@gkd-kit/inspect 0.0.1768900570874 → 0.0.1768904025360
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/404.html +3 -3
- package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-BKq24yyT.js → ActionCard.vue_vue_type_script_setup_true_lang-DgMvuIsb.js} +3 -3
- package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-BKq24yyT.js.map → ActionCard.vue_vue_type_script_setup_true_lang-DgMvuIsb.js.map} +1 -1
- package/dist/assets/DevicePage-3zAjkEzd.js +49 -0
- package/dist/assets/{DevicePage-LsTFe71m.js.map → DevicePage-3zAjkEzd.js.map} +1 -1
- package/dist/assets/{HomePage-Csw7C8jF.js → HomePage-BvzBh-Vr.js} +2 -2
- package/dist/assets/{HomePage-Csw7C8jF.js.map → HomePage-BvzBh-Vr.js.map} +1 -1
- package/dist/assets/ImportPage-Dk8X_JGB.js +2 -0
- package/dist/assets/{ImportPage-RGB4LPNf.js.map → ImportPage-Dk8X_JGB.js.map} +1 -1
- package/dist/assets/{Input-ByXBRWmO.js → Input-ByV0CB_Y.js} +2 -2
- package/dist/assets/{Input-ByXBRWmO.js.map → Input-ByV0CB_Y.js.map} +1 -1
- package/dist/assets/{SelectorPage-17Z-Jk1F.js → SelectorPage-CfS5VjGt.js} +2 -2
- package/dist/assets/{SelectorPage-17Z-Jk1F.js.map → SelectorPage-CfS5VjGt.js.map} +1 -1
- package/dist/assets/SnapshotPage-DJ4TKP-N.js +278 -0
- package/dist/assets/SnapshotPage-DJ4TKP-N.js.map +1 -0
- package/dist/assets/{SvgPage-CGTHxB9M.js → SvgPage-D2dxgiWY.js} +2 -2
- package/dist/assets/{SvgPage-CGTHxB9M.js.map → SvgPage-D2dxgiWY.js.map} +1 -1
- package/dist/assets/{TrackGraph-S8eceX9R.js → TrackGraph-CPenoPWC.js} +3 -3
- package/dist/assets/{TrackGraph-S8eceX9R.js.map → TrackGraph-CPenoPWC.js.map} +1 -1
- package/dist/assets/{_404Page-9FO_quL4.js → _404Page-D0N3kA1Q.js} +2 -2
- package/dist/assets/{_404Page-9FO_quL4.js.map → _404Page-D0N3kA1Q.js.map} +1 -1
- package/dist/assets/chunk-P1K29DU6.js +3 -0
- package/dist/assets/{chunk-Cg4L9mG4.js.map → chunk-P1K29DU6.js.map} +1 -1
- package/dist/assets/{dayjs.min-CSVABQRJ.js → dayjs.min-DU0BA-Jn.js} +2 -2
- package/dist/assets/{dayjs.min-CSVABQRJ.js.map → dayjs.min-DU0BA-Jn.js.map} +1 -1
- package/dist/assets/{error-np4WIvmm.js → error-D9nOgvRa.js} +2 -2
- package/dist/assets/{error-np4WIvmm.js.map → error-D9nOgvRa.js.map} +1 -1
- package/dist/assets/{import-C0XCCThd.js → import-CrAhe8hA.js} +2 -2
- package/dist/assets/{import-C0XCCThd.js.map → import-CrAhe8hA.js.map} +1 -1
- package/dist/assets/{index-jqB-Fx47.js → index-Dp1To-Ad.js} +9 -7
- package/dist/assets/index-Dp1To-Ad.js.map +1 -0
- package/dist/assets/{index-xkPltE-0.js → index-DyjSyMgQ.js} +3 -3
- package/dist/assets/{index-xkPltE-0.js.map → index-DyjSyMgQ.js.map} +1 -1
- package/dist/assets/index-_KZR6YQ9.css +1 -0
- package/dist/assets/{jszip.min-MMSrEo5_.js → jszip.min-Cwi5lnGJ.js} +2 -2
- package/dist/assets/{jszip.min-MMSrEo5_.js.map → jszip.min-Cwi5lnGJ.js.map} +1 -1
- package/dist/assets/{node-CUVTs-TZ.js → node-CKyuvX2h.js} +2 -2
- package/dist/assets/{node-CUVTs-TZ.js.map → node-CKyuvX2h.js.map} +1 -1
- package/dist/assets/{snapshot-BR91A-ol.js → snapshot-t-hW_BtQ.js} +2 -2
- package/dist/assets/{snapshot-BR91A-ol.js.map → snapshot-t-hW_BtQ.js.map} +1 -1
- package/dist/assets/{table-Cd44ejmV.js → table-BCs4WvKN.js} +2 -2
- package/dist/assets/{table-Cd44ejmV.js.map → table-BCs4WvKN.js.map} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/DevicePage-LsTFe71m.js +0 -49
- package/dist/assets/ImportPage-RGB4LPNf.js +0 -2
- package/dist/assets/SnapshotPage-gqLV0Ajt.js +0 -278
- package/dist/assets/SnapshotPage-gqLV0Ajt.js.map +0 -1
- package/dist/assets/chunk-Cg4L9mG4.js +0 -3
- package/dist/assets/index-Br8FJwQH.css +0 -1
- package/dist/assets/index-jqB-Fx47.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as Sf,y as d_,z as HU,A as GU,C as KU,D as zU,E as VU}from"./node-
|
|
1
|
+
import{S as Sf,y as d_,z as HU,A as GU,C as KU,D as zU,E as VU}from"./node-CKyuvX2h.js";import{bP as Qh,cG as f_,b9 as nc,cF as H1,h as jU,av as WU,F as qU,D as pb,o as $U,s as uA,H as YU,Q as XU,aY as yb}from"./index-Dp1To-Ad.js";import{t as ZU}from"./index-DyjSyMgQ.js";function JU(){}function eP(r,e,t,n){for(var i=r.length,a=t+-1;++a<i;)if(e(r[a],a,r))return a;return-1}function tP(r){return r!==r}function nP(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function rP(r,e,t){return e===e?nP(r,e,t):eP(r,tP,t)}function iP(r,e){var t=r==null?0:r.length;return!!t&&rP(r,e,0)>-1}var aP=1/0,sP=Sf&&1/d_(new Sf([,-0]))[1]==aP?function(r){return new Sf(r)}:JU,oP=200;function AP(r,e,t){var n=-1,i=iP,a=r.length,s=!0,o=[],A=o;if(a>=oP){var l=e?null:sP(r);if(l)return d_(l);s=!1,i=GU,A=new HU}else A=e?[]:o;e:for(;++n<a;){var c=r[n],u=e?e(c):c;if(c=c!==0?c:0,s&&u===u){for(var h=A.length;h--;)if(A[h]===u)continue e;e&&A.push(u),o.push(c)}else i(A,u,t)||(A!==o&&A.push(u),o.push(c))}return o}function lP(r,e){return r&&r.length?AP(r,KU(e)):[]}function Ya(r){"@babel/helpers - typeof";return Ya=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ya(r)}function cP(r,e){if(Ya(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(Ya(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function g_(r){var e=cP(r,"string");return Ya(e)=="symbol"?e:e+""}function Ee(r,e,t){return(e=g_(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mb(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function De(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mb(Object(t),!0).forEach(function(n){Ee(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):mb(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ue(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function wb(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,g_(n.key),n)}}function he(r,e,t){return e&&wb(r.prototype,e),t&&wb(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function Hu(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function uP(r){if(Array.isArray(r))return Hu(r)}function hP(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function G1(r,e){if(r){if(typeof r=="string")return Hu(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Hu(r,e):void 0}}function dP(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tt(r){return uP(r)||hP(r)||G1(r)||dP()}function Ho(r){return Ho=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ho(r)}function v_(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v_=function(){return!!r})()}function fP(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function gP(r,e){if(e&&(Ya(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fP(r)}function qe(r,e,t){return e=Ho(e),gP(r,v_()?Reflect.construct(e,t||[],Ho(r).constructor):e.apply(r,t))}function hw(r,e){return hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},hw(r,e)}function $e(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&hw(r,e)}function vP(r){if(Array.isArray(r))return r}function pP(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,a,s,o=[],A=!0,l=!1;try{if(a=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;A=!1}else for(;!(A=(n=a.call(t)).done)&&(o.push(n.value),o.length!==e);A=!0);}catch(c){l=!0,i=c}finally{try{if(!A&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw i}}return o}}function yP(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function We(r,e){return vP(r)||pP(r,e)||G1(r,e)||yP()}var Ff={exports:{}},Bb;function mP(){return Bb||(Bb=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(A,l,c){this.fn=A,this.context=l,this.once=c||!1}function a(A,l,c,u,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,u||A,h),f=t?t+l:l;return A._events[f]?A._events[f].fn?A._events[f]=[A._events[f],d]:A._events[f].push(d):(A._events[f]=d,A._eventsCount++),A}function s(A,l){--A._eventsCount===0?A._events=new n:delete A._events[l]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)e.call(c,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},o.prototype.listeners=function(l){var c=t?t+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,d=u.length,f=new Array(d);h<d;h++)f[h]=u[h].fn;return f},o.prototype.listenerCount=function(l){var c=t?t+l:l,u=this._events[c];return u?u.fn?1:u.length:0},o.prototype.emit=function(l,c,u,h,d,f){var g=t?t+l:l;if(!this._events[g])return!1;var v=this._events[g],p=arguments.length,y,m;if(v.fn){switch(v.once&&this.removeListener(l,v.fn,void 0,!0),p){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,c),!0;case 3:return v.fn.call(v.context,c,u),!0;case 4:return v.fn.call(v.context,c,u,h),!0;case 5:return v.fn.call(v.context,c,u,h,d),!0;case 6:return v.fn.call(v.context,c,u,h,d,f),!0}for(m=1,y=new Array(p-1);m<p;m++)y[m-1]=arguments[m];v.fn.apply(v.context,y)}else{var B=v.length,C;for(m=0;m<B;m++)switch(v[m].once&&this.removeListener(l,v[m].fn,void 0,!0),p){case 1:v[m].fn.call(v[m].context);break;case 2:v[m].fn.call(v[m].context,c);break;case 3:v[m].fn.call(v[m].context,c,u);break;case 4:v[m].fn.call(v[m].context,c,u,h);break;default:if(!y)for(C=1,y=new Array(p-1);C<p;C++)y[C-1]=arguments[C];v[m].fn.apply(v[m].context,y)}}return!0},o.prototype.on=function(l,c,u){return a(this,l,c,u,!1)},o.prototype.once=function(l,c,u){return a(this,l,c,u,!0)},o.prototype.removeListener=function(l,c,u,h){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return s(this,d),this;var f=this._events[d];if(f.fn)f.fn===c&&(!h||f.once)&&(!u||f.context===u)&&s(this,d);else{for(var g=0,v=[],p=f.length;g<p;g++)(f[g].fn!==c||h&&!f[g].once||u&&f[g].context!==u)&&v.push(f[g]);v.length?this._events[d]=v.length===1?v[0]:v:s(this,d)}return this},o.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&s(this,c)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,r.exports=o})(Ff)),Ff.exports}var wP=mP();const p_=Qh(wP);var Pt=1e-6,mn=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function y_(){var r=new mn(9);return mn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function BP(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function bP(r,e,t,n,i,a,s,o,A){var l=new mn(9);return l[0]=r,l[1]=e,l[2]=t,l[3]=n,l[4]=i,l[5]=a,l[6]=s,l[7]=o,l[8]=A,l}function xt(){var r=new mn(16);return mn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function m_(r){var e=new mn(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function Go(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function w_(r,e,t,n,i,a,s,o,A,l,c,u,h,d,f,g){var v=new mn(16);return v[0]=r,v[1]=e,v[2]=t,v[3]=n,v[4]=i,v[5]=a,v[6]=s,v[7]=o,v[8]=A,v[9]=l,v[10]=c,v[11]=u,v[12]=h,v[13]=d,v[14]=f,v[15]=g,v}function dw(r,e,t,n,i,a,s,o,A,l,c,u,h,d,f,g,v){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=A,r[8]=l,r[9]=c,r[10]=u,r[11]=h,r[12]=d,r[13]=f,r[14]=g,r[15]=v,r}function Xa(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function B_(r,e){if(r===e){var t=e[1],n=e[2],i=e[3],a=e[6],s=e[7],o=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=a,r[11]=e[14],r[12]=i,r[13]=s,r[14]=o}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function Ni(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],s=e[4],o=e[5],A=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],f=e[12],g=e[13],v=e[14],p=e[15],y=t*o-n*s,m=t*A-i*s,B=t*l-a*s,C=n*A-i*o,S=n*l-a*o,F=i*l-a*A,T=c*g-u*f,O=c*v-h*f,_=c*p-d*f,k=u*v-h*g,L=u*p-d*g,U=h*p-d*v,G=y*U-m*L+B*k+C*_-S*O+F*T;return G?(G=1/G,r[0]=(o*U-A*L+l*k)*G,r[1]=(i*L-n*U-a*k)*G,r[2]=(g*F-v*S+p*C)*G,r[3]=(h*S-u*F-d*C)*G,r[4]=(A*_-s*U-l*O)*G,r[5]=(t*U-i*_+a*O)*G,r[6]=(v*B-f*F-p*m)*G,r[7]=(c*F-h*B+d*m)*G,r[8]=(s*L-o*_+l*T)*G,r[9]=(n*_-t*L-a*T)*G,r[10]=(f*S-g*B+p*y)*G,r[11]=(u*B-c*S-d*y)*G,r[12]=(o*O-s*k-A*T)*G,r[13]=(t*k-n*O+i*T)*G,r[14]=(g*m-f*C-v*y)*G,r[15]=(c*C-u*m+h*y)*G,r):null}function EP(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],s=e[4],o=e[5],A=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],f=e[12],g=e[13],v=e[14],p=e[15];return r[0]=o*(h*p-d*v)-u*(A*p-l*v)+g*(A*d-l*h),r[1]=-(n*(h*p-d*v)-u*(i*p-a*v)+g*(i*d-a*h)),r[2]=n*(A*p-l*v)-o*(i*p-a*v)+g*(i*l-a*A),r[3]=-(n*(A*d-l*h)-o*(i*d-a*h)+u*(i*l-a*A)),r[4]=-(s*(h*p-d*v)-c*(A*p-l*v)+f*(A*d-l*h)),r[5]=t*(h*p-d*v)-c*(i*p-a*v)+f*(i*d-a*h),r[6]=-(t*(A*p-l*v)-s*(i*p-a*v)+f*(i*l-a*A)),r[7]=t*(A*d-l*h)-s*(i*d-a*h)+c*(i*l-a*A),r[8]=s*(u*p-d*g)-c*(o*p-l*g)+f*(o*d-l*u),r[9]=-(t*(u*p-d*g)-c*(n*p-a*g)+f*(n*d-a*u)),r[10]=t*(o*p-l*g)-s*(n*p-a*g)+f*(n*l-a*o),r[11]=-(t*(o*d-l*u)-s*(n*d-a*u)+c*(n*l-a*o)),r[12]=-(s*(u*v-h*g)-c*(o*v-A*g)+f*(o*h-A*u)),r[13]=t*(u*v-h*g)-c*(n*v-i*g)+f*(n*h-i*u),r[14]=-(t*(o*v-A*g)-s*(n*v-i*g)+f*(n*A-i*o)),r[15]=t*(o*h-A*u)-s*(n*h-i*u)+c*(n*A-i*o),r}function b_(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],A=r[7],l=r[8],c=r[9],u=r[10],h=r[11],d=r[12],f=r[13],g=r[14],v=r[15],p=e*s-t*a,y=e*o-n*a,m=e*A-i*a,B=t*o-n*s,C=t*A-i*s,S=n*A-i*o,F=l*f-c*d,T=l*g-u*d,O=l*v-h*d,_=c*g-u*f,k=c*v-h*f,L=u*v-h*g;return p*L-y*k+m*_+B*O-C*T+S*F}function tr(r,e,t){var n=e[0],i=e[1],a=e[2],s=e[3],o=e[4],A=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],g=e[12],v=e[13],p=e[14],y=e[15],m=t[0],B=t[1],C=t[2],S=t[3];return r[0]=m*n+B*o+C*u+S*g,r[1]=m*i+B*A+C*h+S*v,r[2]=m*a+B*l+C*d+S*p,r[3]=m*s+B*c+C*f+S*y,m=t[4],B=t[5],C=t[6],S=t[7],r[4]=m*n+B*o+C*u+S*g,r[5]=m*i+B*A+C*h+S*v,r[6]=m*a+B*l+C*d+S*p,r[7]=m*s+B*c+C*f+S*y,m=t[8],B=t[9],C=t[10],S=t[11],r[8]=m*n+B*o+C*u+S*g,r[9]=m*i+B*A+C*h+S*v,r[10]=m*a+B*l+C*d+S*p,r[11]=m*s+B*c+C*f+S*y,m=t[12],B=t[13],C=t[14],S=t[15],r[12]=m*n+B*o+C*u+S*g,r[13]=m*i+B*A+C*h+S*v,r[14]=m*a+B*l+C*d+S*p,r[15]=m*s+B*c+C*f+S*y,r}function ko(r,e,t){var n=t[0],i=t[1],a=t[2],s,o,A,l,c,u,h,d,f,g,v,p;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*a+e[12],r[13]=e[1]*n+e[5]*i+e[9]*a+e[13],r[14]=e[2]*n+e[6]*i+e[10]*a+e[14],r[15]=e[3]*n+e[7]*i+e[11]*a+e[15]):(s=e[0],o=e[1],A=e[2],l=e[3],c=e[4],u=e[5],h=e[6],d=e[7],f=e[8],g=e[9],v=e[10],p=e[11],r[0]=s,r[1]=o,r[2]=A,r[3]=l,r[4]=c,r[5]=u,r[6]=h,r[7]=d,r[8]=f,r[9]=g,r[10]=v,r[11]=p,r[12]=s*n+c*i+f*a+e[12],r[13]=o*n+u*i+g*a+e[13],r[14]=A*n+h*i+v*a+e[14],r[15]=l*n+d*i+p*a+e[15]),r}function E_(r,e,t){var n=t[0],i=t[1],a=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*i,r[6]=e[6]*i,r[7]=e[7]*i,r[8]=e[8]*a,r[9]=e[9]*a,r[10]=e[10]*a,r[11]=e[11]*a,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function xP(r,e,t,n){var i=n[0],a=n[1],s=n[2],o=Math.hypot(i,a,s),A,l,c,u,h,d,f,g,v,p,y,m,B,C,S,F,T,O,_,k,L,U,G,W;return o<Pt?null:(o=1/o,i*=o,a*=o,s*=o,A=Math.sin(t),l=Math.cos(t),c=1-l,u=e[0],h=e[1],d=e[2],f=e[3],g=e[4],v=e[5],p=e[6],y=e[7],m=e[8],B=e[9],C=e[10],S=e[11],F=i*i*c+l,T=a*i*c+s*A,O=s*i*c-a*A,_=i*a*c-s*A,k=a*a*c+l,L=s*a*c+i*A,U=i*s*c+a*A,G=a*s*c-i*A,W=s*s*c+l,r[0]=u*F+g*T+m*O,r[1]=h*F+v*T+B*O,r[2]=d*F+p*T+C*O,r[3]=f*F+y*T+S*O,r[4]=u*_+g*k+m*L,r[5]=h*_+v*k+B*L,r[6]=d*_+p*k+C*L,r[7]=f*_+y*k+S*L,r[8]=u*U+g*G+m*W,r[9]=h*U+v*G+B*W,r[10]=d*U+p*G+C*W,r[11]=f*U+y*G+S*W,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function x_(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[4],s=e[5],o=e[6],A=e[7],l=e[8],c=e[9],u=e[10],h=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=a*i+l*n,r[5]=s*i+c*n,r[6]=o*i+u*n,r[7]=A*i+h*n,r[8]=l*i-a*n,r[9]=c*i-s*n,r[10]=u*i-o*n,r[11]=h*i-A*n,r}function C_(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[0],s=e[1],o=e[2],A=e[3],l=e[8],c=e[9],u=e[10],h=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=a*i-l*n,r[1]=s*i-c*n,r[2]=o*i-u*n,r[3]=A*i-h*n,r[8]=a*n+l*i,r[9]=s*n+c*i,r[10]=o*n+u*i,r[11]=A*n+h*i,r}function CP(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[0],s=e[1],o=e[2],A=e[3],l=e[4],c=e[5],u=e[6],h=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=a*i+l*n,r[1]=s*i+c*n,r[2]=o*i+u*n,r[3]=A*i+h*n,r[4]=l*i-a*n,r[5]=c*i-s*n,r[6]=u*i-o*n,r[7]=h*i-A*n,r}function Ia(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function bs(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function S_(r,e,t){var n=t[0],i=t[1],a=t[2],s=Math.hypot(n,i,a),o,A,l;return s<Pt?null:(s=1/s,n*=s,i*=s,a*=s,o=Math.sin(e),A=Math.cos(e),l=1-A,r[0]=n*n*l+A,r[1]=i*n*l+a*o,r[2]=a*n*l-i*o,r[3]=0,r[4]=n*i*l-a*o,r[5]=i*i*l+A,r[6]=a*i*l+n*o,r[7]=0,r[8]=n*a*l+i*o,r[9]=i*a*l-n*o,r[10]=a*a*l+A,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function F_(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function T_(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function fw(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function M_(r,e,t){var n=e[0],i=e[1],a=e[2],s=e[3],o=n+n,A=i+i,l=a+a,c=n*o,u=n*A,h=n*l,d=i*A,f=i*l,g=a*l,v=s*o,p=s*A,y=s*l;return r[0]=1-(d+g),r[1]=u+y,r[2]=h-p,r[3]=0,r[4]=u-y,r[5]=1-(c+g),r[6]=f+v,r[7]=0,r[8]=h+p,r[9]=f-v,r[10]=1-(c+d),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function SP(r,e){var t=new mn(3),n=-e[0],i=-e[1],a=-e[2],s=e[3],o=e[4],A=e[5],l=e[6],c=e[7],u=n*n+i*i+a*a+s*s;return u>0?(t[0]=(o*s+c*n+A*a-l*i)*2/u,t[1]=(A*s+c*i+l*n-o*a)*2/u,t[2]=(l*s+c*a+o*i-A*n)*2/u):(t[0]=(o*s+c*n+A*a-l*i)*2,t[1]=(A*s+c*i+l*n-o*a)*2,t[2]=(l*s+c*a+o*i-A*n)*2),M_(r,e,t),r}function Gu(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function Ko(r,e){var t=e[0],n=e[1],i=e[2],a=e[4],s=e[5],o=e[6],A=e[8],l=e[9],c=e[10];return r[0]=Math.hypot(t,n,i),r[1]=Math.hypot(a,s,o),r[2]=Math.hypot(A,l,c),r}function Ku(r,e){var t=new mn(3);Ko(t,e);var n=1/t[0],i=1/t[1],a=1/t[2],s=e[0]*n,o=e[1]*i,A=e[2]*a,l=e[4]*n,c=e[5]*i,u=e[6]*a,h=e[8]*n,d=e[9]*i,f=e[10]*a,g=s+c+f,v=0;return g>0?(v=Math.sqrt(g+1)*2,r[3]=.25*v,r[0]=(u-d)/v,r[1]=(h-A)/v,r[2]=(o-l)/v):s>c&&s>f?(v=Math.sqrt(1+s-c-f)*2,r[3]=(u-d)/v,r[0]=.25*v,r[1]=(o+l)/v,r[2]=(h+A)/v):c>f?(v=Math.sqrt(1+c-s-f)*2,r[3]=(h-A)/v,r[0]=(o+l)/v,r[1]=.25*v,r[2]=(u+d)/v):(v=Math.sqrt(1+f-s-c)*2,r[3]=(o-l)/v,r[0]=(h+A)/v,r[1]=(u+d)/v,r[2]=.25*v),r}function FP(r,e,t,n){var i=e[0],a=e[1],s=e[2],o=e[3],A=i+i,l=a+a,c=s+s,u=i*A,h=i*l,d=i*c,f=a*l,g=a*c,v=s*c,p=o*A,y=o*l,m=o*c,B=n[0],C=n[1],S=n[2];return r[0]=(1-(f+v))*B,r[1]=(h+m)*B,r[2]=(d-y)*B,r[3]=0,r[4]=(h-m)*C,r[5]=(1-(u+v))*C,r[6]=(g+p)*C,r[7]=0,r[8]=(d+y)*S,r[9]=(g-p)*S,r[10]=(1-(u+f))*S,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function qA(r,e,t,n,i){var a=e[0],s=e[1],o=e[2],A=e[3],l=a+a,c=s+s,u=o+o,h=a*l,d=a*c,f=a*u,g=s*c,v=s*u,p=o*u,y=A*l,m=A*c,B=A*u,C=n[0],S=n[1],F=n[2],T=i[0],O=i[1],_=i[2],k=(1-(g+p))*C,L=(d+B)*C,U=(f-m)*C,G=(d-B)*S,W=(1-(h+p))*S,V=(v+y)*S,K=(f+m)*F,D=(v-y)*F,X=(1-(h+g))*F;return r[0]=k,r[1]=L,r[2]=U,r[3]=0,r[4]=G,r[5]=W,r[6]=V,r[7]=0,r[8]=K,r[9]=D,r[10]=X,r[11]=0,r[12]=t[0]+T-(k*T+G*O+K*_),r[13]=t[1]+O-(L*T+W*O+D*_),r[14]=t[2]+_-(U*T+V*O+X*_),r[15]=1,r}function K1(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],s=t+t,o=n+n,A=i+i,l=t*s,c=n*s,u=n*o,h=i*s,d=i*o,f=i*A,g=a*s,v=a*o,p=a*A;return r[0]=1-u-f,r[1]=c+p,r[2]=h-v,r[3]=0,r[4]=c-p,r[5]=1-l-f,r[6]=d+g,r[7]=0,r[8]=h+v,r[9]=d-g,r[10]=1-l-u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function TP(r,e,t,n,i,a,s){var o=1/(t-e),A=1/(i-n),l=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*A,r[6]=0,r[7]=0,r[8]=(t+e)*o,r[9]=(i+n)*A,r[10]=(s+a)*l,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*l,r[15]=0,r}function O_(r,e,t,n,i){var a=1/Math.tan(e/2),s;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(s=1/(n-i),r[10]=(i+n)*s,r[14]=2*i*n*s):(r[10]=-1,r[14]=-2*n),r}var MP=O_;function OP(r,e,t,n,i){var a=1/Math.tan(e/2),s;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(s=1/(n-i),r[10]=i*s,r[14]=i*n*s):(r[10]=-1,r[14]=-n),r}function _P(r,e,t,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),A=2/(s+o),l=2/(i+a);return r[0]=A,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=-((s-o)*A*.5),r[9]=(i-a)*l*.5,r[10]=n/(t-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*t/(t-n),r[15]=0,r}function __(r,e,t,n,i,a,s){var o=1/(e-t),A=1/(n-i),l=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*A,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*l,r[11]=0,r[12]=(e+t)*o,r[13]=(i+n)*A,r[14]=(s+a)*l,r[15]=1,r}var I_=__;function k_(r,e,t,n,i,a,s){var o=1/(e-t),A=1/(n-i),l=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*A,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=l,r[11]=0,r[12]=(e+t)*o,r[13]=(i+n)*A,r[14]=a*l,r[15]=1,r}function L_(r,e,t,n){var i,a,s,o,A,l,c,u,h,d,f=e[0],g=e[1],v=e[2],p=n[0],y=n[1],m=n[2],B=t[0],C=t[1],S=t[2];return Math.abs(f-B)<Pt&&Math.abs(g-C)<Pt&&Math.abs(v-S)<Pt?Xa(r):(c=f-B,u=g-C,h=v-S,d=1/Math.hypot(c,u,h),c*=d,u*=d,h*=d,i=y*h-m*u,a=m*c-p*h,s=p*u-y*c,d=Math.hypot(i,a,s),d?(d=1/d,i*=d,a*=d,s*=d):(i=0,a=0,s=0),o=u*s-h*a,A=h*i-c*s,l=c*a-u*i,d=Math.hypot(o,A,l),d?(d=1/d,o*=d,A*=d,l*=d):(o=0,A=0,l=0),r[0]=i,r[1]=o,r[2]=c,r[3]=0,r[4]=a,r[5]=A,r[6]=u,r[7]=0,r[8]=s,r[9]=l,r[10]=h,r[11]=0,r[12]=-(i*f+a*g+s*v),r[13]=-(o*f+A*g+l*v),r[14]=-(c*f+u*g+h*v),r[15]=1,r)}function IP(r,e,t,n){var i=e[0],a=e[1],s=e[2],o=n[0],A=n[1],l=n[2],c=i-t[0],u=a-t[1],h=s-t[2],d=c*c+u*u+h*h;d>0&&(d=1/Math.sqrt(d),c*=d,u*=d,h*=d);var f=A*h-l*u,g=l*c-o*h,v=o*u-A*c;return d=f*f+g*g+v*v,d>0&&(d=1/Math.sqrt(d),f*=d,g*=d,v*=d),r[0]=f,r[1]=g,r[2]=v,r[3]=0,r[4]=u*v-h*g,r[5]=h*f-c*v,r[6]=c*g-u*f,r[7]=0,r[8]=c,r[9]=u,r[10]=h,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function kP(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function LP(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function QP(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}function Q_(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}function NP(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}function UP(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r[9]=e[9]+t[9]*n,r[10]=e[10]+t[10]*n,r[11]=e[11]+t[11]*n,r[12]=e[12]+t[12]*n,r[13]=e[13]+t[13]*n,r[14]=e[14]+t[14]*n,r[15]=e[15]+t[15]*n,r}function gw(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}function PP(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],A=r[6],l=r[7],c=r[8],u=r[9],h=r[10],d=r[11],f=r[12],g=r[13],v=r[14],p=r[15],y=e[0],m=e[1],B=e[2],C=e[3],S=e[4],F=e[5],T=e[6],O=e[7],_=e[8],k=e[9],L=e[10],U=e[11],G=e[12],W=e[13],V=e[14],K=e[15];return Math.abs(t-y)<=Pt*Math.max(1,Math.abs(t),Math.abs(y))&&Math.abs(n-m)<=Pt*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(i-B)<=Pt*Math.max(1,Math.abs(i),Math.abs(B))&&Math.abs(a-C)<=Pt*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(s-S)<=Pt*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(o-F)<=Pt*Math.max(1,Math.abs(o),Math.abs(F))&&Math.abs(A-T)<=Pt*Math.max(1,Math.abs(A),Math.abs(T))&&Math.abs(l-O)<=Pt*Math.max(1,Math.abs(l),Math.abs(O))&&Math.abs(c-_)<=Pt*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(u-k)<=Pt*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(h-L)<=Pt*Math.max(1,Math.abs(h),Math.abs(L))&&Math.abs(d-U)<=Pt*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(f-G)<=Pt*Math.max(1,Math.abs(f),Math.abs(G))&&Math.abs(g-W)<=Pt*Math.max(1,Math.abs(g),Math.abs(W))&&Math.abs(v-V)<=Pt*Math.max(1,Math.abs(v),Math.abs(V))&&Math.abs(p-K)<=Pt*Math.max(1,Math.abs(p),Math.abs(K))}var N_=tr,RP=Q_;const DP=Object.freeze(Object.defineProperty({__proto__:null,add:QP,adjoint:EP,clone:m_,copy:Go,create:xt,determinant:b_,equals:PP,exactEquals:gw,frob:LP,fromQuat:K1,fromQuat2:SP,fromRotation:S_,fromRotationTranslation:M_,fromRotationTranslationScale:FP,fromRotationTranslationScaleOrigin:qA,fromScaling:bs,fromTranslation:Ia,fromValues:w_,fromXRotation:F_,fromYRotation:T_,fromZRotation:fw,frustum:TP,getRotation:Ku,getScaling:Ko,getTranslation:Gu,identity:Xa,invert:Ni,lookAt:L_,mul:N_,multiply:tr,multiplyScalar:NP,multiplyScalarAndAdd:UP,ortho:I_,orthoNO:__,orthoZO:k_,perspective:MP,perspectiveFromFieldOfView:_P,perspectiveNO:O_,perspectiveZO:OP,rotate:xP,rotateX:x_,rotateY:C_,rotateZ:CP,scale:E_,set:dw,str:kP,sub:RP,subtract:Q_,targetTo:IP,translate:ko,transpose:B_},Symbol.toStringTag,{value:"Module"}));function Ze(){var r=new mn(3);return mn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function aa(r){var e=new mn(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function oa(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}function Ct(r,e,t){var n=new mn(3);return n[0]=r,n[1]=e,n[2]=t,n}function Ui(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function er(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function Va(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function vw(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function HP(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function GP(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function KP(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function zu(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function zP(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return Math.hypot(t,n,i)}function _s(r,e){var t=e[0],n=e[1],i=e[2],a=t*t+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r[2]=e[2]*a,r}function Pi(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Cu(r,e,t){var n=e[0],i=e[1],a=e[2],s=t[0],o=t[1],A=t[2];return r[0]=i*A-a*o,r[1]=a*s-n*A,r[2]=n*o-i*s,r}function pw(r,e,t,n){var i=e[0],a=e[1],s=e[2];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=s+n*(t[2]-s),r}function nr(r,e,t){var n=e[0],i=e[1],a=e[2],s=t[3]*n+t[7]*i+t[11]*a+t[15];return s=s||1,r[0]=(t[0]*n+t[4]*i+t[8]*a+t[12])/s,r[1]=(t[1]*n+t[5]*i+t[9]*a+t[13])/s,r[2]=(t[2]*n+t[6]*i+t[10]*a+t[14])/s,r}function VP(r,e,t){var n=e[0],i=e[1],a=e[2];return r[0]=n*t[0]+i*t[3]+a*t[6],r[1]=n*t[1]+i*t[4]+a*t[7],r[2]=n*t[2]+i*t[5]+a*t[8],r}function jP(r,e,t){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],A=e[1],l=e[2],c=i*l-a*A,u=a*o-n*l,h=n*A-i*o,d=i*h-a*u,f=a*c-n*h,g=n*u-i*c,v=s*2;return c*=v,u*=v,h*=v,d*=2,f*=2,g*=2,r[0]=o+c+d,r[1]=A+u+f,r[2]=l+h+g,r}function hA(r,e){var t=r[0],n=r[1],i=r[2],a=e[0],s=e[1],o=e[2];return Math.abs(t-a)<=Pt*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-s)<=Pt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=Pt*Math.max(1,Math.abs(i),Math.abs(o))}var U_=vw,bb=zP,P_=oa;(function(){var r=Ze();return function(e,t,n,i,a,s){var o,A;for(t||(t=3),n||(n=0),i?A=Math.min(i*t+n,e.length):A=e.length,o=n;o<A;o+=t)r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],a(r,r,s),e[o]=r[0],e[o+1]=r[1],e[o+2]=r[2];return e}})();function Ri(){var r=new mn(4);return mn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function TA(r,e,t,n){var i=new mn(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function WP(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function qP(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function $P(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],s=t*t+n*n+i*i+a*a;return s>0&&(s=1/Math.sqrt(s)),r[0]=t*s,r[1]=n*s,r[2]=i*s,r[3]=a*s,r}function ua(r,e,t){var n=e[0],i=e[1],a=e[2],s=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*a+t[12]*s,r[1]=t[1]*n+t[5]*i+t[9]*a+t[13]*s,r[2]=t[2]*n+t[6]*i+t[10]*a+t[14]*s,r[3]=t[3]*n+t[7]*i+t[11]*a+t[15]*s,r}(function(){var r=Ri();return function(e,t,n,i,a,s){var o,A;for(t||(t=4),n||(n=0),i?A=Math.min(i*t+n,e.length):A=e.length,o=n;o<A;o+=t)r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],r[3]=e[o+3],a(r,r,s),e[o]=r[0],e[o+1]=r[1],e[o+2]=r[2],e[o+3]=r[3];return e}})();function gn(){var r=new mn(4);return mn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function La(r,e,t){t=t*.5;var n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function ja(r,e,t){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],A=t[1],l=t[2],c=t[3];return r[0]=n*c+s*o+i*l-a*A,r[1]=i*c+s*A+a*o-n*l,r[2]=a*c+s*l+n*A-i*o,r[3]=s*c-n*o-i*A-a*l,r}function Tf(r,e,t,n){var i=e[0],a=e[1],s=e[2],o=e[3],A=t[0],l=t[1],c=t[2],u=t[3],h,d,f,g,v;return d=i*A+a*l+s*c+o*u,d<0&&(d=-d,A=-A,l=-l,c=-c,u=-u),1-d>Pt?(h=Math.acos(d),f=Math.sin(h),g=Math.sin((1-n)*h)/f,v=Math.sin(n*h)/f):(g=1-n,v=n),r[0]=g*i+v*A,r[1]=g*a+v*l,r[2]=g*s+v*c,r[3]=g*o+v*u,r}function Mf(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],s=t*t+n*n+i*i+a*a,o=s?1/s:0;return r[0]=-t*o,r[1]=-n*o,r[2]=-i*o,r[3]=a*o,r}function YP(r,e){var t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[a*3+a]-e[s*3+s]+1),r[i]=.5*n,n=.5/n,r[3]=(e[a*3+s]-e[s*3+a])*n,r[a]=(e[a*3+i]+e[i*3+a])*n,r[s]=(e[s*3+i]+e[i*3+s])*n}return r}function rc(r,e,t,n){var i=.5*Math.PI/180;e*=i,t*=i,n*=i;var a=Math.sin(e),s=Math.cos(e),o=Math.sin(t),A=Math.cos(t),l=Math.sin(n),c=Math.cos(n);return r[0]=a*A*c-s*o*l,r[1]=s*o*c+a*A*l,r[2]=s*A*l-a*o*c,r[3]=s*A*c+a*o*l,r}var XP=TA,ic=WP,R_=qP,Eb=ja,Vu=$P;(function(){var r=Ze(),e=Ct(1,0,0),t=Ct(0,1,0);return function(n,i,a){var s=Pi(i,a);return s<-.999999?(Cu(r,e,i),P_(r)<1e-6&&Cu(r,t,i),_s(r,r),La(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Cu(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,Vu(n,n))}})();(function(){var r=gn(),e=gn();return function(t,n,i,a,s,o){return Tf(r,n,s,o),Tf(e,i,a,o),Tf(t,r,e,2*o*(1-o)),t}})();(function(){var r=y_();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],Vu(e,YP(e,r))}})();function z1(){var r=new mn(2);return mn!=Float32Array&&(r[0]=0,r[1]=0),r}function ZP(r,e){return r[0]=e[0],r[1]=e[1],r}function JP(r,e,t){return r[0]=e,r[1]=t,r}function eR(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r}function tR(r,e){return r[0]*e[0]+r[1]*e[1]}function nR(r,e){return r[0]===e[0]&&r[1]===e[1]}(function(){var r=z1();return function(e,t,n,i,a,s){var o,A;for(t||(t=2),n||(n=0),i?A=Math.min(i*t+n,e.length):A=e.length,o=n;o<A;o+=t)r[0]=e[o],r[1]=e[o+1],a(r,r,s),e[o]=r[0],e[o+1]=r[1];return e}})();var al=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},rR=function(r,e){return al(r)?r.indexOf(e)>-1:!1},iR=function(r,e){if(!al(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},aR=function(r,e){return e===void 0&&(e=[]),iR(r,function(t){return!rR(e,t)})};function Te(r){return typeof r=="function"}function ke(r){return r==null}function Mr(r){return Array.isArray(r)}const un=(function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"});function D_(r,e){if(r){var t;if(Mr(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(un(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var yw=function(r){return typeof r=="object"&&r!==null},sR={}.toString,H_=function(r,e){return sR.call(r)==="[object "+e+"]"},zo=function(r){if(!yw(r)||!H_(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var e=r;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e},oR=function(r){if(!Mr(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e};function ju(r){if(!Array.isArray(r))return-1/0;var e=r.length;if(!e)return-1/0;for(var t=r[0],n=1;n<e;n++)t=Math.max(t,r[n]);return t}const Wu=(function(r){if(Mr(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])});var AR=function(r,e,t){if(!Mr(r)&&!zo(r))return r;var n=t;return D_(r,function(i,a){n=e(n,i,a)}),n};function At(r){return typeof r=="string"}function lR(r,e){e===void 0&&(e=new Map);var t=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];e.has(a)||(t.push(a),e.set(a,!0))}return t}var cR=Object.prototype.hasOwnProperty;function Nh(r,e){if(!e||!Mr(r))return{};for(var t={},n=Te(e)?e:function(o){return o[e]},i,a=0;a<r.length;a++){var s=r[a];i=n(s),cR.call(t,i)?t[i].push(s):t[i]=[s]}return t}var Yt=function(r,e,t){return r<e?e:r>t?t:r};function Be(r){return typeof r=="number"}var uR=1e-5;function Lo(r,e,t){return t===void 0&&(t=uR),r===e||Math.abs(r-e)<t}const hR=(function(r,e){if(Mr(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],s=Te(e)?e(a):a[e];s>n&&(t=a,n=s)}return t}}),dR=(function(r,e){if(Mr(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],s=Te(e)?e(a):a[e];s<n&&(t=a,n=s)}return t}});var G_=function(r,e){return(r%e+e)%e};const K_=(function(r){return ke(r)?"":r.toString()});var fR=function(r){var e=K_(r);return e.charAt(0).toLowerCase()+e.substring(1)};function gR(r,e){return!r||!e?r:r.replace(/\\?\{([^{}]+)\}/g,function(t,n){return t.charAt(0)==="\\"?t.slice(1):e[n]===void 0?"":e[n]})}var qu=function(r){var e=K_(r);return e.charAt(0).toUpperCase()+e.substring(1)},vR={}.toString,pR=function(r){return vR.call(r).replace(/^\[object /,"").replace(/]$/,"")},sl=function(r){return H_(r,"Boolean")};function yR(r){return r instanceof Date}function mR(r){return r===null}var wR=Object.prototype,BR=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||wR;return r===t},He=function(r){return r===void 0};function bR(r){return r instanceof Element||r instanceof Document}function xb(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function ER(r,e,t,n){return e&&xb(r,e),t&&xb(r,t),r}var Za=function(r){if(typeof r!="object"||r===null)return r;var e;if(Mr(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=Za(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=Za(r[i]):e[i]=r[i]}return e};function Sl(r,e,t){var n;return function(){var i=this,a=arguments,s=function(){n=null,r.apply(i,a)};clearTimeout(n),n=setTimeout(s,e)}}function xR(r){var e,t,n,i=r||1;function a(o,A){++e>i&&(n=t,s(1),++e),t[o]=A}function s(o){e=0,t=Object.create(null),o||(n=Object.create(null))}return s(),{clear:s,has:function(o){return t[o]!==void 0||n[o]!==void 0},get:function(o){var A=t[o];if(A!==void 0)return A;if((A=n[o])!==void 0)return a(o,A),A},set:function(o,A){t[o]!==void 0?t[o]=A:a(o,A)}}}var Of=new Map;function mw(r,e,t){t===void 0&&(t=128);var n=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=e?e.apply(this,i):i[0];Of.has(r)||Of.set(r,xR(t));var o=Of.get(r);if(o.has(s))return o.get(s);var A=r.apply(this,i);return o.set(s,A),A};return n}var CR=5;function SR(r,e){if(Object.hasOwn)return Object.hasOwn(r,e);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),e)}function z_(r,e,t,n){t=t||0,n=n||CR;for(var i in e)if(SR(e,i)){var a=e[i];a!==null&&zo(a)?(zo(r[i])||(r[i]={}),t<n?z_(r[i],a,t+1,n):r[i]=e[i]):Mr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var zn=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n+=1)z_(r,e[n]);return r},FR=Object.prototype.hasOwnProperty;function Qi(r){if(ke(r))return!0;if(al(r))return!r.length;var e=pR(r);if(e==="Map"||e==="Set")return!r.size;if(BR(r))return!Object.keys(r).length;for(var t in r)if(FR.call(r,t))return!1;return!0}var Xt=function(r,e){if(r===e)return!0;if(!r||!e||At(r)||At(e))return!1;if(al(r)||al(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=Xt(r[n],e[n]),!!t);n++);return t}if(yw(r)||yw(e)){var i=Object.keys(r),a=Object.keys(e);if(i.length!==a.length)return!1;for(var t=!0,n=0;n<i.length&&(t=Xt(r[i[n]],e[i[n]]),!!t);n++);return t}return!1};const Rn=(function(r,e,t){for(var n=0,i=At(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r}),ol=(function(r,e,t){var n=r,i=At(e)?e.split("."):e;return i.forEach(function(a,s){s<i.length-1?(un(n[a])||(n[a]=Be(i[s+1])?[]:{}),n=n[a]):n[a]=t}),r});var TR=Object.prototype.hasOwnProperty;const Ds=(function(r,e){if(r===null||!zo(r))return{};var t={};return D_(e,function(n){TR.call(r,n)&&(t[n]=r[n])}),t}),V1=(function(r,e){return AR(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})}),V_=(function(r,e,t){var n,i,a,s,o=0;t||(t={});var A=function(){o=t.leading===!1?0:Date.now(),n=null,s=r.apply(i,a),n||(i=a=null)},l=function(){var c=Date.now();!o&&t.leading===!1&&(o=c);var u=e-(c-o);return i=this,a=arguments,u<=0||u>e?(n&&(clearTimeout(n),n=null),o=c,s=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(A,u)),s};return l.cancel=function(){clearTimeout(n),o=0,n=i=a=null},l});var ac={};const MR=(function(r){return r=r||"g",ac[r]?ac[r]+=1:ac[r]=1,r+ac[r]}),_f=(function(){}),ww=(function(r){return r});var Bw=function(r,e){return Bw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Bw(r,e)};function Xe(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Bw(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var le=function(){return le=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},le.apply(this,arguments)};function Dt(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Je(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})}function Fl(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return a}function OR(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n}function _e(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}function If(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}var j_={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function _R(r,e,t){if(r[t].length>7){r[t].shift();for(var n=r[t],i=t;n.length;)e[t]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(t,1)}}var $A={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function W_(r){return Array.isArray(r)&&r.every(function(e){var t=e[0].toLowerCase();return $A[t]===e.length-1&&"achlmqstvz".includes(t)})}function q_(r){return W_(r)&&r.every(function(e){var t=e[0];return t===t.toUpperCase()})}function $_(r){return q_(r)&&r.every(function(e){var t=e[0];return"ACLMQZ".includes(t)})}function Cb(r){for(var e=r.pathValue[r.segmentStart],t=e.toLowerCase(),n=r.data;n.length>=$A[t]&&(t==="m"&&n.length>2?(r.segments.push([e].concat(n.splice(0,2))),t="l",e=e==="m"?"l":"L"):r.segments.push([e].concat(n.splice(0,$A[t]))),!!$A[t]););}function IR(r){var e=r.index,t=r.pathValue,n=t.charCodeAt(e);if(n===48){r.param=0,r.index+=1;return}if(n===49){r.param=1,r.index+=1;return}r.err='[path-util]: invalid Arc flag "'.concat(t[e],'", expecting 0 or 1 at index ').concat(e)}function kR(r){return r>=48&&r<=57||r===43||r===45||r===46}function so(r){return r>=48&&r<=57}function LR(r){var e=r.max,t=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,A=!1,l;if(i>=e){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(l=t.charCodeAt(i),(l===43||l===45)&&(i+=1,l=t.charCodeAt(i)),!so(l)&&l!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(t[i],'" is not a number');return}if(l!==46){if(a=l===48,i+=1,l=t.charCodeAt(i),a&&i<e&&l&&so(l)){r.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(t[n],'" illegal number');return}for(;i<e&&so(t.charCodeAt(i));)i+=1,s=!0;l=t.charCodeAt(i)}if(l===46){for(A=!0,i+=1;so(t.charCodeAt(i));)i+=1,o=!0;l=t.charCodeAt(i)}if(l===101||l===69){if(A&&!s&&!o){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(t[i],'" invalid float exponent');return}if(i+=1,l=t.charCodeAt(i),(l===43||l===45)&&(i+=1),i<e&&so(t.charCodeAt(i)))for(;i<e&&so(t.charCodeAt(i));)i+=1;else{r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(t[i],'" invalid integer exponent');return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function QR(r){var e=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];return r===10||r===13||r===8232||r===8233||r===32||r===9||r===11||r===12||r===160||r>=5760&&e.includes(r)}function Su(r){for(var e=r.pathValue,t=r.max;r.index<t&&QR(e.charCodeAt(r.index));)r.index+=1}function NR(r){switch(r|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}function UR(r){return(r|32)===97}function PR(r){var e=r.max,t=r.pathValue,n=r.index,i=t.charCodeAt(n),a=$A[t[n].toLowerCase()];if(r.segmentStart=n,!NR(i)){r.err='[path-util]: Invalid path value "'.concat(t[n],'" is not a path command');return}if(r.index+=1,Su(r),r.data=[],!a){Cb(r);return}for(;;){for(var s=a;s>0;s-=1){if(UR(i)&&(s===3||s===4)?IR(r):LR(r),r.err.length)return;r.data.push(r.param),Su(r),r.index<e&&t.charCodeAt(r.index)===44&&(r.index+=1,Su(r))}if(r.index>=r.max||!kR(t.charCodeAt(r.index)))break}Cb(r)}var RR=(function(){function r(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r})();function DR(r){if(W_(r))return[].concat(r);var e=new RR(r);for(Su(e);e.index<e.max&&!e.err.length;)PR(e);return e.err?e.err:e.segments}function HR(r){if(q_(r))return[].concat(r);var e=DR(r),t=0,n=0,i=0,a=0;return e.map(function(s){var o=s.slice(1).map(Number),A=s[0],l=A.toUpperCase();if(A==="M")return t=o[0],n=o[1],i=t,a=n,["M",t,n];var c;if(A!==l)switch(l){case"A":c=[l,o[0],o[1],o[2],o[3],o[4],o[5]+t,o[6]+n];break;case"V":c=[l,o[0]+n];break;case"H":c=[l,o[0]+t];break;default:{var u=o.map(function(d,f){return d+(f%2?n:t)});c=[l].concat(u)}}else c=[l].concat(o);var h=c.length;switch(l){case"Z":t=i,n=a;break;case"H":t=c[1];break;case"V":n=c[1];break;default:t=c[h-2],n=c[h-1],l==="M"&&(i=t,a=n)}return c})}function GR(r,e){var t=r[0],n=e.x1,i=e.y1,a=e.x2,s=e.y2,o=r.slice(1).map(Number),A=r;if("TQ".includes(t)||(e.qx=null,e.qy=null),t==="H")A=["L",r[1],i];else if(t==="V")A=["L",n,r[1]];else if(t==="S"){var l=n*2-a,c=i*2-s;e.x1=l,e.y1=c,A=["C",l,c].concat(o)}else if(t==="T"){var u=n*2-e.qx,h=i*2-e.qy;e.qx=u,e.qy=h,A=["Q",u,h].concat(o)}else if(t==="Q"){var d=o[0],f=o[1];e.qx=d,e.qy=f}return A}function $u(r){if($_(r))return[].concat(r);for(var e=HR(r),t=le({},j_),n=0;n<e.length;n+=1){e[n]=GR(e[n],t);var i=e[n],a=i.length;t.x1=+i[a-2],t.y1=+i[a-1],t.x2=+i[a-4]||t.x1,t.y2=+i[a-3]||t.y1}return e}function KR(r){return $_(r)&&r.every(function(e){var t=e[0];return"MC".includes(t)})}function sc(r,e,t){var n=r*Math.cos(t)-e*Math.sin(t),i=r*Math.sin(t)+e*Math.cos(t);return{x:n,y:i}}function j1(r,e,t,n,i,a,s,o,A,l){var c=r,u=e,h=t,d=n,f=o,g=A,v=Math.PI*120/180,p=Math.PI/180*(+i||0),y=[],m,B,C,S,F;if(l)B=l[0],C=l[1],S=l[2],F=l[3];else{m=sc(c,u,-p),c=m.x,u=m.y,m=sc(f,g,-p),f=m.x,g=m.y;var T=(c-f)/2,O=(u-g)/2,_=T*T/(h*h)+O*O/(d*d);_>1&&(_=Math.sqrt(_),h*=_,d*=_);var k=h*h,L=d*d,U=(a===s?-1:1)*Math.sqrt(Math.abs((k*L-k*O*O-L*T*T)/(k*O*O+L*T*T)));S=U*h*O/d+(c+f)/2,F=U*-d*T/h+(u+g)/2,B=Math.asin(((u-F)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),C=Math.asin(((g-F)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),B=c<S?Math.PI-B:B,C=f<S?Math.PI-C:C,B<0&&(B=Math.PI*2+B),C<0&&(C=Math.PI*2+C),s&&B>C&&(B-=Math.PI*2),!s&&C>B&&(C-=Math.PI*2)}var G=C-B;if(Math.abs(G)>v){var W=C,V=f,K=g;C=B+v*(s&&C>B?1:-1),f=S+h*Math.cos(C),g=F+d*Math.sin(C),y=j1(f,g,h,d,i,0,s,V,K,[C,W,S,F])}G=C-B;var D=Math.cos(B),X=Math.sin(B),te=Math.cos(C),ie=Math.sin(C),re=Math.tan(G/4),xe=4/3*h*re,$=4/3*d*re,z=[c,u],ee=[c+xe*X,u-$*D],Ae=[f+xe*ie,g-$*te],be=[f,g];if(ee[0]=2*z[0]-ee[0],ee[1]=2*z[1]-ee[1],l)return ee.concat(Ae,be,y);y=ee.concat(Ae,be,y);for(var Le=[],Ue=0,at=y.length;Ue<at;Ue+=1)Le[Ue]=Ue%2?sc(y[Ue-1],y[Ue],p).y:sc(y[Ue],y[Ue+1],p).x;return Le}function zR(r,e,t,n,i,a){var s=.3333333333333333,o=2/3;return[s*r+o*t,s*e+o*n,s*i+o*t,s*a+o*n,i,a]}function Ma(r,e,t){var n=r[0],i=r[1],a=e[0],s=e[1];return[n+(a-n)*t,i+(s-i)*t]}var Sb=function(r,e,t,n){var i=.5,a=Ma([r,e],[t,n],i);return _e(_e([],a,!0),[t,n,t,n],!1)};function VR(r,e){var t=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],s,o=e.x1,A=e.y1,l=e.x,c=e.y;switch("TQ".includes(t)||(e.qx=null,e.qy=null),t){case"M":return e.x=i,e.y=a,r;case"A":return s=[o,A].concat(n),["C"].concat(j1(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]));case"Q":return e.qx=i,e.qy=a,s=[o,A].concat(n),["C"].concat(zR(s[0],s[1],s[2],s[3],s[4],s[5]));case"L":return["C"].concat(Sb(o,A,i,a));case"Z":return o===l&&A===c?["C",o,A,l,c,l,c]:["C"].concat(Sb(o,A,l,c))}return r}function bw(r,e){if(e===void 0&&(e=!1),KR(r)){var t=[].concat(r);return e?[t,[]]:t}for(var n=$u(r),i=le({},j_),a=[],s="",o=n.length,A,l,c=[],u=0;u<o;u+=1){n[u]&&(s=n[u][0]),a[u]=s;var h=VR(n[u],i);n[u]=h,_R(n,a,u),o=n.length,s==="Z"&&c.push(u),A=n[u],l=A.length,i.x1=+A[l-2],i.y1=+A[l-1],i.x2=+A[l-4]||i.x1,i.y2=+A[l-3]||i.y1}return e?[n,c]:n}function jR(r){return r.map(function(e){return Array.isArray(e)?[].concat(e):e})}function WR(r){var e=r.slice(1).map(function(t,n,i){return n?i[n-1].slice(-2).concat(t.slice(1)):r[0].slice(1).concat(t.slice(1))}).map(function(t){return t.map(function(n,i){return t[t.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map(function(t){return["C"].concat(t.slice(2))}))}function wr(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}function Ew(r,e,t,n,i){var a=wr([r,e],[t,n]),s={x:0,y:0};if(typeof i=="number")if(i<=0)s={x:r,y:e};else if(i>=a)s={x:t,y:n};else{var o=Ma([r,e],[t,n],i/a),A=o[0],l=o[1];s={x:A,y:l}}return{length:a,point:s,min:{x:Math.min(r,t),y:Math.min(e,n)},max:{x:Math.max(r,t),y:Math.max(e,n)}}}function Fb(r,e){var t=r.x,n=r.y,i=e.x,a=e.y,s=t*i+n*a,o=Math.sqrt((Math.pow(t,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),A=t*a-n*i<0?-1:1,l=A*Math.acos(s/o);return l}function qR(r,e,t,n,i,a,s,o,A,l){var c=Math.abs,u=Math.sin,h=Math.cos,d=Math.sqrt,f=Math.PI,g=c(t),v=c(n),p=(i%360+360)%360,y=p*(f/180);if(r===o&&e===A)return{x:r,y:e};if(g===0||v===0)return Ew(r,e,o,A,l).point;var m=(r-o)/2,B=(e-A)/2,C={x:h(y)*m+u(y)*B,y:-u(y)*m+h(y)*B},S=Math.pow(C.x,2)/Math.pow(g,2)+Math.pow(C.y,2)/Math.pow(v,2);S>1&&(g*=d(S),v*=d(S));var F=Math.pow(g,2)*Math.pow(v,2)-Math.pow(g,2)*Math.pow(C.y,2)-Math.pow(v,2)*Math.pow(C.x,2),T=Math.pow(g,2)*Math.pow(C.y,2)+Math.pow(v,2)*Math.pow(C.x,2),O=F/T;O=O<0?0:O;var _=(a!==s?1:-1)*d(O),k={x:_*(g*C.y/v),y:_*(-(v*C.x)/g)},L={x:h(y)*k.x-u(y)*k.y+(r+o)/2,y:u(y)*k.x+h(y)*k.y+(e+A)/2},U={x:(C.x-k.x)/g,y:(C.y-k.y)/v},G=Fb({x:1,y:0},U),W={x:(-C.x-k.x)/g,y:(-C.y-k.y)/v},V=Fb(U,W);!s&&V>0?V-=2*f:s&&V<0&&(V+=2*f),V%=2*f;var K=G+V*l,D=g*h(K),X=v*u(K),te={x:h(y)*D-u(y)*X+L.x,y:u(y)*D+h(y)*X+L.y};return te}function $R(r,e,t,n,i,a,s,o,A,l,c){var u,h=c.bbox,d=h===void 0?!0:h,f=c.length,g=f===void 0?!0:f,v=c.sampleSize,p=v===void 0?30:v,y=typeof l=="number",m=r,B=e,C=0,S=[m,B,C],F=[m,B],T=0,O={x:0,y:0},_=[{x:m,y:B}];y&&l<=0&&(O={x:m,y:B});for(var k=0;k<=p;k+=1){if(T=k/p,u=qR(r,e,t,n,i,a,s,o,A,T),m=u.x,B=u.y,d&&_.push({x:m,y:B}),g&&(C+=wr(F,[m,B])),F=[m,B],y&&C>=l&&l>S[2]){var L=(C-l)/(C-S[2]);O={x:F[0]*(1-L)+S[0]*L,y:F[1]*(1-L)+S[1]*L}}S=[m,B,C]}return y&&l>=C&&(O={x:o,y:A}),{length:C,point:O,min:{x:Math.min.apply(null,_.map(function(U){return U.x})),y:Math.min.apply(null,_.map(function(U){return U.y}))},max:{x:Math.max.apply(null,_.map(function(U){return U.x})),y:Math.max.apply(null,_.map(function(U){return U.y}))}}}function YR(r,e,t,n,i,a,s,o,A){var l=1-A;return{x:Math.pow(l,3)*r+3*Math.pow(l,2)*A*t+3*l*Math.pow(A,2)*i+Math.pow(A,3)*s,y:Math.pow(l,3)*e+3*Math.pow(l,2)*A*n+3*l*Math.pow(A,2)*a+Math.pow(A,3)*o}}function Y_(r,e,t,n,i,a,s,o,A,l){var c,u=l.bbox,h=u===void 0?!0:u,d=l.length,f=d===void 0?!0:d,g=l.sampleSize,v=g===void 0?10:g,p=typeof A=="number",y=r,m=e,B=0,C=[y,m,B],S=[y,m],F=0,T={x:0,y:0},O=[{x:y,y:m}];p&&A<=0&&(T={x:y,y:m});for(var _=0;_<=v;_+=1){if(F=_/v,c=YR(r,e,t,n,i,a,s,o,F),y=c.x,m=c.y,h&&O.push({x:y,y:m}),f&&(B+=wr(S,[y,m])),S=[y,m],p&&B>=A&&A>C[2]){var k=(B-A)/(B-C[2]);T={x:S[0]*(1-k)+C[0]*k,y:S[1]*(1-k)+C[1]*k}}C=[y,m,B]}return p&&A>=B&&(T={x:s,y:o}),{length:B,point:T,min:{x:Math.min.apply(null,O.map(function(L){return L.x})),y:Math.min.apply(null,O.map(function(L){return L.y}))},max:{x:Math.max.apply(null,O.map(function(L){return L.x})),y:Math.max.apply(null,O.map(function(L){return L.y}))}}}function XR(r,e,t,n,i,a,s){var o=1-s;return{x:Math.pow(o,2)*r+2*o*s*t+Math.pow(s,2)*i,y:Math.pow(o,2)*e+2*o*s*n+Math.pow(s,2)*a}}function ZR(r,e,t,n,i,a,s,o){var A,l=o.bbox,c=l===void 0?!0:l,u=o.length,h=u===void 0?!0:u,d=o.sampleSize,f=d===void 0?10:d,g=typeof s=="number",v=r,p=e,y=0,m=[v,p,y],B=[v,p],C=0,S={x:0,y:0},F=[{x:v,y:p}];g&&s<=0&&(S={x:v,y:p});for(var T=0;T<=f;T+=1){if(C=T/f,A=XR(r,e,t,n,i,a,C),v=A.x,p=A.y,c&&F.push({x:v,y:p}),h&&(y+=wr(B,[v,p])),B=[v,p],g&&y>=s&&s>m[2]){var O=(y-s)/(y-m[2]);S={x:B[0]*(1-O)+m[0]*O,y:B[1]*(1-O)+m[1]*O}}m=[v,p,y]}return g&&s>=y&&(S={x:i,y:a}),{length:y,point:S,min:{x:Math.min.apply(null,F.map(function(_){return _.x})),y:Math.min.apply(null,F.map(function(_){return _.y}))},max:{x:Math.max.apply(null,F.map(function(_){return _.x})),y:Math.max.apply(null,F.map(function(_){return _.y}))}}}function X_(r,e,t){for(var n,i,a,s,o,A,l=$u(r),c=typeof e=="number",u,h=[],d,f=0,g=0,v=0,p=0,y,m=[],B=[],C=0,S={x:0,y:0},F=S,T=S,O=S,_=0,k=0,L=l.length;k<L;k+=1)y=l[k],d=y[0],u=d==="M",h=u?h:[f,g].concat(y.slice(1)),u?(v=y[1],p=y[2],S={x:v,y:p},F=S,C=0,c&&e<.001&&(O=S)):d==="L"?(n=Ew(h[0],h[1],h[2],h[3],(e||0)-_),C=n.length,S=n.min,F=n.max,T=n.point):d==="A"?(i=$R(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],(e||0)-_,t||{}),C=i.length,S=i.min,F=i.max,T=i.point):d==="C"?(a=Y_(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],(e||0)-_,t||{}),C=a.length,S=a.min,F=a.max,T=a.point):d==="Q"?(s=ZR(h[0],h[1],h[2],h[3],h[4],h[5],(e||0)-_,t||{}),C=s.length,S=s.min,F=s.max,T=s.point):d==="Z"&&(h=[f,g,v,p],o=Ew(h[0],h[1],h[2],h[3],(e||0)-_),C=o.length,S=o.min,F=o.max,T=o.point),c&&_<e&&_+C>=e&&(O=T),B.push(F),m.push(S),_+=C,A=d!=="Z"?y.slice(-2):[v,p],f=A[0],g=A[1];return c&&e>=_&&(O={x:f,y:g}),{length:_,point:O,min:{x:Math.min.apply(null,m.map(function(U){return U.x})),y:Math.min.apply(null,m.map(function(U){return U.y}))},max:{x:Math.max.apply(null,B.map(function(U){return U.x})),y:Math.max.apply(null,B.map(function(U){return U.y}))}}}function JR(r,e){return X_(r,void 0,le(le({},e),{bbox:!1,length:!0})).length}function eD(r){var e=r.length,t=e-1;return r.map(function(n,i){return r.map(function(a,s){var o=i+s,A;return s===0||r[o]&&r[o][0]==="M"?(A=r[o],["M"].concat(A.slice(-2))):(o>=e&&(o-=t),r[o])})})}function tD(r,e){var t=r.length-1,n=[],i=0,a=0,s=eD(r);return s.forEach(function(o,A){r.slice(1).forEach(function(l,c){a+=wr(r[(A+c)%t].slice(-2),e[c%t].slice(-2))}),n[A]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}function nD(r,e,t,n,i,a,s,o){return 3*((o-e)*(t+i)-(s-r)*(n+a)+n*(r-i)-t*(e-a)+o*(i+r/3)-s*(a+e/3))/20}function rD(r){var e=0,t=0,n=0;return bw(r).map(function(i){var a;if(i[0]==="M")return e=i[1],t=i[2],0;var s=i.slice(1),o=s[0],A=s[1],l=s[2],c=s[3],u=s[4],h=s[5];return n=nD(e,t,o,A,l,c,u,h),a=i.slice(-2),e=a[0],t=a[1],n}).reduce(function(i,a){return i+a},0)}function Tb(r){return rD(r)>=0}function iD(r,e,t){return X_(r,e,le(le({},t),{bbox:!1,length:!0})).point}var aD=50;function sD(r,e){e===void 0&&(e=.5);var t=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),s=Ma(t,n,e),o=Ma(n,i,e),A=Ma(i,a,e),l=Ma(s,o,e),c=Ma(o,A,e),u=Ma(l,c,e);return[["C"].concat(s,l,u),["C"].concat(c,A,a)]}function Mb(r){return r.map(function(e,t,n){var i=t&&n[t-1].slice(-2).concat(e.slice(1)),a=t?Y_(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,s;return t?s=a?sD(i):[e,e]:s=[e],{s:e,ss:s,l:a}})}function Z_(r,e,t,n){if(n===void 0&&(n=0),n>aD)return console.warn("Maximum recursion depth reached in equalizeSegments"),[r,e];var i=Mb(r),a=Mb(e),s=i.length,o=a.length,A=i.filter(function(p){return p.l}).length,l=a.filter(function(p){return p.l}).length,c=i.filter(function(p){return p.l}).reduce(function(p,y){var m=y.l;return p+m},0)/A||0,u=a.filter(function(p){return p.l}).reduce(function(p,y){var m=y.l;return p+m},0)/l||0,h=t||Math.max(s,o),d=[c,u],f=[h-s,h-o],g=0,v=[i,a].map(function(p,y){return p.l===h?p.map(function(m){return m.s}):p.map(function(m,B){return g=B&&f[y]&&m.l>=d[y],f[y]-=g?1:0,g?m.ss:[m.s]}).flat()});return v[0].length===v[1].length?v:Z_(v[0],v[1],h,n+1)}function xw(r){var e=document.createElement("div");e.innerHTML=r;var t=e.childNodes[0];return t&&e.contains(t)&&e.removeChild(t),t}function oD(r,e){for(;!{}.hasOwnProperty.call(r,e)&&(r=Ho(r))!==null;);return r}function Cw(){return Cw=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,e,t){var n=oD(r,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?r:t):i.value}},Cw.apply(null,arguments)}function Yu(r,e,t,n){var i=Cw(Ho(r.prototype),e,t);return typeof i=="function"?function(a){return i.apply(t,a)}:i}function da(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function J_(r,e){var t=Math.min.apply(Math,tt(r)),n=Math.min.apply(Math,tt(e)),i=Math.max.apply(Math,tt(r)),a=Math.max.apply(Math,tt(e));return{x:t,y:n,width:i-t,height:a-n}}function AD(r,e,t){return Math.atan(-e/r*Math.tan(t))}function lD(r,e,t){return Math.atan(e/(r*Math.tan(t)))}function cD(r,e,t,n,i,a){return t*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function uD(r,e,t,n,i,a){return t*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function hD(r,e,t,n,i,a,s){for(var o=AD(t,n,i),A=1/0,l=-1/0,c=[a,s],u=-Math.PI*2;u<=Math.PI*2;u+=Math.PI){var h=o+u;a<s?a<h&&h<s&&c.push(h):s<h&&h<a&&c.push(h)}for(var d=0;d<c.length;d++){var f=cD(r,e,t,n,i,c[d]);f<A&&(A=f),f>l&&(l=f)}for(var g=lD(t,n,i),v=1/0,p=-1/0,y=[a,s],m=-Math.PI*2;m<=Math.PI*2;m+=Math.PI){var B=g+m;a<s?a<B&&B<s&&y.push(B):s<B&&B<a&&y.push(B)}for(var C=0;C<y.length;C++){var S=uD(r,e,t,n,i,y[C]);S<v&&(v=S),S>p&&(p=S)}return{x:A,y:v,width:l-A,height:p-v}}var dD=1e-4;function eI(r,e,t,n,i,a){var s=-1,o=1/0,A=[t,n],l=20;a&&a>200&&(l=a/10);for(var c=1/l,u=c/10,h=0;h<=l;h++){var d=h*c,f=[i.apply(void 0,tt(r.concat([d]))),i.apply(void 0,tt(e.concat([d])))],g=da(A[0],A[1],f[0],f[1]);g<o&&(s=d,o=g)}if(s===0)return{x:r[0],y:e[0]};if(s===1){var v=r.length;return{x:r[v-1],y:e[v-1]}}o=1/0;for(var p=0;p<32&&!(u<dD);p++){var y=s-u,m=s+u,B=[i.apply(void 0,tt(r.concat([y]))),i.apply(void 0,tt(e.concat([y])))],C=da(A[0],A[1],B[0],B[1]);if(y>=0&&C<o)s=y,o=C;else{var S=[i.apply(void 0,tt(r.concat([m]))),i.apply(void 0,tt(e.concat([m])))],F=da(A[0],A[1],S[0],S[1]);m<=1&&F<o?(s=m,o=F):u*=.5}}return{x:i.apply(void 0,tt(r.concat([s]))),y:i.apply(void 0,tt(e.concat([s])))}}function tI(r,e,t,n){return da(r,e,t,n)}function nI(r,e,t,n,i){return{x:(1-i)*r+i*t,y:(1-i)*e+i*n}}function fD(r,e,t,n,i,a){var s=[t-r,n-e];if(nR(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-e)*(a-e));var o=[-s[1],s[0]];eR(o,o);var A=[i-r,a-e];return Math.abs(tR(A,o))}function Sw(r,e,t,n,i){var a=1-i;return a*a*a*r+3*e*i*a*a+3*t*i*i*a+n*i*i*i}function Ob(r,e,t,n){var i=-3*r+9*e-9*t+3*n,a=6*r-12*e+6*t,s=3*e-3*r,o=[],A,l,c;if(Lo(i,0))Lo(a,0)||(A=-s/a,A>=0&&A<=1&&o.push(A));else{var u=a*a-4*i*s;Lo(u,0)?o.push(-a/(2*i)):u>0&&(c=Math.sqrt(u),A=(-a+c)/(2*i),l=(-a-c)/(2*i),A>=0&&A<=1&&o.push(A),l>=0&&l<=1&&o.push(l))}return o}function gD(r,e,t,n,i,a,s,o){for(var A=[r,s],l=[e,o],c=Ob(r,t,i,s),u=Ob(e,n,a,o),h=0;h<c.length;h++)A.push(Sw(r,t,i,s,c[h]));for(var d=0;d<u.length;d++)l.push(Sw(e,n,a,o,u[d]));return J_(A,l)}function vD(r,e,t,n,i,a,s,o,A,l,c){return eI([r,t,i,s],[e,n,a,o],A,l,Sw,c)}function _b(r,e,t,n,i,a,s,o,A,l,c){var u=vD(r,e,t,n,i,a,s,o,A,l,c);return da(u.x,u.y,A,l)}function pD(r){if(r.length<2)return 0;for(var e=0,t=0;t<r.length-1;t++){var n=r[t],i=r[t+1];e+=da(n[0],n[1],i[0],i[1])}return e}function yD(r){return pD(r)}function Fw(r,e,t,n){var i=1-n;return i*i*r+2*n*i*e+n*n*t}function Ib(r,e,t){var n=r+t-2*e;if(Lo(n,0))return[.5];var i=(r-e)/n;return i<=1&&i>=0?[i]:[]}function mD(r,e,t,n,i,a){var s=Ib(r,t,i)[0],o=Ib(e,n,a)[0],A=[r,i],l=[e,a];return s!==void 0&&A.push(Fw(r,t,i,s)),o!==void 0&&l.push(Fw(e,n,a,o)),J_(A,l)}function wD(r,e,t,n,i,a,s,o){return eI([r,t,i],[e,n,a],s,o,Fw)}function BD(r,e,t,n,i,a,s,o){var A=wD(r,e,t,n,i,a,s,o);return da(A.x,A.y,s,o)}function Gn(){Gn=function(){return e};var r,e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(V,K,D){V[K]=D.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",A=a.toStringTag||"@@toStringTag";function l(V,K,D){return Object.defineProperty(V,K,{value:D,enumerable:!0,configurable:!0,writable:!0}),V[K]}try{l({},"")}catch{l=function(D,X,te){return D[X]=te}}function c(V,K,D,X){var te=K&&K.prototype instanceof p?K:p,ie=Object.create(te.prototype),re=new G(X||[]);return i(ie,"_invoke",{value:_(V,D,re)}),ie}function u(V,K,D){try{return{type:"normal",arg:V.call(K,D)}}catch(X){return{type:"throw",arg:X}}}e.wrap=c;var h="suspendedStart",d="suspendedYield",f="executing",g="completed",v={};function p(){}function y(){}function m(){}var B={};l(B,s,function(){return this});var C=Object.getPrototypeOf,S=C&&C(C(W([])));S&&S!==t&&n.call(S,s)&&(B=S);var F=m.prototype=p.prototype=Object.create(B);function T(V){["next","throw","return"].forEach(function(K){l(V,K,function(D){return this._invoke(K,D)})})}function O(V,K){function D(te,ie,re,xe){var $=u(V[te],V,ie);if($.type!=="throw"){var z=$.arg,ee=z.value;return ee&&Ya(ee)=="object"&&n.call(ee,"__await")?K.resolve(ee.__await).then(function(Ae){D("next",Ae,re,xe)},function(Ae){D("throw",Ae,re,xe)}):K.resolve(ee).then(function(Ae){z.value=Ae,re(z)},function(Ae){return D("throw",Ae,re,xe)})}xe($.arg)}var X;i(this,"_invoke",{value:function(ie,re){function xe(){return new K(function($,z){D(ie,re,$,z)})}return X=X?X.then(xe,xe):xe()}})}function _(V,K,D){var X=h;return function(te,ie){if(X===f)throw Error("Generator is already running");if(X===g){if(te==="throw")throw ie;return{value:r,done:!0}}for(D.method=te,D.arg=ie;;){var re=D.delegate;if(re){var xe=k(re,D);if(xe){if(xe===v)continue;return xe}}if(D.method==="next")D.sent=D._sent=D.arg;else if(D.method==="throw"){if(X===h)throw X=g,D.arg;D.dispatchException(D.arg)}else D.method==="return"&&D.abrupt("return",D.arg);X=f;var $=u(V,K,D);if($.type==="normal"){if(X=D.done?g:d,$.arg===v)continue;return{value:$.arg,done:D.done}}$.type==="throw"&&(X=g,D.method="throw",D.arg=$.arg)}}}function k(V,K){var D=K.method,X=V.iterator[D];if(X===r)return K.delegate=null,D==="throw"&&V.iterator.return&&(K.method="return",K.arg=r,k(V,K),K.method==="throw")||D!=="return"&&(K.method="throw",K.arg=new TypeError("The iterator does not provide a '"+D+"' method")),v;var te=u(X,V.iterator,K.arg);if(te.type==="throw")return K.method="throw",K.arg=te.arg,K.delegate=null,v;var ie=te.arg;return ie?ie.done?(K[V.resultName]=ie.value,K.next=V.nextLoc,K.method!=="return"&&(K.method="next",K.arg=r),K.delegate=null,v):ie:(K.method="throw",K.arg=new TypeError("iterator result is not an object"),K.delegate=null,v)}function L(V){var K={tryLoc:V[0]};1 in V&&(K.catchLoc=V[1]),2 in V&&(K.finallyLoc=V[2],K.afterLoc=V[3]),this.tryEntries.push(K)}function U(V){var K=V.completion||{};K.type="normal",delete K.arg,V.completion=K}function G(V){this.tryEntries=[{tryLoc:"root"}],V.forEach(L,this),this.reset(!0)}function W(V){if(V||V===""){var K=V[s];if(K)return K.call(V);if(typeof V.next=="function")return V;if(!isNaN(V.length)){var D=-1,X=function te(){for(;++D<V.length;)if(n.call(V,D))return te.value=V[D],te.done=!1,te;return te.value=r,te.done=!0,te};return X.next=X}}throw new TypeError(Ya(V)+" is not iterable")}return y.prototype=m,i(F,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:y,configurable:!0}),y.displayName=l(m,A,"GeneratorFunction"),e.isGeneratorFunction=function(V){var K=typeof V=="function"&&V.constructor;return!!K&&(K===y||(K.displayName||K.name)==="GeneratorFunction")},e.mark=function(V){return Object.setPrototypeOf?Object.setPrototypeOf(V,m):(V.__proto__=m,l(V,A,"GeneratorFunction")),V.prototype=Object.create(F),V},e.awrap=function(V){return{__await:V}},T(O.prototype),l(O.prototype,o,function(){return this}),e.AsyncIterator=O,e.async=function(V,K,D,X,te){te===void 0&&(te=Promise);var ie=new O(c(V,K,D,X),te);return e.isGeneratorFunction(K)?ie:ie.next().then(function(re){return re.done?re.value:ie.next()})},T(F),l(F,A,"Generator"),l(F,s,function(){return this}),l(F,"toString",function(){return"[object Generator]"}),e.keys=function(V){var K=Object(V),D=[];for(var X in K)D.push(X);return D.reverse(),function te(){for(;D.length;){var ie=D.pop();if(ie in K)return te.value=ie,te.done=!1,te}return te.done=!0,te}},e.values=W,G.prototype={constructor:G,reset:function(K){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(U),!K)for(var D in this)D.charAt(0)==="t"&&n.call(this,D)&&!isNaN(+D.slice(1))&&(this[D]=r)},stop:function(){this.done=!0;var K=this.tryEntries[0].completion;if(K.type==="throw")throw K.arg;return this.rval},dispatchException:function(K){if(this.done)throw K;var D=this;function X(z,ee){return re.type="throw",re.arg=K,D.next=z,ee&&(D.method="next",D.arg=r),!!ee}for(var te=this.tryEntries.length-1;te>=0;--te){var ie=this.tryEntries[te],re=ie.completion;if(ie.tryLoc==="root")return X("end");if(ie.tryLoc<=this.prev){var xe=n.call(ie,"catchLoc"),$=n.call(ie,"finallyLoc");if(xe&&$){if(this.prev<ie.catchLoc)return X(ie.catchLoc,!0);if(this.prev<ie.finallyLoc)return X(ie.finallyLoc)}else if(xe){if(this.prev<ie.catchLoc)return X(ie.catchLoc,!0)}else{if(!$)throw Error("try statement without catch or finally");if(this.prev<ie.finallyLoc)return X(ie.finallyLoc)}}}},abrupt:function(K,D){for(var X=this.tryEntries.length-1;X>=0;--X){var te=this.tryEntries[X];if(te.tryLoc<=this.prev&&n.call(te,"finallyLoc")&&this.prev<te.finallyLoc){var ie=te;break}}ie&&(K==="break"||K==="continue")&&ie.tryLoc<=D&&D<=ie.finallyLoc&&(ie=null);var re=ie?ie.completion:{};return re.type=K,re.arg=D,ie?(this.method="next",this.next=ie.finallyLoc,v):this.complete(re)},complete:function(K,D){if(K.type==="throw")throw K.arg;return K.type==="break"||K.type==="continue"?this.next=K.arg:K.type==="return"?(this.rval=this.arg=K.arg,this.method="return",this.next="end"):K.type==="normal"&&D&&(this.next=D),v},finish:function(K){for(var D=this.tryEntries.length-1;D>=0;--D){var X=this.tryEntries[D];if(X.finallyLoc===K)return this.complete(X.completion,X.afterLoc),U(X),v}},catch:function(K){for(var D=this.tryEntries.length-1;D>=0;--D){var X=this.tryEntries[D];if(X.tryLoc===K){var te=X.completion;if(te.type==="throw"){var ie=te.arg;U(X)}return ie}}throw Error("illegal catch attempt")},delegateYield:function(K,D,X){return this.delegate={iterator:W(K),resultName:D,nextLoc:X},this.method==="next"&&(this.arg=r),v}},e}function kb(r,e,t,n,i,a,s){try{var o=r[a](s),A=o.value}catch(l){return void t(l)}o.done?e(A):Promise.resolve(A).then(n,i)}function Ja(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(A){kb(a,n,i,s,o,"next",A)}function o(A){kb(a,n,i,s,o,"throw",A)}s(void 0)})}}function ka(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=G1(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return s=l.done,l},e:function(l){o=!0,a=l},f:function(){try{s||t.return==null||t.return()}finally{if(o)throw a}}}}function bD(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}function Di(r,e){if(r==null)return{};var t,n,i=bD(r,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(n=0;n<a.length;n++)t=a[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}var ae=(function(r){return r.GROUP="g",r.FRAGMENT="fragment",r.CIRCLE="circle",r.ELLIPSE="ellipse",r.IMAGE="image",r.RECT="rect",r.LINE="line",r.POLYLINE="polyline",r.POLYGON="polygon",r.TEXT="text",r.PATH="path",r.HTML="html",r.MESH="mesh",r})({}),Fu=(function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r})({}),rs=(function(){function r(){ue(this,r),this.plugins=[]}return he(r,[{key:"addRenderingPlugin",value:function(t){this.plugins.push(t),this.context.renderingPlugins.push(t)}},{key:"removeAllRenderingPlugins",value:function(){var t=this;this.plugins.forEach(function(n){var i=t.context.renderingPlugins.indexOf(n);i>=0&&t.context.renderingPlugins.splice(i,1)})}}])})(),ED=(function(){function r(e){ue(this,r),this.clipSpaceNearZ=Fu.NEGATIVE_ONE,this.plugins=[],this.config=De({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},e)}return he(r,[{key:"registerPlugin",value:function(t){var n=this.plugins.findIndex(function(i){return i===t});n===-1&&this.plugins.push(t)}},{key:"unregisterPlugin",value:function(t){var n=this.plugins.findIndex(function(i){return i===t});n>-1&&this.plugins.splice(n,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(t){return this.plugins.find(function(n){return n.name===t})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(t){Object.assign(this.config,t)}}])})(),kf=Va,oo=Ui,xD=KP,CD=GP,Lb=zu,Lf=U_,It=(function(){function r(){ue(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return he(r,[{key:"update",value:function(t,n){oo(this.center,t),oo(this.halfExtents,n),Lf(this.min,this.center,this.halfExtents),kf(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,n){kf(this.center,n,t),Lb(this.center,this.center,.5),Lf(this.halfExtents,n,t),Lb(this.halfExtents,this.halfExtents,.5),oo(this.min,t),oo(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(t){if(!r.isEmpty(t)){if(r.isEmpty(this)){this.setMinMax(t.getMin(),t.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,A=o[0],l=o[1],c=o[2],u=i-A,h=i+A,d=a-l,f=a+l,g=s-c,v=s+c,p=t.center,y=p[0],m=p[1],B=p[2],C=t.halfExtents,S=C[0],F=C[1],T=C[2],O=y-S,_=y+S,k=m-F,L=m+F,U=B-T,G=B+T;O<u&&(u=O),_>h&&(h=_),k<d&&(d=k),L>f&&(f=L),U<g&&(g=U),G>v&&(v=G),n[0]=(u+h)*.5,n[1]=(d+f)*.5,n[2]=(g+v)*.5,o[0]=(h-u)*.5,o[1]=(f-d)*.5,o[2]=(v-g)*.5,this.min[0]=u,this.min[1]=d,this.min[2]=g,this.max[0]=h,this.max[1]=f,this.max[2]=v}}},{key:"setFromTransformedAABB",value:function(t,n){var i=this.center,a=this.halfExtents,s=t.center,o=t.halfExtents,A=n[0],l=n[4],c=n[8],u=n[1],h=n[5],d=n[9],f=n[2],g=n[6],v=n[10],p=Math.abs(A),y=Math.abs(l),m=Math.abs(c),B=Math.abs(u),C=Math.abs(h),S=Math.abs(d),F=Math.abs(f),T=Math.abs(g),O=Math.abs(v);i[0]=n[12]+A*s[0]+l*s[1]+c*s[2],i[1]=n[13]+u*s[0]+h*s[1]+d*s[2],i[2]=n[14]+f*s[0]+g*s[1]+v*s[2],a[0]=p*o[0]+y*o[1]+m*o[2],a[1]=B*o[0]+C*o[1]+S*o[2],a[2]=F*o[0]+T*o[1]+O*o[2],Lf(this.min,i,a),kf(this.max,i,a)}},{key:"intersects",value:function(t){var n=this.getMax(),i=this.getMin(),a=t.getMax(),s=t.getMin();return i[0]<=a[0]&&n[0]>=s[0]&&i[1]<=a[1]&&n[1]>=s[1]&&i[2]<=a[2]&&n[2]>=s[2]}},{key:"intersection",value:function(t){if(!this.intersects(t))return null;var n=new r,i=xD([0,0,0],this.getMin(),t.getMin()),a=CD([0,0,0],this.getMax(),t.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(t){return t.pnVertexFlag===273?oo([0,0,0],this.min):t.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:t.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:t.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:t.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:t.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:t.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(t){return t.pnVertexFlag===273?oo([0,0,0],this.max):t.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:t.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:t.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:t.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:t.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:t.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]}}],[{key:"isEmpty",value:function(t){return!t||t.halfExtents[0]===0&&t.halfExtents[1]===0&&t.halfExtents[2]===0}}])})(),SD=(function(){function r(e,t){ue(this,r),this.distance=e||0,this.normal=t||Ct(0,1,0),this.updatePNVertexFlag()}return he(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return Pi(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/P_(this.normal);zu(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,n,i){var a=this.distanceToPoint(t),s=this.distanceToPoint(n),o=a/(a-s),A=o>=0&&o<=1;return A&&i&&pw(i,t,n,o),A}}])})(),Ao=(function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r})({}),FD=(function(){function r(e){if(ue(this,r),this.planes=[],e)this.planes=e;else for(var t=0;t<6;t++)this.planes.push(new SD)}return he(r,[{key:"extractFromVPMatrix",value:function(t){var n=We(t,16),i=n[0],a=n[1],s=n[2],o=n[3],A=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],f=n[10],g=n[11],v=n[12],p=n[13],y=n[14],m=n[15];er(this.planes[0].normal,o-i,u-A,g-h),this.planes[0].distance=m-v,er(this.planes[1].normal,o+i,u+A,g+h),this.planes[1].distance=m+v,er(this.planes[2].normal,o+a,u+l,g+d),this.planes[2].distance=m+p,er(this.planes[3].normal,o-a,u-l,g-d),this.planes[3].distance=m-p,er(this.planes[4].normal,o-s,u-c,g-f),this.planes[4].distance=m-y,er(this.planes[5].normal,o+s,u+c,g+f),this.planes[5].distance=m+y,this.planes.forEach(function(B){B.normalize(),B.updatePNVertexFlag()})}}])})(),Dn=(function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;ue(this,r),this.x=0,this.y=0,this.x=e,this.y=t}return he(r,[{key:"clone",value:function(){return new r(this.x,this.y)}},{key:"copyFrom",value:function(t){this.x=t.x,this.y=t.y}}])})(),Vo=(function(){function r(e,t,n,i){ue(this,r),this.x=e,this.y=t,this.width=n,this.height=i,this.left=e,this.right=e+n,this.top=t,this.bottom=t+i}return he(r,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(t){return new r(t.x,t.y,t.width,t.height)}},{key:"applyTransform",value:function(t,n){var i=TA(t.x,t.y,0,1),a=TA(t.x+t.width,t.y,0,1),s=TA(t.x,t.y+t.height,0,1),o=TA(t.x+t.width,t.y+t.height,0,1),A=Ri(),l=Ri(),c=Ri(),u=Ri();ua(A,i,n),ua(l,a,n),ua(c,s,n),ua(u,o,n);var h=Math.min(A[0],l[0],c[0],u[0]),d=Math.min(A[1],l[1],c[1],u[1]),f=Math.max(A[0],l[0],c[0],u[0]),g=Math.max(A[1],l[1],c[1],u[1]);return r.fromRect({x:h,y:d,width:f-h,height:g-d})}}])})(),wt="Method not implemented.",lo="Use document.documentElement instead.",TD="Cannot append a destroyed element.";function Qo(r){return r===void 0?0:r>360||r<-360?r%360:r}var Qf=Ze();function Ar(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(r)&&r.length===3?n?aa(r):Ui(Qf,r):Be(r)?n?Ct(r,e,t):er(Qf,r,e,t):n?Ct(r[0],r[1]||e,r[2]||t):er(Qf,r[0],r[1]||e,r[2]||t)}var MD=Math.PI/180;function ft(r){return r*MD}var OD=180/Math.PI;function Br(r){return r*OD}function _D(r){return 360*r}var Xu=Math.PI/2;function ID(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],s=t*t,o=n*n,A=i*i,l=a*a,c=s+o+A+l,u=t*a-n*i;return u>.499995*c?(r[0]=Xu,r[1]=2*Math.atan2(n,t),r[2]=0):u<-.499995*c?(r[0]=-Xu,r[1]=2*Math.atan2(n,t),r[2]=0):(r[0]=Math.asin(2*(t*i-a*n)),r[1]=Math.atan2(2*(t*a+n*i),1-2*(A+l)),r[2]=Math.atan2(2*(t*n+i*a),1-2*(o+A))),r}function kD(r,e){var t,n,i=Ko(Ze(),e),a=We(i,3),s=a[0],o=a[1],A=a[2],l=Math.asin(-e[2]/s);return l<Xu?l>-Xu?(t=Math.atan2(e[6]/o,e[10]/A),n=Math.atan2(e[1]/s,e[0]/s)):(n=0,t=-Math.atan2(e[4]/o,e[5]/o)):(n=0,t=Math.atan2(e[4]/o,e[5]/o)),r[0]=t,r[1]=l,r[2]=n,r}function Nf(r,e){return e.length===16?kD(r,e):ID(r,e)}function LD(r,e,t,n,i){var a=Math.cos(r),s=Math.sin(r);return bP(n*a,i*s,0,-n*s,i*a,0,e,t,1)}function QD(r,e,t,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,A=2*a,l=t-e,c=n-i,u=A/l,h=A/c,d=(t+e)/l,f=(n+i)/c,g,v,p=s-a,y=s*a;return o?(g=-s/p,v=-y/p):(g=-(s+a)/p,v=-2*y/p),r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=d,r[9]=f,r[10]=g,r[11]=-1,r[12]=0,r[13]=0,r[14]=v,r[15]=0,r}function Qb(r){var e=r[0],t=r[1],n=r[3],i=r[4],a=Math.sqrt(e*e+t*t),s=Math.sqrt(n*n+i*i),o=e*i-t*n;if(o<0&&(e<i?a=-a:s=-s),a){var A=1/a;e*=A,t*=A}if(s){var l=1/s;n*=l,i*=l}var c=Math.atan2(t,e),u=Br(c);return[r[6],r[7],a,s,u]}var Mi=xt(),li=xt(),dA=Ri(),Re=[Ze(),Ze(),Ze()],Nb=Ze();function ND(r,e,t,n,i,a){if(!UD(Mi,r)||(Go(li,Mi),li[3]=0,li[7]=0,li[11]=0,li[15]=1,Math.abs(b_(li))<1e-8))return!1;var s=Mi[3],o=Mi[7],A=Mi[11],l=Mi[12],c=Mi[13],u=Mi[14],h=Mi[15];if(s!==0||o!==0||A!==0){dA[0]=s,dA[1]=o,dA[2]=A,dA[3]=h;var d=Ni(li,li);if(!d)return!1;B_(li,li),ua(i,dA,li)}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=l,e[1]=c,e[2]=u,PD(Re,Mi),t[0]=oa(Re[0]),_s(Re[0],Re[0]),n[0]=Pi(Re[0],Re[1]),Uf(Re[1],Re[1],Re[0],1,-n[0]),t[1]=oa(Re[1]),_s(Re[1],Re[1]),n[0]/=t[1],n[1]=Pi(Re[0],Re[2]),Uf(Re[2],Re[2],Re[0],1,-n[1]),n[2]=Pi(Re[1],Re[2]),Uf(Re[2],Re[2],Re[1],1,-n[2]),t[2]=oa(Re[2]),_s(Re[2],Re[2]),n[1]/=t[2],n[2]/=t[2],Cu(Nb,Re[1],Re[2]),Pi(Re[0],Nb)<0)for(var f=0;f<3;f++)t[f]*=-1,Re[f][0]*=-1,Re[f][1]*=-1,Re[f][2]*=-1;return a[0]=.5*Math.sqrt(Math.max(1+Re[0][0]-Re[1][1]-Re[2][2],0)),a[1]=.5*Math.sqrt(Math.max(1-Re[0][0]+Re[1][1]-Re[2][2],0)),a[2]=.5*Math.sqrt(Math.max(1-Re[0][0]-Re[1][1]+Re[2][2],0)),a[3]=.5*Math.sqrt(Math.max(1+Re[0][0]+Re[1][1]+Re[2][2],0)),Re[2][1]>Re[1][2]&&(a[0]=-a[0]),Re[0][2]>Re[2][0]&&(a[1]=-a[1]),Re[1][0]>Re[0][1]&&(a[2]=-a[2]),!0}function UD(r,e){var t=e[15];if(t===0)return!1;for(var n=1/t,i=0;i<16;i++)r[i]=e[i]*n;return!0}function PD(r,e){r[0][0]=e[0],r[0][1]=e[1],r[0][2]=e[2],r[1][0]=e[4],r[1][1]=e[5],r[1][2]=e[6],r[2][0]=e[8],r[2][1]=e[9],r[2][2]=e[10]}function Uf(r,e,t,n,i){r[0]=e[0]*n+t[0]*i,r[1]=e[1]*n+t[1]*i,r[2]=e[2]*n+t[2]*i}var mt=(function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r})({}),Tw=(function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r})({}),$r=(function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r})({}),rI={UPDATED:"updated"},Ub=2e-4,iI=(function(){function r(){ue(this,r),this.clipSpaceNearZ=Fu.NEGATIVE_ONE,this.eventEmitter=new p_,this.matrix=xt(),this.right=Ct(1,0,0),this.up=Ct(0,1,0),this.forward=Ct(0,0,1),this.position=Ct(0,0,1),this.focalPoint=Ct(0,0,0),this.distanceVector=Ct(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=xt(),this.projectionMatrixInverse=xt(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=mt.EXPLORING,this.trackingMode=Tw.DEFAULT,this.projectionMode=$r.PERSPECTIVE,this.frustum=new FD,this.orthoMatrix=xt()}return he(r,[{key:"isOrtho",value:function(){return this.projectionMode===$r.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(t){this.enableUpdate=t}},{key:"setType",value:function(t,n){return this.type=t,this.type===mt.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===mt.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==mt.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this}},{key:"setWorldRotation",value:function(t){return this.rotateWorld=t,this._getAngles(),this}},{key:"getViewTransform",value:function(){return Ni(xt(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(t,n){var i=Ia(xt(),[t,n,0]);this.jitteredProjectionMatrix=tr(xt(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(t){return this.matrix=t,this._update(),this}},{key:"setProjectionMatrix",value:function(t){this.projectionMatrix=t}},{key:"setFov",value:function(t){return this.setPerspective(this.near,this.far,t,this.aspect),this}},{key:"setAspect",value:function(t){return this.setPerspective(this.near,this.far,this.fov,t),this}},{key:"setNear",value:function(t){return this.projectionMode===$r.PERSPECTIVE?this.setPerspective(t,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,t,this.far),this}},{key:"setFar",value:function(t){return this.projectionMode===$r.PERSPECTIVE?this.setPerspective(this.near,t,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,t),this}},{key:"setViewOffset",value:function(t,n,i,a,s,o){return this.aspect=t/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.projectionMode===$r.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===$r.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(t){return this.zoom=t,this.projectionMode===$r.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===$r.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(t,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(t),this.rotate(0,0,o);var A=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),l=A.x,c=A.y,u=Ct(l-a,c-s,0),h=Pi(u,this.right)/oa(this.right),d=Pi(u,this.up)/oa(this.up),f=this.getPosition(),g=We(f,2),v=g[0],p=g[1],y=this.getFocalPoint(),m=We(y,2),B=m[0],C=m[1];return this.setPosition(v-h,p-d),this.setFocalPoint(B-h,C-d),this}},{key:"setPerspective",value:function(t,n,i,a){var s;this.projectionMode=$r.PERSPECTIVE,this.fov=i,this.near=t,this.far=n,this.aspect=a;var o=this.near*Math.tan(ft(.5*this.fov))/this.zoom,A=2*o,l=this.aspect*A,c=-.5*l;if((s=this.view)!==null&&s!==void 0&&s.enabled){var u=this.view.fullWidth,h=this.view.fullHeight;c+=this.view.offsetX*l/u,o-=this.view.offsetY*A/h,l*=this.view.width/u,A*=this.view.height/h}return QD(this.projectionMatrix,c,c+l,o-A,o,t,this.far,this.clipSpaceNearZ===Fu.ZERO),Ni(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(t,n,i,a,s,o){var A;this.projectionMode=$r.ORTHOGRAPHIC,this.rright=n,this.left=t,this.top=i,this.bottom=a,this.near=s,this.far=o;var l=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),u=(this.rright+this.left)/2,h=(this.top+this.bottom)/2,d=u-l,f=u+l,g=h+c,v=h-c;if((A=this.view)!==null&&A!==void 0&&A.enabled){var p=(this.rright-this.left)/this.view.fullWidth/this.zoom,y=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=p*this.view.offsetX,f=d+p*this.view.width,g-=y*this.view.offsetY,v=g-y*this.view.height}return this.clipSpaceNearZ===Fu.NEGATIVE_ONE?I_(this.projectionMatrix,d,f,g,v,s,o):k_(this.projectionMatrix,d,f,g,v,s,o),Ni(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=Ar(t,n,i);return this._setPosition(a),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],a=Ct(0,1,0);if(this.focalPoint=Ar(t,n,i),this.trackingMode===Tw.CINEMATIC){var s=vw(Ze(),this.focalPoint,this.position);t=s[0],n=s[1],i=s[2];var o=oa(s),A=Br(Math.asin(n/o)),l=90+Br(Math.atan2(i,t)),c=xt();C_(c,c,ft(l)),x_(c,c,ft(A)),a=nr(Ze(),[0,1,0],c)}return Ni(this.matrix,L_(xt(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(t){if(this.distance===t||t<0)return this;this.distance=t,this.distance<Ub&&(this.distance=Ub),this.dollyingStep=this.distance/100;var n=Ze();t=this.distance;var i=this.forward,a=this.focalPoint;return n[0]=t*i[0]+a[0],n[1]=t*i[1]+a[1],n[2]=t*i[2]+a[2],this._setPosition(n),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(t){return this.maxDistance=t,this}},{key:"setMinDistance",value:function(t){return this.minDistance=t,this}},{key:"setAzimuth",value:function(t){return this.azimuth=Qo(t),this.computeMatrix(),this._getAxes(),this.type===mt.ORBITING||this.type===mt.EXPLORING?this._getPosition():this.type===mt.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=Qo(t),this.computeMatrix(),this._getAxes(),this.type===mt.ORBITING||this.type===mt.EXPLORING?this._getPosition():this.type===mt.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(t){return this.roll=Qo(t),this.computeMatrix(),this._getAxes(),this.type===mt.ORBITING||this.type===mt.EXPLORING?this._getPosition():this.type===mt.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var t=La(gn(),[0,0,1],ft(this.roll));Xa(this.matrix);var n=La(gn(),[1,0,0],ft((this.rotateWorld&&this.type!==mt.TRACKING||this.type===mt.TRACKING?1:-1)*this.elevation)),i=La(gn(),[0,1,0],ft((this.rotateWorld&&this.type!==mt.TRACKING||this.type===mt.TRACKING?1:-1)*this.azimuth)),a=ja(gn(),i,n);a=ja(gn(),a,t);var s=K1(xt(),a);this.type===mt.ORBITING||this.type===mt.EXPLORING?(ko(this.matrix,this.matrix,this.focalPoint),tr(this.matrix,this.matrix,s),ko(this.matrix,this.matrix,[0,0,this.distance])):this.type===mt.TRACKING&&(ko(this.matrix,this.matrix,this.position),tr(this.matrix,this.matrix,s))}},{key:"_setPosition",value:function(t,n,i){this.position=Ar(t,n,i);var a=this.matrix;a[12]=this.position[0],a[13]=this.position[1],a[14]=this.position[2],a[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){Ui(this.right,Ar(ua(Ri(),[1,0,0,0],this.matrix))),Ui(this.up,Ar(ua(Ri(),[0,1,0,0],this.matrix))),Ui(this.forward,Ar(ua(Ri(),[0,0,1,0],this.matrix))),_s(this.right,this.right),_s(this.up,this.up),_s(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=oa(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===mt.TRACKING?(this.elevation=Br(Math.asin(n/a)),this.azimuth=Br(Math.atan2(-t,-i))):this.rotateWorld?(this.elevation=Br(Math.asin(n/a)),this.azimuth=Br(Math.atan2(-t,-i))):(this.elevation=-Br(Math.asin(n/a)),this.azimuth=-Br(Math.atan2(-t,-i)))}},{key:"_getPosition",value:function(){Ui(this.position,Ar(ua(Ri(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){VP(this.distanceVector,[0,0,-this.distance],BP(y_(),this.matrix)),Va(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=vw(Ze(),this.focalPoint,this.position),this.distance=oa(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===$r.ORTHOGRAPHIC){var t=this.position,n=La(gn(),[0,0,1],-this.roll*Math.PI/180);qA(this.orthoMatrix,n,Ct((this.rright-this.left)/2-t[0],(this.top-this.bottom)/2-t[1],0),Ct(this.zoom,this.zoom,1),t)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var t=this.getViewTransform(),n=tr(xt(),this.getPerspective(),t);this.getFrustum().extractFromVPMatrix(n),this.eventEmitter.emit(rI.UPDATED)}}},{key:"rotate",value:function(t,n,i){throw new Error(wt)}},{key:"pan",value:function(t,n){throw new Error(wt)}},{key:"dolly",value:function(t){throw new Error(wt)}},{key:"createLandmark",value:function(t,n){throw new Error(wt)}},{key:"gotoLandmark",value:function(t,n){throw new Error(wt)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(wt)}}])})(),RD=(function(r){return r[r.Standard=0]="Standard",r})({}),Zu=(function(r){return r[r.ADDED=0]="ADDED",r[r.REMOVED=1]="REMOVED",r[r.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",r})({}),DD=Ze(),fA=xt(),HD=gn();function Pb(r){if(r.localDirtyFlag){var e=r.localSkew[0]!==0||r.localSkew[1]!==0;if(e){qA(r.localTransform,r.localRotation,r.localPosition,Ct(1,1,1),r.origin),(r.localSkew[0]!==0||r.localSkew[1]!==0)&&(Xa(fA),fA[4]=Math.tan(r.localSkew[0]),fA[1]=Math.tan(r.localSkew[1]),tr(r.localTransform,r.localTransform,fA));var t=qA(fA,R_(HD,0,0,0,1),er(DD,1,1,1),r.localScale,r.origin);tr(r.localTransform,r.localTransform,t)}else{var n=r.localTransform,i=r.localPosition,a=r.localRotation,s=r.localScale,o=r.origin,A=i[0]!==0||i[1]!==0||i[2]!==0,l=a[3]!==1||a[0]!==0||a[1]!==0||a[2]!==0,c=s[0]!==1||s[1]!==1||s[2]!==1,u=o[0]!==0||o[1]!==0||o[2]!==0;!l&&!c&&!u?A?Ia(n,i):Xa(n):qA(n,a,i,s,o)}r.localDirtyFlag=!1}}function GD(r,e){r.dirtyFlag&&(e?tr(r.worldTransform,e.worldTransform,r.localTransform):Go(r.worldTransform,r.localTransform),r.dirtyFlag=!1)}var aI={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Vo(0,0,0,0)},pe=(function(r){return r.COORDINATE="<coordinate>",r.COLOR="<color>",r.PAINT="<paint>",r.NUMBER="<number>",r.ANGLE="<angle>",r.OPACITY_VALUE="<opacity-value>",r.SHADOW_BLUR="<shadow-blur>",r.LENGTH="<length>",r.PERCENTAGE="<percentage>",r.LENGTH_PERCENTAGE="<length> | <percentage>",r.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",r.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",r.LIST_OF_POINTS="<list-of-points>",r.PATH="<path>",r.FILTER="<filter>",r.Z_INDEX="<z-index>",r.OFFSET_DISTANCE="<offset-distance>",r.DEFINED_PATH="<defined-path>",r.MARKER="<marker>",r.TRANSFORM="<transform>",r.TRANSFORM_ORIGIN="<transform-origin>",r.TEXT="<text>",r.TEXT_TRANSFORM="<text-transform>",r})({});function W1(r,e,t){r.prototype=e.prototype=t,t.constructor=r}function sI(r,e){var t=Object.create(r.prototype);for(var n in e)t[n]=e[n];return t}function Tl(){}var Al=.7,Ju=1/Al,No="\\s*([+-]?\\d+)\\s*",ll="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Hi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",KD=/^#([0-9a-f]{3,8})$/,zD=new RegExp(`^rgb\\(${No},${No},${No}\\)$`),VD=new RegExp(`^rgb\\(${Hi},${Hi},${Hi}\\)$`),jD=new RegExp(`^rgba\\(${No},${No},${No},${ll}\\)$`),WD=new RegExp(`^rgba\\(${Hi},${Hi},${Hi},${ll}\\)$`),qD=new RegExp(`^hsl\\(${ll},${Hi},${Hi}\\)$`),$D=new RegExp(`^hsla\\(${ll},${Hi},${Hi},${ll}\\)$`),Rb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};W1(Tl,Uh,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:Db,formatHex:Db,formatHex8:YD,formatHsl:XD,formatRgb:Hb,toString:Hb});function Db(){return this.rgb().formatHex()}function YD(){return this.rgb().formatHex8()}function XD(){return oI(this).formatHsl()}function Hb(){return this.rgb().formatRgb()}function Uh(r){var e,t;return r=(r+"").trim().toLowerCase(),(e=KD.exec(r))?(t=e[1].length,e=parseInt(e[1],16),t===6?Gb(e):t===3?new Cr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?oc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?oc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=zD.exec(r))?new Cr(e[1],e[2],e[3],1):(e=VD.exec(r))?new Cr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=jD.exec(r))?oc(e[1],e[2],e[3],e[4]):(e=WD.exec(r))?oc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=qD.exec(r))?Vb(e[1],e[2]/100,e[3]/100,1):(e=$D.exec(r))?Vb(e[1],e[2]/100,e[3]/100,e[4]):Rb.hasOwnProperty(r)?Gb(Rb[r]):r==="transparent"?new Cr(NaN,NaN,NaN,0):null}function Gb(r){return new Cr(r>>16&255,r>>8&255,r&255,1)}function oc(r,e,t,n){return n<=0&&(r=e=t=NaN),new Cr(r,e,t,n)}function ZD(r){return r instanceof Tl||(r=Uh(r)),r?(r=r.rgb(),new Cr(r.r,r.g,r.b,r.opacity)):new Cr}function JD(r,e,t,n){return arguments.length===1?ZD(r):new Cr(r,e,t,n??1)}function Cr(r,e,t,n){this.r=+r,this.g=+e,this.b=+t,this.opacity=+n}W1(Cr,JD,sI(Tl,{brighter(r){return r=r==null?Ju:Math.pow(Ju,r),new Cr(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Al:Math.pow(Al,r),new Cr(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Cr(Is(this.r),Is(this.g),Is(this.b),eh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Kb,formatHex:Kb,formatHex8:e3,formatRgb:zb,toString:zb}));function Kb(){return`#${Ss(this.r)}${Ss(this.g)}${Ss(this.b)}`}function e3(){return`#${Ss(this.r)}${Ss(this.g)}${Ss(this.b)}${Ss((isNaN(this.opacity)?1:this.opacity)*255)}`}function zb(){const r=eh(this.opacity);return`${r===1?"rgb(":"rgba("}${Is(this.r)}, ${Is(this.g)}, ${Is(this.b)}${r===1?")":`, ${r})`}`}function eh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Is(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ss(r){return r=Is(r),(r<16?"0":"")+r.toString(16)}function Vb(r,e,t,n){return n<=0?r=e=t=NaN:t<=0||t>=1?r=e=NaN:e<=0&&(r=NaN),new gi(r,e,t,n)}function oI(r){if(r instanceof gi)return new gi(r.h,r.s,r.l,r.opacity);if(r instanceof Tl||(r=Uh(r)),!r)return new gi;if(r instanceof gi)return r;r=r.rgb();var e=r.r/255,t=r.g/255,n=r.b/255,i=Math.min(e,t,n),a=Math.max(e,t,n),s=NaN,o=a-i,A=(a+i)/2;return o?(e===a?s=(t-n)/o+(t<n)*6:t===a?s=(n-e)/o+2:s=(e-t)/o+4,o/=A<.5?a+i:2-a-i,s*=60):o=A>0&&A<1?0:s,new gi(s,o,A,r.opacity)}function t3(r,e,t,n){return arguments.length===1?oI(r):new gi(r,e,t,n??1)}function gi(r,e,t,n){this.h=+r,this.s=+e,this.l=+t,this.opacity=+n}W1(gi,t3,sI(Tl,{brighter(r){return r=r==null?Ju:Math.pow(Ju,r),new gi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Al:Math.pow(Al,r),new gi(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,i=2*t-n;return new Cr(Pf(r>=240?r-240:r+120,i,n),Pf(r,i,n),Pf(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new gi(jb(this.h),Ac(this.s),Ac(this.l),eh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=eh(this.opacity);return`${r===1?"hsl(":"hsla("}${jb(this.h)}, ${Ac(this.s)*100}%, ${Ac(this.l)*100}%${r===1?")":`, ${r})`}`}}));function jb(r){return r=(r||0)%360,r<0?r+360:r}function Ac(r){return Math.max(0,Math.min(1,r||0))}function Pf(r,e,t){return(r<60?e+(t-e)*r/60:r<180?t:r<240?e+(t-e)*(240-r)/60:e)*255}function hn(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var t=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=e?e.apply(this,a):a[0],A=t.cache;if(A.has(o))return A.get(o);var l=r.apply(this,a);return t.cache=A.set(o,l)||A,l};return t.cache=new(hn.Cache||Map),hn.cacheList.push(t.cache),t}hn.Cache=Map;hn.cacheList=[];hn.clearCache=function(){hn.cacheList.forEach(function(r){return r.clear()})};var we=(function(r){return r[r.kUnknown=0]="kUnknown",r[r.kNumber=1]="kNumber",r[r.kPercentage=2]="kPercentage",r[r.kEms=3]="kEms",r[r.kPixels=4]="kPixels",r[r.kRems=5]="kRems",r[r.kDegrees=6]="kDegrees",r[r.kRadians=7]="kRadians",r[r.kGradians=8]="kGradians",r[r.kTurns=9]="kTurns",r[r.kMilliseconds=10]="kMilliseconds",r[r.kSeconds=11]="kSeconds",r[r.kInteger=12]="kInteger",r})({}),fi=(function(r){return r[r.kUNumber=0]="kUNumber",r[r.kUPercent=1]="kUPercent",r[r.kULength=2]="kULength",r[r.kUAngle=3]="kUAngle",r[r.kUTime=4]="kUTime",r[r.kUOther=5]="kUOther",r})({}),n3=(function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r})({}),r3=(function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r})({}),i3=[{name:"em",unit_type:we.kEms},{name:"px",unit_type:we.kPixels},{name:"deg",unit_type:we.kDegrees},{name:"rad",unit_type:we.kRadians},{name:"grad",unit_type:we.kGradians},{name:"ms",unit_type:we.kMilliseconds},{name:"s",unit_type:we.kSeconds},{name:"rem",unit_type:we.kRems},{name:"turn",unit_type:we.kTurns}],jo=(function(r){return r[r.kUnknownType=0]="kUnknownType",r[r.kUnparsedType=1]="kUnparsedType",r[r.kKeywordType=2]="kKeywordType",r[r.kUnitType=3]="kUnitType",r[r.kSumType=4]="kSumType",r[r.kProductType=5]="kProductType",r[r.kNegateType=6]="kNegateType",r[r.kInvertType=7]="kInvertType",r[r.kMinType=8]="kMinType",r[r.kMaxType=9]="kMaxType",r[r.kClampType=10]="kClampType",r[r.kTransformType=11]="kTransformType",r[r.kPositionType=12]="kPositionType",r[r.kURLImageType=13]="kURLImageType",r[r.kColorType=14]="kColorType",r[r.kUnsupportedColorType=15]="kUnsupportedColorType",r})({}),a3=function(e){return i3.find(function(t){return t.name===e}).unit_type},s3=function(e){return e?e==="number"?we.kNumber:e==="percent"||e==="%"?we.kPercentage:a3(e):we.kUnknown},o3=function(e){switch(e){case we.kNumber:case we.kInteger:return fi.kUNumber;case we.kPercentage:return fi.kUPercent;case we.kPixels:return fi.kULength;case we.kMilliseconds:case we.kSeconds:return fi.kUTime;case we.kDegrees:case we.kRadians:case we.kGradians:case we.kTurns:return fi.kUAngle;default:return fi.kUOther}},A3=function(e){switch(e){case fi.kUNumber:return we.kNumber;case fi.kULength:return we.kPixels;case fi.kUPercent:return we.kPercentage;case fi.kUTime:return we.kSeconds;case fi.kUAngle:return we.kDegrees;default:return we.kUnknown}},Wb=function(e){var t=1;switch(e){case we.kPixels:case we.kDegrees:case we.kSeconds:break;case we.kMilliseconds:t=.001;break;case we.kRadians:t=180/Math.PI;break;case we.kGradians:t=.9;break;case we.kTurns:t=360;break}return t},Mw=function(e){switch(e){case we.kNumber:case we.kInteger:return"";case we.kPercentage:return"%";case we.kEms:return"em";case we.kRems:return"rem";case we.kPixels:return"px";case we.kDegrees:return"deg";case we.kRadians:return"rad";case we.kGradians:return"grad";case we.kMilliseconds:return"ms";case we.kSeconds:return"s";case we.kTurns:return"turn"}return""},Ph=(function(){function r(){ue(this,r)}return he(r,[{key:"toString",value:function(){return this.buildCSSText(n3.kNo,r3.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=jo.kUnitType&&this.getType()<=jo.kClampType}}],[{key:"isAngle",value:function(t){return t===we.kDegrees||t===we.kRadians||t===we.kGradians||t===we.kTurns}},{key:"isLength",value:function(t){return t>=we.kEms&&t<we.kDegrees}},{key:"isRelativeUnit",value:function(t){return t===we.kPercentage||t===we.kEms||t===we.kRems}},{key:"isTime",value:function(t){return t===we.kSeconds||t===we.kMilliseconds}}])})(),l3=(function(r){function e(t){var n;return ue(this,e),n=qe(this,e),n.colorSpace=t,n}return $e(e,r),he(e,[{key:"getType",value:function(){return jo.kColorType}},{key:"to",value:function(n){return this}}])})(Ph),Qa=(function(r){return r[r.Constant=0]="Constant",r[r.LinearGradient=1]="LinearGradient",r[r.RadialGradient=2]="RadialGradient",r})({}),lc=(function(r){function e(t,n){var i;return ue(this,e),i=qe(this,e),i.type=t,i.value=n,i}return $e(e,r),he(e,[{key:"clone",value:function(){return new e(this.type,this.value)}},{key:"buildCSSText",value:function(n,i,a){return a}},{key:"getType",value:function(){return jo.kColorType}}])})(Ph),ii=(function(r){function e(t){var n;return ue(this,e),n=qe(this,e),n.value=t,n}return $e(e,r),he(e,[{key:"clone",value:function(){return new e(this.value)}},{key:"getType",value:function(){return jo.kKeywordType}},{key:"buildCSSText",value:function(n,i,a){return a+this.value}}])})(Ph),c3=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(e)?n="NaN":e>0?n="infinity":n="-infinity",n+=t},Ow=function(e){return A3(o3(e))},Bt=(function(r){function e(t){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:we.kNumber;ue(this,e),n=qe(this,e);var a;return typeof i=="string"?a=s3(i):a=i,n.unit=a,n.value=t,n}return $e(e,r),he(e,[{key:"clone",value:function(){return new e(this.value,this.unit)}},{key:"equals",value:function(n){var i=n;return this.value===i.value&&this.unit===i.unit}},{key:"getType",value:function(){return jo.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new e(this.value,this.unit);var i=Ow(this.unit);if(i!==Ow(n)||i===we.kUnknown)return null;var a=Wb(this.unit)/Wb(n);return new e(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case we.kUnknown:break;case we.kInteger:s=Number(this.value).toFixed(0);break;case we.kNumber:case we.kPercentage:case we.kEms:case we.kRems:case we.kPixels:case we.kDegrees:case we.kRadians:case we.kGradians:case we.kMilliseconds:case we.kSeconds:case we.kTurns:{var o=-999999,A=999999,l=this.value,c=Mw(this.unit);if(l<o||l>A){var u=Mw(this.unit);!Number.isFinite(l)||Number.isNaN(l)?s=c3(l,u):s=l+(u||"")}else s="".concat(l).concat(c)}}return a+=s,a}}])})(Ph),hi=new Bt(0,"px");new Bt(1,"px");var Hs=new Bt(0,"deg"),q1=(function(r){function e(t,n,i){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return ue(this,e),a=qe(this,e,["rgb"]),a.r=t,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return $e(e,r),he(e,[{key:"clone",value:function(){return new e(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(n,i,a){return"".concat(a,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])})(l3),qb=new ii("unset"),u3=new ii("initial"),h3=new ii("inherit"),Rf={"":qb,unset:qb,initial:u3,inherit:h3},d3=function(e){return Rf[e]||(Rf[e]=new ii(e)),Rf[e]},AI=new q1(0,0,0,0,!0),lI=new q1(0,0,0,0),f3=hn(function(r,e,t,n){return new q1(r,e,t,n)},function(r,e,t,n){return"rgba(".concat(r,",").concat(e,",").concat(t,",").concat(n,")")}),Rt=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:we.kNumber;return new Bt(e,t)};new Bt(50,"%");function g3(r){var e=r.type,t=r.value;return e==="hex"?"#".concat(t):e==="literal"?t:e==="rgb"?"rgb(".concat(t.join(","),")"):"rgba(".concat(t.join(","),")")}var v3=(function(){var r={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},e="";function t(K){throw new Error("".concat(e,": ").concat(K))}function n(){var K=i();return e.length>0&&t("Invalid input not EOF"),K}function i(){return m(a)}function a(){return s("linear-gradient",r.linearGradient,A)||s("repeating-linear-gradient",r.repeatingLinearGradient,A)||s("radial-gradient",r.radialGradient,u)||s("repeating-radial-gradient",r.repeatingRadialGradient,u)||s("conic-gradient",r.conicGradient,u)}function s(K,D,X){return o(D,function(te){var ie=X();return ie&&(W(r.comma)||t("Missing comma before color stops")),{type:K,orientation:ie,colorStops:m(B)}})}function o(K,D){var X=W(K);if(X){W(r.startCall)||t("Missing (");var te=D(X);return W(r.endCall)||t("Missing )"),te}}function A(){return l()||c()}function l(){return G("directional",r.sideOrCorner,1)}function c(){return G("angular",r.angleValue,1)}function u(){var K,D=h(),X;return D&&(K=[],K.push(D),X=e,W(r.comma)&&(D=h(),D?K.push(D):e=X)),K}function h(){var K=d()||f();if(K)K.at=v();else{var D=g();if(D){K=D;var X=v();X&&(K.at=X)}else{var te=p();te&&(K={type:"default-radial",at:te})}}return K}function d(){var K=G("shape",/^(circle)/i,0);return K&&(K.style=U()||g()),K}function f(){var K=G("shape",/^(ellipse)/i,0);return K&&(K.style=k()||g()),K}function g(){return G("extent-keyword",r.extentKeywords,1)}function v(){if(G("position",/^at/,0)){var K=p();return K||t("Missing positioning value"),K}}function p(){var K=y();if(K.x||K.y)return{type:"position",value:K}}function y(){return{x:k(),y:k()}}function m(K){var D=K(),X=[];if(D)for(X.push(D);W(r.comma);)D=K(),D?X.push(D):t("One extra comma");return X}function B(){var K=C();return K||t("Expected color definition"),K.length=k(),K}function C(){return F()||O()||T()||S()}function S(){return G("literal",r.literalColor,0)}function F(){return G("hex",r.hexColor,1)}function T(){return o(r.rgbColor,function(){return{type:"rgb",value:m(_)}})}function O(){return o(r.rgbaColor,function(){return{type:"rgba",value:m(_)}})}function _(){return W(r.number)[1]}function k(){return G("%",r.percentageValue,1)||L()||U()}function L(){return G("position-keyword",r.positionKeywords,1)}function U(){return G("px",r.pixelValue,1)||G("em",r.emValue,1)}function G(K,D,X){var te=W(D);if(te)return{type:K,value:te[X]}}function W(K){var D=/^[\n\r\t\s]+/.exec(e);D&&V(D[0].length);var X=K.exec(e);return X&&V(X[0].length),X}function V(K){e=e.substring(K)}return function(K){return e=K,n()}})();function p3(r,e,t,n){var i=ft(n.value),a=0,s=0,o=a+e/2,A=s+t/2,l=Math.abs(e*Math.cos(i))+Math.abs(t*Math.sin(i)),c=r[0]+o-Math.cos(i)*l/2,u=r[1]+A-Math.sin(i)*l/2,h=r[0]+o+Math.cos(i)*l/2,d=r[1]+A+Math.sin(i)*l/2;return{x1:c,y1:u,x2:h,y2:d}}function y3(r,e,t,n,i,a){var s=n.value,o=i.value;n.unit===we.kPercentage&&(s=n.value/100*e),i.unit===we.kPercentage&&(o=i.value/100*t);var A=Math.max(wr([0,0],[s,o]),wr([0,t],[s,o]),wr([e,t],[s,o]),wr([e,0],[s,o]));return a&&(a instanceof Bt?A=a.value:a instanceof ii&&(a.value==="closest-side"?A=Math.min(s,e-s,o,t-o):a.value==="farthest-side"?A=Math.max(s,e-s,o,t-o):a.value==="closest-corner"&&(A=Math.min(wr([0,0],[s,o]),wr([0,t],[s,o]),wr([e,t],[s,o]),wr([e,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:A}}var m3=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,w3=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,B3=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,cI=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function b3(r){var e,t=r.length;if(r[t-1].length=(e=r[t-1].length)!==null&&e!==void 0?e:{type:"%",value:"100"},t>1){var n;r[0].length=(n=r[0].length)!==null&&n!==void 0?n:{type:"%",value:"0"}}for(var i=0,a=Number(r[0].length.value),s=1;s<t;s++){var o,A=(o=r[s].length)===null||o===void 0?void 0:o.value;if(!ke(A)&&!ke(a)){for(var l=1;l<s-i;l++)r[i+l].length={type:"%",value:"".concat(a+(Number(A)-a)*l/(s-i))};i=s,a=Number(A)}}}var E3={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},x3=hn(function(r){var e;return r.type==="angular"?e=Number(r.value):e=E3[r.value]||0,Rt(e,"deg")}),C3=hn(function(r){var e=50,t=50,n="%",i="%";if((r==null?void 0:r.type)==="position"){var a=r.value,s=a.x,o=a.y;(s==null?void 0:s.type)==="position-keyword"&&(s.value==="left"?e=0:s.value==="center"?e=50:s.value==="right"?e=100:s.value==="top"?t=0:s.value==="bottom"&&(t=100)),(o==null?void 0:o.type)==="position-keyword"&&(o.value==="left"?e=0:o.value==="center"?t=50:o.value==="right"?e=100:o.value==="top"?t=0:o.value==="bottom"&&(t=100)),((s==null?void 0:s.type)==="px"||(s==null?void 0:s.type)==="%"||(s==null?void 0:s.type)==="em")&&(n=s==null?void 0:s.type,e=Number(s.value)),((o==null?void 0:o.type)==="px"||(o==null?void 0:o.type)==="%"||(o==null?void 0:o.type)==="em")&&(i=o==null?void 0:o.type,t=Number(o.value))}return{cx:Rt(e,n),cy:Rt(t,i)}}),S3=hn(function(r){if(r.indexOf("linear")>-1||r.indexOf("radial")>-1){var e=v3(r);return e.map(function(o){var A=o.type,l=o.orientation,c=o.colorStops;b3(c);var u=c.map(function(m){return{offset:Rt(Number(m.length.value),"%"),color:g3(m)}});if(A==="linear-gradient")return new lc(Qa.LinearGradient,{angle:l?x3(l):Hs,steps:u});if(A==="radial-gradient"&&(l||(l=[{type:"shape",value:"circle"}]),l[0].type==="shape"&&l[0].value==="circle")){var h=C3(l[0].at),d=h.cx,f=h.cy,g;if(l[0].style){var v=l[0].style,p=v.type,y=v.value;p==="extent-keyword"?g=d3(y):g=Rt(y,p)}return new lc(Qa.RadialGradient,{cx:d,cy:f,size:g,steps:u})}})}var t=r[0];if(r[1]==="("||r[2]==="("){if(t==="l"){var n=m3.exec(r);if(n){var i,a=((i=n[2].match(cI))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new lc(Qa.LinearGradient,{angle:Rt(parseFloat(n[1]),"deg"),steps:a.map(function(o){var A=We(o,2),l=A[0],c=A[1];return{offset:Rt(Number(l)*100,"%"),color:c}})})]}}else if(t==="r"){var s=F3(r);if(s)if(At(s))r=s;else return[new lc(Qa.RadialGradient,s)]}else if(t==="p")return T3(r)}});function F3(r){var e=w3.exec(r);if(e){var t,n=((t=e[4].match(cI))===null||t===void 0?void 0:t.map(function(i){return i.split(":")}))||[];return{cx:Rt(50,"%"),cy:Rt(50,"%"),steps:n.map(function(i){var a=We(i,2),s=a[0],o=a[1];return{offset:Rt(Number(s)*100,"%"),color:o}})}}return null}function T3(r){var e=B3.exec(r);if(e){var t=e[1],n=e[2];switch(t){case"a":t="repeat";break;case"x":t="repeat-x";break;case"y":t="repeat-y";break;case"n":t="no-repeat";break;default:t="no-repeat"}return{image:n,repetition:t}}return null}function Gs(r){return r&&!!r.image}function th(r){return r&&!ke(r.r)&&!ke(r.g)&&!ke(r.b)}var YA=hn(function(r){if(Gs(r))return De({repetition:"repeat"},r);if(ke(r)&&(r=""),r==="transparent")return lI;if(r==="currentColor")r="black";else if(r==="none")return AI;var e=S3(r);if(e)return e;var t=Uh(r),n=[0,0,0,0];return t!==null&&(n[0]=t.r||0,n[1]=t.g||0,n[2]=t.b||0,n[3]=t.opacity),f3.apply(void 0,n)});function M3(r,e){if(!(!th(r)||!th(e)))return[[Number(r.r),Number(r.g),Number(r.b),Number(r.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(t){var n=t.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(Yt(n[i],0,255));return n[3]=Yt(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function Ml(r,e){if(ke(e))return Rt(0,"px");if(e="".concat(e).trim().toLowerCase(),isFinite(Number(e))){if("px".search(r)>=0)return Rt(Number(e),"px");if("deg".search(r)>=0)return Rt(Number(e),"deg")}var t=[];e=e.replace(r,function(i){return t.push(i),"U".concat(i)});var n="U(".concat(r.source,")");return t.map(function(i){return Rt(Number(e.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var uI=function(e){return Ml(new RegExp("px","g"),e)},O3=hn(uI),_3=function(e){return Ml(new RegExp("%","g"),e)};hn(_3);var hI=function(e){return Be(e)||isFinite(Number(e))?Rt(Number(e)||0,"px"):Ml(new RegExp("px|%|em|rem","g"),e)},_w=hn(hI),dI=function(e){return Ml(new RegExp("deg|rad|grad|turn","g"),e)},I3=hn(dI);function k3(r,e,t,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a="",s=r.value||0,o=e.value||0,A=Ow(r.unit),l=r.convertTo(A),c=e.convertTo(A);return l&&c?(s=l.value,o=c.value,a=Mw(r.unit)):(Bt.isLength(r.unit)||Bt.isLength(e.unit))&&(s=Nr(r,i,t),o=Nr(e,i,t),a="px"),[s,o,function(u){return u+a}]}function br(r){var e=0;return r.unit===we.kDegrees?e=r.value:r.unit===we.kRadians?e=Br(Number(r.value)):r.unit===we.kTurns?e=_D(Number(r.value)):r.value&&(e=r.value),e}function $b(r,e){var t;return Array.isArray(r)?t=r.map(function(n){return Number(n)}):At(r)?t=r.split(" ").map(function(n){return Number(n)}):Be(r)&&(t=[r]),e===2?t.length===1?[t[0],t[0]]:[t[0],t[1]]:e===4?t.length===1?[t[0],t[0],t[0],t[0]]:t.length===2?[t[0],t[1],t[0],t[1]]:t.length===3?[t[0],t[1],t[2],t[1]]:[t[0],t[1],t[2],t[3]]:e==="even"&&t.length%2===1?[].concat(tt(t),tt(t)):t}function Nr(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===we.kPixels)return Number(r.value);if(r.unit===we.kPercentage&&t){var i=t.nodeName===ae.GROUP?t.getLocalBounds():t.getGeometryBounds();return(n?i.min[e]:0)+r.value/100*i.halfExtents[e]*2}return 0}var L3=function(e){return Ml(/deg|rad|grad|turn|px|%/g,e)},Q3=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function N3(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(r=r.toLowerCase().trim(),r==="none")return[];for(var e=/\s*([\w-]+)\(([^)]*)\)/g,t=[],n,i=0;n=e.exec(r);){if(n.index!==i)return[];if(i=n.index+n[0].length,Q3.indexOf(n[1])>-1&&t.push({name:n[1],params:n[2].split(" ").map(function(a){return L3(a)||YA(a)})}),e.lastIndex===r.length)return t}return[]}function fI(r){return r.toString()}var gI=function(e){return typeof e=="number"?Rt(e):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(e)?Rt(Number(e)):Rt(0)},Iw=hn(gI);hn(function(r){return At(r)?r.split(" ").map(Iw):r.map(Iw)});function $1(r,e){return[r,e,fI]}function Y1(r,e){return function(t,n){return[t,n,function(i){return fI(Yt(i,r,e))}]}}function vI(r,e){if(r.length===e.length)return[r,e,function(t){return t}]}function kw(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=JR(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function U3(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=yD(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function P3(r){for(var e=0;e<r.length;e++){var t=r[e-1],n=r[e],i=n[0];if(i==="M"&&t){var a=t[0],s=[n[1],n[2]],o=void 0;a==="L"||a==="M"?o=[t[1],t[2]]:(a==="C"||a==="A"||a==="Q")&&(o=[t[t.length-2],t[t.length-1]]),o&&nh(s,o)&&(r.splice(e,1),e--)}}}function R3(r){for(var e=!1,t=r.length,n=0;n<t;n++){var i=r[n],a=i[0];if(a==="C"||a==="A"||a==="Q"){e=!0;break}}return e}function D3(r){for(var e=[],t=[],n=[],i=0;i<r.length;i++){var a=r[i],s=a[0];s==="M"?(n.length&&(t.push(n),n=[]),n.push([a[1],a[2]])):s==="Z"?n.length&&(e.push(n),n=[]):n.push([a[1],a[2]])}return n.length>0&&t.push(n),{polygons:e,polylines:t}}function nh(r,e){return r[0]===e[0]&&r[1]===e[1]}function H3(r,e){for(var t=[],n=[],i=[],a=0;a<r.length;a++){var s=r[a],o=s.currentPoint,A=s.params,l=s.prePoint,c=void 0;switch(s.command){case"Q":c=mD(l[0],l[1],A[1],A[2],A[3],A[4]);break;case"C":c=gD(l[0],l[1],A[1],A[2],A[3],A[4],A[5],A[6]);break;case"A":var u=s.arcParams;c=hD(u.cx,u.cy,u.rx,u.ry,u.xRotation,u.startAngle,u.endAngle);break;default:t.push(o[0]),n.push(o[1]);break}c&&(s.box=c,t.push(c.x,c.x+c.width),n.push(c.y,c.y+c.height))}t=t.filter(function(B){return!Number.isNaN(B)&&B!==1/0&&B!==-1/0}),n=n.filter(function(B){return!Number.isNaN(B)&&B!==1/0&&B!==-1/0});var h=Wu(t),d=Wu(n),f=ju(t),g=ju(n);if(i.length===0)return{x:h,y:d,width:f-h,height:g-d};for(var v=0;v<i.length;v++){var p=i[v],y=p.currentPoint,m=void 0;y[0]===h?(m=cc(p,e),h-=m.xExtra):y[0]===f&&(m=cc(p,e),f+=m.xExtra),y[1]===d?(m=cc(p,e),d-=m.yExtra):y[1]===g&&(m=cc(p,e),g+=m.yExtra)}return{x:h,y:d,width:f-h,height:g-d}}function cc(r,e){var t=r.prePoint,n=r.currentPoint,i=r.nextPoint,a=Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),o=Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2),A=Math.acos((a+s-o)/(2*Math.sqrt(a)*Math.sqrt(s)));if(!A||Math.sin(A)===0||Lo(A,0))return{xExtra:0,yExtra:0};var l=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),c=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));l=l>Math.PI/2?Math.PI-l:l,c=c>Math.PI/2?Math.PI-c:c;var u={xExtra:Math.cos(A/2-l)*(e/2*(1/Math.sin(A/2)))-e/2||0,yExtra:Math.cos(c-A/2)*(e/2*(1/Math.sin(A/2)))-e/2||0};return u}function Yb(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}var Xb=function(e,t){var n=e.x*t.x+e.y*t.y,i=Math.sqrt((Math.pow(e.x,2)+Math.pow(e.y,2))*(Math.pow(t.x,2)+Math.pow(t.y,2))),a=e.x*t.y-e.y*t.x<0?-1:1,s=a*Math.acos(n/i);return s},Zb=function(e,t,n,i,a,s,o,A){t=Math.abs(t),n=Math.abs(n),i=G_(i,360);var l=ft(i);if(e.x===o.x&&e.y===o.y)return{x:e.x,y:e.y,ellipticalArcAngle:0};if(t===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(e.x-o.x)/2,u=(e.y-o.y)/2,h={x:Math.cos(l)*c+Math.sin(l)*u,y:-Math.sin(l)*c+Math.cos(l)*u},d=Math.pow(h.x,2)/Math.pow(t,2)+Math.pow(h.y,2)/Math.pow(n,2);d>1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var f=Math.pow(t,2)*Math.pow(n,2)-Math.pow(t,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2),g=Math.pow(t,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2),v=f/g;v=v<0?0:v;var p=(a!==s?1:-1)*Math.sqrt(v),y={x:p*(t*h.y/n),y:p*(-(n*h.x)/t)},m={x:Math.cos(l)*y.x-Math.sin(l)*y.y+(e.x+o.x)/2,y:Math.sin(l)*y.x+Math.cos(l)*y.y+(e.y+o.y)/2},B={x:(h.x-y.x)/t,y:(h.y-y.y)/n},C=Xb({x:1,y:0},B),S={x:(-h.x-y.x)/t,y:(-h.y-y.y)/n},F=Xb(B,S);!s&&F>0?F-=2*Math.PI:s&&F<0&&(F+=2*Math.PI),F%=2*Math.PI;var T=C+F*A,O=t*Math.cos(T),_=n*Math.sin(T),k={x:Math.cos(l)*O-Math.sin(l)*_+m.x,y:Math.sin(l)*O+Math.cos(l)*_+m.y,ellipticalArcStartAngle:C,ellipticalArcEndAngle:C+F,ellipticalArcAngle:T,ellipticalArcCenter:m,resultantRx:t,resultantRy:n};return k};function G3(r){for(var e=[],t=null,n=null,i=null,a=0,s=r.length,o=0;o<s;o++){var A=r[o];n=r[o+1];var l=A[0],c={command:l,prePoint:t,params:A,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(l){case"M":i=[A[1],A[2]],a=o;break;case"A":var u=K3(t,A);c.arcParams=u;break}if(l==="Z")t=i,n=r[a+1];else{var h=A.length;t=[A[h-2],A[h-1]]}n&&n[0]==="Z"&&(n=r[a],e[a]&&(e[a].prePoint=t)),c.currentPoint=t,e[a]&&nh(t,e[a].currentPoint)&&(e[a].prePoint=c.prePoint);var d=n?[n[n.length-2],n[n.length-1]]:null;c.nextPoint=d;var f=c.prePoint;if(["L","H","V"].includes(l))c.startTangent=[f[0]-t[0],f[1]-t[1]],c.endTangent=[t[0]-f[0],t[1]-f[1]];else if(l==="Q"){var g=[A[1],A[2]];c.startTangent=[f[0]-g[0],f[1]-g[1]],c.endTangent=[t[0]-g[0],t[1]-g[1]]}else if(l==="T"){var v=e[o-1],p=Yb(v.currentPoint,f);v.command==="Q"?(c.command="Q",c.startTangent=[f[0]-p[0],f[1]-p[1]],c.endTangent=[t[0]-p[0],t[1]-p[1]]):(c.command="TL",c.startTangent=[f[0]-t[0],f[1]-t[1]],c.endTangent=[t[0]-f[0],t[1]-f[1]])}else if(l==="C"){var y=[A[1],A[2]],m=[A[3],A[4]];c.startTangent=[f[0]-y[0],f[1]-y[1]],c.endTangent=[t[0]-m[0],t[1]-m[1]],c.startTangent[0]===0&&c.startTangent[1]===0&&(c.startTangent=[y[0]-m[0],y[1]-m[1]]),c.endTangent[0]===0&&c.endTangent[1]===0&&(c.endTangent=[m[0]-y[0],m[1]-y[1]])}else if(l==="S"){var B=e[o-1],C=Yb(B.currentPoint,f),S=[A[1],A[2]];B.command==="C"?(c.command="C",c.startTangent=[f[0]-C[0],f[1]-C[1]],c.endTangent=[t[0]-S[0],t[1]-S[1]]):(c.command="SQ",c.startTangent=[f[0]-S[0],f[1]-S[1]],c.endTangent=[t[0]-S[0],t[1]-S[1]])}else if(l==="A"){var F=Jb(c,0),T=F.x,O=F.y,_=Jb(c,1,!1),k=_.x,L=_.y;c.startTangent=[T,O],c.endTangent=[k,L]}e.push(c)}return e}function Jb(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,A=n.xRotation,l=n.arcFlag,c=n.sweepFlag,u=Zb({x:r.prePoint[0],y:r.prePoint[1]},a,o,A,!!l,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},e),h=Zb({x:r.prePoint[0],y:r.prePoint[1]},a,o,A,!!l,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},t?e+.005:e-.005),d=h.x-u.x,f=h.y-u.y,g=Math.sqrt(d*d+f*f);return{x:-d/g,y:-f/g}}function uc(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Lw(r,e){return uc(r)*uc(e)?(r[0]*e[0]+r[1]*e[1])/(uc(r)*uc(e)):1}function eE(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(Lw(r,e))}function K3(r,e){var t=e[1],n=e[2],i=G_(ft(e[3]),Math.PI*2),a=e[4],s=e[5],o=r[0],A=r[1],l=e[6],c=e[7],u=Math.cos(i)*(o-l)/2+Math.sin(i)*(A-c)/2,h=-1*Math.sin(i)*(o-l)/2+Math.cos(i)*(A-c)/2,d=u*u/(t*t)+h*h/(n*n);d>1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var f=t*t*(h*h)+n*n*(u*u),g=f?Math.sqrt((t*t*(n*n)-f)/f):1;a===s&&(g*=-1),isNaN(g)&&(g=0);var v=n?g*t*h/n:0,p=t?g*-n*u/t:0,y=(o+l)/2+Math.cos(i)*v-Math.sin(i)*p,m=(A+c)/2+Math.sin(i)*v+Math.cos(i)*p,B=[(u-v)/t,(h-p)/n],C=[(-1*u-v)/t,(-1*h-p)/n],S=eE([1,0],B),F=eE(B,C);return Lw(B,C)<=-1&&(F=Math.PI),Lw(B,C)>=1&&(F=0),s===0&&F>0&&(F-=2*Math.PI),s===1&&F<0&&(F+=2*Math.PI),{cx:y,cy:m,rx:nh(r,[l,c])?0:t,ry:nh(r,[l,c])?0:n,startAngle:S,endAngle:S+F,xRotation:i,arcFlag:a,sweepFlag:s}}var pI=function(e){if(e===""||Array.isArray(e)&&e.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var t;try{t=$u(e)}catch{t=$u(""),console.error("[g]: Invalid SVG Path definition: ".concat(e))}P3(t);var n=R3(t),i=D3(t),a=i.polygons,s=i.polylines,o=G3(t),A=H3(o,0),l=A.x,c=A.y,u=A.width,h=A.height;return{absolutePath:t,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(l)?l:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(u)?u:0,height:Number.isFinite(h)?h:0}}},z3=hn(pI);function yI(r){return At(r)?z3(r):pI(r)}function V3(r,e,t){var n=r.curve,i=e.curve;(!n||n.length===0)&&(n=bw(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=bw(e.absolutePath,!1),e.curve=i);var a=[n,i];n.length!==i.length&&(a=Z_(n,i));var s=Tb(a[0])!==Tb(a[1])?WR(a[0]):jR(a[0]);return[s,tD(a[1],s),function(o){return o}]}function j3(r,e){var t;return At(r)?t=r.split(" ").map(function(n){var i=n.split(","),a=We(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):t=r,{points:t,totalLength:0,segments:[]}}function W3(r,e){return[r.points,e.points,function(t){return t}]}var $t=null,Uo=/\s*(\w+)\(([^)]*)\)/g;function pr(r){return function(e){var t=0;return r.map(function(n){return n===$t?e[t++]:n})}}function us(r){return r}var cl={matrix:["NNNNNN",[$t,$t,0,0,$t,$t,0,0,0,0,1,0,$t,$t,0,1],us],matrix3d:["NNNNNNNNNNNNNNNN",us],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",pr([$t,$t,new Bt(1)]),us],scaleX:["N",pr([$t,new Bt(1),new Bt(1)]),pr([$t,new Bt(1)])],scaleY:["N",pr([new Bt(1),$t,new Bt(1)]),pr([new Bt(1),$t])],scaleZ:["N",pr([new Bt(1),new Bt(1),$t])],scale3d:["NNN",us],skew:["Aa",null,us],skewX:["A",null,pr([$t,Hs])],skewY:["A",null,pr([Hs,$t])],translate:["Tt",pr([$t,$t,hi]),us],translateX:["T",pr([$t,hi,hi]),pr([$t,hi])],translateY:["T",pr([hi,$t,hi]),pr([hi,$t])],translateZ:["L",pr([hi,hi,$t])],translate3d:["TTL",us]};function mI(r){for(var e=[],t=r.length,n=0;n<t;n++){var i=r[n],a=i[0],s=i.slice(1);a==="translate"||a==="skew"?s.length===1&&s.push(0):a==="scale"&&s.length===1&&s.push(s[0]);var o=cl[a];if(!o)return[];var A=s.map(function(l){return Rt(l)});e.push({t:a,d:A})}return e}function wI(r){if(Array.isArray(r))return mI(r);if(r=(r||"none").trim(),r==="none")return[];var e=[],t,n=0;for(Uo.lastIndex=0;t=Uo.exec(r);){if(t.index!==n)return[];n=t.index+t[0].length;var i=t[1],a=cl[i];if(!a)return[];var s=t[2].split(","),o=a[0];if(o.length<s.length)return[];for(var A=[],l=0;l<o.length;l++){var c=s[l],u=o[l],h=void 0;if(c?h={A:function(f){return f.trim()==="0"?Hs:I3(f)},N:Iw,T:_w,L:O3}[u.toUpperCase()](c):h={a:Hs,n:A[0],t:hi}[u],h===void 0)return[];A.push(h)}if(e.push({t:i,d:A}),Uo.lastIndex===r.length)return e}return[]}function q3(r){if(Array.isArray(r))return mI(r);if(r=(r||"none").trim(),r==="none")return[];var e=[],t,n=0;for(Uo.lastIndex=0;t=Uo.exec(r);){if(t.index!==n)return[];n=t.index+t[0].length;var i=t[1],a=cl[i];if(!a)return[];var s=t[2].split(","),o=a[0];if(o.length<s.length)return[];for(var A=[],l=0;l<o.length;l++){var c=s[l],u=o[l],h=void 0;if(c?h={A:function(f){return f.trim()==="0"?Hs:dI(f)},N:gI,T:hI,L:uI}[u.toUpperCase()](c):h={a:Hs,n:A[0],t:hi}[u],h===void 0)return[];A.push(h)}if(e.push({t:i,d:A}),Uo.lastIndex===r.length)return e}return[]}function $3(r){var e,t,n,i;switch(r.t){case"rotateX":return i=ft(br(r.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotateY":return i=ft(br(r.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotateZ":return i=ft(br(r.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":e=r.d[0].value,t=r.d[1].value,n=r.d[2].value,i=ft(br(r.d[3]));var a=e*e+t*t+n*n;if(a===0)e=1,t=0,n=0;else if(a!==1){var s=Math.sqrt(a);e/=s,t/=s,n/=s}var o=Math.sin(i/2),A=o*Math.cos(i/2),l=o*o;return[1-2*(t*t+n*n)*l,2*(e*t*l+n*A),2*(e*n*l-t*A),0,2*(e*t*l-n*A),1-2*(e*e+n*n)*l,2*(t*n*l+e*A),0,2*(e*n*l+t*A),2*(t*n*l-e*A),1-2*(e*e+t*t)*l,0,0,0,0,1];case"scale":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[r.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaleY":return[1,0,0,0,0,r.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scaleZ":return[1,0,0,0,0,1,0,0,0,0,r.d[0].value,0,0,0,0,1];case"scale3d":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,r.d[2].value,0,0,0,0,1];case"skew":var c=ft(br(r.d[0])),u=ft(br(r.d[1]));return[1,Math.tan(u),0,0,Math.tan(c),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=ft(br(r.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return i=ft(br(r.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return e=Nr(r.d[0],0,null)||0,t=Nr(r.d[1],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,e,t,0,1];case"translateX":return e=Nr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,e,0,0,1];case"translateY":return t=Nr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,t,0,1];case"translateZ":return n=Nr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,n,1];case"translate3d":return e=Nr(r.d[0],0,null)||0,t=Nr(r.d[1],0,null)||0,n=Nr(r.d[2],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,e,t,n,1];case"perspective":var h=Nr(r.d[0],0,null)||0,d=h?-1/h:0;return[1,0,0,0,0,1,0,0,0,0,1,d,0,0,0,1];case"matrix":return[r.d[0].value,r.d[1].value,0,0,r.d[2].value,r.d[3].value,0,0,0,0,1,0,r.d[4].value,r.d[5].value,0,1];case"matrix3d":return r.d.map(function(f){return f.value})}}function Y3(r,e){return[r[0]*e[0]+r[4]*e[1]+r[8]*e[2]+r[12]*e[3],r[1]*e[0]+r[5]*e[1]+r[9]*e[2]+r[13]*e[3],r[2]*e[0]+r[6]*e[1]+r[10]*e[2]+r[14]*e[3],r[3]*e[0]+r[7]*e[1]+r[11]*e[2]+r[15]*e[3],r[0]*e[4]+r[4]*e[5]+r[8]*e[6]+r[12]*e[7],r[1]*e[4]+r[5]*e[5]+r[9]*e[6]+r[13]*e[7],r[2]*e[4]+r[6]*e[5]+r[10]*e[6]+r[14]*e[7],r[3]*e[4]+r[7]*e[5]+r[11]*e[6]+r[15]*e[7],r[0]*e[8]+r[4]*e[9]+r[8]*e[10]+r[12]*e[11],r[1]*e[8]+r[5]*e[9]+r[9]*e[10]+r[13]*e[11],r[2]*e[8]+r[6]*e[9]+r[10]*e[10]+r[14]*e[11],r[3]*e[8]+r[7]*e[9]+r[11]*e[10]+r[15]*e[11],r[0]*e[12]+r[4]*e[13]+r[8]*e[14]+r[12]*e[15],r[1]*e[12]+r[5]*e[13]+r[9]*e[14]+r[13]*e[15],r[2]*e[12]+r[6]*e[13]+r[10]*e[14]+r[14]*e[15],r[3]*e[12]+r[7]*e[13]+r[11]*e[14]+r[15]*e[15]]}function X3(r){return r.length===0?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:r.map($3).reduce(Y3)}function tE(r){var e=[0,0,0],t=[1,1,1],n=[0,0,0],i=[0,0,0,1],a=[0,0,0,1];return ND(X3(r),e,t,n,i,a),[[e,t,n,a,i]]}var Z3=(function(){function r(n,i){for(var a=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],s=0;s<4;s++)for(var o=0;o<4;o++)for(var A=0;A<4;A++)a[s][o]+=i[s][A]*n[A][o];return a}function e(n){return n[0][2]===0&&n[0][3]===0&&n[1][2]===0&&n[1][3]===0&&n[2][0]===0&&n[2][1]===0&&n[2][2]===1&&n[2][3]===0&&n[3][2]===0&&n[3][3]===1}function t(n,i,a,s,o){for(var A=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],l=0;l<4;l++)A[l][3]=o[l];for(var c=0;c<3;c++)for(var u=0;u<3;u++)A[3][c]+=n[u]*A[u][c];var h=s[0],d=s[1],f=s[2],g=s[3],v=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];v[0][0]=1-2*(d*d+f*f),v[0][1]=2*(h*d-f*g),v[0][2]=2*(h*f+d*g),v[1][0]=2*(h*d+f*g),v[1][1]=1-2*(h*h+f*f),v[1][2]=2*(d*f-h*g),v[2][0]=2*(h*f-d*g),v[2][1]=2*(d*f+h*g),v[2][2]=1-2*(h*h+d*d),A=r(A,v);var p=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];a[2]&&(p[2][1]=a[2],A=r(A,p)),a[1]&&(p[2][1]=0,p[2][0]=a[0],A=r(A,p)),a[0]&&(p[2][0]=0,p[1][0]=a[0],A=r(A,p));for(var y=0;y<3;y++)for(var m=0;m<3;m++)A[y][m]*=i[y];return e(A)?[A[0][0],A[0][1],A[1][0],A[1][1],A[3][0],A[3][1]]:A[0].concat(A[1],A[2],A[3])}return t})();function J3(r){return r.toFixed(6).replace(".000000","")}function Df(r,e){var t,n;return r.decompositionPair!==e&&(r.decompositionPair=e,t=tE(r)),e.decompositionPair!==r&&(e.decompositionPair=r,n=tE(e)),t[0]===null||n[0]===null?[[!1],[!0],function(i){return i?e[0].d:r[0].d}]:(t[0].push(0),n[0].push(1),[t,n,function(i){var a=t4(t[0][3],n[0][3],i[5]),s=Z3(i[0],i[1],i[2],a,i[4]),o=s.map(J3).join(",");return o}])}function e4(r,e){for(var t=0,n=0;n<r.length;n++)t+=r[n]*e[n];return t}function t4(r,e,t){var n=e4(r,e);n=Yt(n,-1,1);var i=[];if(n===1)i=r;else for(var a=Math.acos(n),s=Math.sin(t*a)*1/Math.sqrt(1-n*n),o=0;o<4;o++)i.push(r[o]*(Math.cos(t*a)-n*s)+e[o]*s);return i}function Hf(r){return r.replace(/[XY]/,"")}function Gf(r){return r.replace(/(X|Y|Z|3d)?$/,"3d")}var n4=function(e,t){return e==="perspective"&&t==="perspective"||(e==="matrix"||e==="matrix3d")&&(t==="matrix"||t==="matrix3d")};function r4(r,e,t){var n=!1;if(!r.length||!e.length){r.length||(n=!0,r=e,e=[]);for(var i=function(){var k=r[a],L=k.t,U=k.d,G=L.substring(0,5)==="scale"?1:0;e.push({t:L,d:U.map(function(W){return typeof W=="number"?Rt(G):Rt(G,W.unit)})})},a=0;a<r.length;a++)i()}var s=[],o=[],A=[];if(r.length!==e.length){var l=Df(r,e);s=[l[0]],o=[l[1]],A=[["matrix",[l[2]]]]}else for(var c=0;c<r.length;c++){var u=r[c].t,h=e[c].t,d=r[c].d,f=e[c].d,g=cl[u],v=cl[h],p=void 0;if(n4(u,h)){var y=Df([r[c]],[e[c]]);s.push(y[0]),o.push(y[1]),A.push(["matrix",[y[2]]]);continue}else if(u===h)p=u;else if(g[2]&&v[2]&&Hf(u)===Hf(h))p=Hf(u),d=g[2](d),f=v[2](f);else if(g[1]&&v[1]&&Gf(u)===Gf(h))p=Gf(u),d=g[1](d),f=v[1](f);else{var m=Df(r,e);s=[m[0]],o=[m[1]],A=[["matrix",[m[2]]]];break}for(var B=[],C=[],S=[],F=0;F<d.length;F++){var T=k3(d[F],f[F],t,!1,F);B[F]=T[0],C[F]=T[1],S.push(T[2])}s.push(B),o.push(C),A.push([p,S])}if(n){var O=s;s=o,o=O}return[s,o,function(_){return _.map(function(k,L){var U=k.map(function(G,W){return A[L][1][W](G)}).join(",");return A[L][0]==="matrix"&&U.split(",").length===16&&(A[L][0]="matrix3d"),A[L][0]==="matrix3d"&&U.split(",").length===6&&(A[L][0]="matrix"),"".concat(A[L][0],"(").concat(U,")")}).join(" ")}]}var i4=hn(function(r){if(At(r)){if(r==="text-anchor")return[Rt(0,"px"),Rt(0,"px")];var e=r.split(" ");return e.length===1&&(e[0]==="top"||e[0]==="bottom"?(e[1]=e[0],e[0]="center"):e[1]="center"),e.length!==2?null:[_w(nE(e[0])),_w(nE(e[1]))]}return[Rt(r[0]||0,"px"),Rt(r[1]||0,"px")]});function nE(r){return r==="center"?"50%":r==="left"||r==="top"?"0%":r==="right"||r==="bottom"?"100%":r}var X1=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:pe.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:pe.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:pe.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:pe.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:pe.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:pe.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:pe.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:pe.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:pe.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:pe.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:pe.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:pe.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:pe.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:pe.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:pe.FILTER},{n:"clipPath",syntax:pe.DEFINED_PATH},{n:"textPath",syntax:pe.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:pe.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:pe.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:pe.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:pe.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:pe.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:pe.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:pe.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:pe.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:pe.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:pe.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:pe.COORDINATE},{n:"y1",int:!0,l:!0,syntax:pe.COORDINATE},{n:"z1",int:!0,l:!0,syntax:pe.COORDINATE},{n:"x2",int:!0,l:!0,syntax:pe.COORDINATE},{n:"y2",int:!0,l:!0,syntax:pe.COORDINATE},{n:"z2",int:!0,l:!0,syntax:pe.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:pe.PATH,p:50},{n:"points",int:!0,l:!0,syntax:pe.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:pe.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:pe.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:pe.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:pe.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:pe.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:pe.NUMBER,d:function(e){return e===ae.PATH||e===ae.POLYGON||e===ae.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:pe.MARKER},{n:"markerEnd",syntax:pe.MARKER},{n:"markerMid",syntax:pe.MARKER},{n:"markerStartOffset",syntax:pe.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:pe.LENGTH,l:!0,int:!0,d:"0"}],a4=new Set(X1.filter(function(r){return!!r.l}).map(function(r){return r.n})),BI={},s4=(function(){function r(e){var t=this;ue(this,r),this.runtime=e,X1.forEach(function(n){t.registerMetadata(n)})}return he(r,[{key:"registerMetadata",value:function(t){[t.n].concat(tt(t.a||[])).forEach(function(n){BI[n]=t})}},{key:"getPropertySyntax",value:function(t){return this.runtime.CSSPropertySyntaxFactory[t]}},{key:"processProperties",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{forceUpdateGeometry:!1};Object.assign(t.attributes,n);var a=t.parsedStyle.clipPath,s=t.parsedStyle.offsetPath;o4(t,n);var o=!!i.forceUpdateGeometry;if(!o){for(var A in n)if(a4.has(A)){o=!0;break}}var l=bI(t);l.has("fill")&&n.fill&&(t.parsedStyle.fill=YA(n.fill)),l.has("stroke")&&n.stroke&&(t.parsedStyle.stroke=YA(n.stroke)),l.has("shadowColor")&&n.shadowColor&&(t.parsedStyle.shadowColor=YA(n.shadowColor)),l.has("filter")&&n.filter&&(t.parsedStyle.filter=N3(n.filter)),l.has("radius")&&!ke(n.radius)&&(t.parsedStyle.radius=$b(n.radius,4)),l.has("lineDash")&&!ke(n.lineDash)&&(t.parsedStyle.lineDash=$b(n.lineDash,"even")),l.has("points")&&n.points&&(t.parsedStyle.points=j3(n.points)),l.has("d")&&n.d===""&&(t.parsedStyle.d=De({},aI)),l.has("d")&&n.d&&(t.parsedStyle.d=yI(n.d)),l.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[pe.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},t,null),l.has("clipPath")&&!He(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[pe.DEFINED_PATH].calculator("clipPath",a,n.clipPath,t,this.runtime),l.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[pe.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,t,this.runtime),l.has("transform")&&n.transform&&(t.parsedStyle.transform=wI(n.transform)),l.has("transformOrigin")&&n.transformOrigin&&(t.parsedStyle.transformOrigin=i4(n.transformOrigin)),l.has("markerStart")&&n.markerStart&&(t.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[pe.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),l.has("markerEnd")&&n.markerEnd&&(t.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[pe.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),l.has("markerMid")&&n.markerMid&&(t.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[pe.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),l.has("zIndex")&&!ke(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[pe.Z_INDEX].postProcessor(t),l.has("offsetDistance")&&!ke(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[pe.OFFSET_DISTANCE].postProcessor(t),l.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[pe.TRANSFORM].postProcessor(t),l.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[pe.TRANSFORM_ORIGIN].postProcessor(t),o&&(t.dirty(!0,!0),i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtyToRoot(t))}},{key:"updateGeometry",value:function(t){var n=t.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=t.geometry;a.contentBounds||(a.contentBounds=new It),a.renderBounds||(a.renderBounds=new It);var s=t.parsedStyle,o=i.update(s,t),A=o.cx,l=A===void 0?0:A,c=o.cy,u=c===void 0?0:c,h=o.cz,d=h===void 0?0:h,f=o.hwidth,g=f===void 0?0:f,v=o.hheight,p=v===void 0?0:v,y=o.hdepth,m=y===void 0?0:y,B=[Math.abs(g),Math.abs(p),m],C=s.stroke,S=s.lineWidth,F=S===void 0?1:S,T=s.increasedLineWidthForHitTesting,O=T===void 0?0:T,_=s.shadowType,k=_===void 0?"outer":_,L=s.shadowColor,U=s.filter,G=U===void 0?[]:U,W=s.transformOrigin,V=[l,u,d];a.contentBounds.update(V,B);var K=n===ae.POLYLINE||n===ae.POLYGON||n===ae.PATH?Math.SQRT2:.5,D=C&&!C.isNone;if(D){var X=((F||0)+(O||0))*K;B[0]+=X,B[1]+=X}if(a.renderBounds.update(V,B),L&&k&&k!=="inner"){var te=a.renderBounds,ie=te.min,re=te.max,xe=s.shadowBlur,$=s.shadowOffsetX,z=s.shadowOffsetY,ee=xe||0,Ae=$||0,be=z||0,Le=ie[0]-ee+Ae,Ue=re[0]+ee+Ae,at=ie[1]-ee+be,lt=re[1]+ee+be;ie[0]=Math.min(ie[0],Le),re[0]=Math.max(re[0],Ue),ie[1]=Math.min(ie[1],at),re[1]=Math.max(re[1],lt),a.renderBounds.setMinMax(ie,re)}G.forEach(function(nt){var gr=nt.name,St=nt.params;if(gr==="blur"){var Ji=St[0].value;a.renderBounds.update(a.renderBounds.center,Va(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[Ji,Ji,0]))}else if(gr==="drop-shadow"){var ir=St[0].value,Wt=St[1].value,_t=St[2].value,Qn=a.renderBounds,qn=Qn.min,vr=Qn.max,ar=qn[0]-_t+ir,$n=vr[0]+_t+ir,rn=qn[1]-_t+Wt,an=vr[1]+_t+Wt;qn[0]=Math.min(qn[0],ar),vr[0]=Math.max(vr[0],$n),qn[1]=Math.min(qn[1],rn),vr[1]=Math.max(vr[1],an),a.renderBounds.setMinMax(qn,vr)}}),t.geometry.dirty=!1;var ct=g<0,pt=p<0,Ne=(ct?-1:1)*(W?Nr(W[0],0,t,!0):0),ht=(pt?-1:1)*(W?Nr(W[1],1,t,!0):0);(Ne||ht)&&t.setOrigin(Ne,ht)}}},{key:"updateSizeAttenuation",value:function(t,n){t.style.isSizeAttenuation?(t.style.rawLineWidth||(t.style.rawLineWidth=t.style.lineWidth),t.style.lineWidth=(t.style.rawLineWidth||1)/n,t.nodeName===ae.CIRCLE&&(t.style.rawR||(t.style.rawR=t.style.r),t.style.r=(t.style.rawR||1)/n)):(t.style.rawLineWidth&&(t.style.lineWidth=t.style.rawLineWidth,delete t.style.rawLineWidth),t.nodeName===ae.CIRCLE&&t.style.rawR&&(t.style.r=t.style.rawR,delete t.style.rawR))}}])})();function o4(r,e){var t=bI(r);for(var n in e)t.has(n)&&(r.parsedStyle[n]=e[n])}function bI(r){return r.constructor.PARSED_STYLE_LIST}var A4=(function(){function r(){ue(this,r),this.mixer=$1}return he(r,[{key:"calculator",value:function(t,n,i,a){return br(i)}}])})(),l4=(function(){function r(){ue(this,r)}return he(r,[{key:"calculator",value:function(t,n,i,a,s){return i instanceof ii&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(t,n,i,a),t==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtyToRoot(o)}),i}}])})(),c4=(function(){function r(){ue(this,r),this.parser=YA,this.mixer=M3}return he(r,[{key:"calculator",value:function(t,n,i,a){return i instanceof ii?i.value==="none"?AI:lI:i}}])})(),u4=(function(){function r(){ue(this,r)}return he(r,[{key:"calculator",value:function(t,n,i){return i instanceof ii?[]:i}}])})();function rE(r){var e=r.parsedStyle,t=e.fontSize;return ke(t)?null:t}var Qw=(function(){function r(){ue(this,r),this.mixer=$1}return he(r,[{key:"calculator",value:function(t,n,i,a,s){if(Be(i))return i;if(Bt.isRelativeUnit(i.unit)){if(i.unit===we.kPercentage)return 0;if(i.unit===we.kEms){if(a.parentNode){var o=rE(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===we.kRems){var A;if(a!=null&&(A=a.ownerDocument)!==null&&A!==void 0&&A.documentElement){var l=rE(a.ownerDocument.documentElement);if(l)return l*=i.value,l}return 0}}else return i.value}}])})(),h4=(function(){function r(){ue(this,r),this.mixer=vI}return he(r,[{key:"calculator",value:function(t,n,i){return i.map(function(a){return a.value})}}])})(),d4=(function(){function r(){ue(this,r),this.mixer=vI}return he(r,[{key:"calculator",value:function(t,n,i){return i.map(function(a){return a.value})}}])})(),f4=(function(){function r(){ue(this,r)}return he(r,[{key:"calculator",value:function(t,n,i,a){var s;i instanceof ii&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])})(),g4=(function(){function r(){ue(this,r),this.mixer=$1}return he(r,[{key:"calculator",value:function(t,n,i){return i.value}}])})(),v4=(function(){function r(){ue(this,r),this.mixer=Y1(0,1)}return he(r,[{key:"calculator",value:function(t,n,i){return i.value}},{key:"postProcessor",value:function(t){var n=t.parsedStyle,i=n.offsetPath,a=n.offsetDistance;if(i){var s=i.nodeName;if(s===ae.LINE||s===ae.PATH||s===ae.POLYLINE){var o=i.getPoint(a);o&&t.setLocalPosition(o.x,o.y)}}}}])})(),p4=(function(){function r(){ue(this,r),this.mixer=Y1(0,1)}return he(r,[{key:"calculator",value:function(t,n,i){return i.value}}])})(),y4=(function(){function r(){ue(this,r),this.parser=yI,this.mixer=V3}return he(r,[{key:"calculator",value:function(t,n,i){return i instanceof ii&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Vo(0,0,0,0)}:i}}])})(),m4=he(function r(){ue(this,r),this.mixer=W3}),w4=(function(r){function e(){var t;ue(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return t=qe(this,e,[].concat(i)),t.mixer=Y1(0,1/0),t}return $e(e,r),he(e)})(Qw),B4=(function(){function r(){ue(this,r)}return he(r,[{key:"calculator",value:function(t,n,i,a){return i instanceof ii?i.value==="unset"?"":i.value:"".concat(i)}},{key:"postProcessor",value:function(t){t.nodeValue="".concat(t.parsedStyle.text)||""}}])})(),b4=(function(){function r(){ue(this,r)}return he(r,[{key:"calculator",value:function(t,n,i,a){var s=a.getAttribute("text");if(s){var o=s;i.value==="capitalize"?o=s.charAt(0).toUpperCase()+s.slice(1):i.value==="lowercase"?o=s.toLowerCase():i.value==="uppercase"&&(o=s.toUpperCase()),a.parsedStyle.text=o}return i.value}}])})(),Kf=new WeakMap;function E4(r,e,t){if(r){var n=typeof r=="string"?document.getElementById(r):r;Kf.has(n)&&Kf.get(n).destroy(t),Kf.set(n,e)}}var Z1=typeof window<"u"&&typeof window.document<"u";function x4(r){return!!r.getAttribute}function C4(r,e){for(var t=0,n=r.length;t<n;){var i=t+n>>>1;EI(r[i],e)<0?t=i+1:n=i}return t}function EI(r,e){var t=Number(r.parsedStyle.zIndex||0),n=Number(e.parsedStyle.zIndex||0);if(t===n){var i=r.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(r)-a.indexOf(e)}}return t-n}function xI(r){var e=r;do{var t,n=(t=e.parsedStyle)===null||t===void 0?void 0:t.clipPath;if(n)return e;e=e.parentElement}while(e!==null);return null}var iE="px";function S4(r,e,t){Z1&&r.style&&(r.style.width=e+iE,r.style.height=t+iE)}function CI(r,e){if(Z1)return document.defaultView.getComputedStyle(r,null).getPropertyValue(e)}function F4(r){var e=CI(r,"width");return e==="auto"?r.offsetWidth:parseFloat(e)}function T4(r){var e=CI(r,"height");return e==="auto"?r.offsetHeight:parseFloat(e)}var M4=1,O4={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Nw=typeof performance=="object"&&performance.now?performance:Date;function rh(r){return r.nodeName===ae.FRAGMENT?!0:r.getRootNode().nodeName===ae.FRAGMENT}function $s(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auto",e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,n=!1,i=!1,a=!!e&&!e.isNone,s=!!t&&!t.isNone;return r==="visiblepainted"||r==="painted"||r==="auto"?(n=a,i=s):r==="visiblefill"||r==="fill"?n=!0:r==="visiblestroke"||r==="stroke"?i=!0:(r==="visible"||r==="all")&&(n=!0,i=!0),[n,i]}var _4=1,I4=function(){return _4++},Gi=typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:{},k4=Date.now(),L4=function(){return Gi.performance&&typeof Gi.performance.now=="function"?Gi.performance.now():Date.now()-k4},MA={},aE=Date.now(),Q4=function(e){if(typeof e!="function")throw new TypeError("".concat(e," is not a function"));var t=Date.now(),n=t-aE,i=n>16?0:16-n,a=I4();return MA[a]=e,Object.keys(MA).length>1||setTimeout(function(){aE=t;var s=MA;MA={},Object.keys(s).forEach(function(o){return s[o](L4())})},i),a},N4=function(e){delete MA[e]},U4=["","webkit","moz","ms","o"],SI=function(e){return typeof e!="string"?Q4:e===""?Gi.requestAnimationFrame:Gi["".concat(e,"RequestAnimationFrame")]},P4=function(e){return typeof e!="string"?N4:e===""?Gi.cancelAnimationFrame:Gi["".concat(e,"CancelAnimationFrame")]||Gi["".concat(e,"CancelRequestAnimationFrame")]},R4=function(e,t){for(var n=0;e[n]!==void 0;){if(t(e[n]))return e[n];n+=1}},FI=R4(U4,function(r){return!!SI(r)}),J1=SI(FI),TI=P4(FI);Gi.requestAnimationFrame=J1;Gi.cancelAnimationFrame=TI;var D4=(function(){function r(){ue(this,r),this.callbacks=[]}return he(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(t,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Promise.all(this.callbacks.map(function(a){return a.apply(void 0,n)}))}}])})(),H4=(function(){function r(){ue(this,r),this.callbacks=[]}return he(r,[{key:"tapPromise",value:function(t,n){this.callbacks.push(n)}},{key:"promise",value:(function(){var e=Ja(Gn().mark(function n(){var i,a,s,o,A=arguments;return Gn().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!this.callbacks.length){l.next=6;break}return l.next=1,(i=this.callbacks)[0].apply(i,A);case 1:a=l.sent,s=1;case 2:if(!(s<this.callbacks.length)){l.next=5;break}return o=this.callbacks[s],l.next=3,o(a);case 3:a=l.sent;case 4:s++,l.next=2;break;case 5:return l.abrupt("return",a);case 6:return l.abrupt("return",null);case 7:case"end":return l.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t})()}])})(),sr=(function(){function r(){ue(this,r),this.callbacks=[]}return he(r,[{key:"tap",value:function(t,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var a=arguments;this.callbacks.forEach(function(s){s.apply(void 0,a)})}}])})(),zf=(function(){function r(){ue(this,r),this.callbacks=[]}return he(r,[{key:"tap",value:function(t,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(this.callbacks.length){for(var a=arguments,s=this.callbacks[0].apply(void 0,a),o=1;o<this.callbacks.length;o++){var A=this.callbacks[o];s=A(s)}return s}return null}}])})(),G4=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],K4=/([\"\'])[^\'\"]+\1/;function sE(r){var e=r.fontSize,t=e===void 0?16:e,n=r.fontFamily,i=n===void 0?"sans-serif":n,a=r.fontStyle,s=a===void 0?"normal":a,o=r.fontVariant,A=o===void 0?"normal":o,l=r.fontWeight,c=l===void 0?"normal":l;return{fontSize:t,fontFamily:i,fontStyle:s,fontVariant:A,fontWeight:c}}var oE=hn(function(e){for(var t=sE(e),n=t.fontSize,i=t.fontFamily,a=t.fontStyle,s=t.fontVariant,o=t.fontWeight,A=Be(n)&&"".concat(n,"px")||"16px",l=i.split(","),c=l.length-1;c>=0;c--){var u=l[c].trim();!K4.test(u)&&G4.indexOf(u)<0&&(u='"'.concat(u,'"')),l[c]=u}return"".concat(a," ").concat(s," ").concat(o," ").concat(A," ").concat(l.join(","))},function(r){var e=sE(r),t=e.fontSize,n=e.fontFamily,i=e.fontStyle,a=e.fontVariant,s=e.fontWeight;return"".concat(i,"_").concat(a,"_").concat(s,"_").concat(t,"_").concat(n)}),z4=1e-6,gA=function(e){return Math.max(e,z4)};function Vf(r,e,t){return Xa(r),r[4]=Math.tan(e),r[1]=Math.tan(t),r}var An=xt(),V4=xt(),j4={scale:function(e){bs(An,[e[0].value,e[1].value,1].map(function(t){return gA(t)}))},scaleX:function(e){bs(An,[e[0].value,1,1].map(function(t){return gA(t)}))},scaleY:function(e){bs(An,[1,e[0].value,1].map(function(t){return gA(t)}))},scaleZ:function(e){bs(An,[1,1,e[0].value].map(function(t){return gA(t)}))},scale3d:function(e){bs(An,[e[0].value,e[1].value,e[2].value].map(function(t){return gA(t)}))},translate:function(e){Ia(An,[e[0].value,e[1].value,0])},translateX:function(e){Ia(An,[e[0].value,0,0])},translateY:function(e){Ia(An,[0,e[0].value,0])},translateZ:function(e){Ia(An,[0,0,e[0].value])},translate3d:function(e){Ia(An,[e[0].value,e[1].value,e[2].value])},rotate:function(e){fw(An,ft(br(e[0])))},rotateX:function(e){F_(An,ft(br(e[0])))},rotateY:function(e){T_(An,ft(br(e[0])))},rotateZ:function(e){fw(An,ft(br(e[0])))},rotate3d:function(e){S_(An,ft(br(e[3])),[e[0].value,e[1].value,e[2].value])},skew:function(e){Vf(An,ft(e[0].value),ft(e[1].value))},skewX:function(e){Vf(An,ft(e[0].value),0)},skewY:function(e){Vf(An,0,ft(e[0].value))},matrix:function(e){dw(An,e[0].value,e[1].value,0,0,e[2].value,e[3].value,0,0,0,0,1,0,e[4].value,e[5].value,0,1)},matrix3d:function(e){dw.apply(DP,[An].concat(tt(e.map(function(t){return t.value}))))}},W4=Ct(1,1,1),q4=Ze(),AE={translate:function(e,t){de.sceneGraphService.setLocalScale(e,W4,!1),de.sceneGraphService.setLocalEulerAngles(e,q4,void 0,void 0,!1),de.sceneGraphService.setLocalPosition(e,[t[0].value,t[1].value,0],!1),de.sceneGraphService.dirtyLocalTransform(e,e.transformable)}};function MI(r,e){if(r.length){if(r.length===1&&AE[r[0].t]){AE[r[0].t](e,r[0].d);return}for(var t=Xa(V4),n=0;n<r.length;n++){var i=r[n],a=i.t,s=i.d,o=j4[a];o&&(o(s),N_(t,t,An))}e.setLocalTransform(t)}else e.resetLocalTransform();return e.getLocalTransform()}var $4=(function(){function r(){ue(this,r),this.parser=q3,this.mixer=r4}return he(r,[{key:"calculator",value:function(t,n,i,a){return i instanceof ii?[]:i}},{key:"postProcessor",value:function(t){MI(t.parsedStyle.transform,t)}}])})(),Y4=(function(){function r(){ue(this,r)}return he(r,[{key:"postProcessor",value:function(t){var n=t.parsedStyle.transformOrigin;n[0].unit===we.kPixels&&n[1].unit===we.kPixels?t.setOrigin(n[0].value,n[1].value):t.getGeometryBounds()}}])})(),X4=(function(){function r(){ue(this,r)}return he(r,[{key:"calculator",value:function(t,n,i,a){return i.value}},{key:"postProcessor",value:function(t){if(t.parentNode){var n=t.parentNode,i=n.renderable,a=n.sortable;i&&n.dirty(),a&&(a.dirty=!0,a.dirtyReason=Zu.Z_INDEX_CHANGED)}}}])})(),Z4=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t,n){var i=t.cx,a=i===void 0?0:i,s=t.cy,o=s===void 0?0:s,A=t.r,l=A===void 0?0:A;return{cx:a,cy:o,hwidth:l,hheight:l}}}])})(),J4=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t,n){var i=t.cx,a=i===void 0?0:i,s=t.cy,o=s===void 0?0:s,A=t.rx,l=A===void 0?0:A,c=t.ry,u=c===void 0?0:c;return{cx:a,cy:o,hwidth:l,hheight:u}}}])})(),eH=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t){var n=t.x1,i=t.y1,a=t.x2,s=t.y2,o=Math.min(n,a),A=Math.max(n,a),l=Math.min(i,s),c=Math.max(i,s),u=A-o,h=c-l,d=u/2,f=h/2;return{cx:o+d,cy:l+f,hwidth:d,hheight:f}}}])})(),tH=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t){var n=t.d,i=n.rect,a=i.x,s=i.y,o=i.width,A=i.height,l=o/2,c=A/2;return{cx:a+l,cy:s+c,hwidth:l,hheight:c}}}])})(),nH=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t){if(t.points&&Mr(t.points.points)){var n=t.points.points,i=Math.min.apply(Math,tt(n.map(function(h){return h[0]}))),a=Math.max.apply(Math,tt(n.map(function(h){return h[0]}))),s=Math.min.apply(Math,tt(n.map(function(h){return h[1]}))),o=Math.max.apply(Math,tt(n.map(function(h){return h[1]}))),A=a-i,l=o-s,c=A/2,u=l/2;return{cx:i+c,cy:s+u,hwidth:c,hheight:u}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])})(),rH=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t,n){var i=t.x,a=i===void 0?0:i,s=t.y,o=s===void 0?0:s,A=t.src,l=t.width,c=l===void 0?0:l,u=t.height,h=u===void 0?0:u,d=c,f=h;return A&&!At(A)&&(d||(d=A.width,t.width=d),f||(f=A.height,t.height=f)),{cx:a+d/2,cy:o+f/2,hwidth:d/2,hheight:f/2}}}])})(),iH=(function(){function r(e){ue(this,r),this.globalRuntime=e}return he(r,[{key:"isReadyToMeasure",value:function(t,n){var i=t.text;return i}},{key:"update",value:function(t,n){var i,a=t.text,s=t.textAlign,o=s===void 0?"start":s,A=t.lineWidth,l=A===void 0?1:A,c=t.textBaseline,u=c===void 0?"alphabetic":c,h=t.dx,d=h===void 0?0:h,f=t.dy,g=f===void 0?0:f,v=t.x,p=v===void 0?0:v,y=t.y,m=y===void 0?0:y;if(!this.isReadyToMeasure(t,n))return t.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{hwidth:0,hheight:0,cx:0,cy:0};var B=(n==null||(i=n.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0?void 0:i.getConfig())||{},C=B.offscreenCanvas,S=this.globalRuntime.textService.measureText(a,t,C);t.metrics=S;var F=S.width,T=S.height,O=F/2,_=T/2,k=p+O;o==="center"||o==="middle"?k+=l/2-O:(o==="right"||o==="end")&&(k+=l-O*2);var L=m-_;return u==="middle"?L+=_:u==="top"||u==="hanging"?L+=_*2:u==="alphabetic"||(u==="bottom"||u==="ideographic")&&(L+=0),d&&(k+=d),g&&(L+=g),{cx:k,cy:L,hwidth:O,hheight:_}}}])})(),aH=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t,n){return{cx:0,cy:0,hwidth:0,hheight:0}}}])})(),sH=(function(){function r(){ue(this,r)}return he(r,[{key:"update",value:function(t,n){var i=t.x,a=i===void 0?0:i,s=t.y,o=s===void 0?0:s,A=t.width,l=A===void 0?0:A,c=t.height,u=c===void 0?0:c;return{cx:a+l/2,cy:o+u/2,hwidth:l/2,hheight:u/2}}}])})(),Rh=(function(){function r(e){ue(this,r),this.eventPhase=r.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Dn,this.page=new Dn,this.canvas=new Dn,this.viewport=new Dn,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}return he(r,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}},{key:"clone",value:function(){throw new Error(wt)}}])})(),OI=(function(r){function e(){var t;ue(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return t=qe(this,e,[].concat(i)),t.client=new Dn,t.movement=new Dn,t.offset=new Dn,t.global=new Dn,t.screen=new Dn,t}return $e(e,r),he(e,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(n){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(n)}},{key:"initMouseEvent",value:function(){throw new Error(wt)}}])})(Rh),ih=(function(r){function e(){var t;ue(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return t=qe(this,e,[].concat(i)),t.width=0,t.height=0,t.isPrimary=!1,t}return $e(e,r),he(e,[{key:"getCoalescedEvents",value:function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])})(OI),Uw=(function(r){function e(){return ue(this,e),qe(this,e,arguments)}return $e(e,r),he(e,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])})(OI),vn=(function(r){function e(t,n){var i;return ue(this,e),i=qe(this,e,[null]),i.type=t,i.detail=n==null?void 0:n.detail,n&&!("detail"in n)&&(i.detail=n),Object.assign(i,n),i}return $e(e,r),he(e)})(Rh),_I=(function(){function r(){ue(this,r),this.emitter=new p_}return he(r,[{key:"on",value:function(t,n,i){return this.addEventListener(t,n,i),this}},{key:"addEventListener",value:function(t,n,i){var a=!1,s=!1;if(sl(i))a=i;else if(i){var o=i.capture;a=o===void 0?!1:o;var A=i.once;s=A===void 0?!1:A}a&&(t+="capture"),n=Te(n)?n:n.handleEvent;var l=Te(n)?void 0:n;return s?this.emitter.once(t,n,l):this.emitter.on(t,n,l),this}},{key:"off",value:function(t,n,i){return t?this.removeEventListener(t,n,i):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var t;(t=this.emitter)===null||t===void 0||t.removeAllListeners()}},{key:"removeEventListener",value:function(t,n,i){var a;if(!this.emitter)return this;var s=sl(i)?i:i==null?void 0:i.capture;s&&(t+="capture"),n=Te(n)?n:(a=n)===null||a===void 0?void 0:a.handleEvent;var o=Te(n)?void 0:n;return this.emitter.off(t,n,o),this}},{key:"emit",value:function(t,n){this.dispatchEvent(new vn(t,n))}},{key:"dispatchEventToSelf",value:function(t){t.target||(t.target=this),t.currentTarget=this,this.emitter.emit(t.type,t)}},{key:"dispatchEvent",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0;if(i)return this.dispatchEventToSelf(t),!0;var a;if(this.document)a=this;else if(this.defaultView)a=this.defaultView;else{var s;a=(s=this.ownerDocument)===null||s===void 0?void 0:s.defaultView}if(a){if(t.manager=a.getEventService(),!t.manager)return!1;t.defaultPrevented=!1,t.path?t.path.length=0:t.page=[],n||(t.target=this),t.manager.dispatchEvent(t,t.type,n)}else this.dispatchEventToSelf(t);return!t.defaultPrevented}}])})(),Vt=(function(r){function e(){var t;ue(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return t=qe(this,e,[].concat(i)),t.shadow=!1,t.ownerDocument=null,t.isConnected=!1,t.baseURI="",t.childNodes=[],t.nodeType=0,t.nodeName="",t.nodeValue=null,t.mutations=void 0,t.parentNode=null,t.destroyed=!1,t}return $e(e,r),he(e,[{key:"textContent",get:function(){var n="";this.nodeName===ae.TEXT&&(n+=this.style.text);var i=ka(this.childNodes),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;s.nodeName===ae.TEXT?n+=s.nodeValue:n+=s.textContent}}catch(o){i.e(o)}finally{i.f()}return n},set:function(n){var i=this;this.childNodes.slice().forEach(function(a){i.removeChild(a)}),this.nodeName===ae.TEXT&&(this.style.text="".concat(n))}},{key:"getRootNode",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(wt)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(wt)}},{key:"lookupPrefix",value:function(n){throw new Error(wt)}},{key:"normalize",value:function(){throw new Error(wt)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(A=i.parentNode)!==null&&A!==void 0?A:a.parentNode;){var A;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return e.DOCUMENT_POSITION_DISCONNECTED|e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|e.DOCUMENT_POSITION_PRECEDING;var l=s.length>o.length?s:o,c=l===s?o:s;if(l[l.length-c.length]===c[0])return l===s?e.DOCUMENT_POSITION_CONTAINED_BY|e.DOCUMENT_POSITION_FOLLOWING:e.DOCUMENT_POSITION_CONTAINS|e.DOCUMENT_POSITION_PRECEDING;for(var u=l.length-c.length,h=c.length-1;h>=0;h--){var d=c[h],f=l[u+h];if(f!==d){var g=d.parentNode.childNodes;return g.indexOf(d)<g.indexOf(f)?c===s?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING:l===s?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING}}return e.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(n){return this.contains(n)}},{key:"contains",value:function(n){for(var i=n;i&&this!==i;)i=i.parentNode;return!!i}},{key:"getAncestor",value:function(n){for(var i=this;n>0&&i;)i=i.parentNode,n--;return i}},{key:"forEach",value:function(n){for(var i=[this];i.length>0;){var a=i.pop(),s=n(a);if(s===!1)break;for(var o=a.childNodes.length-1;o>=0;o--)i.push(a.childNodes[o])}}}],[{key:"isNode",value:function(n){return!!n.childNodes}}])})(_I);Vt.DOCUMENT_POSITION_DISCONNECTED=1;Vt.DOCUMENT_POSITION_PRECEDING=2;Vt.DOCUMENT_POSITION_FOLLOWING=4;Vt.DOCUMENT_POSITION_CONTAINS=8;Vt.DOCUMENT_POSITION_CONTAINED_BY=16;Vt.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var oH=2048,AH=(function(){function r(e,t){var n=this;ue(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=xt(),this.tmpVec3=Ze(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var s=a.button===2;n.dispatchEvent(a,s?"rightdown":"mousedown")}var o=n.trackingData(i.pointerId);o.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a=Nw.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var A=n.trackingData(i.pointerId),l=n.findMountedTarget(A.pressTargetsByButton[i.button]),c=l;if(l&&!s.composedPath().includes(l)){for(var u=l;u&&!s.composedPath().includes(u);){if(s.currentTarget=u,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var h=s.button===2;n.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}Vt.isNode(u)&&(u=u.parentNode)}delete A.pressTargetsByButton[i.button],c=u}if(c){var d,f=n.clonePointerEvent(s,"click");f.target=c,f.path=[],A.clicksByButton[i.button]||(A.clicksByButton[i.button]={clickCount:0,target:f.target,timeStamp:a});var g=n.context.renderingContext.root.ownerDocument.defaultView,v=A.clicksByButton[i.button];v.target===f.target&&a-v.timeStamp<g.getConfig().dblClickSpeed?++v.clickCount:v.clickCount=1,v.target=f.target,v.timeStamp=a,f.detail=v.clickCount,(d=s.detail)!==null&&d!==void 0&&d.preventClick||(!n.context.config.useNativeClickEvent&&(f.pointerType==="mouse"||f.pointerType==="touch")&&n.dispatchEvent(f,"click"),n.dispatchEvent(f,"pointertap")),n.freeEvent(f)}n.freeEvent(s)},this.onPointerMove=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),s=a.pointerType==="mouse"||a.pointerType==="pen",o=n.trackingData(i.pointerId),A=n.findMountedTarget(o.overTargets);if(o.overTargets&&A!==a.target){var l=i.type==="mousemove"?"mouseout":"pointerout",c=n.createPointerEvent(i,l,A||void 0);if(n.dispatchEvent(c,"pointerout"),s&&n.dispatchEvent(c,"mouseout"),!a.composedPath().includes(A)){var u=n.createPointerEvent(i,"pointerleave",A||void 0);for(u.eventPhase=u.AT_TARGET;u.target&&!a.composedPath().includes(u.target);)u.currentTarget=u.target,n.notifyTarget(u),s&&n.notifyTarget(u,"mouseleave"),Vt.isNode(u.target)&&(u.target=u.target.parentNode);n.freeEvent(u)}n.freeEvent(c)}if(A!==a.target){var h=i.type==="mousemove"?"mouseover":"pointerover",d=n.clonePointerEvent(a,h);n.dispatchEvent(d,"pointerover"),s&&n.dispatchEvent(d,"mouseover");for(var f=A&&Vt.isNode(A)&&A.parentNode;f&&f!==(Vt.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&f!==a.target;)f=f.parentNode;var g=!f||f===(Vt.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(g){var v=n.clonePointerEvent(a,"pointerenter");for(v.eventPhase=v.AT_TARGET;v.target&&v.target!==A&&v.target!==(Vt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)v.currentTarget=v.target,n.notifyTarget(v),s&&n.notifyTarget(v,"mouseenter"),Vt.isNode(v.target)&&(v.target=v.target.parentNode);n.freeEvent(v)}n.freeEvent(d)}n.dispatchEvent(a,"pointermove"),a.pointerType==="touch"&&n.dispatchEvent(a,"touchmove"),s&&(n.dispatchEvent(a,"mousemove"),n.cursor=n.getCursor(a.target)),o.overTargets=a.composedPath(),n.freeEvent(a)},this.onPointerOut=function(i){var a=n.trackingData(i.pointerId);if(a.overTargets){var s=i.pointerType==="mouse"||i.pointerType==="pen",o=n.findMountedTarget(a.overTargets),A=n.createPointerEvent(i,"pointerout",o||void 0);n.dispatchEvent(A),s&&n.dispatchEvent(A,"mouseout");var l=n.createPointerEvent(i,"pointerleave",o||void 0);for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==(Vt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),s&&n.notifyTarget(l,"mouseleave"),Vt.isNode(l.target)&&(l.target=l.target.parentNode);a.overTargets=null,n.freeEvent(A),n.freeEvent(l)}n.cursor=null},this.onPointerOver=function(i){var a=n.trackingData(i.pointerId),s=n.createPointerEvent(i),o=s.pointerType==="mouse"||s.pointerType==="pen";n.dispatchEvent(s,"pointerover"),o&&n.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(n.cursor=n.getCursor(s.target));var A=n.clonePointerEvent(s,"pointerenter");for(A.eventPhase=A.AT_TARGET;A.target&&A.target!==(Vt.isNode(n.rootTarget)&&n.rootTarget.parentNode);)A.currentTarget=A.target,n.notifyTarget(A),o&&n.notifyTarget(A,"mouseenter"),Vt.isNode(A.target)&&(A.target=A.target.parentNode);a.overTargets=s.composedPath(),n.freeEvent(s),n.freeEvent(A)},this.onPointerUpOutside=function(i){var a=n.trackingData(i.pointerId),s=n.findMountedTarget(a.pressTargetsByButton[i.button]),o=n.createPointerEvent(i);if(s){for(var A=s;A;)o.currentTarget=A,n.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"||(o.pointerType==="mouse"||o.pointerType==="pen")&&n.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),Vt.isNode(A)&&(A=A.parentNode);delete a.pressTargetsByButton[i.button]}n.freeEvent(o)},this.onWheel=function(i){var a=n.createWheelEvent(i);n.dispatchEvent(a),n.freeEvent(a)},this.onClick=function(i){if(n.context.config.useNativeClickEvent){var a=n.createPointerEvent(i);n.dispatchEvent(a),n.freeEvent(a)}},this.onPointerCancel=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(a),n.freeEvent(a)},this.globalRuntime=e,this.context=t}return he(r,[{key:"init",value:function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)}},{key:"destroy",value:function(){this.mappingTable={},this.mappingState={},this.eventPool.clear()}},{key:"getScale",value:function(){var t=this.context.contextService.getBoundingClientRect(),n=1,i=1,a=this.context.contextService.getDomElement();if(a&&t){var s=a.offsetWidth,o=a.offsetHeight;s&&o&&(n=t.width/s,i=t.height/o)}return{scaleX:n,scaleY:i,bbox:t}}},{key:"client2Viewport",value:function(t){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new Dn((t.x-((s==null?void 0:s.left)||0))/i,(t.y-((s==null?void 0:s.top)||0))/a)}},{key:"viewport2Client",value:function(t){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new Dn((t.x+((s==null?void 0:s.left)||0))*i,(t.y+((s==null?void 0:s.top)||0))*a)}},{key:"viewport2Canvas",value:function(t){var n=t.x,i=t.y,a=this.rootTarget.defaultView,s=a.getCamera(),o=this.context.config,A=o.width,l=o.height,c=s.getPerspectiveInverse(),u=s.getWorldTransform(),h=tr(this.tmpMatrix,u,c),d=er(this.tmpVec3,n/A*2-1,(1-i/l)*2-1,0);return nr(d,d,h),new Dn(d[0],d[1])}},{key:"canvas2Viewport",value:function(t){var n=this.rootTarget.defaultView,i=n.getCamera(),a=i.getPerspective(),s=i.getViewTransform(),o=tr(this.tmpMatrix,a,s),A=er(this.tmpVec3,t.x,t.y,0);nr(this.tmpVec3,this.tmpVec3,o);var l=this.context.config,c=l.width,u=l.height;return new Dn((A[0]+1)/2*c,(1-(A[1]+1)/2)*u)}},{key:"setPickHandler",value:function(t){this.pickHandler=t}},{key:"addEventMapping",value:function(t,n){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:n,priority:0}),this.mappingTable[t].sort(function(i,a){return i.priority-a.priority})}},{key:"mapEvent",value:function(t){if(this.rootTarget){var n=this.mappingTable[t.type];if(n)for(var i=0,a=n.length;i<a;i++)n[i].fn(t);else console.warn("[EventService]: Event mapping not defined for ".concat(t.type))}}},{key:"dispatchEvent",value:function(t,n,i){if(!i)t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,n);else{t.eventPhase=t.AT_TARGET;var a=this.rootTarget.defaultView||null;t.currentTarget=a,this.notifyListeners(t,n)}}},{key:"propagate",value:function(t,n){if(t.target){var i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var a=i.length-1;a>=1;a--)if(t.currentTarget=i[a],this.notifyTarget(t,n),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,n),!(t.propagationStopped||t.propagationImmediatelyStopped)){var s=i.indexOf(t.currentTarget);t.eventPhase=t.BUBBLING_PHASE;for(var o=s+1;o<i.length;o++)if(t.currentTarget=i[o],this.notifyTarget(t,n),t.propagationStopped||t.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(t){var n=[t],i=this.rootTarget.defaultView||null;if(i&&i===t)return n.unshift(i.document),n;for(var a=0;a<oH&&t!==this.rootTarget;a++)Vt.isNode(t)&&t.parentNode&&(n.push(t.parentNode),t=t.parentNode);return i&&n.push(i),n}},{key:"hitTest",value:function(t){var n=t.viewportX,i=t.viewportY,a=this.context.config,s=a.width,o=a.height,A=a.disableHitTesting;return n<0||i<0||n>s||i>o?null:!A&&this.pickHandler(t)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(t,n){var i,a=n==null?void 0:n.target;if((i=a)!==null&&i!==void 0&&i.shadowRoot&&(a=n.composedPath()[0]),a){if(a===t)return!0;if(t&&t.contains)return t.contains(a)}return n!=null&&n.composedPath?n.composedPath().indexOf(t)>-1:!1}},{key:"getExistedHTML",value:function(t){if(t.nativeEvent.composedPath)for(var n=0,i=t.nativeEvent.composedPath();n<i.length;n++){var a=i[n],s=this.nativeHTMLMap.get(a);if(s)return s}return null}},{key:"pickTarget",value:function(t){return this.hitTest({clientX:t.clientX,clientY:t.clientY,viewportX:t.viewportX,viewportY:t.viewportY,x:t.canvasX,y:t.canvasY})}},{key:"createPointerEvent",value:function(t,n,i,a){var s=this.allocateEvent(ih);this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t;var o=this.getExistedHTML(s),A=this.context.contextService.getDomElement();return s.target=i??(o||this.isNativeEventFromCanvas(A,s.nativeEvent)&&this.pickTarget(s)||a),typeof n=="string"&&(s.type=n),s}},{key:"createWheelEvent",value:function(t){var n=this.allocateEvent(Uw);this.copyWheelData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t;var i=this.getExistedHTML(n),a=this.context.contextService.getDomElement();return n.target=i||this.isNativeEventFromCanvas(a,n.nativeEvent)&&this.pickTarget(n),n}},{key:"trackingData",value:function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}},{key:"cloneWheelEvent",value:function(t){var n=this.allocateEvent(Uw);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyWheelData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=t.type,n}},{key:"clonePointerEvent",value:function(t,n){var i=this.allocateEvent(ih);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=n??i.type,i}},{key:"copyPointerData",value:function(t,n){n.pointerId=t.pointerId,n.width=t.width,n.height=t.height,n.isPrimary=t.isPrimary,n.pointerType=t.pointerType,n.pressure=t.pressure,n.tangentialPressure=t.tangentialPressure,n.tiltX=t.tiltX,n.tiltY=t.tiltY,n.twist=t.twist}},{key:"copyMouseData",value:function(t,n){n.altKey=t.altKey,n.button=t.button,n.buttons=t.buttons,n.ctrlKey=t.ctrlKey,n.metaKey=t.metaKey,n.shiftKey=t.shiftKey,n.client.copyFrom(t.client),n.movement.copyFrom(t.movement),n.canvas.copyFrom(t.canvas),n.screen.copyFrom(t.screen),n.global.copyFrom(t.global),n.offset.copyFrom(t.offset)}},{key:"copyWheelData",value:function(t,n){n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ}},{key:"copyData",value:function(t,n){n.isTrusted=t.isTrusted,n.timeStamp=Nw.now(),n.type=t.type,n.detail=t.detail,n.view=t.view,n.page.copyFrom(t.page),n.viewport.copyFrom(t.viewport)}},{key:"allocateEvent",value:function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var n=this.eventPool.get(t).pop()||new t(this);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n}},{key:"freeEvent",value:function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var n=t.constructor;this.eventPool.has(n)||this.eventPool.set(n,[]),this.eventPool.get(n).push(t)}},{key:"notifyTarget",value:function(t,n){n=n??t.type;var i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?"".concat(n,"capture"):n;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,n)}},{key:"notifyListeners",value:function(t,n){var i=t.currentTarget.emitter,a=i._events[n];if(a)if("fn"in a)a.once&&i.removeListener(n,a.fn,void 0,!0),a.fn.call(t.currentTarget||a.context,t);else for(var s=0;s<a.length&&!t.propagationImmediatelyStopped;s++)a[s].once&&i.removeListener(n,a[s].fn,void 0,!0),a[s].fn.call(t.currentTarget||a[s].context,t)}},{key:"findMountedTarget",value:function(t){if(!t)return null;for(var n=t[t.length-1],i=t.length-2;i>=0;i--){var a=t[i];if(a===this.rootTarget||Vt.isNode(a)&&a.parentNode===n)n=t[i];else break}return n}},{key:"getCursor",value:function(t){for(var n=t;n;){var i=x4(n)&&n.getAttribute("cursor");if(i)return i;n=Vt.isNode(n)&&n.parentNode}}}])})(),eB=(function(){function r(){ue(this,r)}return he(r,[{key:"getOrCreateCanvas",value:function(t,n){if(this.canvas)return this.canvas;if(t||de.offscreenCanvas)this.canvas=t||de.offscreenCanvas,this.context=this.canvas.getContext("2d",De({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",De({willReadFrequently:!0},n)),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch{this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",De({willReadFrequently:!0},n))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(t,n){return this.context?this.context:(this.getOrCreateCanvas(t,n),this.context)}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch{}try{return document.createElement("canvas")}catch{}return null}}])})(),Po=(function(r){return r[r.CAMERA_CHANGED=0]="CAMERA_CHANGED",r[r.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",r[r.NONE=2]="NONE",r})({}),lH=(function(){function r(e,t){ue(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new sr,initAsync:new D4,dirtycheck:new zf,cull:new zf,beginFrame:new sr,beforeRender:new sr,render:new sr,afterRender:new sr,endFrame:new sr,destroy:new sr,pick:new H4,pickSync:new zf,pointerDown:new sr,pointerUp:new sr,pointerMove:new sr,pointerOut:new sr,pointerOver:new sr,pointerWheel:new sr,pointerCancel:new sr,click:new sr},this.globalRuntime=e,this.context=t}return he(r,[{key:"init",value:function(t){var n=this,i=De(De({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(a){a.apply(i,n.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,t()):this.hooks.initAsync.promise().then(function(){n.inited=!0,t()}).catch(function(a){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){var t=this.context.config.renderer,n=t.getConfig(),i=n.enableDirtyRectangleRendering;return!i||this.context.renderingContext.renderReasons.has(Po.CAMERA_CHANGED)}},{key:"render",value:function(t,n,i){var a=this,s=t.getConfig(),o=this.context.renderingContext;if(this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0,this.globalRuntime.sceneGraphService.syncHierarchy(o.root),this.globalRuntime.sceneGraphService.notifyMutationObservers(t),o.renderReasons.size&&this.inited){o.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var A=o.renderReasons.size===1&&o.renderReasons.has(Po.CAMERA_CHANGED),l=!s.disableRenderHooks||!A;l&&this.renderDisplayObject(o.root,s,o),this.hooks.beginFrame.call(n),l&&o.renderListCurrentFrame.forEach(function(c){a.hooks.beforeRender.call(c),a.hooks.render.call(c),a.hooks.afterRender.call(c)}),this.hooks.endFrame.call(n),o.renderListCurrentFrame=[],o.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(t,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,A=s.enableCulling;function l(g){var v=g.renderable,p=g.sortable,y=o?v.dirty||i.dirtyRectangleRenderingDisabled?g:null:g,m=null;y&&(m=A?a.hooks.cull.call(y,a.context.camera):y,m&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(m))),g.dirty(!1),p.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,p.dirty&&(a.sort(g,p),p.dirty=!1,p.dirtyChildren=[],p.dirtyReason=void 0)}for(var c=[t];c.length>0;){var u,h=c.pop();l(h);for(var d=((u=h.sortable)===null||u===void 0||(u=u.sorted)===null||u===void 0?void 0:u.length)>0?h.sortable.sorted:h.childNodes,f=d.length-1;f>=0;f--)c.push(d[f])}}},{key:"sort",value:function(t,n){var i,a;(n==null||(i=n.sorted)===null||i===void 0?void 0:i.length)>0&&n.dirtyReason!==Zu.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(s){var o=n.sorted.indexOf(s);o>-1&&n.sorted.splice(o,1);var A=t.childNodes.indexOf(s);if(A>-1)if(n.sorted.length===0)n.sorted.push(s);else{var l=C4(n.sorted,s);n.sorted.splice(l,0,s)}}):n.sorted=t.childNodes.slice().sort(EI),((a=n.sorted)===null||a===void 0?void 0:a.length)>0&&t.childNodes.filter(function(s){return s.parsedStyle.zIndex}).length===0&&(n.sorted=[])}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call()}},{key:"dirty",value:function(){this.context.renderingContext.renderReasons.add(Po.DISPLAY_OBJECT_CHANGED)}}])})(),cH=/\[\s*(.*)=(.*)\s*\]/,uH=(function(){function r(){ue(this,r)}return he(r,[{key:"selectOne",value:function(t,n){var i=this;if(t.startsWith("."))return n.find(function(A){return((A==null?void 0:A.classList)||[]).indexOf(i.getIdOrClassname(t))>-1});if(t.startsWith("#"))return n.find(function(A){return A.id===i.getIdOrClassname(t)});if(t.startsWith("[")){var a=this.getAttribute(t),s=a.name,o=a.value;return s?n.find(function(A){return n!==A&&(s==="name"?A.name===o:i.attributeToString(A,s)===o)}):null}return n.find(function(A){return n!==A&&A.nodeName===t})}},{key:"selectAll",value:function(t,n){var i=this;if(t.startsWith("."))return n.findAll(function(A){return n!==A&&((A==null?void 0:A.classList)||[]).indexOf(i.getIdOrClassname(t))>-1});if(t.startsWith("#"))return n.findAll(function(A){return n!==A&&A.id===i.getIdOrClassname(t)});if(t.startsWith("[")){var a=this.getAttribute(t),s=a.name,o=a.value;return s?n.findAll(function(A){return n!==A&&(s==="name"?A.name===o:i.attributeToString(A,s)===o)}):[]}return n.findAll(function(A){return n!==A&&A.nodeName===t})}},{key:"is",value:function(t,n){if(t.startsWith("."))return n.className===this.getIdOrClassname(t);if(t.startsWith("#"))return n.id===this.getIdOrClassname(t);if(t.startsWith("[")){var i=this.getAttribute(t),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===t}},{key:"getIdOrClassname",value:function(t){return t.substring(1)}},{key:"getAttribute",value:function(t){var n=t.match(cH),i="",a="";return n&&n.length>2&&(i=n[1].replace(/"/g,""),a=n[2].replace(/"/g,"")),{name:i,value:a}}},{key:"attributeToString",value:function(t,n){if(!t.getAttribute)return"";var i=t.getAttribute(n);return ke(i)?"":i.toString?i.toString():""}}])})(),it=(function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r})({}),Ki=(function(r){function e(t,n,i,a,s,o,A,l){var c;return ue(this,e),c=qe(this,e,[null]),c.relatedNode=n,c.prevValue=i,c.newValue=a,c.attrName=s,c.attrChange=o,c.prevParsedValue=A,c.newParsedValue=l,c.type=t,c}return $e(e,r),he(e)})(Rh);Ki.ADDITION=2;Ki.MODIFICATION=1;Ki.REMOVAL=3;var hH=new Ki(it.REPARENT,null,"","","",0,"",""),dH=z1(),hc=Ze(),fH=Ct(1,1,1),gH=xt(),vH=z1(),hs=Ze(),pH=xt(),ds=gn(),yH=Ze(),mH=gn(),wH=Ze(),vA=Ze(),fs=Ze(),dc=xt(),lE=gn(),cE=gn(),fc=gn(),BH=(function(){function r(e){ue(this,r),this.displayObjectDependencyMap=new WeakMap,this.runtime=e}return he(r,[{key:"matches",value:function(t,n){return this.runtime.sceneGraphSelector.is(t,n)}},{key:"querySelector",value:function(t,n){return this.runtime.sceneGraphSelector.selectOne(t,n)}},{key:"querySelectorAll",value:function(t,n){return this.runtime.sceneGraphSelector.selectAll(t,n)}},{key:"attach",value:function(t,n,i){var a,s=!1;t.parentNode&&(s=t.parentNode!==n,this.detach(t));var o=t.nodeName===ae.FRAGMENT,A=rh(n);t.parentNode=n;var l=o?t.childNodes:[t];Be(i)?l.forEach(function(g){n.childNodes.splice(i,0,g),g.parentNode=n}):l.forEach(function(g){n.childNodes.push(g),g.parentNode=n});var c=n,u=c.sortable;if((u!=null&&(a=u.sorted)!==null&&a!==void 0&&a.length||u.dirty||t.parsedStyle.zIndex)&&(u.dirtyChildren.indexOf(t)===-1&&u.dirtyChildren.push(t),u.dirty=!0,u.dirtyReason=Zu.ADDED),!A){if(o)this.dirtyFragment(t);else{var h=t.transformable;h&&this.dirtyWorldTransform(t,h)}if(s){var d,f=((d=n.ownerDocument)===null||d===void 0||(d=d.defaultView)===null||d===void 0||(d=d.getConfig())===null||d===void 0||(d=d.future)===null||d===void 0?void 0:d.experimentalCancelEventPropagation)===!0;t.dispatchEvent(hH,f,f)}}}},{key:"detach",value:function(t){var n,i;if(t.parentNode){var a=t.transformable,s=t.parentNode,o=s.sortable;(o!=null&&(n=o.sorted)!==null&&n!==void 0&&n.length||(i=t.style)!==null&&i!==void 0&&i.zIndex)&&(o.dirtyChildren.indexOf(t)===-1&&o.dirtyChildren.push(t),o.dirty=!0,o.dirtyReason=Zu.REMOVED);var A=t.parentNode.childNodes.indexOf(t);A>-1&&t.parentNode.childNodes.splice(A,1),a&&this.dirtyWorldTransform(t,a),t.parentNode=null}}},{key:"getLocalPosition",value:function(t){return t.transformable.localPosition}},{key:"getLocalRotation",value:function(t){return t.transformable.localRotation}},{key:"getLocalScale",value:function(t){return t.transformable.localScale}},{key:"getLocalSkew",value:function(t){return t.transformable.localSkew}},{key:"getLocalTransform",value:function(t){var n=t.transformable;return Pb(n),n.localTransform}},{key:"setLocalPosition",value:function(t,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=t.transformable;vA[0]=n[0],vA[1]=n[1],vA[2]=(i=n[2])!==null&&i!==void 0?i:0,!hA(s.localPosition,vA)&&(Ui(s.localPosition,vA),a&&this.dirtyLocalTransform(t,s))}},{key:"translateLocal",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ct(n,i,a));var s=t.transformable;hA(n,hc)||(jP(n,n,s.localRotation),Va(s.localPosition,s.localPosition,n),this.dirtyLocalTransform(t,s))}},{key:"setLocalRotation",value:function(t,n,i,a,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;typeof n=="number"&&(n=R_(ds,n,i,a,s));var A=t.transformable;ic(A.localRotation,n),o&&this.dirtyLocalTransform(t,A)}},{key:"rotateLocal",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ct(n,i,a));var s=t.transformable;rc(cE,n[0],n[1],n[2]),Eb(s.localRotation,s.localRotation,cE),this.dirtyLocalTransform(t,s)}},{key:"setLocalScale",value:function(t,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=t.transformable;er(hs,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!hA(hs,s.localScale)&&(Ui(s.localScale,hs),a&&this.dirtyLocalTransform(t,s))}},{key:"scaleLocal",value:function(t,n){var i,a=t.transformable;HP(a.localScale,a.localScale,er(hs,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:1)),this.dirtyLocalTransform(t,a)}},{key:"setLocalSkew",value:function(t,n,i){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;typeof n=="number"&&(n=JP(vH,n,i));var s=t.transformable;ZP(s.localSkew,n),a&&this.dirtyLocalTransform(t,s)}},{key:"setLocalEulerAngles",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;typeof n=="number"&&(n=Ct(n,i,a));var o=t.transformable;rc(o.localRotation,n[0],n[1],n[2]),s&&this.dirtyLocalTransform(t,o)}},{key:"setLocalTransform",value:function(t,n){var i=Gu(yH,n),a=Ku(mH,n),s=Ko(wH,n);this.setLocalScale(t,s,!1),this.setLocalPosition(t,i,!1),this.setLocalRotation(t,a,void 0,void 0,void 0,!1),this.dirtyLocalTransform(t,t.transformable)}},{key:"resetLocalTransform",value:function(t){this.setLocalScale(t,fH,!1),this.setLocalPosition(t,hc,!1),this.setLocalEulerAngles(t,hc,void 0,void 0,!1),this.setLocalSkew(t,dH,void 0,!1),this.dirtyLocalTransform(t,t.transformable)}},{key:"getPosition",value:function(t){var n=t.transformable;return Gu(n.position,this.getWorldTransform(t,n))}},{key:"getRotation",value:function(t){var n=t.transformable;return Ku(n.rotation,this.getWorldTransform(t,n))}},{key:"getScale",value:function(t){var n=t.transformable;return Ko(n.scaling,this.getWorldTransform(t,n))}},{key:"getOrigin",value:function(t){return t.getGeometryBounds(),t.transformable.origin}},{key:"getWorldTransform",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t.transformable;return!n.localDirtyFlag&&!n.dirtyFlag||(t.parentNode&&t.parentNode.transformable&&this.getWorldTransform(t.parentNode),this.internalUpdateTransform(t)),n.worldTransform}},{key:"setPosition",value:function(t,n){var i,a=t.transformable;if(fs[0]=n[0],fs[1]=n[1],fs[2]=(i=n[2])!==null&&i!==void 0?i:0,!hA(this.getPosition(t),fs)){if(Ui(a.position,fs),t.parentNode===null||!t.parentNode.transformable)Ui(a.localPosition,fs);else{var s=t.parentNode.transformable;Go(dc,s.worldTransform),Ni(dc,dc),nr(a.localPosition,fs,dc)}this.dirtyLocalTransform(t,a)}}},{key:"translate",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=er(hs,n,i,a)),!hA(n,hc)&&(Va(hs,this.getPosition(t),n),this.setPosition(t,hs))}},{key:"setRotation",value:function(t,n,i,a,s){var o=t.transformable;if(typeof n=="number"&&(n=XP(n,i,a,s)),t.parentNode===null||!t.parentNode.transformable)this.setLocalRotation(t,n);else{var A=this.getRotation(t.parentNode);ic(ds,A),Mf(ds,ds),ja(o.localRotation,ds,n),Vu(o.localRotation,o.localRotation),this.dirtyLocalTransform(t,o)}}},{key:"rotate",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ct(n,i,a));var s=t.transformable;if(t.parentNode===null||!t.parentNode.transformable)this.rotateLocal(t,n);else{var o=ds;rc(o,n[0],n[1],n[2]);var A=this.getRotation(t),l=this.getRotation(t.parentNode);ic(fc,l),Mf(fc,fc),ja(o,fc,o),ja(s.localRotation,o,A),Vu(s.localRotation,s.localRotation),this.dirtyLocalTransform(t,s)}}},{key:"setOrigin",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=[n,i,a]);var s=t.transformable;if(!(n[0]===s.origin[0]&&n[1]===s.origin[1]&&n[2]===s.origin[2])){var o=s.origin;o[0]=n[0],o[1]=n[1],o[2]=n[2]||0,this.dirtyLocalTransform(t,s)}}},{key:"setEulerAngles",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ct(n,i,a));var s=t.transformable;if(t.parentNode===null||!t.parentNode.transformable)this.setLocalEulerAngles(t,n);else{rc(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(t.parentNode);ic(lE,Mf(ds,o)),Eb(s.localRotation,s.localRotation,lE),this.dirtyLocalTransform(t,s)}}},{key:"getGeometryBounds",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=t,a=i.geometry;a.dirty&&de.styleValueRegistry.updateGeometry(t);var s=n?a.renderBounds:a.contentBounds||null;return s||new It}},{key:"getTransformedGeometryBounds",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0,a=this.getGeometryBounds(t,n);if(!It.isEmpty(a)){var s=i||new It;return s.setFromTransformedAABB(a,this.getWorldTransform(t)),s}return null}},{key:"getBounds",value:function(t){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=t,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,A=this.getTransformedGeometryBounds(t,i,o),l=t.childNodes;if(l.forEach(function(h){var d=n.getBounds(h,i);d&&(A?A.add(d):(A=o||new It,A.update(d.center,d.halfExtents)))}),A||(A=new It),i){var c=xI(t);if(c){var u=c.parsedStyle.clipPath.getBounds(i);A?u&&(A=u.intersection(A)):A.update(u.center,u.halfExtents)}}return i?(s.renderBounds=A,s.renderBoundsDirty=!1):(s.bounds=A,s.boundsDirty=!1),A}},{key:"getLocalBounds",value:function(t){if(t.parentNode){var n=gH;t.parentNode.transformable&&(n=Ni(pH,this.getWorldTransform(t.parentNode)));var i=this.getBounds(t);if(!It.isEmpty(i)){var a=new It;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(t)}},{key:"getBoundingClientRect",value:function(t){var n,i,a=this.getGeometryBounds(t);It.isEmpty(a)||(i=new It,i.setFromTransformedAABB(a,this.getWorldTransform(t)));var s=(n=t.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),A=We(o,2),l=A[0],c=A[1],u=i.getMax(),h=We(u,2),d=h[0],f=h[1];return new Vo(l+((s==null?void 0:s.left)||0),c+((s==null?void 0:s.top)||0),d-l,f-c)}return new Vo((s==null?void 0:s.left)||0,(s==null?void 0:s.top)||0,0,0)}},{key:"internalUpdateTransform",value:function(t){var n,i=(n=t.parentNode)===null||n===void 0?void 0:n.transformable;Pb(t.transformable),GD(t.transformable,i)}},{key:"internalUpdateElement",value:function(t,n){var i,a,s,o,A=((i=t.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig())===null||i===void 0||(i=i.future)===null||i===void 0?void 0:i.experimentalAttributeUpdateOptimization)===!0,l=n[n.length-1],c=(l==null?void 0:l.transformDirty)||((a=t.transformable)===null||a===void 0?void 0:a.localDirtyFlag);if(t.transformable){var u;(u=t.transformable).dirtyFlag||(u.dirtyFlag=c)}if(this.internalUpdateTransform(t),c){var h;(h=t.dirty)===null||h===void 0||h.call(t,!0,!0)}var d=((s=t.renderable)===null||s===void 0?void 0:s.boundsDirty)||((o=t.renderable)===null||o===void 0?void 0:o.renderBoundsDirty);if((c||d)&&(l==null?void 0:l.shapeUpdated)===!1&&A)for(var f=n.length-1;f>=0;){var g,v,p=n[f];if(p.shapeUpdated)break;(g=(v=p.node).dirty)===null||g===void 0||g.call(v,!0,!0),p.shapeUpdated=!0,f-=1}return c}},{key:"syncHierarchy",value:function(t){for(var n,i,a=[t],s=t.parentNode?[{node:t.parentNode,transformDirty:((n=t.parentNode.transformable)===null||n===void 0?void 0:n.localDirtyFlag)||((i=t.parentNode.transformable)===null||i===void 0?void 0:i.dirtyFlag),shapeUpdated:!1}]:[];a.length>0;){for(var o=a.pop(),A=s[s.length-1];s.length>0&&o.parentNode!==A.node;)A=s.pop();var l=this.internalUpdateElement(o,s);if(o.childNodes.length>0){for(var c=o.childNodes.length-1;c>=0;c--)a.push(o.childNodes[c]);s.push({node:o,transformDirty:l,shapeUpdated:!1})}}}},{key:"dirtyLocalTransform",value:function(t,n){rh(t)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtyWorldTransform(t,n))}},{key:"dirtyWorldTransform",value:function(t,n){this.dirtyWorldInternal(t,n),this.dirtyToRoot(t,!0)}},{key:"dirtyWorldInternal",value:function(t,n){var i,a=this,s=((i=t.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig())===null||i===void 0||(i=i.future)===null||i===void 0?void 0:i.experimentalAttributeUpdateOptimization)===!0;n.dirtyFlag||(n.dirtyFlag=!0,t.dirty(!0,!0),s||t.childNodes.forEach(function(o){var A=o.transformable;a.dirtyWorldInternal(o,A)}))}},{key:"dirtyToRoot",value:function(t){for(var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=t,s=((n=t.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0||(n=n.getConfig())===null||n===void 0||(n=n.future)===null||n===void 0?void 0:n.experimentalAttributeUpdateOptimization)===!0;a;){var o,A;if((o=(A=a).dirty)===null||o===void 0||o.call(A,!0,!0),s)break;a=a.parentNode}i&&t.forEach(function(u){var h;(h=u.dirty)===null||h===void 0||h.call(u,!0,!0)}),this.informDependentDisplayObjects(t);var l=t.mutations||[],c=l.find(function(u){return u.type==="attributes"&&u._boundsChangeData});c?c._boundsChangeData={affectChildren:c._boundsChangeData.affectChildren||i}:(c={type:"attributes",target:t,_boundsChangeData:{affectChildren:i}},l.push(c)),t.mutations=l}},{key:"dirtyFragment",value:function(t){var n,i,a=t.transformable;a&&(a.dirtyFlag=!0,a.localDirtyFlag=!0),(n=(i=t).dirty)===null||n===void 0||n.call(i,!0,!0);for(var s=t.childNodes.length,o=0;o<s;o++)this.dirtyFragment(t.childNodes[o])}},{key:"notifyMutationObservers",value:function(t){var n=new Set;if(t.getRoot().forEach(function(a){(a.mutations||[]).forEach(function(s){s.type==="attributes"&&s._boundsChangeData&&(s._boundsChangeData.affectChildren?a.forEach(function(o){var A=De({},s);A.target=o,n.add(A)}):n.add(s))}),a.mutations=void 0}),n.size>0){var i=new vn(it.BOUNDS_CHANGED,{detail:Array.from(n)});t.dispatchEvent(i,!0,!0)}}},{key:"updateDisplayObjectDependency",value:function(t,n,i,a){if(n&&n!==i){var s=this.displayObjectDependencyMap.get(n);if(s&&s[t]){var o=s[t].indexOf(a);s[t].splice(o,1)}}if(i){var A=this.displayObjectDependencyMap.get(i);A||(this.displayObjectDependencyMap.set(i,{}),A=this.displayObjectDependencyMap.get(i)),A[t]||(A[t]=[]),A[t].push(a)}}},{key:"informDependentDisplayObjects",value:function(t){var n,i=this,a=this.displayObjectDependencyMap.get(t);if(a){var s=(n=t.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0||(n=n.getConfig())===null||n===void 0||(n=n.future)===null||n===void 0?void 0:n.experimentalCancelEventPropagation;Object.keys(a).forEach(function(o){a[o].forEach(function(A){i.dirtyToRoot(A,!0),A.dispatchEvent(new Ki(it.ATTR_MODIFIED,A,i,i,o,Ki.MODIFICATION,i,i),s,s),A.isCustomElement&&A.isConnected&&A.attributeChangedCallback&&A.attributeChangedCallback(o,i,i)})})}}}])})(),uE=(function(){function r(e){if(ue(this,r),e<=0)throw new Error("LRU capacity must be a positive number.");this.capacity=e,this.cache=new Map}return he(r,[{key:"get",value:function(t){if(this.cache.has(t)){var n=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,n),n}}},{key:"put",value:function(t,n){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,n),this.cache.size>this.capacity){var i=this.cache.keys().next().value;this.cache.delete(i)}}},{key:"len",value:function(){return this.cache.size}},{key:"clear",value:function(){this.cache.clear()}}])})(),gs={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},hE=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,bH=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,EH=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,xH=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,CH=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,SH=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,FH=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,TH=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,MH=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,OH=new RegExp("".concat(bH.source,"|").concat(xH.source,"|").concat(SH.source,"|").concat(TH.source)),_H=new RegExp("".concat(EH.source,"|").concat(CH.source,"|").concat(FH.source,"|").concat(MH.source)),IH=(function(){function r(e){var t=this;ue(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return t.isBreakingSpace(i)?!1:!!(n&&(_H.exec(i)||OH.exec(n)))},this.trimByKinsokuShorui=function(n){var i=tt(n),a=i[i.length-2];if(!a)return n;var s=a[a.length-1];return i[i.length-2]=a.slice(0,-1),i[i.length-1]=s+i[i.length-1],i},this.runtime=e,this.charWidthCache=new uE(100)}return he(r,[{key:"measureFont",value:function(t,n){if(this.fontMetricsCache[t])return this.fontMetricsCache[t];var i={ascent:0,descent:0,fontSize:0},a=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(n),s=this.runtime.offscreenCanvasCreator.getOrCreateContext(n,{willReadFrequently:!0});s.font=t;var o=gs.MetricsString+gs.BaselineSymbol,A=Math.ceil(s.measureText(o).width),l=Math.ceil(s.measureText(gs.BaselineSymbol).width),c=gs.HeightMultiplier*l;l=l*gs.BaselineMultiplier|0,a.width=A,a.height=c,s.fillStyle="#f00",s.fillRect(0,0,A,c),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,l);var u=s.getImageData(0,0,A||1,c||1).data,h=u.length,d=A*4,f=0,g=0,v=!1;for(f=0;f<l;++f){for(var p=0;p<d;p+=4)if(u[g+p]!==255){v=!0;break}if(!v)g+=d;else break}for(i.ascent=l-f,g=h-d,v=!1,f=c;f>l;--f){for(var y=0;y<d;y+=4)if(u[g+y]!==255){v=!0;break}if(!v)g-=d;else break}return i.descent=f-l,i.fontSize=i.ascent+i.descent,this.fontMetricsCache[t]=i,i}},{key:"measureText",value:function(t,n,i){var a=n.fontSize,s=a===void 0?16:a,o=n.wordWrap,A=o===void 0?!1:o,l=n.lineHeight,c=n.lineWidth,u=c===void 0?1:c,h=n.textBaseline,d=h===void 0?"alphabetic":h,f=n.textAlign,g=f===void 0?"start":f,v=n.letterSpacing,p=v===void 0?0:v,y=n.textPath;n.textPathSide,n.textPathStartOffset;var m=n.leading,B=m===void 0?0:m,C=oE(n),S=this.measureFont(C,i);S.fontSize===0&&(S.fontSize=s,S.ascent=s);var F=this.runtime.offscreenCanvasCreator.getOrCreateContext(i);F.font=C,n.isOverflowing=!1;var T=A?this.wordWrap(t,n,i):t,O=T.split(/(?:\r\n|\r|\n)/),_=new Array(O.length),k=0;if(y){y.getTotalLength();for(var L=0;L<O.length;L++)F.measureText(O[L]).width+(O[L].length-1)*p}else{for(var U=0;U<O.length;U++){var G=F.measureText(O[U]).width+(O[U].length-1)*p;_[U]=G,k=Math.max(k,G)}var W=k+u,V=l||S.fontSize+u,K=Math.max(V,S.fontSize+u)+(O.length-1)*(V+B);V+=B;var D=0;return d==="middle"?D=-K/2:d==="bottom"||d==="alphabetic"||d==="ideographic"?D=-K:(d==="top"||d==="hanging")&&(D=0),{font:C,width:W,height:K,lines:O,lineWidths:_,lineHeight:V,maxLineWidth:k,fontProperties:S,lineMetrics:_.map(function(X,te){var ie=0;return g==="center"||g==="middle"?ie-=X/2:(g==="right"||g==="end")&&(ie-=X),new Vo(ie-u/2,D+te*V,X+u,V)})}}}},{key:"wordWrap",value:function(t,n,i){var a=this,s=Array.from(t);if(s.length===0)return"";var o=this,A=n.wordWrapWidth,l=A===void 0?0:A,c=n.letterSpacing,u=c===void 0?0:c,h=n.maxLines,d=h===void 0?1/0:h,f=n.textOverflow,g=this.runtime.offscreenCanvasCreator.getOrCreateContext(i),v=l+u,p="";f==="ellipsis"?p="...":f&&f!=="clip"&&(p=f);var y=[""],m=0,B=0,C=-1,S=oE(n),F=this.charWidthCache.get(S);F||(F=new uE(500),this.charWidthCache.put(S,F));var T=function(X){return a.getFromCache(X,u,F,g)},O=T(p);function _(D,X,te,ie){for(;T(D)<ie&&X<s.length-1&&!o.isNewline(s[X+1]);)X+=1,D+=s[X];for(;T(D)>ie&&X>=te;)X-=1,D=D.slice(0,-1);return{lineTxt:D,txtLastCharIndex:X}}function k(D,X){if(!(O<=0||O>v)){if(!y[D]){y[D]=p;return}var te=_(y[D],X,C+1,v-O);y[D]=te.lineTxt+p}}for(var L=0;L<s.length;L++){var U=s[L],G=s[L-1],W=s[L+1],V=T(U);if(this.isNewline(U)){if(m+1>=d){L<s.length-1&&k(m,L-1),n.isOverflowing=!0;break}C=L-1,m+=1,B=0,y[m]="";continue}if(V>v){k(m,L-1),n.isOverflowing=!0;break}if(B>0&&B+V>v){var K=_(y[m],L-1,C+1,v);if(K.txtLastCharIndex!==L-1){if(y[m]=K.lineTxt,K.txtLastCharIndex===s.length-1)break;L=K.txtLastCharIndex+1,U=s[L],G=s[L-1],W=s[L+1],V=T(U)}if(m+1>=d){k(m,L-1),n.isOverflowing=!0;break}if(C=L-1,m+=1,B=0,y[m]="",this.isBreakingSpace(U))continue;this.canBreakInLastChar(U)||(y=this.trimToBreakable(y),B=this.sumTextWidthByCache(y[m]||"",T)),this.shouldBreakByKinsokuShorui(U,W)&&(y=this.trimByKinsokuShorui(y),B+=T(G||""))}B+=V,y[m]+=U}return y.join(`
|
|
@@ -10,7 +10,7 @@ ${t}]
|
|
|
10
10
|
${t}rows: ${I.rows}
|
|
11
11
|
${t}columns: ${I.columns}
|
|
12
12
|
}`}function s(I,b,E,w,x){const{rows:M,columns:Q}=I,N=Math.min(M,b),P=Math.min(Q,E),R=[];if(x==="auto"){x=!1;e:for(let J=0;J<N;J++)for(let j=0;j<P;j++)if(I.get(J,j)<0){x=!0;break e}}for(let J=0;J<N;J++){let j=[];for(let oe=0;oe<P;oe++)j.push(o(I.get(J,oe),w,x));R.push(`${j.join(" ")}`)}return P!==Q&&(R[R.length-1]+=` ... ${Q-E} more columns`),N!==M&&R.push(`... ${M-b} more rows`),R.join(`
|
|
13
|
-
${n}`)}function o(I,b,E){return(I>=0&&E?` ${A(I,b-1)}`:A(I,b)).padEnd(b)}function A(I,b){let E=I.toString();if(E.length<=b)return E;let w=I.toFixed(b);if(w.length>b&&(w=I.toFixed(Math.max(0,b-(w.length-b)))),w.length<=b&&!w.startsWith("0.000")&&!w.startsWith("-0.000"))return w;let x=I.toExponential(b);return x.length>b&&(x=I.toExponential(Math.max(0,b-(x.length-b)))),x.slice(0)}function l(I,b){I.prototype.add=function(w){return typeof w=="number"?this.addS(w):this.addM(w)},I.prototype.addS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)+w);return this},I.prototype.addM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)+w.get(x,M));return this},I.add=function(w,x){return new b(w).add(x)},I.prototype.sub=function(w){return typeof w=="number"?this.subS(w):this.subM(w)},I.prototype.subS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)-w);return this},I.prototype.subM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)-w.get(x,M));return this},I.sub=function(w,x){return new b(w).sub(x)},I.prototype.subtract=I.prototype.sub,I.prototype.subtractS=I.prototype.subS,I.prototype.subtractM=I.prototype.subM,I.subtract=I.sub,I.prototype.mul=function(w){return typeof w=="number"?this.mulS(w):this.mulM(w)},I.prototype.mulS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)*w);return this},I.prototype.mulM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)*w.get(x,M));return this},I.mul=function(w,x){return new b(w).mul(x)},I.prototype.multiply=I.prototype.mul,I.prototype.multiplyS=I.prototype.mulS,I.prototype.multiplyM=I.prototype.mulM,I.multiply=I.mul,I.prototype.div=function(w){return typeof w=="number"?this.divS(w):this.divM(w)},I.prototype.divS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)/w);return this},I.prototype.divM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)/w.get(x,M));return this},I.div=function(w,x){return new b(w).div(x)},I.prototype.divide=I.prototype.div,I.prototype.divideS=I.prototype.divS,I.prototype.divideM=I.prototype.divM,I.divide=I.div,I.prototype.mod=function(w){return typeof w=="number"?this.modS(w):this.modM(w)},I.prototype.modS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)%w);return this},I.prototype.modM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)%w.get(x,M));return this},I.mod=function(w,x){return new b(w).mod(x)},I.prototype.modulus=I.prototype.mod,I.prototype.modulusS=I.prototype.modS,I.prototype.modulusM=I.prototype.modM,I.modulus=I.mod,I.prototype.and=function(w){return typeof w=="number"?this.andS(w):this.andM(w)},I.prototype.andS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)&w);return this},I.prototype.andM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)&w.get(x,M));return this},I.and=function(w,x){return new b(w).and(x)},I.prototype.or=function(w){return typeof w=="number"?this.orS(w):this.orM(w)},I.prototype.orS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)|w);return this},I.prototype.orM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)|w.get(x,M));return this},I.or=function(w,x){return new b(w).or(x)},I.prototype.xor=function(w){return typeof w=="number"?this.xorS(w):this.xorM(w)},I.prototype.xorS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)^w);return this},I.prototype.xorM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)^w.get(x,M));return this},I.xor=function(w,x){return new b(w).xor(x)},I.prototype.leftShift=function(w){return typeof w=="number"?this.leftShiftS(w):this.leftShiftM(w)},I.prototype.leftShiftS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)<<w);return this},I.prototype.leftShiftM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)<<w.get(x,M));return this},I.leftShift=function(w,x){return new b(w).leftShift(x)},I.prototype.signPropagatingRightShift=function(w){return typeof w=="number"?this.signPropagatingRightShiftS(w):this.signPropagatingRightShiftM(w)},I.prototype.signPropagatingRightShiftS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>w);return this},I.prototype.signPropagatingRightShiftM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>w.get(x,M));return this},I.signPropagatingRightShift=function(w,x){return new b(w).signPropagatingRightShift(x)},I.prototype.rightShift=function(w){return typeof w=="number"?this.rightShiftS(w):this.rightShiftM(w)},I.prototype.rightShiftS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>>w);return this},I.prototype.rightShiftM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>>w.get(x,M));return this},I.rightShift=function(w,x){return new b(w).rightShift(x)},I.prototype.zeroFillRightShift=I.prototype.rightShift,I.prototype.zeroFillRightShiftS=I.prototype.rightShiftS,I.prototype.zeroFillRightShiftM=I.prototype.rightShiftM,I.zeroFillRightShift=I.rightShift,I.prototype.not=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,~this.get(w,x));return this},I.not=function(w){return new b(w).not()},I.prototype.abs=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.abs(this.get(w,x)));return this},I.abs=function(w){return new b(w).abs()},I.prototype.acos=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.acos(this.get(w,x)));return this},I.acos=function(w){return new b(w).acos()},I.prototype.acosh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.acosh(this.get(w,x)));return this},I.acosh=function(w){return new b(w).acosh()},I.prototype.asin=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.asin(this.get(w,x)));return this},I.asin=function(w){return new b(w).asin()},I.prototype.asinh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.asinh(this.get(w,x)));return this},I.asinh=function(w){return new b(w).asinh()},I.prototype.atan=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.atan(this.get(w,x)));return this},I.atan=function(w){return new b(w).atan()},I.prototype.atanh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.atanh(this.get(w,x)));return this},I.atanh=function(w){return new b(w).atanh()},I.prototype.cbrt=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.cbrt(this.get(w,x)));return this},I.cbrt=function(w){return new b(w).cbrt()},I.prototype.ceil=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.ceil(this.get(w,x)));return this},I.ceil=function(w){return new b(w).ceil()},I.prototype.clz32=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.clz32(this.get(w,x)));return this},I.clz32=function(w){return new b(w).clz32()},I.prototype.cos=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.cos(this.get(w,x)));return this},I.cos=function(w){return new b(w).cos()},I.prototype.cosh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.cosh(this.get(w,x)));return this},I.cosh=function(w){return new b(w).cosh()},I.prototype.exp=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.exp(this.get(w,x)));return this},I.exp=function(w){return new b(w).exp()},I.prototype.expm1=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.expm1(this.get(w,x)));return this},I.expm1=function(w){return new b(w).expm1()},I.prototype.floor=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.floor(this.get(w,x)));return this},I.floor=function(w){return new b(w).floor()},I.prototype.fround=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.fround(this.get(w,x)));return this},I.fround=function(w){return new b(w).fround()},I.prototype.log=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log(this.get(w,x)));return this},I.log=function(w){return new b(w).log()},I.prototype.log1p=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log1p(this.get(w,x)));return this},I.log1p=function(w){return new b(w).log1p()},I.prototype.log10=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log10(this.get(w,x)));return this},I.log10=function(w){return new b(w).log10()},I.prototype.log2=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log2(this.get(w,x)));return this},I.log2=function(w){return new b(w).log2()},I.prototype.round=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.round(this.get(w,x)));return this},I.round=function(w){return new b(w).round()},I.prototype.sign=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sign(this.get(w,x)));return this},I.sign=function(w){return new b(w).sign()},I.prototype.sin=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sin(this.get(w,x)));return this},I.sin=function(w){return new b(w).sin()},I.prototype.sinh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sinh(this.get(w,x)));return this},I.sinh=function(w){return new b(w).sinh()},I.prototype.sqrt=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sqrt(this.get(w,x)));return this},I.sqrt=function(w){return new b(w).sqrt()},I.prototype.tan=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.tan(this.get(w,x)));return this},I.tan=function(w){return new b(w).tan()},I.prototype.tanh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.tanh(this.get(w,x)));return this},I.tanh=function(w){return new b(w).tanh()},I.prototype.trunc=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.trunc(this.get(w,x)));return this},I.trunc=function(w){return new b(w).trunc()},I.pow=function(w,x){return new b(w).pow(x)},I.prototype.pow=function(w){return typeof w=="number"?this.powS(w):this.powM(w)},I.prototype.powS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)**w);return this},I.prototype.powM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)**w.get(x,M));return this}}function c(I,b,E){let w=E?I.rows:I.rows-1;if(b<0||b>w)throw new RangeError("Row index out of range")}function u(I,b,E){let w=E?I.columns:I.columns-1;if(b<0||b>w)throw new RangeError("Column index out of range")}function h(I,b){if(b.to1DArray&&(b=b.to1DArray()),b.length!==I.columns)throw new RangeError("vector size must be the same as the number of columns");return b}function d(I,b){if(b.to1DArray&&(b=b.to1DArray()),b.length!==I.rows)throw new RangeError("vector size must be the same as the number of rows");return b}function f(I,b){if(!r.isAnyArray(b))throw new TypeError("row indices must be an array");for(let E=0;E<b.length;E++)if(b[E]<0||b[E]>=I.rows)throw new RangeError("row indices are out of range")}function g(I,b){if(!r.isAnyArray(b))throw new TypeError("column indices must be an array");for(let E=0;E<b.length;E++)if(b[E]<0||b[E]>=I.columns)throw new RangeError("column indices are out of range")}function v(I,b,E,w,x){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(y("startRow",b),y("endRow",E),y("startColumn",w),y("endColumn",x),b>E||w>x||b<0||b>=I.rows||E<0||E>=I.rows||w<0||w>=I.columns||x<0||x>=I.columns)throw new RangeError("Submatrix indices are out of range")}function p(I,b=0){let E=[];for(let w=0;w<I;w++)E.push(b);return E}function y(I,b){if(typeof b!="number")throw new TypeError(`${I} must be a number`)}function m(I){if(I.isEmpty())throw new Error("Empty matrix has no elements to index")}function B(I){let b=p(I.rows);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[E]+=I.get(E,w);return b}function C(I){let b=p(I.columns);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[w]+=I.get(E,w);return b}function S(I){let b=0;for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)b+=I.get(E,w);return b}function F(I){let b=p(I.rows,1);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[E]*=I.get(E,w);return b}function T(I){let b=p(I.columns,1);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[w]*=I.get(E,w);return b}function O(I){let b=1;for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)b*=I.get(E,w);return b}function _(I,b,E){const w=I.rows,x=I.columns,M=[];for(let Q=0;Q<w;Q++){let N=0,P=0,R=0;for(let J=0;J<x;J++)R=I.get(Q,J)-E[Q],N+=R,P+=R*R;b?M.push((P-N*N/x)/(x-1)):M.push((P-N*N/x)/x)}return M}function k(I,b,E){const w=I.rows,x=I.columns,M=[];for(let Q=0;Q<x;Q++){let N=0,P=0,R=0;for(let J=0;J<w;J++)R=I.get(J,Q)-E[Q],N+=R,P+=R*R;b?M.push((P-N*N/w)/(w-1)):M.push((P-N*N/w)/w)}return M}function L(I,b,E){const w=I.rows,x=I.columns,M=w*x;let Q=0,N=0,P=0;for(let R=0;R<w;R++)for(let J=0;J<x;J++)P=I.get(R,J)-E,Q+=P,N+=P*P;return b?(N-Q*Q/M)/(M-1):(N-Q*Q/M)/M}function U(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)-b[E])}function G(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)-b[w])}function W(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)-b)}function V(I){const b=[];for(let E=0;E<I.rows;E++){let w=0;for(let x=0;x<I.columns;x++)w+=I.get(E,x)**2/(I.columns-1);b.push(Math.sqrt(w))}return b}function K(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)/b[E])}function D(I){const b=[];for(let E=0;E<I.columns;E++){let w=0;for(let x=0;x<I.rows;x++)w+=I.get(x,E)**2/(I.rows-1);b.push(Math.sqrt(w))}return b}function X(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)/b[w])}function te(I){const b=I.size-1;let E=0;for(let w=0;w<I.columns;w++)for(let x=0;x<I.rows;x++)E+=I.get(x,w)**2/b;return Math.sqrt(E)}function ie(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)/b)}class re{static from1DArray(b,E,w){if(b*E!==w.length)throw new RangeError("data length does not match given dimensions");let M=new z(b,E);for(let Q=0;Q<b;Q++)for(let N=0;N<E;N++)M.set(Q,N,w[Q*E+N]);return M}static rowVector(b){let E=new z(1,b.length);for(let w=0;w<b.length;w++)E.set(0,w,b[w]);return E}static columnVector(b){let E=new z(b.length,1);for(let w=0;w<b.length;w++)E.set(w,0,b[w]);return E}static zeros(b,E){return new z(b,E)}static ones(b,E){return new z(b,E).fill(1)}static rand(b,E,w={}){if(typeof w!="object")throw new TypeError("options must be an object");const{random:x=Math.random}=w;let M=new z(b,E);for(let Q=0;Q<b;Q++)for(let N=0;N<E;N++)M.set(Q,N,x());return M}static randInt(b,E,w={}){if(typeof w!="object")throw new TypeError("options must be an object");const{min:x=0,max:M=1e3,random:Q=Math.random}=w;if(!Number.isInteger(x))throw new TypeError("min must be an integer");if(!Number.isInteger(M))throw new TypeError("max must be an integer");if(x>=M)throw new RangeError("min must be smaller than max");let N=M-x,P=new z(b,E);for(let R=0;R<b;R++)for(let J=0;J<E;J++){let j=x+Math.round(Q()*N);P.set(R,J,j)}return P}static eye(b,E,w){E===void 0&&(E=b),w===void 0&&(w=1);let x=Math.min(b,E),M=this.zeros(b,E);for(let Q=0;Q<x;Q++)M.set(Q,Q,w);return M}static diag(b,E,w){let x=b.length;E===void 0&&(E=x),w===void 0&&(w=E);let M=Math.min(x,E,w),Q=this.zeros(E,w);for(let N=0;N<M;N++)Q.set(N,N,b[N]);return Q}static min(b,E){b=this.checkMatrix(b),E=this.checkMatrix(E);let w=b.rows,x=b.columns,M=new z(w,x);for(let Q=0;Q<w;Q++)for(let N=0;N<x;N++)M.set(Q,N,Math.min(b.get(Q,N),E.get(Q,N)));return M}static max(b,E){b=this.checkMatrix(b),E=this.checkMatrix(E);let w=b.rows,x=b.columns,M=new this(w,x);for(let Q=0;Q<w;Q++)for(let N=0;N<x;N++)M.set(Q,N,Math.max(b.get(Q,N),E.get(Q,N)));return M}static checkMatrix(b){return re.isMatrix(b)?b:new z(b)}static isMatrix(b){return b!=null&&b.klass==="Matrix"}get size(){return this.rows*this.columns}apply(b){if(typeof b!="function")throw new TypeError("callback must be a function");for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b.call(this,E,w);return this}to1DArray(){let b=[];for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b.push(this.get(E,w));return b}to2DArray(){let b=[];for(let E=0;E<this.rows;E++){b.push([]);for(let w=0;w<this.columns;w++)b[E].push(this.get(E,w))}return b}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let b=0;b<this.rows;b++)for(let E=0;E<=b;E++)if(this.get(b,E)!==this.get(E,b))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let b=0;b<this.rows;b++)if(this.get(b,b)!==0)return!1;return!0}isEchelonForm(){let b=0,E=0,w=-1,x=!0,M=!1;for(;b<this.rows&&x;){for(E=0,M=!1;E<this.columns&&M===!1;)this.get(b,E)===0?E++:this.get(b,E)===1&&E>w?(M=!0,w=E):(x=!1,M=!0);b++}return x}isReducedEchelonForm(){let b=0,E=0,w=-1,x=!0,M=!1;for(;b<this.rows&&x;){for(E=0,M=!1;E<this.columns&&M===!1;)this.get(b,E)===0?E++:this.get(b,E)===1&&E>w?(M=!0,w=E):(x=!1,M=!0);for(let Q=E+1;Q<this.rows;Q++)this.get(b,Q)!==0&&(x=!1);b++}return x}echelonForm(){let b=this.clone(),E=0,w=0;for(;E<b.rows&&w<b.columns;){let x=E;for(let M=E;M<b.rows;M++)b.get(M,w)>b.get(x,w)&&(x=M);if(b.get(x,w)===0)w++;else{b.swapRows(E,x);let M=b.get(E,w);for(let Q=w;Q<b.columns;Q++)b.set(E,Q,b.get(E,Q)/M);for(let Q=E+1;Q<b.rows;Q++){let N=b.get(Q,w)/b.get(E,w);b.set(Q,w,0);for(let P=w+1;P<b.columns;P++)b.set(Q,P,b.get(Q,P)-b.get(E,P)*N)}E++,w++}}return b}reducedEchelonForm(){let b=this.echelonForm(),E=b.columns,w=b.rows,x=w-1;for(;x>=0;)if(b.maxRow(x)===0)x--;else{let M=0,Q=!1;for(;M<w&&Q===!1;)b.get(x,M)===1?Q=!0:M++;for(let N=0;N<x;N++){let P=b.get(N,M);for(let R=M;R<E;R++){let J=b.get(N,R)-P*b.get(x,R);b.set(N,R,J)}}x--}return b}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{rows:E=1,columns:w=1}=b;if(!Number.isInteger(E)||E<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(w)||w<=0)throw new TypeError("columns must be a positive integer");let x=new z(this.rows*E,this.columns*w);for(let M=0;M<E;M++)for(let Q=0;Q<w;Q++)x.setSubMatrix(this,this.rows*M,this.columns*Q);return x}fill(b){for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,b);return this}neg(){return this.mulS(-1)}getRow(b){c(this,b);let E=[];for(let w=0;w<this.columns;w++)E.push(this.get(b,w));return E}getRowVector(b){return z.rowVector(this.getRow(b))}setRow(b,E){c(this,b),E=h(this,E);for(let w=0;w<this.columns;w++)this.set(b,w,E[w]);return this}swapRows(b,E){c(this,b),c(this,E);for(let w=0;w<this.columns;w++){let x=this.get(b,w);this.set(b,w,this.get(E,w)),this.set(E,w,x)}return this}getColumn(b){u(this,b);let E=[];for(let w=0;w<this.rows;w++)E.push(this.get(w,b));return E}getColumnVector(b){return z.columnVector(this.getColumn(b))}setColumn(b,E){u(this,b),E=d(this,E);for(let w=0;w<this.rows;w++)this.set(w,b,E[w]);return this}swapColumns(b,E){u(this,b),u(this,E);for(let w=0;w<this.rows;w++){let x=this.get(w,b);this.set(w,b,this.get(w,E)),this.set(w,E,x)}return this}addRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)+b[w]);return this}subRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)-b[w]);return this}mulRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)*b[w]);return this}divRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)/b[w]);return this}addColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)+b[E]);return this}subColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)-b[E]);return this}mulColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)*b[E]);return this}divColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)/b[E]);return this}mulRow(b,E){c(this,b);for(let w=0;w<this.columns;w++)this.set(b,w,this.get(b,w)*E);return this}mulColumn(b,E){u(this,b);for(let w=0;w<this.rows;w++)this.set(w,b,this.get(w,b)*E);return this}max(b){if(this.isEmpty())return NaN;switch(b){case"row":{const E=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>E[w]&&(E[w]=this.get(w,x));return E}case"column":{const E=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>E[x]&&(E[x]=this.get(w,x));return E}case void 0:{let E=this.get(0,0);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>E&&(E=this.get(w,x));return E}default:throw new Error(`invalid option: ${b}`)}}maxIndex(){m(this);let b=this.get(0,0),E=[0,0];for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>b&&(b=this.get(w,x),E[0]=w,E[1]=x);return E}min(b){if(this.isEmpty())return NaN;switch(b){case"row":{const E=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<E[w]&&(E[w]=this.get(w,x));return E}case"column":{const E=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<E[x]&&(E[x]=this.get(w,x));return E}case void 0:{let E=this.get(0,0);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<E&&(E=this.get(w,x));return E}default:throw new Error(`invalid option: ${b}`)}}minIndex(){m(this);let b=this.get(0,0),E=[0,0];for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<b&&(b=this.get(w,x),E[0]=w,E[1]=x);return E}maxRow(b){if(c(this,b),this.isEmpty())return NaN;let E=this.get(b,0);for(let w=1;w<this.columns;w++)this.get(b,w)>E&&(E=this.get(b,w));return E}maxRowIndex(b){c(this,b),m(this);let E=this.get(b,0),w=[b,0];for(let x=1;x<this.columns;x++)this.get(b,x)>E&&(E=this.get(b,x),w[1]=x);return w}minRow(b){if(c(this,b),this.isEmpty())return NaN;let E=this.get(b,0);for(let w=1;w<this.columns;w++)this.get(b,w)<E&&(E=this.get(b,w));return E}minRowIndex(b){c(this,b),m(this);let E=this.get(b,0),w=[b,0];for(let x=1;x<this.columns;x++)this.get(b,x)<E&&(E=this.get(b,x),w[1]=x);return w}maxColumn(b){if(u(this,b),this.isEmpty())return NaN;let E=this.get(0,b);for(let w=1;w<this.rows;w++)this.get(w,b)>E&&(E=this.get(w,b));return E}maxColumnIndex(b){u(this,b),m(this);let E=this.get(0,b),w=[0,b];for(let x=1;x<this.rows;x++)this.get(x,b)>E&&(E=this.get(x,b),w[0]=x);return w}minColumn(b){if(u(this,b),this.isEmpty())return NaN;let E=this.get(0,b);for(let w=1;w<this.rows;w++)this.get(w,b)<E&&(E=this.get(w,b));return E}minColumnIndex(b){u(this,b),m(this);let E=this.get(0,b),w=[0,b];for(let x=1;x<this.rows;x++)this.get(x,b)<E&&(E=this.get(x,b),w[0]=x);return w}diag(){let b=Math.min(this.rows,this.columns),E=[];for(let w=0;w<b;w++)E.push(this.get(w,w));return E}norm(b="frobenius"){switch(b){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${b}`)}}cumulativeSum(){let b=0;for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b+=this.get(E,w),this.set(E,w,b);return this}dot(b){re.isMatrix(b)&&(b=b.to1DArray());let E=this.to1DArray();if(E.length!==b.length)throw new RangeError("vectors do not have the same size");let w=0;for(let x=0;x<E.length;x++)w+=E[x]*b[x];return w}mmul(b){b=z.checkMatrix(b);let E=this.rows,w=this.columns,x=b.columns,M=new z(E,x),Q=new Float64Array(w);for(let N=0;N<x;N++){for(let P=0;P<w;P++)Q[P]=b.get(P,N);for(let P=0;P<E;P++){let R=0;for(let J=0;J<w;J++)R+=this.get(P,J)*Q[J];M.set(P,N,R)}}return M}strassen2x2(b){b=z.checkMatrix(b);let E=new z(2,2);const w=this.get(0,0),x=b.get(0,0),M=this.get(0,1),Q=b.get(0,1),N=this.get(1,0),P=b.get(1,0),R=this.get(1,1),J=b.get(1,1),j=(w+R)*(x+J),oe=(N+R)*x,me=w*(Q-J),ne=R*(P-x),ce=(w+M)*J,Ce=(N-w)*(x+Q),q=(M-R)*(P+J),ye=j+ne-ce+q,Oe=me+ce,Ke=oe+ne,je=j-oe+me+Ce;return E.set(0,0,ye),E.set(0,1,Oe),E.set(1,0,Ke),E.set(1,1,je),E}strassen3x3(b){b=z.checkMatrix(b);let E=new z(3,3);const w=this.get(0,0),x=this.get(0,1),M=this.get(0,2),Q=this.get(1,0),N=this.get(1,1),P=this.get(1,2),R=this.get(2,0),J=this.get(2,1),j=this.get(2,2),oe=b.get(0,0),me=b.get(0,1),ne=b.get(0,2),ce=b.get(1,0),Ce=b.get(1,1),q=b.get(1,2),ye=b.get(2,0),Oe=b.get(2,1),Ke=b.get(2,2),je=(w+x+M-Q-N-J-j)*Ce,Ht=(w-Q)*(-me+Ce),Qe=N*(-oe+me+ce-Ce-q-ye+Ke),Pe=(-w+Q+N)*(oe-me+Ce),Ft=(Q+N)*(-oe+me),Y=w*oe,fe=(-w+R+J)*(oe-ne+q),Se=(-w+R)*(ne-q),ve=(R+J)*(-oe+ne),Gt=(w+x+M-N-P-R-J)*q,yt=J*(-oe+ne+ce-Ce-q-ye+Oe),Qt=(-M+J+j)*(Ce+ye-Oe),Kt=(M-j)*(Ce-Oe),Nn=M*ye,Ai=(J+j)*(-ye+Oe),bn=(-M+N+P)*(q+ye-Ke),Ti=(M-P)*(q-Ke),ta=(N+P)*(-ye+Ke),st=x*ce,Un=P*Oe,_r=Q*ne,Ir=R*me,En=j*Ke,IU=Y+Nn+st,kU=je+Pe+Ft+Y+Qt+Nn+Ai,LU=Y+fe+ve+Gt+Nn+bn+ta,QU=Ht+Qe+Pe+Y+Nn+bn+Ti,NU=Ht+Pe+Ft+Y+Un,UU=Nn+bn+Ti+ta+_r,PU=Y+fe+Se+yt+Qt+Kt+Nn,RU=Qt+Kt+Nn+Ai+Ir,DU=Y+fe+Se+ve+En;return E.set(0,0,IU),E.set(0,1,kU),E.set(0,2,LU),E.set(1,0,QU),E.set(1,1,NU),E.set(1,2,UU),E.set(2,0,PU),E.set(2,1,RU),E.set(2,2,DU),E}mmulStrassen(b){b=z.checkMatrix(b);let E=this.clone(),w=E.rows,x=E.columns,M=b.rows,Q=b.columns;x!==M&&console.warn(`Multiplying ${w} x ${x} and ${M} x ${Q} matrix: dimensions do not match.`);function N(j,oe,me){let ne=j.rows,ce=j.columns;if(ne===oe&&ce===me)return j;{let Ce=re.zeros(oe,me);return Ce=Ce.setSubMatrix(j,0,0),Ce}}let P=Math.max(w,M),R=Math.max(x,Q);E=N(E,P,R),b=N(b,P,R);function J(j,oe,me,ne){if(me<=512||ne<=512)return j.mmul(oe);me%2===1&&ne%2===1?(j=N(j,me+1,ne+1),oe=N(oe,me+1,ne+1)):me%2===1?(j=N(j,me+1,ne),oe=N(oe,me+1,ne)):ne%2===1&&(j=N(j,me,ne+1),oe=N(oe,me,ne+1));let ce=parseInt(j.rows/2,10),Ce=parseInt(j.columns/2,10),q=j.subMatrix(0,ce-1,0,Ce-1),ye=oe.subMatrix(0,ce-1,0,Ce-1),Oe=j.subMatrix(0,ce-1,Ce,j.columns-1),Ke=oe.subMatrix(0,ce-1,Ce,oe.columns-1),je=j.subMatrix(ce,j.rows-1,0,Ce-1),Ht=oe.subMatrix(ce,oe.rows-1,0,Ce-1),Qe=j.subMatrix(ce,j.rows-1,Ce,j.columns-1),Pe=oe.subMatrix(ce,oe.rows-1,Ce,oe.columns-1),Ft=J(re.add(q,Qe),re.add(ye,Pe),ce,Ce),Y=J(re.add(je,Qe),ye,ce,Ce),fe=J(q,re.sub(Ke,Pe),ce,Ce),Se=J(Qe,re.sub(Ht,ye),ce,Ce),ve=J(re.add(q,Oe),Pe,ce,Ce),Gt=J(re.sub(je,q),re.add(ye,Ke),ce,Ce),yt=J(re.sub(Oe,Qe),re.add(Ht,Pe),ce,Ce),Qt=re.add(Ft,Se);Qt.sub(ve),Qt.add(yt);let Kt=re.add(fe,ve),Nn=re.add(Y,Se),Ai=re.sub(Ft,Y);Ai.add(fe),Ai.add(Gt);let bn=re.zeros(2*Qt.rows,2*Qt.columns);return bn=bn.setSubMatrix(Qt,0,0),bn=bn.setSubMatrix(Kt,Qt.rows,0),bn=bn.setSubMatrix(Nn,0,Qt.columns),bn=bn.setSubMatrix(Ai,Qt.rows,Qt.columns),bn.subMatrix(0,me-1,0,ne-1)}return J(E,b,P,R)}scaleRows(b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{min:E=0,max:w=1}=b;if(!Number.isFinite(E))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(E>=w)throw new RangeError("min must be smaller than max");let x=new z(this.rows,this.columns);for(let M=0;M<this.rows;M++){const Q=this.getRow(M);Q.length>0&&e(Q,{min:E,max:w,output:Q}),x.setRow(M,Q)}return x}scaleColumns(b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{min:E=0,max:w=1}=b;if(!Number.isFinite(E))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(E>=w)throw new RangeError("min must be smaller than max");let x=new z(this.rows,this.columns);for(let M=0;M<this.columns;M++){const Q=this.getColumn(M);Q.length&&e(Q,{min:E,max:w,output:Q}),x.setColumn(M,Q)}return x}flipRows(){const b=Math.ceil(this.columns/2);for(let E=0;E<this.rows;E++)for(let w=0;w<b;w++){let x=this.get(E,w),M=this.get(E,this.columns-1-w);this.set(E,w,M),this.set(E,this.columns-1-w,x)}return this}flipColumns(){const b=Math.ceil(this.rows/2);for(let E=0;E<this.columns;E++)for(let w=0;w<b;w++){let x=this.get(w,E),M=this.get(this.rows-1-w,E);this.set(w,E,M),this.set(this.rows-1-w,E,x)}return this}kroneckerProduct(b){b=z.checkMatrix(b);let E=this.rows,w=this.columns,x=b.rows,M=b.columns,Q=new z(E*x,w*M);for(let N=0;N<E;N++)for(let P=0;P<w;P++)for(let R=0;R<x;R++)for(let J=0;J<M;J++)Q.set(x*N+R,M*P+J,this.get(N,P)*b.get(R,J));return Q}kroneckerSum(b){if(b=z.checkMatrix(b),!this.isSquare()||!b.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let E=this.rows,w=b.rows,x=this.kroneckerProduct(z.eye(w,w)),M=z.eye(E,E).kroneckerProduct(b);return x.add(M)}transpose(){let b=new z(this.columns,this.rows);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b.set(w,E,this.get(E,w));return b}sortRows(b=xe){for(let E=0;E<this.rows;E++)this.setRow(E,this.getRow(E).sort(b));return this}sortColumns(b=xe){for(let E=0;E<this.columns;E++)this.setColumn(E,this.getColumn(E).sort(b));return this}subMatrix(b,E,w,x){v(this,b,E,w,x);let M=new z(E-b+1,x-w+1);for(let Q=b;Q<=E;Q++)for(let N=w;N<=x;N++)M.set(Q-b,N-w,this.get(Q,N));return M}subMatrixRow(b,E,w){if(E===void 0&&(E=0),w===void 0&&(w=this.columns-1),E>w||E<0||E>=this.columns||w<0||w>=this.columns)throw new RangeError("Argument out of range");let x=new z(b.length,w-E+1);for(let M=0;M<b.length;M++)for(let Q=E;Q<=w;Q++){if(b[M]<0||b[M]>=this.rows)throw new RangeError(`Row index out of range: ${b[M]}`);x.set(M,Q-E,this.get(b[M],Q))}return x}subMatrixColumn(b,E,w){if(E===void 0&&(E=0),w===void 0&&(w=this.rows-1),E>w||E<0||E>=this.rows||w<0||w>=this.rows)throw new RangeError("Argument out of range");let x=new z(w-E+1,b.length);for(let M=0;M<b.length;M++)for(let Q=E;Q<=w;Q++){if(b[M]<0||b[M]>=this.columns)throw new RangeError(`Column index out of range: ${b[M]}`);x.set(Q-E,M,this.get(Q,b[M]))}return x}setSubMatrix(b,E,w){if(b=z.checkMatrix(b),b.isEmpty())return this;let x=E+b.rows-1,M=w+b.columns-1;v(this,E,x,w,M);for(let Q=0;Q<b.rows;Q++)for(let N=0;N<b.columns;N++)this.set(E+Q,w+N,b.get(Q,N));return this}selection(b,E){f(this,b),g(this,E);let w=new z(b.length,E.length);for(let x=0;x<b.length;x++){let M=b[x];for(let Q=0;Q<E.length;Q++){let N=E[Q];w.set(x,Q,this.get(M,N))}}return w}trace(){let b=Math.min(this.rows,this.columns),E=0;for(let w=0;w<b;w++)E+=this.get(w,w);return E}clone(){return this.constructor.copy(this,new z(this.rows,this.columns))}static copy(b,E){for(const[w,x,M]of b.entries())E.set(w,x,M);return E}sum(b){switch(b){case"row":return B(this);case"column":return C(this);case void 0:return S(this);default:throw new Error(`invalid option: ${b}`)}}product(b){switch(b){case"row":return F(this);case"column":return T(this);case void 0:return O(this);default:throw new Error(`invalid option: ${b}`)}}mean(b){const E=this.sum(b);switch(b){case"row":{for(let w=0;w<this.rows;w++)E[w]/=this.columns;return E}case"column":{for(let w=0;w<this.columns;w++)E[w]/=this.rows;return E}case void 0:return E/this.size;default:throw new Error(`invalid option: ${b}`)}}variance(b,E={}){if(typeof b=="object"&&(E=b,b=void 0),typeof E!="object")throw new TypeError("options must be an object");const{unbiased:w=!0,mean:x=this.mean(b)}=E;if(typeof w!="boolean")throw new TypeError("unbiased must be a boolean");switch(b){case"row":{if(!r.isAnyArray(x))throw new TypeError("mean must be an array");return _(this,w,x)}case"column":{if(!r.isAnyArray(x))throw new TypeError("mean must be an array");return k(this,w,x)}case void 0:{if(typeof x!="number")throw new TypeError("mean must be a number");return L(this,w,x)}default:throw new Error(`invalid option: ${b}`)}}standardDeviation(b,E){typeof b=="object"&&(E=b,b=void 0);const w=this.variance(b,E);if(b===void 0)return Math.sqrt(w);for(let x=0;x<w.length;x++)w[x]=Math.sqrt(w[x]);return w}center(b,E={}){if(typeof b=="object"&&(E=b,b=void 0),typeof E!="object")throw new TypeError("options must be an object");const{center:w=this.mean(b)}=E;switch(b){case"row":{if(!r.isAnyArray(w))throw new TypeError("center must be an array");return U(this,w),this}case"column":{if(!r.isAnyArray(w))throw new TypeError("center must be an array");return G(this,w),this}case void 0:{if(typeof w!="number")throw new TypeError("center must be a number");return W(this,w),this}default:throw new Error(`invalid option: ${b}`)}}scale(b,E={}){if(typeof b=="object"&&(E=b,b=void 0),typeof E!="object")throw new TypeError("options must be an object");let w=E.scale;switch(b){case"row":{if(w===void 0)w=V(this);else if(!r.isAnyArray(w))throw new TypeError("scale must be an array");return K(this,w),this}case"column":{if(w===void 0)w=D(this);else if(!r.isAnyArray(w))throw new TypeError("scale must be an array");return X(this,w),this}case void 0:{if(w===void 0)w=te(this);else if(typeof w!="number")throw new TypeError("scale must be a number");return ie(this,w),this}default:throw new Error(`invalid option: ${b}`)}}toString(b){return a(this,b)}[Symbol.iterator](){return this.entries()}*entries(){for(let b=0;b<this.rows;b++)for(let E=0;E<this.columns;E++)yield[b,E,this.get(b,E)]}*values(){for(let b=0;b<this.rows;b++)for(let E=0;E<this.columns;E++)yield this.get(b,E)}}re.prototype.klass="Matrix",typeof Symbol<"u"&&(re.prototype[Symbol.for("nodejs.util.inspect.custom")]=i);function xe(I,b){return I-b}function $(I){return I.every(b=>typeof b=="number")}re.random=re.rand,re.randomInt=re.randInt,re.diagonal=re.diag,re.prototype.diagonal=re.prototype.diag,re.identity=re.eye,re.prototype.negate=re.prototype.neg,re.prototype.tensorProduct=re.prototype.kroneckerProduct;class z extends re{data;#e(b,E){if(this.data=[],Number.isInteger(E)&&E>=0)for(let w=0;w<b;w++)this.data.push(new Float64Array(E));else throw new TypeError("nColumns must be a positive integer");this.rows=b,this.columns=E}constructor(b,E){if(super(),z.isMatrix(b))this.#e(b.rows,b.columns),z.copy(b,this);else if(Number.isInteger(b)&&b>=0)this.#e(b,E);else if(r.isAnyArray(b)){const w=b;if(b=w.length,E=b?w[0].length:0,typeof E!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let x=0;x<b;x++){if(w[x].length!==E)throw new RangeError("Inconsistent array dimensions");if(!$(w[x]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(w[x]))}this.rows=b,this.columns=E}else throw new TypeError("First argument must be a positive number or an array")}set(b,E,w){return this.data[b][E]=w,this}get(b,E){return this.data[b][E]}removeRow(b){return c(this,b),this.data.splice(b,1),this.rows-=1,this}addRow(b,E){return E===void 0&&(E=b,b=this.rows),c(this,b,!0),E=Float64Array.from(h(this,E)),this.data.splice(b,0,E),this.rows+=1,this}removeColumn(b){u(this,b);for(let E=0;E<this.rows;E++){const w=new Float64Array(this.columns-1);for(let x=0;x<b;x++)w[x]=this.data[E][x];for(let x=b+1;x<this.columns;x++)w[x-1]=this.data[E][x];this.data[E]=w}return this.columns-=1,this}addColumn(b,E){typeof E>"u"&&(E=b,b=this.columns),u(this,b,!0),E=d(this,E);for(let w=0;w<this.rows;w++){const x=new Float64Array(this.columns+1);let M=0;for(;M<b;M++)x[M]=this.data[w][M];for(x[M++]=E[w];M<this.columns+1;M++)x[M]=this.data[w][M-1];this.data[w]=x}return this.columns+=1,this}}l(re,z);class ee extends re{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(b){return z.isMatrix(b)&&b.klassType==="SymmetricMatrix"}static zeros(b){return new this(b)}static ones(b){return new this(b).fill(1)}constructor(b){if(super(),z.isMatrix(b)){if(!b.isSymmetric())throw new TypeError("not symmetric data");this.#e=z.copy(b,new z(b.rows,b.rows))}else if(Number.isInteger(b)&&b>=0)this.#e=new z(b,b);else if(this.#e=new z(b),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const b=new ee(this.diagonalSize);for(const[E,w,x]of this.upperRightEntries())b.set(E,w,x);return b}toMatrix(){return new z(this)}get(b,E){return this.#e.get(b,E)}set(b,E,w){return this.#e.set(b,E,w),this.#e.set(E,b,w),this}removeCross(b){return this.#e.removeRow(b),this.#e.removeColumn(b),this}addCross(b,E){E===void 0&&(E=b,b=this.diagonalSize);const w=E.slice();return w.splice(b,1),this.#e.addRow(b,w),this.#e.addColumn(b,E),this}applyMask(b){if(b.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const E=[];for(const[w,x]of b.entries())x||E.push(w);E.reverse();for(const w of E)this.removeCross(w);return this}toCompact(){const{diagonalSize:b}=this,E=new Array(b*(b+1)/2);for(let w=0,x=0,M=0;M<E.length;M++)E[M]=this.get(x,w),++w>=b&&(w=++x);return E}static fromCompact(b){const E=b.length,w=(Math.sqrt(8*E+1)-1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(b)}`);const x=new ee(w);for(let M=0,Q=0,N=0;N<E;N++)x.set(M,Q,b[N]),++M>=w&&(M=++Q);return x}*upperRightEntries(){for(let b=0,E=0;b<this.diagonalSize;void 0){const w=this.get(b,E);yield[b,E,w],++E>=this.diagonalSize&&(E=++b)}}*upperRightValues(){for(let b=0,E=0;b<this.diagonalSize;void 0)yield this.get(b,E),++E>=this.diagonalSize&&(E=++b)}}ee.prototype.klassType="SymmetricMatrix";class Ae extends ee{static isDistanceMatrix(b){return ee.isSymmetricMatrix(b)&&b.klassSubType==="DistanceMatrix"}constructor(b){if(super(b),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(b,E,w){return b===E&&(w=0),super.set(b,E,w)}addCross(b,E){return E===void 0&&(E=b,b=this.diagonalSize),E=E.slice(),E[b]=0,super.addCross(b,E)}toSymmetricMatrix(){return new ee(this)}clone(){const b=new Ae(this.diagonalSize);for(const[E,w,x]of this.upperRightEntries())E!==w&&b.set(E,w,x);return b}toCompact(){const{diagonalSize:b}=this,E=(b-1)*b/2,w=new Array(E);for(let x=1,M=0,Q=0;Q<w.length;Q++)w[Q]=this.get(M,x),++x>=b&&(x=++M+1);return w}static fromCompact(b){const E=b.length;if(E===0)return new this(0);const w=(Math.sqrt(8*E+1)+1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(b)}`);const x=new this(w);for(let M=1,Q=0,N=0;N<E;N++)x.set(M,Q,b[N]),++M>=w&&(M=++Q+1);return x}}Ae.prototype.klassSubType="DistanceMatrix";class be extends re{constructor(b,E,w){super(),this.matrix=b,this.rows=E,this.columns=w}}class Le extends be{constructor(b,E){u(b,E),super(b,b.rows,1),this.column=E}set(b,E,w){return this.matrix.set(b,this.column,w),this}get(b){return this.matrix.get(b,this.column)}}class Ue extends be{constructor(b,E){g(b,E),super(b,b.rows,E.length),this.columnIndices=E}set(b,E,w){return this.matrix.set(b,this.columnIndices[E],w),this}get(b,E){return this.matrix.get(b,this.columnIndices[E])}}class at extends be{constructor(b){super(b,b.rows,b.columns)}set(b,E,w){return this.matrix.set(b,this.columns-E-1,w),this}get(b,E){return this.matrix.get(b,this.columns-E-1)}}class lt extends be{constructor(b){super(b,b.rows,b.columns)}set(b,E,w){return this.matrix.set(this.rows-b-1,E,w),this}get(b,E){return this.matrix.get(this.rows-b-1,E)}}class ct extends be{constructor(b,E){c(b,E),super(b,1,b.columns),this.row=E}set(b,E,w){return this.matrix.set(this.row,E,w),this}get(b,E){return this.matrix.get(this.row,E)}}class pt extends be{constructor(b,E){f(b,E),super(b,E.length,b.columns),this.rowIndices=E}set(b,E,w){return this.matrix.set(this.rowIndices[b],E,w),this}get(b,E){return this.matrix.get(this.rowIndices[b],E)}}class Ne extends be{constructor(b,E,w){f(b,E),g(b,w),super(b,E.length,w.length),this.rowIndices=E,this.columnIndices=w}set(b,E,w){return this.matrix.set(this.rowIndices[b],this.columnIndices[E],w),this}get(b,E){return this.matrix.get(this.rowIndices[b],this.columnIndices[E])}}class ht extends be{constructor(b,E,w,x,M){v(b,E,w,x,M),super(b,w-E+1,M-x+1),this.startRow=E,this.startColumn=x}set(b,E,w){return this.matrix.set(this.startRow+b,this.startColumn+E,w),this}get(b,E){return this.matrix.get(this.startRow+b,this.startColumn+E)}}class nt extends be{constructor(b){super(b,b.columns,b.rows)}set(b,E,w){return this.matrix.set(E,b,w),this}get(b,E){return this.matrix.get(E,b)}}class gr extends re{constructor(b,E={}){const{rows:w=1}=E;if(b.length%w!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=w,this.columns=b.length/w,this.data=b}set(b,E,w){let x=this._calculateIndex(b,E);return this.data[x]=w,this}get(b,E){let w=this._calculateIndex(b,E);return this.data[w]}_calculateIndex(b,E){return b*this.columns+E}}class St extends re{constructor(b){super(),this.data=b,this.rows=b.length,this.columns=b[0].length}set(b,E,w){return this.data[b][E]=w,this}get(b,E){return this.data[b][E]}}function Ji(I,b){if(r.isAnyArray(I))return I[0]&&r.isAnyArray(I[0])?new St(I):new gr(I,b);throw new Error("the argument is not an array")}class ir{constructor(b){b=St.checkMatrix(b);let E=b.clone(),w=E.rows,x=E.columns,M=new Float64Array(w),Q=1,N,P,R,J,j,oe,me,ne,ce;for(N=0;N<w;N++)M[N]=N;for(ne=new Float64Array(w),P=0;P<x;P++){for(N=0;N<w;N++)ne[N]=E.get(N,P);for(N=0;N<w;N++){for(ce=Math.min(N,P),j=0,R=0;R<ce;R++)j+=E.get(N,R)*ne[R];ne[N]-=j,E.set(N,P,ne[N])}for(J=P,N=P+1;N<w;N++)Math.abs(ne[N])>Math.abs(ne[J])&&(J=N);if(J!==P){for(R=0;R<x;R++)oe=E.get(J,R),E.set(J,R,E.get(P,R)),E.set(P,R,oe);me=M[J],M[J]=M[P],M[P]=me,Q=-Q}if(P<w&&E.get(P,P)!==0)for(N=P+1;N<w;N++)E.set(N,P,E.get(N,P)/E.get(P,P))}this.LU=E,this.pivotVector=M,this.pivotSign=Q}isSingular(){let b=this.LU,E=b.columns;for(let w=0;w<E;w++)if(b.get(w,w)===0)return!0;return!1}solve(b){b=z.checkMatrix(b);let E=this.LU;if(E.rows!==b.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let x=b.columns,M=b.subMatrixRow(this.pivotVector,0,x-1),Q=E.columns,N,P,R;for(R=0;R<Q;R++)for(N=R+1;N<Q;N++)for(P=0;P<x;P++)M.set(N,P,M.get(N,P)-M.get(R,P)*E.get(N,R));for(R=Q-1;R>=0;R--){for(P=0;P<x;P++)M.set(R,P,M.get(R,P)/E.get(R,R));for(N=0;N<R;N++)for(P=0;P<x;P++)M.set(N,P,M.get(N,P)-M.get(R,P)*E.get(N,R))}return M}get determinant(){let b=this.LU;if(!b.isSquare())throw new Error("Matrix must be square");let E=this.pivotSign,w=b.columns;for(let x=0;x<w;x++)E*=b.get(x,x);return E}get lowerTriangularMatrix(){let b=this.LU,E=b.rows,w=b.columns,x=new z(E,w);for(let M=0;M<E;M++)for(let Q=0;Q<w;Q++)M>Q?x.set(M,Q,b.get(M,Q)):M===Q?x.set(M,Q,1):x.set(M,Q,0);return x}get upperTriangularMatrix(){let b=this.LU,E=b.rows,w=b.columns,x=new z(E,w);for(let M=0;M<E;M++)for(let Q=0;Q<w;Q++)M<=Q?x.set(M,Q,b.get(M,Q)):x.set(M,Q,0);return x}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Wt(I,b){let E=0;return Math.abs(I)>Math.abs(b)?(E=b/I,Math.abs(I)*Math.sqrt(1+E*E)):b!==0?(E=I/b,Math.abs(b)*Math.sqrt(1+E*E)):0}class _t{constructor(b){b=St.checkMatrix(b);let E=b.clone(),w=b.rows,x=b.columns,M=new Float64Array(x),Q,N,P,R;for(P=0;P<x;P++){let J=0;for(Q=P;Q<w;Q++)J=Wt(J,E.get(Q,P));if(J!==0){for(E.get(P,P)<0&&(J=-J),Q=P;Q<w;Q++)E.set(Q,P,E.get(Q,P)/J);for(E.set(P,P,E.get(P,P)+1),N=P+1;N<x;N++){for(R=0,Q=P;Q<w;Q++)R+=E.get(Q,P)*E.get(Q,N);for(R=-R/E.get(P,P),Q=P;Q<w;Q++)E.set(Q,N,E.get(Q,N)+R*E.get(Q,P))}}M[P]=-J}this.QR=E,this.Rdiag=M}solve(b){b=z.checkMatrix(b);let E=this.QR,w=E.rows;if(b.rows!==w)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let x=b.columns,M=b.clone(),Q=E.columns,N,P,R,J;for(R=0;R<Q;R++)for(P=0;P<x;P++){for(J=0,N=R;N<w;N++)J+=E.get(N,R)*M.get(N,P);for(J=-J/E.get(R,R),N=R;N<w;N++)M.set(N,P,M.get(N,P)+J*E.get(N,R))}for(R=Q-1;R>=0;R--){for(P=0;P<x;P++)M.set(R,P,M.get(R,P)/this.Rdiag[R]);for(N=0;N<R;N++)for(P=0;P<x;P++)M.set(N,P,M.get(N,P)-M.get(R,P)*E.get(N,R))}return M.subMatrix(0,Q-1,0,x-1)}isFullRank(){let b=this.QR.columns;for(let E=0;E<b;E++)if(this.Rdiag[E]===0)return!1;return!0}get upperTriangularMatrix(){let b=this.QR,E=b.columns,w=new z(E,E),x,M;for(x=0;x<E;x++)for(M=0;M<E;M++)x<M?w.set(x,M,b.get(x,M)):x===M?w.set(x,M,this.Rdiag[x]):w.set(x,M,0);return w}get orthogonalMatrix(){let b=this.QR,E=b.rows,w=b.columns,x=new z(E,w),M,Q,N,P;for(N=w-1;N>=0;N--){for(M=0;M<E;M++)x.set(M,N,0);for(x.set(N,N,1),Q=N;Q<w;Q++)if(b.get(N,N)!==0){for(P=0,M=N;M<E;M++)P+=b.get(M,N)*x.get(M,Q);for(P=-P/b.get(N,N),M=N;M<E;M++)x.set(M,Q,x.get(M,Q)+P*b.get(M,N))}}return x}}class Qn{constructor(b,E={}){if(b=St.checkMatrix(b),b.isEmpty())throw new Error("Matrix must be non-empty");let w=b.rows,x=b.columns;const{computeLeftSingularVectors:M=!0,computeRightSingularVectors:Q=!0,autoTranspose:N=!1}=E;let P=!!M,R=!!Q,J=!1,j;if(w<x)if(!N)j=b.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{j=b.transpose(),w=j.rows,x=j.columns,J=!0;let Y=P;P=R,R=Y}else j=b.clone();let oe=Math.min(w,x),me=Math.min(w+1,x),ne=new Float64Array(me),ce=new z(w,oe),Ce=new z(x,x),q=new Float64Array(x),ye=new Float64Array(w),Oe=new Float64Array(me);for(let Y=0;Y<me;Y++)Oe[Y]=Y;let Ke=Math.min(w-1,x),je=Math.max(0,Math.min(x-2,w)),Ht=Math.max(Ke,je);for(let Y=0;Y<Ht;Y++){if(Y<Ke){ne[Y]=0;for(let fe=Y;fe<w;fe++)ne[Y]=Wt(ne[Y],j.get(fe,Y));if(ne[Y]!==0){j.get(Y,Y)<0&&(ne[Y]=-ne[Y]);for(let fe=Y;fe<w;fe++)j.set(fe,Y,j.get(fe,Y)/ne[Y]);j.set(Y,Y,j.get(Y,Y)+1)}ne[Y]=-ne[Y]}for(let fe=Y+1;fe<x;fe++){if(Y<Ke&&ne[Y]!==0){let Se=0;for(let ve=Y;ve<w;ve++)Se+=j.get(ve,Y)*j.get(ve,fe);Se=-Se/j.get(Y,Y);for(let ve=Y;ve<w;ve++)j.set(ve,fe,j.get(ve,fe)+Se*j.get(ve,Y))}q[fe]=j.get(Y,fe)}if(P&&Y<Ke)for(let fe=Y;fe<w;fe++)ce.set(fe,Y,j.get(fe,Y));if(Y<je){q[Y]=0;for(let fe=Y+1;fe<x;fe++)q[Y]=Wt(q[Y],q[fe]);if(q[Y]!==0){q[Y+1]<0&&(q[Y]=0-q[Y]);for(let fe=Y+1;fe<x;fe++)q[fe]/=q[Y];q[Y+1]+=1}if(q[Y]=-q[Y],Y+1<w&&q[Y]!==0){for(let fe=Y+1;fe<w;fe++)ye[fe]=0;for(let fe=Y+1;fe<w;fe++)for(let Se=Y+1;Se<x;Se++)ye[fe]+=q[Se]*j.get(fe,Se);for(let fe=Y+1;fe<x;fe++){let Se=-q[fe]/q[Y+1];for(let ve=Y+1;ve<w;ve++)j.set(ve,fe,j.get(ve,fe)+Se*ye[ve])}}if(R)for(let fe=Y+1;fe<x;fe++)Ce.set(fe,Y,q[fe])}}let Qe=Math.min(x,w+1);if(Ke<x&&(ne[Ke]=j.get(Ke,Ke)),w<Qe&&(ne[Qe-1]=0),je+1<Qe&&(q[je]=j.get(je,Qe-1)),q[Qe-1]=0,P){for(let Y=Ke;Y<oe;Y++){for(let fe=0;fe<w;fe++)ce.set(fe,Y,0);ce.set(Y,Y,1)}for(let Y=Ke-1;Y>=0;Y--)if(ne[Y]!==0){for(let fe=Y+1;fe<oe;fe++){let Se=0;for(let ve=Y;ve<w;ve++)Se+=ce.get(ve,Y)*ce.get(ve,fe);Se=-Se/ce.get(Y,Y);for(let ve=Y;ve<w;ve++)ce.set(ve,fe,ce.get(ve,fe)+Se*ce.get(ve,Y))}for(let fe=Y;fe<w;fe++)ce.set(fe,Y,-ce.get(fe,Y));ce.set(Y,Y,1+ce.get(Y,Y));for(let fe=0;fe<Y-1;fe++)ce.set(fe,Y,0)}else{for(let fe=0;fe<w;fe++)ce.set(fe,Y,0);ce.set(Y,Y,1)}}if(R)for(let Y=x-1;Y>=0;Y--){if(Y<je&&q[Y]!==0)for(let fe=Y+1;fe<x;fe++){let Se=0;for(let ve=Y+1;ve<x;ve++)Se+=Ce.get(ve,Y)*Ce.get(ve,fe);Se=-Se/Ce.get(Y+1,Y);for(let ve=Y+1;ve<x;ve++)Ce.set(ve,fe,Ce.get(ve,fe)+Se*Ce.get(ve,Y))}for(let fe=0;fe<x;fe++)Ce.set(fe,Y,0);Ce.set(Y,Y,1)}let Pe=Qe-1,Ft=Number.EPSILON;for(;Qe>0;){let Y,fe;for(Y=Qe-2;Y>=-1&&Y!==-1;Y--){const Se=Number.MIN_VALUE+Ft*Math.abs(ne[Y]+Math.abs(ne[Y+1]));if(Math.abs(q[Y])<=Se||Number.isNaN(q[Y])){q[Y]=0;break}}if(Y===Qe-2)fe=4;else{let Se;for(Se=Qe-1;Se>=Y&&Se!==Y;Se--){let ve=(Se!==Qe?Math.abs(q[Se]):0)+(Se!==Y+1?Math.abs(q[Se-1]):0);if(Math.abs(ne[Se])<=Ft*ve){ne[Se]=0;break}}Se===Y?fe=3:Se===Qe-1?fe=1:(fe=2,Y=Se)}switch(Y++,fe){case 1:{let Se=q[Qe-2];q[Qe-2]=0;for(let ve=Qe-2;ve>=Y;ve--){let Gt=Wt(ne[ve],Se),yt=ne[ve]/Gt,Qt=Se/Gt;if(ne[ve]=Gt,ve!==Y&&(Se=-Qt*q[ve-1],q[ve-1]=yt*q[ve-1]),R)for(let Kt=0;Kt<x;Kt++)Gt=yt*Ce.get(Kt,ve)+Qt*Ce.get(Kt,Qe-1),Ce.set(Kt,Qe-1,-Qt*Ce.get(Kt,ve)+yt*Ce.get(Kt,Qe-1)),Ce.set(Kt,ve,Gt)}break}case 2:{let Se=q[Y-1];q[Y-1]=0;for(let ve=Y;ve<Qe;ve++){let Gt=Wt(ne[ve],Se),yt=ne[ve]/Gt,Qt=Se/Gt;if(ne[ve]=Gt,Se=-Qt*q[ve],q[ve]=yt*q[ve],P)for(let Kt=0;Kt<w;Kt++)Gt=yt*ce.get(Kt,ve)+Qt*ce.get(Kt,Y-1),ce.set(Kt,Y-1,-Qt*ce.get(Kt,ve)+yt*ce.get(Kt,Y-1)),ce.set(Kt,ve,Gt)}break}case 3:{const Se=Math.max(Math.abs(ne[Qe-1]),Math.abs(ne[Qe-2]),Math.abs(q[Qe-2]),Math.abs(ne[Y]),Math.abs(q[Y])),ve=ne[Qe-1]/Se,Gt=ne[Qe-2]/Se,yt=q[Qe-2]/Se,Qt=ne[Y]/Se,Kt=q[Y]/Se,Nn=((Gt+ve)*(Gt-ve)+yt*yt)/2,Ai=ve*yt*(ve*yt);let bn=0;(Nn!==0||Ai!==0)&&(Nn<0?bn=0-Math.sqrt(Nn*Nn+Ai):bn=Math.sqrt(Nn*Nn+Ai),bn=Ai/(Nn+bn));let Ti=(Qt+ve)*(Qt-ve)+bn,ta=Qt*Kt;for(let st=Y;st<Qe-1;st++){let Un=Wt(Ti,ta);Un===0&&(Un=Number.MIN_VALUE);let _r=Ti/Un,Ir=ta/Un;if(st!==Y&&(q[st-1]=Un),Ti=_r*ne[st]+Ir*q[st],q[st]=_r*q[st]-Ir*ne[st],ta=Ir*ne[st+1],ne[st+1]=_r*ne[st+1],R)for(let En=0;En<x;En++)Un=_r*Ce.get(En,st)+Ir*Ce.get(En,st+1),Ce.set(En,st+1,-Ir*Ce.get(En,st)+_r*Ce.get(En,st+1)),Ce.set(En,st,Un);if(Un=Wt(Ti,ta),Un===0&&(Un=Number.MIN_VALUE),_r=Ti/Un,Ir=ta/Un,ne[st]=Un,Ti=_r*q[st]+Ir*ne[st+1],ne[st+1]=-Ir*q[st]+_r*ne[st+1],ta=Ir*q[st+1],q[st+1]=_r*q[st+1],P&&st<w-1)for(let En=0;En<w;En++)Un=_r*ce.get(En,st)+Ir*ce.get(En,st+1),ce.set(En,st+1,-Ir*ce.get(En,st)+_r*ce.get(En,st+1)),ce.set(En,st,Un)}q[Qe-2]=Ti;break}case 4:{if(ne[Y]<=0&&(ne[Y]=ne[Y]<0?-ne[Y]:0,R))for(let Se=0;Se<=Pe;Se++)Ce.set(Se,Y,-Ce.get(Se,Y));for(;Y<Pe&&!(ne[Y]>=ne[Y+1]);){let Se=ne[Y];if(ne[Y]=ne[Y+1],ne[Y+1]=Se,R&&Y<x-1)for(let ve=0;ve<x;ve++)Se=Ce.get(ve,Y+1),Ce.set(ve,Y+1,Ce.get(ve,Y)),Ce.set(ve,Y,Se);if(P&&Y<w-1)for(let ve=0;ve<w;ve++)Se=ce.get(ve,Y+1),ce.set(ve,Y+1,ce.get(ve,Y)),ce.set(ve,Y,Se);Y++}Qe--;break}}}if(J){let Y=Ce;Ce=ce,ce=Y}this.m=w,this.n=x,this.s=ne,this.U=ce,this.V=Ce}solve(b){let E=b,w=this.threshold,x=this.s.length,M=z.zeros(x,x);for(let oe=0;oe<x;oe++)Math.abs(this.s[oe])<=w?M.set(oe,oe,0):M.set(oe,oe,1/this.s[oe]);let Q=this.U,N=this.rightSingularVectors,P=N.mmul(M),R=N.rows,J=Q.rows,j=z.zeros(R,J);for(let oe=0;oe<R;oe++)for(let me=0;me<J;me++){let ne=0;for(let ce=0;ce<x;ce++)ne+=P.get(oe,ce)*Q.get(me,ce);j.set(oe,me,ne)}return j.mmul(E)}solveForDiagonal(b){return this.solve(z.diag(b))}inverse(){let b=this.V,E=this.threshold,w=b.rows,x=b.columns,M=new z(w,this.s.length);for(let J=0;J<w;J++)for(let j=0;j<x;j++)Math.abs(this.s[j])>E&&M.set(J,j,b.get(J,j)/this.s[j]);let Q=this.U,N=Q.rows,P=Q.columns,R=new z(w,N);for(let J=0;J<w;J++)for(let j=0;j<N;j++){let oe=0;for(let me=0;me<P;me++)oe+=M.get(J,me)*Q.get(j,me);R.set(J,j,oe)}return R}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let b=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,E=0,w=this.s;for(let x=0,M=w.length;x<M;x++)w[x]>b&&E++;return E}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return z.diag(this.s)}}function qn(I,b=!1){return I=St.checkMatrix(I),b?new Qn(I).inverse():vr(I,z.eye(I.rows))}function vr(I,b,E=!1){return I=St.checkMatrix(I),b=St.checkMatrix(b),E?new Qn(I).solve(b):I.isSquare()?new ir(I).solve(b):new _t(I).solve(b)}function ar(I){if(I=z.checkMatrix(I),I.isSquare()){if(I.columns===0)return 1;let b,E,w,x;if(I.columns===2)return b=I.get(0,0),E=I.get(0,1),w=I.get(1,0),x=I.get(1,1),b*x-E*w;if(I.columns===3){let M,Q,N;return M=new Ne(I,[1,2],[1,2]),Q=new Ne(I,[1,2],[0,2]),N=new Ne(I,[1,2],[0,1]),b=I.get(0,0),E=I.get(0,1),w=I.get(0,2),b*ar(M)-E*ar(Q)+w*ar(N)}else return new ir(I).determinant}else throw Error("determinant can only be calculated for a square matrix")}function $n(I,b){let E=[];for(let w=0;w<I;w++)w!==b&&E.push(w);return E}function rn(I,b,E,w=1e-9,x=1e-9){if(I>x)return new Array(b.rows+1).fill(0);{let M=b.addRow(E,[0]);for(let Q=0;Q<M.rows;Q++)Math.abs(M.get(Q,0))<w&&M.set(Q,0,0);return M.to1DArray()}}function an(I,b={}){const{thresholdValue:E=1e-9,thresholdError:w=1e-9}=b;I=z.checkMatrix(I);let x=I.rows,M=new z(x,x);for(let Q=0;Q<x;Q++){let N=z.columnVector(I.getRow(Q)),P=I.subMatrixRow($n(x,Q)).transpose(),J=new Qn(P).solve(N),j=z.sub(N,P.mmul(J)).abs().max();M.setRow(Q,rn(j,J,Q,E,w))}return M}function cA(I,b=Number.EPSILON){if(I=z.checkMatrix(I),I.isEmpty())return I.transpose();let E=new Qn(I,{autoTranspose:!0}),w=E.leftSingularVectors,x=E.rightSingularVectors,M=E.diagonal;for(let Q=0;Q<M.length;Q++)Math.abs(M[Q])>b?M[Q]=1/M[Q]:M[Q]=0;return x.mmul(z.diag(M).mmul(w.transpose()))}function cs(I,b=I,E={}){I=new z(I);let w=!1;if(typeof b=="object"&&!z.isMatrix(b)&&!r.isAnyArray(b)?(E=b,b=I,w=!0):b=new z(b),I.rows!==b.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:x=!0}=E;x&&(I=I.center("column"),w||(b=b.center("column")));const M=I.transpose().mmul(b);for(let Q=0;Q<M.rows;Q++)for(let N=0;N<M.columns;N++)M.set(Q,N,M.get(Q,N)*(1/(I.rows-1)));return M}function Or(I,b=I,E={}){I=new z(I);let w=!1;if(typeof b=="object"&&!z.isMatrix(b)&&!r.isAnyArray(b)?(E=b,b=I,w=!0):b=new z(b),I.rows!==b.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:x=!0,scale:M=!0}=E;x&&(I.center("column"),w||b.center("column")),M&&(I.scale("column"),w||b.scale("column"));const Q=I.standardDeviation("column",{unbiased:!0}),N=w?Q:b.standardDeviation("column",{unbiased:!0}),P=I.transpose().mmul(b);for(let R=0;R<P.rows;R++)for(let J=0;J<P.columns;J++)P.set(R,J,P.get(R,J)*(1/(Q[R]*N[J]))*(1/(I.rows-1)));return P}class Vr{constructor(b,E={}){const{assumeSymmetric:w=!1}=E;if(b=St.checkMatrix(b),!b.isSquare())throw new Error("Matrix is not a square matrix");if(b.isEmpty())throw new Error("Matrix must be non-empty");let x=b.columns,M=new z(x,x),Q=new Float64Array(x),N=new Float64Array(x),P=b,R,J,j=!1;if(w?j=!0:j=b.isSymmetric(),j){for(R=0;R<x;R++)for(J=0;J<x;J++)M.set(R,J,P.get(R,J));Xl(x,N,Q,M),Zl(x,N,Q,M)}else{let oe=new z(x,x),me=new Float64Array(x);for(J=0;J<x;J++)for(R=0;R<x;R++)oe.set(R,J,P.get(R,J));Cf(x,oe,me,M),Jl(x,N,Q,M,oe)}this.n=x,this.e=N,this.d=Q,this.V=M}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let b=this.n,E=this.e,w=this.d,x=new z(b,b),M,Q;for(M=0;M<b;M++){for(Q=0;Q<b;Q++)x.set(M,Q,0);x.set(M,M,w[M]),E[M]>0?x.set(M,M+1,E[M]):E[M]<0&&x.set(M,M-1,E[M])}return x}}function Xl(I,b,E,w){let x,M,Q,N,P,R,J,j;for(P=0;P<I;P++)E[P]=w.get(I-1,P);for(N=I-1;N>0;N--){for(j=0,Q=0,R=0;R<N;R++)j=j+Math.abs(E[R]);if(j===0)for(b[N]=E[N-1],P=0;P<N;P++)E[P]=w.get(N-1,P),w.set(N,P,0),w.set(P,N,0);else{for(R=0;R<N;R++)E[R]/=j,Q+=E[R]*E[R];for(x=E[N-1],M=Math.sqrt(Q),x>0&&(M=-M),b[N]=j*M,Q=Q-x*M,E[N-1]=x-M,P=0;P<N;P++)b[P]=0;for(P=0;P<N;P++){for(x=E[P],w.set(P,N,x),M=b[P]+w.get(P,P)*x,R=P+1;R<=N-1;R++)M+=w.get(R,P)*E[R],b[R]+=w.get(R,P)*x;b[P]=M}for(x=0,P=0;P<N;P++)b[P]/=Q,x+=b[P]*E[P];for(J=x/(Q+Q),P=0;P<N;P++)b[P]-=J*E[P];for(P=0;P<N;P++){for(x=E[P],M=b[P],R=P;R<=N-1;R++)w.set(R,P,w.get(R,P)-(x*b[R]+M*E[R]));E[P]=w.get(N-1,P),w.set(N,P,0)}}E[N]=Q}for(N=0;N<I-1;N++){if(w.set(I-1,N,w.get(N,N)),w.set(N,N,1),Q=E[N+1],Q!==0){for(R=0;R<=N;R++)E[R]=w.get(R,N+1)/Q;for(P=0;P<=N;P++){for(M=0,R=0;R<=N;R++)M+=w.get(R,N+1)*w.get(R,P);for(R=0;R<=N;R++)w.set(R,P,w.get(R,P)-M*E[R])}}for(R=0;R<=N;R++)w.set(R,N+1,0)}for(P=0;P<I;P++)E[P]=w.get(I-1,P),w.set(I-1,P,0);w.set(I-1,I-1,1),b[0]=0}function Zl(I,b,E,w){let x,M,Q,N,P,R,J,j,oe,me,ne,ce,Ce,q,ye,Oe;for(Q=1;Q<I;Q++)b[Q-1]=b[Q];b[I-1]=0;let Ke=0,je=0,Ht=Number.EPSILON;for(R=0;R<I;R++){for(je=Math.max(je,Math.abs(E[R])+Math.abs(b[R])),J=R;J<I&&!(Math.abs(b[J])<=Ht*je);)J++;if(J>R)do{for(x=E[R],j=(E[R+1]-x)/(2*b[R]),oe=Wt(j,1),j<0&&(oe=-oe),E[R]=b[R]/(j+oe),E[R+1]=b[R]*(j+oe),me=E[R+1],M=x-E[R],Q=R+2;Q<I;Q++)E[Q]-=M;for(Ke=Ke+M,j=E[J],ne=1,ce=ne,Ce=ne,q=b[R+1],ye=0,Oe=0,Q=J-1;Q>=R;Q--)for(Ce=ce,ce=ne,Oe=ye,x=ne*b[Q],M=ne*j,oe=Wt(j,b[Q]),b[Q+1]=ye*oe,ye=b[Q]/oe,ne=j/oe,j=ne*E[Q]-ye*x,E[Q+1]=M+ye*(ne*x+ye*E[Q]),P=0;P<I;P++)M=w.get(P,Q+1),w.set(P,Q+1,ye*w.get(P,Q)+ne*M),w.set(P,Q,ne*w.get(P,Q)-ye*M);j=-ye*Oe*Ce*q*b[R]/me,b[R]=ye*j,E[R]=ne*j}while(Math.abs(b[R])>Ht*je);E[R]=E[R]+Ke,b[R]=0}for(Q=0;Q<I-1;Q++){for(P=Q,j=E[Q],N=Q+1;N<I;N++)E[N]<j&&(P=N,j=E[N]);if(P!==Q)for(E[P]=E[Q],E[Q]=j,N=0;N<I;N++)j=w.get(N,Q),w.set(N,Q,w.get(N,P)),w.set(N,P,j)}}function Cf(I,b,E,w){let x=0,M=I-1,Q,N,P,R,J,j,oe;for(j=x+1;j<=M-1;j++){for(oe=0,R=j;R<=M;R++)oe=oe+Math.abs(b.get(R,j-1));if(oe!==0){for(P=0,R=M;R>=j;R--)E[R]=b.get(R,j-1)/oe,P+=E[R]*E[R];for(N=Math.sqrt(P),E[j]>0&&(N=-N),P=P-E[j]*N,E[j]=E[j]-N,J=j;J<I;J++){for(Q=0,R=M;R>=j;R--)Q+=E[R]*b.get(R,J);for(Q=Q/P,R=j;R<=M;R++)b.set(R,J,b.get(R,J)-Q*E[R])}for(R=0;R<=M;R++){for(Q=0,J=M;J>=j;J--)Q+=E[J]*b.get(R,J);for(Q=Q/P,J=j;J<=M;J++)b.set(R,J,b.get(R,J)-Q*E[J])}E[j]=oe*E[j],b.set(j,j-1,oe*N)}}for(R=0;R<I;R++)for(J=0;J<I;J++)w.set(R,J,R===J?1:0);for(j=M-1;j>=x+1;j--)if(b.get(j,j-1)!==0){for(R=j+1;R<=M;R++)E[R]=b.get(R,j-1);for(J=j;J<=M;J++){for(N=0,R=j;R<=M;R++)N+=E[R]*w.get(R,J);for(N=N/E[j]/b.get(j,j-1),R=j;R<=M;R++)w.set(R,J,w.get(R,J)+N*E[R])}}}function Jl(I,b,E,w,x){let M=I-1,Q=0,N=I-1,P=Number.EPSILON,R=0,J=0,j=0,oe=0,me=0,ne=0,ce=0,Ce=0,q,ye,Oe,Ke,je,Ht,Qe,Pe,Ft,Y,fe,Se,ve,Gt,yt;for(q=0;q<I;q++)for((q<Q||q>N)&&(E[q]=x.get(q,q),b[q]=0),ye=Math.max(q-1,0);ye<I;ye++)J=J+Math.abs(x.get(q,ye));for(;M>=Q;){for(Ke=M;Ke>Q&&(ne=Math.abs(x.get(Ke-1,Ke-1))+Math.abs(x.get(Ke,Ke)),ne===0&&(ne=J),!(Math.abs(x.get(Ke,Ke-1))<P*ne));)Ke--;if(Ke===M)x.set(M,M,x.get(M,M)+R),E[M]=x.get(M,M),b[M]=0,M--,Ce=0;else if(Ke===M-1){if(Qe=x.get(M,M-1)*x.get(M-1,M),j=(x.get(M-1,M-1)-x.get(M,M))/2,oe=j*j+Qe,ce=Math.sqrt(Math.abs(oe)),x.set(M,M,x.get(M,M)+R),x.set(M-1,M-1,x.get(M-1,M-1)+R),Pe=x.get(M,M),oe>=0){for(ce=j>=0?j+ce:j-ce,E[M-1]=Pe+ce,E[M]=E[M-1],ce!==0&&(E[M]=Pe-Qe/ce),b[M-1]=0,b[M]=0,Pe=x.get(M,M-1),ne=Math.abs(Pe)+Math.abs(ce),j=Pe/ne,oe=ce/ne,me=Math.sqrt(j*j+oe*oe),j=j/me,oe=oe/me,ye=M-1;ye<I;ye++)ce=x.get(M-1,ye),x.set(M-1,ye,oe*ce+j*x.get(M,ye)),x.set(M,ye,oe*x.get(M,ye)-j*ce);for(q=0;q<=M;q++)ce=x.get(q,M-1),x.set(q,M-1,oe*ce+j*x.get(q,M)),x.set(q,M,oe*x.get(q,M)-j*ce);for(q=Q;q<=N;q++)ce=w.get(q,M-1),w.set(q,M-1,oe*ce+j*w.get(q,M)),w.set(q,M,oe*w.get(q,M)-j*ce)}else E[M-1]=Pe+j,E[M]=Pe+j,b[M-1]=ce,b[M]=-ce;M=M-2,Ce=0}else{if(Pe=x.get(M,M),Ft=0,Qe=0,Ke<M&&(Ft=x.get(M-1,M-1),Qe=x.get(M,M-1)*x.get(M-1,M)),Ce===10){for(R+=Pe,q=Q;q<=M;q++)x.set(q,q,x.get(q,q)-Pe);ne=Math.abs(x.get(M,M-1))+Math.abs(x.get(M-1,M-2)),Pe=Ft=.75*ne,Qe=-.4375*ne*ne}if(Ce===30&&(ne=(Ft-Pe)/2,ne=ne*ne+Qe,ne>0)){for(ne=Math.sqrt(ne),Ft<Pe&&(ne=-ne),ne=Pe-Qe/((Ft-Pe)/2+ne),q=Q;q<=M;q++)x.set(q,q,x.get(q,q)-ne);R+=ne,Pe=Ft=Qe=.964}for(Ce=Ce+1,je=M-2;je>=Ke&&(ce=x.get(je,je),me=Pe-ce,ne=Ft-ce,j=(me*ne-Qe)/x.get(je+1,je)+x.get(je,je+1),oe=x.get(je+1,je+1)-ce-me-ne,me=x.get(je+2,je+1),ne=Math.abs(j)+Math.abs(oe)+Math.abs(me),j=j/ne,oe=oe/ne,me=me/ne,!(je===Ke||Math.abs(x.get(je,je-1))*(Math.abs(oe)+Math.abs(me))<P*(Math.abs(j)*(Math.abs(x.get(je-1,je-1))+Math.abs(ce)+Math.abs(x.get(je+1,je+1))))));)je--;for(q=je+2;q<=M;q++)x.set(q,q-2,0),q>je+2&&x.set(q,q-3,0);for(Oe=je;Oe<=M-1&&(Gt=Oe!==M-1,Oe!==je&&(j=x.get(Oe,Oe-1),oe=x.get(Oe+1,Oe-1),me=Gt?x.get(Oe+2,Oe-1):0,Pe=Math.abs(j)+Math.abs(oe)+Math.abs(me),Pe!==0&&(j=j/Pe,oe=oe/Pe,me=me/Pe)),Pe!==0);Oe++)if(ne=Math.sqrt(j*j+oe*oe+me*me),j<0&&(ne=-ne),ne!==0){for(Oe!==je?x.set(Oe,Oe-1,-ne*Pe):Ke!==je&&x.set(Oe,Oe-1,-x.get(Oe,Oe-1)),j=j+ne,Pe=j/ne,Ft=oe/ne,ce=me/ne,oe=oe/j,me=me/j,ye=Oe;ye<I;ye++)j=x.get(Oe,ye)+oe*x.get(Oe+1,ye),Gt&&(j=j+me*x.get(Oe+2,ye),x.set(Oe+2,ye,x.get(Oe+2,ye)-j*ce)),x.set(Oe,ye,x.get(Oe,ye)-j*Pe),x.set(Oe+1,ye,x.get(Oe+1,ye)-j*Ft);for(q=0;q<=Math.min(M,Oe+3);q++)j=Pe*x.get(q,Oe)+Ft*x.get(q,Oe+1),Gt&&(j=j+ce*x.get(q,Oe+2),x.set(q,Oe+2,x.get(q,Oe+2)-j*me)),x.set(q,Oe,x.get(q,Oe)-j),x.set(q,Oe+1,x.get(q,Oe+1)-j*oe);for(q=Q;q<=N;q++)j=Pe*w.get(q,Oe)+Ft*w.get(q,Oe+1),Gt&&(j=j+ce*w.get(q,Oe+2),w.set(q,Oe+2,w.get(q,Oe+2)-j*me)),w.set(q,Oe,w.get(q,Oe)-j),w.set(q,Oe+1,w.get(q,Oe+1)-j*oe)}}}if(J!==0){for(M=I-1;M>=0;M--)if(j=E[M],oe=b[M],oe===0)for(Ke=M,x.set(M,M,1),q=M-1;q>=0;q--){for(Qe=x.get(q,q)-j,me=0,ye=Ke;ye<=M;ye++)me=me+x.get(q,ye)*x.get(ye,M);if(b[q]<0)ce=Qe,ne=me;else if(Ke=q,b[q]===0?x.set(q,M,Qe!==0?-me/Qe:-me/(P*J)):(Pe=x.get(q,q+1),Ft=x.get(q+1,q),oe=(E[q]-j)*(E[q]-j)+b[q]*b[q],Ht=(Pe*ne-ce*me)/oe,x.set(q,M,Ht),x.set(q+1,M,Math.abs(Pe)>Math.abs(ce)?(-me-Qe*Ht)/Pe:(-ne-Ft*Ht)/ce)),Ht=Math.abs(x.get(q,M)),P*Ht*Ht>1)for(ye=q;ye<=M;ye++)x.set(ye,M,x.get(ye,M)/Ht)}else if(oe<0)for(Ke=M-1,Math.abs(x.get(M,M-1))>Math.abs(x.get(M-1,M))?(x.set(M-1,M-1,oe/x.get(M,M-1)),x.set(M-1,M,-(x.get(M,M)-j)/x.get(M,M-1))):(yt=ea(0,-x.get(M-1,M),x.get(M-1,M-1)-j,oe),x.set(M-1,M-1,yt[0]),x.set(M-1,M,yt[1])),x.set(M,M-1,0),x.set(M,M,1),q=M-2;q>=0;q--){for(Y=0,fe=0,ye=Ke;ye<=M;ye++)Y=Y+x.get(q,ye)*x.get(ye,M-1),fe=fe+x.get(q,ye)*x.get(ye,M);if(Qe=x.get(q,q)-j,b[q]<0)ce=Qe,me=Y,ne=fe;else if(Ke=q,b[q]===0?(yt=ea(-Y,-fe,Qe,oe),x.set(q,M-1,yt[0]),x.set(q,M,yt[1])):(Pe=x.get(q,q+1),Ft=x.get(q+1,q),Se=(E[q]-j)*(E[q]-j)+b[q]*b[q]-oe*oe,ve=(E[q]-j)*2*oe,Se===0&&ve===0&&(Se=P*J*(Math.abs(Qe)+Math.abs(oe)+Math.abs(Pe)+Math.abs(Ft)+Math.abs(ce))),yt=ea(Pe*me-ce*Y+oe*fe,Pe*ne-ce*fe-oe*Y,Se,ve),x.set(q,M-1,yt[0]),x.set(q,M,yt[1]),Math.abs(Pe)>Math.abs(ce)+Math.abs(oe)?(x.set(q+1,M-1,(-Y-Qe*x.get(q,M-1)+oe*x.get(q,M))/Pe),x.set(q+1,M,(-fe-Qe*x.get(q,M)-oe*x.get(q,M-1))/Pe)):(yt=ea(-me-Ft*x.get(q,M-1),-ne-Ft*x.get(q,M),ce,oe),x.set(q+1,M-1,yt[0]),x.set(q+1,M,yt[1]))),Ht=Math.max(Math.abs(x.get(q,M-1)),Math.abs(x.get(q,M))),P*Ht*Ht>1)for(ye=q;ye<=M;ye++)x.set(ye,M-1,x.get(ye,M-1)/Ht),x.set(ye,M,x.get(ye,M)/Ht)}for(q=0;q<I;q++)if(q<Q||q>N)for(ye=q;ye<I;ye++)w.set(q,ye,x.get(q,ye));for(ye=I-1;ye>=Q;ye--)for(q=Q;q<=N;q++){for(ce=0,Oe=Q;Oe<=Math.min(ye,N);Oe++)ce=ce+w.get(q,Oe)*x.get(Oe,ye);w.set(q,ye,ce)}}}function ea(I,b,E,w){let x,M;return Math.abs(E)>Math.abs(w)?(x=w/E,M=E+x*w,[(I+x*b)/M,(b-x*I)/M]):(x=E/w,M=w+x*E,[(x*I+b)/M,(x*b-I)/M])}class ec{constructor(b){if(b=St.checkMatrix(b),!b.isSymmetric())throw new Error("Matrix is not symmetric");let E=b,w=E.rows,x=new z(w,w),M=!0,Q,N,P;for(N=0;N<w;N++){let R=0;for(P=0;P<N;P++){let J=0;for(Q=0;Q<P;Q++)J+=x.get(P,Q)*x.get(N,Q);J=(E.get(N,P)-J)/x.get(P,P),x.set(N,P,J),R=R+J*J}for(R=E.get(N,N)-R,M&=R>0,x.set(N,N,Math.sqrt(Math.max(R,0))),P=N+1;P<w;P++)x.set(N,P,0)}this.L=x,this.positiveDefinite=!!M}isPositiveDefinite(){return this.positiveDefinite}solve(b){b=St.checkMatrix(b);let E=this.L,w=E.rows;if(b.rows!==w)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let x=b.columns,M=b.clone(),Q,N,P;for(P=0;P<w;P++)for(N=0;N<x;N++){for(Q=0;Q<P;Q++)M.set(P,N,M.get(P,N)-M.get(Q,N)*E.get(P,Q));M.set(P,N,M.get(P,N)/E.get(P,P))}for(P=w-1;P>=0;P--)for(N=0;N<x;N++){for(Q=P+1;Q<w;Q++)M.set(P,N,M.get(P,N)-M.get(Q,N)*E.get(Q,P));M.set(P,N,M.get(P,N)/E.get(P,P))}return M}get lowerTriangularMatrix(){return this.L}}class tc{constructor(b,E={}){b=St.checkMatrix(b);let{Y:w}=E;const{scaleScores:x=!1,maxIterations:M=1e3,terminationCriteria:Q=1e-10}=E;let N;if(w){if(r.isAnyArray(w)&&typeof w[0]=="number"?w=z.columnVector(w):w=St.checkMatrix(w),w.rows!==b.rows)throw new Error("Y should have the same number of rows as X");N=w.getColumnVector(0)}else N=b.getColumnVector(0);let P=1,R,J,j,oe;for(let me=0;me<M&&P>Q;me++)j=b.transpose().mmul(N).div(N.transpose().mmul(N).get(0,0)),j=j.div(j.norm()),R=b.mmul(j).div(j.transpose().mmul(j).get(0,0)),me>0&&(P=R.clone().sub(oe).pow(2).sum()),oe=R.clone(),w?(J=w.transpose().mmul(R).div(R.transpose().mmul(R).get(0,0)),J=J.div(J.norm()),N=w.mmul(J).div(J.transpose().mmul(J).get(0,0))):N=R;if(w){let me=b.transpose().mmul(R).div(R.transpose().mmul(R).get(0,0));me=me.div(me.norm());let ne=b.clone().sub(R.clone().mmul(me.transpose())),ce=N.transpose().mmul(R).div(R.transpose().mmul(R).get(0,0)),Ce=w.clone().sub(R.clone().mulS(ce.get(0,0)).mmul(J.transpose()));this.t=R,this.p=me.transpose(),this.w=j.transpose(),this.q=J,this.u=N,this.s=R.transpose().mmul(R),this.xResidual=ne,this.yResidual=Ce,this.betas=ce}else this.w=j.transpose(),this.s=R.transpose().mmul(R).sqrt(),x?this.t=R.clone().div(this.s.get(0,0)):this.t=R,this.xResidual=b.sub(R.mmul(j.transpose()))}}return rt.AbstractMatrix=re,rt.CHO=ec,rt.CholeskyDecomposition=ec,rt.DistanceMatrix=Ae,rt.EVD=Vr,rt.EigenvalueDecomposition=Vr,rt.LU=ir,rt.LuDecomposition=ir,rt.Matrix=z,rt.MatrixColumnSelectionView=Ue,rt.MatrixColumnView=Le,rt.MatrixFlipColumnView=at,rt.MatrixFlipRowView=lt,rt.MatrixRowSelectionView=pt,rt.MatrixRowView=ct,rt.MatrixSelectionView=Ne,rt.MatrixSubView=ht,rt.MatrixTransposeView=nt,rt.NIPALS=tc,rt.Nipals=tc,rt.QR=_t,rt.QrDecomposition=_t,rt.SVD=Qn,rt.SingularValueDecomposition=Qn,rt.SymmetricMatrix=ee,rt.WrapperMatrix1D=gr,rt.WrapperMatrix2D=St,rt.correlation=Or,rt.covariance=cs,rt.default=z,rt.determinant=ar,rt.inverse=qn,rt.linearDependencies=an,rt.pseudoInverse=cA,rt.solve=vr,rt.wrap=Ji,rt}var Cd=P7();const yC=Qh(Cd),Ga=Cd.Matrix,wQ=Cd.SingularValueDecomposition;yC.Matrix?yC.Matrix:Cd.Matrix;const R7={center:[0,0],linkDistance:50};class BQ{constructor(e={}){this.options=e,this.id="mds",this.options=Object.assign(Object.assign({},R7),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,e,t)})}genericMDSLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a=[0,0],linkDistance:s=50}=i,o=t.getAllNodes(),A=t.getAllEdges();if(!(o!=null&&o.length)||o.length===1)return to(t,e,a);const l=gQ({nodes:o,edges:A}),c=fQ(l);D7(c);const u=O$(c,s),h=H7(u),d=[];return h.forEach((g,v)=>{const p=Dr(o[v]);p.data.x=g[0]+a[0],p.data.y=g[1]+a[1],d.push(p)}),e&&d.forEach(g=>t.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:A}})}}const D7=r=>{let e=-999999;r.forEach(t=>{t.forEach(n=>{n!==1/0&&e<n&&(e=n)})}),r.forEach((t,n)=>{t.forEach((i,a)=>{i===1/0&&(r[n][a]=e)})})},H7=r=>{const t=Ga.mul(Ga.pow(r,2),-.5),n=t.mean("row"),i=t.mean("column"),a=t.mean();t.add(a).subRowVector(n).subColumnVector(i);const s=new wQ(t),o=Ga.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(A=>Ga.mul([A],[o]).toJSON()[0].splice(0,2))};function B1(r){return!!r.tick&&!!r.stop}const G7={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},K7={center:[0,0],comboPadding:10,treeKey:"combo"};class z7{constructor(e={}){this.options=e,this.id="comboCombined",this.options=Object.assign(Object.assign({},K7),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,e,t)})}genericComboCombinedLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,A=t.getAllNodes().filter(T=>!T.data._isCombo),l=t.getAllNodes().filter(T=>T.data._isCombo),c=t.getAllEdges(),u=A==null?void 0:A.length;if(!u||u===1)return to(t,e,a);const h=[],d=new Map;A.forEach(T=>{d.set(T.id,T)});const f=new Map;l.forEach(T=>{f.set(T.id,T)});const g=new Map,v=this.getInnerGraphs(t,s,d,f,c,i,g);yield Promise.all(v);const p=new Map,y=[],m=new Map;let B=!0;t.getRoots(s).forEach(T=>{const O=g.get(T.id),_=f.get(T.id)||d.get(T.id),k={id:T.id,data:Object.assign(Object.assign({},T.data),{x:O.data.x||_.data.x,y:O.data.y||_.data.y,fx:O.data.fx||_.data.fx,fy:O.data.fy||_.data.fy,mass:O.data.mass||_.data.mass,size:O.data.size})};y.push(k),p.set(T.id,!0),!isNaN(k.data.x)&&k.data.x!==0&&!isNaN(k.data.y)&&k.data.y!==0?B=!1:(k.data.x=Math.random()*100,k.data.y=Math.random()*100),y1(t,[T],L=>{L.id!==T.id&&m.set(L.id,T.id)},"TB",s)});const C=[];c.forEach(T=>{const O=m.get(T.source)||T.source,_=m.get(T.target)||T.target;O!==_&&p.has(O)&&p.has(_)&&C.push({id:T.id,source:O,target:_,data:{}})});let S;if(y!=null&&y.length){if(y.length===1)y[0].data.x=a[0],y[0].data.y=a[1];else{const T=new Mn({nodes:y,edges:C}),O=o||new mQ;B&&G7[O.id]&&(yield(y.length<100?new BQ:new w1).assign(T));const _=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},O.id==="force"?{gravity:1,factor:4,linkDistance:(k,L,U)=>{const G=Math.max(...L.data.size)||32,W=Math.max(...U.data.size)||32;return G/2+W/2+200}}:{});S=yield mC(O,T,_)}g.forEach(T=>{var O;const _=S.nodes.find(U=>U.id===T.id);if(_){const{x:U,y:G}=_.data;T.data.visited=!0,T.data.x=U,T.data.y=G,h.push({id:T.id,data:{x:U,y:G}})}const{x:k,y:L}=T.data;(O=T.data.nodes)===null||O===void 0||O.forEach(U=>{h.push({id:U.id,data:{x:U.data.x+k,y:U.data.y+L}})})}),g.forEach(({data:T})=>{const{x:O,y:_,visited:k,nodes:L}=T;L==null||L.forEach(U=>{if(!k){const G=h.find(W=>W.id===U.id);G.data.x+=O||0,G.data.y+=_||0}})})}return e&&h.forEach(T=>{t.mergeNodeData(T.id,{x:T.data.x,y:T.data.y})}),{nodes:h,edges:c}})}initVals(e){const t=Object.assign({},e),{nodeSize:n,spacing:i,comboPadding:a}=e;let s,o;if(Be(i)?o=()=>i:Te(i)?o=i:o=()=>0,t.spacing=o,!n)s=l=>{const c=o(l);return l.size?la(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+c)/2:un(l.size)?((l.size.width>l.size.height?l.size.width:l.size.height)+c)/2:(l.size+c)/2:32+c/2};else if(Te(n))s=l=>{const c=n(l),u=o(l);return la(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+u)/2:((c||32)+u)/2};else if(la(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=u=>c+o(u)/2}else{const l=n/2;s=c=>l+o(c)/2}t.nodeSize=s;let A;return Be(a)?A=()=>a:la(a)?A=()=>Math.max.apply(null,a):Te(a)?A=a:A=()=>0,t.comboPadding=A,t}getInnerGraphs(e,t,n,i,a,s,o){const{nodeSize:A,comboPadding:l,spacing:c,innerLayout:u}=s,h=u||new w1({}),d={center:[0,0],preventOverlap:!0,nodeSpacing:c},f=[],g=v=>{let p=(l==null?void 0:l(v))||10;return la(p)&&(p=Math.max(...p)),{size:p?[p*2,p*2]:[30,30],padding:p}};return e.getRoots(t).forEach(v=>{o.set(v.id,{id:v.id,data:{nodes:[],size:g(v).size}});let p=Promise.resolve();y1(e,[v],y=>{var m;if(!y.data._isCombo)return;const{size:B,padding:C}=g(y);if(!(!((m=e.getChildren(y.id,t))===null||m===void 0)&&m.length))o.set(y.id,{id:y.id,data:Object.assign(Object.assign({},y.data),{size:B})});else{const S=o.get(y.id);o.set(y.id,{id:y.id,data:Object.assign({nodes:[]},S==null?void 0:S.data)});const F=new Map,T=e.getChildren(y.id,t).map(k=>{if(k.data._isCombo)return o.has(k.id)||o.set(k.id,{id:k.id,data:Object.assign({},k.data)}),F.set(k.id,!0),o.get(k.id);const L=n.get(k.id)||i.get(k.id);return F.set(k.id,!0),{id:k.id,data:Object.assign(Object.assign({},L.data),k.data)}}),O={nodes:T,edges:a.filter(k=>F.has(k.source)&&F.has(k.target))};let _=1/0;T.forEach(k=>{var L;let{size:U}=k.data;U||(U=((L=o.get(k.id))===null||L===void 0?void 0:L.data.size)||(A==null?void 0:A(k))||[30,30]),Be(U)&&(U=[U,U]);const[G,W]=U;_>G&&(_=G),_>W&&(_=W),k.data.size=U}),p=p.then(()=>Je(this,void 0,void 0,function*(){const k=new Mn(O);yield mC(h,k,d,!0);const{minX:L,minY:U,maxX:G,maxY:W}=_$(T),V={x:(G+L)/2,y:(W+U)/2};O.nodes.forEach(D=>{D.data.x-=V.x,D.data.y-=V.y});const K=[Math.max(G-L,_)+C*2,Math.max(W-U,_)+C*2];o.get(y.id).data.size=K,o.get(y.id).data.nodes=T}))}return!0},"BT",t),f.push(p)}),f}}function mC(r,e,t,n){var i;return Je(this,void 0,void 0,function*(){return B1(r)?(r.execute(e,t),r.stop(),r.tick((i=t.iterations)!==null&&i!==void 0?i:300)):n?yield r.assign(e,t):yield r.execute(e,t)})}function V7(r,e){var t,n=1;r==null&&(r=0),e==null&&(e=0);function i(){var a,s=t.length,o,A=0,l=0;for(a=0;a<s;++a)o=t[a],A+=o.x,l+=o.y;for(A=(A/s-r)*n,l=(l/s-e)*n,a=0;a<s;++a)o=t[a],o.x-=A,o.y-=l}return i.initialize=function(a){t=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(e=+a,i):e},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function Fn(r){return function(){return r}}function Ka(r){return(r()-.5)*1e-6}function j7(r){return r.x+r.vx}function W7(r){return r.y+r.vy}function q7(r){var e,t,n,i=1,a=1;typeof r!="function"&&(r=Fn(r==null?1:+r));function s(){for(var l,c=e.length,u,h,d,f,g,v,p=0;p<a;++p)for(u=xd(e,j7,W7).visitAfter(o),l=0;l<c;++l)h=e[l],g=t[h.index],v=g*g,d=h.x+h.vx,f=h.y+h.vy,u.visit(y);function y(m,B,C,S,F){var T=m.data,O=m.r,_=g+O;if(T){if(T.index>h.index){var k=d-T.x-T.vx,L=f-T.y-T.vy,U=k*k+L*L;U<_*_&&(k===0&&(k=Ka(n),U+=k*k),L===0&&(L=Ka(n),U+=L*L),U=(_-(U=Math.sqrt(U)))/U*i,h.vx+=(k*=U)*(_=(O*=O)/(v+O)),h.vy+=(L*=U)*_,T.vx-=k*(_=1-_),T.vy-=L*_)}return}return B>d+_||S<d-_||C>f+_||F<f-_}}function o(l){if(l.data)return l.r=t[l.data.index];for(var c=l.r=0;c<4;++c)l[c]&&l[c].r>l.r&&(l.r=l[c].r)}function A(){if(e){var l,c=e.length,u;for(t=new Array(c),l=0;l<c;++l)u=e[l],t[u.index]=+r(u,l,e)}}return s.initialize=function(l,c){e=l,n=c,A()},s.iterations=function(l){return arguments.length?(a=+l,s):a},s.strength=function(l){return arguments.length?(i=+l,s):i},s.radius=function(l){return arguments.length?(r=typeof l=="function"?l:Fn(+l),A(),s):r},s}function $7(r){return r.index}function wC(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function Y7(r){var e=$7,t=u,n,i=Fn(30),a,s,o,A,l,c=1;r==null&&(r=[]);function u(v){return 1/Math.min(o[v.source.index],o[v.target.index])}function h(v){for(var p=0,y=r.length;p<c;++p)for(var m=0,B,C,S,F,T,O,_;m<y;++m)B=r[m],C=B.source,S=B.target,F=S.x+S.vx-C.x-C.vx||Ka(l),T=S.y+S.vy-C.y-C.vy||Ka(l),O=Math.sqrt(F*F+T*T),O=(O-a[m])/O*v*n[m],F*=O,T*=O,S.vx-=F*(_=A[m]),S.vy-=T*_,C.vx+=F*(_=1-_),C.vy+=T*_}function d(){if(s){var v,p=s.length,y=r.length,m=new Map(s.map((C,S)=>[e(C,S,s),C])),B;for(v=0,o=new Array(p);v<y;++v)B=r[v],B.index=v,typeof B.source!="object"&&(B.source=wC(m,B.source)),typeof B.target!="object"&&(B.target=wC(m,B.target)),o[B.source.index]=(o[B.source.index]||0)+1,o[B.target.index]=(o[B.target.index]||0)+1;for(v=0,A=new Array(y);v<y;++v)B=r[v],A[v]=o[B.source.index]/(o[B.source.index]+o[B.target.index]);n=new Array(y),f(),a=new Array(y),g()}}function f(){if(s)for(var v=0,p=r.length;v<p;++v)n[v]=+t(r[v],v,r)}function g(){if(s)for(var v=0,p=r.length;v<p;++v)a[v]=+i(r[v],v,r)}return h.initialize=function(v,p){s=v,l=p,d()},h.links=function(v){return arguments.length?(r=v,d(),h):r},h.id=function(v){return arguments.length?(e=v,h):e},h.iterations=function(v){return arguments.length?(c=+v,h):c},h.strength=function(v){return arguments.length?(t=typeof v=="function"?v:Fn(+v),f(),h):t},h.distance=function(v){return arguments.length?(i=typeof v=="function"?v:Fn(+v),g(),h):i},h}var X7={value:()=>{}};function bQ(){for(var r=0,e=arguments.length,t={},n;r<e;++r){if(!(n=arguments[r]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new Lu(t)}function Lu(r){this._=r}function Z7(r,e){return r.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}Lu.prototype=bQ.prototype={constructor:Lu,on:function(r,e){var t=this._,n=Z7(r+"",t),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(r=n[a]).type)&&(i=J7(t[i],r.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<s;)if(i=(r=n[a]).type)t[i]=BC(t[i],r.name,e);else if(e==null)for(i in t)t[i]=BC(t[i],r.name,null);return this},copy:function(){var r={},e=this._;for(var t in e)r[t]=e[t].slice();return new Lu(r)},call:function(r,e){if((i=arguments.length-2)>0)for(var t=new Array(i),n=0,i,a;n<i;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(a=this._[r],n=0,i=a.length;n<i;++n)a[n].value.apply(e,t)},apply:function(r,e,t){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],i=0,a=n.length;i<a;++i)n[i].value.apply(e,t)}};function J7(r,e){for(var t=0,n=r.length,i;t<n;++t)if((i=r[t]).name===e)return i.value}function BC(r,e,t){for(var n=0,i=r.length;n<i;++n)if(r[n].name===e){r[n]=X7,r=r.slice(0,n).concat(r.slice(n+1));break}return t!=null&&r.push({name:e,value:t}),r}var $o=0,RA=0,CA=0,EQ=1e3,xh,DA,Ch=0,qs=0,Sd=0,bl=typeof performance=="object"&&performance.now?performance:Date,xQ=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function CQ(){return qs||(xQ(eY),qs=bl.now()+Sd)}function eY(){qs=0}function b1(){this._call=this._time=this._next=null}b1.prototype=SQ.prototype={constructor:b1,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?CQ():+t)+(e==null?0:+e),!this._next&&DA!==this&&(DA?DA._next=this:xh=this,DA=this),this._call=r,this._time=t,E1()},stop:function(){this._call&&(this._call=null,this._time=1/0,E1())}};function SQ(r,e,t){var n=new b1;return n.restart(r,e,t),n}function tY(){CQ(),++$o;for(var r=xh,e;r;)(e=qs-r._time)>=0&&r._call.call(void 0,e),r=r._next;--$o}function bC(){qs=(Ch=bl.now())+Sd,$o=RA=0;try{tY()}finally{$o=0,rY(),qs=0}}function nY(){var r=bl.now(),e=r-Ch;e>EQ&&(Sd-=e,Ch=r)}function rY(){for(var r,e=xh,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:xh=t);DA=r,E1(n)}function E1(r){if(!$o){RA&&(RA=clearTimeout(RA));var e=r-qs;e>24?(r<1/0&&(RA=setTimeout(bC,r-bl.now()-Sd)),CA&&(CA=clearInterval(CA))):(CA||(Ch=bl.now(),CA=setInterval(nY,EQ)),$o=1,xQ(bC))}}const iY=1664525,aY=1013904223,EC=4294967296;function sY(){let r=1;return()=>(r=(iY*r+aY)%EC)/EC}function oY(r){return r.x}function AY(r){return r.y}var lY=10,cY=Math.PI*(3-Math.sqrt(5));function uY(r){var e,t=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,A=SQ(u),l=bQ("tick","end"),c=sY();r==null&&(r=[]);function u(){h(),l.call("tick",e),t<n&&(A.stop(),l.call("end",e))}function h(g){var v,p=r.length,y;g===void 0&&(g=1);for(var m=0;m<g;++m)for(t+=(a-t)*i,o.forEach(function(B){B(t)}),v=0;v<p;++v)y=r[v],y.fx==null?y.x+=y.vx*=s:(y.x=y.fx,y.vx=0),y.fy==null?y.y+=y.vy*=s:(y.y=y.fy,y.vy=0);return e}function d(){for(var g=0,v=r.length,p;g<v;++g){if(p=r[g],p.index=g,p.fx!=null&&(p.x=p.fx),p.fy!=null&&(p.y=p.fy),isNaN(p.x)||isNaN(p.y)){var y=lY*Math.sqrt(.5+g),m=g*cY;p.x=y*Math.cos(m),p.y=y*Math.sin(m)}(isNaN(p.vx)||isNaN(p.vy))&&(p.vx=p.vy=0)}}function f(g){return g.initialize&&g.initialize(r,c),g}return d(),e={tick:h,restart:function(){return A.restart(u),e},stop:function(){return A.stop(),e},nodes:function(g){return arguments.length?(r=g,d(),o.forEach(f),e):r},alpha:function(g){return arguments.length?(t=+g,e):t},alphaMin:function(g){return arguments.length?(n=+g,e):n},alphaDecay:function(g){return arguments.length?(i=+g,e):+i},alphaTarget:function(g){return arguments.length?(a=+g,e):a},velocityDecay:function(g){return arguments.length?(s=1-g,e):1-s},randomSource:function(g){return arguments.length?(c=g,o.forEach(f),e):c},force:function(g,v){return arguments.length>1?(v==null?o.delete(g):o.set(g,f(v)),e):o.get(g)},find:function(g,v,p){var y=0,m=r.length,B,C,S,F,T;for(p==null?p=1/0:p*=p,y=0;y<m;++y)F=r[y],B=g-F.x,C=v-F.y,S=B*B+C*C,S<p&&(T=F,p=S);return T},on:function(g,v){return arguments.length>1?(l.on(g,v),e):l.on(g)}}}function hY(){var r,e,t,n,i=Fn(-30),a,s=1,o=1/0,A=.81;function l(d){var f,g=r.length,v=xd(r,oY,AY).visitAfter(u);for(n=d,f=0;f<g;++f)e=r[f],v.visit(h)}function c(){if(r){var d,f=r.length,g;for(a=new Array(f),d=0;d<f;++d)g=r[d],a[g.index]=+i(g,d,r)}}function u(d){var f=0,g,v,p=0,y,m,B;if(d.length){for(y=m=B=0;B<4;++B)(g=d[B])&&(v=Math.abs(g.value))&&(f+=g.value,p+=v,y+=v*g.x,m+=v*g.y);d.x=y/p,d.y=m/p}else{g=d,g.x=g.data.x,g.y=g.data.y;do f+=a[g.data.index];while(g=g.next)}d.value=f}function h(d,f,g,v){if(!d.value)return!0;var p=d.x-e.x,y=d.y-e.y,m=v-f,B=p*p+y*y;if(m*m/A<B)return B<o&&(p===0&&(p=Ka(t),B+=p*p),y===0&&(y=Ka(t),B+=y*y),B<s&&(B=Math.sqrt(s*B)),e.vx+=p*d.value*n/B,e.vy+=y*d.value*n/B),!0;if(d.length||B>=o)return;(d.data!==e||d.next)&&(p===0&&(p=Ka(t),B+=p*p),y===0&&(y=Ka(t),B+=y*y),B<s&&(B=Math.sqrt(s*B)));do d.data!==e&&(m=a[d.data.index]*n/B,e.vx+=p*m,e.vy+=y*m);while(d=d.next)}return l.initialize=function(d,f){r=d,t=f,c()},l.strength=function(d){return arguments.length?(i=typeof d=="function"?d:Fn(+d),c(),l):i},l.distanceMin=function(d){return arguments.length?(s=d*d,l):Math.sqrt(s)},l.distanceMax=function(d){return arguments.length?(o=d*d,l):Math.sqrt(o)},l.theta=function(d){return arguments.length?(A=d*d,l):Math.sqrt(A)},l}function dY(r,e,t){var n,i=Fn(.1),a,s;typeof r!="function"&&(r=Fn(+r)),e==null&&(e=0),t==null&&(t=0);function o(l){for(var c=0,u=n.length;c<u;++c){var h=n[c],d=h.x-e||1e-6,f=h.y-t||1e-6,g=Math.sqrt(d*d+f*f),v=(s[c]-g)*a[c]*l/g;h.vx+=d*v,h.vy+=f*v}}function A(){if(n){var l,c=n.length;for(a=new Array(c),s=new Array(c),l=0;l<c;++l)s[l]=+r(n[l],l,n),a[l]=isNaN(s[l])?0:+i(n[l],l,n)}}return o.initialize=function(l){n=l,A()},o.strength=function(l){return arguments.length?(i=typeof l=="function"?l:Fn(+l),A(),o):i},o.radius=function(l){return arguments.length?(r=typeof l=="function"?l:Fn(+l),A(),o):r},o.x=function(l){return arguments.length?(e=+l,o):e},o.y=function(l){return arguments.length?(t=+l,o):t},o}function fY(r){var e=Fn(.1),t,n,i;typeof r!="function"&&(r=Fn(r==null?0:+r));function a(o){for(var A=0,l=t.length,c;A<l;++A)c=t[A],c.vx+=(i[A]-c.x)*n[A]*o}function s(){if(t){var o,A=t.length;for(n=new Array(A),i=new Array(A),o=0;o<A;++o)n[o]=isNaN(i[o]=+r(t[o],o,t))?0:+e(t[o],o,t)}}return a.initialize=function(o){t=o,s()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Fn(+o),s(),a):e},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:Fn(+o),s(),a):r},a}function gY(r){var e=Fn(.1),t,n,i;typeof r!="function"&&(r=Fn(r==null?0:+r));function a(o){for(var A=0,l=t.length,c;A<l;++A)c=t[A],c.vy+=(i[A]-c.y)*n[A]*o}function s(){if(t){var o,A=t.length;for(n=new Array(A),i=new Array(A),o=0;o<A;++o)n[o]=isNaN(i[o]=+r(t[o],o,t))?0:+e(t[o],o,t)}}return a.initialize=function(o){t=o,s()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Fn(+o),s(),a):e},a.y=function(o){return arguments.length?(r=typeof o=="function"?o:Fn(+o),s(),a):r},a}class vY{constructor(e){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:Y7,manyBody:hY,center:V7,collide:q7,radial:dY,x:fY,y:gY},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},zn(this.options,e),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericLayout(!0,e,t)})}stop(){this.simulation.stop()}tick(e){return this.simulation.tick(e),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(e,t){const n=this.context.nodes.find(i=>i.id===e);n&&t.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(e){var t,n;const i=zn({},this.options,e);return i.collide&&((t=i.collide)===null||t===void 0?void 0:t.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(e,t,n){var i;return Je(this,void 0,void 0,function*(){const a=this.getOptions(n),s=t.getAllNodes().map(({id:c,data:u})=>Object.assign(Object.assign({id:c},u),Ds(u.data,this.config.inputNodeAttrs))),o=t.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:e,nodes:s,edges:o,graph:t});const A=new Promise(c=>{this.resolver=c}),l=this.setSimulation(a);return l.nodes(s),(i=l.force("link"))===null||i===void 0||i.links(o),A})}getResult(){const{assign:e,nodes:t,edges:n,graph:i}=this.context,a=t.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),Ds(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:A,target:l,data:c})=>({id:o,source:typeof A=="object"?A.id:A,target:typeof l=="object"?l.id:l,data:c}));return e&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return uY()}setSimulation(e){const t=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=t.on("tick",()=>{var n;return(n=e.onTick)===null||n===void 0?void 0:n.call(e,this.getResult())}).on("end",()=>{var n;return(n=this.resolver)===null||n===void 0?void 0:n.call(this,this.getResult())})),xC(t,this.config.simulationAttrs.map(n=>[n,e[n]])),Object.entries(this.forceMap).forEach(([n,i])=>{const a=n;if(e[n]){let s=t.force(a);s||(s=i(),t.force(a,s)),xC(s,Object.entries(e[a]))}else t.force(a,null)}),t}}const xC=(r,e)=>e.reduce((t,[n,i])=>!t[n]||i===void 0?t:t[n].call(r,i),r);var _g,CC;function pY(){if(CC)return _g;CC=1;function r(){this.__data__=[],this.size=0}return _g=r,_g}var Ig,SC;function tA(){if(SC)return Ig;SC=1;function r(e,t){return e===t||e!==e&&t!==t}return Ig=r,Ig}var kg,FC;function Fd(){if(FC)return kg;FC=1;var r=tA();function e(t,n){for(var i=t.length;i--;)if(r(t[i][0],n))return i;return-1}return kg=e,kg}var Lg,TC;function yY(){if(TC)return Lg;TC=1;var r=Fd(),e=Array.prototype,t=e.splice;function n(i){var a=this.__data__,s=r(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():t.call(a,s,1),--this.size,!0}return Lg=n,Lg}var Qg,MC;function mY(){if(MC)return Qg;MC=1;var r=Fd();function e(t){var n=this.__data__,i=r(n,t);return i<0?void 0:n[i][1]}return Qg=e,Qg}var Ng,OC;function wY(){if(OC)return Ng;OC=1;var r=Fd();function e(t){return r(this.__data__,t)>-1}return Ng=e,Ng}var Ug,_C;function BY(){if(_C)return Ug;_C=1;var r=Fd();function e(t,n){var i=this.__data__,a=r(i,t);return a<0?(++this.size,i.push([t,n])):i[a][1]=n,this}return Ug=e,Ug}var Pg,IC;function Td(){if(IC)return Pg;IC=1;var r=pY(),e=yY(),t=mY(),n=wY(),i=BY();function a(s){var o=-1,A=s==null?0:s.length;for(this.clear();++o<A;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=r,a.prototype.delete=e,a.prototype.get=t,a.prototype.has=n,a.prototype.set=i,Pg=a,Pg}var Rg,kC;function bY(){if(kC)return Rg;kC=1;var r=Td();function e(){this.__data__=new r,this.size=0}return Rg=e,Rg}var Dg,LC;function EY(){if(LC)return Dg;LC=1;function r(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}return Dg=r,Dg}var Hg,QC;function xY(){if(QC)return Hg;QC=1;function r(e){return this.__data__.get(e)}return Hg=r,Hg}var Gg,NC;function CY(){if(NC)return Gg;NC=1;function r(e){return this.__data__.has(e)}return Gg=r,Gg}var Kg,UC;function FQ(){if(UC)return Kg;UC=1;var r=typeof nc=="object"&&nc&&nc.Object===Object&&nc;return Kg=r,Kg}var zg,PC;function Ci(){if(PC)return zg;PC=1;var r=FQ(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return zg=t,zg}var Vg,RC;function nA(){if(RC)return Vg;RC=1;var r=Ci(),e=r.Symbol;return Vg=e,Vg}var jg,DC;function SY(){if(DC)return jg;DC=1;var r=nA(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function a(s){var o=t.call(s,i),A=s[i];try{s[i]=void 0;var l=!0}catch{}var c=n.call(s);return l&&(o?s[i]=A:delete s[i]),c}return jg=a,jg}var Wg,HC;function FY(){if(HC)return Wg;HC=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Wg=t,Wg}var qg,GC;function no(){if(GC)return qg;GC=1;var r=nA(),e=SY(),t=FY(),n="[object Null]",i="[object Undefined]",a=r?r.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?e(o):t(o)}return qg=s,qg}var $g,KC;function si(){if(KC)return $g;KC=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return $g=r,$g}var Yg,zC;function Vl(){if(zC)return Yg;zC=1;var r=no(),e=si(),t="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!e(o))return!1;var A=r(o);return A==n||A==i||A==t||A==a}return Yg=s,Yg}var Xg,VC;function TY(){if(VC)return Xg;VC=1;var r=Ci(),e=r["__core-js_shared__"];return Xg=e,Xg}var Zg,jC;function MY(){if(jC)return Zg;jC=1;var r=TY(),e=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function t(n){return!!e&&e in n}return Zg=t,Zg}var Jg,WC;function TQ(){if(WC)return Jg;WC=1;var r=Function.prototype,e=r.toString;function t(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Jg=t,Jg}var ev,qC;function OY(){if(qC)return ev;qC=1;var r=Vl(),e=MY(),t=si(),n=TQ(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,A=s.toString,l=o.hasOwnProperty,c=RegExp("^"+A.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function u(h){if(!t(h)||e(h))return!1;var d=r(h)?c:a;return d.test(n(h))}return ev=u,ev}var tv,$C;function _Y(){if($C)return tv;$C=1;function r(e,t){return e==null?void 0:e[t]}return tv=r,tv}var nv,YC;function ro(){if(YC)return nv;YC=1;var r=OY(),e=_Y();function t(n,i){var a=e(n,i);return r(a)?a:void 0}return nv=t,nv}var rv,XC;function NB(){if(XC)return rv;XC=1;var r=ro(),e=Ci(),t=r(e,"Map");return rv=t,rv}var iv,ZC;function Md(){if(ZC)return iv;ZC=1;var r=ro(),e=r(Object,"create");return iv=e,iv}var av,JC;function IY(){if(JC)return av;JC=1;var r=Md();function e(){this.__data__=r?r(null):{},this.size=0}return av=e,av}var sv,e2;function kY(){if(e2)return sv;e2=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return sv=r,sv}var ov,t2;function LY(){if(t2)return ov;t2=1;var r=Md(),e="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function i(a){var s=this.__data__;if(r){var o=s[a];return o===e?void 0:o}return n.call(s,a)?s[a]:void 0}return ov=i,ov}var Av,n2;function QY(){if(n2)return Av;n2=1;var r=Md(),e=Object.prototype,t=e.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:t.call(a,i)}return Av=n,Av}var lv,r2;function NY(){if(r2)return lv;r2=1;var r=Md(),e="__lodash_hash_undefined__";function t(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=r&&i===void 0?e:i,this}return lv=t,lv}var cv,i2;function UY(){if(i2)return cv;i2=1;var r=IY(),e=kY(),t=LY(),n=QY(),i=NY();function a(s){var o=-1,A=s==null?0:s.length;for(this.clear();++o<A;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=r,a.prototype.delete=e,a.prototype.get=t,a.prototype.has=n,a.prototype.set=i,cv=a,cv}var uv,a2;function PY(){if(a2)return uv;a2=1;var r=UY(),e=Td(),t=NB();function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return uv=n,uv}var hv,s2;function RY(){if(s2)return hv;s2=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return hv=r,hv}var dv,o2;function Od(){if(o2)return dv;o2=1;var r=RY();function e(t,n){var i=t.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return dv=e,dv}var fv,A2;function DY(){if(A2)return fv;A2=1;var r=Od();function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}return fv=e,fv}var gv,l2;function HY(){if(l2)return gv;l2=1;var r=Od();function e(t){return r(this,t).get(t)}return gv=e,gv}var vv,c2;function GY(){if(c2)return vv;c2=1;var r=Od();function e(t){return r(this,t).has(t)}return vv=e,vv}var pv,u2;function KY(){if(u2)return pv;u2=1;var r=Od();function e(t,n){var i=r(this,t),a=i.size;return i.set(t,n),this.size+=i.size==a?0:1,this}return pv=e,pv}var yv,h2;function UB(){if(h2)return yv;h2=1;var r=PY(),e=DY(),t=HY(),n=GY(),i=KY();function a(s){var o=-1,A=s==null?0:s.length;for(this.clear();++o<A;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=r,a.prototype.delete=e,a.prototype.get=t,a.prototype.has=n,a.prototype.set=i,yv=a,yv}var mv,d2;function zY(){if(d2)return mv;d2=1;var r=Td(),e=NB(),t=UB(),n=200;function i(a,s){var o=this.__data__;if(o instanceof r){var A=o.__data__;if(!e||A.length<n-1)return A.push([a,s]),this.size=++o.size,this;o=this.__data__=new t(A)}return o.set(a,s),this.size=o.size,this}return mv=i,mv}var wv,f2;function _d(){if(f2)return wv;f2=1;var r=Td(),e=bY(),t=EY(),n=xY(),i=CY(),a=zY();function s(o){var A=this.__data__=new r(o);this.size=A.size}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=n,s.prototype.has=i,s.prototype.set=a,wv=s,wv}var Bv,g2;function PB(){if(g2)return Bv;g2=1;function r(e,t){for(var n=-1,i=e==null?0:e.length;++n<i&&t(e[n],n,e)!==!1;);return e}return Bv=r,Bv}var bv,v2;function MQ(){if(v2)return bv;v2=1;var r=ro(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}})();return bv=e,bv}var Ev,p2;function Id(){if(p2)return Ev;p2=1;var r=MQ();function e(t,n,i){n=="__proto__"&&r?r(t,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[n]=i}return Ev=e,Ev}var xv,y2;function kd(){if(y2)return xv;y2=1;var r=Id(),e=tA(),t=Object.prototype,n=t.hasOwnProperty;function i(a,s,o){var A=a[s];(!(n.call(a,s)&&e(A,o))||o===void 0&&!(s in a))&&r(a,s,o)}return xv=i,xv}var Cv,m2;function jl(){if(m2)return Cv;m2=1;var r=kd(),e=Id();function t(n,i,a,s){var o=!a;a||(a={});for(var A=-1,l=i.length;++A<l;){var c=i[A],u=s?s(a[c],n[c],c,a,n):void 0;u===void 0&&(u=n[c]),o?e(a,c,u):r(a,c,u)}return a}return Cv=t,Cv}var Sv,w2;function VY(){if(w2)return Sv;w2=1;function r(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}return Sv=r,Sv}var Fv,B2;function Zi(){if(B2)return Fv;B2=1;function r(e){return e!=null&&typeof e=="object"}return Fv=r,Fv}var Tv,b2;function jY(){if(b2)return Tv;b2=1;var r=no(),e=Zi(),t="[object Arguments]";function n(i){return e(i)&&r(i)==t}return Tv=n,Tv}var Mv,E2;function Wl(){if(E2)return Mv;E2=1;var r=jY(),e=Zi(),t=Object.prototype,n=t.hasOwnProperty,i=t.propertyIsEnumerable,a=r((function(){return arguments})())?r:function(s){return e(s)&&n.call(s,"callee")&&!i.call(s,"callee")};return Mv=a,Mv}var Ov,x2;function Bn(){if(x2)return Ov;x2=1;var r=Array.isArray;return Ov=r,Ov}var HA={exports:{}},_v,C2;function WY(){if(C2)return _v;C2=1;function r(){return!1}return _v=r,_v}HA.exports;var S2;function rA(){return S2||(S2=1,(function(r,e){var t=Ci(),n=WY(),i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,s=a&&a.exports===i,o=s?t.Buffer:void 0,A=o?o.isBuffer:void 0,l=A||n;r.exports=l})(HA,HA.exports)),HA.exports}var Iv,F2;function Ld(){if(F2)return Iv;F2=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(n,i){var a=typeof n;return i=i??r,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return Iv=t,Iv}var kv,T2;function RB(){if(T2)return kv;T2=1;var r=9007199254740991;function e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=r}return kv=e,kv}var Lv,M2;function qY(){if(M2)return Lv;M2=1;var r=no(),e=RB(),t=Zi(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",A="[object Function]",l="[object Map]",c="[object Number]",u="[object Object]",h="[object RegExp]",d="[object Set]",f="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",p="[object DataView]",y="[object Float32Array]",m="[object Float64Array]",B="[object Int8Array]",C="[object Int16Array]",S="[object Int32Array]",F="[object Uint8Array]",T="[object Uint8ClampedArray]",O="[object Uint16Array]",_="[object Uint32Array]",k={};k[y]=k[m]=k[B]=k[C]=k[S]=k[F]=k[T]=k[O]=k[_]=!0,k[n]=k[i]=k[v]=k[a]=k[p]=k[s]=k[o]=k[A]=k[l]=k[c]=k[u]=k[h]=k[d]=k[f]=k[g]=!1;function L(U){return t(U)&&e(U.length)&&!!k[r(U)]}return Lv=L,Lv}var Qv,O2;function Qd(){if(O2)return Qv;O2=1;function r(e){return function(t){return e(t)}}return Qv=r,Qv}var GA={exports:{}};GA.exports;var _2;function DB(){return _2||(_2=1,(function(r,e){var t=FQ(),n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a&&t.process,o=(function(){try{var A=i&&i.require&&i.require("util").types;return A||s&&s.binding&&s.binding("util")}catch{}})();r.exports=o})(GA,GA.exports)),GA.exports}var Nv,I2;function ql(){if(I2)return Nv;I2=1;var r=qY(),e=Qd(),t=DB(),n=t&&t.isTypedArray,i=n?e(n):r;return Nv=i,Nv}var Uv,k2;function OQ(){if(k2)return Uv;k2=1;var r=VY(),e=Wl(),t=Bn(),n=rA(),i=Ld(),a=ql(),s=Object.prototype,o=s.hasOwnProperty;function A(l,c){var u=t(l),h=!u&&e(l),d=!u&&!h&&n(l),f=!u&&!h&&!d&&a(l),g=u||h||d||f,v=g?r(l.length,String):[],p=v.length;for(var y in l)(c||o.call(l,y))&&!(g&&(y=="length"||d&&(y=="offset"||y=="parent")||f&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,p)))&&v.push(y);return v}return Uv=A,Uv}var Pv,L2;function Nd(){if(L2)return Pv;L2=1;var r=Object.prototype;function e(t){var n=t&&t.constructor,i=typeof n=="function"&&n.prototype||r;return t===i}return Pv=e,Pv}var Rv,Q2;function _Q(){if(Q2)return Rv;Q2=1;function r(e,t){return function(n){return e(t(n))}}return Rv=r,Rv}var Dv,N2;function $Y(){if(N2)return Dv;N2=1;var r=_Q(),e=r(Object.keys,Object);return Dv=e,Dv}var Hv,U2;function HB(){if(U2)return Hv;U2=1;var r=Nd(),e=$Y(),t=Object.prototype,n=t.hasOwnProperty;function i(a){if(!r(a))return e(a);var s=[];for(var o in Object(a))n.call(a,o)&&o!="constructor"&&s.push(o);return s}return Hv=i,Hv}var Gv,P2;function wa(){if(P2)return Gv;P2=1;var r=Vl(),e=RB();function t(n){return n!=null&&e(n.length)&&!r(n)}return Gv=t,Gv}var Kv,R2;function As(){if(R2)return Kv;R2=1;var r=OQ(),e=HB(),t=wa();function n(i){return t(i)?r(i):e(i)}return Kv=n,Kv}var zv,D2;function YY(){if(D2)return zv;D2=1;var r=jl(),e=As();function t(n,i){return n&&r(i,e(i),n)}return zv=t,zv}var Vv,H2;function XY(){if(H2)return Vv;H2=1;function r(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}return Vv=r,Vv}var jv,G2;function ZY(){if(G2)return jv;G2=1;var r=si(),e=Nd(),t=XY(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return t(s);var o=e(s),A=[];for(var l in s)l=="constructor"&&(o||!i.call(s,l))||A.push(l);return A}return jv=a,jv}var Wv,K2;function io(){if(K2)return Wv;K2=1;var r=OQ(),e=ZY(),t=wa();function n(i){return t(i)?r(i,!0):e(i)}return Wv=n,Wv}var qv,z2;function JY(){if(z2)return qv;z2=1;var r=jl(),e=io();function t(n,i){return n&&r(i,e(i),n)}return qv=t,qv}var KA={exports:{}};KA.exports;var V2;function IQ(){return V2||(V2=1,(function(r,e){var t=Ci(),n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a?t.Buffer:void 0,o=s?s.allocUnsafe:void 0;function A(l,c){if(c)return l.slice();var u=l.length,h=o?o(u):new l.constructor(u);return l.copy(h),h}r.exports=A})(KA,KA.exports)),KA.exports}var $v,j2;function kQ(){if(j2)return $v;j2=1;function r(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}return $v=r,$v}var Yv,W2;function LQ(){if(W2)return Yv;W2=1;function r(e,t){for(var n=-1,i=e==null?0:e.length,a=0,s=[];++n<i;){var o=e[n];t(o,n,e)&&(s[a++]=o)}return s}return Yv=r,Yv}var Xv,q2;function QQ(){if(q2)return Xv;q2=1;function r(){return[]}return Xv=r,Xv}var Zv,$2;function GB(){if($2)return Zv;$2=1;var r=LQ(),e=QQ(),t=Object.prototype,n=t.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),r(i(s),function(o){return n.call(s,o)}))}:e;return Zv=a,Zv}var Jv,Y2;function eX(){if(Y2)return Jv;Y2=1;var r=jl(),e=GB();function t(n,i){return r(n,e(n),i)}return Jv=t,Jv}var ep,X2;function KB(){if(X2)return ep;X2=1;function r(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}return ep=r,ep}var tp,Z2;function Ud(){if(Z2)return tp;Z2=1;var r=_Q(),e=r(Object.getPrototypeOf,Object);return tp=e,tp}var np,J2;function NQ(){if(J2)return np;J2=1;var r=KB(),e=Ud(),t=GB(),n=QQ(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var o=[];s;)r(o,t(s)),s=e(s);return o}:n;return np=a,np}var rp,eS;function tX(){if(eS)return rp;eS=1;var r=jl(),e=NQ();function t(n,i){return r(n,e(n),i)}return rp=t,rp}var ip,tS;function UQ(){if(tS)return ip;tS=1;var r=KB(),e=Bn();function t(n,i,a){var s=i(n);return e(n)?s:r(s,a(n))}return ip=t,ip}var ap,nS;function PQ(){if(nS)return ap;nS=1;var r=UQ(),e=GB(),t=As();function n(i){return r(i,t,e)}return ap=n,ap}var sp,rS;function nX(){if(rS)return sp;rS=1;var r=UQ(),e=NQ(),t=io();function n(i){return r(i,t,e)}return sp=n,sp}var op,iS;function rX(){if(iS)return op;iS=1;var r=ro(),e=Ci(),t=r(e,"DataView");return op=t,op}var Ap,aS;function iX(){if(aS)return Ap;aS=1;var r=ro(),e=Ci(),t=r(e,"Promise");return Ap=t,Ap}var lp,sS;function RQ(){if(sS)return lp;sS=1;var r=ro(),e=Ci(),t=r(e,"Set");return lp=t,lp}var cp,oS;function aX(){if(oS)return cp;oS=1;var r=ro(),e=Ci(),t=r(e,"WeakMap");return cp=t,cp}var up,AS;function iA(){if(AS)return up;AS=1;var r=rX(),e=NB(),t=iX(),n=RQ(),i=aX(),a=no(),s=TQ(),o="[object Map]",A="[object Object]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",h="[object DataView]",d=s(r),f=s(e),g=s(t),v=s(n),p=s(i),y=a;return(r&&y(new r(new ArrayBuffer(1)))!=h||e&&y(new e)!=o||t&&y(t.resolve())!=l||n&&y(new n)!=c||i&&y(new i)!=u)&&(y=function(m){var B=a(m),C=B==A?m.constructor:void 0,S=C?s(C):"";if(S)switch(S){case d:return h;case f:return o;case g:return l;case v:return c;case p:return u}return B}),up=y,up}var hp,lS;function sX(){if(lS)return hp;lS=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&e.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return hp=t,hp}var dp,cS;function DQ(){if(cS)return dp;cS=1;var r=Ci(),e=r.Uint8Array;return dp=e,dp}var fp,uS;function zB(){if(uS)return fp;uS=1;var r=DQ();function e(t){var n=new t.constructor(t.byteLength);return new r(n).set(new r(t)),n}return fp=e,fp}var gp,hS;function oX(){if(hS)return gp;hS=1;var r=zB();function e(t,n){var i=n?r(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}return gp=e,gp}var vp,dS;function AX(){if(dS)return vp;dS=1;var r=/\w*$/;function e(t){var n=new t.constructor(t.source,r.exec(t));return n.lastIndex=t.lastIndex,n}return vp=e,vp}var pp,fS;function lX(){if(fS)return pp;fS=1;var r=nA(),e=r?r.prototype:void 0,t=e?e.valueOf:void 0;function n(i){return t?Object(t.call(i)):{}}return pp=n,pp}var yp,gS;function HQ(){if(gS)return yp;gS=1;var r=zB();function e(t,n){var i=n?r(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}return yp=e,yp}var mp,vS;function cX(){if(vS)return mp;vS=1;var r=zB(),e=oX(),t=AX(),n=lX(),i=HQ(),a="[object Boolean]",s="[object Date]",o="[object Map]",A="[object Number]",l="[object RegExp]",c="[object Set]",u="[object String]",h="[object Symbol]",d="[object ArrayBuffer]",f="[object DataView]",g="[object Float32Array]",v="[object Float64Array]",p="[object Int8Array]",y="[object Int16Array]",m="[object Int32Array]",B="[object Uint8Array]",C="[object Uint8ClampedArray]",S="[object Uint16Array]",F="[object Uint32Array]";function T(O,_,k){var L=O.constructor;switch(_){case d:return r(O);case a:case s:return new L(+O);case f:return e(O,k);case g:case v:case p:case y:case m:case B:case C:case S:case F:return i(O,k);case o:return new L;case A:case u:return new L(O);case l:return t(O);case c:return new L;case h:return n(O)}}return mp=T,mp}var wp,pS;function GQ(){if(pS)return wp;pS=1;var r=si(),e=Object.create,t=(function(){function n(){}return function(i){if(!r(i))return{};if(e)return e(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}})();return wp=t,wp}var Bp,yS;function KQ(){if(yS)return Bp;yS=1;var r=GQ(),e=Ud(),t=Nd();function n(i){return typeof i.constructor=="function"&&!t(i)?r(e(i)):{}}return Bp=n,Bp}var bp,mS;function uX(){if(mS)return bp;mS=1;var r=iA(),e=Zi(),t="[object Map]";function n(i){return e(i)&&r(i)==t}return bp=n,bp}var Ep,wS;function hX(){if(wS)return Ep;wS=1;var r=uX(),e=Qd(),t=DB(),n=t&&t.isMap,i=n?e(n):r;return Ep=i,Ep}var xp,BS;function dX(){if(BS)return xp;BS=1;var r=iA(),e=Zi(),t="[object Set]";function n(i){return e(i)&&r(i)==t}return xp=n,xp}var Cp,bS;function fX(){if(bS)return Cp;bS=1;var r=dX(),e=Qd(),t=DB(),n=t&&t.isSet,i=n?e(n):r;return Cp=i,Cp}var Sp,ES;function zQ(){if(ES)return Sp;ES=1;var r=_d(),e=PB(),t=kd(),n=YY(),i=JY(),a=IQ(),s=kQ(),o=eX(),A=tX(),l=PQ(),c=nX(),u=iA(),h=sX(),d=cX(),f=KQ(),g=Bn(),v=rA(),p=hX(),y=si(),m=fX(),B=As(),C=io(),S=1,F=2,T=4,O="[object Arguments]",_="[object Array]",k="[object Boolean]",L="[object Date]",U="[object Error]",G="[object Function]",W="[object GeneratorFunction]",V="[object Map]",K="[object Number]",D="[object Object]",X="[object RegExp]",te="[object Set]",ie="[object String]",re="[object Symbol]",xe="[object WeakMap]",$="[object ArrayBuffer]",z="[object DataView]",ee="[object Float32Array]",Ae="[object Float64Array]",be="[object Int8Array]",Le="[object Int16Array]",Ue="[object Int32Array]",at="[object Uint8Array]",lt="[object Uint8ClampedArray]",ct="[object Uint16Array]",pt="[object Uint32Array]",Ne={};Ne[O]=Ne[_]=Ne[$]=Ne[z]=Ne[k]=Ne[L]=Ne[ee]=Ne[Ae]=Ne[be]=Ne[Le]=Ne[Ue]=Ne[V]=Ne[K]=Ne[D]=Ne[X]=Ne[te]=Ne[ie]=Ne[re]=Ne[at]=Ne[lt]=Ne[ct]=Ne[pt]=!0,Ne[U]=Ne[G]=Ne[xe]=!1;function ht(nt,gr,St,Ji,ir,Wt){var _t,Qn=gr&S,qn=gr&F,vr=gr&T;if(St&&(_t=ir?St(nt,Ji,ir,Wt):St(nt)),_t!==void 0)return _t;if(!y(nt))return nt;var ar=g(nt);if(ar){if(_t=h(nt),!Qn)return s(nt,_t)}else{var $n=u(nt),rn=$n==G||$n==W;if(v(nt))return a(nt,Qn);if($n==D||$n==O||rn&&!ir){if(_t=qn||rn?{}:f(nt),!Qn)return qn?A(nt,i(_t,nt)):o(nt,n(_t,nt))}else{if(!Ne[$n])return ir?nt:{};_t=d(nt,$n,Qn)}}Wt||(Wt=new r);var an=Wt.get(nt);if(an)return an;Wt.set(nt,_t),m(nt)?nt.forEach(function(Or){_t.add(ht(Or,gr,St,Or,nt,Wt))}):p(nt)&&nt.forEach(function(Or,Vr){_t.set(Vr,ht(Or,gr,St,Vr,nt,Wt))});var cA=vr?qn?c:l:qn?C:B,cs=ar?void 0:cA(nt);return e(cs||nt,function(Or,Vr){cs&&(Vr=Or,Or=nt[Vr]),t(_t,Vr,ht(Or,gr,St,Vr,nt,Wt))}),_t}return Sp=ht,Sp}var Fp,xS;function gX(){if(xS)return Fp;xS=1;var r=zQ(),e=4;function t(n){return r(n,e)}return Fp=t,Fp}var Tp,CS;function VB(){if(CS)return Tp;CS=1;function r(e){return function(){return e}}return Tp=r,Tp}var Mp,SS;function vX(){if(SS)return Mp;SS=1;function r(e){return function(t,n,i){for(var a=-1,s=Object(t),o=i(t),A=o.length;A--;){var l=o[e?A:++a];if(n(s[l],l,s)===!1)break}return t}}return Mp=r,Mp}var Op,FS;function jB(){if(FS)return Op;FS=1;var r=vX(),e=r();return Op=e,Op}var _p,TS;function WB(){if(TS)return _p;TS=1;var r=jB(),e=As();function t(n,i){return n&&r(n,i,e)}return _p=t,_p}var Ip,MS;function pX(){if(MS)return Ip;MS=1;var r=wa();function e(t,n){return function(i,a){if(i==null)return i;if(!r(i))return t(i,a);for(var s=i.length,o=n?s:-1,A=Object(i);(n?o--:++o<s)&&a(A[o],o,A)!==!1;);return i}}return Ip=e,Ip}var kp,OS;function Pd(){if(OS)return kp;OS=1;var r=WB(),e=pX(),t=e(r);return kp=t,kp}var Lp,_S;function ao(){if(_S)return Lp;_S=1;function r(e){return e}return Lp=r,Lp}var Qp,IS;function VQ(){if(IS)return Qp;IS=1;var r=ao();function e(t){return typeof t=="function"?t:r}return Qp=e,Qp}var Np,kS;function jQ(){if(kS)return Np;kS=1;var r=PB(),e=Pd(),t=VQ(),n=Bn();function i(a,s){var o=n(a)?r:e;return o(a,t(s))}return Np=i,Np}var Up,LS;function WQ(){return LS||(LS=1,Up=jQ()),Up}var Pp,QS;function yX(){if(QS)return Pp;QS=1;var r=Pd();function e(t,n){var i=[];return r(t,function(a,s,o){n(a,s,o)&&i.push(a)}),i}return Pp=e,Pp}var Rp,NS;function mX(){if(NS)return Rp;NS=1;var r="__lodash_hash_undefined__";function e(t){return this.__data__.set(t,r),this}return Rp=e,Rp}var Dp,US;function wX(){if(US)return Dp;US=1;function r(e){return this.__data__.has(e)}return Dp=r,Dp}var Hp,PS;function qQ(){if(PS)return Hp;PS=1;var r=UB(),e=mX(),t=wX();function n(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new r;++a<s;)this.add(i[a])}return n.prototype.add=n.prototype.push=e,n.prototype.has=t,Hp=n,Hp}var Gp,RS;function BX(){if(RS)return Gp;RS=1;function r(e,t){for(var n=-1,i=e==null?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}return Gp=r,Gp}var Kp,DS;function $Q(){if(DS)return Kp;DS=1;function r(e,t){return e.has(t)}return Kp=r,Kp}var zp,HS;function YQ(){if(HS)return zp;HS=1;var r=qQ(),e=BX(),t=$Q(),n=1,i=2;function a(s,o,A,l,c,u){var h=A&n,d=s.length,f=o.length;if(d!=f&&!(h&&f>d))return!1;var g=u.get(s),v=u.get(o);if(g&&v)return g==o&&v==s;var p=-1,y=!0,m=A&i?new r:void 0;for(u.set(s,o),u.set(o,s);++p<d;){var B=s[p],C=o[p];if(l)var S=h?l(C,B,p,o,s,u):l(B,C,p,s,o,u);if(S!==void 0){if(S)continue;y=!1;break}if(m){if(!e(o,function(F,T){if(!t(m,T)&&(B===F||c(B,F,A,l,u)))return m.push(T)})){y=!1;break}}else if(!(B===C||c(B,C,A,l,u))){y=!1;break}}return u.delete(s),u.delete(o),y}return zp=a,zp}var Vp,GS;function bX(){if(GS)return Vp;GS=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(i,a){n[++t]=[a,i]}),n}return Vp=r,Vp}var jp,KS;function qB(){if(KS)return jp;KS=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}return jp=r,jp}var Wp,zS;function EX(){if(zS)return Wp;zS=1;var r=nA(),e=DQ(),t=tA(),n=YQ(),i=bX(),a=qB(),s=1,o=2,A="[object Boolean]",l="[object Date]",c="[object Error]",u="[object Map]",h="[object Number]",d="[object RegExp]",f="[object Set]",g="[object String]",v="[object Symbol]",p="[object ArrayBuffer]",y="[object DataView]",m=r?r.prototype:void 0,B=m?m.valueOf:void 0;function C(S,F,T,O,_,k,L){switch(T){case y:if(S.byteLength!=F.byteLength||S.byteOffset!=F.byteOffset)return!1;S=S.buffer,F=F.buffer;case p:return!(S.byteLength!=F.byteLength||!k(new e(S),new e(F)));case A:case l:case h:return t(+S,+F);case c:return S.name==F.name&&S.message==F.message;case d:case g:return S==F+"";case u:var U=i;case f:var G=O&s;if(U||(U=a),S.size!=F.size&&!G)return!1;var W=L.get(S);if(W)return W==F;O|=o,L.set(S,F);var V=n(U(S),U(F),O,_,k,L);return L.delete(S),V;case v:if(B)return B.call(S)==B.call(F)}return!1}return Wp=C,Wp}var qp,VS;function xX(){if(VS)return qp;VS=1;var r=PQ(),e=1,t=Object.prototype,n=t.hasOwnProperty;function i(a,s,o,A,l,c){var u=o&e,h=r(a),d=h.length,f=r(s),g=f.length;if(d!=g&&!u)return!1;for(var v=d;v--;){var p=h[v];if(!(u?p in s:n.call(s,p)))return!1}var y=c.get(a),m=c.get(s);if(y&&m)return y==s&&m==a;var B=!0;c.set(a,s),c.set(s,a);for(var C=u;++v<d;){p=h[v];var S=a[p],F=s[p];if(A)var T=u?A(F,S,p,s,a,c):A(S,F,p,a,s,c);if(!(T===void 0?S===F||l(S,F,o,A,c):T)){B=!1;break}C||(C=p=="constructor")}if(B&&!C){var O=a.constructor,_=s.constructor;O!=_&&"constructor"in a&&"constructor"in s&&!(typeof O=="function"&&O instanceof O&&typeof _=="function"&&_ instanceof _)&&(B=!1)}return c.delete(a),c.delete(s),B}return qp=i,qp}var $p,jS;function CX(){if(jS)return $p;jS=1;var r=_d(),e=YQ(),t=EX(),n=xX(),i=iA(),a=Bn(),s=rA(),o=ql(),A=1,l="[object Arguments]",c="[object Array]",u="[object Object]",h=Object.prototype,d=h.hasOwnProperty;function f(g,v,p,y,m,B){var C=a(g),S=a(v),F=C?c:i(g),T=S?c:i(v);F=F==l?u:F,T=T==l?u:T;var O=F==u,_=T==u,k=F==T;if(k&&s(g)){if(!s(v))return!1;C=!0,O=!1}if(k&&!O)return B||(B=new r),C||o(g)?e(g,v,p,y,m,B):t(g,v,F,p,y,m,B);if(!(p&A)){var L=O&&d.call(g,"__wrapped__"),U=_&&d.call(v,"__wrapped__");if(L||U){var G=L?g.value():g,W=U?v.value():v;return B||(B=new r),m(G,W,p,y,B)}}return k?(B||(B=new r),n(g,v,p,y,m,B)):!1}return $p=f,$p}var Yp,WS;function XQ(){if(WS)return Yp;WS=1;var r=CX(),e=Zi();function t(n,i,a,s,o){return n===i?!0:n==null||i==null||!e(n)&&!e(i)?n!==n&&i!==i:r(n,i,a,s,t,o)}return Yp=t,Yp}var Xp,qS;function SX(){if(qS)return Xp;qS=1;var r=_d(),e=XQ(),t=1,n=2;function i(a,s,o,A){var l=o.length,c=l,u=!A;if(a==null)return!c;for(a=Object(a);l--;){var h=o[l];if(u&&h[2]?h[1]!==a[h[0]]:!(h[0]in a))return!1}for(;++l<c;){h=o[l];var d=h[0],f=a[d],g=h[1];if(u&&h[2]){if(f===void 0&&!(d in a))return!1}else{var v=new r;if(A)var p=A(f,g,d,a,s,v);if(!(p===void 0?e(g,f,t|n,A,v):p))return!1}}return!0}return Xp=i,Xp}var Zp,$S;function ZQ(){if($S)return Zp;$S=1;var r=si();function e(t){return t===t&&!r(t)}return Zp=e,Zp}var Jp,YS;function FX(){if(YS)return Jp;YS=1;var r=ZQ(),e=As();function t(n){for(var i=e(n),a=i.length;a--;){var s=i[a],o=n[s];i[a]=[s,o,r(o)]}return i}return Jp=t,Jp}var e0,XS;function JQ(){if(XS)return e0;XS=1;function r(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}return e0=r,e0}var t0,ZS;function TX(){if(ZS)return t0;ZS=1;var r=SX(),e=FX(),t=JQ();function n(i){var a=e(i);return a.length==1&&a[0][2]?t(a[0][0],a[0][1]):function(s){return s===i||r(s,i,a)}}return t0=n,t0}var n0,JS;function aA(){if(JS)return n0;JS=1;var r=no(),e=Zi(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return n0=n,n0}var r0,eF;function $B(){if(eF)return r0;eF=1;var r=Bn(),e=aA(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(r(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||e(a)?!0:n.test(a)||!t.test(a)||s!=null&&a in Object(s)}return r0=i,r0}var i0,tF;function MX(){if(tF)return i0;tF=1;var r=UB(),e="Expected a function";function t(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],A=a.cache;if(A.has(o))return A.get(o);var l=n.apply(this,s);return a.cache=A.set(o,l)||A,l};return a.cache=new(t.Cache||r),a}return t.Cache=r,i0=t,i0}var a0,nF;function OX(){if(nF)return a0;nF=1;var r=MX(),e=500;function t(n){var i=r(n,function(s){return a.size===e&&a.clear(),s}),a=i.cache;return i}return a0=t,a0}var s0,rF;function _X(){if(rF)return s0;rF=1;var r=OX(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(s,o,A,l){a.push(A?l.replace(t,"$1"):o||s)}),a});return s0=n,s0}var o0,iF;function Rd(){if(iF)return o0;iF=1;function r(e,t){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=t(e[n],n,e);return a}return o0=r,o0}var A0,aF;function IX(){if(aF)return A0;aF=1;var r=nA(),e=Rd(),t=Bn(),n=aA(),i=r?r.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(t(o))return e(o,s)+"";if(n(o))return a?a.call(o):"";var A=o+"";return A=="0"&&1/o==-1/0?"-0":A}return A0=s,A0}var l0,sF;function eN(){if(sF)return l0;sF=1;var r=IX();function e(t){return t==null?"":r(t)}return l0=e,l0}var c0,oF;function Dd(){if(oF)return c0;oF=1;var r=Bn(),e=$B(),t=_X(),n=eN();function i(a,s){return r(a)?a:e(a,s)?[a]:t(n(a))}return c0=i,c0}var u0,AF;function $l(){if(AF)return u0;AF=1;var r=aA();function e(t){if(typeof t=="string"||r(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return u0=e,u0}var h0,lF;function Hd(){if(lF)return h0;lF=1;var r=Dd(),e=$l();function t(n,i){i=r(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[e(i[a++])];return a&&a==s?n:void 0}return h0=t,h0}var d0,cF;function kX(){if(cF)return d0;cF=1;var r=Hd();function e(t,n,i){var a=t==null?void 0:r(t,n);return a===void 0?i:a}return d0=e,d0}var f0,uF;function LX(){if(uF)return f0;uF=1;function r(e,t){return e!=null&&t in Object(e)}return f0=r,f0}var g0,hF;function tN(){if(hF)return g0;hF=1;var r=Dd(),e=Wl(),t=Bn(),n=Ld(),i=RB(),a=$l();function s(o,A,l){A=r(A,o);for(var c=-1,u=A.length,h=!1;++c<u;){var d=a(A[c]);if(!(h=o!=null&&l(o,d)))break;o=o[d]}return h||++c!=u?h:(u=o==null?0:o.length,!!u&&i(u)&&n(d,u)&&(t(o)||e(o)))}return g0=s,g0}var v0,dF;function nN(){if(dF)return v0;dF=1;var r=LX(),e=tN();function t(n,i){return n!=null&&e(n,i,r)}return v0=t,v0}var p0,fF;function QX(){if(fF)return p0;fF=1;var r=XQ(),e=kX(),t=nN(),n=$B(),i=ZQ(),a=JQ(),s=$l(),o=1,A=2;function l(c,u){return n(c)&&i(u)?a(s(c),u):function(h){var d=e(h,c);return d===void 0&&d===u?t(h,c):r(u,d,o|A)}}return p0=l,p0}var y0,gF;function rN(){if(gF)return y0;gF=1;function r(e){return function(t){return t==null?void 0:t[e]}}return y0=r,y0}var m0,vF;function NX(){if(vF)return m0;vF=1;var r=Hd();function e(t){return function(n){return r(n,t)}}return m0=e,m0}var w0,pF;function UX(){if(pF)return w0;pF=1;var r=rN(),e=NX(),t=$B(),n=$l();function i(a){return t(a)?r(n(a)):e(a)}return w0=i,w0}var B0,yF;function Ba(){if(yF)return B0;yF=1;var r=TX(),e=QX(),t=ao(),n=Bn(),i=UX();function a(s){return typeof s=="function"?s:s==null?t:typeof s=="object"?n(s)?e(s[0],s[1]):r(s):i(s)}return B0=a,B0}var b0,mF;function iN(){if(mF)return b0;mF=1;var r=LQ(),e=yX(),t=Ba(),n=Bn();function i(a,s){var o=n(a)?r:e;return o(a,t(s,3))}return b0=i,b0}var E0,wF;function PX(){if(wF)return E0;wF=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n,i){return n!=null&&e.call(n,i)}return E0=t,E0}var x0,BF;function aN(){if(BF)return x0;BF=1;var r=PX(),e=tN();function t(n,i){return n!=null&&e(n,i,r)}return x0=t,x0}var C0,bF;function RX(){if(bF)return C0;bF=1;var r=HB(),e=iA(),t=Wl(),n=Bn(),i=wa(),a=rA(),s=Nd(),o=ql(),A="[object Map]",l="[object Set]",c=Object.prototype,u=c.hasOwnProperty;function h(d){if(d==null)return!0;if(i(d)&&(n(d)||typeof d=="string"||typeof d.splice=="function"||a(d)||o(d)||t(d)))return!d.length;var f=e(d);if(f==A||f==l)return!d.size;if(s(d))return!r(d).length;for(var g in d)if(u.call(d,g))return!1;return!0}return C0=h,C0}var S0,EF;function sN(){if(EF)return S0;EF=1;function r(e){return e===void 0}return S0=r,S0}var F0,xF;function oN(){if(xF)return F0;xF=1;var r=Pd(),e=wa();function t(n,i){var a=-1,s=e(n)?Array(n.length):[];return r(n,function(o,A,l){s[++a]=i(o,A,l)}),s}return F0=t,F0}var T0,CF;function AN(){if(CF)return T0;CF=1;var r=Rd(),e=Ba(),t=oN(),n=Bn();function i(a,s){var o=n(a)?r:t;return o(a,e(s,3))}return T0=i,T0}var M0,SF;function DX(){if(SF)return M0;SF=1;function r(e,t,n,i){var a=-1,s=e==null?0:e.length;for(i&&s&&(n=e[++a]);++a<s;)n=t(n,e[a],a,e);return n}return M0=r,M0}var O0,FF;function HX(){if(FF)return O0;FF=1;function r(e,t,n,i,a){return a(e,function(s,o,A){n=i?(i=!1,s):t(n,s,o,A)}),n}return O0=r,O0}var _0,TF;function lN(){if(TF)return _0;TF=1;var r=DX(),e=Pd(),t=Ba(),n=HX(),i=Bn();function a(s,o,A){var l=i(s)?r:n,c=arguments.length<3;return l(s,t(o,4),A,c,e)}return _0=a,_0}var I0,MF;function GX(){if(MF)return I0;MF=1;var r=no(),e=Bn(),t=Zi(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&t(a)&&r(a)==n}return I0=i,I0}var k0,OF;function KX(){if(OF)return k0;OF=1;var r=rN(),e=r("length");return k0=e,k0}var L0,_F;function zX(){if(_F)return L0;_F=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+t+n,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+r+i+a+"]");function A(l){return o.test(l)}return L0=A,L0}var Q0,IF;function VX(){if(IF)return Q0;IF=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+t+n,a="\\ufe0e\\ufe0f",s="["+r+"]",o="["+i+"]",A="\\ud83c[\\udffb-\\udfff]",l="(?:"+o+"|"+A+")",c="[^"+r+"]",u="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",f=l+"?",g="["+a+"]?",v="(?:"+d+"(?:"+[c,u,h].join("|")+")"+g+f+")*",p=g+f+v,y="(?:"+[c+o+"?",o,u,h,s].join("|")+")",m=RegExp(A+"(?="+A+")|"+y+p,"g");function B(C){for(var S=m.lastIndex=0;m.test(C);)++S;return S}return Q0=B,Q0}var N0,kF;function jX(){if(kF)return N0;kF=1;var r=KX(),e=zX(),t=VX();function n(i){return e(i)?t(i):r(i)}return N0=n,N0}var U0,LF;function WX(){if(LF)return U0;LF=1;var r=HB(),e=iA(),t=wa(),n=GX(),i=jX(),a="[object Map]",s="[object Set]";function o(A){if(A==null)return 0;if(t(A))return n(A)?i(A):A.length;var l=e(A);return l==a||l==s?A.size:r(A).length}return U0=o,U0}var P0,QF;function qX(){if(QF)return P0;QF=1;var r=PB(),e=GQ(),t=WB(),n=Ba(),i=Ud(),a=Bn(),s=rA(),o=Vl(),A=si(),l=ql();function c(u,h,d){var f=a(u),g=f||s(u)||l(u);if(h=n(h,4),d==null){var v=u&&u.constructor;g?d=f?new v:[]:A(u)?d=o(v)?e(i(u)):{}:d={}}return(g?r:t)(u,function(p,y,m){return h(d,p,y,m)}),d}return P0=c,P0}var R0,NF;function $X(){if(NF)return R0;NF=1;var r=nA(),e=Wl(),t=Bn(),n=r?r.isConcatSpreadable:void 0;function i(a){return t(a)||e(a)||!!(n&&a&&a[n])}return R0=i,R0}var D0,UF;function YB(){if(UF)return D0;UF=1;var r=KB(),e=$X();function t(n,i,a,s,o){var A=-1,l=n.length;for(a||(a=e),o||(o=[]);++A<l;){var c=n[A];i>0&&a(c)?i>1?t(c,i-1,a,s,o):r(o,c):s||(o[o.length]=c)}return o}return D0=t,D0}var H0,PF;function YX(){if(PF)return H0;PF=1;function r(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}return H0=r,H0}var G0,RF;function cN(){if(RF)return G0;RF=1;var r=YX(),e=Math.max;function t(n,i,a){return i=e(i===void 0?n.length-1:i,0),function(){for(var s=arguments,o=-1,A=e(s.length-i,0),l=Array(A);++o<A;)l[o]=s[i+o];o=-1;for(var c=Array(i+1);++o<i;)c[o]=s[o];return c[i]=a(l),r(n,this,c)}}return G0=t,G0}var K0,DF;function XX(){if(DF)return K0;DF=1;var r=VB(),e=MQ(),t=ao(),n=e?function(i,a){return e(i,"toString",{configurable:!0,enumerable:!1,value:r(a),writable:!0})}:t;return K0=n,K0}var z0,HF;function ZX(){if(HF)return z0;HF=1;var r=800,e=16,t=Date.now;function n(i){var a=0,s=0;return function(){var o=t(),A=e-(o-s);if(s=o,A>0){if(++a>=r)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return z0=n,z0}var V0,GF;function uN(){if(GF)return V0;GF=1;var r=XX(),e=ZX(),t=e(r);return V0=t,V0}var j0,KF;function Gd(){if(KF)return j0;KF=1;var r=ao(),e=cN(),t=uN();function n(i,a){return t(e(i,a,r),i+"")}return j0=n,j0}var W0,zF;function hN(){if(zF)return W0;zF=1;function r(e,t,n,i){for(var a=e.length,s=n+(i?1:-1);i?s--:++s<a;)if(t(e[s],s,e))return s;return-1}return W0=r,W0}var q0,VF;function JX(){if(VF)return q0;VF=1;function r(e){return e!==e}return q0=r,q0}var $0,jF;function eZ(){if(jF)return $0;jF=1;function r(e,t,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===t)return i;return-1}return $0=r,$0}var Y0,WF;function tZ(){if(WF)return Y0;WF=1;var r=hN(),e=JX(),t=eZ();function n(i,a,s){return a===a?t(i,a,s):r(i,e,s)}return Y0=n,Y0}var X0,qF;function nZ(){if(qF)return X0;qF=1;var r=tZ();function e(t,n){var i=t==null?0:t.length;return!!i&&r(t,n,0)>-1}return X0=e,X0}var Z0,$F;function rZ(){if($F)return Z0;$F=1;function r(e,t,n){for(var i=-1,a=e==null?0:e.length;++i<a;)if(n(t,e[i]))return!0;return!1}return Z0=r,Z0}var J0,YF;function iZ(){if(YF)return J0;YF=1;function r(){}return J0=r,J0}var ey,XF;function aZ(){if(XF)return ey;XF=1;var r=RQ(),e=iZ(),t=qB(),n=1/0,i=r&&1/t(new r([,-0]))[1]==n?function(a){return new r(a)}:e;return ey=i,ey}var ty,ZF;function sZ(){if(ZF)return ty;ZF=1;var r=qQ(),e=nZ(),t=rZ(),n=$Q(),i=aZ(),a=qB(),s=200;function o(A,l,c){var u=-1,h=e,d=A.length,f=!0,g=[],v=g;if(c)f=!1,h=t;else if(d>=s){var p=l?null:i(A);if(p)return a(p);f=!1,h=n,v=new r}else v=l?[]:g;e:for(;++u<d;){var y=A[u],m=l?l(y):y;if(y=c||y!==0?y:0,f&&m===m){for(var B=v.length;B--;)if(v[B]===m)continue e;l&&v.push(m),g.push(y)}else h(v,m,c)||(v!==g&&v.push(m),g.push(y))}return g}return ty=o,ty}var ny,JF;function dN(){if(JF)return ny;JF=1;var r=wa(),e=Zi();function t(n){return e(n)&&r(n)}return ny=t,ny}var ry,eT;function oZ(){if(eT)return ry;eT=1;var r=YB(),e=Gd(),t=sZ(),n=dN(),i=e(function(a){return t(r(a,1,n,!0))});return ry=i,ry}var iy,tT;function AZ(){if(tT)return iy;tT=1;var r=Rd();function e(t,n){return r(n,function(i){return t[i]})}return iy=e,iy}var ay,nT;function fN(){if(nT)return ay;nT=1;var r=AZ(),e=As();function t(n){return n==null?[]:r(n,e(n))}return ay=t,ay}var sy,rT;function oi(){if(rT)return sy;rT=1;var r;if(typeof H1=="function")try{r={clone:gX(),constant:VB(),each:WQ(),filter:iN(),has:aN(),isArray:Bn(),isEmpty:RX(),isFunction:Vl(),isUndefined:sN(),keys:As(),map:AN(),reduce:lN(),size:WX(),transform:qX(),union:oZ(),values:fN()}}catch{}return r||(r=window._),sy=r,sy}var oy,iT;function XB(){if(iT)return oy;iT=1;var r=oi();oy=i;var e="\0",t="\0",n="";function i(c){this._isDirected=r.has(c,"directed")?c.directed:!0,this._isMultigraph=r.has(c,"multigraph")?c.multigraph:!1,this._isCompound=r.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var c=this;return r.filter(this.nodes(),function(u){return r.isEmpty(c._in[u])})},i.prototype.sinks=function(){var c=this;return r.filter(this.nodes(),function(u){return r.isEmpty(c._out[u])})},i.prototype.setNodes=function(c,u){var h=arguments,d=this;return r.each(c,function(f){h.length>1?d.setNode(f,u):d.setNode(f)}),this},i.prototype.setNode=function(c,u){return r.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=u),this):(this._nodes[c]=arguments.length>1?u:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=t,this._children[c]={},this._children[t][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return r.has(this._nodes,c)},i.prototype.removeNode=function(c){var u=this;if(r.has(this._nodes,c)){var h=function(d){u.removeEdge(u._edgeObjs[d])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],r.each(this.children(c),function(d){u.setParent(d)}),delete this._children[c]),r.each(r.keys(this._in[c]),h),delete this._in[c],delete this._preds[c],r.each(r.keys(this._out[c]),h),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,u){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(u))u=t;else{u+="";for(var h=u;!r.isUndefined(h);h=this.parent(h))if(h===c)throw new Error("Setting "+u+" as parent of "+c+" would create a cycle");this.setNode(u)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=u,this._children[u][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var u=this._parent[c];if(u!==t)return u}},i.prototype.children=function(c){if(r.isUndefined(c)&&(c=t),this._isCompound){var u=this._children[c];if(u)return r.keys(u)}else{if(c===t)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var u=this._preds[c];if(u)return r.keys(u)},i.prototype.successors=function(c){var u=this._sucs[c];if(u)return r.keys(u)},i.prototype.neighbors=function(c){var u=this.predecessors(c);if(u)return r.union(u,this.successors(c))},i.prototype.isLeaf=function(c){var u;return this.isDirected()?u=this.successors(c):u=this.neighbors(c),u.length===0},i.prototype.filterNodes=function(c){var u=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});u.setGraph(this.graph());var h=this;r.each(this._nodes,function(g,v){c(v)&&u.setNode(v,g)}),r.each(this._edgeObjs,function(g){u.hasNode(g.v)&&u.hasNode(g.w)&&u.setEdge(g,h.edge(g))});var d={};function f(g){var v=h.parent(g);return v===void 0||u.hasNode(v)?(d[g]=v,v):v in d?d[v]:f(v)}return this._isCompound&&r.each(u.nodes(),function(g){u.setParent(g,f(g))}),u},i.prototype.setDefaultEdgeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(c,u){var h=this,d=arguments;return r.reduce(c,function(f,g){return d.length>1?h.setEdge(f,g,u):h.setEdge(f,g),g}),this},i.prototype.setEdge=function(){var c,u,h,d,f=!1,g=arguments[0];typeof g=="object"&&g!==null&&"v"in g?(c=g.v,u=g.w,h=g.name,arguments.length===2&&(d=arguments[1],f=!0)):(c=g,u=arguments[1],h=arguments[3],arguments.length>2&&(d=arguments[2],f=!0)),c=""+c,u=""+u,r.isUndefined(h)||(h=""+h);var v=o(this._isDirected,c,u,h);if(r.has(this._edgeLabels,v))return f&&(this._edgeLabels[v]=d),this;if(!r.isUndefined(h)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(u),this._edgeLabels[v]=f?d:this._defaultEdgeLabelFn(c,u,h);var p=A(this._isDirected,c,u,h);return c=p.v,u=p.w,Object.freeze(p),this._edgeObjs[v]=p,a(this._preds[u],c),a(this._sucs[c],u),this._in[u][v]=p,this._out[c][v]=p,this._edgeCount++,this},i.prototype.edge=function(c,u,h){var d=arguments.length===1?l(this._isDirected,arguments[0]):o(this._isDirected,c,u,h);return this._edgeLabels[d]},i.prototype.hasEdge=function(c,u,h){var d=arguments.length===1?l(this._isDirected,arguments[0]):o(this._isDirected,c,u,h);return r.has(this._edgeLabels,d)},i.prototype.removeEdge=function(c,u,h){var d=arguments.length===1?l(this._isDirected,arguments[0]):o(this._isDirected,c,u,h),f=this._edgeObjs[d];return f&&(c=f.v,u=f.w,delete this._edgeLabels[d],delete this._edgeObjs[d],s(this._preds[u],c),s(this._sucs[c],u),delete this._in[u][d],delete this._out[c][d],this._edgeCount--),this},i.prototype.inEdges=function(c,u){var h=this._in[c];if(h){var d=r.values(h);return u?r.filter(d,function(f){return f.v===u}):d}},i.prototype.outEdges=function(c,u){var h=this._out[c];if(h){var d=r.values(h);return u?r.filter(d,function(f){return f.w===u}):d}},i.prototype.nodeEdges=function(c,u){var h=this.inEdges(c,u);if(h)return h.concat(this.outEdges(c,u))};function a(c,u){c[u]?c[u]++:c[u]=1}function s(c,u){--c[u]||delete c[u]}function o(c,u,h,d){var f=""+u,g=""+h;if(!c&&f>g){var v=f;f=g,g=v}return f+n+g+n+(r.isUndefined(d)?e:d)}function A(c,u,h,d){var f=""+u,g=""+h;if(!c&&f>g){var v=f;f=g,g=v}var p={v:f,w:g};return d&&(p.name=d),p}function l(c,u){return o(c,u.v,u.w,u.name)}return oy}var Ay,aT;function lZ(){return aT||(aT=1,Ay="2.1.8"),Ay}var ly,sT;function cZ(){return sT||(sT=1,ly={Graph:XB(),version:lZ()}),ly}var cy,oT;function uZ(){if(oT)return cy;oT=1;var r=oi(),e=XB();cy={write:t,read:a};function t(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return r.isUndefined(s.graph())||(o.value=r.clone(s.graph())),o}function n(s){return r.map(s.nodes(),function(o){var A=s.node(o),l=s.parent(o),c={v:o};return r.isUndefined(A)||(c.value=A),r.isUndefined(l)||(c.parent=l),c})}function i(s){return r.map(s.edges(),function(o){var A=s.edge(o),l={v:o.v,w:o.w};return r.isUndefined(o.name)||(l.name=o.name),r.isUndefined(A)||(l.value=A),l})}function a(s){var o=new e(s.options).setGraph(s.value);return r.each(s.nodes,function(A){o.setNode(A.v,A.value),A.parent&&o.setParent(A.v,A.parent)}),r.each(s.edges,function(A){o.setEdge({v:A.v,w:A.w,name:A.name},A.value)}),o}return cy}var uy,AT;function hZ(){if(AT)return uy;AT=1;var r=oi();uy=e;function e(t){var n={},i=[],a;function s(o){r.has(n,o)||(n[o]=!0,a.push(o),r.each(t.successors(o),s),r.each(t.predecessors(o),s))}return r.each(t.nodes(),function(o){a=[],s(o),a.length&&i.push(a)}),i}return uy}var hy,lT;function gN(){if(lT)return hy;lT=1;var r=oi();hy=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(t){return t.key})},e.prototype.has=function(t){return r.has(this._keyIndices,t)},e.prototype.priority=function(t){var n=this._keyIndices[t];if(n!==void 0)return this._arr[n].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(t,n){var i=this._keyIndices;if(t=String(t),!r.has(i,t)){var a=this._arr,s=a.length;return i[t]=s,a.push({key:t,priority:n}),this._decrease(s),!0}return!1},e.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},e.prototype.decrease=function(t,n){var i=this._keyIndices[t];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},e.prototype._heapify=function(t){var n=this._arr,i=2*t,a=i+1,s=t;i<n.length&&(s=n[i].priority<n[s].priority?i:s,a<n.length&&(s=n[a].priority<n[s].priority?a:s),s!==t&&(this._swap(t,s),this._heapify(s)))},e.prototype._decrease=function(t){for(var n=this._arr,i=n[t].priority,a;t!==0&&(a=t>>1,!(n[a].priority<i));)this._swap(t,a),t=a},e.prototype._swap=function(t,n){var i=this._arr,a=this._keyIndices,s=i[t],o=i[n];i[t]=o,i[n]=s,a[o.key]=t,a[s.key]=n},hy}var dy,cT;function vN(){if(cT)return dy;cT=1;var r=oi(),e=gN();dy=n;var t=r.constant(1);function n(a,s,o,A){return i(a,String(s),o||t,A||function(l){return a.outEdges(l)})}function i(a,s,o,A){var l={},c=new e,u,h,d=function(f){var g=f.v!==u?f.v:f.w,v=l[g],p=o(f),y=h.distance+p;if(p<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+f+" Weight: "+p);y<v.distance&&(v.distance=y,v.predecessor=u,c.decrease(g,y))};for(a.nodes().forEach(function(f){var g=f===s?0:Number.POSITIVE_INFINITY;l[f]={distance:g},c.add(f,g)});c.size()>0&&(u=c.removeMin(),h=l[u],h.distance!==Number.POSITIVE_INFINITY);)A(u).forEach(d);return l}return dy}var fy,uT;function dZ(){if(uT)return fy;uT=1;var r=vN(),e=oi();fy=t;function t(n,i,a){return e.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return fy}var gy,hT;function pN(){if(hT)return gy;hT=1;var r=oi();gy=e;function e(t){var n=0,i=[],a={},s=[];function o(A){var l=a[A]={onStack:!0,lowlink:n,index:n++};if(i.push(A),t.successors(A).forEach(function(h){r.has(a,h)?a[h].onStack&&(l.lowlink=Math.min(l.lowlink,a[h].index)):(o(h),l.lowlink=Math.min(l.lowlink,a[h].lowlink))}),l.lowlink===l.index){var c=[],u;do u=i.pop(),a[u].onStack=!1,c.push(u);while(A!==u);s.push(c)}}return t.nodes().forEach(function(A){r.has(a,A)||o(A)}),s}return gy}var vy,dT;function fZ(){if(dT)return vy;dT=1;var r=oi(),e=pN();vy=t;function t(n){return r.filter(e(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return vy}var py,fT;function gZ(){if(fT)return py;fT=1;var r=oi();py=t;var e=r.constant(1);function t(i,a,s){return n(i,a||e,s||function(o){return i.outEdges(o)})}function n(i,a,s){var o={},A=i.nodes();return A.forEach(function(l){o[l]={},o[l][l]={distance:0},A.forEach(function(c){l!==c&&(o[l][c]={distance:Number.POSITIVE_INFINITY})}),s(l).forEach(function(c){var u=c.v===l?c.w:c.v,h=a(c);o[l][u]={distance:h,predecessor:l}})}),A.forEach(function(l){var c=o[l];A.forEach(function(u){var h=o[u];A.forEach(function(d){var f=h[l],g=c[d],v=h[d],p=f.distance+g.distance;p<v.distance&&(v.distance=p,v.predecessor=g.predecessor)})})}),o}return py}var yy,gT;function yN(){if(gT)return yy;gT=1;var r=oi();yy=e,e.CycleException=t;function e(n){var i={},a={},s=[];function o(A){if(r.has(a,A))throw new t;r.has(i,A)||(a[A]=!0,i[A]=!0,r.each(n.predecessors(A),o),delete a[A],s.push(A))}if(r.each(n.sinks(),o),r.size(i)!==n.nodeCount())throw new t;return s}function t(){}return t.prototype=new Error,yy}var my,vT;function vZ(){if(vT)return my;vT=1;var r=yN();my=e;function e(t){try{r(t)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return my}var wy,pT;function mN(){if(pT)return wy;pT=1;var r=oi();wy=e;function e(n,i,a){r.isArray(i)||(i=[i]);var s=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],A={};return r.each(i,function(l){if(!n.hasNode(l))throw new Error("Graph does not have node: "+l);t(n,l,a==="post",A,s,o)}),o}function t(n,i,a,s,o,A){r.has(s,i)||(s[i]=!0,a||A.push(i),r.each(o(i),function(l){t(n,l,a,s,o,A)}),a&&A.push(i))}return wy}var By,yT;function pZ(){if(yT)return By;yT=1;var r=mN();By=e;function e(t,n){return r(t,n,"post")}return By}var by,mT;function yZ(){if(mT)return by;mT=1;var r=mN();by=e;function e(t,n){return r(t,n,"pre")}return by}var Ey,wT;function mZ(){if(wT)return Ey;wT=1;var r=oi(),e=XB(),t=gN();Ey=n;function n(i,a){var s=new e,o={},A=new t,l;function c(h){var d=h.v===l?h.w:h.v,f=A.priority(d);if(f!==void 0){var g=a(h);g<f&&(o[d]=l,A.decrease(d,g))}}if(i.nodeCount()===0)return s;r.each(i.nodes(),function(h){A.add(h,Number.POSITIVE_INFINITY),s.setNode(h)}),A.decrease(i.nodes()[0],0);for(var u=!1;A.size()>0;){if(l=A.removeMin(),r.has(o,l))s.setEdge(l,o[l]);else{if(u)throw new Error("Input graph is not connected: "+i);u=!0}i.nodeEdges(l).forEach(c)}return s}return Ey}var xy,BT;function wZ(){return BT||(BT=1,xy={components:hZ(),dijkstra:vN(),dijkstraAll:dZ(),findCycles:fZ(),floydWarshall:gZ(),isAcyclic:vZ(),postorder:pZ(),preorder:yZ(),prim:mZ(),tarjan:pN(),topsort:yN()}),xy}var Cy,bT;function BZ(){if(bT)return Cy;bT=1;var r=cZ();return Cy={Graph:r.Graph,json:uZ(),alg:wZ(),version:r.version},Cy}var Sy,ET;function bi(){if(ET)return Sy;ET=1;var r;if(typeof H1=="function")try{r=BZ()}catch{}return r||(r=window.graphlib),Sy=r,Sy}var Fy,xT;function bZ(){if(xT)return Fy;xT=1;var r=zQ(),e=1,t=4;function n(i){return r(i,e|t)}return Fy=n,Fy}var Ty,CT;function Kd(){if(CT)return Ty;CT=1;var r=tA(),e=wa(),t=Ld(),n=si();function i(a,s,o){if(!n(o))return!1;var A=typeof s;return(A=="number"?e(o)&&t(s,o.length):A=="string"&&s in o)?r(o[s],a):!1}return Ty=i,Ty}var My,ST;function EZ(){if(ST)return My;ST=1;var r=Gd(),e=tA(),t=Kd(),n=io(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,A){o=Object(o);var l=-1,c=A.length,u=c>2?A[2]:void 0;for(u&&t(A[0],A[1],u)&&(c=1);++l<c;)for(var h=A[l],d=n(h),f=-1,g=d.length;++f<g;){var v=d[f],p=o[v];(p===void 0||e(p,i[v])&&!a.call(o,v))&&(o[v]=h[v])}return o});return My=s,My}var Oy,FT;function xZ(){if(FT)return Oy;FT=1;var r=Ba(),e=wa(),t=As();function n(i){return function(a,s,o){var A=Object(a);if(!e(a)){var l=r(s,3);a=t(a),s=function(u){return l(A[u],u,A)}}var c=i(a,s,o);return c>-1?A[l?a[c]:c]:void 0}}return Oy=n,Oy}var _y,TT;function CZ(){if(TT)return _y;TT=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return _y=e,_y}var Iy,MT;function SZ(){if(MT)return Iy;MT=1;var r=CZ(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Iy=t,Iy}var ky,OT;function FZ(){if(OT)return ky;OT=1;var r=SZ(),e=si(),t=aA(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function A(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var u=a.test(l);return u||s.test(l)?o(l.slice(2),u?2:8):i.test(l)?n:+l}return ky=A,ky}var Ly,_T;function wN(){if(_T)return Ly;_T=1;var r=FZ(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var a=i<0?-1:1;return a*t}return i===i?i:0}return Ly=n,Ly}var Qy,IT;function TZ(){if(IT)return Qy;IT=1;var r=wN();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Qy=e,Qy}var Ny,kT;function MZ(){if(kT)return Ny;kT=1;var r=hN(),e=Ba(),t=TZ(),n=Math.max;function i(a,s,o){var A=a==null?0:a.length;if(!A)return-1;var l=o==null?0:t(o);return l<0&&(l=n(A+l,0)),r(a,e(s,3),l)}return Ny=i,Ny}var Uy,LT;function OZ(){if(LT)return Uy;LT=1;var r=xZ(),e=MZ(),t=r(e);return Uy=t,Uy}var Py,QT;function BN(){if(QT)return Py;QT=1;var r=YB();function e(t){var n=t==null?0:t.length;return n?r(t,1):[]}return Py=e,Py}var Ry,NT;function _Z(){if(NT)return Ry;NT=1;var r=jB(),e=VQ(),t=io();function n(i,a){return i==null?i:r(i,e(a),t)}return Ry=n,Ry}var Dy,UT;function IZ(){if(UT)return Dy;UT=1;function r(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}return Dy=r,Dy}var Hy,PT;function kZ(){if(PT)return Hy;PT=1;var r=Id(),e=WB(),t=Ba();function n(i,a){var s={};return a=t(a,3),e(i,function(o,A,l){r(s,A,a(o,A,l))}),s}return Hy=n,Hy}var Gy,RT;function ZB(){if(RT)return Gy;RT=1;var r=aA();function e(t,n,i){for(var a=-1,s=t.length;++a<s;){var o=t[a],A=n(o);if(A!=null&&(l===void 0?A===A&&!r(A):i(A,l)))var l=A,c=o}return c}return Gy=e,Gy}var Ky,DT;function LZ(){if(DT)return Ky;DT=1;function r(e,t){return e>t}return Ky=r,Ky}var zy,HT;function QZ(){if(HT)return zy;HT=1;var r=ZB(),e=LZ(),t=ao();function n(i){return i&&i.length?r(i,t,e):void 0}return zy=n,zy}var Vy,GT;function bN(){if(GT)return Vy;GT=1;var r=Id(),e=tA();function t(n,i,a){(a!==void 0&&!e(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return Vy=t,Vy}var jy,KT;function NZ(){if(KT)return jy;KT=1;var r=no(),e=Ud(),t=Zi(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,A=s.call(Object);function l(c){if(!t(c)||r(c)!=n)return!1;var u=e(c);if(u===null)return!0;var h=o.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&s.call(h)==A}return jy=l,jy}var Wy,zT;function EN(){if(zT)return Wy;zT=1;function r(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}return Wy=r,Wy}var qy,VT;function UZ(){if(VT)return qy;VT=1;var r=jl(),e=io();function t(n){return r(n,e(n))}return qy=t,qy}var $y,jT;function PZ(){if(jT)return $y;jT=1;var r=bN(),e=IQ(),t=HQ(),n=kQ(),i=KQ(),a=Wl(),s=Bn(),o=dN(),A=rA(),l=Vl(),c=si(),u=NZ(),h=ql(),d=EN(),f=UZ();function g(v,p,y,m,B,C,S){var F=d(v,y),T=d(p,y),O=S.get(T);if(O){r(v,y,O);return}var _=C?C(F,T,y+"",v,p,S):void 0,k=_===void 0;if(k){var L=s(T),U=!L&&A(T),G=!L&&!U&&h(T);_=T,L||U||G?s(F)?_=F:o(F)?_=n(F):U?(k=!1,_=e(T,!0)):G?(k=!1,_=t(T,!0)):_=[]:u(T)||a(T)?(_=F,a(F)?_=f(F):(!c(F)||l(F))&&(_=i(T))):k=!1}k&&(S.set(T,_),B(_,T,m,C,S),S.delete(T)),r(v,y,_)}return $y=g,$y}var Yy,WT;function RZ(){if(WT)return Yy;WT=1;var r=_d(),e=bN(),t=jB(),n=PZ(),i=si(),a=io(),s=EN();function o(A,l,c,u,h){A!==l&&t(l,function(d,f){if(h||(h=new r),i(d))n(A,l,f,c,o,u,h);else{var g=u?u(s(A,f),d,f+"",A,l,h):void 0;g===void 0&&(g=d),e(A,f,g)}},a)}return Yy=o,Yy}var Xy,qT;function DZ(){if(qT)return Xy;qT=1;var r=Gd(),e=Kd();function t(n){return r(function(i,a){var s=-1,o=a.length,A=o>1?a[o-1]:void 0,l=o>2?a[2]:void 0;for(A=n.length>3&&typeof A=="function"?(o--,A):void 0,l&&e(a[0],a[1],l)&&(A=o<3?void 0:A,o=1),i=Object(i);++s<o;){var c=a[s];c&&n(i,c,s,A)}return i})}return Xy=t,Xy}var Zy,$T;function HZ(){if($T)return Zy;$T=1;var r=RZ(),e=DZ(),t=e(function(n,i,a){r(n,i,a)});return Zy=t,Zy}var Jy,YT;function xN(){if(YT)return Jy;YT=1;function r(e,t){return e<t}return Jy=r,Jy}var em,XT;function GZ(){if(XT)return em;XT=1;var r=ZB(),e=xN(),t=ao();function n(i){return i&&i.length?r(i,t,e):void 0}return em=n,em}var tm,ZT;function KZ(){if(ZT)return tm;ZT=1;var r=ZB(),e=Ba(),t=xN();function n(i,a){return i&&i.length?r(i,e(a,2),t):void 0}return tm=n,tm}var nm,JT;function zZ(){if(JT)return nm;JT=1;var r=Ci(),e=function(){return r.Date.now()};return nm=e,nm}var rm,eM;function VZ(){if(eM)return rm;eM=1;var r=kd(),e=Dd(),t=Ld(),n=si(),i=$l();function a(s,o,A,l){if(!n(s))return s;o=e(o,s);for(var c=-1,u=o.length,h=u-1,d=s;d!=null&&++c<u;){var f=i(o[c]),g=A;if(f==="__proto__"||f==="constructor"||f==="prototype")return s;if(c!=h){var v=d[f];g=l?l(v,f,d):void 0,g===void 0&&(g=n(v)?v:t(o[c+1])?[]:{})}r(d,f,g),d=d[f]}return s}return rm=a,rm}var im,tM;function jZ(){if(tM)return im;tM=1;var r=Hd(),e=VZ(),t=Dd();function n(i,a,s){for(var o=-1,A=a.length,l={};++o<A;){var c=a[o],u=r(i,c);s(u,c)&&e(l,t(c,i),u)}return l}return im=n,im}var am,nM;function WZ(){if(nM)return am;nM=1;var r=jZ(),e=nN();function t(n,i){return r(n,i,function(a,s){return e(n,s)})}return am=t,am}var sm,rM;function qZ(){if(rM)return sm;rM=1;var r=BN(),e=cN(),t=uN();function n(i){return t(e(i,void 0,r),i+"")}return sm=n,sm}var om,iM;function $Z(){if(iM)return om;iM=1;var r=WZ(),e=qZ(),t=e(function(n,i){return n==null?{}:r(n,i)});return om=t,om}var Am,aM;function YZ(){if(aM)return Am;aM=1;var r=Math.ceil,e=Math.max;function t(n,i,a,s){for(var o=-1,A=e(r((i-n)/(a||1)),0),l=Array(A);A--;)l[s?A:++o]=n,n+=a;return l}return Am=t,Am}var lm,sM;function XZ(){if(sM)return lm;sM=1;var r=YZ(),e=Kd(),t=wN();function n(i){return function(a,s,o){return o&&typeof o!="number"&&e(a,s,o)&&(s=o=void 0),a=t(a),s===void 0?(s=a,a=0):s=t(s),o=o===void 0?a<s?1:-1:t(o),r(a,s,o,i)}}return lm=n,lm}var cm,oM;function ZZ(){if(oM)return cm;oM=1;var r=XZ(),e=r();return cm=e,cm}var um,AM;function JZ(){if(AM)return um;AM=1;function r(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}return um=r,um}var hm,lM;function eJ(){if(lM)return hm;lM=1;var r=aA();function e(t,n){if(t!==n){var i=t!==void 0,a=t===null,s=t===t,o=r(t),A=n!==void 0,l=n===null,c=n===n,u=r(n);if(!l&&!u&&!o&&t>n||o&&A&&c&&!l&&!u||a&&A&&c||!i&&c||!s)return 1;if(!a&&!o&&!u&&t<n||u&&i&&s&&!a&&!o||l&&i&&s||!A&&s||!c)return-1}return 0}return hm=e,hm}var dm,cM;function tJ(){if(cM)return dm;cM=1;var r=eJ();function e(t,n,i){for(var a=-1,s=t.criteria,o=n.criteria,A=s.length,l=i.length;++a<A;){var c=r(s[a],o[a]);if(c){if(a>=l)return c;var u=i[a];return c*(u=="desc"?-1:1)}}return t.index-n.index}return dm=e,dm}var fm,uM;function nJ(){if(uM)return fm;uM=1;var r=Rd(),e=Hd(),t=Ba(),n=oN(),i=JZ(),a=Qd(),s=tJ(),o=ao(),A=Bn();function l(c,u,h){u.length?u=r(u,function(g){return A(g)?function(v){return e(v,g.length===1?g[0]:g)}:g}):u=[o];var d=-1;u=r(u,a(t));var f=n(c,function(g,v,p){var y=r(u,function(m){return m(g)});return{criteria:y,index:++d,value:g}});return i(f,function(g,v){return s(g,v,h)})}return fm=l,fm}var gm,hM;function rJ(){if(hM)return gm;hM=1;var r=YB(),e=nJ(),t=Gd(),n=Kd(),i=t(function(a,s){if(a==null)return[];var o=s.length;return o>1&&n(a,s[0],s[1])?s=[]:o>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),e(a,r(s,1),[])});return gm=i,gm}var vm,dM;function iJ(){if(dM)return vm;dM=1;var r=eN(),e=0;function t(n){var i=++e;return r(n)+i}return vm=t,vm}var pm,fM;function aJ(){if(fM)return pm;fM=1;function r(e,t,n){for(var i=-1,a=e.length,s=t.length,o={};++i<a;){var A=i<s?t[i]:void 0;n(o,e[i],A)}return o}return pm=r,pm}var ym,gM;function sJ(){if(gM)return ym;gM=1;var r=kd(),e=aJ();function t(n,i){return e(n||[],i||[],r)}return ym=t,ym}var mm,vM;function jt(){if(vM)return mm;vM=1;var r;if(typeof H1=="function")try{r={cloneDeep:bZ(),constant:VB(),defaults:EZ(),each:WQ(),filter:iN(),find:OZ(),flatten:BN(),forEach:jQ(),forIn:_Z(),has:aN(),isUndefined:sN(),last:IZ(),map:AN(),mapValues:kZ(),max:QZ(),merge:HZ(),min:GZ(),minBy:KZ(),now:zZ(),pick:$Z(),range:ZZ(),reduce:lN(),sortBy:rJ(),uniqueId:iJ(),values:fN(),zipObject:sJ()}}catch{}return r||(r=window._),mm=r,mm}var wm,pM;function oJ(){if(pM)return wm;pM=1,wm=r;function r(){var n={};n._next=n._prev=n,this._sentinel=n}r.prototype.dequeue=function(){var n=this._sentinel,i=n._prev;if(i!==n)return e(i),i},r.prototype.enqueue=function(n){var i=this._sentinel;n._prev&&n._next&&e(n),n._next=i._next,i._next._prev=n,i._next=n,n._prev=i},r.prototype.toString=function(){for(var n=[],i=this._sentinel,a=i._prev;a!==i;)n.push(JSON.stringify(a,t)),a=a._prev;return"["+n.join(", ")+"]"};function e(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function t(n,i){if(n!=="_next"&&n!=="_prev")return i}return wm}var Bm,yM;function AJ(){if(yM)return Bm;yM=1;var r=jt(),e=bi().Graph,t=oJ();Bm=i;var n=r.constant(1);function i(l,c){if(l.nodeCount()<=1)return[];var u=o(l,c||n),h=a(u.graph,u.buckets,u.zeroIdx);return r.flatten(r.map(h,function(d){return l.outEdges(d.v,d.w)}),!0)}function a(l,c,u){for(var h=[],d=c[c.length-1],f=c[0],g;l.nodeCount();){for(;g=f.dequeue();)s(l,c,u,g);for(;g=d.dequeue();)s(l,c,u,g);if(l.nodeCount()){for(var v=c.length-2;v>0;--v)if(g=c[v].dequeue(),g){h=h.concat(s(l,c,u,g,!0));break}}}return h}function s(l,c,u,h,d){var f=d?[]:void 0;return r.forEach(l.inEdges(h.v),function(g){var v=l.edge(g),p=l.node(g.v);d&&f.push({v:g.v,w:g.w}),p.out-=v,A(c,u,p)}),r.forEach(l.outEdges(h.v),function(g){var v=l.edge(g),p=g.w,y=l.node(p);y.in-=v,A(c,u,y)}),l.removeNode(h.v),f}function o(l,c){var u=new e,h=0,d=0;r.forEach(l.nodes(),function(v){u.setNode(v,{v,in:0,out:0})}),r.forEach(l.edges(),function(v){var p=u.edge(v.v,v.w)||0,y=c(v),m=p+y;u.setEdge(v.v,v.w,m),d=Math.max(d,u.node(v.v).out+=y),h=Math.max(h,u.node(v.w).in+=y)});var f=r.range(d+h+3).map(function(){return new t}),g=h+1;return r.forEach(u.nodes(),function(v){A(f,g,u.node(v))}),{graph:u,buckets:f,zeroIdx:g}}function A(l,c,u){u.out?u.in?l[u.out-u.in+c].enqueue(u):l[l.length-1].enqueue(u):l[0].enqueue(u)}return Bm}var bm,mM;function lJ(){if(mM)return bm;mM=1;var r=jt(),e=AJ();bm={run:t,undo:i};function t(a){var s=a.graph().acyclicer==="greedy"?e(a,o(a)):n(a);r.forEach(s,function(A){var l=a.edge(A);a.removeEdge(A),l.forwardName=A.name,l.reversed=!0,a.setEdge(A.w,A.v,l,r.uniqueId("rev"))});function o(A){return function(l){return A.edge(l).weight}}}function n(a){var s=[],o={},A={};function l(c){r.has(A,c)||(A[c]=!0,o[c]=!0,r.forEach(a.outEdges(c),function(u){r.has(o,u.w)?s.push(u):l(u.w)}),delete o[c])}return r.forEach(a.nodes(),l),s}function i(a){r.forEach(a.edges(),function(s){var o=a.edge(s);if(o.reversed){a.removeEdge(s);var A=o.forwardName;delete o.reversed,delete o.forwardName,a.setEdge(s.w,s.v,o,A)}})}return bm}var Em,wM;function Sr(){if(wM)return Em;wM=1;var r=jt(),e=bi().Graph;Em={addDummyNode:t,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:s,intersectRect:o,buildLayerMatrix:A,normalizeRanks:l,removeEmptyRanks:c,addBorderNode:u,maxRank:h,partition:d,time:f,notime:g};function t(v,p,y,m){var B;do B=r.uniqueId(m);while(v.hasNode(B));return y.dummy=p,v.setNode(B,y),B}function n(v){var p=new e().setGraph(v.graph());return r.forEach(v.nodes(),function(y){p.setNode(y,v.node(y))}),r.forEach(v.edges(),function(y){var m=p.edge(y.v,y.w)||{weight:0,minlen:1},B=v.edge(y);p.setEdge(y.v,y.w,{weight:m.weight+B.weight,minlen:Math.max(m.minlen,B.minlen)})}),p}function i(v){var p=new e({multigraph:v.isMultigraph()}).setGraph(v.graph());return r.forEach(v.nodes(),function(y){v.children(y).length||p.setNode(y,v.node(y))}),r.forEach(v.edges(),function(y){p.setEdge(y,v.edge(y))}),p}function a(v){var p=r.map(v.nodes(),function(y){var m={};return r.forEach(v.outEdges(y),function(B){m[B.w]=(m[B.w]||0)+v.edge(B).weight}),m});return r.zipObject(v.nodes(),p)}function s(v){var p=r.map(v.nodes(),function(y){var m={};return r.forEach(v.inEdges(y),function(B){m[B.v]=(m[B.v]||0)+v.edge(B).weight}),m});return r.zipObject(v.nodes(),p)}function o(v,p){var y=v.x,m=v.y,B=p.x-y,C=p.y-m,S=v.width/2,F=v.height/2;if(!B&&!C)throw new Error("Not possible to find intersection inside of the rectangle");var T,O;return Math.abs(C)*S>Math.abs(B)*F?(C<0&&(F=-F),T=F*B/C,O=F):(B<0&&(S=-S),T=S,O=S*C/B),{x:y+T,y:m+O}}function A(v){var p=r.map(r.range(h(v)+1),function(){return[]});return r.forEach(v.nodes(),function(y){var m=v.node(y),B=m.rank;r.isUndefined(B)||(p[B][m.order]=y)}),p}function l(v){var p=r.min(r.map(v.nodes(),function(y){return v.node(y).rank}));r.forEach(v.nodes(),function(y){var m=v.node(y);r.has(m,"rank")&&(m.rank-=p)})}function c(v){var p=r.min(r.map(v.nodes(),function(C){return v.node(C).rank})),y=[];r.forEach(v.nodes(),function(C){var S=v.node(C).rank-p;y[S]||(y[S]=[]),y[S].push(C)});var m=0,B=v.graph().nodeRankFactor;r.forEach(y,function(C,S){r.isUndefined(C)&&S%B!==0?--m:m&&r.forEach(C,function(F){v.node(F).rank+=m})})}function u(v,p,y,m){var B={width:0,height:0};return arguments.length>=4&&(B.rank=y,B.order=m),t(v,"border",B,p)}function h(v){return r.max(r.map(v.nodes(),function(p){var y=v.node(p).rank;if(!r.isUndefined(y))return y}))}function d(v,p){var y={lhs:[],rhs:[]};return r.forEach(v,function(m){p(m)?y.lhs.push(m):y.rhs.push(m)}),y}function f(v,p){var y=r.now();try{return p()}finally{console.log(v+" time: "+(r.now()-y)+"ms")}}function g(v,p){return p()}return Em}var xm,BM;function cJ(){if(BM)return xm;BM=1;var r=jt(),e=Sr();xm={run:t,undo:i};function t(a){a.graph().dummyChains=[],r.forEach(a.edges(),function(s){n(a,s)})}function n(a,s){var o=s.v,A=a.node(o).rank,l=s.w,c=a.node(l).rank,u=s.name,h=a.edge(s),d=h.labelRank;if(c!==A+1){a.removeEdge(s);var f,g,v;for(v=0,++A;A<c;++v,++A)h.points=[],g={width:0,height:0,edgeLabel:h,edgeObj:s,rank:A},f=e.addDummyNode(a,"edge",g,"_d"),A===d&&(g.width=h.width,g.height=h.height,g.dummy="edge-label",g.labelpos=h.labelpos),a.setEdge(o,f,{weight:h.weight},u),v===0&&a.graph().dummyChains.push(f),o=f;a.setEdge(o,l,{weight:h.weight},u)}}function i(a){r.forEach(a.graph().dummyChains,function(s){var o=a.node(s),A=o.edgeLabel,l;for(a.setEdge(o.edgeObj,A);o.dummy;)l=a.successors(s)[0],a.removeNode(s),A.points.push({x:o.x,y:o.y}),o.dummy==="edge-label"&&(A.x=o.x,A.y=o.y,A.width=o.width,A.height=o.height),s=l,o=a.node(s)})}return xm}var Cm,bM;function Sh(){if(bM)return Cm;bM=1;var r=jt();Cm={longestPath:e,slack:t};function e(n){var i={};function a(s){var o=n.node(s);if(r.has(i,s))return o.rank;i[s]=!0;var A=r.min(r.map(n.outEdges(s),function(l){return a(l.w)-n.edge(l).minlen}));return(A===Number.POSITIVE_INFINITY||A===void 0||A===null)&&(A=0),o.rank=A}r.forEach(n.sources(),a)}function t(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen}return Cm}var Sm,EM;function CN(){if(EM)return Sm;EM=1;var r=jt(),e=bi().Graph,t=Sh().slack;Sm=n;function n(o){var A=new e({directed:!1}),l=o.nodes()[0],c=o.nodeCount();A.setNode(l,{});for(var u,h;i(A,o)<c;)u=a(A,o),h=A.hasNode(u.v)?t(o,u):-t(o,u),s(A,o,h);return A}function i(o,A){function l(c){r.forEach(A.nodeEdges(c),function(u){var h=u.v,d=c===h?u.w:h;!o.hasNode(d)&&!t(A,u)&&(o.setNode(d,{}),o.setEdge(c,d,{}),l(d))})}return r.forEach(o.nodes(),l),o.nodeCount()}function a(o,A){return r.minBy(A.edges(),function(l){if(o.hasNode(l.v)!==o.hasNode(l.w))return t(A,l)})}function s(o,A,l){r.forEach(o.nodes(),function(c){A.node(c).rank+=l})}return Sm}var Fm,xM;function uJ(){if(xM)return Fm;xM=1;var r=jt(),e=CN(),t=Sh().slack,n=Sh().longestPath,i=bi().alg.preorder,a=bi().alg.postorder,s=Sr().simplify;Fm=o,o.initLowLimValues=u,o.initCutValues=A,o.calcCutValue=c,o.leaveEdge=d,o.enterEdge=f,o.exchangeEdges=g;function o(m){m=s(m),n(m);var B=e(m);u(B),A(B,m);for(var C,S;C=d(B);)S=f(B,m,C),g(B,m,C,S)}function A(m,B){var C=a(m,m.nodes());C=C.slice(0,C.length-1),r.forEach(C,function(S){l(m,B,S)})}function l(m,B,C){var S=m.node(C),F=S.parent;m.edge(C,F).cutvalue=c(m,B,C)}function c(m,B,C){var S=m.node(C),F=S.parent,T=!0,O=B.edge(C,F),_=0;return O||(T=!1,O=B.edge(F,C)),_=O.weight,r.forEach(B.nodeEdges(C),function(k){var L=k.v===C,U=L?k.w:k.v;if(U!==F){var G=L===T,W=B.edge(k).weight;if(_+=G?W:-W,p(m,C,U)){var V=m.edge(C,U).cutvalue;_+=G?-V:V}}}),_}function u(m,B){arguments.length<2&&(B=m.nodes()[0]),h(m,{},1,B)}function h(m,B,C,S,F){var T=C,O=m.node(S);return B[S]=!0,r.forEach(m.neighbors(S),function(_){r.has(B,_)||(C=h(m,B,C,_,S))}),O.low=T,O.lim=C++,F?O.parent=F:delete O.parent,C}function d(m){return r.find(m.edges(),function(B){return m.edge(B).cutvalue<0})}function f(m,B,C){var S=C.v,F=C.w;B.hasEdge(S,F)||(S=C.w,F=C.v);var T=m.node(S),O=m.node(F),_=T,k=!1;T.lim>O.lim&&(_=O,k=!0);var L=r.filter(B.edges(),function(U){return k===y(m,m.node(U.v),_)&&k!==y(m,m.node(U.w),_)});return r.minBy(L,function(U){return t(B,U)})}function g(m,B,C,S){var F=C.v,T=C.w;m.removeEdge(F,T),m.setEdge(S.v,S.w,{}),u(m),A(m,B),v(m,B)}function v(m,B){var C=r.find(m.nodes(),function(F){return!B.node(F).parent}),S=i(m,C);S=S.slice(1),r.forEach(S,function(F){var T=m.node(F).parent,O=B.edge(F,T),_=!1;O||(O=B.edge(T,F),_=!0),B.node(F).rank=B.node(T).rank+(_?O.minlen:-O.minlen)})}function p(m,B,C){return m.hasEdge(B,C)}function y(m,B,C){return C.low<=B.lim&&B.lim<=C.lim}return Fm}var Tm,CM;function hJ(){if(CM)return Tm;CM=1;var r=Sh(),e=r.longestPath,t=CN(),n=uJ();Tm=i;function i(A){switch(A.graph().ranker){case"network-simplex":o(A);break;case"tight-tree":s(A);break;case"longest-path":a(A);break;default:o(A)}}var a=e;function s(A){e(A),t(A)}function o(A){n(A)}return Tm}var Mm,SM;function dJ(){if(SM)return Mm;SM=1;var r=jt();Mm=e;function e(i){var a=n(i);r.forEach(i.graph().dummyChains,function(s){for(var o=i.node(s),A=o.edgeObj,l=t(i,a,A.v,A.w),c=l.path,u=l.lca,h=0,d=c[h],f=!0;s!==A.w;){if(o=i.node(s),f){for(;(d=c[h])!==u&&i.node(d).maxRank<o.rank;)h++;d===u&&(f=!1)}if(!f){for(;h<c.length-1&&i.node(d=c[h+1]).minRank<=o.rank;)h++;d=c[h]}i.setParent(s,d),s=i.successors(s)[0]}})}function t(i,a,s,o){var A=[],l=[],c=Math.min(a[s].low,a[o].low),u=Math.max(a[s].lim,a[o].lim),h,d;h=s;do h=i.parent(h),A.push(h);while(h&&(a[h].low>c||u>a[h].lim));for(d=h,h=o;(h=i.parent(h))!==d;)l.push(h);return{path:A.concat(l.reverse()),lca:d}}function n(i){var a={},s=0;function o(A){var l=s;r.forEach(i.children(A),o),a[A]={low:l,lim:s++}}return r.forEach(i.children(),o),a}return Mm}var Om,FM;function fJ(){if(FM)return Om;FM=1;var r=jt(),e=Sr();Om={run:t,cleanup:s};function t(o){var A=e.addDummyNode(o,"root",{},"_root"),l=i(o),c=r.max(r.values(l))-1,u=2*c+1;o.graph().nestingRoot=A,r.forEach(o.edges(),function(d){o.edge(d).minlen*=u});var h=a(o)+1;r.forEach(o.children(),function(d){n(o,A,u,h,c,l,d)}),o.graph().nodeRankFactor=u}function n(o,A,l,c,u,h,d){var f=o.children(d);if(!f.length){d!==A&&o.setEdge(A,d,{weight:0,minlen:l});return}var g=e.addBorderNode(o,"_bt"),v=e.addBorderNode(o,"_bb"),p=o.node(d);o.setParent(g,d),p.borderTop=g,o.setParent(v,d),p.borderBottom=v,r.forEach(f,function(y){n(o,A,l,c,u,h,y);var m=o.node(y),B=m.borderTop?m.borderTop:y,C=m.borderBottom?m.borderBottom:y,S=m.borderTop?c:2*c,F=B!==C?1:u-h[d]+1;o.setEdge(g,B,{weight:S,minlen:F,nestingEdge:!0}),o.setEdge(C,v,{weight:S,minlen:F,nestingEdge:!0})}),o.parent(d)||o.setEdge(A,g,{weight:0,minlen:u+h[d]})}function i(o){var A={};function l(c,u){var h=o.children(c);h&&h.length&&r.forEach(h,function(d){l(d,u+1)}),A[c]=u}return r.forEach(o.children(),function(c){l(c,1)}),A}function a(o){return r.reduce(o.edges(),function(A,l){return A+o.edge(l).weight},0)}function s(o){var A=o.graph();o.removeNode(A.nestingRoot),delete A.nestingRoot,r.forEach(o.edges(),function(l){var c=o.edge(l);c.nestingEdge&&o.removeEdge(l)})}return Om}var _m,TM;function gJ(){if(TM)return _m;TM=1;var r=jt(),e=Sr();_m=t;function t(i){function a(s){var o=i.children(s),A=i.node(s);if(o.length&&r.forEach(o,a),r.has(A,"minRank")){A.borderLeft=[],A.borderRight=[];for(var l=A.minRank,c=A.maxRank+1;l<c;++l)n(i,"borderLeft","_bl",s,A,l),n(i,"borderRight","_br",s,A,l)}}r.forEach(i.children(),a)}function n(i,a,s,o,A,l){var c={width:0,height:0,rank:l,borderType:a},u=A[a][l-1],h=e.addDummyNode(i,"border",c,s);A[a][l]=h,i.setParent(h,o),u&&i.setEdge(u,h,{weight:1})}return _m}var Im,MM;function vJ(){if(MM)return Im;MM=1;var r=jt();Im={adjust:e,undo:t};function e(l){var c=l.graph().rankdir.toLowerCase();(c==="lr"||c==="rl")&&n(l)}function t(l){var c=l.graph().rankdir.toLowerCase();(c==="bt"||c==="rl")&&a(l),(c==="lr"||c==="rl")&&(o(l),n(l))}function n(l){r.forEach(l.nodes(),function(c){i(l.node(c))}),r.forEach(l.edges(),function(c){i(l.edge(c))})}function i(l){var c=l.width;l.width=l.height,l.height=c}function a(l){r.forEach(l.nodes(),function(c){s(l.node(c))}),r.forEach(l.edges(),function(c){var u=l.edge(c);r.forEach(u.points,s),r.has(u,"y")&&s(u)})}function s(l){l.y=-l.y}function o(l){r.forEach(l.nodes(),function(c){A(l.node(c))}),r.forEach(l.edges(),function(c){var u=l.edge(c);r.forEach(u.points,A),r.has(u,"x")&&A(u)})}function A(l){var c=l.x;l.x=l.y,l.y=c}return Im}var km,OM;function pJ(){if(OM)return km;OM=1;var r=jt();km=e;function e(t){var n={},i=r.filter(t.nodes(),function(l){return!t.children(l).length}),a=r.max(r.map(i,function(l){return t.node(l).rank})),s=r.map(r.range(a+1),function(){return[]});function o(l){if(!r.has(n,l)){n[l]=!0;var c=t.node(l);s[c.rank].push(l),r.forEach(t.successors(l),o)}}var A=r.sortBy(i,function(l){return t.node(l).rank});return r.forEach(A,o),s}return km}var Lm,_M;function yJ(){if(_M)return Lm;_M=1;var r=jt();Lm=e;function e(n,i){for(var a=0,s=1;s<i.length;++s)a+=t(n,i[s-1],i[s]);return a}function t(n,i,a){for(var s=r.zipObject(a,r.map(a,function(h,d){return d})),o=r.flatten(r.map(i,function(h){return r.sortBy(r.map(n.outEdges(h),function(d){return{pos:s[d.w],weight:n.edge(d).weight}}),"pos")}),!0),A=1;A<a.length;)A<<=1;var l=2*A-1;A-=1;var c=r.map(new Array(l),function(){return 0}),u=0;return r.forEach(o.forEach(function(h){var d=h.pos+A;c[d]+=h.weight;for(var f=0;d>0;)d%2&&(f+=c[d+1]),d=d-1>>1,c[d]+=h.weight;u+=h.weight*f})),u}return Lm}var Qm,IM;function mJ(){if(IM)return Qm;IM=1;var r=jt();Qm=e;function e(t,n){return r.map(n,function(i){var a=t.inEdges(i);if(a.length){var s=r.reduce(a,function(o,A){var l=t.edge(A),c=t.node(A.v);return{sum:o.sum+l.weight*c.order,weight:o.weight+l.weight}},{sum:0,weight:0});return{v:i,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:i}})}return Qm}var Nm,kM;function wJ(){if(kM)return Nm;kM=1;var r=jt();Nm=e;function e(i,a){var s={};r.forEach(i,function(A,l){var c=s[A.v]={indegree:0,in:[],out:[],vs:[A.v],i:l};r.isUndefined(A.barycenter)||(c.barycenter=A.barycenter,c.weight=A.weight)}),r.forEach(a.edges(),function(A){var l=s[A.v],c=s[A.w];!r.isUndefined(l)&&!r.isUndefined(c)&&(c.indegree++,l.out.push(s[A.w]))});var o=r.filter(s,function(A){return!A.indegree});return t(o)}function t(i){var a=[];function s(l){return function(c){c.merged||(r.isUndefined(c.barycenter)||r.isUndefined(l.barycenter)||c.barycenter>=l.barycenter)&&n(l,c)}}function o(l){return function(c){c.in.push(l),--c.indegree===0&&i.push(c)}}for(;i.length;){var A=i.pop();a.push(A),r.forEach(A.in.reverse(),s(A)),r.forEach(A.out,o(A))}return r.map(r.filter(a,function(l){return!l.merged}),function(l){return r.pick(l,["vs","i","barycenter","weight"])})}function n(i,a){var s=0,o=0;i.weight&&(s+=i.barycenter*i.weight,o+=i.weight),a.weight&&(s+=a.barycenter*a.weight,o+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=s/o,i.weight=o,i.i=Math.min(a.i,i.i),a.merged=!0}return Nm}var Um,LM;function BJ(){if(LM)return Um;LM=1;var r=jt(),e=Sr();Um=t;function t(a,s){var o=e.partition(a,function(g){return r.has(g,"barycenter")}),A=o.lhs,l=r.sortBy(o.rhs,function(g){return-g.i}),c=[],u=0,h=0,d=0;A.sort(i(!!s)),d=n(c,l,d),r.forEach(A,function(g){d+=g.vs.length,c.push(g.vs),u+=g.barycenter*g.weight,h+=g.weight,d=n(c,l,d)});var f={vs:r.flatten(c,!0)};return h&&(f.barycenter=u/h,f.weight=h),f}function n(a,s,o){for(var A;s.length&&(A=r.last(s)).i<=o;)s.pop(),a.push(A.vs),o++;return o}function i(a){return function(s,o){return s.barycenter<o.barycenter?-1:s.barycenter>o.barycenter?1:a?o.i-s.i:s.i-o.i}}return Um}var Pm,QM;function bJ(){if(QM)return Pm;QM=1;var r=jt(),e=mJ(),t=wJ(),n=BJ();Pm=i;function i(o,A,l,c){var u=o.children(A),h=o.node(A),d=h?h.borderLeft:void 0,f=h?h.borderRight:void 0,g={};d&&(u=r.filter(u,function(C){return C!==d&&C!==f}));var v=e(o,u);r.forEach(v,function(C){if(o.children(C.v).length){var S=i(o,C.v,l,c);g[C.v]=S,r.has(S,"barycenter")&&s(C,S)}});var p=t(v,l);a(p,g);var y=n(p,c);if(d&&(y.vs=r.flatten([d,y.vs,f],!0),o.predecessors(d).length)){var m=o.node(o.predecessors(d)[0]),B=o.node(o.predecessors(f)[0]);r.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+B.order)/(y.weight+2),y.weight+=2}return y}function a(o,A){r.forEach(o,function(l){l.vs=r.flatten(l.vs.map(function(c){return A[c]?A[c].vs:c}),!0)})}function s(o,A){r.isUndefined(o.barycenter)?(o.barycenter=A.barycenter,o.weight=A.weight):(o.barycenter=(o.barycenter*o.weight+A.barycenter*A.weight)/(o.weight+A.weight),o.weight+=A.weight)}return Pm}var Rm,NM;function EJ(){if(NM)return Rm;NM=1;var r=jt(),e=bi().Graph;Rm=t;function t(i,a,s){var o=n(i),A=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(l){return i.node(l)});return r.forEach(i.nodes(),function(l){var c=i.node(l),u=i.parent(l);(c.rank===a||c.minRank<=a&&a<=c.maxRank)&&(A.setNode(l),A.setParent(l,u||o),r.forEach(i[s](l),function(h){var d=h.v===l?h.w:h.v,f=A.edge(d,l),g=r.isUndefined(f)?0:f.weight;A.setEdge(d,l,{weight:i.edge(h).weight+g})}),r.has(c,"minRank")&&A.setNode(l,{borderLeft:c.borderLeft[a],borderRight:c.borderRight[a]}))}),A}function n(i){for(var a;i.hasNode(a=r.uniqueId("_root")););return a}return Rm}var Dm,UM;function xJ(){if(UM)return Dm;UM=1;var r=jt();Dm=e;function e(t,n,i){var a={},s;r.forEach(i,function(o){for(var A=t.parent(o),l,c;A;){if(l=t.parent(A),l?(c=a[l],a[l]=A):(c=s,s=A),c&&c!==A){n.setEdge(c,A);return}A=l}})}return Dm}var Hm,PM;function CJ(){if(PM)return Hm;PM=1;var r=jt(),e=pJ(),t=yJ(),n=bJ(),i=EJ(),a=xJ(),s=bi().Graph,o=Sr();Hm=A;function A(h){var d=o.maxRank(h),f=l(h,r.range(1,d+1),"inEdges"),g=l(h,r.range(d-1,-1,-1),"outEdges"),v=e(h);u(h,v);for(var p=Number.POSITIVE_INFINITY,y,m=0,B=0;B<4;++m,++B){c(m%2?f:g,m%4>=2),v=o.buildLayerMatrix(h);var C=t(h,v);C<p&&(B=0,y=r.cloneDeep(v),p=C)}u(h,y)}function l(h,d,f){return r.map(d,function(g){return i(h,g,f)})}function c(h,d){var f=new s;r.forEach(h,function(g){var v=g.graph().root,p=n(g,v,f,d);r.forEach(p.vs,function(y,m){g.node(y).order=m}),a(g,f,p.vs)})}function u(h,d){r.forEach(d,function(f){r.forEach(f,function(g,v){h.node(g).order=v})})}return Hm}var Gm,RM;function SJ(){if(RM)return Gm;RM=1;var r=jt(),e=bi().Graph,t=Sr();Gm={positionX:f,findType1Conflicts:n,findType2Conflicts:i,addConflict:s,hasConflict:o,verticalAlignment:A,horizontalCompaction:l,alignCoordinates:h,findSmallestWidthAlignment:u,balance:d};function n(p,y){var m={};function B(C,S){var F=0,T=0,O=C.length,_=r.last(S);return r.forEach(S,function(k,L){var U=a(p,k),G=U?p.node(U).order:O;(U||k===_)&&(r.forEach(S.slice(T,L+1),function(W){r.forEach(p.predecessors(W),function(V){var K=p.node(V),D=K.order;(D<F||G<D)&&!(K.dummy&&p.node(W).dummy)&&s(m,V,W)})}),T=L+1,F=G)}),S}return r.reduce(y,B),m}function i(p,y){var m={};function B(S,F,T,O,_){var k;r.forEach(r.range(F,T),function(L){k=S[L],p.node(k).dummy&&r.forEach(p.predecessors(k),function(U){var G=p.node(U);G.dummy&&(G.order<O||G.order>_)&&s(m,U,k)})})}function C(S,F){var T=-1,O,_=0;return r.forEach(F,function(k,L){if(p.node(k).dummy==="border"){var U=p.predecessors(k);U.length&&(O=p.node(U[0]).order,B(F,_,L,T,O),_=L,T=O)}B(F,_,F.length,O,S.length)}),F}return r.reduce(y,C),m}function a(p,y){if(p.node(y).dummy)return r.find(p.predecessors(y),function(m){return p.node(m).dummy})}function s(p,y,m){if(y>m){var B=y;y=m,m=B}var C=p[y];C||(p[y]=C={}),C[m]=!0}function o(p,y,m){if(y>m){var B=y;y=m,m=B}return r.has(p[y],m)}function A(p,y,m,B){var C={},S={},F={};return r.forEach(y,function(T){r.forEach(T,function(O,_){C[O]=O,S[O]=O,F[O]=_})}),r.forEach(y,function(T){var O=-1;r.forEach(T,function(_){var k=B(_);if(k.length){k=r.sortBy(k,function(V){return F[V]});for(var L=(k.length-1)/2,U=Math.floor(L),G=Math.ceil(L);U<=G;++U){var W=k[U];S[_]===_&&O<F[W]&&!o(m,_,W)&&(S[W]=_,S[_]=C[_]=C[W],O=F[W])}}})}),{root:C,align:S}}function l(p,y,m,B,C){var S={},F=c(p,y,m,C),T=C?"borderLeft":"borderRight";function O(L,U){for(var G=F.nodes(),W=G.pop(),V={};W;)V[W]?L(W):(V[W]=!0,G.push(W),G=G.concat(U(W))),W=G.pop()}function _(L){S[L]=F.inEdges(L).reduce(function(U,G){return Math.max(U,S[G.v]+F.edge(G))},0)}function k(L){var U=F.outEdges(L).reduce(function(W,V){return Math.min(W,S[V.w]-F.edge(V))},Number.POSITIVE_INFINITY),G=p.node(L);U!==Number.POSITIVE_INFINITY&&G.borderType!==T&&(S[L]=Math.max(S[L],U))}return O(_,F.predecessors.bind(F)),O(k,F.successors.bind(F)),r.forEach(B,function(L){S[L]=S[m[L]]}),S}function c(p,y,m,B){var C=new e,S=p.graph(),F=g(S.nodesep,S.edgesep,B);return r.forEach(y,function(T){var O;r.forEach(T,function(_){var k=m[_];if(C.setNode(k),O){var L=m[O],U=C.edge(L,k);C.setEdge(L,k,Math.max(F(p,_,O),U||0))}O=_})}),C}function u(p,y){return r.minBy(r.values(y),function(m){var B=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return r.forIn(m,function(S,F){var T=v(p,F)/2;B=Math.max(S+T,B),C=Math.min(S-T,C)}),B-C})}function h(p,y){var m=r.values(y),B=r.min(m),C=r.max(m);r.forEach(["u","d"],function(S){r.forEach(["l","r"],function(F){var T=S+F,O=p[T],_;if(O!==y){var k=r.values(O);_=F==="l"?B-r.min(k):C-r.max(k),_&&(p[T]=r.mapValues(O,function(L){return L+_}))}})})}function d(p,y){return r.mapValues(p.ul,function(m,B){if(y)return p[y.toLowerCase()][B];var C=r.sortBy(r.map(p,B));return(C[1]+C[2])/2})}function f(p){var y=t.buildLayerMatrix(p),m=r.merge(n(p,y),i(p,y)),B={},C;r.forEach(["u","d"],function(F){C=F==="u"?y:r.values(y).reverse(),r.forEach(["l","r"],function(T){T==="r"&&(C=r.map(C,function(L){return r.values(L).reverse()}));var O=(F==="u"?p.predecessors:p.successors).bind(p),_=A(p,C,m,O),k=l(p,C,_.root,_.align,T==="r");T==="r"&&(k=r.mapValues(k,function(L){return-L})),B[F+T]=k})});var S=u(p,B);return h(B,S),d(B,p.graph().align)}function g(p,y,m){return function(B,C,S){var F=B.node(C),T=B.node(S),O=0,_;if(O+=F.width/2,r.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":_=-F.width/2;break;case"r":_=F.width/2;break}if(_&&(O+=m?_:-_),_=0,O+=(F.dummy?y:p)/2,O+=(T.dummy?y:p)/2,O+=T.width/2,r.has(T,"labelpos"))switch(T.labelpos.toLowerCase()){case"l":_=T.width/2;break;case"r":_=-T.width/2;break}return _&&(O+=m?_:-_),_=0,O}}function v(p,y){return p.node(y).width}return Gm}var Km,DM;function FJ(){if(DM)return Km;DM=1;var r=jt(),e=Sr(),t=SJ().positionX;Km=n;function n(a){a=e.asNonCompoundGraph(a),i(a),r.forEach(t(a),function(s,o){a.node(o).x=s})}function i(a){var s=e.buildLayerMatrix(a),o=a.graph().ranksep,A=0;r.forEach(s,function(l){var c=r.max(r.map(l,function(u){return a.node(u).height}));r.forEach(l,function(u){a.node(u).y=A+c/2}),A+=c+o})}return Km}var zm,HM;function TJ(){if(HM)return zm;HM=1;var r=jt(),e=lJ(),t=cJ(),n=hJ(),i=Sr().normalizeRanks,a=dJ(),s=Sr().removeEmptyRanks,o=fJ(),A=gJ(),l=vJ(),c=CJ(),u=FJ(),h=Sr(),d=bi().Graph;zm=f;function f($,z){var ee=z&&z.debugTiming?h.time:h.notime;ee("layout",function(){var Ae=ee(" buildLayoutGraph",function(){return O($)});ee(" runLayout",function(){g(Ae,ee)}),ee(" updateInputGraph",function(){v($,Ae)})})}function g($,z){z(" makeSpaceForEdgeLabels",function(){_($)}),z(" removeSelfEdges",function(){X($)}),z(" acyclic",function(){e.run($)}),z(" nestingGraph.run",function(){o.run($)}),z(" rank",function(){n(h.asNonCompoundGraph($))}),z(" injectEdgeLabelProxies",function(){k($)}),z(" removeEmptyRanks",function(){s($)}),z(" nestingGraph.cleanup",function(){o.cleanup($)}),z(" normalizeRanks",function(){i($)}),z(" assignRankMinMax",function(){L($)}),z(" removeEdgeLabelProxies",function(){U($)}),z(" normalize.run",function(){t.run($)}),z(" parentDummyChains",function(){a($)}),z(" addBorderSegments",function(){A($)}),z(" order",function(){c($)}),z(" insertSelfEdges",function(){te($)}),z(" adjustCoordinateSystem",function(){l.adjust($)}),z(" position",function(){u($)}),z(" positionSelfEdges",function(){ie($)}),z(" removeBorderNodes",function(){D($)}),z(" normalize.undo",function(){t.undo($)}),z(" fixupEdgeLabelCoords",function(){V($)}),z(" undoCoordinateSystem",function(){l.undo($)}),z(" translateGraph",function(){G($)}),z(" assignNodeIntersects",function(){W($)}),z(" reversePoints",function(){K($)}),z(" acyclic.undo",function(){e.undo($)})}function v($,z){r.forEach($.nodes(),function(ee){var Ae=$.node(ee),be=z.node(ee);Ae&&(Ae.x=be.x,Ae.y=be.y,z.children(ee).length&&(Ae.width=be.width,Ae.height=be.height))}),r.forEach($.edges(),function(ee){var Ae=$.edge(ee),be=z.edge(ee);Ae.points=be.points,r.has(be,"x")&&(Ae.x=be.x,Ae.y=be.y)}),$.graph().width=z.graph().width,$.graph().height=z.graph().height}var p=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},m=["acyclicer","ranker","rankdir","align"],B=["width","height"],C={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],F={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function O($){var z=new d({multigraph:!0,compound:!0}),ee=xe($.graph());return z.setGraph(r.merge({},y,re(ee,p),r.pick(ee,m))),r.forEach($.nodes(),function(Ae){var be=xe($.node(Ae));z.setNode(Ae,r.defaults(re(be,B),C)),z.setParent(Ae,$.parent(Ae))}),r.forEach($.edges(),function(Ae){var be=xe($.edge(Ae));z.setEdge(Ae,r.merge({},F,re(be,S),r.pick(be,T)))}),z}function _($){var z=$.graph();z.ranksep/=2,r.forEach($.edges(),function(ee){var Ae=$.edge(ee);Ae.minlen*=2,Ae.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?Ae.width+=Ae.labeloffset:Ae.height+=Ae.labeloffset)})}function k($){r.forEach($.edges(),function(z){var ee=$.edge(z);if(ee.width&&ee.height){var Ae=$.node(z.v),be=$.node(z.w),Le={rank:(be.rank-Ae.rank)/2+Ae.rank,e:z};h.addDummyNode($,"edge-proxy",Le,"_ep")}})}function L($){var z=0;r.forEach($.nodes(),function(ee){var Ae=$.node(ee);Ae.borderTop&&(Ae.minRank=$.node(Ae.borderTop).rank,Ae.maxRank=$.node(Ae.borderBottom).rank,z=r.max(z,Ae.maxRank))}),$.graph().maxRank=z}function U($){r.forEach($.nodes(),function(z){var ee=$.node(z);ee.dummy==="edge-proxy"&&($.edge(ee.e).labelRank=ee.rank,$.removeNode(z))})}function G($){var z=Number.POSITIVE_INFINITY,ee=0,Ae=Number.POSITIVE_INFINITY,be=0,Le=$.graph(),Ue=Le.marginx||0,at=Le.marginy||0;function lt(ct){var pt=ct.x,Ne=ct.y,ht=ct.width,nt=ct.height;z=Math.min(z,pt-ht/2),ee=Math.max(ee,pt+ht/2),Ae=Math.min(Ae,Ne-nt/2),be=Math.max(be,Ne+nt/2)}r.forEach($.nodes(),function(ct){lt($.node(ct))}),r.forEach($.edges(),function(ct){var pt=$.edge(ct);r.has(pt,"x")&<(pt)}),z-=Ue,Ae-=at,r.forEach($.nodes(),function(ct){var pt=$.node(ct);pt.x-=z,pt.y-=Ae}),r.forEach($.edges(),function(ct){var pt=$.edge(ct);r.forEach(pt.points,function(Ne){Ne.x-=z,Ne.y-=Ae}),r.has(pt,"x")&&(pt.x-=z),r.has(pt,"y")&&(pt.y-=Ae)}),Le.width=ee-z+Ue,Le.height=be-Ae+at}function W($){r.forEach($.edges(),function(z){var ee=$.edge(z),Ae=$.node(z.v),be=$.node(z.w),Le,Ue;ee.points?(Le=ee.points[0],Ue=ee.points[ee.points.length-1]):(ee.points=[],Le=be,Ue=Ae),ee.points.unshift(h.intersectRect(Ae,Le)),ee.points.push(h.intersectRect(be,Ue))})}function V($){r.forEach($.edges(),function(z){var ee=$.edge(z);if(r.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function K($){r.forEach($.edges(),function(z){var ee=$.edge(z);ee.reversed&&ee.points.reverse()})}function D($){r.forEach($.nodes(),function(z){if($.children(z).length){var ee=$.node(z),Ae=$.node(ee.borderTop),be=$.node(ee.borderBottom),Le=$.node(r.last(ee.borderLeft)),Ue=$.node(r.last(ee.borderRight));ee.width=Math.abs(Ue.x-Le.x),ee.height=Math.abs(be.y-Ae.y),ee.x=Le.x+ee.width/2,ee.y=Ae.y+ee.height/2}}),r.forEach($.nodes(),function(z){$.node(z).dummy==="border"&&$.removeNode(z)})}function X($){r.forEach($.edges(),function(z){if(z.v===z.w){var ee=$.node(z.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:z,label:$.edge(z)}),$.removeEdge(z)}})}function te($){var z=h.buildLayerMatrix($);r.forEach(z,function(ee){var Ae=0;r.forEach(ee,function(be,Le){var Ue=$.node(be);Ue.order=Le+Ae,r.forEach(Ue.selfEdges,function(at){h.addDummyNode($,"selfedge",{width:at.label.width,height:at.label.height,rank:Ue.rank,order:Le+ ++Ae,e:at.e,label:at.label},"_se")}),delete Ue.selfEdges})})}function ie($){r.forEach($.nodes(),function(z){var ee=$.node(z);if(ee.dummy==="selfedge"){var Ae=$.node(ee.e.v),be=Ae.x+Ae.width/2,Le=Ae.y,Ue=ee.x-be,at=Ae.height/2;$.setEdge(ee.e,ee.label),$.removeNode(z),ee.label.points=[{x:be+2*Ue/3,y:Le-at},{x:be+5*Ue/6,y:Le-at},{x:be+Ue,y:Le},{x:be+5*Ue/6,y:Le+at},{x:be+2*Ue/3,y:Le+at}],ee.label.x=ee.x,ee.label.y=ee.y}})}function re($,z){return r.mapValues(r.pick($,z),Number)}function xe($){var z={};return r.forEach($,function(ee,Ae){z[Ae.toLowerCase()]=ee}),z}return zm}var Vm,GM;function MJ(){if(GM)return Vm;GM=1;var r=jt(),e=Sr(),t=bi().Graph;Vm={debugOrdering:n};function n(i){var a=e.buildLayerMatrix(i),s=new t({compound:!0,multigraph:!0}).setGraph({});return r.forEach(i.nodes(),function(o){s.setNode(o,{label:o}),s.setParent(o,"layer"+i.node(o).rank)}),r.forEach(i.edges(),function(o){s.setEdge(o.v,o.w,{},o.name)}),r.forEach(a,function(o,A){var l="layer"+A;s.setNode(l,{rank:"same"}),r.reduce(o,function(c,u){return s.setEdge(c,u,{style:"invis"}),u})}),s}return Vm}var jm,KM;function OJ(){return KM||(KM=1,jm="0.8.5"),jm}var Wm,zM;function _J(){return zM||(zM=1,Wm={graphlib:bi(),layout:TJ(),debug:MJ(),util:{time:Sr().time,notime:Sr().notime},version:OJ()}),Wm}var SN=_J();const IJ=Qh(SN);class zd{constructor(e){this.id="dagre",this.options={},Object.assign(this.options,zd.defaultOptions,e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,e,Object.assign(Object.assign({},this.options),t))})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,e,Object.assign(Object.assign({},this.options),t))})}genericDagreLayout(e,t,n){return Je(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new SN.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=t.getAllNodes(),o=t.getAllEdges();[...s,...o].some(({id:l})=>Be(l))&&console.error("Dagre layout only support string id, it will convert number to string."),t.getAllNodes().forEach(l=>{const{id:c}=l,u=Object.assign({},l.data);if(i!==void 0){const[h,d]=zl(Te(i)?i(l):i);Object.assign(u,{width:h,height:d})}a.setNode(c.toString(),u)}),t.getAllEdges().forEach(({id:l,source:c,target:u})=>{a.setEdge(c.toString(),u.toString(),{id:l})}),IJ.layout(a);const A={nodes:[],edges:[]};return a.nodes().forEach(l=>{const c=a.node(l);A.nodes.push({id:l,data:c}),e&&t.mergeNodeData(l,c)}),a.edges().forEach(l=>{const c=a.edge(l),{id:u}=c,h=Dt(c,["id"]),{v:d,w:f}=l;A.edges.push({id:u,source:d,target:f,data:h}),e&&t.mergeEdgeData(u,h)}),A})}}zd.defaultOptions={};class JB{constructor(e){this.id=e.id||0,this.rx=e.rx,this.ry=e.ry,this.fx=0,this.fy=0,this.mass=e.mass,this.degree=e.degree,this.g=e.g||0}distanceTo(e){const t=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(t,n)}setPos(e,t){this.rx=e,this.ry=t}resetForce(){this.fx=0,this.fy=0}addForce(e){const t=e.rx-this.rx,n=e.ry-this.ry;let i=Math.hypot(t,n);i=i<1e-4?1e-4:i;const a=this.g*(this.degree+1)*(e.degree+1)/i;this.fx+=a*t/i,this.fy+=a*n/i}in(e){return e.contains(this.rx,this.ry)}add(e){const t=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/t,i=(this.ry*this.mass+e.ry*e.mass)/t,a=this.degree+e.degree,s={rx:n,ry:i,mass:t,degree:a};return new JB(s)}}class _o{constructor(e){this.xmid=e.xmid,this.ymid=e.ymid,this.length=e.length,this.massCenter=e.massCenter||[0,0],this.mass=e.mass||1}getLength(){return this.length}contains(e,t){const n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&t<=this.ymid+n&&t>=this.ymid-n}NW(){const e=this.xmid-this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}NE(){const e=this.xmid+this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}SW(){const e=this.xmid-this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}SE(){const e=this.xmid+this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}}class Io{constructor(e){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,e!=null&&(this.quad=e)}insert(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new Io(this.quad.NW()),this.NE=new Io(this.quad.NE()),this.SW=new Io(this.quad.SW()),this.SE=new Io(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e))}_putBody(e){this.quad&&(e.in(this.quad.NW())&&this.NW?this.NW.insert(e):e.in(this.quad.NE())&&this.NE?this.NE.insert(e):e.in(this.quad.SW())&&this.SW?this.SW.insert(e):e.in(this.quad.SE())&&this.SE&&this.SE.insert(e))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{const t=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);t/n<this.theta?e.addForce(this.body):(this.NW&&this.NW.updateForce(e),this.NE&&this.NE.updateForce(e),this.SW&&this.SW.updateForce(e),this.SE&&this.SE.updateForce(e))}}}const kJ={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class LJ{constructor(e={}){this.options=e,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},kJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,e,t)})}genericForceAtlas2Layout(e,t,n){return Je(this,void 0,void 0,function*(){const i=t.getAllEdges(),a=t.getAllNodes(),s=this.formatOptions(n,a.length),{width:o,height:A,prune:l,maxIteration:c,nodeSize:u,center:h}=s;if(!(a!=null&&a.length)||a.length===1)return to(t,e,h);const d=a.map(p=>Dr(p,[o,A])),f=i.filter(p=>{const{source:y,target:m}=p;return y!==m}),g=new Mn({nodes:d,edges:f}),v=this.getSizes(g,u);if(this.run(g,t,c,v,e,s),l){for(let y=0;y<f.length;y+=1){const{source:m,target:B}=f[y],C=g.getDegree(m),S=g.getDegree(m);if(C<=1){const F=g.getNode(B);g.mergeNodeData(m,{x:F.data.x,y:F.data.y})}else if(S<=1){const F=g.getNode(m);g.mergeNodeData(B,{x:F.data.x,y:F.data.y})}}const p=Object.assign(Object.assign({},s),{prune:!1,barnesHut:!1});this.run(g,t,100,v,e,p)}return{nodes:d,edges:i}})}getSizes(e,t){const n=e.getAllNodes(),i={};for(let a=0;a<n.length;a+=1){const s=n[a];i[s.id]=kB(t,void 0)(s)}return i}formatOptions(e={},t){const n=Object.assign(Object.assign({},this.options),e),{center:i,width:a,height:s,barnesHut:o,prune:A,maxIteration:l,kr:c,kg:u}=n;return n.width=!a&&typeof window<"u"?window.innerWidth:a,n.height=!s&&typeof window<"u"?window.innerHeight:s,n.center=i||[n.width/2,n.height/2],o===void 0&&t>250&&(n.barnesHut=!0),A===void 0&&t>100&&(n.prune=!0),l===0&&!A?(n.maxIteration=250,t<=200&&t>100?n.maxIteration=1e3:t>200&&(n.maxIteration=1200)):l===0&&A&&(n.maxIteration=100,t<=200&&t>100?n.maxIteration=500:t>200&&(n.maxIteration=950)),c||(n.kr=50,t>100&&t<=500?n.kr=20:t>500&&(n.kr=1)),u||(n.kg=20,t>100&&t<=500?n.kg=10:t>500&&(n.kg=1)),n}run(e,t,n,i,a,s){const{kr:o,barnesHut:A,onTick:l}=s,c=e.getAllNodes();let u=0,h=n;const d={},f={},g={};for(let v=0;v<c.length;v+=1){const{data:p,id:y}=c[v];if(d[y]=[0,0],A){const m={id:v,rx:p.x,ry:p.y,mass:1,g:o,degree:e.getDegree(y)};g[y]=new JB(m)}}for(;h>0;)u=this.oneStep(e,{iter:h,preventOverlapIters:50,krPrime:100,sg:u,forces:d,preForces:f,bodies:g,sizes:i},s),h--,l==null||l({nodes:c,edges:t.getAllEdges()});return e}oneStep(e,t,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:A,bodies:l,sizes:c}=t;let{forces:u}=t;const{preventOverlap:h,barnesHut:d}=n,f=e.getAllNodes();for(let g=0;g<f.length;g+=1){const{id:v}=f[g];A[v]=[...u[v]],u[v]=[0,0]}return u=this.getAttrForces(e,i,a,c,u,n),d&&(h&&i>a||!h)?u=this.getOptRepGraForces(e,u,l,n):u=this.getRepGraForces(e,i,a,u,s,c,n),this.updatePos(e,u,A,o,n)}getAttrForces(e,t,n,i,a,s){const{preventOverlap:o,dissuadeHubs:A,mode:l,prune:c}=s,u=e.getAllEdges();for(let h=0;h<u.length;h+=1){const{source:d,target:f}=u[h],g=e.getNode(d),v=e.getNode(f),p=e.getDegree(d),y=e.getDegree(f);if(c&&(p<=1||y<=1))continue;const m=[v.data.x-g.data.x,v.data.y-g.data.y];let B=Math.hypot(m[0],m[1]);B=B<1e-4?1e-4:B,m[0]=m[0]/B,m[1]=m[1]/B,o&&t<n&&(B=B-i[d]-i[f]);let C=B,S=C;l==="linlog"&&(C=Math.log(1+B),S=C),A&&(C=B/p,S=B/y),o&&t<n&&B<=0?(C=0,S=0):o&&t<n&&B>0&&(C=B,S=B),a[d][0]+=C*m[0],a[f][0]-=S*m[0],a[d][1]+=C*m[1],a[f][1]-=S*m[1]}return a}getOptRepGraForces(e,t,n,i){const{kg:a,center:s,prune:o}=i,A=e.getAllNodes(),l=A.length;let c=9e10,u=-9e10,h=9e10,d=-9e10;for(let y=0;y<l;y+=1){const{id:m,data:B}=A[y];o&&e.getDegree(m)<=1||(n[m].setPos(B.x,B.y),B.x>=u&&(u=B.x),B.x<=c&&(c=B.x),B.y>=d&&(d=B.y),B.y<=h&&(h=B.y))}const f=Math.max(u-c,d-h),g={xmid:(u+c)/2,ymid:(d+h)/2,length:f,massCenter:s,mass:l},v=new _o(g),p=new Io(v);for(let y=0;y<l;y+=1){const{id:m}=A[y];o&&e.getDegree(m)<=1||n[m].in(v)&&p.insert(n[m])}for(let y=0;y<l;y+=1){const{id:m,data:B}=A[y],C=e.getDegree(m);if(o&&C<=1)continue;n[m].resetForce(),p.updateForce(n[m]),t[m][0]-=n[m].fx,t[m][1]-=n[m].fy;const S=[B.x-s[0],B.y-s[1]];let F=Math.hypot(S[0],S[1]);F=F<1e-4?1e-4:F,S[0]=S[0]/F,S[1]=S[1]/F;const T=a*(C+1);t[m][0]-=T*S[0],t[m][1]-=T*S[1]}return t}getRepGraForces(e,t,n,i,a,s,o){const{preventOverlap:A,kr:l,kg:c,center:u,prune:h}=o,d=e.getAllNodes(),f=d.length;for(let g=0;g<f;g+=1){const v=d[g],p=e.getDegree(v.id);for(let C=g+1;C<f;C+=1){const S=d[C],F=e.getDegree(S.id);if(h&&(p<=1||F<=1))continue;const T=[S.data.x-v.data.x,S.data.y-v.data.y];let O=Math.hypot(T[0],T[1]);O=O<1e-4?1e-4:O,T[0]=T[0]/O,T[1]=T[1]/O,A&&t<n&&(O=O-s[v.id]-s[S.id]);let _=l*(p+1)*(F+1)/O;A&&t<n&&O<0?_=a*(p+1)*(F+1):A&&t<n&&O===0?_=0:A&&t<n&&O>0&&(_=l*(p+1)*(F+1)/O),i[v.id][0]-=_*T[0],i[S.id][0]+=_*T[0],i[v.id][1]-=_*T[1],i[S.id][1]+=_*T[1]}const y=[v.data.x-u[0],v.data.y-u[1]],m=Math.hypot(y[0],y[1]);y[0]=y[0]/m,y[1]=y[1]/m;const B=c*(p+1);i[v.id][0]-=B*y[0],i[v.id][1]-=B*y[1]}return i}updatePos(e,t,n,i,a){const{ks:s,tao:o,prune:A,ksmax:l}=a,c=e.getAllNodes(),u=c.length,h=[],d=[];let f=0,g=0,v=i;for(let y=0;y<u;y+=1){const{id:m}=c[y],B=e.getDegree(m);if(A&&B<=1)continue;const C=[t[m][0]-n[m][0],t[m][1]-n[m][1]],S=Math.hypot(C[0],C[1]),F=[t[m][0]+n[m][0],t[m][1]+n[m][1]],T=Math.hypot(F[0],F[1]);h[y]=S,d[y]=T/2,f+=(B+1)*h[y],g+=(B+1)*d[y]}const p=v;v=o*g/f,p!==0&&(v=v>1.5*p?1.5*p:v);for(let y=0;y<u;y+=1){const{id:m,data:B}=c[y],C=e.getDegree(m);if(A&&C<=1||Be(B.fx)&&Be(B.fy))continue;let S=s*v/(1+v*Math.sqrt(h[y])),F=Math.hypot(t[m][0],t[m][1]);F=F<1e-4?1e-4:F;const T=l/F;S=S>T?T:S;const O=S*t[m][0],_=S*t[m][1];e.mergeNodeData(m,{x:B.x+O,y:B.y+_})}return v}}const QJ={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},NJ=800;class UJ{constructor(e={}){this.options=e,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},QJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,e,t)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(e=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;n<e;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const t={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&t.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),t}genericFruchtermanLayout(e,t,n){return Je(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:A,clustering:l,nodeClusterBy:c,maxIteration:u,onTick:h}=i,d=t.getAllNodes(),f=t.getAllEdges();if(!(d!=null&&d.length)){const m={nodes:[],edges:f};return this.lastResult=m,m}if(d.length===1){e&&t.mergeNodeData(d[0].id,{x:A[0],y:A[1],z:a===3?A[2]:void 0});const m={nodes:[Object.assign(Object.assign({},d[0]),{data:Object.assign(Object.assign({},d[0].data),{x:A[0],y:A[1],z:a===3?A[2]:void 0})})],edges:f};return this.lastResult=m,m}const g=d.map(m=>Dr(m,[s,o])),v=new Mn({nodes:g,edges:f}),p={};if(l&&g.forEach(m=>{const B=m.data[c];p[B]||(p[B]={name:B,cx:0,cy:0,count:0})}),this.lastLayoutNodes=g,this.lastLayoutEdges=f,this.lastAssign=e,this.lastGraph=v,this.lastOptions=i,this.lastClusterMap=p,typeof window>"u")return;let y=0;return new Promise(m=>{this.timeInterval=window.setInterval(()=>{if(!this.running){m({nodes:g,edges:f});return}this.runOneStep(v,p,i),e&&g.forEach(({id:B,data:C})=>t.mergeNodeData(B,{x:C.x,y:C.y,z:a===3?C.z:void 0})),h==null||h({nodes:g,edges:f}),y++,y>=u&&(window.clearInterval(this.timeInterval),m({nodes:g,edges:f}))},0),this.running=!0})})}formatOptions(e={}){const t=Object.assign(Object.assign({},this.options),e),{clustering:n,nodeClusterBy:i}=t,{center:a,width:s,height:o}=t;return t.width=!s&&typeof window<"u"?window.innerWidth:s,t.height=!o&&typeof window<"u"?window.innerHeight:o,t.center=a||[t.width/2,t.height/2],t.clustering=n&&!!i,t}runOneStep(e,t,n){const{dimensions:i,height:a,width:s,gravity:o,center:A,speed:l,clustering:c,nodeClusterBy:u,clusterGravity:h}=n,d=a*s,f=Math.sqrt(d)/10,g=e.getAllNodes(),v=d/(g.length+1),p=Math.sqrt(v),y={};if(this.applyCalculate(e,y,p,v),c){for(const B in t)t[B].cx=0,t[B].cy=0,t[B].count=0;g.forEach(B=>{const{data:C}=B,S=t[C[u]];Be(C.x)&&(S.cx+=C.x),Be(C.y)&&(S.cy+=C.y),S.count++});for(const B in t)t[B].cx/=t[B].count,t[B].cy/=t[B].count;const m=h||o;g.forEach((B,C)=>{const{id:S,data:F}=B;if(!Be(F.x)||!Be(F.y))return;const T=t[F[u]],O=Math.sqrt((F.x-T.cx)*(F.x-T.cx)+(F.y-T.cy)*(F.y-T.cy)),_=p*m;y[S].x-=_*(F.x-T.cx)/O,y[S].y-=_*(F.y-T.cy)/O})}g.forEach((m,B)=>{const{id:C,data:S}=m;if(!Be(S.x)||!Be(S.y))return;const F=.01*p*o;y[C].x-=F*(S.x-A[0]),y[C].y-=F*(S.y-A[1]),i===3&&(y[C].z-=F*(S.z-A[2]))}),g.forEach((m,B)=>{const{id:C,data:S}=m;if(Be(S.fx)&&Be(S.fy)){S.x=S.fx,S.y=S.fy,i===3&&(S.z=S.fz);return}if(!Be(S.x)||!Be(S.y))return;const F=Math.sqrt(y[C].x*y[C].x+y[C].y*y[C].y+(i===3?y[C].z*y[C].z:0));if(F>0){const T=Math.min(f*(l/NJ),F);e.mergeNodeData(C,{x:S.x+y[C].x/F*T,y:S.y+y[C].y/F*T,z:i===3?S.z+y[C].z/F*T:void 0})}})}applyCalculate(e,t,n,i){this.calRepulsive(e,t,i),this.calAttractive(e,t,n)}calRepulsive(e,t,n){const i=e.getAllNodes();i.forEach(({data:a,id:s},o)=>{t[s]={x:0,y:0,z:0},i.forEach(({data:A,id:l},c)=>{if(o<=c||!Be(a.x)||!Be(A.x)||!Be(a.y)||!Be(A.y))return;let u=a.x-A.x,h=a.y-A.y,d=this.options.dimensions===3?a.z-A.z:0,f=u*u+h*h+d*d;f===0&&(f=1,u=.01,h=.01,d=.01);const g=n/f,v=u*g,p=h*g,y=d*g;t[s].x+=v,t[s].y+=p,t[l].x-=v,t[l].y-=p,this.options.dimensions===3&&(t[s].z+=y,t[l].z-=y)})})}calAttractive(e,t,n){e.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:A}=e.getNode(s),{data:l}=e.getNode(o);if(!Be(l.x)||!Be(A.x)||!Be(l.y)||!Be(A.y))return;const c=l.x-A.x,u=l.y-A.y,h=this.options.dimensions===3?l.z-A.z:0,d=Math.sqrt(c*c+u*u+h*h)/n,f=c*d,g=u*d,v=h*d;t[s].x+=f,t[s].y+=g,t[o].x-=f,t[o].y-=g,this.options.dimensions===3&&(t[s].z+=v,t[o].z-=v)})}}const PJ={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class RJ{constructor(e={}){this.options=e,this.id="grid",this.options=Object.assign(Object.assign({},PJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericGridLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,e,t)})}genericGridLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:A,rows:l,cols:c,nodeSpacing:u,nodeSize:h,width:d,height:f,position:g}=i;let{sortBy:v}=i;const p=t.getAllNodes(),y=t.getAllEdges(),m=p==null?void 0:p.length;if(!m||m===1)return to(t,e,a);const B=p.map(W=>Dr(W));v!=="id"&&(!At(v)||B[0].data[v]===void 0)&&(v="degree"),v==="degree"?B.sort((W,V)=>t.getDegree(V.id,"both")-t.getDegree(W.id,"both")):v==="id"?B.sort((W,V)=>Be(V.id)&&Be(W.id)?V.id-W.id:`${W.id}`.localeCompare(`${V.id}`)):B.sort((W,V)=>V.data[v]-W.data[v]);const C=!d&&typeof window<"u"?window.innerWidth:d,S=!f&&typeof window<"u"?window.innerHeight:f,F=m,T={rows:l,cols:c};if(l!=null&&c!=null)T.rows=l,T.cols=c;else if(l!=null&&c==null)T.rows=l,T.cols=Math.ceil(F/T.rows);else if(l==null&&c!=null)T.cols=c,T.rows=Math.ceil(F/T.cols);else{const W=Math.sqrt(F*S/C);T.rows=Math.round(W),T.cols=Math.round(C/S*W)}if(T.rows=Math.max(T.rows,1),T.cols=Math.max(T.cols,1),T.cols*T.rows>F){const W=du(T),V=fu(T);(W-1)*V>=F?du(T,W-1):(V-1)*W>=F&&fu(T,V-1)}else for(;T.cols*T.rows<F;){const W=du(T),V=fu(T);(V+1)*W>=F?fu(T,V+1):du(T,W+1)}let O=s?0:C/T.cols,_=s?0:S/T.rows;if(A||u){const W=Us(10,u),V=IB(30,h,!1);B.forEach(K=>{(!K.data.x||!K.data.y)&&(K.data.x=0,K.data.y=0);const D=t.getNode(K.id),[X,te]=zl(V(D)||30),ie=W!==void 0?W(K):o,re=X+ie,xe=te+ie;O=Math.max(O,re),_=Math.max(_,xe)})}const k={},L={row:0,col:0},U={};for(let W=0;W<B.length;W++){const V=B[W];let K;if(g&&(K=g(t.getNode(V.id))),K&&(K.row!==void 0||K.col!==void 0)){const D={row:K.row,col:K.col};if(D.col===void 0)for(D.col=0;x1(k,D);)D.col++;else if(D.row===void 0)for(D.row=0;x1(k,D);)D.row++;U[V.id]=D,FN(k,D)}DJ(V,a,O,_,U,T,L,k)}const G={nodes:B,edges:y};return e&&B.forEach(W=>{t.mergeNodeData(W.id,{x:W.data.x,y:W.data.y})}),G})}}const du=(r,e)=>{let t;const n=r.rows||5,i=r.cols||5;return e==null?t=Math.min(n,i):Math.min(n,i)===r.rows?r.rows=e:r.cols=e,t},fu=(r,e)=>{let t;const n=r.rows||5,i=r.cols||5;return e==null?t=Math.max(n,i):Math.max(n,i)===r.rows?r.rows=e:r.cols=e,t},x1=(r,e)=>r[`c-${e.row}-${e.col}`]||!1,FN=(r,e)=>r[`c-${e.row}-${e.col}`]=!0,VM=(r,e)=>{const t=r.cols||5;e.col++,e.col>=t&&(e.col=0,e.row++)},DJ=(r,e,t,n,i,a,s,o)=>{let A,l;const c=i[r.id];if(c)A=c.col*t+t/2+e[0],l=c.row*n+n/2+e[1];else{for(;x1(o,s);)VM(a,s);A=s.col*t+t/2+e[0],l=s.row*n+n/2+e[1],FN(o,s),VM(a,s)}r.data.x=A,r.data.y=l},HJ=(r,e,t)=>{try{const n=Ga.mul(Ga.pow(e,2),-.5),i=n.mean("row"),a=n.mean("column"),s=n.mean();n.add(s).subRowVector(i).subColumnVector(a);const o=new wQ(n),A=Ga.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(l=>Ga.mul([l],[A]).toJSON()[0].splice(0,r))}catch{const i=[];for(let a=0;a<e.length;a++){const s=Math.random()*t,o=Math.random()*t;i.push([s,o])}return i}},GJ=800,KJ={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},zJ=(r,e)=>{const t=Object.assign(Object.assign({},KJ),e),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:A,focusIdx:l,radii:c=[],nodeSizeFunc:u}=t,h=r.getAllNodes(),d=[],f=a/10;for(let g=0;g<i;g++)n.forEach((v,p)=>{d[p]={x:0,y:0}}),VJ(h,n,d,s,c,u),jJ(n,d,o,A,l,f,a,c);return n},VJ=(r,e,t,n,i,a)=>{e.forEach((s,o)=>{t[o]={x:0,y:0},e.forEach((A,l)=>{if(o===l||i[o]!==i[l])return;let c=s.x-A.x,u=s.y-A.y,h=Math.sqrt(c*c+u*u);if(h===0){h=1;const d=o>l?1:-1;c=.01*d,u=.01*d}if(h<a(r[o])/2+a(r[l])/2){const d=n*n/h;t[o].x+=c/h*d,t[o].y+=u/h*d}})})},jJ=(r,e,t,n,i,a,s,o)=>{const A=a||s/10;return n&&e.forEach((l,c)=>{const u=r[c].x-r[i].x,h=r[c].y-r[i].y,d=Math.sqrt(u*u+h*h);let f=h/d,g=-u/d;const v=Math.sqrt(l.x*l.x+l.y*l.y);let p=Math.acos((f*l.x+g*l.y)/v);p>Math.PI/2&&(p-=Math.PI/2,f*=-1,g*=-1);const y=Math.cos(p)*v;l.x=f*y,l.y=g*y}),r.forEach((l,c)=>{if(c===i)return;const u=Math.sqrt(e[c].x*e[c].x+e[c].y*e[c].y);if(u>0&&c!==i){const h=Math.min(A*(t/GJ),u);if(l.x+=e[c].x/u*h,l.y+=e[c].y/u*h,n){let d=l.x-r[i].x,f=l.y-r[i].y;const g=Math.sqrt(d*d+f*f);d=d/g*o[c],f=f/g*o[c],l.x=r[i].x+d,l.y=r[i].y+f}}}),r},WJ={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class qJ{constructor(e={}){this.options=e,this.id="radial",this.options=Object.assign(Object.assign({},WJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,e,t)})}genericRadialLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:A,unitRadius:l,nodeSize:c,nodeSpacing:u,strictRadial:h,preventOverlap:d,maxPreventOverlapIteration:f,sortBy:g,linkDistance:v=50,sortStrength:p=10,maxIteration:y=1e3}=i,m=t.getAllNodes(),B=t.getAllEdges(),C=!a&&typeof window<"u"?window.innerWidth:a,S=!s&&typeof window<"u"?window.innerHeight:s,F=o||[C/2,S/2];if(!(m!=null&&m.length)||m.length===1)return to(t,e,F);let T=m[0];if(At(A)){for(let Ae=0;Ae<m.length;Ae++)if(m[Ae].id===A){T=m[Ae];break}}else T=A||m[0];const O=XJ(m,T.id),_=gQ({nodes:m,edges:B}),k=fQ(_),L=JJ(k,O);ZJ(k,O,L+1);const U=k[O];let G=C-F[0]>F[0]?F[0]:C-F[0],W=S-F[1]>F[1]?F[1]:S-F[1];G===0&&(G=C/2),W===0&&(W=S/2);const V=Math.min(G,W),K=Math.max(...U),D=[],X=l||V/K;U.forEach((Ae,be)=>{D[be]=Ae*X});const te=$J(m,k,v,D,X,g,p),ie=YJ(te),re=HJ(v,te,v);let xe=re.map(([Ae,be])=>({x:(isNaN(Ae)?Math.random()*v:Ae)-re[O][0],y:(isNaN(be)?Math.random()*v:be)-re[O][1]}));this.run(y,xe,ie,te,D,O);let $;if(d){$=kB(c,u);const Ae={nodes:m,nodeSizeFunc:$,positions:xe,radii:D,height:S,width:C,strictRadial:!!h,focusIdx:O,iterations:f||200,k:xe.length/4.5};xe=zJ(t,Ae)}const z=[];return xe.forEach((Ae,be)=>{const Le=Dr(m[be]);Le.data.x=Ae.x+F[0],Le.data.y=Ae.y+F[1],z.push(Le)}),e&&z.forEach(Ae=>t.mergeNodeData(Ae.id,{x:Ae.data.x,y:Ae.data.y})),{nodes:z,edges:B}})}run(e,t,n,i,a,s){for(let o=0;o<=e;o++){const A=o/e;this.oneIteration(A,t,a,i,n,s)}}oneIteration(e,t,n,i,a,s){const o=1-e;t.forEach((A,l)=>{const c=uC(A,{x:0,y:0}),u=c===0?0:1/c;if(l===s)return;let h=0,d=0,f=0;t.forEach((v,p)=>{if(l===p)return;const y=uC(A,v),m=y===0?0:1/y,B=i[p][l];f+=a[l][p],h+=a[l][p]*(v.x+B*(A.x-v.x)*m),d+=a[l][p]*(v.y+B*(A.y-v.y)*m)});const g=n[l]===0?0:1/n[l];f*=o,f+=e*g*g,h*=o,h+=e*g*A.x*u,A.x=h/f,d*=o,d+=e*g*A.y*u,A.y=d/f})}}const $J=(r,e,t,n,i,a,s)=>{if(!r)return[];const o=[];if(e){const A={};e.forEach((l,c)=>{const u=[];l.forEach((h,d)=>{var f,g;if(c===d)u.push(0);else if(n[c]===n[d])if(a==="data")u.push(h*(Math.abs(c-d)*s)/(n[c]/i));else if(a){let v,p;if(A[r[c].id])v=A[r[c].id];else{const y=(a==="id"?r[c].id:(f=r[c].data)===null||f===void 0?void 0:f[a])||0;At(y)?v=y.charCodeAt(0):v=y,A[r[c].id]=v}if(A[r[d].id])p=A[r[d].id];else{const y=(a==="id"?r[d].id:(g=r[d].data)===null||g===void 0?void 0:g[a])||0;At(y)?p=y.charCodeAt(0):p=y,A[r[d].id]=p}u.push(h*(Math.abs(v-p)*s)/(n[c]/i))}else u.push(h*t/(n[c]/i));else{const v=(t+i)/2;u.push(h*v)}}),o.push(u)})}return o},YJ=r=>{const e=r.length,t=r[0].length,n=[];for(let i=0;i<e;i++){const a=[];for(let s=0;s<t;s++)r[i][s]!==0?a.push(1/(r[i][s]*r[i][s])):a.push(0);n.push(a)}return n},XJ=(r,e)=>{let t=-1;return r.forEach((n,i)=>{n.id===e&&(t=i)}),Math.max(t,0)},ZJ=(r,e,t)=>{const n=r.length;for(let i=0;i<n;i++)if(r[e][i]===1/0){r[e][i]=t,r[i][e]=t;for(let a=0;a<n;a++)r[i][a]!==1/0&&r[e][a]===1/0&&(r[e][a]=t+r[i][a],r[a][e]=t+r[i][a])}for(let i=0;i<n;i++)if(i!==e){for(let a=0;a<n;a++)if(r[i][a]===1/0){let s=Math.abs(r[e][i]-r[e][a]);s=s===0?1:s,r[i][a]=s}}},JJ=(r,e)=>{let t=0;for(let n=0;n<r[e].length;n++)r[e][n]!==1/0&&(t=r[e][n]>t?r[e][n]:t);return t},eee={center:[0,0],width:300,height:300};class tee{constructor(e={}){this.options=e,this.id="random",this.options=Object.assign(Object.assign({},eee),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,e,t)})}genericRandomLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,A=t.getAllNodes(),l=.9,c=!s&&typeof window<"u"?window.innerWidth:s,u=!o&&typeof window<"u"?window.innerHeight:o,h=a||[c/2,u/2],d=[];return A&&A.forEach(g=>{d.push({id:g.id,data:{x:(Math.random()-.5)*l*c+h[0],y:(Math.random()-.5)*l*u+h[1]}})}),e&&d.forEach(g=>t.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:t.getAllEdges()}})}}const TN=Symbol("Comlink.proxy"),nee=Symbol("Comlink.endpoint"),MN=Symbol("Comlink.releaseProxy"),qm=Symbol("Comlink.finalizer"),Qu=Symbol("Comlink.thrown"),ON=r=>typeof r=="object"&&r!==null||typeof r=="function",ree={canHandle:r=>ON(r)&&r[TN],serialize(r){const{port1:e,port2:t}=new MessageChannel;return IN(r,e),[t,[t]]},deserialize(r){return r.start(),LN(r)}},iee={canHandle:r=>ON(r)&&Qu in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},_N=new Map([["proxy",ree],["throw",iee]]);function aee(r,e){for(const t of r)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function IN(r,e=globalThis,t=["*"]){e.addEventListener("message",function n(i){if(!i||!i.data)return;if(!aee(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),A=(i.data.argumentList||[]).map(xs);let l;try{const c=o.slice(0,-1).reduce((h,d)=>h[d],r),u=o.reduce((h,d)=>h[d],r);switch(s){case"GET":l=u;break;case"SET":c[o.slice(-1)[0]]=xs(i.data.value),l=!0;break;case"APPLY":l=u.apply(c,A);break;case"CONSTRUCT":{const h=new u(...A);l=uee(h)}break;case"ENDPOINT":{const{port1:h,port2:d}=new MessageChannel;IN(r,d),l=cee(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(c){l={value:c,[Qu]:0}}Promise.resolve(l).catch(c=>({value:c,[Qu]:0})).then(c=>{const[u,h]=Mh(c);e.postMessage(Object.assign(Object.assign({},u),{id:a}),h),s==="RELEASE"&&(e.removeEventListener("message",n),kN(e),qm in r&&typeof r[qm]=="function"&&r[qm]())}).catch(c=>{const[u,h]=Mh({value:new TypeError("Unserializable return value"),[Qu]:0});e.postMessage(Object.assign(Object.assign({},u),{id:a}),h)})}),e.start&&e.start()}function see(r){return r.constructor.name==="MessagePort"}function kN(r){see(r)&&r.close()}function LN(r,e){const t=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=t.get(a.id);if(s)try{s(a)}finally{t.delete(a.id)}}),C1(r,t,[],e)}function gu(r){if(r)throw new Error("Proxy has been released and is not useable")}function QN(r){return To(r,new Map,{type:"RELEASE"}).then(()=>{kN(r)})}const Fh=new WeakMap,Th="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(Fh.get(r)||0)-1;Fh.set(r,e),e===0&&QN(r)});function oee(r,e){const t=(Fh.get(e)||0)+1;Fh.set(e,t),Th&&Th.register(r,e,r)}function Aee(r){Th&&Th.unregister(r)}function C1(r,e,t=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(gu(i),o===MN)return()=>{Aee(a),QN(r),e.clear(),i=!0};if(o==="then"){if(t.length===0)return{then:()=>a};const A=To(r,e,{type:"GET",path:t.map(l=>l.toString())}).then(xs);return A.then.bind(A)}return C1(r,e,[...t,o])},set(s,o,A){gu(i);const[l,c]=Mh(A);return To(r,e,{type:"SET",path:[...t,o].map(u=>u.toString()),value:l},c).then(xs)},apply(s,o,A){gu(i);const l=t[t.length-1];if(l===nee)return To(r,e,{type:"ENDPOINT"}).then(xs);if(l==="bind")return C1(r,e,t.slice(0,-1));const[c,u]=jM(A);return To(r,e,{type:"APPLY",path:t.map(h=>h.toString()),argumentList:c},u).then(xs)},construct(s,o){gu(i);const[A,l]=jM(o);return To(r,e,{type:"CONSTRUCT",path:t.map(c=>c.toString()),argumentList:A},l).then(xs)}});return oee(a,r),a}function lee(r){return Array.prototype.concat.apply([],r)}function jM(r){const e=r.map(Mh);return[e.map(t=>t[0]),lee(e.map(t=>t[1]))]}const NN=new WeakMap;function cee(r,e){return NN.set(r,e),r}function uee(r){return Object.assign(r,{[TN]:!0})}function Mh(r){for(const[e,t]of _N)if(t.canHandle(r)){const[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},NN.get(r)||[]]}function xs(r){switch(r.type){case"HANDLER":return _N.get(r.name).deserialize(r.value);case"RAW":return r.value}}function To(r,e,t,n){return new Promise(i=>{const a=hee();e.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},t),n)})}function hee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class dee extends gd{constructor(e,t,n){super(),this.graph=e,this.layout=t,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=LN(new Worker(new URL("https://registry.npmmirror.com/@gkd-kit/inspect/0.0.1768900570874/files/dist/assets/worker-NxeETyFs.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var e;return Je(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const t=this.layout.options,{onTick:n}=t,i=Dt(t,["onTick"]),a={};Object.keys(i).forEach(l=>{Te(i[l])||(a[l]=i[l])});const s={layout:{id:this.layout.id,options:a,iterations:(e=this.options)===null||e===void 0?void 0:e.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[A]=yield this.proxy.calculateLayout(s,[o]);return A})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[MN]()}isRunning(){return this.running}}var fee=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class Vd extends vd{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const e=this.context.model.getRootsData();if(!(Qi(e)||e.length>2))return e[0]}formatSize(e){const t=typeof e=="function"?e:()=>e;return n=>Gr(t(n))}doLayout(e,t){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=t,{model:A}=this.context,l=this.formatSize(s);let c=l(e)[0]+i(e);const u=(m,B=0)=>{var C;return B+=n*((m.children||[]).length+1),(C=m.children)===null||C===void 0||C.forEach(S=>{var F;(F=A.getNodeLikeDatum(S).children)===null||F===void 0||F.forEach(O=>{const _=A.getNodeLikeDatum(O);B=u(_,B)})}),B},h=m=>{if(m.depth===1)return c;const B=A.getParentData(m.id,"tree");if(yo(m)){const C=A.getParentData(B.id,"tree"),S=g(m)-g(C);return h(B)+S*n/a}else{const C=(B.children||[]).indexOf(m.id),S=A.getNodeData((B.children||[]).slice(C));return d(B)-S.reduce((F,T)=>F+u(T),0)-l(B)[0]/2}},d=mw(m=>{if($m(m))return l(m)[0]/2;const B=A.getParentData(m.id,"tree");if(yo(m))return h(m)+u(m)+l(m)[0]/2;{const C=g(m)-g(B),S=n/a;return h(m)+C*S}},m=>m.id),f=m=>g(A.getParentData(m,"tree")),g=mw(m=>{if($m(m))return o/2;if(yo(m)){const B=A.getParentData(m.id,"tree"),C=B.children.indexOf(m.id);if(C===0)return f(B.id)+a;const S=A.getNodeLikeDatum(B.children[C-1]);if(Qi(S.children))return g(S)+a;const F=A.getDescendantsData(S.id);return Math.max(...F.map(T=>yo(T)?f(T.id):g(T)))+a}else{if(Qi(m.children))return f(m.id)+a;const B=A.getNodeLikeDatum(m.children.slice(-1)[0]);if(Qi(B.children))return g(B)+a;const C=A.getDescendantsData(m.id).slice(-1)[0];return(yo(C)?f(C.id):g(C))+a}},m=>m.id);let v=0;const p={nodes:[],edges:[]},y=m=>{var B;(B=m.children)===null||B===void 0||B.forEach(O=>y(A.getNodeLikeDatum(O)));const C=g(m),S=d(m);if(p.nodes.push({id:m.id,x:S,y:C}),$m(m))return;const F=A.getRelatedEdgesData(m.id,"in")[0],T=[h(m),yo(m)?C:f(m.id)];p.edges.push({id:Z(F),controlPoints:[T],relatedNodeId:m.id}),v=Math.max(v,S+i(m)),m.depth===1&&(c=v)};return y(e),p}placeAlterative(e,t){const n=(t.children||[]).filter((o,A)=>A%2!==0);if(n.length===0)return e;const{model:i}=this.context,a=e.nodes.find(o=>o.id===t.id).y,s=o=>{const A=i.getAncestorsData(o,"tree");if(Qi(A))return!1;const l=A.length===1?o:A[A.length-2].id;return n.includes(l)};e.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),e.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(A=>[A[0],2*a-A[1]]))})}rightToLeft(e,t){return e.nodes.forEach(n=>n.x=t.width-n.x),e.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[t.width-i[0],i[1]])}),e}execute(e,t){return fee(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},Vd.defaultOptions),this.options),t),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return e;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(e.nodes||[]).map(h=>o(h)[1]))),n.hGap||(n.hGap=Math.max(...(e.nodes||[]).map(h=>o(h)[0])));let A=this.doLayout(s,n);this.placeAlterative(A,s),i==="RL"&&(A=this.rightToLeft(A,n));const{model:l}=this.context,c=[],u=[];return A.nodes.forEach(h=>{const{id:d,x:f,y:g}=h,v=l.getNodeLikeDatum(d);c.push(WM(v,{x:f,y:g}))}),A.edges.forEach(h=>{const{id:d,controlPoints:f}=h,g=l.getEdgeDatum(d);u.push(WM(g,{controlPoints:f}))}),{nodes:c,edges:u}})}}Vd.defaultOptions={direction:"RL",getRibSep:()=>60};const WM=(r,e)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),e)}),$m=r=>r.depth===0,yo=r=>(r.depth||(r.depth=0))%2===0;var gee=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class jd extends vd{constructor(){super(...arguments),this.id="snake"}formatSize(e,t){const n=typeof t=="function"?t:(()=>t);return e.reduce((i,a)=>{const[s,o]=Gr(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(e){const{nodes:t=[],edges:n=[]}=e,i={},a={},s={};t.forEach(h=>{i[h.id]=0,a[h.id]=0,s[h.id]=[]}),n.forEach(h=>{i[h.target]++,a[h.source]++,s[h.source].push(h.target)});const o=new Set,A=h=>{o.has(h)||(o.add(h),s[h].forEach(A))};if(A(t[0].id),o.size!==t.length)return!1;const l=t.filter(h=>i[h.id]===0),c=t.filter(h=>a[h.id]===0);return!(l.length!==1||c.length!==1||t.filter(h=>i[h.id]===1&&a[h.id]===1).length!==t.length-2)}execute(e,t){return gee(this,void 0,void 0,function*(){var n;if(!this.validate(e))return e;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:A,rowGap:l,clockwise:c,width:u,height:h}=Object.assign({},jd.defaultOptions,this.options,t),[d,f,g,v]=ai(a),p=this.formatSize(e.nodes||[],i),y=Math.ceil((e.nodes||[]).length/o);let m=A||(u-v-f-o*p[0])/(o-1),B=l||(h-d-g-y*p[1])/(y-1);return(B===1/0||B<0)&&(B=0),(m===1/0||m<0)&&(m=0),{nodes:((s?(n=e.nodes)===null||n===void 0?void 0:n.sort(s):vee(e))||[]).map((F,T)=>{const O=Math.floor(T/o),_=T%o,k=c?O%2===0?_:o-1-_:O%2===0?o-1-_:_,L=v+k*(p[0]+m)+p[0]/2,U=d+O*(p[1]+B)+p[1]/2;return{id:F.id,style:{x:L,y:U}}})}})}}jd.defaultOptions={padding:0,cols:5,clockwise:!0};function vee(r){const{nodes:e=[],edges:t=[]}=r,n={},i={};e.forEach(o=>{n[o.id]=0,i[o.id]=[]}),t.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(e.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),A=e.find(l=>l.id===o);s.push(A),i[o].forEach(l=>{n[l]--,n[l]===0&&a.push(l)})}return s}const pee=["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],yee=["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],mee=["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],wee=["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],Bee=["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"];class Ln extends yB{}function sA(r,e=!0,t){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),e&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),t&&Object.assign(n.style,t),n}function S1(r,e="div",t={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(e);return s.innerHTML=n,s.id=r,Object.assign(s.style,t),i.appendChild(s),s}var bee=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class Wd extends Ln{constructor(e,t){super(e,Object.assign({},Wd.defaultOptions,t)),this.$element=sA("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(t)}update(e){const t=Object.create(null,{update:{get:()=>super.update}});return bee(this,void 0,void 0,function*(){t.update.call(this,e),Object.assign(this.$element.style,V1(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}Wd.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function eb(r,e,t,n,i,a){const s=r,o=e,A=t-s,l=n-o;let c=i-s,u=a-o,h=c*A+u*l,d=0;h<=0?d=0:(c=A-c,u=l-u,h=c*A+u*l,h<=0?d=0:d=h*h/(A*A+l*l));const f=c*c+u*u-d;return f<0?0:f}function za(r,e,t,n){return(r-t)*(r-t)+(e-n)*(e-n)}function qM(r,e,t,n,i){return za(r,e,t,n)<i*i}function Eee(r){if(!Number.isFinite(r))return t=>t;if(r===0)return Math.round;const e=Math.pow(10,r);return t=>Math.round(t*e)/e}function UN(r){const e=Math.min(r.x1,r.x2),t=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:e,y:n,x2:t,y2:i,width:t-e,height:i-n}}class In{constructor(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}draw(e){e.moveTo(this.x1,this.y1),e.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(e){return new In(e.x1,e.y1,e.x2,e.y2)}cuts(e,t){if(this.y1===this.y2||t<this.y1&&t<=this.y2||t>this.y1&&t>=this.y2||e>this.x1&&e>=this.x2)return!1;if(e<this.x1&&e<=this.x2)return!0;const n=this.x1+(t-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return e<=n}distSquare(e,t){return eb(this.x1,this.y1,this.x2,this.y2,e,t)}ptClose(e,t,n){if(this.x1<this.x2){if(e<this.x1-n||e>this.x2+n)return!1}else if(e<this.x2-n||e>this.x1+n)return!1;if(this.y1<this.y2){if(t<this.y1-n||t>this.y2+n)return!1}else if(t<this.y2-n||t>this.y1+n)return!1;return!0}}var Jt;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Jt||(Jt={}));class Ym{constructor(e,t=0,n=0){this.state=e,this.x=t,this.y=n}}function vu(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new Ym(Jt.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Ym(Jt.NONE)}return new Ym(t===0||n===0?Jt.COINCIDENT:Jt.PARALLEL)}function PN(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function xee(r,e){function t(i,a,s,o){let A=PN(e,new In(i,a,s,o));return A=Math.abs(A-.5),A>=0&&A<=1?1:0}let n=t(r.x,r.y,r.x2,r.y);return n+=t(r.x,r.y,r.x,r.y2),n>1||(n+=t(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=t(r.x2,r.y,r.x2,r.y2),n>0)}var en;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(en||(en={}));function Nu(r,e,t){const n=new Set;return r.width<=0?(n.add(en.LEFT),n.add(en.RIGHT)):e<r.x?n.add(en.LEFT):e>r.x+r.width&&n.add(en.RIGHT),r.height<=0?(n.add(en.TOP),n.add(en.BOTTOM)):t<r.y?n.add(en.TOP):t>r.y+r.height&&n.add(en.BOTTOM),n}function RN(r,e){let t=e.x1,n=e.y1;const i=e.x2,a=e.y2,s=Array.from(Nu(r,i,a));if(s.length===0)return!0;let o=Nu(r,t,n);for(;o.size!==0;){for(const A of s)if(o.has(A))return!1;if(o.has(en.RIGHT)||o.has(en.LEFT)){let A=r.x;o.has(en.RIGHT)&&(A+=r.width),n=n+(A-t)*(a-n)/(i-t),t=A}else{let A=r.y;o.has(en.BOTTOM)&&(A+=r.height),t=t+(A-n)*(i-t)/(a-n),n=A}o=Nu(r,t,n)}return!0}function Cee(r,e){let t=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,A){let l=PN(e,new In(a,s,o,A));l=Math.abs(l-.5),l>=0&&l<=1&&(n++,l<t&&(t=l))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?t:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:t)}function See(r,e){let t=0;const n=vu(r,new In(e.x,e.y,e.x2,e.y));t+=n.state===Jt.POINT?1:0;const i=vu(r,new In(e.x,e.y,e.x,e.y2));t+=i.state===Jt.POINT?1:0;const a=vu(r,new In(e.x,e.y2,e.x2,e.y2));t+=a.state===Jt.POINT?1:0;const s=vu(r,new In(e.x2,e.y,e.x2,e.y2));return t+=s.state===Jt.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:t}}class Jn{constructor(e,t,n,i){this.x=e,this.y=t,this.width=n,this.height=i}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(e){return new Jn(e.x,e.y,e.width,e.height)}equals(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}clone(){return new Jn(this.x,this.y,this.width,this.height)}add(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x+e.width),a=Math.max(this.y2,e.y+e.height);this.x=t,this.y=n,this.width=i-t,this.height=a-n}addPoint(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x),a=Math.max(this.y2,e.y);this.x=t,this.y=n,this.width=i-t,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(e){e.rect(this.x,this.y,this.width,this.height)}containsPt(e,t){return e>=this.x&&e<=this.x2&&t>=this.y&&t<=this.y2}get area(){return this.width*this.height}intersects(e){return this.area<=0||e.width<=0||e.height<=0?!1:e.x+e.width>this.x&&e.y+e.height>this.y&&e.x<this.x2&&e.y<this.y2}distSquare(e,t){if(this.containsPt(e,t))return 0;const n=Nu(this,e,t);return n.has(en.TOP)?n.has(en.LEFT)?za(e,t,this.x,this.y):n.has(en.RIGHT)?za(e,t,this.x2,this.y):(this.y-t)*(this.y-t):n.has(en.BOTTOM)?n.has(en.LEFT)?za(e,t,this.x,this.y2):n.has(en.RIGHT)?za(e,t,this.x2,this.y2):(t-this.y2)*(t-this.y2):n.has(en.LEFT)?(this.x-e)*(this.x-e):n.has(en.RIGHT)?(e-this.x2)*(e-this.x2):0}}function Fee(r){if(r.length===0)return null;const e=r[0],t=new Jn(e.x,e.y,0,0);for(const n of r)t.addPoint(n);return t}class Oh{constructor(e,t,n){this.cx=e,this.cy=t,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(e){return new Oh(e.cx,e.cy,e.radius)}containsPt(e,t){return za(this.cx,this.cy,e,t)<this.radius*this.radius}distSquare(e,t){const n=za(this.cx,this.cy,e,t);if(n<this.radius*this.radius)return 0;const i=Math.sqrt(n)-this.radius;return i*i}draw(e){e.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class Ps{constructor(e,t=0,n=0,i=0,a=0,s=10,o=10,A=new Float32Array(Math.max(0,s*o)).fill(0)){this.pixelGroup=e,this.i=t,this.j=n,this.pixelX=i,this.pixelY=a,this.width=s,this.height=o,this.area=A}createSub(e,t){return new Ps(this.pixelGroup,e.x,e.y,t.x,t.y,e.width,e.height)}static fromPixelRegion(e,t){return new Ps(t,0,0,e.x,e.y,Math.ceil(e.width/t),Math.ceil(e.height/t))}copy(e,t){return new Ps(this.pixelGroup,this.scaleX(t.x),this.scaleY(t.y),t.x,t.y,e.width,e.height,e.area)}boundX(e){return e<this.i?this.i:e>=this.width?this.width-1:e}boundY(e){return e<this.j?this.j:e>=this.height?this.height-1:e}scaleX(e){return this.boundX(Math.floor((e-this.pixelX)/this.pixelGroup))}scaleY(e){return this.boundY(Math.floor((e-this.pixelY)/this.pixelGroup))}scale(e){const t=this.scaleX(e.x),n=this.scaleY(e.y),i=this.boundX(Math.ceil((e.x+e.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((e.y+e.height-this.pixelY)/this.pixelGroup)),s=i-t,o=a-n;return new Jn(t,n,s,o)}invertScaleX(e){return Math.round(e*this.pixelGroup+this.pixelX)}invertScaleY(e){return Math.round(e*this.pixelGroup+this.pixelY)}addPadding(e,t){const n=Math.ceil(t/this.pixelGroup),i=this.boundX(e.x-n),a=this.boundY(e.y-n),s=this.boundX(e.x2+n),o=this.boundY(e.y2+n),A=s-i,l=o-a;return new Jn(i,a,A,l)}get(e,t){return e<0||t<0||e>=this.width||t>=this.height?Number.NaN:this.area[e+t*this.width]}inc(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]+=n)}set(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]=n)}incArea(e,t){if(e.width<=0||e.height<=0||t===0)return;const n=this.width,i=e.width,a=Math.max(0,e.i),s=Math.max(0,e.j),o=Math.min(e.i+e.width,n),A=Math.min(e.j+e.height,this.height);if(!(A<=0||o<=0||a>=n||A>=this.height))for(let l=s;l<A;l++){const c=(l-e.j)*i,u=l*n;for(let h=a;h<o;h++){const d=e.area[h-e.i+c];d!==0&&(this.area[h+u]+=t*d)}}}fill(e){this.area.fill(e)}fillArea(e,t){const n=e.x+e.y*this.width;for(let i=0;i<e.height;i++){const a=n+i*this.width;this.area.fill(t,a,a+e.width)}}fillHorizontalLine(e,t,n,i){const a=e+t*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(e,t,n,i){const a=e+t*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let e="";for(let t=0;t<this.height;t++){const n=t*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];e+=a.toFixed(1).padStart(6),e+=" "}e+=`
|
|
13
|
+
${n}`)}function o(I,b,E){return(I>=0&&E?` ${A(I,b-1)}`:A(I,b)).padEnd(b)}function A(I,b){let E=I.toString();if(E.length<=b)return E;let w=I.toFixed(b);if(w.length>b&&(w=I.toFixed(Math.max(0,b-(w.length-b)))),w.length<=b&&!w.startsWith("0.000")&&!w.startsWith("-0.000"))return w;let x=I.toExponential(b);return x.length>b&&(x=I.toExponential(Math.max(0,b-(x.length-b)))),x.slice(0)}function l(I,b){I.prototype.add=function(w){return typeof w=="number"?this.addS(w):this.addM(w)},I.prototype.addS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)+w);return this},I.prototype.addM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)+w.get(x,M));return this},I.add=function(w,x){return new b(w).add(x)},I.prototype.sub=function(w){return typeof w=="number"?this.subS(w):this.subM(w)},I.prototype.subS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)-w);return this},I.prototype.subM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)-w.get(x,M));return this},I.sub=function(w,x){return new b(w).sub(x)},I.prototype.subtract=I.prototype.sub,I.prototype.subtractS=I.prototype.subS,I.prototype.subtractM=I.prototype.subM,I.subtract=I.sub,I.prototype.mul=function(w){return typeof w=="number"?this.mulS(w):this.mulM(w)},I.prototype.mulS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)*w);return this},I.prototype.mulM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)*w.get(x,M));return this},I.mul=function(w,x){return new b(w).mul(x)},I.prototype.multiply=I.prototype.mul,I.prototype.multiplyS=I.prototype.mulS,I.prototype.multiplyM=I.prototype.mulM,I.multiply=I.mul,I.prototype.div=function(w){return typeof w=="number"?this.divS(w):this.divM(w)},I.prototype.divS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)/w);return this},I.prototype.divM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)/w.get(x,M));return this},I.div=function(w,x){return new b(w).div(x)},I.prototype.divide=I.prototype.div,I.prototype.divideS=I.prototype.divS,I.prototype.divideM=I.prototype.divM,I.divide=I.div,I.prototype.mod=function(w){return typeof w=="number"?this.modS(w):this.modM(w)},I.prototype.modS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)%w);return this},I.prototype.modM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)%w.get(x,M));return this},I.mod=function(w,x){return new b(w).mod(x)},I.prototype.modulus=I.prototype.mod,I.prototype.modulusS=I.prototype.modS,I.prototype.modulusM=I.prototype.modM,I.modulus=I.mod,I.prototype.and=function(w){return typeof w=="number"?this.andS(w):this.andM(w)},I.prototype.andS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)&w);return this},I.prototype.andM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)&w.get(x,M));return this},I.and=function(w,x){return new b(w).and(x)},I.prototype.or=function(w){return typeof w=="number"?this.orS(w):this.orM(w)},I.prototype.orS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)|w);return this},I.prototype.orM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)|w.get(x,M));return this},I.or=function(w,x){return new b(w).or(x)},I.prototype.xor=function(w){return typeof w=="number"?this.xorS(w):this.xorM(w)},I.prototype.xorS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)^w);return this},I.prototype.xorM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)^w.get(x,M));return this},I.xor=function(w,x){return new b(w).xor(x)},I.prototype.leftShift=function(w){return typeof w=="number"?this.leftShiftS(w):this.leftShiftM(w)},I.prototype.leftShiftS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)<<w);return this},I.prototype.leftShiftM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)<<w.get(x,M));return this},I.leftShift=function(w,x){return new b(w).leftShift(x)},I.prototype.signPropagatingRightShift=function(w){return typeof w=="number"?this.signPropagatingRightShiftS(w):this.signPropagatingRightShiftM(w)},I.prototype.signPropagatingRightShiftS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>w);return this},I.prototype.signPropagatingRightShiftM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>w.get(x,M));return this},I.signPropagatingRightShift=function(w,x){return new b(w).signPropagatingRightShift(x)},I.prototype.rightShift=function(w){return typeof w=="number"?this.rightShiftS(w):this.rightShiftM(w)},I.prototype.rightShiftS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>>w);return this},I.prototype.rightShiftM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)>>>w.get(x,M));return this},I.rightShift=function(w,x){return new b(w).rightShift(x)},I.prototype.zeroFillRightShift=I.prototype.rightShift,I.prototype.zeroFillRightShiftS=I.prototype.rightShiftS,I.prototype.zeroFillRightShiftM=I.prototype.rightShiftM,I.zeroFillRightShift=I.rightShift,I.prototype.not=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,~this.get(w,x));return this},I.not=function(w){return new b(w).not()},I.prototype.abs=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.abs(this.get(w,x)));return this},I.abs=function(w){return new b(w).abs()},I.prototype.acos=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.acos(this.get(w,x)));return this},I.acos=function(w){return new b(w).acos()},I.prototype.acosh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.acosh(this.get(w,x)));return this},I.acosh=function(w){return new b(w).acosh()},I.prototype.asin=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.asin(this.get(w,x)));return this},I.asin=function(w){return new b(w).asin()},I.prototype.asinh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.asinh(this.get(w,x)));return this},I.asinh=function(w){return new b(w).asinh()},I.prototype.atan=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.atan(this.get(w,x)));return this},I.atan=function(w){return new b(w).atan()},I.prototype.atanh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.atanh(this.get(w,x)));return this},I.atanh=function(w){return new b(w).atanh()},I.prototype.cbrt=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.cbrt(this.get(w,x)));return this},I.cbrt=function(w){return new b(w).cbrt()},I.prototype.ceil=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.ceil(this.get(w,x)));return this},I.ceil=function(w){return new b(w).ceil()},I.prototype.clz32=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.clz32(this.get(w,x)));return this},I.clz32=function(w){return new b(w).clz32()},I.prototype.cos=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.cos(this.get(w,x)));return this},I.cos=function(w){return new b(w).cos()},I.prototype.cosh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.cosh(this.get(w,x)));return this},I.cosh=function(w){return new b(w).cosh()},I.prototype.exp=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.exp(this.get(w,x)));return this},I.exp=function(w){return new b(w).exp()},I.prototype.expm1=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.expm1(this.get(w,x)));return this},I.expm1=function(w){return new b(w).expm1()},I.prototype.floor=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.floor(this.get(w,x)));return this},I.floor=function(w){return new b(w).floor()},I.prototype.fround=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.fround(this.get(w,x)));return this},I.fround=function(w){return new b(w).fround()},I.prototype.log=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log(this.get(w,x)));return this},I.log=function(w){return new b(w).log()},I.prototype.log1p=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log1p(this.get(w,x)));return this},I.log1p=function(w){return new b(w).log1p()},I.prototype.log10=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log10(this.get(w,x)));return this},I.log10=function(w){return new b(w).log10()},I.prototype.log2=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.log2(this.get(w,x)));return this},I.log2=function(w){return new b(w).log2()},I.prototype.round=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.round(this.get(w,x)));return this},I.round=function(w){return new b(w).round()},I.prototype.sign=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sign(this.get(w,x)));return this},I.sign=function(w){return new b(w).sign()},I.prototype.sin=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sin(this.get(w,x)));return this},I.sin=function(w){return new b(w).sin()},I.prototype.sinh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sinh(this.get(w,x)));return this},I.sinh=function(w){return new b(w).sinh()},I.prototype.sqrt=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.sqrt(this.get(w,x)));return this},I.sqrt=function(w){return new b(w).sqrt()},I.prototype.tan=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.tan(this.get(w,x)));return this},I.tan=function(w){return new b(w).tan()},I.prototype.tanh=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.tanh(this.get(w,x)));return this},I.tanh=function(w){return new b(w).tanh()},I.prototype.trunc=function(){for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.set(w,x,Math.trunc(this.get(w,x)));return this},I.trunc=function(w){return new b(w).trunc()},I.pow=function(w,x){return new b(w).pow(x)},I.prototype.pow=function(w){return typeof w=="number"?this.powS(w):this.powM(w)},I.prototype.powS=function(w){for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)**w);return this},I.prototype.powM=function(w){if(w=b.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let x=0;x<this.rows;x++)for(let M=0;M<this.columns;M++)this.set(x,M,this.get(x,M)**w.get(x,M));return this}}function c(I,b,E){let w=E?I.rows:I.rows-1;if(b<0||b>w)throw new RangeError("Row index out of range")}function u(I,b,E){let w=E?I.columns:I.columns-1;if(b<0||b>w)throw new RangeError("Column index out of range")}function h(I,b){if(b.to1DArray&&(b=b.to1DArray()),b.length!==I.columns)throw new RangeError("vector size must be the same as the number of columns");return b}function d(I,b){if(b.to1DArray&&(b=b.to1DArray()),b.length!==I.rows)throw new RangeError("vector size must be the same as the number of rows");return b}function f(I,b){if(!r.isAnyArray(b))throw new TypeError("row indices must be an array");for(let E=0;E<b.length;E++)if(b[E]<0||b[E]>=I.rows)throw new RangeError("row indices are out of range")}function g(I,b){if(!r.isAnyArray(b))throw new TypeError("column indices must be an array");for(let E=0;E<b.length;E++)if(b[E]<0||b[E]>=I.columns)throw new RangeError("column indices are out of range")}function v(I,b,E,w,x){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(y("startRow",b),y("endRow",E),y("startColumn",w),y("endColumn",x),b>E||w>x||b<0||b>=I.rows||E<0||E>=I.rows||w<0||w>=I.columns||x<0||x>=I.columns)throw new RangeError("Submatrix indices are out of range")}function p(I,b=0){let E=[];for(let w=0;w<I;w++)E.push(b);return E}function y(I,b){if(typeof b!="number")throw new TypeError(`${I} must be a number`)}function m(I){if(I.isEmpty())throw new Error("Empty matrix has no elements to index")}function B(I){let b=p(I.rows);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[E]+=I.get(E,w);return b}function C(I){let b=p(I.columns);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[w]+=I.get(E,w);return b}function S(I){let b=0;for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)b+=I.get(E,w);return b}function F(I){let b=p(I.rows,1);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[E]*=I.get(E,w);return b}function T(I){let b=p(I.columns,1);for(let E=0;E<I.rows;++E)for(let w=0;w<I.columns;++w)b[w]*=I.get(E,w);return b}function O(I){let b=1;for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)b*=I.get(E,w);return b}function _(I,b,E){const w=I.rows,x=I.columns,M=[];for(let Q=0;Q<w;Q++){let N=0,P=0,R=0;for(let J=0;J<x;J++)R=I.get(Q,J)-E[Q],N+=R,P+=R*R;b?M.push((P-N*N/x)/(x-1)):M.push((P-N*N/x)/x)}return M}function k(I,b,E){const w=I.rows,x=I.columns,M=[];for(let Q=0;Q<x;Q++){let N=0,P=0,R=0;for(let J=0;J<w;J++)R=I.get(J,Q)-E[Q],N+=R,P+=R*R;b?M.push((P-N*N/w)/(w-1)):M.push((P-N*N/w)/w)}return M}function L(I,b,E){const w=I.rows,x=I.columns,M=w*x;let Q=0,N=0,P=0;for(let R=0;R<w;R++)for(let J=0;J<x;J++)P=I.get(R,J)-E,Q+=P,N+=P*P;return b?(N-Q*Q/M)/(M-1):(N-Q*Q/M)/M}function U(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)-b[E])}function G(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)-b[w])}function W(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)-b)}function V(I){const b=[];for(let E=0;E<I.rows;E++){let w=0;for(let x=0;x<I.columns;x++)w+=I.get(E,x)**2/(I.columns-1);b.push(Math.sqrt(w))}return b}function K(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)/b[E])}function D(I){const b=[];for(let E=0;E<I.columns;E++){let w=0;for(let x=0;x<I.rows;x++)w+=I.get(x,E)**2/(I.rows-1);b.push(Math.sqrt(w))}return b}function X(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)/b[w])}function te(I){const b=I.size-1;let E=0;for(let w=0;w<I.columns;w++)for(let x=0;x<I.rows;x++)E+=I.get(x,w)**2/b;return Math.sqrt(E)}function ie(I,b){for(let E=0;E<I.rows;E++)for(let w=0;w<I.columns;w++)I.set(E,w,I.get(E,w)/b)}class re{static from1DArray(b,E,w){if(b*E!==w.length)throw new RangeError("data length does not match given dimensions");let M=new z(b,E);for(let Q=0;Q<b;Q++)for(let N=0;N<E;N++)M.set(Q,N,w[Q*E+N]);return M}static rowVector(b){let E=new z(1,b.length);for(let w=0;w<b.length;w++)E.set(0,w,b[w]);return E}static columnVector(b){let E=new z(b.length,1);for(let w=0;w<b.length;w++)E.set(w,0,b[w]);return E}static zeros(b,E){return new z(b,E)}static ones(b,E){return new z(b,E).fill(1)}static rand(b,E,w={}){if(typeof w!="object")throw new TypeError("options must be an object");const{random:x=Math.random}=w;let M=new z(b,E);for(let Q=0;Q<b;Q++)for(let N=0;N<E;N++)M.set(Q,N,x());return M}static randInt(b,E,w={}){if(typeof w!="object")throw new TypeError("options must be an object");const{min:x=0,max:M=1e3,random:Q=Math.random}=w;if(!Number.isInteger(x))throw new TypeError("min must be an integer");if(!Number.isInteger(M))throw new TypeError("max must be an integer");if(x>=M)throw new RangeError("min must be smaller than max");let N=M-x,P=new z(b,E);for(let R=0;R<b;R++)for(let J=0;J<E;J++){let j=x+Math.round(Q()*N);P.set(R,J,j)}return P}static eye(b,E,w){E===void 0&&(E=b),w===void 0&&(w=1);let x=Math.min(b,E),M=this.zeros(b,E);for(let Q=0;Q<x;Q++)M.set(Q,Q,w);return M}static diag(b,E,w){let x=b.length;E===void 0&&(E=x),w===void 0&&(w=E);let M=Math.min(x,E,w),Q=this.zeros(E,w);for(let N=0;N<M;N++)Q.set(N,N,b[N]);return Q}static min(b,E){b=this.checkMatrix(b),E=this.checkMatrix(E);let w=b.rows,x=b.columns,M=new z(w,x);for(let Q=0;Q<w;Q++)for(let N=0;N<x;N++)M.set(Q,N,Math.min(b.get(Q,N),E.get(Q,N)));return M}static max(b,E){b=this.checkMatrix(b),E=this.checkMatrix(E);let w=b.rows,x=b.columns,M=new this(w,x);for(let Q=0;Q<w;Q++)for(let N=0;N<x;N++)M.set(Q,N,Math.max(b.get(Q,N),E.get(Q,N)));return M}static checkMatrix(b){return re.isMatrix(b)?b:new z(b)}static isMatrix(b){return b!=null&&b.klass==="Matrix"}get size(){return this.rows*this.columns}apply(b){if(typeof b!="function")throw new TypeError("callback must be a function");for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b.call(this,E,w);return this}to1DArray(){let b=[];for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b.push(this.get(E,w));return b}to2DArray(){let b=[];for(let E=0;E<this.rows;E++){b.push([]);for(let w=0;w<this.columns;w++)b[E].push(this.get(E,w))}return b}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let b=0;b<this.rows;b++)for(let E=0;E<=b;E++)if(this.get(b,E)!==this.get(E,b))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let b=0;b<this.rows;b++)if(this.get(b,b)!==0)return!1;return!0}isEchelonForm(){let b=0,E=0,w=-1,x=!0,M=!1;for(;b<this.rows&&x;){for(E=0,M=!1;E<this.columns&&M===!1;)this.get(b,E)===0?E++:this.get(b,E)===1&&E>w?(M=!0,w=E):(x=!1,M=!0);b++}return x}isReducedEchelonForm(){let b=0,E=0,w=-1,x=!0,M=!1;for(;b<this.rows&&x;){for(E=0,M=!1;E<this.columns&&M===!1;)this.get(b,E)===0?E++:this.get(b,E)===1&&E>w?(M=!0,w=E):(x=!1,M=!0);for(let Q=E+1;Q<this.rows;Q++)this.get(b,Q)!==0&&(x=!1);b++}return x}echelonForm(){let b=this.clone(),E=0,w=0;for(;E<b.rows&&w<b.columns;){let x=E;for(let M=E;M<b.rows;M++)b.get(M,w)>b.get(x,w)&&(x=M);if(b.get(x,w)===0)w++;else{b.swapRows(E,x);let M=b.get(E,w);for(let Q=w;Q<b.columns;Q++)b.set(E,Q,b.get(E,Q)/M);for(let Q=E+1;Q<b.rows;Q++){let N=b.get(Q,w)/b.get(E,w);b.set(Q,w,0);for(let P=w+1;P<b.columns;P++)b.set(Q,P,b.get(Q,P)-b.get(E,P)*N)}E++,w++}}return b}reducedEchelonForm(){let b=this.echelonForm(),E=b.columns,w=b.rows,x=w-1;for(;x>=0;)if(b.maxRow(x)===0)x--;else{let M=0,Q=!1;for(;M<w&&Q===!1;)b.get(x,M)===1?Q=!0:M++;for(let N=0;N<x;N++){let P=b.get(N,M);for(let R=M;R<E;R++){let J=b.get(N,R)-P*b.get(x,R);b.set(N,R,J)}}x--}return b}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{rows:E=1,columns:w=1}=b;if(!Number.isInteger(E)||E<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(w)||w<=0)throw new TypeError("columns must be a positive integer");let x=new z(this.rows*E,this.columns*w);for(let M=0;M<E;M++)for(let Q=0;Q<w;Q++)x.setSubMatrix(this,this.rows*M,this.columns*Q);return x}fill(b){for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,b);return this}neg(){return this.mulS(-1)}getRow(b){c(this,b);let E=[];for(let w=0;w<this.columns;w++)E.push(this.get(b,w));return E}getRowVector(b){return z.rowVector(this.getRow(b))}setRow(b,E){c(this,b),E=h(this,E);for(let w=0;w<this.columns;w++)this.set(b,w,E[w]);return this}swapRows(b,E){c(this,b),c(this,E);for(let w=0;w<this.columns;w++){let x=this.get(b,w);this.set(b,w,this.get(E,w)),this.set(E,w,x)}return this}getColumn(b){u(this,b);let E=[];for(let w=0;w<this.rows;w++)E.push(this.get(w,b));return E}getColumnVector(b){return z.columnVector(this.getColumn(b))}setColumn(b,E){u(this,b),E=d(this,E);for(let w=0;w<this.rows;w++)this.set(w,b,E[w]);return this}swapColumns(b,E){u(this,b),u(this,E);for(let w=0;w<this.rows;w++){let x=this.get(w,b);this.set(w,b,this.get(w,E)),this.set(w,E,x)}return this}addRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)+b[w]);return this}subRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)-b[w]);return this}mulRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)*b[w]);return this}divRowVector(b){b=h(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)/b[w]);return this}addColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)+b[E]);return this}subColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)-b[E]);return this}mulColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)*b[E]);return this}divColumnVector(b){b=d(this,b);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)this.set(E,w,this.get(E,w)/b[E]);return this}mulRow(b,E){c(this,b);for(let w=0;w<this.columns;w++)this.set(b,w,this.get(b,w)*E);return this}mulColumn(b,E){u(this,b);for(let w=0;w<this.rows;w++)this.set(w,b,this.get(w,b)*E);return this}max(b){if(this.isEmpty())return NaN;switch(b){case"row":{const E=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>E[w]&&(E[w]=this.get(w,x));return E}case"column":{const E=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>E[x]&&(E[x]=this.get(w,x));return E}case void 0:{let E=this.get(0,0);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>E&&(E=this.get(w,x));return E}default:throw new Error(`invalid option: ${b}`)}}maxIndex(){m(this);let b=this.get(0,0),E=[0,0];for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)>b&&(b=this.get(w,x),E[0]=w,E[1]=x);return E}min(b){if(this.isEmpty())return NaN;switch(b){case"row":{const E=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<E[w]&&(E[w]=this.get(w,x));return E}case"column":{const E=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<E[x]&&(E[x]=this.get(w,x));return E}case void 0:{let E=this.get(0,0);for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<E&&(E=this.get(w,x));return E}default:throw new Error(`invalid option: ${b}`)}}minIndex(){m(this);let b=this.get(0,0),E=[0,0];for(let w=0;w<this.rows;w++)for(let x=0;x<this.columns;x++)this.get(w,x)<b&&(b=this.get(w,x),E[0]=w,E[1]=x);return E}maxRow(b){if(c(this,b),this.isEmpty())return NaN;let E=this.get(b,0);for(let w=1;w<this.columns;w++)this.get(b,w)>E&&(E=this.get(b,w));return E}maxRowIndex(b){c(this,b),m(this);let E=this.get(b,0),w=[b,0];for(let x=1;x<this.columns;x++)this.get(b,x)>E&&(E=this.get(b,x),w[1]=x);return w}minRow(b){if(c(this,b),this.isEmpty())return NaN;let E=this.get(b,0);for(let w=1;w<this.columns;w++)this.get(b,w)<E&&(E=this.get(b,w));return E}minRowIndex(b){c(this,b),m(this);let E=this.get(b,0),w=[b,0];for(let x=1;x<this.columns;x++)this.get(b,x)<E&&(E=this.get(b,x),w[1]=x);return w}maxColumn(b){if(u(this,b),this.isEmpty())return NaN;let E=this.get(0,b);for(let w=1;w<this.rows;w++)this.get(w,b)>E&&(E=this.get(w,b));return E}maxColumnIndex(b){u(this,b),m(this);let E=this.get(0,b),w=[0,b];for(let x=1;x<this.rows;x++)this.get(x,b)>E&&(E=this.get(x,b),w[0]=x);return w}minColumn(b){if(u(this,b),this.isEmpty())return NaN;let E=this.get(0,b);for(let w=1;w<this.rows;w++)this.get(w,b)<E&&(E=this.get(w,b));return E}minColumnIndex(b){u(this,b),m(this);let E=this.get(0,b),w=[0,b];for(let x=1;x<this.rows;x++)this.get(x,b)<E&&(E=this.get(x,b),w[0]=x);return w}diag(){let b=Math.min(this.rows,this.columns),E=[];for(let w=0;w<b;w++)E.push(this.get(w,w));return E}norm(b="frobenius"){switch(b){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${b}`)}}cumulativeSum(){let b=0;for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b+=this.get(E,w),this.set(E,w,b);return this}dot(b){re.isMatrix(b)&&(b=b.to1DArray());let E=this.to1DArray();if(E.length!==b.length)throw new RangeError("vectors do not have the same size");let w=0;for(let x=0;x<E.length;x++)w+=E[x]*b[x];return w}mmul(b){b=z.checkMatrix(b);let E=this.rows,w=this.columns,x=b.columns,M=new z(E,x),Q=new Float64Array(w);for(let N=0;N<x;N++){for(let P=0;P<w;P++)Q[P]=b.get(P,N);for(let P=0;P<E;P++){let R=0;for(let J=0;J<w;J++)R+=this.get(P,J)*Q[J];M.set(P,N,R)}}return M}strassen2x2(b){b=z.checkMatrix(b);let E=new z(2,2);const w=this.get(0,0),x=b.get(0,0),M=this.get(0,1),Q=b.get(0,1),N=this.get(1,0),P=b.get(1,0),R=this.get(1,1),J=b.get(1,1),j=(w+R)*(x+J),oe=(N+R)*x,me=w*(Q-J),ne=R*(P-x),ce=(w+M)*J,Ce=(N-w)*(x+Q),q=(M-R)*(P+J),ye=j+ne-ce+q,Oe=me+ce,Ke=oe+ne,je=j-oe+me+Ce;return E.set(0,0,ye),E.set(0,1,Oe),E.set(1,0,Ke),E.set(1,1,je),E}strassen3x3(b){b=z.checkMatrix(b);let E=new z(3,3);const w=this.get(0,0),x=this.get(0,1),M=this.get(0,2),Q=this.get(1,0),N=this.get(1,1),P=this.get(1,2),R=this.get(2,0),J=this.get(2,1),j=this.get(2,2),oe=b.get(0,0),me=b.get(0,1),ne=b.get(0,2),ce=b.get(1,0),Ce=b.get(1,1),q=b.get(1,2),ye=b.get(2,0),Oe=b.get(2,1),Ke=b.get(2,2),je=(w+x+M-Q-N-J-j)*Ce,Ht=(w-Q)*(-me+Ce),Qe=N*(-oe+me+ce-Ce-q-ye+Ke),Pe=(-w+Q+N)*(oe-me+Ce),Ft=(Q+N)*(-oe+me),Y=w*oe,fe=(-w+R+J)*(oe-ne+q),Se=(-w+R)*(ne-q),ve=(R+J)*(-oe+ne),Gt=(w+x+M-N-P-R-J)*q,yt=J*(-oe+ne+ce-Ce-q-ye+Oe),Qt=(-M+J+j)*(Ce+ye-Oe),Kt=(M-j)*(Ce-Oe),Nn=M*ye,Ai=(J+j)*(-ye+Oe),bn=(-M+N+P)*(q+ye-Ke),Ti=(M-P)*(q-Ke),ta=(N+P)*(-ye+Ke),st=x*ce,Un=P*Oe,_r=Q*ne,Ir=R*me,En=j*Ke,IU=Y+Nn+st,kU=je+Pe+Ft+Y+Qt+Nn+Ai,LU=Y+fe+ve+Gt+Nn+bn+ta,QU=Ht+Qe+Pe+Y+Nn+bn+Ti,NU=Ht+Pe+Ft+Y+Un,UU=Nn+bn+Ti+ta+_r,PU=Y+fe+Se+yt+Qt+Kt+Nn,RU=Qt+Kt+Nn+Ai+Ir,DU=Y+fe+Se+ve+En;return E.set(0,0,IU),E.set(0,1,kU),E.set(0,2,LU),E.set(1,0,QU),E.set(1,1,NU),E.set(1,2,UU),E.set(2,0,PU),E.set(2,1,RU),E.set(2,2,DU),E}mmulStrassen(b){b=z.checkMatrix(b);let E=this.clone(),w=E.rows,x=E.columns,M=b.rows,Q=b.columns;x!==M&&console.warn(`Multiplying ${w} x ${x} and ${M} x ${Q} matrix: dimensions do not match.`);function N(j,oe,me){let ne=j.rows,ce=j.columns;if(ne===oe&&ce===me)return j;{let Ce=re.zeros(oe,me);return Ce=Ce.setSubMatrix(j,0,0),Ce}}let P=Math.max(w,M),R=Math.max(x,Q);E=N(E,P,R),b=N(b,P,R);function J(j,oe,me,ne){if(me<=512||ne<=512)return j.mmul(oe);me%2===1&&ne%2===1?(j=N(j,me+1,ne+1),oe=N(oe,me+1,ne+1)):me%2===1?(j=N(j,me+1,ne),oe=N(oe,me+1,ne)):ne%2===1&&(j=N(j,me,ne+1),oe=N(oe,me,ne+1));let ce=parseInt(j.rows/2,10),Ce=parseInt(j.columns/2,10),q=j.subMatrix(0,ce-1,0,Ce-1),ye=oe.subMatrix(0,ce-1,0,Ce-1),Oe=j.subMatrix(0,ce-1,Ce,j.columns-1),Ke=oe.subMatrix(0,ce-1,Ce,oe.columns-1),je=j.subMatrix(ce,j.rows-1,0,Ce-1),Ht=oe.subMatrix(ce,oe.rows-1,0,Ce-1),Qe=j.subMatrix(ce,j.rows-1,Ce,j.columns-1),Pe=oe.subMatrix(ce,oe.rows-1,Ce,oe.columns-1),Ft=J(re.add(q,Qe),re.add(ye,Pe),ce,Ce),Y=J(re.add(je,Qe),ye,ce,Ce),fe=J(q,re.sub(Ke,Pe),ce,Ce),Se=J(Qe,re.sub(Ht,ye),ce,Ce),ve=J(re.add(q,Oe),Pe,ce,Ce),Gt=J(re.sub(je,q),re.add(ye,Ke),ce,Ce),yt=J(re.sub(Oe,Qe),re.add(Ht,Pe),ce,Ce),Qt=re.add(Ft,Se);Qt.sub(ve),Qt.add(yt);let Kt=re.add(fe,ve),Nn=re.add(Y,Se),Ai=re.sub(Ft,Y);Ai.add(fe),Ai.add(Gt);let bn=re.zeros(2*Qt.rows,2*Qt.columns);return bn=bn.setSubMatrix(Qt,0,0),bn=bn.setSubMatrix(Kt,Qt.rows,0),bn=bn.setSubMatrix(Nn,0,Qt.columns),bn=bn.setSubMatrix(Ai,Qt.rows,Qt.columns),bn.subMatrix(0,me-1,0,ne-1)}return J(E,b,P,R)}scaleRows(b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{min:E=0,max:w=1}=b;if(!Number.isFinite(E))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(E>=w)throw new RangeError("min must be smaller than max");let x=new z(this.rows,this.columns);for(let M=0;M<this.rows;M++){const Q=this.getRow(M);Q.length>0&&e(Q,{min:E,max:w,output:Q}),x.setRow(M,Q)}return x}scaleColumns(b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{min:E=0,max:w=1}=b;if(!Number.isFinite(E))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(E>=w)throw new RangeError("min must be smaller than max");let x=new z(this.rows,this.columns);for(let M=0;M<this.columns;M++){const Q=this.getColumn(M);Q.length&&e(Q,{min:E,max:w,output:Q}),x.setColumn(M,Q)}return x}flipRows(){const b=Math.ceil(this.columns/2);for(let E=0;E<this.rows;E++)for(let w=0;w<b;w++){let x=this.get(E,w),M=this.get(E,this.columns-1-w);this.set(E,w,M),this.set(E,this.columns-1-w,x)}return this}flipColumns(){const b=Math.ceil(this.rows/2);for(let E=0;E<this.columns;E++)for(let w=0;w<b;w++){let x=this.get(w,E),M=this.get(this.rows-1-w,E);this.set(w,E,M),this.set(this.rows-1-w,E,x)}return this}kroneckerProduct(b){b=z.checkMatrix(b);let E=this.rows,w=this.columns,x=b.rows,M=b.columns,Q=new z(E*x,w*M);for(let N=0;N<E;N++)for(let P=0;P<w;P++)for(let R=0;R<x;R++)for(let J=0;J<M;J++)Q.set(x*N+R,M*P+J,this.get(N,P)*b.get(R,J));return Q}kroneckerSum(b){if(b=z.checkMatrix(b),!this.isSquare()||!b.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let E=this.rows,w=b.rows,x=this.kroneckerProduct(z.eye(w,w)),M=z.eye(E,E).kroneckerProduct(b);return x.add(M)}transpose(){let b=new z(this.columns,this.rows);for(let E=0;E<this.rows;E++)for(let w=0;w<this.columns;w++)b.set(w,E,this.get(E,w));return b}sortRows(b=xe){for(let E=0;E<this.rows;E++)this.setRow(E,this.getRow(E).sort(b));return this}sortColumns(b=xe){for(let E=0;E<this.columns;E++)this.setColumn(E,this.getColumn(E).sort(b));return this}subMatrix(b,E,w,x){v(this,b,E,w,x);let M=new z(E-b+1,x-w+1);for(let Q=b;Q<=E;Q++)for(let N=w;N<=x;N++)M.set(Q-b,N-w,this.get(Q,N));return M}subMatrixRow(b,E,w){if(E===void 0&&(E=0),w===void 0&&(w=this.columns-1),E>w||E<0||E>=this.columns||w<0||w>=this.columns)throw new RangeError("Argument out of range");let x=new z(b.length,w-E+1);for(let M=0;M<b.length;M++)for(let Q=E;Q<=w;Q++){if(b[M]<0||b[M]>=this.rows)throw new RangeError(`Row index out of range: ${b[M]}`);x.set(M,Q-E,this.get(b[M],Q))}return x}subMatrixColumn(b,E,w){if(E===void 0&&(E=0),w===void 0&&(w=this.rows-1),E>w||E<0||E>=this.rows||w<0||w>=this.rows)throw new RangeError("Argument out of range");let x=new z(w-E+1,b.length);for(let M=0;M<b.length;M++)for(let Q=E;Q<=w;Q++){if(b[M]<0||b[M]>=this.columns)throw new RangeError(`Column index out of range: ${b[M]}`);x.set(Q-E,M,this.get(Q,b[M]))}return x}setSubMatrix(b,E,w){if(b=z.checkMatrix(b),b.isEmpty())return this;let x=E+b.rows-1,M=w+b.columns-1;v(this,E,x,w,M);for(let Q=0;Q<b.rows;Q++)for(let N=0;N<b.columns;N++)this.set(E+Q,w+N,b.get(Q,N));return this}selection(b,E){f(this,b),g(this,E);let w=new z(b.length,E.length);for(let x=0;x<b.length;x++){let M=b[x];for(let Q=0;Q<E.length;Q++){let N=E[Q];w.set(x,Q,this.get(M,N))}}return w}trace(){let b=Math.min(this.rows,this.columns),E=0;for(let w=0;w<b;w++)E+=this.get(w,w);return E}clone(){return this.constructor.copy(this,new z(this.rows,this.columns))}static copy(b,E){for(const[w,x,M]of b.entries())E.set(w,x,M);return E}sum(b){switch(b){case"row":return B(this);case"column":return C(this);case void 0:return S(this);default:throw new Error(`invalid option: ${b}`)}}product(b){switch(b){case"row":return F(this);case"column":return T(this);case void 0:return O(this);default:throw new Error(`invalid option: ${b}`)}}mean(b){const E=this.sum(b);switch(b){case"row":{for(let w=0;w<this.rows;w++)E[w]/=this.columns;return E}case"column":{for(let w=0;w<this.columns;w++)E[w]/=this.rows;return E}case void 0:return E/this.size;default:throw new Error(`invalid option: ${b}`)}}variance(b,E={}){if(typeof b=="object"&&(E=b,b=void 0),typeof E!="object")throw new TypeError("options must be an object");const{unbiased:w=!0,mean:x=this.mean(b)}=E;if(typeof w!="boolean")throw new TypeError("unbiased must be a boolean");switch(b){case"row":{if(!r.isAnyArray(x))throw new TypeError("mean must be an array");return _(this,w,x)}case"column":{if(!r.isAnyArray(x))throw new TypeError("mean must be an array");return k(this,w,x)}case void 0:{if(typeof x!="number")throw new TypeError("mean must be a number");return L(this,w,x)}default:throw new Error(`invalid option: ${b}`)}}standardDeviation(b,E){typeof b=="object"&&(E=b,b=void 0);const w=this.variance(b,E);if(b===void 0)return Math.sqrt(w);for(let x=0;x<w.length;x++)w[x]=Math.sqrt(w[x]);return w}center(b,E={}){if(typeof b=="object"&&(E=b,b=void 0),typeof E!="object")throw new TypeError("options must be an object");const{center:w=this.mean(b)}=E;switch(b){case"row":{if(!r.isAnyArray(w))throw new TypeError("center must be an array");return U(this,w),this}case"column":{if(!r.isAnyArray(w))throw new TypeError("center must be an array");return G(this,w),this}case void 0:{if(typeof w!="number")throw new TypeError("center must be a number");return W(this,w),this}default:throw new Error(`invalid option: ${b}`)}}scale(b,E={}){if(typeof b=="object"&&(E=b,b=void 0),typeof E!="object")throw new TypeError("options must be an object");let w=E.scale;switch(b){case"row":{if(w===void 0)w=V(this);else if(!r.isAnyArray(w))throw new TypeError("scale must be an array");return K(this,w),this}case"column":{if(w===void 0)w=D(this);else if(!r.isAnyArray(w))throw new TypeError("scale must be an array");return X(this,w),this}case void 0:{if(w===void 0)w=te(this);else if(typeof w!="number")throw new TypeError("scale must be a number");return ie(this,w),this}default:throw new Error(`invalid option: ${b}`)}}toString(b){return a(this,b)}[Symbol.iterator](){return this.entries()}*entries(){for(let b=0;b<this.rows;b++)for(let E=0;E<this.columns;E++)yield[b,E,this.get(b,E)]}*values(){for(let b=0;b<this.rows;b++)for(let E=0;E<this.columns;E++)yield this.get(b,E)}}re.prototype.klass="Matrix",typeof Symbol<"u"&&(re.prototype[Symbol.for("nodejs.util.inspect.custom")]=i);function xe(I,b){return I-b}function $(I){return I.every(b=>typeof b=="number")}re.random=re.rand,re.randomInt=re.randInt,re.diagonal=re.diag,re.prototype.diagonal=re.prototype.diag,re.identity=re.eye,re.prototype.negate=re.prototype.neg,re.prototype.tensorProduct=re.prototype.kroneckerProduct;class z extends re{data;#e(b,E){if(this.data=[],Number.isInteger(E)&&E>=0)for(let w=0;w<b;w++)this.data.push(new Float64Array(E));else throw new TypeError("nColumns must be a positive integer");this.rows=b,this.columns=E}constructor(b,E){if(super(),z.isMatrix(b))this.#e(b.rows,b.columns),z.copy(b,this);else if(Number.isInteger(b)&&b>=0)this.#e(b,E);else if(r.isAnyArray(b)){const w=b;if(b=w.length,E=b?w[0].length:0,typeof E!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let x=0;x<b;x++){if(w[x].length!==E)throw new RangeError("Inconsistent array dimensions");if(!$(w[x]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(w[x]))}this.rows=b,this.columns=E}else throw new TypeError("First argument must be a positive number or an array")}set(b,E,w){return this.data[b][E]=w,this}get(b,E){return this.data[b][E]}removeRow(b){return c(this,b),this.data.splice(b,1),this.rows-=1,this}addRow(b,E){return E===void 0&&(E=b,b=this.rows),c(this,b,!0),E=Float64Array.from(h(this,E)),this.data.splice(b,0,E),this.rows+=1,this}removeColumn(b){u(this,b);for(let E=0;E<this.rows;E++){const w=new Float64Array(this.columns-1);for(let x=0;x<b;x++)w[x]=this.data[E][x];for(let x=b+1;x<this.columns;x++)w[x-1]=this.data[E][x];this.data[E]=w}return this.columns-=1,this}addColumn(b,E){typeof E>"u"&&(E=b,b=this.columns),u(this,b,!0),E=d(this,E);for(let w=0;w<this.rows;w++){const x=new Float64Array(this.columns+1);let M=0;for(;M<b;M++)x[M]=this.data[w][M];for(x[M++]=E[w];M<this.columns+1;M++)x[M]=this.data[w][M-1];this.data[w]=x}return this.columns+=1,this}}l(re,z);class ee extends re{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(b){return z.isMatrix(b)&&b.klassType==="SymmetricMatrix"}static zeros(b){return new this(b)}static ones(b){return new this(b).fill(1)}constructor(b){if(super(),z.isMatrix(b)){if(!b.isSymmetric())throw new TypeError("not symmetric data");this.#e=z.copy(b,new z(b.rows,b.rows))}else if(Number.isInteger(b)&&b>=0)this.#e=new z(b,b);else if(this.#e=new z(b),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const b=new ee(this.diagonalSize);for(const[E,w,x]of this.upperRightEntries())b.set(E,w,x);return b}toMatrix(){return new z(this)}get(b,E){return this.#e.get(b,E)}set(b,E,w){return this.#e.set(b,E,w),this.#e.set(E,b,w),this}removeCross(b){return this.#e.removeRow(b),this.#e.removeColumn(b),this}addCross(b,E){E===void 0&&(E=b,b=this.diagonalSize);const w=E.slice();return w.splice(b,1),this.#e.addRow(b,w),this.#e.addColumn(b,E),this}applyMask(b){if(b.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const E=[];for(const[w,x]of b.entries())x||E.push(w);E.reverse();for(const w of E)this.removeCross(w);return this}toCompact(){const{diagonalSize:b}=this,E=new Array(b*(b+1)/2);for(let w=0,x=0,M=0;M<E.length;M++)E[M]=this.get(x,w),++w>=b&&(w=++x);return E}static fromCompact(b){const E=b.length,w=(Math.sqrt(8*E+1)-1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(b)}`);const x=new ee(w);for(let M=0,Q=0,N=0;N<E;N++)x.set(M,Q,b[N]),++M>=w&&(M=++Q);return x}*upperRightEntries(){for(let b=0,E=0;b<this.diagonalSize;void 0){const w=this.get(b,E);yield[b,E,w],++E>=this.diagonalSize&&(E=++b)}}*upperRightValues(){for(let b=0,E=0;b<this.diagonalSize;void 0)yield this.get(b,E),++E>=this.diagonalSize&&(E=++b)}}ee.prototype.klassType="SymmetricMatrix";class Ae extends ee{static isDistanceMatrix(b){return ee.isSymmetricMatrix(b)&&b.klassSubType==="DistanceMatrix"}constructor(b){if(super(b),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(b,E,w){return b===E&&(w=0),super.set(b,E,w)}addCross(b,E){return E===void 0&&(E=b,b=this.diagonalSize),E=E.slice(),E[b]=0,super.addCross(b,E)}toSymmetricMatrix(){return new ee(this)}clone(){const b=new Ae(this.diagonalSize);for(const[E,w,x]of this.upperRightEntries())E!==w&&b.set(E,w,x);return b}toCompact(){const{diagonalSize:b}=this,E=(b-1)*b/2,w=new Array(E);for(let x=1,M=0,Q=0;Q<w.length;Q++)w[Q]=this.get(M,x),++x>=b&&(x=++M+1);return w}static fromCompact(b){const E=b.length;if(E===0)return new this(0);const w=(Math.sqrt(8*E+1)+1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(b)}`);const x=new this(w);for(let M=1,Q=0,N=0;N<E;N++)x.set(M,Q,b[N]),++M>=w&&(M=++Q+1);return x}}Ae.prototype.klassSubType="DistanceMatrix";class be extends re{constructor(b,E,w){super(),this.matrix=b,this.rows=E,this.columns=w}}class Le extends be{constructor(b,E){u(b,E),super(b,b.rows,1),this.column=E}set(b,E,w){return this.matrix.set(b,this.column,w),this}get(b){return this.matrix.get(b,this.column)}}class Ue extends be{constructor(b,E){g(b,E),super(b,b.rows,E.length),this.columnIndices=E}set(b,E,w){return this.matrix.set(b,this.columnIndices[E],w),this}get(b,E){return this.matrix.get(b,this.columnIndices[E])}}class at extends be{constructor(b){super(b,b.rows,b.columns)}set(b,E,w){return this.matrix.set(b,this.columns-E-1,w),this}get(b,E){return this.matrix.get(b,this.columns-E-1)}}class lt extends be{constructor(b){super(b,b.rows,b.columns)}set(b,E,w){return this.matrix.set(this.rows-b-1,E,w),this}get(b,E){return this.matrix.get(this.rows-b-1,E)}}class ct extends be{constructor(b,E){c(b,E),super(b,1,b.columns),this.row=E}set(b,E,w){return this.matrix.set(this.row,E,w),this}get(b,E){return this.matrix.get(this.row,E)}}class pt extends be{constructor(b,E){f(b,E),super(b,E.length,b.columns),this.rowIndices=E}set(b,E,w){return this.matrix.set(this.rowIndices[b],E,w),this}get(b,E){return this.matrix.get(this.rowIndices[b],E)}}class Ne extends be{constructor(b,E,w){f(b,E),g(b,w),super(b,E.length,w.length),this.rowIndices=E,this.columnIndices=w}set(b,E,w){return this.matrix.set(this.rowIndices[b],this.columnIndices[E],w),this}get(b,E){return this.matrix.get(this.rowIndices[b],this.columnIndices[E])}}class ht extends be{constructor(b,E,w,x,M){v(b,E,w,x,M),super(b,w-E+1,M-x+1),this.startRow=E,this.startColumn=x}set(b,E,w){return this.matrix.set(this.startRow+b,this.startColumn+E,w),this}get(b,E){return this.matrix.get(this.startRow+b,this.startColumn+E)}}class nt extends be{constructor(b){super(b,b.columns,b.rows)}set(b,E,w){return this.matrix.set(E,b,w),this}get(b,E){return this.matrix.get(E,b)}}class gr extends re{constructor(b,E={}){const{rows:w=1}=E;if(b.length%w!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=w,this.columns=b.length/w,this.data=b}set(b,E,w){let x=this._calculateIndex(b,E);return this.data[x]=w,this}get(b,E){let w=this._calculateIndex(b,E);return this.data[w]}_calculateIndex(b,E){return b*this.columns+E}}class St extends re{constructor(b){super(),this.data=b,this.rows=b.length,this.columns=b[0].length}set(b,E,w){return this.data[b][E]=w,this}get(b,E){return this.data[b][E]}}function Ji(I,b){if(r.isAnyArray(I))return I[0]&&r.isAnyArray(I[0])?new St(I):new gr(I,b);throw new Error("the argument is not an array")}class ir{constructor(b){b=St.checkMatrix(b);let E=b.clone(),w=E.rows,x=E.columns,M=new Float64Array(w),Q=1,N,P,R,J,j,oe,me,ne,ce;for(N=0;N<w;N++)M[N]=N;for(ne=new Float64Array(w),P=0;P<x;P++){for(N=0;N<w;N++)ne[N]=E.get(N,P);for(N=0;N<w;N++){for(ce=Math.min(N,P),j=0,R=0;R<ce;R++)j+=E.get(N,R)*ne[R];ne[N]-=j,E.set(N,P,ne[N])}for(J=P,N=P+1;N<w;N++)Math.abs(ne[N])>Math.abs(ne[J])&&(J=N);if(J!==P){for(R=0;R<x;R++)oe=E.get(J,R),E.set(J,R,E.get(P,R)),E.set(P,R,oe);me=M[J],M[J]=M[P],M[P]=me,Q=-Q}if(P<w&&E.get(P,P)!==0)for(N=P+1;N<w;N++)E.set(N,P,E.get(N,P)/E.get(P,P))}this.LU=E,this.pivotVector=M,this.pivotSign=Q}isSingular(){let b=this.LU,E=b.columns;for(let w=0;w<E;w++)if(b.get(w,w)===0)return!0;return!1}solve(b){b=z.checkMatrix(b);let E=this.LU;if(E.rows!==b.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let x=b.columns,M=b.subMatrixRow(this.pivotVector,0,x-1),Q=E.columns,N,P,R;for(R=0;R<Q;R++)for(N=R+1;N<Q;N++)for(P=0;P<x;P++)M.set(N,P,M.get(N,P)-M.get(R,P)*E.get(N,R));for(R=Q-1;R>=0;R--){for(P=0;P<x;P++)M.set(R,P,M.get(R,P)/E.get(R,R));for(N=0;N<R;N++)for(P=0;P<x;P++)M.set(N,P,M.get(N,P)-M.get(R,P)*E.get(N,R))}return M}get determinant(){let b=this.LU;if(!b.isSquare())throw new Error("Matrix must be square");let E=this.pivotSign,w=b.columns;for(let x=0;x<w;x++)E*=b.get(x,x);return E}get lowerTriangularMatrix(){let b=this.LU,E=b.rows,w=b.columns,x=new z(E,w);for(let M=0;M<E;M++)for(let Q=0;Q<w;Q++)M>Q?x.set(M,Q,b.get(M,Q)):M===Q?x.set(M,Q,1):x.set(M,Q,0);return x}get upperTriangularMatrix(){let b=this.LU,E=b.rows,w=b.columns,x=new z(E,w);for(let M=0;M<E;M++)for(let Q=0;Q<w;Q++)M<=Q?x.set(M,Q,b.get(M,Q)):x.set(M,Q,0);return x}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Wt(I,b){let E=0;return Math.abs(I)>Math.abs(b)?(E=b/I,Math.abs(I)*Math.sqrt(1+E*E)):b!==0?(E=I/b,Math.abs(b)*Math.sqrt(1+E*E)):0}class _t{constructor(b){b=St.checkMatrix(b);let E=b.clone(),w=b.rows,x=b.columns,M=new Float64Array(x),Q,N,P,R;for(P=0;P<x;P++){let J=0;for(Q=P;Q<w;Q++)J=Wt(J,E.get(Q,P));if(J!==0){for(E.get(P,P)<0&&(J=-J),Q=P;Q<w;Q++)E.set(Q,P,E.get(Q,P)/J);for(E.set(P,P,E.get(P,P)+1),N=P+1;N<x;N++){for(R=0,Q=P;Q<w;Q++)R+=E.get(Q,P)*E.get(Q,N);for(R=-R/E.get(P,P),Q=P;Q<w;Q++)E.set(Q,N,E.get(Q,N)+R*E.get(Q,P))}}M[P]=-J}this.QR=E,this.Rdiag=M}solve(b){b=z.checkMatrix(b);let E=this.QR,w=E.rows;if(b.rows!==w)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let x=b.columns,M=b.clone(),Q=E.columns,N,P,R,J;for(R=0;R<Q;R++)for(P=0;P<x;P++){for(J=0,N=R;N<w;N++)J+=E.get(N,R)*M.get(N,P);for(J=-J/E.get(R,R),N=R;N<w;N++)M.set(N,P,M.get(N,P)+J*E.get(N,R))}for(R=Q-1;R>=0;R--){for(P=0;P<x;P++)M.set(R,P,M.get(R,P)/this.Rdiag[R]);for(N=0;N<R;N++)for(P=0;P<x;P++)M.set(N,P,M.get(N,P)-M.get(R,P)*E.get(N,R))}return M.subMatrix(0,Q-1,0,x-1)}isFullRank(){let b=this.QR.columns;for(let E=0;E<b;E++)if(this.Rdiag[E]===0)return!1;return!0}get upperTriangularMatrix(){let b=this.QR,E=b.columns,w=new z(E,E),x,M;for(x=0;x<E;x++)for(M=0;M<E;M++)x<M?w.set(x,M,b.get(x,M)):x===M?w.set(x,M,this.Rdiag[x]):w.set(x,M,0);return w}get orthogonalMatrix(){let b=this.QR,E=b.rows,w=b.columns,x=new z(E,w),M,Q,N,P;for(N=w-1;N>=0;N--){for(M=0;M<E;M++)x.set(M,N,0);for(x.set(N,N,1),Q=N;Q<w;Q++)if(b.get(N,N)!==0){for(P=0,M=N;M<E;M++)P+=b.get(M,N)*x.get(M,Q);for(P=-P/b.get(N,N),M=N;M<E;M++)x.set(M,Q,x.get(M,Q)+P*b.get(M,N))}}return x}}class Qn{constructor(b,E={}){if(b=St.checkMatrix(b),b.isEmpty())throw new Error("Matrix must be non-empty");let w=b.rows,x=b.columns;const{computeLeftSingularVectors:M=!0,computeRightSingularVectors:Q=!0,autoTranspose:N=!1}=E;let P=!!M,R=!!Q,J=!1,j;if(w<x)if(!N)j=b.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{j=b.transpose(),w=j.rows,x=j.columns,J=!0;let Y=P;P=R,R=Y}else j=b.clone();let oe=Math.min(w,x),me=Math.min(w+1,x),ne=new Float64Array(me),ce=new z(w,oe),Ce=new z(x,x),q=new Float64Array(x),ye=new Float64Array(w),Oe=new Float64Array(me);for(let Y=0;Y<me;Y++)Oe[Y]=Y;let Ke=Math.min(w-1,x),je=Math.max(0,Math.min(x-2,w)),Ht=Math.max(Ke,je);for(let Y=0;Y<Ht;Y++){if(Y<Ke){ne[Y]=0;for(let fe=Y;fe<w;fe++)ne[Y]=Wt(ne[Y],j.get(fe,Y));if(ne[Y]!==0){j.get(Y,Y)<0&&(ne[Y]=-ne[Y]);for(let fe=Y;fe<w;fe++)j.set(fe,Y,j.get(fe,Y)/ne[Y]);j.set(Y,Y,j.get(Y,Y)+1)}ne[Y]=-ne[Y]}for(let fe=Y+1;fe<x;fe++){if(Y<Ke&&ne[Y]!==0){let Se=0;for(let ve=Y;ve<w;ve++)Se+=j.get(ve,Y)*j.get(ve,fe);Se=-Se/j.get(Y,Y);for(let ve=Y;ve<w;ve++)j.set(ve,fe,j.get(ve,fe)+Se*j.get(ve,Y))}q[fe]=j.get(Y,fe)}if(P&&Y<Ke)for(let fe=Y;fe<w;fe++)ce.set(fe,Y,j.get(fe,Y));if(Y<je){q[Y]=0;for(let fe=Y+1;fe<x;fe++)q[Y]=Wt(q[Y],q[fe]);if(q[Y]!==0){q[Y+1]<0&&(q[Y]=0-q[Y]);for(let fe=Y+1;fe<x;fe++)q[fe]/=q[Y];q[Y+1]+=1}if(q[Y]=-q[Y],Y+1<w&&q[Y]!==0){for(let fe=Y+1;fe<w;fe++)ye[fe]=0;for(let fe=Y+1;fe<w;fe++)for(let Se=Y+1;Se<x;Se++)ye[fe]+=q[Se]*j.get(fe,Se);for(let fe=Y+1;fe<x;fe++){let Se=-q[fe]/q[Y+1];for(let ve=Y+1;ve<w;ve++)j.set(ve,fe,j.get(ve,fe)+Se*ye[ve])}}if(R)for(let fe=Y+1;fe<x;fe++)Ce.set(fe,Y,q[fe])}}let Qe=Math.min(x,w+1);if(Ke<x&&(ne[Ke]=j.get(Ke,Ke)),w<Qe&&(ne[Qe-1]=0),je+1<Qe&&(q[je]=j.get(je,Qe-1)),q[Qe-1]=0,P){for(let Y=Ke;Y<oe;Y++){for(let fe=0;fe<w;fe++)ce.set(fe,Y,0);ce.set(Y,Y,1)}for(let Y=Ke-1;Y>=0;Y--)if(ne[Y]!==0){for(let fe=Y+1;fe<oe;fe++){let Se=0;for(let ve=Y;ve<w;ve++)Se+=ce.get(ve,Y)*ce.get(ve,fe);Se=-Se/ce.get(Y,Y);for(let ve=Y;ve<w;ve++)ce.set(ve,fe,ce.get(ve,fe)+Se*ce.get(ve,Y))}for(let fe=Y;fe<w;fe++)ce.set(fe,Y,-ce.get(fe,Y));ce.set(Y,Y,1+ce.get(Y,Y));for(let fe=0;fe<Y-1;fe++)ce.set(fe,Y,0)}else{for(let fe=0;fe<w;fe++)ce.set(fe,Y,0);ce.set(Y,Y,1)}}if(R)for(let Y=x-1;Y>=0;Y--){if(Y<je&&q[Y]!==0)for(let fe=Y+1;fe<x;fe++){let Se=0;for(let ve=Y+1;ve<x;ve++)Se+=Ce.get(ve,Y)*Ce.get(ve,fe);Se=-Se/Ce.get(Y+1,Y);for(let ve=Y+1;ve<x;ve++)Ce.set(ve,fe,Ce.get(ve,fe)+Se*Ce.get(ve,Y))}for(let fe=0;fe<x;fe++)Ce.set(fe,Y,0);Ce.set(Y,Y,1)}let Pe=Qe-1,Ft=Number.EPSILON;for(;Qe>0;){let Y,fe;for(Y=Qe-2;Y>=-1&&Y!==-1;Y--){const Se=Number.MIN_VALUE+Ft*Math.abs(ne[Y]+Math.abs(ne[Y+1]));if(Math.abs(q[Y])<=Se||Number.isNaN(q[Y])){q[Y]=0;break}}if(Y===Qe-2)fe=4;else{let Se;for(Se=Qe-1;Se>=Y&&Se!==Y;Se--){let ve=(Se!==Qe?Math.abs(q[Se]):0)+(Se!==Y+1?Math.abs(q[Se-1]):0);if(Math.abs(ne[Se])<=Ft*ve){ne[Se]=0;break}}Se===Y?fe=3:Se===Qe-1?fe=1:(fe=2,Y=Se)}switch(Y++,fe){case 1:{let Se=q[Qe-2];q[Qe-2]=0;for(let ve=Qe-2;ve>=Y;ve--){let Gt=Wt(ne[ve],Se),yt=ne[ve]/Gt,Qt=Se/Gt;if(ne[ve]=Gt,ve!==Y&&(Se=-Qt*q[ve-1],q[ve-1]=yt*q[ve-1]),R)for(let Kt=0;Kt<x;Kt++)Gt=yt*Ce.get(Kt,ve)+Qt*Ce.get(Kt,Qe-1),Ce.set(Kt,Qe-1,-Qt*Ce.get(Kt,ve)+yt*Ce.get(Kt,Qe-1)),Ce.set(Kt,ve,Gt)}break}case 2:{let Se=q[Y-1];q[Y-1]=0;for(let ve=Y;ve<Qe;ve++){let Gt=Wt(ne[ve],Se),yt=ne[ve]/Gt,Qt=Se/Gt;if(ne[ve]=Gt,Se=-Qt*q[ve],q[ve]=yt*q[ve],P)for(let Kt=0;Kt<w;Kt++)Gt=yt*ce.get(Kt,ve)+Qt*ce.get(Kt,Y-1),ce.set(Kt,Y-1,-Qt*ce.get(Kt,ve)+yt*ce.get(Kt,Y-1)),ce.set(Kt,ve,Gt)}break}case 3:{const Se=Math.max(Math.abs(ne[Qe-1]),Math.abs(ne[Qe-2]),Math.abs(q[Qe-2]),Math.abs(ne[Y]),Math.abs(q[Y])),ve=ne[Qe-1]/Se,Gt=ne[Qe-2]/Se,yt=q[Qe-2]/Se,Qt=ne[Y]/Se,Kt=q[Y]/Se,Nn=((Gt+ve)*(Gt-ve)+yt*yt)/2,Ai=ve*yt*(ve*yt);let bn=0;(Nn!==0||Ai!==0)&&(Nn<0?bn=0-Math.sqrt(Nn*Nn+Ai):bn=Math.sqrt(Nn*Nn+Ai),bn=Ai/(Nn+bn));let Ti=(Qt+ve)*(Qt-ve)+bn,ta=Qt*Kt;for(let st=Y;st<Qe-1;st++){let Un=Wt(Ti,ta);Un===0&&(Un=Number.MIN_VALUE);let _r=Ti/Un,Ir=ta/Un;if(st!==Y&&(q[st-1]=Un),Ti=_r*ne[st]+Ir*q[st],q[st]=_r*q[st]-Ir*ne[st],ta=Ir*ne[st+1],ne[st+1]=_r*ne[st+1],R)for(let En=0;En<x;En++)Un=_r*Ce.get(En,st)+Ir*Ce.get(En,st+1),Ce.set(En,st+1,-Ir*Ce.get(En,st)+_r*Ce.get(En,st+1)),Ce.set(En,st,Un);if(Un=Wt(Ti,ta),Un===0&&(Un=Number.MIN_VALUE),_r=Ti/Un,Ir=ta/Un,ne[st]=Un,Ti=_r*q[st]+Ir*ne[st+1],ne[st+1]=-Ir*q[st]+_r*ne[st+1],ta=Ir*q[st+1],q[st+1]=_r*q[st+1],P&&st<w-1)for(let En=0;En<w;En++)Un=_r*ce.get(En,st)+Ir*ce.get(En,st+1),ce.set(En,st+1,-Ir*ce.get(En,st)+_r*ce.get(En,st+1)),ce.set(En,st,Un)}q[Qe-2]=Ti;break}case 4:{if(ne[Y]<=0&&(ne[Y]=ne[Y]<0?-ne[Y]:0,R))for(let Se=0;Se<=Pe;Se++)Ce.set(Se,Y,-Ce.get(Se,Y));for(;Y<Pe&&!(ne[Y]>=ne[Y+1]);){let Se=ne[Y];if(ne[Y]=ne[Y+1],ne[Y+1]=Se,R&&Y<x-1)for(let ve=0;ve<x;ve++)Se=Ce.get(ve,Y+1),Ce.set(ve,Y+1,Ce.get(ve,Y)),Ce.set(ve,Y,Se);if(P&&Y<w-1)for(let ve=0;ve<w;ve++)Se=ce.get(ve,Y+1),ce.set(ve,Y+1,ce.get(ve,Y)),ce.set(ve,Y,Se);Y++}Qe--;break}}}if(J){let Y=Ce;Ce=ce,ce=Y}this.m=w,this.n=x,this.s=ne,this.U=ce,this.V=Ce}solve(b){let E=b,w=this.threshold,x=this.s.length,M=z.zeros(x,x);for(let oe=0;oe<x;oe++)Math.abs(this.s[oe])<=w?M.set(oe,oe,0):M.set(oe,oe,1/this.s[oe]);let Q=this.U,N=this.rightSingularVectors,P=N.mmul(M),R=N.rows,J=Q.rows,j=z.zeros(R,J);for(let oe=0;oe<R;oe++)for(let me=0;me<J;me++){let ne=0;for(let ce=0;ce<x;ce++)ne+=P.get(oe,ce)*Q.get(me,ce);j.set(oe,me,ne)}return j.mmul(E)}solveForDiagonal(b){return this.solve(z.diag(b))}inverse(){let b=this.V,E=this.threshold,w=b.rows,x=b.columns,M=new z(w,this.s.length);for(let J=0;J<w;J++)for(let j=0;j<x;j++)Math.abs(this.s[j])>E&&M.set(J,j,b.get(J,j)/this.s[j]);let Q=this.U,N=Q.rows,P=Q.columns,R=new z(w,N);for(let J=0;J<w;J++)for(let j=0;j<N;j++){let oe=0;for(let me=0;me<P;me++)oe+=M.get(J,me)*Q.get(j,me);R.set(J,j,oe)}return R}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let b=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,E=0,w=this.s;for(let x=0,M=w.length;x<M;x++)w[x]>b&&E++;return E}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return z.diag(this.s)}}function qn(I,b=!1){return I=St.checkMatrix(I),b?new Qn(I).inverse():vr(I,z.eye(I.rows))}function vr(I,b,E=!1){return I=St.checkMatrix(I),b=St.checkMatrix(b),E?new Qn(I).solve(b):I.isSquare()?new ir(I).solve(b):new _t(I).solve(b)}function ar(I){if(I=z.checkMatrix(I),I.isSquare()){if(I.columns===0)return 1;let b,E,w,x;if(I.columns===2)return b=I.get(0,0),E=I.get(0,1),w=I.get(1,0),x=I.get(1,1),b*x-E*w;if(I.columns===3){let M,Q,N;return M=new Ne(I,[1,2],[1,2]),Q=new Ne(I,[1,2],[0,2]),N=new Ne(I,[1,2],[0,1]),b=I.get(0,0),E=I.get(0,1),w=I.get(0,2),b*ar(M)-E*ar(Q)+w*ar(N)}else return new ir(I).determinant}else throw Error("determinant can only be calculated for a square matrix")}function $n(I,b){let E=[];for(let w=0;w<I;w++)w!==b&&E.push(w);return E}function rn(I,b,E,w=1e-9,x=1e-9){if(I>x)return new Array(b.rows+1).fill(0);{let M=b.addRow(E,[0]);for(let Q=0;Q<M.rows;Q++)Math.abs(M.get(Q,0))<w&&M.set(Q,0,0);return M.to1DArray()}}function an(I,b={}){const{thresholdValue:E=1e-9,thresholdError:w=1e-9}=b;I=z.checkMatrix(I);let x=I.rows,M=new z(x,x);for(let Q=0;Q<x;Q++){let N=z.columnVector(I.getRow(Q)),P=I.subMatrixRow($n(x,Q)).transpose(),J=new Qn(P).solve(N),j=z.sub(N,P.mmul(J)).abs().max();M.setRow(Q,rn(j,J,Q,E,w))}return M}function cA(I,b=Number.EPSILON){if(I=z.checkMatrix(I),I.isEmpty())return I.transpose();let E=new Qn(I,{autoTranspose:!0}),w=E.leftSingularVectors,x=E.rightSingularVectors,M=E.diagonal;for(let Q=0;Q<M.length;Q++)Math.abs(M[Q])>b?M[Q]=1/M[Q]:M[Q]=0;return x.mmul(z.diag(M).mmul(w.transpose()))}function cs(I,b=I,E={}){I=new z(I);let w=!1;if(typeof b=="object"&&!z.isMatrix(b)&&!r.isAnyArray(b)?(E=b,b=I,w=!0):b=new z(b),I.rows!==b.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:x=!0}=E;x&&(I=I.center("column"),w||(b=b.center("column")));const M=I.transpose().mmul(b);for(let Q=0;Q<M.rows;Q++)for(let N=0;N<M.columns;N++)M.set(Q,N,M.get(Q,N)*(1/(I.rows-1)));return M}function Or(I,b=I,E={}){I=new z(I);let w=!1;if(typeof b=="object"&&!z.isMatrix(b)&&!r.isAnyArray(b)?(E=b,b=I,w=!0):b=new z(b),I.rows!==b.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:x=!0,scale:M=!0}=E;x&&(I.center("column"),w||b.center("column")),M&&(I.scale("column"),w||b.scale("column"));const Q=I.standardDeviation("column",{unbiased:!0}),N=w?Q:b.standardDeviation("column",{unbiased:!0}),P=I.transpose().mmul(b);for(let R=0;R<P.rows;R++)for(let J=0;J<P.columns;J++)P.set(R,J,P.get(R,J)*(1/(Q[R]*N[J]))*(1/(I.rows-1)));return P}class Vr{constructor(b,E={}){const{assumeSymmetric:w=!1}=E;if(b=St.checkMatrix(b),!b.isSquare())throw new Error("Matrix is not a square matrix");if(b.isEmpty())throw new Error("Matrix must be non-empty");let x=b.columns,M=new z(x,x),Q=new Float64Array(x),N=new Float64Array(x),P=b,R,J,j=!1;if(w?j=!0:j=b.isSymmetric(),j){for(R=0;R<x;R++)for(J=0;J<x;J++)M.set(R,J,P.get(R,J));Xl(x,N,Q,M),Zl(x,N,Q,M)}else{let oe=new z(x,x),me=new Float64Array(x);for(J=0;J<x;J++)for(R=0;R<x;R++)oe.set(R,J,P.get(R,J));Cf(x,oe,me,M),Jl(x,N,Q,M,oe)}this.n=x,this.e=N,this.d=Q,this.V=M}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let b=this.n,E=this.e,w=this.d,x=new z(b,b),M,Q;for(M=0;M<b;M++){for(Q=0;Q<b;Q++)x.set(M,Q,0);x.set(M,M,w[M]),E[M]>0?x.set(M,M+1,E[M]):E[M]<0&&x.set(M,M-1,E[M])}return x}}function Xl(I,b,E,w){let x,M,Q,N,P,R,J,j;for(P=0;P<I;P++)E[P]=w.get(I-1,P);for(N=I-1;N>0;N--){for(j=0,Q=0,R=0;R<N;R++)j=j+Math.abs(E[R]);if(j===0)for(b[N]=E[N-1],P=0;P<N;P++)E[P]=w.get(N-1,P),w.set(N,P,0),w.set(P,N,0);else{for(R=0;R<N;R++)E[R]/=j,Q+=E[R]*E[R];for(x=E[N-1],M=Math.sqrt(Q),x>0&&(M=-M),b[N]=j*M,Q=Q-x*M,E[N-1]=x-M,P=0;P<N;P++)b[P]=0;for(P=0;P<N;P++){for(x=E[P],w.set(P,N,x),M=b[P]+w.get(P,P)*x,R=P+1;R<=N-1;R++)M+=w.get(R,P)*E[R],b[R]+=w.get(R,P)*x;b[P]=M}for(x=0,P=0;P<N;P++)b[P]/=Q,x+=b[P]*E[P];for(J=x/(Q+Q),P=0;P<N;P++)b[P]-=J*E[P];for(P=0;P<N;P++){for(x=E[P],M=b[P],R=P;R<=N-1;R++)w.set(R,P,w.get(R,P)-(x*b[R]+M*E[R]));E[P]=w.get(N-1,P),w.set(N,P,0)}}E[N]=Q}for(N=0;N<I-1;N++){if(w.set(I-1,N,w.get(N,N)),w.set(N,N,1),Q=E[N+1],Q!==0){for(R=0;R<=N;R++)E[R]=w.get(R,N+1)/Q;for(P=0;P<=N;P++){for(M=0,R=0;R<=N;R++)M+=w.get(R,N+1)*w.get(R,P);for(R=0;R<=N;R++)w.set(R,P,w.get(R,P)-M*E[R])}}for(R=0;R<=N;R++)w.set(R,N+1,0)}for(P=0;P<I;P++)E[P]=w.get(I-1,P),w.set(I-1,P,0);w.set(I-1,I-1,1),b[0]=0}function Zl(I,b,E,w){let x,M,Q,N,P,R,J,j,oe,me,ne,ce,Ce,q,ye,Oe;for(Q=1;Q<I;Q++)b[Q-1]=b[Q];b[I-1]=0;let Ke=0,je=0,Ht=Number.EPSILON;for(R=0;R<I;R++){for(je=Math.max(je,Math.abs(E[R])+Math.abs(b[R])),J=R;J<I&&!(Math.abs(b[J])<=Ht*je);)J++;if(J>R)do{for(x=E[R],j=(E[R+1]-x)/(2*b[R]),oe=Wt(j,1),j<0&&(oe=-oe),E[R]=b[R]/(j+oe),E[R+1]=b[R]*(j+oe),me=E[R+1],M=x-E[R],Q=R+2;Q<I;Q++)E[Q]-=M;for(Ke=Ke+M,j=E[J],ne=1,ce=ne,Ce=ne,q=b[R+1],ye=0,Oe=0,Q=J-1;Q>=R;Q--)for(Ce=ce,ce=ne,Oe=ye,x=ne*b[Q],M=ne*j,oe=Wt(j,b[Q]),b[Q+1]=ye*oe,ye=b[Q]/oe,ne=j/oe,j=ne*E[Q]-ye*x,E[Q+1]=M+ye*(ne*x+ye*E[Q]),P=0;P<I;P++)M=w.get(P,Q+1),w.set(P,Q+1,ye*w.get(P,Q)+ne*M),w.set(P,Q,ne*w.get(P,Q)-ye*M);j=-ye*Oe*Ce*q*b[R]/me,b[R]=ye*j,E[R]=ne*j}while(Math.abs(b[R])>Ht*je);E[R]=E[R]+Ke,b[R]=0}for(Q=0;Q<I-1;Q++){for(P=Q,j=E[Q],N=Q+1;N<I;N++)E[N]<j&&(P=N,j=E[N]);if(P!==Q)for(E[P]=E[Q],E[Q]=j,N=0;N<I;N++)j=w.get(N,Q),w.set(N,Q,w.get(N,P)),w.set(N,P,j)}}function Cf(I,b,E,w){let x=0,M=I-1,Q,N,P,R,J,j,oe;for(j=x+1;j<=M-1;j++){for(oe=0,R=j;R<=M;R++)oe=oe+Math.abs(b.get(R,j-1));if(oe!==0){for(P=0,R=M;R>=j;R--)E[R]=b.get(R,j-1)/oe,P+=E[R]*E[R];for(N=Math.sqrt(P),E[j]>0&&(N=-N),P=P-E[j]*N,E[j]=E[j]-N,J=j;J<I;J++){for(Q=0,R=M;R>=j;R--)Q+=E[R]*b.get(R,J);for(Q=Q/P,R=j;R<=M;R++)b.set(R,J,b.get(R,J)-Q*E[R])}for(R=0;R<=M;R++){for(Q=0,J=M;J>=j;J--)Q+=E[J]*b.get(R,J);for(Q=Q/P,J=j;J<=M;J++)b.set(R,J,b.get(R,J)-Q*E[J])}E[j]=oe*E[j],b.set(j,j-1,oe*N)}}for(R=0;R<I;R++)for(J=0;J<I;J++)w.set(R,J,R===J?1:0);for(j=M-1;j>=x+1;j--)if(b.get(j,j-1)!==0){for(R=j+1;R<=M;R++)E[R]=b.get(R,j-1);for(J=j;J<=M;J++){for(N=0,R=j;R<=M;R++)N+=E[R]*w.get(R,J);for(N=N/E[j]/b.get(j,j-1),R=j;R<=M;R++)w.set(R,J,w.get(R,J)+N*E[R])}}}function Jl(I,b,E,w,x){let M=I-1,Q=0,N=I-1,P=Number.EPSILON,R=0,J=0,j=0,oe=0,me=0,ne=0,ce=0,Ce=0,q,ye,Oe,Ke,je,Ht,Qe,Pe,Ft,Y,fe,Se,ve,Gt,yt;for(q=0;q<I;q++)for((q<Q||q>N)&&(E[q]=x.get(q,q),b[q]=0),ye=Math.max(q-1,0);ye<I;ye++)J=J+Math.abs(x.get(q,ye));for(;M>=Q;){for(Ke=M;Ke>Q&&(ne=Math.abs(x.get(Ke-1,Ke-1))+Math.abs(x.get(Ke,Ke)),ne===0&&(ne=J),!(Math.abs(x.get(Ke,Ke-1))<P*ne));)Ke--;if(Ke===M)x.set(M,M,x.get(M,M)+R),E[M]=x.get(M,M),b[M]=0,M--,Ce=0;else if(Ke===M-1){if(Qe=x.get(M,M-1)*x.get(M-1,M),j=(x.get(M-1,M-1)-x.get(M,M))/2,oe=j*j+Qe,ce=Math.sqrt(Math.abs(oe)),x.set(M,M,x.get(M,M)+R),x.set(M-1,M-1,x.get(M-1,M-1)+R),Pe=x.get(M,M),oe>=0){for(ce=j>=0?j+ce:j-ce,E[M-1]=Pe+ce,E[M]=E[M-1],ce!==0&&(E[M]=Pe-Qe/ce),b[M-1]=0,b[M]=0,Pe=x.get(M,M-1),ne=Math.abs(Pe)+Math.abs(ce),j=Pe/ne,oe=ce/ne,me=Math.sqrt(j*j+oe*oe),j=j/me,oe=oe/me,ye=M-1;ye<I;ye++)ce=x.get(M-1,ye),x.set(M-1,ye,oe*ce+j*x.get(M,ye)),x.set(M,ye,oe*x.get(M,ye)-j*ce);for(q=0;q<=M;q++)ce=x.get(q,M-1),x.set(q,M-1,oe*ce+j*x.get(q,M)),x.set(q,M,oe*x.get(q,M)-j*ce);for(q=Q;q<=N;q++)ce=w.get(q,M-1),w.set(q,M-1,oe*ce+j*w.get(q,M)),w.set(q,M,oe*w.get(q,M)-j*ce)}else E[M-1]=Pe+j,E[M]=Pe+j,b[M-1]=ce,b[M]=-ce;M=M-2,Ce=0}else{if(Pe=x.get(M,M),Ft=0,Qe=0,Ke<M&&(Ft=x.get(M-1,M-1),Qe=x.get(M,M-1)*x.get(M-1,M)),Ce===10){for(R+=Pe,q=Q;q<=M;q++)x.set(q,q,x.get(q,q)-Pe);ne=Math.abs(x.get(M,M-1))+Math.abs(x.get(M-1,M-2)),Pe=Ft=.75*ne,Qe=-.4375*ne*ne}if(Ce===30&&(ne=(Ft-Pe)/2,ne=ne*ne+Qe,ne>0)){for(ne=Math.sqrt(ne),Ft<Pe&&(ne=-ne),ne=Pe-Qe/((Ft-Pe)/2+ne),q=Q;q<=M;q++)x.set(q,q,x.get(q,q)-ne);R+=ne,Pe=Ft=Qe=.964}for(Ce=Ce+1,je=M-2;je>=Ke&&(ce=x.get(je,je),me=Pe-ce,ne=Ft-ce,j=(me*ne-Qe)/x.get(je+1,je)+x.get(je,je+1),oe=x.get(je+1,je+1)-ce-me-ne,me=x.get(je+2,je+1),ne=Math.abs(j)+Math.abs(oe)+Math.abs(me),j=j/ne,oe=oe/ne,me=me/ne,!(je===Ke||Math.abs(x.get(je,je-1))*(Math.abs(oe)+Math.abs(me))<P*(Math.abs(j)*(Math.abs(x.get(je-1,je-1))+Math.abs(ce)+Math.abs(x.get(je+1,je+1))))));)je--;for(q=je+2;q<=M;q++)x.set(q,q-2,0),q>je+2&&x.set(q,q-3,0);for(Oe=je;Oe<=M-1&&(Gt=Oe!==M-1,Oe!==je&&(j=x.get(Oe,Oe-1),oe=x.get(Oe+1,Oe-1),me=Gt?x.get(Oe+2,Oe-1):0,Pe=Math.abs(j)+Math.abs(oe)+Math.abs(me),Pe!==0&&(j=j/Pe,oe=oe/Pe,me=me/Pe)),Pe!==0);Oe++)if(ne=Math.sqrt(j*j+oe*oe+me*me),j<0&&(ne=-ne),ne!==0){for(Oe!==je?x.set(Oe,Oe-1,-ne*Pe):Ke!==je&&x.set(Oe,Oe-1,-x.get(Oe,Oe-1)),j=j+ne,Pe=j/ne,Ft=oe/ne,ce=me/ne,oe=oe/j,me=me/j,ye=Oe;ye<I;ye++)j=x.get(Oe,ye)+oe*x.get(Oe+1,ye),Gt&&(j=j+me*x.get(Oe+2,ye),x.set(Oe+2,ye,x.get(Oe+2,ye)-j*ce)),x.set(Oe,ye,x.get(Oe,ye)-j*Pe),x.set(Oe+1,ye,x.get(Oe+1,ye)-j*Ft);for(q=0;q<=Math.min(M,Oe+3);q++)j=Pe*x.get(q,Oe)+Ft*x.get(q,Oe+1),Gt&&(j=j+ce*x.get(q,Oe+2),x.set(q,Oe+2,x.get(q,Oe+2)-j*me)),x.set(q,Oe,x.get(q,Oe)-j),x.set(q,Oe+1,x.get(q,Oe+1)-j*oe);for(q=Q;q<=N;q++)j=Pe*w.get(q,Oe)+Ft*w.get(q,Oe+1),Gt&&(j=j+ce*w.get(q,Oe+2),w.set(q,Oe+2,w.get(q,Oe+2)-j*me)),w.set(q,Oe,w.get(q,Oe)-j),w.set(q,Oe+1,w.get(q,Oe+1)-j*oe)}}}if(J!==0){for(M=I-1;M>=0;M--)if(j=E[M],oe=b[M],oe===0)for(Ke=M,x.set(M,M,1),q=M-1;q>=0;q--){for(Qe=x.get(q,q)-j,me=0,ye=Ke;ye<=M;ye++)me=me+x.get(q,ye)*x.get(ye,M);if(b[q]<0)ce=Qe,ne=me;else if(Ke=q,b[q]===0?x.set(q,M,Qe!==0?-me/Qe:-me/(P*J)):(Pe=x.get(q,q+1),Ft=x.get(q+1,q),oe=(E[q]-j)*(E[q]-j)+b[q]*b[q],Ht=(Pe*ne-ce*me)/oe,x.set(q,M,Ht),x.set(q+1,M,Math.abs(Pe)>Math.abs(ce)?(-me-Qe*Ht)/Pe:(-ne-Ft*Ht)/ce)),Ht=Math.abs(x.get(q,M)),P*Ht*Ht>1)for(ye=q;ye<=M;ye++)x.set(ye,M,x.get(ye,M)/Ht)}else if(oe<0)for(Ke=M-1,Math.abs(x.get(M,M-1))>Math.abs(x.get(M-1,M))?(x.set(M-1,M-1,oe/x.get(M,M-1)),x.set(M-1,M,-(x.get(M,M)-j)/x.get(M,M-1))):(yt=ea(0,-x.get(M-1,M),x.get(M-1,M-1)-j,oe),x.set(M-1,M-1,yt[0]),x.set(M-1,M,yt[1])),x.set(M,M-1,0),x.set(M,M,1),q=M-2;q>=0;q--){for(Y=0,fe=0,ye=Ke;ye<=M;ye++)Y=Y+x.get(q,ye)*x.get(ye,M-1),fe=fe+x.get(q,ye)*x.get(ye,M);if(Qe=x.get(q,q)-j,b[q]<0)ce=Qe,me=Y,ne=fe;else if(Ke=q,b[q]===0?(yt=ea(-Y,-fe,Qe,oe),x.set(q,M-1,yt[0]),x.set(q,M,yt[1])):(Pe=x.get(q,q+1),Ft=x.get(q+1,q),Se=(E[q]-j)*(E[q]-j)+b[q]*b[q]-oe*oe,ve=(E[q]-j)*2*oe,Se===0&&ve===0&&(Se=P*J*(Math.abs(Qe)+Math.abs(oe)+Math.abs(Pe)+Math.abs(Ft)+Math.abs(ce))),yt=ea(Pe*me-ce*Y+oe*fe,Pe*ne-ce*fe-oe*Y,Se,ve),x.set(q,M-1,yt[0]),x.set(q,M,yt[1]),Math.abs(Pe)>Math.abs(ce)+Math.abs(oe)?(x.set(q+1,M-1,(-Y-Qe*x.get(q,M-1)+oe*x.get(q,M))/Pe),x.set(q+1,M,(-fe-Qe*x.get(q,M)-oe*x.get(q,M-1))/Pe)):(yt=ea(-me-Ft*x.get(q,M-1),-ne-Ft*x.get(q,M),ce,oe),x.set(q+1,M-1,yt[0]),x.set(q+1,M,yt[1]))),Ht=Math.max(Math.abs(x.get(q,M-1)),Math.abs(x.get(q,M))),P*Ht*Ht>1)for(ye=q;ye<=M;ye++)x.set(ye,M-1,x.get(ye,M-1)/Ht),x.set(ye,M,x.get(ye,M)/Ht)}for(q=0;q<I;q++)if(q<Q||q>N)for(ye=q;ye<I;ye++)w.set(q,ye,x.get(q,ye));for(ye=I-1;ye>=Q;ye--)for(q=Q;q<=N;q++){for(ce=0,Oe=Q;Oe<=Math.min(ye,N);Oe++)ce=ce+w.get(q,Oe)*x.get(Oe,ye);w.set(q,ye,ce)}}}function ea(I,b,E,w){let x,M;return Math.abs(E)>Math.abs(w)?(x=w/E,M=E+x*w,[(I+x*b)/M,(b-x*I)/M]):(x=E/w,M=w+x*E,[(x*I+b)/M,(x*b-I)/M])}class ec{constructor(b){if(b=St.checkMatrix(b),!b.isSymmetric())throw new Error("Matrix is not symmetric");let E=b,w=E.rows,x=new z(w,w),M=!0,Q,N,P;for(N=0;N<w;N++){let R=0;for(P=0;P<N;P++){let J=0;for(Q=0;Q<P;Q++)J+=x.get(P,Q)*x.get(N,Q);J=(E.get(N,P)-J)/x.get(P,P),x.set(N,P,J),R=R+J*J}for(R=E.get(N,N)-R,M&=R>0,x.set(N,N,Math.sqrt(Math.max(R,0))),P=N+1;P<w;P++)x.set(N,P,0)}this.L=x,this.positiveDefinite=!!M}isPositiveDefinite(){return this.positiveDefinite}solve(b){b=St.checkMatrix(b);let E=this.L,w=E.rows;if(b.rows!==w)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let x=b.columns,M=b.clone(),Q,N,P;for(P=0;P<w;P++)for(N=0;N<x;N++){for(Q=0;Q<P;Q++)M.set(P,N,M.get(P,N)-M.get(Q,N)*E.get(P,Q));M.set(P,N,M.get(P,N)/E.get(P,P))}for(P=w-1;P>=0;P--)for(N=0;N<x;N++){for(Q=P+1;Q<w;Q++)M.set(P,N,M.get(P,N)-M.get(Q,N)*E.get(Q,P));M.set(P,N,M.get(P,N)/E.get(P,P))}return M}get lowerTriangularMatrix(){return this.L}}class tc{constructor(b,E={}){b=St.checkMatrix(b);let{Y:w}=E;const{scaleScores:x=!1,maxIterations:M=1e3,terminationCriteria:Q=1e-10}=E;let N;if(w){if(r.isAnyArray(w)&&typeof w[0]=="number"?w=z.columnVector(w):w=St.checkMatrix(w),w.rows!==b.rows)throw new Error("Y should have the same number of rows as X");N=w.getColumnVector(0)}else N=b.getColumnVector(0);let P=1,R,J,j,oe;for(let me=0;me<M&&P>Q;me++)j=b.transpose().mmul(N).div(N.transpose().mmul(N).get(0,0)),j=j.div(j.norm()),R=b.mmul(j).div(j.transpose().mmul(j).get(0,0)),me>0&&(P=R.clone().sub(oe).pow(2).sum()),oe=R.clone(),w?(J=w.transpose().mmul(R).div(R.transpose().mmul(R).get(0,0)),J=J.div(J.norm()),N=w.mmul(J).div(J.transpose().mmul(J).get(0,0))):N=R;if(w){let me=b.transpose().mmul(R).div(R.transpose().mmul(R).get(0,0));me=me.div(me.norm());let ne=b.clone().sub(R.clone().mmul(me.transpose())),ce=N.transpose().mmul(R).div(R.transpose().mmul(R).get(0,0)),Ce=w.clone().sub(R.clone().mulS(ce.get(0,0)).mmul(J.transpose()));this.t=R,this.p=me.transpose(),this.w=j.transpose(),this.q=J,this.u=N,this.s=R.transpose().mmul(R),this.xResidual=ne,this.yResidual=Ce,this.betas=ce}else this.w=j.transpose(),this.s=R.transpose().mmul(R).sqrt(),x?this.t=R.clone().div(this.s.get(0,0)):this.t=R,this.xResidual=b.sub(R.mmul(j.transpose()))}}return rt.AbstractMatrix=re,rt.CHO=ec,rt.CholeskyDecomposition=ec,rt.DistanceMatrix=Ae,rt.EVD=Vr,rt.EigenvalueDecomposition=Vr,rt.LU=ir,rt.LuDecomposition=ir,rt.Matrix=z,rt.MatrixColumnSelectionView=Ue,rt.MatrixColumnView=Le,rt.MatrixFlipColumnView=at,rt.MatrixFlipRowView=lt,rt.MatrixRowSelectionView=pt,rt.MatrixRowView=ct,rt.MatrixSelectionView=Ne,rt.MatrixSubView=ht,rt.MatrixTransposeView=nt,rt.NIPALS=tc,rt.Nipals=tc,rt.QR=_t,rt.QrDecomposition=_t,rt.SVD=Qn,rt.SingularValueDecomposition=Qn,rt.SymmetricMatrix=ee,rt.WrapperMatrix1D=gr,rt.WrapperMatrix2D=St,rt.correlation=Or,rt.covariance=cs,rt.default=z,rt.determinant=ar,rt.inverse=qn,rt.linearDependencies=an,rt.pseudoInverse=cA,rt.solve=vr,rt.wrap=Ji,rt}var Cd=P7();const yC=Qh(Cd),Ga=Cd.Matrix,wQ=Cd.SingularValueDecomposition;yC.Matrix?yC.Matrix:Cd.Matrix;const R7={center:[0,0],linkDistance:50};class BQ{constructor(e={}){this.options=e,this.id="mds",this.options=Object.assign(Object.assign({},R7),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,e,t)})}genericMDSLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a=[0,0],linkDistance:s=50}=i,o=t.getAllNodes(),A=t.getAllEdges();if(!(o!=null&&o.length)||o.length===1)return to(t,e,a);const l=gQ({nodes:o,edges:A}),c=fQ(l);D7(c);const u=O$(c,s),h=H7(u),d=[];return h.forEach((g,v)=>{const p=Dr(o[v]);p.data.x=g[0]+a[0],p.data.y=g[1]+a[1],d.push(p)}),e&&d.forEach(g=>t.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:A}})}}const D7=r=>{let e=-999999;r.forEach(t=>{t.forEach(n=>{n!==1/0&&e<n&&(e=n)})}),r.forEach((t,n)=>{t.forEach((i,a)=>{i===1/0&&(r[n][a]=e)})})},H7=r=>{const t=Ga.mul(Ga.pow(r,2),-.5),n=t.mean("row"),i=t.mean("column"),a=t.mean();t.add(a).subRowVector(n).subColumnVector(i);const s=new wQ(t),o=Ga.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(A=>Ga.mul([A],[o]).toJSON()[0].splice(0,2))};function B1(r){return!!r.tick&&!!r.stop}const G7={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},K7={center:[0,0],comboPadding:10,treeKey:"combo"};class z7{constructor(e={}){this.options=e,this.id="comboCombined",this.options=Object.assign(Object.assign({},K7),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,e,t)})}genericComboCombinedLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,A=t.getAllNodes().filter(T=>!T.data._isCombo),l=t.getAllNodes().filter(T=>T.data._isCombo),c=t.getAllEdges(),u=A==null?void 0:A.length;if(!u||u===1)return to(t,e,a);const h=[],d=new Map;A.forEach(T=>{d.set(T.id,T)});const f=new Map;l.forEach(T=>{f.set(T.id,T)});const g=new Map,v=this.getInnerGraphs(t,s,d,f,c,i,g);yield Promise.all(v);const p=new Map,y=[],m=new Map;let B=!0;t.getRoots(s).forEach(T=>{const O=g.get(T.id),_=f.get(T.id)||d.get(T.id),k={id:T.id,data:Object.assign(Object.assign({},T.data),{x:O.data.x||_.data.x,y:O.data.y||_.data.y,fx:O.data.fx||_.data.fx,fy:O.data.fy||_.data.fy,mass:O.data.mass||_.data.mass,size:O.data.size})};y.push(k),p.set(T.id,!0),!isNaN(k.data.x)&&k.data.x!==0&&!isNaN(k.data.y)&&k.data.y!==0?B=!1:(k.data.x=Math.random()*100,k.data.y=Math.random()*100),y1(t,[T],L=>{L.id!==T.id&&m.set(L.id,T.id)},"TB",s)});const C=[];c.forEach(T=>{const O=m.get(T.source)||T.source,_=m.get(T.target)||T.target;O!==_&&p.has(O)&&p.has(_)&&C.push({id:T.id,source:O,target:_,data:{}})});let S;if(y!=null&&y.length){if(y.length===1)y[0].data.x=a[0],y[0].data.y=a[1];else{const T=new Mn({nodes:y,edges:C}),O=o||new mQ;B&&G7[O.id]&&(yield(y.length<100?new BQ:new w1).assign(T));const _=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},O.id==="force"?{gravity:1,factor:4,linkDistance:(k,L,U)=>{const G=Math.max(...L.data.size)||32,W=Math.max(...U.data.size)||32;return G/2+W/2+200}}:{});S=yield mC(O,T,_)}g.forEach(T=>{var O;const _=S.nodes.find(U=>U.id===T.id);if(_){const{x:U,y:G}=_.data;T.data.visited=!0,T.data.x=U,T.data.y=G,h.push({id:T.id,data:{x:U,y:G}})}const{x:k,y:L}=T.data;(O=T.data.nodes)===null||O===void 0||O.forEach(U=>{h.push({id:U.id,data:{x:U.data.x+k,y:U.data.y+L}})})}),g.forEach(({data:T})=>{const{x:O,y:_,visited:k,nodes:L}=T;L==null||L.forEach(U=>{if(!k){const G=h.find(W=>W.id===U.id);G.data.x+=O||0,G.data.y+=_||0}})})}return e&&h.forEach(T=>{t.mergeNodeData(T.id,{x:T.data.x,y:T.data.y})}),{nodes:h,edges:c}})}initVals(e){const t=Object.assign({},e),{nodeSize:n,spacing:i,comboPadding:a}=e;let s,o;if(Be(i)?o=()=>i:Te(i)?o=i:o=()=>0,t.spacing=o,!n)s=l=>{const c=o(l);return l.size?la(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+c)/2:un(l.size)?((l.size.width>l.size.height?l.size.width:l.size.height)+c)/2:(l.size+c)/2:32+c/2};else if(Te(n))s=l=>{const c=n(l),u=o(l);return la(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+u)/2:((c||32)+u)/2};else if(la(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=u=>c+o(u)/2}else{const l=n/2;s=c=>l+o(c)/2}t.nodeSize=s;let A;return Be(a)?A=()=>a:la(a)?A=()=>Math.max.apply(null,a):Te(a)?A=a:A=()=>0,t.comboPadding=A,t}getInnerGraphs(e,t,n,i,a,s,o){const{nodeSize:A,comboPadding:l,spacing:c,innerLayout:u}=s,h=u||new w1({}),d={center:[0,0],preventOverlap:!0,nodeSpacing:c},f=[],g=v=>{let p=(l==null?void 0:l(v))||10;return la(p)&&(p=Math.max(...p)),{size:p?[p*2,p*2]:[30,30],padding:p}};return e.getRoots(t).forEach(v=>{o.set(v.id,{id:v.id,data:{nodes:[],size:g(v).size}});let p=Promise.resolve();y1(e,[v],y=>{var m;if(!y.data._isCombo)return;const{size:B,padding:C}=g(y);if(!(!((m=e.getChildren(y.id,t))===null||m===void 0)&&m.length))o.set(y.id,{id:y.id,data:Object.assign(Object.assign({},y.data),{size:B})});else{const S=o.get(y.id);o.set(y.id,{id:y.id,data:Object.assign({nodes:[]},S==null?void 0:S.data)});const F=new Map,T=e.getChildren(y.id,t).map(k=>{if(k.data._isCombo)return o.has(k.id)||o.set(k.id,{id:k.id,data:Object.assign({},k.data)}),F.set(k.id,!0),o.get(k.id);const L=n.get(k.id)||i.get(k.id);return F.set(k.id,!0),{id:k.id,data:Object.assign(Object.assign({},L.data),k.data)}}),O={nodes:T,edges:a.filter(k=>F.has(k.source)&&F.has(k.target))};let _=1/0;T.forEach(k=>{var L;let{size:U}=k.data;U||(U=((L=o.get(k.id))===null||L===void 0?void 0:L.data.size)||(A==null?void 0:A(k))||[30,30]),Be(U)&&(U=[U,U]);const[G,W]=U;_>G&&(_=G),_>W&&(_=W),k.data.size=U}),p=p.then(()=>Je(this,void 0,void 0,function*(){const k=new Mn(O);yield mC(h,k,d,!0);const{minX:L,minY:U,maxX:G,maxY:W}=_$(T),V={x:(G+L)/2,y:(W+U)/2};O.nodes.forEach(D=>{D.data.x-=V.x,D.data.y-=V.y});const K=[Math.max(G-L,_)+C*2,Math.max(W-U,_)+C*2];o.get(y.id).data.size=K,o.get(y.id).data.nodes=T}))}return!0},"BT",t),f.push(p)}),f}}function mC(r,e,t,n){var i;return Je(this,void 0,void 0,function*(){return B1(r)?(r.execute(e,t),r.stop(),r.tick((i=t.iterations)!==null&&i!==void 0?i:300)):n?yield r.assign(e,t):yield r.execute(e,t)})}function V7(r,e){var t,n=1;r==null&&(r=0),e==null&&(e=0);function i(){var a,s=t.length,o,A=0,l=0;for(a=0;a<s;++a)o=t[a],A+=o.x,l+=o.y;for(A=(A/s-r)*n,l=(l/s-e)*n,a=0;a<s;++a)o=t[a],o.x-=A,o.y-=l}return i.initialize=function(a){t=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(e=+a,i):e},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function Fn(r){return function(){return r}}function Ka(r){return(r()-.5)*1e-6}function j7(r){return r.x+r.vx}function W7(r){return r.y+r.vy}function q7(r){var e,t,n,i=1,a=1;typeof r!="function"&&(r=Fn(r==null?1:+r));function s(){for(var l,c=e.length,u,h,d,f,g,v,p=0;p<a;++p)for(u=xd(e,j7,W7).visitAfter(o),l=0;l<c;++l)h=e[l],g=t[h.index],v=g*g,d=h.x+h.vx,f=h.y+h.vy,u.visit(y);function y(m,B,C,S,F){var T=m.data,O=m.r,_=g+O;if(T){if(T.index>h.index){var k=d-T.x-T.vx,L=f-T.y-T.vy,U=k*k+L*L;U<_*_&&(k===0&&(k=Ka(n),U+=k*k),L===0&&(L=Ka(n),U+=L*L),U=(_-(U=Math.sqrt(U)))/U*i,h.vx+=(k*=U)*(_=(O*=O)/(v+O)),h.vy+=(L*=U)*_,T.vx-=k*(_=1-_),T.vy-=L*_)}return}return B>d+_||S<d-_||C>f+_||F<f-_}}function o(l){if(l.data)return l.r=t[l.data.index];for(var c=l.r=0;c<4;++c)l[c]&&l[c].r>l.r&&(l.r=l[c].r)}function A(){if(e){var l,c=e.length,u;for(t=new Array(c),l=0;l<c;++l)u=e[l],t[u.index]=+r(u,l,e)}}return s.initialize=function(l,c){e=l,n=c,A()},s.iterations=function(l){return arguments.length?(a=+l,s):a},s.strength=function(l){return arguments.length?(i=+l,s):i},s.radius=function(l){return arguments.length?(r=typeof l=="function"?l:Fn(+l),A(),s):r},s}function $7(r){return r.index}function wC(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function Y7(r){var e=$7,t=u,n,i=Fn(30),a,s,o,A,l,c=1;r==null&&(r=[]);function u(v){return 1/Math.min(o[v.source.index],o[v.target.index])}function h(v){for(var p=0,y=r.length;p<c;++p)for(var m=0,B,C,S,F,T,O,_;m<y;++m)B=r[m],C=B.source,S=B.target,F=S.x+S.vx-C.x-C.vx||Ka(l),T=S.y+S.vy-C.y-C.vy||Ka(l),O=Math.sqrt(F*F+T*T),O=(O-a[m])/O*v*n[m],F*=O,T*=O,S.vx-=F*(_=A[m]),S.vy-=T*_,C.vx+=F*(_=1-_),C.vy+=T*_}function d(){if(s){var v,p=s.length,y=r.length,m=new Map(s.map((C,S)=>[e(C,S,s),C])),B;for(v=0,o=new Array(p);v<y;++v)B=r[v],B.index=v,typeof B.source!="object"&&(B.source=wC(m,B.source)),typeof B.target!="object"&&(B.target=wC(m,B.target)),o[B.source.index]=(o[B.source.index]||0)+1,o[B.target.index]=(o[B.target.index]||0)+1;for(v=0,A=new Array(y);v<y;++v)B=r[v],A[v]=o[B.source.index]/(o[B.source.index]+o[B.target.index]);n=new Array(y),f(),a=new Array(y),g()}}function f(){if(s)for(var v=0,p=r.length;v<p;++v)n[v]=+t(r[v],v,r)}function g(){if(s)for(var v=0,p=r.length;v<p;++v)a[v]=+i(r[v],v,r)}return h.initialize=function(v,p){s=v,l=p,d()},h.links=function(v){return arguments.length?(r=v,d(),h):r},h.id=function(v){return arguments.length?(e=v,h):e},h.iterations=function(v){return arguments.length?(c=+v,h):c},h.strength=function(v){return arguments.length?(t=typeof v=="function"?v:Fn(+v),f(),h):t},h.distance=function(v){return arguments.length?(i=typeof v=="function"?v:Fn(+v),g(),h):i},h}var X7={value:()=>{}};function bQ(){for(var r=0,e=arguments.length,t={},n;r<e;++r){if(!(n=arguments[r]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new Lu(t)}function Lu(r){this._=r}function Z7(r,e){return r.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}Lu.prototype=bQ.prototype={constructor:Lu,on:function(r,e){var t=this._,n=Z7(r+"",t),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(r=n[a]).type)&&(i=J7(t[i],r.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<s;)if(i=(r=n[a]).type)t[i]=BC(t[i],r.name,e);else if(e==null)for(i in t)t[i]=BC(t[i],r.name,null);return this},copy:function(){var r={},e=this._;for(var t in e)r[t]=e[t].slice();return new Lu(r)},call:function(r,e){if((i=arguments.length-2)>0)for(var t=new Array(i),n=0,i,a;n<i;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(a=this._[r],n=0,i=a.length;n<i;++n)a[n].value.apply(e,t)},apply:function(r,e,t){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],i=0,a=n.length;i<a;++i)n[i].value.apply(e,t)}};function J7(r,e){for(var t=0,n=r.length,i;t<n;++t)if((i=r[t]).name===e)return i.value}function BC(r,e,t){for(var n=0,i=r.length;n<i;++n)if(r[n].name===e){r[n]=X7,r=r.slice(0,n).concat(r.slice(n+1));break}return t!=null&&r.push({name:e,value:t}),r}var $o=0,RA=0,CA=0,EQ=1e3,xh,DA,Ch=0,qs=0,Sd=0,bl=typeof performance=="object"&&performance.now?performance:Date,xQ=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function CQ(){return qs||(xQ(eY),qs=bl.now()+Sd)}function eY(){qs=0}function b1(){this._call=this._time=this._next=null}b1.prototype=SQ.prototype={constructor:b1,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?CQ():+t)+(e==null?0:+e),!this._next&&DA!==this&&(DA?DA._next=this:xh=this,DA=this),this._call=r,this._time=t,E1()},stop:function(){this._call&&(this._call=null,this._time=1/0,E1())}};function SQ(r,e,t){var n=new b1;return n.restart(r,e,t),n}function tY(){CQ(),++$o;for(var r=xh,e;r;)(e=qs-r._time)>=0&&r._call.call(void 0,e),r=r._next;--$o}function bC(){qs=(Ch=bl.now())+Sd,$o=RA=0;try{tY()}finally{$o=0,rY(),qs=0}}function nY(){var r=bl.now(),e=r-Ch;e>EQ&&(Sd-=e,Ch=r)}function rY(){for(var r,e=xh,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:xh=t);DA=r,E1(n)}function E1(r){if(!$o){RA&&(RA=clearTimeout(RA));var e=r-qs;e>24?(r<1/0&&(RA=setTimeout(bC,r-bl.now()-Sd)),CA&&(CA=clearInterval(CA))):(CA||(Ch=bl.now(),CA=setInterval(nY,EQ)),$o=1,xQ(bC))}}const iY=1664525,aY=1013904223,EC=4294967296;function sY(){let r=1;return()=>(r=(iY*r+aY)%EC)/EC}function oY(r){return r.x}function AY(r){return r.y}var lY=10,cY=Math.PI*(3-Math.sqrt(5));function uY(r){var e,t=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,A=SQ(u),l=bQ("tick","end"),c=sY();r==null&&(r=[]);function u(){h(),l.call("tick",e),t<n&&(A.stop(),l.call("end",e))}function h(g){var v,p=r.length,y;g===void 0&&(g=1);for(var m=0;m<g;++m)for(t+=(a-t)*i,o.forEach(function(B){B(t)}),v=0;v<p;++v)y=r[v],y.fx==null?y.x+=y.vx*=s:(y.x=y.fx,y.vx=0),y.fy==null?y.y+=y.vy*=s:(y.y=y.fy,y.vy=0);return e}function d(){for(var g=0,v=r.length,p;g<v;++g){if(p=r[g],p.index=g,p.fx!=null&&(p.x=p.fx),p.fy!=null&&(p.y=p.fy),isNaN(p.x)||isNaN(p.y)){var y=lY*Math.sqrt(.5+g),m=g*cY;p.x=y*Math.cos(m),p.y=y*Math.sin(m)}(isNaN(p.vx)||isNaN(p.vy))&&(p.vx=p.vy=0)}}function f(g){return g.initialize&&g.initialize(r,c),g}return d(),e={tick:h,restart:function(){return A.restart(u),e},stop:function(){return A.stop(),e},nodes:function(g){return arguments.length?(r=g,d(),o.forEach(f),e):r},alpha:function(g){return arguments.length?(t=+g,e):t},alphaMin:function(g){return arguments.length?(n=+g,e):n},alphaDecay:function(g){return arguments.length?(i=+g,e):+i},alphaTarget:function(g){return arguments.length?(a=+g,e):a},velocityDecay:function(g){return arguments.length?(s=1-g,e):1-s},randomSource:function(g){return arguments.length?(c=g,o.forEach(f),e):c},force:function(g,v){return arguments.length>1?(v==null?o.delete(g):o.set(g,f(v)),e):o.get(g)},find:function(g,v,p){var y=0,m=r.length,B,C,S,F,T;for(p==null?p=1/0:p*=p,y=0;y<m;++y)F=r[y],B=g-F.x,C=v-F.y,S=B*B+C*C,S<p&&(T=F,p=S);return T},on:function(g,v){return arguments.length>1?(l.on(g,v),e):l.on(g)}}}function hY(){var r,e,t,n,i=Fn(-30),a,s=1,o=1/0,A=.81;function l(d){var f,g=r.length,v=xd(r,oY,AY).visitAfter(u);for(n=d,f=0;f<g;++f)e=r[f],v.visit(h)}function c(){if(r){var d,f=r.length,g;for(a=new Array(f),d=0;d<f;++d)g=r[d],a[g.index]=+i(g,d,r)}}function u(d){var f=0,g,v,p=0,y,m,B;if(d.length){for(y=m=B=0;B<4;++B)(g=d[B])&&(v=Math.abs(g.value))&&(f+=g.value,p+=v,y+=v*g.x,m+=v*g.y);d.x=y/p,d.y=m/p}else{g=d,g.x=g.data.x,g.y=g.data.y;do f+=a[g.data.index];while(g=g.next)}d.value=f}function h(d,f,g,v){if(!d.value)return!0;var p=d.x-e.x,y=d.y-e.y,m=v-f,B=p*p+y*y;if(m*m/A<B)return B<o&&(p===0&&(p=Ka(t),B+=p*p),y===0&&(y=Ka(t),B+=y*y),B<s&&(B=Math.sqrt(s*B)),e.vx+=p*d.value*n/B,e.vy+=y*d.value*n/B),!0;if(d.length||B>=o)return;(d.data!==e||d.next)&&(p===0&&(p=Ka(t),B+=p*p),y===0&&(y=Ka(t),B+=y*y),B<s&&(B=Math.sqrt(s*B)));do d.data!==e&&(m=a[d.data.index]*n/B,e.vx+=p*m,e.vy+=y*m);while(d=d.next)}return l.initialize=function(d,f){r=d,t=f,c()},l.strength=function(d){return arguments.length?(i=typeof d=="function"?d:Fn(+d),c(),l):i},l.distanceMin=function(d){return arguments.length?(s=d*d,l):Math.sqrt(s)},l.distanceMax=function(d){return arguments.length?(o=d*d,l):Math.sqrt(o)},l.theta=function(d){return arguments.length?(A=d*d,l):Math.sqrt(A)},l}function dY(r,e,t){var n,i=Fn(.1),a,s;typeof r!="function"&&(r=Fn(+r)),e==null&&(e=0),t==null&&(t=0);function o(l){for(var c=0,u=n.length;c<u;++c){var h=n[c],d=h.x-e||1e-6,f=h.y-t||1e-6,g=Math.sqrt(d*d+f*f),v=(s[c]-g)*a[c]*l/g;h.vx+=d*v,h.vy+=f*v}}function A(){if(n){var l,c=n.length;for(a=new Array(c),s=new Array(c),l=0;l<c;++l)s[l]=+r(n[l],l,n),a[l]=isNaN(s[l])?0:+i(n[l],l,n)}}return o.initialize=function(l){n=l,A()},o.strength=function(l){return arguments.length?(i=typeof l=="function"?l:Fn(+l),A(),o):i},o.radius=function(l){return arguments.length?(r=typeof l=="function"?l:Fn(+l),A(),o):r},o.x=function(l){return arguments.length?(e=+l,o):e},o.y=function(l){return arguments.length?(t=+l,o):t},o}function fY(r){var e=Fn(.1),t,n,i;typeof r!="function"&&(r=Fn(r==null?0:+r));function a(o){for(var A=0,l=t.length,c;A<l;++A)c=t[A],c.vx+=(i[A]-c.x)*n[A]*o}function s(){if(t){var o,A=t.length;for(n=new Array(A),i=new Array(A),o=0;o<A;++o)n[o]=isNaN(i[o]=+r(t[o],o,t))?0:+e(t[o],o,t)}}return a.initialize=function(o){t=o,s()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Fn(+o),s(),a):e},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:Fn(+o),s(),a):r},a}function gY(r){var e=Fn(.1),t,n,i;typeof r!="function"&&(r=Fn(r==null?0:+r));function a(o){for(var A=0,l=t.length,c;A<l;++A)c=t[A],c.vy+=(i[A]-c.y)*n[A]*o}function s(){if(t){var o,A=t.length;for(n=new Array(A),i=new Array(A),o=0;o<A;++o)n[o]=isNaN(i[o]=+r(t[o],o,t))?0:+e(t[o],o,t)}}return a.initialize=function(o){t=o,s()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:Fn(+o),s(),a):e},a.y=function(o){return arguments.length?(r=typeof o=="function"?o:Fn(+o),s(),a):r},a}class vY{constructor(e){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:Y7,manyBody:hY,center:V7,collide:q7,radial:dY,x:fY,y:gY},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},zn(this.options,e),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericLayout(!0,e,t)})}stop(){this.simulation.stop()}tick(e){return this.simulation.tick(e),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(e,t){const n=this.context.nodes.find(i=>i.id===e);n&&t.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(e){var t,n;const i=zn({},this.options,e);return i.collide&&((t=i.collide)===null||t===void 0?void 0:t.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(e,t,n){var i;return Je(this,void 0,void 0,function*(){const a=this.getOptions(n),s=t.getAllNodes().map(({id:c,data:u})=>Object.assign(Object.assign({id:c},u),Ds(u.data,this.config.inputNodeAttrs))),o=t.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:e,nodes:s,edges:o,graph:t});const A=new Promise(c=>{this.resolver=c}),l=this.setSimulation(a);return l.nodes(s),(i=l.force("link"))===null||i===void 0||i.links(o),A})}getResult(){const{assign:e,nodes:t,edges:n,graph:i}=this.context,a=t.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),Ds(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:A,target:l,data:c})=>({id:o,source:typeof A=="object"?A.id:A,target:typeof l=="object"?l.id:l,data:c}));return e&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return uY()}setSimulation(e){const t=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=t.on("tick",()=>{var n;return(n=e.onTick)===null||n===void 0?void 0:n.call(e,this.getResult())}).on("end",()=>{var n;return(n=this.resolver)===null||n===void 0?void 0:n.call(this,this.getResult())})),xC(t,this.config.simulationAttrs.map(n=>[n,e[n]])),Object.entries(this.forceMap).forEach(([n,i])=>{const a=n;if(e[n]){let s=t.force(a);s||(s=i(),t.force(a,s)),xC(s,Object.entries(e[a]))}else t.force(a,null)}),t}}const xC=(r,e)=>e.reduce((t,[n,i])=>!t[n]||i===void 0?t:t[n].call(r,i),r);var _g,CC;function pY(){if(CC)return _g;CC=1;function r(){this.__data__=[],this.size=0}return _g=r,_g}var Ig,SC;function tA(){if(SC)return Ig;SC=1;function r(e,t){return e===t||e!==e&&t!==t}return Ig=r,Ig}var kg,FC;function Fd(){if(FC)return kg;FC=1;var r=tA();function e(t,n){for(var i=t.length;i--;)if(r(t[i][0],n))return i;return-1}return kg=e,kg}var Lg,TC;function yY(){if(TC)return Lg;TC=1;var r=Fd(),e=Array.prototype,t=e.splice;function n(i){var a=this.__data__,s=r(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():t.call(a,s,1),--this.size,!0}return Lg=n,Lg}var Qg,MC;function mY(){if(MC)return Qg;MC=1;var r=Fd();function e(t){var n=this.__data__,i=r(n,t);return i<0?void 0:n[i][1]}return Qg=e,Qg}var Ng,OC;function wY(){if(OC)return Ng;OC=1;var r=Fd();function e(t){return r(this.__data__,t)>-1}return Ng=e,Ng}var Ug,_C;function BY(){if(_C)return Ug;_C=1;var r=Fd();function e(t,n){var i=this.__data__,a=r(i,t);return a<0?(++this.size,i.push([t,n])):i[a][1]=n,this}return Ug=e,Ug}var Pg,IC;function Td(){if(IC)return Pg;IC=1;var r=pY(),e=yY(),t=mY(),n=wY(),i=BY();function a(s){var o=-1,A=s==null?0:s.length;for(this.clear();++o<A;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=r,a.prototype.delete=e,a.prototype.get=t,a.prototype.has=n,a.prototype.set=i,Pg=a,Pg}var Rg,kC;function bY(){if(kC)return Rg;kC=1;var r=Td();function e(){this.__data__=new r,this.size=0}return Rg=e,Rg}var Dg,LC;function EY(){if(LC)return Dg;LC=1;function r(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}return Dg=r,Dg}var Hg,QC;function xY(){if(QC)return Hg;QC=1;function r(e){return this.__data__.get(e)}return Hg=r,Hg}var Gg,NC;function CY(){if(NC)return Gg;NC=1;function r(e){return this.__data__.has(e)}return Gg=r,Gg}var Kg,UC;function FQ(){if(UC)return Kg;UC=1;var r=typeof nc=="object"&&nc&&nc.Object===Object&&nc;return Kg=r,Kg}var zg,PC;function Ci(){if(PC)return zg;PC=1;var r=FQ(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return zg=t,zg}var Vg,RC;function nA(){if(RC)return Vg;RC=1;var r=Ci(),e=r.Symbol;return Vg=e,Vg}var jg,DC;function SY(){if(DC)return jg;DC=1;var r=nA(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function a(s){var o=t.call(s,i),A=s[i];try{s[i]=void 0;var l=!0}catch{}var c=n.call(s);return l&&(o?s[i]=A:delete s[i]),c}return jg=a,jg}var Wg,HC;function FY(){if(HC)return Wg;HC=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Wg=t,Wg}var qg,GC;function no(){if(GC)return qg;GC=1;var r=nA(),e=SY(),t=FY(),n="[object Null]",i="[object Undefined]",a=r?r.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?e(o):t(o)}return qg=s,qg}var $g,KC;function si(){if(KC)return $g;KC=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return $g=r,$g}var Yg,zC;function Vl(){if(zC)return Yg;zC=1;var r=no(),e=si(),t="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!e(o))return!1;var A=r(o);return A==n||A==i||A==t||A==a}return Yg=s,Yg}var Xg,VC;function TY(){if(VC)return Xg;VC=1;var r=Ci(),e=r["__core-js_shared__"];return Xg=e,Xg}var Zg,jC;function MY(){if(jC)return Zg;jC=1;var r=TY(),e=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function t(n){return!!e&&e in n}return Zg=t,Zg}var Jg,WC;function TQ(){if(WC)return Jg;WC=1;var r=Function.prototype,e=r.toString;function t(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Jg=t,Jg}var ev,qC;function OY(){if(qC)return ev;qC=1;var r=Vl(),e=MY(),t=si(),n=TQ(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,A=s.toString,l=o.hasOwnProperty,c=RegExp("^"+A.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function u(h){if(!t(h)||e(h))return!1;var d=r(h)?c:a;return d.test(n(h))}return ev=u,ev}var tv,$C;function _Y(){if($C)return tv;$C=1;function r(e,t){return e==null?void 0:e[t]}return tv=r,tv}var nv,YC;function ro(){if(YC)return nv;YC=1;var r=OY(),e=_Y();function t(n,i){var a=e(n,i);return r(a)?a:void 0}return nv=t,nv}var rv,XC;function NB(){if(XC)return rv;XC=1;var r=ro(),e=Ci(),t=r(e,"Map");return rv=t,rv}var iv,ZC;function Md(){if(ZC)return iv;ZC=1;var r=ro(),e=r(Object,"create");return iv=e,iv}var av,JC;function IY(){if(JC)return av;JC=1;var r=Md();function e(){this.__data__=r?r(null):{},this.size=0}return av=e,av}var sv,e2;function kY(){if(e2)return sv;e2=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return sv=r,sv}var ov,t2;function LY(){if(t2)return ov;t2=1;var r=Md(),e="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function i(a){var s=this.__data__;if(r){var o=s[a];return o===e?void 0:o}return n.call(s,a)?s[a]:void 0}return ov=i,ov}var Av,n2;function QY(){if(n2)return Av;n2=1;var r=Md(),e=Object.prototype,t=e.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:t.call(a,i)}return Av=n,Av}var lv,r2;function NY(){if(r2)return lv;r2=1;var r=Md(),e="__lodash_hash_undefined__";function t(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=r&&i===void 0?e:i,this}return lv=t,lv}var cv,i2;function UY(){if(i2)return cv;i2=1;var r=IY(),e=kY(),t=LY(),n=QY(),i=NY();function a(s){var o=-1,A=s==null?0:s.length;for(this.clear();++o<A;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=r,a.prototype.delete=e,a.prototype.get=t,a.prototype.has=n,a.prototype.set=i,cv=a,cv}var uv,a2;function PY(){if(a2)return uv;a2=1;var r=UY(),e=Td(),t=NB();function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return uv=n,uv}var hv,s2;function RY(){if(s2)return hv;s2=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return hv=r,hv}var dv,o2;function Od(){if(o2)return dv;o2=1;var r=RY();function e(t,n){var i=t.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return dv=e,dv}var fv,A2;function DY(){if(A2)return fv;A2=1;var r=Od();function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}return fv=e,fv}var gv,l2;function HY(){if(l2)return gv;l2=1;var r=Od();function e(t){return r(this,t).get(t)}return gv=e,gv}var vv,c2;function GY(){if(c2)return vv;c2=1;var r=Od();function e(t){return r(this,t).has(t)}return vv=e,vv}var pv,u2;function KY(){if(u2)return pv;u2=1;var r=Od();function e(t,n){var i=r(this,t),a=i.size;return i.set(t,n),this.size+=i.size==a?0:1,this}return pv=e,pv}var yv,h2;function UB(){if(h2)return yv;h2=1;var r=PY(),e=DY(),t=HY(),n=GY(),i=KY();function a(s){var o=-1,A=s==null?0:s.length;for(this.clear();++o<A;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=r,a.prototype.delete=e,a.prototype.get=t,a.prototype.has=n,a.prototype.set=i,yv=a,yv}var mv,d2;function zY(){if(d2)return mv;d2=1;var r=Td(),e=NB(),t=UB(),n=200;function i(a,s){var o=this.__data__;if(o instanceof r){var A=o.__data__;if(!e||A.length<n-1)return A.push([a,s]),this.size=++o.size,this;o=this.__data__=new t(A)}return o.set(a,s),this.size=o.size,this}return mv=i,mv}var wv,f2;function _d(){if(f2)return wv;f2=1;var r=Td(),e=bY(),t=EY(),n=xY(),i=CY(),a=zY();function s(o){var A=this.__data__=new r(o);this.size=A.size}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=n,s.prototype.has=i,s.prototype.set=a,wv=s,wv}var Bv,g2;function PB(){if(g2)return Bv;g2=1;function r(e,t){for(var n=-1,i=e==null?0:e.length;++n<i&&t(e[n],n,e)!==!1;);return e}return Bv=r,Bv}var bv,v2;function MQ(){if(v2)return bv;v2=1;var r=ro(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}})();return bv=e,bv}var Ev,p2;function Id(){if(p2)return Ev;p2=1;var r=MQ();function e(t,n,i){n=="__proto__"&&r?r(t,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[n]=i}return Ev=e,Ev}var xv,y2;function kd(){if(y2)return xv;y2=1;var r=Id(),e=tA(),t=Object.prototype,n=t.hasOwnProperty;function i(a,s,o){var A=a[s];(!(n.call(a,s)&&e(A,o))||o===void 0&&!(s in a))&&r(a,s,o)}return xv=i,xv}var Cv,m2;function jl(){if(m2)return Cv;m2=1;var r=kd(),e=Id();function t(n,i,a,s){var o=!a;a||(a={});for(var A=-1,l=i.length;++A<l;){var c=i[A],u=s?s(a[c],n[c],c,a,n):void 0;u===void 0&&(u=n[c]),o?e(a,c,u):r(a,c,u)}return a}return Cv=t,Cv}var Sv,w2;function VY(){if(w2)return Sv;w2=1;function r(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}return Sv=r,Sv}var Fv,B2;function Zi(){if(B2)return Fv;B2=1;function r(e){return e!=null&&typeof e=="object"}return Fv=r,Fv}var Tv,b2;function jY(){if(b2)return Tv;b2=1;var r=no(),e=Zi(),t="[object Arguments]";function n(i){return e(i)&&r(i)==t}return Tv=n,Tv}var Mv,E2;function Wl(){if(E2)return Mv;E2=1;var r=jY(),e=Zi(),t=Object.prototype,n=t.hasOwnProperty,i=t.propertyIsEnumerable,a=r((function(){return arguments})())?r:function(s){return e(s)&&n.call(s,"callee")&&!i.call(s,"callee")};return Mv=a,Mv}var Ov,x2;function Bn(){if(x2)return Ov;x2=1;var r=Array.isArray;return Ov=r,Ov}var HA={exports:{}},_v,C2;function WY(){if(C2)return _v;C2=1;function r(){return!1}return _v=r,_v}HA.exports;var S2;function rA(){return S2||(S2=1,(function(r,e){var t=Ci(),n=WY(),i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,s=a&&a.exports===i,o=s?t.Buffer:void 0,A=o?o.isBuffer:void 0,l=A||n;r.exports=l})(HA,HA.exports)),HA.exports}var Iv,F2;function Ld(){if(F2)return Iv;F2=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(n,i){var a=typeof n;return i=i??r,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return Iv=t,Iv}var kv,T2;function RB(){if(T2)return kv;T2=1;var r=9007199254740991;function e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=r}return kv=e,kv}var Lv,M2;function qY(){if(M2)return Lv;M2=1;var r=no(),e=RB(),t=Zi(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",A="[object Function]",l="[object Map]",c="[object Number]",u="[object Object]",h="[object RegExp]",d="[object Set]",f="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",p="[object DataView]",y="[object Float32Array]",m="[object Float64Array]",B="[object Int8Array]",C="[object Int16Array]",S="[object Int32Array]",F="[object Uint8Array]",T="[object Uint8ClampedArray]",O="[object Uint16Array]",_="[object Uint32Array]",k={};k[y]=k[m]=k[B]=k[C]=k[S]=k[F]=k[T]=k[O]=k[_]=!0,k[n]=k[i]=k[v]=k[a]=k[p]=k[s]=k[o]=k[A]=k[l]=k[c]=k[u]=k[h]=k[d]=k[f]=k[g]=!1;function L(U){return t(U)&&e(U.length)&&!!k[r(U)]}return Lv=L,Lv}var Qv,O2;function Qd(){if(O2)return Qv;O2=1;function r(e){return function(t){return e(t)}}return Qv=r,Qv}var GA={exports:{}};GA.exports;var _2;function DB(){return _2||(_2=1,(function(r,e){var t=FQ(),n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a&&t.process,o=(function(){try{var A=i&&i.require&&i.require("util").types;return A||s&&s.binding&&s.binding("util")}catch{}})();r.exports=o})(GA,GA.exports)),GA.exports}var Nv,I2;function ql(){if(I2)return Nv;I2=1;var r=qY(),e=Qd(),t=DB(),n=t&&t.isTypedArray,i=n?e(n):r;return Nv=i,Nv}var Uv,k2;function OQ(){if(k2)return Uv;k2=1;var r=VY(),e=Wl(),t=Bn(),n=rA(),i=Ld(),a=ql(),s=Object.prototype,o=s.hasOwnProperty;function A(l,c){var u=t(l),h=!u&&e(l),d=!u&&!h&&n(l),f=!u&&!h&&!d&&a(l),g=u||h||d||f,v=g?r(l.length,String):[],p=v.length;for(var y in l)(c||o.call(l,y))&&!(g&&(y=="length"||d&&(y=="offset"||y=="parent")||f&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,p)))&&v.push(y);return v}return Uv=A,Uv}var Pv,L2;function Nd(){if(L2)return Pv;L2=1;var r=Object.prototype;function e(t){var n=t&&t.constructor,i=typeof n=="function"&&n.prototype||r;return t===i}return Pv=e,Pv}var Rv,Q2;function _Q(){if(Q2)return Rv;Q2=1;function r(e,t){return function(n){return e(t(n))}}return Rv=r,Rv}var Dv,N2;function $Y(){if(N2)return Dv;N2=1;var r=_Q(),e=r(Object.keys,Object);return Dv=e,Dv}var Hv,U2;function HB(){if(U2)return Hv;U2=1;var r=Nd(),e=$Y(),t=Object.prototype,n=t.hasOwnProperty;function i(a){if(!r(a))return e(a);var s=[];for(var o in Object(a))n.call(a,o)&&o!="constructor"&&s.push(o);return s}return Hv=i,Hv}var Gv,P2;function wa(){if(P2)return Gv;P2=1;var r=Vl(),e=RB();function t(n){return n!=null&&e(n.length)&&!r(n)}return Gv=t,Gv}var Kv,R2;function As(){if(R2)return Kv;R2=1;var r=OQ(),e=HB(),t=wa();function n(i){return t(i)?r(i):e(i)}return Kv=n,Kv}var zv,D2;function YY(){if(D2)return zv;D2=1;var r=jl(),e=As();function t(n,i){return n&&r(i,e(i),n)}return zv=t,zv}var Vv,H2;function XY(){if(H2)return Vv;H2=1;function r(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}return Vv=r,Vv}var jv,G2;function ZY(){if(G2)return jv;G2=1;var r=si(),e=Nd(),t=XY(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return t(s);var o=e(s),A=[];for(var l in s)l=="constructor"&&(o||!i.call(s,l))||A.push(l);return A}return jv=a,jv}var Wv,K2;function io(){if(K2)return Wv;K2=1;var r=OQ(),e=ZY(),t=wa();function n(i){return t(i)?r(i,!0):e(i)}return Wv=n,Wv}var qv,z2;function JY(){if(z2)return qv;z2=1;var r=jl(),e=io();function t(n,i){return n&&r(i,e(i),n)}return qv=t,qv}var KA={exports:{}};KA.exports;var V2;function IQ(){return V2||(V2=1,(function(r,e){var t=Ci(),n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a?t.Buffer:void 0,o=s?s.allocUnsafe:void 0;function A(l,c){if(c)return l.slice();var u=l.length,h=o?o(u):new l.constructor(u);return l.copy(h),h}r.exports=A})(KA,KA.exports)),KA.exports}var $v,j2;function kQ(){if(j2)return $v;j2=1;function r(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}return $v=r,$v}var Yv,W2;function LQ(){if(W2)return Yv;W2=1;function r(e,t){for(var n=-1,i=e==null?0:e.length,a=0,s=[];++n<i;){var o=e[n];t(o,n,e)&&(s[a++]=o)}return s}return Yv=r,Yv}var Xv,q2;function QQ(){if(q2)return Xv;q2=1;function r(){return[]}return Xv=r,Xv}var Zv,$2;function GB(){if($2)return Zv;$2=1;var r=LQ(),e=QQ(),t=Object.prototype,n=t.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),r(i(s),function(o){return n.call(s,o)}))}:e;return Zv=a,Zv}var Jv,Y2;function eX(){if(Y2)return Jv;Y2=1;var r=jl(),e=GB();function t(n,i){return r(n,e(n),i)}return Jv=t,Jv}var ep,X2;function KB(){if(X2)return ep;X2=1;function r(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}return ep=r,ep}var tp,Z2;function Ud(){if(Z2)return tp;Z2=1;var r=_Q(),e=r(Object.getPrototypeOf,Object);return tp=e,tp}var np,J2;function NQ(){if(J2)return np;J2=1;var r=KB(),e=Ud(),t=GB(),n=QQ(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var o=[];s;)r(o,t(s)),s=e(s);return o}:n;return np=a,np}var rp,eS;function tX(){if(eS)return rp;eS=1;var r=jl(),e=NQ();function t(n,i){return r(n,e(n),i)}return rp=t,rp}var ip,tS;function UQ(){if(tS)return ip;tS=1;var r=KB(),e=Bn();function t(n,i,a){var s=i(n);return e(n)?s:r(s,a(n))}return ip=t,ip}var ap,nS;function PQ(){if(nS)return ap;nS=1;var r=UQ(),e=GB(),t=As();function n(i){return r(i,t,e)}return ap=n,ap}var sp,rS;function nX(){if(rS)return sp;rS=1;var r=UQ(),e=NQ(),t=io();function n(i){return r(i,t,e)}return sp=n,sp}var op,iS;function rX(){if(iS)return op;iS=1;var r=ro(),e=Ci(),t=r(e,"DataView");return op=t,op}var Ap,aS;function iX(){if(aS)return Ap;aS=1;var r=ro(),e=Ci(),t=r(e,"Promise");return Ap=t,Ap}var lp,sS;function RQ(){if(sS)return lp;sS=1;var r=ro(),e=Ci(),t=r(e,"Set");return lp=t,lp}var cp,oS;function aX(){if(oS)return cp;oS=1;var r=ro(),e=Ci(),t=r(e,"WeakMap");return cp=t,cp}var up,AS;function iA(){if(AS)return up;AS=1;var r=rX(),e=NB(),t=iX(),n=RQ(),i=aX(),a=no(),s=TQ(),o="[object Map]",A="[object Object]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",h="[object DataView]",d=s(r),f=s(e),g=s(t),v=s(n),p=s(i),y=a;return(r&&y(new r(new ArrayBuffer(1)))!=h||e&&y(new e)!=o||t&&y(t.resolve())!=l||n&&y(new n)!=c||i&&y(new i)!=u)&&(y=function(m){var B=a(m),C=B==A?m.constructor:void 0,S=C?s(C):"";if(S)switch(S){case d:return h;case f:return o;case g:return l;case v:return c;case p:return u}return B}),up=y,up}var hp,lS;function sX(){if(lS)return hp;lS=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&e.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return hp=t,hp}var dp,cS;function DQ(){if(cS)return dp;cS=1;var r=Ci(),e=r.Uint8Array;return dp=e,dp}var fp,uS;function zB(){if(uS)return fp;uS=1;var r=DQ();function e(t){var n=new t.constructor(t.byteLength);return new r(n).set(new r(t)),n}return fp=e,fp}var gp,hS;function oX(){if(hS)return gp;hS=1;var r=zB();function e(t,n){var i=n?r(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}return gp=e,gp}var vp,dS;function AX(){if(dS)return vp;dS=1;var r=/\w*$/;function e(t){var n=new t.constructor(t.source,r.exec(t));return n.lastIndex=t.lastIndex,n}return vp=e,vp}var pp,fS;function lX(){if(fS)return pp;fS=1;var r=nA(),e=r?r.prototype:void 0,t=e?e.valueOf:void 0;function n(i){return t?Object(t.call(i)):{}}return pp=n,pp}var yp,gS;function HQ(){if(gS)return yp;gS=1;var r=zB();function e(t,n){var i=n?r(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}return yp=e,yp}var mp,vS;function cX(){if(vS)return mp;vS=1;var r=zB(),e=oX(),t=AX(),n=lX(),i=HQ(),a="[object Boolean]",s="[object Date]",o="[object Map]",A="[object Number]",l="[object RegExp]",c="[object Set]",u="[object String]",h="[object Symbol]",d="[object ArrayBuffer]",f="[object DataView]",g="[object Float32Array]",v="[object Float64Array]",p="[object Int8Array]",y="[object Int16Array]",m="[object Int32Array]",B="[object Uint8Array]",C="[object Uint8ClampedArray]",S="[object Uint16Array]",F="[object Uint32Array]";function T(O,_,k){var L=O.constructor;switch(_){case d:return r(O);case a:case s:return new L(+O);case f:return e(O,k);case g:case v:case p:case y:case m:case B:case C:case S:case F:return i(O,k);case o:return new L;case A:case u:return new L(O);case l:return t(O);case c:return new L;case h:return n(O)}}return mp=T,mp}var wp,pS;function GQ(){if(pS)return wp;pS=1;var r=si(),e=Object.create,t=(function(){function n(){}return function(i){if(!r(i))return{};if(e)return e(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}})();return wp=t,wp}var Bp,yS;function KQ(){if(yS)return Bp;yS=1;var r=GQ(),e=Ud(),t=Nd();function n(i){return typeof i.constructor=="function"&&!t(i)?r(e(i)):{}}return Bp=n,Bp}var bp,mS;function uX(){if(mS)return bp;mS=1;var r=iA(),e=Zi(),t="[object Map]";function n(i){return e(i)&&r(i)==t}return bp=n,bp}var Ep,wS;function hX(){if(wS)return Ep;wS=1;var r=uX(),e=Qd(),t=DB(),n=t&&t.isMap,i=n?e(n):r;return Ep=i,Ep}var xp,BS;function dX(){if(BS)return xp;BS=1;var r=iA(),e=Zi(),t="[object Set]";function n(i){return e(i)&&r(i)==t}return xp=n,xp}var Cp,bS;function fX(){if(bS)return Cp;bS=1;var r=dX(),e=Qd(),t=DB(),n=t&&t.isSet,i=n?e(n):r;return Cp=i,Cp}var Sp,ES;function zQ(){if(ES)return Sp;ES=1;var r=_d(),e=PB(),t=kd(),n=YY(),i=JY(),a=IQ(),s=kQ(),o=eX(),A=tX(),l=PQ(),c=nX(),u=iA(),h=sX(),d=cX(),f=KQ(),g=Bn(),v=rA(),p=hX(),y=si(),m=fX(),B=As(),C=io(),S=1,F=2,T=4,O="[object Arguments]",_="[object Array]",k="[object Boolean]",L="[object Date]",U="[object Error]",G="[object Function]",W="[object GeneratorFunction]",V="[object Map]",K="[object Number]",D="[object Object]",X="[object RegExp]",te="[object Set]",ie="[object String]",re="[object Symbol]",xe="[object WeakMap]",$="[object ArrayBuffer]",z="[object DataView]",ee="[object Float32Array]",Ae="[object Float64Array]",be="[object Int8Array]",Le="[object Int16Array]",Ue="[object Int32Array]",at="[object Uint8Array]",lt="[object Uint8ClampedArray]",ct="[object Uint16Array]",pt="[object Uint32Array]",Ne={};Ne[O]=Ne[_]=Ne[$]=Ne[z]=Ne[k]=Ne[L]=Ne[ee]=Ne[Ae]=Ne[be]=Ne[Le]=Ne[Ue]=Ne[V]=Ne[K]=Ne[D]=Ne[X]=Ne[te]=Ne[ie]=Ne[re]=Ne[at]=Ne[lt]=Ne[ct]=Ne[pt]=!0,Ne[U]=Ne[G]=Ne[xe]=!1;function ht(nt,gr,St,Ji,ir,Wt){var _t,Qn=gr&S,qn=gr&F,vr=gr&T;if(St&&(_t=ir?St(nt,Ji,ir,Wt):St(nt)),_t!==void 0)return _t;if(!y(nt))return nt;var ar=g(nt);if(ar){if(_t=h(nt),!Qn)return s(nt,_t)}else{var $n=u(nt),rn=$n==G||$n==W;if(v(nt))return a(nt,Qn);if($n==D||$n==O||rn&&!ir){if(_t=qn||rn?{}:f(nt),!Qn)return qn?A(nt,i(_t,nt)):o(nt,n(_t,nt))}else{if(!Ne[$n])return ir?nt:{};_t=d(nt,$n,Qn)}}Wt||(Wt=new r);var an=Wt.get(nt);if(an)return an;Wt.set(nt,_t),m(nt)?nt.forEach(function(Or){_t.add(ht(Or,gr,St,Or,nt,Wt))}):p(nt)&&nt.forEach(function(Or,Vr){_t.set(Vr,ht(Or,gr,St,Vr,nt,Wt))});var cA=vr?qn?c:l:qn?C:B,cs=ar?void 0:cA(nt);return e(cs||nt,function(Or,Vr){cs&&(Vr=Or,Or=nt[Vr]),t(_t,Vr,ht(Or,gr,St,Vr,nt,Wt))}),_t}return Sp=ht,Sp}var Fp,xS;function gX(){if(xS)return Fp;xS=1;var r=zQ(),e=4;function t(n){return r(n,e)}return Fp=t,Fp}var Tp,CS;function VB(){if(CS)return Tp;CS=1;function r(e){return function(){return e}}return Tp=r,Tp}var Mp,SS;function vX(){if(SS)return Mp;SS=1;function r(e){return function(t,n,i){for(var a=-1,s=Object(t),o=i(t),A=o.length;A--;){var l=o[e?A:++a];if(n(s[l],l,s)===!1)break}return t}}return Mp=r,Mp}var Op,FS;function jB(){if(FS)return Op;FS=1;var r=vX(),e=r();return Op=e,Op}var _p,TS;function WB(){if(TS)return _p;TS=1;var r=jB(),e=As();function t(n,i){return n&&r(n,i,e)}return _p=t,_p}var Ip,MS;function pX(){if(MS)return Ip;MS=1;var r=wa();function e(t,n){return function(i,a){if(i==null)return i;if(!r(i))return t(i,a);for(var s=i.length,o=n?s:-1,A=Object(i);(n?o--:++o<s)&&a(A[o],o,A)!==!1;);return i}}return Ip=e,Ip}var kp,OS;function Pd(){if(OS)return kp;OS=1;var r=WB(),e=pX(),t=e(r);return kp=t,kp}var Lp,_S;function ao(){if(_S)return Lp;_S=1;function r(e){return e}return Lp=r,Lp}var Qp,IS;function VQ(){if(IS)return Qp;IS=1;var r=ao();function e(t){return typeof t=="function"?t:r}return Qp=e,Qp}var Np,kS;function jQ(){if(kS)return Np;kS=1;var r=PB(),e=Pd(),t=VQ(),n=Bn();function i(a,s){var o=n(a)?r:e;return o(a,t(s))}return Np=i,Np}var Up,LS;function WQ(){return LS||(LS=1,Up=jQ()),Up}var Pp,QS;function yX(){if(QS)return Pp;QS=1;var r=Pd();function e(t,n){var i=[];return r(t,function(a,s,o){n(a,s,o)&&i.push(a)}),i}return Pp=e,Pp}var Rp,NS;function mX(){if(NS)return Rp;NS=1;var r="__lodash_hash_undefined__";function e(t){return this.__data__.set(t,r),this}return Rp=e,Rp}var Dp,US;function wX(){if(US)return Dp;US=1;function r(e){return this.__data__.has(e)}return Dp=r,Dp}var Hp,PS;function qQ(){if(PS)return Hp;PS=1;var r=UB(),e=mX(),t=wX();function n(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new r;++a<s;)this.add(i[a])}return n.prototype.add=n.prototype.push=e,n.prototype.has=t,Hp=n,Hp}var Gp,RS;function BX(){if(RS)return Gp;RS=1;function r(e,t){for(var n=-1,i=e==null?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}return Gp=r,Gp}var Kp,DS;function $Q(){if(DS)return Kp;DS=1;function r(e,t){return e.has(t)}return Kp=r,Kp}var zp,HS;function YQ(){if(HS)return zp;HS=1;var r=qQ(),e=BX(),t=$Q(),n=1,i=2;function a(s,o,A,l,c,u){var h=A&n,d=s.length,f=o.length;if(d!=f&&!(h&&f>d))return!1;var g=u.get(s),v=u.get(o);if(g&&v)return g==o&&v==s;var p=-1,y=!0,m=A&i?new r:void 0;for(u.set(s,o),u.set(o,s);++p<d;){var B=s[p],C=o[p];if(l)var S=h?l(C,B,p,o,s,u):l(B,C,p,s,o,u);if(S!==void 0){if(S)continue;y=!1;break}if(m){if(!e(o,function(F,T){if(!t(m,T)&&(B===F||c(B,F,A,l,u)))return m.push(T)})){y=!1;break}}else if(!(B===C||c(B,C,A,l,u))){y=!1;break}}return u.delete(s),u.delete(o),y}return zp=a,zp}var Vp,GS;function bX(){if(GS)return Vp;GS=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(i,a){n[++t]=[a,i]}),n}return Vp=r,Vp}var jp,KS;function qB(){if(KS)return jp;KS=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}return jp=r,jp}var Wp,zS;function EX(){if(zS)return Wp;zS=1;var r=nA(),e=DQ(),t=tA(),n=YQ(),i=bX(),a=qB(),s=1,o=2,A="[object Boolean]",l="[object Date]",c="[object Error]",u="[object Map]",h="[object Number]",d="[object RegExp]",f="[object Set]",g="[object String]",v="[object Symbol]",p="[object ArrayBuffer]",y="[object DataView]",m=r?r.prototype:void 0,B=m?m.valueOf:void 0;function C(S,F,T,O,_,k,L){switch(T){case y:if(S.byteLength!=F.byteLength||S.byteOffset!=F.byteOffset)return!1;S=S.buffer,F=F.buffer;case p:return!(S.byteLength!=F.byteLength||!k(new e(S),new e(F)));case A:case l:case h:return t(+S,+F);case c:return S.name==F.name&&S.message==F.message;case d:case g:return S==F+"";case u:var U=i;case f:var G=O&s;if(U||(U=a),S.size!=F.size&&!G)return!1;var W=L.get(S);if(W)return W==F;O|=o,L.set(S,F);var V=n(U(S),U(F),O,_,k,L);return L.delete(S),V;case v:if(B)return B.call(S)==B.call(F)}return!1}return Wp=C,Wp}var qp,VS;function xX(){if(VS)return qp;VS=1;var r=PQ(),e=1,t=Object.prototype,n=t.hasOwnProperty;function i(a,s,o,A,l,c){var u=o&e,h=r(a),d=h.length,f=r(s),g=f.length;if(d!=g&&!u)return!1;for(var v=d;v--;){var p=h[v];if(!(u?p in s:n.call(s,p)))return!1}var y=c.get(a),m=c.get(s);if(y&&m)return y==s&&m==a;var B=!0;c.set(a,s),c.set(s,a);for(var C=u;++v<d;){p=h[v];var S=a[p],F=s[p];if(A)var T=u?A(F,S,p,s,a,c):A(S,F,p,a,s,c);if(!(T===void 0?S===F||l(S,F,o,A,c):T)){B=!1;break}C||(C=p=="constructor")}if(B&&!C){var O=a.constructor,_=s.constructor;O!=_&&"constructor"in a&&"constructor"in s&&!(typeof O=="function"&&O instanceof O&&typeof _=="function"&&_ instanceof _)&&(B=!1)}return c.delete(a),c.delete(s),B}return qp=i,qp}var $p,jS;function CX(){if(jS)return $p;jS=1;var r=_d(),e=YQ(),t=EX(),n=xX(),i=iA(),a=Bn(),s=rA(),o=ql(),A=1,l="[object Arguments]",c="[object Array]",u="[object Object]",h=Object.prototype,d=h.hasOwnProperty;function f(g,v,p,y,m,B){var C=a(g),S=a(v),F=C?c:i(g),T=S?c:i(v);F=F==l?u:F,T=T==l?u:T;var O=F==u,_=T==u,k=F==T;if(k&&s(g)){if(!s(v))return!1;C=!0,O=!1}if(k&&!O)return B||(B=new r),C||o(g)?e(g,v,p,y,m,B):t(g,v,F,p,y,m,B);if(!(p&A)){var L=O&&d.call(g,"__wrapped__"),U=_&&d.call(v,"__wrapped__");if(L||U){var G=L?g.value():g,W=U?v.value():v;return B||(B=new r),m(G,W,p,y,B)}}return k?(B||(B=new r),n(g,v,p,y,m,B)):!1}return $p=f,$p}var Yp,WS;function XQ(){if(WS)return Yp;WS=1;var r=CX(),e=Zi();function t(n,i,a,s,o){return n===i?!0:n==null||i==null||!e(n)&&!e(i)?n!==n&&i!==i:r(n,i,a,s,t,o)}return Yp=t,Yp}var Xp,qS;function SX(){if(qS)return Xp;qS=1;var r=_d(),e=XQ(),t=1,n=2;function i(a,s,o,A){var l=o.length,c=l,u=!A;if(a==null)return!c;for(a=Object(a);l--;){var h=o[l];if(u&&h[2]?h[1]!==a[h[0]]:!(h[0]in a))return!1}for(;++l<c;){h=o[l];var d=h[0],f=a[d],g=h[1];if(u&&h[2]){if(f===void 0&&!(d in a))return!1}else{var v=new r;if(A)var p=A(f,g,d,a,s,v);if(!(p===void 0?e(g,f,t|n,A,v):p))return!1}}return!0}return Xp=i,Xp}var Zp,$S;function ZQ(){if($S)return Zp;$S=1;var r=si();function e(t){return t===t&&!r(t)}return Zp=e,Zp}var Jp,YS;function FX(){if(YS)return Jp;YS=1;var r=ZQ(),e=As();function t(n){for(var i=e(n),a=i.length;a--;){var s=i[a],o=n[s];i[a]=[s,o,r(o)]}return i}return Jp=t,Jp}var e0,XS;function JQ(){if(XS)return e0;XS=1;function r(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}return e0=r,e0}var t0,ZS;function TX(){if(ZS)return t0;ZS=1;var r=SX(),e=FX(),t=JQ();function n(i){var a=e(i);return a.length==1&&a[0][2]?t(a[0][0],a[0][1]):function(s){return s===i||r(s,i,a)}}return t0=n,t0}var n0,JS;function aA(){if(JS)return n0;JS=1;var r=no(),e=Zi(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return n0=n,n0}var r0,eF;function $B(){if(eF)return r0;eF=1;var r=Bn(),e=aA(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(r(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||e(a)?!0:n.test(a)||!t.test(a)||s!=null&&a in Object(s)}return r0=i,r0}var i0,tF;function MX(){if(tF)return i0;tF=1;var r=UB(),e="Expected a function";function t(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],A=a.cache;if(A.has(o))return A.get(o);var l=n.apply(this,s);return a.cache=A.set(o,l)||A,l};return a.cache=new(t.Cache||r),a}return t.Cache=r,i0=t,i0}var a0,nF;function OX(){if(nF)return a0;nF=1;var r=MX(),e=500;function t(n){var i=r(n,function(s){return a.size===e&&a.clear(),s}),a=i.cache;return i}return a0=t,a0}var s0,rF;function _X(){if(rF)return s0;rF=1;var r=OX(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(s,o,A,l){a.push(A?l.replace(t,"$1"):o||s)}),a});return s0=n,s0}var o0,iF;function Rd(){if(iF)return o0;iF=1;function r(e,t){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=t(e[n],n,e);return a}return o0=r,o0}var A0,aF;function IX(){if(aF)return A0;aF=1;var r=nA(),e=Rd(),t=Bn(),n=aA(),i=r?r.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(t(o))return e(o,s)+"";if(n(o))return a?a.call(o):"";var A=o+"";return A=="0"&&1/o==-1/0?"-0":A}return A0=s,A0}var l0,sF;function eN(){if(sF)return l0;sF=1;var r=IX();function e(t){return t==null?"":r(t)}return l0=e,l0}var c0,oF;function Dd(){if(oF)return c0;oF=1;var r=Bn(),e=$B(),t=_X(),n=eN();function i(a,s){return r(a)?a:e(a,s)?[a]:t(n(a))}return c0=i,c0}var u0,AF;function $l(){if(AF)return u0;AF=1;var r=aA();function e(t){if(typeof t=="string"||r(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return u0=e,u0}var h0,lF;function Hd(){if(lF)return h0;lF=1;var r=Dd(),e=$l();function t(n,i){i=r(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[e(i[a++])];return a&&a==s?n:void 0}return h0=t,h0}var d0,cF;function kX(){if(cF)return d0;cF=1;var r=Hd();function e(t,n,i){var a=t==null?void 0:r(t,n);return a===void 0?i:a}return d0=e,d0}var f0,uF;function LX(){if(uF)return f0;uF=1;function r(e,t){return e!=null&&t in Object(e)}return f0=r,f0}var g0,hF;function tN(){if(hF)return g0;hF=1;var r=Dd(),e=Wl(),t=Bn(),n=Ld(),i=RB(),a=$l();function s(o,A,l){A=r(A,o);for(var c=-1,u=A.length,h=!1;++c<u;){var d=a(A[c]);if(!(h=o!=null&&l(o,d)))break;o=o[d]}return h||++c!=u?h:(u=o==null?0:o.length,!!u&&i(u)&&n(d,u)&&(t(o)||e(o)))}return g0=s,g0}var v0,dF;function nN(){if(dF)return v0;dF=1;var r=LX(),e=tN();function t(n,i){return n!=null&&e(n,i,r)}return v0=t,v0}var p0,fF;function QX(){if(fF)return p0;fF=1;var r=XQ(),e=kX(),t=nN(),n=$B(),i=ZQ(),a=JQ(),s=$l(),o=1,A=2;function l(c,u){return n(c)&&i(u)?a(s(c),u):function(h){var d=e(h,c);return d===void 0&&d===u?t(h,c):r(u,d,o|A)}}return p0=l,p0}var y0,gF;function rN(){if(gF)return y0;gF=1;function r(e){return function(t){return t==null?void 0:t[e]}}return y0=r,y0}var m0,vF;function NX(){if(vF)return m0;vF=1;var r=Hd();function e(t){return function(n){return r(n,t)}}return m0=e,m0}var w0,pF;function UX(){if(pF)return w0;pF=1;var r=rN(),e=NX(),t=$B(),n=$l();function i(a){return t(a)?r(n(a)):e(a)}return w0=i,w0}var B0,yF;function Ba(){if(yF)return B0;yF=1;var r=TX(),e=QX(),t=ao(),n=Bn(),i=UX();function a(s){return typeof s=="function"?s:s==null?t:typeof s=="object"?n(s)?e(s[0],s[1]):r(s):i(s)}return B0=a,B0}var b0,mF;function iN(){if(mF)return b0;mF=1;var r=LQ(),e=yX(),t=Ba(),n=Bn();function i(a,s){var o=n(a)?r:e;return o(a,t(s,3))}return b0=i,b0}var E0,wF;function PX(){if(wF)return E0;wF=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n,i){return n!=null&&e.call(n,i)}return E0=t,E0}var x0,BF;function aN(){if(BF)return x0;BF=1;var r=PX(),e=tN();function t(n,i){return n!=null&&e(n,i,r)}return x0=t,x0}var C0,bF;function RX(){if(bF)return C0;bF=1;var r=HB(),e=iA(),t=Wl(),n=Bn(),i=wa(),a=rA(),s=Nd(),o=ql(),A="[object Map]",l="[object Set]",c=Object.prototype,u=c.hasOwnProperty;function h(d){if(d==null)return!0;if(i(d)&&(n(d)||typeof d=="string"||typeof d.splice=="function"||a(d)||o(d)||t(d)))return!d.length;var f=e(d);if(f==A||f==l)return!d.size;if(s(d))return!r(d).length;for(var g in d)if(u.call(d,g))return!1;return!0}return C0=h,C0}var S0,EF;function sN(){if(EF)return S0;EF=1;function r(e){return e===void 0}return S0=r,S0}var F0,xF;function oN(){if(xF)return F0;xF=1;var r=Pd(),e=wa();function t(n,i){var a=-1,s=e(n)?Array(n.length):[];return r(n,function(o,A,l){s[++a]=i(o,A,l)}),s}return F0=t,F0}var T0,CF;function AN(){if(CF)return T0;CF=1;var r=Rd(),e=Ba(),t=oN(),n=Bn();function i(a,s){var o=n(a)?r:t;return o(a,e(s,3))}return T0=i,T0}var M0,SF;function DX(){if(SF)return M0;SF=1;function r(e,t,n,i){var a=-1,s=e==null?0:e.length;for(i&&s&&(n=e[++a]);++a<s;)n=t(n,e[a],a,e);return n}return M0=r,M0}var O0,FF;function HX(){if(FF)return O0;FF=1;function r(e,t,n,i,a){return a(e,function(s,o,A){n=i?(i=!1,s):t(n,s,o,A)}),n}return O0=r,O0}var _0,TF;function lN(){if(TF)return _0;TF=1;var r=DX(),e=Pd(),t=Ba(),n=HX(),i=Bn();function a(s,o,A){var l=i(s)?r:n,c=arguments.length<3;return l(s,t(o,4),A,c,e)}return _0=a,_0}var I0,MF;function GX(){if(MF)return I0;MF=1;var r=no(),e=Bn(),t=Zi(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&t(a)&&r(a)==n}return I0=i,I0}var k0,OF;function KX(){if(OF)return k0;OF=1;var r=rN(),e=r("length");return k0=e,k0}var L0,_F;function zX(){if(_F)return L0;_F=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+t+n,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+r+i+a+"]");function A(l){return o.test(l)}return L0=A,L0}var Q0,IF;function VX(){if(IF)return Q0;IF=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+t+n,a="\\ufe0e\\ufe0f",s="["+r+"]",o="["+i+"]",A="\\ud83c[\\udffb-\\udfff]",l="(?:"+o+"|"+A+")",c="[^"+r+"]",u="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",f=l+"?",g="["+a+"]?",v="(?:"+d+"(?:"+[c,u,h].join("|")+")"+g+f+")*",p=g+f+v,y="(?:"+[c+o+"?",o,u,h,s].join("|")+")",m=RegExp(A+"(?="+A+")|"+y+p,"g");function B(C){for(var S=m.lastIndex=0;m.test(C);)++S;return S}return Q0=B,Q0}var N0,kF;function jX(){if(kF)return N0;kF=1;var r=KX(),e=zX(),t=VX();function n(i){return e(i)?t(i):r(i)}return N0=n,N0}var U0,LF;function WX(){if(LF)return U0;LF=1;var r=HB(),e=iA(),t=wa(),n=GX(),i=jX(),a="[object Map]",s="[object Set]";function o(A){if(A==null)return 0;if(t(A))return n(A)?i(A):A.length;var l=e(A);return l==a||l==s?A.size:r(A).length}return U0=o,U0}var P0,QF;function qX(){if(QF)return P0;QF=1;var r=PB(),e=GQ(),t=WB(),n=Ba(),i=Ud(),a=Bn(),s=rA(),o=Vl(),A=si(),l=ql();function c(u,h,d){var f=a(u),g=f||s(u)||l(u);if(h=n(h,4),d==null){var v=u&&u.constructor;g?d=f?new v:[]:A(u)?d=o(v)?e(i(u)):{}:d={}}return(g?r:t)(u,function(p,y,m){return h(d,p,y,m)}),d}return P0=c,P0}var R0,NF;function $X(){if(NF)return R0;NF=1;var r=nA(),e=Wl(),t=Bn(),n=r?r.isConcatSpreadable:void 0;function i(a){return t(a)||e(a)||!!(n&&a&&a[n])}return R0=i,R0}var D0,UF;function YB(){if(UF)return D0;UF=1;var r=KB(),e=$X();function t(n,i,a,s,o){var A=-1,l=n.length;for(a||(a=e),o||(o=[]);++A<l;){var c=n[A];i>0&&a(c)?i>1?t(c,i-1,a,s,o):r(o,c):s||(o[o.length]=c)}return o}return D0=t,D0}var H0,PF;function YX(){if(PF)return H0;PF=1;function r(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}return H0=r,H0}var G0,RF;function cN(){if(RF)return G0;RF=1;var r=YX(),e=Math.max;function t(n,i,a){return i=e(i===void 0?n.length-1:i,0),function(){for(var s=arguments,o=-1,A=e(s.length-i,0),l=Array(A);++o<A;)l[o]=s[i+o];o=-1;for(var c=Array(i+1);++o<i;)c[o]=s[o];return c[i]=a(l),r(n,this,c)}}return G0=t,G0}var K0,DF;function XX(){if(DF)return K0;DF=1;var r=VB(),e=MQ(),t=ao(),n=e?function(i,a){return e(i,"toString",{configurable:!0,enumerable:!1,value:r(a),writable:!0})}:t;return K0=n,K0}var z0,HF;function ZX(){if(HF)return z0;HF=1;var r=800,e=16,t=Date.now;function n(i){var a=0,s=0;return function(){var o=t(),A=e-(o-s);if(s=o,A>0){if(++a>=r)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return z0=n,z0}var V0,GF;function uN(){if(GF)return V0;GF=1;var r=XX(),e=ZX(),t=e(r);return V0=t,V0}var j0,KF;function Gd(){if(KF)return j0;KF=1;var r=ao(),e=cN(),t=uN();function n(i,a){return t(e(i,a,r),i+"")}return j0=n,j0}var W0,zF;function hN(){if(zF)return W0;zF=1;function r(e,t,n,i){for(var a=e.length,s=n+(i?1:-1);i?s--:++s<a;)if(t(e[s],s,e))return s;return-1}return W0=r,W0}var q0,VF;function JX(){if(VF)return q0;VF=1;function r(e){return e!==e}return q0=r,q0}var $0,jF;function eZ(){if(jF)return $0;jF=1;function r(e,t,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===t)return i;return-1}return $0=r,$0}var Y0,WF;function tZ(){if(WF)return Y0;WF=1;var r=hN(),e=JX(),t=eZ();function n(i,a,s){return a===a?t(i,a,s):r(i,e,s)}return Y0=n,Y0}var X0,qF;function nZ(){if(qF)return X0;qF=1;var r=tZ();function e(t,n){var i=t==null?0:t.length;return!!i&&r(t,n,0)>-1}return X0=e,X0}var Z0,$F;function rZ(){if($F)return Z0;$F=1;function r(e,t,n){for(var i=-1,a=e==null?0:e.length;++i<a;)if(n(t,e[i]))return!0;return!1}return Z0=r,Z0}var J0,YF;function iZ(){if(YF)return J0;YF=1;function r(){}return J0=r,J0}var ey,XF;function aZ(){if(XF)return ey;XF=1;var r=RQ(),e=iZ(),t=qB(),n=1/0,i=r&&1/t(new r([,-0]))[1]==n?function(a){return new r(a)}:e;return ey=i,ey}var ty,ZF;function sZ(){if(ZF)return ty;ZF=1;var r=qQ(),e=nZ(),t=rZ(),n=$Q(),i=aZ(),a=qB(),s=200;function o(A,l,c){var u=-1,h=e,d=A.length,f=!0,g=[],v=g;if(c)f=!1,h=t;else if(d>=s){var p=l?null:i(A);if(p)return a(p);f=!1,h=n,v=new r}else v=l?[]:g;e:for(;++u<d;){var y=A[u],m=l?l(y):y;if(y=c||y!==0?y:0,f&&m===m){for(var B=v.length;B--;)if(v[B]===m)continue e;l&&v.push(m),g.push(y)}else h(v,m,c)||(v!==g&&v.push(m),g.push(y))}return g}return ty=o,ty}var ny,JF;function dN(){if(JF)return ny;JF=1;var r=wa(),e=Zi();function t(n){return e(n)&&r(n)}return ny=t,ny}var ry,eT;function oZ(){if(eT)return ry;eT=1;var r=YB(),e=Gd(),t=sZ(),n=dN(),i=e(function(a){return t(r(a,1,n,!0))});return ry=i,ry}var iy,tT;function AZ(){if(tT)return iy;tT=1;var r=Rd();function e(t,n){return r(n,function(i){return t[i]})}return iy=e,iy}var ay,nT;function fN(){if(nT)return ay;nT=1;var r=AZ(),e=As();function t(n){return n==null?[]:r(n,e(n))}return ay=t,ay}var sy,rT;function oi(){if(rT)return sy;rT=1;var r;if(typeof H1=="function")try{r={clone:gX(),constant:VB(),each:WQ(),filter:iN(),has:aN(),isArray:Bn(),isEmpty:RX(),isFunction:Vl(),isUndefined:sN(),keys:As(),map:AN(),reduce:lN(),size:WX(),transform:qX(),union:oZ(),values:fN()}}catch{}return r||(r=window._),sy=r,sy}var oy,iT;function XB(){if(iT)return oy;iT=1;var r=oi();oy=i;var e="\0",t="\0",n="";function i(c){this._isDirected=r.has(c,"directed")?c.directed:!0,this._isMultigraph=r.has(c,"multigraph")?c.multigraph:!1,this._isCompound=r.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var c=this;return r.filter(this.nodes(),function(u){return r.isEmpty(c._in[u])})},i.prototype.sinks=function(){var c=this;return r.filter(this.nodes(),function(u){return r.isEmpty(c._out[u])})},i.prototype.setNodes=function(c,u){var h=arguments,d=this;return r.each(c,function(f){h.length>1?d.setNode(f,u):d.setNode(f)}),this},i.prototype.setNode=function(c,u){return r.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=u),this):(this._nodes[c]=arguments.length>1?u:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=t,this._children[c]={},this._children[t][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return r.has(this._nodes,c)},i.prototype.removeNode=function(c){var u=this;if(r.has(this._nodes,c)){var h=function(d){u.removeEdge(u._edgeObjs[d])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],r.each(this.children(c),function(d){u.setParent(d)}),delete this._children[c]),r.each(r.keys(this._in[c]),h),delete this._in[c],delete this._preds[c],r.each(r.keys(this._out[c]),h),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,u){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(u))u=t;else{u+="";for(var h=u;!r.isUndefined(h);h=this.parent(h))if(h===c)throw new Error("Setting "+u+" as parent of "+c+" would create a cycle");this.setNode(u)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=u,this._children[u][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var u=this._parent[c];if(u!==t)return u}},i.prototype.children=function(c){if(r.isUndefined(c)&&(c=t),this._isCompound){var u=this._children[c];if(u)return r.keys(u)}else{if(c===t)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var u=this._preds[c];if(u)return r.keys(u)},i.prototype.successors=function(c){var u=this._sucs[c];if(u)return r.keys(u)},i.prototype.neighbors=function(c){var u=this.predecessors(c);if(u)return r.union(u,this.successors(c))},i.prototype.isLeaf=function(c){var u;return this.isDirected()?u=this.successors(c):u=this.neighbors(c),u.length===0},i.prototype.filterNodes=function(c){var u=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});u.setGraph(this.graph());var h=this;r.each(this._nodes,function(g,v){c(v)&&u.setNode(v,g)}),r.each(this._edgeObjs,function(g){u.hasNode(g.v)&&u.hasNode(g.w)&&u.setEdge(g,h.edge(g))});var d={};function f(g){var v=h.parent(g);return v===void 0||u.hasNode(v)?(d[g]=v,v):v in d?d[v]:f(v)}return this._isCompound&&r.each(u.nodes(),function(g){u.setParent(g,f(g))}),u},i.prototype.setDefaultEdgeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(c,u){var h=this,d=arguments;return r.reduce(c,function(f,g){return d.length>1?h.setEdge(f,g,u):h.setEdge(f,g),g}),this},i.prototype.setEdge=function(){var c,u,h,d,f=!1,g=arguments[0];typeof g=="object"&&g!==null&&"v"in g?(c=g.v,u=g.w,h=g.name,arguments.length===2&&(d=arguments[1],f=!0)):(c=g,u=arguments[1],h=arguments[3],arguments.length>2&&(d=arguments[2],f=!0)),c=""+c,u=""+u,r.isUndefined(h)||(h=""+h);var v=o(this._isDirected,c,u,h);if(r.has(this._edgeLabels,v))return f&&(this._edgeLabels[v]=d),this;if(!r.isUndefined(h)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(u),this._edgeLabels[v]=f?d:this._defaultEdgeLabelFn(c,u,h);var p=A(this._isDirected,c,u,h);return c=p.v,u=p.w,Object.freeze(p),this._edgeObjs[v]=p,a(this._preds[u],c),a(this._sucs[c],u),this._in[u][v]=p,this._out[c][v]=p,this._edgeCount++,this},i.prototype.edge=function(c,u,h){var d=arguments.length===1?l(this._isDirected,arguments[0]):o(this._isDirected,c,u,h);return this._edgeLabels[d]},i.prototype.hasEdge=function(c,u,h){var d=arguments.length===1?l(this._isDirected,arguments[0]):o(this._isDirected,c,u,h);return r.has(this._edgeLabels,d)},i.prototype.removeEdge=function(c,u,h){var d=arguments.length===1?l(this._isDirected,arguments[0]):o(this._isDirected,c,u,h),f=this._edgeObjs[d];return f&&(c=f.v,u=f.w,delete this._edgeLabels[d],delete this._edgeObjs[d],s(this._preds[u],c),s(this._sucs[c],u),delete this._in[u][d],delete this._out[c][d],this._edgeCount--),this},i.prototype.inEdges=function(c,u){var h=this._in[c];if(h){var d=r.values(h);return u?r.filter(d,function(f){return f.v===u}):d}},i.prototype.outEdges=function(c,u){var h=this._out[c];if(h){var d=r.values(h);return u?r.filter(d,function(f){return f.w===u}):d}},i.prototype.nodeEdges=function(c,u){var h=this.inEdges(c,u);if(h)return h.concat(this.outEdges(c,u))};function a(c,u){c[u]?c[u]++:c[u]=1}function s(c,u){--c[u]||delete c[u]}function o(c,u,h,d){var f=""+u,g=""+h;if(!c&&f>g){var v=f;f=g,g=v}return f+n+g+n+(r.isUndefined(d)?e:d)}function A(c,u,h,d){var f=""+u,g=""+h;if(!c&&f>g){var v=f;f=g,g=v}var p={v:f,w:g};return d&&(p.name=d),p}function l(c,u){return o(c,u.v,u.w,u.name)}return oy}var Ay,aT;function lZ(){return aT||(aT=1,Ay="2.1.8"),Ay}var ly,sT;function cZ(){return sT||(sT=1,ly={Graph:XB(),version:lZ()}),ly}var cy,oT;function uZ(){if(oT)return cy;oT=1;var r=oi(),e=XB();cy={write:t,read:a};function t(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return r.isUndefined(s.graph())||(o.value=r.clone(s.graph())),o}function n(s){return r.map(s.nodes(),function(o){var A=s.node(o),l=s.parent(o),c={v:o};return r.isUndefined(A)||(c.value=A),r.isUndefined(l)||(c.parent=l),c})}function i(s){return r.map(s.edges(),function(o){var A=s.edge(o),l={v:o.v,w:o.w};return r.isUndefined(o.name)||(l.name=o.name),r.isUndefined(A)||(l.value=A),l})}function a(s){var o=new e(s.options).setGraph(s.value);return r.each(s.nodes,function(A){o.setNode(A.v,A.value),A.parent&&o.setParent(A.v,A.parent)}),r.each(s.edges,function(A){o.setEdge({v:A.v,w:A.w,name:A.name},A.value)}),o}return cy}var uy,AT;function hZ(){if(AT)return uy;AT=1;var r=oi();uy=e;function e(t){var n={},i=[],a;function s(o){r.has(n,o)||(n[o]=!0,a.push(o),r.each(t.successors(o),s),r.each(t.predecessors(o),s))}return r.each(t.nodes(),function(o){a=[],s(o),a.length&&i.push(a)}),i}return uy}var hy,lT;function gN(){if(lT)return hy;lT=1;var r=oi();hy=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(t){return t.key})},e.prototype.has=function(t){return r.has(this._keyIndices,t)},e.prototype.priority=function(t){var n=this._keyIndices[t];if(n!==void 0)return this._arr[n].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(t,n){var i=this._keyIndices;if(t=String(t),!r.has(i,t)){var a=this._arr,s=a.length;return i[t]=s,a.push({key:t,priority:n}),this._decrease(s),!0}return!1},e.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},e.prototype.decrease=function(t,n){var i=this._keyIndices[t];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},e.prototype._heapify=function(t){var n=this._arr,i=2*t,a=i+1,s=t;i<n.length&&(s=n[i].priority<n[s].priority?i:s,a<n.length&&(s=n[a].priority<n[s].priority?a:s),s!==t&&(this._swap(t,s),this._heapify(s)))},e.prototype._decrease=function(t){for(var n=this._arr,i=n[t].priority,a;t!==0&&(a=t>>1,!(n[a].priority<i));)this._swap(t,a),t=a},e.prototype._swap=function(t,n){var i=this._arr,a=this._keyIndices,s=i[t],o=i[n];i[t]=o,i[n]=s,a[o.key]=t,a[s.key]=n},hy}var dy,cT;function vN(){if(cT)return dy;cT=1;var r=oi(),e=gN();dy=n;var t=r.constant(1);function n(a,s,o,A){return i(a,String(s),o||t,A||function(l){return a.outEdges(l)})}function i(a,s,o,A){var l={},c=new e,u,h,d=function(f){var g=f.v!==u?f.v:f.w,v=l[g],p=o(f),y=h.distance+p;if(p<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+f+" Weight: "+p);y<v.distance&&(v.distance=y,v.predecessor=u,c.decrease(g,y))};for(a.nodes().forEach(function(f){var g=f===s?0:Number.POSITIVE_INFINITY;l[f]={distance:g},c.add(f,g)});c.size()>0&&(u=c.removeMin(),h=l[u],h.distance!==Number.POSITIVE_INFINITY);)A(u).forEach(d);return l}return dy}var fy,uT;function dZ(){if(uT)return fy;uT=1;var r=vN(),e=oi();fy=t;function t(n,i,a){return e.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return fy}var gy,hT;function pN(){if(hT)return gy;hT=1;var r=oi();gy=e;function e(t){var n=0,i=[],a={},s=[];function o(A){var l=a[A]={onStack:!0,lowlink:n,index:n++};if(i.push(A),t.successors(A).forEach(function(h){r.has(a,h)?a[h].onStack&&(l.lowlink=Math.min(l.lowlink,a[h].index)):(o(h),l.lowlink=Math.min(l.lowlink,a[h].lowlink))}),l.lowlink===l.index){var c=[],u;do u=i.pop(),a[u].onStack=!1,c.push(u);while(A!==u);s.push(c)}}return t.nodes().forEach(function(A){r.has(a,A)||o(A)}),s}return gy}var vy,dT;function fZ(){if(dT)return vy;dT=1;var r=oi(),e=pN();vy=t;function t(n){return r.filter(e(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return vy}var py,fT;function gZ(){if(fT)return py;fT=1;var r=oi();py=t;var e=r.constant(1);function t(i,a,s){return n(i,a||e,s||function(o){return i.outEdges(o)})}function n(i,a,s){var o={},A=i.nodes();return A.forEach(function(l){o[l]={},o[l][l]={distance:0},A.forEach(function(c){l!==c&&(o[l][c]={distance:Number.POSITIVE_INFINITY})}),s(l).forEach(function(c){var u=c.v===l?c.w:c.v,h=a(c);o[l][u]={distance:h,predecessor:l}})}),A.forEach(function(l){var c=o[l];A.forEach(function(u){var h=o[u];A.forEach(function(d){var f=h[l],g=c[d],v=h[d],p=f.distance+g.distance;p<v.distance&&(v.distance=p,v.predecessor=g.predecessor)})})}),o}return py}var yy,gT;function yN(){if(gT)return yy;gT=1;var r=oi();yy=e,e.CycleException=t;function e(n){var i={},a={},s=[];function o(A){if(r.has(a,A))throw new t;r.has(i,A)||(a[A]=!0,i[A]=!0,r.each(n.predecessors(A),o),delete a[A],s.push(A))}if(r.each(n.sinks(),o),r.size(i)!==n.nodeCount())throw new t;return s}function t(){}return t.prototype=new Error,yy}var my,vT;function vZ(){if(vT)return my;vT=1;var r=yN();my=e;function e(t){try{r(t)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return my}var wy,pT;function mN(){if(pT)return wy;pT=1;var r=oi();wy=e;function e(n,i,a){r.isArray(i)||(i=[i]);var s=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],A={};return r.each(i,function(l){if(!n.hasNode(l))throw new Error("Graph does not have node: "+l);t(n,l,a==="post",A,s,o)}),o}function t(n,i,a,s,o,A){r.has(s,i)||(s[i]=!0,a||A.push(i),r.each(o(i),function(l){t(n,l,a,s,o,A)}),a&&A.push(i))}return wy}var By,yT;function pZ(){if(yT)return By;yT=1;var r=mN();By=e;function e(t,n){return r(t,n,"post")}return By}var by,mT;function yZ(){if(mT)return by;mT=1;var r=mN();by=e;function e(t,n){return r(t,n,"pre")}return by}var Ey,wT;function mZ(){if(wT)return Ey;wT=1;var r=oi(),e=XB(),t=gN();Ey=n;function n(i,a){var s=new e,o={},A=new t,l;function c(h){var d=h.v===l?h.w:h.v,f=A.priority(d);if(f!==void 0){var g=a(h);g<f&&(o[d]=l,A.decrease(d,g))}}if(i.nodeCount()===0)return s;r.each(i.nodes(),function(h){A.add(h,Number.POSITIVE_INFINITY),s.setNode(h)}),A.decrease(i.nodes()[0],0);for(var u=!1;A.size()>0;){if(l=A.removeMin(),r.has(o,l))s.setEdge(l,o[l]);else{if(u)throw new Error("Input graph is not connected: "+i);u=!0}i.nodeEdges(l).forEach(c)}return s}return Ey}var xy,BT;function wZ(){return BT||(BT=1,xy={components:hZ(),dijkstra:vN(),dijkstraAll:dZ(),findCycles:fZ(),floydWarshall:gZ(),isAcyclic:vZ(),postorder:pZ(),preorder:yZ(),prim:mZ(),tarjan:pN(),topsort:yN()}),xy}var Cy,bT;function BZ(){if(bT)return Cy;bT=1;var r=cZ();return Cy={Graph:r.Graph,json:uZ(),alg:wZ(),version:r.version},Cy}var Sy,ET;function bi(){if(ET)return Sy;ET=1;var r;if(typeof H1=="function")try{r=BZ()}catch{}return r||(r=window.graphlib),Sy=r,Sy}var Fy,xT;function bZ(){if(xT)return Fy;xT=1;var r=zQ(),e=1,t=4;function n(i){return r(i,e|t)}return Fy=n,Fy}var Ty,CT;function Kd(){if(CT)return Ty;CT=1;var r=tA(),e=wa(),t=Ld(),n=si();function i(a,s,o){if(!n(o))return!1;var A=typeof s;return(A=="number"?e(o)&&t(s,o.length):A=="string"&&s in o)?r(o[s],a):!1}return Ty=i,Ty}var My,ST;function EZ(){if(ST)return My;ST=1;var r=Gd(),e=tA(),t=Kd(),n=io(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,A){o=Object(o);var l=-1,c=A.length,u=c>2?A[2]:void 0;for(u&&t(A[0],A[1],u)&&(c=1);++l<c;)for(var h=A[l],d=n(h),f=-1,g=d.length;++f<g;){var v=d[f],p=o[v];(p===void 0||e(p,i[v])&&!a.call(o,v))&&(o[v]=h[v])}return o});return My=s,My}var Oy,FT;function xZ(){if(FT)return Oy;FT=1;var r=Ba(),e=wa(),t=As();function n(i){return function(a,s,o){var A=Object(a);if(!e(a)){var l=r(s,3);a=t(a),s=function(u){return l(A[u],u,A)}}var c=i(a,s,o);return c>-1?A[l?a[c]:c]:void 0}}return Oy=n,Oy}var _y,TT;function CZ(){if(TT)return _y;TT=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return _y=e,_y}var Iy,MT;function SZ(){if(MT)return Iy;MT=1;var r=CZ(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Iy=t,Iy}var ky,OT;function FZ(){if(OT)return ky;OT=1;var r=SZ(),e=si(),t=aA(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function A(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var u=a.test(l);return u||s.test(l)?o(l.slice(2),u?2:8):i.test(l)?n:+l}return ky=A,ky}var Ly,_T;function wN(){if(_T)return Ly;_T=1;var r=FZ(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var a=i<0?-1:1;return a*t}return i===i?i:0}return Ly=n,Ly}var Qy,IT;function TZ(){if(IT)return Qy;IT=1;var r=wN();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Qy=e,Qy}var Ny,kT;function MZ(){if(kT)return Ny;kT=1;var r=hN(),e=Ba(),t=TZ(),n=Math.max;function i(a,s,o){var A=a==null?0:a.length;if(!A)return-1;var l=o==null?0:t(o);return l<0&&(l=n(A+l,0)),r(a,e(s,3),l)}return Ny=i,Ny}var Uy,LT;function OZ(){if(LT)return Uy;LT=1;var r=xZ(),e=MZ(),t=r(e);return Uy=t,Uy}var Py,QT;function BN(){if(QT)return Py;QT=1;var r=YB();function e(t){var n=t==null?0:t.length;return n?r(t,1):[]}return Py=e,Py}var Ry,NT;function _Z(){if(NT)return Ry;NT=1;var r=jB(),e=VQ(),t=io();function n(i,a){return i==null?i:r(i,e(a),t)}return Ry=n,Ry}var Dy,UT;function IZ(){if(UT)return Dy;UT=1;function r(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}return Dy=r,Dy}var Hy,PT;function kZ(){if(PT)return Hy;PT=1;var r=Id(),e=WB(),t=Ba();function n(i,a){var s={};return a=t(a,3),e(i,function(o,A,l){r(s,A,a(o,A,l))}),s}return Hy=n,Hy}var Gy,RT;function ZB(){if(RT)return Gy;RT=1;var r=aA();function e(t,n,i){for(var a=-1,s=t.length;++a<s;){var o=t[a],A=n(o);if(A!=null&&(l===void 0?A===A&&!r(A):i(A,l)))var l=A,c=o}return c}return Gy=e,Gy}var Ky,DT;function LZ(){if(DT)return Ky;DT=1;function r(e,t){return e>t}return Ky=r,Ky}var zy,HT;function QZ(){if(HT)return zy;HT=1;var r=ZB(),e=LZ(),t=ao();function n(i){return i&&i.length?r(i,t,e):void 0}return zy=n,zy}var Vy,GT;function bN(){if(GT)return Vy;GT=1;var r=Id(),e=tA();function t(n,i,a){(a!==void 0&&!e(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return Vy=t,Vy}var jy,KT;function NZ(){if(KT)return jy;KT=1;var r=no(),e=Ud(),t=Zi(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,A=s.call(Object);function l(c){if(!t(c)||r(c)!=n)return!1;var u=e(c);if(u===null)return!0;var h=o.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&s.call(h)==A}return jy=l,jy}var Wy,zT;function EN(){if(zT)return Wy;zT=1;function r(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}return Wy=r,Wy}var qy,VT;function UZ(){if(VT)return qy;VT=1;var r=jl(),e=io();function t(n){return r(n,e(n))}return qy=t,qy}var $y,jT;function PZ(){if(jT)return $y;jT=1;var r=bN(),e=IQ(),t=HQ(),n=kQ(),i=KQ(),a=Wl(),s=Bn(),o=dN(),A=rA(),l=Vl(),c=si(),u=NZ(),h=ql(),d=EN(),f=UZ();function g(v,p,y,m,B,C,S){var F=d(v,y),T=d(p,y),O=S.get(T);if(O){r(v,y,O);return}var _=C?C(F,T,y+"",v,p,S):void 0,k=_===void 0;if(k){var L=s(T),U=!L&&A(T),G=!L&&!U&&h(T);_=T,L||U||G?s(F)?_=F:o(F)?_=n(F):U?(k=!1,_=e(T,!0)):G?(k=!1,_=t(T,!0)):_=[]:u(T)||a(T)?(_=F,a(F)?_=f(F):(!c(F)||l(F))&&(_=i(T))):k=!1}k&&(S.set(T,_),B(_,T,m,C,S),S.delete(T)),r(v,y,_)}return $y=g,$y}var Yy,WT;function RZ(){if(WT)return Yy;WT=1;var r=_d(),e=bN(),t=jB(),n=PZ(),i=si(),a=io(),s=EN();function o(A,l,c,u,h){A!==l&&t(l,function(d,f){if(h||(h=new r),i(d))n(A,l,f,c,o,u,h);else{var g=u?u(s(A,f),d,f+"",A,l,h):void 0;g===void 0&&(g=d),e(A,f,g)}},a)}return Yy=o,Yy}var Xy,qT;function DZ(){if(qT)return Xy;qT=1;var r=Gd(),e=Kd();function t(n){return r(function(i,a){var s=-1,o=a.length,A=o>1?a[o-1]:void 0,l=o>2?a[2]:void 0;for(A=n.length>3&&typeof A=="function"?(o--,A):void 0,l&&e(a[0],a[1],l)&&(A=o<3?void 0:A,o=1),i=Object(i);++s<o;){var c=a[s];c&&n(i,c,s,A)}return i})}return Xy=t,Xy}var Zy,$T;function HZ(){if($T)return Zy;$T=1;var r=RZ(),e=DZ(),t=e(function(n,i,a){r(n,i,a)});return Zy=t,Zy}var Jy,YT;function xN(){if(YT)return Jy;YT=1;function r(e,t){return e<t}return Jy=r,Jy}var em,XT;function GZ(){if(XT)return em;XT=1;var r=ZB(),e=xN(),t=ao();function n(i){return i&&i.length?r(i,t,e):void 0}return em=n,em}var tm,ZT;function KZ(){if(ZT)return tm;ZT=1;var r=ZB(),e=Ba(),t=xN();function n(i,a){return i&&i.length?r(i,e(a,2),t):void 0}return tm=n,tm}var nm,JT;function zZ(){if(JT)return nm;JT=1;var r=Ci(),e=function(){return r.Date.now()};return nm=e,nm}var rm,eM;function VZ(){if(eM)return rm;eM=1;var r=kd(),e=Dd(),t=Ld(),n=si(),i=$l();function a(s,o,A,l){if(!n(s))return s;o=e(o,s);for(var c=-1,u=o.length,h=u-1,d=s;d!=null&&++c<u;){var f=i(o[c]),g=A;if(f==="__proto__"||f==="constructor"||f==="prototype")return s;if(c!=h){var v=d[f];g=l?l(v,f,d):void 0,g===void 0&&(g=n(v)?v:t(o[c+1])?[]:{})}r(d,f,g),d=d[f]}return s}return rm=a,rm}var im,tM;function jZ(){if(tM)return im;tM=1;var r=Hd(),e=VZ(),t=Dd();function n(i,a,s){for(var o=-1,A=a.length,l={};++o<A;){var c=a[o],u=r(i,c);s(u,c)&&e(l,t(c,i),u)}return l}return im=n,im}var am,nM;function WZ(){if(nM)return am;nM=1;var r=jZ(),e=nN();function t(n,i){return r(n,i,function(a,s){return e(n,s)})}return am=t,am}var sm,rM;function qZ(){if(rM)return sm;rM=1;var r=BN(),e=cN(),t=uN();function n(i){return t(e(i,void 0,r),i+"")}return sm=n,sm}var om,iM;function $Z(){if(iM)return om;iM=1;var r=WZ(),e=qZ(),t=e(function(n,i){return n==null?{}:r(n,i)});return om=t,om}var Am,aM;function YZ(){if(aM)return Am;aM=1;var r=Math.ceil,e=Math.max;function t(n,i,a,s){for(var o=-1,A=e(r((i-n)/(a||1)),0),l=Array(A);A--;)l[s?A:++o]=n,n+=a;return l}return Am=t,Am}var lm,sM;function XZ(){if(sM)return lm;sM=1;var r=YZ(),e=Kd(),t=wN();function n(i){return function(a,s,o){return o&&typeof o!="number"&&e(a,s,o)&&(s=o=void 0),a=t(a),s===void 0?(s=a,a=0):s=t(s),o=o===void 0?a<s?1:-1:t(o),r(a,s,o,i)}}return lm=n,lm}var cm,oM;function ZZ(){if(oM)return cm;oM=1;var r=XZ(),e=r();return cm=e,cm}var um,AM;function JZ(){if(AM)return um;AM=1;function r(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}return um=r,um}var hm,lM;function eJ(){if(lM)return hm;lM=1;var r=aA();function e(t,n){if(t!==n){var i=t!==void 0,a=t===null,s=t===t,o=r(t),A=n!==void 0,l=n===null,c=n===n,u=r(n);if(!l&&!u&&!o&&t>n||o&&A&&c&&!l&&!u||a&&A&&c||!i&&c||!s)return 1;if(!a&&!o&&!u&&t<n||u&&i&&s&&!a&&!o||l&&i&&s||!A&&s||!c)return-1}return 0}return hm=e,hm}var dm,cM;function tJ(){if(cM)return dm;cM=1;var r=eJ();function e(t,n,i){for(var a=-1,s=t.criteria,o=n.criteria,A=s.length,l=i.length;++a<A;){var c=r(s[a],o[a]);if(c){if(a>=l)return c;var u=i[a];return c*(u=="desc"?-1:1)}}return t.index-n.index}return dm=e,dm}var fm,uM;function nJ(){if(uM)return fm;uM=1;var r=Rd(),e=Hd(),t=Ba(),n=oN(),i=JZ(),a=Qd(),s=tJ(),o=ao(),A=Bn();function l(c,u,h){u.length?u=r(u,function(g){return A(g)?function(v){return e(v,g.length===1?g[0]:g)}:g}):u=[o];var d=-1;u=r(u,a(t));var f=n(c,function(g,v,p){var y=r(u,function(m){return m(g)});return{criteria:y,index:++d,value:g}});return i(f,function(g,v){return s(g,v,h)})}return fm=l,fm}var gm,hM;function rJ(){if(hM)return gm;hM=1;var r=YB(),e=nJ(),t=Gd(),n=Kd(),i=t(function(a,s){if(a==null)return[];var o=s.length;return o>1&&n(a,s[0],s[1])?s=[]:o>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),e(a,r(s,1),[])});return gm=i,gm}var vm,dM;function iJ(){if(dM)return vm;dM=1;var r=eN(),e=0;function t(n){var i=++e;return r(n)+i}return vm=t,vm}var pm,fM;function aJ(){if(fM)return pm;fM=1;function r(e,t,n){for(var i=-1,a=e.length,s=t.length,o={};++i<a;){var A=i<s?t[i]:void 0;n(o,e[i],A)}return o}return pm=r,pm}var ym,gM;function sJ(){if(gM)return ym;gM=1;var r=kd(),e=aJ();function t(n,i){return e(n||[],i||[],r)}return ym=t,ym}var mm,vM;function jt(){if(vM)return mm;vM=1;var r;if(typeof H1=="function")try{r={cloneDeep:bZ(),constant:VB(),defaults:EZ(),each:WQ(),filter:iN(),find:OZ(),flatten:BN(),forEach:jQ(),forIn:_Z(),has:aN(),isUndefined:sN(),last:IZ(),map:AN(),mapValues:kZ(),max:QZ(),merge:HZ(),min:GZ(),minBy:KZ(),now:zZ(),pick:$Z(),range:ZZ(),reduce:lN(),sortBy:rJ(),uniqueId:iJ(),values:fN(),zipObject:sJ()}}catch{}return r||(r=window._),mm=r,mm}var wm,pM;function oJ(){if(pM)return wm;pM=1,wm=r;function r(){var n={};n._next=n._prev=n,this._sentinel=n}r.prototype.dequeue=function(){var n=this._sentinel,i=n._prev;if(i!==n)return e(i),i},r.prototype.enqueue=function(n){var i=this._sentinel;n._prev&&n._next&&e(n),n._next=i._next,i._next._prev=n,i._next=n,n._prev=i},r.prototype.toString=function(){for(var n=[],i=this._sentinel,a=i._prev;a!==i;)n.push(JSON.stringify(a,t)),a=a._prev;return"["+n.join(", ")+"]"};function e(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function t(n,i){if(n!=="_next"&&n!=="_prev")return i}return wm}var Bm,yM;function AJ(){if(yM)return Bm;yM=1;var r=jt(),e=bi().Graph,t=oJ();Bm=i;var n=r.constant(1);function i(l,c){if(l.nodeCount()<=1)return[];var u=o(l,c||n),h=a(u.graph,u.buckets,u.zeroIdx);return r.flatten(r.map(h,function(d){return l.outEdges(d.v,d.w)}),!0)}function a(l,c,u){for(var h=[],d=c[c.length-1],f=c[0],g;l.nodeCount();){for(;g=f.dequeue();)s(l,c,u,g);for(;g=d.dequeue();)s(l,c,u,g);if(l.nodeCount()){for(var v=c.length-2;v>0;--v)if(g=c[v].dequeue(),g){h=h.concat(s(l,c,u,g,!0));break}}}return h}function s(l,c,u,h,d){var f=d?[]:void 0;return r.forEach(l.inEdges(h.v),function(g){var v=l.edge(g),p=l.node(g.v);d&&f.push({v:g.v,w:g.w}),p.out-=v,A(c,u,p)}),r.forEach(l.outEdges(h.v),function(g){var v=l.edge(g),p=g.w,y=l.node(p);y.in-=v,A(c,u,y)}),l.removeNode(h.v),f}function o(l,c){var u=new e,h=0,d=0;r.forEach(l.nodes(),function(v){u.setNode(v,{v,in:0,out:0})}),r.forEach(l.edges(),function(v){var p=u.edge(v.v,v.w)||0,y=c(v),m=p+y;u.setEdge(v.v,v.w,m),d=Math.max(d,u.node(v.v).out+=y),h=Math.max(h,u.node(v.w).in+=y)});var f=r.range(d+h+3).map(function(){return new t}),g=h+1;return r.forEach(u.nodes(),function(v){A(f,g,u.node(v))}),{graph:u,buckets:f,zeroIdx:g}}function A(l,c,u){u.out?u.in?l[u.out-u.in+c].enqueue(u):l[l.length-1].enqueue(u):l[0].enqueue(u)}return Bm}var bm,mM;function lJ(){if(mM)return bm;mM=1;var r=jt(),e=AJ();bm={run:t,undo:i};function t(a){var s=a.graph().acyclicer==="greedy"?e(a,o(a)):n(a);r.forEach(s,function(A){var l=a.edge(A);a.removeEdge(A),l.forwardName=A.name,l.reversed=!0,a.setEdge(A.w,A.v,l,r.uniqueId("rev"))});function o(A){return function(l){return A.edge(l).weight}}}function n(a){var s=[],o={},A={};function l(c){r.has(A,c)||(A[c]=!0,o[c]=!0,r.forEach(a.outEdges(c),function(u){r.has(o,u.w)?s.push(u):l(u.w)}),delete o[c])}return r.forEach(a.nodes(),l),s}function i(a){r.forEach(a.edges(),function(s){var o=a.edge(s);if(o.reversed){a.removeEdge(s);var A=o.forwardName;delete o.reversed,delete o.forwardName,a.setEdge(s.w,s.v,o,A)}})}return bm}var Em,wM;function Sr(){if(wM)return Em;wM=1;var r=jt(),e=bi().Graph;Em={addDummyNode:t,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:s,intersectRect:o,buildLayerMatrix:A,normalizeRanks:l,removeEmptyRanks:c,addBorderNode:u,maxRank:h,partition:d,time:f,notime:g};function t(v,p,y,m){var B;do B=r.uniqueId(m);while(v.hasNode(B));return y.dummy=p,v.setNode(B,y),B}function n(v){var p=new e().setGraph(v.graph());return r.forEach(v.nodes(),function(y){p.setNode(y,v.node(y))}),r.forEach(v.edges(),function(y){var m=p.edge(y.v,y.w)||{weight:0,minlen:1},B=v.edge(y);p.setEdge(y.v,y.w,{weight:m.weight+B.weight,minlen:Math.max(m.minlen,B.minlen)})}),p}function i(v){var p=new e({multigraph:v.isMultigraph()}).setGraph(v.graph());return r.forEach(v.nodes(),function(y){v.children(y).length||p.setNode(y,v.node(y))}),r.forEach(v.edges(),function(y){p.setEdge(y,v.edge(y))}),p}function a(v){var p=r.map(v.nodes(),function(y){var m={};return r.forEach(v.outEdges(y),function(B){m[B.w]=(m[B.w]||0)+v.edge(B).weight}),m});return r.zipObject(v.nodes(),p)}function s(v){var p=r.map(v.nodes(),function(y){var m={};return r.forEach(v.inEdges(y),function(B){m[B.v]=(m[B.v]||0)+v.edge(B).weight}),m});return r.zipObject(v.nodes(),p)}function o(v,p){var y=v.x,m=v.y,B=p.x-y,C=p.y-m,S=v.width/2,F=v.height/2;if(!B&&!C)throw new Error("Not possible to find intersection inside of the rectangle");var T,O;return Math.abs(C)*S>Math.abs(B)*F?(C<0&&(F=-F),T=F*B/C,O=F):(B<0&&(S=-S),T=S,O=S*C/B),{x:y+T,y:m+O}}function A(v){var p=r.map(r.range(h(v)+1),function(){return[]});return r.forEach(v.nodes(),function(y){var m=v.node(y),B=m.rank;r.isUndefined(B)||(p[B][m.order]=y)}),p}function l(v){var p=r.min(r.map(v.nodes(),function(y){return v.node(y).rank}));r.forEach(v.nodes(),function(y){var m=v.node(y);r.has(m,"rank")&&(m.rank-=p)})}function c(v){var p=r.min(r.map(v.nodes(),function(C){return v.node(C).rank})),y=[];r.forEach(v.nodes(),function(C){var S=v.node(C).rank-p;y[S]||(y[S]=[]),y[S].push(C)});var m=0,B=v.graph().nodeRankFactor;r.forEach(y,function(C,S){r.isUndefined(C)&&S%B!==0?--m:m&&r.forEach(C,function(F){v.node(F).rank+=m})})}function u(v,p,y,m){var B={width:0,height:0};return arguments.length>=4&&(B.rank=y,B.order=m),t(v,"border",B,p)}function h(v){return r.max(r.map(v.nodes(),function(p){var y=v.node(p).rank;if(!r.isUndefined(y))return y}))}function d(v,p){var y={lhs:[],rhs:[]};return r.forEach(v,function(m){p(m)?y.lhs.push(m):y.rhs.push(m)}),y}function f(v,p){var y=r.now();try{return p()}finally{console.log(v+" time: "+(r.now()-y)+"ms")}}function g(v,p){return p()}return Em}var xm,BM;function cJ(){if(BM)return xm;BM=1;var r=jt(),e=Sr();xm={run:t,undo:i};function t(a){a.graph().dummyChains=[],r.forEach(a.edges(),function(s){n(a,s)})}function n(a,s){var o=s.v,A=a.node(o).rank,l=s.w,c=a.node(l).rank,u=s.name,h=a.edge(s),d=h.labelRank;if(c!==A+1){a.removeEdge(s);var f,g,v;for(v=0,++A;A<c;++v,++A)h.points=[],g={width:0,height:0,edgeLabel:h,edgeObj:s,rank:A},f=e.addDummyNode(a,"edge",g,"_d"),A===d&&(g.width=h.width,g.height=h.height,g.dummy="edge-label",g.labelpos=h.labelpos),a.setEdge(o,f,{weight:h.weight},u),v===0&&a.graph().dummyChains.push(f),o=f;a.setEdge(o,l,{weight:h.weight},u)}}function i(a){r.forEach(a.graph().dummyChains,function(s){var o=a.node(s),A=o.edgeLabel,l;for(a.setEdge(o.edgeObj,A);o.dummy;)l=a.successors(s)[0],a.removeNode(s),A.points.push({x:o.x,y:o.y}),o.dummy==="edge-label"&&(A.x=o.x,A.y=o.y,A.width=o.width,A.height=o.height),s=l,o=a.node(s)})}return xm}var Cm,bM;function Sh(){if(bM)return Cm;bM=1;var r=jt();Cm={longestPath:e,slack:t};function e(n){var i={};function a(s){var o=n.node(s);if(r.has(i,s))return o.rank;i[s]=!0;var A=r.min(r.map(n.outEdges(s),function(l){return a(l.w)-n.edge(l).minlen}));return(A===Number.POSITIVE_INFINITY||A===void 0||A===null)&&(A=0),o.rank=A}r.forEach(n.sources(),a)}function t(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen}return Cm}var Sm,EM;function CN(){if(EM)return Sm;EM=1;var r=jt(),e=bi().Graph,t=Sh().slack;Sm=n;function n(o){var A=new e({directed:!1}),l=o.nodes()[0],c=o.nodeCount();A.setNode(l,{});for(var u,h;i(A,o)<c;)u=a(A,o),h=A.hasNode(u.v)?t(o,u):-t(o,u),s(A,o,h);return A}function i(o,A){function l(c){r.forEach(A.nodeEdges(c),function(u){var h=u.v,d=c===h?u.w:h;!o.hasNode(d)&&!t(A,u)&&(o.setNode(d,{}),o.setEdge(c,d,{}),l(d))})}return r.forEach(o.nodes(),l),o.nodeCount()}function a(o,A){return r.minBy(A.edges(),function(l){if(o.hasNode(l.v)!==o.hasNode(l.w))return t(A,l)})}function s(o,A,l){r.forEach(o.nodes(),function(c){A.node(c).rank+=l})}return Sm}var Fm,xM;function uJ(){if(xM)return Fm;xM=1;var r=jt(),e=CN(),t=Sh().slack,n=Sh().longestPath,i=bi().alg.preorder,a=bi().alg.postorder,s=Sr().simplify;Fm=o,o.initLowLimValues=u,o.initCutValues=A,o.calcCutValue=c,o.leaveEdge=d,o.enterEdge=f,o.exchangeEdges=g;function o(m){m=s(m),n(m);var B=e(m);u(B),A(B,m);for(var C,S;C=d(B);)S=f(B,m,C),g(B,m,C,S)}function A(m,B){var C=a(m,m.nodes());C=C.slice(0,C.length-1),r.forEach(C,function(S){l(m,B,S)})}function l(m,B,C){var S=m.node(C),F=S.parent;m.edge(C,F).cutvalue=c(m,B,C)}function c(m,B,C){var S=m.node(C),F=S.parent,T=!0,O=B.edge(C,F),_=0;return O||(T=!1,O=B.edge(F,C)),_=O.weight,r.forEach(B.nodeEdges(C),function(k){var L=k.v===C,U=L?k.w:k.v;if(U!==F){var G=L===T,W=B.edge(k).weight;if(_+=G?W:-W,p(m,C,U)){var V=m.edge(C,U).cutvalue;_+=G?-V:V}}}),_}function u(m,B){arguments.length<2&&(B=m.nodes()[0]),h(m,{},1,B)}function h(m,B,C,S,F){var T=C,O=m.node(S);return B[S]=!0,r.forEach(m.neighbors(S),function(_){r.has(B,_)||(C=h(m,B,C,_,S))}),O.low=T,O.lim=C++,F?O.parent=F:delete O.parent,C}function d(m){return r.find(m.edges(),function(B){return m.edge(B).cutvalue<0})}function f(m,B,C){var S=C.v,F=C.w;B.hasEdge(S,F)||(S=C.w,F=C.v);var T=m.node(S),O=m.node(F),_=T,k=!1;T.lim>O.lim&&(_=O,k=!0);var L=r.filter(B.edges(),function(U){return k===y(m,m.node(U.v),_)&&k!==y(m,m.node(U.w),_)});return r.minBy(L,function(U){return t(B,U)})}function g(m,B,C,S){var F=C.v,T=C.w;m.removeEdge(F,T),m.setEdge(S.v,S.w,{}),u(m),A(m,B),v(m,B)}function v(m,B){var C=r.find(m.nodes(),function(F){return!B.node(F).parent}),S=i(m,C);S=S.slice(1),r.forEach(S,function(F){var T=m.node(F).parent,O=B.edge(F,T),_=!1;O||(O=B.edge(T,F),_=!0),B.node(F).rank=B.node(T).rank+(_?O.minlen:-O.minlen)})}function p(m,B,C){return m.hasEdge(B,C)}function y(m,B,C){return C.low<=B.lim&&B.lim<=C.lim}return Fm}var Tm,CM;function hJ(){if(CM)return Tm;CM=1;var r=Sh(),e=r.longestPath,t=CN(),n=uJ();Tm=i;function i(A){switch(A.graph().ranker){case"network-simplex":o(A);break;case"tight-tree":s(A);break;case"longest-path":a(A);break;default:o(A)}}var a=e;function s(A){e(A),t(A)}function o(A){n(A)}return Tm}var Mm,SM;function dJ(){if(SM)return Mm;SM=1;var r=jt();Mm=e;function e(i){var a=n(i);r.forEach(i.graph().dummyChains,function(s){for(var o=i.node(s),A=o.edgeObj,l=t(i,a,A.v,A.w),c=l.path,u=l.lca,h=0,d=c[h],f=!0;s!==A.w;){if(o=i.node(s),f){for(;(d=c[h])!==u&&i.node(d).maxRank<o.rank;)h++;d===u&&(f=!1)}if(!f){for(;h<c.length-1&&i.node(d=c[h+1]).minRank<=o.rank;)h++;d=c[h]}i.setParent(s,d),s=i.successors(s)[0]}})}function t(i,a,s,o){var A=[],l=[],c=Math.min(a[s].low,a[o].low),u=Math.max(a[s].lim,a[o].lim),h,d;h=s;do h=i.parent(h),A.push(h);while(h&&(a[h].low>c||u>a[h].lim));for(d=h,h=o;(h=i.parent(h))!==d;)l.push(h);return{path:A.concat(l.reverse()),lca:d}}function n(i){var a={},s=0;function o(A){var l=s;r.forEach(i.children(A),o),a[A]={low:l,lim:s++}}return r.forEach(i.children(),o),a}return Mm}var Om,FM;function fJ(){if(FM)return Om;FM=1;var r=jt(),e=Sr();Om={run:t,cleanup:s};function t(o){var A=e.addDummyNode(o,"root",{},"_root"),l=i(o),c=r.max(r.values(l))-1,u=2*c+1;o.graph().nestingRoot=A,r.forEach(o.edges(),function(d){o.edge(d).minlen*=u});var h=a(o)+1;r.forEach(o.children(),function(d){n(o,A,u,h,c,l,d)}),o.graph().nodeRankFactor=u}function n(o,A,l,c,u,h,d){var f=o.children(d);if(!f.length){d!==A&&o.setEdge(A,d,{weight:0,minlen:l});return}var g=e.addBorderNode(o,"_bt"),v=e.addBorderNode(o,"_bb"),p=o.node(d);o.setParent(g,d),p.borderTop=g,o.setParent(v,d),p.borderBottom=v,r.forEach(f,function(y){n(o,A,l,c,u,h,y);var m=o.node(y),B=m.borderTop?m.borderTop:y,C=m.borderBottom?m.borderBottom:y,S=m.borderTop?c:2*c,F=B!==C?1:u-h[d]+1;o.setEdge(g,B,{weight:S,minlen:F,nestingEdge:!0}),o.setEdge(C,v,{weight:S,minlen:F,nestingEdge:!0})}),o.parent(d)||o.setEdge(A,g,{weight:0,minlen:u+h[d]})}function i(o){var A={};function l(c,u){var h=o.children(c);h&&h.length&&r.forEach(h,function(d){l(d,u+1)}),A[c]=u}return r.forEach(o.children(),function(c){l(c,1)}),A}function a(o){return r.reduce(o.edges(),function(A,l){return A+o.edge(l).weight},0)}function s(o){var A=o.graph();o.removeNode(A.nestingRoot),delete A.nestingRoot,r.forEach(o.edges(),function(l){var c=o.edge(l);c.nestingEdge&&o.removeEdge(l)})}return Om}var _m,TM;function gJ(){if(TM)return _m;TM=1;var r=jt(),e=Sr();_m=t;function t(i){function a(s){var o=i.children(s),A=i.node(s);if(o.length&&r.forEach(o,a),r.has(A,"minRank")){A.borderLeft=[],A.borderRight=[];for(var l=A.minRank,c=A.maxRank+1;l<c;++l)n(i,"borderLeft","_bl",s,A,l),n(i,"borderRight","_br",s,A,l)}}r.forEach(i.children(),a)}function n(i,a,s,o,A,l){var c={width:0,height:0,rank:l,borderType:a},u=A[a][l-1],h=e.addDummyNode(i,"border",c,s);A[a][l]=h,i.setParent(h,o),u&&i.setEdge(u,h,{weight:1})}return _m}var Im,MM;function vJ(){if(MM)return Im;MM=1;var r=jt();Im={adjust:e,undo:t};function e(l){var c=l.graph().rankdir.toLowerCase();(c==="lr"||c==="rl")&&n(l)}function t(l){var c=l.graph().rankdir.toLowerCase();(c==="bt"||c==="rl")&&a(l),(c==="lr"||c==="rl")&&(o(l),n(l))}function n(l){r.forEach(l.nodes(),function(c){i(l.node(c))}),r.forEach(l.edges(),function(c){i(l.edge(c))})}function i(l){var c=l.width;l.width=l.height,l.height=c}function a(l){r.forEach(l.nodes(),function(c){s(l.node(c))}),r.forEach(l.edges(),function(c){var u=l.edge(c);r.forEach(u.points,s),r.has(u,"y")&&s(u)})}function s(l){l.y=-l.y}function o(l){r.forEach(l.nodes(),function(c){A(l.node(c))}),r.forEach(l.edges(),function(c){var u=l.edge(c);r.forEach(u.points,A),r.has(u,"x")&&A(u)})}function A(l){var c=l.x;l.x=l.y,l.y=c}return Im}var km,OM;function pJ(){if(OM)return km;OM=1;var r=jt();km=e;function e(t){var n={},i=r.filter(t.nodes(),function(l){return!t.children(l).length}),a=r.max(r.map(i,function(l){return t.node(l).rank})),s=r.map(r.range(a+1),function(){return[]});function o(l){if(!r.has(n,l)){n[l]=!0;var c=t.node(l);s[c.rank].push(l),r.forEach(t.successors(l),o)}}var A=r.sortBy(i,function(l){return t.node(l).rank});return r.forEach(A,o),s}return km}var Lm,_M;function yJ(){if(_M)return Lm;_M=1;var r=jt();Lm=e;function e(n,i){for(var a=0,s=1;s<i.length;++s)a+=t(n,i[s-1],i[s]);return a}function t(n,i,a){for(var s=r.zipObject(a,r.map(a,function(h,d){return d})),o=r.flatten(r.map(i,function(h){return r.sortBy(r.map(n.outEdges(h),function(d){return{pos:s[d.w],weight:n.edge(d).weight}}),"pos")}),!0),A=1;A<a.length;)A<<=1;var l=2*A-1;A-=1;var c=r.map(new Array(l),function(){return 0}),u=0;return r.forEach(o.forEach(function(h){var d=h.pos+A;c[d]+=h.weight;for(var f=0;d>0;)d%2&&(f+=c[d+1]),d=d-1>>1,c[d]+=h.weight;u+=h.weight*f})),u}return Lm}var Qm,IM;function mJ(){if(IM)return Qm;IM=1;var r=jt();Qm=e;function e(t,n){return r.map(n,function(i){var a=t.inEdges(i);if(a.length){var s=r.reduce(a,function(o,A){var l=t.edge(A),c=t.node(A.v);return{sum:o.sum+l.weight*c.order,weight:o.weight+l.weight}},{sum:0,weight:0});return{v:i,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:i}})}return Qm}var Nm,kM;function wJ(){if(kM)return Nm;kM=1;var r=jt();Nm=e;function e(i,a){var s={};r.forEach(i,function(A,l){var c=s[A.v]={indegree:0,in:[],out:[],vs:[A.v],i:l};r.isUndefined(A.barycenter)||(c.barycenter=A.barycenter,c.weight=A.weight)}),r.forEach(a.edges(),function(A){var l=s[A.v],c=s[A.w];!r.isUndefined(l)&&!r.isUndefined(c)&&(c.indegree++,l.out.push(s[A.w]))});var o=r.filter(s,function(A){return!A.indegree});return t(o)}function t(i){var a=[];function s(l){return function(c){c.merged||(r.isUndefined(c.barycenter)||r.isUndefined(l.barycenter)||c.barycenter>=l.barycenter)&&n(l,c)}}function o(l){return function(c){c.in.push(l),--c.indegree===0&&i.push(c)}}for(;i.length;){var A=i.pop();a.push(A),r.forEach(A.in.reverse(),s(A)),r.forEach(A.out,o(A))}return r.map(r.filter(a,function(l){return!l.merged}),function(l){return r.pick(l,["vs","i","barycenter","weight"])})}function n(i,a){var s=0,o=0;i.weight&&(s+=i.barycenter*i.weight,o+=i.weight),a.weight&&(s+=a.barycenter*a.weight,o+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=s/o,i.weight=o,i.i=Math.min(a.i,i.i),a.merged=!0}return Nm}var Um,LM;function BJ(){if(LM)return Um;LM=1;var r=jt(),e=Sr();Um=t;function t(a,s){var o=e.partition(a,function(g){return r.has(g,"barycenter")}),A=o.lhs,l=r.sortBy(o.rhs,function(g){return-g.i}),c=[],u=0,h=0,d=0;A.sort(i(!!s)),d=n(c,l,d),r.forEach(A,function(g){d+=g.vs.length,c.push(g.vs),u+=g.barycenter*g.weight,h+=g.weight,d=n(c,l,d)});var f={vs:r.flatten(c,!0)};return h&&(f.barycenter=u/h,f.weight=h),f}function n(a,s,o){for(var A;s.length&&(A=r.last(s)).i<=o;)s.pop(),a.push(A.vs),o++;return o}function i(a){return function(s,o){return s.barycenter<o.barycenter?-1:s.barycenter>o.barycenter?1:a?o.i-s.i:s.i-o.i}}return Um}var Pm,QM;function bJ(){if(QM)return Pm;QM=1;var r=jt(),e=mJ(),t=wJ(),n=BJ();Pm=i;function i(o,A,l,c){var u=o.children(A),h=o.node(A),d=h?h.borderLeft:void 0,f=h?h.borderRight:void 0,g={};d&&(u=r.filter(u,function(C){return C!==d&&C!==f}));var v=e(o,u);r.forEach(v,function(C){if(o.children(C.v).length){var S=i(o,C.v,l,c);g[C.v]=S,r.has(S,"barycenter")&&s(C,S)}});var p=t(v,l);a(p,g);var y=n(p,c);if(d&&(y.vs=r.flatten([d,y.vs,f],!0),o.predecessors(d).length)){var m=o.node(o.predecessors(d)[0]),B=o.node(o.predecessors(f)[0]);r.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+B.order)/(y.weight+2),y.weight+=2}return y}function a(o,A){r.forEach(o,function(l){l.vs=r.flatten(l.vs.map(function(c){return A[c]?A[c].vs:c}),!0)})}function s(o,A){r.isUndefined(o.barycenter)?(o.barycenter=A.barycenter,o.weight=A.weight):(o.barycenter=(o.barycenter*o.weight+A.barycenter*A.weight)/(o.weight+A.weight),o.weight+=A.weight)}return Pm}var Rm,NM;function EJ(){if(NM)return Rm;NM=1;var r=jt(),e=bi().Graph;Rm=t;function t(i,a,s){var o=n(i),A=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(l){return i.node(l)});return r.forEach(i.nodes(),function(l){var c=i.node(l),u=i.parent(l);(c.rank===a||c.minRank<=a&&a<=c.maxRank)&&(A.setNode(l),A.setParent(l,u||o),r.forEach(i[s](l),function(h){var d=h.v===l?h.w:h.v,f=A.edge(d,l),g=r.isUndefined(f)?0:f.weight;A.setEdge(d,l,{weight:i.edge(h).weight+g})}),r.has(c,"minRank")&&A.setNode(l,{borderLeft:c.borderLeft[a],borderRight:c.borderRight[a]}))}),A}function n(i){for(var a;i.hasNode(a=r.uniqueId("_root")););return a}return Rm}var Dm,UM;function xJ(){if(UM)return Dm;UM=1;var r=jt();Dm=e;function e(t,n,i){var a={},s;r.forEach(i,function(o){for(var A=t.parent(o),l,c;A;){if(l=t.parent(A),l?(c=a[l],a[l]=A):(c=s,s=A),c&&c!==A){n.setEdge(c,A);return}A=l}})}return Dm}var Hm,PM;function CJ(){if(PM)return Hm;PM=1;var r=jt(),e=pJ(),t=yJ(),n=bJ(),i=EJ(),a=xJ(),s=bi().Graph,o=Sr();Hm=A;function A(h){var d=o.maxRank(h),f=l(h,r.range(1,d+1),"inEdges"),g=l(h,r.range(d-1,-1,-1),"outEdges"),v=e(h);u(h,v);for(var p=Number.POSITIVE_INFINITY,y,m=0,B=0;B<4;++m,++B){c(m%2?f:g,m%4>=2),v=o.buildLayerMatrix(h);var C=t(h,v);C<p&&(B=0,y=r.cloneDeep(v),p=C)}u(h,y)}function l(h,d,f){return r.map(d,function(g){return i(h,g,f)})}function c(h,d){var f=new s;r.forEach(h,function(g){var v=g.graph().root,p=n(g,v,f,d);r.forEach(p.vs,function(y,m){g.node(y).order=m}),a(g,f,p.vs)})}function u(h,d){r.forEach(d,function(f){r.forEach(f,function(g,v){h.node(g).order=v})})}return Hm}var Gm,RM;function SJ(){if(RM)return Gm;RM=1;var r=jt(),e=bi().Graph,t=Sr();Gm={positionX:f,findType1Conflicts:n,findType2Conflicts:i,addConflict:s,hasConflict:o,verticalAlignment:A,horizontalCompaction:l,alignCoordinates:h,findSmallestWidthAlignment:u,balance:d};function n(p,y){var m={};function B(C,S){var F=0,T=0,O=C.length,_=r.last(S);return r.forEach(S,function(k,L){var U=a(p,k),G=U?p.node(U).order:O;(U||k===_)&&(r.forEach(S.slice(T,L+1),function(W){r.forEach(p.predecessors(W),function(V){var K=p.node(V),D=K.order;(D<F||G<D)&&!(K.dummy&&p.node(W).dummy)&&s(m,V,W)})}),T=L+1,F=G)}),S}return r.reduce(y,B),m}function i(p,y){var m={};function B(S,F,T,O,_){var k;r.forEach(r.range(F,T),function(L){k=S[L],p.node(k).dummy&&r.forEach(p.predecessors(k),function(U){var G=p.node(U);G.dummy&&(G.order<O||G.order>_)&&s(m,U,k)})})}function C(S,F){var T=-1,O,_=0;return r.forEach(F,function(k,L){if(p.node(k).dummy==="border"){var U=p.predecessors(k);U.length&&(O=p.node(U[0]).order,B(F,_,L,T,O),_=L,T=O)}B(F,_,F.length,O,S.length)}),F}return r.reduce(y,C),m}function a(p,y){if(p.node(y).dummy)return r.find(p.predecessors(y),function(m){return p.node(m).dummy})}function s(p,y,m){if(y>m){var B=y;y=m,m=B}var C=p[y];C||(p[y]=C={}),C[m]=!0}function o(p,y,m){if(y>m){var B=y;y=m,m=B}return r.has(p[y],m)}function A(p,y,m,B){var C={},S={},F={};return r.forEach(y,function(T){r.forEach(T,function(O,_){C[O]=O,S[O]=O,F[O]=_})}),r.forEach(y,function(T){var O=-1;r.forEach(T,function(_){var k=B(_);if(k.length){k=r.sortBy(k,function(V){return F[V]});for(var L=(k.length-1)/2,U=Math.floor(L),G=Math.ceil(L);U<=G;++U){var W=k[U];S[_]===_&&O<F[W]&&!o(m,_,W)&&(S[W]=_,S[_]=C[_]=C[W],O=F[W])}}})}),{root:C,align:S}}function l(p,y,m,B,C){var S={},F=c(p,y,m,C),T=C?"borderLeft":"borderRight";function O(L,U){for(var G=F.nodes(),W=G.pop(),V={};W;)V[W]?L(W):(V[W]=!0,G.push(W),G=G.concat(U(W))),W=G.pop()}function _(L){S[L]=F.inEdges(L).reduce(function(U,G){return Math.max(U,S[G.v]+F.edge(G))},0)}function k(L){var U=F.outEdges(L).reduce(function(W,V){return Math.min(W,S[V.w]-F.edge(V))},Number.POSITIVE_INFINITY),G=p.node(L);U!==Number.POSITIVE_INFINITY&&G.borderType!==T&&(S[L]=Math.max(S[L],U))}return O(_,F.predecessors.bind(F)),O(k,F.successors.bind(F)),r.forEach(B,function(L){S[L]=S[m[L]]}),S}function c(p,y,m,B){var C=new e,S=p.graph(),F=g(S.nodesep,S.edgesep,B);return r.forEach(y,function(T){var O;r.forEach(T,function(_){var k=m[_];if(C.setNode(k),O){var L=m[O],U=C.edge(L,k);C.setEdge(L,k,Math.max(F(p,_,O),U||0))}O=_})}),C}function u(p,y){return r.minBy(r.values(y),function(m){var B=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return r.forIn(m,function(S,F){var T=v(p,F)/2;B=Math.max(S+T,B),C=Math.min(S-T,C)}),B-C})}function h(p,y){var m=r.values(y),B=r.min(m),C=r.max(m);r.forEach(["u","d"],function(S){r.forEach(["l","r"],function(F){var T=S+F,O=p[T],_;if(O!==y){var k=r.values(O);_=F==="l"?B-r.min(k):C-r.max(k),_&&(p[T]=r.mapValues(O,function(L){return L+_}))}})})}function d(p,y){return r.mapValues(p.ul,function(m,B){if(y)return p[y.toLowerCase()][B];var C=r.sortBy(r.map(p,B));return(C[1]+C[2])/2})}function f(p){var y=t.buildLayerMatrix(p),m=r.merge(n(p,y),i(p,y)),B={},C;r.forEach(["u","d"],function(F){C=F==="u"?y:r.values(y).reverse(),r.forEach(["l","r"],function(T){T==="r"&&(C=r.map(C,function(L){return r.values(L).reverse()}));var O=(F==="u"?p.predecessors:p.successors).bind(p),_=A(p,C,m,O),k=l(p,C,_.root,_.align,T==="r");T==="r"&&(k=r.mapValues(k,function(L){return-L})),B[F+T]=k})});var S=u(p,B);return h(B,S),d(B,p.graph().align)}function g(p,y,m){return function(B,C,S){var F=B.node(C),T=B.node(S),O=0,_;if(O+=F.width/2,r.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":_=-F.width/2;break;case"r":_=F.width/2;break}if(_&&(O+=m?_:-_),_=0,O+=(F.dummy?y:p)/2,O+=(T.dummy?y:p)/2,O+=T.width/2,r.has(T,"labelpos"))switch(T.labelpos.toLowerCase()){case"l":_=T.width/2;break;case"r":_=-T.width/2;break}return _&&(O+=m?_:-_),_=0,O}}function v(p,y){return p.node(y).width}return Gm}var Km,DM;function FJ(){if(DM)return Km;DM=1;var r=jt(),e=Sr(),t=SJ().positionX;Km=n;function n(a){a=e.asNonCompoundGraph(a),i(a),r.forEach(t(a),function(s,o){a.node(o).x=s})}function i(a){var s=e.buildLayerMatrix(a),o=a.graph().ranksep,A=0;r.forEach(s,function(l){var c=r.max(r.map(l,function(u){return a.node(u).height}));r.forEach(l,function(u){a.node(u).y=A+c/2}),A+=c+o})}return Km}var zm,HM;function TJ(){if(HM)return zm;HM=1;var r=jt(),e=lJ(),t=cJ(),n=hJ(),i=Sr().normalizeRanks,a=dJ(),s=Sr().removeEmptyRanks,o=fJ(),A=gJ(),l=vJ(),c=CJ(),u=FJ(),h=Sr(),d=bi().Graph;zm=f;function f($,z){var ee=z&&z.debugTiming?h.time:h.notime;ee("layout",function(){var Ae=ee(" buildLayoutGraph",function(){return O($)});ee(" runLayout",function(){g(Ae,ee)}),ee(" updateInputGraph",function(){v($,Ae)})})}function g($,z){z(" makeSpaceForEdgeLabels",function(){_($)}),z(" removeSelfEdges",function(){X($)}),z(" acyclic",function(){e.run($)}),z(" nestingGraph.run",function(){o.run($)}),z(" rank",function(){n(h.asNonCompoundGraph($))}),z(" injectEdgeLabelProxies",function(){k($)}),z(" removeEmptyRanks",function(){s($)}),z(" nestingGraph.cleanup",function(){o.cleanup($)}),z(" normalizeRanks",function(){i($)}),z(" assignRankMinMax",function(){L($)}),z(" removeEdgeLabelProxies",function(){U($)}),z(" normalize.run",function(){t.run($)}),z(" parentDummyChains",function(){a($)}),z(" addBorderSegments",function(){A($)}),z(" order",function(){c($)}),z(" insertSelfEdges",function(){te($)}),z(" adjustCoordinateSystem",function(){l.adjust($)}),z(" position",function(){u($)}),z(" positionSelfEdges",function(){ie($)}),z(" removeBorderNodes",function(){D($)}),z(" normalize.undo",function(){t.undo($)}),z(" fixupEdgeLabelCoords",function(){V($)}),z(" undoCoordinateSystem",function(){l.undo($)}),z(" translateGraph",function(){G($)}),z(" assignNodeIntersects",function(){W($)}),z(" reversePoints",function(){K($)}),z(" acyclic.undo",function(){e.undo($)})}function v($,z){r.forEach($.nodes(),function(ee){var Ae=$.node(ee),be=z.node(ee);Ae&&(Ae.x=be.x,Ae.y=be.y,z.children(ee).length&&(Ae.width=be.width,Ae.height=be.height))}),r.forEach($.edges(),function(ee){var Ae=$.edge(ee),be=z.edge(ee);Ae.points=be.points,r.has(be,"x")&&(Ae.x=be.x,Ae.y=be.y)}),$.graph().width=z.graph().width,$.graph().height=z.graph().height}var p=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},m=["acyclicer","ranker","rankdir","align"],B=["width","height"],C={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],F={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function O($){var z=new d({multigraph:!0,compound:!0}),ee=xe($.graph());return z.setGraph(r.merge({},y,re(ee,p),r.pick(ee,m))),r.forEach($.nodes(),function(Ae){var be=xe($.node(Ae));z.setNode(Ae,r.defaults(re(be,B),C)),z.setParent(Ae,$.parent(Ae))}),r.forEach($.edges(),function(Ae){var be=xe($.edge(Ae));z.setEdge(Ae,r.merge({},F,re(be,S),r.pick(be,T)))}),z}function _($){var z=$.graph();z.ranksep/=2,r.forEach($.edges(),function(ee){var Ae=$.edge(ee);Ae.minlen*=2,Ae.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?Ae.width+=Ae.labeloffset:Ae.height+=Ae.labeloffset)})}function k($){r.forEach($.edges(),function(z){var ee=$.edge(z);if(ee.width&&ee.height){var Ae=$.node(z.v),be=$.node(z.w),Le={rank:(be.rank-Ae.rank)/2+Ae.rank,e:z};h.addDummyNode($,"edge-proxy",Le,"_ep")}})}function L($){var z=0;r.forEach($.nodes(),function(ee){var Ae=$.node(ee);Ae.borderTop&&(Ae.minRank=$.node(Ae.borderTop).rank,Ae.maxRank=$.node(Ae.borderBottom).rank,z=r.max(z,Ae.maxRank))}),$.graph().maxRank=z}function U($){r.forEach($.nodes(),function(z){var ee=$.node(z);ee.dummy==="edge-proxy"&&($.edge(ee.e).labelRank=ee.rank,$.removeNode(z))})}function G($){var z=Number.POSITIVE_INFINITY,ee=0,Ae=Number.POSITIVE_INFINITY,be=0,Le=$.graph(),Ue=Le.marginx||0,at=Le.marginy||0;function lt(ct){var pt=ct.x,Ne=ct.y,ht=ct.width,nt=ct.height;z=Math.min(z,pt-ht/2),ee=Math.max(ee,pt+ht/2),Ae=Math.min(Ae,Ne-nt/2),be=Math.max(be,Ne+nt/2)}r.forEach($.nodes(),function(ct){lt($.node(ct))}),r.forEach($.edges(),function(ct){var pt=$.edge(ct);r.has(pt,"x")&<(pt)}),z-=Ue,Ae-=at,r.forEach($.nodes(),function(ct){var pt=$.node(ct);pt.x-=z,pt.y-=Ae}),r.forEach($.edges(),function(ct){var pt=$.edge(ct);r.forEach(pt.points,function(Ne){Ne.x-=z,Ne.y-=Ae}),r.has(pt,"x")&&(pt.x-=z),r.has(pt,"y")&&(pt.y-=Ae)}),Le.width=ee-z+Ue,Le.height=be-Ae+at}function W($){r.forEach($.edges(),function(z){var ee=$.edge(z),Ae=$.node(z.v),be=$.node(z.w),Le,Ue;ee.points?(Le=ee.points[0],Ue=ee.points[ee.points.length-1]):(ee.points=[],Le=be,Ue=Ae),ee.points.unshift(h.intersectRect(Ae,Le)),ee.points.push(h.intersectRect(be,Ue))})}function V($){r.forEach($.edges(),function(z){var ee=$.edge(z);if(r.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function K($){r.forEach($.edges(),function(z){var ee=$.edge(z);ee.reversed&&ee.points.reverse()})}function D($){r.forEach($.nodes(),function(z){if($.children(z).length){var ee=$.node(z),Ae=$.node(ee.borderTop),be=$.node(ee.borderBottom),Le=$.node(r.last(ee.borderLeft)),Ue=$.node(r.last(ee.borderRight));ee.width=Math.abs(Ue.x-Le.x),ee.height=Math.abs(be.y-Ae.y),ee.x=Le.x+ee.width/2,ee.y=Ae.y+ee.height/2}}),r.forEach($.nodes(),function(z){$.node(z).dummy==="border"&&$.removeNode(z)})}function X($){r.forEach($.edges(),function(z){if(z.v===z.w){var ee=$.node(z.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:z,label:$.edge(z)}),$.removeEdge(z)}})}function te($){var z=h.buildLayerMatrix($);r.forEach(z,function(ee){var Ae=0;r.forEach(ee,function(be,Le){var Ue=$.node(be);Ue.order=Le+Ae,r.forEach(Ue.selfEdges,function(at){h.addDummyNode($,"selfedge",{width:at.label.width,height:at.label.height,rank:Ue.rank,order:Le+ ++Ae,e:at.e,label:at.label},"_se")}),delete Ue.selfEdges})})}function ie($){r.forEach($.nodes(),function(z){var ee=$.node(z);if(ee.dummy==="selfedge"){var Ae=$.node(ee.e.v),be=Ae.x+Ae.width/2,Le=Ae.y,Ue=ee.x-be,at=Ae.height/2;$.setEdge(ee.e,ee.label),$.removeNode(z),ee.label.points=[{x:be+2*Ue/3,y:Le-at},{x:be+5*Ue/6,y:Le-at},{x:be+Ue,y:Le},{x:be+5*Ue/6,y:Le+at},{x:be+2*Ue/3,y:Le+at}],ee.label.x=ee.x,ee.label.y=ee.y}})}function re($,z){return r.mapValues(r.pick($,z),Number)}function xe($){var z={};return r.forEach($,function(ee,Ae){z[Ae.toLowerCase()]=ee}),z}return zm}var Vm,GM;function MJ(){if(GM)return Vm;GM=1;var r=jt(),e=Sr(),t=bi().Graph;Vm={debugOrdering:n};function n(i){var a=e.buildLayerMatrix(i),s=new t({compound:!0,multigraph:!0}).setGraph({});return r.forEach(i.nodes(),function(o){s.setNode(o,{label:o}),s.setParent(o,"layer"+i.node(o).rank)}),r.forEach(i.edges(),function(o){s.setEdge(o.v,o.w,{},o.name)}),r.forEach(a,function(o,A){var l="layer"+A;s.setNode(l,{rank:"same"}),r.reduce(o,function(c,u){return s.setEdge(c,u,{style:"invis"}),u})}),s}return Vm}var jm,KM;function OJ(){return KM||(KM=1,jm="0.8.5"),jm}var Wm,zM;function _J(){return zM||(zM=1,Wm={graphlib:bi(),layout:TJ(),debug:MJ(),util:{time:Sr().time,notime:Sr().notime},version:OJ()}),Wm}var SN=_J();const IJ=Qh(SN);class zd{constructor(e){this.id="dagre",this.options={},Object.assign(this.options,zd.defaultOptions,e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,e,Object.assign(Object.assign({},this.options),t))})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,e,Object.assign(Object.assign({},this.options),t))})}genericDagreLayout(e,t,n){return Je(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new SN.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=t.getAllNodes(),o=t.getAllEdges();[...s,...o].some(({id:l})=>Be(l))&&console.error("Dagre layout only support string id, it will convert number to string."),t.getAllNodes().forEach(l=>{const{id:c}=l,u=Object.assign({},l.data);if(i!==void 0){const[h,d]=zl(Te(i)?i(l):i);Object.assign(u,{width:h,height:d})}a.setNode(c.toString(),u)}),t.getAllEdges().forEach(({id:l,source:c,target:u})=>{a.setEdge(c.toString(),u.toString(),{id:l})}),IJ.layout(a);const A={nodes:[],edges:[]};return a.nodes().forEach(l=>{const c=a.node(l);A.nodes.push({id:l,data:c}),e&&t.mergeNodeData(l,c)}),a.edges().forEach(l=>{const c=a.edge(l),{id:u}=c,h=Dt(c,["id"]),{v:d,w:f}=l;A.edges.push({id:u,source:d,target:f,data:h}),e&&t.mergeEdgeData(u,h)}),A})}}zd.defaultOptions={};class JB{constructor(e){this.id=e.id||0,this.rx=e.rx,this.ry=e.ry,this.fx=0,this.fy=0,this.mass=e.mass,this.degree=e.degree,this.g=e.g||0}distanceTo(e){const t=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(t,n)}setPos(e,t){this.rx=e,this.ry=t}resetForce(){this.fx=0,this.fy=0}addForce(e){const t=e.rx-this.rx,n=e.ry-this.ry;let i=Math.hypot(t,n);i=i<1e-4?1e-4:i;const a=this.g*(this.degree+1)*(e.degree+1)/i;this.fx+=a*t/i,this.fy+=a*n/i}in(e){return e.contains(this.rx,this.ry)}add(e){const t=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/t,i=(this.ry*this.mass+e.ry*e.mass)/t,a=this.degree+e.degree,s={rx:n,ry:i,mass:t,degree:a};return new JB(s)}}class _o{constructor(e){this.xmid=e.xmid,this.ymid=e.ymid,this.length=e.length,this.massCenter=e.massCenter||[0,0],this.mass=e.mass||1}getLength(){return this.length}contains(e,t){const n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&t<=this.ymid+n&&t>=this.ymid-n}NW(){const e=this.xmid-this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}NE(){const e=this.xmid+this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}SW(){const e=this.xmid-this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}SE(){const e=this.xmid+this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n};return new _o(i)}}class Io{constructor(e){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,e!=null&&(this.quad=e)}insert(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new Io(this.quad.NW()),this.NE=new Io(this.quad.NE()),this.SW=new Io(this.quad.SW()),this.SE=new Io(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e))}_putBody(e){this.quad&&(e.in(this.quad.NW())&&this.NW?this.NW.insert(e):e.in(this.quad.NE())&&this.NE?this.NE.insert(e):e.in(this.quad.SW())&&this.SW?this.SW.insert(e):e.in(this.quad.SE())&&this.SE&&this.SE.insert(e))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{const t=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);t/n<this.theta?e.addForce(this.body):(this.NW&&this.NW.updateForce(e),this.NE&&this.NE.updateForce(e),this.SW&&this.SW.updateForce(e),this.SE&&this.SE.updateForce(e))}}}const kJ={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class LJ{constructor(e={}){this.options=e,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},kJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,e,t)})}genericForceAtlas2Layout(e,t,n){return Je(this,void 0,void 0,function*(){const i=t.getAllEdges(),a=t.getAllNodes(),s=this.formatOptions(n,a.length),{width:o,height:A,prune:l,maxIteration:c,nodeSize:u,center:h}=s;if(!(a!=null&&a.length)||a.length===1)return to(t,e,h);const d=a.map(p=>Dr(p,[o,A])),f=i.filter(p=>{const{source:y,target:m}=p;return y!==m}),g=new Mn({nodes:d,edges:f}),v=this.getSizes(g,u);if(this.run(g,t,c,v,e,s),l){for(let y=0;y<f.length;y+=1){const{source:m,target:B}=f[y],C=g.getDegree(m),S=g.getDegree(m);if(C<=1){const F=g.getNode(B);g.mergeNodeData(m,{x:F.data.x,y:F.data.y})}else if(S<=1){const F=g.getNode(m);g.mergeNodeData(B,{x:F.data.x,y:F.data.y})}}const p=Object.assign(Object.assign({},s),{prune:!1,barnesHut:!1});this.run(g,t,100,v,e,p)}return{nodes:d,edges:i}})}getSizes(e,t){const n=e.getAllNodes(),i={};for(let a=0;a<n.length;a+=1){const s=n[a];i[s.id]=kB(t,void 0)(s)}return i}formatOptions(e={},t){const n=Object.assign(Object.assign({},this.options),e),{center:i,width:a,height:s,barnesHut:o,prune:A,maxIteration:l,kr:c,kg:u}=n;return n.width=!a&&typeof window<"u"?window.innerWidth:a,n.height=!s&&typeof window<"u"?window.innerHeight:s,n.center=i||[n.width/2,n.height/2],o===void 0&&t>250&&(n.barnesHut=!0),A===void 0&&t>100&&(n.prune=!0),l===0&&!A?(n.maxIteration=250,t<=200&&t>100?n.maxIteration=1e3:t>200&&(n.maxIteration=1200)):l===0&&A&&(n.maxIteration=100,t<=200&&t>100?n.maxIteration=500:t>200&&(n.maxIteration=950)),c||(n.kr=50,t>100&&t<=500?n.kr=20:t>500&&(n.kr=1)),u||(n.kg=20,t>100&&t<=500?n.kg=10:t>500&&(n.kg=1)),n}run(e,t,n,i,a,s){const{kr:o,barnesHut:A,onTick:l}=s,c=e.getAllNodes();let u=0,h=n;const d={},f={},g={};for(let v=0;v<c.length;v+=1){const{data:p,id:y}=c[v];if(d[y]=[0,0],A){const m={id:v,rx:p.x,ry:p.y,mass:1,g:o,degree:e.getDegree(y)};g[y]=new JB(m)}}for(;h>0;)u=this.oneStep(e,{iter:h,preventOverlapIters:50,krPrime:100,sg:u,forces:d,preForces:f,bodies:g,sizes:i},s),h--,l==null||l({nodes:c,edges:t.getAllEdges()});return e}oneStep(e,t,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:A,bodies:l,sizes:c}=t;let{forces:u}=t;const{preventOverlap:h,barnesHut:d}=n,f=e.getAllNodes();for(let g=0;g<f.length;g+=1){const{id:v}=f[g];A[v]=[...u[v]],u[v]=[0,0]}return u=this.getAttrForces(e,i,a,c,u,n),d&&(h&&i>a||!h)?u=this.getOptRepGraForces(e,u,l,n):u=this.getRepGraForces(e,i,a,u,s,c,n),this.updatePos(e,u,A,o,n)}getAttrForces(e,t,n,i,a,s){const{preventOverlap:o,dissuadeHubs:A,mode:l,prune:c}=s,u=e.getAllEdges();for(let h=0;h<u.length;h+=1){const{source:d,target:f}=u[h],g=e.getNode(d),v=e.getNode(f),p=e.getDegree(d),y=e.getDegree(f);if(c&&(p<=1||y<=1))continue;const m=[v.data.x-g.data.x,v.data.y-g.data.y];let B=Math.hypot(m[0],m[1]);B=B<1e-4?1e-4:B,m[0]=m[0]/B,m[1]=m[1]/B,o&&t<n&&(B=B-i[d]-i[f]);let C=B,S=C;l==="linlog"&&(C=Math.log(1+B),S=C),A&&(C=B/p,S=B/y),o&&t<n&&B<=0?(C=0,S=0):o&&t<n&&B>0&&(C=B,S=B),a[d][0]+=C*m[0],a[f][0]-=S*m[0],a[d][1]+=C*m[1],a[f][1]-=S*m[1]}return a}getOptRepGraForces(e,t,n,i){const{kg:a,center:s,prune:o}=i,A=e.getAllNodes(),l=A.length;let c=9e10,u=-9e10,h=9e10,d=-9e10;for(let y=0;y<l;y+=1){const{id:m,data:B}=A[y];o&&e.getDegree(m)<=1||(n[m].setPos(B.x,B.y),B.x>=u&&(u=B.x),B.x<=c&&(c=B.x),B.y>=d&&(d=B.y),B.y<=h&&(h=B.y))}const f=Math.max(u-c,d-h),g={xmid:(u+c)/2,ymid:(d+h)/2,length:f,massCenter:s,mass:l},v=new _o(g),p=new Io(v);for(let y=0;y<l;y+=1){const{id:m}=A[y];o&&e.getDegree(m)<=1||n[m].in(v)&&p.insert(n[m])}for(let y=0;y<l;y+=1){const{id:m,data:B}=A[y],C=e.getDegree(m);if(o&&C<=1)continue;n[m].resetForce(),p.updateForce(n[m]),t[m][0]-=n[m].fx,t[m][1]-=n[m].fy;const S=[B.x-s[0],B.y-s[1]];let F=Math.hypot(S[0],S[1]);F=F<1e-4?1e-4:F,S[0]=S[0]/F,S[1]=S[1]/F;const T=a*(C+1);t[m][0]-=T*S[0],t[m][1]-=T*S[1]}return t}getRepGraForces(e,t,n,i,a,s,o){const{preventOverlap:A,kr:l,kg:c,center:u,prune:h}=o,d=e.getAllNodes(),f=d.length;for(let g=0;g<f;g+=1){const v=d[g],p=e.getDegree(v.id);for(let C=g+1;C<f;C+=1){const S=d[C],F=e.getDegree(S.id);if(h&&(p<=1||F<=1))continue;const T=[S.data.x-v.data.x,S.data.y-v.data.y];let O=Math.hypot(T[0],T[1]);O=O<1e-4?1e-4:O,T[0]=T[0]/O,T[1]=T[1]/O,A&&t<n&&(O=O-s[v.id]-s[S.id]);let _=l*(p+1)*(F+1)/O;A&&t<n&&O<0?_=a*(p+1)*(F+1):A&&t<n&&O===0?_=0:A&&t<n&&O>0&&(_=l*(p+1)*(F+1)/O),i[v.id][0]-=_*T[0],i[S.id][0]+=_*T[0],i[v.id][1]-=_*T[1],i[S.id][1]+=_*T[1]}const y=[v.data.x-u[0],v.data.y-u[1]],m=Math.hypot(y[0],y[1]);y[0]=y[0]/m,y[1]=y[1]/m;const B=c*(p+1);i[v.id][0]-=B*y[0],i[v.id][1]-=B*y[1]}return i}updatePos(e,t,n,i,a){const{ks:s,tao:o,prune:A,ksmax:l}=a,c=e.getAllNodes(),u=c.length,h=[],d=[];let f=0,g=0,v=i;for(let y=0;y<u;y+=1){const{id:m}=c[y],B=e.getDegree(m);if(A&&B<=1)continue;const C=[t[m][0]-n[m][0],t[m][1]-n[m][1]],S=Math.hypot(C[0],C[1]),F=[t[m][0]+n[m][0],t[m][1]+n[m][1]],T=Math.hypot(F[0],F[1]);h[y]=S,d[y]=T/2,f+=(B+1)*h[y],g+=(B+1)*d[y]}const p=v;v=o*g/f,p!==0&&(v=v>1.5*p?1.5*p:v);for(let y=0;y<u;y+=1){const{id:m,data:B}=c[y],C=e.getDegree(m);if(A&&C<=1||Be(B.fx)&&Be(B.fy))continue;let S=s*v/(1+v*Math.sqrt(h[y])),F=Math.hypot(t[m][0],t[m][1]);F=F<1e-4?1e-4:F;const T=l/F;S=S>T?T:S;const O=S*t[m][0],_=S*t[m][1];e.mergeNodeData(m,{x:B.x+O,y:B.y+_})}return v}}const QJ={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},NJ=800;class UJ{constructor(e={}){this.options=e,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},QJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,e,t)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(e=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;n<e;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const t={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&t.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),t}genericFruchtermanLayout(e,t,n){return Je(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:A,clustering:l,nodeClusterBy:c,maxIteration:u,onTick:h}=i,d=t.getAllNodes(),f=t.getAllEdges();if(!(d!=null&&d.length)){const m={nodes:[],edges:f};return this.lastResult=m,m}if(d.length===1){e&&t.mergeNodeData(d[0].id,{x:A[0],y:A[1],z:a===3?A[2]:void 0});const m={nodes:[Object.assign(Object.assign({},d[0]),{data:Object.assign(Object.assign({},d[0].data),{x:A[0],y:A[1],z:a===3?A[2]:void 0})})],edges:f};return this.lastResult=m,m}const g=d.map(m=>Dr(m,[s,o])),v=new Mn({nodes:g,edges:f}),p={};if(l&&g.forEach(m=>{const B=m.data[c];p[B]||(p[B]={name:B,cx:0,cy:0,count:0})}),this.lastLayoutNodes=g,this.lastLayoutEdges=f,this.lastAssign=e,this.lastGraph=v,this.lastOptions=i,this.lastClusterMap=p,typeof window>"u")return;let y=0;return new Promise(m=>{this.timeInterval=window.setInterval(()=>{if(!this.running){m({nodes:g,edges:f});return}this.runOneStep(v,p,i),e&&g.forEach(({id:B,data:C})=>t.mergeNodeData(B,{x:C.x,y:C.y,z:a===3?C.z:void 0})),h==null||h({nodes:g,edges:f}),y++,y>=u&&(window.clearInterval(this.timeInterval),m({nodes:g,edges:f}))},0),this.running=!0})})}formatOptions(e={}){const t=Object.assign(Object.assign({},this.options),e),{clustering:n,nodeClusterBy:i}=t,{center:a,width:s,height:o}=t;return t.width=!s&&typeof window<"u"?window.innerWidth:s,t.height=!o&&typeof window<"u"?window.innerHeight:o,t.center=a||[t.width/2,t.height/2],t.clustering=n&&!!i,t}runOneStep(e,t,n){const{dimensions:i,height:a,width:s,gravity:o,center:A,speed:l,clustering:c,nodeClusterBy:u,clusterGravity:h}=n,d=a*s,f=Math.sqrt(d)/10,g=e.getAllNodes(),v=d/(g.length+1),p=Math.sqrt(v),y={};if(this.applyCalculate(e,y,p,v),c){for(const B in t)t[B].cx=0,t[B].cy=0,t[B].count=0;g.forEach(B=>{const{data:C}=B,S=t[C[u]];Be(C.x)&&(S.cx+=C.x),Be(C.y)&&(S.cy+=C.y),S.count++});for(const B in t)t[B].cx/=t[B].count,t[B].cy/=t[B].count;const m=h||o;g.forEach((B,C)=>{const{id:S,data:F}=B;if(!Be(F.x)||!Be(F.y))return;const T=t[F[u]],O=Math.sqrt((F.x-T.cx)*(F.x-T.cx)+(F.y-T.cy)*(F.y-T.cy)),_=p*m;y[S].x-=_*(F.x-T.cx)/O,y[S].y-=_*(F.y-T.cy)/O})}g.forEach((m,B)=>{const{id:C,data:S}=m;if(!Be(S.x)||!Be(S.y))return;const F=.01*p*o;y[C].x-=F*(S.x-A[0]),y[C].y-=F*(S.y-A[1]),i===3&&(y[C].z-=F*(S.z-A[2]))}),g.forEach((m,B)=>{const{id:C,data:S}=m;if(Be(S.fx)&&Be(S.fy)){S.x=S.fx,S.y=S.fy,i===3&&(S.z=S.fz);return}if(!Be(S.x)||!Be(S.y))return;const F=Math.sqrt(y[C].x*y[C].x+y[C].y*y[C].y+(i===3?y[C].z*y[C].z:0));if(F>0){const T=Math.min(f*(l/NJ),F);e.mergeNodeData(C,{x:S.x+y[C].x/F*T,y:S.y+y[C].y/F*T,z:i===3?S.z+y[C].z/F*T:void 0})}})}applyCalculate(e,t,n,i){this.calRepulsive(e,t,i),this.calAttractive(e,t,n)}calRepulsive(e,t,n){const i=e.getAllNodes();i.forEach(({data:a,id:s},o)=>{t[s]={x:0,y:0,z:0},i.forEach(({data:A,id:l},c)=>{if(o<=c||!Be(a.x)||!Be(A.x)||!Be(a.y)||!Be(A.y))return;let u=a.x-A.x,h=a.y-A.y,d=this.options.dimensions===3?a.z-A.z:0,f=u*u+h*h+d*d;f===0&&(f=1,u=.01,h=.01,d=.01);const g=n/f,v=u*g,p=h*g,y=d*g;t[s].x+=v,t[s].y+=p,t[l].x-=v,t[l].y-=p,this.options.dimensions===3&&(t[s].z+=y,t[l].z-=y)})})}calAttractive(e,t,n){e.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:A}=e.getNode(s),{data:l}=e.getNode(o);if(!Be(l.x)||!Be(A.x)||!Be(l.y)||!Be(A.y))return;const c=l.x-A.x,u=l.y-A.y,h=this.options.dimensions===3?l.z-A.z:0,d=Math.sqrt(c*c+u*u+h*h)/n,f=c*d,g=u*d,v=h*d;t[s].x+=f,t[s].y+=g,t[o].x-=f,t[o].y-=g,this.options.dimensions===3&&(t[s].z+=v,t[o].z-=v)})}}const PJ={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class RJ{constructor(e={}){this.options=e,this.id="grid",this.options=Object.assign(Object.assign({},PJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericGridLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,e,t)})}genericGridLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:A,rows:l,cols:c,nodeSpacing:u,nodeSize:h,width:d,height:f,position:g}=i;let{sortBy:v}=i;const p=t.getAllNodes(),y=t.getAllEdges(),m=p==null?void 0:p.length;if(!m||m===1)return to(t,e,a);const B=p.map(W=>Dr(W));v!=="id"&&(!At(v)||B[0].data[v]===void 0)&&(v="degree"),v==="degree"?B.sort((W,V)=>t.getDegree(V.id,"both")-t.getDegree(W.id,"both")):v==="id"?B.sort((W,V)=>Be(V.id)&&Be(W.id)?V.id-W.id:`${W.id}`.localeCompare(`${V.id}`)):B.sort((W,V)=>V.data[v]-W.data[v]);const C=!d&&typeof window<"u"?window.innerWidth:d,S=!f&&typeof window<"u"?window.innerHeight:f,F=m,T={rows:l,cols:c};if(l!=null&&c!=null)T.rows=l,T.cols=c;else if(l!=null&&c==null)T.rows=l,T.cols=Math.ceil(F/T.rows);else if(l==null&&c!=null)T.cols=c,T.rows=Math.ceil(F/T.cols);else{const W=Math.sqrt(F*S/C);T.rows=Math.round(W),T.cols=Math.round(C/S*W)}if(T.rows=Math.max(T.rows,1),T.cols=Math.max(T.cols,1),T.cols*T.rows>F){const W=du(T),V=fu(T);(W-1)*V>=F?du(T,W-1):(V-1)*W>=F&&fu(T,V-1)}else for(;T.cols*T.rows<F;){const W=du(T),V=fu(T);(V+1)*W>=F?fu(T,V+1):du(T,W+1)}let O=s?0:C/T.cols,_=s?0:S/T.rows;if(A||u){const W=Us(10,u),V=IB(30,h,!1);B.forEach(K=>{(!K.data.x||!K.data.y)&&(K.data.x=0,K.data.y=0);const D=t.getNode(K.id),[X,te]=zl(V(D)||30),ie=W!==void 0?W(K):o,re=X+ie,xe=te+ie;O=Math.max(O,re),_=Math.max(_,xe)})}const k={},L={row:0,col:0},U={};for(let W=0;W<B.length;W++){const V=B[W];let K;if(g&&(K=g(t.getNode(V.id))),K&&(K.row!==void 0||K.col!==void 0)){const D={row:K.row,col:K.col};if(D.col===void 0)for(D.col=0;x1(k,D);)D.col++;else if(D.row===void 0)for(D.row=0;x1(k,D);)D.row++;U[V.id]=D,FN(k,D)}DJ(V,a,O,_,U,T,L,k)}const G={nodes:B,edges:y};return e&&B.forEach(W=>{t.mergeNodeData(W.id,{x:W.data.x,y:W.data.y})}),G})}}const du=(r,e)=>{let t;const n=r.rows||5,i=r.cols||5;return e==null?t=Math.min(n,i):Math.min(n,i)===r.rows?r.rows=e:r.cols=e,t},fu=(r,e)=>{let t;const n=r.rows||5,i=r.cols||5;return e==null?t=Math.max(n,i):Math.max(n,i)===r.rows?r.rows=e:r.cols=e,t},x1=(r,e)=>r[`c-${e.row}-${e.col}`]||!1,FN=(r,e)=>r[`c-${e.row}-${e.col}`]=!0,VM=(r,e)=>{const t=r.cols||5;e.col++,e.col>=t&&(e.col=0,e.row++)},DJ=(r,e,t,n,i,a,s,o)=>{let A,l;const c=i[r.id];if(c)A=c.col*t+t/2+e[0],l=c.row*n+n/2+e[1];else{for(;x1(o,s);)VM(a,s);A=s.col*t+t/2+e[0],l=s.row*n+n/2+e[1],FN(o,s),VM(a,s)}r.data.x=A,r.data.y=l},HJ=(r,e,t)=>{try{const n=Ga.mul(Ga.pow(e,2),-.5),i=n.mean("row"),a=n.mean("column"),s=n.mean();n.add(s).subRowVector(i).subColumnVector(a);const o=new wQ(n),A=Ga.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(l=>Ga.mul([l],[A]).toJSON()[0].splice(0,r))}catch{const i=[];for(let a=0;a<e.length;a++){const s=Math.random()*t,o=Math.random()*t;i.push([s,o])}return i}},GJ=800,KJ={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},zJ=(r,e)=>{const t=Object.assign(Object.assign({},KJ),e),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:A,focusIdx:l,radii:c=[],nodeSizeFunc:u}=t,h=r.getAllNodes(),d=[],f=a/10;for(let g=0;g<i;g++)n.forEach((v,p)=>{d[p]={x:0,y:0}}),VJ(h,n,d,s,c,u),jJ(n,d,o,A,l,f,a,c);return n},VJ=(r,e,t,n,i,a)=>{e.forEach((s,o)=>{t[o]={x:0,y:0},e.forEach((A,l)=>{if(o===l||i[o]!==i[l])return;let c=s.x-A.x,u=s.y-A.y,h=Math.sqrt(c*c+u*u);if(h===0){h=1;const d=o>l?1:-1;c=.01*d,u=.01*d}if(h<a(r[o])/2+a(r[l])/2){const d=n*n/h;t[o].x+=c/h*d,t[o].y+=u/h*d}})})},jJ=(r,e,t,n,i,a,s,o)=>{const A=a||s/10;return n&&e.forEach((l,c)=>{const u=r[c].x-r[i].x,h=r[c].y-r[i].y,d=Math.sqrt(u*u+h*h);let f=h/d,g=-u/d;const v=Math.sqrt(l.x*l.x+l.y*l.y);let p=Math.acos((f*l.x+g*l.y)/v);p>Math.PI/2&&(p-=Math.PI/2,f*=-1,g*=-1);const y=Math.cos(p)*v;l.x=f*y,l.y=g*y}),r.forEach((l,c)=>{if(c===i)return;const u=Math.sqrt(e[c].x*e[c].x+e[c].y*e[c].y);if(u>0&&c!==i){const h=Math.min(A*(t/GJ),u);if(l.x+=e[c].x/u*h,l.y+=e[c].y/u*h,n){let d=l.x-r[i].x,f=l.y-r[i].y;const g=Math.sqrt(d*d+f*f);d=d/g*o[c],f=f/g*o[c],l.x=r[i].x+d,l.y=r[i].y+f}}}),r},WJ={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class qJ{constructor(e={}){this.options=e,this.id="radial",this.options=Object.assign(Object.assign({},WJ),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,e,t)})}genericRadialLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:A,unitRadius:l,nodeSize:c,nodeSpacing:u,strictRadial:h,preventOverlap:d,maxPreventOverlapIteration:f,sortBy:g,linkDistance:v=50,sortStrength:p=10,maxIteration:y=1e3}=i,m=t.getAllNodes(),B=t.getAllEdges(),C=!a&&typeof window<"u"?window.innerWidth:a,S=!s&&typeof window<"u"?window.innerHeight:s,F=o||[C/2,S/2];if(!(m!=null&&m.length)||m.length===1)return to(t,e,F);let T=m[0];if(At(A)){for(let Ae=0;Ae<m.length;Ae++)if(m[Ae].id===A){T=m[Ae];break}}else T=A||m[0];const O=XJ(m,T.id),_=gQ({nodes:m,edges:B}),k=fQ(_),L=JJ(k,O);ZJ(k,O,L+1);const U=k[O];let G=C-F[0]>F[0]?F[0]:C-F[0],W=S-F[1]>F[1]?F[1]:S-F[1];G===0&&(G=C/2),W===0&&(W=S/2);const V=Math.min(G,W),K=Math.max(...U),D=[],X=l||V/K;U.forEach((Ae,be)=>{D[be]=Ae*X});const te=$J(m,k,v,D,X,g,p),ie=YJ(te),re=HJ(v,te,v);let xe=re.map(([Ae,be])=>({x:(isNaN(Ae)?Math.random()*v:Ae)-re[O][0],y:(isNaN(be)?Math.random()*v:be)-re[O][1]}));this.run(y,xe,ie,te,D,O);let $;if(d){$=kB(c,u);const Ae={nodes:m,nodeSizeFunc:$,positions:xe,radii:D,height:S,width:C,strictRadial:!!h,focusIdx:O,iterations:f||200,k:xe.length/4.5};xe=zJ(t,Ae)}const z=[];return xe.forEach((Ae,be)=>{const Le=Dr(m[be]);Le.data.x=Ae.x+F[0],Le.data.y=Ae.y+F[1],z.push(Le)}),e&&z.forEach(Ae=>t.mergeNodeData(Ae.id,{x:Ae.data.x,y:Ae.data.y})),{nodes:z,edges:B}})}run(e,t,n,i,a,s){for(let o=0;o<=e;o++){const A=o/e;this.oneIteration(A,t,a,i,n,s)}}oneIteration(e,t,n,i,a,s){const o=1-e;t.forEach((A,l)=>{const c=uC(A,{x:0,y:0}),u=c===0?0:1/c;if(l===s)return;let h=0,d=0,f=0;t.forEach((v,p)=>{if(l===p)return;const y=uC(A,v),m=y===0?0:1/y,B=i[p][l];f+=a[l][p],h+=a[l][p]*(v.x+B*(A.x-v.x)*m),d+=a[l][p]*(v.y+B*(A.y-v.y)*m)});const g=n[l]===0?0:1/n[l];f*=o,f+=e*g*g,h*=o,h+=e*g*A.x*u,A.x=h/f,d*=o,d+=e*g*A.y*u,A.y=d/f})}}const $J=(r,e,t,n,i,a,s)=>{if(!r)return[];const o=[];if(e){const A={};e.forEach((l,c)=>{const u=[];l.forEach((h,d)=>{var f,g;if(c===d)u.push(0);else if(n[c]===n[d])if(a==="data")u.push(h*(Math.abs(c-d)*s)/(n[c]/i));else if(a){let v,p;if(A[r[c].id])v=A[r[c].id];else{const y=(a==="id"?r[c].id:(f=r[c].data)===null||f===void 0?void 0:f[a])||0;At(y)?v=y.charCodeAt(0):v=y,A[r[c].id]=v}if(A[r[d].id])p=A[r[d].id];else{const y=(a==="id"?r[d].id:(g=r[d].data)===null||g===void 0?void 0:g[a])||0;At(y)?p=y.charCodeAt(0):p=y,A[r[d].id]=p}u.push(h*(Math.abs(v-p)*s)/(n[c]/i))}else u.push(h*t/(n[c]/i));else{const v=(t+i)/2;u.push(h*v)}}),o.push(u)})}return o},YJ=r=>{const e=r.length,t=r[0].length,n=[];for(let i=0;i<e;i++){const a=[];for(let s=0;s<t;s++)r[i][s]!==0?a.push(1/(r[i][s]*r[i][s])):a.push(0);n.push(a)}return n},XJ=(r,e)=>{let t=-1;return r.forEach((n,i)=>{n.id===e&&(t=i)}),Math.max(t,0)},ZJ=(r,e,t)=>{const n=r.length;for(let i=0;i<n;i++)if(r[e][i]===1/0){r[e][i]=t,r[i][e]=t;for(let a=0;a<n;a++)r[i][a]!==1/0&&r[e][a]===1/0&&(r[e][a]=t+r[i][a],r[a][e]=t+r[i][a])}for(let i=0;i<n;i++)if(i!==e){for(let a=0;a<n;a++)if(r[i][a]===1/0){let s=Math.abs(r[e][i]-r[e][a]);s=s===0?1:s,r[i][a]=s}}},JJ=(r,e)=>{let t=0;for(let n=0;n<r[e].length;n++)r[e][n]!==1/0&&(t=r[e][n]>t?r[e][n]:t);return t},eee={center:[0,0],width:300,height:300};class tee{constructor(e={}){this.options=e,this.id="random",this.options=Object.assign(Object.assign({},eee),e)}execute(e,t){return Je(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,e,t)})}assign(e,t){return Je(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,e,t)})}genericRandomLayout(e,t,n){return Je(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,A=t.getAllNodes(),l=.9,c=!s&&typeof window<"u"?window.innerWidth:s,u=!o&&typeof window<"u"?window.innerHeight:o,h=a||[c/2,u/2],d=[];return A&&A.forEach(g=>{d.push({id:g.id,data:{x:(Math.random()-.5)*l*c+h[0],y:(Math.random()-.5)*l*u+h[1]}})}),e&&d.forEach(g=>t.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:t.getAllEdges()}})}}const TN=Symbol("Comlink.proxy"),nee=Symbol("Comlink.endpoint"),MN=Symbol("Comlink.releaseProxy"),qm=Symbol("Comlink.finalizer"),Qu=Symbol("Comlink.thrown"),ON=r=>typeof r=="object"&&r!==null||typeof r=="function",ree={canHandle:r=>ON(r)&&r[TN],serialize(r){const{port1:e,port2:t}=new MessageChannel;return IN(r,e),[t,[t]]},deserialize(r){return r.start(),LN(r)}},iee={canHandle:r=>ON(r)&&Qu in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},_N=new Map([["proxy",ree],["throw",iee]]);function aee(r,e){for(const t of r)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function IN(r,e=globalThis,t=["*"]){e.addEventListener("message",function n(i){if(!i||!i.data)return;if(!aee(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),A=(i.data.argumentList||[]).map(xs);let l;try{const c=o.slice(0,-1).reduce((h,d)=>h[d],r),u=o.reduce((h,d)=>h[d],r);switch(s){case"GET":l=u;break;case"SET":c[o.slice(-1)[0]]=xs(i.data.value),l=!0;break;case"APPLY":l=u.apply(c,A);break;case"CONSTRUCT":{const h=new u(...A);l=uee(h)}break;case"ENDPOINT":{const{port1:h,port2:d}=new MessageChannel;IN(r,d),l=cee(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(c){l={value:c,[Qu]:0}}Promise.resolve(l).catch(c=>({value:c,[Qu]:0})).then(c=>{const[u,h]=Mh(c);e.postMessage(Object.assign(Object.assign({},u),{id:a}),h),s==="RELEASE"&&(e.removeEventListener("message",n),kN(e),qm in r&&typeof r[qm]=="function"&&r[qm]())}).catch(c=>{const[u,h]=Mh({value:new TypeError("Unserializable return value"),[Qu]:0});e.postMessage(Object.assign(Object.assign({},u),{id:a}),h)})}),e.start&&e.start()}function see(r){return r.constructor.name==="MessagePort"}function kN(r){see(r)&&r.close()}function LN(r,e){const t=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=t.get(a.id);if(s)try{s(a)}finally{t.delete(a.id)}}),C1(r,t,[],e)}function gu(r){if(r)throw new Error("Proxy has been released and is not useable")}function QN(r){return To(r,new Map,{type:"RELEASE"}).then(()=>{kN(r)})}const Fh=new WeakMap,Th="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(Fh.get(r)||0)-1;Fh.set(r,e),e===0&&QN(r)});function oee(r,e){const t=(Fh.get(e)||0)+1;Fh.set(e,t),Th&&Th.register(r,e,r)}function Aee(r){Th&&Th.unregister(r)}function C1(r,e,t=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(gu(i),o===MN)return()=>{Aee(a),QN(r),e.clear(),i=!0};if(o==="then"){if(t.length===0)return{then:()=>a};const A=To(r,e,{type:"GET",path:t.map(l=>l.toString())}).then(xs);return A.then.bind(A)}return C1(r,e,[...t,o])},set(s,o,A){gu(i);const[l,c]=Mh(A);return To(r,e,{type:"SET",path:[...t,o].map(u=>u.toString()),value:l},c).then(xs)},apply(s,o,A){gu(i);const l=t[t.length-1];if(l===nee)return To(r,e,{type:"ENDPOINT"}).then(xs);if(l==="bind")return C1(r,e,t.slice(0,-1));const[c,u]=jM(A);return To(r,e,{type:"APPLY",path:t.map(h=>h.toString()),argumentList:c},u).then(xs)},construct(s,o){gu(i);const[A,l]=jM(o);return To(r,e,{type:"CONSTRUCT",path:t.map(c=>c.toString()),argumentList:A},l).then(xs)}});return oee(a,r),a}function lee(r){return Array.prototype.concat.apply([],r)}function jM(r){const e=r.map(Mh);return[e.map(t=>t[0]),lee(e.map(t=>t[1]))]}const NN=new WeakMap;function cee(r,e){return NN.set(r,e),r}function uee(r){return Object.assign(r,{[TN]:!0})}function Mh(r){for(const[e,t]of _N)if(t.canHandle(r)){const[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},NN.get(r)||[]]}function xs(r){switch(r.type){case"HANDLER":return _N.get(r.name).deserialize(r.value);case"RAW":return r.value}}function To(r,e,t,n){return new Promise(i=>{const a=hee();e.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},t),n)})}function hee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class dee extends gd{constructor(e,t,n){super(),this.graph=e,this.layout=t,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=LN(new Worker(new URL("https://registry.npmmirror.com/@gkd-kit/inspect/0.0.1768904025360/files/dist/assets/worker-NxeETyFs.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var e;return Je(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const t=this.layout.options,{onTick:n}=t,i=Dt(t,["onTick"]),a={};Object.keys(i).forEach(l=>{Te(i[l])||(a[l]=i[l])});const s={layout:{id:this.layout.id,options:a,iterations:(e=this.options)===null||e===void 0?void 0:e.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[A]=yield this.proxy.calculateLayout(s,[o]);return A})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[MN]()}isRunning(){return this.running}}var fee=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class Vd extends vd{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const e=this.context.model.getRootsData();if(!(Qi(e)||e.length>2))return e[0]}formatSize(e){const t=typeof e=="function"?e:()=>e;return n=>Gr(t(n))}doLayout(e,t){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=t,{model:A}=this.context,l=this.formatSize(s);let c=l(e)[0]+i(e);const u=(m,B=0)=>{var C;return B+=n*((m.children||[]).length+1),(C=m.children)===null||C===void 0||C.forEach(S=>{var F;(F=A.getNodeLikeDatum(S).children)===null||F===void 0||F.forEach(O=>{const _=A.getNodeLikeDatum(O);B=u(_,B)})}),B},h=m=>{if(m.depth===1)return c;const B=A.getParentData(m.id,"tree");if(yo(m)){const C=A.getParentData(B.id,"tree"),S=g(m)-g(C);return h(B)+S*n/a}else{const C=(B.children||[]).indexOf(m.id),S=A.getNodeData((B.children||[]).slice(C));return d(B)-S.reduce((F,T)=>F+u(T),0)-l(B)[0]/2}},d=mw(m=>{if($m(m))return l(m)[0]/2;const B=A.getParentData(m.id,"tree");if(yo(m))return h(m)+u(m)+l(m)[0]/2;{const C=g(m)-g(B),S=n/a;return h(m)+C*S}},m=>m.id),f=m=>g(A.getParentData(m,"tree")),g=mw(m=>{if($m(m))return o/2;if(yo(m)){const B=A.getParentData(m.id,"tree"),C=B.children.indexOf(m.id);if(C===0)return f(B.id)+a;const S=A.getNodeLikeDatum(B.children[C-1]);if(Qi(S.children))return g(S)+a;const F=A.getDescendantsData(S.id);return Math.max(...F.map(T=>yo(T)?f(T.id):g(T)))+a}else{if(Qi(m.children))return f(m.id)+a;const B=A.getNodeLikeDatum(m.children.slice(-1)[0]);if(Qi(B.children))return g(B)+a;const C=A.getDescendantsData(m.id).slice(-1)[0];return(yo(C)?f(C.id):g(C))+a}},m=>m.id);let v=0;const p={nodes:[],edges:[]},y=m=>{var B;(B=m.children)===null||B===void 0||B.forEach(O=>y(A.getNodeLikeDatum(O)));const C=g(m),S=d(m);if(p.nodes.push({id:m.id,x:S,y:C}),$m(m))return;const F=A.getRelatedEdgesData(m.id,"in")[0],T=[h(m),yo(m)?C:f(m.id)];p.edges.push({id:Z(F),controlPoints:[T],relatedNodeId:m.id}),v=Math.max(v,S+i(m)),m.depth===1&&(c=v)};return y(e),p}placeAlterative(e,t){const n=(t.children||[]).filter((o,A)=>A%2!==0);if(n.length===0)return e;const{model:i}=this.context,a=e.nodes.find(o=>o.id===t.id).y,s=o=>{const A=i.getAncestorsData(o,"tree");if(Qi(A))return!1;const l=A.length===1?o:A[A.length-2].id;return n.includes(l)};e.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),e.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(A=>[A[0],2*a-A[1]]))})}rightToLeft(e,t){return e.nodes.forEach(n=>n.x=t.width-n.x),e.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[t.width-i[0],i[1]])}),e}execute(e,t){return fee(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},Vd.defaultOptions),this.options),t),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return e;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(e.nodes||[]).map(h=>o(h)[1]))),n.hGap||(n.hGap=Math.max(...(e.nodes||[]).map(h=>o(h)[0])));let A=this.doLayout(s,n);this.placeAlterative(A,s),i==="RL"&&(A=this.rightToLeft(A,n));const{model:l}=this.context,c=[],u=[];return A.nodes.forEach(h=>{const{id:d,x:f,y:g}=h,v=l.getNodeLikeDatum(d);c.push(WM(v,{x:f,y:g}))}),A.edges.forEach(h=>{const{id:d,controlPoints:f}=h,g=l.getEdgeDatum(d);u.push(WM(g,{controlPoints:f}))}),{nodes:c,edges:u}})}}Vd.defaultOptions={direction:"RL",getRibSep:()=>60};const WM=(r,e)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),e)}),$m=r=>r.depth===0,yo=r=>(r.depth||(r.depth=0))%2===0;var gee=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class jd extends vd{constructor(){super(...arguments),this.id="snake"}formatSize(e,t){const n=typeof t=="function"?t:(()=>t);return e.reduce((i,a)=>{const[s,o]=Gr(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(e){const{nodes:t=[],edges:n=[]}=e,i={},a={},s={};t.forEach(h=>{i[h.id]=0,a[h.id]=0,s[h.id]=[]}),n.forEach(h=>{i[h.target]++,a[h.source]++,s[h.source].push(h.target)});const o=new Set,A=h=>{o.has(h)||(o.add(h),s[h].forEach(A))};if(A(t[0].id),o.size!==t.length)return!1;const l=t.filter(h=>i[h.id]===0),c=t.filter(h=>a[h.id]===0);return!(l.length!==1||c.length!==1||t.filter(h=>i[h.id]===1&&a[h.id]===1).length!==t.length-2)}execute(e,t){return gee(this,void 0,void 0,function*(){var n;if(!this.validate(e))return e;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:A,rowGap:l,clockwise:c,width:u,height:h}=Object.assign({},jd.defaultOptions,this.options,t),[d,f,g,v]=ai(a),p=this.formatSize(e.nodes||[],i),y=Math.ceil((e.nodes||[]).length/o);let m=A||(u-v-f-o*p[0])/(o-1),B=l||(h-d-g-y*p[1])/(y-1);return(B===1/0||B<0)&&(B=0),(m===1/0||m<0)&&(m=0),{nodes:((s?(n=e.nodes)===null||n===void 0?void 0:n.sort(s):vee(e))||[]).map((F,T)=>{const O=Math.floor(T/o),_=T%o,k=c?O%2===0?_:o-1-_:O%2===0?o-1-_:_,L=v+k*(p[0]+m)+p[0]/2,U=d+O*(p[1]+B)+p[1]/2;return{id:F.id,style:{x:L,y:U}}})}})}}jd.defaultOptions={padding:0,cols:5,clockwise:!0};function vee(r){const{nodes:e=[],edges:t=[]}=r,n={},i={};e.forEach(o=>{n[o.id]=0,i[o.id]=[]}),t.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(e.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),A=e.find(l=>l.id===o);s.push(A),i[o].forEach(l=>{n[l]--,n[l]===0&&a.push(l)})}return s}const pee=["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],yee=["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],mee=["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],wee=["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],Bee=["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"];class Ln extends yB{}function sA(r,e=!0,t){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),e&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),t&&Object.assign(n.style,t),n}function S1(r,e="div",t={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(e);return s.innerHTML=n,s.id=r,Object.assign(s.style,t),i.appendChild(s),s}var bee=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class Wd extends Ln{constructor(e,t){super(e,Object.assign({},Wd.defaultOptions,t)),this.$element=sA("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(t)}update(e){const t=Object.create(null,{update:{get:()=>super.update}});return bee(this,void 0,void 0,function*(){t.update.call(this,e),Object.assign(this.$element.style,V1(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}Wd.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function eb(r,e,t,n,i,a){const s=r,o=e,A=t-s,l=n-o;let c=i-s,u=a-o,h=c*A+u*l,d=0;h<=0?d=0:(c=A-c,u=l-u,h=c*A+u*l,h<=0?d=0:d=h*h/(A*A+l*l));const f=c*c+u*u-d;return f<0?0:f}function za(r,e,t,n){return(r-t)*(r-t)+(e-n)*(e-n)}function qM(r,e,t,n,i){return za(r,e,t,n)<i*i}function Eee(r){if(!Number.isFinite(r))return t=>t;if(r===0)return Math.round;const e=Math.pow(10,r);return t=>Math.round(t*e)/e}function UN(r){const e=Math.min(r.x1,r.x2),t=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:e,y:n,x2:t,y2:i,width:t-e,height:i-n}}class In{constructor(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}draw(e){e.moveTo(this.x1,this.y1),e.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(e){return new In(e.x1,e.y1,e.x2,e.y2)}cuts(e,t){if(this.y1===this.y2||t<this.y1&&t<=this.y2||t>this.y1&&t>=this.y2||e>this.x1&&e>=this.x2)return!1;if(e<this.x1&&e<=this.x2)return!0;const n=this.x1+(t-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return e<=n}distSquare(e,t){return eb(this.x1,this.y1,this.x2,this.y2,e,t)}ptClose(e,t,n){if(this.x1<this.x2){if(e<this.x1-n||e>this.x2+n)return!1}else if(e<this.x2-n||e>this.x1+n)return!1;if(this.y1<this.y2){if(t<this.y1-n||t>this.y2+n)return!1}else if(t<this.y2-n||t>this.y1+n)return!1;return!0}}var Jt;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Jt||(Jt={}));class Ym{constructor(e,t=0,n=0){this.state=e,this.x=t,this.y=n}}function vu(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new Ym(Jt.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Ym(Jt.NONE)}return new Ym(t===0||n===0?Jt.COINCIDENT:Jt.PARALLEL)}function PN(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function xee(r,e){function t(i,a,s,o){let A=PN(e,new In(i,a,s,o));return A=Math.abs(A-.5),A>=0&&A<=1?1:0}let n=t(r.x,r.y,r.x2,r.y);return n+=t(r.x,r.y,r.x,r.y2),n>1||(n+=t(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=t(r.x2,r.y,r.x2,r.y2),n>0)}var en;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(en||(en={}));function Nu(r,e,t){const n=new Set;return r.width<=0?(n.add(en.LEFT),n.add(en.RIGHT)):e<r.x?n.add(en.LEFT):e>r.x+r.width&&n.add(en.RIGHT),r.height<=0?(n.add(en.TOP),n.add(en.BOTTOM)):t<r.y?n.add(en.TOP):t>r.y+r.height&&n.add(en.BOTTOM),n}function RN(r,e){let t=e.x1,n=e.y1;const i=e.x2,a=e.y2,s=Array.from(Nu(r,i,a));if(s.length===0)return!0;let o=Nu(r,t,n);for(;o.size!==0;){for(const A of s)if(o.has(A))return!1;if(o.has(en.RIGHT)||o.has(en.LEFT)){let A=r.x;o.has(en.RIGHT)&&(A+=r.width),n=n+(A-t)*(a-n)/(i-t),t=A}else{let A=r.y;o.has(en.BOTTOM)&&(A+=r.height),t=t+(A-n)*(i-t)/(a-n),n=A}o=Nu(r,t,n)}return!0}function Cee(r,e){let t=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,A){let l=PN(e,new In(a,s,o,A));l=Math.abs(l-.5),l>=0&&l<=1&&(n++,l<t&&(t=l))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?t:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:t)}function See(r,e){let t=0;const n=vu(r,new In(e.x,e.y,e.x2,e.y));t+=n.state===Jt.POINT?1:0;const i=vu(r,new In(e.x,e.y,e.x,e.y2));t+=i.state===Jt.POINT?1:0;const a=vu(r,new In(e.x,e.y2,e.x2,e.y2));t+=a.state===Jt.POINT?1:0;const s=vu(r,new In(e.x2,e.y,e.x2,e.y2));return t+=s.state===Jt.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:t}}class Jn{constructor(e,t,n,i){this.x=e,this.y=t,this.width=n,this.height=i}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(e){return new Jn(e.x,e.y,e.width,e.height)}equals(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}clone(){return new Jn(this.x,this.y,this.width,this.height)}add(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x+e.width),a=Math.max(this.y2,e.y+e.height);this.x=t,this.y=n,this.width=i-t,this.height=a-n}addPoint(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x),a=Math.max(this.y2,e.y);this.x=t,this.y=n,this.width=i-t,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(e){e.rect(this.x,this.y,this.width,this.height)}containsPt(e,t){return e>=this.x&&e<=this.x2&&t>=this.y&&t<=this.y2}get area(){return this.width*this.height}intersects(e){return this.area<=0||e.width<=0||e.height<=0?!1:e.x+e.width>this.x&&e.y+e.height>this.y&&e.x<this.x2&&e.y<this.y2}distSquare(e,t){if(this.containsPt(e,t))return 0;const n=Nu(this,e,t);return n.has(en.TOP)?n.has(en.LEFT)?za(e,t,this.x,this.y):n.has(en.RIGHT)?za(e,t,this.x2,this.y):(this.y-t)*(this.y-t):n.has(en.BOTTOM)?n.has(en.LEFT)?za(e,t,this.x,this.y2):n.has(en.RIGHT)?za(e,t,this.x2,this.y2):(t-this.y2)*(t-this.y2):n.has(en.LEFT)?(this.x-e)*(this.x-e):n.has(en.RIGHT)?(e-this.x2)*(e-this.x2):0}}function Fee(r){if(r.length===0)return null;const e=r[0],t=new Jn(e.x,e.y,0,0);for(const n of r)t.addPoint(n);return t}class Oh{constructor(e,t,n){this.cx=e,this.cy=t,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(e){return new Oh(e.cx,e.cy,e.radius)}containsPt(e,t){return za(this.cx,this.cy,e,t)<this.radius*this.radius}distSquare(e,t){const n=za(this.cx,this.cy,e,t);if(n<this.radius*this.radius)return 0;const i=Math.sqrt(n)-this.radius;return i*i}draw(e){e.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class Ps{constructor(e,t=0,n=0,i=0,a=0,s=10,o=10,A=new Float32Array(Math.max(0,s*o)).fill(0)){this.pixelGroup=e,this.i=t,this.j=n,this.pixelX=i,this.pixelY=a,this.width=s,this.height=o,this.area=A}createSub(e,t){return new Ps(this.pixelGroup,e.x,e.y,t.x,t.y,e.width,e.height)}static fromPixelRegion(e,t){return new Ps(t,0,0,e.x,e.y,Math.ceil(e.width/t),Math.ceil(e.height/t))}copy(e,t){return new Ps(this.pixelGroup,this.scaleX(t.x),this.scaleY(t.y),t.x,t.y,e.width,e.height,e.area)}boundX(e){return e<this.i?this.i:e>=this.width?this.width-1:e}boundY(e){return e<this.j?this.j:e>=this.height?this.height-1:e}scaleX(e){return this.boundX(Math.floor((e-this.pixelX)/this.pixelGroup))}scaleY(e){return this.boundY(Math.floor((e-this.pixelY)/this.pixelGroup))}scale(e){const t=this.scaleX(e.x),n=this.scaleY(e.y),i=this.boundX(Math.ceil((e.x+e.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((e.y+e.height-this.pixelY)/this.pixelGroup)),s=i-t,o=a-n;return new Jn(t,n,s,o)}invertScaleX(e){return Math.round(e*this.pixelGroup+this.pixelX)}invertScaleY(e){return Math.round(e*this.pixelGroup+this.pixelY)}addPadding(e,t){const n=Math.ceil(t/this.pixelGroup),i=this.boundX(e.x-n),a=this.boundY(e.y-n),s=this.boundX(e.x2+n),o=this.boundY(e.y2+n),A=s-i,l=o-a;return new Jn(i,a,A,l)}get(e,t){return e<0||t<0||e>=this.width||t>=this.height?Number.NaN:this.area[e+t*this.width]}inc(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]+=n)}set(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]=n)}incArea(e,t){if(e.width<=0||e.height<=0||t===0)return;const n=this.width,i=e.width,a=Math.max(0,e.i),s=Math.max(0,e.j),o=Math.min(e.i+e.width,n),A=Math.min(e.j+e.height,this.height);if(!(A<=0||o<=0||a>=n||A>=this.height))for(let l=s;l<A;l++){const c=(l-e.j)*i,u=l*n;for(let h=a;h<o;h++){const d=e.area[h-e.i+c];d!==0&&(this.area[h+u]+=t*d)}}}fill(e){this.area.fill(e)}fillArea(e,t){const n=e.x+e.y*this.width;for(let i=0;i<e.height;i++){const a=n+i*this.width;this.area.fill(t,a,a+e.width)}}fillHorizontalLine(e,t,n,i){const a=e+t*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(e,t,n,i){const a=e+t*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let e="";for(let t=0;t<this.height;t++){const n=t*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];e+=a.toFixed(1).padStart(6),e+=" "}e+=`
|
|
14
14
|
`}return e}draw(e,t=!0){if(this.width<=0||this.height<=0)return;e.save(),t&&e.translate(this.pixelX,this.pixelY);const n=this.area.reduce((s,o)=>Math.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);e.scale(this.pixelGroup,this.pixelGroup);for(let s=0;s<this.width;s++)for(let o=0;o<this.height;o++){const A=this.area[s+o*this.width];e.fillStyle=`rgba(0, 0, 0, ${a(A)})`,e.fillRect(s,o,1,1)}e.restore()}drawThreshold(e,t,n=!0){if(!(this.width<=0||this.height<=0)){e.save(),n&&e.translate(this.pixelX,this.pixelY),e.scale(this.pixelGroup,this.pixelGroup);for(let i=0;i<this.width;i++)for(let a=0;a<this.height;a++){const s=this.area[i+a*this.width];e.fillStyle=s>t?"black":"white",e.fillRect(i,a,1,1)}e.restore()}}}function DN(r,e){const t=n=>({x:n.x-e,y:n.y-e,width:n.width+2*e,height:n.height+2*e});return Array.isArray(r)?r.map(t):t(r)}function $M(r,e,t){return HN(Object.assign(UN(r),{distSquare:(n,i)=>eb(r.x1,r.y1,r.x2,r.y2,n,i)}),e,t)}function HN(r,e,t){const n=DN(r,t),i=e.scale(n),a=e.createSub(i,n);return Tee(a,e,t,(s,o)=>r.distSquare(s,o)),a}function Tee(r,e,t,n){const i=t*t;for(let a=0;a<r.height;a++)for(let s=0;s<r.width;s++){const o=e.invertScaleX(r.i+s),A=e.invertScaleY(r.j+a),l=n(o,A);if(l===0){r.set(s,a,i);continue}if(l<i){const c=t-Math.sqrt(l);r.set(s,a,c*c)}}return r}function Mee(r,e,t){const n=e.scale(r),i=e.addPadding(n,t),a=e.createSub(i,{x:r.x-t,y:r.y-t}),s=n.x-i.x,o=n.y-i.y,A=i.x2-n.x2,l=i.y2-n.y2,c=i.width-s-A,u=i.height-o-l,h=t*t;a.fillArea({x:s,y:o,width:c+1,height:u+1},h);const d=[0],f=Math.max(o,s,A,l);{const y=e.invertScaleX(n.x+n.width/2);for(let m=1;m<f;m++){const B=e.invertScaleY(n.y-m),C=r.distSquare(y,B);if(C<h){const S=t-Math.sqrt(C);d.push(S*S)}else break}}const g=[],v=Math.max(s,A),p=Math.max(o,A);for(let y=1;y<v;y++){const m=e.invertScaleX(n.x-y),B=[];for(let C=1;C<p;C++){const S=e.invertScaleY(n.y-C),F=r.distSquare(m,S);if(F<h){const T=t-Math.sqrt(F);B.push(T*T)}else B.push(0)}g.push(B)}for(let y=1;y<Math.min(o,d.length);y++){const m=d[y];a.fillHorizontalLine(s,o-y,c+1,m)}for(let y=1;y<Math.min(l,d.length);y++){const m=d[y];a.fillHorizontalLine(s,o+u+y,c+1,m)}for(let y=1;y<Math.min(s,d.length);y++){const m=d[y];a.fillVerticalLine(s-y,o,u+1,m)}for(let y=1;y<Math.min(l,d.length);y++){const m=d[y];a.fillVerticalLine(s+c+y,o,u+1,m)}for(let y=1;y<s;y++){const m=g[y-1],B=s-y;for(let C=1;C<o;C++)a.set(B,o-C,m[C-1]);for(let C=1;C<l;C++)a.set(B,o+u+C,m[C-1])}for(let y=1;y<A;y++){const m=g[y-1],B=s+c+y;for(let C=1;C<o;C++)a.set(B,o-C,m[C-1]);for(let C=1;C<l;C++)a.set(B,o+u+C,m[C-1])}return a}function Nt(r,e){return{x:r,y:e}}function Oee(r,e,t,n){if(r.length===0)return[];const i=Qee(r);return i.map((a,s)=>{const o=i.slice(0,s);return _ee(e,a,o,t,n)}).flat()}function _ee(r,e,t,n,i){const a=Nt(e.cx,e.cy),s=Lee(a,t,r);if(s==null)return[];const o=new In(a.x,a.y,s.cx,s.cy),A=Iee(o,r,n,i);return kee(A,r)}function Iee(r,e,t,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o<t&&s;o++)for(s=!1;!s&&a.length>0;){const A=a.pop(),l=GN(e,A),c=l?See(A,l):null;if(!l||!c||c.count!==2){s||i.push(A);continue}let u=n,h=yu(l,u,c,!0),d=Ea(h,a)||Ea(h,i),f=pu(h,e);for(;!d&&f&&u>=1;)u/=1.5,h=yu(l,u,c,!0),d=Ea(h,a)||Ea(h,i),f=pu(h,e);if(h&&!d&&!f&&(a.push(new In(A.x1,A.y1,h.x,h.y)),a.push(new In(h.x,h.y,A.x2,A.y2)),s=!0),s)continue;u=n,h=yu(l,u,c,!1);let g=Ea(h,a)||Ea(h,i);for(f=pu(h,e);!g&&f&&u>=1;)u/=1.5,h=yu(l,u,c,!1),g=Ea(h,a)||Ea(h,i),f=pu(h,e);h&&!g&&(a.push(new In(A.x1,A.y1,h.x,h.y)),a.push(new In(h.x,h.y,A.x2,A.y2)),s=!0),s||i.push(A)}for(;a.length>0;)i.push(a.pop());return i}function kee(r,e){const t=[];for(;r.length>0;){const n=r.pop();if(r.length===0){t.push(n);break}const i=r.pop(),a=new In(n.x1,n.y1,i.x2,i.y2);GN(e,a)?(t.push(n),r.push(i)):r.push(a)}return t}function Lee(r,e,t){let n=Number.POSITIVE_INFINITY;return e.reduce((i,a)=>{const s=za(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new In(r.x,r.y,a.cx,a.cy),A=Nee(t,o);return s*(A+1)*(A+1)<n&&(i=a,n=s*(A+1)*(A+1)),i},null)}function Qee(r){if(r.length<2)return r;let e=0,t=0;return r.forEach(n=>{e+=n.cx,t+=n.cy}),e/=r.length,t/=r.length,r.map(n=>{const i=e-n.cx,a=t-n.cy,s=i*i+a*a;return[n,s]}).sort((n,i)=>n[1]-i[1]).map(n=>n[0])}function pu(r,e){return e.some(t=>t.containsPt(r.x,r.y))}function Ea(r,e){return e.some(t=>!!(qM(t.x1,t.y1,r.x,r.y,.001)||qM(t.x2,t.y2,r.x,r.y,.001)))}function GN(r,e){let t=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!RN(i,e))continue;const a=Cee(i,e);a>=0&&a<t&&(n=i,t=a)}return n}function Nee(r,e){return r.reduce((t,n)=>RN(n,e)&&xee(n,e)?t+1:t,0)}function yu(r,e,t,n){const i=t.top,a=t.left,s=t.bottom,o=t.right;if(n){if(a.state===Jt.POINT){if(i.state===Jt.POINT)return Nt(r.x-e,r.y-e);if(s.state===Jt.POINT)return Nt(r.x-e,r.y2+e);const h=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)<h*.5?a.y>o.y?Nt(r.x-e,r.y-e):Nt(r.x2+e,r.y-e):a.y<o.y?Nt(r.x-e,r.y2+e):Nt(r.x2+e,r.y2+e)}if(o.state===Jt.POINT){if(i.state===Jt.POINT)return Nt(r.x2+e,r.y-e);if(s.state===Jt.POINT)return Nt(r.x2+e,r.y2+e)}const c=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<c*.5?i.x>s.x?Nt(r.x-e,r.y-e):Nt(r.x-e,r.y2+e):i.x<s.x?Nt(r.x2+e,r.y-e):Nt(r.x2+e,r.y2+e)}if(a.state===Jt.POINT){if(i.state===Jt.POINT)return Nt(r.x2+e,r.y2+e);if(s.state===Jt.POINT)return Nt(r.x2+e,r.y-e);const c=r.height*r.width;return r.width*((a.y-r.y+(o.y-r.y))*.5)<c*.5?a.y>o.y?Nt(r.x2+e,r.y2+e):Nt(r.x-e,r.y2+e):a.y<o.y?Nt(r.x2+e,r.y-e):Nt(r.x-e,r.y-e)}if(o.state===Jt.POINT){if(i.state===Jt.POINT)return Nt(r.x-e,r.y2+e);if(s.state===Jt.POINT)return Nt(r.x-e,r.y-e)}const A=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<A*.5?i.x>s.x?Nt(r.x2+e,r.y2+e):Nt(r.x2+e,r.y-e):i.x<s.x?Nt(r.x-e,r.y2+e):Nt(r.x-e,r.y-e)}function Uee(r,e,t,n){if(!(r.closed?t<r.length:t<r.length-1))return!1;const a=r.get(e),s=r.get(t+1);for(let o=e+1;o<=t;o++){const A=r.get(o);if(eb(a.x,a.y,s.x,s.y,A.x,A.y)>n)return!1}return!0}function Pee(r=0){return e=>{if(r<0||e.length<3)return e;const t=[];let n=0;const i=r*r;for(;n<e.length;){let a=n+1;for(;Uee(e,n,a,i);)a++;t.push(e.get(n)),n=a}return new oA(t)}}function Ree(r,e){switch(r){case-2:return(((-e+3)*e-3)*e+1)/6;case-1:return((3*e-6)*e*e+4)/6;case 0:return(((-3*e+3)*e+3)*e+1)/6;case 1:return e*e*e/6;default:throw new Error("unknown error")}}function Dee(r=6){function a(s,o,A){let l=0,c=0;for(let u=-2;u<=1;u++){const h=s.get(o+u),d=Ree(u,A);l+=d*h.x,c+=d*h.y}return{x:l,y:c}}return s=>{if(s.length<3)return s;const o=[],A=s.closed,l=s.length+3-1+(A?0:2);o.push(a(s,2-(A?0:2),0));for(let c=2-(A?0:2);c<l;c++)for(let u=1;u<=r;u++)o.push(a(s,c,u/r));return new oA(o)}}function Hee(r=8){return e=>{let t=r,n=e.length;if(t>1)for(n=Math.floor(e.length/t);n<3&&t>1;)t-=1,n=Math.floor(e.length/t);const i=[];for(let a=0,s=0;s<n;s++,a+=t)i.push(e.get(a));return new oA(i)}}class oA{constructor(e=[],t=!0){this.points=e,this.closed=t}get(e){const t=e,n=this.points.length;return e<0?this.closed?this.get(e+n):this.points[0]:e>=n?this.closed?this.get(e-n):this.points[n-1]:this.points[t]}get length(){return this.points.length}toString(e=1/0){const t=this.points;if(t.length===0)return"";const n=typeof e=="function"?e:Eee(e);let i="M";for(const a of t)i+=`${n(a.x)},${n(a.y)} L`;return i=i.slice(0,-1),this.closed&&(i+=" Z"),i}draw(e){const t=this.points;if(t.length!==0){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const n of t)e.lineTo(n.x,n.y);this.closed&&e.closePath()}}sample(e){return Hee(e)(this)}simplify(e){return Pee(e)(this)}bSplines(e){return Dee(e)(this)}apply(e){return e(this)}containsElements(e){const t=Fee(this.points);return t?e.every(n=>t.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(e,t){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new In(i.x,i.y,i.x,i.y);for(let s=1;s<this.points.length;s++){const o=this.points[s];a.x1=a.x2,a.y1=a.y2,a.x2=o.x,a.y2=o.y,a.cuts(e,t)&&n++}return a.x1=a.x2,a.y1=a.y2,a.x2=i.x,a.y2=i.y,a.cuts(e,t)&&n++,n%2===1}}class Gee{constructor(e=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=e}add(e){this.set.add(`${e.x}x${e.y}`),this.arr[this.count++]=e}contains(e){return this.set.has(`${e.x}x${e.y}`)}isFirst(e){if(this.count===0)return!1;const t=this.arr[0];return t!=null&&t.x===e.x&&t.y===e.y}path(){return new oA(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(e){return this.arr[e]}get length(){return this.count}}const SA=0,mu=1,wu=2,Xm=3;function Kee(r,e){const t=(Math.floor(r.width)+Math.floor(r.height))*2,n=new Gee(t);function i(A,l,c,u){const h=r.get(A,l);return Number.isNaN(h)?Number.NaN:h>e?c+u:c}function a(A,l){let c=SA;return c=i(A,l,c,1),c=i(A+1,l,c,2),c=i(A,l+1,c,4),c=i(A+1,l+1,c,8),Number.isNaN(c)?-1:c}let s=mu;function o(A,l){let c=A,u=l,h=r.invertScaleX(c),d=r.invertScaleY(u);for(let f=0;f<r.width*r.height;f++){const g={x:h,y:d};if(n.contains(g)){if(n.isFirst(g))return!0}else n.add(g);const v=a(c,u);switch(v){case-1:return!0;case 0:case 3:case 2:case 7:s=wu;break;case 12:case 14:case 4:s=Xm;break;case 6:s=s===SA?Xm:wu;break;case 1:case 13:case 5:s=SA;break;case 9:s=s===wu?SA:mu;break;case 10:case 8:case 11:s=mu;break;default:return console.warn("Marching squares invalid state: "+v),!0}switch(s){case SA:u--,d-=r.pixelGroup;break;case mu:u++,d+=r.pixelGroup;break;case Xm:c--,h-=r.pixelGroup;break;case wu:c++,h+=r.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+v),!0}}return!0}for(let A=0;A<r.width;A++)for(let l=0;l<r.height;l++){if(r.get(A,l)<=e)continue;const c=a(A,l);if(!(c<0||c===15)&&o(A,l))return n.path()}return null}const qd={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function nl(r){return r!=null&&typeof r.radius=="number"}function YM(r,e){if(nl(r)!==nl(e))return!1;if(nl(r)){const n=e;return r.cx===n.cx&&r.cy===n.cy&&r.radius===n.radius}const t=e;return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height}var di;(function(r){r[r.MEMBERS=0]="MEMBERS",r[r.NON_MEMBERS=1]="NON_MEMBERS",r[r.EDGES=2]="EDGES"})(di||(di={}));let XM=class{constructor(e={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new Jn(0,0,0,0),this.potentialArea=new Ps(1,0,0,0,0,0,0),this.o=Object.assign({},qd,e)}pushMember(...e){if(e.length!==0){this.dirty.add(di.MEMBERS);for(const t of e)this.members.push({raw:t,obj:nl(t)?Oh.from(t):Jn.from(t),area:null})}}removeMember(e){const t=this.members.findIndex(n=>YM(n.raw,e));return t<0?!1:(this.members.splice(t,1),this.dirty.add(di.MEMBERS),!0)}removeNonMember(e){const t=this.nonMembers.findIndex(n=>YM(n.raw,e));return t<0?!1:(this.nonMembers.splice(t,1),this.dirty.add(di.NON_MEMBERS),!0)}removeEdge(e){const t=this.edges.findIndex(n=>n.obj.equals(e));return t<0?!1:(this.edges.splice(t,1),this.dirty.add(di.NON_MEMBERS),!0)}pushNonMember(...e){if(e.length!==0){this.dirty.add(di.NON_MEMBERS);for(const t of e)this.nonMembers.push({raw:t,obj:nl(t)?Oh.from(t):Jn.from(t),area:null})}}pushEdge(...e){if(e.length!==0){this.dirty.add(di.EDGES);for(const t of e)this.edges.push({raw:t,obj:In.from(t),area:null})}}update(){const e=this.dirty.has(di.MEMBERS),t=this.dirty.has(di.NON_MEMBERS);let n=this.dirty.has(di.EDGES);this.dirty.clear();const i=this.members.map(l=>l.obj);if(this.o.virtualEdges&&(e||t)){const l=this.nonMembers.map(h=>h.obj),c=Oee(i,l,this.o.maxRoutingIterations,this.o.morphBuffer),u=new Map(this.virtualEdges.map(h=>[h.obj.toString(),h.area]));this.virtualEdges=c.map(h=>{var d;return{raw:h,obj:h,area:(d=u.get(h.toString()))!==null&&d!==void 0?d:null}}),n=!0}let a=!1;if(e||n){const l=this.virtualEdges.concat(this.edges).map(d=>d.obj),c=Vee(i,l),u=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,h=Jn.from(DN(c,u));h.equals(this.activeRegion)||(a=!0,this.activeRegion=h)}if(a){const l=Math.ceil(this.activeRegion.width/this.o.pixelGroup),c=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Ps.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(u=>u.area=null),this.nonMembers.forEach(u=>u.area=null),this.edges.forEach(u=>u.area=null),this.virtualEdges.forEach(u=>u.area=null)):(l!==this.potentialArea.width||c!==this.potentialArea.height)&&(this.potentialArea=Ps.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=l=>{if(l.area){const c=`${l.obj.width}x${l.obj.height}x${l.obj instanceof Jn?"R":"C"}`;s.set(c,l.area)}},A=l=>{if(l.area)return;const c=`${l.obj.width}x${l.obj.height}x${l.obj instanceof Jn?"R":"C"}`;if(s.has(c)){const h=s.get(c);l.area=this.potentialArea.copy(h,{x:l.obj.x-this.o.nodeR1,y:l.obj.y-this.o.nodeR1});return}const u=l.obj instanceof Jn?Mee(l.obj,this.potentialArea,this.o.nodeR1):HN(l.obj,this.potentialArea,this.o.nodeR1);l.area=u,s.set(c,u)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(A),this.nonMembers.forEach(l=>{this.activeRegion.intersects(l.obj)?A(l):l.area=null}),this.edges.forEach(l=>{l.area||(l.area=$M(l.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(l=>{l.area||(l.area=$M(l.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(e){for(const t of this.members)t.obj.draw(e)}drawNonMembers(e){for(const t of this.nonMembers)t.obj.draw(e)}drawEdges(e){for(const t of this.edges)t.obj.draw(e)}drawPotentialArea(e,t=!0){this.potentialArea.draw(e,t)}compute(){if(this.members.length===0)return new oA([]);this.dirty.size>0&&this.update();const{o:e,potentialArea:t}=this,n=this.members.map(o=>o.area),i=this.virtualEdges.concat(this.edges).map(o=>o.area),a=this.nonMembers.filter(o=>o.area!=null).map(o=>o.area),s=this.members.map(o=>o.obj);return zee(t,n,i,a,o=>o.containsElements(s),e)}};function zee(r,e,t,n,i,a={}){const s=Object.assign({},qd,a);let o=s.threshold,A=s.memberInfluenceFactor,l=s.edgeInfluenceFactor,c=s.nonMemberInfluenceFactor;const u=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),h=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let d=0;d<s.maxMarchingIterations;d++){if(r.clear(),A!==0){const g=A/u;for(const v of e)r.incArea(v,g)}if(l!==0){const g=l/h;for(const v of t)r.incArea(v,g)}if(c!==0){const g=c/u;for(const v of n)r.incArea(v,g)}const f=Kee(r,o);if(f&&i(f))return f;if(o*=.95,d<=s.maxMarchingIterations*.5)A*=1.2,l*=1.2;else if(c!==0&&n.length>0)c*=.8;else break}return new oA([])}function Vee(r,e){if(r.length===0)return new Jn(0,0,0,0);const t=Jn.from(r[0]);for(const n of r)t.add(n);for(const n of e)t.add(UN(n));return t}var jee=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};class $d extends Ln{constructor(e,t){super(e,zn({},$d.defaultOptions,t)),this.path=null,this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:n,bubbleSetOptions:i}=this.parseOptions();Xt(this.bubbleSetOptions,i)||this.init(),this.bubbleSetOptions=Object.assign({},i);const a=Object.assign(Object.assign({},n),{d:this.getPath()});this.shape?this.shape.update(a):(this.shape=new Pl({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=Z(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,A=[...this.avoidMembers.keys()];if(a.length===0&&o.length===0)return this.members.clear(),this.avoidMembers.clear(),this.path=[],this.path;if(!n&&this.path&&Xt(a,s)&&Xt(o,A))return this.path;const{enter:l=[],exit:c=[]}=qa(s,a,v=>v),{enter:u=[],exit:h=[]}=qa(A,o,v=>v);if(n){const v=a.includes(n),p=o.includes(n);v&&(c.push(n),l.push(n)),p&&(h.push(n),u.push(n))}const d=(v,p,y)=>{v.forEach(m=>{const B=y?this.members:this.avoidMembers,C=y?"pushMember":"pushNonMember",S=y?"removeMember":"removeNonMember";if(p){let F;i.getElementType(m)==="edge"?([F]=qee(i,m),this.bubbleSets.pushEdge(F)):([F]=Wee(i,m),this.bubbleSets[C](F)),B.set(m,F)}else{const F=B.get(m);F&&(i.getElementType(m)==="edge"?this.bubbleSets.removeEdge(F):this.bubbleSets[S](F),B.delete(m))}})};d(c,!1,!0),d(l,!0,!0),d(h,!1,!1),d(u,!0,!1);const g=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=BL(g.points.map(Hn)),this.path},this.bindEvents(),this.bubbleSets=new XM(this.options)}bindEvents(){this.context.graph.on(ge.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(ge.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new XM(this.options),this.members.clear(),this.avoidMembers.clear(),this.path=null}parseOptions(){const e=this.options,{type:t,key:n,members:i,avoidMembers:a}=e,s=jee(e,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((A,l)=>(l in qd?A.bubbleSetOptions[l]=s[l]:A.style[l]=s[l],A),{style:{},bubbleSetOptions:{}});return Object.assign({type:t,key:n,members:i,avoidMembers:a},o)}addMember(e){const t=Array.isArray(e)?e:[e];t.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!t.includes(n))),this.options.members=[...new Set([...this.options.members,...t])],this.drawBubbleSets()}removeMember(e){const t=Array.isArray(e)?e:[e];this.options.members=this.options.members.filter(n=>!t.includes(n)),this.drawBubbleSets()}updateMember(e){this.options.members=Te(e)?e(this.options.members):e,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(e){const t=Array.isArray(e)?e:[e];t.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!t.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...t])],this.drawBubbleSets()}removeAvoidMember(e){const t=Array.isArray(e)?e:[e];this.options.avoidMembers.some(n=>t.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!t.includes(n)),this.drawBubbleSets())}updateAvoidMember(e){this.options.avoidMembers=Array.isArray(e)?e:[e],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(ge.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(ge.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape&&(this.shape.destroy(),this.shape=void 0),super.destroy()}}$d.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},qd);const Wee=(r,e)=>(Array.isArray(e)?e:[e]).map(n=>{const i=r.getElementRenderBounds(n);return new Jn(i.min[0],i.min[1],Yi(i),Xi(i))}),qee=(r,e)=>(Array.isArray(e)?e:[e]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return In.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function $ee(r){return`
|
|
15
15
|
<ul class="g6-contextmenu-ul">
|
|
16
16
|
${r.map(e=>`<li class="g6-contextmenu-li" value="${e.value}">${e.name}</li>`).join("")}
|
|
@@ -131,4 +131,4 @@ YYYY`):yr(t,"MM月");case"year":return yr(t,"YYYY");default:return yr(t,"YYYY-MM
|
|
|
131
131
|
<use xlink:href="#${t.id}"></use>
|
|
132
132
|
</svg>
|
|
133
133
|
</div>`}).join("")})}}pf.defaultOptions={position:"top-left"};var ZO=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class yf extends Ln{constructor(e,t){super(e,Object.assign({},yf.defaultOptions,t)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=(n,i)=>{const{enable:a}=this.options;return typeof a=="function"?a(n,i):a},this.onClick=n=>{const{target:{id:i}}=n;this.currentTarget===i?this.hide(n):this.show(n)},this.onPointerMove=n=>{const{target:i}=n;!this.currentTarget||i.id===this.currentTarget||this.show(n)},this.onPointerLeave=n=>{this.hide(n)},this.onCanvasMove=n=>{this.hide(n)},this.onPointerOver=n=>{this.show(n)},this.showById=n=>ZO(this,void 0,void 0,function*(){const i={target:{id:n}};yield this.show(i)}),this.getElementData=(n,i)=>{const{model:a}=this.context;switch(i){case"node":return a.getNodeData([n]);case"edge":return a.getEdgeData([n]);case"combo":return a.getComboData([n]);default:return[]}},this.show=n=>ZO(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(Gl(n.target))return;const A=this.context.graph.getElementType(o),{getContent:l,title:c}=this.options,u=this.getElementData(o,A);if(!this.tooltipElement)return;if(!this.isEnable(n,u)){this.hide(n);return}let h={};if(l){if(h.content=yield l(n,u),!h.content)return}else{const g=this.context.graph.getElementRenderStyle(o),v=A==="node"?g.fill:g.stroke;h={title:c||A,data:u.map(p=>({name:"ID",value:p.id||`${p.source} -> ${p.target}`,color:v}))}}this.currentTarget=o;let d,f;if(s)d=s.x,f=s.y;else{const g=Rn(u,"0.style",{x:0,y:0});d=g.x,f=g.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:d,y:f,style:{".tooltip":{visibility:"visible"}}}),h))}),this.hide=n=>{var i,a,s,o,A;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:l,y:c}}=n;(A=(o=this.options).onOpenChange)===null||A===void 0||A.call(o,!1),this.tooltipElement.hide(l,c),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new qie({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerover":this.onPointerOver,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerover":this.onPointerOver,"edge:pointermove":this.onPointerMove,"combo:pointerover":this.onPointerOver,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(e){var t;this.unbindEvents(),super.update(e),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:e}=this.context,t=e.getContainer();t&&(this.container=t,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:e}=this.context,t=this.getEvents();Object.keys(t).forEach(n=>{e.off(n,t[n])})}bindEvents(){const{graph:e}=this.context,t=this.getEvents();Object.keys(t).forEach(n=>{e.on(n,t[n])})}get tooltipStyleProps(){const{canvas:e}=this.context,{center:t}=e.getBounds(),n=e.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:A,container:l={x:-a,y:-i},title:c,offset:u}=this.options,[h,d]=t,[f,g]=e.getSize();return{x:h,y:d,container:l,title:c,bounding:{x:0,y:0,width:f,height:g},position:o,enterable:A,offset:u,style:s}}destroy(){var e;this.unbindEvents(),this.tooltipElement&&((e=this.container)===null||e===void 0||e.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}yf.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var SU=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};let mo;function FU(r,e){return mo||(mo=document.createElement("canvas")),mo.width=r,mo.height=e,mo.getContext("2d").clearRect(0,0,r,e),mo}function Oae(r,e,t,n){return SU(this,void 0,void 0,function*(){const i=FU(r,e),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:A,textFontSize:l,textFontFamily:c,textFontVariant:u,textFontWeight:h,textAlign:d,textBaseline:f}=n;return a.textAlign=d,a.textBaseline=f,a.translate(r/2,e/2),a.font=`${l}px ${c} ${u} ${h}`,s&&a.rotate(s),o&&(a.globalAlpha=o),A&&(a.fillStyle=A,a.fillText(`${t}`,0,0)),i.toDataURL()})}function _ae(r,e,t,n){return SU(this,void 0,void 0,function*(){const i=FU(r,e),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const A=new Image;return A.crossOrigin="anonymous",A.src=t,new Promise(l=>{A.onload=function(){const c=r>A.width?(r-A.width)/2:0,u=e>A.height?(e-A.height)/2:0;a.drawImage(A,0,0,A.width,A.height,c,u,r-c*2,e-u*2),l(i.toDataURL())}})})}var Iae=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})},kae=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};class mf extends Ln{constructor(e,t){super(e,Object.assign({},mf.defaultOptions,t)),this.$element=sA("watermark"),this.context.canvas.getContainer().appendChild(this.$element),this.update(t)}update(e){const t=Object.create(null,{update:{get:()=>super.update}});return Iae(this,void 0,void 0,function*(){t.update.call(this,e);const n=this.options,{width:i,height:a,text:s,imageURL:o}=n,A=kae(n,["width","height","text","imageURL"]);Object.keys(A).forEach(c=>{c.startsWith("background")&&(this.$element.style[c]=e[c])});const l=o?yield _ae(i,a,o,A):yield Oae(i,a,s,A);this.$element.style.backgroundImage=`url(${l})`})}destroy(){super.destroy(),this.$element.remove()}}mf.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const Lae=["#7E92B5","#F4664A","#FFBE3A"],Qae={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},Nae={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function TU(r){const{bgColor:e,textColor:t,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:A=.06,nodeIconOpacityInactive:l=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:u=Lae,nodePaletteOptions:h=Qae,edgeColor:d,edgeColorDisabled:f,edgePaletteOptions:g=Nae,comboColor:v,comboColorDisabled:p,comboStroke:y,comboStrokeDisabled:m,edgeColorInactive:B}=r;return{background:e,node:{palette:h,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:u,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:t,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:l,labelFill:t,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:A,fill:i,fillOpacity:A,iconFill:i,iconOpacity:.25,labelFill:t,labelFillOpacity:.25,strokeOpacity:A}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:d,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,badgeBackgroundOpacity:1,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:t,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:d,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:B,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:f,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:e,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:v,halo:!1,haloLineWidth:12,haloStroke:y,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:t,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:y},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:p,fillOpacity:.25,labelOpacity:.25,stroke:m,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const Uae={type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},Pae={bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:Uae,nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"},Rae=TU(Pae),Dae={bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"},Hae=TU(Dae);class ls extends yB{beforeDraw(e,t){return e}afterLayout(e,t){}}class Gae extends ls{beforeDraw(e){const{model:t}=this.context,n=e.add.combos,i=a=>{const s=[];return a.forEach((o,A)=>{const c=t.getAncestorsData(A,"combo").map(u=>Z(u)).reverse();s.push([A,o,c.length])}),new Map(s.sort(([,,o],[,,A])=>A-o).map(([o,A])=>[o,A]))};return e.add.combos=i(n),e.update.combos=i(e.update.combos),e}}function Hr(r,e,t,n,i){const a=Z(n),s=`${t}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([A,l])=>{e===A?l[s].set(a,o):l[s].delete(a)})}function Du(r,e){return Object.keys(r).every(t=>r[t]===e[t])}class Kae extends ls{beforeDraw(e,t){if(t.stage==="visibility"||!this.context.model.model.hasTreeStructure(Et))return e;const{model:n}=this.context,{add:i,update:a}=e,s=[...e.update.combos.entries(),...e.add.combos.entries()];for(;s.length;){const[o,A]=s.pop();if(xr(A)){const l=n.getDescendantsData(o),c=l.map(Z),{internal:u,external:h}=h1(c,d=>n.getRelatedEdgesData(d));l.forEach(d=>{const f=Z(d),g=s.findIndex(([p])=>p===f);g!==-1&&s.splice(g,1);const v=n.getElementType(f);Hr(e,"remove",v,d)}),u.forEach(d=>Hr(e,"remove","edge",d)),h.forEach(d=>{var f;const g=Z(d);((f=this.context.element)===null||f===void 0?void 0:f.getElement(g))?a.edges.set(g,d):i.edges.set(g,d)})}else{const l=n.getChildrenData(o),c=l.map(Z),{edges:u}=h1(c,h=>n.getRelatedEdgesData(h));[...l,...u].forEach(h=>{var d;const f=Z(h),g=n.getElementType(f);((d=this.context.element)===null||d===void 0?void 0:d.getElement(f))?Hr(e,"update",g,h):Hr(e,"add",g,h),g==="combo"&&s.push([f,h])})}}return e}}const JO=(r,e,t,n)=>{const i=`${t}s`,a=Z(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[e][i].set(Z(n),n)};class zae extends ls{getElement(e){return this.context.element.getElement(e)}handleExpand(e,t){if(JO(t,"add","node",e),xr(e))return;const n=Z(e);JO(t,"add","node",e),this.context.model.getRelatedEdgesData(n).forEach(s=>{Hr(t,"add","edge",s)}),this.context.model.getChildrenData(n).forEach(s=>{this.handleExpand(s,t)})}beforeDraw(e){const{graph:t,model:n}=this.context;if(!n.model.hasTreeStructure(Rr))return e;const{add:{nodes:i,edges:a},update:{nodes:s}}=e,o=new Map,A=new Map;i.forEach((c,u)=>{xr(c)&&o.set(u,c)}),a.forEach(c=>{if(t.getElementType(c.source)!=="node")return;const u=t.getNodeData(c.source);xr(u)&&o.set(c.source,u)}),s.forEach((c,u)=>{const h=this.getElement(u);if(!h)return;const d=h.attributes.collapsed;xr(c)?d||o.set(u,c):d&&A.set(u,c)});const l=new Set;return o.forEach((c,u)=>{n.getDescendantsData(u).forEach(d=>{const f=Z(d);if(l.has(f))return;Hr(e,"remove","node",d),n.getRelatedEdgesData(f).forEach(v=>{Hr(e,"remove","edge",v)}),l.add(f)})}),A.forEach((c,u)=>{if(n.getAncestorsData(u,Rr).some(xr)){Hr(e,"remove","node",c);return}this.handleExpand(c,e)}),e}}function MU(r,e,t){a1[r][e]&&$i.warn(`The extension ${e} of ${r} has been registered before, and will be overridden.`),Object.assign(a1[r],{[e]:t})}var OU=(function(){function r(e){ue(this,r),this.dragndropPluginOptions=e}return he(r,[{key:"apply",value:function(t){var n=this,i=t.renderingService,a=t.renderingContext,s=a.root.ownerDocument,o=s.defaultView,A=function(c){var u=c.target,h=u===s,d=h&&n.dragndropPluginOptions.isDocumentDraggable?s:u.closest&&u.closest("[draggable=true]");if(d){var f=!1,g=c.timeStamp,v=[c.clientX,c.clientY],p=null,y=[c.clientX,c.clientY],m=(function(){var C=Ja(Gn().mark(function S(F){var T,O,_,k,L,U;return Gn().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(f){G.next=2;break}if(T=F.timeStamp-g,O=wr([F.clientX,F.clientY],v),!(T<=n.dragndropPluginOptions.dragstartTimeThreshold||O<=n.dragndropPluginOptions.dragstartDistanceThreshold)){G.next=1;break}return G.abrupt("return");case 1:F.type="dragstart",d.dispatchEvent(F),f=!0;case 2:if(F.type="drag",F.dx=F.clientX-y[0],F.dy=F.clientY-y[1],d.dispatchEvent(F),y=[F.clientX,F.clientY],h){G.next=4;break}return _=n.dragndropPluginOptions.overlap==="pointer"?[F.canvasX,F.canvasY]:u.getBounds().center,G.next=3,s.elementsFromPoint(_[0],_[1]);case 3:k=G.sent,L=k[k.indexOf(u)+1],U=(L==null?void 0:L.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),p!==U&&(p&&(F.type="dragleave",F.target=p,p.dispatchEvent(F)),U&&(F.type="dragenter",F.target=U,U.dispatchEvent(F)),p=U,p&&(F.type="dragover",F.target=p,p.dispatchEvent(F)));case 4:case"end":return G.stop()}},S)}));return function(F){return C.apply(this,arguments)}})();o.addEventListener("pointermove",m);var B=function(S){if(f){S.detail={preventClick:!0};var F=S.clone();p&&(F.type="drop",F.target=p,p.dispatchEvent(F)),F.type="dragend",d.dispatchEvent(F),f=!1}o.removeEventListener("pointermove",m)};u.addEventListener("pointerup",B,{once:!0}),u.addEventListener("pointerupoutside",B,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",A)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",A)})}}])})();OU.tag="Dragndrop";var Vae=(function(r){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ue(this,e),t=qe(this,e),t.name="dragndrop",t.options=n,t}return $e(e,r),he(e,[{key:"init",value:function(){this.addRenderingPlugin(new OU(De({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(n){Object.assign(this.plugins[0].dragndropPluginOptions,n)}}])})(rs),e_=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})},t_=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};const n_=["main"],r_=["background","main","label","transient"];function jae(r){return r.main}class i_{getConfig(){return this.config}getLayer(e="main"){return this.extends.layers[e]||jae(this.getLayers())}getLayers(){return this.extends.layers}getRenderer(e){return this.extends.renderers[e]}getCamera(e="main"){return this.getLayer(e).getCamera()}getRoot(e="main"){return this.getLayer(e).getRoot()}getContextService(e="main"){return this.getLayer(e).getContextService()}setCursor(e){this.config.cursor=e,this.getLayer().setCursor(e)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(e){this.config={enableMultiLayer:!0},Object.assign(this.config,e);const t=this.config,{renderer:n,background:i,cursor:a,enableMultiLayer:s}=t,o=t_(t,["renderer","background","cursor","enableMultiLayer"]),A=s?r_:n_,l=a_(n,A),c=Object.fromEntries(A.map(u=>{const h=new Dw(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:l[u],background:s?u==="background"?i:void 0:i}));return[u,h]}));s_(c),this.extends={config:this.config,renderer:n,renderers:l,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,e])=>e.ready))}resize(e,t){Object.assign(this.extends.config,{width:e,height:t}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(e,t),i.setPosition(a),i.setFocalPoint(s)})}getBounds(e){return Ql(Object.values(this.getLayers()).map(t=>e?t.getRoot().childNodes.find(i=>i.classList.includes(e)):t.getRoot()).filter(t=>(t==null?void 0:t.childNodes.length)>0).map(t=>t.getBounds()))}getContainer(){const e=this.extends.config.container;return typeof e=="string"?document.getElementById(e):e}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(e,t){var n;const i=((n=e.style)===null||n===void 0?void 0:n.$layer)||"main";return this.getLayer(i).appendChild(e,t)}setRenderer(e){if(e===this.extends.renderer)return;const t=a_(e,this.config.enableMultiLayer?r_:n_);this.extends.renderers=t,Object.entries(t).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),s_(this.getLayers())}getCanvasByViewport(e){return Hn(this.getLayer().viewport2Canvas(pi(e)))}getViewportByCanvas(e){return Hn(this.getLayer().canvas2Viewport(pi(e)))}getViewportByClient(e){return Hn(this.getLayer().client2Viewport(pi(e)))}getClientByViewport(e){return Hn(this.getLayer().viewport2Client(pi(e)))}getClientByCanvas(e){return this.getClientByViewport(this.getViewportByCanvas(e))}getCanvasByClient(e){const t=this.getLayer(),n=t.client2Viewport(pi(e));return Hn(t.viewport2Canvas(n))}toDataURL(){return e_(this,arguments,void 0,function*(e={}){const t=globalThis.devicePixelRatio||1,{mode:n="viewport"}=e,i=t_(e,["mode"]);let[a,s,o,A]=[0,0,0,0];if(n==="viewport")[o,A]=this.getSize();else if(n==="overall"){const p=this.getBounds(),y=is(p);[a,s]=p.min,[o,A]=y}const l=xw('<div id="virtual-image"></div>'),c=new Dw({width:o,height:A,renderer:new vl,devicePixelRatio:t,container:l,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const u=this.getLayer("label").getRoot().cloneNode(!0),h=c.viewport2Canvas({x:0,y:0}),d=this.getCanvasByViewport([0,0]);u.translate([d[0]-h.x,d[1]-h.y]),u.scale(1/this.getCamera().getZoom()),c.appendChild(u),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const f=this.getCamera(),g=c.getCamera();if(n==="viewport")g.setZoom(f.getZoom()),g.setPosition(f.getPosition()),g.setFocalPoint(f.getFocalPoint());else if(n==="overall"){const[p,y,m]=g.getPosition(),[B,C,S]=g.getFocalPoint();g.setPosition([p+a,y+s,m]),g.setFocalPoint([B+a,C+s,S])}const v=c.getContextService();return new Promise(p=>{c.addEventListener(Pr.RERENDER,()=>e_(this,void 0,void 0,function*(){yield new Promise(m=>setTimeout(m,300));const y=yield v.toDataURL(i);p(y)}))})})}destroy(){Object.values(this.getLayers()).forEach(e=>{e.getCamera().cancelLandmarkAnimation(),e.destroy()})}}function a_(r,e){return Object.fromEntries(e.map(t=>{const n=(r==null?void 0:r(t))||new vl;return n instanceof vl&&n.setConfig({enableDirtyRectangleRendering:!1}),t==="main"?n.registerPlugin(new Vae({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[t,n]}))}function s_(r){Object.entries(r).forEach(([e,t])=>{const n=t.getContextService().getDomElement();n!=null&&n.style&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,e!=="main"&&(n.style.pointerEvents="none")),n!=null&&n.parentElement&&(n.parentElement.style.display="grid",n.parentElement.style.isolation="isolate")})}const wo=r=>r?parseInt(r):0;function Wae(r){const e=getComputedStyle(r),t=r.clientWidth||wo(e.width),n=r.clientHeight||wo(e.height),i=wo(e.paddingLeft)+wo(e.paddingRight),a=wo(e.paddingTop)+wo(e.paddingBottom);return[t-i,n-a]}function o_(r){if(!r)return[0,0];let e=640,t=480;const[n,i]=Wae(r);e=n||e,t=i||t;const a=1,s=1;return[Math.max(Be(e)?e:a,a),Math.max(Be(t)?t:s,s)]}class wf{constructor(e){this.type=e}}class yn extends wf{constructor(e,t){super(e),this.data=t}}class Xr extends wf{constructor(e,t,n,i){super(e),this.animationType=t,this.animation=n,this.data=i}}class Bo extends wf{constructor(e,t,n){super(e),this.elementType=t,this.data=n}}class Eu extends wf{constructor(e,t){super(e),this.data=t}}function Cn(r,e){r.emit(e.type,e)}function qae(r){if(!r)return null;if(r instanceof kI)return{type:"canvas",element:r};let e=r;for(;e;){if(Hl(e))return{type:"node",element:e};if(DL(e))return{type:"edge",element:e};if(FB(e))return{type:"combo",element:e};e=e.parentElement}return null}function A_(r){var e;return((e=r==null?void 0:r.style)===null||e===void 0?void 0:e.zIndex)||0}const il="cachedStyle",gb=r=>`__${r}__`;function $ae(r,e){const t=Array.isArray(e)?e:[e];Rn(r,il)||ol(r,il,{}),t.forEach(n=>{ol(Rn(r,il),gb(n),r.attributes[n])})}function l_(r,e){return Rn(r,[il,gb(e)])}function Yae(r,e){return gb(e)in(Rn(r,il)||{})}class Xae{constructor(e){this.tasks=[],this.animations=new Set,this.context=e}getTasks(){const e=[...this.tasks];return this.tasks=[],e}add(e,t){this.tasks.push([e,t])}animate(e,t,n){var i,a,s;(i=t==null?void 0:t.before)===null||i===void 0||i.call(t);const o=this.getTasks().map(([l,c])=>{var u,h,d;const{element:f,elementType:g,stage:v}=l,p=lV(this.context.options,g,v,e);(u=c==null?void 0:c.before)===null||u===void 0||u.call(c);const y=p.length?uV(f,this.inferStyle(l,n),p):null;return y?((h=c==null?void 0:c.beforeAnimate)===null||h===void 0||h.call(c,y),y.finished.then(()=>{var m,B;(m=c==null?void 0:c.afterAnimate)===null||m===void 0||m.call(c,y),(B=c==null?void 0:c.after)===null||B===void 0||B.call(c),this.animations.delete(y)})):(d=c==null?void 0:c.after)===null||d===void 0||d.call(c),y}).filter(Boolean);o.forEach(l=>this.animations.add(l));const A=fB(o);return A?((a=t==null?void 0:t.beforeAnimate)===null||a===void 0||a.call(t,A),A.finished.then(()=>{var l,c;(l=t==null?void 0:t.afterAnimate)===null||l===void 0||l.call(t,A),(c=t==null?void 0:t.after)===null||c===void 0||c.call(t),this.release()})):(s=t==null?void 0:t.after)===null||s===void 0||s.call(t),A}inferStyle(e,t){var n,i;const{element:a,elementType:s,stage:o,originalStyle:A,updatedStyle:l={}}=e;e.modifiedStyle||(e.modifiedStyle=Object.assign(Object.assign({},A),l));const{modifiedStyle:c}=e,u={},h={};if(o==="enter")Object.assign(u,{opacity:0});else if(o==="exit")Object.assign(h,{opacity:0});else if(o==="show")Object.assign(u,{opacity:0}),Object.assign(h,{opacity:(n=l_(a,"opacity"))!==null&&n!==void 0?n:fl("opacity")});else if(o==="hide")Object.assign(u,{opacity:(i=l_(a,"opacity"))!==null&&i!==void 0?i:fl("opacity")}),Object.assign(h,{opacity:0});else if(o==="collapse"){const{collapse:d}=t||{},{target:f,descendants:g,position:v}=d;if(s==="node"){if(g.includes(a.id)){const[p,y,m]=v;Object.assign(h,{x:p,y,z:m})}}else if(s==="combo"){if(a.id===f||g.includes(a.id)){const[p,y]=v;Object.assign(h,{x:p,y,childrenNode:A.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if(o==="expand"){const{expand:d}=t||{},{target:f,descendants:g,position:v}=d;if(s==="node"){if(a.id===f||g.includes(a.id)){const[p,y,m]=v;Object.assign(u,{x:p,y,z:m})}}else if(s==="combo"){if(a.id===f||g.includes(a.id)){const[p,y,m]=v;Object.assign(u,{x:p,y,z:m,childrenNode:c.childrenNode})}}else s==="edge"&&Object.assign(u,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(u).length>0?Object.assign({},A,u):A,Object.keys(h).length>0?Object.assign({},c,h):c]}stop(){this.animations.forEach(e=>e.cancel())}clear(){this.tasks=[]}release(){var e,t;const{canvas:n}=this.context,i=(t=(e=n.document)===null||e===void 0?void 0:e.timeline)===null||t===void 0?void 0:t.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class Zae{constructor(e){this.batchCount=0,this.context=e}emit(e){const{graph:t}=this.context;t.emit(e.type,e)}startBatch(e=!0){this.batchCount++,this.batchCount===1&&this.emit(new yn(ge.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new yn(ge.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class Jae extends pB{constructor(e){super(e),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=t=>{const{target:n}=t,i=qae(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:A}=i;if("destroyed"in A&&(Gl(A)||A.destroyed))return;const{type:l,detail:c,button:u}=t,h=Object.assign(Object.assign({},t),{target:A,targetType:o,originalTarget:n});l===se.POINTER_MOVE&&(this.currentTarget!==A&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${se.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:se.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),A&&(Object.assign(h,{type:se.POINTER_ENTER}),a.emit(`${o}:${se.POINTER_ENTER}`,h))),this.currentTarget=A,this.currentTargetType=o),l===se.CLICK&&u===2||(a.emit(`${o}:${l}`,h),a.emit(l,h)),l===se.CLICK&&c===2&&(Object.assign(h,{type:se.DBLCLICK}),a.emit(`${o}:${se.DBLCLICK}`,h),a.emit(se.DBLCLICK,h)),l===se.POINTER_DOWN&&u===2&&(Object.assign(h,{type:se.CONTEXT_MENU,preventDefault:()=>{var d;(d=s.getContainer())===null||d===void 0||d.addEventListener(se.CONTEXT_MENU,f=>f.preventDefault(),{once:!0})}}),a.emit(`${o}:${se.CONTEXT_MENU}`,h),a.emit(se.CONTEXT_MENU,h))},this.forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(e){this.setExtensions(e)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[Oo.KEY_DOWN,Oo.KEY_UP].forEach(n=>{e.addEventListener(n,this.forwardContainerEvents)});const t=this.context.canvas.document;t&&[se.CLICK,se.DBLCLICK,se.POINTER_OVER,se.POINTER_LEAVE,se.POINTER_ENTER,se.POINTER_MOVE,se.POINTER_OUT,se.POINTER_DOWN,se.POINTER_UP,se.CONTEXT_MENU,se.DRAG_START,se.DRAG,se.DRAG_END,se.DRAG_ENTER,se.DRAG_OVER,se.DRAG_LEAVE,se.DROP,se.WHEEL].forEach(n=>{t.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const e=this.context.canvas.getContainer();e&&[Oo.KEY_DOWN,Oo.KEY_UP].forEach(t=>{e.removeEventListener(t,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var ese=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function uw(r){const{id:e=Z(r),style:t,data:n}=r,i=ese(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},t),data:Object.assign({},n)});return pV(r)?Object.assign({id:e,data:a},i):{id:e,data:a}}function On(r){return r.data}function tse(r){if(r.hasTreeStructure(Rr))return;r.attachTreeStructure(Rr);const e=r.getAllEdges();for(const t of e){const{source:n,target:i}=t;r.setParent(i,n,Rr)}}class nse{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new Mn}pushChange(e){if(this.isTraceless)return;const{type:t}=e;if(t===Ut.NodeUpdated||t===Ut.EdgeUpdated||t===Ut.ComboUpdated){const{value:n,original:i}=e;this.changes.push({value:bg(n),original:bg(i),type:t})}else this.changes.push({value:bg(e.value),type:t})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(e){this.batchCount++,this.model.batch(e),this.batchCount--}isBatching(){return this.batchCount>0}silence(e){this.isTraceless=!0,e(),this.isTraceless=!1}isCombo(e){return this.comboIds.has(e)||this.latestRemovedComboIds.has(e)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=On(n);return this.isCombo(Z(i))||(e===void 0||e.includes(Z(i)))&&t.push(i),t},[])}getEdgeDatum(e){return On(this.model.getEdge(e))}getEdgeData(e){return this.model.getAllEdges().reduce((t,n)=>{const i=On(n);return(e===void 0||e.includes(Z(i)))&&t.push(i),t},[])}getComboData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=On(n);return this.isCombo(Z(i))&&(e===void 0||e.includes(Z(i)))&&t.push(i),t},[])}getRootsData(e=Rr){return this.model.getRoots(e).map(On)}getAncestorsData(e,t){const{model:n}=this;return!n.hasNode(e)||!n.hasTreeStructure(t)?[]:n.getAncestors(e,t).map(On)}getDescendantsData(e){const t=this.getElementDataById(e),n=[];return Ns(t,i=>{i!==t&&n.push(i)},i=>this.getChildrenData(Z(i)),"TB"),n}getParentData(e,t){const{model:n}=this;if(!t){$i.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(e)||!n.hasTreeStructure(t))return;const i=n.getParent(e,t);return i?On(i):void 0}getChildrenData(e){const t=this.getElementType(e)==="node"?Rr:Et,{model:n}=this;return!n.hasNode(e)||!n.hasTreeStructure(t)?[]:n.getChildren(e,t).map(On)}getElementsDataByType(e){return e==="node"?this.getNodeData():e==="edge"?this.getEdgeData():e==="combo"?this.getComboData():[]}getElementDataById(e){return this.getElementType(e)==="edge"?this.getEdgeDatum(e):this.getNodeLikeDatum(e)}getNodeLikeDatum(e){const t=this.model.getNode(e);return On(t)}getNodeLikeData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=On(n);return e?e.includes(Z(i))&&t.push(i):t.push(i),t},[])}getElementDataByState(e,t){return this.getElementsDataByType(e).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(t)})}getElementState(e){var t;return((t=this.getElementDataById(e))===null||t===void 0?void 0:t.states)||[]}hasNode(e){return this.model.hasNode(e)&&!this.isCombo(e)}hasEdge(e){return this.model.hasEdge(e)}hasCombo(e){return this.model.hasNode(e)&&this.isCombo(e)}getRelatedEdgesData(e,t="both"){return this.model.getRelatedEdges(e,t).map(On)}getNeighborNodesData(e){return this.model.getNeighbors(e).map(On)}setData(e){const{nodes:t=[],edges:n=[],combos:i=[]}=e,{nodes:a,edges:s,combos:o}=this.getData(),A=qa(a,t,u=>Z(u),po),l=qa(s,n,u=>Z(u),po),c=qa(o,i,u=>Z(u),po);this.batch(()=>{const u={nodes:A.enter,edges:l.enter,combos:c.enter};this.addData(u),this.computeZIndex(u,"add",!0);const h={nodes:A.update,edges:l.update,combos:c.update};this.updateData(h),this.computeZIndex(h,"update",!0);const d={nodes:A.exit.map(Z),edges:l.exit.map(Z),combos:c.exit.map(Z)};this.removeData(d)})}addData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.addComboData(i),this.addNodeData(t),this.addEdgeData(n)}),this.computeZIndex(e,"add")}addNodeData(e=[]){e.length&&(this.model.addNodes(e.map(t=>(this.pushChange({value:t,type:Ut.NodeAdded}),uw(t)))),this.updateNodeLikeHierarchy(e),this.computeZIndex({nodes:e},"add"))}addEdgeData(e=[]){e.length&&(this.model.addEdges(e.map(t=>(this.pushChange({value:t,type:Ut.EdgeAdded}),uw(t)))),this.computeZIndex({edges:e},"add"))}addComboData(e=[]){if(!e.length)return;const{model:t}=this;t.hasTreeStructure(Et)||t.attachTreeStructure(Et),t.addNodes(e.map(n=>(this.comboIds.add(Z(n)),this.pushChange({value:n,type:Ut.ComboAdded}),uw(n)))),this.updateNodeLikeHierarchy(e),this.computeZIndex({combos:e},"add")}addChildrenData(e,t){const n=this.getNodeLikeDatum(e),i=t.map(Z);this.addNodeData(t),this.updateNodeData([{id:e,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:e,target:a})))}computeZIndex(e,t,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=e;s.forEach(o=>{var A,l,c;const u=Z(o);if(t==="add"&&Be((A=o.style)===null||A===void 0?void 0:A.zIndex)||t==="update"&&!("combo"in o))return;const h=this.getParentData(u,Et),d=h?((c=(l=h.style)===null||l===void 0?void 0:l.zIndex)!==null&&c!==void 0?c:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:u,style:{zIndex:d}}])})}),i.forEach(o=>{var A,l,c;const u=Z(o);if(t==="add"&&Be((A=o.style)===null||A===void 0?void 0:A.zIndex)||t==="update"&&!("combo"in o)&&!("children"in o))return;let h=0;const d=this.getParentData(u,Et);if(d)h=(((l=d.style)===null||l===void 0?void 0:l.zIndex)||0)+1;else{const f=this.getParentData(u,Rr);f&&(h=((c=f==null?void 0:f.style)===null||c===void 0?void 0:c.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:u,style:{zIndex:h}}])})}),a.forEach(o=>{var A,l,c,u,h;if(Be((A=o.style)===null||A===void 0?void 0:A.zIndex))return;let{id:d,source:f,target:g}=o;if(!d)d=Z(o);else{const y=this.getEdgeDatum(d);f=y.source,g=y.target}if(!f||!g)return;const v=((c=(l=this.getNodeLikeDatum(f))===null||l===void 0?void 0:l.style)===null||c===void 0?void 0:c.zIndex)||0,p=((h=(u=this.getNodeLikeDatum(g))===null||u===void 0?void 0:u.style)===null||h===void 0?void 0:h.zIndex)||0;this.updateEdgeData([{id:Z(o),style:{zIndex:Math.max(v,p)-1}}])})})}getFrontZIndex(e){var t;const n=this.getElementType(e),i=this.getElementDataById(e),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>Z(s)!==e)}),n==="combo"&&!xr(i)){const s=new Set(this.getAncestorsData(e,Et).map(Z));a.nodes=a.nodes.filter(o=>!s.has(Z(o))),a.combos=a.combos.filter(o=>!s.has(Z(o))),a.edges=a.edges.filter(({source:o,target:A})=>!s.has(o)&&!s.has(A))}return Math.max(((t=i.style)===null||t===void 0?void 0:t.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(e){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:t}=this;e.forEach(n=>{const i=Z(n),a=nu(n);a!==void 0&&(t.hasTreeStructure(Et)||t.attachTreeStructure(Et),a===null&&this.refreshComboData(i),this.setParent(i,nu(n),Et));const s=n.children||[];if(s.length){t.hasTreeStructure(Rr)||t.attachTreeStructure(Rr);const o=s.filter(A=>t.hasNode(A));o.forEach(A=>this.setParent(A,i,Rr)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(e){this.enableUpdateNodeLikeHierarchy=!1,e(),this.enableUpdateNodeLikeHierarchy=!0}updateData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.updateNodeData(t),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(e,"update")}updateNodeData(e=[]){if(!e.length)return;const{model:t}=this;this.batch(()=>{const n=[];e.forEach(i=>{const a=Z(i),s=On(t.getNode(a));if(po(s,i))return;const o=ba(s,i);this.pushChange({value:o,original:s,type:Ut.NodeUpdated}),t.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:e},"update")}refreshData(){const{nodes:e,edges:t,combos:n}=this.getData();e.forEach(i=>{this.pushChange({value:i,original:i,type:Ut.NodeUpdated})}),t.forEach(i=>{this.pushChange({value:i,original:i,type:Ut.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Ut.ComboUpdated})})}syncNodeLikeDatum(e){const{model:t}=this,n=Z(e);if(!t.hasNode(n))return;const i=On(t.getNode(n)),a=ba(i,e);t.mergeNodeData(n,a)}syncEdgeDatum(e){const{model:t}=this,n=Z(e);if(!t.hasEdge(n))return;const i=On(t.getEdge(n)),a=ba(i,e);t.mergeEdgeData(n,a)}updateEdgeData(e=[]){if(!e.length)return;const{model:t}=this;this.batch(()=>{e.forEach(n=>{const i=Z(n),a=On(t.getEdge(i));if(po(a,n))return;n.source&&a.source!==n.source&&t.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&t.updateEdgeTarget(i,n.target);const s=ba(a,n);this.pushChange({value:s,original:a,type:Ut.EdgeUpdated}),t.mergeEdgeData(i,s)})}),this.computeZIndex({edges:e},"update")}updateComboData(e=[]){if(!e.length)return;const{model:t}=this;t.batch(()=>{const n=[];e.forEach(i=>{const a=Z(i),s=On(t.getNode(a));if(po(s,i))return;const o=ba(s,i);this.pushChange({value:o,original:s,type:Ut.ComboUpdated}),t.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:e},"update")}setParent(e,t,n,i=!0){if(e===t)return;const a=this.getNodeLikeDatum(e),s=nu(a);if(s!==t&&n===Et){const o={id:e,combo:t};this.isCombo(e)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(e,t,n),i&&n===Et&&lR([s,t]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(e){const t=this.getComboData([e])[0],n=this.getAncestorsData(e,Et);t&&this.pushChange({value:t,original:t,type:Ut.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Ut.ComboUpdated})})}getElementPosition(e){const t=this.getElementDataById(e);return Sn(t)}translateNodeLikeBy(e,t){this.isCombo(e)?this.translateComboBy(e,t):this.translateNodeBy(e,t)}translateNodeLikeTo(e,t){this.isCombo(e)?this.translateComboTo(e,t):this.translateNodeTo(e,t)}translateNodeBy(e,t){const n=this.getElementPosition(e),i=Ve(n,[...t,0].slice(0,3));this.translateNodeTo(e,i)}translateNodeTo(e,t){const[n=0,i=0,a=0]=t;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:e,style:{x:n,y:i,z:a}}])})}translateComboBy(e,t){const[n=0,i=0,a=0]=t;if([n,i,a].some(isNaN)||[n,i,a].every(A=>A===0))return;const s=this.getComboData([e])[0];if(!s)return;const o=new Set;Ns(s,A=>{const l=Z(A);if(o.has(l))return;o.add(l);const[c,u,h]=Sn(A),d=ba(A,{style:{x:c+n,y:u+i,z:h+a}});this.pushChange({value:d,original:A,type:this.isCombo(l)?Ut.ComboUpdated:Ut.NodeUpdated}),this.model.mergeNodeData(l,d)},A=>this.getChildrenData(Z(A)),"BT")}translateComboTo(e,t){var n;if(t.some(isNaN))return;const[i=0,a=0,s=0]=t,o=(n=this.getComboData([e]))===null||n===void 0?void 0:n[0];if(!o)return;const[A,l,c]=Sn(o),u=i-A,h=a-l,d=s-c;Ns(o,f=>{const g=Z(f),[v,p,y]=Sn(f),m=ba(f,{style:{x:v+u,y:p+h,z:y+d}});this.pushChange({value:m,original:f,type:this.isCombo(g)?Ut.ComboUpdated:Ut.NodeUpdated}),this.model.mergeNodeData(g,m)},f=>this.getChildrenData(Z(f)),"BT")}removeData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(t),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(e=[]){e.length&&this.batch(()=>{e.forEach(t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(Z)),this.pushChange({value:this.getNodeData([t])[0],type:Ut.NodeRemoved}),this.removeNodeLikeHierarchy(t)}),this.model.removeNodes(e)})}removeEdgeData(e=[]){e.length&&(e.forEach(t=>this.pushChange({value:this.getEdgeData([t])[0],type:Ut.EdgeRemoved})),this.model.removeEdges(e))}removeComboData(e=[]){e.length&&this.batch(()=>{e.forEach(t=>{this.pushChange({value:this.getComboData([t])[0],type:Ut.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)}),this.model.removeNodes(e)})}removeNodeLikeHierarchy(e){if(this.model.hasTreeStructure(Et)){const t=nu(this.getNodeLikeDatum(e));this.setParent(e,void 0,Et,!1),this.model.getChildren(e,Et).forEach(n=>{const i=On(n),a=Z(i);this.setParent(Z(i),t,Et,!1);const s=ba(i,{id:Z(i),combo:t});this.pushChange({value:s,original:i,type:this.isCombo(a)?Ut.ComboUpdated:Ut.NodeUpdated}),this.model.mergeNodeData(Z(i),s)}),ke(t)||this.refreshComboData(t)}}getElementType(e){if(this.model.hasNode(e))return this.isCombo(e)?"combo":"node";if(this.model.hasEdge(e))return"edge";throw new Error(ha(`Unknown element type of id: ${e}`))}destroy(){const{model:e}=this,t=e.getAllNodes(),n=e.getAllEdges();e.removeEdges(n.map(i=>i.id)),e.removeNodes(t.map(i=>i.id)),this.context={}}}var bo=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class rse{constructor(e){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=e}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:e}=this.context;this.container=e.appendChild(new Tn({className:"elements"}))}}emit(e,t){t.silence||Cn(this.context.graph,e)}forEachElementData(e){Ws.forEach(t=>{const n=this.context.model.getElementsDataByType(t);e(t,n)})}getElementType(e,t){var n;const{options:i,graph:a}=this.context,s=Gx(t)&&((n=i[e])===null||n===void 0?void 0:n.type)||t.type;return s?typeof s=="string"?s:s.call(a,t):e==="edge"?"line":"circle"}getTheme(e){return Wk(this.context.options)[e]||{}}getThemeStyle(e){return this.getTheme(e).style||{}}getThemeStateStyle(e,t){const{state:n={}}=this.getTheme(e);return Object.assign({},...t.map(i=>n[i]||{}))}computePaletteStyle(){const{options:e}=this.context;this.paletteStyle={},this.forEachElementData((t,n)=>{var i,a;const s=Object.assign({},Ex((i=this.getTheme(t))===null||i===void 0?void 0:i.palette),Ex((a=e[t])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,uj(n,s))})}getPaletteStyle(e,t){const n=this.paletteStyle[t];return n?e==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(e,t){var n;const{options:i}=this.context,a=((n=i[e])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[Z(t.datum)]=bx(a,t)}computeElementsDefaultStyle(e){const{graph:t}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];(e===void 0||e.includes(Z(o)))&&this.computeElementDefaultStyle(n,{datum:o,graph:t})}})}getDefaultStyle(e){return this.defaultStyle[e]||{}}getElementState(e){try{const{model:t}=this.context;return t.getElementState(e)}catch{return[]}}getElementStateStyle(e,t,n){var i,a;const{options:s}=this.context,o=((a=(i=s[e])===null||i===void 0?void 0:i.state)===null||a===void 0?void 0:a[t])||{};return bx(o,n)}computeElementStatesStyle(e,t,n){this.stateStyle[Z(n.datum)]=Object.assign({},...t.map(i=>this.getElementStateStyle(e,i,n)))}computeElementsStatesStyle(e){const{graph:t}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];if(e===void 0||e.includes(Z(o))){const A=this.getElementState(Z(o));this.computeElementStatesStyle(n,A,{datum:o,graph:t})}}})}getStateStyle(e){return this.stateStyle[e]||{}}computeStyle(e,t){e&&["translate","zIndex"].includes(e)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(t),this.computeElementsStatesStyle(t))}getElement(e){return this.elementMap[e]}getNodes(){return this.context.model.getNodeData().map(({id:e})=>this.elementMap[e])}getEdges(){return this.context.model.getEdgeData().map(e=>this.elementMap[Z(e)])}getCombos(){return this.context.model.getComboData().map(({id:e})=>this.elementMap[e])}getElementComputedStyle(e,t){const n=Z(t),i=this.getThemeStyle(e),a=this.getPaletteStyle(e,n),s=t.style||{},o=this.getDefaultStyle(n),A=this.getThemeStateStyle(e,this.getElementState(n)),l=this.getStateStyle(n),c=Gx(t)?Object.assign({},i,a,s,o,A,l):Object.assign({},s);if(e==="combo"){const u=this.context.model.getChildrenData(n),d=!!c.collapsed?[]:u.map(Z).filter(f=>this.getElement(f));Object.assign(c,{childrenNode:d,childrenData:u})}return c}getDrawData(e){this.init();const t=this.computeChangesAndDrawData(e);if(!t)return null;const{type:n="draw",stage:i=n}=e;return this.markDestroyElement(t.drawData),this.computeStyle(i),{type:n,stage:i,data:t}}draw(e={animation:!0}){const t=this.getDrawData(e);if(!t)return;const{data:{drawData:{add:n,update:i,remove:a}}}=t;return this.destroyElements(a,e),this.createElements(n,e),this.updateElements(i,e),this.setAnimationTask(e,t)}preLayoutDraw(){return bo(this,arguments,void 0,function*(e={animation:!0}){var t,n;const i=this.getDrawData(e);if(!i)return;const{data:{drawData:a}}=i;yield(n=(t=this.context.layout)===null||t===void 0?void 0:t.preLayout)===null||n===void 0?void 0:n.call(t,a);const{add:s,update:o,remove:A}=a;return this.destroyElements(A,e),this.createElements(s,e),this.updateElements(o,e),this.setAnimationTask(e,i)})}setAnimationTask(e,t){const{animation:n,silence:i}=e,{data:{dataChanges:a,drawData:s},stage:o,type:A}=t;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new yn(ge.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:A==="render"}),e),beforeAnimate:l=>this.emit(new Xr(ge.BEFORE_ANIMATE,mr.DRAW,l,s),e),afterAnimate:l=>this.emit(new Xr(ge.AFTER_ANIMATE,mr.DRAW,l,s),e),after:()=>this.emit(new yn(ge.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:A==="render",firstRender:this.context.graph.rendered===!1}),e)})}computeChangesAndDrawData(e){const{model:t}=this.context,n=t.getChanges(),i=tb(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:A=[],EdgeUpdated:l=[],EdgeRemoved:c=[],ComboAdded:u=[],ComboUpdated:h=[],ComboRemoved:d=[]}=Nh(i,C=>C.type),f=(C,S)=>{const F=[];return C.forEach(T=>{const O=Z(T.value);this.getElement(O)?F.push(T):S.push(T)}),F},g=f(s,a),v=f(l,A),p=f(h,u),y=C=>new Map(C.map(S=>{const F=S.value;return[Z(F),F]})),m={add:{nodes:y(a),edges:y(A),combos:y(u)},update:{nodes:y(g),edges:y(v),combos:y(p)},remove:{nodes:y(o),edges:y(c),combos:y(d)}},B=this.transformData(m,e);return t.clearChanges(),{dataChanges:n,drawData:B}}transformData(e,t){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,t),e)}createElement(e,t,n){var i;const a=Z(t);if(this.getElement(a))return;const o=this.getElementType(e,t),A=this.getElementComputedStyle(e,t),l=va(e,o);if(!l)return $i.warn(`The element ${o} of ${e} is not registered.`);this.emit(new Bo(ge.BEFORE_ELEMENT_CREATE,e,t),n);const c=this.container.appendChild(new l({id:a,context:this.context,style:A}));this.shapeTypeMap[a]=o,this.elementMap[a]=c;const{stage:u="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:c,elementType:e,stage:u,originalStyle:Object.assign({},c.attributes),updatedStyle:A},{after:()=>{var h;this.emit(new Bo(ge.AFTER_ELEMENT_CREATE,e,t),n),(h=c.onCreate)===null||h===void 0||h.call(c)}})}createElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["node",n],["combo",a],["edge",i]].forEach(([o,A])=>{A.forEach(l=>this.createElement(o,l,t))})}getUpdateStageStyle(e,t,n){const{stage:i="update"}=n;if(i==="translate")if(e==="node"||e==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=t;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(e,t)}updateElement(e,t,n){var i;const a=Z(t),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new Bo(ge.BEFORE_ELEMENT_UPDATE,e,t),n);const A=this.getElementType(e,t),l=this.getUpdateStageStyle(e,t,n);this.shapeTypeMap[a]!==A&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(e,t,{animation:!1,silence:!0}));const c=s!=="visibility"?s:l.visibility==="hidden"?"hide":"show";c==="hide"&&delete l.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:e,stage:c,originalStyle:Object.assign({},o.attributes),updatedStyle:l},{before:()=>{const u=this.elementMap[a];s!=="collapse"&&f1(u,l),s==="visibility"&&(Yae(u,"opacity")||$ae(u,"opacity"),this.visibilityCache.set(u,c==="show"?"visible":"hidden"),c==="show"&&Vs(u,"visible"))},after:()=>{var u;const h=this.elementMap[a];s==="collapse"&&f1(h,l),c==="hide"&&Vs(h,this.visibilityCache.get(h)),this.emit(new Bo(ge.AFTER_ELEMENT_UPDATE,e,t),n),(u=h.onUpdate)===null||u===void 0||u.call(h)}})}updateElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["node",n],["combo",a],["edge",i]].forEach(([o,A])=>{A.forEach(l=>this.updateElement(o,l,t))})}markDestroyElement(e){Object.values(e.remove).forEach(t=>{t.forEach(n=>{const i=Z(n),a=this.getElement(i);a&&rW(a)})})}destroyElement(e,t,n){var i;const{stage:a="exit"}=n,s=Z(t),o=this.elementMap[s];if(!o)return()=>null;this.emit(new Bo(ge.BEFORE_ELEMENT_DESTROY,e,t),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:e,stage:a,originalStyle:Object.assign({},o.attributes),updatedStyle:{}},{after:()=>{var A;this.clearElement(s),o.destroy(),(A=o.onDestroy)===null||A===void 0||A.call(o),this.emit(new Bo(ge.AFTER_ELEMENT_DESTROY,e,t),n)}})}destroyElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["combo",a],["edge",i],["node",n]].forEach(([o,A])=>{A.forEach(l=>this.destroyElement(o,l,t))})}clearElement(e){delete this.paletteStyle[e],delete this.defaultStyle[e],delete this.stateStyle[e],delete this.elementMap[e],delete this.shapeTypeMap[e]}alignLayoutResultToElement(e,t){var n,i;const a=(n=e.nodes)===null||n===void 0?void 0:n.find(s=>Z(s)===t);if(a){const s=Sn(this.context.model.getNodeLikeDatum(t)),o=Sn(a),A=bt(s,o);(i=e.nodes)===null||i===void 0||i.forEach(l=>{var c,u,h;!((c=l.style)===null||c===void 0)&&c.x&&(l.style.x+=A[0]),!((u=l.style)===null||u===void 0)&&u.y&&(l.style.y+=A[1]),!((h=l.style)===null||h===void 0)&&h.z&&(l.style.z+=A[2]||0)})}}syncLayoutResult(e,t){return bo(this,void 0,void 0,function*(){const{layout:n,model:i}=this.context;if(!n)return;const a=this.context.options.layout,s=A=>Array.isArray(A)?A.map(l=>Object.assign(Object.assign({},l),{preLayout:!0})):Object.assign(Object.assign({},A),{preLayout:!0}),o=yield n.simulate(a?s(a):void 0);t&&this.alignLayoutResultToElement(o,e),i.updateData(o)})}collapseNode(e,t){return bo(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=t;yield this.syncLayoutResult(e,a);const s=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!s)return;const{drawData:o}=s,{add:A,remove:l,update:c}=o;this.markDestroyElement(o);const u={animation:i,stage:"collapse",data:o};this.destroyElements(l,u),this.createElements(A,u),this.updateElements(c,u),yield(n=this.context.animation.animate(i,{beforeAnimate:h=>this.emit(new Xr(ge.BEFORE_ANIMATE,mr.COLLAPSE,h,o),u),afterAnimate:h=>this.emit(new Xr(ge.AFTER_ANIMATE,mr.COLLAPSE,h,o),u)},{collapse:{target:e,descendants:Array.from(l.nodes).map(([,h])=>Z(h)),position:Sn(c.nodes.get(e))}}))===null||n===void 0?void 0:n.finished})}expandNode(e,t){return bo(this,void 0,void 0,function*(){var n;const{model:i}=this.context,{animation:a,align:s}=t,o=Sn(i.getNodeData([e])[0]);yield this.syncLayoutResult(e,s);const A=this.computeChangesAndDrawData({stage:"expand",animation:a});if(this.createElements(A.drawData.add,{animation:!1,stage:"expand",target:e}),this.context.animation.clear(),this.computeStyle("expand"),!A)return;const{drawData:l}=A,{update:c,add:u}=l,h={animation:a,stage:"expand",data:l};u.edges.forEach(d=>c.edges.set(Z(d),d)),u.nodes.forEach(d=>c.nodes.set(Z(d),d)),this.updateElements(c,h),yield(n=this.context.animation.animate(a,{beforeAnimate:d=>this.emit(new Xr(ge.BEFORE_ANIMATE,mr.EXPAND,d,l),h),afterAnimate:d=>this.emit(new Xr(ge.AFTER_ANIMATE,mr.EXPAND,d,l),h)},{expand:{target:e,descendants:Array.from(u.nodes).map(([,d])=>Z(d)),position:o}}))===null||n===void 0?void 0:n.finished})}collapseCombo(e,t){return bo(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(e,Et).some(g=>xr(g)))return;const s=a.getElement(e),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),A=this.computeChangesAndDrawData({stage:"collapse",animation:t});if(!A)return;const{dataChanges:l,drawData:c}=A;this.markDestroyElement(c);const{update:u,remove:h}=c,d={animation:t,stage:"collapse",data:c};this.destroyElements(h,d),this.updateElements(u,d);const f=g=>Array.from(g).map(([,v])=>Z(v));yield(n=this.context.animation.animate(t,{before:()=>this.emit(new yn(ge.BEFORE_DRAW,{dataChanges:l,animation:t}),d),beforeAnimate:g=>this.emit(new Xr(ge.BEFORE_ANIMATE,mr.COLLAPSE,g,c),d),afterAnimate:g=>this.emit(new Xr(ge.AFTER_ANIMATE,mr.COLLAPSE,g,c),d),after:()=>this.emit(new yn(ge.AFTER_DRAW,{dataChanges:l,animation:t}),d)},{collapse:{target:e,descendants:[...f(h.nodes),...f(h.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(e,t){return bo(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=Sn(i.getComboData([e])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:t});if(!s)return;const{dataChanges:o,drawData:A}=s,{add:l,update:c}=A,u={animation:t,stage:"expand",data:A,target:e};this.createElements(l,u),this.updateElements(c,u);const h=d=>Array.from(d).map(([,f])=>Z(f));yield(n=this.context.animation.animate(t,{before:()=>this.emit(new yn(ge.BEFORE_DRAW,{dataChanges:o,animation:t}),u),beforeAnimate:d=>this.emit(new Xr(ge.BEFORE_ANIMATE,mr.EXPAND,d,A),u),afterAnimate:d=>this.emit(new Xr(ge.AFTER_ANIMATE,mr.EXPAND,d,A),u),after:()=>this.emit(new yn(ge.AFTER_DRAW,{dataChanges:o,animation:t}),u)},{expand:{target:e,descendants:[...h(l.nodes),...h(l.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}var Eo=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})},ise=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};class ase{get presetOptions(){return{animation:!!qk(this.context.options,!0)}}get options(){const{options:e}=this.context;return e.layout}constructor(e){this.instances=[],this.context=e}getLayoutInstance(){return this.instances}preLayout(e){return Eo(this,void 0,void 0,function*(){var t,n,i,a;const{graph:s,model:o}=this.context,{add:A}=e;Cn(s,new yn(ge.BEFORE_LAYOUT,{type:"pre"}));const l=yield(t=this.context.layout)===null||t===void 0?void 0:t.simulate();(n=l==null?void 0:l.nodes)===null||n===void 0||n.forEach(c=>{const u=Z(c),h=A.nodes.get(u);o.syncNodeLikeDatum(c),h&&Object.assign(h.style,c.style)}),(i=l==null?void 0:l.edges)===null||i===void 0||i.forEach(c=>{const u=Z(c),h=A.edges.get(u);o.syncEdgeDatum(c),h&&Object.assign(h.style,c.style)}),(a=l==null?void 0:l.combos)===null||a===void 0||a.forEach(c=>{const u=Z(c),h=A.combos.get(u);o.syncNodeLikeDatum(c),h&&Object.assign(h.style,c.style)}),Cn(s,new yn(ge.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",e)})}postLayout(){return Eo(this,arguments,void 0,function*(e=this.options){if(!e)return;const t=Array.isArray(e)?e:[e],{graph:n}=this.context;Cn(n,new yn(ge.BEFORE_LAYOUT,{type:"post"}));for(let i=0;i<t.length;i++){const a=t[i],s=this.getLayoutData(a),o=Object.assign(Object.assign({},this.presetOptions),a);Cn(n,new yn(ge.BEFORE_STAGE_LAYOUT,{options:o,index:i}));const A=yield this.stepLayout(s,o,i);Cn(n,new yn(ge.AFTER_STAGE_LAYOUT,{options:o,index:i})),a.animation||this.updateElementPosition(A,!1)}Cn(n,new yn(ge.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(e,t){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(i=>i.afterLayout(e,t))}simulate(){return Eo(this,arguments,void 0,function*(e=this.options){if(!e)return{};const t=Array.isArray(e)?e:[e];let n={};for(let i=0;i<t.length;i++){const a=t[i],s=this.getLayoutData(a);n=yield this.stepLayout(s,Object.assign(Object.assign(Object.assign({},this.presetOptions),a),{animation:!1}),i)}return n})}stepLayout(e,t,n){return Eo(this,void 0,void 0,function*(){return cW(t)?yield this.treeLayout(e,t,n):yield this.graphLayout(e,t,n)})}graphLayout(e,t,n){return Eo(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=t,o=this.initGraphLayout(t);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const l=o;return this.supervisor=new dee(l.graphData2LayoutModel(e),l.instance,{iterations:s}),Iu(yield this.supervisor.execute())}if(B1(o))return i?yield o.execute(e,{onTick:l=>{this.updateElementPosition(l,!1)}}):(o.execute(e),o.stop(),o.tick(s));const A=yield o.execute(e);if(i){const l=this.updateElementPosition(A,i);yield l==null?void 0:l.finished}return A})}treeLayout(e,t,n){return Eo(this,void 0,void 0,function*(){const{type:i,animation:a}=t,s=va("layout",i);if(!s)return{};const{nodes:o=[],edges:A=[]}=e,l=new Mn({nodes:o.map(f=>({id:Z(f),data:f.data||{}})),edges:A.map(f=>({id:Z(f),source:f.source,target:f.target,data:f.data||{}}))});tse(l);const c={nodes:[],edges:[]},u={nodes:[],edges:[]};l.getRoots(Rr).forEach(f=>{Ns(f,m=>{m.children=l.getSuccessors(m.id)},m=>l.getSuccessors(m.id),"TB");const g=s(f,t),{x:v,y:p,z:y=0}=g;Ns(g,m=>{const{id:B,x:C,y:S,z:F=0}=m;c.nodes.push({id:B,style:{x:v,y:p,z:y}}),u.nodes.push({id:B,style:{x:C,y:S,z:F}})},m=>m.children,"TB")});const d=this.inferTreeLayoutOffset(u);if(c_(u,d),a){c_(c,d),this.updateElementPosition(c,!1);const f=this.updateElementPosition(u,a);yield f==null?void 0:f.finished}return u})}inferTreeLayoutOffset(e){var t;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(t=e.nodes)===null||t===void 0||t.forEach(g=>{const{x:v=0,y:p=0}=g.style||{};n=Math.min(n,v),i=Math.max(i,v),a=Math.min(a,p),s=Math.max(s,p)});const{canvas:o}=this.context,A=o.getSize(),[l,c]=o.getCanvasByViewport([0,0]),[u,h]=o.getCanvasByViewport(A);if(n>=l&&i<=u&&a>=c&&s<=h)return[0,0];const d=(l+u)/2,f=(c+h)/2;return[d-(n+i)/2,f-(a+s)/2]}stopLayout(){this.instance&&B1(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(e){const{nodeFilter:t=()=>!0,comboFilter:n=()=>!0,preLayout:i=!1,isLayoutInvisibleNodes:a=!1}=e,{nodes:s,edges:o,combos:A}=this.context.model.getData(),{element:l,model:c}=this.context,u=p=>l.getElement(p),h=i?p=>{var y;return!a&&(((y=p.style)===null||y===void 0?void 0:y.visibility)==="hidden"||c.getAncestorsData(p.id,Rr).some(xr)||c.getAncestorsData(p.id,Et).some(xr))?!1:t(p)}:p=>{const y=Z(p),m=u(y);return!m||Gl(m)?!1:t(p)},d=s.filter(h),f=A.filter(n),g=new Map(d.map(p=>[Z(p),p]));f.forEach(p=>g.set(Z(p),p));const v=o.filter(({source:p,target:y})=>g.has(p)&&g.has(y));return{nodes:d,edges:v,combos:f}}initGraphLayout(e){var t;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:A}=e,l=ise(e,["type","enableWorker","animation","iterations"]),[c,u]=i.getCanvasSize(),h=[c/2,u/2],d=(t=e==null?void 0:e.nodeSize)!==null&&t!==void 0?t:(y=>{const m=n==null?void 0:n.getElement(y.id);return m?m.attributes.size:n==null?void 0:n.getElementComputedStyle("node",y).size}),f=va("layout",a);if(!f)return $i.warn(`The layout of ${a} is not registered.`);const g=Object.getPrototypeOf(f.prototype)===vd.prototype?f:hW(f,this.context),v=new g(this.context),p={nodeSize:d,width:c,height:u,center:h};switch(v.id){case"d3-force":case"d3-force-3d":Object.assign(p,{center:{x:c/2,y:u/2,z:0}});break}return zn(v.options,p,l),v}updateElementPosition(e,t){const{model:n,element:i}=this.context;return i?(n.updateData(e),i.draw({animation:t,silence:!0})):null}destroy(){var e;this.stopLayout(),this.context={},(e=this.supervisor)===null||e===void 0||e.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const c_=(r,e)=>{var t;const[n,i]=e;(t=r.nodes)===null||t===void 0||t.forEach(a=>{if(a.style){const{x:s=0,y:o=0}=a.style;a.style.x=s+n,a.style.y=o+i}else a.style={x:n,y:i}})};function sse(r){return[ose].reduce((t,n)=>n(t),r)}function ose(r){return!r.layout||Array.isArray(r.layout)||"preLayout"in r.layout||["antv-dagre","combo-combined","compact-box","circular","concentric","dagre","fishbone","grid","indented","mds","radial","random","snake","dendrogram","mindmap"].includes(r.layout.type)&&(r.layout.preLayout=!0),r}class Ase extends pB{constructor(e){super(e),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(e){this.setExtensions(e)}getPluginInstance(e){const t=this.extensionMap[e];if(t)return t;$i.warn(`Cannot find the plugin ${e}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===e);if(n)return this.extensionMap[n.key]}}const xu=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class lse extends pB{constructor(e){super(e),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(e){this.setExtensions([...xu.slice(0,xu.length-1),...e,xu[xu.length-1]])}getTransformInstance(e){return e?this.extensionMap[e]:this.extensionMap}}var FA=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class cse{get padding(){return ai(this.context.options.padding)}get paddingOffset(){const[e,t,n,i]=this.padding,[a,s,o]=[(i-t)/2,(e-n)/2,0];return[a,s,o]}constructor(e){this.landmarkCounter=0,this.context=e;const[t,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=t,y:o=n}=e.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:e}=this.context;return new Proxy(e.getCamera(),{get:(t,n)=>{const a=Object.entries(e.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=t[n];if(typeof s=="function")return(...o)=>{const A=s.apply(t,o);return a.forEach(l=>{l[n].apply(l,o)}),A}}})}createLandmark(e){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,e)}getAnimation(e){const t=qk(this.context.options,e);return t?Ds(Object.assign({},t),["easing","duration"]):!1}getCanvasSize(){const{canvas:e}=this.context,{width:t=0,height:n=0}=e.getConfig();return[t,n]}getCanvasCenter(){const{canvas:e}=this.context,{width:t=0,height:n=0}=e.getConfig();return[t/2,n/2,0]}getViewportCenter(){const[e,t]=this.camera.getPosition();return[e,t,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(e){const{camera:t}=this,{mode:n,translate:i=[]}=e,a=this.getZoom(),s=t.getPosition(),o=t.getFocalPoint(),[A,l]=this.getCanvasCenter(),[c=0,u=0,h=0]=i,d=Bi([-c,-u,-h],a);return n==="relative"?{position:Ve(s,d),focalPoint:Ve(o,d)}:{position:Ve([A,l,s[2]],d),focalPoint:Ve([A,l,o[2]],d)}}getRotateOptions(e){const{mode:t,rotate:n=0}=e;return{roll:t==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(e){const{zoomRange:t}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=e;return Yt(i==="relative"?n*a:a,...t)}transform(e,t){return FA(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=e;this.cancelAnimation();const A=this.getAnimation(t);if(Cn(n,new Eu(ge.BEFORE_TRANSFORM,e)),!a&&s&&!i&&o&&!A){this.camera.setZoomByViewportPoint(this.getZoomOptions(e),o),Cn(n,new Eu(ge.AFTER_TRANSFORM,e));return}const l={};if(i&&Object.assign(l,this.getTranslateOptions(e)),Be(a)&&Object.assign(l,this.getRotateOptions(e)),Be(s)&&Object.assign(l,{zoom:this.getZoomOptions(e)}),A)return Cn(n,new Xr(ge.BEFORE_ANIMATE,mr.TRANSFORM,null,e)),new Promise(c=>{this.transformResolver=c,this.camera.gotoLandmark(this.createLandmark(l),Object.assign(Object.assign({},A),{onfinish:()=>{Cn(n,new Xr(ge.AFTER_ANIMATE,mr.TRANSFORM,null,e)),Cn(n,new Eu(ge.AFTER_TRANSFORM,e)),this.transformResolver=void 0,c()}}))});this.camera.gotoLandmark(this.createLandmark(l),{duration:0}),Cn(n,new Eu(ge.AFTER_TRANSFORM,e))})}fitView(e,t){return FA(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:A="both"}=e||{},[l,c]=this.context.canvas.getSize(),u=l-s-i,h=c-n-a,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[g,v]=is(f),p=A==="x"&&g>=u||A==="y"&&v>=h||A==="both"&&g>=u&&v>=h;if(o==="overflow"&&!p)return yield this.fitCenter({animation:t});const y=u/g,m=h/v,B=A==="x"?y:A==="y"?m:Math.min(y,m),C=this.getAnimation(t);Number.isFinite(B)&&(yield this.transform({mode:"relative",scale:B,translate:Ve(bt(this.getCanvasCenter(),this.getBBoxInViewport(d).center),Bi(this.paddingOffset,B))},C))})}fitCenter(e){return FA(this,void 0,void 0,function*(){const t=this.context.canvas.getBounds();yield this.focus(t,e)})}focusElements(e){return FA(this,arguments,void 0,function*(t,n={}){const{element:i}=this.context;if(!i)return;const a=o=>n.shapes?o.getShape(n.shapes).getRenderBounds():o.getRenderBounds(),s=Ql(t.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(e,t){return FA(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(e.center),i=t.position||this.getCanvasCenter(),a=bt(i,n);yield this.transform({mode:"relative",translate:Ve(a,this.paddingOffset)},t.animation)})}getBBoxInViewport(e){const{min:t,max:n}=e,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(t),[o,A]=i.getViewportByCanvas(n),l=new It;return l.setMinMax([a,s,0],[o,A,0]),l}isInViewport(e,t=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[A,l]=i.getCanvasByViewport(a);let c=new It;return c.setMinMax([s,o,0],[A,l,0]),n&&(c=as(c,n)),qo(e)?wi(e,c):t?wV(e,c):c.intersects(e)}cancelAnimation(){var e,t;!((e=this.camera.landmarks)===null||e===void 0)&&e.length&&this.camera.cancelLandmarkAnimation(),(t=this.transformResolver)===null||t===void 0||t.call(this)}}var Tt=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,e||[])).next())})};class Bf extends gd{constructor(e){var t;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new nse},this.isCollapsingExpanding=!1,this.onResize=Sl(()=>{this.resize()},300),this._setOptions(Object.assign({},Bf.defaultOptions,e),!0),this.context.graph=this,this.options.autoResize&&((t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(e){this._setOptions(e,!1)}_setOptions(e,t){if(this.updateCanvas(e),Object.assign(this.options,sse(e)),t){const{data:h}=e;h&&this.addData(h);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:A,plugins:l,theme:c,transforms:u}=e;n&&this.setBehaviors(n),a&&this.setData(a),A&&this.setNode(A),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),c&&this.setTheme(c),l&&this.setPlugins(l),u&&this.setTransforms(u)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(e,t){e&&(this.options.width=e),t&&(this.options.height=t),this.resize(e,t)}setZoomRange(e){this.options.zoomRange=e}getZoomRange(){return this.options.zoomRange}setNode(e){this.options.node=e,this.context.model.refreshData()}setEdge(e){this.options.edge=e,this.context.model.refreshData()}setCombo(e){this.options.combo=e,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(e){this.options.theme=Te(e)?e(this.getTheme()):e}setLayout(e){this.options.layout=Te(e)?e(this.getLayout()):e}getLayout(){return this.options.layout}setBehaviors(e){var t;this.options.behaviors=Te(e)?e(this.getBehaviors()):e,(t=this.context.behavior)===null||t===void 0||t.setBehaviors(this.options.behaviors)}updateBehavior(e){this.setBehaviors(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(e){var t;this.options.plugins=Te(e)?e(this.getPlugins()):e,(t=this.context.plugin)===null||t===void 0||t.setPlugins(this.options.plugins)}updatePlugin(e){this.setPlugins(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(e){return this.context.plugin.getPluginInstance(e)}setTransforms(e){var t;this.options.transforms=Te(e)?e(this.getTransforms()):e,(t=this.context.transform)===null||t===void 0||t.setTransforms(this.options.transforms)}updateTransform(e){this.setTransforms(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}hasNode(e){return this.context.model.hasNode(e)}hasEdge(e){return this.context.model.hasEdge(e)}hasCombo(e){return this.context.model.hasCombo(e)}getElementData(e){return Array.isArray(e)?e.map(t=>this.context.model.getElementDataById(t)):this.context.model.getElementDataById(e)}getNodeData(e){return e===void 0?this.context.model.getNodeData():Array.isArray(e)?this.context.model.getNodeData(e):this.context.model.getNodeLikeDatum(e)}getEdgeData(e){return e===void 0?this.context.model.getEdgeData():Array.isArray(e)?this.context.model.getEdgeData(e):this.context.model.getEdgeDatum(e)}getComboData(e){return e===void 0?this.context.model.getComboData():Array.isArray(e)?this.context.model.getComboData(e):this.context.model.getNodeLikeDatum(e)}setData(e){this.context.model.setData(Te(e)?e(this.getData()):e)}addData(e){this.context.model.addData(Te(e)?e(this.getData()):e)}addNodeData(e){this.context.model.addNodeData(Te(e)?e(this.getNodeData()):e)}addEdgeData(e){this.context.model.addEdgeData(Te(e)?e(this.getEdgeData()):e)}addComboData(e){this.context.model.addComboData(Te(e)?e(this.getComboData()):e)}addChildrenData(e,t){this.context.model.addChildrenData(e,t)}updateData(e){this.context.model.updateData(Te(e)?e(this.getData()):e)}updateNodeData(e){this.context.model.updateNodeData(Te(e)?e(this.getNodeData()):e)}updateEdgeData(e){this.context.model.updateEdgeData(Te(e)?e(this.getEdgeData()):e)}updateComboData(e){this.context.model.updateComboData(Te(e)?e(this.getComboData()):e)}removeData(e){this.context.model.removeData(Te(e)?e(this.getData()):e)}removeNodeData(e){this.context.model.removeNodeData(Te(e)?e(this.getNodeData()):e)}removeEdgeData(e){this.context.model.removeEdgeData(Te(e)?e(this.getEdgeData()):e)}removeComboData(e){this.context.model.removeComboData(Te(e)?e(this.getComboData()):e)}getElementType(e){return this.context.model.getElementType(e)}getRelatedEdgesData(e,t="both"){return this.context.model.getRelatedEdgesData(e,t)}getNeighborNodesData(e){return this.context.model.getNeighborNodesData(e)}getAncestorsData(e,t){return this.context.model.getAncestorsData(e,t)}getParentData(e,t){return this.context.model.getParentData(e,t)}getChildrenData(e){return this.context.model.getChildrenData(e)}getDescendantsData(e){return this.context.model.getDescendantsData(e)}getElementDataByState(e,t){return this.context.model.getElementDataByState(e,t)}initCanvas(){return Tt(this,void 0,void 0,function*(){var e;if(this.context.canvas)return yield this.context.canvas.ready;const{container:t="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:A,devicePixelRatio:l=(e=globalThis.devicePixelRatio)!==null&&e!==void 0?e:1}=this.options;if(t instanceof i_)this.context.canvas=t,s&&t.setCursor(s),a&&t.setRenderer(a),yield t.ready;else{const c=At(t)?document.getElementById(t):t,u=o_(c);this.emit(ge.BEFORE_CANVAS_INIT,{container:c,width:n,height:i});const h=Object.assign(Object.assign({},A),{container:c,width:n||u[0],height:i||u[1],background:o,renderer:a,cursor:s,devicePixelRatio:l}),d=new i_(h);this.context.canvas=d,yield d.ready,this.emit(ge.AFTER_CANVAS_INIT,{canvas:d})}})}updateCanvas(e){var t,n;const{renderer:i,cursor:a,height:s,width:o}=e,A=this.context.canvas;A&&(i&&(this.emit(ge.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),A.setRenderer(i),this.emit(ge.AFTER_RENDERER_CHANGE,{renderer:i})),a&&A.setCursor(a),(Be(o)||Be(s))&&this.setSize((t=o??this.options.width)!==null&&t!==void 0?t:0,(n=s??this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new Zae(this.context)),this.context.plugin||(this.context.plugin=new Ase(this.context)),this.context.viewport||(this.context.viewport=new cse(this.context)),this.context.transform||(this.context.transform=new lse(this.context)),this.context.element||(this.context.element=new rse(this.context)),this.context.animation||(this.context.animation=new Xae(this.context)),this.context.layout||(this.context.layout=new ase(this.context)),this.context.behavior||(this.context.behavior=new Jae(this.context))}prepare(){return Tt(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed){console.error(ha("The graph instance has been destroyed"));return}yield this.initCanvas(),this.initRuntime()})}render(){return Tt(this,void 0,void 0,function*(){if(yield this.prepare(),Cn(this,new yn(ge.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&uW(this.options.layout)){const e=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.autoFit()])}else{const e=this.context.element.draw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const e=this.context.element.draw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.autoFit()])}this.rendered=!0,Cn(this,new yn(ge.AFTER_RENDER))})}draw(){return Tt(this,void 0,void 0,function*(){var e;yield this.prepare(),yield(e=this.context.element.draw())===null||e===void 0?void 0:e.finished})}layout(e){return Tt(this,void 0,void 0,function*(){yield this.context.layout.postLayout(e)})}stopLayout(){this.context.layout.stopLayout()}clear(){return Tt(this,void 0,void 0,function*(){const{model:e,element:t}=this.context;e.setData({}),e.clearChanges(),t==null||t.clear()})}destroy(){var e;Cn(this,new yn(ge.BEFORE_DESTROY));const{layout:t,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:A}=this.context;A==null||A.destroy(),o==null||o.destroy(),t==null||t.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"resize",this.onResize),this.destroyed=!0,Cn(this,new yn(ge.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,t){var n;const i=o_((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[e||i[0],t||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();Xt(a,s)||(Cn(this,new yn(ge.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),Cn(this,new yn(ge.AFTER_SIZE_CHANGE,{size:a})))}fitView(e,t){return Tt(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(e,t)})}fitCenter(e){return Tt(this,void 0,void 0,function*(){var t;yield(t=this.context.viewport)===null||t===void 0?void 0:t.fitCenter({animation:e})})}autoFit(){return Tt(this,void 0,void 0,function*(){const{autoFit:e}=this.context.options;if(e)if(At(e))e==="view"?yield this.fitView():e==="center"&&(yield this.fitCenter());else{const{type:t,animation:n}=e;t==="view"?yield this.fitView(e.options,n):t==="center"&&(yield this.fitCenter(n))}})}focusElement(e,t){return Tt(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(e)?e:[e],{animation:t})})}zoomBy(e,t,n){return Tt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:e,origin:n},t)})}zoomTo(e,t,n){return Tt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",scale:e,origin:n},t)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(e,t,n){return Tt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:e,origin:n},t)})}rotateTo(e,t,n){return Tt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:e,origin:n},t)})}getRotation(){return this.context.viewport.getRotation()}translateBy(e,t){return Tt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:e},t)})}translateTo(e,t){return Tt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:e},t)})}getPosition(){return bt([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(e,t){return Tt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(A).forEach(([c,u])=>this.context.model.translateNodeLikeBy(c,u)),yield(o=this.context.element.draw({animation:l,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(e,t){return Tt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(A).forEach(([c,u])=>this.context.model.translateNodeLikeTo(c,u)),yield(o=this.context.element.draw({animation:l,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(e){return this.context.model.getElementPosition(e)}getElementRenderStyle(e){return V1(this.context.element.getElement(e).attributes,["context"])}setElementVisibility(e,t){return Tt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c={nodes:[],edges:[],combos:[]};Object.entries(A).forEach(([d,f])=>{const g=this.getElementType(d);c[`${g}s`].push({id:d,style:{visibility:f}})});const{model:u,element:h}=this.context;u.preventUpdateNodeLikeHierarchy(()=>{u.updateData(c)}),yield(o=h.draw({animation:l,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(e,t){return Tt(this,void 0,void 0,function*(){const n=Array.isArray(e)?e:[e];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),t)})}hideElement(e,t){return Tt(this,void 0,void 0,function*(){const n=Array.isArray(e)?e:[e];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),t)})}getElementVisibility(e){var t,n;const i=this.context.element.getElement(e);return(n=(t=i==null?void 0:i.style)===null||t===void 0?void 0:t.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(e,t){return Tt(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=un(e)?e:{[e]:t};Object.entries(a).forEach(([A,l])=>{const c=this.getElementType(A);i[`${c}s`].push({id:A,style:{zIndex:l}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(e){return Tt(this,void 0,void 0,function*(){const t=Array.isArray(e)?e:[e],{model:n}=this.context,i={};t.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const A=n.getAncestorsData(a,Et).at(-1)||this.getComboData(a),l=[A,...n.getDescendantsData(Z(A))],c=s-A_(A);l.forEach(h=>{i[Z(h)]=this.getElementZIndex(Z(h))+c});const{internal:u}=h1(l.map(Z),h=>n.getRelatedEdgesData(h));u.forEach(h=>{const d=Z(h);i[d]=this.getElementZIndex(d)+c})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(e){return A_(this.context.model.getElementDataById(e))}setElementState(e,t){return Tt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c=h=>h?Array.isArray(h)?h:[h]:[],u={nodes:[],edges:[],combos:[]};Object.entries(A).forEach(([h,d])=>{const f=this.getElementType(h);u[`${f}s`].push({id:h,states:c(d)})}),this.updateData(u),yield(o=this.context.element.draw({animation:l,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(e){return this.context.model.getElementState(e)}getElementRenderBounds(e){return this.context.element.getElement(e).getRenderBounds()}collapseElement(e){return Tt(this,arguments,void 0,function*(t,n=!0){const{model:i,element:a}=this.context;if(xr(i.getNodeLikeData([t])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!1});const s=i.getElementType(t);yield this.frontElement(t),this.isCollapsingExpanding=!0,i.updateData(s==="node"?{nodes:[{id:t,style:{collapsed:!0}}]}:{combos:[{id:t,style:{collapsed:!0}}]}),s==="node"?yield a.collapseNode(t,n):s==="combo"&&(yield a.collapseCombo(t,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(e){return Tt(this,arguments,void 0,function*(t,n=!0){const{model:i,element:a}=this.context;if(!xr(i.getNodeLikeData([t])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!1});const s=i.getElementType(t);this.isCollapsingExpanding=!0,i.updateData(s==="node"?{nodes:[{id:t,style:{collapsed:!1}}]}:{combos:[{id:t,style:{collapsed:!1}}]}),s==="node"?yield a.expandNode(t,n):s==="combo"&&(yield a.expandCombo(t,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(e,t){const n=this.getElementType(e);n==="node"?this.updateNodeData([{id:e,style:{collapsed:t}}]):n==="combo"&&this.updateComboData([{id:e,style:{collapsed:t}}])}toDataURL(){return Tt(this,arguments,void 0,function*(e={}){return this.context.canvas.toDataURL(e)})}getCanvasByViewport(e){return this.context.canvas.getCanvasByViewport(e)}getViewportByCanvas(e){return this.context.canvas.getViewportByCanvas(e)}getClientByCanvas(e){return this.context.canvas.getClientByCanvas(e)}getCanvasByClient(e){return this.context.canvas.getCanvasByClient(e)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(e,t,n){return super.on(e,t,n)}once(e,t){return super.once(e,t)}off(e,t){return super.off(e,t)}}Bf.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var use=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function hse(r,e){const{getNodeData:t=(o,A)=>{if(o.depth=A,!o.children)return o;const{children:l}=o,c=use(o,["children"]);return Object.assign(Object.assign({},c),{children:l.map(u=>u.id)})},getEdgeData:n=(o,A)=>({source:o.id,target:A.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return Ns(r,(o,A)=>{a.push(t(o,A));const l=i(o);for(const c of l)s.push(n(o,c))},o=>i(o),"TB"),{nodes:a,edges:s}}class dse extends ls{beforeDraw(e){const{add:t,update:n}=e,{model:i}=this.context;return[...t.edges.entries(),...n.edges.entries()].forEach(([,a])=>{_U(i,a)}),e}}const _U=(r,e)=>{const{source:t,target:n}=e,i=r.getElementDataById(t),a=r.getElementDataById(n),s=Qx(i,u=>r.getParentData(u,Et)),o=Qx(a,u=>r.getParentData(u,Et)),A=Z(s),l=Z(o),c={sourceNode:A,targetNode:l};return e.style?Object.assign(e.style,c):e.style=c,e},fse=(r,e,t)=>{const[n,i]=e,[a,s]=t;if(i===n)return a;const o=(r-n)/(i-n);return a+o*(s-a)},gse=(r,e,t)=>{const[n,i]=e,[a,s]=t,o=Math.log(r-n+1)/Math.log(i-n+1);return a+o*(s-a)},vse=(r,e,t,n=2)=>{const[i,a]=e,[s,o]=t,A=Math.pow((r-i)/(a-i),n);return s+A*(o-s)},pse=(r,e,t)=>{const[n,i]=e,[a,s]=t,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class bf extends ls{constructor(e,t){super(e,zn({},bf.defaultOptions,t)),this.assignSizeByCentrality=(n,i,a,s,o,A)=>{const l=[i,a],c=[s[0],o[0]],u=[s[1],o[1]],h=[s[2],o[2]],d=(f,g)=>{if(typeof A=="function")return A(f,l,g);switch(A){case"linear":return fse(f,l,g);case"log":return gse(f,l,g);case"pow":return vse(f,l,g,2);case"sqrt":return pse(f,l,g);default:return g[0]}};return[d(n,c),d(n,u),d(n,h)]}}beforeDraw(e){const{model:t}=this.context,n=t.getNodeData(),i=Gr(this.options.maxSize),a=Gr(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,A=s.size>0?Math.min(...s.values()):0;return n.forEach(l=>{var c;const u=this.assignSizeByCentrality(s.get(Z(l))||0,A,o,a,i,this.options.scale),h=(c=this.context.element)===null||c===void 0?void 0:c.getElement(Z(l)),d={size:u};this.assignLabelStyle(d,u,l,h),(!h||!Du(d,h.attributes))&&Hr(e,h?"update":"add","node",zn(l,{style:d}),!0)}),e}assignLabelStyle(e,t,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(e,Ds(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(t,1/0,Number(e.labelFontSize));Object.assign(e,{labelFontSize:o,labelLineHeight:o+mV(e.labelPadding)})}return e}getLabelSizeByNodeSize(e,t,n){const i=Math.min(...e)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,t];return Math.min(s,Math.max(i,a))}getCentralities(e){const{model:t}=this.context,n=t.getData();if(typeof e=="function")return e(n);const i=t.getRelatedEdgesData.bind(t);return aL(n,i,e)}}bf.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class Ef extends ls{constructor(e,t){super(e,Object.assign({},Ef.defaultOptions,t))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var e;const t=Sn(this.ref),{graph:n,model:i}=this.context;(e=i.getData().nodes)===null||e===void 0||e.forEach(s=>{var o;if(Z(s)===Z(this.ref))return;const A=oL(bt(Sn(s),t)),l=Math.abs(A)>Math.PI/2,c=!s.children||s.children.length===0,u=Z(s),h=(o=this.context.element)===null||o===void 0?void 0:o.getElement(u);if(!h||!h.isVisible())return;const d=Gr(n.getElementRenderStyle(u).size)[0]/2,f=(c?1:-1)*(d+this.options.offset),g=[["translate",f*Math.cos(A),f*Math.sin(A)],["rotate",l?Br(A)+180:Br(A)]];i.updateNodeData([{id:Z(s),style:{labelTextAlign:l===c?"right":"left",labelTextBaseline:"middle",labelTransform:g}}])}),n.draw()}}Ef.defaultOptions={offset:5};const yse="quadratic",u_=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class xf extends ls{constructor(e,t){super(e,Object.assign({},xf.defaultOptions,t)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:A}}=n,{model:l}=this.context,c=new Map,u=(f,g)=>{l.getRelatedEdgesData(g).forEach(p=>!c.has(Z(p))&&c.set(Z(p),p))};a.forEach(u),o.forEach(u);const h=f=>{const g=new Set(n.remove.edges.keys()),v=l.getEdgeData().filter(p=>!g.has(Z(p))).map(p=>_U(l,p));mse(f,v).forEach(p=>{const y=Z(p);c.has(y)||c.set(y,p)})};if(A.size&&A.forEach(h),i.size&&i.forEach(h),s.size){const f=KN(tb(l.getChanges())).update.edges;s.forEach(g=>{var v;h(g);const p=(v=f.find(y=>Z(y.value)===Z(g)))===null||v===void 0?void 0:v.original;p&&!vb(g,p)&&h(p)})}Qi(this.options.edges)||c.forEach((f,g)=>!this.options.edges.includes(g)&&c.delete(g));const d=l.getEdgeData().map(Z);return new Map([...c].sort((f,g)=>d.indexOf(f[0])-d.indexOf(g[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=h_(i);s.forEach(A=>{A.forEach((l,c,u)=>{var h;const d=u.length,f=l.style||{};if(l.source===l.target){const p=u_.length;f.loopPlacement=u_[c%p],f.loopDist=Math.floor(c/p)*a+50}else if(d===1)f.curveOffset=0;else{const p=(c%2===0?1:-1)*(o[`${l.source}|${l.target}|${c}`]?-1:1);f.curveOffset=d%2===1?p*Math.ceil(c/2)*a*2:p*(Math.floor(c/2)*a*2+a)}const g=Object.assign(l,{type:yse,style:f}),v=(h=this.context.element)===null||h===void 0?void 0:h.getElement(Z(l));(!v||!Du(g.style,v.attributes))&&Hr(n,v?"update":"add","edge",g,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(Z(n))||{};return Object.keys(a).forEach(s=>{Xt(i[s],a[s])&&(n[s]?i[s]=n[s]:delete i[s])}),Object.assign(n,{style:i})},this.applyMergingStyle=(n,i)=>{const{edgeMap:a,reverses:s}=h_(i);a.forEach(o=>{var A;if(o.length===1){const c=o[0],u=(A=this.context.element)===null||A===void 0?void 0:A.getElement(Z(c)),h=this.resetEdgeStyle(c);(!u||!Du(h,u.attributes))&&Hr(n,u?"update":"add","edge",h);return}const l=o.map(({source:c,target:u,style:h={}},d)=>{const{startArrow:f,endArrow:g}=h,v={},[p,y]=s[`${c}|${u}|${d}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return sl(f)&&(v[p]=f),sl(g)&&(v[y]=g),v}).reduce((c,u)=>Object.assign(Object.assign({},c),u),{});o.forEach((c,u,h)=>{var d;if(u!==0){Hr(n,"remove","edge",c);return}const f=Object.assign({},Te(this.options.style)?this.options.style(h):this.options.style,{childrenData:h});this.cacheMergeStyle.set(Z(c),f);const g=Object.assign(Object.assign({},c),{type:"line",style:Object.assign(Object.assign(Object.assign({},c.style),l),f)}),v=(d=this.context.element)===null||d===void 0?void 0:d.getElement(Z(c));(!v||!Du(g.style,v.attributes))&&Hr(n,v?"update":"add","edge",g,!0)})})}}beforeDraw(e){const t=this.getAffectedParallelEdges(e);return t.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(e,t,this.options.distance):this.applyMergingStyle(e,t)),e}}xf.defaultOptions={mode:"bundle",distance:15};const h_=r=>{const e=new Map,t=new Set,n={},i=new Map;for(const[a,s]of r){if(t.has(a))continue;const{source:o,target:A}=s,l=`${o}-${A}`;e.has(l)||(e.set(l,[]),i.set(l,new Set));const c=e.get(l),u=i.get(l);c&&u&&!u.has(a)&&(c.push(s),u.add(a),t.add(a));for(const[h,d]of r)if(!(t.has(h)||h===a)&&vb(s,d)){const f=e.get(l),g=i.get(l);f&&g&&!g.has(h)&&(f.push(d),g.add(h),o===d.target&&A===d.source&&(n[`${d.source}|${d.target}|${f.length-1}`]=!0),t.add(h))}}return{edgeMap:e,reverses:n}},mse=(r,e,t)=>e.filter(n=>vb(n,r)),vb=(r,e)=>{const{sourceNode:t,targetNode:n}=r.style||{},{sourceNode:i,targetNode:a}=e.style||{};return t===i&&n===a||t===a&&n===i};class wse extends ls{beforeDraw(e,t){const{stage:n}=t;if(n==="visibility")return e;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=e,A=(l,c)=>{i.getRelatedEdgesData(c).forEach(h=>!s.has(Z(h))&&s.set(Z(h),h))};return a.forEach(A),o.forEach(A),e}}const Bse={animation:{"combo-collapse":Zk,"combo-expand":vV,"node-collapse":Yk,"node-expand":fV,"path-in":Xk,"path-out":gV,fade:hV,translate:dV},behavior:{"brush-select":Nl,"click-select":nd,"collapse-expand":hd,"create-edge":dd,"drag-canvas":fd,"drag-element-force":fW,"drag-element":Kl,"fix-element-size":pd,"focus-element":yd,"hover-activate":md,"lasso-select":vW,"auto-adapt-label":Jh,"optimize-viewport-transform":wd,"scroll-canvas":Bd,"zoom-canvas":bd},combo:{circle:f9,rect:g9},edge:{cubic:Js,line:UL,polyline:ud,quadratic:Dl,"cubic-horizontal":Ad,"cubic-radial":ld,"cubic-vertical":cd},layout:{"antv-dagre":k$,"combo-combined":z7,"compact-box":CW,"d3-force":vY,"force-atlas2":LJ,circular:N$,concentric:w1,dagre:zd,dendrogram:_W,fishbone:Vd,force:mQ,fruchterman:UJ,grid:RJ,indented:QW,mds:BQ,mindmap:DW,radial:qJ,random:tee,snake:jd},node:{circle:Rl,diamond:bj,ellipse:ad,hexagon:Fj,html:sd,image:OL,rect:h9,star:d9,donut:id,triangle:od},palette:{spectral:pee,tableau:yee,oranges:mee,greens:wee,blues:Bee},theme:{dark:Rae,light:Hae},plugin:{"bubble-sets":$d,"edge-bundling":Xd,"edge-filter-lens":Zd,"grid-line":tf,background:Wd,contextmenu:Yd,fisheye:Jd,fullscreen:ef,history:nf,hull:af,legend:df,minimap:ff,snapline:gf,timebar:vf,title:Cae,toolbar:pf,tooltip:yf,watermark:mf},transform:{"arrange-draw-order":Gae,"collapse-expand-combo":Kae,"collapse-expand-node":zae,"get-edge-actual-ends":dse,"map-node-size":bf,"place-radial-labels":Ef,"process-parallel-edges":xf,"update-related-edges":wse},shape:{circle:zi,ellipse:_l,group:Tn,html:Ys,image:bB,line:Ks,path:rr,polygon:Xs,polyline:Dh,rect:Vn,text:Zs,label:ji,badge:Zo}};function bse(){Object.entries(Bse).forEach(([r,e])=>{Object.entries(e).forEach(([t,n])=>{MU(r,t,n)})})}bse();class Rs extends Dl{static tyoe="ant-quadratic";static lineDashGap=5;onCreate(){this.shapeMap.key.animate([{lineDashOffset:Rs.lineDashGap*2},{lineDashOffset:0}],{duration:500,iterations:1/0,delay:0})}}MU(Wo.EDGE,Rs.tyoe,Rs);const Ise=jU({__name:"TrackGraph",props:{nodes:{},queryResult:{},showUnitResults:{},filterUnitResults:{}},setup(r){const e=r,t=$U(),n=v=>e.nodes[v],i=uA(()=>lP(e.queryResult.unitResults.asJsReadonlyArrayView().flatMap(v=>v.context.toArray()),v=>v.id)),a=uA(()=>VU(e.nodes,i.value)),s=v=>({id:v.id.toString(),children:a.value.getChildren(v).map(s)}),o=uA(()=>hse(s(a.value.topNode))),A=v=>a.value.getChildren(v).length>0,l=uA(()=>{const v={},p={},y=O=>{const _=`#${O.source.id}-${O.target.id}`,k=v[_]||0;v[_]=k+1;const L=_+(k>0?`-${k}`:"");return p[L]=O,{id:L,source:String(O.source.id),target:String(O.target.id)}},B=e.showUnitResults.map(O=>({result:O,pathList:O.getNodeConnectPath(ZU).asJsReadonlyArrayView().concat()})).map(({result:O,pathList:_})=>{const k=_.map(L=>y(L));return{result:O,edgeGroup:k}}),C=B.flatMap(O=>O.edgeGroup),S=O=>p[O.id].formatConnectOffset,F=O=>B.findIndex(_=>_.edgeGroup.some(k=>k.id===O.id));return{groupList:B,edgeList:C,getLabel:S,getColor:O=>{const _=e.showUnitResults.indexOf(B[F(O)].result);return yb[_%yb.length]},getGroupIndex:F}}),c=v=>{var p;return((p=v.id)==null?void 0:p[0])==="#"},u=(v,p,y,m)=>Math.sqrt(Math.pow(Math.abs(v-y),2)+Math.pow(Math.abs(p-m),2)),h=(v,p)=>{var B,C,S,F;const y=v.getNodeData(p.source),m=v.getNodeData(p.target);return u(((B=y.style)==null?void 0:B.x)||0,((C=y.style)==null?void 0:C.y)||0,((S=m.style)==null?void 0:S.x)||0,((F=m.style)==null?void 0:F.y)||0)},d=/\d+/,f=qU();WU(()=>{f.value&&f.value.destroy()}),pb(t,async()=>{if(!t.value)return;const v=new Bf({container:t.value,data:o.value,autoFit:"view",padding:[24,48],animation:!1,node:{type(p){const y=n(p.id);return A(y)?"triangle":"rect"},style(p){const y=n(p.id),m=e.queryResult.target.id===y.id,B=a.value.isPlaceholder(y),C=zU(y);return{size:A(y)?4:1,direction:A(y)?"down":void 0,fill:A(y)?"#767C82":"#E3E3E3",pointerEvents:"none",labelPlacement:"right",labelText:a.value.getLabel(y),labelOffsetX:2,labelFontWeight:C&&!B?"bold":void 0,labelOpacity:B?.5:void 0,labelPointerEvents:"none",labelStroke:m?"#0FF":void 0}}},edge:{type(p){return c(p)?Rs.tyoe:"polyline"},style(p){if(c(p)){const y=h(v,p),m=l.value.getLabel(p),B=m.match(d);return{curveOffset:30*(Number(p.source)>Number(p.target)?1:-1),stroke:l.value.getColor(p)||"#FF7FFF",zIndex:1+l.value.getGroupIndex(p),pointerEvents:"none",endArrow:!0,endArrowOpacity:.5,endArrowPointerEvents:"none",labelText:m,labelFill:"#F00",labelFontSize:B&&y<50?8:12,labelBackground:!0,labelBackgroundStroke:"#FF00FF",labelPadding:B?[0,1,-2,0]:[0,0,-1,0],labelBackgroundLineWidth:1,labelBackgroundRadius:2,labelBackgroundPointerEvents:"none",labelOffsetX:y<50?-5:0,labelPointerEvents:"none",lineDash:[Rs.lineDashGap,Rs.lineDashGap]}}return{router:{type:"orth"},stroke:"#E3E3E3",pointerEvents:"none"}}},layout:{type:"indented",direction:"LR",indent:20,getHeight:()=>0},behaviors:["drag-canvas","zoom-canvas"]});await v.render(),f.value=v});const g=uA(()=>{const v=e.filterUnitResults;return v!=null&&v.length?l.value.groupList.filter(p=>v.includes(p.result)).flatMap(p=>p.edgeGroup):[]});return pb([f,g],async([v,p],[y,m])=>{if(v){if(p!==m){const B=m.filter(S=>!p.some(F=>F.id===S.id)),C=p.filter(S=>!m.some(F=>F.id===S.id));if(!B.length&&!C.length)return;v.removeEdgeData(B.map(S=>S.id)),await v.draw(),v.addEdgeData(C)}else v.addEdgeData(p);await v.draw()}}),(v,p)=>(XU(),YU("div",{ref_key:"el",ref:t,class:"TrackGraph"},null,512))}});export{Ise as default};
|
|
134
|
-
//# sourceMappingURL=TrackGraph-
|
|
134
|
+
//# sourceMappingURL=TrackGraph-CPenoPWC.js.map
|