You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

89 lines
1.1 MiB

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).G6={})}(this,function(t){"use strict";var e="undefined"!=typeof document?document.currentScript:null;function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}function i(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach(function(e){i(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}function c(t,e,n){return e&&l(t.prototype,e),n&&l(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function h(t,e){if(t){if("string"==typeof t)return u(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,e):void 0}}function d(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(p=function(){return!!t})()}function g(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function v(t,e,n){return e=f(e),g(t,p()?Reflect.construct(e,n||[],f(t).constructor):e.apply(t,n))}function m(t,e){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},m(t,e)}function y(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&m(t,e)}function b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||h(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function w(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}),n}var k={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],s]:t._events[l].push(s):(t._events[l]=s,t._eventsCount++),t}function a(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var l,c,u=this._events[s],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,i),!0;case 5:return u.fn.call(u.context,e,r,i,o),!0;case 6:return u.fn.call(u.context,e,r,i,o,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,r);break;case 4:u[c].fn.call(u[c].context,e,r,i);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==e||i&&!s[l].once||r&&s[l].context!==r)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(k);var M=E(k.exports),S=1e-6,N="undefined"!=typeof Float32Array?Float32Array:Array;function T(){var t=new N(9);return N!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function O(){var t=new N(16);return N!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function C(t){var e=new N(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function A(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function P(t,e,n,r,i,o,a,s,l,c,u,h,d,f,p,g){var v=new N(16);return v[0]=t,v[1]=e,v[2]=n,v[3]=r,v[4]=i,v[5]=o,v[6]=a,v[7]=s,v[8]=l,v[9]=c,v[10]=u,v[11]=h,v[12]=d,v[13]=f,v[14]=p,v[15]=g,v}function R(t,e,n,r,i,o,a,s,l,c,u,h,d,f,p,g,v){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=c,t[9]=u,t[10]=h,t[11]=d,t[12]=f,t[13]=p,t[14]=g,t[15]=v,t}function D(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function L(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function _(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],m=e[15],y=n*s-r*a,b=n*l-i*a,x=n*c-o*a,E=r*l-i*s,w=r*c-o*s,k=i*c-o*l,M=u*g-h*p,S=u*v-d*p,N=u*m-f*p,T=h*v-d*g,O=h*m-f*g,C=d*m-f*v,A=y*C-b*O+x*T+E*N-w*S+k*M;return A?(A=1/A,t[0]=(s*C-l*O+c*T)*A,t[1]=(i*O-r*C-o*T)*A,t[2]=(g*k-v*w+m*E)*A,t[3]=(d*w-h*k-f*E)*A,t[4]=(l*N-a*C-c*S)*A,t[5]=(n*C-i*N+o*S)*A,t[6]=(v*x-p*k-m*b)*A,t[7]=(u*k-d*x+f*b)*A,t[8]=(a*O-s*N+c*M)*A,t[9]=(r*N-n*O-o*M)*A,t[10]=(p*w-g*x+m*y)*A,t[11]=(h*x-u*w-f*y)*A,t[12]=(s*S-a*T-l*M)*A,t[13]=(n*T-r*S+i*M)*A,t[14]=(g*b-p*E-v*y)*A,t[15]=(u*E-h*b+d*y)*A,t):null}function I(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],f=t[12],p=t[13],g=t[14],v=e*a-n*o,m=e*s-r*o,y=n*s-r*a,b=c*p-u*f,x=c*g-h*f,E=u*g-h*p;return l*(e*E-n*x+r*b)-i*(o*E-a*x+s*b)+t[15]*(c*y-u*m+h*v)-d*(f*y-p*m+g*v)}function j(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],v=e[13],m=e[14],y=e[15],b=n[0],x=n[1],E=n[2],w=n[3];return t[0]=b*r+x*s+E*h+w*g,t[1]=b*i+x*l+E*d+w*v,t[2]=b*o+x*c+E*f+w*m,t[3]=b*a+x*u+E*p+w*y,b=n[4],x=n[5],E=n[6],w=n[7],t[4]=b*r+x*s+E*h+w*g,t[5]=b*i+x*l+E*d+w*v,t[6]=b*o+x*c+E*f+w*m,t[7]=b*a+x*u+E*p+w*y,b=n[8],x=n[9],E=n[10],w=n[11],t[8]=b*r+x*s+E*h+w*g,t[9]=b*i+x*l+E*d+w*v,t[10]=b*o+x*c+E*f+w*m,t[11]=b*a+x*u+E*p+w*y,b=n[12],x=n[13],E=n[14],w=n[15],t[12]=b*r+x*s+E*h+w*g,t[13]=b*i+x*l+E*d+w*v,t[14]=b*o+x*c+E*f+w*m,t[15]=b*a+x*u+E*p+w*y,t}function B(t,e,n){var r,i,o,a,s,l,c,u,h,d,f,p,g=n[0],v=n[1],m=n[2];return e===t?(t[12]=e[0]*g+e[4]*v+e[8]*m+e[12],t[13]=e[1]*g+e[5]*v+e[9]*m+e[13],t[14]=e[2]*g+e[6]*v+e[10]*m+e[14],t[15]=e[3]*g+e[7]*v+e[11]*m+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],f=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=d,t[10]=f,t[11]=p,t[12]=r*g+s*v+h*m+e[12],t[13]=i*g+l*v+d*m+e[13],t[14]=o*g+c*v+f*m+e[14],t[15]=a*g+u*v+p*m+e[15]),t}function F(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function z(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*r,t[5]=a*i+u*r,t[6]=s*i+h*r,t[7]=l*i+d*r,t[8]=c*i-o*r,t[9]=u*i-a*r,t[10]=h*i-s*r,t[11]=d*i-l*r,t}function G(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],s=e[2],l=e[3],c=e[8],u=e[9],h=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*r,t[1]=a*i-u*r,t[2]=s*i-h*r,t[3]=l*i-d*r,t[8]=o*r+c*i,t[9]=a*r+u*i,t[10]=s*r+h*i,t[11]=l*r+d*i,t}function V(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function W(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function H(t,e,n){var r,i,o,a=n[0],s=n[1],l=n[2],c=Math.sqrt(a*a+s*s+l*l);return c<S?null:(a*=c=1/c,s*=c,l*=c,r=Math.sin(e),o=1-(i=Math.cos(e)),t[0]=a*a*o+i,t[1]=s*a*o+l*r,t[2]=l*a*o-s*r,t[3]=0,t[4]=a*s*o-l*r,t[5]=s*s*o+i,t[6]=l*s*o+a*r,t[7]=0,t[8]=a*l*o+s*r,t[9]=s*l*o-a*r,t[10]=l*l*o+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function U(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function $(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Y(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function q(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=r+r,l=i+i,c=o+o,u=r*s,h=r*l,d=r*c,f=i*l,p=i*c,g=o*c,v=a*s,m=a*l,y=a*c;return t[0]=1-(f+g),t[1]=h+y,t[2]=d-m,t[3]=0,t[4]=h-y,t[5]=1-(u+g),t[6]=p+v,t[7]=0,t[8]=d+m,t[9]=p-v,t[10]=1-(u+f),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function X(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function K(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],s=e[6],l=e[8],c=e[9],u=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(o*o+a*a+s*s),t[2]=Math.sqrt(l*l+c*c+u*u),t}function Z(t,e){var n=new N(3);K(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,s=e[1]*i,l=e[2]*o,c=e[4]*r,u=e[5]*i,h=e[6]*o,d=e[8]*r,f=e[9]*i,p=e[10]*o,g=a+u+p,v=0;return g>0?(v=2*Math.sqrt(g+1),t[3]=.25*v,t[0]=(h-f)/v,t[1]=(d-l)/v,t[2]=(s-c)/v):a>u&&a>p?(v=2*Math.sqrt(1+a-u-p),t[3]=(h-f)/v,t[0]=.25*v,t[1]=(s+c)/v,t[2]=(d+l)/v):u>p?(v=2*Math.sqrt(1+u-a-p),t[3]=(d-l)/v,t[0]=(s+c)/v,t[1]=.25*v,t[2]=(h+f)/v):(v=2*Math.sqrt(1+p-a-u),t[3]=(s-c)/v,t[0]=(d+l)/v,t[1]=(h+f)/v,t[2]=.25*v),t}function Q(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],l=e[3],c=o+o,u=a+a,h=s+s,d=o*c,f=o*u,p=o*h,g=a*u,v=a*h,m=s*h,y=l*c,b=l*u,x=l*h,E=r[0],w=r[1],k=r[2],M=i[0],S=i[1],N=i[2],T=(1-(g+m))*E,O=(f+x)*E,C=(p-b)*E,A=(f-x)*w,P=(1-(d+m))*w,R=(v+y)*w,D=(p+b)*k,L=(v-y)*k,_=(1-(d+g))*k;return t[0]=T,t[1]=O,t[2]=C,t[3]=0,t[4]=A,t[5]=P,t[6]=R,t[7]=0,t[8]=D,t[9]=L,t[10]=_,t[11]=0,t[12]=n[0]+M-(T*M+A*S+D*N),t[13]=n[1]+S-(O*M+P*S+L*N),t[14]=n[2]+N-(C*M+R*S+_*N),t[15]=1,t}function J(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,s=r+r,l=i+i,c=n*a,u=r*a,h=r*s,d=i*a,f=i*s,p=i*l,g=o*a,v=o*s,m=o*l;return t[0]=1-h-p,t[1]=u+m,t[2]=d-v,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=f+g,t[7]=0,t[8]=d+v,t[9]=f-g,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function tt(t,e,n,r,i){var o=1/Math.tan(e/2);if(t[0]=o/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){var a=1/(r-i);t[10]=(i+r)*a,t[14]=2*i*r*a}else t[10]=-1,t[14]=-2*r;return t}var et=tt;function nt(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=(a+o)*c,t[15]=1,t}var rt=nt;function it(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=o*c,t[15]=1,t}function ot(t,e,n,r){var i,o,a,s,l,c,u,h,d,f,p=e[0],g=e[1],v=e[2],m=r[0],y=r[1],b=r[2],x=n[0],E=n[1],w=n[2];return Math.abs(p-x)<S&&Math.abs(g-E)<S&&Math.abs(v-w)<S?D(t):(u=p-x,h=g-E,d=v-w,i=y*(d*=f=1/Math.sqrt(u*u+h*h+d*d))-b*(h*=f),o=b*(u*=f)-m*d,a=m*h-y*u,(f=Math.sqrt(i*i+o*o+a*a))?(i*=f=1/f,o*=f,a*=f):(i=0,o=0,a=0),s=h*a-d*o,l=d*i-u*a,c=u*o-h*i,(f=Math.sqrt(s*s+l*l+c*c))?(s*=f=1/f,l*=f,c*=f):(s=0,l=0,c=0),t[0]=i,t[1]=s,t[2]=u,t[3]=0,t[4]=o,t[5]=l,t[6]=h,t[7]=0,t[8]=a,t[9]=c,t[10]=d,t[11]=0,t[12]=-(i*p+o*g+a*v),t[13]=-(s*p+l*g+c*v),t[14]=-(u*p+h*g+d*v),t[15]=1,t)}function at(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function st(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}var lt=j,ct=at,ut=Object.freeze({__proto__:null,add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},adjoint:function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],m=e[15],y=n*s-r*a,b=n*l-i*a,x=n*c-o*a,E=r*l-i*s,w=r*c-o*s,k=i*c-o*l,M=u*g-h*p,S=u*v-d*p,N=u*m-f*p,T=h*v-d*g,O=h*m-f*g,C=d*m-f*v;return t[0]=s*C-l*O+c*T,t[1]=i*O-r*C-o*T,t[2]=g*k-v*w+m*E,t[3]=d*w-h*k-f*E,t[4]=l*N-a*C-c*S,t[5]=n*C-i*N+o*S,t[6]=v*x-p*k-m*b,t[7]=u*k-d*x+f*b,t[8]=a*O-s*N+c*M,t[9]=r*N-n*O-o*M,t[10]=p*w-g*x+m*y,t[11]=h*x-u*w-f*y,t[12]=s*S-a*T-l*M,t[13]=n*T-r*S+i*M,t[14]=g*b-p*E-v*y,t[15]=u*E-h*b+d*y,t},clone:C,copy:A,create:O,decompose:function(t,e,n,r){e[0]=r[12],e[1]=r[13],e[2]=r[14];var i=r[0],o=r[1],a=r[2],s=r[4],l=r[5],c=r[6],u=r[8],h=r[9],d=r[10];n[0]=Math.sqrt(i*i+o*o+a*a),n[1]=Math.sqrt(s*s+l*l+c*c),n[2]=Math.sqrt(u*u+h*h+d*d);var f=1/n[0],p=1/n[1],g=1/n[2],v=i*f,m=o*p,y=a*g,b=s*f,x=l*p,E=c*g,w=u*f,k=h*p,M=d*g,S=v+x+M,N=0;return S>0?(N=2*Math.sqrt(S+1),t[3]=.25*N,t[0]=(E-k)/N,t[1]=(w-y)/N,t[2]=(m-b)/N):v>x&&v>M?(N=2*Math.sqrt(1+v-x-M),t[3]=(E-k)/N,t[0]=.25*N,t[1]=(m+b)/N,t[2]=(w+y)/N):x>M?(N=2*Math.sqrt(1+x-v-M),t[3]=(w-y)/N,t[0]=(m+b)/N,t[1]=.25*N,t[2]=(E+k)/N):(N=2*Math.sqrt(1+M-v-x),t[3]=(m-b)/N,t[0]=(w+y)/N,t[1]=(E+k)/N,t[2]=.25*N),t},determinant:I,equals:function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],p=t[12],g=t[13],v=t[14],m=t[15],y=e[0],b=e[1],x=e[2],E=e[3],w=e[4],k=e[5],M=e[6],N=e[7],T=e[8],O=e[9],C=e[10],A=e[11],P=e[12],R=e[13],D=e[14],L=e[15];return Math.abs(n-y)<=S*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(r-b)<=S*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-x)<=S*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-E)<=S*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(a-w)<=S*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-k)<=S*Math.max(1,Math.abs(s),Math.abs(k))&&Math.abs(l-M)<=S*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-N)<=S*Math.max(1,Math.abs(c),Math.abs(N))&&Math.abs(u-T)<=S*Math.max(1,Math.abs(u),Math.abs(T))&&Math.abs(h-O)<=S*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(d-C)<=S*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(f-A)<=S*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(p-P)<=S*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(g-R)<=S*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(v-D)<=S*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(m-L)<=S*Math.max(1,Math.abs(m),Math.abs(L))},exactEquals:st,frob:function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])},fromQuat:J,fromQuat2:function(t,e){var n=new N(3),r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=r*r+i*i+o*o+a*a;return h>0?(n[0]=2*(s*a+u*r+l*o-c*i)/h,n[1]=2*(l*a+u*i+c*r-s*o)/h,n[2]=2*(c*a+u*o+s*i-l*r)/h):(n[0]=2*(s*a+u*r+l*o-c*i),n[1]=2*(l*a+u*i+c*r-s*o),n[2]=2*(c*a+u*o+s*i-l*r)),q(t,e,n),t},fromRotation:H,fromRotationTranslation:q,fromRotationTranslationScale:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,c=o+o,u=a+a,h=i*l,d=i*c,f=i*u,p=o*c,g=o*u,v=a*u,m=s*l,y=s*c,b=s*u,x=r[0],E=r[1],w=r[2];return t[0]=(1-(p+v))*x,t[1]=(d+b)*x,t[2]=(f-y)*x,t[3]=0,t[4]=(d-b)*E,t[5]=(1-(h+v))*E,t[6]=(g+m)*E,t[7]=0,t[8]=(f+y)*w,t[9]=(g-m)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},fromRotationTranslationScaleOrigin:Q,fromScaling:W,fromTranslation:V,fromValues:P,fromXRotation:U,fromYRotation:$,fromZRotation:Y,frustum:function(t,e,n,r,i,o,a){var s=1/(n-e),l=1/(i-r),c=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*l,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*c,t[15]=0,t},getRotation:Z,getScaling:K,getTranslation:X,identity:D,invert:_,lookAt:ot,mul:lt,multiply:j,multiplyScalar:function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},multiplyScalarAndAdd:function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},ortho:rt,orthoNO:nt,orthoZO:it,perspective:et,perspectiveFromFieldOfView:function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),c=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(a-s)*l*.5,t[9]=(i-o)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},perspectiveNO:tt,perspectiveZO:function(t,e,n,r,i){var o=1/Math.tan(e/2);if(t[0]=o/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){var a=1/(r-i);t[10]=i*a,t[14]=i*r*a}else t[10]=-1,t[14]=-r;return t},rotate:function(t,e,n,r){var i,o,a,s,l,c,u,h,d,f,p,g,v,m,y,b,x,E,w,k,M,N,T,O,C=r[0],A=r[1],P=r[2],R=Math.sqrt(C*C+A*A+P*P);return R<S?null:(C*=R=1/R,A*=R,P*=R,i=Math.sin(n),a=1-(o=Math.cos(n)),s=e[0],l=e[1],c=e[2],u=e[3],h=e[4],d=e[5],f=e[6],p=e[7],g=e[8],v=e[9],m=e[10],y=e[11],b=C*C*a+o,x=A*C*a+P*i,E=P*C*a-A*i,w=C*A*a-P*i,k=A*A*a+o,M=P*A*a+C*i,N=C*P*a+A*i,T=A*P*a-C*i,O=P*P*a+o,t[0]=s*b+h*x+g*E,t[1]=l*b+d*x+v*E,t[2]=c*b+f*x+m*E,t[3]=u*b+p*x+y*E,t[4]=s*w+h*k+g*M,t[5]=l*w+d*k+v*M,t[6]=c*w+f*k+m*M,t[7]=u*w+p*k+y*M,t[8]=s*N+h*T+g*O,t[9]=l*N+d*T+v*O,t[10]=c*N+f*T+m*O,t[11]=u*N+p*T+y*O,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},rotateX:z,rotateY:G,rotateZ:function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],u=e[5],h=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*r,t[1]=a*i+u*r,t[2]=s*i+h*r,t[3]=l*i+d*r,t[4]=c*i-o*r,t[5]=u*i-a*r,t[6]=h*i-s*r,t[7]=d*i-l*r,t},scale:F,set:R,str:function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},sub:ct,subtract:at,targetTo:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=r[0],l=r[1],c=r[2],u=i-n[0],h=o-n[1],d=a-n[2],f=u*u+h*h+d*d;f>0&&(u*=f=1/Math.sqrt(f),h*=f,d*=f);var p=l*d-c*h,g=c*u-s*d,v=s*h-l*u;return(f=p*p+g*g+v*v)>0&&(p*=f=1/Math.sqrt(f),g*=f,v*=f),t[0]=p,t[1]=g,t[2]=v,t[3]=0,t[4]=h*v-d*g,t[5]=d*p-u*v,t[6]=u*g-h*p,t[7]=0,t[8]=u,t[9]=h,t[10]=d,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t},translate:B,transpose:L});function ht(){var t=new N(3);return N!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function dt(t){var e=new N(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function ft(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function pt(t,e,n){var r=new N(3);return r[0]=t,r[1]=e,r[2]=n,r}function gt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function vt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function mt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function yt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function bt(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function xt(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Et(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function wt(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=i*l-o*s,t[1]=o*a-r*l,t[2]=r*s-i*a,t}function kt(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function Mt(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function St(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2];return Math.abs(n-o)<=S*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=S*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=S*Math.max(1,Math.abs(i),Math.abs(s))}var Nt=yt,Tt=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},Ot=ft;function Ct(){var t=new N(4);return N!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function At(t,e,n,r){var i=new N(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function Pt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}function Rt(){var t=new N(4);return N!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Dt(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Lt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=n[0],l=n[1],c=n[2],u=n[3];return t[0]=r*u+a*s+i*c-o*l,t[1]=i*u+a*l+o*s-r*c,t[2]=o*u+a*c+r*l-i*s,t[3]=a*u-r*s-i*l-o*c,t}function _t(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=o*s,t}function It(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,r*=o,n*=o;var a=Math.sin(e),s=Math.cos(e),l=Math.sin(n),c=Math.cos(n),u=Math.sin(r),h=Math.cos(r);switch(i){case"xyz":t[0]=a*c*h+s*l*u,t[1]=s*l*h-a*c*u,t[2]=s*c*u+a*l*h,t[3]=s*c*h-a*l*u;break;case"xzy":t[0]=a*c*h-s*l*u,t[1]=s*l*h-a*c*u,t[2]=s*c*u+a*l*h,t[3]=s*c*h+a*l*u;break;case"yxz":t[0]=a*c*h+s*l*u,t[1]=s*l*h-a*c*u,t[2]=s*c*u-a*l*h,t[3]=s*c*h+a*l*u;break;case"yzx":t[0]=a*c*h+s*l*u,t[1]=s*l*h+a*c*u,t[2]=s*c*u-a*l*h,t[3]=s*c*h-a*l*u;break;case"zxy":t[0]=a*c*h-s*l*u,t[1]=s*l*h+a*c*u,t[2]=s*c*u+a*l*h,t[3]=s*c*h-a*l*u;break;case"zyx":t[0]=a*c*h-s*l*u,t[1]=s*l*h+a*c*u,t[2]=s*c*u-a*l*h,t[3]=s*c*h+a*l*u;break;default:throw new Error("Unknown angle order "+i)}return t}ht(),function(){var t=Ct()}();var jt=At,Bt=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Ft=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},zt=Lt,Gt=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t};function Vt(){var t=new N(2);return N!=Float32Array&&(t[0]=0,t[1]=0),t}ht(),pt(1,0,0),pt(0,1,0),Rt(),Rt(),T(),function(){var t=Vt()}();var Wt=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},Ht=function(t,e){return void 0===e&&(e=[]),function(t,e){if(!Wt(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];e(i,r)&&n.push(i)}return n}(t,function(t){return!function(t,e){return!!Wt(t)&&t.indexOf(e)>-1}(e,t)})};function Ut(t){return"function"==typeof t}function $t(t){return null==t}function Yt(t){return Array.isArray(t)}var qt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Xt(t,e){if(t)if(Yt(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(qt(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var Kt=function(t){return"object"==typeof t&&null!==t},Zt={}.toString,Qt=function(t,e){return Zt.call(t)==="[object "+e+"]"},Jt=function(t){if(!Kt(t)||!Qt(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function te(t){if(!Array.isArray(t))return-1/0;var e=t.length;if(!e)return-1/0;for(var n=t[0],r=1;r<e;r++)n=Math.max(n,t[r]);return n}var ee=function(t){if(Yt(t))return t.reduce(function(t,e){return Math.min(t,e)},t[0])};function ne(t){return"string"==typeof t}var re=Object.prototype.hasOwnProperty;function ie(t,e){if(!e||!Yt(t))return{};for(var n,r={},i=Ut(e)?e:function(t){return t[e]},o=0;o<t.length;o++){var a=t[o];n=i(a),re.call(r,n)?r[n].push(a):r[n]=[a]}return r}var oe=function(t,e,n){return t<e?e:t>n?n:t};function ae(t){return"number"==typeof t}function se(t,e,n){return void 0===n&&(n=1e-5),t===e||Math.abs(t-e)<n}var le=function(t,e){if(Yt(t)){for(var n,r=-1/0,i=0;i<t.length;i++){var o=t[i],a=Ut(e)?e(o):o[e];a>r&&(n=o,r=a)}return n}},ce=function(t,e){if(Yt(t)){for(var n,r=1/0,i=0;i<t.length;i++){var o=t[i],a=Ut(e)?e(o):o[e];a<r&&(n=o,r=a)}return n}},ue=function(t,e){return(t%e+e)%e},he=function(t){return $t(t)?"":t.toString()};var de=function(t){var e=he(t);return e.charAt(0).toUpperCase()+e.substring(1)},fe={}.toString,pe=function(t){return Qt(t,"Boolean")};var ge=Object.prototype,ve=function(t){return void 0===t};function me(t,e){for(var n in e)e.hasOwnProperty(n)&&"constructor"!==n&&void 0!==e[n]&&(t[n]=e[n])}var ye=function(t){if("object"!=typeof t||null===t)return t;var e;if(Yt(t)){e=[];for(var n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=ye(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=ye(t[i]):e[i]=t[i];return e};function be(t,e,n){var r;return function(){var n=this,i=arguments;clearTimeout(r),r=setTimeout(function(){r=null,t.apply(n,i)},e)}}var xe=new Map;function Ee(t,e,n){void 0===n&&(n=128);return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0];xe.has(t)||xe.set(t,function(t){var e,n,r,i=t||1;function o(t,o){++e>i&&(r=n,a(1),++e),n[t]=o}function a(t){e=0,n=Object.create(null),t||(r=Object.create(null))}return a(),{clear:a,has:function(t){return void 0!==n[t]||void 0!==r[t]},get:function(t){var e=n[t];return void 0!==e?e:void 0!==(e=r[t])?(o(t,e),e):void 0},set:function(t,e){void 0!==n[t]?n[t]=e:o(t,e)}}}(n));var a=xe.get(t);if(a.has(o))return a.get(o);var s=t.apply(this,r);return a.set(o,s),s}}function we(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function ke(t,e,n,r){for(var i in n=n||0,r=r||5,e)if(we(e,i)){var o=e[i];null!==o&&Jt(o)?(Jt(t[i])||(t[i]={}),n<r?ke(t[i],o,n+1,r):t[i]=e[i]):Yt(o)?(t[i]=[],t[i]=t[i].concat(o)):void 0!==o&&(t[i]=o)}}var Me=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)ke(t,e[r]);return t},Se=Object.prototype.hasOwnProperty;function Ne(t){if($t(t))return!0;if(Wt(t))return!t.length;var e=function(t){return fe.call(t).replace(/^\[object /,"").replace(/]$/,"")}(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ge)}(t))return!Object.keys(t).length;for(var n in t)if(Se.call(t,n))return!1;return!0}var Te=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(ne(t)||ne(e))return!1;if(Wt(t)||Wt(e)){if(t.length!==e.length)return!1;for(var n=!0,r=0;r<t.length&&(n=Te(t[r],e[r]));r++);return n}if(Kt(t)||Kt(e)){var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(n=!0,r=0;r<i.length&&(n=Te(t[i[r]],e[i[r]]));r++);return n}return!1},Oe=function(t,e,n){for(var r=0,i=ne(e)?e.split("."):e;t&&r<i.length;)t=t[i[r++]];return void 0===t||r<i.length?n:t},Ce=function(t,e,n){var r=t,i=ne(e)?e.split("."):e;return i.forEach(function(t,e){e<i.length-1?(qt(r[t])||(r[t]=ae(i[e+1])?[]:{}),r=r[t]):r[t]=n}),t},Ae=Object.prototype.hasOwnProperty,Pe=function(t,e){if(null===t||!Jt(t))return{};var n={};return Xt(e,function(e){Ae.call(t,e)&&(n[e]=t[e])}),n},Re=function(t,e){return function(t,e,n){if(!Yt(t)&&!Jt(t))return t;var r=n;return Xt(t,function(t,n){r=e(r,t,n)}),r}(t,function(t,n,r){return e.includes(r)||(t[r]=n),t},{})},De=function(t,e,n){var r,i,o,a,s=0;n||(n={});var l=function(){s=!1===n.leading?0:Date.now(),r=null,a=t.apply(i,o),r||(i=o=null)},c=function(){var c=Date.now();s||!1!==n.leading||(s=c);var u=e-(c-s);return i=this,o=arguments,u<=0||u>e?(r&&(clearTimeout(r),r=null),s=c,a=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(l,u)),a};return c.cancel=function(){clearTimeout(r),s=0,r=i=o=null},c},Le={},_e=function(){},Ie=function(t){return t},je=function(t,e){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},je(t,e)};function Be(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}je(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Fe=function(){return Fe=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Fe.apply(this,arguments)};function ze(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function Ge(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}l((r=r.apply(t,e||[])).next())})}function Ve(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function We(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function He(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function Ue(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}"function"==typeof SuppressedError&&SuppressedError;var $e={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function Ye(t,e,n){if(t[n].length>7){t[n].shift();for(var r=t[n],i=n;r.length;)e[n]="A",t.splice(i+=1,0,["C"].concat(r.splice(0,6)));t.splice(n,1)}}var qe={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function Xe(t){return Array.isArray(t)&&t.every(function(t){var e=t[0].toLowerCase();return qe[e]===t.length-1&&"achlmqstvz".includes(e)})}function Ke(t){return Xe(t)&&t.every(function(t){var e=t[0];return e===e.toUpperCase()})}function Ze(t){return Ke(t)&&t.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function Qe(t){for(var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;r.length>=qe[n]&&("m"===n&&r.length>2?(t.segments.push([e].concat(r.splice(0,2))),n="l",e="m"===e?"l":"L"):t.segments.push([e].concat(r.splice(0,qe[n]))),qe[n]););}function Je(t){var e=t.index,n=t.pathValue,r=n.charCodeAt(e);return 48===r?(t.param=0,void(t.index+=1)):49===r?(t.param=1,void(t.index+=1)):void(t.err='[path-util]: invalid Arc flag "'.concat(n[e],'", expecting 0 or 1 at index ').concat(e))}function tn(t){return t>=48&&t<=57||43===t||45===t||46===t}function en(t){return t>=48&&t<=57}function nn(t){var e,n=t.max,r=t.pathValue,i=t.index,o=i,a=!1,s=!1,l=!1,c=!1;if(o>=n)t.err="[path-util]: Invalid path value at index ".concat(o,', "pathValue" is missing param');else if(43!==(e=r.charCodeAt(o))&&45!==e||(o+=1,e=r.charCodeAt(o)),en(e)||46===e){if(46!==e){if(a=48===e,o+=1,e=r.charCodeAt(o),a&&o<n&&e&&en(e))return void(t.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(r[i],'" illegal number'));for(;o<n&&en(r.charCodeAt(o));)o+=1,s=!0;e=r.charCodeAt(o)}if(46===e){for(c=!0,o+=1;en(r.charCodeAt(o));)o+=1,l=!0;e=r.charCodeAt(o)}if(101===e||69===e){if(c&&!s&&!l)return void(t.err="[path-util]: Invalid path value at index ".concat(o,', "').concat(r[o],'" invalid float exponent'));if(o+=1,43!==(e=r.charCodeAt(o))&&45!==e||(o+=1),!(o<n&&en(r.charCodeAt(o))))return void(t.err="[path-util]: Invalid path value at index ".concat(o,', "').concat(r[o],'" invalid integer exponent'));for(;o<n&&en(r.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(i,o)}else t.err="[path-util]: Invalid path value at index ".concat(o,', "').concat(r[o],'" is not a number')}function rn(t){return 10===t||13===t||8232===t||8233===t||32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function on(t){for(var e=t.pathValue,n=t.max;t.index<n&&rn(e.charCodeAt(t.index));)t.index+=1}function an(t){return 97==(32|t)}function sn(t){var e=t.max,n=t.pathValue,r=t.index,i=n.charCodeAt(r),o=qe[n[r].toLowerCase()];if(t.segmentStart=r,function(t){switch(32|t){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}}(i))if(t.index+=1,on(t),t.data=[],o){for(;;){for(var a=o;a>0;a-=1){if(!an(i)||3!==a&&4!==a?nn(t):Je(t),t.err.length)return;t.data.push(t.param),on(t),t.index<e&&44===n.charCodeAt(t.index)&&(t.index+=1,on(t))}if(t.index>=t.max)break;if(!tn(n.charCodeAt(t.index)))break}Qe(t)}else Qe(t);else t.err='[path-util]: Invalid path value "'.concat(n[r],'" is not a path command')}var ln=function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""};function cn(t){if(Ke(t))return[].concat(t);var e=function(t){if(Xe(t))return[].concat(t);var e=new ln(t);for(on(e);e.index<e.max&&!e.err.length;)sn(e);return e.err?e.err:e.segments}(t),n=0,r=0,i=0,o=0;return e.map(function(t){var e,a=t.slice(1).map(Number),s=t[0],l=s.toUpperCase();if("M"===s)return n=a[0],r=a[1],i=n,o=r,["M",n,r];if(s!==l)switch(l){case"A":e=[l,a[0],a[1],a[2],a[3],a[4],a[5]+n,a[6]+r];break;case"V":e=[l,a[0]+r];break;case"H":e=[l,a[0]+n];break;default:var c=a.map(function(t,e){return t+(e%2?r:n)});e=[l].concat(c)}else e=[l].concat(a);var u=e.length;switch(l){case"Z":n=i,r=o;break;case"H":n=e[1];break;case"V":r=e[1];break;default:n=e[u-2],r=e[u-1],"M"===l&&(i=n,o=r)}return e})}function un(t,e){var n=t[0],r=e.x1,i=e.y1,o=e.x2,a=e.y2,s=t.slice(1).map(Number),l=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)l=["L",t[1],i];else if("V"===n)l=["L",r,t[1]];else if("S"===n){var c=2*r-o,u=2*i-a;e.x1=c,e.y1=u,l=["C",c,u].concat(s)}else if("T"===n){var h=2*r-e.qx,d=2*i-e.qy;e.qx=h,e.qy=d,l=["Q",h,d].concat(s)}else if("Q"===n){var f=s[0],p=s[1];e.qx=f,e.qy=p}return l}function hn(t){if(Ze(t))return[].concat(t);for(var e=cn(t),n=Fe({},$e),r=0;r<e.length;r+=1){e[r]=un(e[r],n);var i=e[r],o=i.length;n.x1=+i[o-2],n.y1=+i[o-1],n.x2=+i[o-4]||n.x1,n.y2=+i[o-3]||n.y1}return e}function dn(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function fn(t,e,n,r,i,o,a,s,l,c){var u,h,d,f,p,g=t,v=e,m=n,y=r,b=s,x=l,E=120*Math.PI/180,w=Math.PI/180*(+i||0),k=[];if(c)h=c[0],d=c[1],f=c[2],p=c[3];else{g=(u=dn(g,v,-w)).x,v=u.y;var M=(g-(b=(u=dn(b,x,-w)).x))/2,S=(v-(x=u.y))/2,N=M*M/(m*m)+S*S/(y*y);N>1&&(m*=N=Math.sqrt(N),y*=N);var T=m*m,O=y*y,C=(o===a?-1:1)*Math.sqrt(Math.abs((T*O-T*S*S-O*M*M)/(T*S*S+O*M*M)));f=C*m*S/y+(g+b)/2,p=C*-y*M/m+(v+x)/2,h=Math.asin(((v-p)/y*Math.pow(10,9)|0)/Math.pow(10,9)),d=Math.asin(((x-p)/y*Math.pow(10,9)|0)/Math.pow(10,9)),h=g<f?Math.PI-h:h,d=b<f?Math.PI-d:d,h<0&&(h=2*Math.PI+h),d<0&&(d=2*Math.PI+d),a&&h>d&&(h-=2*Math.PI),!a&&d>h&&(d-=2*Math.PI)}var A=d-h;if(Math.abs(A)>E){var P=d,R=b,D=x;d=h+E*(a&&d>h?1:-1),k=fn(b=f+m*Math.cos(d),x=p+y*Math.sin(d),m,y,i,0,a,R,D,[d,P,f,p])}A=d-h;var L=Math.cos(h),_=Math.sin(h),I=Math.cos(d),j=Math.sin(d),B=Math.tan(A/4),F=4/3*m*B,z=4/3*y*B,G=[g,v],V=[g+F*_,v-z*L],W=[b+F*j,x-z*I],H=[b,x];if(V[0]=2*G[0]-V[0],V[1]=2*G[1]-V[1],c)return V.concat(W,H,k);for(var U=[],$=0,Y=(k=V.concat(W,H,k)).length;$<Y;$+=1)U[$]=$%2?dn(k[$-1],k[$],w).y:dn(k[$],k[$+1],w).x;return U}function pn(t,e,n){var r=t[0],i=t[1];return[r+(e[0]-r)*n,i+(e[1]-i)*n]}var gn=function(t,e,n,r){return He(He([],pn([t,e],[n,r],.5),!0),[n,r,n,r],!1)};function vn(t,e){var n,r,i,o,a,s,l,c,u,h=t[0],d=t.slice(1).map(Number),f=d[0],p=d[1],g=e.x1,v=e.y1,m=e.x,y=e.y;switch("TQ".includes(h)||(e.qx=null,e.qy=null),h){case"M":return e.x=f,e.y=p,t;case"A":return n=[g,v].concat(d),["C"].concat(fn(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9]));case"Q":return e.qx=f,e.qy=p,n=[g,v].concat(d),["C"].concat((r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],[(c=1/3)*r+(u=2/3)*o,c*i+u*a,c*s+u*o,c*l+u*a,s,l]));case"L":return["C"].concat(gn(g,v,f,p));case"Z":return g===m&&v===y?["C",g,v,m,y,m,y]:["C"].concat(gn(g,v,m,y))}return t}function mn(t,e){if(void 0===e&&(e=!1),function(t){return Ze(t)&&t.every(function(t){var e=t[0];return"MC".includes(e)})}(t)){var n=[].concat(t);return e?[n,[]]:n}for(var r,i,o=hn(t),a=Fe({},$e),s=[],l="",c=o.length,u=[],h=0;h<c;h+=1){o[h]&&(l=o[h][0]),s[h]=l;var d=vn(o[h],a);o[h]=d,Ye(o,s,h),c=o.length,"Z"===l&&u.push(h),i=(r=o[h]).length,a.x1=+r[i-2],a.y1=+r[i-1],a.x2=+r[i-4]||a.x1,a.y2=+r[i-3]||a.y1}return e?[o,u]:o}function yn(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function bn(t,e,n,r,i){var o=yn([t,e],[n,r]),a={x:0,y:0};if("number"==typeof i)if(i<=0)a={x:t,y:e};else if(i>=o)a={x:n,y:r};else{var s=pn([t,e],[n,r],i/o);a={x:s[0],y:s[1]}}return{length:o,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function xn(t,e){var n=t.x,r=t.y,i=e.x,o=e.y,a=n*i+r*o,s=Math.sqrt((Math.pow(n,2)+Math.pow(r,2))*(Math.pow(i,2)+Math.pow(o,2)));return(n*o-r*i<0?-1:1)*Math.acos(a/s)}function En(t,e,n,r,i,o,a,s,l,c){var u=Math.abs,h=Math.sin,d=Math.cos,f=Math.sqrt,p=Math.PI,g=u(n),v=u(r),m=(i%360+360)%360*(p/180);if(t===s&&e===l)return{x:t,y:e};if(0===g||0===v)return bn(t,e,s,l,c).point;var y=(t-s)/2,b=(e-l)/2,x={x:d(m)*y+h(m)*b,y:-h(m)*y+d(m)*b},E=Math.pow(x.x,2)/Math.pow(g,2)+Math.pow(x.y,2)/Math.pow(v,2);E>1&&(g*=f(E),v*=f(E));var w=(Math.pow(g,2)*Math.pow(v,2)-Math.pow(g,2)*Math.pow(x.y,2)-Math.pow(v,2)*Math.pow(x.x,2))/(Math.pow(g,2)*Math.pow(x.y,2)+Math.pow(v,2)*Math.pow(x.x,2)),k=(o!==a?1:-1)*f(w=w<0?0:w),M=k*(g*x.y/v),S=k*(-v*x.x/g),N=d(m)*M-h(m)*S+(t+s)/2,T=h(m)*M+d(m)*S+(e+l)/2,O={x:(x.x-M)/g,y:(x.y-S)/v},C=xn({x:1,y:0},O),A=xn(O,{x:(-x.x-M)/g,y:(-x.y-S)/v});!a&&A>0?A-=2*p:a&&A<0&&(A+=2*p);var P=C+(A%=2*p)*c,R=g*d(P),D=v*h(P);return{x:d(m)*R-h(m)*D+N,y:h(m)*R+d(m)*D+T}}function wn(t,e,n,r,i,o,a,s,l,c,u){var h,d=u.bbox,f=void 0===d||d,p=u.length,g=void 0===p||p,v=u.sampleSize,m=void 0===v?30:v,y="number"==typeof c,b=t,x=e,E=0,w=[b,x,E],k=[b,x],M={x:0,y:0},S=[{x:b,y:x}];y&&c<=0&&(M={x:b,y:x});for(var N=0;N<=m;N+=1){if(b=(h=En(t,e,n,r,i,o,a,s,l,N/m)).x,x=h.y,f&&S.push({x:b,y:x}),g&&(E+=yn(k,[b,x])),k=[b,x],y&&E>=c&&c>w[2]){var T=(E-c)/(E-w[2]);M={x:k[0]*(1-T)+w[0]*T,y:k[1]*(1-T)+w[1]*T}}w=[b,x,E]}return y&&c>=E&&(M={x:s,y:l}),{length:E,point:M,min:{x:Math.min.apply(null,S.map(function(t){return t.x})),y:Math.min.apply(null,S.map(function(t){return t.y}))},max:{x:Math.max.apply(null,S.map(function(t){return t.x})),y:Math.max.apply(null,S.map(function(t){return t.y}))}}}function kn(t,e,n,r,i,o,a,s,l){var c=1-l;return{x:Math.pow(c,3)*t+3*Math.pow(c,2)*l*n+3*c*Math.pow(l,2)*i+Math.pow(l,3)*a,y:Math.pow(c,3)*e+3*Math.pow(c,2)*l*r+3*c*Math.pow(l,2)*o+Math.pow(l,3)*s}}function Mn(t,e,n,r,i,o,a,s,l,c){var u,h=c.bbox,d=void 0===h||h,f=c.length,p=void 0===f||f,g=c.sampleSize,v=void 0===g?10:g,m="number"==typeof l,y=t,b=e,x=0,E=[y,b,x],w=[y,b],k={x:0,y:0},M=[{x:y,y:b}];m&&l<=0&&(k={x:y,y:b});for(var S=0;S<=v;S+=1){if(y=(u=kn(t,e,n,r,i,o,a,s,S/v)).x,b=u.y,d&&M.push({x:y,y:b}),p&&(x+=yn(w,[y,b])),w=[y,b],m&&x>=l&&l>E[2]){var N=(x-l)/(x-E[2]);k={x:w[0]*(1-N)+E[0]*N,y:w[1]*(1-N)+E[1]*N}}E=[y,b,x]}return m&&l>=x&&(k={x:a,y:s}),{length:x,point:k,min:{x:Math.min.apply(null,M.map(function(t){return t.x})),y:Math.min.apply(null,M.map(function(t){return t.y}))},max:{x:Math.max.apply(null,M.map(function(t){return t.x})),y:Math.max.apply(null,M.map(function(t){return t.y}))}}}function Sn(t,e,n,r,i,o,a){var s=1-a;return{x:Math.pow(s,2)*t+2*s*a*n+Math.pow(a,2)*i,y:Math.pow(s,2)*e+2*s*a*r+Math.pow(a,2)*o}}function Nn(t,e,n,r,i,o,a,s){var l,c=s.bbox,u=void 0===c||c,h=s.length,d=void 0===h||h,f=s.sampleSize,p=void 0===f?10:f,g="number"==typeof a,v=t,m=e,y=0,b=[v,m,y],x=[v,m],E={x:0,y:0},w=[{x:v,y:m}];g&&a<=0&&(E={x:v,y:m});for(var k=0;k<=p;k+=1){if(v=(l=Sn(t,e,n,r,i,o,k/p)).x,m=l.y,u&&w.push({x:v,y:m}),d&&(y+=yn(x,[v,m])),x=[v,m],g&&y>=a&&a>b[2]){var M=(y-a)/(y-b[2]);E={x:x[0]*(1-M)+b[0]*M,y:x[1]*(1-M)+b[1]*M}}b=[v,m,y]}return g&&a>=y&&(E={x:i,y:o}),{length:y,point:E,min:{x:Math.min.apply(null,w.map(function(t){return t.x})),y:Math.min.apply(null,w.map(function(t){return t.y}))},max:{x:Math.max.apply(null,w.map(function(t){return t.x})),y:Math.max.apply(null,w.map(function(t){return t.y}))}}}function Tn(t,e,n){for(var r,i,o,a,s,l,c,u,h,d=hn(t),f="number"==typeof e,p=[],g=0,v=0,m=0,y=0,b=[],x=[],E=0,w={x:0,y:0},k=w,M=w,S=w,N=0,T=0,O=d.length;T<O;T+=1)p=(c="M"===(u=(h=d[T])[0]))?p:[g,v].concat(h.slice(1)),c?(k=w={x:m=h[1],y:y=h[2]},E=0,f&&e<.001&&(S=w)):"L"===u?(E=(r=bn(p[0],p[1],p[2],p[3],(e||0)-N)).length,w=r.min,k=r.max,M=r.point):"A"===u?(E=(i=wn(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],(e||0)-N,n||{})).length,w=i.min,k=i.max,M=i.point):"C"===u?(E=(o=Mn(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],(e||0)-N,n||{})).length,w=o.min,k=o.max,M=o.point):"Q"===u?(E=(a=Nn(p[0],p[1],p[2],p[3],p[4],p[5],(e||0)-N,n||{})).length,w=a.min,k=a.max,M=a.point):"Z"===u&&(E=(s=bn((p=[g,v,m,y])[0],p[1],p[2],p[3],(e||0)-N)).length,w=s.min,k=s.max,M=s.point),f&&N<e&&N+E>=e&&(S=M),x.push(k),b.push(w),N+=E,g=(l="Z"!==u?h.slice(-2):[m,y])[0],v=l[1];return f&&e>=N&&(S={x:g,y:v}),{length:N,point:S,min:{x:Math.min.apply(null,b.map(function(t){return t.x})),y:Math.min.apply(null,b.map(function(t){return t.y}))},max:{x:Math.max.apply(null,x.map(function(t){return t.x})),y:Math.max.apply(null,x.map(function(t){return t.y}))}}}function On(t,e){var n=t.length-1,r=[],i=0,o=function(t){var e=t.length,n=e-1;return t.map(function(r,i){return t.map(function(r,o){var a,s=i+o;return 0===o||t[s]&&"M"===t[s][0]?(a=t[s],["M"].concat(a.slice(-2))):(s>=e&&(s-=n),t[s])})})}(t);return o.forEach(function(o,a){t.slice(1).forEach(function(r,o){i+=yn(t[(a+o)%n].slice(-2),e[o%n].slice(-2))}),r[a]=i,i=0}),o[r.indexOf(Math.min.apply(null,r))]}function Cn(t){return function(t){var e=0,n=0,r=0;return mn(t).map(function(t){var i;if("M"===t[0])return e=t[1],n=t[2],0;var o=t.slice(1),a=o[0],s=o[1],l=o[2],c=o[3],u=o[4],h=o[5];return r=function(t,e,n,r,i,o,a,s){return 3*((s-e)*(n+i)-(a-t)*(r+o)+r*(t-i)-n*(e-o)+s*(i+t/3)-a*(o+e/3))/20}(e,n,a,s,l,c,u,h),i=t.slice(-2),e=i[0],n=i[1],r}).reduce(function(t,e){return t+e},0)}(t)>=0}function An(t){return t.map(function(t,e,n){var r=e&&n[e-1].slice(-2).concat(t.slice(1)),i=e?Mn(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],{bbox:!1}).length:0;return{s:t,ss:e?i?function(t,e){void 0===e&&(e=.5);var n=t.slice(0,2),r=t.slice(2,4),i=t.slice(4,6),o=t.slice(6,8),a=pn(n,r,e),s=pn(r,i,e),l=pn(i,o,e),c=pn(a,s,e),u=pn(s,l,e),h=pn(c,u,e);return[["C"].concat(a,c,h),["C"].concat(u,l,o)]}(r):[t,t]:[t],l:i}})}function Pn(t,e,n,r){if(void 0===r&&(r=0),r>50)return console.warn("Maximum recursion depth reached in equalizeSegments"),[t,e];var i=An(t),o=An(e),a=i.length,s=o.length,l=i.filter(function(t){return t.l}).length,c=o.filter(function(t){return t.l}).length,u=i.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/l||0,h=o.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/c||0,d=n||Math.max(a,s),f=[u,h],p=[d-a,d-s],g=0,v=[i,o].map(function(t,e){return t.l===d?t.map(function(t){return t.s}):t.map(function(t,n){return g=n&&p[e]&&t.l>=f[e],p[e]-=g?1:0,g?t.ss:[t.s]}).flat()});return v[0].length===v[1].length?v:Pn(v[0],v[1],d,r+1)}function Rn(t){var e=document.createElement("div");e.innerHTML=t;var n=e.childNodes[0];return n&&e.contains(n)&&e.removeChild(n),n}function Dn(){return Dn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Dn.apply(null,arguments)}function Ln(t,e,n,r){var i=Dn(f(t.prototype),e,n);return"function"==typeof i?function(t){return i.apply(n,t)}:i}
/*!
* @antv/g-math
* @description Geometry util
* @version 3.0.1
* @date 5/9/2025, 8:18:51 AM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function _n(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function In(t,e){var n=Math.min.apply(Math,d(t)),r=Math.min.apply(Math,d(e));return{x:n,y:r,width:Math.max.apply(Math,d(t))-n,height:Math.max.apply(Math,d(e))-r}}function jn(t,e,n,r,i,o){return n*Math.cos(i)*Math.cos(o)-r*Math.sin(i)*Math.sin(o)+t}function Bn(t,e,n,r,i,o){return n*Math.sin(i)*Math.cos(o)+r*Math.cos(i)*Math.sin(o)+e}function Fn(t,e,n,r,i,o,a){for(var s=function(t,e,n){return Math.atan(-e/t*Math.tan(n))}(n,r,i),l=1/0,c=-1/0,u=[o,a],h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var d=s+h;o<a?o<d&&d<a&&u.push(d):a<d&&d<o&&u.push(d)}for(var f=0;f<u.length;f++){var p=jn(t,0,n,r,i,u[f]);p<l&&(l=p),p>c&&(c=p)}for(var g=function(t,e,n){return Math.atan(e/(t*Math.tan(n)))}(n,r,i),v=1/0,m=-1/0,y=[o,a],b=2*-Math.PI;b<=2*Math.PI;b+=Math.PI){var x=g+b;o<a?o<x&&x<a&&y.push(x):a<x&&x<o&&y.push(x)}for(var E=0;E<y.length;E++){var w=Bn(0,e,n,r,i,y[E]);w<v&&(v=w),w>m&&(m=w)}return{x:l,y:v,width:c-l,height:m-v}}function zn(t,e,n,r,i,o){var a=-1,s=1/0,l=[n,r],c=20;o&&o>200&&(c=o/10);for(var u=1/c,h=u/10,f=0;f<=c;f++){var p=f*u,g=[i.apply(void 0,d(t.concat([p]))),i.apply(void 0,d(e.concat([p])))],v=_n(l[0],l[1],g[0],g[1]);v<s&&(a=p,s=v)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var m=t.length;return{x:t[m-1],y:e[m-1]}}s=1/0;for(var y=0;y<32&&!(h<1e-4);y++){var b=a-h,x=a+h,E=[i.apply(void 0,d(t.concat([b]))),i.apply(void 0,d(e.concat([b])))],w=_n(l[0],l[1],E[0],E[1]);if(b>=0&&w<s)a=b,s=w;else{var k=[i.apply(void 0,d(t.concat([x]))),i.apply(void 0,d(e.concat([x])))],M=_n(l[0],l[1],k[0],k[1]);x<=1&&M<s?(a=x,s=M):h*=.5}}return{x:i.apply(void 0,d(t.concat([a]))),y:i.apply(void 0,d(e.concat([a])))}}function Gn(t,e,n,r){return _n(t,e,n,r)}function Vn(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}}function Wn(t,e,n,r,i,o){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-a[1],a[0]];!function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(s,s);var l=[i-t,o-e];return Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}(l,s))}function Hn(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function Un(t,e,n,r){var i,o,a,s=-3*t+9*e-9*n+3*r,l=6*t-12*e+6*n,c=3*e-3*t,u=[];if(se(s,0))se(l,0)||(i=-c/l)>=0&&i<=1&&u.push(i);else{var h=l*l-4*s*c;se(h,0)?u.push(-l/(2*s)):h>0&&(o=(-l-(a=Math.sqrt(h)))/(2*s),(i=(-l+a)/(2*s))>=0&&i<=1&&u.push(i),o>=0&&o<=1&&u.push(o))}return u}function $n(t,e,n,r,i,o,a,s){for(var l=[t,a],c=[e,s],u=Un(t,n,i,a),h=Un(e,r,o,s),d=0;d<u.length;d++)l.push(Hn(t,n,i,a,u[d]));for(var f=0;f<h.length;f++)c.push(Hn(e,r,o,s,h[f]));return In(l,c)}function Yn(t,e,n,r,i,o,a,s,l,c,u){var h=function(t,e,n,r,i,o,a,s,l,c,u){return zn([t,n,i,a],[e,r,o,s],l,c,Hn,u)}(t,e,n,r,i,o,a,s,l,c,u);return _n(h.x,h.y,l,c)}function qn(t){return function(t){if(t.length<2)return 0;for(var e=0,n=0;n<t.length-1;n++){var r=t[n],i=t[n+1];e+=_n(r[0],r[1],i[0],i[1])}return e}(t)}function Xn(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function Kn(t,e,n){var r=t+n-2*e;if(se(r,0))return[.5];var i=(t-e)/r;return i<=1&&i>=0?[i]:[]}function Zn(t,e,n,r,i,o){var a=Kn(t,n,i)[0],s=Kn(e,r,o)[0],l=[t,i],c=[e,o];return void 0!==a&&l.push(Xn(t,n,i,a)),void 0!==s&&c.push(Xn(e,r,o,s)),In(l,c)}function Qn(t,e,n,r,i,o,a,s){var l=function(t,e,n,r,i,o,a,s){return zn([t,n,i],[e,r,o],a,s,Xn)}(t,e,n,r,i,o,a,s);return _n(l.x,l.y,a,s)}function Jn(t,e){this.v=t,this.k=e}function tr(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}tr=function(t,e,n,r){function o(e,n){tr(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},tr(t,e,n,r)}function er(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return tr(c,"_invoke",function(n,r,i){var o,s,l,c=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,n){return o=e,s=0,l=t,d.n=n,a}};function f(n,r){for(s=n,l=r,e=0;!h&&c&&!i&&e<u.length;e++){var i,o=u[e],f=d.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=f&&((i=n<2&&f<o[1])?(s=0,d.v=r,d.n=o[1]):f<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,u,p){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&f(u,p),s=u,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),f(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=d.n<0)?l:n.call(r,d))!==a)break}catch(e){o=t,s=1,l=e}finally{c=1}}return{value:e,done:h}}}(n,i,o),!0),c}var a={};function s(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][r]?e(e([][r]())):(tr(e={},r,function(){return this}),e),h=c.prototype=s.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,tr(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=c,tr(h,"constructor",c),tr(c,"constructor",l),l.displayName="GeneratorFunction",tr(c,i,"GeneratorFunction"),tr(h),tr(h,i,"Generator"),tr(h,r,function(){return this}),tr(h,"toString",function(){return"[object Generator]"}),(er=function(){return{w:o,m:d}})()}function nr(t,e){function n(r,i,o,a){try{var s=t[r](i),l=s.value;return l instanceof Jn?e.resolve(l.v).then(function(t){n("next",t,o,a)},function(t){n("throw",t,o,a)}):e.resolve(l).then(function(t){s.value=t,o(s)},function(t){return n("throw",t,o,a)})}catch(t){a(t)}}var r;this.next||(tr(nr.prototype),tr(nr.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),tr(this,"_invoke",function(t,i,o){function a(){return new e(function(e,r){n(t,o,e,r)})}return r=r?r.then(a,a):a()},!0)}function rr(t,e,n,r,i){return new nr(er().w(t,e,n,r),i||Promise)}function ir(t,e,n,r,i){var o=rr(t,e,n,r,i);return o.next().then(function(t){return t.done?t.value:o.next()})}function or(t){var e=Object(t),n=[];for(var r in e)n.unshift(r);return function t(){for(;n.length;)if((r=n.pop())in e)return t.value=r,t.done=!1,t;return t.done=!0,t}}function ar(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}throw new TypeError(n(t)+" is not iterable")}function sr(){var t=er(),e=t.m(sr),n=(Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__).constructor;function r(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===n||"GeneratorFunction"===(e.displayName||e.name))}var i={throw:1,return:2,break:3,continue:3};function o(t){var e,n;return function(r){e||(e={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(t,e){return n(r.a,i[t],e)},delegateYield:function(t,i,o){return e.resultName=i,n(r.d,ar(t),o)},finish:function(t){return n(r.f,t)}},n=function(t,n,i){r.p=e.prev,r.n=e.next;try{return t(n,i)}finally{e.next=r.n}}),e.resultName&&(e[e.resultName]=r.v,e.resultName=void 0),e.sent=r.v,e.next=r.n;try{return t.call(this,e)}finally{r.p=e.prev,r.n=e.next}}}return(sr=function(){return{wrap:function(e,n,r,i){return t.w(o(e),n,r,i&&i.reverse())},isGeneratorFunction:r,mark:t.m,awrap:function(t,e){return new Jn(t,e)},AsyncIterator:nr,async:function(t,e,n,i,a){return(r(e)?rr:ir)(o(t),e,n,i,a)},keys:or,values:ar}})()}function lr(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function cr(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){lr(o,r,i,a,s,"next",t)}function s(t){lr(o,r,i,a,s,"throw",t)}a(void 0)})}}function ur(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=h(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function hr(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}
/*!
* @antv/g-lite
* @description A core module for rendering engine implements DOM API.
* @version 2.3.2
* @date 7/30/2025, 1:34:19 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var dr={exports:{}};!function(t){t.exports=function(){function t(t,n,i,o,a){e(t,n,i||0,o||t.length-1,a||r)}function e(t,r,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,l=r-i+1,c=Math.log(s),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);e(t,r,Math.max(i,Math.floor(r-l*u/s+h)),Math.min(o,Math.floor(r+(s-l)*u/s+h)),a)}var d=t[r],f=i,p=o;for(n(t,i,r),a(t[o],d)>0&&n(t,i,o);f<p;){for(n(t,f,p),f++,p--;a(t[f],d)<0;)f++;for(;a(t[p],d)>0;)p--}0===a(t[i],d)?n(t,i,p):n(t,++p,o),p<=r&&(i=p+1),r<=p&&(o=p-1)}}function n(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function r(t,e){return t<e?-1:t>e?1:0}var i=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function a(t,e){s(t,0,t.children.length,e,t)}function s(t,e,n,r,i){i||(i=m(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var a=t.children[o];l(i,t.leaf?r(a):a)}return i}function l(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function c(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function d(t){return t.maxX-t.minX+(t.maxY-t.minY)}function f(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function p(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function g(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function v(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function m(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function y(e,n,r,i,o){for(var a=[n,r];a.length;)if(!((r=a.pop())-(n=a.pop())<=i)){var s=n+Math.ceil((r-n)/i/2)*i;t(e,s,n,r,o),a.push(n,s,s,r)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(t){var e=this.data,n=[];if(!v(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],s=e.leaf?r(a):a;v(t,s)&&(e.leaf?n.push(a):g(t,s)?this._all(a,n):i.push(a))}e=i.pop()}return n},i.prototype.collides=function(t){var e=this.data;if(!v(t,e))return!1;for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(v(t,o)){if(e.leaf||g(t,o))return!0;n.push(i)}}e=n.pop()}return!1},i.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},i.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},i.prototype.clear=function(){return this.data=m([]),this},i.prototype.remove=function(t,e){if(!t)return this;for(var n,r,i,a=this.data,s=this.toBBox(t),l=[],c=[];a||l.length;){if(a||(a=l.pop(),r=l[l.length-1],n=c.pop(),i=!0),a.leaf){var u=o(t,a.children,e);if(-1!==u)return a.children.splice(u,1),l.push(a),this._condense(l),this}i||a.leaf||!g(a,s)?r?(n++,a=r.children[n],i=!1):a=null:(l.push(a),c.push(n),n=0,r=a,a=a.children[0])}return this},i.prototype.toBBox=function(t){return t},i.prototype.compareMinX=function(t,e){return t.minX-e.minX},i.prototype.compareMinY=function(t,e){return t.minY-e.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(t){return this.data=t,this},i.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},i.prototype._build=function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return a(i=m(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=m([])).leaf=!1,i.height=r;var l=Math.ceil(o/s),c=l*Math.ceil(Math.sqrt(s));y(t,e,n,c,this.compareMinX);for(var u=e;u<=n;u+=c){var h=Math.min(u+c-1,n);y(t,u,h,l,this.compareMinY);for(var d=u;d<=h;d+=l){var f=Math.min(d+l-1,h);i.children.push(this._build(t,d,f,r-1))}}return a(i,this.toBBox),i},i.prototype._chooseSubtree=function(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){for(var i=1/0,o=1/0,a=void 0,s=0;s<e.children.length;s++){var l=e.children[s],c=h(l),u=f(t,l)-c;u<o?(o=u,i=c<i?c:i,a=l):u===o&&c<i&&(i=c,a=l)}e=a||e.children[0]}return e},i.prototype._insert=function(t,e,n){var r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),l(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)},i.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=m(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,a(n,this.toBBox),a(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},i.prototype._splitRoot=function(t,e){this.data=m([t,e]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(t,e,n){for(var r,i=1/0,o=1/0,a=e;a<=n-e;a++){var l=s(t,0,a,this.toBBox),c=s(t,a,n,this.toBBox),u=p(l,c),d=h(l)+h(c);u<i?(i=u,r=a,o=d<o?d:o):u===i&&d<o&&(o=d,r=a)}return r||n-e},i.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:c,i=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},i.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=s(t,0,e,i),a=s(t,n-e,n,i),c=d(o)+d(a),u=e;u<n-e;u++){var h=t.children[u];l(o,t.leaf?i(h):h),c+=d(o)}for(var f=n-e-1;f>=e;f--){var p=t.children[f];l(a,t.leaf?i(p):p),c+=d(a)}return c},i.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;r>=0;r--)l(e[r],t)},i.prototype._condense=function(t){for(var e=t.length-1,n=void 0;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():a(t[e],this.toBBox)},i}()}(dr);var fr=dr.exports,pr=function(t){return t.GROUP="g",t.FRAGMENT="fragment",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.IMAGE="image",t.RECT="rect",t.LINE="line",t.POLYLINE="polyline",t.POLYGON="polygon",t.TEXT="text",t.PATH="path",t.HTML="html",t.MESH="mesh",t}({}),gr=function(t){return t[t.ZERO=0]="ZERO",t[t.NEGATIVE_ONE=1]="NEGATIVE_ONE",t}({}),vr=function(){return c(function t(){s(this,t),this.plugins=[]},[{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(e){var n=t.context.renderingPlugins.indexOf(e);n>=0&&t.context.renderingPlugins.splice(n,1)})}}])}(),mr=function(){return c(function t(e){s(this,t),this.clipSpaceNearZ=gr.NEGATIVE_ONE,this.plugins=[],this.config=a({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},e)},[{key:"registerPlugin",value:function(t){-1===this.plugins.findIndex(function(e){return e===t})&&this.plugins.push(t)}},{key:"unregisterPlugin",value:function(t){var e=this.plugins.findIndex(function(e){return e===t});e>-1&&this.plugins.splice(e,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(t){return this.plugins.find(function(e){return e.name===t})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(t){Object.assign(this.config,t)}}])}(),yr=mt,br=gt,xr=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},Er=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},wr=bt,kr=Nt,Mr=function(){function t(){s(this,t),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return c(t,[{key:"update",value:function(t,e){br(this.center,t),br(this.halfExtents,e),kr(this.min,this.center,this.halfExtents),yr(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,e){yr(this.center,e,t),wr(this.center,this.center,.5),kr(this.halfExtents,e,t),wr(this.halfExtents,this.halfExtents,.5),br(this.min,t),br(this.max,e)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!t.isEmpty(e))if(t.isEmpty(this))this.setMinMax(e.getMin(),e.getMax());else{var n=this.center,r=n[0],i=n[1],o=n[2],a=this.halfExtents,s=a[0],l=a[1],c=a[2],u=r-s,h=r+s,d=i-l,f=i+l,p=o-c,g=o+c,v=e.center,m=v[0],y=v[1],b=v[2],x=e.halfExtents,E=x[0],w=x[1],k=x[2],M=m-E,S=m+E,N=y-w,T=y+w,O=b-k,C=b+k;M<u&&(u=M),S>h&&(h=S),N<d&&(d=N),T>f&&(f=T),O<p&&(p=O),C>g&&(g=C),n[0]=.5*(u+h),n[1]=.5*(d+f),n[2]=.5*(p+g),a[0]=.5*(h-u),a[1]=.5*(f-d),a[2]=.5*(g-p),this.min[0]=u,this.min[1]=d,this.min[2]=p,this.max[0]=h,this.max[1]=f,this.max[2]=g}}},{key:"setFromTransformedAABB",value:function(t,e){var n=this.center,r=this.halfExtents,i=t.center,o=t.halfExtents,a=e[0],s=e[4],l=e[8],c=e[1],u=e[5],h=e[9],d=e[2],f=e[6],p=e[10],g=Math.abs(a),v=Math.abs(s),m=Math.abs(l),y=Math.abs(c),b=Math.abs(u),x=Math.abs(h),E=Math.abs(d),w=Math.abs(f),k=Math.abs(p);n[0]=e[12]+a*i[0]+s*i[1]+l*i[2],n[1]=e[13]+c*i[0]+u*i[1]+h*i[2],n[2]=e[14]+d*i[0]+f*i[1]+p*i[2],r[0]=g*o[0]+v*o[1]+m*o[2],r[1]=y*o[0]+b*o[1]+x*o[2],r[2]=E*o[0]+w*o[1]+k*o[2],kr(this.min,n,r),yr(this.max,n,r)}},{key:"intersects",value:function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return n[0]<=r[0]&&e[0]>=i[0]&&n[1]<=r[1]&&e[1]>=i[1]&&n[2]<=r[2]&&e[2]>=i[2]}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new t,r=xr([0,0,0],this.getMin(),e.getMin()),i=Er([0,0,0],this.getMax(),e.getMax());return n.setMinMax(r,i),n}},{key:"getNegativeFarPoint",value:function(t){return 273===t.pnVertexFlag?br([0,0,0],this.min):272===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:257===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:256===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:17===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:16===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:1===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(t){return 273===t.pnVertexFlag?br([0,0,0],this.max):272===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:257===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:256===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:17===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:16===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:1===t.pnVertexFlag?[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||0===t.halfExtents[0]&&0===t.halfExtents[1]&&0===t.halfExtents[2]}}])}(),Sr=function(){return c(function t(e,n){s(this,t),this.distance=e||0,this.normal=n||pt(0,1,0),this.updatePNVertexFlag()},[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return Et(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/Ot(this.normal);bt(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&i<=1;return o&&n&&kt(n,t,e,i),o}}])}(),Nr=function(t){return t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE",t}({}),Tr=function(){return c(function t(e){if(s(this,t),this.planes=[],e)this.planes=e;else for(var n=0;n<6;n++)this.planes.push(new Sr)},[{key:"extractFromVPMatrix",value:function(t){var e=b(t,16),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],v=e[14],m=e[15];vt(this.planes[0].normal,o-n,c-a,f-u),this.planes[0].distance=m-p,vt(this.planes[1].normal,o+n,c+a,f+u),this.planes[1].distance=m+p,vt(this.planes[2].normal,o+r,c+s,f+h),this.planes[2].distance=m+g,vt(this.planes[3].normal,o-r,c-s,f-h),this.planes[3].distance=m-g,vt(this.planes[4].normal,o-i,c-l,f-d),this.planes[4].distance=m-v,vt(this.planes[5].normal,o+i,c+l,f+d),this.planes[5].distance=m+v,this.planes.forEach(function(t){t.normalize(),t.updatePNVertexFlag()})}}])}(),Or=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,t),this.x=0,this.y=0,this.x=e,this.y=n}return c(t,[{key:"clone",value:function(){return new t(this.x,this.y)}},{key:"copyFrom",value:function(t){this.x=t.x,this.y=t.y}}])}(),Cr=function(){function t(e,n,r,i){s(this,t),this.x=e,this.y=n,this.width=r,this.height=i,this.left=e,this.right=e+r,this.top=n,this.bottom=n+i}return c(t,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new t(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var r=At(e.x,e.y,0,1),i=At(e.x+e.width,e.y,0,1),o=At(e.x,e.y+e.height,0,1),a=At(e.x+e.width,e.y+e.height,0,1),s=Ct(),l=Ct(),c=Ct(),u=Ct();Pt(s,r,n),Pt(l,i,n),Pt(c,o,n),Pt(u,a,n);var h=Math.min(s[0],l[0],c[0],u[0]),d=Math.min(s[1],l[1],c[1],u[1]),f=Math.max(s[0],l[0],c[0],u[0]),p=Math.max(s[1],l[1],c[1],u[1]);return t.fromRect({x:h,y:d,width:f-h,height:p-d})}}])}(),Ar="Method not implemented.",Pr="Use document.documentElement instead.";function Rr(t){return void 0===t?0:t>360||t<-360?t%360:t}var Dr=ht();function Lr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return Array.isArray(t)&&3===t.length?r?dt(t):gt(Dr,t):ae(t)?r?pt(t,e,n):vt(Dr,t,e,n):r?pt(t[0],t[1]||e,t[2]||n):vt(Dr,t[0],t[1]||e,t[2]||n)}var _r=Math.PI/180;function Ir(t){return t*_r}var jr=180/Math.PI;function Br(t){return t*jr}var Fr=Math.PI/2;function zr(t,e){return 16===e.length?function(t,e){var n,r,i=b(K(ht(),e),3),o=i[0],a=i[1],s=i[2],l=Math.asin(-e[2]/o);return l<Fr?l>-Fr?(n=Math.atan2(e[6]/a,e[10]/s),r=Math.atan2(e[1]/o,e[0]/o)):(r=0,n=-Math.atan2(e[4]/a,e[5]/a)):(r=0,n=Math.atan2(e[4]/a,e[5]/a)),t[0]=n,t[1]=l,t[2]=r,t}(t,e):function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=r*r,s=i*i,l=o*o,c=n*n+a+s+l,u=n*o-r*i;return u>.499995*c?(t[0]=Fr,t[1]=2*Math.atan2(r,n),t[2]=0):u<-.499995*c?(t[0]=-Fr,t[1]=2*Math.atan2(r,n),t[2]=0):(t[0]=Math.asin(2*(n*i-o*r)),t[1]=Math.atan2(2*(n*o+r*i),1-2*(s+l)),t[2]=Math.atan2(2*(n*r+i*o),1-2*(a+s))),t}(t,e)}function Gr(t,e,n,r,i){var o,a,s,l,c,u,h,d,f,p,g=Math.cos(t),v=Math.sin(t);return o=r*g,a=i*v,s=0,l=-r*v,c=i*g,u=0,h=e,d=n,f=1,(p=new N(9))[0]=o,p[1]=a,p[2]=s,p[3]=l,p[4]=c,p[5]=u,p[6]=h,p[7]=d,p[8]=f,p}function Vr(t){var e=t[0],n=t[1],r=t[3],i=t[4],o=Math.sqrt(e*e+n*n),a=Math.sqrt(r*r+i*i);if(e*i-n*r<0&&(e<i?o=-o:a=-a),o){var s=1/o;e*=s,n*=s}if(a){var l=1/a;r*=l,i*=l}var c=Br(Math.atan2(n,e));return[t[6],t[7],o,a,c]}var Wr=O(),Hr=O(),Ur=Ct(),$r=[ht(),ht(),ht()],Yr=ht();function qr(t,e,n,r,i){t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i}var Xr=function(t){return t[t.ORBITING=0]="ORBITING",t[t.EXPLORING=1]="EXPLORING",t[t.TRACKING=2]="TRACKING",t}({}),Kr=function(t){return t[t.DEFAULT=0]="DEFAULT",t[t.ROTATIONAL=1]="ROTATIONAL",t[t.TRANSLATIONAL=2]="TRANSLATIONAL",t[t.CINEMATIC=3]="CINEMATIC",t}({}),Zr=function(t){return t[t.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",t[t.PERSPECTIVE=1]="PERSPECTIVE",t}({}),Qr="updated",Jr=2e-4,ti=function(){return c(function t(){s(this,t),this.clipSpaceNearZ=gr.NEGATIVE_ONE,this.eventEmitter=new M,this.matrix=O(),this.right=pt(1,0,0),this.up=pt(0,1,0),this.forward=pt(0,0,1),this.position=pt(0,0,1),this.focalPoint=pt(0,0,0),this.distanceVector=pt(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=O(),this.projectionMatrixInverse=O(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=Xr.EXPLORING,this.trackingMode=Kr.DEFAULT,this.projectionMode=Zr.PERSPECTIVE,this.frustum=new Tr,this.orthoMatrix=O()},[{key:"isOrtho",value:function(){return this.projectionMode===Zr.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,e){return this.type=t,this.type===Xr.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===Xr.TRACKING&&void 0!==e&&this.setTrackingMode(e),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==Xr.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 _(O(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(t,e){var n=V(O(),[t,e,0]);this.jitteredProjectionMatrix=j(O(),n,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===Zr.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===Zr.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,e,n,r,i,o){return this.aspect=t/e,void 0===this.view&&(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=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===Zr.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 void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===Zr.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===Zr.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===Zr.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(t,e){var n=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),r=n.x,i=n.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(r,i),this.setFocalPoint(r,i),this.setZoom(t),this.rotate(0,0,o);var a=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),s=pt(a.x-r,a.y-i,0),l=Et(s,this.right)/ft(this.right),c=Et(s,this.up)/ft(this.up),u=b(this.getPosition(),2),h=u[0],d=u[1],f=b(this.getFocalPoint(),2),p=f[0],g=f[1];return this.setPosition(h-l,d-c),this.setFocalPoint(p-l,g-c),this}},{key:"setPerspective",value:function(t,e,n,r){var i;this.projectionMode=Zr.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r;var o=this.near*Math.tan(Ir(.5*this.fov))/this.zoom,a=2*o,s=this.aspect*a,l=-.5*s;if(null!==(i=this.view)&&void 0!==i&&i.enabled){var c=this.view.fullWidth,u=this.view.fullHeight;l+=this.view.offsetX*s/c,o-=this.view.offsetY*a/u,s*=this.view.width/c,a*=this.view.height/u}return function(t,e,n,r,i,o,a){var s,l,c=2*o,u=n-e,h=r-i,d=c/u,f=c/h,p=(n+e)/u,g=(r+i)/h,v=a-o,m=a*o;arguments.length>7&&void 0!==arguments[7]&&arguments[7]?(s=-a/v,l=-m/v):(s=-(a+o)/v,l=-2*m/v),t[0]=d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=f,t[6]=0,t[7]=0,t[8]=p,t[9]=g,t[10]=s,t[11]=-1,t[12]=0,t[13]=0,t[14]=l,t[15]=0}(this.projectionMatrix,l,l+s,o-a,o,t,this.far,this.clipSpaceNearZ===gr.ZERO),_(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(t,e,n,r,i,o){var a;this.projectionMode=Zr.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var s=(this.rright-this.left)/(2*this.zoom),l=(this.top-this.bottom)/(2*this.zoom),c=(this.rright+this.left)/2,u=(this.top+this.bottom)/2,h=c-s,d=c+s,f=u+l,p=u-l;if(null!==(a=this.view)&&void 0!==a&&a.enabled){var g=(this.rright-this.left)/this.view.fullWidth/this.zoom,v=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d=(h+=g*this.view.offsetX)+g*this.view.width,p=(f-=v*this.view.offsetY)-v*this.view.height}return this.clipSpaceNearZ===gr.NEGATIVE_ONE?rt(this.projectionMatrix,h,d,f,p,i,o):it(this.projectionMatrix,h,d,f,p,i,o),_(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(t){var e=Lr(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.position[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.position[2]);return this._setPosition(e),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.focalPoint[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.focalPoint[2],r=pt(0,1,0);if(this.focalPoint=Lr(t,e,n),this.trackingMode===Kr.CINEMATIC){var i=yt(ht(),this.focalPoint,this.position);t=i[0],e=i[1],n=i[2];var o=ft(i),a=Br(Math.asin(e/o)),s=90+Br(Math.atan2(n,t)),l=O();G(l,l,Ir(s)),z(l,l,Ir(a)),r=Mt(ht(),[0,1,0],l)}return _(this.matrix,ot(O(),this.position,this.focalPoint,r)),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<Jr&&(this.distance=Jr),this.dollyingStep=this.distance/100;var e=ht();t=this.distance;var n=this.forward,r=this.focalPoint;return e[0]=t*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),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=Rr(t),this.computeMatrix(),this._getAxes(),this.type===Xr.ORBITING||this.type===Xr.EXPLORING?this._getPosition():this.type===Xr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=Rr(t),this.computeMatrix(),this._getAxes(),this.type===Xr.ORBITING||this.type===Xr.EXPLORING?this._getPosition():this.type===Xr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(t){return this.roll=Rr(t),this.computeMatrix(),this._getAxes(),this.type===Xr.ORBITING||this.type===Xr.EXPLORING?this._getPosition():this.type===Xr.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=Dt(Rt(),[0,0,1],Ir(this.roll));D(this.matrix);var e=Dt(Rt(),[1,0,0],Ir((this.rotateWorld&&this.type!==Xr.TRACKING||this.type===Xr.TRACKING?1:-1)*this.elevation)),n=Dt(Rt(),[0,1,0],Ir((this.rotateWorld&&this.type!==Xr.TRACKING||this.type===Xr.TRACKING?1:-1)*this.azimuth)),r=Lt(Rt(),n,e);r=Lt(Rt(),r,t);var i=J(O(),r);this.type===Xr.ORBITING||this.type===Xr.EXPLORING?(B(this.matrix,this.matrix,this.focalPoint),j(this.matrix,this.matrix,i),B(this.matrix,this.matrix,[0,0,this.distance])):this.type===Xr.TRACKING&&(B(this.matrix,this.matrix,this.position),j(this.matrix,this.matrix,i))}},{key:"_setPosition",value:function(t,e,n){this.position=Lr(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){gt(this.right,Lr(Pt(Ct(),[1,0,0,0],this.matrix))),gt(this.up,Lr(Pt(Ct(),[0,1,0,0],this.matrix))),gt(this.forward,Lr(Pt(Ct(),[0,0,1,0],this.matrix))),xt(this.right,this.right),xt(this.up,this.up),xt(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=ft(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===Xr.TRACKING||this.rotateWorld?(this.elevation=Br(Math.asin(e/r)),this.azimuth=Br(Math.atan2(-t,-n))):(this.elevation=-Br(Math.asin(e/r)),this.azimuth=-Br(Math.atan2(-t,-n)))}},{key:"_getPosition",value:function(){gt(this.position,Lr(Pt(Ct(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){!function(t,e,n){var r=e[0],i=e[1],o=e[2];t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8]}(this.distanceVector,[0,0,-this.distance],function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}(T(),this.matrix)),mt(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=yt(ht(),this.focalPoint,this.position),this.distance=ft(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===Zr.ORTHOGRAPHIC){var t=this.position,e=Dt(Rt(),[0,0,1],-this.roll*Math.PI/180);Q(this.orthoMatrix,e,pt((this.rright-this.left)/2-t[0],(this.top-this.bottom)/2-t[1],0),pt(this.zoom,this.zoom,1),t)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var t=this.getViewTransform(),e=j(O(),this.getPerspective(),t);this.getFrustum().extractFromVPMatrix(e),this.eventEmitter.emit(Qr)}}},{key:"rotate",value:function(t,e,n){throw new Error(Ar)}},{key:"pan",value:function(t,e){throw new Error(Ar)}},{key:"dolly",value:function(t){throw new Error(Ar)}},{key:"createLandmark",value:function(t,e){throw new Error(Ar)}},{key:"gotoLandmark",value:function(t,e){throw new Error(Ar)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(Ar)}}])}(),ei=function(t){return t[t.Standard=0]="Standard",t}({}),ni=function(t){return t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED",t[t.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",t}({}),ri=ht(),ii=O(),oi=Rt();function ai(t){if(t.localDirtyFlag){if(0!==t.localSkew[0]||0!==t.localSkew[1]){Q(t.localTransform,t.localRotation,t.localPosition,pt(1,1,1),t.origin),0===t.localSkew[0]&&0===t.localSkew[1]||(D(ii),ii[4]=Math.tan(t.localSkew[0]),ii[1]=Math.tan(t.localSkew[1]),j(t.localTransform,t.localTransform,ii));var e=Q(ii,Ft(oi,0,0,0,1),vt(ri,1,1,1),t.localScale,t.origin);j(t.localTransform,t.localTransform,e)}else{var n=t.localTransform,r=t.localPosition,i=t.localRotation,o=t.localScale,a=t.origin,s=0!==r[0]||0!==r[1]||0!==r[2],l=1!==i[3]||0!==i[0]||0!==i[1]||0!==i[2],c=1!==o[0]||1!==o[1]||1!==o[2],u=0!==a[0]||0!==a[1]||0!==a[2];l||c||u?Q(n,i,r,o,a):s?V(n,r):D(n)}t.localDirtyFlag=!1}}var si={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Cr(0,0,0,0)},li=function(t){return t.COORDINATE="<coordinate>",t.COLOR="<color>",t.PAINT="<paint>",t.NUMBER="<number>",t.ANGLE="<angle>",t.OPACITY_VALUE="<opacity-value>",t.SHADOW_BLUR="<shadow-blur>",t.LENGTH="<length>",t.PERCENTAGE="<percentage>",t.LENGTH_PERCENTAGE="<length> | <percentage>",t.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",t.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",t.LIST_OF_POINTS="<list-of-points>",t.PATH="<path>",t.FILTER="<filter>",t.Z_INDEX="<z-index>",t.OFFSET_DISTANCE="<offset-distance>",t.DEFINED_PATH="<defined-path>",t.MARKER="<marker>",t.TRANSFORM="<transform>",t.TRANSFORM_ORIGIN="<transform-origin>",t.TEXT="<text>",t.TEXT_TRANSFORM="<text-transform>",t}({});function ci(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ui(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function hi(){}var di=.7,fi=1/di,pi="\\s*([+-]?\\d+)\\s*",gi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mi=/^#([0-9a-f]{3,8})$/,yi=new RegExp(`^rgb\\(${pi},${pi},${pi}\\)$`),bi=new RegExp(`^rgb\\(${vi},${vi},${vi}\\)$`),xi=new RegExp(`^rgba\\(${pi},${pi},${pi},${gi}\\)$`),Ei=new RegExp(`^rgba\\(${vi},${vi},${vi},${gi}\\)$`),wi=new RegExp(`^hsl\\(${gi},${vi},${vi}\\)$`),ki=new RegExp(`^hsla\\(${gi},${vi},${vi},${gi}\\)$`),Mi={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};function Si(){return this.rgb().formatHex()}function Ni(){return this.rgb().formatRgb()}function Ti(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=mi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Oi(e):3===n?new Ai(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Ci(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Ci(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=yi.exec(t))?new Ai(e[1],e[2],e[3],1):(e=bi.exec(t))?new Ai(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=xi.exec(t))?Ci(e[1],e[2],e[3],e[4]):(e=Ei.exec(t))?Ci(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=wi.exec(t))?Ii(e[1],e[2]/100,e[3]/100,1):(e=ki.exec(t))?Ii(e[1],e[2]/100,e[3]/100,e[4]):Mi.hasOwnProperty(t)?Oi(Mi[t]):"transparent"===t?new Ai(NaN,NaN,NaN,0):null}function Oi(t){return new Ai(t>>16&255,t>>8&255,255&t,1)}function Ci(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ai(t,e,n,r)}function Ai(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Pi(){return`#${_i(this.r)}${_i(this.g)}${_i(this.b)}`}function Ri(){const t=Di(this.opacity);return`${1===t?"rgb(":"rgba("}${Li(this.r)}, ${Li(this.g)}, ${Li(this.b)}${1===t?")":`, ${t})`}`}function Di(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Li(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function _i(t){return((t=Li(t))<16?"0":"")+t.toString(16)}function Ii(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Bi(t,e,n,r)}function ji(t){if(t instanceof Bi)return new Bi(t.h,t.s,t.l,t.opacity);if(t instanceof hi||(t=Ti(t)),!t)return new Bi;if(t instanceof Bi)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Bi(a,s,l,t.opacity)}function Bi(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Fi(t){return(t=(t||0)%360)<0?t+360:t}function zi(t){return Math.max(0,Math.min(1,t||0))}function Gi(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Vi(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=e?e.apply(this,i):i[0],s=n.cache;if(s.has(a))return s.get(a);var l=t.apply(this,i);return n.cache=s.set(a,l)||s,l};return n.cache=new(Vi.Cache||Map),Vi.cacheList.push(n.cache),n}ci(hi,Ti,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Si,formatHex:Si,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ji(this).formatHsl()},formatRgb:Ni,toString:Ni}),ci(Ai,function(t,e,n,r){return 1===arguments.length?((i=t)instanceof hi||(i=Ti(i)),i?new Ai((i=i.rgb()).r,i.g,i.b,i.opacity):new Ai):new Ai(t,e,n,null==r?1:r);var i},ui(hi,{brighter(t){return t=null==t?fi:Math.pow(fi,t),new Ai(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?di:Math.pow(di,t),new Ai(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ai(Li(this.r),Li(this.g),Li(this.b),Di(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:Pi,formatHex:Pi,formatHex8:function(){return`#${_i(this.r)}${_i(this.g)}${_i(this.b)}${_i(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ri,toString:Ri})),ci(Bi,function(t,e,n,r){return 1===arguments.length?ji(t):new Bi(t,e,n,null==r?1:r)},ui(hi,{brighter(t){return t=null==t?fi:Math.pow(fi,t),new Bi(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?di:Math.pow(di,t),new Bi(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ai(Gi(t>=240?t-240:t+120,i,r),Gi(t,i,r),Gi(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Bi(Fi(this.h),zi(this.s),zi(this.l),Di(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 t=Di(this.opacity);return`${1===t?"hsl(":"hsla("}${Fi(this.h)}, ${100*zi(this.s)}%, ${100*zi(this.l)}%${1===t?")":`, ${t})`}`}})),Vi.Cache=Map,Vi.cacheList=[],Vi.clearCache=function(){Vi.cacheList.forEach(function(t){return t.clear()})};var Wi=function(t){return t[t.kUnknown=0]="kUnknown",t[t.kNumber=1]="kNumber",t[t.kPercentage=2]="kPercentage",t[t.kEms=3]="kEms",t[t.kPixels=4]="kPixels",t[t.kRems=5]="kRems",t[t.kDegrees=6]="kDegrees",t[t.kRadians=7]="kRadians",t[t.kGradians=8]="kGradians",t[t.kTurns=9]="kTurns",t[t.kMilliseconds=10]="kMilliseconds",t[t.kSeconds=11]="kSeconds",t[t.kInteger=12]="kInteger",t}({}),Hi=function(t){return t[t.kUNumber=0]="kUNumber",t[t.kUPercent=1]="kUPercent",t[t.kULength=2]="kULength",t[t.kUAngle=3]="kUAngle",t[t.kUTime=4]="kUTime",t[t.kUOther=5]="kUOther",t}({}),Ui=function(t){return t[t.kYes=0]="kYes",t[t.kNo=1]="kNo",t}({}),$i=function(t){return t[t.kYes=0]="kYes",t[t.kNo=1]="kNo",t}({}),Yi=[{name:"em",unit_type:Wi.kEms},{name:"px",unit_type:Wi.kPixels},{name:"deg",unit_type:Wi.kDegrees},{name:"rad",unit_type:Wi.kRadians},{name:"grad",unit_type:Wi.kGradians},{name:"ms",unit_type:Wi.kMilliseconds},{name:"s",unit_type:Wi.kSeconds},{name:"rem",unit_type:Wi.kRems},{name:"turn",unit_type:Wi.kTurns}],qi=function(t){return t[t.kUnknownType=0]="kUnknownType",t[t.kUnparsedType=1]="kUnparsedType",t[t.kKeywordType=2]="kKeywordType",t[t.kUnitType=3]="kUnitType",t[t.kSumType=4]="kSumType",t[t.kProductType=5]="kProductType",t[t.kNegateType=6]="kNegateType",t[t.kInvertType=7]="kInvertType",t[t.kMinType=8]="kMinType",t[t.kMaxType=9]="kMaxType",t[t.kClampType=10]="kClampType",t[t.kTransformType=11]="kTransformType",t[t.kPositionType=12]="kPositionType",t[t.kURLImageType=13]="kURLImageType",t[t.kColorType=14]="kColorType",t[t.kUnsupportedColorType=15]="kUnsupportedColorType",t}({}),Xi=function(t){return t?"number"===t?Wi.kNumber:"percent"===t||"%"===t?Wi.kPercentage:function(t){return Yi.find(function(e){return e.name===t}).unit_type}(t):Wi.kUnknown},Ki=function(t){var e=1;switch(t){case Wi.kPixels:case Wi.kDegrees:case Wi.kSeconds:break;case Wi.kMilliseconds:e=.001;break;case Wi.kRadians:e=180/Math.PI;break;case Wi.kGradians:e=.9;break;case Wi.kTurns:e=360}return e},Zi=function(t){switch(t){case Wi.kNumber:case Wi.kInteger:return"";case Wi.kPercentage:return"%";case Wi.kEms:return"em";case Wi.kRems:return"rem";case Wi.kPixels:return"px";case Wi.kDegrees:return"deg";case Wi.kRadians:return"rad";case Wi.kGradians:return"grad";case Wi.kMilliseconds:return"ms";case Wi.kSeconds:return"s";case Wi.kTurns:return"turn"}return""},Qi=function(){return c(function t(){s(this,t)},[{key:"toString",value:function(){return this.buildCSSText(Ui.kNo,$i.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=qi.kUnitType&&this.getType()<=qi.kClampType}}],[{key:"isAngle",value:function(t){return t===Wi.kDegrees||t===Wi.kRadians||t===Wi.kGradians||t===Wi.kTurns}},{key:"isLength",value:function(t){return t>=Wi.kEms&&t<Wi.kDegrees}},{key:"isRelativeUnit",value:function(t){return t===Wi.kPercentage||t===Wi.kEms||t===Wi.kRems}},{key:"isTime",value:function(t){return t===Wi.kSeconds||t===Wi.kMilliseconds}}])}(),Ji=function(t){function e(t){var n;return s(this,e),(n=v(this,e)).colorSpace=t,n}return y(e,t),c(e,[{key:"getType",value:function(){return qi.kColorType}},{key:"to",value:function(t){return this}}])}(Qi),to=function(t){return t[t.Constant=0]="Constant",t[t.LinearGradient=1]="LinearGradient",t[t.RadialGradient=2]="RadialGradient",t}({}),eo=function(t){function e(t,n){var r;return s(this,e),(r=v(this,e)).type=t,r.value=n,r}return y(e,t),c(e,[{key:"clone",value:function(){return new e(this.type,this.value)}},{key:"buildCSSText",value:function(t,e,n){return n}},{key:"getType",value:function(){return qi.kColorType}}])}(Qi),no=function(t){function e(t){var n;return s(this,e),(n=v(this,e)).value=t,n}return y(e,t),c(e,[{key:"clone",value:function(){return new e(this.value)}},{key:"getType",value:function(){return qi.kKeywordType}},{key:"buildCSSText",value:function(t,e,n){return n+this.value}}])}(Qi),ro=function(t){return function(t){switch(t){case Hi.kUNumber:return Wi.kNumber;case Hi.kULength:return Wi.kPixels;case Hi.kUPercent:return Wi.kPercentage;case Hi.kUTime:return Wi.kSeconds;case Hi.kUAngle:return Wi.kDegrees;default:return Wi.kUnknown}}(function(t){switch(t){case Wi.kNumber:case Wi.kInteger:return Hi.kUNumber;case Wi.kPercentage:return Hi.kUPercent;case Wi.kPixels:return Hi.kULength;case Wi.kMilliseconds:case Wi.kSeconds:return Hi.kUTime;case Wi.kDegrees:case Wi.kRadians:case Wi.kGradians:case Wi.kTurns:return Hi.kUAngle;default:return Hi.kUOther}}(t))},io=function(t){function e(t){var n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wi.kNumber;return s(this,e),n=v(this,e),r="string"==typeof i?Xi(i):i,n.unit=r,n.value=t,n}return y(e,t),c(e,[{key:"clone",value:function(){return new e(this.value,this.unit)}},{key:"equals",value:function(t){var e=t;return this.value===e.value&&this.unit===e.unit}},{key:"getType",value:function(){return qi.kUnitType}},{key:"convertTo",value:function(t){if(this.unit===t)return new e(this.value,this.unit);var n=ro(this.unit);if(n!==ro(t)||n===Wi.kUnknown)return null;var r=Ki(this.unit)/Ki(t);return new e(this.value*r,t)}},{key:"buildCSSText",value:function(t,e,n){var r;switch(this.unit){case Wi.kUnknown:break;case Wi.kInteger:r=Number(this.value).toFixed(0);break;case Wi.kNumber:case Wi.kPercentage:case Wi.kEms:case Wi.kRems:case Wi.kPixels:case Wi.kDegrees:case Wi.kRadians:case Wi.kGradians:case Wi.kMilliseconds:case Wi.kSeconds:case Wi.kTurns:var i=this.value,o=Zi(this.unit);if(i<-999999||i>999999){var a=Zi(this.unit);r=!Number.isFinite(i)||Number.isNaN(i)?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(Number.isFinite(t)?"NaN":t>0?"infinity":"-infinity")+e}(i,a):i+(a||"")}else r="".concat(i).concat(o)}return n+=r}}])}(Qi),oo=new io(0,"px");new io(1,"px");var ao=new io(0,"deg"),so=function(t){function e(t,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return s(this,e),(i=v(this,e,["rgb"])).r=t,i.g=n,i.b=r,i.alpha=o,i.isNone=a,i}return y(e,t),c(e,[{key:"clone",value:function(){return new e(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(t,e,n){return"".concat(n,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(Ji),lo=new no("unset"),co={"":lo,unset:lo,initial:new no("initial"),inherit:new no("inherit")},uo=new so(0,0,0,0,!0),ho=new so(0,0,0,0),fo=Vi(function(t,e,n,r){return new so(t,e,n,r)},function(t,e,n,r){return"rgba(".concat(t,",").concat(e,",").concat(n,",").concat(r,")")}),po=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wi.kNumber;return new io(t,e)};function go(t){var e=t.type,n=t.value;return"hex"===e?"#".concat(n):"literal"===e?n:"rgb"===e?"rgb(".concat(n.join(","),")"):"rgba(".concat(n.join(","),")")}new io(50,"%");var vo=function(){var t=/^(linear\-gradient)/i,e=/^(repeating\-linear\-gradient)/i,n=/^(radial\-gradient)/i,r=/^(repeating\-radial\-gradient)/i,i=/^(conic\-gradient)/i,o=/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,a=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,s=/^(left|center|right|top|bottom)/i,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,c=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,h=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,d=/^\(/,f=/^\)/,p=/^,/,g=/^\#([0-9a-fA-F]+)/,v=/^([a-zA-Z]+)/,m=/^rgb/i,y=/^rgba/i,b=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,x="";function E(t){throw new Error("".concat(x,": ").concat(t))}function w(){var t=R(k);return x.length>0&&E("Invalid input not EOF"),t}function k(){return M("linear-gradient",t,N)||M("repeating-linear-gradient",e,N)||M("radial-gradient",n,T)||M("repeating-radial-gradient",r,T)||M("conic-gradient",i,T)}function M(t,e,n){return S(e,function(e){var r=n();return r&&(B(p)||E("Missing comma before color stops")),{type:t,orientation:r,colorStops:R(D)}})}function S(t,e){var n=B(t);if(n){B(d)||E("Missing (");var r=e(n);return B(f)||E("Missing )"),r}}function N(){return j("directional",o,1)||j("angular",h,1)}function T(){var t,e,n=O();return n&&((t=[]).push(n),e=x,B(p)&&((n=O())?t.push(n):x=e)),t}function O(){var t=function(){var t=j("shape",/^(circle)/i,0);t&&(t.style=I()||C());return t}()||function(){var t=j("shape",/^(ellipse)/i,0);t&&(t.style=_()||C());return t}();if(t)t.at=A();else{var e=C();if(e){t=e;var n=A();n&&(t.at=n)}else{var r=P();r&&(t={type:"default-radial",at:r})}}return t}function C(){return j("extent-keyword",a,1)}function A(){if(j("position",/^at/,0)){var t=P();return t||E("Missing positioning value"),t}}function P(){var t={x:_(),y:_()};if(t.x||t.y)return{type:"position",value:t}}function R(t){var e=t(),n=[];if(e)for(n.push(e);B(p);)(e=t())?n.push(e):E("One extra comma");return n}function D(){var t=j("hex",g,1)||S(y,function(){return{type:"rgba",value:R(L)}})||S(m,function(){return{type:"rgb",value:R(L)}})||j("literal",v,0);return t||E("Expected color definition"),t.length=_(),t}function L(){return B(b)[1]}function _(){return j("%",c,1)||j("position-keyword",s,1)||I()}function I(){return j("px",l,1)||j("em",u,1)}function j(t,e,n){var r=B(e);if(r)return{type:t,value:r[n]}}function B(t){var e=/^[\n\r\t\s]+/.exec(x);e&&F(e[0].length);var n=t.exec(x);return n&&F(n[0].length),n}function F(t){x=x.substring(t)}return function(t){return x=t,w()}}();var mo=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,yo=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,bo=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,xo=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;var Eo={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},wo=Vi(function(t){var e;return e="angular"===t.type?Number(t.value):Eo[t.value]||0,po(e,"deg")}),ko=Vi(function(t){var e=50,n=50,r="%",i="%";if("position"===(null==t?void 0:t.type)){var o=t.value,a=o.x,s=o.y;"position-keyword"===(null==a?void 0:a.type)&&("left"===a.value?e=0:"center"===a.value?e=50:"right"===a.value?e=100:"top"===a.value?n=0:"bottom"===a.value&&(n=100)),"position-keyword"===(null==s?void 0:s.type)&&("left"===s.value?e=0:"center"===s.value?n=50:"right"===s.value?e=100:"top"===s.value?n=0:"bottom"===s.value&&(n=100)),"px"!==(null==a?void 0:a.type)&&"%"!==(null==a?void 0:a.type)&&"em"!==(null==a?void 0:a.type)||(r=null==a?void 0:a.type,e=Number(a.value)),"px"!==(null==s?void 0:s.type)&&"%"!==(null==s?void 0:s.type)&&"em"!==(null==s?void 0:s.type)||(i=null==s?void 0:s.type,n=Number(s.value))}return{cx:po(e,r),cy:po(n,i)}}),Mo=Vi(function(t){if(t.indexOf("linear")>-1||t.indexOf("radial")>-1)return vo(t).map(function(t){var e=t.type,n=t.orientation,r=t.colorStops;!function(t){var e,n,r=t.length;t[r-1].length=null!==(e=t[r-1].length)&&void 0!==e?e:{type:"%",value:"100"},r>1&&(t[0].length=null!==(n=t[0].length)&&void 0!==n?n:{type:"%",value:"0"});for(var i=0,o=Number(t[0].length.value),a=1;a<r;a++){var s,l=null===(s=t[a].length)||void 0===s?void 0:s.value;if(!$t(l)&&!$t(o)){for(var c=1;c<a-i;c++)t[i+c].length={type:"%",value:"".concat(o+(Number(l)-o)*c/(a-i))};i=a,o=Number(l)}}}(r);var i=r.map(function(t){return{offset:po(Number(t.length.value),"%"),color:go(t)}});if("linear-gradient"===e)return new eo(to.LinearGradient,{angle:n?wo(n):ao,steps:i});if("radial-gradient"===e&&(n||(n=[{type:"shape",value:"circle"}]),"shape"===n[0].type&&"circle"===n[0].value)){var o,a=ko(n[0].at),s=a.cx,l=a.cy;if(n[0].style){var c=n[0].style,u=c.type,h=c.value;o="extent-keyword"===u?function(t){return co[t]||(co[t]=new no(t)),co[t]}(h):po(h,u)}return new eo(to.RadialGradient,{cx:s,cy:l,size:o,steps:i})}});var e=t[0];if("("===t[1]||"("===t[2])if("l"===e){var n=mo.exec(t);if(n){var r,i=(null===(r=n[2].match(xo))||void 0===r?void 0:r.map(function(t){return t.split(":")}))||[];return[new eo(to.LinearGradient,{angle:po(parseFloat(n[1]),"deg"),steps:i.map(function(t){var e=b(t,2),n=e[0],r=e[1];return{offset:po(100*Number(n),"%"),color:r}})})]}}else if("r"===e){var o=function(t){var e=yo.exec(t);if(e){var n,r=(null===(n=e[4].match(xo))||void 0===n?void 0:n.map(function(t){return t.split(":")}))||[];return{cx:po(50,"%"),cy:po(50,"%"),steps:r.map(function(t){var e=b(t,2),n=e[0],r=e[1];return{offset:po(100*Number(n),"%"),color:r}})}}return null}(t);if(o){if(!ne(o))return[new eo(to.RadialGradient,o)];t=o}}else if("p"===e)return function(t){var e=bo.exec(t);if(e){var n=e[1],r=e[2];switch(n){case"a":n="repeat";break;case"x":n="repeat-x";break;case"y":n="repeat-y";break;default:n="no-repeat"}return{image:r,repetition:n}}return null}(t)});function So(t){return t&&!!t.image}function No(t){return t&&!$t(t.r)&&!$t(t.g)&&!$t(t.b)}var To=Vi(function(t){if(So(t))return a({repetition:"repeat"},t);if($t(t)&&(t=""),"transparent"===t)return ho;if("currentColor"===t)t="black";else if("none"===t)return uo;var e=Mo(t);if(e)return e;var n=Ti(t),r=[0,0,0,0];return null!==n&&(r[0]=n.r||0,r[1]=n.g||0,r[2]=n.b||0,r[3]=n.opacity),fo.apply(void 0,r)});function Oo(t,e){if(No(t)&&No(e))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(t){var e=t.slice();if(e[3])for(var n=0;n<3;n++)e[n]=Math.round(oe(e[n],0,255));return e[3]=oe(e[3],0,1),"rgba(".concat(e.join(","),")")}]}function Co(t,e){if($t(e))return po(0,"px");if(e="".concat(e).trim().toLowerCase(),isFinite(Number(e))){if("px".search(t)>=0)return po(Number(e),"px");if("deg".search(t)>=0)return po(Number(e),"deg")}var n=[];e=e.replace(t,function(t){return n.push(t),"U".concat(t)});var r="U(".concat(t.source,")");return n.map(function(t){return po(Number(e.replace(new RegExp("U".concat(t),"g"),"").replace(new RegExp(r,"g"),"*0")),t)})[0]}var Ao=function(t){return Co(new RegExp("px","g"),t)},Po=Vi(Ao);Vi(function(t){return Co(new RegExp("%","g"),t)});var Ro=function(t){return ae(t)||isFinite(Number(t))?po(Number(t)||0,"px"):Co(new RegExp("px|%|em|rem","g"),t)},Do=Vi(Ro),Lo=function(t){return Co(new RegExp("deg|rad|grad|turn","g"),t)},_o=Vi(Lo);function Io(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o="",a=t.value||0,s=e.value||0,l=ro(t.unit),c=t.convertTo(l),u=e.convertTo(l);return c&&u?(a=c.value,s=u.value,o=Zi(t.unit)):(io.isLength(t.unit)||io.isLength(e.unit))&&(a=Fo(t,i,n),s=Fo(e,i,n),o="px"),[a,s,function(t){return t+o}]}function jo(t){var e=0;return t.unit===Wi.kDegrees?e=t.value:t.unit===Wi.kRadians?e=Br(Number(t.value)):t.unit===Wi.kTurns?e=360*Number(t.value):t.value&&(e=t.value),e}function Bo(t,e){var n;return Array.isArray(t)?n=t.map(function(t){return Number(t)}):ne(t)?n=t.split(" ").map(function(t){return Number(t)}):ae(t)&&(n=[t]),2===e?1===n.length?[n[0],n[0]]:[n[0],n[1]]:4===e?1===n.length?[n[0],n[0],n[0],n[0]]:2===n.length?[n[0],n[1],n[0],n[1]]:3===n.length?[n[0],n[1],n[2],n[1]]:[n[0],n[1],n[2],n[3]]:"even"===e&&n.length%2==1?[].concat(d(n),d(n)):n}function Fo(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.unit===Wi.kPixels)return Number(t.value);if(t.unit===Wi.kPercentage&&n){var i=n.nodeName===pr.GROUP?n.getLocalBounds():n.getGeometryBounds();return(r?i.min[e]:0)+t.value/100*i.halfExtents[e]*2}return 0}var zo=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Go(t){return t.toString()}var Vo=function(t){return"number"==typeof t?po(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?po(Number(t)):po(0)},Wo=Vi(Vo);function Ho(t,e){return[t,e,Go]}function Uo(t,e){return function(n,r){return[n,r,function(n){return Go(oe(n,t,e))}]}}function $o(t,e){if(t.length===e.length)return[t,e,function(t){return t}]}function Yo(t){var e;return 0===t.parsedStyle.d.totalLength&&(t.parsedStyle.d.totalLength=Tn(t.parsedStyle.d.absolutePath,void 0,Fe(Fe({},e),{bbox:!1,length:!0})).length),t.parsedStyle.d.totalLength}function qo(t,e){return t[0]===e[0]&&t[1]===e[1]}function Xo(t,e){var n=t.prePoint,r=t.currentPoint,i=t.nextPoint,o=Math.pow(r[0]-n[0],2)+Math.pow(r[1]-n[1],2),a=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),l=Math.acos((o+a-s)/(2*Math.sqrt(o)*Math.sqrt(a)));if(!l||0===Math.sin(l)||se(l,0))return{xExtra:0,yExtra:0};var c=Math.abs(Math.atan2(i[1]-r[1],i[0]-r[0])),u=Math.abs(Math.atan2(i[0]-r[0],i[1]-r[1]));return c=c>Math.PI/2?Math.PI-c:c,u=u>Math.PI/2?Math.PI-u:u,{xExtra:Math.cos(l/2-c)*(e/2*(1/Math.sin(l/2)))-e/2||0,yExtra:Math.cos(u-l/2)*(e/2*(1/Math.sin(l/2)))-e/2||0}}function Ko(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}Vi(function(t){return ne(t)?t.split(" ").map(Wo):t.map(Wo)});var Zo=function(t,e){var n=t.x*e.x+t.y*e.y,r=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2)));return(t.x*e.y-t.y*e.x<0?-1:1)*Math.acos(n/r)},Qo=function(t,e,n,r,i,o,a,s){e=Math.abs(e),n=Math.abs(n);var l=Ir(r=ue(r,360));if(t.x===a.x&&t.y===a.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(0===e||0===n)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-a.x)/2,u=(t.y-a.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(e,2)+Math.pow(h.y,2)/Math.pow(n,2);d>1&&(e*=Math.sqrt(d),n*=Math.sqrt(d));var f=(Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2))/(Math.pow(e,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2));f=f<0?0:f;var p=(i!==o?1:-1)*Math.sqrt(f),g=p*(e*h.y/n),v=p*(-n*h.x/e),m={x:Math.cos(l)*g-Math.sin(l)*v+(t.x+a.x)/2,y:Math.sin(l)*g+Math.cos(l)*v+(t.y+a.y)/2},y={x:(h.x-g)/e,y:(h.y-v)/n},b=Zo({x:1,y:0},y),x=Zo(y,{x:(-h.x-g)/e,y:(-h.y-v)/n});!o&&x>0?x-=2*Math.PI:o&&x<0&&(x+=2*Math.PI);var E=b+(x%=2*Math.PI)*s,w=e*Math.cos(E),k=n*Math.sin(E);return{x:Math.cos(l)*w-Math.sin(l)*k+m.x,y:Math.sin(l)*w+Math.cos(l)*k+m.y,ellipticalArcStartAngle:b,ellipticalArcEndAngle:b+x,ellipticalArcAngle:E,ellipticalArcCenter:m,resultantRx:e,resultantRy:n}};function Jo(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.arcParams,i=r.rx,o=void 0===i?0:i,a=r.ry,s=void 0===a?0:a,l=r.xRotation,c=r.arcFlag,u=r.sweepFlag,h=Qo({x:t.prePoint[0],y:t.prePoint[1]},o,s,l,!!c,!!u,{x:t.currentPoint[0],y:t.currentPoint[1]},e),d=Qo({x:t.prePoint[0],y:t.prePoint[1]},o,s,l,!!c,!!u,{x:t.currentPoint[0],y:t.currentPoint[1]},n?e+.005:e-.005),f=d.x-h.x,p=d.y-h.y,g=Math.sqrt(f*f+p*p);return{x:-f/g,y:-p/g}}function ta(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ea(t,e){return ta(t)*ta(e)?(t[0]*e[0]+t[1]*e[1])/(ta(t)*ta(e)):1}function na(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(ea(t,e))}function ra(t,e){var n=e[1],r=e[2],i=ue(Ir(e[3]),2*Math.PI),o=e[4],a=e[5],s=t[0],l=t[1],c=e[6],u=e[7],h=Math.cos(i)*(s-c)/2+Math.sin(i)*(l-u)/2,d=-1*Math.sin(i)*(s-c)/2+Math.cos(i)*(l-u)/2,f=h*h/(n*n)+d*d/(r*r);f>1&&(n*=Math.sqrt(f),r*=Math.sqrt(f));var p=n*n*(d*d)+r*r*(h*h),g=p?Math.sqrt((n*n*(r*r)-p)/p):1;o===a&&(g*=-1),isNaN(g)&&(g=0);var v=r?g*n*d/r:0,m=n?g*-r*h/n:0,y=(s+c)/2+Math.cos(i)*v-Math.sin(i)*m,b=(l+u)/2+Math.sin(i)*v+Math.cos(i)*m,x=[(h-v)/n,(d-m)/r],E=[(-1*h-v)/n,(-1*d-m)/r],w=na([1,0],x),k=na(x,E);return ea(x,E)<=-1&&(k=Math.PI),ea(x,E)>=1&&(k=0),0===a&&k>0&&(k-=2*Math.PI),1===a&&k<0&&(k+=2*Math.PI),{cx:y,cy:b,rx:qo(t,[c,u])?0:n,ry:qo(t,[c,u])?0:r,startAngle:w,endAngle:w+k,xRotation:i,arcFlag:o,sweepFlag:a}}var ia=function(t){if(""===t||Array.isArray(t)&&0===t.length)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=hn(t)}catch(n){e=hn(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}!function(t){for(var e=0;e<t.length;e++){var n=t[e-1],r=t[e];if("M"===r[0]&&n){var i=n[0],o=[r[1],r[2]],a=void 0;"L"===i||"M"===i?a=[n[1],n[2]]:"C"!==i&&"A"!==i&&"Q"!==i||(a=[n[n.length-2],n[n.length-1]]),a&&qo(o,a)&&(t.splice(e,1),e--)}}}(e);var n=function(t){for(var e=!1,n=t.length,r=0;r<n;r++){var i=t[r][0];if("C"===i||"A"===i||"Q"===i){e=!0;break}}return e}(e),r=function(t){for(var e=[],n=[],r=[],i=0;i<t.length;i++){var o=t[i],a=o[0];"M"===a?(r.length&&(n.push(r),r=[]),r.push([o[1],o[2]])):"Z"===a?r.length&&(e.push(r),r=[]):r.push([o[1],o[2]])}return r.length>0&&n.push(r),{polygons:e,polylines:n}}(e),i=r.polygons,o=r.polylines,a=function(t){for(var e=[],n=null,r=null,i=null,o=0,a=t.length,s=0;s<a;s++){var l=t[s];r=t[s+1];var c=l[0],u={command:c,prePoint:n,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(c){case"M":i=[l[1],l[2]],o=s;break;case"A":var h=ra(n,l);u.arcParams=h}if("Z"===c)n=i,r=t[o+1];else{var d=l.length;n=[l[d-2],l[d-1]]}r&&"Z"===r[0]&&(r=t[o],e[o]&&(e[o].prePoint=n)),u.currentPoint=n,e[o]&&qo(n,e[o].currentPoint)&&(e[o].prePoint=u.prePoint);var f=r?[r[r.length-2],r[r.length-1]]:null;u.nextPoint=f;var p=u.prePoint;if(["L","H","V"].includes(c))u.startTangent=[p[0]-n[0],p[1]-n[1]],u.endTangent=[n[0]-p[0],n[1]-p[1]];else if("Q"===c){var g=[l[1],l[2]];u.startTangent=[p[0]-g[0],p[1]-g[1]],u.endTangent=[n[0]-g[0],n[1]-g[1]]}else if("T"===c){var v=e[s-1],m=Ko(v.currentPoint,p);"Q"===v.command?(u.command="Q",u.startTangent=[p[0]-m[0],p[1]-m[1]],u.endTangent=[n[0]-m[0],n[1]-m[1]]):(u.command="TL",u.startTangent=[p[0]-n[0],p[1]-n[1]],u.endTangent=[n[0]-p[0],n[1]-p[1]])}else if("C"===c){var y=[l[1],l[2]],b=[l[3],l[4]];u.startTangent=[p[0]-y[0],p[1]-y[1]],u.endTangent=[n[0]-b[0],n[1]-b[1]],0===u.startTangent[0]&&0===u.startTangent[1]&&(u.startTangent=[y[0]-b[0],y[1]-b[1]]),0===u.endTangent[0]&&0===u.endTangent[1]&&(u.endTangent=[b[0]-y[0],b[1]-y[1]])}else if("S"===c){var x=e[s-1],E=Ko(x.currentPoint,p),w=[l[1],l[2]];"C"===x.command?(u.command="C",u.startTangent=[p[0]-E[0],p[1]-E[1]],u.endTangent=[n[0]-w[0],n[1]-w[1]]):(u.command="SQ",u.startTangent=[p[0]-w[0],p[1]-w[1]],u.endTangent=[n[0]-w[0],n[1]-w[1]])}else if("A"===c){var k=Jo(u,0),M=k.x,S=k.y,N=Jo(u,1,!1),T=N.x,O=N.y;u.startTangent=[M,S],u.endTangent=[T,O]}e.push(u)}return e}(e),s=function(t,e){for(var n=[],r=[],i=[],o=0;o<t.length;o++){var a=t[o],s=a.currentPoint,l=a.params,c=a.prePoint,u=void 0;switch(a.command){case"Q":u=Zn(c[0],c[1],l[1],l[2],l[3],l[4]);break;case"C":u=$n(c[0],c[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=a.arcParams;u=Fn(h.cx,h.cy,h.rx,h.ry,h.xRotation,h.startAngle,h.endAngle);break;default:n.push(s[0]),r.push(s[1])}u&&(a.box=u,n.push(u.x,u.x+u.width),r.push(u.y,u.y+u.height))}n=n.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}),r=r.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0});var d=ee(n),f=ee(r),p=te(n),g=te(r);if(0===i.length)return{x:d,y:f,width:p-d,height:g-f};for(var v=0;v<i.length;v++){var m=i[v],y=m.currentPoint;y[0]===d?d-=Xo(m,e).xExtra:y[0]===p&&(p+=Xo(m,e).xExtra),y[1]===f?f-=Xo(m,e).yExtra:y[1]===g&&(g+=Xo(m,e).yExtra)}return{x:d,y:f,width:p-d,height:g-f}}(a,0),l=s.x,c=s.y,u=s.width,h=s.height;return{absolutePath:e,hasArc:n,segments:a,polygons:i,polylines:o,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}}},oa=Vi(ia);function aa(t){return ne(t)?oa(t):ia(t)}function sa(t,e,n){var r=t.curve,i=e.curve;r&&0!==r.length||(r=mn(t.absolutePath,!1),t.curve=r),i&&0!==i.length||(i=mn(e.absolutePath,!1),e.curve=i);var o=[r,i];r.length!==i.length&&(o=Pn(r,i));var a,s,l=Cn(o[0])!==Cn(o[1])?(a=o[0],s=a.slice(1).map(function(t,e,n){return e?n[e-1].slice(-2).concat(t.slice(1)):a[0].slice(1).concat(t.slice(1))}).map(function(t){return t.map(function(e,n){return t[t.length-n-2*(1-n%2)]})}).reverse(),[["M"].concat(s[0].slice(0,2))].concat(s.map(function(t){return["C"].concat(t.slice(2))}))):o[0].map(function(t){return Array.isArray(t)?[].concat(t):t});return[l,On(o[1],l),function(t){return t}]}function la(t,e){return[t.points,e.points,function(t){return t}]}var ca=null,ua=/\s*(\w+)\(([^)]*)\)/g;function ha(t){return function(e){var n=0;return t.map(function(t){return t===ca?e[n++]:t})}}function da(t){return t}var fa={matrix:["NNNNNN",[ca,ca,0,0,ca,ca,0,0,0,0,1,0,ca,ca,0,1],da],matrix3d:["NNNNNNNNNNNNNNNN",da],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",ha([ca,ca,new io(1)]),da],scaleX:["N",ha([ca,new io(1),new io(1)]),ha([ca,new io(1)])],scaleY:["N",ha([new io(1),ca,new io(1)]),ha([new io(1),ca])],scaleZ:["N",ha([new io(1),new io(1),ca])],scale3d:["NNN",da],skew:["Aa",null,da],skewX:["A",null,ha([ca,ao])],skewY:["A",null,ha([ao,ca])],translate:["Tt",ha([ca,ca,oo]),da],translateX:["T",ha([ca,oo,oo]),ha([ca,oo])],translateY:["T",ha([oo,ca,oo]),ha([oo,ca])],translateZ:["L",ha([oo,oo,ca])],translate3d:["TTL",da]};function pa(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t[r],o=i[0],a=i.slice(1);if("translate"===o||"skew"===o?1===a.length&&a.push(0):"scale"===o&&1===a.length&&a.push(a[0]),!fa[o])return[];var s=a.map(function(t){return po(t)});e.push({t:o,d:s})}return e}function ga(t){if(Array.isArray(t))return pa(t);if("none"===(t=(t||"none").trim()))return[];var e,n=[],r=0;for(ua.lastIndex=0;e=ua.exec(t);){if(e.index!==r)return[];r=e.index+e[0].length;var i=e[1],o=fa[i];if(!o)return[];var a=e[2].split(","),s=o[0];if(s.length<a.length)return[];for(var l=[],c=0;c<s.length;c++){var u=a[c],h=s[c],d=void 0;if(void 0===(d=u?{A:function(t){return"0"===t.trim()?ao:_o(t)},N:Wo,T:Do,L:Po}[h.toUpperCase()](u):{a:ao,n:l[0],t:oo}[h]))return[];l.push(d)}if(n.push({t:i,d:l}),ua.lastIndex===t.length)return n}return[]}function va(t){if(Array.isArray(t))return pa(t);if("none"===(t=(t||"none").trim()))return[];var e,n=[],r=0;for(ua.lastIndex=0;e=ua.exec(t);){if(e.index!==r)return[];r=e.index+e[0].length;var i=e[1],o=fa[i];if(!o)return[];var a=e[2].split(","),s=o[0];if(s.length<a.length)return[];for(var l=[],c=0;c<s.length;c++){var u=a[c],h=s[c],d=void 0;if(void 0===(d=u?{A:function(t){return"0"===t.trim()?ao:Lo(t)},N:Vo,T:Ro,L:Ao}[h.toUpperCase()](u):{a:ao,n:l[0],t:oo}[h]))return[];l.push(d)}if(n.push({t:i,d:l}),ua.lastIndex===t.length)return n}return[]}function ma(t){var e,n,r,i;switch(t.t){case"rotateX":return i=Ir(jo(t.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=Ir(jo(t.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=Ir(jo(t.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=t.d[0].value,n=t.d[1].value,r=t.d[2].value,i=Ir(jo(t.d[3]));var o=e*e+n*n+r*r;if(0===o)e=1,n=0,r=0;else if(1!==o){var a=Math.sqrt(o);e/=a,n/=a,r/=a}var s=Math.sin(i/2),l=s*Math.cos(i/2),c=s*s;return[1-2*(n*n+r*r)*c,2*(e*n*c+r*l),2*(e*r*c-n*l),0,2*(e*n*c-r*l),1-2*(e*e+r*r)*c,2*(n*r*c+e*l),0,2*(e*r*c+n*l),2*(n*r*c-e*l),1-2*(e*e+n*n)*c,0,0,0,0,1];case"scale":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[t.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,t.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,t.d[0].value,0,0,0,0,1];case"scale3d":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,t.d[2].value,0,0,0,0,1];case"skew":var u=Ir(jo(t.d[0])),h=Ir(jo(t.d[1]));return[1,Math.tan(h),0,0,Math.tan(u),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=Ir(jo(t.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return i=Ir(jo(t.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Fo(t.d[0],0,null)||0,n=Fo(t.d[1],0,null)||0,0,1];case"translateX":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Fo(t.d[0],0,null)||0,0,0,1];case"translateY":return[1,0,0,0,0,1,0,0,0,0,1,0,0,n=Fo(t.d[0],0,null)||0,0,1];case"translateZ":return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,r=Fo(t.d[0],0,null)||0,1];case"translate3d":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Fo(t.d[0],0,null)||0,n=Fo(t.d[1],0,null)||0,r=Fo(t.d[2],0,null)||0,1];case"perspective":var d=Fo(t.d[0],0,null)||0;return[1,0,0,0,0,1,0,0,0,0,1,d?-1/d:0,0,0,0,1];case"matrix":return[t.d[0].value,t.d[1].value,0,0,t.d[2].value,t.d[3].value,0,0,0,0,1,0,t.d[4].value,t.d[5].value,0,1];case"matrix3d":return t.d.map(function(t){return t.value})}}function ya(t,e){return[t[0]*e[0]+t[4]*e[1]+t[8]*e[2]+t[12]*e[3],t[1]*e[0]+t[5]*e[1]+t[9]*e[2]+t[13]*e[3],t[2]*e[0]+t[6]*e[1]+t[10]*e[2]+t[14]*e[3],t[3]*e[0]+t[7]*e[1]+t[11]*e[2]+t[15]*e[3],t[0]*e[4]+t[4]*e[5]+t[8]*e[6]+t[12]*e[7],t[1]*e[4]+t[5]*e[5]+t[9]*e[6]+t[13]*e[7],t[2]*e[4]+t[6]*e[5]+t[10]*e[6]+t[14]*e[7],t[3]*e[4]+t[7]*e[5]+t[11]*e[6]+t[15]*e[7],t[0]*e[8]+t[4]*e[9]+t[8]*e[10]+t[12]*e[11],t[1]*e[8]+t[5]*e[9]+t[9]*e[10]+t[13]*e[11],t[2]*e[8]+t[6]*e[9]+t[10]*e[10]+t[14]*e[11],t[3]*e[8]+t[7]*e[9]+t[11]*e[10]+t[15]*e[11],t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12]*e[15],t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13]*e[15],t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14]*e[15],t[3]*e[12]+t[7]*e[13]+t[11]*e[14]+t[15]*e[15]]}function ba(t){var e=[0,0,0],n=[1,1,1],r=[0,0,0],i=[0,0,0,1],o=[0,0,0,1];return function(t,e,n,r,i,o){if(!function(t,e){var n=e[15];if(0===n)return!1;for(var r=1/n,i=0;i<16;i++)t[i]=e[i]*r;return!0}(Wr,t))return!1;if(A(Hr,Wr),Hr[3]=0,Hr[7]=0,Hr[11]=0,Hr[15]=1,Math.abs(I(Hr))<1e-8)return!1;var a,s,l=Wr[3],c=Wr[7],u=Wr[11],h=Wr[12],d=Wr[13],f=Wr[14],p=Wr[15];if(0!==l||0!==c||0!==u){if(Ur[0]=l,Ur[1]=c,Ur[2]=u,Ur[3]=p,!_(Hr,Hr))return!1;L(Hr,Hr),Pt(i,Ur,Hr)}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=h,e[1]=d,e[2]=f,s=Wr,(a=$r)[0][0]=s[0],a[0][1]=s[1],a[0][2]=s[2],a[1][0]=s[4],a[1][1]=s[5],a[1][2]=s[6],a[2][0]=s[8],a[2][1]=s[9],a[2][2]=s[10],n[0]=ft($r[0]),xt($r[0],$r[0]),r[0]=Et($r[0],$r[1]),qr($r[1],$r[1],$r[0],1,-r[0]),n[1]=ft($r[1]),xt($r[1],$r[1]),r[0]/=n[1],r[1]=Et($r[0],$r[2]),qr($r[2],$r[2],$r[0],1,-r[1]),r[2]=Et($r[1],$r[2]),qr($r[2],$r[2],$r[1],1,-r[2]),n[2]=ft($r[2]),xt($r[2],$r[2]),r[1]/=n[2],r[2]/=n[2],wt(Yr,$r[1],$r[2]),Et($r[0],Yr)<0)for(var g=0;g<3;g++)n[g]*=-1,$r[g][0]*=-1,$r[g][1]*=-1,$r[g][2]*=-1;o[0]=.5*Math.sqrt(Math.max(1+$r[0][0]-$r[1][1]-$r[2][2],0)),o[1]=.5*Math.sqrt(Math.max(1-$r[0][0]+$r[1][1]-$r[2][2],0)),o[2]=.5*Math.sqrt(Math.max(1-$r[0][0]-$r[1][1]+$r[2][2],0)),o[3]=.5*Math.sqrt(Math.max(1+$r[0][0]+$r[1][1]+$r[2][2],0)),$r[2][1]>$r[1][2]&&(o[0]=-o[0]),$r[0][2]>$r[2][0]&&(o[1]=-o[1]),$r[1][0]>$r[0][1]&&(o[2]=-o[2])}(function(t){return 0===t.length?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:t.map(ma).reduce(ya)}(t),e,n,r,i,o),[[e,n,r,o,i]]}var xa=function(){function t(t,e){for(var n=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],r=0;r<4;r++)for(var i=0;i<4;i++)for(var o=0;o<4;o++)n[r][i]+=e[r][o]*t[o][i];return n}return function(e,n,r,i,o){for(var a=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],s=0;s<4;s++)a[s][3]=o[s];for(var l=0;l<3;l++)for(var c=0;c<3;c++)a[3][l]+=e[c]*a[c][l];var u=i[0],h=i[1],d=i[2],f=i[3],p=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];p[0][0]=1-2*(h*h+d*d),p[0][1]=2*(u*h-d*f),p[0][2]=2*(u*d+h*f),p[1][0]=2*(u*h+d*f),p[1][1]=1-2*(u*u+d*d),p[1][2]=2*(h*d-u*f),p[2][0]=2*(u*d-h*f),p[2][1]=2*(h*d+u*f),p[2][2]=1-2*(u*u+h*h),a=t(a,p);var g=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];r[2]&&(g[2][1]=r[2],a=t(a,g)),r[1]&&(g[2][1]=0,g[2][0]=r[0],a=t(a,g)),r[0]&&(g[2][0]=0,g[1][0]=r[0],a=t(a,g));for(var v=0;v<3;v++)for(var m=0;m<3;m++)a[v][m]*=n[v];return function(t){return 0===t[0][2]&&0===t[0][3]&&0===t[1][2]&&0===t[1][3]&&0===t[2][0]&&0===t[2][1]&&1===t[2][2]&&0===t[2][3]&&0===t[3][2]&&1===t[3][3]}(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])}}();function Ea(t){return t.toFixed(6).replace(".000000","")}function wa(t,e){var n,r;return t.decompositionPair!==e&&(t.decompositionPair=e,n=ba(t)),e.decompositionPair!==t&&(e.decompositionPair=t,r=ba(e)),null===n[0]||null===r[0]?[[!1],[!0],function(n){return n?e[0].d:t[0].d}]:(n[0].push(0),r[0].push(1),[n,r,function(t){var e=function(t,e,n){var r=function(t,e){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[r];return n}(t,e);r=oe(r,-1,1);var i=[];if(1===r)i=t;else for(var o=Math.acos(r),a=1*Math.sin(n*o)/Math.sqrt(1-r*r),s=0;s<4;s++)i.push(t[s]*(Math.cos(n*o)-r*a)+e[s]*a);return i}(n[0][3],r[0][3],t[5]);return xa(t[0],t[1],t[2],e,t[4]).map(Ea).join(",")}])}function ka(t){return t.replace(/[XY]/,"")}function Ma(t){return t.replace(/(X|Y|Z|3d)?$/,"3d")}var Sa=function(t,e){return"perspective"===t&&"perspective"===e||("matrix"===t||"matrix3d"===t)&&("matrix"===e||"matrix3d"===e)};function Na(t,e,n){var r=!1;if(!t.length||!e.length){t.length||(r=!0,t=e,e=[]);for(var i=function(){var n=t[o],r=n.t,i=n.d,a="scale"===r.substring(0,5)?1:0;e.push({t:r,d:i.map(function(t){return"number"==typeof t?po(a):po(a,t.unit)})})},o=0;o<t.length;o++)i()}var a=[],s=[],l=[];if(t.length!==e.length){var c=wa(t,e);a=[c[0]],s=[c[1]],l=[["matrix",[c[2]]]]}else for(var u=0;u<t.length;u++){var h=t[u].t,d=e[u].t,f=t[u].d,p=e[u].d,g=fa[h],v=fa[d],m=void 0;if(Sa(h,d)){var y=wa([t[u]],[e[u]]);a.push(y[0]),s.push(y[1]),l.push(["matrix",[y[2]]])}else{if(h===d)m=h;else if(g[2]&&v[2]&&ka(h)===ka(d))m=ka(h),f=g[2](f),p=v[2](p);else{if(!g[1]||!v[1]||Ma(h)!==Ma(d)){var b=wa(t,e);a=[b[0]],s=[b[1]],l=[["matrix",[b[2]]]];break}m=Ma(h),f=g[1](f),p=v[1](p)}for(var x=[],E=[],w=[],k=0;k<f.length;k++){var M=Io(f[k],p[k],n,!1,k);x[k]=M[0],E[k]=M[1],w.push(M[2])}a.push(x),s.push(E),l.push([m,w])}}if(r){var S=a;a=s,s=S}return[a,s,function(t){return t.map(function(t,e){var n=t.map(function(t,n){return l[e][1][n](t)}).join(",");return"matrix"===l[e][0]&&16===n.split(",").length&&(l[e][0]="matrix3d"),"matrix3d"===l[e][0]&&6===n.split(",").length&&(l[e][0]="matrix"),"".concat(l[e][0],"(").concat(n,")")}).join(" ")}]}var Ta=Vi(function(t){if(ne(t)){if("text-anchor"===t)return[po(0,"px"),po(0,"px")];var e=t.split(" ");return 1===e.length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[Do(Oa(e[0])),Do(Oa(e[1]))]}return[po(t[0]||0,"px"),po(t[1]||0,"px")]});function Oa(t){return"center"===t?"50%":"left"===t||"top"===t?"0%":"right"===t||"bottom"===t?"100%":t}var Ca=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:li.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:li.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:li.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:li.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:li.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:li.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:li.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:li.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:li.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:li.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:li.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:li.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:li.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:li.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:li.FILTER},{n:"clipPath",syntax:li.DEFINED_PATH},{n:"textPath",syntax:li.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:li.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:li.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:li.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:li.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:li.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:li.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:li.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:li.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:li.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:li.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:li.COORDINATE},{n:"y1",int:!0,l:!0,syntax:li.COORDINATE},{n:"z1",int:!0,l:!0,syntax:li.COORDINATE},{n:"x2",int:!0,l:!0,syntax:li.COORDINATE},{n:"y2",int:!0,l:!0,syntax:li.COORDINATE},{n:"z2",int:!0,l:!0,syntax:li.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:li.PATH,p:50},{n:"points",int:!0,l:!0,syntax:li.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:li.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:li.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:li.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:li.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:li.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:li.NUMBER,d:function(t){return t===pr.PATH||t===pr.POLYGON||t===pr.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:li.MARKER},{n:"markerEnd",syntax:li.MARKER},{n:"markerMid",syntax:li.MARKER},{n:"markerStartOffset",syntax:li.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:li.LENGTH,l:!0,int:!0,d:"0"}],Aa=new Set(Ca.filter(function(t){return!!t.l}).map(function(t){return t.n})),Pa={},Ra=function(){return c(function t(e){var n=this;s(this,t),this.runtime=e,Ca.forEach(function(t){n.registerMetadata(t)})},[{key:"registerMetadata",value:function(t){[t.n].concat(d(t.a||[])).forEach(function(e){Pa[e]=t})}},{key:"getPropertySyntax",value:function(t){return this.runtime.CSSPropertySyntaxFactory[t]}},{key:"processProperties",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{forceUpdateGeometry:!1};Object.assign(t.attributes,e);var r=t.parsedStyle.clipPath,i=t.parsedStyle.offsetPath;!function(t,e){var n=Da(t);for(var r in e)n.has(r)&&(t.parsedStyle[r]=e[r])}(t,e);var o=!!n.forceUpdateGeometry;if(!o)for(var s in e)if(Aa.has(s)){o=!0;break}var l,c,u=Da(t);u.has("fill")&&e.fill&&(t.parsedStyle.fill=To(e.fill)),u.has("stroke")&&e.stroke&&(t.parsedStyle.stroke=To(e.stroke)),u.has("shadowColor")&&e.shadowColor&&(t.parsedStyle.shadowColor=To(e.shadowColor)),u.has("filter")&&e.filter&&(t.parsedStyle.filter=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if("none"===(t=t.toLowerCase().trim()))return[];for(var e,n=/\s*([\w-]+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];if(i=e.index+e[0].length,zo.indexOf(e[1])>-1&&r.push({name:e[1],params:e[2].split(" ").map(function(t){return Co(/deg|rad|grad|turn|px|%/g,t)||To(t)})}),n.lastIndex===t.length)return r}return[]}(e.filter)),u.has("radius")&&!$t(e.radius)&&(t.parsedStyle.radius=Bo(e.radius,4)),u.has("lineDash")&&!$t(e.lineDash)&&(t.parsedStyle.lineDash=Bo(e.lineDash,"even")),u.has("points")&&e.points&&(t.parsedStyle.points=(l=e.points,c=ne(l)?l.split(" ").map(function(t){var e=b(t.split(","),2),n=e[0],r=e[1];return[Number(n),Number(r)]}):l,{points:c,totalLength:0,segments:[]})),u.has("d")&&""===e.d&&(t.parsedStyle.d=a({},si)),u.has("d")&&e.d&&(t.parsedStyle.d=aa(e.d)),u.has("textTransform")&&e.textTransform&&this.runtime.CSSPropertySyntaxFactory[li.TEXT_TRANSFORM].calculator(null,null,{value:e.textTransform},t,null),u.has("clipPath")&&!ve(e.clipPath)&&this.runtime.CSSPropertySyntaxFactory[li.DEFINED_PATH].calculator("clipPath",r,e.clipPath,t,this.runtime),u.has("offsetPath")&&e.offsetPath&&this.runtime.CSSPropertySyntaxFactory[li.DEFINED_PATH].calculator("offsetPath",i,e.offsetPath,t,this.runtime),u.has("transform")&&e.transform&&(t.parsedStyle.transform=ga(e.transform)),u.has("transformOrigin")&&e.transformOrigin&&(t.parsedStyle.transformOrigin=Ta(e.transformOrigin)),u.has("markerStart")&&e.markerStart&&(t.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[li.MARKER].calculator(null,e.markerStart,e.markerStart,null,null)),u.has("markerEnd")&&e.markerEnd&&(t.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[li.MARKER].calculator(null,e.markerEnd,e.markerEnd,null,null)),u.has("markerMid")&&e.markerMid&&(t.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[li.MARKER].calculator("",e.markerMid,e.markerMid,null,null)),u.has("zIndex")&&!$t(e.zIndex)&&this.runtime.CSSPropertySyntaxFactory[li.Z_INDEX].postProcessor(t),u.has("offsetDistance")&&!$t(e.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[li.OFFSET_DISTANCE].postProcessor(t),u.has("transform")&&e.transform&&this.runtime.CSSPropertySyntaxFactory[li.TRANSFORM].postProcessor(t),u.has("transformOrigin")&&e.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[li.TRANSFORM_ORIGIN].postProcessor(t),o&&(t.geometry.dirty=!0,t.dirty(!0,!0),n.forceUpdateGeometry||this.runtime.sceneGraphService.dirtyToRoot(t))}},{key:"updateGeometry",value:function(t){var e=t.nodeName,n=this.runtime.geometryUpdaterFactory[e];if(n){var r=t.geometry;r.contentBounds||(r.contentBounds=new Mr),r.renderBounds||(r.renderBounds=new Mr);var i=t.parsedStyle,o=n.update(i,t),a=o.cx,s=void 0===a?0:a,l=o.cy,c=void 0===l?0:l,u=o.cz,h=void 0===u?0:u,d=o.hwidth,f=void 0===d?0:d,p=o.hheight,g=void 0===p?0:p,v=o.hdepth,m=void 0===v?0:v,y=[Math.abs(f),Math.abs(g),m],b=i.stroke,x=i.lineWidth,E=void 0===x?1:x,w=i.increasedLineWidthForHitTesting,k=void 0===w?0:w,M=i.shadowType,S=void 0===M?"outer":M,N=i.shadowColor,T=i.filter,O=void 0===T?[]:T,C=i.transformOrigin,A=[s,c,h];r.contentBounds.update(A,y);var P=e===pr.POLYLINE||e===pr.POLYGON||e===pr.PATH?Math.SQRT2:.5;if(b&&!b.isNone){var R=((E||0)+(k||0))*P;y[0]+=R,y[1]+=R}if(r.renderBounds.update(A,y),N&&S&&"inner"!==S){var D=r.renderBounds,L=D.min,_=D.max,I=i.shadowBlur||0,j=i.shadowOffsetX||0,B=i.shadowOffsetY||0,F=L[0]-I+j,z=_[0]+I+j,G=L[1]-I+B,V=_[1]+I+B;L[0]=Math.min(L[0],F),_[0]=Math.max(_[0],z),L[1]=Math.min(L[1],G),_[1]=Math.max(_[1],V),r.renderBounds.setMinMax(L,_)}O.forEach(function(t){var e=t.name,n=t.params;if("blur"===e){var i=n[0].value;r.renderBounds.update(r.renderBounds.center,mt(r.renderBounds.halfExtents,r.renderBounds.halfExtents,[i,i,0]))}else if("drop-shadow"===e){var o=n[0].value,a=n[1].value,s=n[2].value,l=r.renderBounds,c=l.min,u=l.max,h=c[0]-s+o,d=u[0]+s+o,f=c[1]-s+a,p=u[1]+s+a;c[0]=Math.min(c[0],h),u[0]=Math.max(u[0],d),c[1]=Math.min(c[1],f),u[1]=Math.max(u[1],p),r.renderBounds.setMinMax(c,u)}}),t.geometry.dirty=!1;var W=g<0,H=(f<0?-1:1)*(C?Fo(C[0],0,t,!0):0),U=(W?-1:1)*(C?Fo(C[1],1,t,!0):0);(H||U)&&t.setOrigin(H,U)}}},{key:"updateSizeAttenuation",value:function(t,e){t.style.isSizeAttenuation?(t.style.rawLineWidth||(t.style.rawLineWidth=t.style.lineWidth),t.style.lineWidth=(t.style.rawLineWidth||1)/e,t.nodeName===pr.CIRCLE&&(t.style.rawR||(t.style.rawR=t.style.r),t.style.r=(t.style.rawR||1)/e)):(t.style.rawLineWidth&&(t.style.lineWidth=t.style.rawLineWidth,delete t.style.rawLineWidth),t.nodeName===pr.CIRCLE&&t.style.rawR&&(t.style.r=t.style.rawR,delete t.style.rawR))}}])}();function Da(t){return t.constructor.PARSED_STYLE_LIST}var La=function(){return c(function t(){s(this,t),this.mixer=Ho},[{key:"calculator",value:function(t,e,n,r){return jo(n)}}])}(),_a=function(){return c(function t(){s(this,t)},[{key:"calculator",value:function(t,e,n,r,i){return n instanceof no&&(n=null),i.sceneGraphService.updateDisplayObjectDependency(t,e,n,r),"clipPath"===t&&r.forEach(function(t){0===t.childNodes.length&&i.sceneGraphService.dirtyToRoot(t)}),n}}])}(),Ia=function(){return c(function t(){s(this,t),this.parser=To,this.mixer=Oo},[{key:"calculator",value:function(t,e,n,r){return n instanceof no?"none"===n.value?uo:ho:n}}])}(),ja=function(){return c(function t(){s(this,t)},[{key:"calculator",value:function(t,e,n){return n instanceof no?[]:n}}])}();function Ba(t){var e=t.parsedStyle.fontSize;return $t(e)?null:e}var Fa=function(){return c(function t(){s(this,t),this.mixer=Ho},[{key:"calculator",value:function(t,e,n,r,i){if(ae(n))return n;if(!io.isRelativeUnit(n.unit))return n.value;if(n.unit===Wi.kPercentage)return 0;if(n.unit===Wi.kEms){if(r.parentNode){var o=Ba(r.parentNode);if(o)return o*=n.value}return 0}if(n.unit===Wi.kRems){var a;if(null!=r&&null!==(a=r.ownerDocument)&&void 0!==a&&a.documentElement){var s=Ba(r.ownerDocument.documentElement);if(s)return s*=n.value}return 0}}}])}(),za=function(){return c(function t(){s(this,t),this.mixer=$o},[{key:"calculator",value:function(t,e,n){return n.map(function(t){return t.value})}}])}(),Ga=function(){return c(function t(){s(this,t),this.mixer=$o},[{key:"calculator",value:function(t,e,n){return n.map(function(t){return t.value})}}])}(),Va=function(){return c(function t(){s(this,t)},[{key:"calculator",value:function(t,e,n,r){var i;n instanceof no&&(n=null);var o=null===(i=n)||void 0===i?void 0:i.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),Wa=function(){return c(function t(){s(this,t),this.mixer=Ho},[{key:"calculator",value:function(t,e,n){return n.value}}])}(),Ha=function(){return c(function t(){s(this,t),this.mixer=Uo(0,1)},[{key:"calculator",value:function(t,e,n){return n.value}},{key:"postProcessor",value:function(t){var e=t.parsedStyle,n=e.offsetPath,r=e.offsetDistance;if(n){var i=n.nodeName;if(i===pr.LINE||i===pr.PATH||i===pr.POLYLINE){var o=n.getPoint(r);o&&t.setLocalPosition(o.x,o.y)}}}}])}(),Ua=function(){return c(function t(){s(this,t),this.mixer=Uo(0,1)},[{key:"calculator",value:function(t,e,n){return n.value}}])}(),$a=function(){return c(function t(){s(this,t),this.parser=aa,this.mixer=sa},[{key:"calculator",value:function(t,e,n){return n instanceof no&&"unset"===n.value?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Cr(0,0,0,0)}:n}}])}(),Ya=c(function t(){s(this,t),this.mixer=la}),qa=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).mixer=Uo(0,1/0),t}return y(e,t),c(e)}(Fa),Xa=function(){return c(function t(){s(this,t)},[{key:"calculator",value:function(t,e,n,r){return n instanceof no?"unset"===n.value?"":n.value:"".concat(n)}},{key:"postProcessor",value:function(t){t.nodeValue="".concat(t.parsedStyle.text)||""}}])}(),Ka=function(){return c(function t(){s(this,t)},[{key:"calculator",value:function(t,e,n,r){var i=r.getAttribute("text");if(i){var o=i;"capitalize"===n.value?o=i.charAt(0).toUpperCase()+i.slice(1):"lowercase"===n.value?o=i.toLowerCase():"uppercase"===n.value&&(o=i.toUpperCase()),r.parsedStyle.text=o}return n.value}}])}(),Za=new WeakMap;var Qa="undefined"!=typeof window&&void 0!==window.document;function Ja(t){return!!t.getAttribute}function ts(t,e){var n=Number(t.parsedStyle.zIndex||0),r=Number(e.parsedStyle.zIndex||0);if(n===r){var i=t.parentNode;if(i){var o=i.childNodes||[];return o.indexOf(t)-o.indexOf(e)}}return n-r}function es(t){var e=t;do{var n;if(null===(n=e.parsedStyle)||void 0===n?void 0:n.clipPath)return e;e=e.parentElement}while(null!==e);return null}function ns(t,e){if(Qa)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}var rs={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},is="object"==typeof performance&&performance.now?performance:Date;function os(t){return t.nodeName===pr.FRAGMENT||t.getRootNode().nodeName===pr.FRAGMENT}function as(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"auto",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=!1,i=!1,o=!!e&&!e.isNone,a=!!n&&!n.isNone;return"visiblepainted"===t||"painted"===t||"auto"===t?(r=o,i=a):"visiblefill"===t||"fill"===t?r=!0:"visiblestroke"===t||"stroke"===t?i=!0:"visible"!==t&&"all"!==t||(r=!0,i=!0),[r,i]}var ss=1,ls="object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:{},cs=Date.now(),us={},hs=Date.now(),ds=function(t){if("function"!=typeof t)throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-hs,r=n>16?0:16-n,i=ss++;return us[i]=t,Object.keys(us).length>1||setTimeout(function(){hs=e;var t=us;us={},Object.keys(t).forEach(function(e){return t[e](ls.performance&&"function"==typeof ls.performance.now?ls.performance.now():Date.now()-cs)})},r),i},fs=function(t){delete us[t]},ps=function(t){return"string"!=typeof t?ds:""===t?ls.requestAnimationFrame:ls["".concat(t,"RequestAnimationFrame")]},gs=function(t,e){for(var n=0;void 0!==t[n];){if(e(t[n]))return t[n];n+=1}}(["","webkit","moz","ms","o"],function(t){return!!ps(t)}),vs=ps(gs),ms=function(t){return"string"!=typeof t?fs:""===t?ls.cancelAnimationFrame:ls["".concat(t,"CancelAnimationFrame")]||ls["".concat(t,"CancelRequestAnimationFrame")]}(gs);ls.requestAnimationFrame=vs,ls.cancelAnimationFrame=ms;var ys=function(){return c(function t(){s(this,t),this.callbacks=[]},[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(t,e){this.callbacks.push(e)}},{key:"promise",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Promise.all(this.callbacks.map(function(t){return t.apply(void 0,e)}))}}])}(),bs=function(){return c(function t(){s(this,t),this.callbacks=[]},[{key:"tapPromise",value:function(t,e){this.callbacks.push(e)}},{key:"promise",value:(t=cr(sr().mark(function t(){var e,n,r,i,o=arguments;return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.callbacks.length){t.next=6;break}return t.next=1,(e=this.callbacks)[0].apply(e,o);case 1:n=t.sent,r=0;case 2:if(!(r<this.callbacks.length-1)){t.next=5;break}return i=this.callbacks[r],t.next=3,i(n);case 3:n=t.sent;case 4:r++,t.next=2;break;case 5:return t.abrupt("return",n);case 6:return t.abrupt("return",null);case 7:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})}]);var t}(),xs=function(){return c(function t(){s(this,t),this.callbacks=[]},[{key:"tap",value:function(t,e){this.callbacks.push(e)}},{key:"call",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=arguments;this.callbacks.forEach(function(t){t.apply(void 0,r)})}}])}(),Es=function(){return c(function t(){s(this,t),this.callbacks=[]},[{key:"tap",value:function(t,e){this.callbacks.push(e)}},{key:"call",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(this.callbacks.length){for(var r=arguments,i=this.callbacks[0].apply(void 0,r),o=0;o<this.callbacks.length-1;o++){i=(0,this.callbacks[o])(i)}return i}return null}}])}(),ws=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ks=/([\"\'])[^\'\"]+\1/;function Ms(t){var e=t.fontSize,n=void 0===e?16:e,r=t.fontFamily,i=void 0===r?"sans-serif":r,o=t.fontStyle,a=void 0===o?"normal":o,s=t.fontVariant,l=void 0===s?"normal":s,c=t.fontWeight;return{fontSize:n,fontFamily:i,fontStyle:a,fontVariant:l,fontWeight:void 0===c?"normal":c}}var Ss=Vi(function(t){for(var e=Ms(t),n=e.fontSize,r=e.fontFamily,i=e.fontStyle,o=e.fontVariant,a=e.fontWeight,s=ae(n)&&"".concat(n,"px")||"16px",l=r.split(","),c=l.length-1;c>=0;c--){var u=l[c].trim();!ks.test(u)&&ws.indexOf(u)<0&&(u='"'.concat(u,'"')),l[c]=u}return"".concat(i," ").concat(o," ").concat(a," ").concat(s," ").concat(l.join(","))},function(t){var e=Ms(t),n=e.fontSize,r=e.fontFamily,i=e.fontStyle,o=e.fontVariant,a=e.fontWeight;return"".concat(i,"_").concat(o,"_").concat(a,"_").concat(n,"_").concat(r)}),Ns=function(t){return Math.max(t,1e-6)};function Ts(t,e,n){return D(t),t[4]=Math.tan(e),t[1]=Math.tan(n),t}var Os=O(),Cs=O(),As={scale:function(t){W(Os,[t[0].value,t[1].value,1].map(function(t){return Ns(t)}))},scaleX:function(t){W(Os,[t[0].value,1,1].map(function(t){return Ns(t)}))},scaleY:function(t){W(Os,[1,t[0].value,1].map(function(t){return Ns(t)}))},scaleZ:function(t){W(Os,[1,1,t[0].value].map(function(t){return Ns(t)}))},scale3d:function(t){W(Os,[t[0].value,t[1].value,t[2].value].map(function(t){return Ns(t)}))},translate:function(t){V(Os,[t[0].value,t[1].value,0])},translateX:function(t){V(Os,[t[0].value,0,0])},translateY:function(t){V(Os,[0,t[0].value,0])},translateZ:function(t){V(Os,[0,0,t[0].value])},translate3d:function(t){V(Os,[t[0].value,t[1].value,t[2].value])},rotate:function(t){Y(Os,Ir(jo(t[0])))},rotateX:function(t){U(Os,Ir(jo(t[0])))},rotateY:function(t){$(Os,Ir(jo(t[0])))},rotateZ:function(t){Y(Os,Ir(jo(t[0])))},rotate3d:function(t){H(Os,Ir(jo(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){Ts(Os,Ir(t[0].value),Ir(t[1].value))},skewX:function(t){Ts(Os,Ir(t[0].value),0)},skewY:function(t){Ts(Os,0,Ir(t[0].value))},matrix:function(t){R(Os,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){R.apply(ut,[Os].concat(d(t.map(function(t){return t.value}))))}},Ps=pt(1,1,1),Rs=ht(),Ds={translate:function(t,e){jl.sceneGraphService.setLocalScale(t,Ps,!1),jl.sceneGraphService.setLocalEulerAngles(t,Rs,void 0,void 0,!1),jl.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),jl.sceneGraphService.dirtyLocalTransform(t,t.transformable)}};function Ls(t,e){if(t.length){if(1===t.length&&Ds[t[0].t])return void Ds[t[0].t](e,t[0].d);for(var n=D(Cs),r=0;r<t.length;r++){var i=t[r],o=i.t,a=i.d,s=As[o];s&&(s(a),lt(n,n,Os))}e.setLocalTransform(n)}else e.resetLocalTransform();return e.getLocalTransform()}var _s=function(){return c(function t(){s(this,t),this.parser=va,this.mixer=Na},[{key:"calculator",value:function(t,e,n,r){return n instanceof no?[]:n}},{key:"postProcessor",value:function(t){Ls(t.parsedStyle.transform,t)}}])}(),Is=function(){return c(function t(){s(this,t)},[{key:"postProcessor",value:function(t){var e=t.parsedStyle.transformOrigin;e[0].unit===Wi.kPixels&&e[1].unit===Wi.kPixels?t.setOrigin(e[0].value,e[1].value):t.getGeometryBounds()}}])}(),js=function(){return c(function t(){s(this,t)},[{key:"calculator",value:function(t,e,n,r){return n.value}},{key:"postProcessor",value:function(t){if(t.parentNode){var e=t.parentNode,n=e.renderable,r=e.sortable;n&&e.dirty(),r&&(r.dirty=!0,r.dirtyReason=ni.Z_INDEX_CHANGED)}}}])}(),Bs=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t,e){var n=t.cx,r=void 0===n?0:n,i=t.cy,o=void 0===i?0:i,a=t.r,s=void 0===a?0:a;return{cx:r,cy:o,hwidth:s,hheight:s}}}])}(),Fs=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t,e){var n=t.cx,r=void 0===n?0:n,i=t.cy,o=void 0===i?0:i,a=t.rx,s=void 0===a?0:a,l=t.ry;return{cx:r,cy:o,hwidth:s,hheight:void 0===l?0:l}}}])}(),zs=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2,o=Math.min(e,r),a=Math.max(e,r),s=Math.min(n,i),l=(a-o)/2,c=(Math.max(n,i)-s)/2;return{cx:o+l,cy:s+c,hwidth:l,hheight:c}}}])}(),Gs=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t){var e=t.d.rect,n=e.x,r=e.y,i=e.width/2,o=e.height/2;return{cx:n+i,cy:r+o,hwidth:i,hheight:o}}}])}(),Vs=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t){if(t.points&&Yt(t.points.points)){var e=t.points.points,n=Math.min.apply(Math,d(e.map(function(t){return t[0]}))),r=Math.max.apply(Math,d(e.map(function(t){return t[0]}))),i=Math.min.apply(Math,d(e.map(function(t){return t[1]}))),o=Math.max.apply(Math,d(e.map(function(t){return t[1]}))),a=(r-n)/2,s=(o-i)/2;return{cx:n+a,cy:i+s,hwidth:a,hheight:s}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),Ws=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i,a=t.src,s=t.width,l=void 0===s?0:s,c=t.height,u=l,h=void 0===c?0:c;return a&&!ne(a)&&(u||(u=a.width,t.width=u),h||(h=a.height,t.height=h)),{cx:r+u/2,cy:o+h/2,hwidth:u/2,hheight:h/2}}}])}(),Hs=function(){return c(function t(e){s(this,t),this.globalRuntime=e},[{key:"isReadyToMeasure",value:function(t,e){return t.text}},{key:"update",value:function(t,e){var n,r=t.text,i=t.textAlign,o=void 0===i?"start":i,a=t.lineWidth,s=void 0===a?1:a,l=t.textBaseline,c=void 0===l?"alphabetic":l,u=t.dx,h=void 0===u?0:u,d=t.dy,f=void 0===d?0:d,p=t.x,g=void 0===p?0:p,v=t.y,m=void 0===v?0:v;if(!this.isReadyToMeasure(t,e))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 y=((null==e||null===(n=e.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n?void 0:n.getConfig())||{}).offscreenCanvas,b=this.globalRuntime.textService.measureText(r,t,y);t.metrics=b;var x=b.width/2,E=b.height/2,w=g+x;"center"===o||"middle"===o?w+=s/2-x:"right"!==o&&"end"!==o||(w+=s-2*x);var k=m-E;return"middle"===c?k+=E:"top"===c||"hanging"===c?k+=2*E:"alphabetic"===c||"bottom"!==c&&"ideographic"!==c||(k+=0),h&&(w+=h),f&&(k+=f),{cx:w,cy:k,hwidth:x,hheight:E}}}])}(),Us=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t,e){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),$s=function(){return c(function t(){s(this,t)},[{key:"update",value:function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i,a=t.width,s=void 0===a?0:a,l=t.height,c=void 0===l?0:l;return{cx:r+s/2,cy:o+c/2,hwidth:s/2,hheight:c/2}}}])}(),Ys=function(){return c(function t(e){s(this,t),this.eventPhase=t.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Or,this.page=new Or,this.canvas=new Or,this.viewport=new Or,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e},[{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(Ar)}}])}(),qs=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).client=new Or,t.movement=new Or,t.offset=new Or,t.global=new Or,t.screen=new Or,t}return y(e,t),c(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(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}},{key:"initMouseEvent",value:function(){throw new Error(Ar)}}])}(Ys),Xs=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).width=0,t.height=0,t.isPrimary=!1,t}return y(e,t),c(e,[{key:"getCoalescedEvents",value:function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])}(qs),Ks=function(t){function e(){return s(this,e),v(this,e,arguments)}return y(e,t),c(e,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}(qs),Zs=function(t){function e(t,n){var r;return s(this,e),(r=v(this,e,[null])).type=t,r.detail=n,Object.assign(r,n),r}return y(e,t),c(e)}(Ys),Qs=function(){return c(function t(){s(this,t),this.emitter=new M},[{key:"on",value:function(t,e,n){return this.addEventListener(t,e,n),this}},{key:"addEventListener",value:function(t,e,n){var r=!1,i=!1;if(pe(n))r=n;else if(n){var o=n.capture;r=void 0!==o&&o;var a=n.once;i=void 0!==a&&a}r&&(t+="capture"),e=Ut(e)?e:e.handleEvent;var s=Ut(e)?void 0:e;return i?this.emitter.once(t,e,s):this.emitter.on(t,e,s),this}},{key:"off",value:function(t,e,n){return t?this.removeEventListener(t,e,n):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var t;null===(t=this.emitter)||void 0===t||t.removeAllListeners()}},{key:"removeEventListener",value:function(t,e,n){var r;if(!this.emitter)return this;(pe(n)?n:null==n?void 0:n.capture)&&(t+="capture"),e=Ut(e)?e:null===(r=e)||void 0===r?void 0:r.handleEvent;var i=Ut(e)?void 0:e;return this.emitter.off(t,e,i),this}},{key:"emit",value:function(t,e){this.dispatchEvent(new Zs(t,e))}},{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 e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(arguments.length>2?arguments[2]:void 0)return this.dispatchEventToSelf(t),!0;if(this.document)e=this;else if(this.defaultView)e=this.defaultView;else{var r;e=null===(r=this.ownerDocument)||void 0===r?void 0:r.defaultView}if(e){if(t.manager=e.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}}])}(),Js=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).shadow=!1,t.ownerDocument=null,t.isConnected=!1,t.baseURI="",t.childNodes=[],t.nodeType=0,t.nodeName="",t.nodeValue=null,t.parentNode=null,t.destroyed=!1,t}return y(e,t),c(e,[{key:"textContent",get:function(){var t="";this.nodeName===pr.TEXT&&(t+=this.style.text);var e,n=ur(this.childNodes);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.nodeName===pr.TEXT?t+=r.nodeValue:t+=r.textContent}}catch(t){n.e(t)}finally{n.f()}return t},set:function(t){var e=this;this.childNodes.slice().forEach(function(t){e.removeChild(t)}),this.nodeName===pr.TEXT&&(this.style.text="".concat(t))}},{key:"getRootNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(t):t.composed&&this.host?this.host.getRootNode(t):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(t){throw new Error(Ar)}},{key:"lookupNamespaceURI",value:function(t){throw new Error(Ar)}},{key:"lookupPrefix",value:function(t){throw new Error(Ar)}},{key:"normalize",value:function(){throw new Error(Ar)}},{key:"isEqualNode",value:function(t){return this===t}},{key:"isSameNode",value:function(t){return this.isEqualNode(t)}},{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(t){if(t===this)return 0;for(var n=t,r=this,i=[n],o=[r];null!==(a=n.parentNode)&&void 0!==a?a:r.parentNode;){var a;n=n.parentNode?(i.push(n.parentNode),n.parentNode):n,r=r.parentNode?(o.push(r.parentNode),r.parentNode):r}if(n!==r)return e.DOCUMENT_POSITION_DISCONNECTED|e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|e.DOCUMENT_POSITION_PRECEDING;var s=i.length>o.length?i:o,l=s===i?o:i;if(s[s.length-l.length]===l[0])return s===i?e.DOCUMENT_POSITION_CONTAINED_BY|e.DOCUMENT_POSITION_FOLLOWING:e.DOCUMENT_POSITION_CONTAINS|e.DOCUMENT_POSITION_PRECEDING;for(var c=s.length-l.length,u=l.length-1;u>=0;u--){var h=l[u],d=s[c+u];if(d!==h){var f=h.parentNode.childNodes;return f.indexOf(h)<f.indexOf(d)?l===i?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING:s===i?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING}}return e.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(t){return this.contains(t)}},{key:"contains",value:function(t){for(var e=t;e&&this!==e;)e=e.parentNode;return!!e}},{key:"getAncestor",value:function(t){for(var e=this;t>0&&e;)e=e.parentNode,t--;return e}},{key:"forEach",value:function(t){for(var e=[this];e.length>0;){var n=e.pop();if(!1===t(n))break;for(var r=n.childNodes.length-1;r>=0;r--)e.push(n.childNodes[r])}}}],[{key:"isNode",value:function(t){return!!t.childNodes}}])}(Qs);Js.DOCUMENT_POSITION_DISCONNECTED=1,Js.DOCUMENT_POSITION_PRECEDING=2,Js.DOCUMENT_POSITION_FOLLOWING=4,Js.DOCUMENT_POSITION_CONTAINS=8,Js.DOCUMENT_POSITION_CONTAINED_BY=16,Js.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var tl=function(){return c(function t(e,n){var r=this;s(this,t),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=O(),this.tmpVec3=ht(),this.onPointerDown=function(t){var e=r.createPointerEvent(t);if(r.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)r.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;r.dispatchEvent(e,n?"rightdown":"mousedown")}r.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),r.freeEvent(e)},this.onPointerUp=function(t){var e=is.now(),n=r.createPointerEvent(t,void 0,void 0,r.context.config.alwaysTriggerPointerEventOnCanvas?r.rootTarget:void 0);if(r.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)r.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var i=2===n.button;r.dispatchEvent(n,i?"rightup":"mouseup")}var o=r.trackingData(t.pointerId),a=r.findMountedTarget(o.pressTargetsByButton[t.button]),s=a;if(a&&!n.composedPath().includes(a)){for(var l=a;l&&!n.composedPath().includes(l);){if(n.currentTarget=l,r.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)r.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){var c=2===n.button;r.notifyTarget(n,c?"rightupoutside":"mouseupoutside")}Js.isNode(l)&&(l=l.parentNode)}delete o.pressTargetsByButton[t.button],s=l}if(s){var u,h=r.clonePointerEvent(n,"click");h.target=s,h.path=[],o.clicksByButton[t.button]||(o.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});var d=r.context.renderingContext.root.ownerDocument.defaultView,f=o.clicksByButton[t.button];f.target===h.target&&e-f.timeStamp<d.getConfig().dblClickSpeed?++f.clickCount:f.clickCount=1,f.target=h.target,f.timeStamp=e,h.detail=f.clickCount,null!==(u=n.detail)&&void 0!==u&&u.preventClick||(r.context.config.useNativeClickEvent||"mouse"!==h.pointerType&&"touch"!==h.pointerType||r.dispatchEvent(h,"click"),r.dispatchEvent(h,"pointertap")),r.freeEvent(h)}r.freeEvent(n)},this.onPointerMove=function(t){var e=r.createPointerEvent(t,void 0,void 0,r.context.config.alwaysTriggerPointerEventOnCanvas?r.rootTarget:void 0),n="mouse"===e.pointerType||"pen"===e.pointerType,i=r.trackingData(t.pointerId),o=r.findMountedTarget(i.overTargets);if(i.overTargets&&o!==e.target){var a="mousemove"===t.type?"mouseout":"pointerout",s=r.createPointerEvent(t,a,o||void 0);if(r.dispatchEvent(s,"pointerout"),n&&r.dispatchEvent(s,"mouseout"),!e.composedPath().includes(o)){var l=r.createPointerEvent(t,"pointerleave",o||void 0);for(l.eventPhase=l.AT_TARGET;l.target&&!e.composedPath().includes(l.target);)l.currentTarget=l.target,r.notifyTarget(l),n&&r.notifyTarget(l,"mouseleave"),Js.isNode(l.target)&&(l.target=l.target.parentNode);r.freeEvent(l)}r.freeEvent(s)}if(o!==e.target){var c="mousemove"===t.type?"mouseover":"pointerover",u=r.clonePointerEvent(e,c);r.dispatchEvent(u,"pointerover"),n&&r.dispatchEvent(u,"mouseover");for(var h=o&&Js.isNode(o)&&o.parentNode;h&&h!==(Js.isNode(r.rootTarget)&&r.rootTarget.parentNode)&&h!==e.target;)h=h.parentNode;if(!h||h===(Js.isNode(r.rootTarget)&&r.rootTarget.parentNode)){var d=r.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==(Js.isNode(r.rootTarget)&&r.rootTarget.parentNode);)d.currentTarget=d.target,r.notifyTarget(d),n&&r.notifyTarget(d,"mouseenter"),Js.isNode(d.target)&&(d.target=d.target.parentNode);r.freeEvent(d)}r.freeEvent(u)}r.dispatchEvent(e,"pointermove"),"touch"===e.pointerType&&r.dispatchEvent(e,"touchmove"),n&&(r.dispatchEvent(e,"mousemove"),r.cursor=r.getCursor(e.target)),i.overTargets=e.composedPath(),r.freeEvent(e)},this.onPointerOut=function(t){var e=r.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,i=r.findMountedTarget(e.overTargets),o=r.createPointerEvent(t,"pointerout",i||void 0);r.dispatchEvent(o),n&&r.dispatchEvent(o,"mouseout");var a=r.createPointerEvent(t,"pointerleave",i||void 0);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==(Js.isNode(r.rootTarget)&&r.rootTarget.parentNode);)a.currentTarget=a.target,r.notifyTarget(a),n&&r.notifyTarget(a,"mouseleave"),Js.isNode(a.target)&&(a.target=a.target.parentNode);e.overTargets=null,r.freeEvent(o),r.freeEvent(a)}r.cursor=null},this.onPointerOver=function(t){var e=r.trackingData(t.pointerId),n=r.createPointerEvent(t),i="mouse"===n.pointerType||"pen"===n.pointerType;r.dispatchEvent(n,"pointerover"),i&&r.dispatchEvent(n,"mouseover"),"mouse"===n.pointerType&&(r.cursor=r.getCursor(n.target));var o=r.clonePointerEvent(n,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==(Js.isNode(r.rootTarget)&&r.rootTarget.parentNode);)o.currentTarget=o.target,r.notifyTarget(o),i&&r.notifyTarget(o,"mouseenter"),Js.isNode(o.target)&&(o.target=o.target.parentNode);e.overTargets=n.composedPath(),r.freeEvent(n),r.freeEvent(o)},this.onPointerUpOutside=function(t){var e=r.trackingData(t.pointerId),n=r.findMountedTarget(e.pressTargetsByButton[t.button]),i=r.createPointerEvent(t);if(n){for(var o=n;o;)i.currentTarget=o,r.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType||"mouse"!==i.pointerType&&"pen"!==i.pointerType||r.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),Js.isNode(o)&&(o=o.parentNode);delete e.pressTargetsByButton[t.button]}r.freeEvent(i)},this.onWheel=function(t){var e=r.createWheelEvent(t);r.dispatchEvent(e),r.freeEvent(e)},this.onClick=function(t){if(r.context.config.useNativeClickEvent){var e=r.createPointerEvent(t);r.dispatchEvent(e),r.freeEvent(e)}},this.onPointerCancel=function(t){var e=r.createPointerEvent(t,void 0,void 0,r.context.config.alwaysTriggerPointerEventOnCanvas?r.rootTarget:void 0);r.dispatchEvent(e),r.freeEvent(e)},this.globalRuntime=e,this.context=n},[{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(),e=1,n=1,r=this.context.contextService.getDomElement();if(r&&t){var i=r.offsetWidth,o=r.offsetHeight;i&&o&&(e=t.width/i,n=t.height/o)}return{scaleX:e,scaleY:n,bbox:t}}},{key:"client2Viewport",value:function(t){var e=this.getScale(),n=e.scaleX,r=e.scaleY,i=e.bbox;return new Or((t.x-((null==i?void 0:i.left)||0))/n,(t.y-((null==i?void 0:i.top)||0))/r)}},{key:"viewport2Client",value:function(t){var e=this.getScale(),n=e.scaleX,r=e.scaleY,i=e.bbox;return new Or((t.x+((null==i?void 0:i.left)||0))*n,(t.y+((null==i?void 0:i.top)||0))*r)}},{key:"viewport2Canvas",value:function(t){var e=t.x,n=t.y,r=this.rootTarget.defaultView.getCamera(),i=this.context.config,o=i.width,a=i.height,s=r.getPerspectiveInverse(),l=r.getWorldTransform(),c=j(this.tmpMatrix,l,s),u=vt(this.tmpVec3,e/o*2-1,2*(1-n/a)-1,0);return Mt(u,u,c),new Or(u[0],u[1])}},{key:"canvas2Viewport",value:function(t){var e=this.rootTarget.defaultView.getCamera(),n=e.getPerspective(),r=e.getViewTransform(),i=j(this.tmpMatrix,n,r),o=vt(this.tmpVec3,t.x,t.y,0);Mt(this.tmpVec3,this.tmpVec3,i);var a=this.context.config,s=a.width,l=a.height;return new Or((o[0]+1)/2*s,(1-(o[1]+1)/2)*l)}},{key:"setPickHandler",value:function(t){this.pickHandler=t}},{key:"addEventMapping",value:function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})}},{key:"mapEvent",value:function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,r=e.length;n<r;n++)e[n].fn(t);else console.warn("[EventService]: Event mapping not defined for ".concat(t.type))}}},{key:"dispatchEvent",value:function(t,e,n){if(n){t.eventPhase=t.AT_TARGET;var r=this.rootTarget.defaultView||null;t.currentTarget=r,this.notifyListeners(t,e)}else t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e)}},{key:"propagate",value:function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var r=n.length-1;r>=1;r--)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){var i=n.indexOf(t.currentTarget);t.eventPhase=t.BUBBLING_PHASE;for(var o=i+1;o<n.length;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(t){var e=[t],n=this.rootTarget.defaultView||null;if(n&&n===t)return e.unshift(n.document),e;for(var r=0;r<2048&&t!==this.rootTarget;r++)Js.isNode(t)&&t.parentNode&&(e.push(t.parentNode),t=t.parentNode);return n&&e.push(n),e}},{key:"hitTest",value:function(t){var e=t.viewportX,n=t.viewportY,r=this.context.config,i=r.width,o=r.height,a=r.disableHitTesting;return e<0||n<0||e>i||n>o?null:!a&&this.pickHandler(t)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(t,e){var n,r=null==e?void 0:e.target;if(null!==(n=r)&&void 0!==n&&n.shadowRoot&&(r=e.composedPath()[0]),r){if(r===t)return!0;if(t&&t.contains)return t.contains(r)}return!(null==e||!e.composedPath)&&e.composedPath().indexOf(t)>-1}},{key:"getExistedHTML",value:function(t){if(t.nativeEvent.composedPath)for(var e=0,n=t.nativeEvent.composedPath();e<n.length;e++){var r=n[e],i=this.nativeHTMLMap.get(r);if(i)return i}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,e,n,r){var i=this.allocateEvent(Xs);this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t;var o=this.getExistedHTML(i),a=this.context.contextService.getDomElement();return i.target=null!=n?n:o||this.isNativeEventFromCanvas(a,i.nativeEvent)&&this.pickTarget(i)||r,"string"==typeof e&&(i.type=e),i}},{key:"createWheelEvent",value:function(t){var e=this.allocateEvent(Ks);this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t;var n=this.getExistedHTML(e),r=this.context.contextService.getDomElement();return e.target=n||this.isNativeEventFromCanvas(r,e.nativeEvent)&&this.pickTarget(e),e}},{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 e=this.allocateEvent(Ks);return e.nativeEvent=t.nativeEvent,e.originalEvent=t.originalEvent,this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.target=t.target,e.path=t.composedPath().slice(),e.type=t.type,e}},{key:"clonePointerEvent",value:function(t,e){var n=this.allocateEvent(Xs);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n}},{key:"copyPointerData",value:function(t,e){e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist}},{key:"copyMouseData",value:function(t,e){e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.shiftKey=t.shiftKey,e.client.copyFrom(t.client),e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset)}},{key:"copyWheelData",value:function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}},{key:"copyData",value:function(t,e){e.isTrusted=t.isTrusted,e.timeStamp=is.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.page.copyFrom(t.page),e.viewport.copyFrom(t.viewport)}},{key:"allocateEvent",value:function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=[],e.target=null,e}},{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 e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}},{key:"notifyTarget",value:function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?"".concat(e,"capture"):e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}},{key:"notifyListeners",value:function(t,e){var n=t.currentTarget.emitter,r=n._events[e];if(r)if("fn"in r)r.once&&n.removeListener(e,r.fn,void 0,!0),r.fn.call(t.currentTarget||r.context,t);else for(var i=0;i<r.length&&!t.propagationImmediatelyStopped;i++)r[i].once&&n.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(t.currentTarget||r[i].context,t)}},{key:"findMountedTarget",value:function(t){if(!t)return null;for(var e=t[t.length-1],n=t.length-2;n>=0;n--){var r=t[n];if(!(r===this.rootTarget||Js.isNode(r)&&r.parentNode===e))break;e=t[n]}return e}},{key:"getCursor",value:function(t){for(var e=t;e;){var n=Ja(e)&&e.getAttribute("cursor");if(n)return n;e=Js.isNode(e)&&e.parentNode}}}])}(),el=function(){return c(function t(){s(this,t)},[{key:"getOrCreateCanvas",value:function(t,e){if(this.canvas)return this.canvas;if(t||jl.offscreenCanvas)this.canvas=t||jl.offscreenCanvas,this.context=this.canvas.getContext("2d",a({willReadFrequently:!0},e));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",a({willReadFrequently:!0},e)),this.context&&this.context.measureText||(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",a({willReadFrequently:!0},e))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(t,e){return this.context||this.getOrCreateCanvas(t,e),this.context}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch(t){}try{return document.createElement("canvas")}catch(t){}return null}}])}(),nl=function(t){return t[t.CAMERA_CHANGED=0]="CAMERA_CHANGED",t[t.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",t[t.NONE=2]="NONE",t}({}),rl=function(){return c(function t(e,n){s(this,t),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new xs,initAsync:new ys,dirtycheck:new Es,cull:new Es,beginFrame:new xs,beforeRender:new xs,render:new xs,afterRender:new xs,endFrame:new xs,destroy:new xs,pick:new bs,pickSync:new Es,pointerDown:new xs,pointerUp:new xs,pointerMove:new xs,pointerOut:new xs,pointerOver:new xs,pointerWheel:new xs,pointerCancel:new xs,click:new xs},this.globalRuntime=e,this.context=n},[{key:"init",value:function(t){var e=this,n=a(a({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(t){t.apply(n,e.globalRuntime)}),this.hooks.init.call(),0===this.hooks.initAsync.getCallbacksNum()?(this.inited=!0,t()):this.hooks.initAsync.promise().then(function(){e.inited=!0,t()}).catch(function(t){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){return!this.context.config.renderer.getConfig().enableDirtyRectangleRendering||this.context.renderingContext.renderReasons.has(nl.CAMERA_CHANGED)}},{key:"render",value:function(t,e,n){var r=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var i=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(i.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),i.renderReasons.size&&this.inited){i.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var o=1===i.renderReasons.size&&i.renderReasons.has(nl.CAMERA_CHANGED),a=!t.disableRenderHooks||!o;a&&this.renderDisplayObject(i.root,t,i),this.hooks.beginFrame.call(e),a&&i.renderListCurrentFrame.forEach(function(t){r.hooks.beforeRender.call(t),r.hooks.render.call(t),r.hooks.afterRender.call(t)}),this.hooks.endFrame.call(e),i.renderListCurrentFrame=[],i.renderReasons.clear(),n()}}},{key:"renderDisplayObject",value:function(t,e,n){var r=this,i=e.renderer.getConfig(),o=i.enableDirtyCheck,a=i.enableCulling;function s(t){var e=t.renderable,i=t.sortable,s=o?e.dirty||n.dirtyRectangleRenderingDisabled?t:null:t,l=null;s&&(l=a?r.hooks.cull.call(s,r.context.camera):s)&&(r.stats.rendered+=1,n.renderListCurrentFrame.push(l)),t.dirty(!1),i.renderOrder=r.zIndexCounter,r.zIndexCounter+=1,r.stats.total+=1,i.dirty&&(r.sort(t,i),i.dirty=!1,i.dirtyChildren=[],i.dirtyReason=void 0)}for(var l=[t];l.length>0;){var c,u=l.pop();s(u);for(var h=(null===(c=u.sortable)||void 0===c||null===(c=c.sorted)||void 0===c?void 0:c.length)>0?u.sortable.sorted:u.childNodes,d=h.length-1;d>=0;d--)l.push(h[d])}}},{key:"sort",value:function(t,e){var n,r;(null==e||null===(n=e.sorted)||void 0===n?void 0:n.length)>0&&e.dirtyReason!==ni.Z_INDEX_CHANGED?e.dirtyChildren.forEach(function(n){var r=e.sorted.indexOf(n);if(r>-1&&e.sorted.splice(r,1),t.childNodes.indexOf(n)>-1)if(0===e.sorted.length)e.sorted.push(n);else{var i=function(t,e){for(var n=0,r=t.length;n<r;){var i=n+r>>>1;ts(t[i],e)<0?n=i+1:r=i}return n}(e.sorted,n);e.sorted.splice(i,0,n)}}):e.sorted=t.childNodes.slice().sort(ts),(null===(r=e.sorted)||void 0===r?void 0:r.length)>0&&0===t.childNodes.filter(function(t){return t.parsedStyle.zIndex}).length&&(e.sorted=[])}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add(nl.DISPLAY_OBJECT_CHANGED)}}])}(),il=/\[\s*(.*)=(.*)\s*\]/,ol=function(){return c(function t(){s(this,t)},[{key:"selectOne",value:function(t,e){var n=this;if(t.startsWith("."))return e.find(function(e){return((null==e?void 0:e.classList)||[]).indexOf(n.getIdOrClassname(t))>-1});if(t.startsWith("#"))return e.find(function(e){return e.id===n.getIdOrClassname(t)});if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.find(function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)}):null}return e.find(function(n){return e!==n&&n.nodeName===t})}},{key:"selectAll",value:function(t,e){var n=this;if(t.startsWith("."))return e.findAll(function(r){return e!==r&&((null==r?void 0:r.classList)||[]).indexOf(n.getIdOrClassname(t))>-1});if(t.startsWith("#"))return e.findAll(function(r){return e!==r&&r.id===n.getIdOrClassname(t)});if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.findAll(function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)}):[]}return e.findAll(function(n){return e!==n&&n.nodeName===t})}},{key:"is",value:function(t,e){if(t.startsWith("."))return e.className===this.getIdOrClassname(t);if(t.startsWith("#"))return e.id===this.getIdOrClassname(t);if(t.startsWith("[")){var n=this.getAttribute(t),r=n.name,i=n.value;return"name"===r?e.name===i:this.attributeToString(e,r)===i}return e.nodeName===t}},{key:"getIdOrClassname",value:function(t){return t.substring(1)}},{key:"getAttribute",value:function(t){var e=t.match(il),n="",r="";return e&&e.length>2&&(n=e[1].replace(/"/g,""),r=e[2].replace(/"/g,"")),{name:n,value:r}}},{key:"attributeToString",value:function(t,e){if(!t.getAttribute)return"";var n=t.getAttribute(e);return $t(n)?"":n.toString?n.toString():""}}])}(),al=function(t){return t.ATTR_MODIFIED="DOMAttrModified",t.INSERTED="DOMNodeInserted",t.MOUNTED="DOMNodeInsertedIntoDocument",t.REMOVED="removed",t.UNMOUNTED="DOMNodeRemovedFromDocument",t.REPARENT="reparent",t.DESTROY="destroy",t.BOUNDS_CHANGED="bounds-changed",t.CULLED="culled",t}({}),sl=function(t){function e(t,n,r,i,o,a,l,c){var u;return s(this,e),(u=v(this,e,[null])).relatedNode=n,u.prevValue=r,u.newValue=i,u.attrName=o,u.attrChange=a,u.prevParsedValue=l,u.newParsedValue=c,u.type=t,u}return y(e,t),c(e)}(Ys);sl.ADDITION=2,sl.MODIFICATION=1,sl.REMOVAL=3;var ll,cl,ul,hl=new sl(al.REPARENT,null,"","","",0,"",""),dl=Vt(),fl=ht(),pl=pt(1,1,1),gl=O(),vl=Vt(),ml=ht(),yl=O(),bl=Rt(),xl=ht(),El=Rt(),wl=ht(),kl=ht(),Ml=ht(),Sl=O(),Nl=Rt(),Tl=Rt(),Ol=Rt(),Cl={affectChildren:!0},Al=function(){return c(function t(e){s(this,t),this.pendingEvents=new Map,this.boundsChangedEvent=new Zs(al.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=e},[{key:"matches",value:function(t,e){return this.runtime.sceneGraphSelector.is(t,e)}},{key:"querySelector",value:function(t,e){return this.runtime.sceneGraphSelector.selectOne(t,e)}},{key:"querySelectorAll",value:function(t,e){return this.runtime.sceneGraphSelector.selectAll(t,e)}},{key:"attach",value:function(t,e,n){var r,i=!1;t.parentNode&&(i=t.parentNode!==e,this.detach(t));var o=t.nodeName===pr.FRAGMENT,a=os(e);t.parentNode=e;var s=o?t.childNodes:[t];ae(n)?s.forEach(function(t){e.childNodes.splice(n,0,t),t.parentNode=e}):s.forEach(function(t){e.childNodes.push(t),t.parentNode=e});var l=e.sortable;if((null!=l&&null!==(r=l.sorted)&&void 0!==r&&r.length||l.dirty||t.parsedStyle.zIndex)&&(-1===l.dirtyChildren.indexOf(t)&&l.dirtyChildren.push(t),l.dirty=!0,l.dirtyReason=ni.ADDED),!a){if(o)this.dirtifyFragment(t);else{var c=t.transformable;c&&this.dirtyWorldTransform(t,c)}if(i){var u,h=!0===(null===(u=e.ownerDocument)||void 0===u||null===(u=u.defaultView)||void 0===u||null===(u=u.getConfig())||void 0===u||null===(u=u.future)||void 0===u?void 0:u.experimentalCancelEventPropagation);t.dispatchEvent(hl,h,h)}}}},{key:"detach",value:function(t){var e,n;if(t.parentNode){var r=t.transformable,i=t.parentNode.sortable;(null!=i&&null!==(e=i.sorted)&&void 0!==e&&e.length||null!==(n=t.style)&&void 0!==n&&n.zIndex)&&(-1===i.dirtyChildren.indexOf(t)&&i.dirtyChildren.push(t),i.dirty=!0,i.dirtyReason=ni.REMOVED);var o=t.parentNode.childNodes.indexOf(t);o>-1&&t.parentNode.childNodes.splice(o,1),r&&this.dirtyWorldTransform(t,r),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 e=t.transformable;return ai(e),e.localTransform}},{key:"setLocalPosition",value:function(t,e){var n,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.transformable;kl[0]=e[0],kl[1]=e[1],kl[2]=null!==(n=e[2])&&void 0!==n?n:0,St(i.localPosition,kl)||(gt(i.localPosition,kl),r&&this.dirtyLocalTransform(t,i))}},{key:"translateLocal",value:function(t,e){"number"==typeof e&&(e=pt(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;St(e,fl)||(!function(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],s=e[0],l=e[1],c=e[2],u=i*c-o*l,h=o*s-r*c,d=r*l-i*s;u+=u,h+=h,d+=d,t[0]=s+a*u+i*d-o*h,t[1]=l+a*h+o*u-r*d,t[2]=c+a*d+r*h-i*u}(e,e,n.localRotation),mt(n.localPosition,n.localPosition,e),this.dirtyLocalTransform(t,n))}},{key:"setLocalRotation",value:function(t,e,n,r,i){var o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];"number"==typeof e&&(e=Ft(bl,e,n,r,i));var a=t.transformable;Bt(a.localRotation,e),o&&this.dirtyLocalTransform(t,a)}},{key:"rotateLocal",value:function(t,e){"number"==typeof e&&(e=pt(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;It(Tl,e[0],e[1],e[2]),zt(n.localRotation,n.localRotation,Tl),this.dirtyLocalTransform(t,n)}},{key:"setLocalScale",value:function(t,e){var n,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.transformable;vt(ml,e[0],e[1],null!==(n=e[2])&&void 0!==n?n:i.localScale[2]),St(ml,i.localScale)||(gt(i.localScale,ml),r&&this.dirtyLocalTransform(t,i))}},{key:"scaleLocal",value:function(t,e){var n,r=t.transformable;!function(t,e,n){t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2]}(r.localScale,r.localScale,vt(ml,e[0],e[1],null!==(n=e[2])&&void 0!==n?n:1)),this.dirtyLocalTransform(t,r)}},{key:"setLocalSkew",value:function(t,e,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];"number"==typeof e&&(e=function(t,e,n){return t[0]=e,t[1]=n,t}(vl,e,n));var i=t.transformable;!function(t,e){t[0]=e[0],t[1]=e[1]}(i.localSkew,e),r&&this.dirtyLocalTransform(t,i)}},{key:"setLocalEulerAngles",value:function(t,e){var n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];"number"==typeof e&&(e=pt(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var r=t.transformable;It(r.localRotation,e[0],e[1],e[2]),n&&this.dirtyLocalTransform(t,r)}},{key:"setLocalTransform",value:function(t,e){var n=X(xl,e),r=Z(El,e),i=K(wl,e);this.setLocalScale(t,i,!1),this.setLocalPosition(t,n,!1),this.setLocalRotation(t,r,void 0,void 0,void 0,!1),this.dirtyLocalTransform(t,t.transformable)}},{key:"resetLocalTransform",value:function(t){this.setLocalScale(t,pl,!1),this.setLocalPosition(t,fl,!1),this.setLocalEulerAngles(t,fl,void 0,void 0,!1),this.setLocalSkew(t,dl,void 0,!1),this.dirtyLocalTransform(t,t.transformable)}},{key:"getPosition",value:function(t){var e=t.transformable;return X(e.position,this.getWorldTransform(t,e))}},{key:"getRotation",value:function(t){var e=t.transformable;return Z(e.rotation,this.getWorldTransform(t,e))}},{key:"getScale",value:function(t){var e=t.transformable;return K(e.scaling,this.getWorldTransform(t,e))}},{key:"getOrigin",value:function(t){return t.getGeometryBounds(),t.transformable.origin}},{key:"getWorldTransform",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.transformable;return e.localDirtyFlag||e.dirtyFlag?(t.parentNode&&t.parentNode.transformable&&this.getWorldTransform(t.parentNode),this.internalUpdateTransform(t),e.worldTransform):e.worldTransform}},{key:"setPosition",value:function(t,e){var n,r=t.transformable;if(Ml[0]=e[0],Ml[1]=e[1],Ml[2]=null!==(n=e[2])&&void 0!==n?n:0,!St(this.getPosition(t),Ml)){if(gt(r.position,Ml),null!==t.parentNode&&t.parentNode.transformable){var i=t.parentNode.transformable;A(Sl,i.worldTransform),_(Sl,Sl),Mt(r.localPosition,Ml,Sl)}else gt(r.localPosition,Ml);this.dirtyLocalTransform(t,r)}}},{key:"translate",value:function(t,e){"number"==typeof e&&(e=vt(ml,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)),St(e,fl)||(mt(ml,this.getPosition(t),e),this.setPosition(t,ml))}},{key:"setRotation",value:function(t,e,n,r,i){var o=t.transformable;if("number"==typeof e&&(e=jt(e,n,r,i)),null!==t.parentNode&&t.parentNode.transformable){var a=this.getRotation(t.parentNode);Bt(bl,a),_t(bl,bl),Lt(o.localRotation,bl,e),Gt(o.localRotation,o.localRotation),this.dirtyLocalTransform(t,o)}else this.setLocalRotation(t,e)}},{key:"rotate",value:function(t,e){"number"==typeof e&&(e=pt(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){var r=bl;It(r,e[0],e[1],e[2]);var i=this.getRotation(t),o=this.getRotation(t.parentNode);Bt(Ol,o),_t(Ol,Ol),Lt(r,Ol,r),Lt(n.localRotation,r,i),Gt(n.localRotation,n.localRotation),this.dirtyLocalTransform(t,n)}else this.rotateLocal(t,e)}},{key:"setOrigin",value:function(t,e){"number"==typeof e&&(e=[e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0]);var n=t.transformable;if(e[0]!==n.origin[0]||e[1]!==n.origin[1]||e[2]!==n.origin[2]){var r=n.origin;r[0]=e[0],r[1]=e[1],r[2]=e[2]||0,this.dirtyLocalTransform(t,n)}}},{key:"setEulerAngles",value:function(t,e){"number"==typeof e&&(e=pt(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){It(n.localRotation,e[0],e[1],e[2]);var r=this.getRotation(t.parentNode);Bt(Nl,_t(bl,r)),zt(n.localRotation,n.localRotation,Nl),this.dirtyLocalTransform(t,n)}else this.setLocalEulerAngles(t,e)}},{key:"getTransformedGeometryBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=this.getGeometryBounds(t,e);if(!Mr.isEmpty(r)){var i=n||new Mr;return i.setFromTransformedAABB(r,this.getWorldTransform(t)),i}return null}},{key:"getGeometryBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.geometry;return n.dirty&&jl.styleValueRegistry.updateGeometry(t),(e?n.renderBounds:n.contentBounds||null)||new Mr}},{key:"getBounds",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.renderable;if(!r.boundsDirty&&!n&&r.bounds)return r.bounds;if(!r.renderBoundsDirty&&n&&r.renderBounds)return r.renderBounds;var i=n?r.renderBounds:r.bounds,o=this.getTransformedGeometryBounds(t,n,i);if(t.childNodes.forEach(function(t){var r=e.getBounds(t,n);r&&(o?o.add(r):(o=i||new Mr).update(r.center,r.halfExtents))}),o||(o=new Mr),n){var a=es(t);if(a){var s=a.parsedStyle.clipPath.getBounds(n);o?s&&(o=s.intersection(o)):o.update(s.center,s.halfExtents)}}return n?(r.renderBounds=o,r.renderBoundsDirty=!1):(r.bounds=o,r.boundsDirty=!1),o}},{key:"getLocalBounds",value:function(t){if(t.parentNode){var e=gl;t.parentNode.transformable&&(e=_(yl,this.getWorldTransform(t.parentNode)));var n=this.getBounds(t);if(!Mr.isEmpty(n)){var r=new Mr;return r.setFromTransformedAABB(n,e),r}}return this.getBounds(t)}},{key:"getBoundingClientRect",value:function(t){var e,n,r=this.getGeometryBounds(t);Mr.isEmpty(r)||(n=new Mr).setFromTransformedAABB(r,this.getWorldTransform(t));var i=null===(e=t.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e?void 0:e.getContextService().getBoundingClientRect();if(n){var o=b(n.getMin(),2),a=o[0],s=o[1],l=b(n.getMax(),2),c=l[0],u=l[1];return new Cr(a+((null==i?void 0:i.left)||0),s+((null==i?void 0:i.top)||0),c-a,u-s)}return new Cr((null==i?void 0:i.left)||0,(null==i?void 0:i.top)||0,0,0)}},{key:"internalUpdateTransform",value:function(t){var e,n=null===(e=t.parentNode)||void 0===e?void 0:e.transformable;ai(t.transformable),function(t,e){t.dirtyFlag&&(e?j(t.worldTransform,e.worldTransform,t.localTransform):A(t.worldTransform,t.localTransform),t.dirtyFlag=!1)}(t.transformable,n)}},{key:"internalUpdateElement",value:function(t,e){var n,r,i,o,a,s,l=!0===(null===(n=t.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n||null===(n=n.getConfig())||void 0===n||null===(n=n.future)||void 0===n?void 0:n.experimentalAttributeUpdateOptimization),c=e[e.length-1],u=(null==c?void 0:c.transformDirty)||(null===(r=t.transformable)||void 0===r?void 0:r.localDirtyFlag);t.transformable&&((a=t.transformable).dirtyFlag||(a.dirtyFlag=u));(this.internalUpdateTransform(t),u)&&(null===(s=t.dirty)||void 0===s||s.call(t,!0,!0));var h=(null===(i=t.renderable)||void 0===i?void 0:i.boundsDirty)||(null===(o=t.renderable)||void 0===o?void 0:o.renderBoundsDirty);if((u||h)&&!1===(null==c?void 0:c.shapeUpdated)&&l)for(var d=e.length-1;d>=0;){var f,p,g=e[d];if(g.shapeUpdated)break;null===(f=(p=g.node).dirty)||void 0===f||f.call(p,!0,!0),g.shapeUpdated=!0,d-=1}return u}},{key:"syncHierarchy",value:function(t){for(var e,n,r=[t],i=t.parentNode?[{node:t.parentNode,transformDirty:(null===(e=t.parentNode.transformable)||void 0===e?void 0:e.localDirtyFlag)||(null===(n=t.parentNode.transformable)||void 0===n?void 0:n.dirtyFlag),shapeUpdated:!1}]:[];r.length>0;){for(var o=r.pop(),a=i[i.length-1];i.length>0&&o.parentNode!==a.node;)a=i.pop();var s=this.internalUpdateElement(o,i);if(o.childNodes.length>0){for(var l=o.childNodes.length-1;l>=0;l--)r.push(o.childNodes[l]);i.push({node:o,transformDirty:s,shapeUpdated:!1})}}}},{key:"dirtyLocalTransform",value:function(t,e){os(t)||e.localDirtyFlag||(e.localDirtyFlag=!0,e.dirtyFlag||this.dirtyWorldTransform(t,e))}},{key:"dirtyWorldTransform",value:function(t,e){this.dirtifyWorldInternal(t,e),this.dirtyToRoot(t,!0)}},{key:"dirtifyWorldInternal",value:function(t,e){var n,r=this,i=!0===(null===(n=t.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n||null===(n=n.getConfig())||void 0===n||null===(n=n.future)||void 0===n?void 0:n.experimentalAttributeUpdateOptimization);e.dirtyFlag||(e.dirtyFlag=!0,t.dirty(!0,!0),i||t.childNodes.forEach(function(t){var e=t.transformable;r.dirtifyWorldInternal(t,e)}))}},{key:"dirtyToRoot",value:function(t){for(var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t,i=!0===(null===(e=t.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e||null===(e=e.getConfig())||void 0===e||null===(e=e.future)||void 0===e?void 0:e.experimentalAttributeUpdateOptimization);r;){var o,a;if(null===(o=(a=r).dirty)||void 0===o||o.call(a,!0,!0),i)break;r=r.parentNode}n&&t.forEach(function(t){var e;null===(e=t.dirty)||void 0===e||e.call(t,!0,!0)}),this.informDependentDisplayObjects(t),this.pendingEvents.set(t,n)}},{key:"dirtifyFragment",value:function(t){var e,n,r=t.transformable;r&&(r.dirtyFlag=!0,r.localDirtyFlag=!0),null===(e=(n=t).dirty)||void 0===e||e.call(n,!0,!0);for(var i=t.childNodes.length,o=0;o<i;o++)this.dirtifyFragment(t.childNodes[o]);t.nodeName===pr.FRAGMENT&&this.pendingEvents.set(t,!1)}},{key:"triggerPendingEvents",value:function(){var t,e,n=this,r=new Set,i=function(e,i){if(e.isConnected&&!r.has(e)&&e.nodeName!==pr.FRAGMENT){if(n.boundsChangedEvent.detail=i,n.boundsChangedEvent.target=e,e.isMutationObserved)e.dispatchEvent(n.boundsChangedEvent);else{var o;if(void 0===t)t=!0===(null===(o=e.ownerDocument.defaultView)||void 0===o||null===(o=o.getConfig())||void 0===o||null===(o=o.future)||void 0===o?void 0:o.experimentalCancelEventPropagation);e.ownerDocument.defaultView.dispatchEvent(n.boundsChangedEvent,!0,t)}r.add(e)}};this.pendingEvents.forEach(function(t,n){if(n.nodeName!==pr.FRAGMENT){var r;if(void 0===e)e=!0===(null===(r=n.ownerDocument)||void 0===r||null===(r=r.defaultView)||void 0===r||null===(r=r.getConfig())||void 0===r||null===(r=r.future)||void 0===r?void 0:r.experimentalAttributeUpdateOptimization);Cl.affectChildren=t,e?i(n,Cl):t?n.forEach(function(t){i(t,Cl)}):i(n,Cl)}}),r.clear(),this.clearPendingEvents()}},{key:"clearPendingEvents",value:function(){this.pendingEvents.clear()}},{key:"updateDisplayObjectDependency",value:function(t,e,n,r){if(e&&e!==n){var i=this.displayObjectDependencyMap.get(e);if(i&&i[t]){var o=i[t].indexOf(r);i[t].splice(o,1)}}if(n){var a=this.displayObjectDependencyMap.get(n);a||(this.displayObjectDependencyMap.set(n,{}),a=this.displayObjectDependencyMap.get(n)),a[t]||(a[t]=[]),a[t].push(r)}}},{key:"informDependentDisplayObjects",value:function(t){var e,n=this,r=this.displayObjectDependencyMap.get(t);if(r){var i=null===(e=t.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e||null===(e=e.getConfig())||void 0===e||null===(e=e.future)||void 0===e?void 0:e.experimentalCancelEventPropagation;Object.keys(r).forEach(function(t){r[t].forEach(function(e){n.dirtyToRoot(e,!0),e.dispatchEvent(new sl(al.ATTR_MODIFIED,e,n,n,t,sl.MODIFICATION,n,n),i,i),e.isCustomElement&&e.isConnected&&e.attributeChangedCallback&&e.attributeChangedCallback(t,n,n)})})}}}])}(),Pl=function(){return c(function t(e){if(s(this,t),e<=0)throw new Error("LRU capacity must be a positive number.");this.capacity=e,this.cache=new Map},[{key:"get",value:function(t){if(this.cache.has(t)){var e=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,e),e}}},{key:"put",value:function(t,e){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.capacity){var n=this.cache.keys().next().value;this.cache.delete(n)}}},{key:"len",value:function(){return this.cache.size}},{key:"clear",value:function(){this.cache.clear()}}])}(),Rl={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]},Dl=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,Ll=new RegExp("".concat(/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/.source,"|").concat(/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/.source,"|").concat(/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/.source,"|").concat(/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/.source)),_l=new RegExp("".concat(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source,"|").concat(/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source,"|").concat(/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source,"|").concat(/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source)),Il=function(){return c(function t(e){var n=this;s(this,t),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(t,e){return!n.isBreakingSpace(e)&&!(!t||!_l.exec(e)&&!Ll.exec(t))},this.trimByKinsokuShorui=function(t){var e=d(t),n=e[e.length-2];if(!n)return t;var r=n[n.length-1];return e[e.length-2]=n.slice(0,-1),e[e.length-1]=r+e[e.length-1],e},this.runtime=e,this.charWidthCache=new Pl(100)},[{key:"measureFont",value:function(t,e){if(this.fontMetricsCache[t])return this.fontMetricsCache[t];var n={ascent:0,descent:0,fontSize:0},r=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(e),i=this.runtime.offscreenCanvasCreator.getOrCreateContext(e,{willReadFrequently:!0});i.font=t;var o=Rl.MetricsString+Rl.BaselineSymbol,a=Math.ceil(i.measureText(o).width),s=Math.ceil(i.measureText(Rl.BaselineSymbol).width),l=Rl.HeightMultiplier*s;s=s*Rl.BaselineMultiplier|0,r.width=a,r.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(o,0,s);var c=i.getImageData(0,0,a||1,l||1).data,u=c.length,h=4*a,d=0,f=0,p=!1;for(d=0;d<s;++d){for(var g=0;g<h;g+=4)if(255!==c[f+g]){p=!0;break}if(p)break;f+=h}for(n.ascent=s-d,f=u-h,p=!1,d=l;d>s;--d){for(var v=0;v<h;v+=4)if(255!==c[f+v]){p=!0;break}if(p)break;f-=h}return n.descent=d-s,n.fontSize=n.ascent+n.descent,this.fontMetricsCache[t]=n,n}},{key:"measureText",value:function(t,e,n){var r=e.fontSize,i=void 0===r?16:r,o=e.wordWrap,a=void 0!==o&&o,s=e.lineHeight,l=e.lineWidth,c=void 0===l?1:l,u=e.textBaseline,h=void 0===u?"alphabetic":u,d=e.textAlign,f=void 0===d?"start":d,p=e.letterSpacing,g=void 0===p?0:p,v=e.textPath;e.textPathSide,e.textPathStartOffset;var m=e.leading,y=void 0===m?0:m,b=Ss(e),x=this.measureFont(b,n);0===x.fontSize&&(x.fontSize=i,x.ascent=i);var E=this.runtime.offscreenCanvasCreator.getOrCreateContext(n);E.font=b,e.isOverflowing=!1;var w=(a?this.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),k=new Array(w.length),M=0;if(!v){for(var S=0;S<w.length;S++){var N=E.measureText(w[S]).width+(w[S].length-1)*g;k[S]=N,M=Math.max(M,N)}var T=M+c,O=s||x.fontSize+c,C=Math.max(O,x.fontSize+c)+(w.length-1)*(O+y),A=0;return"middle"===h?A=-C/2:"bottom"===h||"alphabetic"===h||"ideographic"===h?A=-C:"top"!==h&&"hanging"!==h||(A=0),{font:b,width:T,height:C,lines:w,lineWidths:k,lineHeight:O+=y,maxLineWidth:M,fontProperties:x,lineMetrics:k.map(function(t,e){var n=0;return"center"===f||"middle"===f?n-=t/2:"right"!==f&&"end"!==f||(n-=t),new Cr(n-c/2,A+e*O,t+c,O)})}}v.getTotalLength();for(var P=0;P<w.length;P++)E.measureText(w[P]).width,w[P].length}},{key:"wordWrap",value:function(t,e,n){var r=this,i=Array.from(t);if(0===i.length)return"";var o=this,a=e.wordWrapWidth,s=void 0===a?0:a,l=e.letterSpacing,c=void 0===l?0:l,u=e.maxLines,h=void 0===u?1/0:u,d=e.textOverflow,f=this.runtime.offscreenCanvasCreator.getOrCreateContext(n),p=s+c,g="";"ellipsis"===d?g="...":d&&"clip"!==d&&(g=d);var v=[""],m=0,y=0,b=-1,x=Ss(e),E=this.charWidthCache.get(x);E||(E=new Pl(500),this.charWidthCache.put(x,E));var w=function(t){return r.getFromCache(t,c,E,f)},k=w(g);function M(t,e,n,r){for(;w(t)<r&&e<i.length-1&&!o.isNewline(i[e+1]);)t+=i[e+=1];for(;w(t)>r&&e>=n;)e-=1,t=t.slice(0,-1);return{lineTxt:t,txtLastCharIndex:e}}function S(t,e){if(!(k<=0||k>p))if(v[t]){var n=M(v[t],e,b+1,p-k);v[t]=n.lineTxt+g}else v[t]=g}for(var N=0;N<i.length;N++){var T=i[N],O=i[N-1],C=i[N+1],A=w(T);if(this.isNewline(T)){if(m+1>=h){N<i.length-1&&S(m,N-1),e.isOverflowing=!0;break}b=N-1,y=0,v[m+=1]=""}else{if(A>p){S(m,N-1),e.isOverflowing=!0;break}if(y>0&&y+A>p){var P=M(v[m],N-1,b+1,p);if(P.txtLastCharIndex!==N-1){if(v[m]=P.lineTxt,P.txtLastCharIndex===i.length-1)break;N=P.txtLastCharIndex+1,T=i[N],O=i[N-1],C=i[N+1],A=w(T)}if(m+1>=h){S(m,N-1),e.isOverflowing=!0;break}if(b=N-1,y=0,v[m+=1]="",this.isBreakingSpace(T))continue;this.canBreakInLastChar(T)||(v=this.trimToBreakable(v),y=this.sumTextWidthByCache(v[m]||"",w)),this.shouldBreakByKinsokuShorui(T,C)&&(v=this.trimByKinsokuShorui(v),y+=w(O||""))}y+=A,v[m]+=T}}return v.join("\n")}},{key:"isBreakingSpace",value:function(t){return"string"==typeof t&&Rl.BreakingSpaces.indexOf(t.charCodeAt(0))>=0}},{key:"isNewline",value:function(t){return"string"==typeof t&&Rl.Newlines.indexOf(t.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(t){var e=d(t),n=e[e.length-2],r=this.findBreakableIndex(n);if(-1===r||!n)return e;var i=n.slice(r,r+1),o=r+1,a=r+(this.isBreakingSpace(i)?0:1);return e[e.length-1]+=n.slice(o,n.length),e[e.length-2]=n.slice(0,a),e}},{key:"canBreakInLastChar",value:function(t){return!t||!Dl.test(t)}},{key:"sumTextWidthByCache",value:function(t,e){return t.split("").reduce(function(t,n){return t+e(n)},0)}},{key:"findBreakableIndex",value:function(t){for(var e=t.length-1;e>=0;e--)if(!Dl.test(t[e]))return e;return-1}},{key:"getFromCache",value:function(t,e,n,r){var i=n.get(t);if("number"!=typeof i){var o=t.length*e;i=r.measureText(t).width+o,n.put(t,i)}return i}},{key:"clearCache",value:function(){this.fontMetricsCache={},this.charWidthCache.clear()}}])}(),jl={},Bl=(cl=new Ws,ul=new Vs,i(i(i(i(i(i(i(i(i(i(ll={},pr.FRAGMENT,null),pr.CIRCLE,new Bs),pr.ELLIPSE,new Fs),pr.RECT,cl),pr.IMAGE,cl),pr.GROUP,new Us),pr.LINE,new zs),pr.TEXT,new Hs(jl)),pr.POLYLINE,ul),pr.POLYGON,ul),i(i(i(ll,pr.PATH,new Gs),pr.HTML,new $s),pr.MESH,null)),Fl=function(t){var e=new Ia,n=new Fa;return i(i(i(i(i(i(i(i(i(i(t={},li.PERCENTAGE,null),li.NUMBER,new Wa),li.ANGLE,new La),li.DEFINED_PATH,new _a),li.PAINT,e),li.COLOR,e),li.FILTER,new ja),li.LENGTH,n),li.LENGTH_PERCENTAGE,n),li.LENGTH_PERCENTAGE_12,new za),i(i(i(i(i(i(i(i(i(i(t,li.LENGTH_PERCENTAGE_14,new Ga),li.COORDINATE,new Fa),li.OFFSET_DISTANCE,new Ha),li.OPACITY_VALUE,new Ua),li.PATH,new $a),li.LIST_OF_POINTS,new Ya),li.SHADOW_BLUR,new qa),li.TEXT,new Xa),li.TEXT_TRANSFORM,new Ka),li.TRANSFORM,new _s),i(i(i(t,li.TRANSFORM_ORIGIN,new Is),li.Z_INDEX,new js),li.MARKER,new Va)}();jl.CameraContribution=ti,jl.AnimationTimeline=null,jl.EasingFunction=null,jl.offscreenCanvasCreator=new el,jl.sceneGraphSelector=new ol,jl.sceneGraphService=new Al(jl),jl.textService=new Il(jl),jl.geometryUpdaterFactory=Bl,jl.CSSPropertySyntaxFactory=Fl,jl.styleValueRegistry=new Ra(jl),jl.layoutRegistry=null,jl.globalThis="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},jl.enableStyleSyntax=!0,jl.enableSizeAttenuation=!1;var zl=0,Gl=new sl(al.INSERTED,null,"","","",0,"",""),Vl=new sl(al.REMOVED,null,"","","",0,"",""),Wl=new Zs(al.DESTROY),Hl=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).entity=zl++,t.transformable={dirtyFlag:!1,localDirtyFlag:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},t.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},t.geometry={contentBounds:void 0,renderBounds:void 0,dirty:!0},t.cullable={strategy:ei.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},t.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},t.rBushNode={aabb:void 0},t.namespaceURI="g",t.scrollLeft=0,t.scrollTop=0,t.clientTop=0,t.clientLeft=0,t.style={},t.computedStyle={},t.parsedStyle={},t.attributes={},t}return y(e,t),c(e,[{key:"dirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.renderable.dirty=t,e&&(this.renderable.boundsDirty=t,this.renderable.renderBoundsDirty=t)}},{key:"className",get:function(){return this.getAttribute("class")||""},set:function(t){this.setAttribute("class",t)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(t){return""!==t})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t-1]||null}return null}},{key:"cloneNode",value:function(t){throw new Error(Ar)}},{key:"appendChild",value:function(t,e){var n;if(t.destroyed)throw new Error("Cannot append a destroyed element.");return jl.sceneGraphService.attach(t,this,e),null!==(n=this.ownerDocument)&&void 0!==n&&n.defaultView&&(os(this)||t.nodeName!==pr.FRAGMENT?this.ownerDocument.defaultView.mountChildren(t):this.ownerDocument.defaultView.mountFragment(t)),this.isMutationObserved&&(Gl.relatedNode=this,t.dispatchEvent(Gl)),t}},{key:"insertBefore",value:function(t,e){if(e){t.parentElement&&t.parentElement.removeChild(t);var n=this.childNodes.indexOf(e);-1===n?this.appendChild(t):this.appendChild(t,n)}else this.appendChild(t);return t}},{key:"replaceChild",value:function(t,e){var n=this.childNodes.indexOf(e);return this.removeChild(e),this.appendChild(t,n),e}},{key:"removeChild",value:function(t){var e,n,r=!0===(null===(e=this.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e||null===(e=e.getConfig().future)||void 0===e?void 0:e.experimentalCancelEventPropagation);return Vl.relatedNode=this,t.dispatchEvent(Vl,r,r),null!==(n=t.ownerDocument)&&void 0!==n&&n.defaultView&&t.ownerDocument.defaultView.unmountChildren(t),jl.sceneGraphService.detach(t),t}},{key:"removeChildren",value:function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];this.removeChild(e)}}},{key:"destroyChildren",value:function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];e.childNodes.length>0&&e.destroyChildren(),e.destroy()}}},{key:"matches",value:function(t){return jl.sceneGraphService.matches(t,this)}},{key:"getElementById",value:function(t){return jl.sceneGraphService.querySelector("#".concat(t),this)}},{key:"getElementsByName",value:function(t){return jl.sceneGraphService.querySelectorAll('[name="'.concat(t,'"]'),this)}},{key:"getElementsByClassName",value:function(t){return jl.sceneGraphService.querySelectorAll(".".concat(t),this)}},{key:"getElementsByTagName",value:function(t){return jl.sceneGraphService.querySelectorAll(t,this)}},{key:"querySelector",value:function(t){return jl.sceneGraphService.querySelector(t,this)}},{key:"querySelectorAll",value:function(t){return jl.sceneGraphService.querySelectorAll(t,this)}},{key:"closest",value:function(t){var e=this;do{if(jl.sceneGraphService.matches(t,e))return e;e=e.parentElement}while(null!==e);return null}},{key:"find",value:function(t){var e=this,n=null;return this.forEach(function(r){return r===e||!t(r)||(n=r,!1)}),n}},{key:"findAll",value:function(t){var e=this,n=[];return this.forEach(function(r){r!==e&&t(r)&&n.push(r)}),n}},{key:"after",value:function(){var t=this;if(this.parentNode){for(var e=this.parentNode.childNodes.indexOf(this),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];r.forEach(function(n,r){var i;return null===(i=t.parentNode)||void 0===i?void 0:i.appendChild(n,e+r+1)})}}},{key:"before",value:function(){if(this.parentNode){for(var t,e=this.parentNode.childNodes.indexOf(this),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=r[0],a=r.slice(1);this.parentNode.appendChild(o,e),(t=o).after.apply(t,d(a))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.forEach(function(e){return t.appendChild(e)})}},{key:"prepend",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.forEach(function(e,n){return t.appendChild(e,n)})}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){return this.parentNode?this.parentNode.removeChild(this):this}},{key:"destroy",value:function(){var t,e=!0===(null===(t=this.ownerDocument)||void 0===t||null===(t=t.defaultView)||void 0===t||null===(t=t.getConfig().future)||void 0===t?void 0:t.experimentalCancelEventPropagation);this.destroyChildren(),this.dispatchEvent(Wl,e,e),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){return jl.sceneGraphService.getGeometryBounds(this)}},{key:"getRenderBounds",value:function(){return jl.sceneGraphService.getBounds(this,!0)}},{key:"getBounds",value:function(){return jl.sceneGraphService.getBounds(this)}},{key:"getLocalBounds",value:function(){return jl.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return jl.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(t){if("symbol"!=typeof t){var e=this.attributes[t];return e}}},{key:"hasAttribute",value:function(t){return this.getAttributeNames().includes(t)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(t){this.setAttribute(t,null),delete this.attributes[t]}},{key:"setAttribute",value:function(t,e,n,r){this.attributes[t]=e}},{key:"getAttributeNS",value:function(t,e){throw new Error(Ar)}},{key:"getAttributeNode",value:function(t){throw new Error(Ar)}},{key:"getAttributeNodeNS",value:function(t,e){throw new Error(Ar)}},{key:"hasAttributeNS",value:function(t,e){throw new Error(Ar)}},{key:"removeAttributeNS",value:function(t,e){throw new Error(Ar)}},{key:"removeAttributeNode",value:function(t){throw new Error(Ar)}},{key:"setAttributeNS",value:function(t,e,n){throw new Error(Ar)}},{key:"setAttributeNode",value:function(t){throw new Error(Ar)}},{key:"setAttributeNodeNS",value:function(t){throw new Error(Ar)}},{key:"toggleAttribute",value:function(t,e){throw new Error(Ar)}}])}(Js);function Ul(t){return!(null==t||!t.nodeName)}var $l=jl.globalThis.Proxy?jl.globalThis.Proxy:function(){},Yl=new sl(al.ATTR_MODIFIED,null,null,null,null,sl.MODIFICATION,null,null),ql=ht(),Xl=Rt(),Kl=function(t){function e(t){var n;return s(this,e),(n=v(this,e)).isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=t,n.id=t.id||"",n.name=t.name||"",(t.className||t.class)&&(n.className=t.className||t.class),n.nodeName=t.type||pr.GROUP,t.initialParsedStyle&&Object.assign(n.parsedStyle,t.initialParsedStyle),n.initAttributes(t.style),jl.enableStyleSyntax&&(n.style=new $l({setProperty:function(t,e){n.setAttribute(t,e)},getPropertyValue:function(t){return n.getAttribute(t)},removeProperty:function(t){n.removeAttribute(t)},item:function(){return""}},{get:function(t,e){return void 0!==t[e]?t[e]:n.getAttribute(e)},set:function(t,e,r){return n.setAttribute(e,r),!0}})),n}return y(e,t),c(e,[{key:"destroy",value:function(){Ln(e,"destroy",this)([]),this.getAnimations().forEach(function(t){t.cancel()})}},{key:"cloneNode",value:function(t,e){var n=a({},this.attributes);for(var r in n){var i=n[r];Ul(i)&&"clipPath"!==r&&"offsetPath"!==r&&"textPath"!==r&&(n[r]=i.cloneNode(t)),e&&(n[r]=e(r,i))}var o=new this.constructor(a(a({},this.config),{},{style:n}));return o.setLocalTransform(this.getLocalTransform()),t&&this.children.forEach(function(e){if(!e.style.isMarker){var n=e.cloneNode(t);o.appendChild(n)}}),o}},{key:"initAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};jl.styleValueRegistry.processProperties(this,t,{forceUpdateGeometry:!0}),this.dirty()}},{key:"setAttribute",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];ve(n)||(r||n!==this.attributes[t])&&(this.internalSetAttribute(t,n,{memoize:i}),Ln(e,"setAttribute",this)([t,n]))}},{key:"internalSetAttribute",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.attributes[t],o=this.parsedStyle[t];jl.styleValueRegistry.processProperties(this,i({},t,e),n),this.dirty();var a,s=this.parsedStyle[t];if(this.isConnected)if(Yl.relatedNode=this,Yl.prevValue=r,Yl.newValue=e,Yl.attrName=t,Yl.prevParsedValue=o,Yl.newParsedValue=s,this.isMutationObserved)this.dispatchEvent(Yl);else{var l,c=!0===(null===(l=this.ownerDocument.defaultView.getConfig().future)||void 0===l?void 0:l.experimentalCancelEventPropagation);Yl.target=this,this.ownerDocument.defaultView.dispatchEvent(Yl,!0,c)}(this.isCustomElement&&this.isConnected||!this.isCustomElement)&&(null===(a=this.attributeChangedCallback)||void 0===a||a.call(this,t,r,e,o,s))}},{key:"getBBox",value:function(){var t=this.getBounds(),e=b(t.getMin(),2),n=e[0],r=e[1],i=b(t.getMax(),2),o=i[0],a=i[1];return new Cr(n,r,o-n,a-r)}},{key:"setOrigin",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return jl.sceneGraphService.setOrigin(this,Lr(t,e,n,!1)),this}},{key:"getOrigin",value:function(){return jl.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return jl.sceneGraphService.setPosition(this,Lr(t,e,n,!1)),this}},{key:"setLocalPosition",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return jl.sceneGraphService.setLocalPosition(this,Lr(t,e,n,!1)),this}},{key:"translate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return jl.sceneGraphService.translate(this,Lr(t,e,n,!1)),this}},{key:"translateLocal",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return jl.sceneGraphService.translateLocal(this,Lr(t,e,n,!1)),this}},{key:"getPosition",value:function(){return jl.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return jl.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(t,e,n){return this.scaleLocal(t,e,n)}},{key:"scaleLocal",value:function(t,e,n){return"number"==typeof t&&(t=Lr(t,e=e||t,n=n||t,!1)),jl.sceneGraphService.scaleLocal(this,t),this}},{key:"setLocalScale",value:function(t,e,n){return"number"==typeof t&&(t=Lr(t,e=e||t,n=n||t,!1)),jl.sceneGraphService.setLocalScale(this,t),this}},{key:"getLocalScale",value:function(){return jl.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return jl.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){return Br(b(zr(ql,jl.sceneGraphService.getWorldTransform(this)),3)[2])}},{key:"getLocalEulerAngles",value:function(){return Br(b(zr(ql,jl.sceneGraphService.getLocalRotation(this)),3)[2])}},{key:"setEulerAngles",value:function(t){return jl.sceneGraphService.setEulerAngles(this,0,0,t),this}},{key:"setLocalEulerAngles",value:function(t){return jl.sceneGraphService.setLocalEulerAngles(this,0,0,t),this}},{key:"rotateLocal",value:function(t,e,n){return $t(e)&&$t(n)?jl.sceneGraphService.rotateLocal(this,0,0,t):jl.sceneGraphService.rotateLocal(this,t,e,n),this}},{key:"rotate",value:function(t,e,n){return $t(e)&&$t(n)?jl.sceneGraphService.rotate(this,0,0,t):jl.sceneGraphService.rotate(this,t,e,n),this}},{key:"setRotation",value:function(t,e,n,r){return jl.sceneGraphService.setRotation(this,t,e,n,r),this}},{key:"setLocalRotation",value:function(t,e,n,r){return jl.sceneGraphService.setLocalRotation(this,t,e,n,r),this}},{key:"setLocalSkew",value:function(t,e){return jl.sceneGraphService.setLocalSkew(this,t,e),this}},{key:"getRotation",value:function(){return jl.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return jl.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return jl.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return jl.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return jl.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(t){return jl.sceneGraphService.setLocalTransform(this,t),this}},{key:"resetLocalTransform",value:function(){jl.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(t,e){var n,r=null===(n=this.ownerDocument)||void 0===n?void 0:n.timeline;return r?r.play(this,t,e):null}},{key:"isVisible",value:function(){var t;return"hidden"!==(null===(t=this.parsedStyle)||void 0===t?void 0:t.visibility)}},{key:"interactive",get:function(){return this.isInteractive()},set:function(t){this.style.pointerEvents=t?"auto":"none"}},{key:"isInteractive",value:function(){var t;return"none"!==(null===(t=this.parsedStyle)||void 0===t?void 0:t.pointerEvents)}},{key:"isCulled",value:function(){return!(!this.cullable||!this.cullable.enable||this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,d(this.parentNode.children.map(function(t){return Number(t.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,d(this.parentNode.children.map(function(t){return Number(t.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0],o=n[1];return i?qt(i)?(Object.keys(i).forEach(function(e){t.setAttribute(e,i[e])}),this):2===n.length?(this.setAttribute(i,o),this):this.attributes[i]:this.attributes}},{key:"getMatrix",value:function(t){var e=t||this.getWorldTransform(),n=b(X(ql,e),2),r=n[0],i=n[1],o=b(K(ql,e),2),a=o[0],s=o[1],l=Z(Xl,e),c=b(zr(ql,l),3),u=c[0],h=c[2];return Gr(u||h,r,i,a,s)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(t){var e=b(Vr(t),5),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4];this.setEulerAngles(a).setPosition(n,r).setLocalScale(i,o)}},{key:"setLocalMatrix",value:function(t){var e=b(Vr(t),5),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4];this.setLocalEulerAngles(a).setLocalPosition(n,r).setLocalScale(i,o)}},{key:"show",value:function(){this.forEach(function(t){t.style.visibility="visible"})}},{key:"hide",value:function(){this.forEach(function(t){t.style.visibility="hidden"})}},{key:"getCount",value:function(){return this.childElementCount}},{key:"getParent",value:function(){return this.parentElement}},{key:"getChildren",value:function(){return this.children}},{key:"getFirst",value:function(){return this.firstElementChild}},{key:"getLast",value:function(){return this.lastElementChild}},{key:"getChildByIndex",value:function(t){return this.children[t]||null}},{key:"add",value:function(t,e){return this.appendChild(t,e)}},{key:"set",value:function(t,e){this.config[t]=e}},{key:"get",value:function(t){return this.config[t]}},{key:"moveTo",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.setPosition(t,e,n),this}},{key:"move",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.setPosition(t,e,n),this}},{key:"setZIndex",value:function(t){return this.style.zIndex=t,this}}])}(Hl);Kl.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var Zl=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),v(this,e,[a({type:pr.CIRCLE},t)])}return y(e,t),c(e)}(Kl);Zl.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var Ql=["style"],Jl=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=hr(n,Ql);return s(this,e),(t=v(this,e,[a({style:r},i)])).isCustomElement=!0,t}return y(e,t),c(e)}(Kl);Jl.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var tc=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),v(this,e,[a({type:pr.ELLIPSE},t)])}return y(e,t),c(e)}(Kl);tc.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"])),(function(t){function e(){return s(this,e),v(this,e,[{type:pr.FRAGMENT}])}return y(e,t),c(e)}(Kl)).PARSED_STYLE_LIST=new Set(["class","className"]);var ec=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),v(this,e,[a({type:pr.GROUP},t)])}return y(e,t),c(e)}(Kl);ec.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var nc=["style"],rc=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=hr(n,nc);return s(this,e),(t=v(this,e,[a({type:pr.HTML,style:r},i)])).cullable.enable=!1,t}return y(e,t),c(e,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var t=_(O(),this.parentNode.getWorldTransform()),e=this.getBounds();if(!Mr.isEmpty(e)){var n=new Mr;return n.setFromTransformedAABB(e,t),n}}return this.getBounds()}}])}(Kl);rc.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var ic=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),v(this,e,[a({type:pr.IMAGE},t)])}return y(e,t),c(e)}(Kl);ic.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var oc=["style"],ac=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=hr(n,oc);s(this,e),(t=v(this,e,[a({type:pr.LINE,style:a({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},r)},i)])).markerStartAngle=0,t.markerEndAngle=0;var o=t.parsedStyle,l=o.markerStart,c=o.markerEnd;return l&&Ul(l)&&(t.markerStartAngle=l.getLocalEulerAngles(),t.appendChild(l)),c&&Ul(c)&&(t.markerEndAngle=c.getLocalEulerAngles(),t.appendChild(c)),t.transformMarker(!0),t.transformMarker(!1),t}return y(e,t),c(e,[{key:"attributeChangedCallback",value:function(t,e,n,r,i){"x1"===t||"y1"===t||"x2"===t||"y2"===t||"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Ul(r)&&(this.markerStartAngle=0,r.remove()),i&&Ul(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t&&(r&&Ul(r)&&(this.markerEndAngle=0,r.remove()),i&&Ul(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1)))}},{key:"transformMarker",value:function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=e.x1,s=e.x2,l=e.y1,c=e.y2,u=t?n:r;if(u&&Ul(u)){var h,d,f,p,g,v,m;t?(p=a,g=l,d=s-a,f=c-l,v=i||0,m=this.markerStartAngle):(p=s,g=c,d=a-s,f=l-c,v=o||0,m=this.markerEndAngle),h=Math.atan2(f,d),u.setLocalEulerAngles(180*h/Math.PI+m),u.setLocalPosition(p+Math.cos(h)*v,g+Math.sin(h)*v)}}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.parsedStyle,r=Vn(n.x1,n.y1,n.x2,n.y2,t),i=r.x,o=r.y,a=Mt(ht(),pt(i,o,0),e?this.getWorldTransform():this.getLocalTransform());return new Or(a[0],a[1])}},{key:"getPointAtLength",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.getPoint(t/this.getTotalLength(),e)}},{key:"getTotalLength",value:function(){var t=this.parsedStyle;return Gn(t.x1,t.y1,t.x2,t.y2)}}])}(Kl);ac.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var sc=["style"],lc=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=hr(n,sc);s(this,e),(t=v(this,e,[a({type:pr.PATH,style:r,initialParsedStyle:{miterLimit:4,d:a({},si)}},i)])).markerStartAngle=0,t.markerEndAngle=0,t.markerMidList=[];var o=t.parsedStyle,l=o.markerStart,c=o.markerEnd,u=o.markerMid;return l&&Ul(l)&&(t.markerStartAngle=l.getLocalEulerAngles(),t.appendChild(l)),u&&Ul(u)&&t.placeMarkerMid(u),c&&Ul(c)&&(t.markerEndAngle=c.getLocalEulerAngles(),t.appendChild(c)),t.transformMarker(!0),t.transformMarker(!1),t}return y(e,t),c(e,[{key:"attributeChangedCallback",value:function(t,e,n,r,i){"d"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Ul(r)&&(this.markerStartAngle=0,r.remove()),i&&Ul(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Ul(r)&&(this.markerEndAngle=0,r.remove()),i&&Ul(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)}},{key:"transformMarker",value:function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=t?n:r;if(a&&Ul(a)){var s,l,c,u,h,d,f;if(t){var p=b(this.getStartTangent(),2),g=p[0],v=p[1];u=v[0],h=v[1],l=g[0]-v[0],c=g[1]-v[1],d=i||0,f=this.markerStartAngle}else{var m=b(this.getEndTangent(),2),y=m[0],x=m[1];u=x[0],h=x[1],l=y[0]-x[0],c=y[1]-x[1],d=o||0,f=this.markerEndAngle}s=Math.atan2(c,l),a.setLocalEulerAngles(180*s/Math.PI+f),a.setLocalPosition(u+Math.cos(s)*d,h+Math.sin(s)*d)}}},{key:"placeMarkerMid",value:function(t){var e=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(t){t.remove()}),t&&Ul(t))for(var n=1;n<e.length-1;n++){var r=b(e[n].currentPoint,2),i=r[0],o=r[1],a=1===n?t:t.cloneNode(!0);this.markerMidList.push(a),this.appendChild(a),a.setLocalPosition(i,o)}}},{key:"getTotalLength",value:function(){return Yo(this)}},{key:"getPointAtLength",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(t,e,n){return Tn(t,e,Fe(Fe({},n),{bbox:!1,length:!0})).point}(this.parsedStyle.d.absolutePath,t),r=n.x,i=n.y,o=Mt(ht(),pt(r,i,0),e?this.getWorldTransform():this.getLocalTransform());return new Or(o[0],o[1])}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.getPointAtLength(t*Yo(this),e)}},{key:"getStartTangent",value:function(){var t=this.parsedStyle.d.segments,e=[];if(t.length>1){var n=t[0].currentPoint,r=t[1].currentPoint,i=t[1].startTangent;e=[],i?(e.push([n[0]-i[0],n[1]-i[1]]),e.push([n[0],n[1]])):(e.push([r[0],r[1]]),e.push([n[0],n[1]]))}return e}},{key:"getEndTangent",value:function(){var t=this.parsedStyle.d.segments,e=t.length,n=[];if(e>1){var r=t[e-2].currentPoint,i=t[e-1].currentPoint,o=t[e-1].endTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([r[0],r[1]]),n.push([i[0],i[1]]))}return n}}])}(Kl);lc.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var cc=["style"],uc=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=hr(n,cc);s(this,e),(t=v(this,e,[a({type:pr.POLYGON,style:r,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},i)])).markerStartAngle=0,t.markerEndAngle=0,t.markerMidList=[];var o=t.parsedStyle,l=o.markerStart,c=o.markerEnd,u=o.markerMid;return l&&Ul(l)&&(t.markerStartAngle=l.getLocalEulerAngles(),t.appendChild(l)),u&&Ul(u)&&t.placeMarkerMid(u),c&&Ul(c)&&(t.markerEndAngle=c.getLocalEulerAngles(),t.appendChild(c)),t.transformMarker(!0),t.transformMarker(!1),t}return y(e,t),c(e,[{key:"attributeChangedCallback",value:function(t,e,n,r,i){"points"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Ul(r)&&(this.markerStartAngle=0,r.remove()),i&&Ul(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Ul(r)&&(this.markerEndAngle=0,r.remove()),i&&Ul(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)}},{key:"transformMarker",value:function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=(e.points||{}).points,s=t?n:r;if(s&&Ul(s)&&a){var l,c,u,h,d,f,p;if(h=a[0][0],d=a[0][1],t)c=a[1][0]-a[0][0],u=a[1][1]-a[0][1],f=i||0,p=this.markerStartAngle;else{var g=a.length;this.parsedStyle.isClosed?(c=a[g-1][0]-a[0][0],u=a[g-1][1]-a[0][1]):(h=a[g-1][0],d=a[g-1][1],c=a[g-2][0]-a[g-1][0],u=a[g-2][1]-a[g-1][1]),f=o||0,p=this.markerEndAngle}l=Math.atan2(u,c),s.setLocalEulerAngles(180*l/Math.PI+p),s.setLocalPosition(h+Math.cos(l)*f,d+Math.sin(l)*f)}}},{key:"placeMarkerMid",value:function(t){var e=(this.parsedStyle.points||{}).points;if(this.markerMidList.forEach(function(t){t.remove()}),this.markerMidList=[],t&&Ul(t)&&e)for(var n=1;n<(this.parsedStyle.isClosed?e.length:e.length-1);n++){var r=e[n][0],i=e[n][1],o=1===n?t:t.cloneNode(!0);this.markerMidList.push(o),this.appendChild(o),o.setLocalPosition(r,i)}}}])}(Kl);uc.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var hc=["style"],dc=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.style,r=hr(t,hc);return s(this,e),v(this,e,[a({type:pr.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},r)])}return y(e,t),c(e,[{key:"getTotalLength",value:function(){return 0===(t=this).parsedStyle.points.totalLength&&(t.parsedStyle.points.totalLength=qn(t.parsedStyle.points.points)),t.parsedStyle.points.totalLength;var t}},{key:"getPointAtLength",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.getPoint(t/this.getTotalLength(),e)}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.parsedStyle.points.points;if(0===this.parsedStyle.points.segments.length){var r,i,o=[],a=0,s=this.getTotalLength();n.forEach(function(t,e){n[e+1]&&((r=[0,0])[0]=a/s,i=Gn(t[0],t[1],n[e+1][0],n[e+1][1]),a+=i,r[1]=a/s,o.push(r))}),this.parsedStyle.points.segments=o}var l=0,c=0;this.parsedStyle.points.segments.forEach(function(e,n){t>=e[0]&&t<=e[1]&&(l=(t-e[0])/(e[1]-e[0]),c=n)});var u=Vn(n[c][0],n[c][1],n[c+1][0],n[c+1][1],l),h=u.x,d=u.y,f=Mt(ht(),pt(h,d,0),e?this.getWorldTransform():this.getLocalTransform());return new Or(f[0],f[1])}},{key:"getStartTangent",value:function(){var t=this.parsedStyle.points.points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e}},{key:"getEndTangent",value:function(){var t=this.parsedStyle.points.points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n}}])}(uc);dc.PARSED_STYLE_LIST=new Set([].concat(d(uc.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var fc=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),v(this,e,[a({type:pr.RECT},t)])}return y(e,t),c(e)}(Kl);fc.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var pc=["style"],gc=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.style,r=hr(t,pc);return s(this,e),v(this,e,[a({type:pr.TEXT,style:a({fill:"black"},n)},r)])}return y(e,t),c(e,[{key:"getComputedTextLength",value:function(){var t;return this.getGeometryBounds(),(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var t;return this.getGeometryBounds(),(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(Kl);gc.PARSED_STYLE_LIST=new Set([].concat(d(Kl.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textPathSide","textPathStartOffset","metrics","dx","dy"]));var vc=function(){return c(function t(){s(this,t),this.registry={},this.define(pr.CIRCLE,Zl),this.define(pr.ELLIPSE,tc),this.define(pr.RECT,fc),this.define(pr.IMAGE,ic),this.define(pr.LINE,ac),this.define(pr.GROUP,ec),this.define(pr.PATH,lc),this.define(pr.POLYGON,uc),this.define(pr.POLYLINE,dc),this.define(pr.TEXT,gc),this.define(pr.HTML,rc)},[{key:"define",value:function(t,e){this.registry[t]=e}},{key:"get",value:function(t){return this.registry[t]}}])}(),mc=function(t){function e(){var t;s(this,e),(t=v(this,e)).defaultView=null,t.ownerDocument=null,t.nodeName="document";try{t.timeline=new jl.AnimationTimeline(t)}catch(t){}var n={};return Ca.forEach(function(t){var e=t.n,r=t.inh,i=t.d;r&&i&&(n[e]=Ut(i)?i(pr.GROUP):i)}),t.documentElement=new ec({id:"g-root",style:n}),t.documentElement.ownerDocument=t,t.documentElement.parentNode=t,t.childNodes=[t.documentElement],t}return y(e,t),c(e,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(t,e){if("svg"===t)return this.documentElement;var n=this.defaultView.customElements.get(t);n||(console.warn("Unsupported tagName: ",t),n="tspan"===t?gc:ec);var r=new n(e);return r.ownerDocument=this,r}},{key:"createElementNS",value:function(t,e,n){return this.createElement(e,n)}},{key:"cloneNode",value:function(t){throw new Error(Ar)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(t){}}},{key:"elementsFromBBox",value:function(t,e,n,r){var i=this.defaultView.context.rBushRoot.search({minX:t,minY:e,maxX:n,maxY:r}),o=[];return i.forEach(function(t){var e=t.displayObject,n=e.parsedStyle.pointerEvents,r=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(void 0===n?"auto":n);(!r||r&&e.isVisible())&&!e.isCulled()&&e.isInteractive()&&o.push(e)}),o.sort(function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder}),o}},{key:"elementFromPointSync",value:function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,s=o.height;if(r<0||i<0||r>a||i>s)return null;var l=this.defaultView.viewport2Client({x:r,y:i}),c=l.x,u=l.y,h=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:c,clientY:u},picked:[]}).picked;return h&&h[0]||this.documentElement}},{key:"elementFromPoint",value:(r=cr(sr().mark(function t(e,n){var r,i,o,a,s,l,c,u,h,d,f;return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.defaultView.canvas2Viewport({x:e,y:n}),i=r.x,o=r.y,a=this.defaultView.getConfig(),s=a.width,l=a.height,!(i<0||o<0||i>s||o>l)){t.next=1;break}return t.abrupt("return",null);case 1:return c=this.defaultView.viewport2Client({x:i,y:o}),u=c.x,h=c.y,t.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:e,y:n,viewportX:i,viewportY:o,clientX:u,clientY:h},picked:[]});case 2:return d=t.sent,f=d.picked,t.abrupt("return",f&&f[0]||this.documentElement);case 3:case"end":return t.stop()}},t,this)})),function(t,e){return r.apply(this,arguments)})},{key:"elementsFromPointSync",value:function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,s=o.height;if(r<0||i<0||r>a||i>s)return[];var l=this.defaultView.viewport2Client({x:r,y:i}),c=l.x,u=l.y,h=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:c,clientY:u},picked:[]}).picked;return h[h.length-1]!==this.documentElement&&h.push(this.documentElement),h}},{key:"elementsFromPoint",value:(n=cr(sr().mark(function t(e,n){var r,i,o,a,s,l,c,u,h,d,f;return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.defaultView.canvas2Viewport({x:e,y:n}),i=r.x,o=r.y,a=this.defaultView.getConfig(),s=a.width,l=a.height,!(i<0||o<0||i>s||o>l)){t.next=1;break}return t.abrupt("return",[]);case 1:return c=this.defaultView.viewport2Client({x:i,y:o}),u=c.x,h=c.y,t.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:e,y:n,viewportX:i,viewportY:o,clientX:u,clientY:h},picked:[]});case 2:return d=t.sent,(f=d.picked)[f.length-1]!==this.documentElement&&f.push(this.documentElement),t.abrupt("return",f);case 3:case"end":return t.stop()}},t,this)})),function(t,e){return n.apply(this,arguments)})},{key:"appendChild",value:function(t,e){throw new Error(Pr)}},{key:"insertBefore",value:function(t,e){throw new Error(Pr)}},{key:"removeChild",value:function(t,e){throw new Error(Pr)}},{key:"replaceChild",value:function(t,e,n){throw new Error(Pr)}},{key:"append",value:function(){throw new Error(Pr)}},{key:"prepend",value:function(){throw new Error(Pr)}},{key:"getElementById",value:function(t){return this.documentElement.getElementById(t)}},{key:"getElementsByName",value:function(t){return this.documentElement.getElementsByName(t)}},{key:"getElementsByTagName",value:function(t){return this.documentElement.getElementsByTagName(t)}},{key:"getElementsByClassName",value:function(t){return this.documentElement.getElementsByClassName(t)}},{key:"querySelector",value:function(t){return this.documentElement.querySelector(t)}},{key:"querySelectorAll",value:function(t){return this.documentElement.querySelectorAll(t)}},{key:"find",value:function(t){return this.documentElement.find(t)}},{key:"findAll",value:function(t){return this.documentElement.findAll(t)}}]);var n,r}(Js),yc=function(){function t(e){s(this,t),this.strategies=e}return c(t,[{key:"apply",value:function(e){var n=e.config,r=e.camera,i=e.renderingService,o=e.renderingContext,a=this.strategies;i.hooks.cull.tap(t.tag,function(t){if(t){var e,i=t.cullable;if(0===a.length?i.visible=o.unculledEntities.indexOf(t.entity)>-1:i.visible=a.every(function(e){return e.isVisible(r,t)}),!t.isCulled()&&t.isVisible())return t;var s=!0===(null===(e=n.future)||void 0===e?void 0:e.experimentalCancelEventPropagation);return t.dispatchEvent(new Zs(al.CULLED),s,s),null}return t}),i.hooks.afterRender.tap(t.tag,function(t){t.cullable.visibilityPlaneMask=-1})}}])}();yc.tag="Culling";var bc=function(){function t(){var e=this;s(this,t),this.autoPreventDefault=!1,this.rootPointerEvent=new Xs(null),this.rootWheelEvent=new Ks(null),this.onPointerMove=function(t){var n,r=null===(n=e.context.renderingContext.root)||void 0===n||null===(n=n.ownerDocument)||void 0===n?void 0:n.defaultView;if(!r.supportsTouchEvents||"touch"!==t.pointerType){var i,o=ur(e.normalizeToPointerEvent(t,r));try{for(o.s();!(i=o.n()).done;){var a=i.value,s=e.bootstrapEvent(e.rootPointerEvent,a,r,t);e.context.eventService.mapEvent(s)}}catch(t){o.e(t)}finally{o.f()}e.setCursor(e.context.eventService.cursor)}},this.onClick=function(t){var n,r,i=null===(n=e.context.renderingContext.root)||void 0===n||null===(n=n.ownerDocument)||void 0===n?void 0:n.defaultView,o=ur(e.normalizeToPointerEvent(t,i));try{for(o.s();!(r=o.n()).done;){var a=r.value,s=e.bootstrapEvent(e.rootPointerEvent,a,i,t);e.context.eventService.mapEvent(s)}}catch(t){o.e(t)}finally{o.f()}e.setCursor(e.context.eventService.cursor)}}return c(t,[{key:"apply",value:function(e){var n=this;this.context=e;var r=e.renderingService,i=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(t){return n.context.renderingService.hooks.pickSync.call({position:t,picked:[],topmost:!0}).picked[0]||null}),r.hooks.pointerWheel.tap(t.tag,function(t){var e=n.normalizeWheelEvent(t);n.context.eventService.mapEvent(e)}),r.hooks.pointerDown.tap(t.tag,function(t){if(!i.supportsTouchEvents||"touch"!==t.pointerType){var e=n.normalizeToPointerEvent(t,i);if(n.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();var r,o=ur(e);try{for(o.s();!(r=o.n()).done;){var a=r.value,s=n.bootstrapEvent(n.rootPointerEvent,a,i,t);n.context.eventService.mapEvent(s)}}catch(t){o.e(t)}finally{o.f()}n.setCursor(n.context.eventService.cursor)}}),r.hooks.pointerUp.tap(t.tag,function(t){if(!i.supportsTouchEvents||"touch"!==t.pointerType){var e,r=n.context.contextService.getDomElement(),o=n.context.eventService.isNativeEventFromCanvas(r,t)?"":"outside",a=ur(n.normalizeToPointerEvent(t,i));try{for(a.s();!(e=a.n()).done;){var s=e.value,l=n.bootstrapEvent(n.rootPointerEvent,s,i,t);l.type+=o,n.context.eventService.mapEvent(l)}}catch(t){a.e(t)}finally{a.f()}n.setCursor(n.context.eventService.cursor)}}),r.hooks.pointerMove.tap(t.tag,this.onPointerMove),r.hooks.pointerOver.tap(t.tag,this.onPointerMove),r.hooks.pointerOut.tap(t.tag,this.onPointerMove),r.hooks.click.tap(t.tag,this.onClick),r.hooks.pointerCancel.tap(t.tag,function(t){var e,r=ur(n.normalizeToPointerEvent(t,i));try{for(r.s();!(e=r.n()).done;){var o=e.value,a=n.bootstrapEvent(n.rootPointerEvent,o,i,t);n.context.eventService.mapEvent(a)}}catch(t){r.e(t)}finally{r.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),o=i.x,a=i.y;t.viewport.x=o,t.viewport.y=a;var s=this.context.eventService.viewport2Canvas(t.viewport),l=s.x,c=s.y;return t.canvas.x=l,t.canvas.y=c,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=rs[t.type]||t.type),t}},{key:"normalizeWheelEvent",value:function(t){var e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;var n=this.context.eventService.client2Viewport({x:t.clientX,y:t.clientY}),r=n.x,i=n.y;e.viewport.x=r,e.viewport.y=i;var o=this.context.eventService.viewport2Canvas(e.viewport),a=o.x,s=o.y;return e.canvas.x=a,e.canvas.y=s,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.nativeEvent=t,e.type=t.type,e}},{key:"transferMouseData",value:function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=is.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}},{key:"setCursor",value:function(t){this.context.contextService.applyCursorStyle(t||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(t,e){var n=[];if(e.isTouchEvent(t))for(var r=0;r<t.changedTouches.length;r++){var i=t.changedTouches[r];ve(i.button)&&(i.button=0),ve(i.buttons)&&(i.buttons=1),ve(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),ve(i.width)&&(i.width=i.radiusX||1),ve(i.height)&&(i.height=i.radiusY||1),ve(i.tiltX)&&(i.tiltX=0),ve(i.tiltY)&&(i.tiltY=0),ve(i.pointerType)&&(i.pointerType="touch"),ve(i.pointerId)&&(i.pointerId=i.identifier||0),ve(i.pressure)&&(i.pressure=i.force||.5),ve(i.twist)&&(i.twist=0),ve(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,i.type=t.type,n.push(i)}else if(e.isMouseEvent(t)){var o=t;ve(o.isPrimary)&&(o.isPrimary=!0),ve(o.width)&&(o.width=1),ve(o.height)&&(o.height=1),ve(o.tiltX)&&(o.tiltX=0),ve(o.tiltY)&&(o.tiltY=0),ve(o.pointerType)&&(o.pointerType="mouse"),ve(o.pointerId)&&(o.pointerId=1),ve(o.pressure)&&(o.pressure=.5),ve(o.twist)&&(o.twist=0),ve(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,n.push(o)}else n.push(t);return n}}])}();bc.tag="Event";var xc=[pr.CIRCLE,pr.ELLIPSE,pr.IMAGE,pr.RECT,pr.LINE,pr.POLYLINE,pr.POLYGON,pr.TEXT,pr.PATH,pr.HTML],Ec=function(){return c(function t(){s(this,t)},[{key:"isVisible",value:function(t,e){var n,r=e.cullable;if(!r.enable)return!0;var i=e.getRenderBounds();if(Mr.isEmpty(i))return!1;var o=t.getFrustum(),a=null===(n=e.parentNode)||void 0===n||null===(n=n.cullable)||void 0===n?void 0:n.visibilityPlaneMask;return r.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(e,i,a||Nr.INDETERMINATE,o.planes),r.visible=r.visibilityPlaneMask!==Nr.OUTSIDE,r.visible}},{key:"computeVisibilityWithPlaneMask",value:function(t,e,n,r){if(n===Nr.OUTSIDE||n===Nr.INSIDE)return n;for(var i=Nr.INSIDE,o=xc.indexOf(t.nodeName)>-1,a=0,s=r.length;a<s;++a){var l=1<<a;if(0!==(n&l)&&(!o||4!==a&&5!==a)){var c=r[a],u=c.normal,h=c.distance;if(Et(u,e.getPositiveFarPoint(r[a]))+h<0)return Nr.OUTSIDE;Et(u,e.getNegativeFarPoint(r[a]))+h<0&&(i|=l)}}return i}}])}(),wc=function(){function t(){s(this,t),this.syncTasks=new Map,this.isFirstTimeRendering=!0,this.syncing=!1,this.isFirstTimeRenderingFinished=!1}return c(t,[{key:"apply",value:function(e){var n,r,i=this,o=e.config,a=e.renderingService,s=e.renderingContext,l=e.rBushRoot,c=s.root.ownerDocument.defaultView;this.rBush=l;var u=function(t){a.dirtify()},h=function(t){i.syncTasks.set(t.target,t.detail.affectChildren),a.dirtify()},d=function(t){var e=t.target;jl.enableSizeAttenuation&&jl.styleValueRegistry.updateSizeAttenuation(e,c.getCamera().getZoom())},f=function(t){var e=t.target,n=e.rBushNode;null!=n&&n.aabb&&i.rBush.remove(n.aabb),i.syncTasks.delete(e),jl.sceneGraphService.dirtyToRoot(e),a.dirtify()};a.hooks.init.tap(t.tag,function(){c.addEventListener(al.MOUNTED,d),c.addEventListener(al.UNMOUNTED,f),c.addEventListener(al.ATTR_MODIFIED,u),c.addEventListener(al.BOUNDS_CHANGED,h)}),a.hooks.destroy.tap(t.tag,function(){c.removeEventListener(al.MOUNTED,d),c.removeEventListener(al.UNMOUNTED,f),c.removeEventListener(al.ATTR_MODIFIED,u),c.removeEventListener(al.BOUNDS_CHANGED,h),i.syncTasks.clear()});var p=null!==(n=jl.globalThis.requestIdleCallback)&&void 0!==n?n:vs.bind(jl.globalThis),g=!0===(null===(r=o.future)||void 0===r?void 0:r.experimentalRICSyncRTree);a.hooks.endFrame.tap(t.tag,function(){i.isFirstTimeRendering?(i.isFirstTimeRendering=!1,i.syncing=!0,p(function(){i.syncRTree(!0),i.isFirstTimeRenderingFinished=!0})):g&&jl.globalThis.requestIdleCallback&&jl.globalThis.cancelIdleCallback?(jl.globalThis.cancelIdleCallback(i.ricSyncRTreeId),i.ricSyncRTreeId=jl.globalThis.requestIdleCallback(function(){return i.syncRTree()})):i.syncRTree()})}},{key:"syncNode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.isConnected){var n=t.rBushNode;n.aabb&&this.rBush.remove(n.aabb);var r=t.getRenderBounds();if(r){var i=t.renderable;e&&(i.dirtyRenderBounds||(i.dirtyRenderBounds=new Mr),i.dirtyRenderBounds.update(r.center,r.halfExtents));var o=b(r.getMin(),2),a=o[0],s=o[1],l=b(r.getMax(),2),c=l[0],u=l[1];n.aabb||(n.aabb={}),n.aabb.displayObject=t,n.aabb.minX=a,n.aabb.minY=s,n.aabb.maxX=c,n.aabb.maxY=u}return n.aabb&&!(isNaN(n.aabb.maxX)||isNaN(n.aabb.maxX)||isNaN(n.aabb.minX)||isNaN(n.aabb.minY))?n.aabb:void 0}}},{key:"syncRTree",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e||!this.syncing&&0!==this.syncTasks.size){this.syncing=!0;var n=[],r=new Set,i=function(i){if(!r.has(i)&&i.renderable){var o=t.syncNode(i,e);o&&(n.push(o),r.add(i))}};this.syncTasks.forEach(function(t,e){t&&e.forEach(i);for(var n=e;n;)i(n),n=n.parentElement}),this.rBush.load(n),n.length=0,this.syncing=!1}}}])}();wc.tag="Prepare";var kc=function(t){return t.READY="ready",t.BEFORE_RENDER="beforerender",t.RERENDER="rerender",t.AFTER_RENDER="afterrender",t.BEFORE_DESTROY="beforedestroy",t.AFTER_DESTROY="afterdestroy",t.RESIZE="resize",t.DIRTY_RECTANGLE="dirtyrectangle",t.RENDERER_CHANGED="rendererchanged",t}({}),Mc=new Zs(al.MOUNTED),Sc=new Zs(al.UNMOUNTED),Nc=new Zs(kc.BEFORE_RENDER),Tc=new Zs(kc.RERENDER),Oc=new Zs(kc.AFTER_RENDER),Cc=function(t){function e(t){var n;s(this,e),(n=v(this,e)).Element=Kl,n.inited=!1,n.context={};var r=t.container,i=t.canvas,o=t.renderer,l=t.width,c=t.height,u=t.background,h=t.cursor,d=t.supportsMutipleCanvasesInOneContainer,f=t.cleanUpOnDestroy,p=void 0===f||f,g=t.offscreenCanvas,m=t.devicePixelRatio,y=t.requestAnimationFrame,b=t.cancelAnimationFrame,x=t.createImage,E=t.supportsTouchEvents,w=t.supportsPointerEvents,k=t.isTouchEvent,M=t.isMouseEvent,S=t.dblClickSpeed,N=l,T=c,O=m||Qa&&window.devicePixelRatio||1;return O=O>=1?Math.ceil(O):1,i&&(N=l||function(t){var e=ns(t,"width");return"auto"===e?t.offsetWidth:parseFloat(e)}(i)||i.width/O,T=c||function(t){var e=ns(t,"height");return"auto"===e?t.offsetHeight:parseFloat(e)}(i)||i.height/O),n.customElements=new vc,n.devicePixelRatio=O,n.requestAnimationFrame=null!=y?y:vs.bind(jl.globalThis),n.cancelAnimationFrame=null!=b?b:ms.bind(jl.globalThis),n.createImage=null!=x?x:function(){return new window.Image},n.supportsTouchEvents=null!=E?E:"ontouchstart"in jl.globalThis,n.supportsPointerEvents=null!=w?w:!!jl.globalThis.PointerEvent,n.isTouchEvent=null!=k?k:function(t){return n.supportsTouchEvents&&t instanceof jl.globalThis.TouchEvent},n.isMouseEvent=null!=M?M:function(t){return!jl.globalThis.MouseEvent||t instanceof jl.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(t instanceof jl.globalThis.PointerEvent))},g&&(jl.offscreenCanvas=g),n.document=new mc,n.document.defaultView=n,d||function(t,e,n){if(t){var r="string"==typeof t?document.getElementById(t):t;Za.has(r)&&Za.get(r).destroy(n),Za.set(r,e)}}(r,n,p),n.initRenderingContext(a(a({},t),{},{width:N,height:T,background:null!=u?u:"transparent",cursor:null!=h?h:"default",cleanUpOnDestroy:p,devicePixelRatio:O,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,createImage:n.createImage,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:null!=S?S:200})),n.initDefaultCamera(N,T,o.clipSpaceNearZ),n.initRenderer(o,!0),n}return y(e,t),c(e,[{key:"initRenderingContext",value:function(t){this.context.config=t,this.context.renderingContext={root:this.document.documentElement,unculledEntities:[],renderListCurrentFrame:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(t,e,n){var r=this,i=new jl.CameraContribution;i.clipSpaceNearZ=n,i.setType(Xr.EXPLORING,Kr.DEFAULT).setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0).setOrthographic(t/-2,t/2,e/2,e/-2,.1,1e3),i.canvas=this,i.eventEmitter.on(Qr,function(){r.context.renderingContext.renderReasons.add(nl.CAMERA_CHANGED),jl.enableSizeAttenuation&&r.getConfig().renderer.getConfig().enableSizeAttenuation&&r.updateSizeAttenuation()}),this.context.camera=i}},{key:"updateSizeAttenuation",value:function(){var t=this.getCamera().getZoom();this.document.documentElement.forEach(function(e){jl.styleValueRegistry.updateSizeAttenuation(e,t)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var t=this;return this.readyPromise||(this.readyPromise=new Promise(function(e){t.resolveReadyPromise=function(){e(t)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1?arguments[1]:void 0;Vi.clearCache();var r=!0===(null===(t=this.getConfig().future)||void 0===t?void 0:t.experimentalCancelEventPropagation);n||this.dispatchEvent(new Zs(kc.BEFORE_DESTROY),r,r),this.frameId&&this.cancelAnimationFrame(this.frameId);var i=this.getRoot();e&&(this.unmountChildren(i),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),this.context.rBushRoot&&this.context.rBushRoot.clear(),n||this.dispatchEvent(new Zs(kc.AFTER_DESTROY),r,r);var o=function(t){t.currentTarget=null,t.manager=null,t.target=null,t.relatedNode=null};o(Mc),o(Sc),o(Nc),o(Tc),o(Oc),o(Yl),o(Gl),o(Vl),o(Wl),jl.textService.clearCache()}},{key:"changeSize",value:function(t,e){this.resize(t,e)}},{key:"resize",value:function(t,e){var n,r=this.context.config;r.width=t,r.height=e,this.getContextService().resize(t,e);var i=this.context.camera,o=i.getProjectionMode();i.setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0),o===Zr.ORTHOGRAPHIC?i.setOrthographic(t/-2,t/2,e/2,e/-2,i.getNear(),i.getFar()):i.setAspect(t/e);var a=!0===(null===(n=r.future)||void 0===n?void 0:n.experimentalCancelEventPropagation);this.dispatchEvent(new Zs(kc.RESIZE,{width:t,height:e}),a,a)}},{key:"appendChild",value:function(t,e){return this.document.documentElement.appendChild(t,e)}},{key:"insertBefore",value:function(t,e){return this.document.documentElement.insertBefore(t,e)}},{key:"removeChild",value:function(t){return this.document.documentElement.removeChild(t)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(t){var e,n=this;t&&(Nc.detail=t,Oc.detail=t);var r=!0===(null===(e=this.getConfig().future)||void 0===e?void 0:e.experimentalCancelEventPropagation);this.dispatchEvent(Nc,r,r),this.getRenderingService().render(this.getConfig(),t,function(){n.dispatchEvent(Tc,r,r)}),this.dispatchEvent(Oc,r,r)}},{key:"run",value:function(){var t=this,e=function(n,r){t.render(r),t.frameId=t.requestAnimationFrame(e)};e()}},{key:"initRenderer",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new fr,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new bc,new wc,new yc([new Ec])),this.loadRendererContainerModule(t),this.context.contextService=new this.context.ContextService(a(a({},jl),this.context)),this.context.renderingService=new rl(jl,this.context),this.context.eventService=new tl(jl,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(t,n,!0)):this.context.contextService.initAsync().then(function(){e.initRenderingService(t,n)}).catch(function(t){console.error(t)})}},{key:"initRenderingService",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.context.renderingService.init(function(){var i;e.inited=!0;var o=!0===(null===(i=e.getConfig().future)||void 0===i?void 0:i.experimentalCancelEventPropagation);n?r?e.requestAnimationFrame(function(){e.dispatchEvent(new Zs(kc.READY),o,o)}):e.dispatchEvent(new Zs(kc.READY),o,o):e.dispatchEvent(new Zs(kc.RENDERER_CHANGED),o,o),e.readyPromise&&e.resolveReadyPromise(),n||e.getRoot().forEach(function(t){var e,n;null===(e=(n=t).dirty)||void 0===e||e.call(n,!0,!0)}),e.mountChildren(e.getRoot()),t.getConfig().enableAutoRendering&&e.run()})}},{key:"loadRendererContainerModule",value:function(t){var e=this;t.getPlugins().forEach(function(t){t.context=e.context,t.init(jl)})}},{key:"setRenderer",value:function(t){var e=this.getConfig();if(e.renderer!==t){var n=e.renderer;e.renderer=t,this.destroy(!1,!0),d((null==n?void 0:n.getPlugins())||[]).reverse().forEach(function(t){t.destroy(jl)}),this.initRenderer(t)}}},{key:"setCursor",value:function(t){this.getConfig().cursor=t,this.getContextService().applyCursorStyle(t)}},{key:"unmountChildren",value:function(t){var e=this;if(t.childNodes.forEach(function(t){e.unmountChildren(t)}),this.inited){if(t.isMutationObserved)t.dispatchEvent(Sc);else{var n,r=!0===(null===(n=this.getConfig().future)||void 0===n?void 0:n.experimentalCancelEventPropagation);Sc.target=t,this.dispatchEvent(Sc,!0,r)}t!==this.document.documentElement&&(t.ownerDocument=null),t.isConnected=!1}t.isCustomElement&&t.disconnectedCallback&&t.disconnectedCallback()}},{key:"mountChildren",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:os(t);if(this.inited){if(!t.isConnected&&(t.ownerDocument=this.document,t.isConnected=!0,!n))if(t.isMutationObserved)t.dispatchEvent(Mc);else{var r,i=!0===(null===(r=this.getConfig().future)||void 0===r?void 0:r.experimentalCancelEventPropagation);Mc.target=t,this.dispatchEvent(Mc,!0,i)}}else console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",t.nodeName);t.childNodes.forEach(function(t){e.mountChildren(t,n)}),t.isCustomElement&&t.connectedCallback&&t.connectedCallback()}},{key:"mountFragment",value:function(t){this.mountChildren(t,!1)}},{key:"client2Viewport",value:function(t){return this.getEventService().client2Viewport(t)}},{key:"viewport2Client",value:function(t){return this.getEventService().viewport2Client(t)}},{key:"viewport2Canvas",value:function(t){return this.getEventService().viewport2Canvas(t)}},{key:"canvas2Viewport",value:function(t){return this.getEventService().canvas2Viewport(t)}},{key:"getPointByClient",value:function(t,e){return this.client2Viewport({x:t,y:e})}},{key:"getClientByPoint",value:function(t,e){return this.viewport2Client({x:t,y:e})}}])}(Qs),Ac=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).landmarks=[],t}return y(e,t),c(e,[{key:"rotate",value:function(t,e,n){if(this.relElevation=Rr(e),this.relAzimuth=Rr(t),this.relRoll=Rr(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===Xr.EXPLORING){var r=Dt(Rt(),[1,0,0],Ir((this.rotateWorld?1:-1)*this.relElevation)),i=Dt(Rt(),[0,1,0],Ir((this.rotateWorld?1:-1)*this.relAzimuth)),o=Dt(Rt(),[0,0,1],Ir(this.relRoll)),a=Lt(Rt(),i,r);a=Lt(Rt(),a,o);var s=J(O(),a);B(this.matrix,this.matrix,[0,0,-this.distance]),j(this.matrix,this.matrix,s),B(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===Xr.ORBITING||this.type===Xr.EXPLORING?this._getPosition():this.type===Xr.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,e){var n=Lr(t,e,0),r=dt(this.position);return mt(r,r,bt(ht(),this.right,n[0])),mt(r,r,bt(ht(),this.up,n[1])),this._setPosition(r),this.triggerUpdate(),this}},{key:"dolly",value:function(t){var e=this.forward,n=dt(this.position),r=this.dollyingStep,i=this.distance+t*this.dollyingStep;return r=Math.max(Math.min(i,this.maxDistance),this.minDistance)-this.distance,n[0]+=r*e[0],n[1]+=r*e[1],n[2]+=r*e[2],this._setPosition(n),this.type===Xr.ORBITING||this.type===Xr.EXPLORING?this._getDistance():this.type===Xr.TRACKING&&mt(this.focalPoint,n,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){void 0!==this.landmarkAnimationID&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(t){var e,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.position,s=void 0===a?this.position:a,l=o.focalPoint,c=void 0===l?this.focalPoint:l,u=o.roll,h=o.zoom,d=new jl.CameraContribution;d.setType(this.type,void 0),d.setPosition(s[0],null!==(e=s[1])&&void 0!==e?e:this.position[1],null!==(n=s[2])&&void 0!==n?n:this.position[2]),d.setFocalPoint(c[0],null!==(r=c[1])&&void 0!==r?r:this.focalPoint[1],null!==(i=c[2])&&void 0!==i?i:this.focalPoint[2]),d.setRoll(null!=u?u:this.roll),d.setZoom(null!=h?h:this.zoom);var f={name:t,matrix:C(d.getWorldTransform()),right:dt(d.right),up:dt(d.up),forward:dt(d.forward),position:dt(d.getPosition()),focalPoint:dt(d.getFocalPoint()),distanceVector:dt(d.getDistanceVector()),distance:d.getDistance(),dollyingStep:d.getDollyingStep(),azimuth:d.getAzimuth(),elevation:d.getElevation(),roll:d.getRoll(),relAzimuth:d.relAzimuth,relElevation:d.relElevation,relRoll:d.relRoll,zoom:d.getZoom()};return this.landmarks.push(f),f}},{key:"gotoLandmark",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ne(t)?this.landmarks.find(function(e){return e.name===t}):t;if(r){var i=ae(n)?{duration:n}:n,o=i.easing,a=void 0===o?"linear":o,s=i.duration,l=void 0===s?100:s,c=i.easingFunction,u=void 0===c?void 0:c,h=i.onfinish,d=void 0===h?void 0:h,f=i.onframe,p=void 0===f?void 0:f;this.cancelLandmarkAnimation();var g,v=r.position,m=r.focalPoint,y=r.zoom,b=r.roll,x=u||jl.EasingFunction(a),E=function(){e.setFocalPoint(m),e.setPosition(v),e.setRoll(b),e.setZoom(y),e.computeMatrix(),e.triggerUpdate(),null==d||d()};if(0===l)return E();var w=function(t){void 0===g&&(g=t);var n=t-g;if(n>=l)E();else{var r,i,o=x(n/l),a=ht(),s=ht();if(kt(a,e.focalPoint,m,o),kt(s,e.position,v,o),i=e.roll*(1-o)+b*o,r=e.zoom*(1-o)+y*o,e.setFocalPoint(a),e.setPosition(s),e.setRoll(i),e.setZoom(r),Tt(a,m)+Tt(s,v)<=.01&&void 0===y&&void 0===b)return E();e.computeMatrix(),e.triggerUpdate(),n<l&&(null==p||p(o),e.landmarkAnimationID=e.canvas.requestAnimationFrame(w))}};this.canvas.requestAnimationFrame(w)}}}])}(ti);jl.CameraContribution=Ac;
/*!
* @antv/g-web-animations-api
* @description A simple implementation of Web Animations API.
* @version 2.1.28
* @date 7/30/2025, 1:36:24 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/
var Pc=function(t){function e(t,n,r,i){var o;return s(this,e),(o=v(this,e,[t])).currentTime=r,o.timelineTime=i,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=r,o.timelineTime=i,o}return y(e,t),c(e)}(Ys),Rc=0,Dc=function(){return c(function t(e,n){var r;s(this,t),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=e,e.animation=this,this.timeline=n,this.id="".concat(Rc++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null===(r=this.effect)||void 0===r?void 0:r.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()},[{key:"pending",get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var t=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(e,n){t.resolveReadyPromise=function(){e(t)},t.rejectReadyPromise=function(){n(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var t=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(e,n){t.resolveFinishedPromise=function(){e(t)},t.rejectFinishedPromise=function(){n(new Error)}}),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){if(t=Number(t),!isNaN(t)){var e;if(this.timeline.restart(),!this._paused&&null!==this._startTime)this._startTime=Number(null===(e=this.timeline)||void 0===e?void 0:e.currentTime)-t/this.playbackRate;this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(t){if(null!==t){if(this.updatePromises(),t=Number(t),isNaN(t))return;if(this._paused||this._idle)return;this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){if(t!==this._playbackRate){this.updatePromises();var e=this.currentTime;this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||"running"===this.playState||!this._finishedFlag}},{key:"updatePromises",value:function(){var t;if(null!==(t=this.effect.target)&&void 0!==t&&t.destroyed)return this.readyPromise=void 0,this.finishedPromise=void 0,!1;var e=this.oldPlayState,n=this.pending?"pending":this.playState;return this.readyPromise&&n!==e&&("idle"===n?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===e?this.resolveReadyPromise():"pending"===n&&(this.readyPromise=void 0)),this.finishedPromise&&n!==e&&("idle"===n?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===n?this.resolveFinishedPromise():"finished"===e&&(this.finishedPromise=void 0)),this.oldPlayState=n,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var t=this;if(this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var e=new Pc(null,this,this.currentTime,null);setTimeout(function(){t.oncancel(e)})}}},{key:"reverse",value:function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()}},{key:"updatePlaybackRate",value:function(t){this.playbackRate=t}},{key:"targetAnimations",value:function(){var t;return(null===(t=this.effect)||void 0===t?void 0:t.target).getAnimations()}},{key:"markTarget",value:function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)}},{key:"unmarkTarget",value:function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)}},{key:"tick",value:function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}}},{key:"persist",value:function(){throw new Error(Ar)}},{key:"addEventListener",value:function(t,e,n){throw new Error(Ar)}},{key:"removeEventListener",value:function(t,e,n){throw new Error(Ar)}},{key:"dispatchEvent",value:function(t){throw new Error(Ar)}},{key:"commitStyles",value:function(){throw new Error(Ar)}},{key:"ensureAlive",value:function(){var t,e;this.playbackRate<0&&0===this.currentTime?this._inEffect=!(null===(t=this.effect)||void 0===t||!t.update(-1)):this._inEffect=!(null===(e=this.effect)||void 0===e||!e.update(this.currentTime));this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(t){var e=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new Pc(null,this,this.currentTime,t);setTimeout(function(){e.onfinish&&e.onfinish(n)})}this._finishedFlag=!0}}else{if(this.onframe&&"running"===this.playState){var r=new Pc(null,this,this.currentTime,t);this.onframe(r)}this._finishedFlag=!1}}}])}(),Lc=.1,_c="function"==typeof Float32Array,Ic=function(t,e){return 1-3*e+3*t},jc=function(t,e){return 3*e-6*t},Bc=function(t){return 3*t},Fc=function(t,e,n){return((Ic(e,n)*t+jc(e,n))*t+Bc(e))*t},zc=function(t,e,n){return 3*Ic(e,n)*t*t+2*jc(e,n)*t+Bc(e)},Gc=function(t,e,n,r){if(!(t>=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===r)return function(t){return t};for(var i=_c?new Float32Array(11):new Array(11),o=0;o<11;++o)i[o]=Fc(o*Lc,t,n);var a=function(e){for(var r=0,o=1;10!==o&&i[o]<=e;++o)r+=Lc;--o;var a=r+(e-i[o])/(i[o+1]-i[o])*Lc,s=zc(a,t,n);return s>=.001?function(t,e,n,r){for(var i=0;i<4;++i){var o=zc(e,n,r);if(0===o)return e;e-=(Fc(e,n,r)-t)/o}return e}(e,a,t,n):0===s?a:function(t,e,n,r,i){var o,a,s=0;do{(o=Fc(a=e+(n-e)/2,r,i)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++s<10);return a}(e,r,r+Lc,t,n)};return function(t){return 0===t||1===t?t:Fc(a(t),e,r)}},Vc=function(t){return Math.pow(t,2)},Wc=function(t){return Math.pow(t,3)},Hc=function(t){return Math.pow(t,4)},Uc=function(t){return Math.pow(t,5)},$c=function(t){return Math.pow(t,6)},Yc=function(t){return 1-Math.cos(t*Math.PI/2)},qc=function(t){return 1-Math.sqrt(1-t*t)},Xc=function(t){return t*t*(3*t-2)},Kc=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)},Zc=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?.5:i,a=oe(Number(r),1,10),s=oe(Number(o),.1,2);return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-s/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/s)},Qc=function(t){var e=arguments.length>2?arguments[2]:void 0,n=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),r=n[0],i=void 0===r?1:r,o=n[1],a=void 0===o?100:o,s=n[2],l=void 0===s?10:s,c=n[3],u=void 0===c?0:c;i=oe(i,.1,1e3),a=oe(a,.1,1e3),l=oe(l,.1,1e3),u=oe(u,.1,1e3);var h=Math.sqrt(a/i),d=l/(2*Math.sqrt(a*i)),f=d<1?h*Math.sqrt(1-d*d):0,p=d<1?(d*h-u)/f:-u+h,g=e?e*t/1e3:t;return g=d<1?Math.exp(-g*d*h)*(1*Math.cos(f*g)+p*Math.sin(f*g)):(1+p*g)*Math.exp(-g*h),0===t||1===t?t:1-g},Jc=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?10:n;return("start"===e[1]?Math.ceil:Math.floor)(oe(t,0,1)*r)/r},tu=function(t){var e=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),n=e[0],r=e[1],i=e[2],o=e[3];return Gc(n,r,i,o)(t)},eu=Gc(.42,0,1,1),nu=function(t){return function(e){return 1-t(1-e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],arguments.length>2?arguments[2]:void 0)}},ru=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?t(2*e,n,r)/2:1-t(-2*e+2,n,r)/2}},iu=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-2*e,n,r))/2:(t(2*e-1,n,r)+1)/2}},ou={steps:Jc,"step-start":function(t){return Jc(t,[1,"start"])},"step-end":function(t){return Jc(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":tu,ease:function(t){return tu(t,[.25,.1,.25,1])},in:eu,out:nu(eu),"in-out":ru(eu),"out-in":iu(eu),"in-quad":Vc,"out-quad":nu(Vc),"in-out-quad":ru(Vc),"out-in-quad":iu(Vc),"in-cubic":Wc,"out-cubic":nu(Wc),"in-out-cubic":ru(Wc),"out-in-cubic":iu(Wc),"in-quart":Hc,"out-quart":nu(Hc),"in-out-quart":ru(Hc),"out-in-quart":iu(Hc),"in-quint":Uc,"out-quint":nu(Uc),"in-out-quint":ru(Uc),"out-in-quint":iu(Uc),"in-expo":$c,"out-expo":nu($c),"in-out-expo":ru($c),"out-in-expo":iu($c),"in-sine":Yc,"out-sine":nu(Yc),"in-out-sine":ru(Yc),"out-in-sine":iu(Yc),"in-circ":qc,"out-circ":nu(qc),"in-out-circ":ru(qc),"out-in-circ":iu(qc),"in-back":Xc,"out-back":nu(Xc),"in-out-back":ru(Xc),"out-in-back":iu(Xc),"in-bounce":Kc,"out-bounce":nu(Kc),"in-out-bounce":ru(Kc),"out-in-bounce":iu(Kc),"in-elastic":Zc,"out-elastic":nu(Zc),"in-out-elastic":ru(Zc),"out-in-elastic":iu(Zc),spring:Qc,"spring-in":Qc,"spring-out":nu(Qc),"spring-in-out":ru(Qc),"spring-out-in":iu(Qc)},au=function(t){return t};function su(t,e){return function(n){if(n>=1)return 1;var r=1/t;return(n+=e*r)-n%r}}var lu="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",cu=new RegExp("cubic-bezier\\(".concat(lu,",").concat(lu,",").concat(lu,",").concat(lu,"\\)")),uu=/steps\(\s*(\d+)\s*\)/,hu=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function du(t){var e=cu.exec(t);if(e)return Gc.apply(void 0,d(e.slice(1).map(Number)));var n=uu.exec(t);if(n)return su(Number(n[1]),0);var r=hu.exec(t);return r?su(Number(r[1]),{start:1,middle:.5,end:0}[r[2]]):ou[function(t){return function(t){return"-"===(t=t.replace(/([A-Z])/g,function(t){return"-".concat(t.toLowerCase())})).charAt(0)?t.substring(1):t}(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()}(t)]||ou.linear}function fu(t){return Math.abs(function(t){var e;if(0===t.duration||0===t.iterations)return 0;return("auto"===t.duration?0:Number(t.duration))*(null!==(e=t.iterations)&&void 0!==e?e:1)}(t)/(t.playbackRate||1))}function pu(t,e,n){var r=function(t,e,n){if(null===e)return 0;var r=n.endTime;return e<Math.min(n.delay,r)?1:e>=Math.min(n.delay+t+n.endDelay,r)?2:3}(t,e,n),i=function(t,e,n,r,i){switch(r){case 1:return"backwards"===e||"both"===e?0:null;case 3:return n-i;case 2:return"forwards"===e||"both"===e?t:null;case 0:return null}}(t,n.fill,e,r,n.delay);if(null===i)return null;var o="auto"===n.duration?0:n.duration,a=function(t,e,n,r,i){var o=i;return 0===t?1!==e&&(o+=n):o+=r/t,o}(o,r,n.iterations,i,n.iterationStart),s=function(t,e,n,r,i,o){var a=t===1/0?e%1:t%1;return 0!==a||2!==n||0===r||0===i&&0!==o||(a=1),a}(a,n.iterationStart,r,n.iterations,i,o),l=function(t,e,n,r){return 2===t&&e===1/0?1/0:1===n?Math.floor(r)-1:Math.floor(r)}(r,n.iterations,s,a),c=function(t,e,n){var r=t;if("normal"!==t&&"reverse"!==t){var i=e;"alternate-reverse"===t&&(i+=1),r="normal",i!==1/0&&i%2!=0&&(r="reverse")}return"normal"===r?n:1-n}(n.direction,l,s);return n.currentIteration=l,n.progress=c,n.easingFunction(c)}function gu(t,e,n){var r=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r])if(vu(i)){var o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:du(t[r].easing)||e.easingFunction,value:t[r][i]};n[i]=n[i]||[],n[i].push(o)}return n}(t,e),i=function(t,e){var n=[];for(var r in t)for(var i=t[r],o=0;o<i.length-1;o++){var a=o,s=o+1,l=i[a].computedOffset,c=i[s].computedOffset,u=l,h=c;0===o&&(u=-1/0,0===c&&(s=a)),o===i.length-2&&(h=1/0,1===l&&(a=s)),n.push({applyFrom:u,applyTo:h,startOffset:i[a].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[a].easingFunction,property:r,interpolation:yu(r,i[a].value,i[s].value,e)})}return n.sort(function(t,e){return t.startOffset-e.startOffset}),n}(r,n);return function(t,e){if(null!==e)i.filter(function(t){return e>=t.applyFrom&&e<t.applyTo}).forEach(function(n){var r=e-n.startOffset,i=n.endOffset-n.startOffset,o=0===i?0:r/i;t.setAttribute(n.property,n.interpolation(o),!1,!1)});else for(var n in r)vu(n)&&t.setAttribute(n,null)}}function vu(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var mu=function(t,e,n){return function(r){var i=bu(t,e,r);return ae(i)?i:n(i)}};function yu(t,e,n,r){var i=Pa[t];if(i&&i.syntax&&i.int){var o=jl.styleValueRegistry.getPropertySyntax(i.syntax);if(o){var a=o.parser,s=a?a(e,r):e,l=a?a(n,r):n,c=o.mixer(s,l,r);if(c){var u=mu.apply(void 0,d(c));return function(t){return 0===t?e:1===t?n:u(t)}}}}return mu(!1,!0,function(t){return t?n:e})}function bu(t,e,n){if("number"==typeof t&&"number"==typeof e)return t*(1-n)+e*n;if("boolean"==typeof t&&"boolean"==typeof e||"string"==typeof t&&"string"==typeof e)return n<.5?t:e;if(Array.isArray(t)&&Array.isArray(e)){for(var r=t.length,i=e.length,o=Math.max(r,i),a=[],s=0;s<o;s++)a.push(bu(t[s<r?s:r-1],e[s<i?s:i-1],n));return a}throw new Error("Mismatched interpolation arguments ".concat(t,":").concat(e))}var xu=function(){return c(function t(){s(this,t),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=au,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null},[{key:"easing",get:function(){return this._easing},set:function(t){this.easingFunction=du(t),this._easing=t}}])}();function Eu(t,e){if(null===t)return[];Array.isArray(t)||(t=function(t){var e=[];for(var n in t)if(!(n in["easing","offset","composite"])){var r=t[n];Array.isArray(r)||(r=[r]);for(var i=r.length,o=0;o<i;o++){if(!e[o]){var a={};"offset"in t&&(a.offset=Number(t.offset)),"easing"in t&&(a.easing=t.easing),"composite"in t&&(a.composite=t.composite),e[o]=a}void 0!==r[o]&&null!==r[o]&&(e[o][n]=r[o])}}return e.sort(function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)}),e}(t));for(var n=t.map(function(t){var n={};for(var r in null!=e&&e.composite&&(n.composite="auto"),t){var i=t[r];if("offset"===r){if(null!==i){if(i=Number(i),!isFinite(i))throw new Error("Keyframe offsets must be numbers.");if(i<0||i>1)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=i}}else if("composite"===r&&-1===["replace","add","accumulate","auto"].indexOf(i))throw new Error("".concat(i," compositing is not supported"));n[r]=i}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==e?void 0:e.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n}),r=!0,i=-1/0,o=0;o<n.length;o++){var a=n[o].offset;if($t(a))r=!1;else{if(a<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=a}}return n=n.filter(function(t){return Number(t.offset)>=0&&Number(t.offset)<=1}),r||function(){var t,e,r=n.length;n[r-1].computedOffset=Number(null!==(t=n[r-1].offset)&&void 0!==t?t:1),r>1&&(n[0].computedOffset=Number(null!==(e=n[0].offset)&&void 0!==e?e:0));for(var i=0,o=Number(n[0].computedOffset),a=1;a<r;a++){var s=n[a].computedOffset;if(!$t(s)&&!$t(o)){for(var l=1;l<a-i;l++)n[i+l].computedOffset=o+(Number(s)-o)*l/(a-i);i=a,o=Number(s)}}}(),n}var wu="backwards|forwards|both|none".split("|"),ku="reverse|alternate|alternate-reverse".split("|");function Mu(t,e){return function(t){var e=new xu;return"number"!=typeof t||isNaN(t)?void 0!==t&&Object.keys(t).forEach(function(n){if(void 0!==t[n]&&null!==t[n]&&"auto"!==t[n]){if(("number"==typeof e[n]||"duration"===n)&&("number"!=typeof t[n]||isNaN(t[n])))return;if("fill"===n&&-1===wu.indexOf(t[n]))return;if("direction"===n&&-1===ku.indexOf(t[n]))return;e[n]=t[n]}}):e.duration=t,e}(t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!=t?t:{duration:"auto"}))}var Su=function(){return c(function t(e,n,r){var i=this;s(this,t),this.composite="replace",this.iterationComposite="replace",this.target=e,this.timing=Mu(r),this.timing.effect=this,this.timing.activeDuration=fu(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=Eu(n,this.timing),this.interpolations=gu(this.normalizedKeyframes,this.timing,this.target);var o=jl.globalThis.Proxy;this.computedTiming=o?new o(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?i.animation&&i.animation.currentTime||null:"currentIteration"===e?i.animation&&"running"===i.animation.playState?t.currentIteration||0:null:"progress"===e?i.animation&&"running"===i.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing},[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(t){return null!==t&&(this.timeFraction=pu(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(t){this.normalizedKeyframes=Eu(t)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(t){var e=this;Object.keys(t||{}).forEach(function(n){e.timing[n]=t[n]})}}])}();function Nu(t,e){return Number(t.id)-Number(e.id)}var Tu=function(){return c(function t(e){var n=this;s(this,t),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(t){n.currentTime=t,n.discardAnimations(),0===n.animations.length?n.timelineTicking=!1:n.requestAnimationFrame(n.webAnimationsNextTick)},this.processRafCallbacks=function(t){var e=n.rafCallbacks;n.rafCallbacks=[],t<Number(n.currentTime)&&(t=Number(n.currentTime)),n.animations.sort(Nu),n.animations=n.tick(t,!0,n.animations)[0],e.forEach(function(e){e[1](t)}),n.applyPendingEffects()},this.document=e},[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(t,e,n){var r=new Su(t,e,n),i=new Dc(r,this);return this.animations.push(i),this.restartWebAnimationsNextTick(),i.updatePromises(),i.play(),i.updatePromises(),i}},{key:"applyDirtiedAnimation",value:function(t){var e=this;if(!this.inTick){t.markTarget();var n=t.targetAnimations();n.sort(Nu),this.tick(Number(this.currentTime),!1,n.slice())[1].forEach(function(t){var n=e.animations.indexOf(t);-1!==n&&e.animations.splice(n,1)}),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach(function(t){null==t||t.applyInterpolations()}),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(t){return t.updatePromises()})}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(t){return"finished"!==t.playState&&"idle"!==t.playState})}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e}},{key:"requestAnimationFrame",value:function(t){var e=this;return this.rAF(function(n){e.updateAnimationsPromises(),t(n),e.updateAnimationsPromises()})}},{key:"tick",value:function(t,e,n){var r,i,o=this;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=t,this.ticking=!1;var a=[],s=[],l=[],c=[];return n.forEach(function(n){n.tick(t,e),n._inEffect?(s.push(n.effect),n.markTarget()):(a.push(n.effect),n.unmarkTarget()),n._needsTick&&(o.ticking=!0);var r=n._inEffect||n._needsTick;n._inTimeline=r,r?l.push(n):c.push(n)}),(r=this.pendingEffects).push.apply(r,a),(i=this.pendingEffects).push.apply(i,s),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[l,c]}}])}();jl.EasingFunction=du,jl.AnimationTimeline=Tu;const Ou={duration:500},Cu={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var Au,Pu,Ru,Du,Lu,_u,Iu,ju,Bu;!function(t){t.NodeAdded="NodeAdded",t.NodeUpdated="NodeUpdated",t.NodeRemoved="NodeRemoved",t.EdgeAdded="EdgeAdded",t.EdgeUpdated="EdgeUpdated",t.EdgeRemoved="EdgeRemoved",t.ComboAdded="ComboAdded",t.ComboUpdated="ComboUpdated",t.ComboRemoved="ComboRemoved"}(Au||(Au={})),function(t){t.DRAW="draw",t.COLLAPSE="collapse",t.EXPAND="expand",t.TRANSFORM="transform"}(Pu||(Pu={})),t.CanvasEvent=void 0,function(t){t.CLICK="canvas:click",t.DBLCLICK="canvas:dblclick",t.POINTER_OVER="canvas:pointerover",t.POINTER_LEAVE="canvas:pointerleave",t.POINTER_ENTER="canvas:pointerenter",t.POINTER_MOVE="canvas:pointermove",t.POINTER_OUT="canvas:pointerout",t.POINTER_DOWN="canvas:pointerdown",t.POINTER_UP="canvas:pointerup",t.CONTEXT_MENU="canvas:contextmenu",t.DRAG_START="canvas:dragstart",t.DRAG="canvas:drag",t.DRAG_END="canvas:dragend",t.DRAG_ENTER="canvas:dragenter",t.DRAG_OVER="canvas:dragover",t.DRAG_LEAVE="canvas:dragleave",t.DROP="canvas:drop",t.WHEEL="canvas:wheel"}(t.CanvasEvent||(t.CanvasEvent={})),t.ComboEvent=void 0,(Ru=t.ComboEvent||(t.ComboEvent={})).CLICK="combo:click",Ru.DBLCLICK="combo:dblclick",Ru.POINTER_OVER="combo:pointerover",Ru.POINTER_LEAVE="combo:pointerleave",Ru.POINTER_ENTER="combo:pointerenter",Ru.POINTER_MOVE="combo:pointermove",Ru.POINTER_OUT="combo:pointerout",Ru.POINTER_DOWN="combo:pointerdown",Ru.POINTER_UP="combo:pointerup",Ru.CONTEXT_MENU="combo:contextmenu",Ru.DRAG_START="combo:dragstart",Ru.DRAG="combo:drag",Ru.DRAG_END="combo:dragend",Ru.DRAG_ENTER="combo:dragenter",Ru.DRAG_OVER="combo:dragover",Ru.DRAG_LEAVE="combo:dragleave",Ru.DROP="combo:drop",t.CommonEvent=void 0,(Du=t.CommonEvent||(t.CommonEvent={})).CLICK="click",Du.DBLCLICK="dblclick",Du.POINTER_OVER="pointerover",Du.POINTER_LEAVE="pointerleave",Du.POINTER_ENTER="pointerenter",Du.POINTER_MOVE="pointermove",Du.POINTER_OUT="pointerout",Du.POINTER_DOWN="pointerdown",Du.POINTER_UP="pointerup",Du.CONTEXT_MENU="contextmenu",Du.DRAG_START="dragstart",Du.DRAG="drag",Du.DRAG_END="dragend",Du.DRAG_ENTER="dragenter",Du.DRAG_OVER="dragover",Du.DRAG_LEAVE="dragleave",Du.DROP="drop",Du.KEY_DOWN="keydown",Du.KEY_UP="keyup",Du.WHEEL="wheel",Du.PINCH="pinch",t.ContainerEvent=void 0,(Lu=t.ContainerEvent||(t.ContainerEvent={})).KEY_DOWN="keydown",Lu.KEY_UP="keyup",t.EdgeEvent=void 0,(_u=t.EdgeEvent||(t.EdgeEvent={})).CLICK="edge:click",_u.DBLCLICK="edge:dblclick",_u.POINTER_OVER="edge:pointerover",_u.POINTER_LEAVE="edge:pointerleave",_u.POINTER_ENTER="edge:pointerenter",_u.POINTER_MOVE="edge:pointermove",_u.POINTER_OUT="edge:pointerout",_u.POINTER_DOWN="edge:pointerdown",_u.POINTER_UP="edge:pointerup",_u.CONTEXT_MENU="edge:contextmenu",_u.DRAG_ENTER="edge:dragenter",_u.DRAG_OVER="edge:dragover",_u.DRAG_LEAVE="edge:dragleave",_u.DROP="edge:drop",t.GraphEvent=void 0,(Iu=t.GraphEvent||(t.GraphEvent={})).BEFORE_CANVAS_INIT="beforecanvasinit",Iu.AFTER_CANVAS_INIT="aftercanvasinit",Iu.BEFORE_SIZE_CHANGE="beforesizechange",Iu.AFTER_SIZE_CHANGE="aftersizechange",Iu.BEFORE_ELEMENT_CREATE="beforeelementcreate",Iu.AFTER_ELEMENT_CREATE="afterelementcreate",Iu.BEFORE_ELEMENT_UPDATE="beforeelementupdate",Iu.AFTER_ELEMENT_UPDATE="afterelementupdate",Iu.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",Iu.AFTER_ELEMENT_DESTROY="afterelementdestroy",Iu.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",Iu.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",Iu.BEFORE_DRAW="beforedraw",Iu.AFTER_DRAW="afterdraw",Iu.BEFORE_RENDER="beforerender",Iu.AFTER_RENDER="afterrender",Iu.BEFORE_ANIMATE="beforeanimate",Iu.AFTER_ANIMATE="afteranimate",Iu.BEFORE_LAYOUT="beforelayout",Iu.AFTER_LAYOUT="afterlayout",Iu.BEFORE_STAGE_LAYOUT="beforestagelayout",Iu.AFTER_STAGE_LAYOUT="afterstagelayout",Iu.BEFORE_TRANSFORM="beforetransform",Iu.AFTER_TRANSFORM="aftertransform",Iu.BATCH_START="batchstart",Iu.BATCH_END="batchend",Iu.BEFORE_DESTROY="beforedestroy",Iu.AFTER_DESTROY="afterdestroy",Iu.BEFORE_RENDERER_CHANGE="beforerendererchange",Iu.AFTER_RENDERER_CHANGE="afterrendererchange",t.HistoryEvent=void 0,(ju=t.HistoryEvent||(t.HistoryEvent={})).UNDO="undo",ju.REDO="redo",ju.CANCEL="cancel",ju.ADD="add",ju.CLEAR="clear",ju.CHANGE="change",t.NodeEvent=void 0,(Bu=t.NodeEvent||(t.NodeEvent={})).CLICK="node:click",Bu.DBLCLICK="node:dblclick",Bu.POINTER_OVER="node:pointerover",Bu.POINTER_LEAVE="node:pointerleave",Bu.POINTER_ENTER="node:pointerenter",Bu.POINTER_MOVE="node:pointermove",Bu.POINTER_OUT="node:pointerout",Bu.POINTER_DOWN="node:pointerdown",Bu.POINTER_UP="node:pointerup",Bu.CONTEXT_MENU="node:contextmenu",Bu.DRAG_START="node:dragstart",Bu.DRAG="node:drag",Bu.DRAG_END="node:dragend",Bu.DRAG_ENTER="node:dragenter",Bu.DRAG_OVER="node:dragover",Bu.DRAG_LEAVE="node:dragleave",Bu.DROP="node:drop";const Fu="combo",zu="tree";var Gu;t.ExtensionCategory=void 0,(Gu=t.ExtensionCategory||(t.ExtensionCategory={})).NODE="node",Gu.EDGE="edge",Gu.COMBO="combo",Gu.THEME="theme",Gu.PALETTE="palette",Gu.LAYOUT="layout",Gu.BEHAVIOR="behavior",Gu.PLUGIN="plugin",Gu.ANIMATION="animation",Gu.TRANSFORM="transform",Gu.SHAPE="shape";const Vu={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function Wu(t,e){var n;const r=null===(n=Vu[t])||void 0===n?void 0:n[e];if(r)return r}const Hu="5.0.50";function Uu(t){return`[G6 v${Hu}] ${t}`}const $u=t=>{console.warn(Uu(t))};function Yu(e){const{theme:n}=e;if(!n)return{};const r=Wu(t.ExtensionCategory.THEME,n);return r||($u(`The theme of ${n} is not registered.`),{})}function qu(t,e){if(Array.isArray(t)&&0===t.length)return null;const n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t.slice(1):e||[];return new Proxy(n,{get:(t,e)=>"function"!=typeof t[e]||["onframe","onfinish"].includes(e)?"finished"===e?Promise.all([n.finished,...r.map(t=>t.finished)]):Reflect.get(t,e):(...n)=>{t[e](...n),r.forEach(t=>{var r;return null===(r=t[e])||void 0===r?void 0:r.call(t,...n)})},set:(t,e,n)=>(["onframe","onfinish"].includes(e)||r.forEach(t=>{t[e]=n}),Reflect.set(t,e,n))})}function Xu(t){const e=t.reduce((t,e)=>(Object.entries(e).forEach(([e,n])=>{void 0===t[e]?t[e]=[n]:t[e].push(n)}),t),{});Object.entries(e).forEach(([n,r])=>{(r.length!==t.length||r.some(t=>$t(t))||r.every(t=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Te(t,r[0])))&&delete e[n]});const n=Object.entries(e).reduce((t,[e,n])=>(n.forEach((n,r)=>{t[r]?t[r][e]=n:t[r]={[e]:n}}),t),[]);return 0!==t.length&&0===n.length&&n.push({_:0},{_:0}),n}function Ku(t){switch(t){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function Zu(t,e){const{animation:n}=t;if(!1===n||!1===e)return!1;const r=Object.assign({},Ou);return qt(n)&&Object.assign(r,n),qt(e)&&Object.assign(r,e),r}function Qu(e,n,r,i){var o,a;const{animation:s}=e;if(!1===s||!1===i)return[];const l=null===(o=null==e?void 0:e[n])||void 0===o?void 0:o.animation;if(!1===l)return[];const c=null==l?void 0:l[r];if(!1===c)return[];const u=null===(a=Yu(e)[n])||void 0===a?void 0:a.animation,h=(e=[])=>function(e){if("string"==typeof e){return Wu(t.ExtensionCategory.ANIMATION,e)||($u(`The animation of ${e} is not registered.`),[])}return e}(e).map(t=>Object.assign(Object.assign(Object.assign(Object.assign({},Cu),qt(s)&&s),t),qt(i)&&i));if(c)return h(c);if(!u)return[];const d=u[r];return!1===d?[]:h(d)}function Ju(t,e,n,r=[]){if(!r&&0===t&&0===e&&0===n)return null;if(Array.isArray(r)){let i=-1;const o=[];for(let a=0;a<r.length;a++){const s=r[a];if("translate"===s[0]){if(s[1]===t&&s[2]===e)return null;i=a,o.push(["translate",t,e])}else if("translate3d"===s[0]){if(s[1]===t&&s[2]===e&&s[3]===n)return null;i=a,o.push(["translate3d",t,e,null!=n?n:0])}else o.push(s)}return-1===i&&o.splice(0,0,ae(n)?["translate3d",t,e,null!=n?n:0]:["translate",t,e]),0===o.length?null:o}const i=r?r.replace(/translate(3d)?\([^)]*\)/g,""):"";return 0===n?`translate(${t}, ${e})${i}`:`translate3d(${t}, ${e}, ${n})${i}`}const th=(t,e,n)=>{if(!n.length)return null;const[r,i]=e;let o;const a=n.map(e=>{var{fields:n,shape:a,states:s}=e,l=ze(e,["fields","shape","states"]);const c=(e=>{var n;if(e){const o=t.getShape(e);if(!o)return null;const a=`get${de(e)}Style`,s=(null===(n=null==t?void 0:t[a])||void 0===n?void 0:n.bind(t))||(t=>t);return{shape:o,fromStyle:(null==s?void 0:s(r))||{},toStyle:(null==s?void 0:s(i))||{}}}return{shape:t,fromStyle:r,toStyle:i}})(a);if(!c)return null;const{shape:u,fromStyle:h,toStyle:d}=c,f=[{},{}];if(n.forEach(t=>{var e,n;Object.assign(f[0],{[t]:null!==(e=h[t])&&void 0!==e?e:Ku(t)}),Object.assign(f[1],{[t]:null!==(n=d[t])&&void 0!==n?n:Ku(t)})}),f.some(t=>Object.keys(t).some(t=>["x","y","z"].includes(t)))){const{x:t=0,y:e=0,z:n,transform:r=""}=u.attributes||{};f.forEach(i=>{var o,a,s;i.transform=Ju(null!==(o=i.x)&&void 0!==o?o:t,null!==(a=i.y)&&void 0!==a?a:e,null!==(s=i.z)&&void 0!==s?s:n,r)})}const p=u.animate(Xu(f),l);return void 0===a&&(o=p),p}).filter(Boolean),s=o||(null==a?void 0:a[0]);return s?qu(s,a.filter(t=>t!=t)):null},eh=[{fields:["x","y"]}],nh=eh,rh=[{fields:["sourceNode","targetNode"]}],ih=rh,oh=[{fields:["childrenNode","x","y"]}],ah=oh;function sh(t){return t instanceof Float32Array||!(!Array.isArray(t)||2!==t.length&&3!==t.length)&&t.every(t=>"number"==typeof t)}function lh(t,e,n){return t>=e&&t<=n}function ch(t=0){if(Array.isArray(t)){const[e=0,n=e,r=e,i=n]=t;return[e,n,r,i]}return[t,t,t,t]}function uh(t=0){const e=ch(t);return e[0]+e[2]}function hh(t){return t.max[0]-t.min[0]}function dh(t){return t.max[1]-t.min[1]}function fh(t){return[hh(t),dh(t)]}function ph(t,e){const n=sh(t)?gh(t):t.getShape("key").getBounds();return e?vh(n,e):n}function gh(t){const[e,n,r=0]=t,i=new Mr;return i.setMinMax([e,n,r],[e,n,r]),i}function vh(t,e){const[n,r,i,o]=ch(e),[a,s,l]=t.min,[c,u,h]=t.max,d=new Mr;return d.setMinMax([a-o,s-n,l],[c+r,u+i,h]),d}function mh(t){if(0===t.length)return new Mr;if(1===t.length)return t[0];const e=new Mr;e.setMinMax(t[0].min,t[0].max);for(let n=1;n<t.length;n++){const r=t[n];e.setMinMax([Math.min(e.min[0],r.min[0]),Math.min(e.min[1],r.min[1]),Math.min(e.min[2],r.min[2])],[Math.max(e.max[0],r.max[0]),Math.max(e.max[1],r.max[1]),Math.max(e.max[2],r.max[2])])}return e}function yh(t,e){return lh(t[0],e.min[0],e.max[0])&&lh(t[1],e.min[1],e.max[1])}function bh(t,e,n=!1){const{min:[r,i],max:[o,a]}=e,s=(t[1]===i||t[1]===a)&&(n||lh(t[0],r,o)),l=(t[0]===r||t[0]===o)&&(n||lh(t[1],i,a));return s||l}function xh(t,e){const{center:n}=e;return t[0]===n[0]&&t[1]===n[1]}function Eh(t,e){const[n,r]=t,[i,o]=e.min,[a,s]=e.max,l=n-i,c=a-n,u=r-o,h=s-r,d=Math.min(l,c,u,h);return d===l?"left":d===c?"right":d===u?"top":d===h?"bottom":"left"}function wh(t,e){const n=ye(t);if(yh(t,e)){switch(Eh(t,e)){case"left":n[0]=e.min[0];break;case"right":n[0]=e.max[0];break;case"top":n[1]=e.min[1];break;case"bottom":n[1]=e.max[1]}}else{const[r,i]=t,[o,a]=e.min,[s,l]=e.max;n[0]=lh(r,o,s)?r:r<o?o:s,n[1]=lh(i,a,l)?i:i<a?a:l}return n}var kh=function(t,e){return t===e},Mh=function(){function t(t,e){void 0===e&&(e=null),this.value=t,this.next=e}return t.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},t}(),Sh=function(){function t(t){void 0===t&&(t=kh),this.head=null,this.tail=null,this.compare=t}return t.prototype.prepend=function(t){var e=new Mh(t,this.head);return this.head=e,this.tail||(this.tail=e),this},t.prototype.append=function(t){var e=new Mh(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},t.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(null!==n)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},t.prototype.find=function(t){var e=t.value,n=void 0===e?void 0:e,r=t.callback,i=void 0===r?void 0:r;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value))return o;if(void 0!==n&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},t.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},t.prototype.fromArray=function(t){var e=this;return t.forEach(function(t){return e.append(t)}),this},t.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},t.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},t.prototype.toString=function(t){return void 0===t&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},t}(),Nh=function(t,e,n){void 0===e&&(e=[]);var r=e.filter(function(e){return e.source===t||e.target===t});if("target"===n){return r.filter(function(e){return e.source===t}).map(function(t){return t.target})}if("source"===n){return r.filter(function(e){return e.target===t}).map(function(t){return t.source})}return r.map(function(e){return e.source===t?e.target:e.source})},Th={}.toString,Oh=function(t,e){return Th.call(t)==="[object "+e+"]"},Ch=function(t){return Oh(t,"Function")},Ah=function(t){return Array.isArray?Array.isArray(t):Oh(t,"Array")};var Ph,Rh=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return function(t,e){var n,r;if(t)if(Ah(t))for(var i=0,o=t.length;i<o&&!1!==e(t[i],i);i++);else if(r=typeof(n=t),null!==n&&"object"===r||"function"===r)for(var a in t)if(t.hasOwnProperty(a)&&!1===e(t[a],a))break}(t,function(n,r){Ch(t)&&"prototype"===r||e.push(n)}),e};!function(t,e){if(!Ch(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var s=t.apply(this,r);return a.set(o,s),s};n.cache=new Map}(function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return Ph||(Ph=document.createElement("canvas").getContext("2d")),Ph.font=[o,a,i,n+"px",r].join(" "),Ph.measureText(function(t){return Oh(t,"String")}(t)?t:"").width},function(t,e){return void 0===e&&(e={}),function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}([t],Rh(e)).join("")});function Dh(t,e,n,r){if(t===e)return[t];if(r[e])return r[e];for(var i=[],o=0,a=n[e];o<a.length;o++){var s=Dh(t,a[o],n,r);if(!s)return;for(var l=0,c=s;l<c.length;l++){var u=c[l];Ah(u)?i.push(He(He([],u,!0),[e],!1)):i.push([u,e])}}return r[e]=i,r[e]}var Lh,_h=function(t,e,n,r,i){var o=function(t,e,n,r){var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,l={},c={},u={};o.forEach(function(t,n){var r=t.id;c[r]=1/0,r===e&&(c[r]=0)});for(var h=o.length,d=function(t){var e=function(t,e,n){for(var r,i=1/0,o=0;o<e.length;o++){var a=e[o].id;!n[a]&&t[a]<=i&&(i=t[a],r=e[o])}return r}(c,o,l),i=e.id;if(l[i]=!0,c[i]===1/0)return"continue";var a=[];a=n?function(t,e){return e.filter(function(e){return e.source===t})}(i,s):function(t,e){return e.filter(function(e){return e.source===t||e.target===t})}(i,s),a.forEach(function(t){var n=t.target,o=t.source,a=n===i?o:n,s=r&&t[r]?t[r]:1;c[a]>c[e.id]+s?(c[a]=c[e.id]+s,u[a]=[e.id]):c[a]===c[e.id]+s&&u[a].push(e.id)})},f=0;f<h;f++)d();u[e]=[e];var p={};for(var g in c)c[g]!==1/0&&Dh(e,g,u,p);var v={};for(var g in p)v[g]=p[g][0];return{length:c,path:v,allPath:p}}(t,e,r,i),a=o.length,s=o.path,l=o.allPath;return{length:a[n],path:s[n],allPath:l[n]}};!function(t){t.EuclideanDistance="euclideanDistance"}(Lh||(Lh={}));function Ih(t){if(void 0!==t.id)return t.id;if(void 0!==t.source&&void 0!==t.target)return`${t.source}-${t.target}`;throw new Error(Uu("The datum does not have available id."))}function jh(t){return t.combo}function Bh(t,e){const n={nodes:(t.nodes||[]).map(Ih),edges:(t.edges||[]).map(Ih),combos:(t.combos||[]).map(Ih)};return e?Object.values(n).flat():n}!function(){function t(t){void 0===t&&(t=10),this.linkedList=new Sh,this.maxStep=t}Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()}}();const Fh=(t,e,n)=>{var r;switch(n.type){case"degree":{const i=new Map;return null===(r=t.nodes)||void 0===r||r.forEach(t=>{const r=e(Ih(t),n.direction).length;i.set(Ih(t),r)}),i}case"betweenness":return Gh(t,n.directed,n.weightPropertyName);case"closeness":return Vh(t,n.directed,n.weightPropertyName);case"eigenvector":return Hh(t,n.directed);case"pagerank":return Wh(t,n.epsilon,n.linkProb);default:return zh(t)}},zh=t=>{var e;const n=new Map;return null===(e=t.nodes)||void 0===e||e.forEach(t=>{n.set(Ih(t),0)}),n},Gh=(t,e,n)=>{const r=zh(t),{nodes:i=[]}=t;return i.forEach(o=>{i.forEach(i=>{if(o!==i){const{allPath:a}=_h(t,Ih(o),Ih(i),e,n),s=a.length;a.flat().forEach(t=>{t!==Ih(o)&&t!==Ih(i)&&r.set(t,r.get(t)+1/s)})}})}),r},Vh=(t,e,n)=>{const r=new Map,{nodes:i=[]}=t;return i.forEach(o=>{const a=i.reduce((r,i)=>{if(o!==i){const{length:a}=_h(t,Ih(o),Ih(i),e,n);r+=a}return r},0);r.set(Ih(o),1/a)}),r},Wh=(t,e,n)=>{var r;const i=new Map,o=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,i=1,o=0,a=1e3,s=t.nodes,l=void 0===s?[]:s,c=t.edges,u=void 0===c?[]:c,h=l.length,d={},f={},p=0;p<h;++p)d[v=(E=l[p]).id]=1/h,f[v]=1/h;for(var g=function(t){var e={},n=t.nodes,r=void 0===n?[]:n,i=t.edges,o=void 0===i?[]:i;return r.forEach(function(t){e[t.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(t){e[t.source].degree++,e[t.source].outDegree++,e[t.target].degree++,e[t.target].inDegree++}),e}(t);a>0&&i>e;){for(o=0,p=0;p<h;++p){var v=(E=l[p]).id;if(r=0,0===g[E.id].inDegree)d[v]=0;else{for(var m=Nh(v,u,"source"),y=0;y<m.length;++y){var b=m[y],x=g[b].outDegree;x>0&&(r+=f[b]/x)}d[v]=n*r,o+=d[v]}}for(o=(1-o)/h,i=0,p=0;p<h;++p){var E;r=d[v=(E=l[p]).id]+o,i+=Math.abs(r-f[v]),f[v]=r}a-=1}return f}(t,e,n);return null===(r=t.nodes)||void 0===r||r.forEach(t=>{i.set(Ih(t),o[Ih(t)])}),i},Hh=(t,e)=>{const{nodes:n=[]}=t,r=Uh(t,e),i=$h(r,n.length),o=new Map;return n.forEach((t,e)=>{o.set(Ih(t),i[e])}),o},Uh=(t,e)=>{const{nodes:n=[],edges:r=[]}=t,i=Array(n.length).fill(null).map(()=>Array(n.length).fill(0));return r.forEach(({source:t,target:r})=>{const o=n.findIndex(e=>Ih(e)===t),a=n.findIndex(t=>Ih(t)===r);e?i[o][a]=1:(i[o][a]=1,i[a][o]=1)}),i},$h=(t,e,n=100,r=1e-6)=>{let i=Array(e).fill(1),o=1/0;for(let a=0;a<n&&o>r;a++){const n=Array(e).fill(0);for(let r=0;r<e;r++)for(let o=0;o<e;o++)n[r]+=t[r][o]*i[o];const r=Math.sqrt(n.reduce((t,e)=>t+e*e,0));for(let t=0;t<e;t++)n[t]/=r;o=Math.sqrt(n.reduce((t,e,n)=>t+(e-i[n])*e,0)),i=n}return i};function Yh(t,e,n,r=Te){const i=new Map(t.map(t=>[n(t),t])),o=new Map(e.map(t=>[n(t),t])),a=new Set(i.keys()),s=new Set(o.keys()),l=[],c=[],u=[],h=[];return s.forEach(t=>{a.has(t)?r(i.get(t),o.get(t))?h.push(o.get(t)):c.push(o.get(t)):l.push(o.get(t))}),a.forEach(t=>{s.has(t)||u.push(i.get(t))}),{enter:l,exit:u,keep:h,update:c}}function qh(t,e,n){t.forEach(t=>{(t=>{n&&!n(t)||(t.style.visibility=e)})(t)})}class Xh{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=function(t,e,n){const r={},i=t=>(t in r||(r[t]=0),`${e}-${t}-${r[t]++}`);return n.map(e=>"string"==typeof e?{type:e,key:i(e)}:"function"==typeof e?e.call(t):e.key?e:Object.assign(Object.assign({},e),{key:i(e.type)}))}(this.context.graph,this.category,t),{enter:n,update:r,exit:i,keep:o}=Yh(this.extensions,e,t=>t.key);this.createExtensions(n),this.updateExtensions([...r,...o]),this.destroyExtensions(i),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:r}=t,i=Wu(e,r);if(!i)return $u(`The extension ${r} of ${e} is not registered.`);const o=new i(this.context,t);o.initialized=!0,this.extensionMap[n]=o}createExtensions(t){t.forEach(t=>this.createExtension(t))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach(t=>this.updateExtension(t))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.initialized&&!e.destroyed&&e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach(({key:t})=>this.destroyExtension(t))}destroy(){this.destroyExtensions(this.extensions),this.context={},this.extensions=[],this.extensionMap={}}}class Kh{constructor(t,e){this.events=[],this.initialized=!1,this.destroyed=!1,this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class Zh extends Kh{}class Qh extends Zh{constructor(t,e){super(t,Object.assign({},Qh.defaultOptions,e)),this.isOverlapping=(t,e)=>e.some(e=>t.intersects(e)),this.occupiedBounds=[],this.detectLabelCollision=t=>{const e=this.context.viewport,n={show:[],hide:[]};return this.occupiedBounds=[],t.forEach(t=>{const r=t.getShape("label").getRenderBounds();e.isInViewport(r,!0)&&!this.isOverlapping(r,this.occupiedBounds)?(n.show.push(t),this.occupiedBounds.push(vh(r,this.options.padding))):n.hide.push(t)}),n},this.hideLabelIfExceedViewport=(t,e)=>{const{exit:n}=Yh(t,e,t=>t.id);null==n||n.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(t,e)=>{const{model:n}=this.context,r=n.getData(),i=n.getRelatedEdgesData.bind(n);return t.map(t=>(this.nodeCentralities.has(t.id)||(this.nodeCentralities=Fh(r,i,e)),{node:t,centrality:this.nodeCentralities.get(t.id)})).sort((t,e)=>e.centrality-t.centrality).map(t=>t.node)},this.sortLabelElementsInView=t=>{const{sort:e,sortNode:n,sortCombo:r,sortEdge:i}=this.options,{model:o}=this.context;if(Ut(e))return t.sort((t,n)=>e(o.getElementDataById(t.id),o.getElementDataById(n.id)));const{node:a=[],edge:s=[],combo:l=[]}=ie(t,t=>t.type),c=Ut(r)?l.sort((t,e)=>r(...o.getComboData([t.id,e.id]))):l,u=Ut(n)?a.sort((t,e)=>n(...o.getNodeData([t.id,e.id]))):this.sortNodesByCentrality(a,n),h=Ut(i)?s.sort((t,e)=>i(...o.getEdgeData([t.id,e.id]))):s;return[...c,...u,...h]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=t=>{var e;if("zIndex"===(null===(e=t.data)||void 0===e?void 0:e.stage))return;if(!this.validate(t))return void(this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear()));const n=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,n),this.labelElementsInView=n;const r=this.sortLabelElementsInView(this.labelElementsInView),{show:i,hide:o}=this.detectLabelCollision(r);for(let t=i.length-1;t>=0;t--)this.showLabel(i[t]);o.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=t=>{const e=t.getShape("label");e&&qh(e,"hidden"),this.hiddenElements.set(t.id,t)},this.showLabel=t=>{const e=t.getShape("label");e&&qh(e,"visible"),t.toFront(),this.hiddenElements.delete(t.id)},this.onTransform=De(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=t=>{this.enableToggle&&this.onToggleVisibility(t)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=t=>{this.onToggleVisibility(t),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const r=t[n];r.isVisible()&&r.getShape("label")&&e.push(r)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.on(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.on(t.GraphEvent.AFTER_DRAW,this.toggle),e.on(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.off(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.off(t.GraphEvent.AFTER_DRAW,this.toggle),e.off(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Qh.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const Jh=[0,0,0];function td(t,e){return t.map((t,n)=>t+e[n])}function ed(t,e){return t.map((t,n)=>t-e[n])}function nd(t,e){return"number"==typeof e?t.map(t=>t*e):t.map((t,n)=>t*e[n])}function rd(t,e){return"number"==typeof e?t.map(t=>t/e):t.map((t,n)=>t/e[n])}function id(t,e){return t.map(t=>t*e)}function od(t,e){return Math.sqrt(t.reduce((t,n,r)=>t+Math.pow(n-e[r]||0,2),0))}function ad(t,e){return t.reduce((t,n,r)=>t+Math.abs(n-e[r]),0)}function sd(t){const e=t.reduce((t,e)=>t+Math.pow(e,2),0);return t.map(t=>t/Math.sqrt(e))}function ld(t,e,n=!1){const r=t[0]*e[1]-t[1]*e[0];let i=Math.acos(nd(t,e).reduce((t,e)=>t+e,0)/(od(t,Jh)*od(e,Jh)));return n&&r<0&&(i=2*Math.PI-i),i}function cd(t,e=!0){return e?[-t[1],t[0]]:[t[1],-t[0]]}function ud(t,e){return t.map(t=>t%e)}function hd(t){return[t[0],t[1]]}function dd(t){return 2===t.length?[t[0],t[1],0]:t}function fd(t){const[e,n]=t;return e||n?Math.atan2(n,e):0}function pd(t,e){const[n,r]=t;if(e%360==0)return[n,r];const i=e*Math.PI/180,o=Math.cos(i),a=Math.sin(i);return[n*o-r*a,n*a+r*o]}function gd(t,e){const[n,r]=t,[i,o]=e;return function(t,e){const n=dd(t),r=dd(e);return[n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]}(ed(n,r),ed(i,o)).every(t=>0===t)}function vd(t,e,n=!1){if(gd(t,e))return;const[r,i]=t,[o,a]=e,s=((r[0]-o[0])*(o[1]-a[1])-(r[1]-o[1])*(o[0]-a[0]))/((r[0]-i[0])*(o[1]-a[1])-(r[1]-i[1])*(o[0]-a[0])),l=a[0]-o[0]?(r[0]-o[0]+s*(i[0]-r[0]))/(a[0]-o[0]):(r[1]-o[1]+s*(i[1]-r[1]))/(a[1]-o[1]);return n||lh(s,0,1)&&lh(l,0,1)?[r[0]+s*(i[0]-r[0]),r[1]+s*(i[1]-r[1])]:void 0}function md(t){if(Array.isArray(t))return lh(t[0],0,1)&&lh(t[1],0,1)?t:[.5,.5];const e=t.split("-");return[e.includes("left")?0:e.includes("right")?1:.5,e.includes("top")?0:e.includes("bottom")?1:.5]}function yd(t){const{x:e=0,y:n=0,z:r=0}=t.style||{};return[+e,+n,+r]}function bd(t){const{x:e,y:n,z:r}=t.style||{};return void 0!==e||void 0!==n||void 0!==r}function xd(t,e="center"){return function(t,e){const[n,r]=e,{min:i,max:o}=t;return[i[0]+n*(o[0]-i[0]),i[1]+r*(o[1]-i[1])]}(t,md(e))}function Ed(t){var e;return[t.x,t.y,null!==(e=t.z)&&void 0!==e?e:0]}function wd(t){var e;return{x:t[0],y:t[1],z:null!==(e=t[2])&&void 0!==e?e:0}}function kd(t,e=0){return t.map(t=>parseFloat(t.toFixed(e)))}function Md(t,e,n,r=!1){if(Te(t,e))return t;const i=sd(r?ed(t,e):ed(e,t)),o=[i[0]*n,i[1]*n];return td(hd(t),o)}function Sd(t,e){return t[1]===e[1]}function Nd(t,e){return Sd(t,e)||function(t,e){return t[0]===e[0]}(t,e)}function Td(t,e,n){return gd([t,e],[e,n])}function Od(t,e){return[2*e[0]-t[0],2*e[1]-t[1]]}function Cd(t,e,n,r=!0,i=!1){for(let o=0;o<n.length;o++){let a=n[o],s=n[(o+1)%n.length];r&&(a=td(e,a),s=td(e,s));const l=vd([e,i?Od(t,e):t],[a,s]);if(l)return{point:l,line:[a,s]}}return{point:e,line:void 0}}function Ad(t,e,n=!1){const r=e.center,i=ed(n?Od(t,r):t,e.center),o=Math.atan2(i[1],i[0]);if(isNaN(o))return r;const a=hh(e)/2,s=dh(e)/2;return[r[0]+a*Math.cos(o),r[1]+s*Math.sin(o)]}function Pd(t,e){let n=1/0,r=[[0,0],[0,0]];return e.forEach(e=>{const i=function(t,e){const n=Rd(t,e);return od(t,n)}(t,e);i<n&&(n=i,r=e)}),r}function Rd(t,e){const[n,r]=e[0],[i,o]=e[1],[a,s]=t,l=i-n,c=o-r;if(0===l&&0===c)return[n,r];let u=((a-n)*l+(s-r)*c)/(l*l+c*c);u>1?u=1:u<0&&(u=0);return[n+u*l,r+u*c]}function Dd(t,e=!0){const n=function(t){return rd(t.reduce((t,e)=>td(t,e),[0,0]),t.length)}(t);return t.sort(([t,r],[i,o])=>{const a=Math.atan2(r-n[1],t-n[0]),s=Math.atan2(o-n[1],i-n[0]);return e?s-a:a-s})}function Ld(t,e){return[t,[t[0],e[1]],e,[e[0],t[1]]]}class _d{constructor(t,e,n){if(this.phase=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,_d.instance)return _d.callbacks[this.phase].push(n),_d.instance;this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents(),_d.instance=this,_d.callbacks[this.phase].push(n)}bindEvents(){const{emitter:e}=this;e.on(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.on(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.on(t.CommonEvent.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const r=this.pointerByTouch.findIndex(e=>e.pointerId===t);r>=0&&(this.pointerByTouch[r]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client||{};if(void 0!==e&&void 0!==n&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),"touch"===t.pointerType&&2===this.pointerByTouch.length)){_d.isPinching=!0;const e=this.pointerByTouch[0].x-this.pointerByTouch[1].x,n=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(e*e+n*n),_d.callbacks.pinchstart.forEach(e=>e(t,{scale:0}))}}onPointerMove(t){if(2!==this.pointerByTouch.length||null===this.initialDistance)return;const{x:e,y:n}=t.client||{};if(void 0===e||void 0===n)return;this.updatePointerPosition(t.pointerId,e,n);const r=this.pointerByTouch[0].x-this.pointerByTouch[1].x,i=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(r*r+i*i)/this.initialDistance;_d.callbacks.pinchmove.forEach(e=>e(t,{scale:5*(o-1)}))}onPointerUp(t){var e;_d.callbacks.pinchend.forEach(e=>e(t,{scale:0})),_d.isPinching=!1,this.initialDistance=null,this.pointerByTouch=[],null===(e=_d.instance)||void 0===e||e.tryDestroy()}destroy(){this.emitter.off(t.CommonEvent.POINTER_DOWN,this.onPointerDown),this.emitter.off(t.CommonEvent.POINTER_MOVE,this.onPointerMove),this.emitter.off(t.CommonEvent.POINTER_UP,this.onPointerUp),_d.instance=null}off(t,e){const n=_d.callbacks[t].indexOf(e);n>-1&&_d.callbacks[t].splice(n,1),this.tryDestroy()}tryDestroy(){Object.values(_d.callbacks).every(t=>0===t.length)&&this.destroy()}}_d.isPinching=!1,_d.instance=null,_d.callbacks={pinchstart:[],pinchmove:[],pinchend:[]};const Id=t=>t.map(t=>ne(t)?t.toLocaleLowerCase():t);class jd{constructor(e){this.map=new Map,this.boundHandlePinch=()=>{},this.recordKey=new Set,this.onKeyDown=t=>{(null==t?void 0:t.key)&&(this.recordKey.add(t.key),this.trigger(t))},this.onKeyUp=t=>{(null==t?void 0:t.key)&&this.recordKey.delete(t.key)},this.onWheel=e=>{this.triggerExtendKey(t.CommonEvent.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(t.CommonEvent.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(t.CommonEvent.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=e,this.bindEvents()}bind(e,n){0!==e.length&&(e.includes(t.CommonEvent.PINCH)&&!this.pinchHandler&&(this.boundHandlePinch=this.handlePinch.bind(this),this.pinchHandler=new _d(this.emitter,"pinchmove",this.boundHandlePinch)),this.map.set(e,n))}unbind(t,e){this.map.forEach((n,r)=>{Te(r,t)&&(e&&e!==n||this.map.delete(r))})}unbindAll(){this.map.clear()}match(t){const e=Id(Array.from(this.recordKey)).sort(),n=Id(t).sort();return Te(e,n)}bindEvents(){var e;const{emitter:n}=this;n.on(t.CommonEvent.KEY_DOWN,this.onKeyDown),n.on(t.CommonEvent.KEY_UP,this.onKeyUp),n.on(t.CommonEvent.WHEEL,this.onWheel),n.on(t.CommonEvent.DRAG,this.onDrag),null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,r)=>{r.includes(t)&&Te(Array.from(this.recordKey),r.filter(e=>e!==t))&&n(e)})}destroy(){var e,n;this.unbindAll(),this.emitter.off(t.CommonEvent.KEY_DOWN,this.onKeyDown),this.emitter.off(t.CommonEvent.KEY_UP,this.onKeyUp),this.emitter.off(t.CommonEvent.WHEEL,this.onWheel),this.emitter.off(t.CommonEvent.DRAG,this.onDrag),null===(e=this.pinchHandler)||void 0===e||e.off("pinchmove",this.boundHandlePinch),null===(n=globalThis.removeEventListener)||void 0===n||n.call(globalThis,"blur",this.onFocus)}}class Bd extends Zh{constructor(t,e){super(t,Me({},Bd.defaultOptions,e)),this.shortcut=new jd(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,r=Object.assign({},this.options.style);this.options.style.lineWidth&&(r.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new fc({id:"g6-brush-select",style:r}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:r}=this.options;this.endPoint=Fd(t,this.context.graph),null===(e=this.rectShape)||void 0===e||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&"default"===r&&this.updateElementsStates(Ld(this.startPoint,this.endPoint))}onPointerUp(t){this.startPoint&&(this.endPoint?(this.endPoint=Fd(t,this.context.graph),this.updateElementsStates(Ld(this.startPoint,this.endPoint)),this.clearBrush()):this.clearBrush())}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((t,e)=>Object.assign({},t,e.reduce((t,e)=>{var n;const r=null===(n=e.states||[])||void 0===n?void 0:n.filter(t=>t!==this.options.state);return t[Ih(e)]=r,t},{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:r,mode:i,onSelect:o}=this.options,a=this.selector(e,t,n);let s={};switch(i){case"union":a.forEach(t=>{s[t]=[...e.getElementState(t),r]});break;case"diff":a.forEach(t=>{const n=e.getElementState(t);s[t]=n.includes(r)?n.filter(t=>t!==r):[...n,r]});break;case"intersect":a.forEach(t=>{const n=e.getElementState(t);s[t]=n.includes(r)?[r]:[]});break;default:a.forEach(t=>{s[t]=[r]})}Ut(o)&&(s=o(s)),e.setElementState(s,this.options.animation)}selector(t,e,n){if(!n||0===n.length)return[];const r=[],i=t.getData();if(n.forEach(n=>{i[`${n}s`].forEach(n=>{const i=Ih(n);"hidden"!==t.getElementVisibility(i)&&function(t,e,n,r){const i=t[0],o=t[1];let a=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);const s=r-n;for(let t=0,r=s-1;t<s;r=t++){const s=e[t+n][0],l=e[t+n][1],c=e[r+n][0],u=e[r+n][1];l>o!=u>o&&i<(c-s)*(o-l)/(u-l)+s&&(a=!a)}return a}(t.getElementPosition(i),e)&&r.push(i)})}),n.includes("edge")){const t=i.edges;null==t||t.forEach(t=>{const{source:e,target:n}=t;r.includes(e)&&r.includes(n)&&r.push(Ih(t))})}return r}clearBrush(){var t;null===(t=this.rectShape)||void 0===t||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(t=>"drag"!==t))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}bindEvents(){const{graph:e}=this.context;e.on(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.on(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.on(t.CommonEvent.POINTER_UP,this.onPointerUp),e.on(t.CanvasEvent.CLICK,this.clearStates)}unbindEvents(){const{graph:e}=this.context;e.off(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.off(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.off(t.CommonEvent.POINTER_UP,this.onPointerUp),e.off(t.CanvasEvent.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=Me(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Bd.defaultOptions={animation:!1,enable:!0,enableElements:["node","combo","edge"],immediately:!1,mode:"default",state:"selected",trigger:["shift"],style:{width:0,height:0,lineWidth:1,fill:"#1677FF",stroke:"#1677FF",fillOpacity:.1,zIndex:2,pointerEvents:"none"}};const Fd=(t,e)=>{if(!("node"!==t.targetType&&"combo"!==t.targetType||t.nativeEvent.target instanceof HTMLCanvasElement)){const[n,r]=e.getCanvasByClient([t.client.x,t.client.y]);return[n,r]}return[t.canvas.x,t.canvas.y]},zd=.8,Gd=["node","edge","combo"];function Vd(t,e,n,r,i=0){"TB"===r&&e(t,i);const o=n(t);if(o)for(const t of o)Vd(t,e,n,r,i+1);"BT"===r&&e(t,i)}function Wd(t,e,n,r,i="both"){if("combo"===e||"node"===e)return Hd(t,n,r,i);const o=t.getEdgeData(n);if(!o)return[];const a=Hd(t,o.source,r-1,i),s=Hd(t,o.target,r-1,i);return Array.from(new Set([...a,...s,n]))}function Hd(t,e,n,r="both"){const i=new Set,o=new Set,a=new Set;return function(t,e,n){const r=[[t,0]];for(;r.length;){const[t,i]=r.shift();e(t,i);const o=n(t);if(o)for(const t of o)r.push([t,i+1])}}(e,(e,i)=>{i>n||(a.add(e),t.getRelatedEdgesData(e,r).forEach(t=>{const e=Ih(t);!o.has(e)&&i<n&&(a.add(e),o.add(e))}))},e=>t.getRelatedEdgesData(e,r).map(t=>t.source===e?t.target:t.source).filter(t=>!i.has(t)&&(i.add(t),!0))),Array.from(a)}function Ud(t){return t.states||[]}class $d extends Zh{constructor(t,e){super(t,Object.assign({},$d.defaultOptions,e)),this.onClickSelect=t=>Ge(this,void 0,void 0,function*(){var e,n;this.validate(t)&&(yield this.updateState(t),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))}),this.onClickCanvas=t=>Ge(this,void 0,void 0,function*(){var e,n;this.validate(t)&&(yield this.clearState(),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))}),this.shortcut=new jd(t.graph),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),Gd.forEach(n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)}),e.on(t.CanvasEvent.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:r}=this.context,{degree:i}=this.options;return Wd(r,n,e.id,"function"==typeof i?i(t):i).filter(t=>t!==e.id)}updateState(t){return Ge(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:r,animation:i}=this.options;if(!e&&!r&&!n)return;const{target:o}=t,{graph:a}=this.context,s=Ud(a.getElementData(o.id)).includes(e)?"unselect":"select",l={},c=this.isMultipleSelect,u=[o.id],h=this.getNeighborIds(t);if(c)if(Object.assign(l,this.getDataStates()),"select"===s){const t=(t,e)=>{t.forEach(t=>{const r=new Set(a.getElementState(t));r.add(e),r.delete(n),l[t]=Array.from(r)})};t(u,e),t(h,r),n&&Object.keys(l).forEach(t=>{const i=l[t];i.includes(e)||i.includes(r)||i.includes(n)||l[t].push(n)})}else{const t=l[o.id];l[o.id]=t.filter(t=>t!==e&&t!==r),t.includes(n)||l[o.id].push(n),h.forEach(t=>{l[t]=l[t].filter(t=>t!==r),l[t].includes(e)||l[t].push(n)})}else if("select"===s){Object.assign(l,this.getClearStates(!!n));const t=(t,e)=>{t.forEach(t=>{l[t]||(l[t]=a.getElementState(t)),l[t].push(e)})};t(u,e),t(h,r),n&&Object.keys(l).forEach(t=>{u.includes(t)||h.includes(t)||l[t].push(n)})}else Object.assign(l,this.getClearStates());yield a.setElementState(l,i)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:r}=t.getData(),i={};return[...e,...n,...r].forEach(t=>{i[Ih(t)]=Ud(t)}),i}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:r,neighborState:i}=this.options,o=new Set([n,r,i]),{nodes:a,edges:s,combos:l}=e.getData(),c={};return[...a,...s,...l].forEach(e=>{const n=Ud(e),r=n.filter(t=>!o.has(t));(t||r.length!==n.length)&&(c[Ih(e)]=r)}),c}clearState(){return Ge(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;Gd.forEach(n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)}),e.off(t.CanvasEvent.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}function Yd(t){var e;return!!(null===(e=t.style)||void 0===e?void 0:e.collapsed)}function qd(t,e){if(!t.startsWith(e))return!1;const n=t[e.length];return n>="A"&&n<="Z"}function Xd(t,e,n=!0){if(!e)return t;if(!qd(t,e))return t;const r=t.slice(e.length);return n?function(t){var e=he(t);return e.charAt(0).toLowerCase()+e.substring(1)}(r):r}function Kd(t,e){const n=Object.entries(t).reduce((t,[n,r])=>("className"===n||"class"===n||qd(n,e)&&Object.assign(t,{[Xd(n,e)]:r}),t),{});if("opacity"in t){const r=function(t,e){return`${e}${de(t)}`}("opacity",e),i=t.opacity;if(r in t){const e=t[r];Object.assign(n,{opacity:i*e})}else Object.assign(n,{opacity:i})}return n}function Zd(t,e){const n=e.length;return Object.keys(t).reduce((r,i)=>{if(i.startsWith(e)){r[i.slice(n)]=t[i]}return r},{})}function Qd(t,e){const n="string"==typeof e?[e]:e,r={};return Object.keys(t).forEach(e=>{n.find(t=>e.startsWith(t))||(r[e]=t[e])}),r}function Jd(t=0){if("number"==typeof t)return[t,t,t];const[e,n=e,r=e]=t;return[e,n,r]}function tf(t,e){const{datum:n,graph:r}=e;return"function"==typeof t?t.call(r,n):Object.fromEntries(Object.entries(t).map(([t,e])=>"function"==typeof e?[t,e.call(r,n)]:[t,e]))}function ef(t,e){const n=(null==t?void 0:t.style)||{},r=(null==e?void 0:e.style)||{};for(const t in n)t in r||(r[t]=n[t]);return Object.assign({},t,e,{style:r})}function nf(t){if(t)return"string"==typeof t||"function"==typeof t||Array.isArray(t)?{type:"group",field:t=>t.id,color:t,invert:!1}:t}function rf(t){const e="string"==typeof t?Wu("palette",t):t;if("function"!=typeof e)return e}function of(t,e){let n=2*t;return"string"==typeof e?n=t*Number(e.replace("%",""))/100:"number"==typeof e&&(n=e),isNaN(n)&&(n=2*t),n}function af(t,e,n=1,r=!1){const i=r?n:1;return of((t.max[0]-t.min[0])*i,e)}$d.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};class sf extends Jl{constructor(t){cf(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(e,n,r,i,o){var a,s,l,c,u,h,d,f;const p=this.shapeMap[e];if(!1===r)return void(p&&(null===(a=null==o?void 0:o.beforeDestroy)||void 0===a||a.call(o,p),i.removeChild(p),delete this.shapeMap[e],null===(s=null==o?void 0:o.afterDestroy)||void 0===s||s.call(o,p)));const g="string"==typeof n?Wu(t.ExtensionCategory.SHAPE,n):n;if(!g)throw new Error(Uu(`Shape ${n} not found`));if(!p||p.destroyed||!(p instanceof g)){p&&(null===(l=null==o?void 0:o.beforeDestroy)||void 0===l||l.call(o,p),null==p||p.destroy(),null===(c=null==o?void 0:o.afterDestroy)||void 0===c||c.call(o,p)),null===(u=null==o?void 0:o.beforeCreate)||void 0===u||u.call(o);const t=new g({className:e,style:r});return i.appendChild(t),this.shapeMap[e]=t,null===(h=null==o?void 0:o.afterCreate)||void 0===h||h.call(o,t),t}return null===(d=null==o?void 0:o.beforeUpdate)||void 0===d||d.call(o,p),nv(p,r),null===(f=null==o?void 0:o.afterUpdate)||void 0===f||f.call(o,p),p}update(t={}){const e=Object.assign({},this.attributes,t);cf(e),function(t,e){const{zIndex:n,transform:r,transformOrigin:i,visibility:o,cursor:a,clipPath:s,component:l}=e,c=ze(e,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(t.attributes,c),r&&t.setAttribute("transform",r);ae(n)&&t.setAttribute("zIndex",n);i&&t.setAttribute("transformOrigin",i);o&&t.setAttribute("visibility",o);a&&t.setAttribute("cursor",a);s&&t.setAttribute("clipPath",s);l&&t.setAttribute("component",l)}(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return function(t){const{x:e,y:n,z:r,class:i,className:o,transform:a,transformOrigin:s,zIndex:l,visibility:c}=t;return ze(t,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(0===t.length)return null;const n=[];if(void 0!==t[0].x||void 0!==t[0].y||void 0!==t[0].z){const{x:e=0,y:n=0,z:r=0}=this.attributes;t.forEach(t=>{const{x:i=e,y:o=n,z:a=r}=t;Object.assign(t,{transform:a?[["translate3d",i,o,a]]:[["translate",i,o]]})})}const r=super.animate(t,e);if(r&&(lf(this,r),n.push(r)),Array.isArray(t)&&t.length>0){const r=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(t=>!r.includes(t))){Object.entries(this.shapeMap).forEach(([r,i])=>{const o=this[`get${de(r)}Style`];if(Ut(o)){const r=t.map(t=>o.call(this,Object.assign(Object.assign({},this.attributes),t))),a=i.animate(Xu(r),e);a&&(lf(i,a),n.push(a))}});const r=(r,i)=>{if(!Ne(r)){const o=this[`get${de(i)}Style`];if(Ut(o)){const i=t.map(t=>o.call(this,Object.assign(Object.assign({},this.attributes),t)));Object.entries(i[0]).map(([t])=>{const o=i.map(e=>e[t]),a=r[t];if(a){const t=a.animate(Xu(o),e);t&&(lf(a,t),n.push(t))}})}}};this.compositeShapes.forEach(([t,e])=>{const n=Zd(this.shapeMap,e);r(n,t)})}}return qu(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;qh(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function lf(t,e){null==e||e.finished.then(()=>{const n=t.activeAnimations.findIndex(t=>t===e);n>-1&&t.activeAnimations.splice(n,1)})}function cf(t){if(!t)return{};if("x"in t||"y"in t||"z"in t){const{x:e=0,y:n=0,z:r,transform:i}=t,o=Ju(e,n,r,i);o&&(t.transform=o)}return t}class uf extends sf{constructor(t){super(ef({style:uf.defaultStyleProps},t))}isTextStyle(t){return qd(t,"label")}isBackgroundStyle(t){return qd(t,"background")}getTextStyle(t){const e=this.getGraphicStyle(t),{padding:n}=e;return Qd(ze(e,["padding"]),"background")}getBackgroundStyle(t){if(!1===t.background)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:r,padding:i}=e,o=Kd(e,"background"),{min:[a,s],center:[l,c],halfExtents:[u,h]}=this.shapeMap.text.getGeometryBounds(),[d,f,p,g]=ch(i),v=2*u+g+f,{width:m,height:y}=o;m&&y?Object.assign(o,{x:l-Number(m)/2,y:c-Number(y)/2}):Object.assign(o,{x:a-g,y:s-d,width:n?Math.min(v,r+g+f):v,height:2*h+d+p});const{radius:b}=o;if("string"==typeof b&&b.endsWith("%")){const t=Number(b.replace("%",""))/100;o.radius=Math.min(+o.width,+o.height)*t}return o}render(t=this.parsedAttributes,e=this){this.upsert("text",gc,this.getTextStyle(t),e),this.upsert("background",fc,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}uf.defaultStyleProps={padding:0,fontSize:12,fontFamily:"system-ui, sans-serif",wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};class hf extends sf{constructor(t){super(ef({style:hf.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",uf,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}hf.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};const df={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};function ff(t){const e=[],n="string"==typeof t?function(t){const e=t.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),n=[];let r="",i={};for(;e.length>0;){let t=e.shift();t in df?r=t:e.unshift(t),i={type:r},df[r].forEach(n=>{t=e.shift(),i[n]=t}),"M"===r?r="L":"m"===r&&(r="l");const[o,...a]=Object.values(i);n.push([o,...a.map(Number)])}return n}(t):t;return n.forEach(t=>{const n=t[0];if("Z"!==n)if("A"!==n)for(let n=1;n<t.length;n+=2)e.push([t[n],t[n+1],0]);else{const n=t.length;e.push([t[n-2],t[n-1],0])}else e.push(e[0])}),e}const pf=t=>{if(t.length<2)return[["M",0,0],["L",0,0]];const e=t[0],n=t[1],r=t[t.length-1],i=t[t.length-2];t.unshift(i,r),t.push(e,n);const o=[["M",r[0],r[1]]];for(let e=1;e<t.length-2;e+=1){const[n,r]=t[e-1],[i,a]=t[e],[s,l]=t[e+1],[c,u]=e!==t.length-2?t[e+2]:[s,l],h=i+(s-n)/6,d=a+(l-r)/6,f=s-(c-i)/6,p=l-(u-a)/6;o.push(["C",h,d,f,p,s,l])}return o};class gf extends sf{constructor(t){super(ef({style:gf.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||0===t.d.length)return!1;const e=Kd(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:r,offsetY:i,autoRotate:o,placement:a,closeToPath:s}=e,l=ze(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),c=this.shapeMap.key,u=null==c?void 0:c.getRenderBounds();return Object.assign(function(t,e,n,r,i,o,a){const[s,l]=xd(t,e),c={textAlign:"left"===e?"right":"right"===e?"left":"center",textBaseline:"top"===e?"bottom":"bottom"===e?"top":"middle",transform:[["translate",s+n,l+r]]};if("center"===e||!i)return c;const u=ff(o);if(!u||u.length<=3)return c;const h=u.map((t,e)=>{const n=t,r=u[(e+1)%u.length];return Te(n,r)?null:[n,r]}).filter(Boolean),d=Pd([s,l],h),f=Rd([s,l],d);if(f&&d&&(c.transform=[["translate",f[0]+n,f[1]+r]],a)){const t=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));c.transform.push(["rotate",t/Math.PI*180]),c.textAlign="center","right"!==e&&"left"!==e||(c.textBaseline=t>0?"right"===e?"bottom":"top":"right"===e?"top":"bottom")}return c}(u,a,r,i,s,t.d,o),{wordWrapWidth:af(u,n)},l)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",lc,this.getKeyStyle(t),e),this.upsert("label",uf,this.getLabelStyle(t),e)}}gf.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};let vf=class extends ic{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},yf=this,this.isMutationObserved=!0,this.addEventListener(al.MOUNTED,this.onMounted),this.addEventListener(al.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:r=0}=this.attributes;if(t&&n&&r){const[i,o]=this.getBounds().min,a={x:i,y:o,radius:t,width:n,height:r};if(e)Object.assign(this.parsedStyle.clipPath.style,a);else{const t=new fc({style:a});this.style.clipPath=t}}else e&&(this.style.clipPath=null)}};const mf=new WeakMap;let yf=null;const bf=t=>{if(yf&&function(t){const e=[];let n=t.parentNode;for(;n;)e.push(n),n=n.parentNode;return e}(yf).includes(t)){const e=mf.get(t);e?e.includes(yf)||e.push(yf):mf.set(t,[yf])}},xf=t=>{const e=mf.get(t);e&&e.forEach(t=>t.handleRadius())};class Ef extends sf{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,r=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},r):Object.assign({textBaseline:"middle",textAlign:"center"},r)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?vf:gc,this.getIconStyle(t),e)}}class wf extends sf{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then(()=>this.onframe())),n}}class kf extends wf{constructor(t){super(ef({style:kf.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return Jd(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(Qd(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(!1===t.label||!t.labelText)return!1;const e=Kd(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:r,offsetX:i,offsetY:o}=e,a=ze(e,["placement","maxWidth","offsetX","offsetY"]),s=this.getShape("key").getLocalBounds();return Object.assign(tv(s,n,i,o),{wordWrapWidth:af(s,r)},a)}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getKeyStyle(t),{fill:n}=e,r=ze(e,["fill"]),i=Kd(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},r),{stroke:n}),i)}getIconStyle(t){if(!1===t.icon||!t.iconText&&!t.iconSrc)return!1;const e=Kd(this.getGraphicStyle(t),"icon");return Object.assign(function(t,e){const n=Jd(t);let r={};return e.text&&!e.fontSize&&(r={fontSize:.5*Math.min(...n)}),!e.src||e.width&&e.height||(r={width:.5*n[0],height:.5*n[1]}),r}(t.size,e),e)}getBadgesStyle(t){var e;const n=Zd(this.shapeMap,"badge-"),r={};if(Object.keys(n).forEach(t=>{r[t]=!1}),!1===t.badge||!(null===(e=t.badges)||void 0===e?void 0:e.length))return r;const{badges:i=[],badgePalette:o,opacity:a=1}=t,s=ze(t,["badges","badgePalette","opacity"]),l=rf(o),c=Kd(this.getGraphicStyle(s),"badge");return i.forEach((t,e)=>{r[e]=Object.assign(Object.assign({backgroundFill:l?l[e%(null==l?void 0:l.length)]:void 0,opacity:a},c),this.getBadgeStyle(t))}),r}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:r,offsetY:i}=t,o=ze(t,["placement","offsetX","offsetY"]),a=tv(e.getLocalBounds(),n,r,i,!0);return Object.assign(Object.assign({},a),o)}getPortsStyle(t){var e;const n=this.getPorts(),r={};if(Object.keys(n).forEach(t=>{r[t]=!1}),!1===t.port||!(null===(e=t.ports)||void 0===e?void 0:e.length))return r;const i=Kd(this.getGraphicStyle(t),"port"),{ports:o=[]}=t;return o.forEach((e,n)=>{const o=e.key||n,a=Object.assign(Object.assign({},i),e);if(qg(a))r[o]=!1;else{const[n,i]=this.getPortXY(t,e);r[o]=Object.assign({transform:[["translate",n,i]]},a)}}),r}getPortXY(t,e){const{placement:n="left"}=e,r=this.getShape("key");return $g(function(t,e){if(!t)return e.getLocalBounds();const n=t.canvas.getLayer(),r=e.cloneNode();qh(r,"hidden"),n.appendChild(r);const i=r.getLocalBounds();return r.destroy(),i}(this.context,r),n)}getPorts(){return Zd(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){return function(t,e,n=!1){return Cd(t,xd(e,"center"),[xd(e,"left-top"),xd(e,"right-top"),xd(e,"right-bottom"),xd(e,"left-bottom")],!1,n).point}(t,this.getShape("key").getBounds(),e)}drawHaloShape(t,e){const n=this.getHaloStyle(t),r=this.getShape("key");this.upsert("halo",r.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);this.upsert("icon",Ef,n,e),bf(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(t=>{const r=n[t];this.upsert(`badge-${t}`,hf,r,e)})}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach(t=>{const r=n[t],i=`port-${t}`;this.upsert(i,Zl,r,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",uf,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&xf(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}kf.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};let Mf=class t extends kf{constructor(e){super(ef({style:t.defaultStyleProps},e))}drawKeyShape(t,e){return this.upsert("key",Zl,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,r=2*n*zd;return!!e&&Object.assign({width:r,height:r},e)}getIntersectPoint(t,e=!1){return Ad(t,this.getShape("key").getBounds(),e)}};Mf.defaultStyleProps={size:32};class Sf extends kf{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",uc,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,r;const{points:i}=this.getShape("key").attributes;return Cd(t,[+((null===(n=this.attributes)||void 0===n?void 0:n.x)||0),+((null===(r=this.attributes)||void 0===r?void 0:r.y)||0)],i,!0,e).point}}class Nf extends Sf{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return function(t,e){return[[0,-e/2],[t/2,0],[0,e/2],[-t/2,0]]}(e,n)}}class Tf extends Mf{constructor(t){super(ef({style:Tf.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...Jd(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return ne(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(null==n?void 0:n.length))return;const r=n.map(t=>ae(t)?{value:t}:t),i=Kd(this.getGraphicStyle(t),"donut"),o=rf(t.donutPalette);if(!o)return;const a=r.reduce((t,e)=>{var n;return t+(null!==(n=e.value)&&void 0!==n?n:0)},0),s=this.parseOuterR(),l=this.parseInnerR();let c=0;r.forEach((t,n)=>{const{value:u=0,color:h=o[n%o.length]}=t,d=ze(t,["value","color"]),f=360*(0===a?1/r.length:u/a);this.upsert(`round${n}`,lc,Object.assign(Object.assign(Object.assign({},i),{d:Cf(s,l,c,c+f),fill:h}),d),e),c+=f})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}Tf.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const Of=(t,e,n,r)=>[t+Math.sin(r)*n,e-Math.cos(r)*n],Cf=(t=0,e=0,n,r)=>{const[i,o]=[0,0];return Math.abs(n-r)%360<1e-6?((t,e,n,r)=>r<=0||n<=r?[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"]]:[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"],["M",t+r,e],["A",r,r,0,1,0,t-r,e],["A",r,r,0,1,0,t+r,e],["Z"]])(i,o,t,e):((t,e,n,r,i,o)=>{const[a,s]=[i/360*2*Math.PI,o/360*2*Math.PI],l=[Of(t,e,r,a),Of(t,e,n,a),Of(t,e,n,s),Of(t,e,r,s)],c=s-a>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",n,n,0,c,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",r,r,0,c,0,l[0][0],l[0][1]],["Z"]]})(i,o,t,e,n,r)};class Af extends kf{constructor(t){super(ef({style:Af.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",tc,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:r/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:r}=this.getShape("key").attributes,i=2*Math.min(+n,+r)*zd;return!!e&&Object.assign({width:i,height:i},e)}getIntersectPoint(t,e=!1){return Ad(t,this.getShape("key").getBounds(),e)}}Af.defaultStyleProps={size:[45,35]};class Pf extends Sf{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return[[0,e=this.getOuterR(t)],[e*Math.sqrt(3)/2,e/2],[e*Math.sqrt(3)/2,-e/2],[0,-e],[-e*Math.sqrt(3)/2,-e/2],[-e*Math.sqrt(3)/2,e/2]];var e}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*zd;return!!e&&Object.assign({width:n,height:n},e)}}
/*!
* @antv/g-plugin-canvas-path-generator
* @description A G plugin of path generator with Canvas2D API
* @version 2.1.22
* @date 7/30/2025, 1:35:25 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function Rf(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,a=e.r;t.arc(r,o,a,0,2*Math.PI,!1)}function Df(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,a=e.rx,s=e.ry;if(t.ellipse)t.ellipse(r,o,a,s,0,0,2*Math.PI,!1);else{var l=a>s?a:s,c=a>s?1:a/s,u=a>s?s/a:1;t.save(),t.scale(c,u),t.arc(r,o,l,0,2*Math.PI)}}function Lf(t,e){var n,r,i=e.x1,o=e.y1,a=e.x2,s=e.y2,l=e.markerStart,c=e.markerEnd,u=e.markerStartOffset,h=e.markerEndOffset,d=0,f=0,p=0,g=0,v=0;l&&Ul(l)&&u&&(n=a-i,r=s-o,v=Math.atan2(r,n),d=Math.cos(v)*(u||0),f=Math.sin(v)*(u||0)),c&&Ul(c)&&h&&(n=i-a,r=o-s,v=Math.atan2(r,n),p=Math.cos(v)*(h||0),g=Math.sin(v)*(h||0)),t.moveTo(i+d,o+f),t.lineTo(a+p,s+g)}function _f(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,l=e.d,c=l.absolutePath,u=l.segments,h=0,d=0,f=0,p=0,g=0;if(i&&Ul(i)&&a){var v=b(i.parentNode.getStartTangent(),2),m=v[0],y=v[1];n=m[0]-y[0],r=m[1]-y[1],g=Math.atan2(r,n),h=Math.cos(g)*(a||0),d=Math.sin(g)*(a||0)}if(o&&Ul(o)&&s){var x=b(o.parentNode.getEndTangent(),2),E=x[0],w=x[1];n=E[0]-w[0],r=E[1]-w[1],g=Math.atan2(r,n),f=Math.cos(g)*(s||0),p=Math.sin(g)*(s||0)}for(var k=0;k<c.length;k++){var M=c[k],S=M[0],N=c[k+1],T=0===k&&(0!==h||0!==d),O=(k===c.length-1||N&&("M"===N[0]||"Z"===N[0]))&&0!==f&&0!==p,C=b(T?[h,d]:[0,0],2),A=C[0],P=C[1],R=b(O?[f,p]:[0,0],2),D=R[0],L=R[1];switch(S){case"M":t.moveTo(M[1]+A,M[2]+P);break;case"L":t.lineTo(M[1]+D,M[2]+L);break;case"Q":t.quadraticCurveTo(M[1],M[2],M[3]+D,M[4]+L);break;case"C":t.bezierCurveTo(M[1],M[2],M[3],M[4],M[5]+D,M[6]+L);break;case"A":var _=u[k].arcParams,I=_.cx,j=_.cy,B=_.rx,F=_.ry,z=_.startAngle,G=_.endAngle,V=_.xRotation,W=_.sweepFlag;if(t.ellipse)t.ellipse(I,j,B,F,V,z,G,!!(1-W));else{var H=B>F?B:F,U=B>F?1:B/F,$=B>F?F/B:1;t.translate(I,j),t.rotate(V),t.scale(U,$),t.arc(0,0,H,z,G,!!(1-W)),t.scale(1/U,1/$),t.rotate(-V),t.translate(-I,-j)}O&&t.lineTo(M[6]+f,M[7]+p);break;case"Z":t.closePath()}}}function If(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,l=e.points.points,c=l.length,u=l[0][0],h=l[0][1],d=l[c-1][0],f=l[c-1][1],p=0,g=0,v=0,m=0,y=0;i&&Ul(i)&&a&&(n=l[1][0]-l[0][0],r=l[1][1]-l[0][1],y=Math.atan2(r,n),p=Math.cos(y)*(a||0),g=Math.sin(y)*(a||0)),o&&Ul(o)&&s&&(n=l[c-1][0]-l[0][0],r=l[c-1][1]-l[0][1],y=Math.atan2(r,n),v=Math.cos(y)*(s||0),m=Math.sin(y)*(s||0)),t.moveTo(u+(p||v),h+(g||m));for(var b=1;b<c-1;b++){var x=l[b];t.lineTo(x[0],x[1])}t.lineTo(d,f)}function jf(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,l=e.points.points,c=l.length,u=l[0][0],h=l[0][1],d=l[c-1][0],f=l[c-1][1],p=0,g=0,v=0,m=0,y=0;i&&Ul(i)&&a&&(n=l[1][0]-l[0][0],r=l[1][1]-l[0][1],y=Math.atan2(r,n),p=Math.cos(y)*(a||0),g=Math.sin(y)*(a||0)),o&&Ul(o)&&s&&(n=l[c-2][0]-l[c-1][0],r=l[c-2][1]-l[c-1][1],y=Math.atan2(r,n),v=Math.cos(y)*(s||0),m=Math.sin(y)*(s||0)),t.moveTo(u+p,h+g);for(var b=1;b<c-1;b++){var x=l[b];t.lineTo(x[0],x[1])}t.lineTo(d+v,f+m)}function Bf(t,e){var n=e.x,r=void 0===n?0:n,i=e.y,o=void 0===i?0:i,a=e.radius,s=e.width,l=e.height,c=s,u=l;if(a&&a.some(function(t){return 0!==t})){var h=s>0?1:-1,d=l>0?1:-1,f=h+d===0,p=b(a.map(function(t){return oe(t,0,Math.min(Math.abs(c)/2,Math.abs(u)/2))}),4),g=p[0],v=p[1],m=p[2],y=p[3];t.moveTo(h*g+r,o),t.lineTo(c-h*v+r,o),0!==v&&t.arc(c-h*v+r,d*v+o,v,-d*Math.PI/2,h>0?0:Math.PI,f),t.lineTo(c+r,u-d*m+o),0!==m&&t.arc(c-h*m+r,u-d*m+o,m,h>0?0:Math.PI,d>0?Math.PI/2:1.5*Math.PI,f),t.lineTo(h*y+r,u+o),0!==y&&t.arc(h*y+r,u-d*y+o,y,d>0?Math.PI/2:-Math.PI/2,h>0?Math.PI:0,f),t.lineTo(r,d*g+o),0!==g&&t.arc(h*g+r,d*g+o,g,h>0?Math.PI:0,d>0?1.5*Math.PI:Math.PI/2,f)}else t.rect(r,o,c,u)}var Ff=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).name="canvas-path-generator",t}return y(e,t),c(e,[{key:"init",value:function(){var t,e=(i(i(i(i(i(i(i(i(i(i(t={},pr.CIRCLE,Rf),pr.ELLIPSE,Df),pr.RECT,Bf),pr.LINE,Lf),pr.POLYLINE,jf),pr.POLYGON,If),pr.PATH,_f),pr.TEXT,void 0),pr.GROUP,void 0),pr.IMAGE,void 0),i(i(i(t,pr.HTML,void 0),pr.MESH,void 0),pr.FRAGMENT,void 0));this.context.pathGeneratorFactory=e}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(vr),zf=ht(),Gf=ht(),Vf=ht(),Wf=O(),Hf=function(){function t(){var e=this;s(this,t),this.isHit=function(t,n,r,i){var o=e.context.pointInPathPickerFactory[t.nodeName];if(o){var a=_(Wf,r),s=Mt(Gf,vt(Vf,n[0],n[1],0),a);if(o(t,new Or(s[0],s[1]),i,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,n){var r=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),i=e.context.pathGeneratorFactory[t.nodeName];return i&&(r.beginPath(),i(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return c(t,[{key:"apply",value:function(e,n){var r,i=this,o=e.renderingService,a=e.renderingContext;this.context=e,this.runtime=n;var s=null===(r=a.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,function(){var t=cr(sr().mark(function t(e){return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",i.pick(s,e));case 1:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),o.hooks.pickSync.tap(t.tag,function(t){return i.pick(s,t)})}},{key:"pick",value:function(t,e){var n,r=e.topmost,i=e.position,o=i.x,a=i.y,s=vt(zf,o,a,0),l=[],c=ur(t.elementsFromBBox(s[0],s[1],s[0],s[1]));try{for(c.s();!(n=c.n()).done;){var u=n.value,h=u.getWorldTransform();if(this.isHit(u,s,h,!1)){var d=es(u);if(d){var f=d.parsedStyle.clipPath;if(this.isHit(f,s,f.getWorldTransform(),!0)){if(r)return e.picked=[u],e;l.push(u)}}else{if(r)return e.picked=[u],e;l.push(u)}}}}catch(t){c.e(t)}finally{c.f()}return e.picked=l,e}}])}();
/*!
* @antv/g-plugin-canvas-picker
* @description A G plugin for picking in canvas
* @version 2.1.27
* @date 7/30/2025, 1:37:32 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function Uf(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,a=r.cy,s=void 0===a?0:a,l=r.r,c=r.fill,u=r.stroke,h=r.lineWidth,d=void 0===h?1:h,f=r.increasedLineWidthForHitTesting,p=void 0===f?0:f,g=r.pointerEvents,v=void 0===g?"auto":g,m=(d+p)/2,y=_n(o,s,e.x,e.y),x=b(as(v,c,u),2),E=x[0],w=x[1];return E&&w||n?y<=l+m:E?y<=l:!!w&&(y>=l-m&&y<=l+m)}function $f(t,e,n,r){return t/(n*n)+e/(r*r)}function Yf(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,a=r.cy,s=void 0===a?0:a,l=r.rx,c=r.ry,u=r.fill,h=r.stroke,d=r.lineWidth,f=void 0===d?1:d,p=r.increasedLineWidthForHitTesting,g=void 0===p?0:p,v=r.pointerEvents,m=void 0===v?"auto":v,y=e.x,x=e.y,E=b(as(m,u,h),2),w=E[0],k=E[1],M=(f+g)/2,S=(y-o)*(y-o),N=(x-s)*(x-s);return w&&k||n?$f(S,N,l+M,c+M)<=1:w?$f(S,N,l,c)<=1:!!k&&($f(S,N,l-M,c-M)>=1&&$f(S,N,l+M,c+M)<=1)}function qf(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function Xf(t,e,n,r,i,o,a,s){var l=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI),c={x:t+n*Math.cos(l),y:e+n*Math.sin(l)};return _n(c.x,c.y,a,s)<=o/2}function Kf(t,e,n,r,i,o,a){var s=Math.min(t,n),l=Math.max(t,n),c=Math.min(e,r),u=Math.max(e,r),h=i/2;return o>=s-h&&o<=l+h&&a>=c-h&&a<=u+h&&Wn(t,e,n,r,o,a)<=i/2}function Zf(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var a=0;a<o-1;a++){if(Kf(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(i){var s=t[0],l=t[o-1];if(Kf(s[0],s[1],l[0],l[1],e,n,r))return!0}return!1}Hf.tag="CanvasPicker";function Qf(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function Jf(t,e,n){return(n[0]-t[0])*(e[1]-t[1])===(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function tp(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o<i;o++){var a=t[o],s=t[(o+1)%i];if(Jf(a,s,[e,n]))return!0;Qf(a[1]-n)>0!=Qf(s[1]-n)>0&&Qf(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}function ep(t,e,n){for(var r=!1,i=0;i<t.length;i++){if(r=tp(t[i],e,n))break}return r}function np(t,e,n){var r=t.parsedStyle,i=r.x1,o=r.y1,a=r.x2,s=r.y2,l=r.lineWidth,c=void 0===l?1:l,u=r.increasedLineWidthForHitTesting,h=void 0===u?0:u,d=r.pointerEvents;return!(!b(as(void 0===d?"auto":d,r.fill,r.stroke),2)[1]&&!n||!c)&&Kf(i,o,a,s,c+h,e.x,e.y)}function rp(t,e,n,r,i,o){var a=t.parsedStyle,s=a.lineWidth,l=void 0===s?1:s,c=a.increasedLineWidthForHitTesting,u=void 0===c?0:c,h=a.stroke,d=a.fill,f=a.d,p=a.pointerEvents,g=void 0===p?"auto":p,v=f.segments,m=f.hasArc,y=f.polylines,x=f.polygons,E=b(as(g,(null==x?void 0:x.length)&&d,h),2),w=E[0],k=E[1],M=Yo(t),S=!1;return w||n?S=m?r(t,e):ep(x,e.x,e.y)||ep(y,e.x,e.y):((k||n)&&(S=function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;s<t.length;s++){var l=t[s],c=l.currentPoint,u=l.params,h=l.prePoint,d=l.box;if(!d||qf(d.x-a,d.y-a,d.width+e,d.height+e,n,r))switch(l.command){case"L":case"Z":if(o=Kf(h[0],h[1],c[0],c[1],e,n,r))return!0;break;case"Q":if(o=Qn(h[0],h[1],u[1],u[2],u[3],u[4],n,r)<=e/2)return!0;break;case"C":if(o=Yn(h[0],h[1],u[1],u[2],u[3],u[4],u[5],u[6],n,r,i)<=e/2)return!0;break;case"A":l.cubicParams||(l.cubicParams=fn(h[0],h[1],u[1],u[2],u[3],u[4],u[5],u[6],u[7],void 0));for(var f=l.cubicParams,p=h,g=0;g<f.length;g+=6){var v=Yn(p[0],p[1],f[g],f[g+1],f[g+2],f[g+3],f[g+4],f[g+5],n,r,i);if(p=[f[g+4],f[g+5]],o=v<=e/2)return!0}}}return o}(v,l+u,e.x,e.y,M)),S)}function ip(t,e,n){var r=t.parsedStyle,i=r.stroke,o=r.fill,a=r.lineWidth,s=void 0===a?1:a,l=r.increasedLineWidthForHitTesting,c=void 0===l?0:l,u=r.points,h=r.pointerEvents,d=b(as(void 0===h?"auto":h,o,i),2),f=d[0],p=!1;return(d[1]||n)&&(p=Zf(u.points,s+c,e.x,e.y,!0)),p||!f&&!n||(p=tp(u.points,e.x,e.y)),p}function op(t,e,n){var r=t.parsedStyle,i=r.lineWidth,o=void 0===i?1:i,a=r.increasedLineWidthForHitTesting,s=void 0===a?0:a,l=r.points,c=r.pointerEvents;return!(!b(as(void 0===c?"auto":c,r.fill,r.stroke),2)[1]&&!n||!o)&&Zf(l.points,o+s,e.x,e.y,!1)}function ap(t,e,n,r,i){var o=t.parsedStyle,a=o.radius,s=o.fill,l=o.stroke,c=o.lineWidth,u=void 0===c?1:c,h=o.increasedLineWidthForHitTesting,d=void 0===h?0:h,f=o.x,p=void 0===f?0:f,g=o.y,v=void 0===g?0:g,m=o.width,y=o.height,x=o.pointerEvents,E=b(as(void 0===x?"auto":x,s,l),2),w=E[0],k=E[1],M=u+d;if(a&&a.some(function(t){return 0!==t})){var S=!1;return(k||n)&&(S=function(t,e,n,r,i,o,a,s){var l=b(i,4),c=l[0],u=l[1],h=l[2],d=l[3];return Kf(t+c,e,t+n-u,e,o,a,s)||Kf(t+n,e+u,t+n,e+r-h,o,a,s)||Kf(t+n-h,e+r,t+d,e+r,o,a,s)||Kf(t,e+r-d,t,e+c,o,a,s)||Xf(t+n-u,e+u,u,Math.PI,Math.PI,o,a,s)||Xf(t+n-h,e+r-h,h,0,Math.PI,o,a,s)||Xf(t+d,e+r-d,d,Math.PI,Math.PI,o,a,s)||Xf(t+c,e+c,c,Math.PI,Math.PI,o,a,s)}(p,v,m,y,a.map(function(t){return oe(t,0,Math.min(Math.abs(m)/2,Math.abs(y)/2))}),M,e.x,e.y)),S||!w&&!n||(S=r(t,e)),S}var N=M/2;return w&&k||n?qf(p-N,v-N,m+N,y+N,e.x,e.y):w?qf(p,v,m,y,e.x,e.y):!!k&&function(t,e,n,r,i,o,a){var s=i/2;return qf(t-s,e-s,n,i,o,a)||qf(t+n-s,e-s,i,r,o,a)||qf(t+s,e+r-s,n,i,o,a)||qf(t-s,e+s,i,r,o,a)}(p,v,m,y,M,e.x,e.y)}function sp(t,e,n,r,i,o){var s=t.parsedStyle,l=s.pointerEvents,c=void 0===l?"auto":l,u=s.x,h=void 0===u?0:u,d=s.y,f=void 0===d?0:d,p=s.width,g=s.height;if("non-transparent-pixel"===c){var v=i.config.offscreenCanvas,m=o.offscreenCanvasCreator.getOrCreateCanvas(v),y=o.offscreenCanvasCreator.getOrCreateContext(v,{willReadFrequently:!0});return m.width=p,m.height=g,i.defaultStyleRendererFactory[pr.IMAGE].render(y,a(a({},t.parsedStyle),{},{x:0,y:0}),t,void 0,void 0,void 0),y.getImageData(e.x-h,e.y-f,1,1).data.every(function(t){return 0!==t})}return!0}function lp(t,e,n,r){var i=t.getGeometryBounds();return e.x>=i.min[0]&&e.y>=i.min[1]&&e.x<=i.max[0]&&e.y<=i.max[1]}var cp=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).name="canvas-picker",t}return y(e,t),c(e,[{key:"init",value:function(){var t,e=(i(i(i(i(i(i(i(i(i(i(t={},pr.CIRCLE,Uf),pr.ELLIPSE,Yf),pr.RECT,ap),pr.LINE,np),pr.POLYLINE,op),pr.POLYGON,ip),pr.PATH,rp),pr.TEXT,lp),pr.GROUP,null),pr.IMAGE,sp),i(i(t,pr.HTML,null),pr.MESH,null));this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new Hf)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(vr);function up(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var hp=0;function dp(t){return"__private_"+hp+++"_"+t}
/*!
* @antv/g-plugin-image-loader
* @description A G plugin for loading image
* @version 2.1.26
* @date 7/30/2025, 1:35:52 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/var fp=function(){return c(function t(){s(this,t),this.cacheStore=new Map},[{key:"onRefAdded",value:function(t){}},{key:"has",value:function(t){return this.cacheStore.has(t)}},{key:"put",value:function(t,e,n){return!this.cacheStore.has(t)&&(this.cacheStore.set(t,{value:e,counter:new Set([n.entity])}),this.onRefAdded(n),!0)}},{key:"get",value:function(t,e){var n=this.cacheStore.get(t);return n?(n.counter.has(e.entity)||(n.counter.add(e.entity),this.onRefAdded(e)),n.value):null}},{key:"update",value:function(t,e,n){var r=this.cacheStore.get(t);return!!r&&(r.value=a(a({},r.value),e),r.counter.has(n.entity)||(r.counter.add(n.entity),this.onRefAdded(n)),!0)}},{key:"release",value:function(t,e){var n=this.cacheStore.get(t);return!!n&&(n.counter.delete(e.entity),n.counter.size<=0&&this.cacheStore.delete(t),!0)}},{key:"releaseRef",value:function(t){var e=this;Array.from(this.cacheStore.keys()).forEach(function(n){e.release(n,t)})}},{key:"getSize",value:function(){return this.cacheStore.size}},{key:"clear",value:function(){this.cacheStore.clear()}}])}(),pp=[],gp=[],vp=function(){function t(){s(this,t)}return c(t,null,[{key:"stop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.api;t.rafId&&(e.cancelAnimationFrame(t.rafId),t.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.api;pp.length<=0&&gp.length<=0||(gp.forEach(function(t){return t()}),gp=pp.splice(0,t.TASK_NUM_PER_FRAME),t.rafId=e.requestAnimationFrame(function(){t.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,r,i){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:t.api,s=e.naturalWidth||e.width,l=e.naturalHeight||e.height,c=n-o,u=r-o,h=Math.ceil(s/c),d=Math.ceil(l/u),f={tileSize:[n,r],gridSize:[d,h],tiles:Array(d).fill(null).map(function(){return Array(h).fill(null)})},p=function(t){for(var o=function(o){pp.push(function(){var h=o*c,d=t*u,p=[Math.min(n,s-h),Math.min(r,l-d)],g=p[0],v=p[1],m=a.createCanvas();m.width=n,m.height=r,m.getContext("2d").drawImage(e,h,d,g,v,0,0,g,v),f.tiles[t][o]={x:h,y:d,tileX:o,tileY:t,data:m},i()})},d=0;d<h;d++)o(d)},g=0;g<d;g++)p(g);return t.stop(),t.executeTask(),f}}])}();vp.TASK_NUM_PER_FRAME=10;var mp=new fp;mp.onRefAdded=function(t){var e=this;t.addEventListener(al.DESTROY,function(){e.releaseRef(t)},{once:!0})};var yp=function(){return c(function t(e,n){s(this,t),this.gradientCache={},this.patternCache={},this.context=e,this.runtime=n},[{key:"getImageSync",value:function(t,e,n){var r=ne(t)?t:t.src;if(mp.has(r)){var i=mp.get(r,e);if(i.img.complete)return null==n||n(i),i}return this.getOrCreateImage(t,e).then(function(t){null==n||n(t)}).catch(function(t){console.error(t)}),null}},{key:"getOrCreateImage",value:function(t,e){var n=this,r=ne(t)?t:t.src;if(!ne(t)&&!mp.has(r)){var i={img:t,size:[t.naturalWidth||t.width,t.naturalHeight||t.height],tileSize:bp(t)};mp.put(r,i,e)}if(mp.has(r)){var o=mp.get(r,e);return o.img.complete?Promise.resolve(o):new Promise(function(t,e){o.img.addEventListener("load",function(){o.size=[o.img.naturalWidth||o.img.width,o.img.naturalHeight||o.img.height],o.tileSize=bp(o.img),t(o)}),o.img.addEventListener("error",function(t){e(t)})})}return new Promise(function(t,i){var o=n.context.config.createImage();if(o){var a={img:o,size:[0,0],tileSize:bp(o)};mp.put(r,a,e),o.onload=function(){a.size=[o.naturalWidth||o.width,o.naturalHeight||o.height],a.tileSize=bp(a.img),t(a)},o.onerror=function(t){i(t)},o.crossOrigin="Anonymous",o.src=r}})}},{key:"createDownSampledImage",value:(e=cr(sr().mark(function t(e,n){var r,i,o,s,l,c,u,h,d,f,p,g,v,m;return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,this.getOrCreateImage(e,n);case 1:if(void 0===(r=t.sent).downSamplingRate){t.next=2;break}return t.abrupt("return",r);case 2:if(i=this.context.config.enableLargeImageOptimization,s=(o="boolean"==typeof i?{}:i).maxDownSampledImageSize,l=void 0===s?2048:s,c=o.downSamplingRateThreshold,u=void 0===c?.5:c,h=this.runtime.globalThis.createImageBitmap,d=b(r.size,2),f=d[0],p=d[1],g=r.img,v=Math.min((l+l)/(f+p),Math.max(.01,Math.min(u,.5))),m=a(a({},r),{},{downSamplingRate:v}),mp.update(r.img.src,m,n),!h){t.next=7;break}return t.prev=3,t.next=4,h(r.img,{resizeWidth:f*v,resizeHeight:p*v});case 4:g=t.sent,t.next=6;break;case 5:t.prev=5,t.catch(3),v=1;case 6:t.next=8;break;case 7:v=1;case 8:return m=a(a({},this.getImageSync(e,n)),{},{downSampled:g,downSamplingRate:v}),mp.update(r.img.src,m,n),t.abrupt("return",m);case 9:case"end":return t.stop()}},t,this,[[3,5]])})),function(t,n){return e.apply(this,arguments)})},{key:"createImageTiles",value:(t=cr(sr().mark(function t(e,n,r,i){var o,s,l,c,u;return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,this.getOrCreateImage(e,i);case 1:return o=t.sent,s=i.ownerDocument.defaultView,l=s.requestAnimationFrame,c=s.cancelAnimationFrame,vp.api={requestAnimationFrame:l,cancelAnimationFrame:c,createCanvas:function(){return el.createCanvas()}},u=a(a({},o),vp.sliceImage(o.img,o.tileSize[0],o.tileSize[0],r)),mp.update(o.img.src,u,i),t.abrupt("return",u);case 2:case"end":return t.stop()}},t,this)})),function(e,n,r,i){return t.apply(this,arguments)})},{key:"releaseImage",value:function(t,e){mp.release(ne(t)?t:t.src,e)}},{key:"releaseImageRef",value:function(t){mp.releaseRef(t)}},{key:"getOrCreatePatternSync",value:function(t,e,n,r,i,o,a){var s=this.generatePatternKey(e);if(s&&this.patternCache[s])return this.patternCache[s];var l,c=e.image,u=e.repetition,h=e.transform,d=!1;if(ne(c)){var f=this.getImageSync(c,t,a);l=null==f?void 0:f.img}else r?(l=r,d=!0):l=c;var p,g=l&&n.createPattern(l,u);g&&(p=h?Ls(ga(h),new Kl({})):D(O()),d&&F(p,p,[1/i,1/i,1]),g.setTransform({a:p[0],b:p[1],c:p[4],d:p[5],e:p[12]+o[0],f:p[13]+o[1]}));return s&&g&&(this.patternCache[s]=g),g}},{key:"getOrCreateGradient",value:function(t,e){var n=this.generateGradientKey(t),r=t.type,i=t.steps,o=t.min,a=t.width,s=t.height,l=t.angle,c=t.cx,u=t.cy,h=t.size;if(this.gradientCache[n])return this.gradientCache[n];var d=null;if(r===to.LinearGradient){var f=function(t,e,n,r){var i=Ir(r.value),o=0+e/2,a=0+n/2,s=Math.abs(e*Math.cos(i))+Math.abs(n*Math.sin(i));return{x1:t[0]+o-Math.cos(i)*s/2,y1:t[1]+a-Math.sin(i)*s/2,x2:t[0]+o+Math.cos(i)*s/2,y2:t[1]+a+Math.sin(i)*s/2}}(o,a,s,l),p=f.x1,g=f.y1,v=f.x2,m=f.y2;d=e.createLinearGradient(p,g,v,m)}else if(r===to.RadialGradient){var y=function(t,e,n,r,i,o){var a=r.value,s=i.value;r.unit===Wi.kPercentage&&(a=r.value/100*e),i.unit===Wi.kPercentage&&(s=i.value/100*n);var l=Math.max(yn([0,0],[a,s]),yn([0,n],[a,s]),yn([e,n],[a,s]),yn([e,0],[a,s]));return o&&(o instanceof io?l=o.value:o instanceof no&&("closest-side"===o.value?l=Math.min(a,e-a,s,n-s):"farthest-side"===o.value?l=Math.max(a,e-a,s,n-s):"closest-corner"===o.value&&(l=Math.min(yn([0,0],[a,s]),yn([0,n],[a,s]),yn([e,n],[a,s]),yn([e,0],[a,s]))))),{x:a+t[0],y:s+t[1],r:l}}(o,a,s,c,u,h),b=y.x,x=y.y,E=y.r;d=e.createRadialGradient(b,x,0,b,x,E)}return d&&(i.forEach(function(t){var e,n=t.offset,r=t.color;n.unit===Wi.kPercentage&&(null===(e=d)||void 0===e||e.addColorStop(n.value/100,r.toString()))}),this.gradientCache[n]=d),this.gradientCache[n]}},{key:"generateGradientKey",value:function(t){var e=t.type,n=t.min,r=t.width,i=t.height,o=t.steps,a=t.angle,s=t.cx,l=t.cy,c=t.size;return"gradient-".concat(e,"-").concat((null==a?void 0:a.toString())||0,"-").concat((null==s?void 0:s.toString())||0,"-").concat((null==l?void 0:l.toString())||0,"-").concat((null==c?void 0:c.toString())||0,"-").concat(n[0],"-").concat(n[1],"-").concat(r,"-").concat(i,"-").concat(o.map(function(t){var e=t.offset,n=t.color;return"".concat(e).concat(n)}).join("-"))}},{key:"generatePatternKey",value:function(t){var e=t.image,n=t.repetition;return ne(e)?"pattern-".concat(e,"-").concat(n):"rect"===e.nodeName?"pattern-".concat(e.entity,"-").concat(n):void 0}}]);var t,e}();function bp(t){if(!t.complete)return[0,0];var e=t.naturalWidth||t.width,n=t.naturalHeight||t.height,r=256;return[256,512].forEach(function(t){Math.ceil(n/t)*Math.ceil(e/t)<1e3&&(r=t)}),[r,r]}yp.isSupportTile=!!el.createCanvas();var xp=function(){function t(){s(this,t)}return c(t,[{key:"apply",value:function(e){var n=e.renderingService,r=e.renderingContext,i=e.imagePool,o=r.root.ownerDocument.defaultView,a=function(t,e,n){var r=t.parsedStyle,i=r.width,o=r.height;i&&!o?t.setAttribute("height",n/e*i):!i&&o&&t.setAttribute("width",e/n*o)},s=function(t){var e=t.target,r=e.nodeName,o=e.attributes;if(r===pr.IMAGE){var s=o.src,l=o.keepAspectRatio;i.getImageSync(s,e,function(t){var r=t.img,i=r.width,o=r.height;l&&a(e,i,o),e.renderable.dirty=!0,n.dirtify()})}},l=function(t){var e=t.target,r=t.attrName,o=t.prevValue,s=t.newValue;e.nodeName===pr.IMAGE&&"src"===r&&(o!==s&&i.releaseImage(o,e),ne(s)&&i.getOrCreateImage(s,e).then(function(t){var r=t.img,i=r.width,o=r.height;e.attributes.keepAspectRatio&&a(e,i,o),e.renderable.dirty=!0,n.dirtify()}).catch(function(){}))};n.hooks.init.tap(t.tag,function(){o.addEventListener(al.MOUNTED,s),o.addEventListener(al.ATTR_MODIFIED,l)}),n.hooks.destroy.tap(t.tag,function(){o.removeEventListener(al.MOUNTED,s),o.removeEventListener(al.ATTR_MODIFIED,l)})}}])}();xp.tag="LoadImage";var Ep=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).name="image-loader",t}return y(e,t),c(e,[{key:"init",value:function(t){this.context.imagePool=new yp(this.context,t),this.addRenderingPlugin(new xp)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(vr),wp=dp("renderState"),kp=function(){function t(e){s(this,t),this.removedRBushNodeAABBs=[],this.renderQueue=[],Object.defineProperty(this,wp,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=O(),this.dprMatrix=O(),this.tmpMat4=O(),this.vec3a=ht(),this.vec3b=ht(),this.vec3c=ht(),this.vec3d=ht(),this.canvasRendererPluginOptions=e}return c(t,[{key:"apply",value:function(e,n){var r=this;this.context=e;var i=this.context,o=i.config,a=i.camera,s=i.renderingService,l=i.renderingContext,c=i.rBushRoot,u=i.pathGeneratorFactory,h=o.renderer.getConfig().enableRenderingOptimization;o.renderer.getConfig().enableDirtyCheck=!1,o.renderer.getConfig().enableDirtyRectangleRendering=!1,this.rBush=c,this.pathGeneratorFactory=u;var f=e.contextService,p=l.root.ownerDocument.defaultView,g=function(t){var e=t.target.rBushNode;null!=e&&e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)},v=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)};s.hooks.init.tap(t.tag,function(){p.addEventListener(al.UNMOUNTED,g),p.addEventListener(al.CULLED,v);var t=f.getDPR(),e=o.width,n=o.height,i=f.getContext();r.clearRect(i,0,0,e*t,n*t,o.background)}),s.hooks.destroy.tap(t.tag,function(){p.removeEventListener(al.UNMOUNTED,g),p.removeEventListener(al.CULLED,v),r.renderQueue=[],r.removedRBushNodeAABBs=[],up(r,wp)[wp]={restoreStack:[],prevObject:null,currentContext:null}});var m=function(t,e){for(var i=[t];i.length>0;){var o,a=i.pop();a.isVisible()&&!a.isCulled()&&(h?r.renderDisplayObjectOptimized(a,e,r.context,up(r,wp)[wp],n):r.renderDisplayObject(a,e,r.context,up(r,wp)[wp],n));for(var s=(null===(o=a.sortable)||void 0===o||null===(o=o.sorted)||void 0===o?void 0:o.length)>0?a.sortable.sorted:a.childNodes,l=s.length-1;l>=0;l--)i.push(s[l])}};s.hooks.endFrame.tap(t.tag,function(){if(function(){var t,e=f.getContext(),n=f.getDPR(),i=o.width,a=o.height,l=r.canvasRendererPluginOptions,c=l.dirtyObjectNumThreshold,u=l.dirtyObjectRatioThreshold,h=s.getStats(),d=h.total,g=h.rendered,v=g/d;r.clearFullScreen=r.clearFullScreenLastFrame||!(null!==(t=p.context.renderingPlugins[1])&&void 0!==t&&t.isFirstTimeRenderingFinished)||s.disableDirtyRectangleRendering()||g>c&&v>u,e&&("function"==typeof e.resetTransform?e.resetTransform():e.setTransform(1,0,0,1,0,0),r.clearFullScreen&&r.clearRect(e,0,0,i*n,a*n,o.background))}(),0!==l.root.childNodes.length){h=o.renderer.getConfig().enableRenderingOptimization,up(r,wp)[wp]={restoreStack:[],prevObject:null,currentContext:up(r,wp)[wp].currentContext},up(r,wp)[wp].currentContext.clear(),r.clearFullScreenLastFrame=!1;var t=f.getContext(),e=f.getDPR();if(W(r.dprMatrix,[e,e,1]),j(r.vpMatrix,r.dprMatrix,a.getOrthoMatrix()),r.clearFullScreen)h?(t.save(),m(l.root,t),t.restore()):m(l.root,t),r.removedRBushNodeAABBs=[];else{var i=r.safeMergeAABB.apply(r,[r.mergeDirtyAABBs(r.renderQueue)].concat(d(r.removedRBushNodeAABBs.map(function(t){var e=t.minX,n=t.minY,r=t.maxX,i=t.maxY,o=new Mr;return o.setMinMax([e,n,0],[r,i,0]),o}))));if(r.removedRBushNodeAABBs=[],Mr.isEmpty(i))return void(r.renderQueue=[]);var c=r.convertAABB2Rect(i),u=c.x,g=c.y,v=c.width,y=c.height,b=Mt(r.vec3a,[u,g,0],r.vpMatrix),x=Mt(r.vec3b,[u+v,g,0],r.vpMatrix),E=Mt(r.vec3c,[u,g+y,0],r.vpMatrix),w=Mt(r.vec3d,[u+v,g+y,0],r.vpMatrix),k=Math.min(b[0],x[0],w[0],E[0]),M=Math.min(b[1],x[1],w[1],E[1]),S=Math.max(b[0],x[0],w[0],E[0]),N=Math.max(b[1],x[1],w[1],E[1]),T=Math.floor(k),O=Math.floor(M),C=Math.ceil(S-k),A=Math.ceil(N-M);t.save(),r.clearRect(t,T,O,C,A,o.background),t.beginPath(),t.rect(T,O,C,A),t.clip(),t.setTransform(r.vpMatrix[0],r.vpMatrix[1],r.vpMatrix[4],r.vpMatrix[5],r.vpMatrix[12],r.vpMatrix[13]),o.renderer.getConfig().enableDirtyRectangleRenderingDebug&&p.dispatchEvent(new Zs(kc.DIRTY_RECTANGLE,{dirtyRect:{x:T,y:O,width:C,height:A}})),r.searchDirtyObjects(i).sort(function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder}).forEach(function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t,r.context,up(r,wp)[wp],n)}),t.restore(),r.renderQueue.forEach(function(t){r.saveDirtyAABB(t)}),r.renderQueue=[]}up(r,wp)[wp].restoreStack.forEach(function(){t.restore()}),up(r,wp)[wp].restoreStack=[]}else r.clearFullScreenLastFrame=!0}),s.hooks.render.tap(t.tag,function(t){r.clearFullScreen||r.renderQueue.push(t)})}},{key:"clearRect",value:function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))}},{key:"renderDisplayObjectOptimized",value:function(t,e,n,r,i){var o=t.nodeName,a=!1,s=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],c=t.parsedStyle.clipPath;if(c){(!r.prevObject||!st(c.getWorldTransform(),r.prevObject.getWorldTransform()))&&(this.applyWorldTransform(e,c),r.prevObject=null);var u=this.pathGeneratorFactory[c.nodeName];u&&(e.save(),a=!0,e.beginPath(),u(e,c.parsedStyle),e.closePath(),e.clip())}if(s){(!r.prevObject||!st(t.getWorldTransform(),r.prevObject.getWorldTransform()))&&this.applyWorldTransform(e,t);var h=!r.prevObject;if(!h){var d=r.prevObject.nodeName;h=o===pr.TEXT?d!==pr.TEXT:o===pr.IMAGE?d!==pr.IMAGE:d===pr.TEXT||d===pr.IMAGE}s.applyStyleToContext(e,t,h,r),r.prevObject=t}l&&(e.beginPath(),l(e,t.parsedStyle),o!==pr.LINE&&o!==pr.PATH&&o!==pr.POLYLINE&&e.closePath()),s&&s.drawToContext(e,t,up(this,wp)[wp],this,i),a&&e.restore(),t.dirty(!1)}},{key:"renderDisplayObject",value:function(t,e,n,r,i){var o=t.nodeName,a=r.restoreStack[r.restoreStack.length-1];!a||t.compareDocumentPosition(a)&Js.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.restoreStack.pop());var s=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],c=t.parsedStyle.clipPath;if(c){this.applyWorldTransform(e,c);var u=this.pathGeneratorFactory[c.nodeName];u&&(e.save(),r.restoreStack.push(t),e.beginPath(),u(e,c.parsedStyle),e.closePath(),e.clip())}s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),l&&(e.beginPath(),l(e,t.parsedStyle),o!==pr.LINE&&o!==pr.PATH&&o!==pr.POLYLINE&&e.closePath()),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.dirty(!1)}},{key:"applyAttributesToContext",value:function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,a=n.lineDash,s=n.lineDashOffset;a&&t.setLineDash(a),$t(s)||(t.lineDashOffset=s),$t(o)||(t.globalAlpha*=o),$t(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),$t(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)}},{key:"convertAABB2Rect",value:function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}}},{key:"mergeDirtyAABBs",value:function(t){var e=new Mr;return t.forEach(function(t){var n=t.getRenderBounds();e.add(n);var r=t.renderable.dirtyRenderBounds;r&&e.add(r)}),e}},{key:"searchDirtyObjects",value:function(t){var e=b(t.getMin(),2),n=e[0],r=e[1],i=b(t.getMax(),2),o=i[0],a=i[1];return this.rBush.search({minX:n,minY:r,maxX:o,maxY:a}).map(function(t){return t.displayObject})}},{key:"saveDirtyAABB",value:function(t){var e=t.renderable;e.dirtyRenderBounds||(e.dirtyRenderBounds=new Mr);var n=t.getRenderBounds();n&&e.dirtyRenderBounds.update(n.center,n.halfExtents)}},{key:"applyWorldTransform",value:function(t,e,n){n?(A(this.tmpMat4,e.getLocalTransform()),j(this.tmpMat4,n,this.tmpMat4),j(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(A(this.tmpMat4,e.getWorldTransform()),j(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var t=new Mr,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.forEach(function(e){t.add(e)}),t}}])}();
/*!
* @antv/g-plugin-canvas-renderer
* @description A G plugin of renderer implementation with Canvas2D API
* @version 2.3.3
* @date 7/30/2025, 1:36:40 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function Mp(t,e,n,r,i,o,a){var s,l;if("rect"===t.image.nodeName){var c=t.image.parsedStyle,u=c.width,h=c.height;l=r.contextService.getDPR();var d=r.config.offscreenCanvas;(s=o.offscreenCanvasCreator.getOrCreateCanvas(d)).width=u*l,s.height=h*l;var f=o.offscreenCanvasCreator.getOrCreateContext(d),p={restoreStack:[],prevObject:null,currentContext:new Map};t.image.forEach(function(t){i.renderDisplayObject(t,f,r,p,o)}),p.restoreStack.forEach(function(){f.restore()})}return a.getOrCreatePatternSync(e,t,n,s,l,e.getGeometryBounds().min,function(){e.dirty(),r.renderingService.dirtify()})}function Sp(t,e,n,r){var i;if(t.type===to.LinearGradient||t.type===to.RadialGradient){var o=e.getGeometryBounds(),s=o&&2*o.halfExtents[0]||1,l=o&&2*o.halfExtents[1]||1,c=o&&o.min||[0,0];i=r.getOrCreateGradient(a(a({type:t.type},t.value),{},{min:c,width:s,height:l}),n)}return i}kp.tag="CanvasRenderer";var Np=["shadowBlur","shadowOffsetX","shadowOffsetY"],Tp=["lineCap","lineJoin","miterLimit"],Op={globalAlpha:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",filter:"none",globalCompositeOperation:"source-over",strokeStyle:"#000",strokeOpacity:1,lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,fillStyle:"#000",fillOpacity:1},Cp={};function Ap(t,e,n,r){var i=r.has(e)?r.get(e):Op[e];return i!==n&&("lineDash"===e?t.setLineDash(n):t[e]=n,r.set(e,n)),i}var Pp=function(){return c(function t(e){s(this,t),this.imagePool=e},[{key:"applyAttributesToContext",value:function(t,e){}},{key:"render",value:function(t,e,n,r,i,o){}},{key:"applyCommonStyleToContext",value:function(t,e,n,r){var i=n?Cp:r.prevObject.parsedStyle,o=e.parsedStyle;(n||o.opacity!==i.opacity)&&Ap(t,"globalAlpha",$t(o.opacity)?Op.globalAlpha:o.opacity,r.currentContext),(n||o.blend!==i.blend)&&Ap(t,"globalCompositeOperation",$t(o.blend)?Op.globalCompositeOperation:o.blend,r.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(t,e,n,r){var i=n?Cp:r.prevObject.parsedStyle,o=e.parsedStyle,a=o.lineWidth,s=void 0===a?Op.lineWidth:a,l=o.fill&&!o.fill.isNone;if(o.stroke&&!o.stroke.isNone&&s>0){if(n||e.attributes.stroke!==r.prevObject.attributes.stroke)Ap(t,"strokeStyle",$t(o.stroke)||Array.isArray(o.stroke)||o.stroke.isNone?Op.strokeStyle:e.attributes.stroke,r.currentContext);(n||o.lineWidth!==i.lineWidth)&&Ap(t,"lineWidth",$t(o.lineWidth)?Op.lineWidth:o.lineWidth,r.currentContext),(n||o.lineDash!==i.lineDash)&&Ap(t,"lineDash",o.lineDash||Op.lineDash,r.currentContext),(n||o.lineDashOffset!==i.lineDashOffset)&&Ap(t,"lineDashOffset",$t(o.lineDashOffset)?Op.lineDashOffset:o.lineDashOffset,r.currentContext);for(var c=0;c<Tp.length;c++){var u=Tp[c];(n||o[u]!==i[u])&&Ap(t,u,$t(o[u])?Op[u]:o[u],r.currentContext)}}l&&(n||e.attributes.fill!==r.prevObject.attributes.fill)&&Ap(t,"fillStyle",$t(o.fill)||Array.isArray(o.fill)||o.fill.isNone?Op.fillStyle:e.attributes.fill,r.currentContext)}},{key:"applyStyleToContext",value:function(t,e,n,r){var i=e.nodeName;this.applyCommonStyleToContext(t,e,n,r),i===pr.IMAGE||this.applyStrokeFillStyleToContext(t,e,n,r)}},{key:"applyShadowAndFilterStyleToContext",value:function(t,e,n,r){var i=e.parsedStyle;if(n){Ap(t,"shadowColor",i.shadowColor.toString(),r.currentContext);for(var o=0;o<Np.length;o++){var a=Np[o];Ap(t,a,i[a]||Op[a],r.currentContext)}}i.filter&&i.filter.length&&Ap(t,"filter",e.attributes.filter,r.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e){Ap(t,"shadowColor",Op.shadowColor,r.currentContext);for(var o=0;o<Np.length;o++){var a=Np[o];Ap(t,a,Op[a],r.currentContext)}}if(n)if(e&&i){var s=t.filter;!$t(s)&&s.indexOf("drop-shadow")>-1&&Ap(t,"filter",s.replace(/drop-shadow\([^)]*\)/,"").trim()||Op.filter,r.currentContext)}else Ap(t,"filter",Op.filter,r.currentContext)}},{key:"fillToContext",value:function(t,e,n,r,i){var o=this,a=e.parsedStyle,s=a.fill,l=a.fillRule,c=null;if(Array.isArray(s)&&s.length>0)s.forEach(function(r){var i=Ap(t,"fillStyle",Sp(r,e,t,o.imagePool),n.currentContext);c=null!=c?c:i,l?t.fill(l):t.fill()});else{if(So(s)){var u=Mp(s,e,t,e.ownerDocument.defaultView.context,r,i,this.imagePool);u&&(t.fillStyle=u,c=!0)}l?t.fill(l):t.fill()}null!==c&&Ap(t,"fillStyle",c,n.currentContext)}},{key:"strokeToContext",value:function(t,e,n,r,i){var o=this,a=e.parsedStyle.stroke,s=null;if(Array.isArray(a)&&a.length>0)a.forEach(function(r){var i=Ap(t,"strokeStyle",Sp(r,e,t,o.imagePool),n.currentContext);s=null!=s?s:i,t.stroke()});else{if(So(a)){var l=Mp(a,e,t,e.ownerDocument.defaultView.context,r,i,this.imagePool);if(l){var c=Ap(t,"strokeStyle",l,n.currentContext);s=null!=s?s:c}}t.stroke()}null!==s&&Ap(t,"strokeStyle",s,n.currentContext)}},{key:"drawToContext",value:function(t,e,n,r,i){var o,a=e.nodeName,s=e.parsedStyle,l=s.opacity,c=void 0===l?Op.globalAlpha:l,u=s.fillOpacity,h=void 0===u?Op.fillOpacity:u,d=s.strokeOpacity,f=void 0===d?Op.strokeOpacity:d,p=s.lineWidth,g=void 0===p?Op.lineWidth:p,v=s.fill&&!s.fill.isNone,m=s.stroke&&!s.stroke.isNone&&g>0;if(v||m){var y=!$t(s.shadowColor)&&s.shadowBlur>0,b="inner"===s.shadowType,x=0===(null===(o=s.fill)||void 0===o?void 0:o.alpha),E=!(!s.filter||!s.filter.length),w=y&&m&&(a===pr.PATH||a===pr.LINE||a===pr.POLYLINE||x||b),k=null;if(v)w||this.applyShadowAndFilterStyleToContext(t,e,y,n),k=Ap(t,"globalAlpha",c*h,n.currentContext),this.fillToContext(t,e,n,r,i),w||this.clearShadowAndFilterStyleForContext(t,y,E,n);if(m){var M=!1,S=Ap(t,"globalAlpha",c*f,n.currentContext);if(k=v?k:S,w&&(this.applyShadowAndFilterStyleToContext(t,e,y,n),M=!0,b)){var N=t.globalCompositeOperation;t.globalCompositeOperation="source-atop",this.strokeToContext(t,e,n,r,i),t.globalCompositeOperation=N,this.clearShadowAndFilterStyleForContext(t,y,E,n,!0)}this.strokeToContext(t,e,n,r,i),M&&this.clearShadowAndFilterStyleForContext(t,y,E,n)}null!==k&&Ap(t,"globalAlpha",k,n.currentContext)}}}])}(),Rp=function(t){function e(){return s(this,e),v(this,e,arguments)}return y(e,t),c(e,[{key:"render",value:function(t,e,n,r,i,o){var a=e.fill,s=e.fillRule,l=e.opacity,c=void 0===l?1:l,u=e.fillOpacity,h=void 0===u?1:u,d=e.stroke,f=e.strokeOpacity,p=void 0===f?1:f,g=e.lineWidth,v=void 0===g?1:g,m=e.lineCap,y=e.lineJoin,b=e.shadowType,x=e.shadowColor,E=e.shadowBlur,w=e.filter,k=e.miterLimit,M=a&&!a.isNone,S=d&&!d.isNone&&v>0,N=0===(null==a?void 0:a.alpha),T=!(!w||!w.length),O=!$t(x)&&E>0,C=n.nodeName,A="inner"===b,P=S&&O&&(C===pr.PATH||C===pr.LINE||C===pr.POLYLINE||N||A);M&&(t.globalAlpha=c*h,P||Dp(n,t,O),Lp(t,n,a,s,r,i,o,this.imagePool),P||this.clearShadowAndFilter(t,T,O)),S&&(t.globalAlpha=c*p,t.lineWidth=v,$t(k)||(t.miterLimit=k),$t(m)||(t.lineCap=m),$t(y)||(t.lineJoin=y),P&&(A&&(t.globalCompositeOperation="source-atop"),Dp(n,t,!0),A&&(_p(t,n,d,r,i,o,this.imagePool),t.globalCompositeOperation=Op.globalCompositeOperation,this.clearShadowAndFilter(t,T,!0))),_p(t,n,d,r,i,o,this.imagePool))}},{key:"clearShadowAndFilter",value:function(t,e,n){if(n&&(t.shadowColor="transparent",t.shadowBlur=0),e){var r=t.filter;!$t(r)&&r.indexOf("drop-shadow")>-1&&(t.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(Pp);function Dp(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,a=r.shadowBlur,s=r.shadowOffsetX,l=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=l||0)}function Lp(t,e,n,r,i,o,a,s){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8];Array.isArray(n)?n.forEach(function(n){t.fillStyle=Sp(n,e,t,s),l||(r?t.fill(r):t.fill())}):(So(n)&&(t.fillStyle=Mp(n,e,t,i,o,a,s)),l||(r?t.fill(r):t.fill()))}function _p(t,e,n,r,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];Array.isArray(n)?n.forEach(function(n){t.strokeStyle=Sp(n,e,t,a),s||t.stroke()}):(So(n)&&(t.strokeStyle=Mp(n,e,t,r,i,o,a)),s||t.stroke())}var Ip=function(t){function e(){return s(this,e),v(this,e,arguments)}return y(e,t),c(e,[{key:"renderDownSampled",value:function(t,e,n,r){var i=r.src,o=r.imageCache;o.downSampled?t.drawImage(o.downSampled,Math.floor(r.drawRect[0]),Math.floor(r.drawRect[1]),Math.ceil(r.drawRect[2]),Math.ceil(r.drawRect[3])):this.imagePool.createDownSampledImage(i,n).then(function(){n.ownerDocument&&(n.dirty(),n.ownerDocument.defaultView.context.renderingService.dirtify())}).catch(function(t){console.error(t)})}},{key:"renderTile",value:function(t,e,n,r){var i=r.src,o=r.imageCache,a=r.imageRect,s=r.drawRect,l=o.size,c=t.getTransform(),u=c.a,h=c.b,d=c.c,f=c.d,p=c.e,g=c.f;if(t.resetTransform(),null!=o&&o.gridSize){for(var v=[l[0]/a[2],l[1]/a[3]],m=[o.tileSize[0]/v[0],o.tileSize[1]/v[1]],y=[Math.floor((s[0]-a[0])/m[0]),Math.ceil((s[0]+s[2]-a[0])/m[0])],b=y[0],x=y[1],E=[Math.floor((s[1]-a[1])/m[1]),Math.ceil((s[1]+s[3]-a[1])/m[1])],w=E[1],k=E[0];k<=w;k++)for(var M=b;M<=x;M++){var S=o.tiles[k][M];if(S){var N=[Math.floor(a[0]+S.tileX*m[0]),Math.floor(a[1]+S.tileY*m[1]),Math.ceil(m[0]),Math.ceil(m[1])];t.drawImage(S.data,N[0],N[1],N[2],N[3])}}t.setTransform(u,h,d,f,p,g)}else this.imagePool.createImageTiles(i,[],function(){n.ownerDocument&&(n.dirty(),n.ownerDocument.defaultView.context.renderingService.dirtify())},n).catch(function(t){console.error(t)})}},{key:"render",value:function(t,n,r){var i=n.x,o=void 0===i?0:i,a=n.y,s=void 0===a?0:a,l=n.width,c=n.height,u=n.src,h=n.shadowColor,d=n.shadowBlur,f=this.imagePool.getImageSync(u,r),p=null==f?void 0:f.img,g=l,v=c;if(p){var m,y,x,E,w,k,M,S,N,T,O,C,A,R,D;g||(g=p.width),v||(v=p.height),Dp(r,t,!$t(h)&&d>0);try{var L=r.ownerDocument.defaultView.getContextService().getDomElement(),_=L.width,I=L.height,j=t.getTransform(),B=j.a,F=j.b,z=function(t,e){var n=Mt(ht(),[t[0],t[1],0],e),r=Mt(ht(),[t[0]+t[2],t[1],0],e),i=Mt(ht(),[t[0],t[1]+t[3],0],e),o=Mt(ht(),[t[0]+t[2],t[1]+t[3],0],e);return[Math.min(n[0],r[0],i[0],o[0]),Math.min(n[1],r[1],i[1],o[1]),Math.max(n[0],r[0],i[0],o[0])-Math.min(n[0],r[0],i[0],o[0]),Math.max(n[1],r[1],i[1],o[1])-Math.min(n[1],r[1],i[1],o[1])]}([o,s,g,v],P(B,j.c,0,0,F,j.d,0,0,0,0,1,0,j.e,j.f,0,1)),G=(m=z,y=b([0,0,_,I],4),x=y[0],E=y[1],w=y[2],k=y[3],M=b(m,4),S=M[0],N=M[1],T=M[2],O=M[3],C=Math.max(x,S),A=Math.max(E,N),R=Math.min(x+w,S+T),D=Math.min(E+k,N+O),R<=C||D<=A?null:[C,A,R-C,D-A]);if(!G)return;if(!r.ownerDocument.defaultView.getConfig().enableLargeImageOptimization)return void e.renderFull(t,n,r,{image:p,drawRect:[o,s,g,v]});if(z[2]/f.size[0]<(f.downSamplingRate||.5))return void this.renderDownSampled(t,n,r,{src:u,imageCache:f,drawRect:[o,s,g,v]});if(!yp.isSupportTile)return void e.renderFull(t,n,r,{image:p,drawRect:[o,s,g,v]});this.renderTile(t,n,r,{src:u,imageCache:f,imageRect:z,drawRect:G})}catch(t){}}}},{key:"drawToContext",value:function(t,e,n,r,i){this.render(t,e.parsedStyle,e)}}],[{key:"renderFull",value:function(t,e,n,r){t.drawImage(r.image,Math.floor(r.drawRect[0]),Math.floor(r.drawRect[1]),Math.ceil(r.drawRect[2]),Math.ceil(r.drawRect[3]))}}])}(Rp),jp=function(t){function e(){return s(this,e),v(this,e,arguments)}return y(e,t),c(e,[{key:"render",value:function(t,e,n,r,i,o){n.getBounds();var a=e.lineWidth,s=void 0===a?1:a,l=e.textAlign,c=void 0===l?"start":l,u=e.textBaseline,h=void 0===u?"alphabetic":u,d=e.lineJoin,f=void 0===d?"miter":d,p=e.miterLimit,g=void 0===p?10:p,v=e.letterSpacing,m=void 0===v?0:v,y=e.stroke,b=e.fill,x=e.fillRule,E=e.fillOpacity,w=void 0===E?1:E,k=e.strokeOpacity,M=void 0===k?1:k,S=e.opacity,N=void 0===S?1:S,T=e.metrics,O=e.x,C=void 0===O?0:O,A=e.y,P=void 0===A?0:A,R=e.dx,D=e.dy,L=e.shadowColor,_=e.shadowBlur,I=T.font,j=T.lines,B=T.height,F=T.lineHeight,z=T.lineMetrics;t.font=I,t.lineWidth=s,t.textAlign="middle"===c?"center":c;var G=h;"alphabetic"===G&&(G="bottom"),t.lineJoin=f,$t(g)||(t.miterLimit=g);var V=P;"middle"===h?V+=-B/2-F/2:"bottom"===h||"alphabetic"===h||"ideographic"===h?V+=-B:"top"!==h&&"hanging"!==h||(V+=-F);var W=C+(R||0);V+=D||0,1===j.length&&("bottom"===G?(G="middle",V-=.5*B):"top"===G&&(G="middle",V+=.5*B)),t.textBaseline=G,Dp(n,t,!$t(L)&&_>0);for(var H=0;H<j.length;H++){var U=s/2+W;V+=F,$t(y)||y.isNone||!s||this.drawLetterSpacing(t,n,j[H],z[H],c,U,V,m,b,x,w,y,M,N,!0,r,i,o),$t(b)||this.drawLetterSpacing(t,n,j[H],z[H],c,U,V,m,b,x,w,y,M,N,!1,r,i,o)}}},{key:"drawLetterSpacing",value:function(t,e,n,r,i,o,a,s,l,c,u,h,d,f,p,g,v,m){if(0!==s){var y=t.textAlign;t.textAlign="left";var b=o;"center"===i||"middle"===i?b=o-r.width/2:"right"!==i&&"end"!==i||(b=o-r.width);for(var x=Array.from(n),E=t.measureText(n).width,w=0,k=0;k<x.length;++k){var M=x[k];p?this.strokeText(t,e,M,b,a,h,d,g,v,m):this.fillText(t,e,M,b,a,l,c,u,f,g,v,m),b+=E-(w=t.measureText(n.substring(k+1)).width)+s,E=w}t.textAlign=y}else p?this.strokeText(t,e,n,o,a,h,d,g,v,m):this.fillText(t,e,n,o,a,l,c,u,f,g,v,m)}},{key:"fillText",value:function(t,e,n,r,i,o,a,s,l,c,u,h){var d;Lp(t,e,o,a,c,u,h,this.imagePool,!0);var f=!$t(s)&&1!==s;f&&(d=t.globalAlpha,t.globalAlpha=s*l),t.fillText(n,r,i),f&&(t.globalAlpha=d)}},{key:"strokeText",value:function(t,e,n,r,i,o,a,s,l,c){var u;_p(t,e,o,s,l,c,this.imagePool,!0);var h=!$t(a)&&1!==a;h&&(u=t.globalAlpha,t.globalAlpha=a),t.strokeText(n,r,i),h&&(t.globalAlpha=u)}},{key:"drawToContext",value:function(t,e,n,r,i){this.render(t,e.parsedStyle,e,e.ownerDocument.defaultView.context,r,i)}}])}(Rp),Bp=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),(t=v(this,e)).name="canvas-renderer",t.options=n,t}return y(e,t),c(e,[{key:"init",value:function(){var t,e=a({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,r=new Rp(n),o=(i(i(i(i(i(i(i(i(i(i(t={},pr.CIRCLE,r),pr.ELLIPSE,r),pr.RECT,r),pr.IMAGE,new Ip(n)),pr.TEXT,new jp(n)),pr.LINE,r),pr.POLYLINE,r),pr.POLYGON,r),pr.PATH,r),pr.GROUP,void 0),i(i(i(t,pr.HTML,void 0),pr.MESH,void 0),pr.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new kp(e))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(vr),Fp=function(){function t(){s(this,t)}return c(t,[{key:"apply",value:function(e,n){var r=this,i=e.renderingService,o=e.renderingContext,a=e.config;this.context=e;var s=o.root.ownerDocument.defaultView,l=function(t){i.hooks.pointerMove.call(t)},c=function(t){i.hooks.pointerUp.call(t)},u=function(t){i.hooks.pointerDown.call(t)},h=function(t){i.hooks.pointerOver.call(t)},d=function(t){i.hooks.pointerOut.call(t)},f=function(t){i.hooks.pointerCancel.call(t)},p=function(t){i.hooks.pointerWheel.call(t)},g=function(t){i.hooks.click.call(t)};i.hooks.init.tap(t.tag,function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="none",t.style.msTouchAction="none"):s.supportsPointerEvents&&(t.style.touchAction="none"),s.supportsPointerEvents?function(t){n.globalThis.document.addEventListener("pointermove",l,!0),t.addEventListener("pointerdown",u,!0),t.addEventListener("pointerleave",d,!0),t.addEventListener("pointerover",h,!0),n.globalThis.addEventListener("pointerup",c,!0),n.globalThis.addEventListener("pointercancel",f,!0)}(t):function(t){n.globalThis.document.addEventListener("mousemove",l,!0),t.addEventListener("mousedown",u,!0),t.addEventListener("mouseout",d,!0),t.addEventListener("mouseover",h,!0),n.globalThis.addEventListener("mouseup",c,!0)}(t),s.supportsTouchEvents&&function(t){t.addEventListener("touchstart",u,!0),t.addEventListener("touchend",c,!0),t.addEventListener("touchmove",l,!0),t.addEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.addEventListener("click",g,!0),t.addEventListener("wheel",p,{passive:!0,capture:!0})}),i.hooks.destroy.tap(t.tag,function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):s.supportsPointerEvents&&(t.style.touchAction=""),s.supportsPointerEvents?function(t){n.globalThis.document.removeEventListener("pointermove",l,!0),t.removeEventListener("pointerdown",u,!0),t.removeEventListener("pointerleave",d,!0),t.removeEventListener("pointerover",h,!0),n.globalThis.removeEventListener("pointerup",c,!0),n.globalThis.removeEventListener("pointercancel",f,!0)}(t):function(t){n.globalThis.document.removeEventListener("mousemove",l,!0),t.removeEventListener("mousedown",u,!0),t.removeEventListener("mouseout",d,!0),t.removeEventListener("mouseover",h,!0),n.globalThis.removeEventListener("mouseup",c,!0)}(t),s.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",u,!0),t.removeEventListener("touchend",c,!0),t.removeEventListener("touchmove",l,!0),t.removeEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.removeEventListener("click",g,!0),t.removeEventListener("wheel",p,!0)})}}])}();Fp.tag="DOMInteraction";var zp=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).name="dom-interaction",t}return y(e,t),c(e,[{key:"init",value:function(){this.addRenderingPlugin(new Fp)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(vr),Gp=function(){function t(){s(this,t),this.displayObjectHTMLElementMap=new WeakMap}return c(t,[{key:"joinTransformMatrix",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return"matrix(".concat([t[0],t[1],t[4],t[5],t[12]+e[0],t[13]+e[1]].join(","),")")}},{key:"apply",value:function(e,n){var r=this,i=e.camera,o=e.renderingContext,a=e.renderingService;this.context=e;var s=o.root.ownerDocument.defaultView,l=s.context.eventService.nativeHTMLMap,c=function(t,e){e.style.transform=r.joinTransformMatrix(t.getWorldTransform(),t.getOrigin())},u=function(t){var e=t.target;if(e.nodeName===pr.HTML){r.$camera||(r.$camera=r.createCamera(i));var n=r.getOrCreateEl(e);r.$camera.appendChild(n),Object.keys(e.attributes).forEach(function(t){r.updateAttribute(t,e)}),c(e,n),l.set(n,e)}},h=function(t){var e=t.target;if(e.nodeName===pr.HTML&&r.$camera){var n=r.getOrCreateEl(e);n&&(n.remove(),l.delete(n))}},d=function(t){var e=t.target;if(e.nodeName===pr.HTML){var n=t.attrName;r.updateAttribute(n,e)}},f=function(t){var e=t.target;(e.nodeName===pr.FRAGMENT?e.childNodes:[e]).forEach(function(t){if(t.nodeName===pr.HTML){var e=r.getOrCreateEl(t);c(t,e)}})},p=function(){if(r.$camera){var t=r.context.config,e=t.width,n=t.height;r.$camera.parentElement.style.width="".concat(e||0,"px"),r.$camera.parentElement.style.height="".concat(n||0,"px")}};a.hooks.init.tap(t.tag,function(){s.addEventListener(kc.RESIZE,p),s.addEventListener(al.MOUNTED,u),s.addEventListener(al.UNMOUNTED,h),s.addEventListener(al.ATTR_MODIFIED,d),s.addEventListener(al.BOUNDS_CHANGED,f)}),a.hooks.endFrame.tap(t.tag,function(){r.$camera&&o.renderReasons.has(nl.CAMERA_CHANGED)&&(r.$camera.style.transform=r.joinTransformMatrix(i.getOrthoMatrix()))}),a.hooks.destroy.tap(t.tag,function(){r.$camera&&r.$camera.remove(),s.removeEventListener(kc.RESIZE,p),s.removeEventListener(al.MOUNTED,u),s.removeEventListener(al.UNMOUNTED,h),s.removeEventListener(al.ATTR_MODIFIED,d),s.removeEventListener(al.BOUNDS_CHANGED,f)})}},{key:"createCamera",value:function(t){var e=this.context.config,n=e.document,r=e.width,i=e.height,o=this.context.contextService.getDomElement(),a=o.parentNode;if(a){var s="g-canvas-camera",l=a.querySelector("#".concat(s));if(!l){var c=(n||document).createElement("div");c.style.overflow="hidden",c.style.pointerEvents="none",c.style.position="absolute",c.style.left="0px",c.style.top="0px",c.style.width="".concat(r||0,"px"),c.style.height="".concat(i||0,"px");var u=(n||document).createElement("div");l=u,u.id=s,u.style.position="absolute",u.style.left="".concat(o.offsetLeft||0,"px"),u.style.top="".concat(o.offsetTop||0,"px"),u.style.transformOrigin="left top",u.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),u.style.pointerEvents="none",u.style.width="100%",u.style.height="100%",c.appendChild(u),a.appendChild(c)}return l}return null}},{key:"getOrCreateEl",value:function(t){var e=this.context.config.document,n=this.displayObjectHTMLElementMap.get(t);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(t,n),t.id&&(n.id=t.id),t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform(),t.getOrigin())),n}},{key:"updateAttribute",value:function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;ne(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"x":n.style.left="".concat(e.parsedStyle.x,"px");break;case"y":n.style.top="".concat(e.parsedStyle.y,"px");break;case"transformOrigin":var i=e.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(i[0].buildCSSText(null,null,"")," ").concat(i[1].buildCSSText(null,null,""));break;case"width":var o=e.parsedStyle.width;n.style.width=ae(o)?"".concat(o,"px"):o.toString();break;case"height":var a=e.parsedStyle.height;n.style.height=ae(a)?"".concat(a,"px"):a.toString();break;case"zIndex":var s=e.parsedStyle.zIndex;n.style["z-index"]="".concat(s);break;case"visibility":var l=e.parsedStyle.visibility;n.style.visibility=l;break;case"pointerEvents":var c=e.parsedStyle.pointerEvents,u=void 0===c?"auto":c;n.style.pointerEvents=u;break;case"opacity":var h=e.parsedStyle.opacity;n.style.opacity="".concat(h);break;case"fill":var d=e.parsedStyle.fill,f="";No(d)?f=d.isNone?"transparent":e.getAttribute("fill"):Array.isArray(d)?f=e.getAttribute("fill"):So(d),n.style.background=f;break;case"stroke":var p=e.parsedStyle.stroke,g="";No(p)?g=p.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(p)?g=e.getAttribute("stroke"):So(p),n.style["border-color"]=g,n.style["border-style"]="solid";break;case"lineWidth":var v=e.parsedStyle.lineWidth;n.style["border-width"]="".concat(v||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":var m=e.style.filter;n.style.filter=m;break;default:$t(e.style[t])||""===e.style[t]||(n.style[t]=e.style[t])}}}])}();
/*!
* @antv/g-plugin-html-renderer
* @description A G plugin for rendering HTML
* @version 2.1.27
* @date 7/30/2025, 1:35:48 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/Gp.tag="HTMLRendering";var Vp=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).name="html-renderer",t}return y(e,t),c(e,[{key:"init",value:function(){this.addRenderingPlugin(new Gp)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(vr),Wp=function(){return c(function t(e){s(this,t),this.renderingContext=e.renderingContext,this.canvasConfig=e.config},[{key:"init",value:function(){var t=this.canvasConfig,e=t.container,n=t.canvas;if(n)this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(e&&(this.$container=ne(e)?document.getElementById(e):e,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(t,e){var n=this.canvasConfig.devicePixelRatio;this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,function(t,e,n){Qa&&t.style&&(t.style.width=e+"px",t.style.height=n+"px")}(this.$canvas,t,e)),this.renderingContext.renderReasons.add(nl.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)}},{key:"toDataURL",value:(t=cr(sr().mark(function t(){var e,n,r,i=arguments;return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=(e=i.length>0&&void 0!==i[0]?i[0]:{}).type,r=e.encoderOptions,t.abrupt("return",this.context.canvas.toDataURL(n,r));case 1:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})}]);var t}(),Hp=function(t){function e(){var t;s(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=v(this,e,[].concat(r))).name="canvas-context-register",t}return y(e,t),c(e,[{key:"init",value:function(){this.context.ContextService=Wp}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(vr),Up=function(t){function e(t){var n;return s(this,e),(n=v(this,e,[t])).registerPlugin(new Hp),n.registerPlugin(new Ep),n.registerPlugin(new Ff),n.registerPlugin(new Bp),n.registerPlugin(new zp),n.registerPlugin(new cp),n.registerPlugin(new Vp),n}return y(e,t),c(e)}(mr);
/*!
* @antv/g-canvas
* @description A renderer implemented by Canvas 2D API
* @version 2.0.48
* @date 7/30/2025, 1:38:18 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/class $p extends kf{constructor(t){super(Object.assign(Object.assign({},t),{style:Object.assign({},$p.defaultStyleProps,t.style)})),this.rootPointerEvent=new Xs(null),this.forwardEvents=t=>{const e=this.context.canvas,n=e.context.renderingContext.root.ownerDocument.defaultView;this.normalizeToPointerEvent(t,n).forEach(r=>{const i=this.bootstrapEvent(this.rootPointerEvent,r,n,t);Ce(e.context.eventService,"mappingTable.pointerupoutside",[]),e.context.eventService.mapEvent(i)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[t.CommonEvent.CLICK,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_UP,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=Pe(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:r=0}=e,i=ze(e,["dx","dy"]),[o,a]=this.getSize(t);return Object.assign(Object.assign({x:n,y:r},i),{width:o,height:a})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:r,y:i,width:o=0,height:a=0}=n,s=this.upsert("key-container",fc,{x:r,y:i,width:o,height:a,opacity:0},e);return this.upsert("key",rc,n,s)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof Up))return;const t=this.getDomElement();this.events.forEach(e=>{t.addEventListener(e,this.forwardEvents)})}attributeChangedCallback(t,e,n){"zIndex"===t&&e!==n&&(this.getDomElement().style.zIndex=n)}destroy(){const t=this.getDomElement();this.events.forEach(e=>{t.removeEventListener(e,this.forwardEvents)}),super.destroy()}normalizeToPointerEvent(t,e){const n=[];if(e.isTouchEvent(t))for(let e=0;e<t.changedTouches.length;e++){const r=t.changedTouches[e];ve(r.button)&&(r.button=0),ve(r.buttons)&&(r.buttons=1),ve(r.isPrimary)&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),ve(r.width)&&(r.width=r.radiusX||1),ve(r.height)&&(r.height=r.radiusY||1),ve(r.tiltX)&&(r.tiltX=0),ve(r.tiltY)&&(r.tiltY=0),ve(r.pointerType)&&(r.pointerType="touch"),ve(r.pointerId)&&(r.pointerId=r.identifier||0),ve(r.pressure)&&(r.pressure=r.force||.5),ve(r.twist)&&(r.twist=0),ve(r.tangentialPressure)&&(r.tangentialPressure=0),r.isNormalized=!0,r.type=t.type,n.push(r)}else if(e.isMouseEvent(t)){const e=t;ve(e.isPrimary)&&(e.isPrimary=!0),ve(e.width)&&(e.width=1),ve(e.height)&&(e.height=1),ve(e.tiltX)&&(e.tiltX=0),ve(e.tiltY)&&(e.tiltY=0),ve(e.pointerType)&&(e.pointerType="mouse"),ve(e.pointerId)&&(e.pointerId=1),ve(e.pressure)&&(e.pressure=.5),ve(e.twist)&&(e.twist=0),ve(e.tangentialPressure)&&(e.tangentialPressure=0),e.isNormalized=!0,n.push(e)}else n.push(t);return n}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}bootstrapEvent(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:i,y:o}=this.getViewportXY(e);t.viewport.x=i,t.viewport.y=o;const[a,s]=this.context.canvas.getCanvasByViewport([i,o]);return t.canvas.x=a,t.canvas.y=s,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t}getViewportXY(t){let e,n;const{offsetX:r,offsetY:i,clientX:o,clientY:a}=t;if($t(r)||$t(i)){const t=this.eventService.client2Viewport({x:o,y:a});e=t.x,n=t.y}else e=r,n=i;return{x:e,y:n}}onframe(){super.onframe();const{opacity:t}=this.attributes;this.getDomElement().style.opacity=`${t}`}}$p.defaultStyleProps={size:[160,80],halo:!1,icon:!1,label:!1,pointerEvents:"auto"};let Yp=class t extends kf{constructor(e){super(ef({style:t.defaultStyleProps},e))}getKeyStyle(t){const[e,n]=this.getSize(t),r=super.getKeyStyle(t),{fillOpacity:i,opacity:o=i}=r,a=ze(r,["fillOpacity","opacity"]);return Object.assign(Object.assign({opacity:o},a),{width:e,height:n,x:-e/2,y:-n/2})}getBounds(){return this.getShape("key").getBounds()}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getShape("key").attributes,{fill:n,stroke:r}=e;ze(e,["fill","stroke"]);const i=Kd(this.getGraphicStyle(t),"halo"),o=Number(i.lineWidth),[a,s]=td(this.getSize(t),[o,o]),{lineWidth:l}=i,c={fill:"transparent",lineWidth:l/2,width:a-l/2,height:s-l/2,x:-(a-l/2)/2,y:-(s-l/2)/2};return Object.assign(Object.assign({},i),c)}getIconStyle(t){const e=super.getIconStyle(t),[n,r]=this.getSize(t);return!!e&&Object.assign({width:n*zd,height:r*zd},e)}drawKeyShape(t,e){const n=this.upsert("key",vf,this.getKeyStyle(t),e);return bf(this),n}drawHaloShape(t,e){this.upsert("halo",fc,this.getHaloStyle(t),e)}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&xf(this)}};Yp.defaultStyleProps={size:32};class qp extends kf{constructor(t){super(t)}getKeyStyle(t){const[e,n]=this.getSize(t);return Object.assign(Object.assign({},super.getKeyStyle(t)),{width:e,height:n,x:-e/2,y:-n/2})}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:r}=this.getShape("key").attributes;return!!e&&Object.assign({width:n*zd,height:r*zd},e)}drawKeyShape(t,e){return this.upsert("key",fc,this.getKeyStyle(t),e)}}class Xp extends Sf{constructor(t){super(t)}getInnerR(t){return t.innerR||3*this.getOuterR(t)/8}getOuterR(t){return Math.min(...this.getSize(t))/2}getPoints(t){return e=this.getOuterR(t),n=this.getInnerR(t),[[0,-e],[n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)],[e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[0,n],[-e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[-n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[-e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[-n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)]];var e,n}getIconStyle(t){const e=super.getIconStyle(t),n=2*this.getInnerR(t)*zd;return!!e&&Object.assign({width:n,height:n},e)}getPortXY(t,e){const{placement:n="top"}=e;return $g(this.getShape("key").getLocalBounds(),n,function(t,e){const n={};return n.top=[0,-t],n.left=[-t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n["left-bottom"]=[-t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.bottom=[0,e],n["right-bottom"]=[t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.right=n.default=[t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n}(this.getOuterR(t),this.getInnerR(t)),!1)}}class Kp extends Sf{constructor(t){super(ef({style:Kp.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,r]=this.getSize(t);return function(t,e,n){const r=e/2,i=t/2,o={up:[[-i,r],[i,r],[0,-r]],left:[[-i,0],[i,r],[i,-r]],right:[[-i,r],[-i,-r],[i,0]],down:[[-i,-r],[i,-r],[0,r]]};return o[n]||o.up}(n,r,e)}getPortXY(t,e){const{direction:n}=t,{placement:r="top"}=e,i=this.getShape("key").getLocalBounds(),[o,a]=this.getSize(t),s=function(t,e,n){const r=e/2,i=t/2,o={};"down"===n?(o.bottom=o.default=[0,r],o.right=[i,-r],o.left=[-i,-r]):"left"===n?(o.top=[i,-r],o.bottom=[i,r],o.left=o.default=[-i,0]):"right"===n?(o.top=[-i,-r],o.bottom=[-i,r],o.right=o.default=[i,0]):(o.left=[-i,r],o.top=o.default=[0,-r],o.right=[i,r]);return o}(o,a,n);return $g(i,r,s,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:r,direction:i}=t;if(!1===e||Ne(n||r))return!1;const o=Kd(this.getGraphicStyle(t),"icon"),a=this.getShape("key").getLocalBounds(),[s,l]=function(t,e){const{center:n}=t,[r,i]=fh(t);return["up"===e||"down"===e?n[0]:"right"===e?n[0]-r/6:n[0]+r/6,"left"===e||"right"===e?n[1]:"down"===e?n[1]-i/6:n[1]+i/6]}(a,i),c=2*function(t,e){let[n,r]=fh(t);return[n,r]="up"===e||"down"===e?[n,r]:[r,n],(Math.pow(r,2)-Math.pow(Math.sqrt(Math.pow(n/2,2)+Math.pow(r,2))-n/2,2))/(2*r)}(a,i)*zd;return Object.assign({x:s,y:l,width:c,height:c},o)}}Kp.defaultStyleProps={size:40,direction:"up"};class Zp extends kf{constructor(t){super(ef({style:Zp.defaultStyleProps},t)),this.type="combo",this.updateComboPosition(this.parsedAttributes)}getKeySize(t){const{collapsed:e,childrenNode:n=[]}=t;return 0===n.length?this.getEmptyKeySize(t):e?this.getCollapsedKeySize(t):this.getExpandedKeySize(t)}getEmptyKeySize(t){const{padding:e,collapsedSize:n}=t,[r,i,o,a]=ch(e);return td(Jd(n),[a+i,r+o,0])}getCollapsedKeySize(t){return Jd(t.collapsedSize)}getExpandedKeySize(t){const e=this.getContentBBox(t);return[hh(e),dh(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,r=e.map(t=>this.context.element.getElement(t)).filter(Boolean);if(0===r.length){const e=new Mr,{x:n=0,y:r=0,size:i}=t,[o,a]=Jd(i);return e.setMinMax([n-o/2,r-a/2,0],[n+o/2,r+a/2,0]),e}const i=mh(r.map(t=>t.getBounds()));return n?vh(i,n):i}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",Ef,n,e),bf(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=Kd(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,r=ze(e,["type"]),i=this.getShape("key"),[o,a]=xd(i.getLocalBounds(),"center"),s=Object.assign(Object.assign({},r),{x:o,y:a});if(n){const e=this.getCollapsedMarkerText(n,t);Object.assign(s,{text:e})}return s}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:r}=this.context;return"descendant-count"===t?r.getDescendantsData(this.id).length.toString():"child-count"===t?n.length.toString():"node-count"===t?r.getDescendantsData(this.id).filter(t=>"node"===r.getElementType(Ih(t))).length.toString():Ut(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:r,childrenData:i=[]}=t;if(0===i.length)return[+e,+n,0];if(r){const{model:t}=this.context,r=t.getDescendantsData(this.id).filter(e=>!t.isCombo(Ih(e)));if(r.length>0&&r.some(bd)){return rd(r.reduce((t,e)=>td(t,yd(e)),[0,0,0]),r.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:r}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:r}}),xf(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(t=>{var{x:e,y:n,z:r,transform:i}=t;return ze(t,["x","y","z","transform"])}),e);return n?new Proxy(n,{set:(t,e,n)=>("currentTime"===e&&Promise.resolve().then(()=>this.onframe()),Reflect.set(t,e,n))}):n}}Zp.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class Qp extends Zp{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Zl,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[r]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&Kd(n,"collapsed")),{r:r/2})}getCollapsedKeySize(t){const[e,n]=Jd(t.collapsedSize),r=Math.max(e,n)/2;return[2*r,2*r,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,r]=fh(e),i=Math.sqrt(Math.pow(n,2)+Math.pow(r,2))/2;return[2*i,2*i,0]}getIntersectPoint(t,e=!1){return Ad(t,this.getShape("key").getBounds(),e)}}class Jp extends Zp{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",fc,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&Kd(e,"collapsed")),{width:n,height:r,x:-n/2,y:-r/2})}}const tg={padding:10};function eg(t,e,n,r,i,o){const{padding:a}=Object.assign(tg,o),s=ph(n,a),l=ph(r,a),c=[t,...i,e];let u=null;const h=[];for(let t=0,e=c.length;t<e-1;t++){const n=t+1,r=c[t],i=c[n],o=Nd(r,i);let d=null;if(0===t)if(n===e-1)if(s.intersects(l))d=ug(r,i,s,l);else if(xh(r,s)||xh(i,l))o||(d=cg(r,i,s,l));else{const t=wh(r,s),e=wh(i,l);d=ag(t,e,ig(t,e)),d.points.unshift(t),d.points.push(e)}else yh(i,s)?d=ug(r,i,s,ph(i,a),u):o||(d=sg(r,i,s));else n===e-1?yh(r,l)?d=ug(r,i,ph(r,a),l,u):o||(d=lg(r,i,l,u)):o||(d=ag(r,i,u));d?(h.push(...d.points),u=d.direction):u=ig(r,i),n<e-1&&h.push(i)}return h.map(hd)}const ng={N:"S",S:"N",W:"E",E:"W"},rg={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function ig(t,e){const[n,r]=t,[i,o]=e;return n===i?r>o?"N":"S":r===o?n>i?"W":"E":null}function og(t,e){return"N"===e||"S"===e?dh(t):hh(t)}function ag(t,e,n){const r=[t[0],e[1]],i=[e[0],t[1]],o=ig(t,r),a=ig(t,i),s=n?ng[n]:null,l=o===n||o!==s&&a!==n?r:i;return{points:[l],direction:ig(l,e)}}function sg(t,e,n){if(xh(t,n)){const r=hg(t,e,n);return{points:[r],direction:ig(r,e)}}{const r=wh(t,n),i=["left","right"].includes(Eh(t,n))?[e[0],r[1]]:[r[0],e[1]];return{points:[i],direction:ig(i,e)}}}function lg(t,e,n,r){const i=xh(e,n)?e:wh(e,n),o=[[i[0],t[1]],[t[0],i[1]]],a=o.filter(t=>function(t,e){return!yh(t,e)}(t,n)&&!bh(t,n,!0)),s=a.filter(e=>ig(e,t)!==r);if(s.length>0){const n=s.find(e=>ig(t,e)===r)||s[0];return{points:[n],direction:ig(n,e)}}{const i=Md(e,Ht(o,a)[0],og(n,r)/2);return{points:[hg(i,t,n),i],direction:ig(i,e)}}}function cg(t,e,n,r){let i=sg(t,e,n);const o=dd(i.points[0]);if(yh(o,r)){i=sg(e,t,r);const a=dd(i.points[0]);if(yh(a,n)){const s=Md(t,o,og(n,ig(t,o))/2),l=Md(e,a,og(r,ig(e,a))/2),c=[(s[0]+l[0])/2,(s[1]+l[1])/2],u=sg(t,c,n),h=lg(c,e,r,u.direction);i.points=[u.points[0],h.points[0]],i.direction=h.direction}}return i}function ug(t,e,n,r,i){const o=.01,a=mh([n,r]),s=od(e,a.center)>od(t,a.center),[l,c]=s?[e,t]:[t,e],u=dh(a)+hh(a);let h;if(i){const t=[l[0]+u*Math.cos(rg[i]),l[1]+u*Math.sin(rg[i])];h=Md(wh(t,a),t,o)}else h=Md(wh(l,a),l,-.01);let d=hg(h,c,a),f=[kd(h,2),kd(d,2)];if(Te(kd(h),kd(d))){const t=ld(ed(h,l),[1,0,0])+Math.PI/2;d=[c[0]+u*Math.cos(t),c[1]+u*Math.sin(t),0],d=kd(Md(wh(d,a),c,-.01),2);f=[h,hg(h,d,a),d]}return{points:s?f.reverse():f,direction:ig(s?h:d,e)}}function hg(t,e,n){let r=[t[0],e[1]];return yh(r,n)&&(r=[e[0],t[1]]),r}function dg(t,e,n,r,i){let o="number"==typeof e?e:.5;"start"===e&&(o=0),"end"===e&&(o=.99);const a=Ed(t.getPoint(o)),s=Ed(t.getPoint(o+.01));let l="start"===e?"left":"end"===e?"right":"center";if(Sd(a,s)||!n){const[e,n]=fg(t,o,r,i);return{transform:[["translate",e,n]],textAlign:l}}let c=Math.atan2(s[1]-a[1],s[0]-a[0]);s[0]<a[0]&&(l="center"===l?l:"left"===l?"right":"left",r*=-1,c+=Math.PI);const[u,h]=fg(t,o,r,i,c);return{textAlign:l,transform:[["translate",u,h],["rotate",c/Math.PI*180]]}}function fg(t,e,n,r,i){const[o,a]=Ed(t.getPoint(e));let s=n,l=r;return i&&(s=n*Math.cos(i)-r*Math.sin(i),l=n*Math.sin(i)+r*Math.cos(i)),[o+s,a+l]}function pg(t,e,n,r){if(Te(t,e))return t;const i=ed(e,t),o=[t[0]+n*i[0],t[1]+n*i[1]],a=sd(cd(i,!1));return o[0]+=r*a[0],o[1]+=r*a[1],o}function gg(t,e,n){return[["M",t[0],t[1]],["C",n[0][0],n[0][1],n[1][0],n[1][1],e[0],e[1]]]}function vg(t,e=0,n=!1){const r=t.length-1,i=t[0],o=t[r],a=t.slice(1,r),s=[["M",i[0],i[1]]];return a.forEach((t,n)=>{const r=a[n-1]||i,l=a[n+1]||o;if(!Td(r,t,l)&&e){const[n,i]=function(t,e,n,r){const i=ad(t,e),o=ad(n,e),a=Math.min(r,Math.min(i,o)/2),s=[e[0]-a/i*(e[0]-t[0]),e[1]-a/i*(e[1]-t[1])],l=[e[0]-a/o*(e[0]-n[0]),e[1]-a/o*(e[1]-n[1])];return[s,l]}(r,t,l,e);s.push(["L",n[0],n[1]],["Q",t[0],t[1],i[0],i[1]],["L",i[0],i[1]])}else s.push(["L",t[0],t[1]])}),s.push(["L",o[0],o[1]]),n&&s.push(["Z"]),s}function mg(t,e,n,r,i){const o=ph(t),a=t.getCenter();let s=r&&Xg(r),l=i&&Xg(i);if(!s||!l){const r=(t=>{const e=Math.PI/2,n=dh(t)/2,r=hh(t)/2,i=Math.atan2(n,r)/2,o=Math.atan2(r,n)/2;return{top:[-e-o,-e+o],"top-right":[-e+o,-i],"right-top":[-e+o,-i],right:[-i,i],"bottom-right":[i,e-o],"right-bottom":[i,e-o],bottom:[e-o,e+o],"bottom-left":[e+o,Math.PI-i],"left-bottom":[e+o,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-e-o],"left-top":[Math.PI+i,-e-o]}})(o),i=r[e][0],c=r[e][1],[u,h]=fh(o),d=Math.max(u,h),f=td(a,[d*Math.cos(i),d*Math.sin(i),0]),p=td(a,[d*Math.cos(c),d*Math.sin(c),0]);s=Jg(t,f),l=Jg(t,p),n||([s,l]=[l,s])}return[s,l]}function yg(t,e,n,r,i,o){const a=t.getPorts()[i||o],s=t.getPorts()[o||i];let[l,c]=mg(t,e,n,a,s);const u=function(t,e,n,r){const i=t.getCenter();if(Te(e,n)){const t=ed(e,i),o=[r*Math.sign(t[0])||r/2,r*Math.sign(t[1])||-r/2,0];return[td(e,o),td(n,nd(o,[1,-1,1]))]}return[Md(i,e,od(i,e)+r),Md(i,n,od(i,n)+r)]}(t,l,c,r);return a&&(l=Qg(a,u[0])),s&&(c=Qg(s,u.at(-1))),gg(l,c,u)}function bg(t,e,n,r,i,o,a){const s=Yg(t),l=s[o||a],c=s[a||o];let[u,h]=mg(t,n,r,l,c);const d=function(t,e,n,r){const i=[],o=ph(t);if(Te(e,n)){switch(Eh(e,o)){case"left":i.push([e[0]-r,e[1]]),i.push([e[0]-r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"right":i.push([e[0]+r,e[1]]),i.push([e[0]+r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"top":i.push([e[0],e[1]-r]),i.push([e[0]+r,e[1]-r]),i.push([e[0]+r,e[1]]);break;case"bottom":i.push([e[0],e[1]+r]),i.push([e[0]+r,e[1]+r]),i.push([e[0]+r,e[1]])}}else{const t=Eh(e,o),a=Eh(n,o);if(t===a){let o,a;switch(t){case"left":o=Math.min(e[0],n[0])-r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"right":o=Math.max(e[0],n[0])+r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"top":a=Math.min(e[1],n[1])-r,i.push([e[0],a]),i.push([n[0],a]);break;case"bottom":a=Math.max(e[1],n[1])+r,i.push([e[0],a]),i.push([n[0],a])}}else{const s=(t,e)=>({left:[e[0]-r,e[1]],right:[e[0]+r,e[1]],top:[e[0],e[1]-r],bottom:[e[0],e[1]+r]}[t]),l=s(t,e),c=s(a,n),u=hg(l,c,o);i.push(l,u,c)}}return i}(t,u,h,i);return l&&(u=Qg(l,d[0])),c&&(h=Qg(c,d.at(-1))),vg([u,...d,h],e)}function xg(t,e){const n=new Set,r=new Set,i=new Set;return t.forEach(o=>{e(o).forEach(e=>{n.add(e),t.includes(e.source)&&t.includes(e.target)?r.add(e):i.add(e)})}),{edges:Array.from(n),internal:Array.from(r),external:Array.from(i)}}function Eg(t,e){const n=[];let r=t;for(;r;){n.push(r);const t=e(Ih(r));if(!t)break;r=t}if(n.some(t=>{var e;return null===(e=t.style)||void 0===e?void 0:e.collapsed})){const t=n.reverse().findIndex(Yd);return n[t]||n.at(-1)}return t}const wg=(t,e)=>[["M",-t/2,0],["L",t/2,-e/2],["L",t/2,e/2],["Z"]];var kg=Object.freeze({__proto__:null,circle:(t,e)=>{const n=Math.max(t,e)/2;return[["M",-t/2,0],["A",n,n,0,1,0,2*n-t/2,0],["A",n,n,0,1,0,-t/2,0],["Z"]]},diamond:(t,e)=>[["M",-t/2,0],["L",0,-e/2],["L",t/2,0],["L",0,e/2],["Z"]],rect:(t,e)=>[["M",-t/2,-e/2],["L",t/2,-e/2],["L",t/2,e/2],["L",-t/2,e/2],["Z"]],simple:(t,e)=>[["M",t/2,-e/2],["L",-t/2,0],["L",t/2,0],["L",-t/2,0],["L",t/2,e/2]],triangle:wg,triangleRect:(t,e)=>{const n=t/2,r=t/7,i=t-r;return[["M",-n,0],["L",0,-e/2],["L",0,e/2],["Z"],["M",i-n,-e/2],["L",i+r-n,-e/2],["L",i+r-n,e/2],["L",i-n,e/2],["Z"]]},vee:(t,e)=>[["M",-t/2,0],["L",t/2,-e/2],["L",4*t/5-t/2,0],["L",t/2,e/2],["Z"]]});class Mg extends wf{constructor(t){super(ef({style:Mg.defaultStyleProps},t)),this.type="edge"}get sourceNode(){const{sourceNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}get targetNode(){const{targetNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}getKeyStyle(t){const e=this.getGraphicStyle(t),{loop:n}=e,r=ze(e,["loop"]),{sourceNode:i,targetNode:o}=this;var a,s;const l={d:n&&(s=o,(a=i)&&s&&a===s)?this.getLoopPath(t):this.getKeyPath(t)};return lc.PARSED_STYLE_LIST.forEach(t=>{t in r&&(l[t]=r[t])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,r=this.sourceNode,i=ph(r),o=Math.max(hh(i),dh(i)),{placement:a,clockwise:s,dist:l=o}=Kd(this.getGraphicStyle(t),"loop");return yg(r,a,s,l,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:r,targetPort:i}=t,{sourceNode:o,targetNode:a}=this,[s,l]=function(t,e,n,r){const i=Kg(t,e,n,r),o=Kg(e,t,r,n);return[i,o]}(o,a,r,i);if(!e){return[s?Xg(s):o.getCenter(),l?Xg(l):a.getCenter()]}const c="function"==typeof n?n():n;return[Zg(s||o,c[0]||l||a),Zg(l||a,c[c.length-1]||s||o)]}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getKeyStyle(t),n=Kd(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(!1===t.label||!t.labelText)return!1;const e=Kd(this.getGraphicStyle(t),"label"),{placement:n,offsetX:r,offsetY:i,autoRotate:o,maxWidth:a}=e,s=ze(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),l=dg(this.shapeMap.key,n,o,r,i),c=this.shapeMap.key.getLocalBounds(),u=function(t,e,n=1){return of(od(t[0],t[1])*n,e)}([c.min,c.max],a);return Object.assign({wordWrapWidth:u},l,s)}getBadgeStyle(t){if(!1===t.badge||!t.badgeText)return!1;const e=Kd(t,"badge"),{offsetX:n,offsetY:r,placement:i}=e,o=ze(e,["offsetX","offsetY","placement"]);return Object.assign(o,function(t,e,n,r,i){var o,a;const s=2*(null===(o=t.badge)||void 0===o?void 0:o.getGeometryBounds().halfExtents[0])||0,l=2*(null===(a=t.label)||void 0===a?void 0:a.getGeometryBounds().halfExtents[0])||0;return dg(t.key,n,!0,(l?(l/2+s/2)*("suffix"===e?1:-1):0)+r,i)}(this.shapeMap,i,t.labelPlacement,n,r))}drawArrow(t,e){var n;const r="start"===e,i=t["start"===e?"startArrow":"endArrow"],o=this.shapeMap.key;if(i){const e=this.getArrowStyle(t,r),[n,i,a]=r?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],s=o.parsedStyle[n];if(s)s.attr(e);else{const t=new(e.src?ic:lc)({style:e});o.style[n]=t}o.style[i]=t[a]||e.width/2+ +e.lineWidth}else{const t=r?"markerStart":"markerEnd";null===(n=o.style[t])||void 0===n||n.destroy(),o.style[t]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,r=e?"startArrow":"endArrow",i=Kd(this.getGraphicStyle(t),r),{size:o,type:a}=i,s=ze(i,["size","type"]),[l,c]=Jd(function(t,e){return e||(t<4?10:4===t?12:2.5*t)}(n.lineWidth,o)),u=(Ut(a)?a:kg[a]||wg)(l,c);return Object.assign(Pe(n,["stroke","strokeOpacity","fillOpacity"]),{width:l,height:c},Object.assign({},u&&{d:u,fill:"simple"===a?"":n.stroke}),s)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",uf,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",lc,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",hf,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",lc,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n?new Proxy(n,{set:(t,e,n)=>("currentTime"===e&&Promise.resolve().then(()=>this.onframe()),Reflect.set(t,e,n))}):n}}Mg.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class Sg extends Mg{constructor(t){super(ef({style:Sg.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:r,curvePosition:i,curveOffset:o}=t,a=this.getControlPoints(e,n,function(t){return ae(t)?[t,1-t]:t}(i),function(t){return ae(t)?[t,-t]:t}(o),r);return gg(e,n,a)}getControlPoints(t,e,n,r,i){return 2===(null==i?void 0:i.length)?i:[pg(t,e,n[0],r[0]),pg(t,e,n[1],r[1])]}}Sg.defaultStyleProps={curvePosition:.5,curveOffset:20};class Ng extends Sg{constructor(t){super(ef({style:Ng.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[0]-t[0];return[[t[0]+i*n[0]+r[0],t[1]],[e[0]-i*n[1]+r[1],e[1]]]}}Ng.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class Tg extends Sg{constructor(t){super(ef({style:Tg.defaultStyleProps},t))}get ref(){return this.context.model.getRootsData()[0]}getEndpoints(t){if(this.sourceNode.id===this.ref.id)return super.getEndpoints(t);const e=yd(this.ref);return[this.sourceNode.getIntersectPoint(e,!0),this.targetNode.getIntersectPoint(e)]}toRadialCoordinate(t){const e=yd(this.ref);return[od(t,e),fd(ed(t,e))]}getControlPoints(t,e,n,r){const[i,o]=this.toRadialCoordinate(t),[a]=this.toRadialCoordinate(e),s=a-i;return[[t[0]+(s*n[0]+r[0])*Math.cos(o),t[1]+(s*n[0]+r[0])*Math.sin(o)],[e[0]-(s*n[1]-r[0])*Math.cos(o),e[1]-(s*n[1]-r[0])*Math.sin(o)]]}}Tg.defaultStyleProps={curvePosition:.5,curveOffset:20};class Og extends Sg{constructor(t){super(ef({style:Og.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[1]-t[1];return[[t[0],t[1]+i*n[0]+r[0]],[e[0],e[1]-i*n[1]+r[1]]]}}Og.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let Cg=class t extends Mg{constructor(e){super(ef({style:t.defaultStyleProps},e))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};Cg.defaultStyleProps={};const Ag={enableObstacleAvoidance:!1,offset:10,maxAllowedDirectionChange:Math.PI/2,maximumLoops:3e3,gridSize:5,startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{right:{stepX:1,stepY:0},left:{stepX:-1,stepY:0},bottom:{stepX:0,stepY:1},top:{stepX:0,stepY:-1}},penalties:{0:0,90:0},distFunc:ad},Pg=t=>`${Math.round(t[0])}|||${Math.round(t[1])}`;function Rg(t,e){const n=t=>Math.round(t/e);return ae(t)?n(t):t.map(n)}function Dg(t,e){const n=e[0]-t[0],r=e[1]-t[1];return n||r?Math.atan2(r,n):0}function Lg(t,e,n,r){const i=Dg(t,e),o=n[Pg(t)];return function(t,e){const n=Math.abs(t-e);return n>Math.PI?2*Math.PI-n:n}(Dg(o||r,t),i)}function _g(t,e,n){return Math.min(...e.map(e=>n(t,e)))}const Ig=(t,e,n,r)=>{if(!e)return[t];const{directionMap:i,offset:o}=r,a=vh(e.getRenderBounds(),o),s=Object.keys(i).reduce((e,r)=>{if(n.includes(r)){const n=i[r],[o,s]=fh(a),l=[t[0]+n.stepX*o,t[1]+n.stepY*s],c=function(t){const{min:[e,n],max:[r,i]}=t,o=[e,i],a=[r,i],s=[r,n],l=[e,n];return[[o,a],[a,s],[s,l],[l,o]]}(a);for(let n=0;n<c.length;n++){const r=vd([t,l],c[n]);r&&bh(r,a)&&e.push(r)}}return e},[]);return yh(t,a)||s.push(t),s.map(t=>Rg(t,r.gridSize))},jg=(t,e,n,r,i,o,a)=>{const s=[];let l=[o[0]===r[0]?r[0]:t[0]*a,o[1]===r[1]?r[1]:t[1]*a];s.unshift(l);let c=t,u=e[Pg(c)];for(;u;){const t=u,r=c;Lg(t,r,e,n)&&(l=[t[0]===r[0]?l[0]:t[0]*a,t[1]===r[1]?l[1]:t[1]*a],s.unshift(l)),u=e[Pg(t)],c=t}const h=i.map(t=>[t[0]*a,t[1]*a]),d=function(t,e,n){let r=t[0],i=n(t[0],e);for(let o=0;o<t.length;o++){const a=t[o],s=n(a,e);s<i&&(r=a,i=s)}return r}(h,l,ad);return s.unshift(d),s};function Bg(t,e,n,r){const i=hd(t.getCenter()),o=hd(e.getCenter()),a=Object.assign(Ag,r),{gridSize:s}=a,l=((t,e)=>{const{offset:n,gridSize:r}=e,i={};return t.forEach(t=>{if(!t||t.destroyed||!t.isVisible())return;const e=vh(t.getRenderBounds(),n);for(let t=Rg(e.min[0],r);t<=Rg(e.max[0],r);t+=1)for(let n=Rg(e.min[1],r);n<=Rg(e.max[1],r);n+=1)i[`${t}|||${n}`]=!0}),i})(a.enableObstacleAvoidance?n:[t,e],a),c=Rg(i,s),u=Rg(o,s),h=Ig(i,t,a.startDirections,a),d=Ig(o,e,a.endDirections,a);h.forEach(t=>delete l[Pg(t)]),d.forEach(t=>delete l[Pg(t)]);const f={},p={},g={},v={},m={},y=new Fg;for(let t=0;t<h.length;t++){const e=h[t],n=Pg(e);f[n]=e,v[n]=0,m[n]=_g(e,d,a.distFunc),y.add({id:n,value:m[n]})}const b=d.map(t=>Pg(t));let x,E=a.maximumLoops,w=1/0;for(const[t,e]of Object.entries(f))m[t]<=w&&(w=m[t],x=e);for(;Object.keys(f).length>0&&E>0;){const t=y.minId(!1);if(!t)break;x=f[t];const e=Pg(x);if(b.includes(e))return jg(x,g,c,o,h,u,s);delete f[e],y.remove(e),p[e]=!0;for(const t of Object.values(a.directionMap)){const n=td(x,[t.stepX,t.stepY]),r=Pg(n);if(p[r])continue;const i=Lg(x,n,g,c);if(i>a.maxAllowedDirectionChange)continue;if(l[r])continue;f[r]||(f[r]=n);const o=a.penalties[i],u=a.distFunc(x,n)+(isNaN(o)?s:o),h=v[e]+u,b=v[r];b&&h>=b||(g[r]=x,v[r]=h,m[r]=h+_g(n,d,a.distFunc),y.add({id:r,value:m[r]}))}E-=1}return[]}class Fg{constructor(){this.arr=[],this.map={},this.arr=[],this.map={}}_innerAdd(t,e){let n=0,r=e-1;for(;r-n>1;){const e=Math.floor((n+r)/2);if(this.arr[e].value>t.value)r=e;else{if(!(this.arr[e].value<t.value))return this.arr.splice(e,0,t),void(this.map[t.id]=!0);n=e}}this.arr.splice(r,0,t),this.map[t.id]=!0}add(t){delete this.map[t.id];const e=this.arr.length;if(!e||this.arr[e-1].value<t.value)return this.arr.push(t),void(this.map[t.id]=!0);this._innerAdd(t,e)}remove(t){this.map[t]&&delete this.map[t]}_clearAndGetMinId(){let t;for(let e=this.arr.length-1;e>=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t}_findFirstId(){for(;this.arr.length;){const t=this.arr.shift();if(this.map[t.id])return t.id}}minId(t){return t?this._clearAndGetMinId():this._findFirstId()}}class zg extends Mg{constructor(t){super(ef({style:zg.defaultStyleProps},t))}getControlPoints(t){const{router:e}=t,{sourceNode:n,targetNode:r}=this,[i,o]=this.getEndpoints(t,!1);let a=[];if(e)if("shortest-path"===e.type){a=Bg(n,r,this.context.element.getNodes(),e),a.length||(a=eg(i,o,n,r,t.controlPoints,{padding:e.offset}))}else"orth"===e.type&&(a=eg(i,o,n,r,t.controlPoints,e));else a=t.controlPoints;return a}getPoints(t){const e=this.getControlPoints(t),[n,r]=this.getEndpoints(t,!0,e);return[n,...e,r]}getKeyPath(t){return vg(this.getPoints(t),t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:r}=t,i=this.sourceNode,o=ph(i),a=Math.max(hh(o),dh(o))/4,{placement:s,clockwise:l,dist:c=a}=Kd(this.getGraphicStyle(t),"loop");return bg(i,r,s,l,c,e,n)}}zg.defaultStyleProps={radius:0,controlPoints:[],router:!1};class Gg extends Mg{constructor(t){super(ef({style:Gg.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[r,i]=this.getEndpoints(t);return function(t,e,n){return[["M",t[0],t[1]],["Q",n[0],n[1],e[0],e[1]]]}(r,i,t.controlPoint||pg(r,i,e,n))}}function Vg(t){return t instanceof kf&&"node"===t.type}function Wg(t){return t instanceof Mg}function Hg(t){return t instanceof Zp}Gg.defaultStyleProps={curvePosition:.5,curveOffset:30};const Ug={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],"left-top":[0,0],"top-left":[0,0],"left-bottom":[0,1],"bottom-left":[0,1],"right-top":[1,0],"top-right":[1,0],"right-bottom":[1,1],"bottom-right":[1,1],default:[.5,.5]};function $g(t,e,n=Ug,r=!0){const i=[.5,.5],o=ne(e)?Oe(n,e.toLocaleLowerCase(),i):e;if(!r&&ne(e))return o;const[a,s]=o||i;return[t.min[0]+hh(t)*a,t.min[1]+dh(t)*s]}function Yg(t){if(!t)return{};const e=t.getPorts();return(t.attributes.ports||[]).forEach((n,r)=>{var i;const{key:o,placement:a}=n;qg(n)&&(e[i=o||r]||(e[i]=xd(t.getShape("key").getBounds(),a)))}),e}function qg(t){const{r:e}=t;return!e||0===Number(e)}function Xg(t){return sh(t)?t:t.getPosition()}function Kg(t,e,n,r){const i=Yg(t);if(n)return i[n];const o=Object.values(i);if(0===o.length)return;const a=o.map(t=>Xg(t)),s=function(t,e){const n=Yg(t);if(e)return[Xg(n[e])];const r=Object.values(n);return r.length>0?r.map(t=>Xg(t)):[t.getCenter()]}(e,r),[l]=function(t,e){let n=1/0,r=[t[0],e[0]];return t.forEach(t=>{e.forEach(e=>{const i=od(t,e);i<n&&(n=i,r=[t,e])})}),r}(a,s);return o.find(t=>Xg(t)===l)}function Zg(t,e){return Hg(t)||Vg(t)?Jg(t,e):Qg(t,e)}function Qg(t,e){if(!t||!e)return[0,0,0];if(sh(t))return t;if(t.attributes.linkToCenter)return t.getPosition();return Ad(sh(e)?e:Vg(e)?e.getCenter():e.getPosition(),t.getBounds())}function Jg(t,e){if(!t||!e)return[0,0,0];const n=sh(e)?e:Vg(e)?e.getCenter():e.getPosition();return t.getIntersectPoint(n)||t.getCenter()}function tv(t,e="bottom",n=0,r=0,i=!1){const o=e.split("-"),[a,s]=xd(t,e),[l,c]=i?["bottom","top"]:["top","bottom"];return{transform:[["translate",a+n,s+r]],textBaseline:o.includes("top")?c:o.includes("bottom")?l:"middle",textAlign:o.includes("left")?"right":o.includes("right")?"left":"center"}}function ev(t){return"hidden"!==Oe(t,["style","visibility"])}function nv(t,e){"update"in t?t.update(e):t.attr(e)}function rv(t){return Oe(t,"__to_be_destroyed__",!1)}class iv extends Zh{constructor(t,e){super(t,Object.assign({},iv.defaultOptions,e)),this.onCollapseExpand=t=>Ge(this,void 0,void 0,function*(){if(!this.validate(t))return;const{target:e}=t;if(!(Vg(n=e)||Wg(n)||Hg(n)))return;var n;const r=e.id,{model:i,graph:o}=this.context,a=i.getElementDataById(r);if(!a)return!1;const{onCollapse:s,onExpand:l,animation:c,align:u}=this.options;Yd(a)?(yield o.expandElement(r,{animation:c,align:u}),null==l||l(r)):(yield o.collapseElement(r,{animation:c,align:u}),null==s||s(r))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}iv.defaultOptions={enable:!0,animation:!0,trigger:t.CommonEvent.DBLCLICK,align:!0};const ov="g6-create-edge-assist-node-id";class av extends Zh{constructor(t,e){super(t,Object.assign({},av.defaultOptions,e)),this.drop=t=>Ge(this,void 0,void 0,function*(){const{targetType:e}=t;["combo","node"].includes(e)&&this.source?yield this.handleCreateEdge(t):yield this.cancelEdge()}),this.handleCreateEdge=t=>Ge(this,void 0,void 0,function*(){var e,n,r;if(!this.validate(t))return;const{graph:i,canvas:o,batch:a,element:s}=this.context,{style:l}=this.options;if(this.source)return this.createEdge(t),void(yield this.cancelEdge());a.startBatch(),o.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([t.target.id])[0];const c=i.getElementData(this.source);i.addNodeData([{id:ov,style:{visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:null===(e=c.style)||void 0===e?void 0:e.x,y:null===(n=c.style)||void 0===n?void 0:n.y}}]),i.addEdgeData([{id:"g6-create-edge-assist-edge-id",source:this.source,target:ov,style:Object.assign({pointerEvents:"none"},l)}]),yield null===(r=s.draw({animation:!1}))||void 0===r?void 0:r.finished}),this.updateAssistEdge=t=>Ge(this,void 0,void 0,function*(){var e;if(!this.source)return;const{model:n,element:r}=this.context;n.translateNodeTo(ov,[t.canvas.x,t.canvas.y]),yield null===(e=r.draw({animation:!1,silence:!0}))||void 0===e?void 0:e.finished}),this.createEdge=t=>{var e,n;const{graph:r}=this.context,{style:i,onFinish:o,onCreate:a}=this.options;if(void 0===(null===(e=t.target)||void 0===e?void 0:e.id)||void 0===this.source)return;const s=null===(n=this.getSelectedNodeIDs([t.target.id]))||void 0===n?void 0:n[0];var l;const c=a({id:`${this.source}-${s}-${Le[l=l||"g"]?Le[l]+=1:Le[l]=1,l+Le[l]}`,source:this.source,target:s,style:i});c&&(r.addEdgeData([c]),o(c))},this.cancelEdge=()=>Ge(this,void 0,void 0,function*(){var t;if(!this.source)return;const{graph:e,element:n,batch:r}=this.context;e.removeNodeData([ov]),this.source=void 0,yield null===(t=n.draw({animation:!1}))||void 0===t?void 0:t.finished,r.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:e}=this.context,{trigger:n}=this.options;this.unbindEvents(),"click"===n?(e.on(t.NodeEvent.CLICK,this.handleCreateEdge),e.on(t.ComboEvent.CLICK,this.handleCreateEdge),e.on(t.CanvasEvent.CLICK,this.cancelEdge),e.on(t.EdgeEvent.CLICK,this.cancelEdge)):(e.on(t.NodeEvent.DRAG_START,this.handleCreateEdge),e.on(t.ComboEvent.DRAG_START,this.handleCreateEdge),e.on(t.CommonEvent.POINTER_UP,this.drop)),e.on(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(t=>t.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;e.off(t.NodeEvent.CLICK,this.handleCreateEdge),e.off(t.ComboEvent.CLICK,this.handleCreateEdge),e.off(t.CanvasEvent.CLICK,this.cancelEdge),e.off(t.EdgeEvent.CLICK,this.cancelEdge),e.off(t.NodeEvent.DRAG_START,this.handleCreateEdge),e.off(t.ComboEvent.DRAG_START,this.handleCreateEdge),e.off(t.CommonEvent.POINTER_UP,this.drop),e.off(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}av.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:t=>t,onFinish:()=>{}};class sv extends Zh{constructor(t,e){super(t,Object.assign({},sv.defaultOptions,e)),this.isDragging=!1,this.onDragStart=t=>{this.validate(t)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=t=>{var e,n,r,i;if(!this.isDragging||_d.isPinching)return;const o=null!==(n=null===(e=t.movement)||void 0===e?void 0:e.x)&&void 0!==n?n:t.dx,a=null!==(i=null===(r=t.movement)||void 0===r?void 0:r.y)&&void 0!==i?i:t.dy;0!==(o|a)&&this.translate([o,a],!1)},this.onDragEnd=()=>{var t,e;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),null===(e=(t=this.options).onFinish)||void 0===e||e.call(t)},this.invokeOnFinish=be(()=>{var t,e;null===(e=(t=this.options).onFinish)||void 0===e||e.call(t)},300),this.shortcut=new jd(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:e}=this.options;if(qt(e)){const{up:t=[],down:n=[],left:r=[],right:i=[]}=e;this.shortcut.bind(t,t=>this.onTranslate([0,1],t)),this.shortcut.bind(n,t=>this.onTranslate([0,-1],t)),this.shortcut.bind(r,t=>this.onTranslate([1,0],t)),this.shortcut.bind(i,t=>this.onTranslate([-1,0],t))}else{const{graph:e}=this.context;e.on(t.CommonEvent.DRAG_START,this.onDragStart),e.on(t.CommonEvent.DRAG,this.onDrag),e.on(t.CommonEvent.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return Ge(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,r=-1*n;yield this.translate(nd(t,r),this.options.animation),this.invokeOnFinish()})}translate(t,e){return Ge(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),t=this.clampByRotation(t),yield this.context.graph.translateBy(t,e)})}clampByRotation([t,e]){return pd([t,e],this.context.graph.getRotation())}clampByDirection([t,e]){const{direction:n}=this.options;return"x"===n?e=0:"y"===n&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:r}=this.context,[i,o]=r.getSize(),[a,s,l,c]=ch(this.options.range),u=[o*a,i*s,o*l,i*c],h=vh(gh(n.getCanvasCenter()),u),d=ed(n.getViewportCenter(),[t,e,0]);if(!yh(d,h)){const{min:[n,r],max:[i,o]}=h;(d[0]<n&&t>0||d[0]>i&&t<0)&&(t=0),(d[1]<r&&e>0||d[1]>o&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return"function"==typeof e?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:e}=this.context;e.off(t.CommonEvent.DRAG_START,this.onDragStart),e.off(t.CommonEvent.DRAG,this.onDrag),e.off(t.CommonEvent.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}sv.defaultOptions={enable:t=>!("targetType"in t)||"canvas"===t.targetType,sensitivity:10,direction:"both",range:1/0};class lv extends Zh{constructor(e,n){super(e,Object.assign({},lv.defaultOptions,n)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=t=>Ge(this,void 0,void 0,function*(){var e;if("link"!==this.options.dropEffect)return;const{model:n,element:r}=this.context,i=t.target.id;this.target.forEach(t=>{const e=n.getParentData(t,Fu);e&&Ih(e)===i&&n.refreshComboData(i),n.setParent(t,i,Fu)}),yield null===(e=null==r?void 0:r.draw({animation:!0}))||void 0===e?void 0:e.finished}),this.setCursor=e=>{if(this.isDragging)return;const{type:n}=e,{canvas:r}=this.context,{cursor:i}=this.options;n===t.CommonEvent.POINTER_ENTER?r.setCursor((null==i?void 0:i.grab)||"grab"):r.setCursor((null==i?void 0:i.default)||"default")},this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:e,canvas:n}=this.context,r=n.getLayer().getContextService().$canvas;r&&(r.addEventListener("blur",this.onDragEnd),r.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(n=>{e.on(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.on(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.on(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd),e.on(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.setCursor),e.on(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(e.on(t.ComboEvent.DROP,this.onDrop),e.on(t.CanvasEvent.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(t=>t.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return rd([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:r,graph:i}=this.context;r.setCursor((null===(e=this.options.cursor)||void 0===e?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const o=t.target.id;i.getElementState(o).includes(this.options.state)?this.target=this.getSelectedNodeIDs([o]):this.target=[o],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(!this.enable)return;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:t=0,y:e=0}=this.shadow.attributes,[n,r]=ed([+t,+e],this.shadowOrigin);this.moveElement(this.target,[n,r])}this.showEdges(),null===(e=(t=this.options).onFinish)||void 0===e||e.call(t,this.target);const{batch:r,canvas:i}=this.context;r.endBatch(),i.setCursor((null===(n=this.options.cursor)||void 0===n?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}validate(t){if(this.destroyed||rv(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}clampByRotation([t,e]){return pd([t,e],this.context.graph.getRotation())}moveElement(t,e){return Ge(this,void 0,void 0,function*(){const{graph:n,model:r}=this.context,{dropEffect:i}=this.options;"move"===i&&t.forEach(t=>r.refreshComboData(t)),n.translateElementBy(Object.fromEntries(t.map(t=>[t,this.clampByRotation(e)])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[r,i]=t;this.shadow.attr({x:+e+r,y:+n+i})}createShadow(t){const e=Kd(this.options,"shadow"),n=mh(t.map(t=>this.context.element.getElement(t).getBounds())),[r,i]=n.min;this.shadowOrigin=[r,i];const[o,a]=fh(n),s={width:o,height:a,x:r,y:i};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),s),{visibility:"visible"})):(this.shadow=new fc({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),s),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||0===this.hiddenEdges.length||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if("none"===t||e)return;const{graph:n}=this.context;this.hiddenEdges="all"===t?n.getEdgeData().map(Ih):Array.from(new Set(this.target.map(e=>n.getRelatedEdgesData(e,t).map(Ih)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:e,canvas:n}=this.context,r=n.getLayer().getContextService().$canvas;r&&(r.removeEventListener("blur",this.onDragEnd),r.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(n=>{e.off(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.off(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.off(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd),e.off(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.setCursor),e.off(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.setCursor)}),e.off(`combo:${t.CommonEvent.DROP}`,this.onDrop),e.off(`canvas:${t.CommonEvent.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),null===(t=this.shadow)||void 0===t||t.destroy(),super.destroy()}}lv.defaultOptions={animation:!0,enable:t=>["node","combo"].includes(t.targetType),dropEffect:"move",state:"selected",hideEdge:"none",shadow:!1,shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5],cursor:{default:"default",grab:"grab",grabbing:"grabbing"}};var cv=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this._events[t]||[],o=this._events["*"]||[],a=function(r){for(var i=r.length,o=0;o<i;o++)if(r[o]){var a=r[o],s=a.callback;a.once&&(r.splice(o,1),0===r.length&&delete e._events[t],i--,o--),s.apply(e,n)}};a(i),a(o)},t.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function uv(t,e,n,r){for(;t.length;){const i=t.shift();if(n(i))return!0;e.add(i.id),r(i.id).forEach(n=>{e.has(n.id)||(e.add(n.id),t.push(n))})}return!1}function hv(t,e,n,r){if(n(t))return!0;e.add(t.id);for(const i of r(t.id))if(!e.has(i.id)&&hv(i,e,n,r))return!0;return!1}const dv=()=>!0;class fv{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||dv,n=t.edgeFilter||dv;this.nodeFilter=e,this.edgeFilter=t=>{const{source:r,target:i}=this.graph.getEdgeDetail(t.id);return!(!e(r)||!e(i))&&n(t,r,i)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))};updateCache=t=>{const e=new Set;t.forEach(t=>{const n=this.bothEdgesMap.get(t);if(n&&n.forEach(t=>e.add(t.id)),this.hasNode(t)){const n=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),r=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),i=Array.from(new Set([...n,...r]));i.forEach(t=>e.add(t.id)),this.inEdgesMap.set(t,n),this.outEdgesMap.set(t,r),this.bothEdgesMap.set(t,i),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)}),e.forEach(t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)})};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":case"NodeRemoved":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":"source"!==n.propertyName&&"target"!==n.propertyName||(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const r=t.graph.getEdge(n.id);e.add(r.source),e.add(r.target)}}}),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some(e=>e.id===t)}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),this.cacheEnabled)return"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t);return this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map(t=>this.getNode(t.target));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map(t=>this.getNode(t.source));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return n&&this.nodeFilter(n)?n:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];uv([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];hv(this.getNode(t),new Set,e,r)}}let pv=class t extends cv{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach(t=>{switch(t.type){case"NodeRemoved":{let n=!1;e=e.filter(e=>{if("NodeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id}),n||e.push(t);break}case"EdgeRemoved":{let n=!1;e=e.filter(e=>{if("EdgeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id}),n||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const n=e.findIndex(e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName)),r=e[n];r?void 0!==t.propertyName?r.newValue=t.newValue:(e.splice(n,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter(e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey),e.push(t);break;case"TreeStructureChanged":{const n=e.find(e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId);n?n.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}}),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some(e=>e.id===t)}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map(t=>this.getNode(t.target));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map(t=>this.getNode(t.source));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach(e=>{e.childrenMap.set(t.id,new Set)}),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch(()=>{for(const e of t)this.doAddNode(e)})}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),n=this.bothEdgesMap.get(t);n?.forEach(t=>this.doRemoveEdge(t.id)),this.nodeMap.delete(t),this.treeIndices.forEach(n=>{n.childrenMap.get(t)?.forEach(t=>{n.parentMap.delete(t.id)});const r=n.parentMap.get(t);r&&n.childrenMap.get(r.id)?.delete(e),n.parentMap.delete(t),n.childrenMap.delete(t)}),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch(()=>{t.forEach(t=>this.doRemoveNode(t))})}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,n){const r=this.getNode(t);this.batch(()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})})}mergeNodeData(t,e){this.batch(()=>{Object.entries(e).forEach(([e,n])=>{this.updateNodeDataProperty(t,e,n)})})}updateNodeData(...t){const e=t[0],n=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch(()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:i})})}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),n=this.outEdgesMap.get(t.source),r=this.bothEdgesMap.get(t.source),i=this.bothEdgesMap.get(t.target);e.add(t),n.add(t),r.add(t),i.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch(()=>{for(const e of t)this.doAddEdge(e)})}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),n=this.outEdgesMap.get(e.source),r=this.inEdgesMap.get(e.target),i=this.bothEdgesMap.get(e.source),o=this.bothEdgesMap.get(e.target);n.delete(e),r.delete(e),i.delete(e),o.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch(()=>{t.forEach(t=>this.doRemoveEdge(t))})}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.source,i=e;this.outEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.outEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.source=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:r,newValue:i})})}updateEdgeTarget(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.target,i=e;this.inEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.inEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.target=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:r,newValue:i})})}updateEdgeDataProperty(t,e,n){const r=this.getEdge(t);this.batch(()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})})}updateEdgeData(...t){const e=t[0],n=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch(()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:i})})}mergeEdgeData(t,e){this.batch(()=>{Object.entries(e).forEach(([e,n])=>{this.updateEdgeDataProperty(t,e,n)})})}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})}))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})})}addTree(t,e){this.batch(()=>{this.attachTreeStructure(e);const n=[],r=Array.isArray(t)?t:[t];for(;r.length;){const t=r.shift();n.push(t),t.children&&r.push(...t.children)}this.addNodes(n),n.forEach(t=>{t.children?.forEach(n=>{this.setParent(n.id,t.id,e)})})})}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter(e=>!this.getParent(e.id,t))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const n=this.treeIndices.get(e).childrenMap.get(t);return Array.from(n||[])}getParent(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);return this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const n=[];let r,i=this.getNode(t);for(;r=this.getParent(i.id,e);)n.push(r),i=r;return n}setParent(t,e,n){this.checkTreeExistence(n);const r=this.treeIndices.get(n);if(!r)return;const i=this.getNode(t),o=r.parentMap.get(t);if(o?.id===e)return;if(null==e)return o&&r.childrenMap.get(o.id)?.delete(i),void r.parentMap.delete(t);const a=this.getNode(e);r.parentMap.set(t,a),o&&r.childrenMap.get(o.id)?.delete(i);let s=r.childrenMap.get(a.id);s||(s=new Set,r.childrenMap.set(a.id,s)),s.add(i),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:n,nodeId:t,oldParentId:o?.id,newParentId:a.id})})}dfsTree(t,e,n){return hv(this.getNode(t),new Set,e,t=>this.getChildren(t,n))}bfsTree(t,e,n){return uv([this.getNode(t)],new Set,e,t=>this.getChildren(t,n))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return uv([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return hv(this.getNode(t),new Set,e,r)}clone(){const e=this.getAllNodes().map(t=>({...t,data:{...t.data}})),n=this.getAllEdges().map(t=>({...t,data:{...t.data}})),r=new t({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:t,childrenMap:e},n)=>{const i=new Map;t.forEach((t,e)=>{i.set(e,r.getNode(t.id))});const o=new Map;e.forEach((t,e)=>{o.set(e,new Set(Array.from(t).map(t=>r.getNode(t.id))))}),r.treeIndices.set(n,{parentMap:i,childrenMap:o})}),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new fv({graph:this,...t})}};class gv{constructor(t,e){this.context=t,this.options=e||{}}}function vv(t){const{nodes:e,edges:n}=t,r={nodes:[],edges:[],combos:[]};return e.forEach(t=>{const e=t.data._isCombo?r.combos:r.nodes,{x:n,y:i,z:o=0}=t.data;null==e||e.push({id:t.id,style:{x:n,y:i,z:o}})}),n.forEach(t=>{const{id:e,source:n,target:i,data:{points:o=[],controlPoints:a=o.slice(1,o.length-1)}}=t;r.edges.push({id:e,source:n,target:i,style:Object.assign({},(null==a?void 0:a.length)?{controlPoints:a.map(Ed)}:{})})}),r}function mv(t,e,...n){if(e in t)return t[e](...n);if("instance"in t){const r=t.instance;if(e in r)return r[e](...n)}return null}function yv(t,e){if(e in t)return t[e];if("instance"in t){const n=t.instance;if(e in n)return n[e]}return null}class bv extends lv{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find(t=>["d3-force","d3-force-3d"].includes(null==t?void 0:t.id))}validate(t){return!!this.context.layout&&(this.forceLayoutInstance?super.validate(t):($u("DragElementForce only works with d3-force or d3-force-3d layout"),!1))}moveElement(t,e){return Ge(this,void 0,void 0,function*(){const n=this.forceLayoutInstance;this.context.graph.getNodeData(t).forEach((r,i)=>{const{x:o=0,y:a=0}=r.style||{};n&&mv(n,"setFixedPosition",t[i],[...td([+o,+a],this.clampByRotation(e))])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&yv(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(t=>{const{x:n=0,y:r=0}=t.style||{};e&&mv(e,"setFixedPosition",Ih(t),[+n,+r])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&yv(t,"simulation").alphaTarget(0),this.options.fixed||this.context.graph.getNodeData(this.target).forEach(e=>{t&&mv(t,"setFixedPosition",Ih(e),[null,null,null])})}}class xv extends Zh{constructor(t,e){super(t,Object.assign({},xv.defaultOptions,e)),this.isZoomEvent=t=>Boolean(t.data&&"scale"in t.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=t=>Ge(this,void 0,void 0,function*(){if(!this.validate(t))return;const{graph:e}=this.context,{state:n,nodeFilter:r,edgeFilter:i,comboFilter:o}=this.options,a=(n?e.getElementDataByState("node",n):e.getNodeData()).filter(r),s=(n?e.getElementDataByState("edge",n):e.getEdgeData()).filter(i),l=(n?e.getElementDataByState("combo",n):e.getComboData()).filter(o),c=this.isZoomEvent(t)?this.zoom=Math.max(.01,Math.min(t.data.scale,10)):this.zoom,u=[...a,...l];u.length>0&&u.forEach(t=>this.fixNodeLike(t,c)),this.updateRelatedEdges(),s.length>0&&s.forEach(t=>this.fixEdge(t,c))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(t,e,n)=>{var r;const i=this.cachedStyles.get(t)||[],o=(null===(r=i.find(t=>t.shape===e))||void 0===r?void 0:r.style)||{};return n in o||(o[n]=e.attributes[n],this.cachedStyles.set(t,[...i.filter(t=>t.shape!==e),{shape:e,style:o}])),o[n]},this.scaleEntireElement=(t,e,n)=>{e.setLocalScale(1/n);const r=this.cachedStyles.get(t)||[];r.push({shape:e}),this.cachedStyles.set(t,r)},this.scaleSpecificShapes=(t,e,n)=>{const r=function(t){const e=[],n=t=>{(null==t?void 0:t.children.length)&&t.children.forEach(t=>{e.push(t),n(t)})};return n(t),e}(t);(Array.isArray(n)?n:[n]).forEach(n=>{const{shape:i,fields:o}=n,a="function"==typeof i?i(r):t.getShape(i);a&&(o?o.forEach(n=>{const r=this.getOriginalFieldValue(t.id,a,n);ae(r)&&(a.style[n]=r/e)}):this.scaleEntireElement(t.id,a,e))})},this.skipIfExceedViewport=t=>{const{viewport:e}=this.context;return!(null==e?void 0:e.isInViewport(t.getRenderBounds(),!1,30))},this.fixNodeLike=(t,e)=>{const n=Ih(t),{element:r,model:i}=this.context,o=r.getElement(n);if(!o||this.skipIfExceedViewport(o))return;i.getRelatedEdgesData(n).forEach(t=>this.relatedEdgeToUpdate.add(Ih(t)));const a=this.options[o.type];a?this.scaleSpecificShapes(o,e,a):this.scaleEntireElement(n,o,e)},this.fixEdge=(t,e)=>{const n=Ih(t),r=this.context.element.getElement(n);if(!r||this.skipIfExceedViewport(r))return;const i=this.options.edge;if(!i)return r.style.transformOrigin="center",void this.scaleEntireElement(n,r,e);this.scaleSpecificShapes(r,e,i)},this.updateRelatedEdges=()=>{const{element:t}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(e=>{const n=t.getElement(e);null==n||n.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=t=>Ge(this,void 0,void 0,function*(){var e;(null===(e=t.data)||void 0===e?void 0:e.firstRender)||(this.options.reset?this.restoreCachedStyles():this.fixElementSize({data:{scale:this.zoom}}))}),this.bindEvents()}restoreCachedStyles(){if(this.cachedStyles.size>0){this.cachedStyles.forEach(t=>{t.forEach(({shape:t,style:e})=>{if(Ne(e))t.setLocalScale(1);else{if(this.options.state)return;Object.entries(e).forEach(([e,n])=>t.style[e]=n)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(e=>e&&"node"===t.getElementType(e));if(n.length>0){const r=new Set;n.forEach(e=>{t.getRelatedEdgesData(e).forEach(t=>r.add(Ih(t)))}),r.forEach(t=>{const n=null==e?void 0:e.getElement(t);null==n||n.update({})})}}}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.resetTransform),e.on(t.GraphEvent.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.resetTransform),e.off(t.GraphEvent.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}xv.defaultOptions={enable:t=>t.data.scale<1,nodeFilter:()=>!0,edgeFilter:()=>!0,comboFilter:()=>!0,edge:[{shape:"key",fields:["lineWidth"]},{shape:"halo",fields:["lineWidth"]},{shape:"label"}],reset:!1};class Ev extends Zh{constructor(t,e){super(t,Object.assign({},Ev.defaultOptions,e)),this.focus=t=>Ge(this,void 0,void 0,function*(){if(!this.validate(t))return;const{graph:e}=this.context;yield e.focusElement(t.target.id,this.options.animation)}),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),Gd.forEach(n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;Gd.forEach(n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}Ev.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class wv extends Zh{constructor(e,n){super(e,Object.assign({},wv.defaultOptions,n)),this.isFrozen=!1,this.toggleFrozen=t=>{this.isFrozen="dragstart"===t.type},this.hoverElement=e=>{if(!this.validate(e))return;const n=e.type===t.CommonEvent.POINTER_ENTER;this.updateElementsState(e,n);const{onHover:r,onHoverEnd:i}=this.options;n?null==r||r(e):null==i||i(e)},this.updateElementsState=(t,e)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:n}=this.context,{state:r,animation:i,inactiveState:o}=this.options,a=this.getActiveIds(t),s={};if(r&&Object.assign(s,this.getElementsState(a,r,e)),o){const t=Bh(n.getData(),!0).filter(t=>!a.includes(t));Object.assign(s,this.getElementsState(t,o,e))}n.setElementState(s,i)},this.getElementsState=(t,e,n)=>{const{graph:r}=this.context,i={};return t.forEach(t=>{const o=r.getElementState(t);i[t]=n?o.includes(e)?o:[...o,e]:o.filter(t=>t!==e)}),i},this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),Gd.forEach(n=>{e.on(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.hoverElement),e.on(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.hoverElement)});const n=this.context.canvas.document;n.addEventListener(`${t.CommonEvent.DRAG_START}`,this.toggleFrozen),n.addEventListener(`${t.CommonEvent.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:r}=this.options,i=t.target.id;return n?Wd(e,t.targetType,i,"function"==typeof n?n(t):n,r):[i]}validate(t){if(this.destroyed||this.isFrozen||rv(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;Gd.forEach(n=>{e.off(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.hoverElement),e.off(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.hoverElement)});const n=this.context.canvas.document;n.removeEventListener(`${t.CommonEvent.DRAG_START}`,this.toggleFrozen),n.removeEventListener(`${t.CommonEvent.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}wv.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class kv extends Bd{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e,graph:n}=this.context;this.pathShape=new lc({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[Fd(t,n)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:r}=this.options;this.points.push(Fd(t,this.context.graph)),null===(e=this.pathShape)||void 0===e||e.setAttribute("d",function(t,e=!0){const n=[];return t.forEach((t,e)=>{n.push([0===e?"M":"L",...t])}),e&&n.push(["Z"]),n}(this.points)),n&&"default"===r&&this.points.length>2&&super.updateElementsStates(this.points)}onPointerUp(){this.points&&(this.points.length<2||super.updateElementsStates(this.points),this.clearLasso())}clearLasso(){var t;null===(t=this.pathShape)||void 0===t||t.remove(),this.pathShape=void 0,this.points=void 0}}class Mv extends Zh{constructor(t,e){super(t,Object.assign({},Mv.defaultOptions,e)),this.hiddenShapes=[],this.isVisible=!0,this.setElementsVisibility=(t,e,n)=>{t.filter(Boolean).forEach(t=>{"hidden"!==e||t.isVisible()?"visible"===e&&this.hiddenShapes.includes(t)?this.hiddenShapes.splice(this.hiddenShapes.indexOf(t),1):qh(t,e,n):this.hiddenShapes.push(t)})},this.filterShapes=(t,e)=>{if(Ut(e))return n=>!e(t,n);const n=null==e?void 0:e[t];return t=>!t.className||!(null==n?void 0:n.includes(t.className))},this.hideShapes=t=>{if(!this.validate(t)||!this.isVisible)return;const{element:e}=this.context,{shapes:n={}}=this.options;this.setElementsVisibility(e.getNodes(),"hidden",this.filterShapes("node",n)),this.setElementsVisibility(e.getEdges(),"hidden",this.filterShapes("edge",n)),this.setElementsVisibility(e.getCombos(),"hidden",this.filterShapes("combo",n)),this.isVisible=!1},this.showShapes=be(t=>{if(!this.validate(t)||this.isVisible)return;const{element:e}=this.context;this.setElementsVisibility(e.getNodes(),"visible"),this.setElementsVisibility(e.getEdges(),"visible"),this.setElementsVisibility(e.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.BEFORE_TRANSFORM,this.hideShapes),e.on(t.GraphEvent.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.BEFORE_TRANSFORM,this.hideShapes),e.off(t.GraphEvent.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Mv.defaultOptions={enable:!0,debounce:200,shapes:t=>"node"===t};class Sv extends Zh{constructor(t,e){super(t,Object.assign({},Sv.defaultOptions,e)),this.onWheel=t=>Ge(this,void 0,void 0,function*(){this.options.preventDefault&&t.preventDefault();const e=t.deltaX,n=t.deltaY;yield this.scroll([-e,-n],t)}),this.shortcut=new jd(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var e,n;const{trigger:r}=this.options;if(this.shortcut.unbindAll(),qt(r)){null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.onWheel);const{up:n=[],down:i=[],left:o=[],right:a=[]}=r;this.shortcut.bind(n,t=>this.scroll([0,-10],t)),this.shortcut.bind(i,t=>this.scroll([0,10],t)),this.shortcut.bind(o,t=>this.scroll([-10,0],t)),this.shortcut.bind(a,t=>this.scroll([10,0],t))}else null===(n=this.graphDom)||void 0===n||n.addEventListener(t.CommonEvent.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=nd(t,e),t=this.clampByDirection(t),t=this.clampByRange(t)}clampByDirection([t,e]){const{direction:n}=this.options;return"x"===n?e=0:"y"===n&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:r}=this.context,[i,o]=r.getSize(),[a,s,l,c]=ch(this.options.range),u=[o*a,i*s,o*l,i*c],h=vh(gh(n.getCanvasCenter()),u),d=ed(n.getViewportCenter(),[t,e,0]);if(!yh(d,h)){const{min:[n,r],max:[i,o]}=h;(d[0]<n&&t>0||d[0]>i&&t<0)&&(t=0),(d[1]<r&&e>0||d[1]>o&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return Ge(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,r=this.context.graph,i=this.formatDisplacement(t);yield r.translateBy(i,!1),null==n||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}destroy(){var e;this.shortcut.destroy(),null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.onWheel),super.destroy()}}Sv.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};class Nv extends Zh{constructor(t,e){super(t,Object.assign({},Nv.defaultOptions,e)),this.zoom=(t,e,n)=>Ge(this,void 0,void 0,function*(){if(!this.validate(e))return;const{graph:r}=this.context;let i=this.options.origin;!i&&"viewport"in e&&(i=Ed(e.viewport));const{sensitivity:o,onFinish:a}=this.options,s=1+oe(t,-50,50)*o/100,l=r.getZoom();yield r.zoomTo(l*s,n,i),null==a||a()}),this.onReset=()=>Ge(this,void 0,void 0,function*(){yield this.context.graph.zoomTo(1,this.options.animation)}),this.preventDefault=t=>{this.options.preventDefault&&t.preventDefault()},this.shortcut=new jd(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:e}=this.options;if(this.shortcut.unbindAll(),Array.isArray(e))if(e.includes(t.CommonEvent.PINCH))this.shortcut.bind([t.CommonEvent.PINCH],t=>{this.zoom(t.scale,t,!1)});else{const n=this.context.canvas.getContainer();null==n||n.addEventListener(t.CommonEvent.WHEEL,this.preventDefault),this.shortcut.bind([...e,t.CommonEvent.WHEEL],t=>{const{deltaX:e,deltaY:n}=t;this.zoom(-(null!=n?n:e),t,!1)})}if("object"==typeof e){const{zoomIn:t=[],zoomOut:n=[],reset:r=[]}=e;this.shortcut.bind(t,t=>this.zoom(10,t,this.options.animation)),this.shortcut.bind(n,t=>this.zoom(-10,t,this.options.animation)),this.shortcut.bind(r,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ut(e)?e(t):!!e}destroy(){var e;this.shortcut.destroy(),null===(e=this.context.canvas.getContainer())||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.preventDefault),super.destroy()}}Nv.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};var Tv={assign:Object.assign,getHeight:function(t,e,n,r){return void 0===r&&(r="height"),"center"===n?(t[r]+e[r])/2:t.height}},Ov=Tv,Cv={getId:function(t){return t.id||t.name},getPreH:function(t){return t.preH||0},getPreV:function(t){return t.preV||0},getHGap:function(t){return t.hgap||18},getVGap:function(t){return t.vgap||18},getChildren:function(t){return t.children},getHeight:function(t){return t.height||36},getWidth:function(t){var e=t.label||" ";return t.width||18*e.split("").length}};function Av(t,e){var n=this;if(n.vgap=n.hgap=0,t instanceof Av)return t;n.data=t;var r=e.getHGap(t),i=e.getVGap(t);return n.preH=e.getPreH(t),n.preV=e.getPreV(t),n.width=e.getWidth(t),n.height=e.getHeight(t),n.width+=n.preH,n.height+=n.preV,n.id=e.getId(t),n.x=n.y=0,n.depth=0,n.children||(n.children=[]),n.addGap(r,i),n}Ov.assign(Av.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(t,e){var n=this;n.hgap+=t,n.vgap+=e,n.width+=2*t,n.height+=2*e},eachNode:function(t){for(var e,n=[this];e=n.shift();)t(e),n=e.children.concat(n)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e,n=[this];e=n.shift();)t(e),n=n.concat(e.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t},translate:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.eachNode(function(n){n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(t){t.x=t.x-2*(t.x-e.left)-t.width}),t.translate(e.width,0)},bottom2top:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(t){t.y=t.y-2*(t.y-e.top)-t.height}),t.translate(0,e.height)}});var Pv=function(t,e,n){void 0===e&&(e={});var r,i=new Av(t,e=Ov.assign({},Cv,e)),o=[i];if(!n&&!t.collapsed)for(;r=o.shift();)if(!r.data.collapsed){var a=e.getChildren(r.data),s=a?a.length:0;if(r.children=new Array(s),a&&s)for(var l=0;l<s;l++){var c=new Av(a[l],e);r.children[l]=c,o.push(c),c.parent=r,c.depth=r.depth+1}}return i},Rv=Pv,Dv=function(){function t(t,e){void 0===e&&(e={});this.options=e,this.rootNode=Rv(t,e)}return t.prototype.execute=function(){throw new Error("please override this method")},t}(),Lv=Dv;function _v(t,e,n,r){void 0===r&&(r=[]);var i=this;i.w=t||0,i.h=e||0,i.y=n||0,i.x=0,i.c=r||[],i.cs=r.length,i.prelim=0,i.mod=0,i.shift=0,i.change=0,i.tl=null,i.tr=null,i.el=null,i.er=null,i.msel=0,i.mser=0}function Iv(t,e,n){n?t.y+=e:t.x+=e,t.children.forEach(function(t){Iv(t,e,n)})}function jv(t,e){var n=e?t.y:t.x;return t.children.forEach(function(t){n=Math.min(jv(t,e),n)}),n}function Bv(t,e){Iv(t,-jv(t,e),e)}function Fv(t,e,n){n?e.y=t.x:e.x=t.x,t.c.forEach(function(t,r){Fv(t,e.children[r],n)})}function zv(t,e,n){void 0===n&&(n=0),e?(t.x=n,n+=t.width):(t.y=n,n+=t.height),t.children.forEach(function(t){zv(t,e,n)})}_v.fromNode=function(t,e){if(!t)return null;var n=[];return t.children.forEach(function(t){n.push(_v.fromNode(t,e))}),e?new _v(t.height,t.width,t.x,n):new _v(t.width,t.height,t.y,n)};var Gv=Pv,Vv=function(t,e){for(var n=Gv(t.data,e,!0),r=Gv(t.data,e,!0),i=t.children.length,o=Math.round(i/2),a=e.getSide||function(t,e){return e<o?"right":"left"},s=0;s<i;s++){var l=t.children[s];"right"===a(l,s)?r.children.push(l):n.children.push(l)}return n.eachNode(function(t){t.isRoot()||(t.side="left")}),r.eachNode(function(t){t.isRoot()||(t.side="right")}),{left:n,right:r}},Wv=Vv,Hv=["LR","RL","TB","BT","H","V"],Uv=["LR","RL","H"],$v=Hv[0],Yv=function(t,e,n){var r=e.direction||$v;if(e.isHorizontal=function(t){return Uv.indexOf(t)>-1}(r),-1===Hv.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Hv[0])n(t,e);else if(r===Hv[1])n(t,e),t.right2left();else if(r===Hv[2])n(t,e);else if(r===Hv[3])n(t,e),t.bottom2top();else if(r===Hv[4]||r===Hv[5]){var i=Wv(t,e),o=i.left,a=i.right;n(o,e),n(a,e),e.isHorizontal?o.right2left():o.bottom2top(),a.translate(o.x-a.x,o.y-a.y),t.x=o.x,t.y=a.y;var s=t.getBoundingBox();e.isHorizontal?s.top<0&&t.translate(0,-s.top):s.left<0&&t.translate(-s.left,0)}var l=e.fixedRoot;return void 0===l&&(l=!0),l&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),function(t,e){if(e.radial){var n=e.isHorizontal?["x","y"]:["y","x"],r=n[0],i=n[1],o={x:1/0,y:1/0},a={x:-1/0,y:-1/0},s=0;t.DFTraverse(function(t){s++;var e=t.x,n=t.y;o.x=Math.min(o.x,e),o.y=Math.min(o.y,n),a.x=Math.max(a.x,e),a.y=Math.max(a.y,n)});var l=a[i]-o[i];if(0===l)return;var c=2*Math.PI/s;t.DFTraverse(function(e){var n=(e[i]-o[i])/l*(2*Math.PI-c)+c,a=e[r]-t[r];e.x=Math.cos(n)*a,e.y=Math.sin(n)*a})}}(t,e),t};function qv(t,e){return qv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qv(t,e)}var Xv=function(t,e){void 0===e&&(e={});var n=e.isHorizontal;function r(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function i(t,e,n){for(var r=t.c[e-1],i=r.mod,c=t.c[e],u=c.mod;null!==r&&null!==c;){l(r)>n.low&&(n=n.nxt);var h=i+r.prelim+r.w-(u+c.prelim);h>0&&(u+=h,o(t,e,n.index,h));var d=l(r),f=l(c);d<=f&&null!==(r=s(r))&&(i+=r.mod),d>=f&&null!==(c=a(c))&&(u+=c.mod)}!r&&c?function(t,e,n,r){var i=t.c[0].el;i.tl=n;var o=r-n.mod-t.c[0].msel;i.mod+=o,i.prelim-=o,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,c,u):r&&!c&&function(t,e,n,r){var i=t.c[e].er;i.tr=n;var o=r-n.mod-t.c[e].mser;i.mod+=o,i.prelim-=o,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,r,i)}function o(t,e,n,r){t.c[e].mod+=r,t.c[e].msel+=r,t.c[e].mser+=r,function(t,e,n,r){if(n!==e-1){var i=e-n;t.c[n+1].shift+=r/i,t.c[e].shift-=r/i,t.c[e].change-=r-r/i}}(t,e,n,r)}function a(t){return 0===t.cs?t.tl:t.c[0]}function s(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function l(t){return t.y+t.h}function c(t,e,n){for(;null!==n&&t>=n.low;)n=n.nxt;return{low:t,index:e,nxt:n}}zv(t,n);var u=_v.fromNode(t,n);return function t(e){if(0!==e.cs){t(e.c[0]);for(var n=c(l(e.c[0].el),0,null),o=1;o<e.cs;++o){t(e.c[o]);var a=l(e.c[o].er);i(e,o,n),n=c(a,o,n)}!function(t){t.prelim=(t.c[0].prelim+t.c[0].mod+t.c[t.cs-1].mod+t.c[t.cs-1].prelim+t.c[t.cs-1].w)/2-t.w/2}(e),r(e)}else r(e)}(u),function t(e,n){n+=e.mod,e.x=e.prelim+n,function(t){for(var e=0,n=0,r=0;r<t.cs;r++)n+=(e+=t.c[r].shift)+t.c[r].change,t.c[r].mod+=n}(e);for(var r=0;r<e.cs;r++)t(e.c[r],n)}(u,0),Fv(u,t,n),Bv(t,n),t},Kv=Yv,Zv=Tv,Qv=function(t){function e(){return t.apply(this,arguments)||this}var n,r;return r=t,(n=e).prototype=Object.create(r.prototype),n.prototype.constructor=n,qv(n,r),e.prototype.execute=function(){return Kv(this.rootNode,this.options,Xv)},e}(Lv),Jv={};var tm=function(t,e){return e=Zv.assign({},Jv,e),new Qv(t,e).execute()},em=Tv;function nm(t,e){void 0===e&&(e=[]);var n=this;n.x=n.y=0,n.leftChild=n.rightChild=null,n.height=0,n.children=e}var rm={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function im(t,e,n){n?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach(function(t,r){im(t,e.children[r],n)})}function om(t,e){return om=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},om(t,e)}var am=function(t,e){void 0===e&&(e={}),e=em.assign({},rm,e);var n,r=0;var i=function t(e){if(!e)return null;e.width=0,e.depth&&e.depth>r&&(r=e.depth);var n=e.children,i=n.length,o=new nm(e.height,[]);return n.forEach(function(e,n){var r=t(e);o.children.push(r),0===n&&(o.leftChild=r),n===i-1&&(o.rightChild=r)}),o.originNode=e,o.isLeaf=e.isLeaf(),o}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=r;else{var n=e.children.map(function(e){return t(e)}),i=Math.min.apply(null,n);e.drawingDepth=i-1}return e.drawingDepth}(i),function t(r){r.x=r.drawingDepth*e.rankSep,r.isLeaf?(r.y=0,n&&(r.y=n.y+n.height+e.nodeSep,r.originNode.parent!==n.originNode.parent&&(r.y+=e.subTreeSep)),n=r):(r.children.forEach(function(e){t(e)}),r.y=(r.leftChild.y+r.rightChild.y)/2)}(i),im(i,t,e.isHorizontal),t},sm=Yv,lm=Tv,cm=function(t){function e(){return t.apply(this,arguments)||this}var n,r;return r=t,(n=e).prototype=Object.create(r.prototype),n.prototype.constructor=n,om(n,r),e.prototype.execute=function(){var t=this;return t.rootNode.width=0,sm(t.rootNode,t.options,am)},e}(Lv),um={};var hm=function(t,e){return e=lm.assign({},um,e),new cm(t,e).execute()},dm=Tv;function fm(t,e){return fm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fm(t,e)}var pm=Lv,gm=function(t,e,n,r){var i=null;t.eachNode(function(t){!function(t,e,n,r,i){var o=("function"==typeof n?n(t):n)*t.depth;if(!r)try{if(t.id===t.parent.children[0].id)return t.x+=o,void(t.y=e?e.y:0)}catch(t){}if(t.x+=o,e){if(t.y=e.y+dm.getHeight(e,t,i),e.parent&&t.parent.id!==e.parent.id){var a=e.parent,s=a.y+dm.getHeight(a,t,i);t.y=s>t.y?s:t.y}}else t.y=0}(t,i,e,n,r),i=t})},vm=Vv,mm=Tv,ym=["LR","RL","H"],bm=ym[0],xm=function(t){function e(){return t.apply(this,arguments)||this}var n,r;return r=t,(n=e).prototype=Object.create(r.prototype),n.prototype.constructor=n,fm(n,r),e.prototype.execute=function(){var t=this.options,e=this.rootNode;t.isHorizontal=!0;var n=t.indent,r=void 0===n?20:n,i=t.dropCap,o=void 0===i||i,a=t.direction,s=void 0===a?bm:a,l=t.align;if(s&&-1===ym.indexOf(s))throw new TypeError("Invalid direction: "+s);if(s===ym[0])gm(e,r,o,l);else if(s===ym[1])gm(e,r,o,l),e.right2left();else if(s===ym[2]){var c=vm(e,t),u=c.left,h=c.right;gm(u,r,o,l),u.right2left(),gm(h,r,o,l);var d=u.getBoundingBox();h.translate(d.width,0),e.x=h.x-e.width/2}return e},e}(pm),Em={};var wm=function(t,e){return e=mm.assign({},Em,e),new xm(t,e).execute()},km=Tv;function Mm(t,e){var n=0;return t.children.length?t.children.forEach(function(t){n+=Mm(t,e)}):n=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,n)+2*t._subTreeSep,t.totalHeight}function Sm(t){var e=t.children,n=e.length;if(n){e.forEach(function(t){Sm(t)});var r=e[0],i=e[n-1],o=i.y-r.y+i.height,a=0;if(e.forEach(function(t){a+=t.totalHeight}),o>t.height)t.y=r.y+o/2-t.height/2;else if(1!==e.length||t.height>a){var s=t.y+(t.height-o)/2-r.y;e.forEach(function(t){t.translate(0,s)})}else t.y=(r.y+r.height/2+i.y+i.height/2)/2-t.height/2}}var Nm={getSubTreeSep:function(){return 0}};function Tm(t,e){return Tm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tm(t,e)}var Om=function(t,e){void 0===e&&(e={}),e=km.assign({},Nm,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse(function(t){t.x=t.parent.x+t.parent.width}),t.parent=null,Mm(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode(function(t){var e=t.children,n=e.length;if(n){var r=e[0];if(r.startY=t.startY+t._subTreeSep,1===n)r.y=t.y+t.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var i=1;i<n;i++){var o=e[i];o.startY=e[i-1].startY+e[i-1].totalHeight,o.y=o.startY+o.totalHeight/2-o.height/2}}}}),Sm(t)},Cm=Yv,Am=Tv,Pm=function(t){function e(){return t.apply(this,arguments)||this}var n,r;return r=t,(n=e).prototype=Object.create(r.prototype),n.prototype.constructor=n,Tm(n,r),e.prototype.execute=function(){return Cm(this.rootNode,this.options,Om)},e}(Lv),Rm={};var Dm=function(t,e){return e=Am.assign({},Rm,e),new Pm(t,e).execute()},Lm={compactBox:tm,dendrogram:hm,indented:wm,mindmap:Dm};const _m=(t,e)=>{if("next"!==t&&"prev"!==t)return e},Im=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};let jm=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return Im(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&Im(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,_m)),n=null==n?void 0:n.prev;return`[${t.join(", ")}]`}},Bm=class extends jm{};const Fm=()=>1,zm=(t,e,n)=>{let r=[];const i=e[e.length-1],o=e[0];let a;for(;t.getAllNodes().length;){for(;a=o.dequeue();)Gm(t,e,n,a);for(;a=i.dequeue();)Gm(t,e,n,a);if(t.getAllNodes().length)for(let i=e.length-2;i>0;--i)if(a=e[i].dequeue(),a){r=r.concat(Gm(t,e,n,a,!0));break}}return r},Gm=(t,e,n,r,i)=>{var o,a;const s=[];return t.hasNode(r.v)&&(null===(o=t.getRelatedEdges(r.v,"in"))||void 0===o||o.forEach(r=>{const o=r.data.weight,a=t.getNode(r.source);i&&s.push({v:r.source,w:r.target,in:0,out:0}),void 0===a.data.out&&(a.data.out=0),a.data.out-=o,Wm(e,n,Object.assign({v:a.id},a.data))}),null===(a=t.getRelatedEdges(r.v,"out"))||void 0===a||a.forEach(r=>{const i=r.data.weight,o=r.target,a=t.getNode(o);void 0===a.data.in&&(a.data.in=0),a.data.in-=i,Wm(e,n,Object.assign({v:a.id},a.data))}),t.removeNode(r.v)),i?s:void 0},Vm=(t,e)=>{const n=new pv;let r=0,i=0;t.getAllNodes().forEach(t=>{n.addNode({id:t.id,data:{v:t.id,in:0,out:0}})}),t.getAllEdges().forEach(t=>{const o=n.getRelatedEdges(t.source,"out").find(e=>e.target===t.target),a=(null==e?void 0:e(t))||1;o?n.updateEdgeData(null==o?void 0:o.id,Object.assign(Object.assign({},o.data),{weight:o.data.weight+a})):n.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:a}}),i=Math.max(i,n.getNode(t.source).data.out+=a),r=Math.max(r,n.getNode(t.target).data.in+=a)});const o=[],a=i+r+3;for(let t=0;t<a;t++)o.push(new Bm);const s=r+1;return n.getAllNodes().forEach(t=>{Wm(o,s,Object.assign({v:t.id},n.getNode(t.id).data))}),{buckets:o,zeroIdx:s,graph:n}},Wm=(t,e,n)=>{n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)},Hm=(t,e)=>{const n=((t,e)=>{var n;if(t.getAllNodes().length<=1)return[];const r=Vm(t,e||Fm);return null===(n=zm(r.graph,r.buckets,r.zeroIdx).map(e=>t.getRelatedEdges(e.v,"out").filter(({target:t})=>t===e.w)))||void 0===n?void 0:n.flat()})(t,t=>t.data.weight||1);null==n||n.forEach(e=>{const n=e.data;t.removeEdge(e.id),n.forwardName=e.data.name,n.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},n)})})},Um=(t,e,n,r)=>{let i;do{i=`${r}${Math.random()}`}while(t.hasNode(i));return n.dummy=e,t.addNode({id:i,data:n}),i},$m=t=>{const e=new pv;return t.getAllNodes().forEach(n=>{t.getChildren(n.id).length||e.addNode(Object.assign({},n))}),t.getAllEdges().forEach(t=>{e.addEdge(t)}),e},Ym=(t,e)=>{const n=Number(t.x),r=Number(t.y),i=Number(e.x)-n,o=Number(e.y)-r;let a,s,l=Number(t.width)/2,c=Number(t.height)/2;return i||o?(Math.abs(o)*l>Math.abs(i)*c?(o<0&&(c=-c),a=c*i/o,s=c):(i<0&&(l=-l),a=l,s=l*o/i),{x:n+a,y:r+s}):{x:0,y:0}},qm=t=>{const e=[],n=Km(t)+1;for(let t=0;t<n;t++)e.push([]);t.getAllNodes().forEach(t=>{const n=t.data.rank;void 0!==n&&e[n]&&e[n].push(t.id)});for(let r=0;r<n;r++)e[r]=e[r].sort((e,n)=>{return r=t.getNode(e).data.order,i=t.getNode(n).data.order,Number(r)-Number(i);var r,i});return e},Xm=(t,e,n,r)=>{const i={width:0,height:0};return ae(n)&&ae(r)&&(i.rank=n,i.order=r),Um(t,"border",i,e)},Km=t=>{let e;return t.getAllNodes().forEach(t=>{const n=t.data.rank;void 0!==n&&(void 0===e||n>e)&&(e=n)}),e||(e=0),e},Zm=(t,e)=>t.reduce((t,n)=>e(t)>e(n)?n:t),Qm=(t,e,n,r,i,o)=>{r.includes(e.id)||(r.push(e.id),n||o.push(e.id),i(e.id).forEach(e=>Qm(t,e,n,r,i,o)),n&&o.push(e.id))},Jm=(t,e,n,r)=>{const i=Array.isArray(e)?e:[e],o=e=>t.getNeighbors(e),a=[],s=[];return i.forEach(e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);Qm(t,e,"post"===n,s,o,a)}),a},ty=(t,e,n,r,i,o)=>{const a={rank:o,borderType:e,width:0,height:0},s=i.data[e][o-1],l=Um(t,"border",a,n);i.data[e][o]=l,t.setParent(l,r),s&&t.addEdge({id:`e${Math.random()}`,source:s,target:l,data:{weight:1}})},ey=t=>{t.getAllNodes().forEach(t=>{ny(t)}),t.getAllEdges().forEach(t=>{ny(t)})},ny=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},ry=t=>{t.getAllNodes().forEach(t=>{iy(t.data)}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>iy(t)),t.data.hasOwnProperty("y")&&iy(t.data)})},iy=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},oy=t=>{t.getAllNodes().forEach(t=>{ay(t.data)}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>ay(t)),t.data.hasOwnProperty("x")&&ay(t.data)})},ay=t=>{const e=t.x;t.x=t.y,t.y=e},sy=(t,e,n,r,i,o,a)=>{const s=t.getChildren(a);if(!(null==s?void 0:s.length))return void(a!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:a,data:{weight:0,minlen:n}}));const l=Xm(t,"_bt"),c=Xm(t,"_bb"),u=t.getNode(a);t.setParent(l,a),u.data.borderTop=l,t.setParent(c,a),u.data.borderBottom=c,null==s||s.forEach(s=>{sy(t,e,n,r,i,o,s.id);const u=s.data.borderTop?s.data.borderTop:s.id,h=s.data.borderBottom?s.data.borderBottom:s.id,d=s.data.borderTop?r:2*r,f=u!==h?1:i-o[a]+1;t.addEdge({id:`e${Math.random()}`,source:l,target:u,data:{minlen:f,weight:d,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:h,target:c,data:{minlen:f,weight:d,nestingEdge:!0}})}),t.getParent(a)||t.addEdge({id:`e${Math.random()}`,source:e,target:l,data:{weight:0,minlen:i+o[a]}})},ly=t=>{const e={},n=(r,i)=>{const o=t.getChildren(r);null==o||o.forEach(t=>n(t.id,i+1)),e[r]=i};return t.getRoots().forEach(t=>n(t.id,1)),e},cy=t=>{let e=0;return t.getAllEdges().forEach(t=>{e+=t.data.weight}),e},uy="edge-label",hy=(t,e,n)=>{let r=e.source,i=t.getNode(r).data.rank;const o=e.target,a=t.getNode(o).data.rank,s=e.data.labelRank;if(a===i+1)return;let l,c,u;for(t.removeEdge(e.id),u=0,++i;i<a;++u,++i)e.data.points=[],c={originalEdge:e,width:0,height:0,rank:i},l=Um(t,"edge",c,"_d"),i===s&&(c.width=e.data.width,c.height=e.data.height,c.dummy=uy,c.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:r,target:l,data:{weight:e.data.weight}}),0===u&&n.push(l),r=l;t.addEdge({id:`e${Math.random()}`,source:r,target:o,data:{weight:e.data.weight}})},dy=t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e},fy=(t,e,n)=>{const r=((t,e)=>null==t?void 0:t.reduce((t,n,r)=>(t[n]=e[r],t),{}))(n,n.map((t,e)=>e)),i=e.map(e=>{const n=t.getRelatedEdges(e,"out").map(t=>({pos:r[t.target]||0,weight:t.data.weight}));return null==n?void 0:n.sort((t,e)=>t.pos-e.pos)}),o=i.flat().filter(t=>void 0!==t);let a=1;for(;a<n.length;)a<<=1;const s=2*a-1;a-=1;const l=Array(s).fill(0,0,s);let c=0;return null==o||o.forEach(t=>{if(t){let e=t.pos+a;l[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=l[e+1]),e=e-1>>1,l[e]+=t.weight;c+=t.weight*n}}),c},py=(t,e)=>{let n=0;for(let r=1;r<(null==e?void 0:e.length);r+=1)n+=fy(t,e[r-1],e[r]);return n},gy=t=>{const e={},n=t.getAllNodes(),r=n.map(t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0}),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o.push([]);const a=n.sort((e,n)=>t.getNode(e.id).data.rank-t.getNode(n.id).data.rank),s=a.filter(e=>void 0!==t.getNode(e.id).data.fixorder).sort((e,n)=>t.getNode(e.id).data.fixorder-t.getNode(n.id).data.fixorder);return null==s||s.forEach(n=>{isNaN(t.getNode(n.id).data.rank)||o[t.getNode(n.id).data.rank].push(n.id),e[n.id]=!0}),null==a||a.forEach(n=>t.dfsTree(n.id,t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||o[t.data.rank].push(t.id)})),o},vy=t=>{var e,n;const r=[];for(;null==t?void 0:t.length;){const i=t.pop();r.push(i),null===(e=i.in.reverse())||void 0===e||e.forEach(t=>{return(e=i,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&my(e,t)})(t);var e}),null===(n=i.out)||void 0===n||n.forEach(e=>{return(n=i,e=>{e.in.push(n),0===--e.indegree&&t.push(e)})(e);var n})}const i=r.filter(t=>!t.merged),o=["vs","i","barycenter","weight"];return i.map(t=>{const e={};return null==o||o.forEach(n=>{void 0!==t[n]&&(e[n]=t[n])}),e})},my=(t,e)=>{var n;let r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0},yy=(t,e,n)=>{let r,i=n;for(;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},by=(t,e)=>(n,r)=>{if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i},xy=(t,e,n,r,i,o)=>{var a,s,l,c;let u=t.getChildren(e).map(t=>t.id);const h=t.getNode(e),d=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,p={};d&&(u=null==u?void 0:u.filter(t=>t!==d&&t!==f));const g=((t,e)=>e.map(e=>{const n=t.getRelatedEdges(e,"in");if(!(null==n?void 0:n.length))return{v:e};const r={sum:0,weight:0};return null==n||n.forEach(e=>{const n=t.getNode(e.source);r.sum+=e.data.weight*n.data.order,r.weight+=e.data.weight}),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}))(t,u||[]);null==g||g.forEach(e=>{var i;if(null===(i=t.getChildren(e.v))||void 0===i?void 0:i.length){const i=xy(t,e.v,n,r,o);p[e.v]=i,i.hasOwnProperty("barycenter")&&wy(e,i)}});const v=((t,e)=>{var n,r,i;const o={};null==t||t.forEach((t,e)=>{o[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const n=o[t.v];void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)}),null===(n=e.getAllEdges())||void 0===n||n.forEach(t=>{const e=o[t.source],n=o[t.target];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(o[t.target]))});const a=null===(i=(r=Object.values(o)).filter)||void 0===i?void 0:i.call(r,t=>!t.indegree);return vy(a)})(g,n);Ey(v,p),null===(a=v.filter(t=>t.vs.length>0))||void 0===a||a.forEach(e=>{const n=t.getNode(e.vs[0]);n&&(e.fixorder=n.data.fixorder,e.order=n.data.order)});const m=((t,e,n,r)=>{const i=((t,e)=>{const n={lhs:[],rhs:[]};return null==t||t.forEach(t=>{e(t)?n.lhs.push(t):n.rhs.push(t)}),n})(t,t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return r?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")}),o=i.lhs,a=i.rhs.sort((t,e)=>-t.i- -e.i),s=[];let l=0,c=0,u=0;null==o||o.sort(by(!!e,!!n)),u=yy(s,a,u),null==o||o.forEach(t=>{var e;u+=null===(e=t.vs)||void 0===e?void 0:e.length,s.push(t.vs),l+=t.barycenter*t.weight,c+=t.weight,u=yy(s,a,u)});const h={vs:s.flat()};return c&&(h.barycenter=l/c,h.weight=c),h})(v,r,i,o);if(d&&(m.vs=[d,m.vs,f].flat(),null===(s=t.getPredecessors(d))||void 0===s?void 0:s.length)){const e=t.getNode((null===(l=t.getPredecessors(d))||void 0===l?void 0:l[0].id)||""),n=t.getNode((null===(c=t.getPredecessors(f))||void 0===c?void 0:c[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+n.data.order)/(m.weight+2),m.weight+=2}return m},Ey=(t,e)=>{null==t||t.forEach(t=>{var n;const r=null===(n=t.vs)||void 0===n?void 0:n.map(t=>e[t]?e[t].vs:t);t.vs=r.flat()})},wy=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},ky=(t,e,n)=>e.map(e=>((t,e,n)=>{const r=dy(t),i=new pv({tree:[{id:r,children:[],data:{}}]});return t.getAllNodes().forEach(o=>{const a=t.getParent(o.id);(o.data.rank===e||o.data.minRank<=e&&e<=o.data.maxRank)&&(i.hasNode(o.id)||i.addNode(Object.assign({},o)),(null==a?void 0:a.id)&&!i.hasNode(null==a?void 0:a.id)&&i.addNode(Object.assign({},a)),i.setParent(o.id,(null==a?void 0:a.id)||r),t.getRelatedEdges(o.id,n).forEach(e=>{const n=e.source===o.id?e.target:e.source;i.hasNode(n)||i.addNode(Object.assign({},t.getNode(n)));const r=i.getRelatedEdges(n,"out").find(({target:t})=>t===o.id),a=void 0!==r?r.data.weight:0;r?i.updateEdgeData(r.id,Object.assign(Object.assign({},r.data),{weight:e.data.weight+a})):i.addEdge({id:e.id,source:n,target:o.id,data:{weight:e.data.weight+a}})}),o.data.hasOwnProperty("minRank")&&i.updateNodeData(o.id,Object.assign(Object.assign({},o.data),{borderLeft:o.data.borderLeft[e],borderRight:o.data.borderRight[e]})))}),i})(t,e,n)),My=(t,e,n,r)=>{const i=new pv;null==t||t.forEach(t=>{var o;const a=t.getRoots()[0].id,s=xy(t,a,i,e,n,r);for(let e=0;e<(null===(o=s.vs)||void 0===o?void 0:o.length);e++){const n=t.getNode(s.vs[e]);n&&(n.data.order=e)}((t,e,n)=>{const r={};let i;null==n||n.forEach(n=>{let o,a,s=t.getParent(n);for(;s;){if(o=t.getParent(s.id),o?(a=r[o.id],r[o.id]=s.id):(a=i,i=s.id),a&&a!==s.id)return e.hasNode(a)||e.addNode({id:a,data:{}}),e.hasNode(s.id)||e.addNode({id:s.id,data:{}}),void(e.hasEdge(`e${a}-${s.id}`)||e.addEdge({id:`e${a}-${s.id}`,source:a,target:s.id,data:{}}));s=o}})})(t,i,s.vs)})},Sy=(t,e)=>{null==e||e.forEach(e=>{null==e||e.forEach((e,n)=>{t.getNode(e).data.order=n})})},Ny=(t,e)=>{const n=(t=>{const e={};let n=0;const r=i=>{const o=n;t.getChildren(i).forEach(t=>r(t.id)),e[i]={low:o,lim:n++}};return t.getRoots().forEach(t=>r(t.id)),e})(t);e.forEach(e=>{var r,i;let o=e,a=t.getNode(o);const s=a.data.originalEdge;if(!s)return;const l=((t,e,n,r)=>{var i,o;const a=[],s=[],l=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);let u,h;u=n;do{u=null===(i=t.getParent(u))||void 0===i?void 0:i.id,a.push(u)}while(u&&(e[u].low>l||c>e[u].lim));for(h=u,u=r;u&&u!==h;)s.push(u),u=null===(o=t.getParent(u))||void 0===o?void 0:o.id;return{lca:h,path:a.concat(s.reverse())}})(t,n,s.source,s.target),c=l.path,u=l.lca;let h=0,d=c[h],f=!0;for(;o!==s.target;){if(a=t.getNode(o),f){for(;d!==u&&(null===(r=t.getNode(d))||void 0===r?void 0:r.data.maxRank)<a.data.rank;)h++,d=c[h];d===u&&(f=!1)}if(!f){for(;h<c.length-1&&(null===(i=t.getNode(c[h+1]))||void 0===i?void 0:i.data.minRank)<=a.data.rank;)h++;d=c[h]}t.hasNode(d)&&t.setParent(o,d),o=t.getSuccessors(o)[0].id}})},Ty=(t,e)=>{const n={};function r(e,r){const i=function(t){return JSON.stringify(t.slice(1))}(e);r.get(i)||(!function(e,r,i,o,a){var s,l;let c;for(let u=r;u<i;u++)c=e[u],(null===(s=t.getNode(c))||void 0===s?void 0:s.data.dummy)&&(null===(l=t.getPredecessors(c))||void 0===l||l.forEach(e=>{const r=t.getNode(e.id);r.data.dummy&&(r.data.order<o||r.data.order>a)&&Cy(n,e.id,c)}))}(...e),r.set(i,!0))}const i=(e,n)=>{let i,o=-1,a=0;const s=new Map;return null==n||n.forEach((l,c)=>{var u;if("border"===(null===(u=t.getNode(l))||void 0===u?void 0:u.data.dummy)){const e=t.getPredecessors(l)||[];e.length&&(i=t.getNode(e[0].id).data.order,r([n,a,c,o,i],s),a=c,o=i)}r([n,a,n.length,i,e.length],s)}),n};return(null==e?void 0:e.length)&&e.reduce(i),n},Oy=(t,e)=>{var n,r;if(null===(n=t.getNode(e))||void 0===n?void 0:n.data.dummy)return null===(r=t.getPredecessors(e))||void 0===r?void 0:r.find(e=>t.getNode(e.id).data.dummy)},Cy=(t,e,n)=>{let r=e,i=n;if(r>i){const t=r;r=i,i=t}let o=t[r];o||(t[r]=o={}),o[i]=!0},Ay=(t,e,n)=>{let r=e,i=n;if(r>n){r=n,i=e}return!!t[r]},Py=(t,e,n,r,i,o)=>{const a=new pv,s=Ry(r,i,o);return null==e||e.forEach(e=>{let r;null==e||e.forEach(e=>{const i=n[e];if(a.hasNode(i)||a.addNode({id:i,data:{}}),r){const o=n[r],l=a.getRelatedEdges(o,"out").find(t=>t.target===i);l?a.updateEdgeData(l.id,Object.assign(Object.assign({},l.data),{weight:Math.max(s(t,e,r),l.data.weight||0)})):a.addEdge({id:`e${Math.random()}`,source:o,target:i,data:{weight:Math.max(s(t,e,r),0)}})}r=e})}),a};const Ry=(t,e,n)=>(r,i,o)=>{const a=r.getNode(i),s=r.getNode(o);let l=0,c=0;if(l+=a.data.width/2,a.data.hasOwnProperty("labelpos"))switch((a.data.labelpos||"").toLowerCase()){case"l":c=-a.data.width/2;break;case"r":c=a.data.width/2}if(c&&(l+=n?c:-c),c=0,l+=(a.data.dummy?e:t)/2,l+=(s.data.dummy?e:t)/2,l+=s.data.width/2,s.data.labelpos)switch((s.data.labelpos||"").toLowerCase()){case"l":c=s.data.width/2;break;case"r":c=-s.data.width/2}return c&&(l+=n?c:-c),c=0,l},Dy=(t,e)=>t.getNode(e).data.width||0,Ly=(t,e)=>{const{align:n,nodesep:r=0,edgesep:i=0}=e||{},o=qm(t),a=Object.assign(((t,e)=>{const n={},r=(e,r)=>{let i=0,o=0;const a=e.length,s=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach((e,l)=>{var c;const u=Oy(t,e),h=u?t.getNode(u.id).data.order:a;(u||e===s)&&(null===(c=r.slice(o,l+1))||void 0===c||c.forEach(e=>{var r;null===(r=t.getPredecessors(e))||void 0===r||r.forEach(r=>{var o;const a=t.getNode(r.id),s=a.data.order;!(s<i||h<s)||a.data.dummy&&(null===(o=t.getNode(e))||void 0===o?void 0:o.data.dummy)||Cy(n,r.id,e)})}),o=l+1,i=h)}),r};return(null==e?void 0:e.length)&&e.reduce(r),n})(t,o),Ty(t,o)),s={};let l=[];["u","d"].forEach(e=>{l="u"===e?o:Object.values(o).reverse(),["l","r"].forEach(n=>{"r"===n&&(l=l.map(t=>Object.values(t).reverse()));const o=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),c=((t,e,n,r)=>{const i={},o={},a={};return null==e||e.forEach(t=>{null==t||t.forEach((t,e)=>{i[t]=t,o[t]=t,a[t]=e})}),null==e||e.forEach(t=>{let e=-1;null==t||t.forEach(t=>{let s=r(t).map(t=>t.id);if(s.length){s=s.sort((t,e)=>a[t]-a[e]);const r=(s.length-1)/2;for(let l=Math.floor(r),c=Math.ceil(r);l<=c;++l){const r=s[l];o[t]===t&&e<a[r]&&!Ay(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=a[r])}}})}),{root:i,align:o}})(0,l,a,o),u=((t,e,n,r,i,o,a)=>{var s;const l={},c=Py(t,e,n,i,o,a),u=a?"borderLeft":"borderRight",h=(t,e)=>{let n=c.getAllNodes(),r=n.pop();const i={};for(;r;)i[r.id]?t(r.id):(i[r.id]=!0,n.push(r),n=n.concat(e(r.id))),r=n.pop()};return h(t=>{l[t]=(c.getRelatedEdges(t,"in")||[]).reduce((t,e)=>Math.max(t,(l[e.source]||0)+e.data.weight),0)},c.getPredecessors.bind(c)),h(e=>{const n=(c.getRelatedEdges(e,"out")||[]).reduce((t,e)=>Math.min(t,(l[e.target]||0)-e.data.weight),Number.POSITIVE_INFINITY),r=t.getNode(e);n!==Number.POSITIVE_INFINITY&&r.data.borderType!==u&&(l[e]=Math.max(l[e],n))},c.getSuccessors.bind(c)),null===(s=Object.values(r))||void 0===s||s.forEach(t=>{l[t]=l[n[t]]}),l})(t,l,c.root,c.align,r,i,"r"===n);"r"===n&&Object.keys(u).forEach(t=>u[t]=-u[t]),s[e+n]=u})});const c=((t,e)=>Zm(Object.values(e),e=>{var n;let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach(n=>{const o=e[n],a=Dy(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)}),r-i}))(t,s);return c&&function(t,e){const n=Object.values(e),r=Math.min(...n),i=Math.max(...n);["u","d"].forEach(n=>{["l","r"].forEach(o=>{const a=n+o,s=t[a];let l;if(s===e)return;const c=Object.values(s);l="l"===o?r-Math.min(...c):i-Math.max(...c),l&&(t[a]={},Object.keys(s).forEach(e=>{t[a][e]=s[e]+l}))})})}(s,c),((t,e)=>{const n={};return Object.keys(t.ul).forEach(r=>{if(e)n[r]=t[e.toLowerCase()][r];else{const e=Object.values(t).map(t=>t[r]);n[r]=(e[0]+e[1])/2}}),n})(s,n)},_y=(t,e)=>{var n;const r=$m(t);((t,e)=>{const{ranksep:n=0}=e||{},r=qm(t);let i=0;null==r||r.forEach(e=>{const r=e.map(e=>t.getNode(e).data.height),o=Math.max(...r,0);null==e||e.forEach(e=>{t.getNode(e).data.y=i+o/2}),i+=o+n})})(r,e);const i=Ly(r,e);null===(n=Object.keys(i))||void 0===n||n.forEach(t=>{r.getNode(t).data.x=i[t]})},Iy=t=>{const e={},n=r=>{var i;const o=t.getNode(r);if(!o)return 0;if(e[r])return o.data.rank;let a;return e[r]=!0,null===(i=t.getRelatedEdges(r,"out"))||void 0===i||i.forEach(t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)}),a||(a=0),o.data.rank=a,a};t.getAllNodes().filter(e=>0===t.getRelatedEdges(e.id,"in").length).forEach(t=>n(t.id))},jy=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,By=(t,e)=>{const n=r=>{e.getRelatedEdges(r,"both").forEach(i=>{const o=i.source,a=r===o?i.target:o;t.hasNode(a)||jy(e,i)||(t.addNode({id:a,data:{}}),t.addEdge({id:i.id,source:r,target:a,data:{}}),n(a))})};return t.getAllNodes().forEach(t=>n(t.id)),t.getAllNodes().length},Fy=(t,e)=>{const n=r=>{var i;null===(i=e.getRelatedEdges(r,"both"))||void 0===i||i.forEach(i=>{const o=i.source,a=r===o?i.target:o;t.hasNode(a)||void 0===e.getNode(a).data.layer&&jy(e,i)||(t.addNode({id:a,data:{}}),t.addEdge({id:i.id,source:r,target:a,data:{}}),n(a))})};return t.getAllNodes().forEach(t=>n(t.id)),t.getAllNodes().length},zy=(t,e)=>Zm(e.getAllEdges(),n=>t.hasNode(n.source)!==t.hasNode(n.target)?jy(e,n):1/0),Gy=(t,e,n)=>{t.getAllNodes().forEach(t=>{const r=e.getNode(t.id);r.data.rank||(r.data.rank=0),r.data.rank+=n})},Vy=t=>{const e=(t=>{const e=new pv;return t.getAllNodes().forEach(t=>{e.addNode(Object.assign({},t))}),t.getAllEdges().forEach(t=>{const n=e.getRelatedEdges(t.source,"out").find(e=>e.target===t.target);n?e.updateEdgeData(null==n?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+t.data.weight||0,minlen:Math.max(n.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})}),e})(t);Iy(e);const n=(t=>{const e=new pv({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);By(e,t)<r;)i=zy(e,t),o=e.hasNode(i.source)?jy(t,i):-jy(t,i),Gy(e,t,o);return e})(e);let r,i;for($y(n),Wy(n,e);r=qy(n);)i=Xy(n,e,r),Ky(n,e,r,i)},Wy=(t,e)=>{let n=Jm(t,t.getAllNodes(),"post");n=n.slice(0,(null==n?void 0:n.length)-1),n.forEach(n=>{Hy(t,e,n)})},Hy=(t,e,n)=>{const r=t.getNode(n).data.parent;t.getRelatedEdges(n,"both").find(t=>t.target===r||t.source===r).data.cutvalue=Uy(t,e,n)},Uy=(t,e,n)=>{const r=t.getNode(n).data.parent;let i=!0,o=e.getRelatedEdges(n,"out").find(t=>t.target===r),a=0;return o||(i=!1,o=e.getRelatedEdges(r,"out").find(t=>t.target===n)),a=o.data.weight,e.getRelatedEdges(n,"both").forEach(e=>{const o=e.source===n,s=o?e.target:e.source;if(s!==r){const r=o===i,l=e.data.weight;if(a+=r?l:-l,Qy(t,n,s)){const e=t.getRelatedEdges(n,"both").find(t=>t.source===s||t.target===s).data.cutvalue;a+=r?-e:e}}}),a},$y=(t,e=t.getAllNodes()[0].id)=>{Yy(t,{},1,e)},Yy=(t,e,n,r,i)=>{var o;const a=n;let s=n;const l=t.getNode(r);return e[r]=!0,null===(o=t.getNeighbors(r))||void 0===o||o.forEach(n=>{e[n.id]||(s=Yy(t,e,s,n.id,r))}),l.data.low=a,l.data.lim=s++,i?l.data.parent=i:delete l.data.parent,s},qy=t=>t.getAllEdges().find(t=>t.data.cutvalue<0),Xy=(t,e,n)=>{let r=n.source,i=n.target;e.getRelatedEdges(r,"out").find(t=>t.target===i)||(r=n.target,i=n.source);const o=t.getNode(r),a=t.getNode(i);let s=o,l=!1;o.data.lim>a.data.lim&&(s=a,l=!0);const c=e.getAllEdges().filter(e=>l===Jy(t.getNode(e.source),s)&&l!==Jy(t.getNode(e.target),s));return Zm(c,t=>jy(e,t))},Ky=(t,e,n,r)=>{const i=t.getRelatedEdges(n.source,"both").find(t=>t.source===n.target||t.target===n.target);i&&t.removeEdge(i.id),t.addEdge({id:`e${Math.random()}`,source:r.source,target:r.target,data:{}}),$y(t),Wy(t,e),Zy(t,e)},Zy=(t,e)=>{const n=t.getAllNodes().find(t=>!t.data.parent);let r=Jm(t,n,"pre");r=r.slice(1),r.forEach(n=>{const r=t.getNode(n).data.parent;let i=e.getRelatedEdges(n,"out").find(t=>t.target===r),o=!1;!i&&e.hasNode(r)&&(i=e.getRelatedEdges(r,"out").find(t=>t.target===n),o=!0),e.getNode(n).data.rank=(e.hasNode(r)&&e.getNode(r).data.rank||0)+(o?null==i?void 0:i.data.minlen:-(null==i?void 0:i.data.minlen))})},Qy=(t,e,n)=>t.getRelatedEdges(e,"both").find(t=>t.source===n||t.target===n),Jy=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,tb=Iy,eb=t=>{(t=>{const e={};let n;const r=i=>{var o;const a=t.getNode(i);if(!a)return 0;if(e[i])return a.data.rank;let s;return e[i]=!0,null===(o=t.getRelatedEdges(i,"out"))||void 0===o||o.forEach(t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)}),s||(s=0),(void 0===n||s<n)&&(n=s),a.data.rank=s,s};t.getAllNodes().filter(e=>0===t.getRelatedEdges(e.id,"in").length).forEach(t=>{t&&r(t.id)}),void 0===n&&(n=0);const i={},o=(e,n)=>{var r;const a=t.getNode(e),s=isNaN(a.data.layer)?n:a.data.layer;(void 0===a.data.rank||a.data.rank<s)&&(a.data.rank=s),i[e]||(i[e]=!0,null===(r=t.getRelatedEdges(e,"out"))||void 0===r||r.forEach(t=>{o(t.target,s+t.data.minlen)}))};t.getAllNodes().forEach(t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=n:o(t.id,e.layer))})})(t),(t=>{const e=new pv({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);Fy(e,t)<r;)i=zy(e,t),o=e.hasNode(i.source)?jy(t,i):-jy(t,i),Gy(e,t,o)})(t)},nb=t=>{Vy(t)},rb=(t,e)=>{const{ranker:n,rankdir:r="tb",nodeOrder:i,keepNodeOrder:o,align:a,nodesep:s=50,edgesep:l=20,ranksep:c=50}=e;Eb(t),Hm(t);const{nestingRoot:u,nodeRankFactor:h}=(t=>{const e=Um(t,"root",{},"_root"),n=ly(t);let r=Math.max(...Object.values(n));Math.abs(r)===1/0&&(r=1);const i=r-1,o=2*i+1;t.getAllEdges().forEach(t=>{t.data.minlen*=o});const a=cy(t)+1;return t.getRoots().forEach(r=>{sy(t,e,o,a,i,n,r.id)}),{nestingRoot:e,nodeRankFactor:o}})(t);((t,e)=>{switch(e){case"network-simplex":nb(t);break;case"tight-tree":default:eb(t);break;case"longest-path":tb(t)}})($m(t),n),fb(t),((t,e=0)=>{const n=t.getAllNodes(),r=n.filter(t=>void 0!==t.data.rank).map(t=>t.data.rank),i=Math.min(...r),o=[];n.forEach(t=>{const e=(t.data.rank||0)-i;o[e]||(o[e]=[]),o[e].push(t.id)});let a=0;for(let n=0;n<o.length;n++){const r=o[n];void 0===r?n%e!==0&&(a-=1):a&&(null==r||r.forEach(e=>{const n=t.getNode(e);n&&(n.data.rank=n.data.rank||0,n.data.rank+=a)}))}})(t,h),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach(e=>{e.data.nestingEdge&&t.removeEdge(e.id)})})(t,u),(t=>{const e=t.getAllNodes().filter(t=>void 0!==t.data.rank).map(t=>t.data.rank),n=Math.min(...e);t.getAllNodes().forEach(t=>{t.data.hasOwnProperty("rank")&&n!==1/0&&(t.data.rank-=n)})})(t),pb(t),gb(t);const d=[];((t,e)=>{t.getAllEdges().forEach(n=>hy(t,n,e))})(t,d),Ny(t,d),(t=>{const e=n=>{const r=t.getChildren(n),i=t.getNode(n);if((null==r?void 0:r.length)&&r.forEach(t=>e(t.id)),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let e=i.data.minRank,r=i.data.maxRank+1;e<r;e+=1)ty(t,"borderLeft","_bl",n,i,e),ty(t,"borderRight","_br",n,i,e)}};t.getRoots().forEach(t=>e(t.id))})(t),o&&((t,e)=>{const n=t.getAllNodes().filter(e=>{var n;return!(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length)}),r=n.map(t=>t.data.rank),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o[t]=[];null==e||e.forEach(e=>{const n=t.getNode(e);n&&!n.data.dummy&&(isNaN(n.data.rank)||(n.data.fixorder=o[n.data.rank].length,o[n.data.rank].push(e)))})})(t,i),((t,e)=>{const n=Km(t),r=[],i=[];for(let t=1;t<n+1;t++)r.push(t);for(let t=n-1;t>-1;t--)i.push(t);const o=ky(t,r,"in"),a=ky(t,i,"out");let s=gy(t);Sy(t,s);let l,c=Number.POSITIVE_INFINITY;for(let n=0,r=0;r<4;++n,++r){My(n%2?o:a,n%4>=2,!1,e),s=qm(t);const i=py(t,s);i<c&&(r=0,l=ye(s),c=i)}s=gy(t),Sy(t,s);for(let n=0,r=0;r<4;++n,++r){My(n%2?o:a,n%4>=2,!0,e),s=qm(t);const i=py(t,s);i<c&&(r=0,l=ye(s),c=i)}Sy(t,l)})(t,o),wb(t),((t,e)=>{const n=e.toLowerCase();"lr"!==n&&"rl"!==n||ey(t)})(t,r),_y(t,{align:a,nodesep:s,edgesep:l,ranksep:c}),kb(t),xb(t),((t,e)=>{e.forEach(e=>{let n=t.getNode(e);const{data:r}=n,i=r.originalEdge;let o;i&&t.addEdge(i);let a=e;for(;n.data.dummy;)o=t.getSuccessors(a)[0],t.removeNode(a),i.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===uy&&(i.data.x=n.data.x,i.data.y=n.data.y,i.data.width=n.data.width,i.data.height=n.data.height),a=o.id,n=t.getNode(a)})})(t,d),yb(t),((t,e)=>{const n=e.toLowerCase();"bt"!==n&&"rl"!==n||ry(t),"lr"!==n&&"rl"!==n||(oy(t),ey(t))})(t,r);const{width:f,height:p}=vb(t);return mb(t),bb(t),(t=>{t.getAllEdges().forEach(e=>{const n=e.data;if(n.reversed){t.removeEdge(e.id);const r=n.forwardName;delete n.reversed,delete n.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},n),{forwardName:r})})}})})(t),{width:f,height:p}},ib=(t,e)=>{t.getAllNodes().forEach(n=>{const r=t.getNode(n.id);if(e.hasNode(n.id)){const t=e.getNode(n.id);r.data.fixorder=t.data._order,delete t.data._order}else delete r.data.fixorder})},ob=(t,e)=>{t.getAllNodes().forEach(n=>{var r;const i=t.getNode(n.id);if(i){const t=e.getNode(n.id);i.data.x=t.data.x,i.data.y=t.data.y,i.data._order=t.data.order,i.data._rank=t.data.rank,(null===(r=e.getChildren(n.id))||void 0===r?void 0:r.length)&&(i.data.width=t.data.width,i.data.height=t.data.height)}}),t.getAllEdges().forEach(n=>{const r=t.getEdge(n.id),i=e.getEdge(n.id);r.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(r.data.x=i.data.x,r.data.y=i.data.y)})},ab=["width","height","layer","fixorder"],sb={width:0,height:0},lb=["minlen","weight","width","height","labeloffset"],cb={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ub=["labelpos"],hb=t=>{const e=new pv({tree:[]});return t.getAllNodes().forEach(n=>{const r=Sb(t.getNode(n.id).data),i=Object.assign(Object.assign({},sb),r),o=Mb(i,ab);e.hasNode(n.id)||e.addNode({id:n.id,data:Object.assign({},o)});const a=t.hasTreeStructure("combo")?t.getParent(n.id,"combo"):t.getParent(n.id);$t(a)||(e.hasNode(a.id)||e.addNode(Object.assign({},a)),e.setParent(n.id,a.id))}),t.getAllEdges().forEach(n=>{const r=Sb(t.getEdge(n.id).data),i={};null==ub||ub.forEach(t=>{void 0!==r[t]&&(i[t]=r[t])}),e.addEdge({id:n.id,source:n.source,target:n.target,data:Object.assign({},cb,Mb(r,lb),i)})}),e},db=(t,e)=>{const{ranksep:n=0,rankdir:r}=e;return t.getAllNodes().forEach(t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)}),t.getAllEdges().forEach(t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===r||"BT"===r?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)}),n/2},fb=t=>{t.getAllEdges().forEach(e=>{if(e.data.width&&e.data.height){const n=t.getNode(e.source),r={e:e,rank:(t.getNode(e.target).data.rank-n.data.rank)/2+n.data.rank};Um(t,"edge-proxy",r,"_ep")}})},pb=t=>{let e=0;return t.getAllNodes().forEach(n=>{var r,i;n.data.borderTop&&(n.data.minRank=null===(r=t.getNode(n.data.borderTop))||void 0===r?void 0:r.data.rank,n.data.maxRank=null===(i=t.getNode(n.data.borderBottom))||void 0===i?void 0:i.data.rank,e=Math.max(e,n.data.maxRank||-1/0))}),e},gb=t=>{t.getAllNodes().forEach(e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))})},vb=(t,e)=>{let n,r,i=0,o=0;const{marginx:a=0,marginy:s=0}={},l=t=>{if(!t.data)return;const e=t.data.x,a=t.data.y,s=t.data.width,l=t.data.height;isNaN(e)||isNaN(s)||(void 0===n&&(n=e-s/2),n=Math.min(n,e-s/2),i=Math.max(i,e+s/2)),isNaN(a)||isNaN(l)||(void 0===r&&(r=a-l/2),r=Math.min(r,a-l/2),o=Math.max(o,a+l/2))};return t.getAllNodes().forEach(t=>{l(t)}),t.getAllEdges().forEach(t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&l(t)}),n-=a,r-=s,t.getAllNodes().forEach(t=>{t.data.x-=n,t.data.y-=r}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>{t.x-=n,t.y-=r}),t.data.hasOwnProperty("x")&&(t.data.x-=n),t.data.hasOwnProperty("y")&&(t.data.y-=r)}),{width:i-n+a,height:o-r+s}},mb=t=>{t.getAllEdges().forEach(e=>{const n=t.getNode(e.source),r=t.getNode(e.target);let i,o;e.data.points?(i=e.data.points[0],o=e.data.points[e.data.points.length-1]):(e.data.points=[],i={x:r.data.x,y:r.data.y},o={x:n.data.x,y:n.data.y}),e.data.points.unshift(Ym(n.data,i)),e.data.points.push(Ym(r.data,o))})},yb=t=>{t.getAllEdges().forEach(t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}})},bb=t=>{t.getAllEdges().forEach(t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())})},xb=t=>{t.getAllNodes().forEach(e=>{var n,r,i;if(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length){const n=t.getNode(e.id),o=t.getNode(n.data.borderTop),a=t.getNode(n.data.borderBottom),s=t.getNode(n.data.borderLeft[(null===(r=n.data.borderLeft)||void 0===r?void 0:r.length)-1]),l=t.getNode(n.data.borderRight[(null===(i=n.data.borderRight)||void 0===i?void 0:i.length)-1]);n.data.width=Math.abs((null==l?void 0:l.data.x)-(null==s?void 0:s.data.x))||10,n.data.height=Math.abs((null==a?void 0:a.data.y)-(null==o?void 0:o.data.y))||10,n.data.x=((null==s?void 0:s.data.x)||0)+n.data.width/2,n.data.y=((null==o?void 0:o.data.y)||0)+n.data.height/2}}),t.getAllNodes().forEach(e=>{"border"===e.data.dummy&&t.removeNode(e.id)})},Eb=t=>{t.getAllEdges().forEach(e=>{if(e.source===e.target){const n=t.getNode(e.source);n.data.selfEdges||(n.data.selfEdges=[]),n.data.selfEdges.push(e),t.removeEdge(e.id)}})},wb=t=>{const e=qm(t);null==e||e.forEach(e=>{let n=0;null==e||e.forEach((e,r)=>{var i;const o=t.getNode(e);o.data.order=r+n,null===(i=o.data.selfEdges)||void 0===i||i.forEach(e=>{Um(t,"selfedge",{width:e.data.width,height:e.data.height,rank:o.data.rank,order:r+ ++n,e:e},"_se")}),delete o.data.selfEdges})})},kb=t=>{t.getAllNodes().forEach(e=>{const n=t.getNode(e.id);if("selfedge"===n.data.dummy){const r=t.getNode(n.data.e.source),i=r.data.x+r.data.width/2,o=r.data.y,a=n.data.x-i,s=r.data.height/2;t.hasEdge(n.data.e.id)?t.updateEdgeData(n.data.e.id,n.data.e.data):t.addEdge({id:n.data.e.id,source:n.data.e.source,target:n.data.e.target,data:n.data.e.data}),t.removeNode(e.id),n.data.e.data.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{y:o,x:i+a},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.data.e.data.x=n.data.x,n.data.e.data.y=n.data.y}})},Mb=(t,e)=>{const n={};return null==e||e.forEach(e=>{void 0!==t[e]&&(n[e]=+t[e])}),n},Sb=(t={})=>{const e={};return Object.keys(t).forEach(n=>{e[n.toLowerCase()]=t[n]}),e},Nb=Array.isArray,Tb=t=>{const e=[],n=t.length;for(let r=0;r<n;r+=1){e[r]=[];for(let i=0;i<n;i+=1)r===i?e[r][i]=0:0!==t[r][i]&&t[r][i]?e[r][i]=t[r][i]:e[r][i]=1/0}for(let t=0;t<n;t+=1)for(let r=0;r<n;r+=1)for(let i=0;i<n;i+=1)e[r][i]>e[r][t]+e[t][i]&&(e[r][i]=e[r][t]+e[t][i]);return e},Ob=(t,e)=>{const{nodes:n,edges:r}=t,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((t,e)=>{o[t.id]=e;i.push([])}),null==r||r.forEach(t=>{const{source:e,target:n}=t,r=o[e],a=o[n];void 0!==r&&void 0!==a&&(i[r][a]=1,i[a][r]=1)}),i},Cb=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),Ab=(t,e,n,r="TB",i,o={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:a,stopAllFn:s}=o;for(let l=0;l<e.length;l++){const c=e[l];if(t.hasNode(c.id)&&!(null==a?void 0:a(c))){if(null==s?void 0:s(c))return;"TB"===r&&n(c),Ab(t,t.getChildren(c.id,i),n,r,i,o),"TB"!==r&&n(c)}}},Pb=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach(t=>{e.push(t)}),e.map(t=>Pb(t))}if("object"==typeof t){const e={};return Object.keys(t).forEach(n=>{e[n]=Pb(t[n])}),e}return t},Rb=(t,e)=>{const n=Pb(t);return n.data=n.data||{},e&&(ae(n.data.x)||(n.data.x=Math.random()*e[0]),ae(n.data.y)||(n.data.y=Math.random()*e[1])),n};function Db(t){if(!t)return[0,0,0];if(ae(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,n=e,r=e]=t;return[e,n,r]}function Lb(t,e){let n;return n=Ut(e)?e:ae(e)?()=>e:()=>t,n}function _b(t,e,n=!0){return e||0===e?Ut(e)?e:ae(e)?()=>e:Array.isArray(e)?()=>n?Math.max(...e)||t:e:qt(e)&&e.width&&e.height?()=>n?Math.max(e.width,e.height)||t:[e.width,e.height]:()=>t:e=>{const{size:r}=e.data||{};return r?Array.isArray(r)?n?Math.max(...r)||t:r:qt(r)&&r.width&&r.height?n?Math.max(r.width,r.height)||t:[r.width,r.height]:r:t}}const Ib=(t,e,n=10)=>{let r;const i="function"==typeof e?e:()=>e||0;r=t?Array.isArray(t)?e=>t:Ut(t)?t:e=>t:t=>{var e,r,i;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return null===(r=t.data)||void 0===r?void 0:r.bboxSize;if(null===(i=t.data)||void 0===i?void 0:i.size){const e=t.data.size;return Array.isArray(e)?e:qt(e)?[e.width,e.height]:e}return n};return t=>{const e=r(t),n=i(t);return Math.max(...Db(e))+n}},jb={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class Bb{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},jb),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),{nodeSize:i,align:o,rankdir:a="TB",ranksep:s,nodesep:l,ranksepFunc:c,nodesepFunc:u,edgeLabelSpace:h,ranker:d,nodeOrder:f,begin:p,controlPoints:g,radial:v,sortByCombo:m,preset:y}=r,b=new pv({tree:[]}),x=Lb(s||50,c),E=Lb(l||50,u);let w=E,k=x;"LR"!==a&&"RL"!==a||(w=x,k=E);const M=_b(10,i,!1),S=e.getAllNodes(),N=e.getAllEdges();let T;S.forEach(t=>{const e=Db(M(t)),n=k(t),r=w(t),i=e[0]+2*r,o=e[1]+2*n,a=t.data.layer;ae(a)?b.addNode({id:t.id,data:{width:i,height:o,layer:a}}):b.addNode({id:t.id,data:{width:i,height:o}})}),m&&(b.attachTreeStructure("combo"),S.forEach(t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")})),N.forEach(t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})}),(null==y?void 0:y.length)&&(T=new pv({nodes:y})),((t,e)=>{const{edgeLabelSpace:n,keepNodeOrder:r,prevGraph:i,rankdir:o,ranksep:a}=e;!r&&i&&ib(t,i);const s=hb(t);let l;n&&(e.ranksep=db(s,{rankdir:o,ranksep:a}));try{l=rb(s,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}ob(t,s)})(b,{prevGraph:T,edgeLabelSpace:h,keepNodeOrder:!!f,nodeOrder:f||[],acyclicer:"greedy",ranker:d,rankdir:a,nodesep:l,align:o});const O=[0,0];if(p){let t=1/0,e=1/0;b.getAllNodes().forEach(n=>{t>n.data.x&&(t=n.data.x),e>n.data.y&&(e=n.data.y)}),b.getAllEdges().forEach(n=>{var r;null===(r=n.data.points)||void 0===r||r.forEach(n=>{t>n.x&&(t=n.x),e>n.y&&(e=n.y)})}),O[0]=p[0]-t,O[1]=p[1]-e}const C="LR"===a||"RL"===a;if(v);else{const t=new Set,e="BT"===a||"RL"===a?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach(e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(C?e.data.x:e.data.y)});const n=Array.from(t).sort(e),r=C?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,i=C?(t,e,n)=>{const r=Math.max(e.y,n.y),i=Math.min(e.y,n.y);return t.filter(t=>t.y<=r&&t.y>=i)}:(t,e,n)=>{const r=Math.max(e.x,n.x),i=Math.min(e.x,n.x);return t.filter(t=>t.x<=r&&t.x>=i)};b.getAllEdges().forEach((t,e)=>{var o;h&&g&&"loop"!==t.data.type&&(t.data.controlPoints=Fb(null===(o=t.data.points)||void 0===o?void 0:o.map(({x:t,y:e})=>({x:t+O[0],y:e+O[1]})),b.getNode(t.source),b.getNode(t.target),n,C,r,i))})}let A=[];A=b.getAllNodes().map(t=>Rb(t));const P=b.getAllEdges();t&&(A.forEach(t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),P.forEach(t=>{e.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}));return{nodes:A,edges:P}})}}const Fb=(t,e,n,r,i,o,a)=>{let s=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&n){let{x:t,y:l}=e.data,{x:c,y:u}=n.data;if(i&&(t=e.data.y,l=e.data.x,c=n.data.y,u=n.data.x),u!==l&&t!==c){const h=r.indexOf(l),d=r[h+1];if(d){const t=s[0],e=i?{x:(l+d)/2,y:(null==t?void 0:t.y)||c}:{x:(null==t?void 0:t.x)||c,y:(l+d)/2};t&&!o(t,e)||s.unshift(e)}const f=r.indexOf(u),p=Math.abs(f-h);if(1===p)s=a(s,e.data,n.data),s.length||s.push(i?{x:(l+u)/2,y:t}:{x:t,y:(l+u)/2});else if(p>1){const e=r[f-1];if(e){const n=s[s.length-1],r=i?{x:(u+e)/2,y:(null==n?void 0:n.y)||c}:{x:(null==n?void 0:n.x)||t,y:(u+e)/2};n&&!o(n,r)||s.push(r)}}}}return s},zb=(t,e,n)=>{const r=t.getAllNodes(),i=t.getAllEdges();if(!(null==r?void 0:r.length)){return{nodes:[],edges:i}}if(1===r.length){e&&t.mergeNodeData(r[0].id,{x:n[0],y:n[1]});return{nodes:[Object.assign(Object.assign({},r[0]),{data:Object.assign(Object.assign({},r[0].data),{x:n[0],y:n[1]})})],edges:i}}},Gb={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class Vb{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Gb),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),{width:i,height:o,center:a,divisions:s,startAngle:l=0,endAngle:c=2*Math.PI,angleRatio:u,ordering:h,clockwise:d,nodeSpacing:f,nodeSize:p}=r,g=e.getAllNodes(),v=e.getAllEdges(),[m,y,b]=Hb(i,o,a),x=null==g?void 0:g.length;if(!x||1===x)return zb(e,t,b);const E=(c-l)/x;let{radius:w,startRadius:k,endRadius:M}=r;if(f){const t=Lb(10,f),e=_b(10,p);let n=-1/0;g.forEach(t=>{const r=e(t);n<r&&(n=r)});let r=0;g.forEach((e,i)=>{r+=0===i?n||10:(t(e)||0)+(n||10)}),w=r/(2*Math.PI)}else w||k||M?!k&&M?k=M:k&&!M&&(M=k):w=Math.min(y,m)/2;const S=E*u;let N=[];N="topology"===h?Wb(e,g):"topology-directed"===h?Wb(e,g,!0):"degree"===h?function(t,e){const n=[];return e.forEach((t,e)=>{n.push(Rb(t))}),n.sort((e,n)=>t.getDegree(e.id,"both")-t.getDegree(n.id,"both")),n}(e,g):g.map(t=>Rb(t));const T=Math.ceil(x/s);for(let t=0;t<x;++t){let e=w;e||null===k||null===M||(e=k+t*(M-k)/(x-1)),e||(e=10+100*t/(x-1));let n=l+t%T*S+2*Math.PI/s*Math.floor(t/T);d||(n=c-t%T*S-2*Math.PI/s*Math.floor(t/T)),N[t].data.x=b[0]+Math.cos(n)*e,N[t].data.y=b[1]+Math.sin(n)*e}t&&N.forEach(t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})});return{nodes:N,edges:v}})}}const Wb=(t,e,n=!1)=>{const r=[Rb(e[0])],i={},o=e.length;i[e[0].id]=!0;let a=0;return e.forEach((s,l)=>{if(0!==l)if(l!==o-1&&t.getDegree(s.id,"both")===t.getDegree(e[l+1].id,"both")&&!t.areNeighbors(r[a].id,s.id)||i[s.id]){const l=n?t.getSuccessors(r[a].id):t.getNeighbors(r[a].id);let c=!1;for(let e=0;e<l.length;e++){const n=l[e];if(t.getDegree(n.id)===t.getDegree(s.id)&&!i[n.id]){r.push(Rb(n)),i[n.id]=!0,c=!0;break}}let u=0;for(;!c&&(i[e[u].id]||(r.push(Rb(e[u])),i[e[u].id]=!0,c=!0),u++,u!==o););}else r.push(Rb(s)),i[s.id]=!0,a++}),r};const Hb=(t,e,n)=>{let r=t,i=e,o=n;return r||"undefined"==typeof window||(r=window.innerWidth),i||"undefined"==typeof window||(i=window.innerHeight),o||(o=[r/2,i/2]),[r,i,o]},Ub={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class $b{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},Ub),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i,width:o,height:a,sortBy:s,maxLevelDiff:l,sweep:c,clockwise:u,equidistant:h,preventOverlap:d,startAngle:f=1.5*Math.PI,nodeSize:p,nodeSpacing:g}=r,v=e.getAllNodes(),m=e.getAllEdges(),y=o||"undefined"==typeof window?o:window.innerWidth,b=a||"undefined"==typeof window?a:window.innerHeight,x=i||[y/2,b/2];if(!(null==v?void 0:v.length)||1===v.length)return zb(e,t,x);const E=[];let w,k=0;Nb(p)?w=Math.max(p[0],p[1]):Ut(p)?(w=-1/0,v.forEach(t=>{const e=Math.max(...Db(p(t)));e>w&&(w=e)})):w=p,Nb(g)?k=Math.max(g[0],g[1]):ae(g)&&(k=g),v.forEach(t=>{const e=Rb(t);E.push(e);let n=w;const{data:r}=e;Nb(r.size)?n=Math.max(r.size[0],r.size[1]):ae(r.size)?n=r.size:qt(r.size)&&(n=Math.max(r.size.width,r.size.height)),w=Math.max(w,n),Ut(g)&&(k=Math.max(g(t),k))});const M={};E.forEach((t,e)=>{M[t.id]=e});let S=s;ne(S)&&void 0!==E[0].data[S]||(S="degree"),"degree"===S?E.sort((t,n)=>e.getDegree(n.id,"both")-e.getDegree(t.id,"both")):E.sort((t,e)=>e.data[S]-t.data[S]);const N=E[0],T=(l||("degree"===S?e.getDegree(N.id,"both"):N.data[S]))/4,O=[{nodes:[]}];let C=O[0];E.forEach(t=>{if(C.nodes.length>0){const n="degree"===S?Math.abs(e.getDegree(C.nodes[0].id,"both")-e.getDegree(t.id,"both")):Math.abs(C.nodes[0].data[S]-t.data[S]);T&&n>=T&&(C={nodes:[]},O.push(C))}C.nodes.push(t)});let A=w+k;if(!d){const t=O.length>0&&O[0].nodes.length>1,e=(Math.min(y,b)/2-A)/(O.length+(t?1:0));A=Math.min(A,e)}let P=0;if(O.forEach(t=>{const e=void 0===c?2*Math.PI-2*Math.PI/t.nodes.length:c;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&d){const e=Math.cos(t.dTheta)-Math.cos(0),n=Math.sin(t.dTheta)-Math.sin(0),r=Math.sqrt(A*A/(e*e+n*n));P=Math.max(r,P)}t.r=P,P+=A}),h){let t=0,e=0;for(let n=0;n<O.length;n++){const r=(O[n].r||0)-e;t=Math.max(t,r)}e=0,O.forEach((n,r)=>{0===r&&(e=n.r||0),n.r=e,e+=t})}O.forEach(t=>{const e=t.dTheta||0,n=t.r||0;t.nodes.forEach((t,r)=>{const i=f+(u?1:-1)*e*r;t.data.x=x[0]+n*Math.cos(i),t.data.y=x[1]+n*Math.sin(i)})}),t&&E.forEach(t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}));return{nodes:E,edges:m}})}}function Yb(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,l,c,u,h,d,f=t._root,p={data:r},g=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=p,t;for(;f.length;)if((c=e>=(o=(g+m)/2))?g=o:m=o,(u=n>=(a=(v+y)/2))?v=a:y=a,i=f,!(f=f[h=u<<1|c]))return i[h]=p,t;if(s=+t._x.call(null,f.data),l=+t._y.call(null,f.data),e===s&&n===l)return p.next=f,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+m)/2))?g=o:m=o,(u=n>=(a=(v+y)/2))?v=a:y=a}while((h=u<<1|c)==(d=(l>=a)<<1|s>=o));return i[d]=f,i[h]=p,t}function qb(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Xb(t){return t[0]}function Kb(t){return t[1]}function Zb(t,e,n){var r=new Qb(null==e?Xb:e,null==n?Kb:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Qb(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Jb(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var tx=Zb.prototype=Qb.prototype;function ex(t,e,n,r,i){if(isNaN(e)||isNaN(n)||isNaN(r))return t;var o,a,s,l,c,u,h,d,f,p,g,v,m=t._root,y={data:i},b=t._x0,x=t._y0,E=t._z0,w=t._x1,k=t._y1,M=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((d=e>=(a=(b+w)/2))?b=a:w=a,(f=n>=(s=(x+k)/2))?x=s:k=s,(p=r>=(l=(E+M)/2))?E=l:M=l,o=m,!(m=m[g=p<<2|f<<1|d]))return o[g]=y,t;if(c=+t._x.call(null,m.data),u=+t._y.call(null,m.data),h=+t._z.call(null,m.data),e===c&&n===u&&r===h)return y.next=m,o?o[g]=y:t._root=y,t;do{o=o?o[g]=new Array(8):t._root=new Array(8),(d=e>=(a=(b+w)/2))?b=a:w=a,(f=n>=(s=(x+k)/2))?x=s:k=s,(p=r>=(l=(E+M)/2))?E=l:M=l}while((g=p<<2|f<<1|d)==(v=(h>=l)<<2|(u>=s)<<1|c>=a));return o[v]=m,o[g]=y,t}function nx(t,e,n,r,i,o,a){this.node=t,this.x0=e,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}tx.copy=function(){var t,e,n=new Qb(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Jb(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Jb(e));return n},tx.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Yb(this.cover(e,n),e,n,t)},tx.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),l=1/0,c=1/0,u=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<l&&(l=r),r>u&&(u=r),i<c&&(c=i),i>h&&(h=i));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),n=0;n<o;++n)Yb(this,a[n],s[n],t[n]);return this},tx.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,l=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=c,c=a,l*=2,s){case 0:i=n+l,o=r+l;break;case 1:n=i-l,o=r+l;break;case 2:i=n+l,r=o-l;break;case 3:n=i-l,r=o-l}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},tx.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},tx.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},tx.find=function(t,e,n){var r,i,o,a,s,l,c,u=this._x0,h=this._y0,d=this._x1,f=this._y1,p=[],g=this._root;for(g&&p.push(new qb(g,u,h,d,f)),null==n?n=1/0:(u=t-n,h=e-n,d=t+n,f=e+n,n*=n);l=p.pop();)if(!(!(g=l.node)||(i=l.x0)>d||(o=l.y0)>f||(a=l.x1)<u||(s=l.y1)<h))if(g.length){var v=(i+a)/2,m=(o+s)/2;p.push(new qb(g[3],v,m,a,s),new qb(g[2],i,m,v,s),new qb(g[1],v,o,a,m),new qb(g[0],i,o,v,m)),(c=(e>=m)<<1|t>=v)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var y=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),x=y*y+b*b;if(x<n){var E=Math.sqrt(n=x);u=t-E,h=e-E,d=t+E,f=e+E,r=g.data}}return r},tx.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,l,c,u,h,d,f=this._root,p=this._x0,g=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((c=o>=(s=(p+v)/2))?p=s:v=s,(u=a>=(l=(g+m)/2))?g=l:m=l,e=f,!(f=f[h=u<<1|c]))return this;if(!f.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,d=h)}for(;f.data!==t;)if(r=f,!(f=f.next))return this;return(i=f.next)&&delete f.next,r?(i?r.next=i:delete r.next,this):e?(i?e[h]=i:delete e[h],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(n?n[d]=f:this._root=f),this):(this._root=i,this)},tx.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},tx.root=function(){return this._root},tx.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},tx.visit=function(t){var e,n,r,i,o,a,s=[],l=this._root;for(l&&s.push(new qb(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&l.length){var c=(r+o)/2,u=(i+a)/2;(n=l[3])&&s.push(new qb(n,c,u,o,a)),(n=l[2])&&s.push(new qb(n,r,u,c,a)),(n=l[1])&&s.push(new qb(n,c,i,o,u)),(n=l[0])&&s.push(new qb(n,r,i,c,u))}return this},tx.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new qb(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,l=e.x1,c=e.y1,u=(a+l)/2,h=(s+c)/2;(o=i[0])&&n.push(new qb(o,a,s,u,h)),(o=i[1])&&n.push(new qb(o,u,s,l,h)),(o=i[2])&&n.push(new qb(o,a,h,u,c)),(o=i[3])&&n.push(new qb(o,u,h,l,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},tx.x=function(t){return arguments.length?(this._x=t,this):this._x},tx.y=function(t){return arguments.length?(this._y=t,this):this._y};const rx=(t,e,n,r,i,o)=>Math.sqrt((t-r)**2+(e-i)**2+(n-o)**2);function ix(t){return t[0]}function ox(t){return t[1]}function ax(t){return t[2]}function sx(t,e,n,r){var i=new lx(null==e?ix:e,null==n?ox:n,null==r?ax:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function lx(t,e,n,r,i,o,a,s,l){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function cx(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var ux=sx.prototype=lx.prototype;ux.copy=function(){var t,e,n=new lx(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(!r)return n;if(!r.length)return n._root=cx(r),n;for(t=[{source:r,target:n._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(8)}):r.target[i]=cx(e));return n},ux.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t),r=+this._z.call(null,t);return ex(this.cover(e,n,r),e,n,r,t)},ux.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,n=new Float64Array(e),r=new Float64Array(e),i=new Float64Array(e);let o=1/0,a=1/0,s=1/0,l=-1/0,c=-1/0,u=-1/0;for(let h,d,f,p,g=0;g<e;++g)isNaN(d=+this._x.call(null,h=t[g]))||isNaN(f=+this._y.call(null,h))||isNaN(p=+this._z.call(null,h))||(n[g]=d,r[g]=f,i[g]=p,d<o&&(o=d),d>l&&(l=d),f<a&&(a=f),f>c&&(c=f),p<s&&(s=p),p>u&&(u=p));if(o>l||a>c||s>u)return this;this.cover(o,a,s).cover(l,c,u);for(let o=0;o<e;++o)ex(this,n[o],r[o],i[o],t[o]);return this},ux.cover=function(t,e,n){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._z0,a=this._x1,s=this._y1,l=this._z1;if(isNaN(r))a=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1,l=(o=Math.floor(n))+1;else{for(var c,u,h=a-r||1,d=this._root;r>t||t>=a||i>e||e>=s||o>n||n>=l;)switch(u=(n<o)<<2|(e<i)<<1|t<r,(c=new Array(8))[u]=d,d=c,h*=2,u){case 0:a=r+h,s=i+h,l=o+h;break;case 1:r=a-h,s=i+h,l=o+h;break;case 2:a=r+h,i=s-h,l=o+h;break;case 3:r=a-h,i=s-h,l=o+h;break;case 4:a=r+h,s=i+h,o=l-h;break;case 5:r=a-h,s=i+h,o=l-h;break;case 6:a=r+h,i=s-h,o=l-h;break;case 7:r=a-h,i=s-h,o=l-h}this._root&&this._root.length&&(this._root=d)}return this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this},ux.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},ux.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},ux.find=function(t,e,n,r){var i,o,a,s,l,c,u,h,d,f=this._x0,p=this._y0,g=this._z0,v=this._x1,m=this._y1,y=this._z1,b=[],x=this._root;for(x&&b.push(new nx(x,f,p,g,v,m,y)),null==r?r=1/0:(f=t-r,p=e-r,g=n-r,v=t+r,m=e+r,y=n+r,r*=r);h=b.pop();)if(!(!(x=h.node)||(o=h.x0)>v||(a=h.y0)>m||(s=h.z0)>y||(l=h.x1)<f||(c=h.y1)<p||(u=h.z1)<g))if(x.length){var E=(o+l)/2,w=(a+c)/2,k=(s+u)/2;b.push(new nx(x[7],E,w,k,l,c,u),new nx(x[6],o,w,k,E,c,u),new nx(x[5],E,a,k,l,w,u),new nx(x[4],o,a,k,E,w,u),new nx(x[3],E,w,s,l,c,k),new nx(x[2],o,w,s,E,c,k),new nx(x[1],E,a,s,l,w,k),new nx(x[0],o,a,s,E,w,k)),(d=(n>=k)<<2|(e>=w)<<1|t>=E)&&(h=b[b.length-1],b[b.length-1]=b[b.length-1-d],b[b.length-1-d]=h)}else{var M=t-+this._x.call(null,x.data),S=e-+this._y.call(null,x.data),N=n-+this._z.call(null,x.data),T=M*M+S*S+N*N;if(T<r){var O=Math.sqrt(r=T);f=t-O,p=e-O,g=n-O,v=t+O,m=e+O,y=n+O,i=x.data}}return i},ux.findAllWithinRadius=function(t,e,n,r){const i=[],o=t-r,a=e-r,s=n-r,l=t+r,c=e+r,u=n+r;return this.visit((h,d,f,p,g,v,m)=>{if(!h.length)do{const o=h.data;rx(t,e,n,this._x(o),this._y(o),this._z(o))<=r&&i.push(o)}while(h=h.next);return d>l||f>c||p>u||g<o||v<a||m<s}),i},ux.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,n,r,i,o,a,s,l,c,u,h,d,f,p,g,v=this._root,m=this._x0,y=this._y0,b=this._z0,x=this._x1,E=this._y1,w=this._z1;if(!v)return this;if(v.length)for(;;){if((h=o>=(l=(m+x)/2))?m=l:x=l,(d=a>=(c=(y+E)/2))?y=c:E=c,(f=s>=(u=(b+w)/2))?b=u:w=u,e=v,!(v=v[p=f<<2|d<<1|h]))return this;if(!v.length)break;(e[p+1&7]||e[p+2&7]||e[p+3&7]||e[p+4&7]||e[p+5&7]||e[p+6&7]||e[p+7&7])&&(n=e,g=p)}for(;v.data!==t;)if(r=v,!(v=v.next))return this;return(i=v.next)&&delete v.next,r?(i?r.next=i:delete r.next,this):e?(i?e[p]=i:delete e[p],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(n?n[g]=v:this._root=v),this):(this._root=i,this)},ux.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},ux.root=function(){return this._root},ux.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},ux.visit=function(t){var e,n,r,i,o,a,s,l,c=[],u=this._root;for(u&&c.push(new nx(u,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(u=e.node,r=e.x0,i=e.y0,o=e.z0,a=e.x1,s=e.y1,l=e.z1)&&u.length){var h=(r+a)/2,d=(i+s)/2,f=(o+l)/2;(n=u[7])&&c.push(new nx(n,h,d,f,a,s,l)),(n=u[6])&&c.push(new nx(n,r,d,f,h,s,l)),(n=u[5])&&c.push(new nx(n,h,i,f,a,d,l)),(n=u[4])&&c.push(new nx(n,r,i,f,h,d,l)),(n=u[3])&&c.push(new nx(n,h,d,o,a,s,f)),(n=u[2])&&c.push(new nx(n,r,d,o,h,s,f)),(n=u[1])&&c.push(new nx(n,h,i,o,a,d,f)),(n=u[0])&&c.push(new nx(n,r,i,o,h,d,f))}return this},ux.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new nx(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,l=e.z0,c=e.x1,u=e.y1,h=e.z1,d=(a+c)/2,f=(s+u)/2,p=(l+h)/2;(o=i[0])&&n.push(new nx(o,a,s,l,d,f,p)),(o=i[1])&&n.push(new nx(o,d,s,l,c,f,p)),(o=i[2])&&n.push(new nx(o,a,f,l,d,u,p)),(o=i[3])&&n.push(new nx(o,d,f,l,c,u,p)),(o=i[4])&&n.push(new nx(o,a,s,p,d,f,h)),(o=i[5])&&n.push(new nx(o,d,s,p,c,f,h)),(o=i[6])&&n.push(new nx(o,a,f,p,d,u,h)),(o=i[7])&&n.push(new nx(o,d,f,p,c,u,h))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},ux.x=function(t){return arguments.length?(this._x=t,this):this._x},ux.y=function(t){return arguments.length?(this._y=t,this):this._y},ux.z=function(t){return arguments.length?(this._z=t,this):this._z};function hx(t,e,n,r,i=2){const o=e/n,a=t.getAllNodes(),s=a.map((t,e)=>{const{nodeStrength:n,x:r,y:i,z:a,size:s}=t.data;return{x:r,y:i,z:a,size:s,index:e,id:t.id,vx:0,vy:0,vz:0,weight:o*n}}),l=(2===i?Zb(s,t=>t.x,t=>t.y):sx(s,t=>t.x,t=>t.y,t=>t.z)).visitAfter(dx),c=new Map;return s.forEach(t=>{c.set(t.id,t),function(t,e,n){e.visit((e,r,i,o,a)=>fx(e,r,i,o,a,t,n))}(t,l,i)}),s.map((t,e)=>{const{id:n,data:i}=a[e],{mass:o=1}=i;r[n]={x:t.vx/o,y:t.vy/o,z:t.vz/o}}),r}function dx(t){let e=0,n=0,r=0,i=0,o=0;const a=t.length;if(a){for(let s=0;s<a;s++){const a=t[s];a&&a.weight&&(e+=a.weight,n+=a.x*a.weight,r+=a.y*a.weight,i+=a.z*a.weight,o+=a.size*a.weight)}t.x=n/e,t.y=r/e,t.z=i/e,t.size=o/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}const fx=(t,e,n,r,i,o,a)=>{var s;if((null===(s=t.data)||void 0===s?void 0:s.id)===o.id)return;const l=[n,r,i][a-1],c=o.x-t.x||.1,u=o.y-t.y||.1,h=o.z-t.z||.1,d=[c,u,h],f=l-e;let p=0;for(let t=0;t<a;t++)p+=d[t]*d[t];const g=Math.sqrt(p)*p;if(f*f*.81<p){const e=t.weight/g;return o.vx+=c*e,o.vy+=u*e,o.vz+=h*e,!0}if(t.length)return!1;if(t.data!==o){const e=t.data.weight/g;o.vx+=c*e,o.vy+=u*e,o.vz+=h*e}};const px={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class gx{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},px),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,t,e)})}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0})),e}genericForceLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),i=e.getAllNodes(),o=e.getAllEdges(),a=this.formatOptions(r,e),{dimensions:s,width:l,height:c,nodeSize:u,getMass:h,nodeStrength:d,edgeStrength:f,linkDistance:p}=a,g=i.map((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:ae(t.data.x)?t.data.x:Math.random()*l,y:ae(t.data.y)?t.data.y:Math.random()*c,z:ae(t.data.z)?t.data.z:Math.random()*Math.sqrt(l*c),size:u(t)||30,mass:h(t),nodeStrength:d(t)})})),v=o.map(t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:f(t),linkDistance:p(t,e.getNode(t.source),e.getNode(t.target))})}));if(!(null==i?void 0:i.length))return this.lastResult={nodes:[],edges:o},{nodes:[],edges:o};const m={};i.forEach((t,e)=>{m[t.id]={x:0,y:0,z:0}});const y=new pv({nodes:g,edges:v});this.formatCentripetal(a,y);const{maxIteration:b,minMovement:x,onTick:E}=a;if(this.lastLayoutNodes=g,this.lastLayoutEdges=v,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=y,this.lastOptions=a,this.lastVelMap=m,"undefined"==typeof window)return;let w=0;return new Promise(n=>{this.timeInterval=window.setInterval(()=>{i&&this.running||n({nodes:xx(e,g),edges:o}),this.runOneStep(y,e,w,m,a),this.updatePosition(e,y,m,a),t&&g.forEach(t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===s?t.data.z:void 0})),null==E||E({nodes:xx(e,g),edges:o}),w++,(w>=b||this.judgingDistance<x)&&(window.clearInterval(this.timeInterval),n({nodes:xx(e,g),edges:o}))},0),this.running=!0})})}formatOptions(t,e){const n=Object.assign({},t),{width:r,height:i,getMass:o}=t;n.width=r||"undefined"==typeof window?r:window.innerWidth,n.height=i||"undefined"==typeof window?i:window.innerHeight,t.center||(n.center=[n.width/2,n.height/2]),o||(n.getMass=t=>{let n=1;ae(null==t?void 0:t.data.mass)&&(n=null==t?void 0:t.data.mass);const r=e.getDegree(t.id,"both");return!r||r<5?n:5*r*n}),n.nodeSize=Ib(t.nodeSize,t.nodeSpacing);const a=t.linkDistance?Lb(1,t.linkDistance):t=>1+n.nodeSize(e.getNode(t.source))+n.nodeSize(e.getNode(t.target));return n.linkDistance=a,n.nodeStrength=Lb(1,t.nodeStrength),n.edgeStrength=Lb(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:r,center:i,clusterNodeStrength:o,leafCluster:a,clustering:s,nodeClusterBy:l}=t,c=e.getAllNodes(),u=r||{leaf:2,single:2,others:1,center:t=>({x:i[0],y:i[1],z:3===n?i[2]:void 0})};let h,d;if("function"!=typeof o&&(t.clusterNodeStrength=t=>o),a&&l&&(h=vx(e,l),d=Array.from(new Set(null==c?void 0:c.map(t=>t.data[l])))||[],t.centripetalOptions=Object.assign(u,{single:100,leaf:e=>{const{siblingLeaves:n,sameTypeLeaves:r}=h[e.id]||{};return(null==r?void 0:r.length)===(null==n?void 0:n.length)||1===(null==d?void 0:d.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const n=e.getDegree(t.id,"both");if(!n)return{x:100,y:100,z:0};let r;if(1===n){const{sameTypeLeaves:e=[]}=h[t.id]||{};1===e.length?r=void 0:e.length>1&&(r=bx(e))}else r=void 0;return{x:null==r?void 0:r.x,y:null==r?void 0:r.y,z:null==r?void 0:r.z}}})),s&&l){h||(h=vx(e,l)),d||(d=Array.from(new Set(c.map(t=>t.data[l])))),d=d.filter(t=>void 0!==t);const n={};d.forEach(t=>{const r=c.filter(e=>e.data[l]===t).map(t=>e.getNode(t.id));n[t]=bx(r)}),t.centripetalOptions=Object.assign(u,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=n[t.data[l]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:p,others:g}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),p&&"function"!=typeof p&&(t.centripetalOptions.single=()=>p),g&&"function"!=typeof g&&(t.centripetalOptions.others=()=>g)}runOneStep(t,e,n,r,i){const o={},a=t.getAllNodes(),s=t.getAllEdges();if(!(null==a?void 0:a.length))return;const{monitor:l}=i;if(this.calRepulsive(t,o,i),s&&this.calAttractive(t,o,i),this.calGravity(t,e,o,i),this.updateVelocity(t,o,r,i),l){l({energy:this.calTotalEnergy(o,a),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let n=0;return e.forEach((e,r)=>{const i=t[e.id].x,o=t[e.id].y,a=3===this.options.dimensions?t[e.id].z:0,s=i*i+o*o+a*a,{mass:l=1}=e.data;n+=l*s*.5}),n}calRepulsive(t,e,n){const{dimensions:r,factor:i,coulombDisScale:o}=n;hx(t,i,o*o,e,r)}calAttractive(t,e,n){const{dimensions:r,nodeSize:i}=n;t.getAllEdges().forEach((n,o)=>{const{source:a,target:s}=n,l=t.getNode(a),c=t.getNode(s);if(!l||!c)return;let u=c.data.x-l.data.x,h=c.data.y-l.data.y,d=3===r?c.data.z-l.data.z:0;u||h||(u=.01*Math.random(),h=.01*Math.random(),3!==r||d||(d=.01*Math.random()));const f=Math.sqrt(u*u+h*h+d*d);if(f<i(l)+i(c))return;const p=u/f,g=h/f,v=d/f,{linkDistance:m=200,edgeStrength:y=200}=n.data||{},b=(m-f)*y,x=1/(l.data.mass||1),E=1/(c.data.mass||1),w=p*b,k=g*b,M=v*b;e[a].x-=w*x,e[a].y-=k*x,e[a].z-=M*x,e[s].x+=w*E,e[s].y+=k*E,e[s].z+=M*E})}calGravity(t,e,n,r){const{getCenter:i}=r,o=t.getAllNodes(),a=e.getAllNodes(),s=e.getAllEdges(),{width:l,height:c,center:u,gravity:h,centripetalOptions:d}=r;o&&o.forEach(r=>{const{id:o,data:f}=r,{mass:p,x:g,y:v,z:m}=f,y=e.getNode(o);let b=0,x=0,E=0,w=h;const k=t.getDegree(o,"in"),M=t.getDegree(o,"out"),S=t.getDegree(o,"both"),N=null==i?void 0:i(y,S);if(N){const[t,e,n]=N;b=g-t,x=v-e,w=n}else b=g-u[0],x=v-u[1],E=m-u[2];if(w&&(n[o].x-=w*b/p,n[o].y-=w*x/p,n[o].z-=w*E/p),d){const{leaf:t,single:e,others:r,center:i}=d,{x:u,y:h,z:f,centerStrength:b}=(null==i?void 0:i(y,a,s,l,c))||{x:0,y:0,z:0,centerStrength:0};if(!ae(u)||!ae(h))return;const x=(g-u)/p,E=(v-h)/p,w=(m-f)/p;if(b&&(n[o].x-=b*x,n[o].y-=b*E,n[o].z-=b*w),0===S){const t=e(y);if(!t)return;return n[o].x-=t*x,n[o].y-=t*E,void(n[o].z-=t*w)}if(0===k||0===M){const e=t(y,a,s);if(!e)return;return n[o].x-=e*x,n[o].y-=e*E,void(n[o].z-=e*w)}const N=r(y);if(!N)return;n[o].x-=N*x,n[o].y-=N*E,n[o].z-=N*w}})}updateVelocity(t,e,n,r){const{damping:i,maxSpeed:o,interval:a,dimensions:s}=r,l=t.getAllNodes();(null==l?void 0:l.length)&&l.forEach(t=>{const{id:r}=t;let l=(n[r].x+e[r].x*a)*i||.01,c=(n[r].y+e[r].y*a)*i||.01,u=3===s?(n[r].z+e[r].z*a)*i||.01:0;const h=Math.sqrt(l*l+c*c+u*u);if(h>o){const t=o/h;l*=t,c*=t,u*=t}n[r]={x:l,y:c,z:u}})}updatePosition(t,e,n,r){const{distanceThresholdMode:i,interval:o,dimensions:a}=r,s=e.getAllNodes();if(!(null==s?void 0:s.length))return void(this.judgingDistance=0);let l=0;"max"===i?this.judgingDistance=-1/0:"min"===i&&(this.judgingDistance=1/0),s.forEach(r=>{const{id:s}=r,c=t.getNode(s);if(ae(c.data.fx)&&ae(c.data.fy))return void e.mergeNodeData(s,{x:c.data.fx,y:c.data.fy,z:3===a?c.data.fz:void 0});const u=n[s].x*o,h=n[s].y*o,d=3===a?n[s].z*o:0;e.mergeNodeData(s,{x:r.data.x+u,y:r.data.y+h,z:r.data.z+d});const f=Math.sqrt(u*u+h*h+d*d);switch(i){case"max":this.judgingDistance<f&&(this.judgingDistance=f);break;case"min":this.judgingDistance>f&&(this.judgingDistance=f);break;default:l+=f}}),i&&"mean"!==i||(this.judgingDistance=l/s.length)}}const vx=(t,e)=>{const n=t.getAllNodes();if(!(null==n?void 0:n.length))return{};const r={};return n.forEach((n,i)=>{1===t.getDegree(n.id,"both")&&(r[n.id]=mx(t,"leaf",n,e))}),r},mx=(t,e,n,r)=>{const i=t.getDegree(n.id,"in"),o=t.getDegree(n.id,"out");let a=n,s=[];0===i?(a=t.getSuccessors(n.id)[0],s=t.getNeighbors(a.id)):0===o&&(a=t.getPredecessors(n.id)[0],s=t.getNeighbors(a.id)),s=s.filter(e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"));return{coreNode:a,siblingLeaves:s,sameTypeLeaves:yx(t,e,r,n,s)}},yx=(t,e,n,r,i)=>{const o=r.data[n]||"";let a=(null==i?void 0:i.filter(t=>t.data[n]===o))||[];return a=a.filter(e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")),a},bx=t=>{const e={x:0,y:0};t.forEach(t=>{const{x:n,y:r}=t.data;e.x+=n||0,e.y+=r||0});const n=t.length||1;return{x:e.x/n,y:e.y/n}},xx=(t,e)=>e.map(e=>{const{id:n,data:r}=e,i=t.getNode(n);return Object.assign(Object.assign({},i),{data:Object.assign(Object.assign({},i.data),{x:r.x,y:r.y,z:r.z})})});var Ex={};const wx=Object.prototype.toString;function kx(t){const e=wx.call(t);return e.endsWith("Array]")&&!e.includes("Big")}var Mx=w(Object.freeze({__proto__:null,isAnyArray:kx}));var Sx=Object.freeze({__proto__:null,default:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!kx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!kx(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!kx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],s=r+1;s<o;s++)t[s]<a&&(a=t[s]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!kx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],s=r+1;s<o;s++)t[s]>a&&(a=t[s]);return a}(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,a=void 0===o?n.autoMinMax?r:0:o,s=n.max,l=void 0===s?n.autoMinMax?i:1:s;if(a>=l)throw new RangeError("min option must be smaller than max option");for(var c=(l-a)/(i-r),u=0;u<t.length;u++)e[u]=(t[u]-r)*c+a;return e}}),Nx=w(Sx);Object.defineProperty(Ex,"__esModule",{value:!0});var Tx=Mx,Ox=Nx;const Cx=" ".repeat(2),Ax=" ".repeat(4);function Px(t,e={}){const{maxRows:n=15,maxColumns:r=10,maxNumSize:i=8,padMinus:o="auto"}=e;return`${t.constructor.name} {\n${Cx}[\n${Ax}${function(t,e,n,r,i){const{rows:o,columns:a}=t,s=Math.min(o,e),l=Math.min(a,n),c=[];if("auto"===i){i=!1;t:for(let e=0;e<s;e++)for(let n=0;n<l;n++)if(t.get(e,n)<0){i=!0;break t}}for(let e=0;e<s;e++){let n=[];for(let o=0;o<l;o++)n.push(Rx(t.get(e,o),r,i));c.push(`${n.join(" ")}`)}l!==a&&(c[c.length-1]+=` ... ${a-n} more columns`);s!==o&&c.push(`... ${o-e} more rows`);return c.join(`\n${Ax}`)}(t,n,r,i,o)}\n${Cx}]\n${Cx}rows: ${t.rows}\n${Cx}columns: ${t.columns}\n}`}function Rx(t,e,n){return(t>=0&&n?` ${Dx(t,e-1)}`:Dx(t,e)).padEnd(e)}function Dx(t,e){let n=t.toString();if(n.length<=e)return n;let r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function Lx(t,e,n){let r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function _x(t,e,n){let r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function Ix(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function jx(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function Bx(t,e){if(!Tx.isAnyArray(e))throw new TypeError("row indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.rows)throw new RangeError("row indices are out of range")}function Fx(t,e){if(!Tx.isAnyArray(e))throw new TypeError("column indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.columns)throw new RangeError("column indices are out of range")}function zx(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(Vx("startRow",e),Vx("endRow",n),Vx("startColumn",r),Vx("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function Gx(t,e=0){let n=[];for(let r=0;r<t;r++)n.push(e);return n}function Vx(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function Wx(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class Hx{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let r=new Yx(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.set(i,t,n[i*e+t]);return r}static rowVector(t){let e=new Yx(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new Yx(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new Yx(t,e)}static ones(t,e){return new Yx(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:r=Math.random}=n;let i=new Yx(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.set(n,t,r());return i}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:r=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(r>=i)throw new RangeError("min must be smaller than max");let a=i-r,s=new Yx(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=r+Math.round(o()*a);s.set(n,t,e)}return s}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let r=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<r;t++)i.set(t,t,n);return i}static diag(t,e,n){let r=t.length;void 0===e&&(e=r),void 0===n&&(n=e);let i=Math.min(r,e,n),o=this.zeros(e,n);for(let e=0;e<i;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new Yx(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new this(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return i}static checkMatrix(t){return Hx.isMatrix(t)?t:new Yx(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let r=e;for(let i=e;i<t.rows;i++)t.get(i,n)>t.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);let i=t.get(e,n);for(let r=n;r<t.columns;r++)t.set(e,r,t.get(e,r)/i);for(let r=e+1;r<t.rows;r++){let i=t.get(r,n)/t.get(e,n);t.set(r,n,0);for(let o=n+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*i)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,r=n-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let i=0,o=!1;for(;i<n&&!1===o;)1===t.get(r,i)?o=!0:i++;for(let n=0;n<r;n++){let o=t.get(n,i);for(let a=i;a<e;a++){let e=t.get(n,a)-o*t.get(r,a);t.set(n,a,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let r=new Yx(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){Lx(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return Yx.rowVector(this.getRow(t))}setRow(t,e){Lx(this,t),e=Ix(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){Lx(this,t),Lx(this,e);for(let n=0;n<this.columns;n++){let r=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,r)}return this}getColumn(t){_x(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return Yx.columnVector(this.getColumn(t))}setColumn(t,e){_x(this,t),e=jx(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){_x(this,t),_x(this,e);for(let n=0;n<this.rows;n++){let r=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,r)}return this}addRowVector(t){t=Ix(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=Ix(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=Ix(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=Ix(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=jx(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=jx(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=jx(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=jx(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){Lx(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){_x(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){Wx(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)>t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){Wx(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)<t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}maxRow(t){if(Lx(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){Lx(this,t),Wx(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),n[1]=r);return n}minRow(t){if(Lx(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){Lx(this,t),Wx(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),n[1]=r);return n}maxColumn(t){if(_x(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){_x(this,t),Wx(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),n[0]=r);return n}minColumn(t){if(_x(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){_x(this,t),Wx(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),n[0]=r);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){Hx.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}mmul(t){t=Yx.checkMatrix(t);let e=this.rows,n=this.columns,r=t.columns,i=new Yx(e,r),o=new Float64Array(n);for(let a=0;a<r;a++){for(let e=0;e<n;e++)o[e]=t.get(e,a);for(let t=0;t<e;t++){let e=0;for(let r=0;r<n;r++)e+=this.get(t,r)*o[r];i.set(t,a,e)}}return i}mpow(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");let e=Yx.eye(this.rows),n=this;for(let r=t;r>=1;r/=2)1&r&&(e=e.mmul(n)),n=n.mmul(n);return e}strassen2x2(t){t=Yx.checkMatrix(t);let e=new Yx(2,2);const n=this.get(0,0),r=t.get(0,0),i=this.get(0,1),o=t.get(0,1),a=this.get(1,0),s=t.get(1,0),l=this.get(1,1),c=t.get(1,1),u=(n+l)*(r+c),h=(a+l)*r,d=n*(o-c),f=l*(s-r),p=(n+i)*c,g=u+f-p+(i-l)*(s+c),v=d+p,m=h+f,y=u-h+d+(a-n)*(r+o);return e.set(0,0,g),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=Yx.checkMatrix(t);let e=new Yx(3,3);const n=this.get(0,0),r=this.get(0,1),i=this.get(0,2),o=this.get(1,0),a=this.get(1,1),s=this.get(1,2),l=this.get(2,0),c=this.get(2,1),u=this.get(2,2),h=t.get(0,0),d=t.get(0,1),f=t.get(0,2),p=t.get(1,0),g=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),b=t.get(2,2),x=(n-o)*(-d+g),E=(-n+o+a)*(h-d+g),w=(o+a)*(-h+d),k=n*h,M=(-n+l+c)*(h-f+v),S=(-n+l)*(f-v),N=(l+c)*(-h+f),T=(-i+c+u)*(g+m-y),O=(i-u)*(g-y),C=i*m,A=(c+u)*(-m+y),P=(-i+a+s)*(v+m-b),R=(i-s)*(v-b),D=(a+s)*(-m+b),L=k+C+r*p,_=(n+r+i-o-a-c-u)*g+E+w+k+T+C+A,I=k+M+N+(n+r+i-a-s-l-c)*v+C+P+D,j=x+a*(-h+d+p-g-v-m+b)+E+k+C+P+R,B=x+E+w+k+s*y,F=C+P+R+D+o*f,z=k+M+S+c*(-h+f+p-g-v-m+y)+T+O+C,G=T+O+C+A+l*d,V=k+M+S+N+u*b;return e.set(0,0,L),e.set(0,1,_),e.set(0,2,I),e.set(1,0,j),e.set(1,1,B),e.set(1,2,F),e.set(2,0,z),e.set(2,1,G),e.set(2,2,V),e}mmulStrassen(t){t=Yx.checkMatrix(t);let e=this.clone(),n=e.rows,r=e.columns,i=t.rows,o=t.columns;function a(t,e,n){let r=t.rows,i=t.columns;if(r===e&&i===n)return t;{let r=Hx.zeros(e,n);return r=r.setSubMatrix(t,0,0),r}}r!==i&&console.warn(`Multiplying ${n} x ${r} and ${i} x ${o} matrix: dimensions do not match.`);let s=Math.max(n,i),l=Math.max(r,o);return e=a(e,s,l),function t(e,n,r,i){if(r<=512||i<=512)return e.mmul(n);r%2==1&&i%2==1?(e=a(e,r+1,i+1),n=a(n,r+1,i+1)):r%2==1?(e=a(e,r+1,i),n=a(n,r+1,i)):i%2==1&&(e=a(e,r,i+1),n=a(n,r,i+1));let o=parseInt(e.rows/2,10),s=parseInt(e.columns/2,10),l=e.subMatrix(0,o-1,0,s-1),c=n.subMatrix(0,o-1,0,s-1),u=e.subMatrix(0,o-1,s,e.columns-1),h=n.subMatrix(0,o-1,s,n.columns-1),d=e.subMatrix(o,e.rows-1,0,s-1),f=n.subMatrix(o,n.rows-1,0,s-1),p=e.subMatrix(o,e.rows-1,s,e.columns-1),g=n.subMatrix(o,n.rows-1,s,n.columns-1),v=t(Hx.add(l,p),Hx.add(c,g),o,s),m=t(Hx.add(d,p),c,o,s),y=t(l,Hx.sub(h,g),o,s),b=t(p,Hx.sub(f,c),o,s),x=t(Hx.add(l,u),g,o,s),E=t(Hx.sub(d,l),Hx.add(c,h),o,s),w=t(Hx.sub(u,p),Hx.add(f,g),o,s),k=Hx.add(v,b);k.sub(x),k.add(w);let M=Hx.add(y,x),S=Hx.add(m,b),N=Hx.sub(v,m);N.add(y),N.add(E);let T=Hx.zeros(2*k.rows,2*k.columns);return T=T.setSubMatrix(k,0,0),T=T.setSubMatrix(M,k.rows,0),T=T.setSubMatrix(S,0,k.columns),T=T.setSubMatrix(N,k.rows,k.columns),T.subMatrix(0,r-1,0,i-1)}(e,t=a(t,s,l),s,l)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Yx(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&Ox(i,{min:e,max:n,output:i}),r.setRow(t,i)}return r}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Yx(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&Ox(i,{min:e,max:n,output:i}),r.setColumn(t,i)}return r}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),r=this.get(e,this.columns-1-n);this.set(e,n,r),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),r=this.get(this.rows-1-n,e);this.set(n,e,r),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=Yx.checkMatrix(t);let e=this.rows,n=this.columns,r=t.rows,i=t.columns,o=new Yx(e*r,n*i);for(let a=0;a<e;a++)for(let e=0;e<n;e++)for(let n=0;n<r;n++)for(let s=0;s<i;s++)o.set(r*a+n,i*e+s,this.get(a,e)*t.get(n,s));return o}kroneckerSum(t){if(t=Yx.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,r=this.kroneckerProduct(Yx.eye(n,n)),i=Yx.eye(e,e).kroneckerProduct(t);return r.add(i)}transpose(){let t=new Yx(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=Ux){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Ux){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,r){zx(this,t,e,n,r);let i=new Yx(e-t+1,r-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=r;e++)i.set(o-t,e-n,this.get(o,e));return i}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let r=new Yx(t.length,n-e+1);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);r.set(i,o-e,this.get(t[i],o))}return r}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let r=new Yx(n-e+1,t.length);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);r.set(o-e,i,this.get(o,t[i]))}return r}setSubMatrix(t,e,n){if((t=Yx.checkMatrix(t)).isEmpty())return this;zx(this,e,e+t.rows-1,n,n+t.columns-1);for(let r=0;r<t.rows;r++)for(let i=0;i<t.columns;i++)this.set(e+r,n+i,t.get(r,i));return this}selection(t,e){Bx(this,t),Fx(this,e);let n=new Yx(t.length,e.length);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<e.length;t++){let o=e[t];n.set(r,t,this.get(i,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){return this.constructor.copy(this,new Yx(this.rows,this.columns))}static copy(t,e){for(const[n,r,i]of t.entries())e.set(n,r,i);return e}sum(t){switch(t){case"row":return function(t){let e=Gx(t.rows);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]+=t.get(n,r);return e}(this);case"column":return function(t){let e=Gx(t.columns);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]+=t.get(n,r);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e+=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=Gx(t.rows,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]*=t.get(n,r);return e}(this);case"column":return function(t){let e=Gx(t.columns,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]*=t.get(n,r);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e*=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:r=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Tx.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<r;a++){let r=0,s=0,l=0;for(let e=0;e<i;e++)l=t.get(a,e)-n[a],r+=l,s+=l*l;e?o.push((s-r*r/i)/(i-1)):o.push((s-r*r/i)/i)}return o}(this,n,r);case"column":if(!Tx.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<i;a++){let i=0,s=0,l=0;for(let e=0;e<r;e++)l=t.get(e,a)-n[a],i+=l,s+=l*l;e?o.push((s-i*i/r)/(r-1)):o.push((s-i*i/r)/r)}return o}(this,n,r);case void 0:if("number"!=typeof r)throw new TypeError("mean must be a number");return function(t,e,n){const r=t.rows,i=t.columns,o=r*i;let a=0,s=0,l=0;for(let e=0;e<r;e++)for(let r=0;r<i;r++)l=t.get(e,r)-n,a+=l,s+=l*l;return e?(s-a*a/o)/(o-1):(s-a*a/o)/o}(this,n,r);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!Tx.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[n])}(this,n),this;case"column":if(!Tx.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[r])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let r=0;for(let e=0;e<t.columns;e++)r+=t.get(n,e)**2/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!Tx.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let r=0;for(let e=0;e<t.rows;e++)r+=t.get(e,n)**2/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!Tx.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[r])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let r=0;r<t.columns;r++)for(let i=0;i<t.rows;i++)n+=t.get(i,r)**2/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return Px(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function Ux(t,e){return t-e}function $x(t){return t.every(t=>"number"==typeof t)}Hx.prototype.klass="Matrix","undefined"!=typeof Symbol&&(Hx.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return Px(this)}),Hx.random=Hx.rand,Hx.randomInt=Hx.randInt,Hx.diagonal=Hx.diag,Hx.prototype.diagonal=Hx.prototype.diag,Hx.identity=Hx.eye,Hx.prototype.negate=Hx.prototype.neg,Hx.prototype.tensorProduct=Hx.prototype.kroneckerProduct;let Yx=class t extends Hx{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(e,n){if(super(),t.isMatrix(e))this.#t(e.rows,e.columns),t.copy(e,this);else if(Number.isInteger(e)&&e>=0)this.#t(e,n);else{if(!Tx.isAnyArray(e))throw new TypeError("First argument must be a positive number or an array");{const t=e;if("number"!=typeof(n=(e=t.length)?t[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<e;r++){if(t[r].length!==n)throw new RangeError("Inconsistent array dimensions");if(!$x(t[r]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(t[r]))}this.rows=e,this.columns=n}}}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return Lx(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),Lx(this,t,!0),e=Float64Array.from(Ix(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){_x(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let r=0;r<t;r++)n[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)n[r-1]=this.data[e][r];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),_x(this,t,!0),e=jx(this,e);for(let n=0;n<this.rows;n++){const r=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)r[i]=this.data[n][i];for(r[i++]=e[n];i<this.columns+1;i++)r[i]=this.data[n][i-1];this.data[n]=r}return this.columns+=1,this}};!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)**t);return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)**t.get(e,n));return this}}(Hx,Yx);class qx extends Hx{#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(t){return Yx.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),Yx.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=Yx.copy(t,new Yx(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new Yx(t,t);else if(this.#e=new Yx(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new qx(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())t.set(e,n,r);return t}toMatrix(){return new Yx(this)}get(t,e){return this.#e.get(t,e)}set(t,e,n){return this.#e.set(t,e,n),this.#e.set(e,t,n),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const n=e.slice();return n.splice(t,1),this.#e.addRow(t,n),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[n,r]of t.entries())r||e.push(n);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let n=0,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=++r);return e}static fromCompact(t){const e=t.length,n=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const r=new qx(n);for(let i=0,o=0,a=0;a<e;a++)r.set(i,o,t[a]),++i>=n&&(i=++o);return r}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield[t,e,n],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield n,++e>=this.diagonalSize&&(e=++t)}}}qx.prototype.klassType="SymmetricMatrix";class Xx extends qx{static isDistanceMatrix(t){return qx.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,n){return t===e&&(n=0),super.set(t,e,n)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new qx(this)}clone(){const t=new Xx(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())e!==n&&t.set(e,n,r);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let n=1,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=1+ ++r);return e}static fromCompact(t){const e=t.length;if(0===e)return new this(0);const n=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const r=new this(n);for(let i=1,o=0,a=0;a<e;a++)r.set(i,o,t[a]),++i>=n&&(i=1+ ++o);return r}}Xx.prototype.klassSubType="DistanceMatrix";class Kx extends Hx{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class Zx extends Kx{constructor(t,e,n){Bx(t,e),Fx(t,n),super(t,e.length,n.length),this.rowIndices=e,this.columnIndices=n}set(t,e,n){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],n),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class Qx extends Hx{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let r=this._calculateIndex(t,e);return this.data[r]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class Jx extends Hx{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}class tE{constructor(t){let e,n,r,i,o,a,s,l,c,u=(t=Jx.checkMatrix(t)).clone(),h=u.rows,d=u.columns,f=new Float64Array(h),p=1;for(e=0;e<h;e++)f[e]=e;for(l=new Float64Array(h),n=0;n<d;n++){for(e=0;e<h;e++)l[e]=u.get(e,n);for(e=0;e<h;e++){for(c=Math.min(e,n),o=0,r=0;r<c;r++)o+=u.get(e,r)*l[r];l[e]-=o,u.set(e,n,l[e])}for(i=n,e=n+1;e<h;e++)Math.abs(l[e])>Math.abs(l[i])&&(i=e);if(i!==n){for(r=0;r<d;r++)a=u.get(i,r),u.set(i,r,u.get(n,r)),u.set(n,r,a);s=f[i],f[i]=f[n],f[n]=s,p=-p}if(n<h&&0!==u.get(n,n))for(e=n+1;e<h;e++)u.set(e,n,u.get(e,n)/u.get(n,n))}this.LU=u,this.pivotVector=f,this.pivotSign=p}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(0===t.get(n,n))return!0;return!1}solve(t){t=Yx.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,r,i,o=t.columns,a=t.subMatrixRow(this.pivotVector,0,o-1),s=e.columns;for(i=0;i<s;i++)for(n=i+1;n<s;n++)for(r=0;r<o;r++)a.set(n,r,a.get(n,r)-a.get(i,r)*e.get(n,i));for(i=s-1;i>=0;i--){for(r=0;r<o;r++)a.set(i,r,a.get(i,r)/e.get(i,i));for(n=0;n<i;n++)for(r=0;r<o;r++)a.set(n,r,a.get(n,r)-a.get(i,r)*e.get(n,i))}return a}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let r=0;r<n;r++)e*=t.get(r,r);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new Yx(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i>e?r.set(i,e,t.get(i,e)):i===e?r.set(i,e,1):r.set(i,e,0);return r}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new Yx(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i<=e?r.set(i,e,t.get(i,e)):r.set(i,e,0);return r}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function eE(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class nE{constructor(t){let e,n,r,i,o=(t=Jx.checkMatrix(t)).clone(),a=t.rows,s=t.columns,l=new Float64Array(s);for(r=0;r<s;r++){let t=0;for(e=r;e<a;e++)t=eE(t,o.get(e,r));if(0!==t){for(o.get(r,r)<0&&(t=-t),e=r;e<a;e++)o.set(e,r,o.get(e,r)/t);for(o.set(r,r,o.get(r,r)+1),n=r+1;n<s;n++){for(i=0,e=r;e<a;e++)i+=o.get(e,r)*o.get(e,n);for(i=-i/o.get(r,r),e=r;e<a;e++)o.set(e,n,o.get(e,n)+i*o.get(e,r))}}l[r]=-t}this.QR=o,this.Rdiag=l}solve(t){t=Yx.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let r,i,o,a,s=t.columns,l=t.clone(),c=e.columns;for(o=0;o<c;o++)for(i=0;i<s;i++){for(a=0,r=o;r<n;r++)a+=e.get(r,o)*l.get(r,i);for(a=-a/e.get(o,o),r=o;r<n;r++)l.set(r,i,l.get(r,i)+a*e.get(r,o))}for(o=c-1;o>=0;o--){for(i=0;i<s;i++)l.set(o,i,l.get(o,i)/this.Rdiag[o]);for(r=0;r<o;r++)for(i=0;i<s;i++)l.set(r,i,l.get(r,i)-l.get(o,i)*e.get(r,o))}return l.subMatrix(0,c-1,0,s-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,n=this.QR,r=n.columns,i=new Yx(r,r);for(t=0;t<r;t++)for(e=0;e<r;e++)t<e?i.set(t,e,n.get(t,e)):t===e?i.set(t,e,this.Rdiag[t]):i.set(t,e,0);return i}get orthogonalMatrix(){let t,e,n,r,i=this.QR,o=i.rows,a=i.columns,s=new Yx(o,a);for(n=a-1;n>=0;n--){for(t=0;t<o;t++)s.set(t,n,0);for(s.set(n,n,1),e=n;e<a;e++)if(0!==i.get(n,n)){for(r=0,t=n;t<o;t++)r+=i.get(t,n)*s.get(t,e);for(r=-r/i.get(n,n),t=n;t<o;t++)s.set(t,e,s.get(t,e)+r*i.get(t,n))}}return s}}let rE=class{constructor(t,e={}){if((t=Jx.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,r=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:a=!1}=e;let s,l=Boolean(i),c=Boolean(o),u=!1;if(n<r)if(a){s=t.transpose(),n=s.rows,r=s.columns,u=!0;let e=l;l=c,c=e}else s=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else s=t.clone();let h=Math.min(n,r),d=Math.min(n+1,r),f=new Float64Array(d),p=new Yx(n,h),g=new Yx(r,r),v=new Float64Array(r),m=new Float64Array(n),y=new Float64Array(d);for(let t=0;t<d;t++)y[t]=t;let b=Math.min(n-1,r),x=Math.max(0,Math.min(r-2,n)),E=Math.max(b,x);for(let t=0;t<E;t++){if(t<b){f[t]=0;for(let e=t;e<n;e++)f[t]=eE(f[t],s.get(e,t));if(0!==f[t]){s.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<n;e++)s.set(e,t,s.get(e,t)/f[t]);s.set(t,t,s.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<r;e++){if(t<b&&0!==f[t]){let r=0;for(let i=t;i<n;i++)r+=s.get(i,t)*s.get(i,e);r=-r/s.get(t,t);for(let i=t;i<n;i++)s.set(i,e,s.get(i,e)+r*s.get(i,t))}v[e]=s.get(t,e)}if(l&&t<b)for(let e=t;e<n;e++)p.set(e,t,s.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<r;e++)v[t]=eE(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<r;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<n&&0!==v[t]){for(let e=t+1;e<n;e++)m[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<r;n++)m[e]+=v[n]*s.get(e,n);for(let e=t+1;e<r;e++){let r=-v[e]/v[t+1];for(let i=t+1;i<n;i++)s.set(i,e,s.get(i,e)+r*m[i])}}if(c)for(let e=t+1;e<r;e++)g.set(e,t,v[e])}}let w=Math.min(r,n+1);if(b<r&&(f[b]=s.get(b,b)),n<w&&(f[w-1]=0),x+1<w&&(v[x]=s.get(x,w-1)),v[w-1]=0,l){for(let t=b;t<h;t++){for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}for(let t=b-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<h;e++){let r=0;for(let i=t;i<n;i++)r+=p.get(i,t)*p.get(i,e);r=-r/p.get(t,t);for(let i=t;i<n;i++)p.set(i,e,p.get(i,e)+r*p.get(i,t))}for(let e=t;e<n;e++)p.set(e,t,-p.get(e,t));p.set(t,t,1+p.get(t,t));for(let e=0;e<t-1;e++)p.set(e,t,0)}else{for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}}if(c)for(let t=r-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<r;e++){let n=0;for(let i=t+1;i<r;i++)n+=g.get(i,t)*g.get(i,e);n=-n/g.get(t+1,t);for(let i=t+1;i<r;i++)g.set(i,e,g.get(i,e)+n*g.get(i,t))}for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}let k=w-1,M=Number.EPSILON;for(;w>0;){let t,e;for(t=w-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+M*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===w-2)e=4;else{let n;for(n=w-1;n>=t&&n!==t;n--){let e=(n!==w?Math.abs(v[n]):0)+(n!==t+1?Math.abs(v[n-1]):0);if(Math.abs(f[n])<=M*e){f[n]=0;break}}n===t?e=3:n===w-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=v[w-2];v[w-2]=0;for(let n=w-2;n>=t;n--){let i=eE(f[n],e),o=f[n]/i,a=e/i;if(f[n]=i,n!==t&&(e=-a*v[n-1],v[n-1]=o*v[n-1]),c)for(let t=0;t<r;t++)i=o*g.get(t,n)+a*g.get(t,w-1),g.set(t,w-1,-a*g.get(t,n)+o*g.get(t,w-1)),g.set(t,n,i)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let r=t;r<w;r++){let i=eE(f[r],e),o=f[r]/i,a=e/i;if(f[r]=i,e=-a*v[r],v[r]=o*v[r],l)for(let e=0;e<n;e++)i=o*p.get(e,r)+a*p.get(e,t-1),p.set(e,t-1,-a*p.get(e,r)+o*p.get(e,t-1)),p.set(e,r,i)}break}case 3:{const e=Math.max(Math.abs(f[w-1]),Math.abs(f[w-2]),Math.abs(v[w-2]),Math.abs(f[t]),Math.abs(v[t])),i=f[w-1]/e,o=f[w-2]/e,a=v[w-2]/e,s=f[t]/e,u=v[t]/e,h=((o+i)*(o-i)+a*a)/2,d=i*a*(i*a);let m=0;0===h&&0===d||(m=h<0?0-Math.sqrt(h*h+d):Math.sqrt(h*h+d),m=d/(h+m));let y=(s+i)*(s-i)+m,b=s*u;for(let e=t;e<w-1;e++){let i=eE(y,b);0===i&&(i=Number.MIN_VALUE);let o=y/i,a=b/i;if(e!==t&&(v[e-1]=i),y=o*f[e]+a*v[e],v[e]=o*v[e]-a*f[e],b=a*f[e+1],f[e+1]=o*f[e+1],c)for(let t=0;t<r;t++)i=o*g.get(t,e)+a*g.get(t,e+1),g.set(t,e+1,-a*g.get(t,e)+o*g.get(t,e+1)),g.set(t,e,i);if(i=eE(y,b),0===i&&(i=Number.MIN_VALUE),o=y/i,a=b/i,f[e]=i,y=o*v[e]+a*f[e+1],f[e+1]=-a*v[e]+o*f[e+1],b=a*v[e+1],v[e+1]=o*v[e+1],l&&e<n-1)for(let t=0;t<n;t++)i=o*p.get(t,e)+a*p.get(t,e+1),p.set(t,e+1,-a*p.get(t,e)+o*p.get(t,e+1)),p.set(t,e,i)}v[w-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,c))for(let e=0;e<=k;e++)g.set(e,t,-g.get(e,t));for(;t<k&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,c&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);if(l&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);t++}w--}}if(u){let t=g;g=p,p=t}this.m=n,this.n=r,this.s=f,this.U=p,this.V=g}solve(t){let e=t,n=this.threshold,r=this.s.length,i=Yx.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=n?i.set(t,t,0):i.set(t,t,1/this.s[t]);let o=this.U,a=this.rightSingularVectors,s=a.mmul(i),l=a.rows,c=o.rows,u=Yx.zeros(l,c);for(let t=0;t<l;t++)for(let e=0;e<c;e++){let n=0;for(let i=0;i<r;i++)n+=s.get(t,i)*o.get(e,i);u.set(t,e,n)}return u.mmul(e)}solveForDiagonal(t){return this.solve(Yx.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,r=t.columns,i=new Yx(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<r;n++)Math.abs(this.s[n])>e&&i.set(o,n,t.get(o,n)/this.s[n]);let o=this.U,a=o.rows,s=o.columns,l=new Yx(n,a);for(let t=0;t<n;t++)for(let e=0;e<a;e++){let n=0;for(let r=0;r<s;r++)n+=i.get(t,r)*o.get(e,r);l.set(t,e,n)}return l}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let r=0,i=n.length;r<i;r++)n[r]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Yx.diag(this.s)}};function iE(t,e,n=!1){return t=Jx.checkMatrix(t),e=Jx.checkMatrix(e),n?new rE(t).solve(e):t.isSquare()?new tE(t).solve(e):new nE(t).solve(e)}function oE(t,e){let n=[];for(let r=0;r<t;r++)r!==e&&n.push(r);return n}function aE(t,e,n,r=1e-9,i=1e-9){if(t>i)return new Array(e.rows+1).fill(0);{let t=e.addRow(n,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<r&&t.set(e,0,0);return t.to1DArray()}}class sE{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(!(t=Jx.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let r,i,o=t.columns,a=new Yx(o,o),s=new Float64Array(o),l=new Float64Array(o),c=t,u=!1;if(u=!!n||t.isSymmetric(),u){for(r=0;r<o;r++)for(i=0;i<o;i++)a.set(r,i,c.get(r,i));!function(t,e,n,r){let i,o,a,s,l,c,u,h;for(l=0;l<t;l++)n[l]=r.get(t-1,l);for(s=t-1;s>0;s--){for(h=0,a=0,c=0;c<s;c++)h+=Math.abs(n[c]);if(0===h)for(e[s]=n[s-1],l=0;l<s;l++)n[l]=r.get(s-1,l),r.set(s,l,0),r.set(l,s,0);else{for(c=0;c<s;c++)n[c]/=h,a+=n[c]*n[c];for(i=n[s-1],o=Math.sqrt(a),i>0&&(o=-o),e[s]=h*o,a-=i*o,n[s-1]=i-o,l=0;l<s;l++)e[l]=0;for(l=0;l<s;l++){for(i=n[l],r.set(l,s,i),o=e[l]+r.get(l,l)*i,c=l+1;c<=s-1;c++)o+=r.get(c,l)*n[c],e[c]+=r.get(c,l)*i;e[l]=o}for(i=0,l=0;l<s;l++)e[l]/=a,i+=e[l]*n[l];for(u=i/(a+a),l=0;l<s;l++)e[l]-=u*n[l];for(l=0;l<s;l++){for(i=n[l],o=e[l],c=l;c<=s-1;c++)r.set(c,l,r.get(c,l)-(i*e[c]+o*n[c]));n[l]=r.get(s-1,l),r.set(s,l,0)}}n[s]=a}for(s=0;s<t-1;s++){if(r.set(t-1,s,r.get(s,s)),r.set(s,s,1),a=n[s+1],0!==a){for(c=0;c<=s;c++)n[c]=r.get(c,s+1)/a;for(l=0;l<=s;l++){for(o=0,c=0;c<=s;c++)o+=r.get(c,s+1)*r.get(c,l);for(c=0;c<=s;c++)r.set(c,l,r.get(c,l)-o*n[c])}}for(c=0;c<=s;c++)r.set(c,s+1,0)}for(l=0;l<t;l++)n[l]=r.get(t-1,l),r.set(t-1,l,0);r.set(t-1,t-1,1),e[0]=0}(o,l,s,a),function(t,e,n,r){let i,o,a,s,l,c,u,h,d,f,p,g,v,m,y,b;for(a=1;a<t;a++)e[a-1]=e[a];e[t-1]=0;let x=0,E=0,w=Number.EPSILON;for(c=0;c<t;c++){for(E=Math.max(E,Math.abs(n[c])+Math.abs(e[c])),u=c;u<t&&!(Math.abs(e[u])<=w*E);)u++;if(u>c)do{for(i=n[c],h=(n[c+1]-i)/(2*e[c]),d=eE(h,1),h<0&&(d=-d),n[c]=e[c]/(h+d),n[c+1]=e[c]*(h+d),f=n[c+1],o=i-n[c],a=c+2;a<t;a++)n[a]-=o;for(x+=o,h=n[u],p=1,g=p,v=p,m=e[c+1],y=0,b=0,a=u-1;a>=c;a--)for(v=g,g=p,b=y,i=p*e[a],o=p*h,d=eE(h,e[a]),e[a+1]=y*d,y=e[a]/d,p=h/d,h=p*n[a]-y*i,n[a+1]=o+y*(p*i+y*n[a]),l=0;l<t;l++)o=r.get(l,a+1),r.set(l,a+1,y*r.get(l,a)+p*o),r.set(l,a,p*r.get(l,a)-y*o);h=-y*b*v*m*e[c]/f,e[c]=y*h,n[c]=p*h}while(Math.abs(e[c])>w*E);n[c]=n[c]+x,e[c]=0}for(a=0;a<t-1;a++){for(l=a,h=n[a],s=a+1;s<t;s++)n[s]<h&&(l=s,h=n[s]);if(l!==a)for(n[l]=n[a],n[a]=h,s=0;s<t;s++)h=r.get(s,a),r.set(s,a,r.get(s,l)),r.set(s,l,h)}}(o,l,s,a)}else{let t=new Yx(o,o),e=new Float64Array(o);for(i=0;i<o;i++)for(r=0;r<o;r++)t.set(r,i,c.get(r,i));!function(t,e,n,r){let i,o,a,s,l,c,u,h=0,d=t-1;for(c=h+1;c<=d-1;c++){for(u=0,s=c;s<=d;s++)u+=Math.abs(e.get(s,c-1));if(0!==u){for(a=0,s=d;s>=c;s--)n[s]=e.get(s,c-1)/u,a+=n[s]*n[s];for(o=Math.sqrt(a),n[c]>0&&(o=-o),a-=n[c]*o,n[c]=n[c]-o,l=c;l<t;l++){for(i=0,s=d;s>=c;s--)i+=n[s]*e.get(s,l);for(i/=a,s=c;s<=d;s++)e.set(s,l,e.get(s,l)-i*n[s])}for(s=0;s<=d;s++){for(i=0,l=d;l>=c;l--)i+=n[l]*e.get(s,l);for(i/=a,l=c;l<=d;l++)e.set(s,l,e.get(s,l)-i*n[l])}n[c]=u*n[c],e.set(c,c-1,u*o)}}for(s=0;s<t;s++)for(l=0;l<t;l++)r.set(s,l,s===l?1:0);for(c=d-1;c>=h+1;c--)if(0!==e.get(c,c-1)){for(s=c+1;s<=d;s++)n[s]=e.get(s,c-1);for(l=c;l<=d;l++){for(o=0,s=c;s<=d;s++)o+=n[s]*r.get(s,l);for(o=o/n[c]/e.get(c,c-1),s=c;s<=d;s++)r.set(s,l,r.get(s,l)+o*n[s])}}}(o,t,e,a),function(t,e,n,r,i){let o,a,s,l,c,u,h,d,f,p,g,v,m,y,b,x=t-1,E=0,w=t-1,k=Number.EPSILON,M=0,S=0,N=0,T=0,O=0,C=0,A=0,P=0;for(o=0;o<t;o++)for((o<E||o>w)&&(n[o]=i.get(o,o),e[o]=0),a=Math.max(o-1,0);a<t;a++)S+=Math.abs(i.get(o,a));for(;x>=E;){for(l=x;l>E&&(C=Math.abs(i.get(l-1,l-1))+Math.abs(i.get(l,l)),0===C&&(C=S),!(Math.abs(i.get(l,l-1))<k*C));)l--;if(l===x)i.set(x,x,i.get(x,x)+M),n[x]=i.get(x,x),e[x]=0,x--,P=0;else if(l===x-1){if(h=i.get(x,x-1)*i.get(x-1,x),N=(i.get(x-1,x-1)-i.get(x,x))/2,T=N*N+h,A=Math.sqrt(Math.abs(T)),i.set(x,x,i.get(x,x)+M),i.set(x-1,x-1,i.get(x-1,x-1)+M),d=i.get(x,x),T>=0){for(A=N>=0?N+A:N-A,n[x-1]=d+A,n[x]=n[x-1],0!==A&&(n[x]=d-h/A),e[x-1]=0,e[x]=0,d=i.get(x,x-1),C=Math.abs(d)+Math.abs(A),N=d/C,T=A/C,O=Math.sqrt(N*N+T*T),N/=O,T/=O,a=x-1;a<t;a++)A=i.get(x-1,a),i.set(x-1,a,T*A+N*i.get(x,a)),i.set(x,a,T*i.get(x,a)-N*A);for(o=0;o<=x;o++)A=i.get(o,x-1),i.set(o,x-1,T*A+N*i.get(o,x)),i.set(o,x,T*i.get(o,x)-N*A);for(o=E;o<=w;o++)A=r.get(o,x-1),r.set(o,x-1,T*A+N*r.get(o,x)),r.set(o,x,T*r.get(o,x)-N*A)}else n[x-1]=d+N,n[x]=d+N,e[x-1]=A,e[x]=-A;x-=2,P=0}else{if(d=i.get(x,x),f=0,h=0,l<x&&(f=i.get(x-1,x-1),h=i.get(x,x-1)*i.get(x-1,x)),10===P){for(M+=d,o=E;o<=x;o++)i.set(o,o,i.get(o,o)-d);C=Math.abs(i.get(x,x-1))+Math.abs(i.get(x-1,x-2)),d=f=.75*C,h=-.4375*C*C}if(30===P&&(C=(f-d)/2,C=C*C+h,C>0)){for(C=Math.sqrt(C),f<d&&(C=-C),C=d-h/((f-d)/2+C),o=E;o<=x;o++)i.set(o,o,i.get(o,o)-C);M+=C,d=f=h=.964}for(P+=1,c=x-2;c>=l&&(A=i.get(c,c),O=d-A,C=f-A,N=(O*C-h)/i.get(c+1,c)+i.get(c,c+1),T=i.get(c+1,c+1)-A-O-C,O=i.get(c+2,c+1),C=Math.abs(N)+Math.abs(T)+Math.abs(O),N/=C,T/=C,O/=C,c!==l)&&!(Math.abs(i.get(c,c-1))*(Math.abs(T)+Math.abs(O))<k*(Math.abs(N)*(Math.abs(i.get(c-1,c-1))+Math.abs(A)+Math.abs(i.get(c+1,c+1)))));)c--;for(o=c+2;o<=x;o++)i.set(o,o-2,0),o>c+2&&i.set(o,o-3,0);for(s=c;s<=x-1&&(y=s!==x-1,s!==c&&(N=i.get(s,s-1),T=i.get(s+1,s-1),O=y?i.get(s+2,s-1):0,d=Math.abs(N)+Math.abs(T)+Math.abs(O),0!==d&&(N/=d,T/=d,O/=d)),0!==d);s++)if(C=Math.sqrt(N*N+T*T+O*O),N<0&&(C=-C),0!==C){for(s!==c?i.set(s,s-1,-C*d):l!==c&&i.set(s,s-1,-i.get(s,s-1)),N+=C,d=N/C,f=T/C,A=O/C,T/=N,O/=N,a=s;a<t;a++)N=i.get(s,a)+T*i.get(s+1,a),y&&(N+=O*i.get(s+2,a),i.set(s+2,a,i.get(s+2,a)-N*A)),i.set(s,a,i.get(s,a)-N*d),i.set(s+1,a,i.get(s+1,a)-N*f);for(o=0;o<=Math.min(x,s+3);o++)N=d*i.get(o,s)+f*i.get(o,s+1),y&&(N+=A*i.get(o,s+2),i.set(o,s+2,i.get(o,s+2)-N*O)),i.set(o,s,i.get(o,s)-N),i.set(o,s+1,i.get(o,s+1)-N*T);for(o=E;o<=w;o++)N=d*r.get(o,s)+f*r.get(o,s+1),y&&(N+=A*r.get(o,s+2),r.set(o,s+2,r.get(o,s+2)-N*O)),r.set(o,s,r.get(o,s)-N),r.set(o,s+1,r.get(o,s+1)-N*T)}}}if(0===S)return;for(x=t-1;x>=0;x--)if(N=n[x],T=e[x],0===T)for(l=x,i.set(x,x,1),o=x-1;o>=0;o--){for(h=i.get(o,o)-N,O=0,a=l;a<=x;a++)O+=i.get(o,a)*i.get(a,x);if(e[o]<0)A=h,C=O;else if(l=o,0===e[o]?i.set(o,x,0!==h?-O/h:-O/(k*S)):(d=i.get(o,o+1),f=i.get(o+1,o),T=(n[o]-N)*(n[o]-N)+e[o]*e[o],u=(d*C-A*O)/T,i.set(o,x,u),i.set(o+1,x,Math.abs(d)>Math.abs(A)?(-O-h*u)/d:(-C-f*u)/A)),u=Math.abs(i.get(o,x)),k*u*u>1)for(a=o;a<=x;a++)i.set(a,x,i.get(a,x)/u)}else if(T<0)for(l=x-1,Math.abs(i.get(x,x-1))>Math.abs(i.get(x-1,x))?(i.set(x-1,x-1,T/i.get(x,x-1)),i.set(x-1,x,-(i.get(x,x)-N)/i.get(x,x-1))):(b=lE(0,-i.get(x-1,x),i.get(x-1,x-1)-N,T),i.set(x-1,x-1,b[0]),i.set(x-1,x,b[1])),i.set(x,x-1,0),i.set(x,x,1),o=x-2;o>=0;o--){for(p=0,g=0,a=l;a<=x;a++)p+=i.get(o,a)*i.get(a,x-1),g+=i.get(o,a)*i.get(a,x);if(h=i.get(o,o)-N,e[o]<0)A=h,O=p,C=g;else if(l=o,0===e[o]?(b=lE(-p,-g,h,T),i.set(o,x-1,b[0]),i.set(o,x,b[1])):(d=i.get(o,o+1),f=i.get(o+1,o),v=(n[o]-N)*(n[o]-N)+e[o]*e[o]-T*T,m=2*(n[o]-N)*T,0===v&&0===m&&(v=k*S*(Math.abs(h)+Math.abs(T)+Math.abs(d)+Math.abs(f)+Math.abs(A))),b=lE(d*O-A*p+T*g,d*C-A*g-T*p,v,m),i.set(o,x-1,b[0]),i.set(o,x,b[1]),Math.abs(d)>Math.abs(A)+Math.abs(T)?(i.set(o+1,x-1,(-p-h*i.get(o,x-1)+T*i.get(o,x))/d),i.set(o+1,x,(-g-h*i.get(o,x)-T*i.get(o,x-1))/d)):(b=lE(-O-f*i.get(o,x-1),-C-f*i.get(o,x),A,T),i.set(o+1,x-1,b[0]),i.set(o+1,x,b[1]))),u=Math.max(Math.abs(i.get(o,x-1)),Math.abs(i.get(o,x))),k*u*u>1)for(a=o;a<=x;a++)i.set(a,x-1,i.get(a,x-1)/u),i.set(a,x,i.get(a,x)/u)}for(o=0;o<t;o++)if(o<E||o>w)for(a=o;a<t;a++)r.set(o,a,i.get(o,a));for(a=t-1;a>=E;a--)for(o=E;o<=w;o++){for(A=0,s=E;s<=Math.min(a,w);s++)A+=r.get(o,s)*i.get(s,a);r.set(o,a,A)}}(o,l,s,a,t)}this.n=o,this.e=l,this.d=s,this.V=a}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,n=this.n,r=this.e,i=this.d,o=new Yx(n,n);for(t=0;t<n;t++){for(e=0;e<n;e++)o.set(t,e,0);o.set(t,t,i[t]),r[t]>0?o.set(t,t+1,r[t]):r[t]<0&&o.set(t,t-1,r[t])}return o}}function lE(t,e,n,r){let i,o;return Math.abs(n)>Math.abs(r)?(i=r/n,o=n+i*r,[(t+i*e)/o,(e-i*t)/o]):(i=n/r,o=r+i*n,[(i*t+e)/o,(i*e-t)/o])}class cE{constructor(t){if(!(t=Jx.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,n,r,i=t,o=i.rows,a=new Yx(o,o),s=!0;for(n=0;n<o;n++){let t=0;for(r=0;r<n;r++){let o=0;for(e=0;e<r;e++)o+=a.get(r,e)*a.get(n,e);o=(i.get(n,r)-o)/a.get(r,r),a.set(n,r,o),t+=o*o}for(t=i.get(n,n)-t,s&&=t>0,a.set(n,n,Math.sqrt(Math.max(t,0))),r=n+1;r<o;r++)a.set(n,r,0)}this.L=a,this.positiveDefinite=s}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=Jx.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let r,i,o,a=t.columns,s=t.clone();for(o=0;o<n;o++)for(i=0;i<a;i++){for(r=0;r<o;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(o,r));s.set(o,i,s.get(o,i)/e.get(o,o))}for(o=n-1;o>=0;o--)for(i=0;i<a;i++){for(r=o+1;r<n;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(r,o));s.set(o,i,s.get(o,i)/e.get(o,o))}return s}get lowerTriangularMatrix(){return this.L}}class uE{constructor(t,e={}){t=Jx.checkMatrix(t);let{Y:n}=e;const{scaleScores:r=!1,maxIterations:i=1e3,terminationCriteria:o=1e-10}=e;let a;if(n){if(n=Tx.isAnyArray(n)&&"number"==typeof n[0]?Yx.columnVector(n):Jx.checkMatrix(n),n.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=n.getColumnVector(0)}else a=t.getColumnVector(0);let s,l,c,u,h=1;for(let e=0;e<i&&h>o;e++)c=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),c=c.div(c.norm()),s=t.mmul(c).div(c.transpose().mmul(c).get(0,0)),e>0&&(h=s.clone().sub(u).pow(2).sum()),u=s.clone(),n?(l=n.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),l=l.div(l.norm()),a=n.mmul(l).div(l.transpose().mmul(l).get(0,0))):a=s;if(n){let e=t.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0));e=e.div(e.norm());let r=t.clone().sub(s.clone().mmul(e.transpose())),i=a.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),o=n.clone().sub(s.clone().mulS(i.get(0,0)).mmul(l.transpose()));this.t=s,this.p=e.transpose(),this.w=c.transpose(),this.q=l,this.u=a,this.s=s.transpose().mmul(s),this.xResidual=r,this.yResidual=o,this.betas=i}else this.w=c.transpose(),this.s=s.transpose().mmul(s).sqrt(),this.t=r?s.clone().div(this.s.get(0,0)):s,this.xResidual=t.sub(s.mmul(c.transpose()))}}Ex.AbstractMatrix=Hx,Ex.CHO=cE,Ex.CholeskyDecomposition=cE,Ex.DistanceMatrix=Xx,Ex.EVD=sE,Ex.EigenvalueDecomposition=sE,Ex.LU=tE,Ex.LuDecomposition=tE;var hE=Ex.Matrix=Yx;Ex.MatrixColumnSelectionView=class extends Kx{constructor(t,e){Fx(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,n){return this.matrix.set(t,this.columnIndices[e],n),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},Ex.MatrixColumnView=class extends Kx{constructor(t,e){_x(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}},Ex.MatrixFlipColumnView=class extends Kx{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},Ex.MatrixFlipRowView=class extends Kx{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},Ex.MatrixRowSelectionView=class extends Kx{constructor(t,e){Bx(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,n){return this.matrix.set(this.rowIndices[t],e,n),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},Ex.MatrixRowView=class extends Kx{constructor(t,e){Lx(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}},Ex.MatrixSelectionView=Zx,Ex.MatrixSubView=class extends Kx{constructor(t,e,n,r,i){zx(t,e,n,r,i),super(t,n-e+1,i-r+1),this.startRow=e,this.startColumn=r}set(t,e,n){return this.matrix.set(this.startRow+t,this.startColumn+e,n),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},Ex.MatrixTransposeView=class extends Kx{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}},Ex.NIPALS=uE,Ex.Nipals=uE,Ex.QR=nE,Ex.QrDecomposition=nE,Ex.SVD=rE;var dE=Ex.SingularValueDecomposition=rE;Ex.SymmetricMatrix=qx,Ex.WrapperMatrix1D=Qx,Ex.WrapperMatrix2D=Jx,Ex.correlation=function(t,e=t,n={}){t=new Yx(t);let r=!1;if("object"!=typeof e||Yx.isMatrix(e)||Tx.isAnyArray(e)?e=new Yx(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:o=!0}=n;i&&(t.center("column"),r||e.center("column")),o&&(t.scale("column"),r||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),s=r?a:e.standardDeviation("column",{unbiased:!0}),l=t.transpose().mmul(e);for(let e=0;e<l.rows;e++)for(let n=0;n<l.columns;n++)l.set(e,n,l.get(e,n)*(1/(a[e]*s[n]))*(1/(t.rows-1)));return l},Ex.covariance=function(t,e=t,n={}){t=new Yx(t);let r=!1;if("object"!=typeof e||Yx.isMatrix(e)||Tx.isAnyArray(e)?e=new Yx(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=n;i&&(t=t.center("column"),r||(e=e.center("column")));const o=t.transpose().mmul(e);for(let e=0;e<o.rows;e++)for(let n=0;n<o.columns;n++)o.set(e,n,o.get(e,n)*(1/(t.rows-1)));return o};var fE=Ex.default=Yx;Ex.determinant=function t(e){if((e=Yx.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let n,r,i,o;if(2===e.columns)return n=e.get(0,0),r=e.get(0,1),i=e.get(1,0),o=e.get(1,1),n*o-r*i;if(3===e.columns){let o,a,s;return o=new Zx(e,[1,2],[1,2]),a=new Zx(e,[1,2],[0,2]),s=new Zx(e,[1,2],[0,1]),n=e.get(0,0),r=e.get(0,1),i=e.get(0,2),n*t(o)-r*t(a)+i*t(s)}return new tE(e).determinant}throw Error("determinant can only be calculated for a square matrix")},Ex.inverse=function(t,e=!1){return t=Jx.checkMatrix(t),e?new rE(t).inverse():iE(t,Yx.eye(t.rows))},Ex.linearDependencies=function(t,e={}){const{thresholdValue:n=1e-9,thresholdError:r=1e-9}=e;let i=(t=Yx.checkMatrix(t)).rows,o=new Yx(i,i);for(let e=0;e<i;e++){let a=Yx.columnVector(t.getRow(e)),s=t.subMatrixRow(oE(i,e)).transpose(),l=new rE(s).solve(a),c=Yx.sub(a,s.mmul(l)).abs().max();o.setRow(e,aE(c,l,e,n,r))}return o},Ex.pseudoInverse=function(t,e=Number.EPSILON){if((t=Yx.checkMatrix(t)).isEmpty())return t.transpose();let n=new rE(t,{autoTranspose:!0}),r=n.leftSingularVectors,i=n.rightSingularVectors,o=n.diagonal;for(let t=0;t<o.length;t++)Math.abs(o[t])>e?o[t]=1/o[t]:o[t]=0;return i.mmul(Yx.diag(o).mmul(r.transpose()))},Ex.solve=iE,Ex.wrap=function(t,e){if(Tx.isAnyArray(t))return t[0]&&Tx.isAnyArray(t[0])?new Jx(t):new Qx(t,e);throw new Error("the argument is not an array")};const pE=hE,gE=dE;fE.Matrix&&fE.Matrix;const vE={center:[0,0],linkDistance:50};class mE{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},vE),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i=[0,0],linkDistance:o=50}=r,a=e.getAllNodes(),s=e.getAllEdges();if(!(null==a?void 0:a.length)||1===a.length)return zb(e,t,i);const l=Ob({nodes:a,edges:s}),c=Tb(l);yE(c);const u=((t,e)=>{const n=[];return t.forEach(t=>{const r=[];t.forEach(t=>{r.push(t*e)}),n.push(r)}),n})(c,o),h=bE(u),d=[];h.forEach((t,e)=>{const n=Rb(a[e]);n.data.x=t[0]+i[0],n.data.y=t[1]+i[1],d.push(n)}),t&&d.forEach(t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}));return{nodes:d,edges:s}})}}const yE=t=>{let e=-999999;t.forEach(t=>{t.forEach(t=>{t!==1/0&&e<t&&(e=t)})}),t.forEach((n,r)=>{n.forEach((n,i)=>{n===1/0&&(t[r][i]=e)})})},bE=t=>{const e=pE.mul(pE.pow(t,2),-.5),n=e.mean("row"),r=e.mean("column"),i=e.mean();e.add(i).subRowVector(n).subColumnVector(r);const o=new gE(e),a=pE.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(t=>pE.mul([t],[a]).toJSON()[0].splice(0,2))};function xE(t){return!!t.tick&&!!t.stop}const EE={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},wE={center:[0,0],comboPadding:10,treeKey:"combo"};class kE{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},wE),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:i,treeKey:o,outerLayout:a}=r,s=e.getAllNodes().filter(t=>!t.data._isCombo),l=e.getAllNodes().filter(t=>t.data._isCombo),c=e.getAllEdges(),u=null==s?void 0:s.length;if(!u||1===u)return zb(e,t,i);const h=[],d=new Map;s.forEach(t=>{d.set(t.id,t)});const f=new Map;l.forEach(t=>{f.set(t.id,t)});const p=new Map,g=this.getInnerGraphs(e,o,d,f,c,r,p);yield Promise.all(g);const v=new Map,m=[],y=new Map;let b=!0;e.getRoots(o).forEach(t=>{const n=p.get(t.id),r=f.get(t.id)||d.get(t.id),i={id:t.id,data:Object.assign(Object.assign({},t.data),{x:n.data.x||r.data.x,y:n.data.y||r.data.y,fx:n.data.fx||r.data.fx,fy:n.data.fy||r.data.fy,mass:n.data.mass||r.data.mass,size:n.data.size})};m.push(i),v.set(t.id,!0),isNaN(i.data.x)||0===i.data.x||isNaN(i.data.y)||0===i.data.y?(i.data.x=100*Math.random(),i.data.y=100*Math.random()):b=!1,Ab(e,[t],e=>{e.id!==t.id&&y.set(e.id,t.id)},"TB",o)});const x=[];let E;if(c.forEach(t=>{const e=y.get(t.source)||t.source,n=y.get(t.target)||t.target;e!==n&&v.has(e)&&v.has(n)&&x.push({id:t.id,source:e,target:n,data:{}})}),null==m?void 0:m.length){if(1===m.length)m[0].data.x=i[0],m[0].data.y=i[1];else{const t=new pv({nodes:m,edges:x}),e=a||new gx;if(b&&EE[e.id]){const e=m.length<100?new mE:new $b;yield e.assign(t)}const n=Object.assign({center:i,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,n)=>(Math.max(...e.data.size)||32)/2+(Math.max(...n.data.size)||32)/2+200}:{});E=yield ME(e,t,n)}p.forEach(t=>{var e;const n=E.nodes.find(e=>e.id===t.id);if(n){const{x:e,y:r}=n.data;t.data.visited=!0,t.data.x=e,t.data.y=r,h.push({id:t.id,data:{x:e,y:r}})}const{x:r,y:i}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach(t=>{h.push({id:t.id,data:{x:t.data.x+r,y:t.data.y+i}})})}),p.forEach(({data:t})=>{const{x:e,y:n,visited:r,nodes:i}=t;null==i||i.forEach(t=>{if(!r){const r=h.find(e=>e.id===t.id);r.data.x+=e||0,r.data.y+=n||0}})})}t&&h.forEach(t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})});return{nodes:h,edges:c}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:r,comboPadding:i}=t;let o,a,s;if(a=ae(r)?()=>r:Ut(r)?r:()=>0,e.spacing=a,n)if(Ut(n))o=t=>{const e=n(t),r=a(t);if(Nb(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+r)/2}return((e||32)+r)/2};else if(Nb(n)){const t=(n[0]>n[1]?n[0]:n[1])/2;o=e=>t+a(e)/2}else{const t=n/2;o=e=>t+a(e)/2}else o=t=>{const e=a(t);if(t.size){if(Nb(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2}if(qt(t.size)){return((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2}return(t.size+e)/2}return 32+e/2};return e.nodeSize=o,s=ae(i)?()=>i:Nb(i)?()=>Math.max.apply(null,i):Ut(i)?i:()=>0,e.comboPadding=s,e}getInnerGraphs(t,e,n,r,i,o,a){const{nodeSize:s,comboPadding:l,spacing:c,innerLayout:u}=o,h=u||new $b({}),d={center:[0,0],preventOverlap:!0,nodeSpacing:c},f=[],p=t=>{let e=(null==l?void 0:l(t))||10;return Nb(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(e).forEach(o=>{a.set(o.id,{id:o.id,data:{nodes:[],size:p(o).size}});let l=Promise.resolve();Ab(t,[o],o=>{var c;if(!o.data._isCombo)return;const{size:u,padding:f}=p(o);if(null===(c=t.getChildren(o.id,e))||void 0===c?void 0:c.length){const c=a.get(o.id);a.set(o.id,{id:o.id,data:Object.assign({nodes:[]},null==c?void 0:c.data)});const u=new Map,p=t.getChildren(o.id,e).map(t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),u.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||r.get(t.id);return u.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}}),g={nodes:p,edges:i.filter(t=>u.has(t.source)&&u.has(t.target))};let v=1/0;p.forEach(t=>{var e;let{size:n}=t.data;n||(n=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==s?void 0:s(t))||[30,30]),ae(n)&&(n=[n,n]);const[r,i]=n;v>r&&(v=r),v>i&&(v=i),t.data.size=n}),l=l.then(()=>Ge(this,void 0,void 0,function*(){const t=new pv(g);yield ME(h,t,d,!0);const{minX:e,minY:n,maxX:r,maxY:i}=(t=>{let e=1/0,n=1/0,r=-1/0,i=-1/0;return t.forEach(t=>{let o=t.data.size;Nb(o)?1===o.length&&(o=[o[0],o[0]]):ae(o)?o=[o,o]:(void 0===o||isNaN(o))&&(o=[30,30]);const a=[o[0]/2,o[1]/2],s=t.data.x-a[0],l=t.data.x+a[0],c=t.data.y-a[1],u=t.data.y+a[1];e>s&&(e=s),n>c&&(n=c),r<l&&(r=l),i<u&&(i=u)}),{minX:e,minY:n,maxX:r,maxY:i}})(p),s=(r+e)/2,l=(i+n)/2;g.nodes.forEach(t=>{t.data.x-=s,t.data.y-=l});const c=[Math.max(r-e,v)+2*f,Math.max(i-n,v)+2*f];a.get(o.id).data.size=c,a.get(o.id).data.nodes=p}))}else a.set(o.id,{id:o.id,data:Object.assign(Object.assign({},o.data),{size:u})});return!0},"BT",e),f.push(l)}),f}}function ME(t,e,n,r){var i;return Ge(this,void 0,void 0,function*(){return xE(t)?(t.execute(e,n),t.stop(),t.tick(null!==(i=n.iterations)&&void 0!==i?i:300)):r?yield t.assign(e,n):yield t.execute(e,n)})}function SE(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,l=0;for(i=0;i<a;++i)s+=(o=n[i]).x,l+=o.y;for(s=(s/a-t)*r,l=(l/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=s,o.y-=l}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function NE(t){return function(){return t}}function TE(t){return 1e-6*(t()-.5)}function OE(t){return t.x+t.vx}function CE(t){return t.y+t.vy}function AE(t){var e,n,r,i=1,o=1;function a(){for(var t,a,l,c,u,h,d,f=e.length,p=0;p<o;++p)for(a=Zb(e,OE,CE).visitAfter(s),t=0;t<f;++t)l=e[t],h=n[l.index],d=h*h,c=l.x+l.vx,u=l.y+l.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,f=t.r,p=h+f;if(!s)return e>c+p||o<c-p||n>u+p||a<u-p;if(s.index>l.index){var g=c-s.x-s.vx,v=u-s.y-s.vy,m=g*g+v*v;m<p*p&&(0===g&&(m+=(g=TE(r))*g),0===v&&(m+=(v=TE(r))*v),m=(p-(m=Math.sqrt(m)))/m*i,l.vx+=(g*=m)*(p=(f*=f)/(d+f)),l.vy+=(v*=m)*p,s.vx-=g*(p=1-p),s.vy-=v*p)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function l(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=NE(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,l()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:NE(+e),l(),a):t},a}function PE(t){return t.index}function RE(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function DE(t){var e,n,r,i,o,a,s=PE,l=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=NE(30),u=1;function h(r){for(var i=0,s=t.length;i<u;++i)for(var l,c,h,d,f,p,g,v=0;v<s;++v)c=(l=t[v]).source,d=(h=l.target).x+h.vx-c.x-c.vx||TE(a),f=h.y+h.vy-c.y-c.vy||TE(a),d*=p=((p=Math.sqrt(d*d+f*f))-n[v])/p*r*e[v],f*=p,h.vx-=d*(g=o[v]),h.vy-=f*g,c.vx+=d*(g=1-g),c.vy+=f*g}function d(){if(r){var a,l,c=r.length,u=t.length,h=new Map(r.map((t,e)=>[s(t,e,r),t]));for(a=0,i=new Array(c);a<u;++a)(l=t[a]).index=a,"object"!=typeof l.source&&(l.source=RE(h,l.source)),"object"!=typeof l.target&&(l.target=RE(h,l.target)),i[l.source.index]=(i[l.source.index]||0)+1,i[l.target.index]=(i[l.target.index]||0)+1;for(a=0,o=new Array(u);a<u;++a)l=t[a],o[a]=i[l.source.index]/(i[l.source.index]+i[l.target.index]);e=new Array(u),f(),n=new Array(u),p()}}function f(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+l(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,e){r=t,a=e,d()},h.links=function(e){return arguments.length?(t=e,d(),h):t},h.id=function(t){return arguments.length?(s=t,h):s},h.iterations=function(t){return arguments.length?(u=+t,h):u},h.strength=function(t){return arguments.length?(l="function"==typeof t?t:NE(+t),f(),h):l},h.distance=function(t){return arguments.length?(c="function"==typeof t?t:NE(+t),p(),h):c},h}var LE={value:()=>{}};function _E(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new IE(r)}function IE(t){this._=t}function jE(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function BE(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=LE,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}IE.prototype=_E.prototype={constructor:IE,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=BE(i[n],t.name,e);else if(null==e)for(n in i)i[n]=BE(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=jE(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new IE(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var FE,zE,GE=0,VE=0,WE=0,HE=0,UE=0,$E=0,YE="object"==typeof performance&&performance.now?performance:Date,qE="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function XE(){return UE||(qE(KE),UE=YE.now()+$E)}function KE(){UE=0}function ZE(){this._call=this._time=this._next=null}function QE(t,e,n){var r=new ZE;return r.restart(t,e,n),r}function JE(){UE=(HE=YE.now())+$E,GE=VE=0;try{!function(){XE(),++GE;for(var t,e=FE;e;)(t=UE-e._time)>=0&&e._call.call(void 0,t),e=e._next;--GE}()}finally{GE=0,function(){var t,e,n=FE,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:FE=e);zE=t,ew(r)}(),UE=0}}function tw(){var t=YE.now(),e=t-HE;e>1e3&&($E-=e,HE=t)}function ew(t){GE||(VE&&(VE=clearTimeout(VE)),t-UE>24?(t<1/0&&(VE=setTimeout(JE,t-YE.now()-$E)),WE&&(WE=clearInterval(WE))):(WE||(HE=YE.now(),WE=setInterval(tw,1e3)),GE=1,qE(JE)))}ZE.prototype=QE.prototype={constructor:ZE,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?XE():+n)+(null==e?0:+e),this._next||zE===this||(zE?zE._next=this:FE=this,zE=this),this._call=t,this._time=n,ew()},stop:function(){this._call&&(this._call=null,this._time=1/0,ew())}};const nw=4294967296;function rw(t){return t.x}function iw(t){return t.y}var ow=Math.PI*(3-Math.sqrt(5));function aw(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,l=QE(h),c=_E("tick","end"),u=function(){let t=1;return()=>(t=(1664525*t+1013904223)%nw)/nw}();function h(){d(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function d(r){var l,c,u=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(n+=(o-n)*i,s.forEach(function(t){t(n)}),l=0;l<u;++l)null==(c=t[l]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function f(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*ow;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,u),e}return null==t&&(t=[]),f(),e={tick:d,restart:function(){return l.restart(h),e},stop:function(){return l.stop(),e},nodes:function(n){return arguments.length?(t=n,f(),s.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(u=t,s.forEach(p),e):u},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,l,c=0,u=t.length;for(null==r?r=1/0:r*=r,c=0;c<u;++c)(a=(i=e-(s=t[c]).x)*i+(o=n-s.y)*o)<r&&(l=s,r=a);return l},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function sw(){var t,e,n,r,i,o=NE(-30),a=1,s=1/0,l=.81;function c(n){var i,o=t.length,a=Zb(t,rw,iw).visitAfter(h);for(r=n,i=0;i<o;++i)e=t[i],a.visit(d)}function u(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function h(t){var e,n,r,o,a,s=0,l=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,l+=n,r+=n*e.x,o+=n*e.y);t.x=r/l,t.y=o/l}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function d(t,o,c,u){if(!t.value)return!0;var h=t.x-e.x,d=t.y-e.y,f=u-o,p=h*h+d*d;if(f*f/l<p)return p<s&&(0===h&&(p+=(h=TE(n))*h),0===d&&(p+=(d=TE(n))*d),p<a&&(p=Math.sqrt(a*p)),e.vx+=h*t.value*r/p,e.vy+=d*t.value*r/p),!0;if(!(t.length||p>=s)){(t.data!==e||t.next)&&(0===h&&(p+=(h=TE(n))*h),0===d&&(p+=(d=TE(n))*d),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(f=i[t.data.index]*r/p,e.vx+=h*f,e.vy+=d*f)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,u()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:NE(+t),u(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.theta=function(t){return arguments.length?(l=t*t,c):Math.sqrt(l)},c}function lw(t,e,n){var r,i,o,a=NE(.1);function s(t){for(var a=0,s=r.length;a<s;++a){var l=r[a],c=l.x-e||1e-6,u=l.y-n||1e-6,h=Math.sqrt(c*c+u*u),d=(o[a]-h)*i[a]*t/h;l.vx+=c*d,l.vy+=u*d}}function l(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)o[e]=+t(r[e],e,r),i[e]=isNaN(o[e])?0:+a(r[e],e,r)}}return"function"!=typeof t&&(t=NE(+t)),null==e&&(e=0),null==n&&(n=0),s.initialize=function(t){r=t,l()},s.strength=function(t){return arguments.length?(a="function"==typeof t?t:NE(+t),l(),s):a},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:NE(+e),l(),s):t},s.x=function(t){return arguments.length?(e=+t,s):e},s.y=function(t){return arguments.length?(n=+t,s):n},s}function cw(t){var e,n,r,i=NE(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=NE(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:NE(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:NE(+e),a(),o):t},o}function uw(t){var e,n,r,i=NE(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=NE(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:NE(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:NE(+e),a(),o):t},o}class hw{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:DE,manyBody:sw,center:SE,collide:AE,radial:lw,x:cw,y:uw},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},Me(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find(e=>e.id===t);n&&e.forEach((t,e)=>{if("number"==typeof t||null===t){n[["fx","fy","fz"][e]]=t}})}getOptions(t){var e,n;const r=Me({},this.options,t);return r.collide&&void 0===(null===(e=r.collide)||void 0===e?void 0:e.radius)&&(r.collide=r.collide||{},r.collide.radius=null!==(n=r.nodeSize)&&void 0!==n?n:10),void 0===r.iterations&&(r.link&&void 0===r.link.iterations&&(r.iterations=r.link.iterations),r.collide&&void 0===r.collide.iterations&&(r.iterations=r.collide.iterations)),this.context.options=r,r}genericLayout(t,e,n){var r;return Ge(this,void 0,void 0,function*(){const i=this.getOptions(n),o=e.getAllNodes().map(({id:t,data:e})=>Object.assign(Object.assign({id:t},e),Pe(e.data,this.config.inputNodeAttrs))),a=e.getAllEdges().map(t=>Object.assign({},t));Object.assign(this.context,{assign:t,nodes:o,edges:a,graph:e});const s=new Promise(t=>{this.resolver=t}),l=this.setSimulation(i);return l.nodes(o),null===(r=l.force("link"))||void 0===r||r.links(a),s})}getResult(){const{assign:t,nodes:e,edges:n,graph:r}=this.context,i=e.map(t=>({id:t.id,data:Object.assign(Object.assign({},t.data),Pe(t,this.config.outputNodeAttrs))})),o=n.map(({id:t,source:e,target:n,data:r})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof n?n.id:n,data:r}));return t&&i.forEach(t=>r.mergeNodeData(t.id,t.data)),{nodes:i,edges:o}}initSimulation(){return aw()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())}).on("end",()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())})),dw(e,this.config.simulationAttrs.map(e=>[e,t[e]])),Object.entries(this.forceMap).forEach(([n,r])=>{const i=n;if(t[n]){let n=e.force(i);n||(n=r(),e.force(i,n)),dw(n,Object.entries(t[i]))}else e.force(i,null)}),e}}const dw=(t,e)=>e.reduce((e,[n,r])=>e[n]&&void 0!==r?e[n].call(t,r):e,t);var fw,pw,gw,vw,mw,yw,bw,xw,Ew,ww,kw,Mw,Sw,Nw,Tw,Ow,Cw,Aw,Pw,Rw,Dw,Lw,_w,Iw,jw,Bw,Fw,zw,Gw,Vw,Ww,Hw,Uw,$w,Yw,qw,Xw,Kw,Zw,Qw,Jw,tk,ek,nk,rk,ik,ok,ak,sk,lk,ck,uk,hk,dk,fk,pk,gk,vk,mk,yk,bk,xk,Ek,wk,kk,Mk,Sk,Nk,Tk,Ok,Ck,Ak,Pk,Rk,Dk,Lk,_k,Ik,jk,Bk,Fk,zk,Gk,Vk,Wk,Hk,Uk,$k,Yk,qk,Xk,Kk,Zk,Qk,Jk,tM,eM,nM,rM,iM,oM,aM,sM,lM,cM,uM,hM,dM;function fM(){if(vw)return gw;return vw=1,gw=function(t,e){return t===e||t!=t&&e!=e}}function pM(){if(yw)return mw;yw=1;var t=fM();return mw=function(e,n){for(var r=e.length;r--;)if(t(e[r][0],n))return r;return-1},mw}function gM(){if(Ow)return Tw;Ow=1;var t=pw?fw:(pw=1,fw=function(){this.__data__=[],this.size=0}),e=function(){if(xw)return bw;xw=1;var t=pM(),e=Array.prototype.splice;return bw=function(n){var r=this.__data__,i=t(r,n);return!(i<0||(i==r.length-1?r.pop():e.call(r,i,1),--this.size,0))},bw}(),n=function(){if(ww)return Ew;ww=1;var t=pM();return Ew=function(e){var n=this.__data__,r=t(n,e);return r<0?void 0:n[r][1]},Ew}(),r=function(){if(Mw)return kw;Mw=1;var t=pM();return kw=function(e){return t(this.__data__,e)>-1}}(),i=function(){if(Nw)return Sw;Nw=1;var t=pM();return Sw=function(e,n){var r=this.__data__,i=t(r,e);return i<0?(++this.size,r.push([e,n])):r[i][1]=n,this},Sw}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Tw=o}function vM(){if(Bw)return jw;Bw=1;var t="object"==typeof x&&x&&x.Object===Object&&x;return jw=t}function mM(){if(zw)return Fw;zw=1;var t=vM(),e="object"==typeof self&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return Fw=n}function yM(){if(Vw)return Gw;Vw=1;var t=mM().Symbol;return Gw=t}function bM(){if(qw)return Yw;qw=1;var t=yM(),e=function(){if(Hw)return Ww;Hw=1;var t=yM(),e=Object.prototype,n=e.hasOwnProperty,r=e.toString,i=t?t.toStringTag:void 0;return Ww=function(t){var e=n.call(t,i),o=t[i];try{t[i]=void 0;var a=!0}catch(t){}var s=r.call(t);return a&&(e?t[i]=o:delete t[i]),s}}(),n=function(){if($w)return Uw;$w=1;var t=Object.prototype.toString;return Uw=function(e){return t.call(e)}}(),r=t?t.toStringTag:void 0;return Yw=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":r&&r in Object(t)?e(t):n(t)}}function xM(){if(Kw)return Xw;return Kw=1,Xw=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function EM(){if(Qw)return Zw;Qw=1;var t=bM(),e=xM();return Zw=function(n){if(!e(n))return!1;var r=t(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function wM(){if(nk)return ek;nk=1;var t,e=function(){if(tk)return Jw;tk=1;var t=mM()["__core-js_shared__"];return Jw=t}(),n=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return ek=function(t){return!!n&&n in t}}function kM(){if(ik)return rk;ik=1;var t=Function.prototype.toString;return rk=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function MM(){if(uk)return ck;uk=1;var t=function(){if(ak)return ok;ak=1;var t=EM(),e=wM(),n=xM(),r=kM(),i=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,s=o.toString,l=a.hasOwnProperty,c=RegExp("^"+s.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return ok=function(o){return!(!n(o)||e(o))&&(t(o)?c:i).test(r(o))}}(),e=lk?sk:(lk=1,sk=function(t,e){return null==t?void 0:t[e]});return ck=function(n,r){var i=e(n,r);return t(i)?i:void 0}}function SM(){if(dk)return hk;dk=1;var t=MM()(mM(),"Map");return hk=t}function NM(){if(pk)return fk;pk=1;var t=MM()(Object,"create");return fk=t}function TM(){if(Nk)return Sk;Nk=1;var t=function(){if(vk)return gk;vk=1;var t=NM();return gk=function(){this.__data__=t?t(null):{},this.size=0}}(),e=yk?mk:(yk=1,mk=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}),n=function(){if(xk)return bk;xk=1;var t=NM(),e=Object.prototype.hasOwnProperty;return bk=function(n){var r=this.__data__;if(t){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return e.call(r,n)?r[n]:void 0},bk}(),r=function(){if(wk)return Ek;wk=1;var t=NM(),e=Object.prototype.hasOwnProperty;return Ek=function(n){var r=this.__data__;return t?void 0!==r[n]:e.call(r,n)},Ek}(),i=function(){if(Mk)return kk;Mk=1;var t=NM();return kk=function(e,n){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=t&&void 0===n?"__lodash_hash_undefined__":n,this},kk}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Sk=o}function OM(){if(Rk)return Pk;Rk=1;var t=Ak?Ck:(Ak=1,Ck=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t});return Pk=function(e,n){var r=e.__data__;return t(n)?r["string"==typeof n?"string":"hash"]:r.map},Pk}function CM(){if(Vk)return Gk;Vk=1;var t=function(){if(Ok)return Tk;Ok=1;var t=TM(),e=gM(),n=SM();return Tk=function(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}}(),e=function(){if(Lk)return Dk;Lk=1;var t=OM();return Dk=function(e){var n=t(this,e).delete(e);return this.size-=n?1:0,n}}(),n=function(){if(Ik)return _k;Ik=1;var t=OM();return _k=function(e){return t(this,e).get(e)}}(),r=function(){if(Bk)return jk;Bk=1;var t=OM();return jk=function(e){return t(this,e).has(e)}}(),i=function(){if(zk)return Fk;zk=1;var t=OM();return Fk=function(e,n){var r=t(this,e),i=r.size;return r.set(e,n),this.size+=r.size==i?0:1,this},Fk}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Gk=o}function AM(){if($k)return Uk;$k=1;var t=gM(),e=function(){if(Aw)return Cw;Aw=1;var t=gM();return Cw=function(){this.__data__=new t,this.size=0}}(),n=(Rw||(Rw=1,Pw=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}),Pw),r=Lw?Dw:(Lw=1,Dw=function(t){return this.__data__.get(t)}),i=Iw?_w:(Iw=1,_w=function(t){return this.__data__.has(t)}),o=function(){if(Hk)return Wk;Hk=1;var t=gM(),e=SM(),n=CM();return Wk=function(r,i){var o=this.__data__;if(o instanceof t){var a=o.__data__;if(!e||a.length<199)return a.push([r,i]),this.size=++o.size,this;o=this.__data__=new n(a)}return o.set(r,i),this.size=o.size,this},Wk}();function a(e){var n=this.__data__=new t(e);this.size=n.size}return a.prototype.clear=e,a.prototype.delete=n,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,Uk=a}function PM(){if(qk)return Yk;return qk=1,Yk=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t},Yk}function RM(){if(Kk)return Xk;Kk=1;var t=MM(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return Xk=e}function DM(){if(Qk)return Zk;Qk=1;var t=RM();return Zk=function(e,n,r){"__proto__"==n&&t?t(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r}}function LM(){if(tM)return Jk;tM=1;var t=DM(),e=fM(),n=Object.prototype.hasOwnProperty;return Jk=function(r,i,o){var a=r[i];n.call(r,i)&&e(a,o)&&(void 0!==o||i in r)||t(r,i,o)}}function _M(){if(nM)return eM;nM=1;var t=LM(),e=DM();return eM=function(n,r,i,o){var a=!i;i||(i={});for(var s=-1,l=r.length;++s<l;){var c=r[s],u=o?o(i[c],n[c],c,i,n):void 0;void 0===u&&(u=n[c]),a?e(i,c,u):t(i,c,u)}return i},eM}function IM(){if(aM)return oM;return aM=1,oM=function(t){return null!=t&&"object"==typeof t}}function jM(){if(uM)return cM;uM=1;var t=function(){if(lM)return sM;lM=1;var t=bM(),e=IM();return sM=function(n){return e(n)&&"[object Arguments]"==t(n)}}(),e=IM(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,o=t(function(){return arguments}())?t:function(t){return e(t)&&r.call(t,"callee")&&!i.call(t,"callee")};return cM=o}function BM(){if(dM)return hM;dM=1;var t=Array.isArray;return hM=t}var FM,zM,GM,VM,WM,HM,UM,$M,YM,qM,XM,KM={exports:{}};function ZM(){return GM||(GM=1,function(t,e){var n=mM(),r=zM?FM:(zM=1,FM=function(){return!1}),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;t.exports=s}(KM,KM.exports)),KM.exports}function QM(){if(WM)return VM;WM=1;var t=/^(?:0|[1-9]\d*)$/;return VM=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n},VM}function JM(){if(UM)return HM;UM=1;return HM=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function tS(){if(XM)return qM;return XM=1,qM=function(t){return function(e){return t(e)}}}var eS,nS,rS,iS,oS,aS,sS,lS,cS,uS,hS,dS,fS,pS,gS,vS,mS,yS,bS,xS,ES,wS,kS,MS,SS,NS,TS,OS={exports:{}};function CS(){return eS||(eS=1,function(t,e){var n=vM(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r&&n.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a}(OS,OS.exports)),OS.exports}function AS(){if(rS)return nS;rS=1;var t=function(){if(YM)return $M;YM=1;var t=bM(),e=JM(),n=IM(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,$M=function(i){return n(i)&&e(i.length)&&!!r[t(i)]}}(),e=tS(),n=CS(),r=n&&n.isTypedArray,i=r?e(r):t;return nS=i}function PS(){if(oS)return iS;oS=1;var t=(iM||(iM=1,rM=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}),rM),e=jM(),n=BM(),r=ZM(),i=QM(),o=AS(),a=Object.prototype.hasOwnProperty;return iS=function(s,l){var c=n(s),u=!c&&e(s),h=!c&&!u&&r(s),d=!c&&!u&&!h&&o(s),f=c||u||h||d,p=f?t(s.length,String):[],g=p.length;for(var v in s)!l&&!a.call(s,v)||f&&("length"==v||h&&("offset"==v||"parent"==v)||d&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||i(v,g))||p.push(v);return p},iS}function RS(){if(sS)return aS;sS=1;var t=Object.prototype;return aS=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}}function DS(){if(cS)return lS;return cS=1,lS=function(t,e){return function(n){return t(e(n))}}}function LS(){if(fS)return dS;fS=1;var t=RS(),e=function(){if(hS)return uS;hS=1;var t=DS()(Object.keys,Object);return uS=t}(),n=Object.prototype.hasOwnProperty;return dS=function(r){if(!t(r))return e(r);var i=[];for(var o in Object(r))n.call(r,o)&&"constructor"!=o&&i.push(o);return i}}function _S(){if(gS)return pS;gS=1;var t=EM(),e=JM();return pS=function(n){return null!=n&&e(n.length)&&!t(n)}}function IS(){if(mS)return vS;mS=1;var t=PS(),e=LS(),n=_S();return vS=function(r){return n(r)?t(r):e(r)}}function jS(){if(kS)return wS;kS=1;var t=xM(),e=RS(),n=ES?xS:(ES=1,xS=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}),r=Object.prototype.hasOwnProperty;return wS=function(i){if(!t(i))return n(i);var o=e(i),a=[];for(var s in i)("constructor"!=s||!o&&r.call(i,s))&&a.push(s);return a}}function BS(){if(SS)return MS;SS=1;var t=PS(),e=jS(),n=_S();return MS=function(r){return n(r)?t(r,!0):e(r)}}var FS,zS,GS,VS,WS,HS,US,$S,YS,qS,XS,KS,ZS,QS,JS,tN,eN,nN,rN,iN,oN,aN,sN,lN,cN,uN,hN,dN,fN,pN,gN,vN,mN,yN,bN,xN,EN,wN,kN,MN,SN,NN,TN,ON,CN,AN,PN,RN,DN,LN,_N,IN,jN,BN,FN,zN,GN,VN,WN,HN,UN,$N,YN,qN,XN,KN,ZN,QN,JN,tT,eT,nT,rT,iT,oT,aT,sT,lT,cT,uT,hT,dT,fT,pT,gT,vT,mT,yT,bT,xT,ET,wT,kT,MT,ST,NT,TT,OT,CT,AT,PT,RT,DT,LT,_T,IT,jT,BT,FT,zT,GT,VT,WT,HT,UT,$T,YT,qT,XT,KT,ZT,QT,JT,tO,eO,nO,rO,iO,oO,aO,sO,lO,cO,uO,hO,dO,fO,pO,gO,vO,mO,yO,bO,xO,EO,wO,kO,MO,SO,NO,TO,OO,CO,AO,PO,RO,DO,LO,_O,IO,jO,BO,FO,zO,GO,VO,WO,HO,UO,$O,YO,qO,XO,KO,ZO,QO,JO,tC,eC,nC,rC,iC,oC,aC,sC,lC,cC,uC,hC,dC,fC,pC,gC,vC,mC,yC,bC,xC,EC,wC,kC,MC,SC,NC,TC,OC,CC,AC,PC,RC,DC,LC,_C,IC,jC,BC,FC,zC,GC,VC,WC,HC,UC,$C,YC,qC,XC,KC,ZC,QC,JC,tA,eA,nA,rA,iA,oA,aA,sA,lA,cA,uA,hA,dA,fA,pA,gA,vA,mA,yA,bA,xA,EA,wA,kA,MA,SA,NA,TA,OA,CA,AA,PA,RA,DA,LA,_A,IA,jA,BA,FA,zA,GA,VA,WA,HA,UA,$A,YA,qA,XA={exports:{}};function KA(){return FS||(FS=1,function(t,e){var n=mM(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r?n.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}}(XA,XA.exports)),XA.exports}function ZA(){if(GS)return zS;return GS=1,zS=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},zS}function QA(){if(WS)return VS;return WS=1,VS=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o},VS}function JA(){if(US)return HS;return US=1,HS=function(){return[]}}function tP(){if(YS)return $S;YS=1;var t=QA(),e=JA(),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return $S=r?function(e){return null==e?[]:(e=Object(e),t(r(e),function(t){return n.call(e,t)}))}:e}function eP(){if(ZS)return KS;return ZS=1,KS=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t},KS}function nP(){if(JS)return QS;JS=1;var t=DS()(Object.getPrototypeOf,Object);return QS=t}function rP(){if(eN)return tN;eN=1;var t=eP(),e=nP(),n=tP(),r=JA(),i=Object.getOwnPropertySymbols;return tN=i?function(r){for(var i=[];r;)t(i,n(r)),r=e(r);return i}:r}function iP(){if(oN)return iN;oN=1;var t=eP(),e=BM();return iN=function(n,r,i){var o=r(n);return e(n)?o:t(o,i(n))}}function oP(){if(sN)return aN;sN=1;var t=iP(),e=tP(),n=IS();return aN=function(r){return t(r,n,e)}}function aP(){if(gN)return pN;gN=1;var t=MM()(mM(),"Set");return pN=t}function sP(){if(bN)return yN;bN=1;var t=function(){if(hN)return uN;hN=1;var t=MM()(mM(),"DataView");return uN=t}(),e=SM(),n=function(){if(fN)return dN;fN=1;var t=MM()(mM(),"Promise");return dN=t}(),r=aP(),i=function(){if(mN)return vN;mN=1;var t=MM()(mM(),"WeakMap");return vN=t}(),o=bM(),a=kM(),s="[object Map]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",h="[object DataView]",d=a(t),f=a(e),p=a(n),g=a(r),v=a(i),m=o;return(t&&m(new t(new ArrayBuffer(1)))!=h||e&&m(new e)!=s||n&&m(n.resolve())!=l||r&&m(new r)!=c||i&&m(new i)!=u)&&(m=function(t){var e=o(t),n="[object Object]"==e?t.constructor:void 0,r=n?a(n):"";if(r)switch(r){case d:return h;case f:return s;case p:return l;case g:return c;case v:return u}return e}),yN=m}function lP(){if(kN)return wN;kN=1;var t=mM().Uint8Array;return wN=t}function cP(){if(SN)return MN;SN=1;var t=lP();return MN=function(e){var n=new e.constructor(e.byteLength);return new t(n).set(new t(e)),n}}function uP(){if(DN)return RN;DN=1;var t=cP();return RN=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}}function hP(){if(_N)return LN;_N=1;var t=cP(),e=function(){if(TN)return NN;TN=1;var t=cP();return NN=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}}(),n=function(){if(CN)return ON;CN=1;var t=/\w*$/;return ON=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}}(),r=function(){if(PN)return AN;PN=1;var t=yM(),e=t?t.prototype:void 0,n=e?e.valueOf:void 0;return AN=function(t){return n?Object(n.call(t)):{}}}(),i=uP();return LN=function(o,a,s){var l=o.constructor;switch(a){case"[object ArrayBuffer]":return t(o);case"[object Boolean]":case"[object Date]":return new l(+o);case"[object DataView]":return e(o,s);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return i(o,s);case"[object Map]":case"[object Set]":return new l;case"[object Number]":case"[object String]":return new l(o);case"[object RegExp]":return n(o);case"[object Symbol]":return r(o)}}}function dP(){if(jN)return IN;jN=1;var t=xM(),e=Object.create,n=function(){function n(){}return function(r){if(!t(r))return{};if(e)return e(r);n.prototype=r;var i=new n;return n.prototype=void 0,i}}();return IN=n}function fP(){if(FN)return BN;FN=1;var t=dP(),e=nP(),n=RS();return BN=function(r){return"function"!=typeof r.constructor||n(r)?{}:t(e(r))}}function pP(){if(WN)return VN;WN=1;var t=function(){if(GN)return zN;GN=1;var t=sP(),e=IM();return zN=function(n){return e(n)&&"[object Map]"==t(n)}}(),e=tS(),n=CS(),r=n&&n.isMap,i=r?e(r):t;return VN=i}function gP(){if(YN)return $N;YN=1;var t=function(){if(UN)return HN;UN=1;var t=sP(),e=IM();return HN=function(n){return e(n)&&"[object Set]"==t(n)}}(),e=tS(),n=CS(),r=n&&n.isSet,i=r?e(r):t;return $N=i}function vP(){if(XN)return qN;XN=1;var t=AM(),e=PM(),n=LM(),r=function(){if(bS)return yS;bS=1;var t=_M(),e=IS();return yS=function(n,r){return n&&t(r,e(r),n)}}(),i=function(){if(TS)return NS;TS=1;var t=_M(),e=BS();return NS=function(n,r){return n&&t(r,e(r),n)}}(),o=KA(),a=ZA(),s=function(){if(XS)return qS;XS=1;var t=_M(),e=tP();return qS=function(n,r){return t(n,e(n),r)}}(),l=function(){if(rN)return nN;rN=1;var t=_M(),e=rP();return nN=function(n,r){return t(n,e(n),r)}}(),c=oP(),u=function(){if(cN)return lN;cN=1;var t=iP(),e=rP(),n=BS();return lN=function(r){return t(r,n,e)}}(),h=sP(),d=function(){if(EN)return xN;EN=1;var t=Object.prototype.hasOwnProperty;return xN=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r},xN}(),f=hP(),p=fP(),g=BM(),v=ZM(),m=pP(),y=xM(),b=gP(),x=IS(),E=BS(),w="[object Arguments]",k="[object Function]",M="[object Object]",S={};return S[w]=S["[object Array]"]=S["[object ArrayBuffer]"]=S["[object DataView]"]=S["[object Boolean]"]=S["[object Date]"]=S["[object Float32Array]"]=S["[object Float64Array]"]=S["[object Int8Array]"]=S["[object Int16Array]"]=S["[object Int32Array]"]=S["[object Map]"]=S["[object Number]"]=S[M]=S["[object RegExp]"]=S["[object Set]"]=S["[object String]"]=S["[object Symbol]"]=S["[object Uint8Array]"]=S["[object Uint8ClampedArray]"]=S["[object Uint16Array]"]=S["[object Uint32Array]"]=!0,S["[object Error]"]=S[k]=S["[object WeakMap]"]=!1,qN=function N(T,O,C,A,P,R){var D,L=1&O,_=2&O,I=4&O;if(C&&(D=P?C(T,A,P,R):C(T)),void 0!==D)return D;if(!y(T))return T;var j=g(T);if(j){if(D=d(T),!L)return a(T,D)}else{var B=h(T),F=B==k||"[object GeneratorFunction]"==B;if(v(T))return o(T,L);if(B==M||B==w||F&&!P){if(D=_||F?{}:p(T),!L)return _?l(T,i(D,T)):s(T,r(D,T))}else{if(!S[B])return P?T:{};D=f(T,B,L)}}R||(R=new t);var z=R.get(T);if(z)return z;R.set(T,D),b(T)?T.forEach(function(t){D.add(N(t,O,C,t,T,R))}):m(T)&&T.forEach(function(t,e){D.set(e,N(t,O,C,e,T,R))});var G=j?void 0:(I?_?u:c:_?E:x)(T);return e(G||T,function(t,e){G&&(t=T[e=t]),n(D,e,N(t,O,C,e,T,R))}),D},qN}function mP(){if(ZN)return KN;ZN=1;var t=vP();return KN=function(e){return t(e,4)}}function yP(){if(JN)return QN;return JN=1,QN=function(t){return function(){return t}}}function bP(){if(rT)return nT;rT=1;var t=(eT||(eT=1,tT=function(t){return function(e,n,r){for(var i=-1,o=Object(e),a=r(e),s=a.length;s--;){var l=a[t?s:++i];if(!1===n(o[l],l,o))break}return e}}),tT),e=t();return nT=e}function xP(){if(oT)return iT;oT=1;var t=bP(),e=IS();return iT=function(n,r){return n&&t(n,r,e)}}function EP(){if(cT)return lT;cT=1;var t=xP(),e=function(){if(sT)return aT;sT=1;var t=_S();return aT=function(e,n){return function(r,i){if(null==r)return r;if(!t(r))return e(r,i);for(var o=r.length,a=n?o:-1,s=Object(r);(n?a--:++a<o)&&!1!==i(s[a],a,s););return r}},aT}(),n=e(t);return lT=n}function wP(){if(hT)return uT;return hT=1,uT=function(t){return t}}function kP(){if(fT)return dT;fT=1;var t=wP();return dT=function(e){return"function"==typeof e?e:t}}function MP(){if(gT)return pT;gT=1;var t=PM(),e=EP(),n=kP(),r=BM();return pT=function(i,o){return(r(i)?t:e)(i,n(o))}}function SP(){return mT?vT:(mT=1,vT=MP())}function NP(){if(ST)return MT;ST=1;var t=CM(),e=ET?xT:(ET=1,xT=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}),n=kT?wT:(kT=1,wT=function(t){return this.__data__.has(t)});function r(e){var n=-1,r=null==e?0:e.length;for(this.__data__=new t;++n<r;)this.add(e[n])}return r.prototype.add=r.prototype.push=e,r.prototype.has=n,MT=r}function TP(){if(CT)return OT;return CT=1,OT=function(t,e){return t.has(e)}}function OP(){if(PT)return AT;PT=1;var t=NP(),e=(TT||(TT=1,NT=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}),NT),n=TP();return AT=function(r,i,o,a,s,l){var c=1&o,u=r.length,h=i.length;if(u!=h&&!(c&&h>u))return!1;var d=l.get(r),f=l.get(i);if(d&&f)return d==i&&f==r;var p=-1,g=!0,v=2&o?new t:void 0;for(l.set(r,i),l.set(i,r);++p<u;){var m=r[p],y=i[p];if(a)var b=c?a(y,m,p,i,r,l):a(m,y,p,r,i,l);if(void 0!==b){if(b)continue;g=!1;break}if(v){if(!e(i,function(t,e){if(!n(v,e)&&(m===t||s(m,t,o,a,l)))return v.push(e)})){g=!1;break}}else if(m!==y&&!s(m,y,o,a,l)){g=!1;break}}return l.delete(r),l.delete(i),g},AT}function CP(){if(_T)return LT;return _T=1,LT=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n},LT}function AP(){if(jT)return IT;jT=1;var t=yM(),e=lP(),n=fM(),r=OP(),i=(DT||(DT=1,RT=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}),RT),o=CP(),a=t?t.prototype:void 0,s=a?a.valueOf:void 0;return IT=function(t,a,l,c,u,h,d){switch(l){case"[object DataView]":if(t.byteLength!=a.byteLength||t.byteOffset!=a.byteOffset)return!1;t=t.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=a.byteLength||!h(new e(t),new e(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+t,+a);case"[object Error]":return t.name==a.name&&t.message==a.message;case"[object RegExp]":case"[object String]":return t==a+"";case"[object Map]":var f=i;case"[object Set]":var p=1&c;if(f||(f=o),t.size!=a.size&&!p)return!1;var g=d.get(t);if(g)return g==a;c|=2,d.set(t,a);var v=r(f(t),f(a),c,u,h,d);return d.delete(t),v;case"[object Symbol]":if(s)return s.call(t)==s.call(a)}return!1}}function PP(){if(GT)return zT;GT=1;var t=AM(),e=OP(),n=AP(),r=function(){if(FT)return BT;FT=1;var t=oP(),e=Object.prototype.hasOwnProperty;return BT=function(n,r,i,o,a,s){var l=1&i,c=t(n),u=c.length;if(u!=t(r).length&&!l)return!1;for(var h=u;h--;){var d=c[h];if(!(l?d in r:e.call(r,d)))return!1}var f=s.get(n),p=s.get(r);if(f&&p)return f==r&&p==n;var g=!0;s.set(n,r),s.set(r,n);for(var v=l;++h<u;){var m=n[d=c[h]],y=r[d];if(o)var b=l?o(y,m,d,r,n,s):o(m,y,d,n,r,s);if(!(void 0===b?m===y||a(m,y,i,o,s):b)){g=!1;break}v||(v="constructor"==d)}if(g&&!v){var x=n.constructor,E=r.constructor;x==E||!("constructor"in n)||!("constructor"in r)||"function"==typeof x&&x instanceof x&&"function"==typeof E&&E instanceof E||(g=!1)}return s.delete(n),s.delete(r),g},BT}(),i=sP(),o=BM(),a=ZM(),s=AS(),l="[object Arguments]",c="[object Array]",u="[object Object]",h=Object.prototype.hasOwnProperty;return zT=function(d,f,p,g,v,m){var y=o(d),b=o(f),x=y?c:i(d),E=b?c:i(f),w=(x=x==l?u:x)==u,k=(E=E==l?u:E)==u,M=x==E;if(M&&a(d)){if(!a(f))return!1;y=!0,w=!1}if(M&&!w)return m||(m=new t),y||s(d)?e(d,f,p,g,v,m):n(d,f,x,p,g,v,m);if(!(1&p)){var S=w&&h.call(d,"__wrapped__"),N=k&&h.call(f,"__wrapped__");if(S||N){var T=S?d.value():d,O=N?f.value():f;return m||(m=new t),v(T,O,p,g,m)}}return!!M&&(m||(m=new t),r(d,f,p,g,v,m))}}function RP(){if(WT)return VT;WT=1;var t=PP(),e=IM();return VT=function n(r,i,o,a,s){return r===i||(null==r||null==i||!e(r)&&!e(i)?r!=r&&i!=i:t(r,i,o,a,n,s))},VT}function DP(){if(YT)return $T;YT=1;var t=xM();return $T=function(e){return e==e&&!t(e)}}function LP(){if(ZT)return KT;return ZT=1,KT=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}}function _P(){if(JT)return QT;JT=1;var t=function(){if(UT)return HT;UT=1;var t=AM(),e=RP();return HT=function(n,r,i,o){var a=i.length,s=a,l=!o;if(null==n)return!s;for(n=Object(n);a--;){var c=i[a];if(l&&c[2]?c[1]!==n[c[0]]:!(c[0]in n))return!1}for(;++a<s;){var u=(c=i[a])[0],h=n[u],d=c[1];if(l&&c[2]){if(void 0===h&&!(u in n))return!1}else{var f=new t;if(o)var p=o(h,d,u,n,r,f);if(!(void 0===p?e(d,h,3,o,f):p))return!1}}return!0},HT}(),e=function(){if(XT)return qT;XT=1;var t=DP(),e=IS();return qT=function(n){for(var r=e(n),i=r.length;i--;){var o=r[i],a=n[o];r[i]=[o,a,t(a)]}return r},qT}(),n=LP();return QT=function(r){var i=e(r);return 1==i.length&&i[0][2]?n(i[0][0],i[0][1]):function(e){return e===r||t(e,r,i)}}}function IP(){if(eO)return tO;eO=1;var t=bM(),e=IM();return tO=function(n){return"symbol"==typeof n||e(n)&&"[object Symbol]"==t(n)}}function jP(){if(rO)return nO;rO=1;var t=BM(),e=IP(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return nO=function(i,o){if(t(i))return!1;var a=typeof i;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=i&&!e(i))||(r.test(i)||!n.test(i)||null!=o&&i in Object(o))}}function BP(){if(sO)return aO;sO=1;var t=function(){if(oO)return iO;oO=1;var t=CM();function e(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var i=function(){var t=arguments,e=r?r.apply(this,t):t[0],o=i.cache;if(o.has(e))return o.get(e);var a=n.apply(this,t);return i.cache=o.set(e,a)||o,a};return i.cache=new(e.Cache||t),i}return e.Cache=t,iO=e}();return aO=function(e){var n=t(e,function(t){return 500===r.size&&r.clear(),t}),r=n.cache;return n}}function FP(){if(hO)return uO;return hO=1,uO=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i},uO}function zP(){if(gO)return pO;gO=1;var t=function(){if(fO)return dO;fO=1;var t=yM(),e=FP(),n=BM(),r=IP(),i=t?t.prototype:void 0,o=i?i.toString:void 0;return dO=function t(i){if("string"==typeof i)return i;if(n(i))return e(i,t)+"";if(r(i))return o?o.call(i):"";var a=i+"";return"0"==a&&1/i==-1/0?"-0":a},dO}();return pO=function(e){return null==e?"":t(e)}}function GP(){if(mO)return vO;mO=1;var t=BM(),e=jP(),n=function(){if(cO)return lO;cO=1;var t=BP(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=t(function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(e,function(t,e,i,o){r.push(i?o.replace(n,"$1"):e||t)}),r});return lO=r}(),r=zP();return vO=function(i,o){return t(i)?i:e(i,o)?[i]:n(r(i))}}function VP(){if(bO)return yO;bO=1;var t=IP();return yO=function(e){if("string"==typeof e||t(e))return e;var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}}function WP(){if(EO)return xO;EO=1;var t=GP(),e=VP();return xO=function(n,r){for(var i=0,o=(r=t(r,n)).length;null!=n&&i<o;)n=n[e(r[i++])];return i&&i==o?n:void 0},xO}function HP(){if(TO)return NO;TO=1;var t=GP(),e=jM(),n=BM(),r=QM(),i=JM(),o=VP();return NO=function(a,s,l){for(var c=-1,u=(s=t(s,a)).length,h=!1;++c<u;){var d=o(s[c]);if(!(h=null!=a&&l(a,d)))break;a=a[d]}return h||++c!=u?h:!!(u=null==a?0:a.length)&&i(u)&&r(d,u)&&(n(a)||e(a))},NO}function UP(){if(CO)return OO;CO=1;var t=SO?MO:(SO=1,MO=function(t,e){return null!=t&&e in Object(t)}),e=HP();return OO=function(n,r){return null!=n&&e(n,r,t)}}function $P(){if(PO)return AO;PO=1;var t=RP(),e=function(){if(kO)return wO;kO=1;var t=WP();return wO=function(e,n,r){var i=null==e?void 0:t(e,n);return void 0===i?r:i}}(),n=UP(),r=jP(),i=DP(),o=LP(),a=VP();return AO=function(s,l){return r(s)&&i(l)?o(a(s),l):function(r){var i=e(r,s);return void 0===i&&i===l?n(r,s):t(l,i,3)}}}function YP(){if(DO)return RO;return DO=1,RO=function(t){return function(e){return null==e?void 0:e[t]}}}function qP(){if(jO)return IO;jO=1;var t=YP(),e=function(){if(_O)return LO;_O=1;var t=WP();return LO=function(e){return function(n){return t(n,e)}}}(),n=jP(),r=VP();return IO=function(i){return n(i)?t(r(i)):e(i)}}function XP(){if(FO)return BO;FO=1;var t=_P(),e=$P(),n=wP(),r=BM(),i=qP();return BO=function(o){return"function"==typeof o?o:null==o?n:"object"==typeof o?r(o)?e(o[0],o[1]):t(o):i(o)}}function KP(){if(GO)return zO;GO=1;var t=QA(),e=function(){if(bT)return yT;bT=1;var t=EP();return yT=function(e,n){var r=[];return t(e,function(t,e,i){n(t,e,i)&&r.push(t)}),r},yT}(),n=XP(),r=BM();return zO=function(i,o){return(r(i)?t:e)(i,n(o,3))}}function ZP(){if(UO)return HO;UO=1;var t=function(){if(WO)return VO;WO=1;var t=Object.prototype.hasOwnProperty;return VO=function(e,n){return null!=e&&t.call(e,n)}}(),e=HP();return HO=function(n,r){return null!=n&&e(n,r,t)}}function QP(){if(YO)return $O;YO=1;var t=LS(),e=sP(),n=jM(),r=BM(),i=_S(),o=ZM(),a=RS(),s=AS(),l=Object.prototype.hasOwnProperty;return $O=function(c){if(null==c)return!0;if(i(c)&&(r(c)||"string"==typeof c||"function"==typeof c.splice||o(c)||s(c)||n(c)))return!c.length;var u=e(c);if("[object Map]"==u||"[object Set]"==u)return!c.size;if(a(c))return!t(c).length;for(var h in c)if(l.call(c,h))return!1;return!0}}function JP(){if(XO)return qO;return XO=1,qO=function(t){return void 0===t}}function tR(){if(ZO)return KO;ZO=1;var t=EP(),e=_S();return KO=function(n,r){var i=-1,o=e(n)?Array(n.length):[];return t(n,function(t,e,n){o[++i]=r(t,e,n)}),o},KO}function eR(){if(JO)return QO;JO=1;var t=FP(),e=XP(),n=tR(),r=BM();return QO=function(i,o){return(r(i)?t:n)(i,e(o,3))}}function nR(){if(oC)return iC;oC=1;var t=(eC||(eC=1,tC=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}),tC),e=EP(),n=XP(),r=(rC||(rC=1,nC=function(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}),nC),i=BM();return iC=function(o,a,s){var l=i(o)?t:r,c=arguments.length<3;return l(o,n(a,4),s,c,e)},iC}function rR(){if(gC)return pC;gC=1;var t=function(){if(cC)return lC;cC=1;var t=YP()("length");return lC=t}(),e=function(){if(hC)return uC;hC=1;var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return uC=function(e){return t.test(e)}}(),n=function(){if(fC)return dC;fC=1;var t="\\ud800-\\udfff",e="["+t+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",s="(?:"+n+"|"+r+")?",l="[\\ufe0e\\ufe0f]?",c=l+s+"(?:\\u200d(?:"+[i,o,a].join("|")+")"+l+s+")*",u="(?:"+[i+n+"?",n,o,a,e].join("|")+")",h=RegExp(r+"(?="+r+")|"+u+c,"g");return dC=function(t){for(var e=h.lastIndex=0;h.test(t);)++e;return e}}();return pC=function(r){return e(r)?n(r):t(r)}}function iR(){if(mC)return vC;mC=1;var t=LS(),e=sP(),n=_S(),r=function(){if(sC)return aC;sC=1;var t=bM(),e=BM(),n=IM();return aC=function(r){return"string"==typeof r||!e(r)&&n(r)&&"[object String]"==t(r)}}(),i=rR();return vC=function(o){if(null==o)return 0;if(n(o))return r(o)?i(o):o.length;var a=e(o);return"[object Map]"==a||"[object Set]"==a?o.size:t(o).length}}function oR(){if(bC)return yC;bC=1;var t=PM(),e=dP(),n=xP(),r=XP(),i=nP(),o=BM(),a=ZM(),s=EM(),l=xM(),c=AS();return yC=function(u,h,d){var f=o(u),p=f||a(u)||c(u);if(h=r(h,4),null==d){var g=u&&u.constructor;d=p?f?new g:[]:l(u)&&s(g)?e(i(u)):{}}return(p?t:n)(u,function(t,e,n){return h(d,t,e,n)}),d},yC}function aR(){if(kC)return wC;kC=1;var t=eP(),e=function(){if(EC)return xC;EC=1;var t=yM(),e=jM(),n=BM(),r=t?t.isConcatSpreadable:void 0;return xC=function(t){return n(t)||e(t)||!!(r&&t&&t[r])}}();return wC=function n(r,i,o,a,s){var l=-1,c=r.length;for(o||(o=e),s||(s=[]);++l<c;){var u=r[l];i>0&&o(u)?i>1?n(u,i-1,o,a,s):t(s,u):a||(s[s.length]=u)}return s},wC}function sR(){if(TC)return NC;TC=1;var t=SC?MC:(SC=1,MC=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}),e=Math.max;return NC=function(n,r,i){return r=e(void 0===r?n.length-1:r,0),function(){for(var o=arguments,a=-1,s=e(o.length-r,0),l=Array(s);++a<s;)l[a]=o[r+a];a=-1;for(var c=Array(r+1);++a<r;)c[a]=o[a];return c[r]=i(l),t(n,this,c)}},NC}function lR(){if(DC)return RC;DC=1;var t=function(){if(CC)return OC;CC=1;var t=yP(),e=RM(),n=wP();return OC=e?function(n,r){return e(n,"toString",{configurable:!0,enumerable:!1,value:t(r),writable:!0})}:n}(),e=function(){if(PC)return AC;PC=1;var t=Date.now;return AC=function(e){var n=0,r=0;return function(){var i=t(),o=16-(i-r);if(r=i,o>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}},AC}(),n=e(t);return RC=n}function cR(){if(_C)return LC;_C=1;var t=wP(),e=sR(),n=lR();return LC=function(r,i){return n(e(r,i,t),r+"")}}function uR(){if(jC)return IC;return jC=1,IC=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1},IC}function hR(){if(WC)return VC;WC=1;var t=uR(),e=FC?BC:(FC=1,BC=function(t){return t!=t}),n=(GC||(GC=1,zC=function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}),zC);return VC=function(r,i,o){return i==i?n(r,i,o):t(r,e,o)}}function dR(){if(ZC)return KC;ZC=1;var t=aP(),e=XC?qC:(XC=1,qC=function(){}),n=CP(),r=t&&1/n(new t([,-0]))[1]==1/0?function(e){return new t(e)}:e;return KC=r}function fR(){if(JC)return QC;JC=1;var t=NP(),e=function(){if(UC)return HC;UC=1;var t=hR();return HC=function(e,n){return!(null==e||!e.length)&&t(e,n,0)>-1}}(),n=(YC||(YC=1,$C=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}),$C),r=TP(),i=dR(),o=CP();return QC=function(a,s,l){var c=-1,u=e,h=a.length,d=!0,f=[],p=f;if(l)d=!1,u=n;else if(h>=200){var g=s?null:i(a);if(g)return o(g);d=!1,u=r,p=new t}else p=s?[]:f;t:for(;++c<h;){var v=a[c],m=s?s(v):v;if(v=l||0!==v?v:0,d&&m==m){for(var y=p.length;y--;)if(p[y]===m)continue t;s&&p.push(m),f.push(v)}else u(p,m,l)||(p!==f&&p.push(m),f.push(v))}return f},QC}function pR(){if(eA)return tA;eA=1;var t=_S(),e=IM();return tA=function(n){return e(n)&&t(n)}}function gR(){if(rA)return nA;rA=1;var t=aR(),e=cR(),n=fR(),r=pR(),i=e(function(e){return n(t(e,1,r,!0))});return nA=i}function vR(){if(sA)return aA;sA=1;var t=function(){if(oA)return iA;oA=1;var t=FP();return iA=function(e,n){return t(n,function(t){return e[t]})}}(),e=IS();return aA=function(n){return null==n?[]:t(n,e(n))}}function mR(){if(cA)return lA;var t;cA=1;try{t={clone:mP(),constant:yP(),each:SP(),filter:KP(),has:ZP(),isArray:BM(),isEmpty:QP(),isFunction:EM(),isUndefined:JP(),keys:IS(),map:eR(),reduce:nR(),size:iR(),transform:oR(),union:gR(),values:vR()}}catch(t){}return t||(t=window._),lA=t}function yR(){if(hA)return uA;hA=1;var t=mR();uA=n;var e="\0";function n(n){this._isDirected=!t.has(n,"directed")||n.directed,this._isMultigraph=!!t.has(n,"multigraph")&&n.multigraph,this._isCompound=!!t.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function r(t,e){t[e]?t[e]++:t[e]=1}function i(t,e){--t[e]||delete t[e]}function o(e,n,r,i){var o=""+n,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}return o+""+a+""+(t.isUndefined(i)?"\0":i)}function a(t,e){return o(t,e.v,e.w,e.name)}return n.prototype._nodeCount=0,n.prototype._edgeCount=0,n.prototype.isDirected=function(){return this._isDirected},n.prototype.isMultigraph=function(){return this._isMultigraph},n.prototype.isCompound=function(){return this._isCompound},n.prototype.setGraph=function(t){return this._label=t,this},n.prototype.graph=function(){return this._label},n.prototype.setDefaultNodeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultNodeLabelFn=e,this},n.prototype.nodeCount=function(){return this._nodeCount},n.prototype.nodes=function(){return t.keys(this._nodes)},n.prototype.sources=function(){var e=this;return t.filter(this.nodes(),function(n){return t.isEmpty(e._in[n])})},n.prototype.sinks=function(){var e=this;return t.filter(this.nodes(),function(n){return t.isEmpty(e._out[n])})},n.prototype.setNodes=function(e,n){var r=arguments,i=this;return t.each(e,function(t){r.length>1?i.setNode(t,n):i.setNode(t)}),this},n.prototype.setNode=function(n,r){return t.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=e,this._children[n]={},this._children[e][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},n.prototype.node=function(t){return this._nodes[t]},n.prototype.hasNode=function(e){return t.has(this._nodes,e)},n.prototype.removeNode=function(e){var n=this;if(t.has(this._nodes,e)){var r=function(t){n.removeEdge(n._edgeObjs[t])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],t.each(this.children(e),function(t){n.setParent(t)}),delete this._children[e]),t.each(t.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],t.each(t.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},n.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(r))r=e;else{for(var i=r+="";!t.isUndefined(i);i=this.parent(i))if(i===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},n.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},n.prototype.parent=function(t){if(this._isCompound){var n=this._parent[t];if(n!==e)return n}},n.prototype.children=function(n){if(t.isUndefined(n)&&(n=e),this._isCompound){var r=this._children[n];if(r)return t.keys(r)}else{if(n===e)return this.nodes();if(this.hasNode(n))return[]}},n.prototype.predecessors=function(e){var n=this._preds[e];if(n)return t.keys(n)},n.prototype.successors=function(e){var n=this._sucs[e];if(n)return t.keys(n)},n.prototype.neighbors=function(e){var n=this.predecessors(e);if(n)return t.union(n,this.successors(e))},n.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},n.prototype.filterNodes=function(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;t.each(this._nodes,function(t,r){e(r)&&n.setNode(r,t)}),t.each(this._edgeObjs,function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,r.edge(t))});var i={};function o(t){var e=r.parent(t);return void 0===e||n.hasNode(e)?(i[t]=e,e):e in i?i[e]:o(e)}return this._isCompound&&t.each(n.nodes(),function(t){n.setParent(t,o(t))}),n},n.prototype.setDefaultEdgeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultEdgeLabelFn=e,this},n.prototype.edgeCount=function(){return this._edgeCount},n.prototype.edges=function(){return t.values(this._edgeObjs)},n.prototype.setPath=function(e,n){var r=this,i=arguments;return t.reduce(e,function(t,e){return i.length>1?r.setEdge(t,e,n):r.setEdge(t,e),e}),this},n.prototype.setEdge=function(){var e,n,i,a,s=!1,l=arguments[0];"object"==typeof l&&null!==l&&"v"in l?(e=l.v,n=l.w,i=l.name,2===arguments.length&&(a=arguments[1],s=!0)):(e=l,n=arguments[1],i=arguments[3],arguments.length>2&&(a=arguments[2],s=!0)),e=""+e,n=""+n,t.isUndefined(i)||(i=""+i);var c=o(this._isDirected,e,n,i);if(t.has(this._edgeLabels,c))return s&&(this._edgeLabels[c]=a),this;if(!t.isUndefined(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[c]=s?a:this._defaultEdgeLabelFn(e,n,i);var u=function(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,e,n,i);return e=u.v,n=u.w,Object.freeze(u),this._edgeObjs[c]=u,r(this._preds[n],e),r(this._sucs[e],n),this._in[n][c]=u,this._out[e][c]=u,this._edgeCount++,this},n.prototype.edge=function(t,e,n){var r=1===arguments.length?a(this._isDirected,arguments[0]):o(this._isDirected,t,e,n);return this._edgeLabels[r]},n.prototype.hasEdge=function(e,n,r){var i=1===arguments.length?a(this._isDirected,arguments[0]):o(this._isDirected,e,n,r);return t.has(this._edgeLabels,i)},n.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?a(this._isDirected,arguments[0]):o(this._isDirected,t,e,n),s=this._edgeObjs[r];return s&&(t=s.v,e=s.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[e],t),i(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},n.prototype.inEdges=function(e,n){var r=this._in[e];if(r){var i=t.values(r);return n?t.filter(i,function(t){return t.v===n}):i}},n.prototype.outEdges=function(e,n){var r=this._out[e];if(r){var i=t.values(r);return n?t.filter(i,function(t){return t.w===n}):i}},n.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))},uA}function bR(){return gA?pA:(gA=1,pA={Graph:yR(),version:fA?dA:(fA=1,dA="2.1.8")})}function xR(){if(mA)return vA;mA=1;var t=mR(),e=yR();function n(e){return t.map(e.nodes(),function(n){var r=e.node(n),i=e.parent(n),o={v:n};return t.isUndefined(r)||(o.value=r),t.isUndefined(i)||(o.parent=i),o})}function r(e){return t.map(e.edges(),function(n){var r=e.edge(n),i={v:n.v,w:n.w};return t.isUndefined(n.name)||(i.name=n.name),t.isUndefined(r)||(i.value=r),i})}return vA={write:function(e){var i={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:n(e),edges:r(e)};t.isUndefined(e.graph())||(i.value=t.clone(e.graph()));return i},read:function(n){var r=new e(n.options).setGraph(n.value);return t.each(n.nodes,function(t){r.setNode(t.v,t.value),t.parent&&r.setParent(t.v,t.parent)}),t.each(n.edges,function(t){r.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),r}}}function ER(){if(bA)return yA;bA=1;var t=mR();return yA=function(e){var n,r={},i=[];function o(i){t.has(r,i)||(r[i]=!0,n.push(i),t.each(e.successors(i),o),t.each(e.predecessors(i),o))}return t.each(e.nodes(),function(t){n=[],o(t),n.length&&i.push(n)}),i},yA}function wR(){if(EA)return xA;EA=1;var t=mR();function e(){this._arr=[],this._keyIndices={}}return xA=e,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(e){return t.has(this._keyIndices,e)},e.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},e.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(e,n){var r=this._keyIndices;if(e=String(e),!t.has(r,e)){var i=this._arr,o=i.length;return r[e]=o,i.push({key:e,priority:n}),this._decrease(o),!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,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},e.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))},e.prototype._decrease=function(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e},e.prototype._swap=function(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e},xA}function kR(){if(kA)return wA;kA=1;var t=mR(),e=wR();wA=function(t,r,i,o){return function(t,n,r,i){var o,a,s={},l=new e,c=function(t){var e=t.v!==o?t.v:t.w,n=s[e],i=r(t),c=a.distance+i;if(i<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+i);c<n.distance&&(n.distance=c,n.predecessor=o,l.decrease(e,c))};t.nodes().forEach(function(t){var e=t===n?0:Number.POSITIVE_INFINITY;s[t]={distance:e},l.add(t,e)});for(;l.size()>0&&(o=l.removeMin(),(a=s[o]).distance!==Number.POSITIVE_INFINITY);)i(o).forEach(c);return s}(t,String(r),i||n,o||function(e){return t.outEdges(e)})};var n=t.constant(1);return wA}function MR(){if(SA)return MA;SA=1;var t=kR(),e=mR();return MA=function(n,r,i){return e.transform(n.nodes(),function(e,o){e[o]=t(n,o,r,i)},{})}}function SR(){if(TA)return NA;TA=1;var t=mR();return NA=function(e){var n=0,r=[],i={},o=[];function a(s){var l=i[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),e.successors(s).forEach(function(e){t.has(i,e)?i[e].onStack&&(l.lowlink=Math.min(l.lowlink,i[e].index)):(a(e),l.lowlink=Math.min(l.lowlink,i[e].lowlink))}),l.lowlink===l.index){var c,u=[];do{c=r.pop(),i[c].onStack=!1,u.push(c)}while(s!==c);o.push(u)}}return e.nodes().forEach(function(e){t.has(i,e)||a(e)}),o},NA}function NR(){if(CA)return OA;CA=1;var t=mR(),e=SR();return OA=function(n){return t.filter(e(n),function(t){return t.length>1||1===t.length&&n.hasEdge(t[0],t[0])})}}function TR(){if(PA)return AA;PA=1;var t=mR();AA=function(t,n,r){return function(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)})})}),r}(t,n||e,r||function(e){return t.outEdges(e)})};var e=t.constant(1);return AA}function OR(){if(DA)return RA;DA=1;var t=mR();function e(e){var r={},i={},o=[];if(t.each(e.sinks(),function a(s){if(t.has(i,s))throw new n;t.has(r,s)||(i[s]=!0,r[s]=!0,t.each(e.predecessors(s),a),delete i[s],o.push(s))}),t.size(r)!==e.nodeCount())throw new n;return o}function n(){}return RA=e,e.CycleException=n,n.prototype=new Error,RA}function CR(){if(_A)return LA;_A=1;var t=OR();return LA=function(e){try{t(e)}catch(e){if(e instanceof t.CycleException)return!1;throw e}return!0}}function AR(){if(jA)return IA;jA=1;var t=mR();function e(n,r,i,o,a,s){t.has(o,r)||(o[r]=!0,i||s.push(r),t.each(a(r),function(t){e(n,t,i,o,a,s)}),i&&s.push(r))}return IA=function(n,r,i){t.isArray(r)||(r=[r]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),a=[],s={};return t.each(r,function(t){if(!n.hasNode(t))throw new Error("Graph does not have node: "+t);e(n,t,"post"===i,s,o,a)}),a},IA}function PR(){if(FA)return BA;FA=1;var t=AR();return BA=function(e,n){return t(e,n,"post")}}function RR(){if(GA)return zA;GA=1;var t=AR();return zA=function(e,n){return t(e,n,"pre")}}function DR(){if(WA)return VA;WA=1;var t=mR(),e=yR(),n=wR();return VA=function(r,i){var o,a=new e,s={},l=new n;function c(t){var e=t.v===o?t.w:t.v,n=l.priority(e);if(void 0!==n){var r=i(t);r<n&&(s[e]=o,l.decrease(e,r))}}if(0===r.nodeCount())return a;t.each(r.nodes(),function(t){l.add(t,Number.POSITIVE_INFINITY),a.setNode(t)}),l.decrease(r.nodes()[0],0);var u=!1;for(;l.size()>0;){if(o=l.removeMin(),t.has(s,o))a.setEdge(o,s[o]);else{if(u)throw new Error("Input graph is not connected: "+r);u=!0}r.nodeEdges(o).forEach(c)}return a}}try{qA=function(){if(YA)return $A;YA=1;var t=bR();return $A={Graph:t.Graph,json:xR(),alg:UA?HA:(UA=1,HA={components:ER(),dijkstra:kR(),dijkstraAll:MR(),findCycles:NR(),floydWarshall:TR(),isAcyclic:CR(),postorder:PR(),preorder:RR(),prim:DR(),tarjan:SR(),topsort:OR()}),version:t.version}}()}catch(t){}qA||(qA=window.graphlib);var LR,_R,IR,jR,BR,FR,zR,GR,VR,WR,HR,UR,$R,YR,qR,XR,KR,ZR,QR,JR,tD,eD,nD,rD,iD,oD,aD,sD,lD,cD,uD,hD,dD,fD,pD,gD,vD,mD,yD,bD,xD,ED,wD,kD,MD,SD,ND,TD,OD,CD,AD,PD,RD,DD,LD,_D,ID,jD,BD,FD,zD,GD,VD,WD,HD,UD,$D,YD,qD,XD,KD,ZD,QD,JD,tL,eL,nL,rL,iL,oL,aL,sL,lL,cL,uL,hL,dL,fL,pL,gL,vL,mL,yL,bL=qA;function xL(){if(jR)return IR;jR=1;var t=fM(),e=_S(),n=QM(),r=xM();return IR=function(i,o,a){if(!r(a))return!1;var s=typeof o;return!!("number"==s?e(a)&&n(o,a.length):"string"==s&&o in a)&&t(a[o],i)},IR}function EL(){if(UR)return HR;UR=1;var t=function(){if(WR)return VR;WR=1;var t=/\s/;return VR=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n},VR}(),e=/^\s+/;return HR=function(n){return n?n.slice(0,t(n)+1).replace(e,""):n}}function wL(){if(XR)return qR;XR=1;var t=function(){if(YR)return $R;YR=1;var t=EL(),e=xM(),n=IP(),r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;return $R=function(s){if("number"==typeof s)return s;if(n(s))return NaN;if(e(s)){var l="function"==typeof s.valueOf?s.valueOf():s;s=e(l)?l+"":l}if("string"!=typeof s)return 0===s?s:+s;s=t(s);var c=i.test(s);return c||o.test(s)?a(s.slice(2),c?2:8):r.test(s)?NaN:+s}}(),e=1/0;return qR=function(n){return n?(n=t(n))===e||n===-1/0?17976931348623157e292*(n<0?-1:1):n==n?n:0:0===n?n:0}}function kL(){if(JR)return QR;JR=1;var t=uR(),e=XP(),n=function(){if(ZR)return KR;ZR=1;var t=wL();return KR=function(e){var n=t(e),r=n%1;return n==n?r?n-r:n:0}}(),r=Math.max;return QR=function(i,o,a){var s=null==i?0:i.length;if(!s)return-1;var l=null==a?0:n(a);return l<0&&(l=r(s+l,0)),t(i,e(o,3),l)},QR}function ML(){if(rD)return nD;rD=1;var t=aR();return nD=function(e){return(null==e?0:e.length)?t(e,1):[]}}function SL(){if(hD)return uD;hD=1;var t=IP();return uD=function(e,n,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=n(a);if(null!=s&&(void 0===l?s==s&&!t(s):r(s,l)))var l=s,c=a}return c},uD}function NL(){if(mD)return vD;mD=1;var t=DM(),e=fM();return vD=function(n,r,i){(void 0!==i&&!e(n[r],i)||void 0===i&&!(r in n))&&t(n,r,i)}}function TL(){if(ED)return xD;return ED=1,xD=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function OL(){if(SD)return MD;SD=1;var t=NL(),e=KA(),n=uP(),r=ZA(),i=fP(),o=jM(),a=BM(),s=pR(),l=ZM(),c=EM(),u=xM(),h=function(){if(bD)return yD;bD=1;var t=bM(),e=nP(),n=IM(),r=Function.prototype,i=Object.prototype,o=r.toString,a=i.hasOwnProperty,s=o.call(Object);return yD=function(r){if(!n(r)||"[object Object]"!=t(r))return!1;var i=e(r);if(null===i)return!0;var l=a.call(i,"constructor")&&i.constructor;return"function"==typeof l&&l instanceof l&&o.call(l)==s}}(),d=AS(),f=TL(),p=function(){if(kD)return wD;kD=1;var t=_M(),e=BS();return wD=function(n){return t(n,e(n))}}();return MD=function(g,v,m,y,b,x,E){var w=f(g,m),k=f(v,m),M=E.get(k);if(M)t(g,m,M);else{var S=x?x(w,k,m+"",g,v,E):void 0,N=void 0===S;if(N){var T=a(k),O=!T&&l(k),C=!T&&!O&&d(k);S=k,T||O||C?a(w)?S=w:s(w)?S=r(w):O?(N=!1,S=e(k,!0)):C?(N=!1,S=n(k,!0)):S=[]:h(k)||o(k)?(S=w,o(w)?S=p(w):u(w)&&!c(w)||(S=i(k))):N=!1}N&&(E.set(k,S),b(S,k,y,x,E),E.delete(k)),t(g,m,S)}}}function CL(){if(DD)return RD;return DD=1,RD=function(t,e){return t<e}}function AL(){if(WD)return VD;WD=1;var t=WP(),e=function(){if(GD)return zD;GD=1;var t=LM(),e=GP(),n=QM(),r=xM(),i=VP();return zD=function(o,a,s,l){if(!r(o))return o;for(var c=-1,u=(a=e(a,o)).length,h=u-1,d=o;null!=d&&++c<u;){var f=i(a[c]),p=s;if("__proto__"===f||"constructor"===f||"prototype"===f)return o;if(c!=h){var g=d[f];void 0===(p=l?l(g,f,d):void 0)&&(p=r(g)?g:n(a[c+1])?[]:{})}t(d,f,p),d=d[f]}return o},zD}(),n=GP();return VD=function(r,i,o){for(var a=-1,s=i.length,l={};++a<s;){var c=i[a],u=t(r,c);o(u,c)&&e(l,n(c,r),u)}return l},VD}function PL(){if(JD)return QD;JD=1;var t=function(){if(ZD)return KD;ZD=1;var t=Math.ceil,e=Math.max;return KD=function(n,r,i,o){for(var a=-1,s=e(t((r-n)/(i||1)),0),l=Array(s);s--;)l[o?s:++a]=n,n+=i;return l},KD}(),e=xL(),n=wL();return QD=function(r){return function(i,o,a){return a&&"number"!=typeof a&&e(i,o,a)&&(o=a=void 0),i=n(i),void 0===o?(o=i,i=0):o=n(o),a=void 0===a?i<o?1:-1:n(a),t(i,o,a,r)}},QD}function RL(){if(sL)return aL;sL=1;var t=function(){if(oL)return iL;oL=1;var t=IP();return iL=function(e,n){if(e!==n){var r=void 0!==e,i=null===e,o=e==e,a=t(e),s=void 0!==n,l=null===n,c=n==n,u=t(n);if(!l&&!u&&!a&&e>n||a&&s&&c&&!l&&!u||i&&s&&c||!r&&c||!o)return 1;if(!i&&!a&&!u&&e<n||u&&r&&o&&!i&&!a||l&&r&&o||!s&&o||!c)return-1}return 0}}();return aL=function(e,n,r){for(var i=-1,o=e.criteria,a=n.criteria,s=o.length,l=r.length;++i<s;){var c=t(o[i],a[i]);if(c)return i>=l?c:c*("desc"==r[i]?-1:1)}return e.index-n.index},aL}function DL(){if(cL)return lL;cL=1;var t=FP(),e=WP(),n=XP(),r=tR(),i=(rL||(rL=1,nL=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}),nL),o=tS(),a=RL(),s=wP(),l=BM();return lL=function(c,u,h){u=u.length?t(u,function(t){return l(t)?function(n){return e(n,1===t.length?t[0]:t)}:t}):[s];var d=-1;u=t(u,o(n));var f=r(c,function(e,n,r){return{criteria:t(u,function(t){return t(e)}),index:++d,value:e}});return i(f,function(t,e){return a(t,e,h)})},lL}try{yL={cloneDeep:function(){if(_R)return LR;_R=1;var t=vP();return LR=function(e){return t(e,5)}}(),constant:yP(),defaults:function(){if(FR)return BR;FR=1;var t=cR(),e=fM(),n=xL(),r=BS(),i=Object.prototype,o=i.hasOwnProperty,a=t(function(t,a){t=Object(t);var s=-1,l=a.length,c=l>2?a[2]:void 0;for(c&&n(a[0],a[1],c)&&(l=1);++s<l;)for(var u=a[s],h=r(u),d=-1,f=h.length;++d<f;){var p=h[d],g=t[p];(void 0===g||e(g,i[p])&&!o.call(t,p))&&(t[p]=u[p])}return t});return BR=a}(),each:SP(),filter:KP(),find:function(){if(eD)return tD;eD=1;var t=function(){if(GR)return zR;GR=1;var t=XP(),e=_S(),n=IS();return zR=function(r){return function(i,o,a){var s=Object(i);if(!e(i)){var l=t(o,3);i=n(i),o=function(t){return l(s[t],t,s)}}var c=r(i,o,a);return c>-1?s[l?i[c]:c]:void 0}},zR}(),e=t(kL());return tD=e}(),flatten:ML(),forEach:MP(),forIn:function(){if(oD)return iD;oD=1;var t=bP(),e=kP(),n=BS();return iD=function(r,i){return null==r?r:t(r,e(i),n)}}(),has:ZP(),isUndefined:JP(),last:(sD||(sD=1,aD=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}),aD),map:eR(),mapValues:function(){if(cD)return lD;cD=1;var t=DM(),e=xP(),n=XP();return lD=function(r,i){var o={};return i=n(i,3),e(r,function(e,n,r){t(o,n,i(e,n,r))}),o}}(),max:function(){if(gD)return pD;gD=1;var t=SL(),e=fD?dD:(fD=1,dD=function(t,e){return t>e}),n=wP();return pD=function(r){return r&&r.length?t(r,n,e):void 0}}(),merge:function(){if(PD)return AD;PD=1;var t=function(){if(TD)return ND;TD=1;var t=AM(),e=NL(),n=bP(),r=OL(),i=xM(),o=BS(),a=TL();return ND=function s(l,c,u,h,d){l!==c&&n(c,function(n,o){if(d||(d=new t),i(n))r(l,c,o,u,s,h,d);else{var f=h?h(a(l,o),n,o+"",l,c,d):void 0;void 0===f&&(f=n),e(l,o,f)}},o)},ND}(),e=function(){if(CD)return OD;CD=1;var t=cR(),e=xL();return OD=function(n){return t(function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=n.length>3&&"function"==typeof a?(o--,a):void 0,s&&e(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),t=Object(t);++i<o;){var l=r[i];l&&n(t,l,i,a)}return t})},OD}(),n=e(function(e,n,r){t(e,n,r)});return AD=n}(),min:function(){if(_D)return LD;_D=1;var t=SL(),e=CL(),n=wP();return LD=function(r){return r&&r.length?t(r,n,e):void 0}}(),minBy:function(){if(jD)return ID;jD=1;var t=SL(),e=XP(),n=CL();return ID=function(r,i){return r&&r.length?t(r,e(i,2),n):void 0}}(),now:function(){if(FD)return BD;FD=1;var t=mM();return BD=function(){return t.Date.now()}}(),pick:function(){if(XD)return qD;XD=1;var t=function(){if(UD)return HD;UD=1;var t=AL(),e=UP();return HD=function(n,r){return t(n,r,function(t,r){return e(n,r)})}}(),e=function(){if(YD)return $D;YD=1;var t=ML(),e=sR(),n=lR();return $D=function(r){return n(e(r,void 0,t),r+"")}}(),n=e(function(e,n){return null==e?{}:t(e,n)});return qD=n}(),range:function(){if(eL)return tL;eL=1;var t=PL()();return tL=t}(),reduce:nR(),sortBy:function(){if(hL)return uL;hL=1;var t=aR(),e=DL(),n=cR(),r=xL(),i=n(function(n,i){if(null==n)return[];var o=i.length;return o>1&&r(n,i[0],i[1])?i=[]:o>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),e(n,t(i,1),[])});return uL=i}(),uniqueId:function(){if(fL)return dL;fL=1;var t=zP(),e=0;return dL=function(n){var r=++e;return t(n)+r},dL}(),values:vR(),zipObject:function(){if(mL)return vL;mL=1;var t=LM(),e=(gL||(gL=1,pL=function(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var s=r<o?e[r]:void 0;n(a,t[r],s)}return a}),pL);return vL=function(n,r){return e(n||[],r||[],t)},vL}()}}catch(t){}yL||(yL=window._);var LL=yL,_L=IL;function IL(){var t={};t._next=t._prev=t,this._sentinel=t}function jL(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function BL(t,e){if("_next"!==t&&"_prev"!==t)return e}IL.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return jL(e),e},IL.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&jL(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},IL.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,BL)),n=n._prev;return"["+t.join(", ")+"]"};var FL=LL,zL=bL.Graph,GL=_L,VL=function(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new zL,r=0,i=0;FL.forEach(t.nodes(),function(t){n.setNode(t,{v:t,in:0,out:0})}),FL.forEach(t.edges(),function(t){var o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)});var o=FL.range(i+r+3).map(function(){return new GL}),a=r+1;return FL.forEach(n.nodes(),function(t){UL(o,a,n.node(t))}),{graph:n,buckets:o,zeroIdx:a}}(t,e||WL),r=function(t,e,n){var r,i=[],o=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;r=a.dequeue();)HL(t,e,n,r);for(;r=o.dequeue();)HL(t,e,n,r);if(t.nodeCount())for(var s=e.length-2;s>0;--s)if(r=e[s].dequeue()){i=i.concat(HL(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return FL.flatten(FL.map(r,function(e){return t.outEdges(e.v,e.w)}),!0)},WL=FL.constant(1);function HL(t,e,n,r,i){var o=i?[]:void 0;return FL.forEach(t.inEdges(r.v),function(r){var a=t.edge(r),s=t.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,UL(e,n,s)}),FL.forEach(t.outEdges(r.v),function(r){var i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,UL(e,n,a)}),t.removeNode(r.v),o}function UL(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var $L=LL,YL=VL,qL={run:function(t){var e="greedy"===t.graph().acyclicer?YL(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},r={};function i(o){$L.has(r,o)||(r[o]=!0,n[o]=!0,$L.forEach(t.outEdges(o),function(t){$L.has(n,t.w)?e.push(t):i(t.w)}),delete n[o])}return $L.forEach(t.nodes(),i),e}(t);$L.forEach(e,function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,$L.uniqueId("rev"))})},undo:function(t){$L.forEach(t.edges(),function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}};var XL=LL,KL=bL.Graph,ZL={addDummyNode:QL,simplify:function(t){var e=(new KL).setGraph(t.graph());return XL.forEach(t.nodes(),function(n){e.setNode(n,t.node(n))}),XL.forEach(t.edges(),function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e},asNonCompoundGraph:function(t){var e=new KL({multigraph:t.isMultigraph()}).setGraph(t.graph());return XL.forEach(t.nodes(),function(n){t.children(n).length||e.setNode(n,t.node(n))}),XL.forEach(t.edges(),function(n){e.setEdge(n,t.edge(n))}),e},successorWeights:function(t){var e=XL.map(t.nodes(),function(e){var n={};return XL.forEach(t.outEdges(e),function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return XL.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=XL.map(t.nodes(),function(e){var n={};return XL.forEach(t.inEdges(e),function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return XL.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,o=t.y,a=e.x-i,s=e.y-o,l=t.width/2,c=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,r=c):(a<0&&(l=-l),n=l,r=l*s/a);return{x:i+n,y:o+r}},buildLayerMatrix:function(t){var e=XL.map(XL.range(JL(t)+1),function(){return[]});return XL.forEach(t.nodes(),function(n){var r=t.node(n),i=r.rank;XL.isUndefined(i)||(e[i][r.order]=n)}),e},normalizeRanks:function(t){var e=XL.min(XL.map(t.nodes(),function(e){return t.node(e).rank}));XL.forEach(t.nodes(),function(n){var r=t.node(n);XL.has(r,"rank")&&(r.rank-=e)})},removeEmptyRanks:function(t){var e=XL.min(XL.map(t.nodes(),function(e){return t.node(e).rank})),n=[];XL.forEach(t.nodes(),function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=t.graph().nodeRankFactor;XL.forEach(n,function(e,n){XL.isUndefined(e)&&n%i!==0?--r:r&&XL.forEach(e,function(e){t.node(e).rank+=r})})},addBorderNode:function(t,e,n,r){var i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return QL(t,"border",i,e)},maxRank:JL,partition:function(t,e){var n={lhs:[],rhs:[]};return XL.forEach(t,function(t){e(t)?n.lhs.push(t):n.rhs.push(t)}),n},time:function(t,e){var n=XL.now();try{return e()}finally{console.log(t+" time: "+(XL.now()-n)+"ms")}},notime:function(t,e){return e()}};function QL(t,e,n,r){var i;do{i=XL.uniqueId(r)}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function JL(t){return XL.max(XL.map(t.nodes(),function(e){var n=t.node(e).rank;if(!XL.isUndefined(n))return n}))}var t_=LL,e_=ZL,n_={run:function(t){t.graph().dummyChains=[],t_.forEach(t.edges(),function(e){!function(t,e){var n,r,i,o=e.v,a=t.node(o).rank,s=e.w,l=t.node(s).rank,c=e.name,u=t.edge(e),h=u.labelRank;if(l===a+1)return;for(t.removeEdge(e),i=0,++a;a<l;++i,++a)u.points=[],r={width:0,height:0,edgeLabel:u,edgeObj:e,rank:a},n=e_.addDummyNode(t,"edge",r,"_d"),a===h&&(r.width=u.width,r.height=u.height,r.dummy="edge-label",r.labelpos=u.labelpos),t.setEdge(o,n,{weight:u.weight},c),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,s,{weight:u.weight},c)}(t,e)})},undo:function(t){t_.forEach(t.graph().dummyChains,function(e){var n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)})}};var r_=LL,i_={longestPath:function(t){var e={};r_.forEach(t.sources(),function n(r){var i=t.node(r);if(r_.has(e,r))return i.rank;e[r]=!0;var o=r_.min(r_.map(t.outEdges(r),function(e){return n(e.w)-t.edge(e).minlen}));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),i.rank=o})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};var o_=LL,a_=bL.Graph,s_=i_.slack,l_=function(t){var e,n,r=new a_({directed:!1}),i=t.nodes()[0],o=t.nodeCount();r.setNode(i,{});for(;c_(r,t)<o;)e=u_(r,t),n=r.hasNode(e.v)?s_(t,e):-s_(t,e),h_(r,t,n);return r};function c_(t,e){return o_.forEach(t.nodes(),function n(r){o_.forEach(e.nodeEdges(r),function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||s_(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))})}),t.nodeCount()}function u_(t,e){return o_.minBy(e.edges(),function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return s_(e,n)})}function h_(t,e,n){o_.forEach(t.nodes(),function(t){e.node(t).rank+=n})}var d_=LL,f_=l_,p_=i_.slack,g_=i_.longestPath,v_=bL.alg.preorder,m_=bL.alg.postorder,y_=ZL.simplify,b_=x_;function x_(t){t=y_(t),g_(t);var e,n=f_(t);for(k_(n),E_(n,t);e=S_(n);)T_(n,t,e,N_(n,t,e))}function E_(t,e){var n=m_(t,t.nodes());n=n.slice(0,n.length-1),d_.forEach(n,function(n){!function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=w_(t,e,n)}(t,e,n)})}function w_(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,d_.forEach(e.nodeEdges(n),function(o){var s,l,c=o.v===n,u=c?o.w:o.v;if(u!==r){var h=c===i,d=e.edge(o).weight;if(a+=h?d:-d,s=n,l=u,t.hasEdge(s,l)){var f=t.edge(n,u).cutvalue;a+=h?-f:f}}}),a}function k_(t,e){arguments.length<2&&(e=t.nodes()[0]),M_(t,{},1,e)}function M_(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,d_.forEach(t.neighbors(r),function(i){d_.has(e,i)||(n=M_(t,e,n,i,r))}),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function S_(t){return d_.find(t.edges(),function(e){return t.edge(e).cutvalue<0})}function N_(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),s=o,l=!1;o.lim>a.lim&&(s=a,l=!0);var c=d_.filter(e.edges(),function(e){return l===O_(t,t.node(e.v),s)&&l!==O_(t,t.node(e.w),s)});return d_.minBy(c,function(t){return p_(e,t)})}function T_(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),k_(t),E_(t,e),function(t,e){var n=d_.find(t.nodes(),function(t){return!e.node(t).parent}),r=v_(t,n);r=r.slice(1),d_.forEach(r,function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})}(t,e)}function O_(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}x_.initLowLimValues=k_,x_.initCutValues=E_,x_.calcCutValue=w_,x_.leaveEdge=S_,x_.enterEdge=N_,x_.exchangeEdges=T_;var C_=i_.longestPath,A_=l_,P_=b_,R_=function(t){switch(t.graph().ranker){case"network-simplex":default:L_(t);break;case"tight-tree":!function(t){C_(t),A_(t)}(t);break;case"longest-path":D_(t)}};var D_=C_;function L_(t){P_(t)}var __=LL,I_=function(t){var e=function(t){var e={},n=0;function r(i){var o=n;__.forEach(t.children(i),r),e[i]={low:o,lim:n++}}return __.forEach(t.children(),r),e}(t);__.forEach(t.graph().dummyChains,function(n){for(var r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){var i,o,a=[],s=[],l=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>l||c>e[i].lim));o=i,i=r;for(;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,s=o.lca,l=0,c=a[l],u=!0;n!==i.w;){if(r=t.node(n),u){for(;(c=a[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(c=a[l+1]).minRank<=r.rank;)l++;c=a[l]}t.setParent(n,c),n=t.successors(n)[0]}})};var j_=LL,B_=ZL,F_={run:function(t){var e=B_.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&j_.forEach(o,function(t){n(t,i+1)}),e[r]=i}return j_.forEach(t.children(),function(t){n(t,1)}),e}(t),r=j_.max(j_.values(n))-1,i=2*r+1;t.graph().nestingRoot=e,j_.forEach(t.edges(),function(e){t.edge(e).minlen*=i});var o=function(t){return j_.reduce(t.edges(),function(e,n){return e+t.edge(n).weight},0)}(t)+1;j_.forEach(t.children(),function(a){z_(t,e,i,o,r,n,a)}),t.graph().nodeRankFactor=i},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,j_.forEach(t.edges(),function(e){t.edge(e).nestingEdge&&t.removeEdge(e)})}};function z_(t,e,n,r,i,o,a){var s=t.children(a);if(s.length){var l=B_.addBorderNode(t,"_bt"),c=B_.addBorderNode(t,"_bb"),u=t.node(a);t.setParent(l,a),u.borderTop=l,t.setParent(c,a),u.borderBottom=c,j_.forEach(s,function(s){z_(t,e,n,r,i,o,s);var u=t.node(s),h=u.borderTop?u.borderTop:s,d=u.borderBottom?u.borderBottom:s,f=u.borderTop?r:2*r,p=h!==d?1:i-o[a]+1;t.setEdge(l,h,{weight:f,minlen:p,nestingEdge:!0}),t.setEdge(d,c,{weight:f,minlen:p,nestingEdge:!0})}),t.parent(a)||t.setEdge(e,l,{weight:0,minlen:i+o[a]})}else a!==e&&t.setEdge(e,a,{weight:0,minlen:n})}var G_=LL,V_=ZL,W_=function(t){G_.forEach(t.children(),function e(n){var r=t.children(n),i=t.node(n);if(r.length&&G_.forEach(r,e),G_.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)H_(t,"borderLeft","_bl",n,i,o),H_(t,"borderRight","_br",n,i,o)}})};function H_(t,e,n,r,i,o){var a={width:0,height:0,rank:o,borderType:e},s=i[e][o-1],l=V_.addDummyNode(t,"border",a,n);i[e][o]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}var U_=LL,$_={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||Y_(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){U_.forEach(t.nodes(),function(e){X_(t.node(e))}),U_.forEach(t.edges(),function(e){var n=t.edge(e);U_.forEach(n.points,X_),U_.has(n,"y")&&X_(n)})}(t);"lr"!==e&&"rl"!==e||(!function(t){U_.forEach(t.nodes(),function(e){K_(t.node(e))}),U_.forEach(t.edges(),function(e){var n=t.edge(e);U_.forEach(n.points,K_),U_.has(n,"x")&&K_(n)})}(t),Y_(t))}};function Y_(t){U_.forEach(t.nodes(),function(e){q_(t.node(e))}),U_.forEach(t.edges(),function(e){q_(t.edge(e))})}function q_(t){var e=t.width;t.width=t.height,t.height=e}function X_(t){t.y=-t.y}function K_(t){var e=t.x;t.x=t.y,t.y=e}var Z_=LL,Q_=function(t){var e={},n=Z_.filter(t.nodes(),function(e){return!t.children(e).length}),r=Z_.max(Z_.map(n,function(e){return t.node(e).rank})),i=Z_.map(Z_.range(r+1),function(){return[]});function o(n){if(!Z_.has(e,n)){e[n]=!0;var r=t.node(n);i[r.rank].push(n),Z_.forEach(t.successors(n),o)}}var a=Z_.sortBy(n,function(e){return t.node(e).rank});return Z_.forEach(a,o),i};var J_=LL,tI=function(t,e){for(var n=0,r=1;r<e.length;++r)n+=eI(t,e[r-1],e[r]);return n};function eI(t,e,n){for(var r=J_.zipObject(n,J_.map(n,function(t,e){return e})),i=J_.flatten(J_.map(e,function(e){return J_.sortBy(J_.map(t.outEdges(e),function(e){return{pos:r[e.w],weight:t.edge(e).weight}}),"pos")}),!0),o=1;o<n.length;)o<<=1;var a=2*o-1;o-=1;var s=J_.map(new Array(a),function(){return 0}),l=0;return J_.forEach(i.forEach(function(t){var e=t.pos+o;s[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=s[e+1]),s[e=e-1>>1]+=t.weight;l+=t.weight*n})),l}var nI=LL;var rI=LL,iI=function(t,e){var n={};return rI.forEach(t,function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};rI.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)}),rI.forEach(e.edges(),function(t){var e=n[t.v],r=n[t.w];rI.isUndefined(e)||rI.isUndefined(r)||(r.indegree++,e.out.push(n[t.w]))}),function(t){var e=[];function n(t){return function(e){e.merged||(rI.isUndefined(e.barycenter)||rI.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return function(n){n.in.push(e),0===--n.indegree&&t.push(n)}}for(;t.length;){var i=t.pop();e.push(i),rI.forEach(i.in.reverse(),n(i)),rI.forEach(i.out,r(i))}return rI.map(rI.filter(e,function(t){return!t.merged}),function(t){return rI.pick(t,["vs","i","barycenter","weight"])})}(rI.filter(n,function(t){return!t.indegree}))};var oI=LL,aI=ZL;function sI(t,e,n){for(var r;e.length&&(r=oI.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}var lI=LL,cI=function(t,e){return nI.map(e,function(e){var n=t.inEdges(e);if(n.length){var r=nI.reduce(n,function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}})},uI=iI,hI=function(t,e){var n=aI.partition(t,function(t){return oI.has(t,"barycenter")}),r=n.lhs,i=oI.sortBy(n.rhs,function(t){return-t.i}),o=[],a=0,s=0,l=0;r.sort((c=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:c?e.i-t.i:t.i-e.i})),l=sI(o,i,l),oI.forEach(r,function(t){l+=t.vs.length,o.push(t.vs),a+=t.barycenter*t.weight,s+=t.weight,l=sI(o,i,l)});var c;var u={vs:oI.flatten(o,!0)};s&&(u.barycenter=a/s,u.weight=s);return u},dI=function t(e,n,r,i){var o=e.children(n),a=e.node(n),s=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,c={};s&&(o=lI.filter(o,function(t){return t!==s&&t!==l}));var u=cI(e,o);lI.forEach(u,function(n){if(e.children(n.v).length){var o=t(e,n.v,r,i);c[n.v]=o,lI.has(o,"barycenter")&&(a=n,s=o,lI.isUndefined(a.barycenter)?(a.barycenter=s.barycenter,a.weight=s.weight):(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight))}var a,s});var h=uI(u,r);!function(t,e){lI.forEach(t,function(t){t.vs=lI.flatten(t.vs.map(function(t){return e[t]?e[t].vs:t}),!0)})}(h,c);var d=hI(h,i);if(s&&(d.vs=lI.flatten([s,d.vs,l],!0),e.predecessors(s).length)){var f=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(l)[0]);lI.has(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d};var fI=LL,pI=bL.Graph,gI=function(t,e,n){var r=function(t){var e;for(;t.hasNode(e=fI.uniqueId("_root")););return e}(t),i=new pI({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(e){return t.node(e)});return fI.forEach(t.nodes(),function(o){var a=t.node(o),s=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,s||r),fI.forEach(t[n](o),function(e){var n=e.v===o?e.w:e.v,r=i.edge(n,o),a=fI.isUndefined(r)?0:r.weight;i.setEdge(n,o,{weight:t.edge(e).weight+a})}),fI.has(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),i};var vI=LL;var mI=LL,yI=Q_,bI=tI,xI=dI,EI=gI,wI=function(t,e,n){var r,i={};vI.forEach(n,function(n){for(var o,a,s=t.parent(n);s;){if((o=t.parent(s))?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}})},kI=bL.Graph,MI=ZL,SI=function(t){var e=MI.maxRank(t),n=NI(t,mI.range(1,e+1),"inEdges"),r=NI(t,mI.range(e-1,-1,-1),"outEdges"),i=yI(t);OI(t,i);for(var o,a=Number.POSITIVE_INFINITY,s=0,l=0;l<4;++s,++l){TI(s%2?n:r,s%4>=2),i=MI.buildLayerMatrix(t);var c=bI(t,i);c<a&&(l=0,o=mI.cloneDeep(i),a=c)}OI(t,o)};function NI(t,e,n){return mI.map(e,function(e){return EI(t,e,n)})}function TI(t,e){var n=new kI;mI.forEach(t,function(t){var r=t.graph().root,i=xI(t,r,n,e);mI.forEach(i.vs,function(e,n){t.node(e).order=n}),wI(t,n,i.vs)})}function OI(t,e){mI.forEach(e,function(e){mI.forEach(e,function(e,n){t.node(e).order=n})})}var CI=LL,AI=bL.Graph,PI=ZL,RI=function(t){var e,n=PI.buildLayerMatrix(t),r=CI.merge(function(t,e){var n={};function r(e,r){var i=0,o=0,a=e.length,s=CI.last(r);return CI.forEach(r,function(e,l){var c=function(t,e){if(t.node(e).dummy)return CI.find(t.predecessors(e),function(e){return t.node(e).dummy})}(t,e),u=c?t.node(c).order:a;(c||e===s)&&(CI.forEach(r.slice(o,l+1),function(e){CI.forEach(t.predecessors(e),function(r){var o=t.node(r),a=o.order;!(a<i||u<a)||o.dummy&&t.node(e).dummy||DI(n,r,e)})}),o=l+1,i=u)}),r}return CI.reduce(e,r),n}(t,n),function(t,e){var n={};function r(e,r,i,o,a){var s;CI.forEach(CI.range(r,i),function(r){s=e[r],t.node(s).dummy&&CI.forEach(t.predecessors(s),function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&DI(n,e,s)})})}function i(e,n){var i,o=-1,a=0;return CI.forEach(n,function(s,l){if("border"===t.node(s).dummy){var c=t.predecessors(s);c.length&&(i=t.node(c[0]).order,r(n,a,l,o,i),a=l,o=i)}r(n,a,n.length,i,e.length)}),n}return CI.reduce(e,i),n}(t,n)),i={};CI.forEach(["u","d"],function(o){e="u"===o?n:CI.values(n).reverse(),CI.forEach(["l","r"],function(n){"r"===n&&(e=CI.map(e,function(t){return CI.values(t).reverse()}));var a=("u"===o?t.predecessors:t.successors).bind(t),s=function(t,e,n,r){var i={},o={},a={};return CI.forEach(e,function(t){CI.forEach(t,function(t,e){i[t]=t,o[t]=t,a[t]=e})}),CI.forEach(e,function(t){var e=-1;CI.forEach(t,function(t){var s=r(t);if(s.length){s=CI.sortBy(s,function(t){return a[t]});for(var l=(s.length-1)/2,c=Math.floor(l),u=Math.ceil(l);c<=u;++c){var h=s[c];o[t]===t&&e<a[h]&&!LI(n,t,h)&&(o[h]=t,o[t]=i[t]=i[h],e=a[h])}}})}),{root:i,align:o}}(0,e,r,a),l=function(t,e,n,r,i){var o={},a=function(t,e,n,r){var i=new AI,o=t.graph(),a=function(t,e,n){return function(r,i,o){var a,s=r.node(i),l=r.node(o),c=0;if(c+=s.width/2,CI.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?e:t)/2,c+=(l.dummy?e:t)/2,c+=l.width/2,CI.has(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2}return a&&(c+=n?a:-a),a=0,c}}(o.nodesep,o.edgesep,r);return CI.forEach(e,function(e){var r;CI.forEach(e,function(e){var o=n[e];if(i.setNode(o),r){var s=n[r],l=i.edge(s,o);i.setEdge(s,o,Math.max(a(t,e,r),l||0))}r=e})}),i}(t,e,n,i),s=i?"borderLeft":"borderRight";function l(t,e){for(var n=a.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}function c(t){o[t]=a.inEdges(t).reduce(function(t,e){return Math.max(t,o[e.v]+a.edge(e))},0)}function u(e){var n=a.outEdges(e).reduce(function(t,e){return Math.min(t,o[e.w]-a.edge(e))},Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(o[e]=Math.max(o[e],n))}return l(c,a.predecessors.bind(a)),l(u,a.successors.bind(a)),CI.forEach(r,function(t){o[t]=o[n[t]]}),o}(t,e,s.root,s.align,"r"===n);"r"===n&&(l=CI.mapValues(l,function(t){return-t})),i[o+n]=l})});var o=function(t,e){return CI.minBy(CI.values(e),function(e){var n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return CI.forIn(e,function(e,i){var o=function(t,e){return t.node(e).width}(t,i)/2;n=Math.max(e+o,n),r=Math.min(e-o,r)}),n-r})}(t,i);return function(t,e){var n=CI.values(e),r=CI.min(n),i=CI.max(n);CI.forEach(["u","d"],function(n){CI.forEach(["l","r"],function(o){var a,s=n+o,l=t[s];if(l!==e){var c=CI.values(l);(a="l"===o?r-CI.min(c):i-CI.max(c))&&(t[s]=CI.mapValues(l,function(t){return t+a}))}})})}(i,o),function(t,e){return CI.mapValues(t.ul,function(n,r){if(e)return t[e.toLowerCase()][r];var i=CI.sortBy(CI.map(t,r));return(i[1]+i[2])/2})}(i,t.graph().align)};function DI(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function LI(t,e,n){if(e>n){var r=e;e=n,n=r}return CI.has(t[e],n)}var _I=LL,II=ZL,jI=RI,BI=function(t){(function(t){var e=II.buildLayerMatrix(t),n=t.graph().ranksep,r=0;_I.forEach(e,function(e){var i=_I.max(_I.map(e,function(e){return t.node(e).height}));_I.forEach(e,function(e){t.node(e).y=r+i/2}),r+=i+n})})(t=II.asNonCompoundGraph(t)),_I.forEach(jI(t),function(e,n){t.node(n).x=e})};var FI=LL,zI=qL,GI=n_,VI=R_,WI=ZL.normalizeRanks,HI=I_,UI=ZL.removeEmptyRanks,$I=F_,YI=W_,qI=$_,XI=SI,KI=BI,ZI=ZL,QI=bL.Graph,JI=function(t,e){var n=e&&e.debugTiming?ZI.time:ZI.notime;n("layout",function(){var e=n(" buildLayoutGraph",function(){return function(t){var e=new QI({multigraph:!0,compound:!0}),n=cj(t.graph());return e.setGraph(FI.merge({},ej,lj(n,tj),FI.pick(n,nj))),FI.forEach(t.nodes(),function(n){var r=cj(t.node(n));e.setNode(n,FI.defaults(lj(r,rj),ij)),e.setParent(n,t.parent(n))}),FI.forEach(t.edges(),function(n){var r=cj(t.edge(n));e.setEdge(n,FI.merge({},aj,lj(r,oj),FI.pick(r,sj)))}),e}(t)});n(" runLayout",function(){!function(t,e){e(" makeSpaceForEdgeLabels",function(){!function(t){var e=t.graph();e.ranksep/=2,FI.forEach(t.edges(),function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(t)}),e(" removeSelfEdges",function(){!function(t){FI.forEach(t.edges(),function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}(t)}),e(" acyclic",function(){zI.run(t)}),e(" nestingGraph.run",function(){$I.run(t)}),e(" rank",function(){VI(ZI.asNonCompoundGraph(t))}),e(" injectEdgeLabelProxies",function(){!function(t){FI.forEach(t.edges(),function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};ZI.addDummyNode(t,"edge-proxy",i,"_ep")}})}(t)}),e(" removeEmptyRanks",function(){UI(t)}),e(" nestingGraph.cleanup",function(){$I.cleanup(t)}),e(" normalizeRanks",function(){WI(t)}),e(" assignRankMinMax",function(){!function(t){var e=0;FI.forEach(t.nodes(),function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=FI.max(e,r.maxRank))}),t.graph().maxRank=e}(t)}),e(" removeEdgeLabelProxies",function(){!function(t){FI.forEach(t.nodes(),function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}(t)}),e(" normalize.run",function(){GI.run(t)}),e(" parentDummyChains",function(){HI(t)}),e(" addBorderSegments",function(){YI(t)}),e(" order",function(){XI(t)}),e(" insertSelfEdges",function(){!function(t){var e=ZI.buildLayerMatrix(t);FI.forEach(e,function(e){var n=0;FI.forEach(e,function(e,r){var i=t.node(e);i.order=r+n,FI.forEach(i.selfEdges,function(e){ZI.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}(t)}),e(" adjustCoordinateSystem",function(){qI.adjust(t)}),e(" position",function(){KI(t)}),e(" positionSelfEdges",function(){!function(t){FI.forEach(t.nodes(),function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}(t)}),e(" removeBorderNodes",function(){!function(t){FI.forEach(t.nodes(),function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(FI.last(n.borderLeft)),a=t.node(FI.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),FI.forEach(t.nodes(),function(e){"border"===t.node(e).dummy&&t.removeNode(e)})}(t)}),e(" normalize.undo",function(){GI.undo(t)}),e(" fixupEdgeLabelCoords",function(){!function(t){FI.forEach(t.edges(),function(e){var n=t.edge(e);if(FI.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(t)}),e(" undoCoordinateSystem",function(){qI.undo(t)}),e(" translateGraph",function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0;function l(t){var o=t.x,a=t.y,s=t.width,l=t.height;e=Math.min(e,o-s/2),n=Math.max(n,o+s/2),r=Math.min(r,a-l/2),i=Math.max(i,a+l/2)}FI.forEach(t.nodes(),function(e){l(t.node(e))}),FI.forEach(t.edges(),function(e){var n=t.edge(e);FI.has(n,"x")&&l(n)}),e-=a,r-=s,FI.forEach(t.nodes(),function(n){var i=t.node(n);i.x-=e,i.y-=r}),FI.forEach(t.edges(),function(n){var i=t.edge(n);FI.forEach(i.points,function(t){t.x-=e,t.y-=r}),FI.has(i,"x")&&(i.x-=e),FI.has(i,"y")&&(i.y-=r)}),o.width=n-e+a,o.height=i-r+s}(t)}),e(" assignNodeIntersects",function(){!function(t){FI.forEach(t.edges(),function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(ZI.intersectRect(o,n)),i.points.push(ZI.intersectRect(a,r))})}(t)}),e(" reversePoints",function(){!function(t){FI.forEach(t.edges(),function(e){var n=t.edge(e);n.reversed&&n.points.reverse()})}(t)}),e(" acyclic.undo",function(){zI.undo(t)})}(e,n)}),n(" updateInputGraph",function(){!function(t,e){FI.forEach(t.nodes(),function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))}),FI.forEach(t.edges(),function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,FI.has(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)})})};var tj=["nodesep","edgesep","ranksep","marginx","marginy"],ej={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},nj=["acyclicer","ranker","rankdir","align"],rj=["width","height"],ij={width:0,height:0},oj=["minlen","weight","width","height","labeloffset"],aj={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},sj=["labelpos"];function lj(t,e){return FI.mapValues(FI.pick(t,e),Number)}function cj(t){var e={};return FI.forEach(t,function(t,n){e[n.toLowerCase()]=t}),e}var uj=LL,hj=ZL,dj=bL.Graph,fj={debugOrdering:function(t){var e=hj.buildLayerMatrix(t),n=new dj({compound:!0,multigraph:!0}).setGraph({});return uj.forEach(t.nodes(),function(e){n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)}),uj.forEach(t.edges(),function(t){n.setEdge(t.v,t.w,{},t.name)}),uj.forEach(e,function(t,e){var r="layer"+e;n.setNode(r,{rank:"same"}),uj.reduce(t,function(t,e){return n.setEdge(t,e,{style:"invis"}),e})}),n}};var pj={graphlib:bL,layout:JI,debug:fj,util:{time:ZL.time,notime:ZL.notime},version:"0.8.5"},gj=E(pj);class vj{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,vj.defaultOptions,t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const{nodeSize:r}=n,i=new pj.graphlib.Graph;i.setGraph(n),i.setDefaultEdgeLabel(()=>({}));[...e.getAllNodes(),...e.getAllEdges()].some(({id:t})=>ae(t))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(t=>{const{id:e}=t,n=Object.assign({},t.data);if(void 0!==r){const[e,i]=Db(Ut(r)?r(t):r);Object.assign(n,{width:e,height:i})}i.setNode(e.toString(),n)}),e.getAllEdges().forEach(({id:t,source:e,target:n})=>{i.setEdge(e.toString(),n.toString(),{id:t})}),gj.layout(i);const o={nodes:[],edges:[]};return i.nodes().forEach(n=>{const r=i.node(n);o.nodes.push({id:n,data:r}),t&&e.mergeNodeData(n,r)}),i.edges().forEach(n=>{const r=i.edge(n),{id:a}=r,s=ze(r,["id"]),{v:l,w:c}=n;o.edges.push({id:a,source:l,target:c,data:s}),t&&e.mergeEdgeData(a,s)}),o})}}vj.defaultOptions={};class mj{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let r=Math.hypot(e,n);r=r<1e-4?1e-4:r;const i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,r=(this.ry*this.mass+t.ry*t.mass)/e,i=this.degree+t.degree;return new mj({rx:n,ry:r,mass:e,degree:i})}}class yj{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new yj({xmid:t,ymid:e,length:n})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new yj({xmid:t,ymid:e,length:n})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new yj({xmid:t,ymid:e,length:n})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new yj({xmid:t,ymid:e,length:n})}}class bj{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new bj(this.quad.NW()),this.NE=new bj(this.quad.NE()),this.SW=new bj(this.quad.SW()),this.SE=new bj(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){if(null!=this.body&&t!==this.body)if(this._isExternal())t.addForce(this.body);else{(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}const xj={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 Ej{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},xj),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=e.getAllEdges(),i=e.getAllNodes(),o=this.formatOptions(n,i.length),{width:a,height:s,prune:l,maxIteration:c,nodeSize:u,center:h}=o;if(!(null==i?void 0:i.length)||1===i.length)return zb(e,t,h);const d=i.map(t=>Rb(t,[a,s])),f=r.filter(t=>{const{source:e,target:n}=t;return e!==n}),p=new pv({nodes:d,edges:f}),g=this.getSizes(p,u);if(this.run(p,e,c,g,t,o),l){for(let t=0;t<f.length;t+=1){const{source:e,target:n}=f[t],r=p.getDegree(e),i=p.getDegree(e);if(r<=1){const t=p.getNode(n);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(i<=1){const t=p.getNode(e);p.mergeNodeData(n,{x:t.data.x,y:t.data.y})}}const n=Object.assign(Object.assign({},o),{prune:!1,barnesHut:!1});this.run(p,e,100,g,t,n)}return{nodes:d,edges:r}})}getSizes(t,e){const n=t.getAllNodes(),r={};for(let t=0;t<n.length;t+=1){const i=n[t];r[i.id]=Ib(e,void 0)(i)}return r}formatOptions(t={},e){const n=Object.assign(Object.assign({},this.options),t),{center:r,width:i,height:o,barnesHut:a,prune:s,maxIteration:l,kr:c,kg:u}=n;return n.width=i||"undefined"==typeof window?i:window.innerWidth,n.height=o||"undefined"==typeof window?o:window.innerHeight,n.center=r||[n.width/2,n.height/2],void 0===a&&e>250&&(n.barnesHut=!0),void 0===s&&e>100&&(n.prune=!0),0!==l||s?0===l&&s&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)):(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),u||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,r,i,o){const{kr:a,barnesHut:s,onTick:l}=o,c=t.getAllNodes();let u=0,h=n;const d={},f={},p={};for(let e=0;e<c.length;e+=1){const{data:n,id:r}=c[e];if(d[r]=[0,0],s){const i={id:e,rx:n.x,ry:n.y,mass:1,g:a,degree:t.getDegree(r)};p[r]=new mj(i)}}for(;h>0;)u=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:u,forces:d,preForces:f,bodies:p,sizes:r},o),h--,null==l||l({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:r,preventOverlapIters:i,krPrime:o,sg:a,preForces:s,bodies:l,sizes:c}=e;let{forces:u}=e;const{preventOverlap:h,barnesHut:d}=n,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];s[e]=[...u[e]],u[e]=[0,0]}return u=this.getAttrForces(t,r,i,c,u,n),u=d&&(h&&r>i||!h)?this.getOptRepGraForces(t,u,l,n):this.getRepGraForces(t,r,i,u,o,c,n),this.updatePos(t,u,s,a,n)}getAttrForces(t,e,n,r,i,o){const{preventOverlap:a,dissuadeHubs:s,mode:l,prune:c}=o,u=t.getAllEdges();for(let o=0;o<u.length;o+=1){const{source:h,target:d}=u[o],f=t.getNode(h),p=t.getNode(d),g=t.getDegree(h),v=t.getDegree(d);if(c&&(g<=1||v<=1))continue;const m=[p.data.x-f.data.x,p.data.y-f.data.y];let y=Math.hypot(m[0],m[1]);y=y<1e-4?1e-4:y,m[0]=m[0]/y,m[1]=m[1]/y,a&&e<n&&(y=y-r[h]-r[d]);let b=y,x=b;"linlog"===l&&(b=Math.log(1+y),x=b),s&&(b=y/g,x=y/v),a&&e<n&&y<=0?(b=0,x=0):a&&e<n&&y>0&&(b=y,x=y),i[h][0]+=b*m[0],i[d][0]-=x*m[0],i[h][1]+=b*m[1],i[d][1]-=x*m[1]}return i}getOptRepGraForces(t,e,n,r){const{kg:i,center:o,prune:a}=r,s=t.getAllNodes(),l=s.length;let c=9e10,u=-9e10,h=9e10,d=-9e10;for(let e=0;e<l;e+=1){const{id:r,data:i}=s[e];a&&t.getDegree(r)<=1||(n[r].setPos(i.x,i.y),i.x>=u&&(u=i.x),i.x<=c&&(c=i.x),i.y>=d&&(d=i.y),i.y<=h&&(h=i.y))}const f=Math.max(u-c,d-h),p=new yj({xmid:(u+c)/2,ymid:(d+h)/2,length:f,massCenter:o,mass:l}),g=new bj(p);for(let e=0;e<l;e+=1){const{id:r}=s[e];a&&t.getDegree(r)<=1||n[r].in(p)&&g.insert(n[r])}for(let r=0;r<l;r+=1){const{id:l,data:c}=s[r],u=t.getDegree(l);if(a&&u<=1)continue;n[l].resetForce(),g.updateForce(n[l]),e[l][0]-=n[l].fx,e[l][1]-=n[l].fy;const h=[c.x-o[0],c.y-o[1]];let d=Math.hypot(h[0],h[1]);d=d<1e-4?1e-4:d,h[0]=h[0]/d,h[1]=h[1]/d;const f=i*(u+1);e[l][0]-=f*h[0],e[l][1]-=f*h[1]}return e}getRepGraForces(t,e,n,r,i,o,a){const{preventOverlap:s,kr:l,kg:c,center:u,prune:h}=a,d=t.getAllNodes(),f=d.length;for(let a=0;a<f;a+=1){const p=d[a],g=t.getDegree(p.id);for(let c=a+1;c<f;c+=1){const a=d[c],u=t.getDegree(a.id);if(h&&(g<=1||u<=1))continue;const f=[a.data.x-p.data.x,a.data.y-p.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,s&&e<n&&(v=v-o[p.id]-o[a.id]);let m=l*(g+1)*(u+1)/v;s&&e<n&&v<0?m=i*(g+1)*(u+1):s&&e<n&&0===v?m=0:s&&e<n&&v>0&&(m=l*(g+1)*(u+1)/v),r[p.id][0]-=m*f[0],r[a.id][0]+=m*f[0],r[p.id][1]-=m*f[1],r[a.id][1]+=m*f[1]}const v=[p.data.x-u[0],p.data.y-u[1]],m=Math.hypot(v[0],v[1]);v[0]=v[0]/m,v[1]=v[1]/m;const y=c*(g+1);r[p.id][0]-=y*v[0],r[p.id][1]-=y*v[1]}return r}updatePos(t,e,n,r,i){const{ks:o,tao:a,prune:s,ksmax:l}=i,c=t.getAllNodes(),u=c.length,h=[],d=[];let f=0,p=0,g=r;for(let r=0;r<u;r+=1){const{id:i}=c[r],o=t.getDegree(i);if(s&&o<=1)continue;const a=[e[i][0]-n[i][0],e[i][1]-n[i][1]],l=Math.hypot(a[0],a[1]),u=[e[i][0]+n[i][0],e[i][1]+n[i][1]],g=Math.hypot(u[0],u[1]);h[r]=l,d[r]=g/2,f+=(o+1)*h[r],p+=(o+1)*d[r]}const v=g;g=a*p/f,0!==v&&(g=g>1.5*v?1.5*v:g);for(let n=0;n<u;n+=1){const{id:r,data:i}=c[n],a=t.getDegree(r);if(s&&a<=1)continue;if(ae(i.fx)&&ae(i.fy))continue;let u=o*g/(1+g*Math.sqrt(h[n])),d=Math.hypot(e[r][0],e[r][1]);d=d<1e-4?1e-4:d;const f=l/d;u=u>f?f:u;const p=u*e[r][0],v=u*e[r][1];t.mergeNodeData(r,{x:i.x+p,y:i.y+v})}return g}}const wj={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};class kj{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},wj),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0})),e}genericFruchtermanLayout(t,e,n){return Ge(this,void 0,void 0,function*(){if(this.running)return;const r=this.formatOptions(n),{dimensions:i,width:o,height:a,center:s,clustering:l,nodeClusterBy:c,maxIteration:u,onTick:h}=r,d=e.getAllNodes(),f=e.getAllEdges();if(!(null==d?void 0:d.length)){const t={nodes:[],edges:f};return this.lastResult=t,t}if(1===d.length){t&&e.mergeNodeData(d[0].id,{x:s[0],y:s[1],z:3===i?s[2]:void 0});const n={nodes:[Object.assign(Object.assign({},d[0]),{data:Object.assign(Object.assign({},d[0].data),{x:s[0],y:s[1],z:3===i?s[2]:void 0})})],edges:f};return this.lastResult=n,n}const p=d.map(t=>Rb(t,[o,a])),g=new pv({nodes:p,edges:f}),v={};if(l&&p.forEach(t=>{const e=t.data[c];v[e]||(v[e]={name:e,cx:0,cy:0,count:0})}),this.lastLayoutNodes=p,this.lastLayoutEdges=f,this.lastAssign=t,this.lastGraph=g,this.lastOptions=r,this.lastClusterMap=v,"undefined"==typeof window)return;let m=0;return new Promise(n=>{this.timeInterval=window.setInterval(()=>{this.running?(this.runOneStep(g,v,r),t&&p.forEach(({id:t,data:n})=>e.mergeNodeData(t,{x:n.x,y:n.y,z:3===i?n.z:void 0})),null==h||h({nodes:p,edges:f}),m++,m>=u&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:f}))):n({nodes:p,edges:f})},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:r}=e,{center:i,width:o,height:a}=e;return e.width=o||"undefined"==typeof window?o:window.innerWidth,e.height=a||"undefined"==typeof window?a:window.innerHeight,e.center=i||[e.width/2,e.height/2],e.clustering=n&&!!r,e}runOneStep(t,e,n){const{dimensions:r,height:i,width:o,gravity:a,center:s,speed:l,clustering:c,nodeClusterBy:u,clusterGravity:h}=n,d=i*o,f=Math.sqrt(d)/10,p=t.getAllNodes(),g=d/(p.length+1),v=Math.sqrt(g),m={};if(this.applyCalculate(t,m,v,g),c){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach(t=>{const{data:n}=t,r=e[n[u]];ae(n.x)&&(r.cx+=n.x),ae(n.y)&&(r.cy+=n.y),r.count++});for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=h||a;p.forEach((n,r)=>{const{id:i,data:o}=n;if(!ae(o.x)||!ae(o.y))return;const a=e[o[u]],s=Math.sqrt((o.x-a.cx)*(o.x-a.cx)+(o.y-a.cy)*(o.y-a.cy)),l=v*t;m[i].x-=l*(o.x-a.cx)/s,m[i].y-=l*(o.y-a.cy)/s})}p.forEach((t,e)=>{const{id:n,data:i}=t;if(!ae(i.x)||!ae(i.y))return;const o=.01*v*a;m[n].x-=o*(i.x-s[0]),m[n].y-=o*(i.y-s[1]),3===r&&(m[n].z-=o*(i.z-s[2]))}),p.forEach((e,n)=>{const{id:i,data:o}=e;if(ae(o.fx)&&ae(o.fy))return o.x=o.fx,o.y=o.fy,void(3===r&&(o.z=o.fz));if(!ae(o.x)||!ae(o.y))return;const a=Math.sqrt(m[i].x*m[i].x+m[i].y*m[i].y+(3===r?m[i].z*m[i].z:0));if(a>0){const e=Math.min(f*(l/800),a);t.mergeNodeData(i,{x:o.x+m[i].x/a*e,y:o.y+m[i].y/a*e,z:3===r?o.z+m[i].z/a*e:void 0})}})}applyCalculate(t,e,n,r){this.calRepulsive(t,e,r),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const r=t.getAllNodes();r.forEach(({data:t,id:i},o)=>{e[i]={x:0,y:0,z:0},r.forEach(({data:r,id:a},s)=>{if(o<=s||!ae(t.x)||!ae(r.x)||!ae(t.y)||!ae(r.y))return;let l=t.x-r.x,c=t.y-r.y,u=3===this.options.dimensions?t.z-r.z:0,h=l*l+c*c+u*u;0===h&&(h=1,l=.01,c=.01,u=.01);const d=n/h,f=l*d,p=c*d,g=u*d;e[i].x+=f,e[i].y+=p,e[a].x-=f,e[a].y-=p,3===this.options.dimensions&&(e[i].z+=g,e[a].z-=g)})})}calAttractive(t,e,n){t.getAllEdges().forEach(r=>{const{source:i,target:o}=r;if(!i||!o||i===o)return;const{data:a}=t.getNode(i),{data:s}=t.getNode(o);if(!(ae(s.x)&&ae(a.x)&&ae(s.y)&&ae(a.y)))return;const l=s.x-a.x,c=s.y-a.y,u=3===this.options.dimensions?s.z-a.z:0,h=Math.sqrt(l*l+c*c+u*u)/n,d=l*h,f=c*h,p=u*h;e[i].x+=d,e[i].y+=f,e[o].x-=d,e[o].y-=f,3===this.options.dimensions&&(e[i].z+=p,e[o].z-=p)})}}const Mj={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 Sj{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},Mj),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),{begin:i=[0,0],condense:o,preventOverlapPadding:a,preventOverlap:s,rows:l,cols:c,nodeSpacing:u,nodeSize:h,width:d,height:f,position:p}=r;let{sortBy:g}=r;const v=e.getAllNodes(),m=e.getAllEdges(),y=null==v?void 0:v.length;if(!y||1===y)return zb(e,t,i);const b=v.map(t=>Rb(t));"id"===g||ne(g)&&void 0!==b[0].data[g]||(g="degree"),"degree"===g?b.sort((t,n)=>e.getDegree(n.id,"both")-e.getDegree(t.id,"both")):"id"===g?b.sort((t,e)=>ae(e.id)&&ae(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`)):b.sort((t,e)=>e.data[g]-t.data[g]);const x=d||"undefined"==typeof window?d:window.innerWidth,E=f||"undefined"==typeof window?f:window.innerHeight,w=y,k={rows:l,cols:c};if(null!=l&&null!=c)k.rows=l,k.cols=c;else if(null!=l&&null==c)k.rows=l,k.cols=Math.ceil(w/k.rows);else if(null==l&&null!=c)k.cols=c,k.rows=Math.ceil(w/k.cols);else{const t=Math.sqrt(w*E/x);k.rows=Math.round(t),k.cols=Math.round(x/E*t)}if(k.rows=Math.max(k.rows,1),k.cols=Math.max(k.cols,1),k.cols*k.rows>w){const t=Nj(k),e=Tj(k);(t-1)*e>=w?Nj(k,t-1):(e-1)*t>=w&&Tj(k,e-1)}else for(;k.cols*k.rows<w;){const t=Nj(k),e=Tj(k);(e+1)*t>=w?Tj(k,e+1):Nj(k,t+1)}let M=o?0:x/k.cols,S=o?0:E/k.rows;if(s||u){const t=Lb(10,u),n=_b(30,h,!1);b.forEach(r=>{r.data.x&&r.data.y||(r.data.x=0,r.data.y=0);const i=e.getNode(r.id),[o,s]=Db(n(i)||30),l=void 0!==t?t(r):a,c=o+l,u=s+l;M=Math.max(M,c),S=Math.max(S,u)})}const N={},T={row:0,col:0},O={};for(let t=0;t<b.length;t++){const n=b[t];let r;if(p&&(r=p(e.getNode(n.id))),r&&(void 0!==r.row||void 0!==r.col)){const t={row:r.row,col:r.col};if(void 0===t.col)for(t.col=0;Oj(N,t);)t.col++;else if(void 0===t.row)for(t.row=0;Oj(N,t);)t.row++;O[n.id]=t,Cj(N,t)}Pj(n,i,M,S,O,k,T,N)}const C={nodes:b,edges:m};return t&&b.forEach(t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),C})}}const Nj=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.min(r,i);else{Math.min(r,i)===t.rows?t.rows=e:t.cols=e}return n},Tj=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.max(r,i);else{Math.max(r,i)===t.rows?t.rows=e:t.cols=e}return n},Oj=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,Cj=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,Aj=(t,e)=>{const n=t.cols||5;e.col++,e.col>=n&&(e.col=0,e.row++)},Pj=(t,e,n,r,i,o,a,s)=>{let l,c;const u=i[t.id];if(u)l=u.col*n+n/2+e[0],c=u.row*r+r/2+e[1];else{for(;Oj(s,a);)Aj(o,a);l=a.col*n+n/2+e[0],c=a.row*r+r/2+e[1],Cj(s,a),Aj(o,a)}t.data.x=l,t.data.y=c},Rj={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Dj=(t,e,n,r,i,o)=>{e.forEach((a,s)=>{n[s]={x:0,y:0},e.forEach((e,l)=>{if(s===l)return;if(i[s]!==i[l])return;let c=a.x-e.x,u=a.y-e.y,h=Math.sqrt(c*c+u*u);if(0===h){h=1;const t=s>l?1:-1;c=.01*t,u=.01*t}if(h<o(t[s])/2+o(t[l])/2){const t=r*r/h;n[s].x+=c/h*t,n[s].y+=u/h*t}})})},Lj=(t,e,n,r,i,o,a,s)=>{const l=o||a/10;return r&&e.forEach((e,n)=>{const r=t[n].x-t[i].x,o=t[n].y-t[i].y,a=Math.sqrt(r*r+o*o);let s=o/a,l=-r/a;const c=Math.sqrt(e.x*e.x+e.y*e.y);let u=Math.acos((s*e.x+l*e.y)/c);u>Math.PI/2&&(u-=Math.PI/2,s*=-1,l*=-1);const h=Math.cos(u)*c;e.x=s*h,e.y=l*h}),t.forEach((o,a)=>{if(a===i)return;const c=Math.sqrt(e[a].x*e[a].x+e[a].y*e[a].y);if(c>0&&a!==i){const u=Math.min(l*(n/800),c);if(o.x+=e[a].x/c*u,o.y+=e[a].y/c*u,r){let e=o.x-t[i].x,n=o.y-t[i].y;const r=Math.sqrt(e*e+n*n);e=e/r*s[a],n=n/r*s[a],o.x=t[i].x+e,o.y=t[i].y+n}}}),t},_j={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class Ij{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},_j),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),{width:i,height:o,center:a,focusNode:s,unitRadius:l,nodeSize:c,nodeSpacing:u,strictRadial:h,preventOverlap:d,maxPreventOverlapIteration:f,sortBy:p,linkDistance:g=50,sortStrength:v=10,maxIteration:m=1e3}=r,y=e.getAllNodes(),b=e.getAllEdges(),x=i||"undefined"==typeof window?i:window.innerWidth,E=o||"undefined"==typeof window?o:window.innerHeight,w=a||[x/2,E/2];if(!(null==y?void 0:y.length)||1===y.length)return zb(e,t,w);let k=y[0];if(ne(s)){for(let t=0;t<y.length;t++)if(y[t].id===s){k=y[t];break}}else k=s||y[0];const M=Fj(y,k.id),S=Ob({nodes:y,edges:b}),N=Tb(S),T=Gj(N,M);zj(N,M,T+1);const O=N[M];let C=x-w[0]>w[0]?w[0]:x-w[0],A=E-w[1]>w[1]?w[1]:E-w[1];0===C&&(C=x/2),0===A&&(A=E/2);const P=Math.min(C,A),R=Math.max(...O),D=[],L=l||P/R;O.forEach((t,e)=>{D[e]=t*L});const _=jj(y,N,g,D,L,p,v),I=Bj(_),j=((t,e,n)=>{try{const n=pE.mul(pE.pow(e,2),-.5),r=n.mean("row"),i=n.mean("column"),o=n.mean();n.add(o).subRowVector(r).subColumnVector(i);const a=new gE(n),s=pE.sqrt(a.diagonalMatrix).diagonal();return a.leftSingularVectors.toJSON().map(e=>pE.mul([e],[s]).toJSON()[0].splice(0,t))}catch(t){const r=[];for(let t=0;t<e.length;t++){const t=Math.random()*n,e=Math.random()*n;r.push([t,e])}return r}})(g,_,g);let B,F=j.map(([t,e])=>({x:(isNaN(t)?Math.random()*g:t)-j[M][0],y:(isNaN(e)?Math.random()*g:e)-j[M][1]}));if(this.run(m,F,I,_,D,M),d){B=Ib(c,u);const t={nodes:y,nodeSizeFunc:B,positions:F,radii:D,height:E,width:x,strictRadial:Boolean(h),focusIdx:M,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const n=Object.assign(Object.assign({},Rj),e),{positions:r,iterations:i,width:o,k:a,speed:s=100,strictRadial:l,focusIdx:c,radii:u=[],nodeSizeFunc:h}=n,d=t.getAllNodes(),f=[],p=o/10;for(let t=0;t<i;t++)r.forEach((t,e)=>{f[e]={x:0,y:0}}),Dj(d,r,f,a,u,h),Lj(r,f,s,l,c,p,o,u);return r})(e,t)}const z=[];F.forEach((t,e)=>{const n=Rb(y[e]);n.data.x=t.x+w[0],n.data.y=t.y+w[1],z.push(n)}),t&&z.forEach(t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}));return{nodes:z,edges:b}})}run(t,e,n,r,i,o){for(let a=0;a<=t;a++){const s=a/t;this.oneIteration(s,e,i,r,n,o)}}oneIteration(t,e,n,r,i,o){const a=1-t;e.forEach((s,l)=>{const c=Cb(s,{x:0,y:0}),u=0===c?0:1/c;if(l===o)return;let h=0,d=0,f=0;e.forEach((t,e)=>{if(l===e)return;const n=Cb(s,t),o=0===n?0:1/n,a=r[e][l];f+=i[l][e],h+=i[l][e]*(t.x+a*(s.x-t.x)*o),d+=i[l][e]*(t.y+a*(s.y-t.y)*o)});const p=0===n[l]?0:1/n[l];f*=a,f+=t*p*p,h*=a,h+=t*p*s.x*u,s.x=h/f,d*=a,d+=t*p*s.y*u,s.y=d/f})}}const jj=(t,e,n,r,i,o,a)=>{if(!t)return[];const s=[];if(e){const l={};e.forEach((e,c)=>{const u=[];e.forEach((e,s)=>{var h,d;if(c===s)u.push(0);else if(r[c]===r[s])if("data"===o)u.push(e*(Math.abs(c-s)*a)/(r[c]/i));else if(o){let n,f;if(l[t[c].id])n=l[t[c].id];else{const e=("id"===o?t[c].id:null===(h=t[c].data)||void 0===h?void 0:h[o])||0;n=ne(e)?e.charCodeAt(0):e,l[t[c].id]=n}if(l[t[s].id])f=l[t[s].id];else{const e=("id"===o?t[s].id:null===(d=t[s].data)||void 0===d?void 0:d[o])||0;f=ne(e)?e.charCodeAt(0):e,l[t[s].id]=f}u.push(e*(Math.abs(n-f)*a)/(r[c]/i))}else u.push(e*n/(r[c]/i));else{const t=(n+i)/2;u.push(e*t)}}),s.push(u)})}return s},Bj=t=>{const e=t.length,n=t[0].length,r=[];for(let i=0;i<e;i++){const e=[];for(let r=0;r<n;r++)0!==t[i][r]?e.push(1/(t[i][r]*t[i][r])):e.push(0);r.push(e)}return r},Fj=(t,e)=>{let n=-1;return t.forEach((t,r)=>{t.id===e&&(n=r)}),Math.max(n,0)},zj=(t,e,n)=>{const r=t.length;for(let i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(let o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(let n=0;n<r;n++)if(n!==e)for(let i=0;i<r;i++)if(t[n][i]===1/0){let r=Math.abs(t[e][n]-t[e][i]);r=0===r?1:r,t[n][i]=r}},Gj=(t,e)=>{let n=0;for(let r=0;r<t[e].length;r++)t[e][r]!==1/0&&(n=t[e][r]>n?t[e][r]:n);return n},Vj={center:[0,0],width:300,height:300};class Wj{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Vj),t)}execute(t,e){return Ge(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return Ge(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i,width:o,height:a}=r,s=e.getAllNodes(),l=o||"undefined"==typeof window?o:window.innerWidth,c=a||"undefined"==typeof window?a:window.innerHeight,u=i||[l/2,c/2],h=[];s&&s.forEach(t=>{h.push({id:t.id,data:{x:.9*(Math.random()-.5)*l+u[0],y:.9*(Math.random()-.5)*c+u[1]}})}),t&&h.forEach(t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}));return{nodes:h,edges:e.getAllEdges()}})}}
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/const Hj=Symbol("Comlink.proxy"),Uj=Symbol("Comlink.endpoint"),$j=Symbol("Comlink.releaseProxy"),Yj=Symbol("Comlink.finalizer"),qj=Symbol("Comlink.thrown"),Xj=t=>"object"==typeof t&&null!==t||"function"==typeof t,Kj=new Map([["proxy",{canHandle:t=>Xj(t)&&t[Hj],serialize(t){const{port1:e,port2:n}=new MessageChannel;return Zj(t,e),[n,[n]]},deserialize:t=>(t.start(),Jj(t))}],["throw",{canHandle:t=>Xj(t)&&qj in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function Zj(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(lB);let c;try{const e=s.slice(0,-1).reduce((t,e)=>t[e],t),n=s.reduce((t,e)=>t[e],t);switch(a){case"GET":c=n;break;case"SET":e[s.slice(-1)[0]]=lB(i.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[Hj]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;Zj(t,n),c=function(t,e){return aB.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[qj]:0}}Promise.resolve(c).catch(t=>({value:t,[qj]:0})).then(n=>{const[i,s]=sB(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),Qj(e),Yj in t&&"function"==typeof t[Yj]&&t[Yj]())}).catch(t=>{const[n,r]=sB({value:new TypeError("Unserializable return value"),[qj]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function Qj(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function Jj(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),iB(t,n,[],e)}function tB(t){if(t)throw new Error("Proxy has been released and is not useable")}function eB(t){return cB(t,new Map,{type:"RELEASE"}).then(()=>{Qj(t)})}const nB=new WeakMap,rB="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(nB.get(t)||0)-1;nB.set(t,e),0===e&&eB(t)});function iB(t,e,n=[],r=function(){}){let i=!1;const o=new Proxy(r,{get(r,a){if(tB(i),a===$j)return()=>{!function(t){rB&&rB.unregister(t)}(o),eB(t),e.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const r=cB(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(lB);return r.then.bind(r)}return iB(t,e,[...n,a])},set(r,o,a){tB(i);const[s,l]=sB(a);return cB(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:s},l).then(lB)},apply(r,o,a){tB(i);const s=n[n.length-1];if(s===Uj)return cB(t,e,{type:"ENDPOINT"}).then(lB);if("bind"===s)return iB(t,e,n.slice(0,-1));const[l,c]=oB(a);return cB(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(lB)},construct(r,o){tB(i);const[a,s]=oB(o);return cB(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:a},s).then(lB)}});return function(t,e){const n=(nB.get(e)||0)+1;nB.set(e,n),rB&&rB.register(t,e,t)}(o,t),o}function oB(t){const e=t.map(sB);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const aB=new WeakMap;function sB(t){for(const[e,n]of Kj)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},aB.get(t)||[]]}function lB(t){switch(t.type){case"HANDLER":return Kj.get(t.name).deserialize(t.value);case"RAW":return t.value}}function cB(t,e,n,r){return new Promise(i=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,i),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}class uB extends cv{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=Jj(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return Ge(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,r=ze(e,["onTick"]),i={};Object.keys(r).forEach(t=>{Ut(r[t])||(i[t]=r[t])});const o={layout:{id:this.layout.id,options:i,iterations:null===(t=this.options)||void 0===t?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},a=new Float32Array([0]),[s]=yield this.proxy.calculateLayout(o,[a]);return s})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[$j]()}isRunning(){return this.running}}class hB extends gv{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Ne(t)||t.length>2))return t[0]}formatSize(t){const e="function"==typeof t?t:()=>t;return t=>Jd(e(t))}doLayout(t,e){const{hGap:n,getRibSep:r,vGap:i,nodeSize:o,height:a}=e,{model:s}=this.context,l=this.formatSize(o);let c=l(t)[0]+r(t);const u=(t,e=0)=>{var r;return e+=n*((t.children||[]).length+1),null===(r=t.children)||void 0===r||r.forEach(t=>{var n;null===(n=s.getNodeLikeDatum(t).children)||void 0===n||n.forEach(t=>{const n=s.getNodeLikeDatum(t);e=u(n,e)})}),e},h=t=>{if(1===t.depth)return c;const e=s.getParentData(t.id,"tree");if(pB(t)){const r=s.getParentData(e.id,"tree"),o=p(t)-p(r);return h(e)+o*n/i}{const n=(e.children||[]).indexOf(t.id),r=s.getNodeData((e.children||[]).slice(n));return d(e)-r.reduce((t,e)=>t+u(e),0)-l(e)[0]/2}},d=Ee(t=>{if(fB(t))return l(t)[0]/2;const e=s.getParentData(t.id,"tree");if(pB(t))return h(t)+u(t)+l(t)[0]/2;{const r=p(t)-p(e),o=n/i;return h(t)+r*o}},t=>t.id),f=t=>p(s.getParentData(t,"tree")),p=Ee(t=>{if(fB(t))return a/2;if(pB(t)){const e=s.getParentData(t.id,"tree"),n=e.children.indexOf(t.id);if(0===n)return f(e.id)+i;const r=s.getNodeLikeDatum(e.children[n-1]);if(Ne(r.children))return p(r)+i;const o=s.getDescendantsData(r.id);return Math.max(...o.map(t=>pB(t)?f(t.id):p(t)))+i}{if(Ne(t.children))return f(t.id)+i;const e=s.getNodeLikeDatum(t.children.slice(-1)[0]);if(Ne(e.children))return p(e)+i;const n=s.getDescendantsData(t.id).slice(-1)[0];return(pB(n)?f(n.id):p(n))+i}},t=>t.id);let g=0;const v={nodes:[],edges:[]},m=t=>{var e;null===(e=t.children)||void 0===e||e.forEach(t=>m(s.getNodeLikeDatum(t)));const n=p(t),i=d(t);if(v.nodes.push({id:t.id,x:i,y:n}),fB(t))return;const o=s.getRelatedEdgesData(t.id,"in")[0],a=[h(t),pB(t)?n:f(t.id)];v.edges.push({id:Ih(o),controlPoints:[a],relatedNodeId:t.id}),g=Math.max(g,i+r(t)),1===t.depth&&(c=g)};return m(t),v}placeAlterative(t,e){const n=(e.children||[]).filter((t,e)=>e%2!=0);if(0===n.length)return t;const{model:r}=this.context,i=t.nodes.find(t=>t.id===e.id).y,o=t=>{const e=r.getAncestorsData(t,"tree");if(Ne(e))return!1;const i=1===e.length?t:e[e.length-2].id;return n.includes(i)};t.nodes.forEach(t=>{o(t.id)&&(t.y=2*i-t.y)}),t.edges.forEach(t=>{o(t.relatedNodeId)&&(t.controlPoints=t.controlPoints.map(t=>[t[0],2*i-t[1]]))})}rightToLeft(t,e){return t.nodes.forEach(t=>t.x=e.width-t.x),t.edges.forEach(t=>{t.controlPoints=t.controlPoints.map(t=>[e.width-t[0],t[1]])}),t}execute(t,e){return Ge(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},hB.defaultOptions),this.options),e),{direction:r,nodeSize:i}=n,o=this.getRoot();if(!o)return t;const a=this.formatSize(i);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(t=>a(t)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(t=>a(t)[0])));let s=this.doLayout(o,n);this.placeAlterative(s,o),"RL"===r&&(s=this.rightToLeft(s,n));const{model:l}=this.context,c=[],u=[];return s.nodes.forEach(t=>{const{id:e,x:n,y:r}=t,i=l.getNodeLikeDatum(e);c.push(dB(i,{x:n,y:r}))}),s.edges.forEach(t=>{const{id:e,controlPoints:n}=t,r=l.getEdgeDatum(e);u.push(dB(r,{controlPoints:n}))}),{nodes:c,edges:u}})}}hB.defaultOptions={direction:"RL",getRibSep:()=>60};const dB=(t,e)=>Object.assign(Object.assign({},t),{style:Object.assign(Object.assign({},t.style||{}),e)}),fB=t=>0===t.depth,pB=t=>(t.depth||(t.depth=0))%2==0;class gB extends gv{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n="function"==typeof e?e:()=>e;return t.reduce((t,e)=>{const[r,i]=Jd(n(e))||[0,0];return[Math.max(t[0],r),Math.max(t[1],i)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,r={},i={},o={};e.forEach(t=>{r[t.id]=0,i[t.id]=0,o[t.id]=[]}),n.forEach(t=>{r[t.target]++,i[t.source]++,o[t.source].push(t.target)});const a=new Set,s=t=>{a.has(t)||(a.add(t),o[t].forEach(s))};if(s(e[0].id),a.size!==e.length)return!1;const l=e.filter(t=>0===r[t.id]),c=e.filter(t=>0===i[t.id]);if(1!==l.length||1!==c.length)return!1;return e.filter(t=>1===r[t.id]&&1===i[t.id]).length===e.length-2}execute(t,e){return Ge(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:r,padding:i,sortBy:o,cols:a,colGap:s,rowGap:l,clockwise:c,width:u,height:h}=Object.assign({},gB.defaultOptions,this.options,e),[d,f,p,g]=ch(i),v=this.formatSize(t.nodes||[],r),m=Math.ceil((t.nodes||[]).length/a);let y=s||(u-g-f-a*v[0])/(a-1),b=l||(h-d-p-m*v[1])/(m-1);(b===1/0||b<0)&&(b=0),(y===1/0||y<0)&&(y=0);const x=o?null===(n=t.nodes)||void 0===n?void 0:n.sort(o):function(t){const{nodes:e=[],edges:n=[]}=t,r={},i={};e.forEach(t=>{r[t.id]=0,i[t.id]=[]}),n.forEach(t=>{r[t.target]++,i[t.source].push(t.target)});const o=[],a=[];e.forEach(t=>{0===r[t.id]&&o.push(t.id)});for(;o.length>0;){const t=o.shift(),n=e.find(e=>e.id===t);a.push(n),i[t].forEach(t=>{r[t]--,0===r[t]&&o.push(t)})}return a}(t),E=(x||[]).map((t,e)=>{const n=Math.floor(e/a),r=e%a,i=g+(c?n%2==0?r:a-1-r:n%2==0?a-1-r:r)*(v[0]+y)+v[0]/2,o=d+n*(v[1]+b)+v[1]/2;return{id:t.id,style:{x:i,y:o}}});return{nodes:E}})}}gB.defaultOptions={padding:0,cols:5,clockwise:!0};class vB extends Kh{}function mB(t,e=!0,n){const r=document.createElement("div");return r.setAttribute("class",`g6-${t}`),Object.assign(r.style,{position:"absolute",display:"block"}),e&&Object.assign(r.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),n&&Object.assign(r.style,n),r}function yB(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const a=document.createElement(e);return a.innerHTML=r,a.id=t,Object.assign(a.style,n),i.appendChild(a),a}class bB extends vB{constructor(t,e){super(t,Object.assign({},bB.defaultOptions,e)),this.$element=mB("background");this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Ge(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Re(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}function xB(t,e,n,r,i,o){const a=n-t,s=r-e;let l=i-t,c=o-e,u=l*a+c*s,h=0;u<=0?h=0:(l=a-l,c=s-c,u=l*a+c*s,h=u<=0?0:u*u/(a*a+s*s));const d=l*l+c*c-h;return d<0?0:d}function EB(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)}function wB(t,e,n,r,i){return EB(t,e,n,r)<i*i}function kB(t){const e=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2);return{x:e,y:r,x2:n,y2:i,width:n-e,height:i-r}}bB.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};class MB{constructor(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new MB(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2)return!1;if(e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2)return!1;if(t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;return t<=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1)}distSquare(t,e){return xB(this.x1,this.y1,this.x2,this.y2,t,e)}ptClose(t,e,n){if(this.x1<this.x2){if(t<this.x1-n||t>this.x2+n)return!1}else if(t<this.x2-n||t>this.x1+n)return!1;if(this.y1<this.y2){if(e<this.y1-n||e>this.y2+n)return!1}else if(e<this.y2-n||e>this.y1+n)return!1;return!0}}var SB,NB;!function(t){t[t.POINT=1]="POINT",t[t.PARALLEL=2]="PARALLEL",t[t.COINCIDENT=3]="COINCIDENT",t[t.NONE=4]="NONE"}(SB||(SB={}));class TB{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function OB(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const e=n/i,o=r/i;return 0<=e&&e<=1&&0<=o&&o<=1?new TB(SB.POINT,t.x1+e*(t.x2-t.x1),t.y1+e*(t.y2-t.y1)):new TB(SB.NONE)}return new TB(0===n||0===r?SB.COINCIDENT:SB.PARALLEL)}function CB(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const t=n/i,e=r/i;if(0<=t&&t<=1&&0<=e&&e<=1)return t}return Number.POSITIVE_INFINITY}function AB(t,e,n){const r=new Set;return t.width<=0?(r.add(NB.LEFT),r.add(NB.RIGHT)):e<t.x?r.add(NB.LEFT):e>t.x+t.width&&r.add(NB.RIGHT),t.height<=0?(r.add(NB.TOP),r.add(NB.BOTTOM)):n<t.y?r.add(NB.TOP):n>t.y+t.height&&r.add(NB.BOTTOM),r}function PB(t,e){let n=e.x1,r=e.y1;const i=e.x2,o=e.y2,a=Array.from(AB(t,i,o));if(0===a.length)return!0;let s=AB(t,n,r);for(;0!==s.size;){for(const t of a)if(s.has(t))return!1;if(s.has(NB.RIGHT)||s.has(NB.LEFT)){let e=t.x;s.has(NB.RIGHT)&&(e+=t.width),r+=(e-n)*(o-r)/(i-n),n=e}else{let e=t.y;s.has(NB.BOTTOM)&&(e+=t.height),n+=(e-r)*(i-n)/(o-r),r=e}s=AB(t,n,r)}return!0}function RB(t,e){let n=Number.POSITIVE_INFINITY,r=0;function i(t,i,o,a){let s=CB(e,new MB(t,i,o,a));s=Math.abs(s-.5),s>=0&&s<=1&&(r++,s<n&&(n=s))}return i(t.x,t.y,t.x2,t.y),i(t.x,t.y,t.x,t.y2),r>1?n:(i(t.x,t.y2,t.x2,t.y2),r>1?n:(i(t.x2,t.y,t.x2,t.y2),0===r?-1:n))}function DB(t,e){let n=0;const r=OB(t,new MB(e.x,e.y,e.x2,e.y));n+=r.state===SB.POINT?1:0;const i=OB(t,new MB(e.x,e.y,e.x,e.y2));n+=i.state===SB.POINT?1:0;const o=OB(t,new MB(e.x,e.y2,e.x2,e.y2));n+=o.state===SB.POINT?1:0;const a=OB(t,new MB(e.x2,e.y,e.x2,e.y2));return n+=a.state===SB.POINT?1:0,{top:r,left:i,bottom:o,right:a,count:n}}!function(t){t[t.LEFT=0]="LEFT",t[t.TOP=1]="TOP",t[t.RIGHT=2]="RIGHT",t[t.BOTTOM=3]="BOTTOM"}(NB||(NB={}));class LB{constructor(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r}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(t){return new LB(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new LB(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x+t.width),i=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=r-e,this.height=i-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x),i=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=r-e,this.height=i-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return!(this.area<=0||t.width<=0||t.height<=0)&&(t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2)}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=AB(this,t,e);return n.has(NB.TOP)?n.has(NB.LEFT)?EB(t,e,this.x,this.y):n.has(NB.RIGHT)?EB(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(NB.BOTTOM)?n.has(NB.LEFT)?EB(t,e,this.x,this.y2):n.has(NB.RIGHT)?EB(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(NB.LEFT)?(this.x-t)*(this.x-t):n.has(NB.RIGHT)?(t-this.x2)*(t-this.x2):0}}class _B{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return 2*this.radius}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return 2*this.radius}static from(t){return new _B(t.cx,t.cy,t.radius)}containsPt(t,e){return EB(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=EB(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const r=Math.sqrt(n)-this.radius;return r*r}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,2*Math.PI)}}class IB{constructor(t,e=0,n=0,r=0,i=0,o=10,a=10,s=new Float32Array(Math.max(0,o*a)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=r,this.pixelY=i,this.width=o,this.height=a,this.area=s}createSub(t,e){return new IB(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new IB(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new IB(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),r=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),i=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup));return new LB(e,n,r-e,i-n)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),r=this.boundX(t.x-n),i=this.boundY(t.y-n),o=this.boundX(t.x2+n),a=this.boundY(t.y2+n);return new LB(r,i,o-r,a-i)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||0===e)return;const n=this.width,r=t.width,i=Math.max(0,t.i),o=Math.max(0,t.j),a=Math.min(t.i+t.width,n),s=Math.min(t.j+t.height,this.height);if(!(s<=0||a<=0||i>=n||s>=this.height))for(let l=o;l<s;l++){const o=(l-t.j)*r,s=l*n;for(let n=i;n<a;n++){const r=t.area[n-t.i+o];0!==r&&(this.area[n+s]+=e*r)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let r=0;r<t.height;r++){const i=n+r*this.width;this.area.fill(e,i,i+t.width)}}fillHorizontalLine(t,e,n,r){const i=t+e*this.width;this.area.fill(r,i,i+n)}fillVerticalLine(t,e,n,r){const i=t+e*this.width;for(let t=0;t<n;t++)this.area[i+t*this.width]=r}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let e=0;e<this.width;e++){t+=this.area[n+e].toFixed(1).padStart(6),t+=" "}t+="\n"}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce((t,e)=>Math.min(t,e),Number.POSITIVE_INFINITY),r=this.area.reduce((t,e)=>Math.max(t,e),Number.NEGATIVE_INFINITY),i=t=>(t-n)/(r-n);t.scale(this.pixelGroup,this.pixelGroup);for(let e=0;e<this.width;e++)for(let n=0;n<this.height;n++){const r=this.area[e+n*this.width];t.fillStyle=`rgba(0, 0, 0, ${i(r)})`,t.fillRect(e,n,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let n=0;n<this.width;n++)for(let r=0;r<this.height;r++){const i=this.area[n+r*this.width];t.fillStyle=i>e?"black":"white",t.fillRect(n,r,1,1)}t.restore()}}}function jB(t,e){const n=t=>({x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e});return Array.isArray(t)?t.map(n):n(t)}function BB(t,e,n){return FB(Object.assign(kB(t),{distSquare:(e,n)=>xB(t.x1,t.y1,t.x2,t.y2,e,n)}),e,n)}function FB(t,e,n){const r=jB(t,n),i=e.scale(r),o=e.createSub(i,r);return function(t,e,n,r){const i=n*n;for(let o=0;o<t.height;o++)for(let a=0;a<t.width;a++){const s=r(e.invertScaleX(t.i+a),e.invertScaleY(t.j+o));if(0!==s){if(s<i){const e=n-Math.sqrt(s);t.set(a,o,e*e)}}else t.set(a,o,i)}}(o,e,n,(e,n)=>t.distSquare(e,n)),o}function zB(t,e){return{x:t,y:e}}function GB(t,e,n,r){if(0===t.length)return[];const i=function(t){if(t.length<2)return t;let e=0,n=0;return t.forEach(t=>{e+=t.cx,n+=t.cy}),e/=t.length,n/=t.length,t.map(t=>{const r=e-t.cx,i=n-t.cy;return[t,r*r+i*i]}).sort((t,e)=>t[1]-e[1]).map(t=>t[0])}(t);return i.map((t,o)=>{const a=i.slice(0,o);return function(t,e,n,r,i){const o=zB(e.cx,e.cy),a=function(t,e,n){let r=Number.POSITIVE_INFINITY;return e.reduce((e,i)=>{const o=EB(t.x,t.y,i.cx,i.cy);if(o>r)return e;const a=new MB(t.x,t.y,i.cx,i.cy),s=function(t,e){return t.reduce((t,n)=>PB(n,e)&&function(t,e){function n(t,n,r,i){let o=CB(e,new MB(t,n,r,i));return o=Math.abs(o-.5),o>=0&&o<=1?1:0}let r=n(t.x,t.y,t.x2,t.y);return r+=n(t.x,t.y,t.x,t.y2),r>1||(r+=n(t.x,t.y2,t.x2,t.y2),r>1||(r+=n(t.x2,t.y,t.x2,t.y2),r>0))}(n,e)?t+1:t,0)}(n,a);return o*(s+1)*(s+1)<r&&(e=i,r=o*(s+1)*(s+1)),e},null)}(o,n,t);if(null==a)return[];const s=function(t,e,n,r){const i=[],o=[];o.push(t);let a=!0;for(let t=0;t<n&&a;t++)for(a=!1;!a&&o.length>0;){const t=o.pop(),n=HB(e,t),s=n?DB(t,n):null;if(!n||!s||2!==s.count){a||i.push(t);continue}let l=r,c=UB(n,l,s,!0),u=WB(c,o)||WB(c,i),h=VB(c,e);for(;!u&&h&&l>=1;)l/=1.5,c=UB(n,l,s,!0),u=WB(c,o)||WB(c,i),h=VB(c,e);if(!c||u||h||(o.push(new MB(t.x1,t.y1,c.x,c.y)),o.push(new MB(c.x,c.y,t.x2,t.y2)),a=!0),a)continue;l=r,c=UB(n,l,s,!1);let d=WB(c,o)||WB(c,i);for(h=VB(c,e);!d&&h&&l>=1;)l/=1.5,c=UB(n,l,s,!1),d=WB(c,o)||WB(c,i),h=VB(c,e);c&&!d&&(o.push(new MB(t.x1,t.y1,c.x,c.y)),o.push(new MB(c.x,c.y,t.x2,t.y2)),a=!0),a||i.push(t)}for(;o.length>0;)i.push(o.pop());return i}(new MB(o.x,o.y,a.cx,a.cy),t,r,i);return function(t,e){const n=[];for(;t.length>0;){const r=t.pop();if(0===t.length){n.push(r);break}const i=t.pop(),o=new MB(r.x1,r.y1,i.x2,i.y2);HB(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(s,t)}(e,t,a,n,r)}).flat()}function VB(t,e){return e.some(e=>e.containsPt(t.x,t.y))}function WB(t,e){return e.some(e=>!!wB(e.x1,e.y1,t.x,t.y,.001)||!!wB(e.x2,e.y2,t.x,t.y,.001))}function HB(t,e){let n=Number.POSITIVE_INFINITY,r=null;for(const i of t){if(!PB(i,e))continue;const t=RB(i,e);t>=0&&t<n&&(r=i,n=t)}return r}function UB(t,e,n,r){const i=n.top,o=n.left,a=n.bottom,s=n.right;if(r){if(o.state===SB.POINT){if(i.state===SB.POINT)return zB(t.x-e,t.y-e);if(a.state===SB.POINT)return zB(t.x-e,t.y2+e);const n=t.width*t.height;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?zB(t.x-e,t.y-e):zB(t.x2+e,t.y-e):o.y<s.y?zB(t.x-e,t.y2+e):zB(t.x2+e,t.y2+e)}if(s.state===SB.POINT){if(i.state===SB.POINT)return zB(t.x2+e,t.y-e);if(a.state===SB.POINT)return zB(t.x2+e,t.y2+e)}const n=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*n?i.x>a.x?zB(t.x-e,t.y-e):zB(t.x-e,t.y2+e):i.x<a.x?zB(t.x2+e,t.y-e):zB(t.x2+e,t.y2+e)}if(o.state===SB.POINT){if(i.state===SB.POINT)return zB(t.x2+e,t.y2+e);if(a.state===SB.POINT)return zB(t.x2+e,t.y-e);const n=t.height*t.width;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?zB(t.x2+e,t.y2+e):zB(t.x-e,t.y2+e):o.y<s.y?zB(t.x2+e,t.y-e):zB(t.x-e,t.y-e)}if(s.state===SB.POINT){if(i.state===SB.POINT)return zB(t.x-e,t.y2+e);if(a.state===SB.POINT)return zB(t.x-e,t.y-e)}const l=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*l?i.x>a.x?zB(t.x2+e,t.y2+e):zB(t.x2+e,t.y-e):i.x<a.x?zB(t.x-e,t.y2+e):zB(t.x-e,t.y-e)}function $B(t,e,n,r){if(!(t.closed?n<t.length:n<t.length-1))return!1;const i=t.get(e),o=t.get(n+1);for(let a=e+1;a<=n;a++){const e=t.get(a);if(xB(i.x,i.y,o.x,o.y,e.x,e.y)>r)return!1}return!0}function YB(t,e){switch(t){case-2:return(((3-e)*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")}}class qB{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(0===e.length)return"";const n="function"==typeof t?t:function(t){if(!Number.isFinite(t))return t=>t;if(0===t)return Math.round;const e=Math.pow(10,t);return t=>Math.round(t*e)/e}(t);let r="M";for(const t of e)r+=`${n(t.x)},${n(t.y)} L`;return r=r.slice(0,-1),this.closed&&(r+=" Z"),r}draw(t){const e=this.points;if(0!==e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return function(t=8){return e=>{let n=t,r=e.length;if(n>1)for(r=Math.floor(e.length/n);r<3&&n>1;)n-=1,r=Math.floor(e.length/n);const i=[];for(let t=0,o=0;o<r;o++,t+=n)i.push(e.get(t));return new qB(i)}}(t)(this)}simplify(t){return function(t=0){return e=>{if(t<0||e.length<3)return e;const n=[];let r=0;const i=t*t;for(;r<e.length;){let t=r+1;for(;$B(e,r,t,i);)t++;n.push(e.get(r)),r=t}return new qB(n)}}(t)(this)}bSplines(t){return function(t=6){function e(t,e,n){let r=0,i=0;for(let o=-2;o<=1;o++){const a=t.get(e+o),s=YB(o,n);r+=s*a.x,i+=s*a.y}return{x:r,y:i}}return n=>{if(n.length<3)return n;const r=[],i=n.closed,o=n.length+3-1+(i?0:2);r.push(e(n,2-(i?0:2),0));for(let a=2-(i?0:2);a<o;a++)for(let i=1;i<=t;i++)r.push(e(n,a,i/t));return new qB(r)}}(t)(this)}apply(t){return t(this)}containsElements(t){const e=function(t){if(0===t.length)return null;const e=t[0],n=new LB(e.x,e.y,0,0);for(const e of t)n.addPoint(e);return n}(this.points);return!!e&&t.every(t=>e.containsPt(t.cx,t.cy)&&this.withinArea(t.cx,t.cy))}withinArea(t,e){if(0===this.length)return!1;let n=0;const r=this.points[0],i=new MB(r.x,r.y,r.x,r.y);for(let r=1;r<this.points.length;r++){const o=this.points[r];i.x1=i.x2,i.y1=i.y2,i.x2=o.x,i.y2=o.y,i.cuts(t,e)&&n++}return i.x1=i.x2,i.y1=i.y2,i.x2=r.x,i.y2=r.y,i.cuts(t,e)&&n++,n%2==1}}class XB{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(0===this.count)return!1;const e=this.arr[0];return null!=e&&e.x===t.x&&e.y===t.y}path(){return new qB(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}function KB(t,e){const n=2*(Math.floor(t.width)+Math.floor(t.height)),r=new XB(n);function i(n,r,i,o){const a=t.get(n,r);return Number.isNaN(a)?Number.NaN:a>e?i+o:i}function o(t,e){let n=0;return n=i(t,e,n,1),n=i(t+1,e,n,2),n=i(t,e+1,n,4),n=i(t+1,e+1,n,8),Number.isNaN(n)?-1:n}let a=1;function s(e,n){let i=e,s=n,l=t.invertScaleX(i),c=t.invertScaleY(s);for(let e=0;e<t.width*t.height;e++){const e={x:l,y:c};if(r.contains(e)){if(r.isFirst(e))return!0}else r.add(e);const n=o(i,s);switch(n){case-1:return!0;case 0:case 3:case 2:case 7:a=2;break;case 12:case 14:case 4:a=3;break;case 6:a=0===a?3:2;break;case 1:case 13:case 5:a=0;break;case 9:a=2===a?0:1;break;case 10:case 8:case 11:a=1;break;default:return console.warn("Marching squares invalid state: "+n),!0}switch(a){case 0:s--,c-=t.pixelGroup;break;case 1:s++,c+=t.pixelGroup;break;case 3:i--,l-=t.pixelGroup;break;case 2:i++,l+=t.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+n),!0}}return!0}for(let n=0;n<t.width;n++)for(let i=0;i<t.height;i++){if(t.get(n,i)<=e)continue;const a=o(n,i);if(!(a<0||15===a)&&s(n,i))return r.path()}return null}const ZB={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 QB(t){return null!=t&&"number"==typeof t.radius}function JB(t,e){if(QB(t)!==QB(e))return!1;if(QB(t)){const n=e;return t.cx===n.cx&&t.cy===n.cy&&t.radius===n.radius}const n=e;return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}var tF;!function(t){t[t.MEMBERS=0]="MEMBERS",t[t.NON_MEMBERS=1]="NON_MEMBERS",t[t.EDGES=2]="EDGES"}(tF||(tF={}));let eF=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new LB(0,0,0,0),this.potentialArea=new IB(1,0,0,0,0,0,0),this.o=Object.assign({},ZB,t)}pushMember(...t){if(0!==t.length){this.dirty.add(tF.MEMBERS);for(const e of t)this.members.push({raw:e,obj:QB(e)?_B.from(e):LB.from(e),area:null})}}removeMember(t){const e=this.members.findIndex(e=>JB(e.raw,t));return!(e<0)&&(this.members.splice(e,1),this.dirty.add(tF.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(e=>JB(e.raw,t));return!(e<0)&&(this.nonMembers.splice(e,1),this.dirty.add(tF.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex(e=>e.obj.equals(t));return!(e<0)&&(this.edges.splice(e,1),this.dirty.add(tF.NON_MEMBERS),!0)}pushNonMember(...t){if(0!==t.length){this.dirty.add(tF.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:QB(e)?_B.from(e):LB.from(e),area:null})}}pushEdge(...t){if(0!==t.length){this.dirty.add(tF.EDGES);for(const e of t)this.edges.push({raw:e,obj:MB.from(e),area:null})}}update(){const t=this.dirty.has(tF.MEMBERS),e=this.dirty.has(tF.NON_MEMBERS);let n=this.dirty.has(tF.EDGES);this.dirty.clear();const r=this.members.map(t=>t.obj);if(this.o.virtualEdges&&(t||e)){const t=GB(r,this.nonMembers.map(t=>t.obj),this.o.maxRoutingIterations,this.o.morphBuffer),e=new Map(this.virtualEdges.map(t=>[t.obj.toString(),t.area]));this.virtualEdges=t.map(t=>{var n;return{raw:t,obj:t,area:null!==(n=e.get(t.toString()))&&void 0!==n?n:null}}),n=!0}let i=!1;if(t||n){const t=function(t,e){if(0===t.length)return new LB(0,0,0,0);const n=LB.from(t[0]);for(const e of t)n.add(e);for(const t of e)n.add(kB(t));return n}(r,this.virtualEdges.concat(this.edges).map(t=>t.obj)),e=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,n=LB.from(jB(t,e));n.equals(this.activeRegion)||(i=!0,this.activeRegion=n)}if(i){const t=Math.ceil(this.activeRegion.width/this.o.pixelGroup),e=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=IB.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(t=>t.area=null),this.nonMembers.forEach(t=>t.area=null),this.edges.forEach(t=>t.area=null),this.virtualEdges.forEach(t=>t.area=null)):t===this.potentialArea.width&&e===this.potentialArea.height||(this.potentialArea=IB.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const o=new Map,a=t=>{if(t.area){const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof LB?"R":"C"}`;o.set(e,t.area)}},s=t=>{if(t.area)return;const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof LB?"R":"C"}`;if(o.has(e)){const n=o.get(e);return void(t.area=this.potentialArea.copy(n,{x:t.obj.x-this.o.nodeR1,y:t.obj.y-this.o.nodeR1}))}const n=t.obj instanceof LB?function(t,e,n){const r=e.scale(t),i=e.addPadding(r,n),o=e.createSub(i,{x:t.x-n,y:t.y-n}),a=r.x-i.x,s=r.y-i.y,l=i.x2-r.x2,c=i.y2-r.y2,u=i.width-a-l,h=i.height-s-c,d=n*n;o.fillArea({x:a,y:s,width:u+1,height:h+1},d);const f=[0],p=Math.max(s,a,l,c);{const i=e.invertScaleX(r.x+r.width/2);for(let o=1;o<p;o++){const a=e.invertScaleY(r.y-o),s=t.distSquare(i,a);if(!(s<d))break;{const t=n-Math.sqrt(s);f.push(t*t)}}}const g=[],v=Math.max(a,l),m=Math.max(s,l);for(let i=1;i<v;i++){const o=e.invertScaleX(r.x-i),a=[];for(let i=1;i<m;i++){const s=e.invertScaleY(r.y-i),l=t.distSquare(o,s);if(l<d){const t=n-Math.sqrt(l);a.push(t*t)}else a.push(0)}g.push(a)}for(let t=1;t<Math.min(s,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s-t,u+1,e)}for(let t=1;t<Math.min(c,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s+h+t,u+1,e)}for(let t=1;t<Math.min(a,f.length);t++){const e=f[t];o.fillVerticalLine(a-t,s,h+1,e)}for(let t=1;t<Math.min(c,f.length);t++){const e=f[t];o.fillVerticalLine(a+u+t,s,h+1,e)}for(let t=1;t<a;t++){const e=g[t-1],n=a-t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<c;t++)o.set(n,s+h+t,e[t-1])}for(let t=1;t<l;t++){const e=g[t-1],n=a+u+t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<c;t++)o.set(n,s+h+t,e[t-1])}return o}(t.obj,this.potentialArea,this.o.nodeR1):FB(t.obj,this.potentialArea,this.o.nodeR1);t.area=n,o.set(e,n)};this.members.forEach(a),this.nonMembers.forEach(a),this.members.forEach(s),this.nonMembers.forEach(t=>{this.activeRegion.intersects(t.obj)?s(t):t.area=null}),this.edges.forEach(t=>{t.area||(t.area=BB(t.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(t=>{t.area||(t.area=BB(t.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(0===this.members.length)return new qB([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map(t=>t.area),r=this.virtualEdges.concat(this.edges).map(t=>t.area),i=this.nonMembers.filter(t=>null!=t.area).map(t=>t.area),o=this.members.map(t=>t.obj);return function(t,e,n,r,i,o={}){const a=Object.assign({},ZB,o);let s=a.threshold,l=a.memberInfluenceFactor,c=a.edgeInfluenceFactor,u=a.nonMemberInfluenceFactor;const h=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),d=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1);for(let o=0;o<a.maxMarchingIterations;o++){if(t.clear(),0!==l){const n=l/h;for(const r of e)t.incArea(r,n)}if(0!==c){const e=c/d;for(const r of n)t.incArea(r,e)}if(0!==u){const e=u/h;for(const n of r)t.incArea(n,e)}const f=KB(t,s);if(f&&i(f))return f;if(s*=.95,o<=.5*a.maxMarchingIterations)l*=1.2,c*=1.2;else{if(!(0!==u&&r.length>0))break;u*=.8}}return new qB([])}(e,n,r,i,t=>t.containsElements(o),t)}};class nF extends vB{constructor(t,e){super(t,Me({},nF.defaultOptions,e)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:t,bubbleSetOptions:e}=this.parseOptions();Te(this.bubbleSetOptions,e)||this.init(),this.bubbleSetOptions=Object.assign({},e);const n=Object.assign(Object.assign({},t),{d:this.getPath()});this.shape?this.shape.update(n):(this.shape=new gf({style:n}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=t=>{if(!this.shape)return;const e=Ih(t.data);[...this.options.members,...this.options.avoidMembers].includes(e)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(e)}))},this.getPath=t=>{const{graph:e}=this.context,n=this.options.members,r=[...this.members.keys()],i=this.options.avoidMembers,o=[...this.avoidMembers.keys()];if(!t&&Te(n,r)&&Te(i,o))return this.path;const{enter:a=[],exit:s=[]}=Yh(r,n,t=>t),{enter:l=[],exit:c=[]}=Yh(o,i,t=>t);t&&(s.push(t),a.push(t));const u=(t,n,r)=>{t.forEach(t=>{const i=r?this.members:this.avoidMembers,o=r?"pushMember":"pushNonMember",a=r?"removeMember":"removeNonMember";if(n){let n;"edge"===e.getElementType(t)?([n]=iF(e,t),this.bubbleSets.pushEdge(n)):([n]=rF(e,t),this.bubbleSets[o](n)),i.set(t,n)}else{const n=i.get(t);n&&("edge"===e.getElementType(t)?this.bubbleSets.removeEdge(n):this.bubbleSets[a](n),i.delete(t))}})};u(s,!1,!0),u(a,!0,!0),u(c,!1,!1),u(l,!0,!1);const h=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=pf(h.points.map(Ed)),this.path},this.bindEvents(),this.bubbleSets=new eF(this.options)}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new eF(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const t=this.options,{type:e,key:n,members:r,avoidMembers:i}=t,o=ze(t,["type","key","members","avoidMembers"]),a=Object.keys(o).reduce((t,e)=>(e in ZB?t.bubbleSetOptions[e]=o[e]:t.style[e]=o[e],t),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:r,avoidMembers:i},a)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(t=>this.options.avoidMembers.includes(t))&&(this.options.avoidMembers=this.options.avoidMembers.filter(t=>!e.includes(t))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(t=>!e.includes(t)),this.drawBubbleSets()}updateMember(t){this.options.members=Ut(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(t=>this.options.members.includes(t))&&(this.options.members=this.options.members.filter(t=>!e.includes(t))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(t=>e.includes(t))&&(this.options.avoidMembers=this.options.avoidMembers.filter(t=>!e.includes(t)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}nF.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},ZB);const rF=(t,e)=>(Array.isArray(e)?e:[e]).map(e=>{const n=t.getElementRenderBounds(e);return new LB(n.min[0],n.min[1],hh(n),dh(n))}),iF=(t,e)=>(Array.isArray(e)?e:[e]).map(e=>{const n=t.getEdgeData(e),r=t.getElementPosition(n.source),i=t.getElementPosition(n.target);return MB.from({x1:r[0],y1:r[1],x2:i[0],y2:i[1]})});class oF extends vB{constructor(t,e){super(t,Object.assign({},oF.defaultOptions,e)),this.targetElement=null,this.onTriggerEvent=t=>{var e;null===(e=t.preventDefault)||void 0===e||e.call(t),this.show(t)},this.onMenuItemClick=t=>{const{onClick:e,trigger:n}=this.options;if(t.target instanceof HTMLElement&&t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");null==e||e(n,t.target,this.targetElement),this.hide()}"click"!==n&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=mB("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t);this.context.canvas.getContainer().appendChild(this.$element),yB("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow: hidden;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head)}show(t){return Ge(this,void 0,void 0,function*(){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hide();const r=yield this.getDOMContent(t);r instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(r)):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-i.left+n[0]}px`,this.$element.style.top=`${t.client.y-i.top+n[1]}px`,this.$element.style.display="block",this.targetElement=t.target})}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return Ge(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(yield n(t)).map(t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`).join("")}\n </ul>\n `:yield e(t)})}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}}oF.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class aF extends vB{constructor(t,e){super(t,Object.assign({},aF.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:t,element:e}=this.context,n=t.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:r,iterRate:i,divRate:o}=this.options;let{lambda:a,divisions:s,iterations:l}=this.options;for(let t=0;t<r;t++){for(let t=0;t<l;t++){const t={};n.forEach(e=>{var n;if(e.source===e.target)return;const r=Ih(e);t[r]=this.getEdgeForces(e,s,a);for(let e=0;e<s+1;e++)(n=this.edgePoints)[r]||(n[r]=[]),this.edgePoints[r][e]=td(this.edgePoints[r][e],t[r][e])})}a/=2,s*=o,l*=i,this.divideEdges(s)}n.forEach(t=>{const n=Ih(t),r=e.getElement(n);null==r||r.update({d:vg(this.edgePoints[n])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(t=>[Ih(t),hd(yd(t))]))}divideEdges(t){this.context.model.getEdgeData().forEach(e=>{var n;const r=Ih(e);(n=this.edgePoints)[r]||(n[r]=[]);const i=this.nodeMap[e.source],o=this.nodeMap[e.target];if(1===t)this.edgePoints[r].push(i),this.edgePoints[r].push(rd(td(i,o),2)),this.edgePoints[r].push(o);else{const e=(0===this.edgePoints[r].length?od(i,o):fF(this.edgePoints[r]))/(t+1);let n=e;const a=[i];for(let t=1;t<this.edgePoints[r].length;t++){const i=this.edgePoints[r][t-1],o=this.edgePoints[r][t];let s=od(o,i);for(;s>n;){const t=n/s,r=td(i,nd(ed(o,i),t));a.push(r),s-=n,n=e}n-=s}a.push(o),this.edgePoints[r]=a}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[r,i]=ed(n,e);return{source:e,target:n,vx:r,vy:i,length:od(e,n)}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),r=this.getVectorPosition(e);return sF(n,r)*lF(n,r)*cF(n,r)*dF(n,r)}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((r,i)=>{n.forEach((n,o)=>{var a,s;if(o<=i)return;this.measureEdgeCompatibility(r,n)>=e&&(t[a=Ih(r)]||(t[a]=[]),t[Ih(r)].push(n),t[s=Ih(n)]||(t[s]=[]),t[Ih(n)].push(r))})}),t}getSpringForce(t,e){const{pre:n,cur:r,next:i}=t;return nd(ed(td(n,i),nd(r,2)),e)}getElectrostaticForce(t,e){Ne(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[Ih(e)];let r=[0,0];return null==n||n.forEach(n=>{const i=this.edgePoints[Ih(n)][t],o=this.edgePoints[Ih(e)][t],a=ed(i,o),s=od(i,o);r=td(r,nd(a,1/s))}),r}getEdgeForces(t,e,n){const r=this.nodeMap[t.source],i=this.nodeMap[t.target],o=this.options.K/(od(r,i)*(e+1)),a=[[0,0]],s=Ih(t);for(let r=1;r<e;r++){const e=this.getSpringForce({pre:this.edgePoints[s][r-1],cur:this.edgePoints[s][r],next:this.edgePoints[s][r+1]||[0,0]},o),i=this.getElectrostaticForce(r,t);a.push(nd(td(e,i),n))}return a.push([0,0]),a}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}aF.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const sF=(t,e)=>Math.abs(function(t,e){return t.reduce((t,n,r)=>t+n*e[r],0)}([t.vx,t.vy],[e.vx,e.vy])/(t.length*e.length)),lF=(t,e)=>{const n=(t.length+e.length)/2;return 2/(n/Math.min(t.length,e.length)+Math.max(t.length,e.length)/n)},cF=(t,e)=>{const n=(t.length+e.length)/2;return n/(n+od(rd(td(t.source,t.target),2),rd(td(e.source,e.target),2)))},uF=(t,e)=>{if(e.source[0]===e.target[0])return[e.source[0],t[1]];if(e.source[1]===e.target[1])return[t[0],e.source[1]];const n=(e.source[1]-e.target[1])/(e.source[0]-e.target[0]),r=(n*n*e.source[0]+n*(t[1]-e.source[1])+t[0])/(n*n+1);return[r,n*(r-e.source[0])+e.source[1]]},hF=(t,e)=>{const n=uF(e.source,t),r=uF(e.target,t),i=rd(td(n,r),2),o=rd(td(t.source,t.target),2);return 0===od(n,r)?0:Math.max(0,1-2*od(o,i)/od(n,r))},dF=(t,e)=>Math.min(hF(t,e),hF(e,t)),fF=t=>{let e=0;for(let n=1;n<t.length;n++)e+=od(t[n],t[n-1]);return e},pF={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0};class gF extends vB{constructor(t,e){super(t,Object.assign({},gF.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=Ed(t.canvas);this.renderLens(e),this.renderFocusElements()},this.renderLens=t=>{const e=Object.assign({},pF,this.options.style);this.isLensOn||(this.lens=new Mf({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,wd(t),{size:2*this.r}),this.lens.update(e)},this.getFilterData=()=>{const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:r,edges:i,combos:o}=n;return{nodes:r.filter(e=>t(Ih(e),"node")),edges:i.filter(e=>t(Ih(e),"edge")),combos:o.filter(e=>t(Ih(e),"combo"))}},this.getFocusElements=t=>{const{nodes:e,edges:n}=this.getFilterData(),r=e.filter(e=>od(yd(e),t)<this.r),i=r.map(t=>Ih(t));return{nodes:r,edges:n.filter(t=>{const{source:e,target:n}=t,r=i.includes(e),o=i.includes(n);switch(this.options.nodeType){case"both":return r&&o;case"either":return r!==o;case"source":return r&&!o;case"target":return!r&&o;default:return!1}})}},this.renderFocusElements=()=>{const{element:t,graph:e}=this.context;if(!this.isLensOn)return;const n=this.lens.getCenter(),{nodes:r,edges:i}=this.getFocusElements(n),o=new Set,a=n=>{const r=Ih(n);o.add(r);const i=t.getElement(r);if(!i)return;const a=this.shapes.get(r)||i.cloneNode();a.setPosition(i.getPosition()),a.id=i.id,this.shapes.has(r)?Object.entries(i.attributes).forEach(([t,e])=>{a.style[t]!==e&&(a.style[t]=e)}):(this.canvas.appendChild(a),this.shapes.set(r,a));const s=e.getElementType(r),l=this.getElementStyle(s,n);a.update(l)};r.forEach(a),i.forEach(a),this.shapes.forEach((t,e)=>{o.has(e)||(t.destroy(),this.shapes.delete(e))})},this.scaleRByWheel=t=>{var e;this.options.preventDefault&&t.preventDefault();const{clientX:n,clientY:r,deltaX:i,deltaY:o}=t,{graph:a,canvas:s}=this.context,l=a.getCanvasByClient([n,r]),c=null===(e=this.lens)||void 0===e?void 0:e.getCenter();if(!this.isLensOn||od(l,c)>this.r)return;const{maxR:u,minR:h}=this.options,d=i+o>0?1/.95:.95,f=Math.min(...s.getSize())/2;this.r=Math.max(h||0,Math.min(u||f,this.r*d)),this.renderLens(c),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=t=>{var e;const n=Ed(t.canvas),r=null===(e=this.lens)||void 0===e?void 0:e.getCenter();!this.isLensOn||od(n,r)>this.r||(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=Ed(t.canvas);this.renderLens(e),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n="node"===t?this.options.nodeStyle:this.options.edgeStyle;return"function"==typeof n?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.addEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.addEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.addEventListener(t.CommonEvent.DRAG,this.onDrag),o.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.removeEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.removeEventListener(t.CommonEvent.DRAG,this.onDrag),o.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel))}update(t){var e;this.unbindEvents(),super.update(t),this.r=null!==(e=t.r)&&void 0!==e?e:this.r,this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}gF.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const vF={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12};class mF extends vB{constructor(t,e){super(t,Object.assign({},mF.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=Ed(t.canvas);this.onMagnify(e)},this.onMagnify=t=>{t.some(isNaN)||(this.renderLens(t),this.renderFocusElements())},this.renderLens=t=>{const e=Object.assign({},vF,this.options.style);this.isLensOn||(this.lens=new Mf({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,wd(t),{size:2*this.r,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(e)},this.getDPercent=()=>{const{minD:t,maxD:e}=this.options;return`${Math.round((this.d-t)/(e-t)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:t}=this.context,e=this.lens.getCenter(),n=(this.d+1)*this.r,r=new Map,i=new Map;t.getNodeData().forEach(o=>{const a=yd(o),s=od(a,e);if(s>this.r)return;const l=n*s/(this.d*s+this.r),[c,u]=a,[h,d]=e,f=[h+l*((c-h)/s),d+l*((u-d)/s)],p=Ih(o),g=this.getNodeStyle(o),v=Pe(t.getElementRenderStyle(p),Object.keys(g));r.set(p,Object.assign(Object.assign({},wd(f)),g)),i.set(p,Object.assign(Object.assign({},wd(a)),v))}),this.updateStyle(r,i)},this.getNodeStyle=t=>{const{nodeStyle:e}=this.options;return"function"==typeof e?e(t):e},this.updateStyle=(t,e)=>{const{graph:n,element:r}=this.context,{enter:i,exit:o,keep:a}=Yh(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(t.keys()),t=>t),s=new Set,l=(t,e)=>{const i=r.getElement(t);null==i||i.update(e),n.getRelatedEdgesData(t).forEach(t=>{s.add(Ih(t))})};[...i,...a].forEach(e=>{l(e,t.get(e))}),o.forEach(t=>{l(t,this.prevOriginStyleMap.get(t)),this.prevOriginStyleMap.delete(t)}),s.forEach(t=>{const e=r.getElement(t);null==e||e.update({})}),this.prevMagnifiedStyleMap=t,e.forEach((t,e)=>{this.prevOriginStyleMap.has(e)||this.prevOriginStyleMap.set(e,t)})},this.isWheelValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;const{clientX:e,clientY:n}=t;return!(od(this.context.graph.getCanvasByClient([e,n]),this.lens.getCenter())>this.r)},this.scaleR=t=>{const{maxR:e,minR:n}=this.options,r=t?1/.95:.95,i=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(n||0,Math.min(e||i,this.r*r))},this.scaleD=t=>{const{maxD:e,minD:n}=this.options,r=t?this.d+.1:this.d-.1;this.d=Math.max(n,Math.min(e,r))},this.scaleRByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleR(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleD(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.isDragValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;return!(od(Ed(t.canvas),this.lens.getCenter())>this.r)},this.isLensDragging=!1,this.onDragStart=t=>{this.isDragValid(t)&&(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=Ed(t.canvas);this.onMagnify(e)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleR(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleD(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,a=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&a.addEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&a.addEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){a.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),a.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;a.addEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,n,{passive:!1})}}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,a=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&a.removeEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&a.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){a.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),a.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;a.removeEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,n)}}update(t){var e,n;this.unbindEvents(),super.update(t),this.r=null!==(e=t.r)&&void 0!==e?e:this.r,this.d=null!==(n=t.d)&&void 0!==n?n:this.d,this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&(null===(t=this.lens)||void 0===t||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}mF.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class yF extends vB{constructor(t,e){super(t,Object.assign({},yF.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var t,e,n,r;const i=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(i),i?null===(e=(t=this.options).onEnter)||void 0===e||e.call(t):null===(r=(n=this.options).onExit)||void 0===r||r.call(n)},this.shortcut=new jd(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML="\n :not(:root):fullscreen::backdrop {\n background: transparent;\n }\n "}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit);["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(t=>{document.addEventListener(t,this.onFullscreenChange,!1)})}unbindEvents(){this.shortcut.unbindAll();["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(t=>{document.removeEventListener(t,this.onFullscreenChange,!1)})}setGraphSize(t=!0){var e,n;let r,i;t?(r=(null===(e=globalThis.screen)||void 0===e?void 0:e.width)||0,i=(null===(n=globalThis.screen)||void 0===n?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[r,i]=this.graphSize,this.context.graph.setSize(r,i),this.context.graph.render()}request(){!document.fullscreenElement&&(document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled"))&&this.$el.requestFullscreen().catch(t=>{$u(`Error attempting to enable full-screen: ${t.message} (${t.name})`)})}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.exit(),this.style.remove(),super.destroy()}}yF.defaultOptions={trigger:{},autoFit:!0};class bF extends vB{constructor(t,e){super(t,Object.assign({},bF.defaultOptions,e)),this.$element=mB("grid-line",!0),this.offset=[0,0],this.currentScale=1,this.followZoom=t=>{const{data:{scale:e,origin:n}}=t;if(!e||void 0===n&&void 0===this.context.viewport)return;const r=this.currentScale;this.currentScale=e;const i=e/r,o=nd(n||this.context.graph.getCanvasCenter(),1-i),a=this.baseSize*e,s=td(ud(nd(this.offset,i),a),o);this.$element.style.backgroundSize=`${a}px ${a}px`,this.$element.style.backgroundPosition=`${s[0]}px ${s[1]}px`,this.offset=ud(s,a)},this.followTranslate=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)},this.onTransform=t=>{const e=this.parseFollow(this.options.follow);e.zoom&&this.followZoom(t),e.translate&&this.followTranslate(t)};this.context.canvas.getContainer().prepend(this.$element),this.baseSize=this.options.size,this.updateStyle(),this.bindEvents()}update(t){super.update(t),void 0!==t.size&&(this.baseSize=t.size),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{stroke:t,lineWidth:e,border:n,borderLineWidth:r,borderStroke:i,borderStyle:o}=this.options,a=this.baseSize*this.currentScale;Object.assign(this.$element.style,{border:n?`${r}px ${o} ${i}`:"none",backgroundImage:`linear-gradient(${t} ${e}px, transparent ${e}px), linear-gradient(90deg, ${t} ${e}px, transparent ${e}px)`,backgroundSize:`${a}px ${a}px`,backgroundRepeat:"repeat"})}updateOffset(t){const e=this.baseSize*this.currentScale;this.offset=ud(td(this.offset,t),e),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}parseFollow(t){var e,n;return pe(t)?{translate:t,zoom:t}:{translate:null!==(e=null==t?void 0:t.translate)&&void 0!==e&&e,zoom:null!==(n=null==t?void 0:t.zoom)&&void 0!==n&&n}}destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}function xF(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach(t=>{const{type:n,value:r}=t,i=Ih(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Removed.has(i)||e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)?e.Added.delete(i):e.Updated.has(i)?(e.Updated.delete(i),e.Removed.set(i,t)):e.Removed.set(i,t))}),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}function EF(t){const{NodeAdded:e=[],NodeUpdated:n=[],NodeRemoved:r=[],EdgeAdded:i=[],EdgeUpdated:o=[],EdgeRemoved:a=[],ComboAdded:s=[],ComboUpdated:l=[],ComboRemoved:c=[]}=ie(t,t=>t.type);return{add:{nodes:e,edges:i,combos:s},update:{nodes:n,edges:o,combos:l},remove:{nodes:r,edges:a,combos:c}}}function wF(t,e){for(const n in t)qt(t[n])&&!Array.isArray(t[n])&&null!==t[n]?(e[n]||(e[n]={}),wF(t[n],e[n])):void 0===e[n]&&(e[n]=Ku(n))}function kF(t,e=!1,n){const r={animation:e,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:o,remove:a}=EF(xF(t));return["nodes","edges","combos"].forEach(t=>{o[t]&&o[t].forEach(e=>{var i,o;const a=Object.assign({},e.value);let s=Object.assign({},e.original);if(n){const t=n.graph.getElementType(Ih(e.original)),r="edge"===t?"stroke":"fill",i=n.element.getElementComputedStyle(t,e.original);s=Object.assign(Object.assign({},e.original),{style:Object.assign({[r]:i[r]},e.original.style)})}wF(a,s),(i=r.current.update)[t]||(i[t]=[]),r.current.update[t].push(a),(o=r.original.update)[t]||(o[t]=[]),r.original.update[t].push(s)}),i[t]&&i[t].forEach(e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.add)[t]||(n[t]=[]),r.current.add[t].push(o),(i=r.original.remove)[t]||(i[t]=[]),r.original.remove[t].push(o)}),a[t]&&a[t].forEach(e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.remove)[t]||(n[t]=[]),r.current.remove[t].push(o),(i=r.original.add)[t]||(i[t]=[]),r.original.add[t].push(o)})}),r}bF.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};class MF extends vB{constructor(e,n){super(e,Object.assign({},MF.defaultOptions,n)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(t,e=!0)=>{var n,r,i;this.freezed=!0,null===(r=(n=this.options).executeCommand)||void 0===r||r.call(n,t);const o=e?t.original:t.current;this.context.graph.addData(o.add),this.context.graph.updateData(o.update),this.context.graph.removeData(Bh(o.remove,!1)),null===(i=this.context.element)||void 0===i||i.draw({silence:!0,animation:t.animation}),this.freezed=!1},this.addCommand=e=>{var n;if(!this.freezed){if(e.type===t.GraphEvent.AFTER_DRAW){const{dataChanges:t=[],animation:r=!0}=e.data;if(null===(n=this.context.batch)||void 0===n?void 0:n.isBatching){if(!this.batchChanges)return;return this.batchChanges.push(t),void(this.batchAnimation&&(this.batchAnimation=r))}this.batchChanges=[t],this.batchAnimation=r}this.undoStackPush(kF(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(t.HistoryEvent.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=t=>{const{initiate:e}=t.data;if(this.batchAnimation=!1,e)this.batchChanges=[];else{this.undoStack.pop()||(this.batchChanges=null)}},this.emitter=new cv;const{graph:r}=this.context;r.on(t.GraphEvent.AFTER_DRAW,this.addCommand),r.on(t.GraphEvent.BATCH_START,this.initBatchCommand),r.on(t.GraphEvent.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var e,n,r,i;const o=this.undoStack.pop();if(o){this.executeCommand(o);if(!1===(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,o,!1)))return;this.redoStack.push(o),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,o,!1),this.notify(t.HistoryEvent.UNDO,o)}return this}redo(){const e=this.redoStack.pop();return e&&(this.executeCommand(e,!1),this.undoStackPush(e),this.notify(t.HistoryEvent.REDO,e)),this}undoAndCancel(){const e=this.undoStack.pop();return e&&(this.executeCommand(e,!1),this.redoStack=[],this.notify(t.HistoryEvent.CANCEL,e)),this}undoStackPush(t){var e,n,r,i;const{stackSize:o}=this.options;0!==o&&this.undoStack.length>=o&&this.undoStack.shift();!1!==(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,t,!0))&&(this.undoStack.push(t),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(t.HistoryEvent.CLEAR,null)}notify(e,n){this.emitter.emit(e,{cmd:n}),this.emitter.emit(t.HistoryEvent.CHANGE,{cmd:n})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.addCommand),e.off(t.GraphEvent.BATCH_START,this.initBatchCommand),e.off(t.GraphEvent.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}MF.defaultOptions={stackSize:0};const SF={toXy(t,e){if(!e)return[...t];const n=e[0].slice(1),r=e[1].slice(1);return t.map(t=>[t[n],t[r]])},fromXy(t,e){if(!e)return[...t];const n=e[0].slice(1),r=e[1].slice(1);return t.map(([t,e])=>({[n]:t,[r]:e}))}};let NF=class{constructor(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(const e of t){const t=this.coordToCellNum(e[0]),n=this.coordToCellNum(e[1]);this._cells[t]||(this._cells[t]=[]),this._cells[t][n]||(this._cells[t][n]=[]),this._cells[t][n].push(e)}}cellPoints(t,e){var n;return(null===(n=this._cells[t])||void 0===n?void 0:n[e])||[]}rangePoints(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this.coordToCellNum(t[2]),i=this.coordToCellNum(t[3]),o=[];for(let t=e;t<=r;t++)for(let e=n;e<=i;e++){const n=this.cellPoints(t,e);for(const t of n)o.push(t)}return o}removePoint(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this._cells[e][n],i=r.findIndex(([e,n])=>e===t[0]&&n===t[1]);return i>-1&&r.splice(i,1),r}trunc(t){return Math.trunc(t)}coordToCellNum(t){return this.trunc(t*this._reverseCellSize)}extendBbox(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}};const TF=+(Math.pow(2,27)+1);function OF(t,e,n){const r=t*e,i=TF*t,o=i-(i-t),a=t-o,s=TF*e,l=s-(s-e),c=e-l,u=a*c-(r-o*l-a*l-o*c);return n?(n[0]=u,n[1]=r,n):[u,r]}function CF(t,e,n){const r=t+e,i=r-t,o=e-i,a=t-(r-i);return n?(n[0]=a+o,n[1]=r,n):[a+o,r]}function AF(t,e){const n=t.length;if(1===n){const n=OF(t[0],e);return n[0]?n:[n[1]]}const r=new Array(2*n),i=[.1,.1],o=[.1,.1];let a=0;OF(t[0],e,i),i[0]&&(r[a++]=i[0]);for(let s=1;s<n;++s){OF(t[s],e,o);CF(i[1],o[0],i),i[0]&&(r[a++]=i[0]);const n=o[1],l=i[1],c=n+l,u=l-(c-n);i[1]=c,u&&(r[a++]=u)}return i[1]&&(r[a++]=i[1]),0===a&&(r[a++]=0),r.length=a,r}function PF(t,e){const n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){const n=t+e,r=n-t,i=t-(n-r)+(e-r);return i?[i,n]:[n]}(t[0],-e[0]);const i=new Array(n+r);let o=0,a=0,s=0;const l=Math.abs;let c,u,h=t[a],d=l(h),f=-e[s],p=l(f);d<p?(u=h,a+=1,a<n&&(h=t[a],d=l(h))):(u=f,s+=1,s<r&&(f=-e[s],p=l(f))),a<n&&d<p||s>=r?(c=h,a+=1,a<n&&(h=t[a],d=l(h))):(c=f,s+=1,s<r&&(f=-e[s],p=l(f)));let g,v,m,y,b,x=c+u,E=x-c,w=u-E,k=w,M=x;for(;a<n&&s<r;)d<p?(c=h,a+=1,a<n&&(h=t[a],d=l(h))):(c=f,s+=1,s<r&&(f=-e[s],p=l(f))),u=k,x=c+u,E=x-c,w=u-E,w&&(i[o++]=w),g=M+x,v=g-M,m=g-v,y=x-v,b=M-m,k=b+y,M=g;for(;a<n;)c=h,u=k,x=c+u,E=x-c,w=u-E,w&&(i[o++]=w),g=M+x,v=g-M,m=g-v,y=x-v,b=M-m,k=b+y,M=g,a+=1,a<n&&(h=t[a]);for(;s<r;)c=f,u=k,x=c+u,E=x-c,w=u-E,w&&(i[o++]=w),g=M+x,v=g-M,m=g-v,y=x-v,b=M-m,k=b+y,M=g,s+=1,s<r&&(f=-e[s]);return k&&(i[o++]=k),M&&(i[o++]=M),o||(i[o++]=0),i.length=o,i}function RF(t,e){const n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){const n=t+e,r=n-t,i=t-(n-r)+(e-r);return i?[i,n]:[n]}(t[0],e[0]);const i=new Array(n+r);let o=0,a=0,s=0;const l=Math.abs;let c,u,h=t[a],d=l(h),f=e[s],p=l(f);d<p?(u=h,a+=1,a<n&&(h=t[a],d=l(h))):(u=f,s+=1,s<r&&(f=e[s],p=l(f))),a<n&&d<p||s>=r?(c=h,a+=1,a<n&&(h=t[a],d=l(h))):(c=f,s+=1,s<r&&(f=e[s],p=l(f)));let g,v,m,y,b,x=c+u,E=x-c,w=u-E,k=w,M=x;for(;a<n&&s<r;)d<p?(c=h,a+=1,a<n&&(h=t[a],d=l(h))):(c=f,s+=1,s<r&&(f=e[s],p=l(f))),u=k,x=c+u,E=x-c,w=u-E,w&&(i[o++]=w),g=M+x,v=g-M,m=g-v,y=x-v,b=M-m,k=b+y,M=g;for(;a<n;)c=h,u=k,x=c+u,E=x-c,w=u-E,w&&(i[o++]=w),g=M+x,v=g-M,m=g-v,y=x-v,b=M-m,k=b+y,M=g,a+=1,a<n&&(h=t[a]);for(;s<r;)c=f,u=k,x=c+u,E=x-c,w=u-E,w&&(i[o++]=w),g=M+x,v=g-M,m=g-v,y=x-v,b=M-m,k=b+y,M=g,s+=1,s<r&&(f=e[s]);return k&&(i[o++]=k),M&&(i[o++]=M),o||(i[o++]=0),i.length=o,i}function DF(t,e,n,r){return function(n,i,o){const a=t(t(e(i[1],o[0]),e(-o[1],i[0])),t(e(n[1],i[0]),e(-i[1],n[0]))),s=t(e(n[1],o[0]),e(-o[1],n[0])),l=r(a,s);return l[l.length-1]}}function LF(t,e,n,r){return function(i,o,a,s){const l=t(t(n(t(e(a[1],s[0]),e(-s[1],a[0])),o[2]),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),-a[2]),n(t(e(o[1],a[0]),e(-a[1],o[0])),s[2]))),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),s[2])))),c=t(t(n(t(e(a[1],s[0]),e(-s[1],a[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-a[2]),n(t(e(i[1],a[0]),e(-a[1],i[0])),s[2]))),t(n(t(e(o[1],a[0]),e(-a[1],o[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),a[2])))),u=r(l,c);return u[u.length-1]}}function _F(t,e,n,r){return function(i,o,a,s,l){const c=t(t(t(n(t(n(t(e(s[1],l[0]),e(-l[1],s[0])),a[2]),t(n(t(e(a[1],l[0]),e(-l[1],a[0])),-s[2]),n(t(e(a[1],s[0]),e(-s[1],a[0])),l[2]))),o[3]),t(n(t(n(t(e(s[1],l[0]),e(-l[1],s[0])),o[2]),t(n(t(e(o[1],l[0]),e(-l[1],o[0])),-s[2]),n(t(e(o[1],s[0]),e(-s[1],o[0])),l[2]))),-a[3]),n(t(n(t(e(a[1],l[0]),e(-l[1],a[0])),o[2]),t(n(t(e(o[1],l[0]),e(-l[1],o[0])),-a[2]),n(t(e(o[1],a[0]),e(-a[1],o[0])),l[2]))),s[3]))),t(n(t(n(t(e(a[1],s[0]),e(-s[1],a[0])),o[2]),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),-a[2]),n(t(e(o[1],a[0]),e(-a[1],o[0])),s[2]))),-l[3]),t(n(t(n(t(e(s[1],l[0]),e(-l[1],s[0])),o[2]),t(n(t(e(o[1],l[0]),e(-l[1],o[0])),-s[2]),n(t(e(o[1],s[0]),e(-s[1],o[0])),l[2]))),i[3]),n(t(n(t(e(s[1],l[0]),e(-l[1],s[0])),i[2]),t(n(t(e(i[1],l[0]),e(-l[1],i[0])),-s[2]),n(t(e(i[1],s[0]),e(-s[1],i[0])),l[2]))),-o[3])))),t(t(n(t(n(t(e(o[1],l[0]),e(-l[1],o[0])),i[2]),t(n(t(e(i[1],l[0]),e(-l[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),l[2]))),s[3]),t(n(t(n(t(e(o[1],s[0]),e(-s[1],o[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),s[2]))),-l[3]),n(t(n(t(e(a[1],s[0]),e(-s[1],a[0])),o[2]),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),-a[2]),n(t(e(o[1],a[0]),e(-a[1],o[0])),s[2]))),i[3]))),t(n(t(n(t(e(a[1],s[0]),e(-s[1],a[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-a[2]),n(t(e(i[1],a[0]),e(-a[1],i[0])),s[2]))),-o[3]),t(n(t(n(t(e(o[1],s[0]),e(-s[1],o[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),s[2]))),a[3]),n(t(n(t(e(o[1],a[0]),e(-a[1],o[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),a[2]))),-s[3]))))),u=t(t(t(n(t(n(t(e(s[1],l[0]),e(-l[1],s[0])),a[2]),t(n(t(e(a[1],l[0]),e(-l[1],a[0])),-s[2]),n(t(e(a[1],s[0]),e(-s[1],a[0])),l[2]))),i[3]),n(t(n(t(e(s[1],l[0]),e(-l[1],s[0])),i[2]),t(n(t(e(i[1],l[0]),e(-l[1],i[0])),-s[2]),n(t(e(i[1],s[0]),e(-s[1],i[0])),l[2]))),-a[3])),t(n(t(n(t(e(a[1],l[0]),e(-l[1],a[0])),i[2]),t(n(t(e(i[1],l[0]),e(-l[1],i[0])),-a[2]),n(t(e(i[1],a[0]),e(-a[1],i[0])),l[2]))),s[3]),n(t(n(t(e(a[1],s[0]),e(-s[1],a[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-a[2]),n(t(e(i[1],a[0]),e(-a[1],i[0])),s[2]))),-l[3]))),t(t(n(t(n(t(e(a[1],l[0]),e(-l[1],a[0])),o[2]),t(n(t(e(o[1],l[0]),e(-l[1],o[0])),-a[2]),n(t(e(o[1],a[0]),e(-a[1],o[0])),l[2]))),i[3]),n(t(n(t(e(a[1],l[0]),e(-l[1],a[0])),i[2]),t(n(t(e(i[1],l[0]),e(-l[1],i[0])),-a[2]),n(t(e(i[1],a[0]),e(-a[1],i[0])),l[2]))),-o[3])),t(n(t(n(t(e(o[1],l[0]),e(-l[1],o[0])),i[2]),t(n(t(e(i[1],l[0]),e(-l[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),l[2]))),a[3]),n(t(n(t(e(o[1],a[0]),e(-a[1],o[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),a[2]))),-l[3])))),h=r(c,u);return h[h.length-1]}}function IF(t){return(3===t?DF:4===t?LF:_F)(RF,OF,AF,PF)}const jF=IF(3),BF=IF(4),FF=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,n){const r=(t[1]-n[1])*(e[0]-n[0]),i=(t[0]-n[0])*(e[1]-n[1]),o=r-i;let a;if(r>0){if(i<=0)return o;a=r+i}else{if(!(r<0))return o;if(i>=0)return o;a=-(r+i)}const s=33306690738754716e-32*a;return o>=s||o<=-s?o:jF(t,e,n)},function(t,e,n,r){const i=t[0]-r[0],o=e[0]-r[0],a=n[0]-r[0],s=t[1]-r[1],l=e[1]-r[1],c=n[1]-r[1],u=t[2]-r[2],h=e[2]-r[2],d=n[2]-r[2],f=o*c,p=a*l,g=a*s,v=i*c,m=i*l,y=o*s,b=u*(f-p)+h*(g-v)+d*(m-y),x=7771561172376103e-31*((Math.abs(f)+Math.abs(p))*Math.abs(u)+(Math.abs(g)+Math.abs(v))*Math.abs(h)+(Math.abs(m)+Math.abs(y))*Math.abs(d));return b>x||-b>x?b:BF(t,e,n,r)}];function zF(t){let e=FF[t.length];return e||(e=FF[t.length]=IF(t.length)),e.apply(void 0,...t)}var GF=function(){for(;FF.length<=5;)FF.push(IF(FF.length));const t=function(t,e,n,r,i,o,a){return function(...e){switch(e.length){case 0:case 1:return 0;case 2:return r(e[0],e[1]);case 3:return i(e[0],e[1],e[2]);case 4:return o(e[0],e[1],e[2],e[3]);case 5:return a(e[0],e[1],e[2],e[3],e[4])}return t(e)}}(void 0,zF,...FF);for(let e=0;e<=5;++e)t[e]=FF[e];return t}();const VF=GF[3];function WF(t,e,n,r){const i=GF(t,n,r),o=GF(e,n,r);if(i>0&&o>0||i<0&&o<0)return!1;const a=GF(n,t,e),s=GF(r,t,e);return!(a>0&&s>0||a<0&&s<0)&&(0!==i||0!==o||0!==a||0!==s||function(t,e,n,r){for(let i=0;i<2;++i){const o=t[i],a=e[i],[s,l]=[Math.min(o,a),Math.max(o,a)],c=n[i],u=r[i],[h,d]=[Math.min(c,u),Math.max(c,u)];if(d<s||l<h)return!1}return!0}(t,e,n,r))}function HF(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function UF(t,e,n){const r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],o=HF(t,e),a=HF(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(o*a)}function $F(t,e){for(let n=0;n<e.length-1;n++){const r=[e[n],e[n+1]];if(!(t[0][0]===r[0][0]&&t[0][1]===r[0][1]||t[0][0]===r[1][0]&&t[0][1]===r[1][1])&&WF(t[0],t[1],r[0],r[1]))return!0}return!1}function YF(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function qF(t,e,n){let r,i,o=null,a=ZF,s=ZF;for(let l=0;l<e.length;l++)r=UF(t[0],t[1],e[l]),i=UF(t[1],t[0],e[l]),r>a&&i>s&&!$F([t[0],e[l]],n)&&!$F([t[1],e[l]],n)&&(a=r,s=i,o=e[l]);return o}function XF(t,e,n,r,i){let o=!1;for(let a=0;a<t.length-1;a++){const s=[t[a],t[a+1]],l=s[0][0]+","+s[0][1]+","+s[1][0]+","+s[1][1];if(HF(s[0],s[1])<e||i.has(l))continue;let c,u,h,d=0,f=YF(s);do{f=r.extendBbox(f,d),c=f[2]-f[0],u=f[3]-f[1],h=qF(s,r.rangePoints(f),t),d++}while(null===h&&(n[0]>c||n[1]>u));c>=n[0]&&u>=n[1]&&i.add(l),null!==h&&(t.splice(a+1,0,h),r.removePoint(h),o=!0)}return o?XF(t,e,n,r,i):t}function KF(t,e,n){const r=e||20,i=function(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];n[0]===i[0]&&n[1]===i[1]||e.push(i),n=i}return e}(function(t){return t.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]})}(SF.toXy(t,n)));if(i.length<4){const t=i.concat([i[0]]);return n?SF.fromXy(t,n):t}const o=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<n&&(n=t[o][1]),t[o][0]>r&&(r=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[r-e,i-n]}(i),a=[o[0]*QF,o[1]*QF],s=function(t){const e=t.length;if(e<3){const n=new Array(e);for(let t=0;t<e;++t)n[t]=t;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:n}const n=new Array(e);for(let t=0;t<e;++t)n[t]=t;n.sort((e,n)=>t[e][0]-t[n][0]||t[e][1]-t[n][1]);const r=[n[0],n[1]],i=[n[0],n[1]];for(let o=2;o<e;++o){const e=n[o],a=t[e];let s=r.length;for(;s>1&&VF(t[r[s-2]],t[r[s-1]],a)<=0;)s-=1,r.pop();for(r.push(e),s=i.length;s>1&&VF(t[i[s-2]],t[i[s-1]],a)>=0;)s-=1,i.pop();i.push(e)}const o=new Array(i.length+r.length-2);let a=0;for(let t=0,e=r.length;t<e;++t)o[a++]=r[t];for(let t=i.length-2;t>0;--t)o[a++]=i[t];return o}(i).reverse().map(t=>i[t]);s.push(s[0]);const l=i.filter(function(t){return s.indexOf(t)<0}),c=Math.ceil(1/(i.length/(o[0]*o[1]))),u=XF(s,Math.pow(r,2),a,function(t,e){return new NF(t,e)}(l,c),new Set);return n?SF.fromXy(u,n):u}const ZF=Math.cos(90/(180/Math.PI)),QF=.6;const JF=(t,e,n)=>{if("sharp"===n)return[["M",t[0]-e,t[1]-e],["L",t[0]+e,t[1]-e],["L",t[0]+e,t[1]+e],["L",t[0]-e,t[1]+e],["Z"]];const r=[e,e,0,0,0];return[["M",t[0],t[1]-e],["A",...r,t[0],t[1]+e],["A",...r,t[0],t[1]-e]]},tz=(t,e,n)=>{const r=[e,e,0,0,0],i="sharp"===n?td(t[0],id(sd(ed(t[0],t[1])),e)):t[0],o="sharp"===n?td(t[1],id(sd(ed(t[1],t[0])),e)):t[1],a=id(sd(cd(ed(i,o),!1)),e),s=id(a,-1),l=td(i,a),c=td(o,a),u=td(o,s),h=td(i,s);return"sharp"===n?[["M",l[0],l[1]],["L",c[0],c[1]],["L",u[0],u[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",c[0],c[1]],["A",...r,u[0],u[1]],["L",h[0],h[1]],["A",...r,l[0],l[1]]]},ez=(t,e)=>{const n=Dd(t).map((n,r)=>{const i=(r-2+t.length)%t.length,o=(r-1+t.length)%t.length,a=(r+1)%t.length,s=t[i],l=t[o],c=t[a],u=ed(s,l),h=ed(l,n),d=ed(n,c),f=(t,e)=>ld(t,e,!0)<Math.PI,p=f(u,h),g=f(h,d),v=t=>id(sd(cd(t,!1)),e),m=v(h);return[{p:hd(td(l,p?v(u):m)),concave:p&&l},{p:hd(td(n,g?v(d):m)),concave:g&&n}]}),r=[e,e,0,0,0],i=n.findIndex((t,e)=>!(n[(e-1+n.length)%n.length][0].concave||n[(e-1+n.length)%n.length][1].concave||t[0].concave||t[0].concave||t[1].concave)),o=n.slice(i).concat(n.slice(0,i));let a=[];return o.flatMap((t,e)=>{const i=[],s=o[n.length-1];return 0===e&&i.push(["M",...s[1].p]),t[0].concave?a.push(t[0].p,t[1].p):i.push(["A",...r,...t[0].p]),t[1].concave?a.unshift(t[1].p):i.push(["L",...t[1].p]),3===a.length&&(i.pop(),i.push(["C",...a.flat()]),a=[]),i})},nz=(t,e)=>{const n=Dd(t).map((e,n)=>({p:e,v:sd(ed(t[(n+1)%t.length],e))}));return n.forEach((r,i)=>{const o=i>0?i-1:t.length-1,a=n[o].v,s=sd(td(a,id(r.v,ld(a,r.v,!0)<Math.PI?1:-1)));r.p=td(r.p,id(s,e))}),pf(n.map(t=>t.p))},rz=(t,e)=>{const n=t.map((n,r)=>{const i=t[0===r?t.length-1:r-1],o=dd(id(sd(cd(ed(i,n),!1)),e));return[td(i,o),td(n,o)]}),r=n.flat();return r.map((t,e)=>{if(e%2==0)return null;return vd([r[(e-1)%r.length],r[e%r.length]],[r[(e+1)%r.length],r[(e+2)%r.length]],!0)}).filter(Boolean).map((t,e)=>[0===e?"M":"L",t[0],t[1]]).concat([["Z"]])};class iz extends vB{constructor(t,e){super(t,Object.assign({},iz.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(this.shape){const t=!Te(this.optionsCache,this.options);this.shape.update(this.getHullStyle(t))}else this.shape=new gf({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);this.optionsCache=Object.assign({},this.options)},this.updateHullPath=t=>{this.shape&&this.options.members.includes(Ih(t.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(t=!1)=>{const{graph:e}=this.context,n=this.getMember();if(0===n.length)return"";const r=n.map(t=>e.getNodeData(t)),i=KF(r.map(yd),this.options.concavity).slice(1).reverse(),o=i.flatMap(t=>r.filter(e=>Te(yd(e),t)).map(Ih));return Te(o,this.hullMemberIds)&&!t||(this.hullMemberIds=o,this.path=function(t,e,n){if(1===t.length)return JF(t[0],e,n);if(2===t.length)return tz(t,e,n);if(3===t.length){const[r,i,o]=Dd(t);if(Td(r,i,o))return tz([r,o],e,n)}switch(n){case"smooth":return nz(t,e);case"sharp":return rz(t,e);default:return ez(t,e)}}(i,this.getPadding(),this.options.corner)),this.path},this.bindEvents()}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}unbindEvents(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:r,corner:i}=e,o=ze(e,["members","padding","corner"]);return Object.assign(Object.assign({},o),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context,e=this.hullMemberIds.reduce((e,n)=>{const{halfExtents:r}=t.getElementRenderBounds(n),i=Math.max(r[0],r[1]);return Math.max(e,i)},0);return e+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(t=>!e.includes(t)),e.some(t=>this.hullMemberIds.includes(t))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Ut(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.unbindEvents(),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}function oz(t,e){e(t),t.children&&t.children.forEach(function(t){t&&oz(t,e)})}function az(t){lz(t,!0)}function sz(t){lz(t,!1)}function lz(t,e){var n=e?"visible":"hidden";oz(t,function(t){t.attr("visibility",n)})}iz.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};var cz=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,He([],We(e),!1))||this;return r.isMutationObserved=!0,r.addEventListener(al.INSERTED,function(){sz(r)}),r}return Be(e,t),e}(ec);function uz(t){var e=t.appendChild(new cz({class:"offscreen"}));return sz(e),e}var hz=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=ze(e,["style"]);return t.call(this,Fe({style:Fe({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return Be(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=uz(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(gc);function dz(t){return t*Math.PI/180}function fz(t){return Number((180*t/Math.PI).toPrecision(5))}var pz=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();function gz(t,e){return Ut(t)?t.apply(void 0,He([],We(e),!1)):t}var vz,mz=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map(function(t){var e=We(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]}));return Object.assign(r,{prefix:n}),r},yz=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach(function(i){var o=We(i,2),a=o[0],s=o[1],l=t;Object.prototype.hasOwnProperty.call(e,a)&&(s?Jt(s)?(Jt(t[a])||(l[a]={}),n<r?yz(t[a],s,n+1,r):l[a]=e[a]):Yt(s)?(l[a]=[],l[a]=l[a].concat(s)):l[a]=s:l[a]=s)})},bz=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)yz(t,e[r]);return t},xz=function(t){return void 0!==t&&null!=t&&!Number.isNaN(t)},Ez=Ee(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return vz||(vz=jl.offscreenCanvasCreator.getOrCreateContext(void 0)),vz.font=[o,a,i,"".concat(n,"px"),r].join(" "),vz.measureText(t).width},function(t,e){return[t,Object.values(e||wz(t)).join()].join("")},4096),wz=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function kz(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}function Mz(t,e){var n=kz(t);n&&n.attr(e)}function Sz(t,e,n){void 0===n&&(n="..."),Mz(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function Nz(t){var e=t.canvas,n=t.touches,r=t.offsetX,i=t.offsetY;if(e)return[e.x,e.y];if(n){var o=n[0];return[o.clientX,o.clientY]}return r&&i?[r,i]:[0,0]}function Tz(t){return"function"==typeof t?t():ne(t)||ae(t)?new hz({style:{text:String(t)}}):t}function Oz(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function Cz(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=!1),!!(r&&t===e||i&&t===n)||t>e&&t<n}function Az(t,e){return"number"==typeof t&&"number"==typeof e?function(t,e){return function(n){return t*(1-n)+e*n}}(t,e):Array.isArray(t)&&Array.isArray(e)?function(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0;return function(i){var o=new Array(r),a=new Array(n),s=0;for(s=0;s<r;++s)o[s]=Az(t[s],e[s]);for(;s<n;++s)a[s]=e[s];for(s=0;s<r;++s)a[s]=o[s](i);return a}}(t,e):"object"==typeof t&&"object"==typeof e?function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n={},r={};return Object.entries(e).forEach(function(e){var i=We(e,2),o=i[0],a=i[1];o in t?n[o]=Az(t[o],a):r[o]=a}),function(t){return Object.entries(n).forEach(function(e){var n=We(e,2),i=n[0],o=n[1];return r[i]=o(t)}),r}}(t,e):function(e){return t}}function Pz(t,e){return[t[0]*e,t[1]*e]}function Rz(t,e){return[t[0]+e[0],t[1]+e[1]]}function Dz(t,e){return[t[0]-e[0],t[1]-e[1]]}function Lz(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1])]}function _z(t,e){return[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}function Iz(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function jz(t){if(0===t[0]&&0===t[1])return[0,0];var e=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2));return[t[0]/e,t[1]/e]}function Bz(t,e){return+t.toPrecision(e)}function Fz(t,e){var n={},r=Array.isArray(e)?e:[e];for(var i in t)r.includes(i)||(n[i]=t[i]);return n}function zz(t,e,n){void 0===n&&(n=[[0,0],[1,1]]);for(var r=[],i=0,o=t.length;i<o;i+=2)r.push([t[i],t[i+1]]);var a,s,l,c=function(t,e,n,r){var i,o,a,s,l,c,u=[],h=!!r,d=[1/0,1/0],f=[-1/0,-1/0];if(h){d=(i=We(r,2))[0],f=i[1];for(var p=0,g=t.length;p<g;p+=1)d=Lz(d,m=t[p]),f=_z(f,m)}p=0;for(var v=t.length;p<v;p+=1){var m=t[p];if(0===p)c=m;else if(p===v-1)l=m,u.push(c),u.push(l);else{o=t[p-1];var y=[0,0];y=Pz(y=Dz(a=t[p+1],o),e);var b=Iz(m,o),x=Iz(m,a),E=b+x;0!==E&&(b/=E,x/=E);var w=Pz(y,-b),k=Pz(y,x);l=Rz(m,w),s=Lz(s=Rz(m,k),_z(a,m)),s=_z(s,Lz(a,m)),l=Lz(l=Rz(m,w=Pz(w=Dz(s,m),-b/x)),_z(o,m)),s=Rz(m,k=Pz(k=Dz(m,l=_z(l,Lz(o,m))),x/b)),h&&(l=Lz(l=_z(l,d),f),s=Lz(s=_z(s,d),f)),u.push(c),u.push(l),c=s}}return u}(r,.4,0,n),u=r.length,h=[];for(i=0;i<u-1;i+=1)a=c[2*i],s=c[2*i+1],l=r[i+1],h.push(["C",a[0],a[1],s[0],s[1],l[0],l[1]]);return h}var Gz=["$el","cx","cy","d","dx","dy","fill","fillOpacity","filter","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","height","img","increasedLineWidthForHitTesting","innerHTML","isBillboard","billboardRotation","isSizeAttenuation","isClosed","isOverflowing","leading","letterSpacing","lineDash","lineHeight","lineWidth","markerEnd","markerEndOffset","markerMid","markerStart","markerStartOffset","maxLines","metrics","miterLimit","offsetX","offsetY","opacity","path","points","r","radius","rx","ry","shadowColor","src","stroke","strokeOpacity","text","textAlign","textBaseline","textDecorationColor","textDecorationLine","textDecorationStyle","textOverflow","textPath","textPathSide","textPathStartOffset","transform","transformOrigin","visibility","width","wordWrap","wordWrapWidth","x","x1","x2","y","y1","y2","z1","z2","zIndex"];function Vz(t){return Gz.includes(t)}function Wz(t){var e={};for(var n in t)Vz(n)&&(e[n]=t[n]);return e}function Hz(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=e/Math.max(i,o);return t.style.transform="scale(".concat(a,")"),a}var Uz=function(){function t(t,n,r,i,o,a,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===a&&(a=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=a,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var a=this._data[o],s=We(Array.isArray(a)?a:[a,null],2),l=s[0],c=s[1];(h=r(l,o)).__data__=l,null!==c&&(h.__fromElements__=c),this._parent.appendChild(h),i.push(h)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var u=this._elements[o],h=r(l=u.__data__,o);u.appendChild(h),i.push(h)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=Ue(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=Ue(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=Ue(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var a,s,l,c=[],u=[],h=new Set(this._elements),d=[],f=new Set,p=new Map(this._elements.map(function(t,n){return[e(t.__data__,n),t]})),g=new Map(this._facetElements.map(function(t,n){return[e(t.__data__,n),t]})),v=(a=this._elements,s=function(t){return r(t.__data__)},l=new Map,a.forEach(function(t){var e=s(t);l.has(e)||l.set(e,[]),l.get(e).push(t)}),l),m=0;m<t.length;m++){var y=t[m],b=e(y,m),x=r(y,m);if(p.has(b))(M=p.get(b)).__data__=y,M.__facet__=!1,u.push(M),h.delete(M),p.delete(b);else if(g.has(b)){(M=g.get(b)).__data__=y,M.__facet__=!0,u.push(M),g.delete(b)}else if(v.has(b)){var E=v.get(b);d.push([y,E]);try{for(var w=(i=void 0,Ve(E)),k=w.next();!k.done;k=w.next()){var M=k.value;h.delete(M)}}catch(t){i={error:t}}finally{try{k&&!k.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}v.delete(b)}else if(p.has(x)){(M=p.get(x)).__toData__?M.__toData__.push(y):M.__toData__=[y],f.add(M),h.delete(M)}else c.push(y)}var S=[new n([],c,this._parent,this._document),new n(u,null,this._parent,this._document),new n(h,null,this._parent,this._document),new n([],d,this._parent,this._document),new n(f,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,S)},t.prototype.merge=function(t){var e=He(He([],We(this._elements),!1),We(t._elements),!1),r=He(He([],We(this._transitions),!1),We(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),a=e(this._update),s=n(this._exit),l=r(this._merge),c=i(this._split);return a.merge(o).merge(s).merge(l).merge(c)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then(function(){return n.remove()}):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each(function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))})},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each(function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))})},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each(function(n,r){var i=this;Object.entries(t).forEach(function(t){var o=We(t,2),a=o[0],s=o[1],l="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(a,l.call(i,n,r))})})},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each(function(e,r){t&&this.update&&this.update(n.call(this,e,r))})},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each(function(e,r){t&&this.update&&this.update(n.call(this,e,r))})},t.prototype.transition=function(t){this._transitions;var e=new Array(this._elements.length);return this.each(function(n,r){e[r]=t.call(this,n,r)}),this._transitions=function(t){if(!Yt(t))return[];for(var e=[],n=0;n<t.length;n++)e=e.concat(t[n]);return e}(e),this},t.prototype.on=function(t,e){return this.each(function(){this.addEventListener(t,e)}),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,He([this._parent,this],We(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter(function(t){return!!t})},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:ec,rect:fc,circle:Zl,path:lc,text:hz,ellipse:tc,image:ic,line:ac,polygon:uc,polyline:dc,html:rc},t}();function $z(t){return new Uz([t],null,t,t.ownerDocument)}function Yz(t){if(ae(t))return[t,t,t,t];if(Yt(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function qz(t){var e=t.getLocalBounds(),n=We([e.min,e.max],2),r=We(n[0],2),i=r[0],o=r[1],a=We(n[1],2),s=a[0],l=a[1];return{x:i,y:o,width:s-i,height:l-o,left:i,bottom:l,top:o,right:s}}function Xz(t,e){var n=We(t,2),r=n[0],i=n[1],o=We(e,2),a=o[0],s=o[1];return r!==a&&i===s}function Kz(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Zz(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var Qz=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function Jz(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach(function(t){var i=We(t,2),o=i[0],a=i[1];if("className"===o||"class"===o);else if(Qz(o,"show")&&Qz(Zz(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(Kz(t))}(e,"show")?r[o]=a:r[o.replace(new RegExp(Kz(e)),"")]=a;else if(!Qz(o,"show")&&Qz(o,e)!==n){var s=Zz(o,e);"filter"===s&&"function"==typeof a||(r[s]=a)}}),r}function tG(t,e){return Object.entries(t).reduce(function(t,n){var r=We(n,2),i=r[0],o=r[1];return i.startsWith("show")?t["show".concat(e).concat(i.slice(4))]=o:t["".concat(e).concat(Kz(i))]=o,t},{})}function eG(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach(function(t){var o=We(t,2),a=o[0],s=o[1];e.includes(a)||(-1!==n.indexOf(a)?i[a]=s:r[a]=s)}),[r,i]}function nG(t,e){var n={YYYY:t.getFullYear(),MM:t.getMonth()+1,DD:t.getDate(),HH:t.getHours(),mm:t.getMinutes(),ss:t.getSeconds()},r=e;return Object.keys(n).forEach(function(t){var e=n[t];r=r.replace(t,"YYYY"===t?"".concat(e):"".concat(e).padStart(2,"0"))}),r}function rG(t,e){if(e)try{var n=e.replace(/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,function(e,n,r){return"translate(".concat(function(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=We([e,n].map(function(t,e){var n;return t.includes("%")?parseFloat((null===(n=t.match(/[+-]?([0-9]*[.])?[0-9]+/))||void 0===n?void 0:n[0])||"0")/100*(0===e?i:o):t}),2);return[a[0],a[1]]}(t,n,r),")")});t.attr("transform",n)}catch(t){}}var iG=function(t,e){null!=e?t.replaceChildren?Array.isArray(e)?t.replaceChildren.apply(t,He([],We(e),!1)):t.replaceChildren(e):(t.innerHTML="",Array.isArray(e)?e.forEach(function(e){return t.appendChild(e)}):t.appendChild(e)):t.innerHTML=""};function oG(t){return/\S+-\S+/g.test(t)?t.split("-").map(function(t){return t[0]}):t.length>2?[t[0]]:t.split("")}function aG(){lz(this,"hidden"!==this.attributes.visibility)}var sG=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,bz({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return Be(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=uz(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&aG.call(this)},e.prototype.update=function(t,e){var n;return this.attr(bz({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,ze(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}(Jl),lG=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},cG=lG,uG=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},hG=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},dG=hG;var fG=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function pG(t){var e=function(t){var e="default";if(qt(t)&&t instanceof Image)e="image";else if(Ut(t))e="symbol";else if(ne(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var gG=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),e.prototype.render=function(t,n){var r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o,s=this.getSubShapeStyle(t),l=s.symbol,c=s.size,u=void 0===c?16:c,h=ze(s,["symbol","size"]),d=pG(l);Oz(!!d,$z(n),function(t){t.maybeAppendByClassName("marker",d).attr("className","marker ".concat(d,"-marker")).call(function(t){if("image"===d){var n=2*u;t.styles({img:l,width:n,height:n,x:i-u,y:a-u})}else{n=u/2;var r=Ut(l)?l:e.getSymbol(l);t.styles(Fe({d:null==r?void 0:r(i,a,n)},h))}})})},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(sG);function vG(t,...e){return e.reduce((t,e)=>n=>t(e(n)),t)}function mG(t,e){return e-t?n=>(n-t)/(e-t):t=>.5}gG.registerSymbol("cross",function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]}),gG.registerSymbol("hyphen",function(t,e,n){return[["M",t-n,e],["L",t+n,e]]}),gG.registerSymbol("line",uG),gG.registerSymbol("plus",function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]}),gG.registerSymbol("tick",function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]}),gG.registerSymbol("circle",lG),gG.registerSymbol("point",cG),gG.registerSymbol("bowtie",function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]}),gG.registerSymbol("hexagon",function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]}),gG.registerSymbol("square",function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]}),gG.registerSymbol("diamond",function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]}),gG.registerSymbol("triangle",function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]}),gG.registerSymbol("triangle-down",function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]}),gG.registerSymbol("line",uG),gG.registerSymbol("dot",hG),gG.registerSymbol("dash",dG),gG.registerSymbol("smooth",function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]}),gG.registerSymbol("hv",function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]}),gG.registerSymbol("vh",function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]}),gG.registerSymbol("hvh",function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]}),gG.registerSymbol("vhv",function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}),gG.registerSymbol("focus",function(t,e,n){var r=.2*n,i=.7*n;return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"],["M",t-i,e],["L",t-r,e],["M",t+r,e],["L",t+i,e],["M",t,e-i],["L",t,e-r],["M",t,e+r],["L",t,e+i]]});const yG=Math.sqrt(50),bG=Math.sqrt(10),xG=Math.sqrt(2);function EG(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/10**i;return i>=0?(o>=yG?10:o>=bG?5:o>=xG?2:1)*10**i:-(10**-i)/(o>=yG?10:o>=bG?5:o>=xG?2:1)}const wG=(t,e,n=5)=>{const r=[t,e];let i,o=0,a=r.length-1,s=r[o],l=r[a];return l<s&&([s,l]=[l,s],[o,a]=[a,o]),i=EG(s,l,n),i>0?(s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i,i=EG(s,l,n)):i<0&&(s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i,i=EG(s,l,n)),i>0?(r[o]=Math.floor(s/i)*i,r[a]=Math.ceil(l/i)*i):i<0&&(r[o]=Math.ceil(s*i)/i,r[a]=Math.floor(l*i)/i),r};function kG(t){return!(ve(t)||(e=t,null===e)||Number.isNaN(t));var e}var MG={exports:{}},SG={exports:{}},NG=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},TG=Array.prototype.concat,OG=Array.prototype.slice,CG=SG.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];NG(i)?e=TG.call(e,OG.call(i)):e.push(i)}return e};CG.wrap=function(t){return function(){return t(CG(arguments))}};var AG=SG.exports,PG={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},RG=AG,DG=Object.hasOwnProperty,LG=Object.create(null);for(var _G in PG)DG.call(PG,_G)&&(LG[PG[_G]]=_G);var IG=MG.exports={to:{},get:{}};function jG(t,e,n){return Math.min(Math.max(e,t),n)}function BG(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}IG.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=IG.get.hsl(t),n="hsl";break;case"hwb":e=IG.get.hwb(t),n="hwb";break;default:e=IG.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},IG.get.rgb=function(t){if(!t)return null;var e,n,r,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var o=2*n;i[n]=parseInt(e.slice(o,o+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)i[n]=parseInt(e[n]+e[n],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)i[n]=parseInt(e[n+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:DG.call(PG,e[1])?((i=PG[e[1]])[3]=1,i):null:null;for(n=0;n<3;n++)i[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(n=0;n<3;n++)i[n]=jG(i[n],0,255);return i[3]=jG(i[3],0,1),i},IG.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,jG(parseFloat(e[2]),0,100),jG(parseFloat(e[3]),0,100),jG(isNaN(n)?1:n,0,1)]}return null},IG.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,jG(parseFloat(e[2]),0,100),jG(parseFloat(e[3]),0,100),jG(isNaN(n)?1:n,0,1)]}return null},IG.to.hex=function(){var t=RG(arguments);return"#"+BG(t[0])+BG(t[1])+BG(t[2])+(t[3]<1?BG(Math.round(255*t[3])):"")},IG.to.rgb=function(){var t=RG(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},IG.to.rgb.percent=function(){var t=RG(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},IG.to.hsl=function(){var t=RG(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},IG.to.hwb=function(){var t=RG(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},IG.to.keyword=function(t){return LG[t.slice(0,3)]};var FG=E(MG.exports);function zG(t,e,n){let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function GG(t){const e=FG.get(t);if(!e)return null;const{model:n,value:r}=e;return"rgb"===n?r:"hsl"===n?function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100,i=t[3];if(0===n)return[255*r,255*r,255*r,i];const o=r<.5?r*(1+n):r+n-r*n,a=2*r-o;return[255*zG(a,o,e+1/3),255*zG(a,o,e),255*zG(a,o,e-1/3),i]}(r):null}const VG=(t,e)=>n=>t*(1-n)+e*n,WG=(t,e)=>"number"==typeof t&&"number"==typeof e?VG(t,e):"string"==typeof t&&"string"==typeof e?((t,e)=>{const n=GG(t),r=GG(e);return null===n||null===r?n?()=>t:()=>e:t=>{const e=new Array(4);for(let i=0;i<4;i+=1){const o=n[i],a=r[i];e[i]=o*(1-t)+a*t}const[i,o,a,s]=e;return`rgba(${Math.round(i)}, ${Math.round(o)}, ${Math.round(a)}, ${s})`}})(t,e):()=>t,HG=(t,e)=>{const n=VG(t,e);return t=>Math.round(n(t))};function UG({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):n}function $G(t){return"object"==typeof t?t.valueOf():t}class YG extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=$G,null!==t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(UG({map:this.map,initKey:this.initKey},t))}has(t){return super.has(UG({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(function({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(function({map:t,initKey:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}({map:this.map,initKey:this.initKey},t))}}class qG{constructor(t){this.options=Me({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=Me({},this.options,t),this.rescale(t)}rescale(t){}}const XG=Symbol("defaultUnknown");function KG(t,e,n){for(let r=0;r<e.length;r+=1)t.has(e[r])||t.set(n(e[r]),r)}function ZG(t){const{value:e,from:n,to:r,mapper:i,notFoundReturn:o}=t;let a=i.get(e);if(void 0===a){if(o!==XG)return o;a=n.push(e)-1,i.set(e,a)}return r[a%r.length]}function QG(t){return t instanceof Date?t=>`${t}`:"object"==typeof t?t=>JSON.stringify(t):t=>t}class JG extends qG{getDefaultOptions(){return{domain:[],range:[],unknown:XG}}constructor(t){super(t)}map(t){return 0===this.domainIndexMap.size&&KG(this.domainIndexMap,this.getDomain(),this.domainKey),ZG({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&KG(this.rangeIndexMap,this.getRange(),this.rangeKey),ZG({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){const[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=QG(e),this.rangeKey=QG(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new JG(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function tV(t){return Math.round(1e12*t)/1e12}function eV(t){const{domain:e,range:n,paddingOuter:r,paddingInner:i,flex:o,round:a,align:s}=t,l=e.length,c=function(t,e){const n=e-t.length;return n>0?[...t,...new Array(n).fill(1)]:n<0?t.slice(0,e):t}(o,l),[u,h]=n,d=h-u,f=d/(2/l*r+1-1/l*i),p=f*i/l,g=f-l*p,v=function(t){const e=Math.min(...t);return t.map(t=>t/e)}(c),m=g/v.reduce((t,e)=>t+e),y=new YG(e.map((t,e)=>{const n=v[e]*m;return[t,a?Math.floor(n):n]})),b=new YG(e.map((t,e)=>{const n=v[e]*m+p;return[t,a?Math.floor(n):n]})),x=Array.from(b.values()).reduce((t,e)=>t+e),E=u+(d-(x-x/l*i))*s;let w=a?Math.round(E):E;const k=new Array(l);for(let t=0;t<l;t+=1){k[t]=tV(w);const n=e[t];w+=b.get(n)}return{valueBandWidth:y,valueStep:b,adjustedRange:k}}class nV extends JG{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:XG,flex:[]}}constructor(t){super(t)}clone(){return new nV(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:r,flex:i}=this.options,{adjustedRange:o,valueBandWidth:a,valueStep:s}=function(t){var e;const{domain:n}=t,r=n.length;if(0===r)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(null===(e=t.flex)||void 0===e?void 0:e.length)return eV(t);const{range:i,paddingOuter:o,paddingInner:a,round:s,align:l}=t;let c,u,h=i[0];const d=i[1]-h,f=2*o,p=r-a;c=d/Math.max(1,f+p),s&&(c=Math.floor(c)),h+=(d-c*(r-a))*l,u=c*(1-a),s&&(h=Math.round(h),u=Math.round(u));const g=new Array(r).fill(0).map((t,e)=>h+e*c);return{valueStep:c,valueBandWidth:u,adjustedRange:g}}({align:t,range:n,round:r,flex:i,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=s,this.valueBandWidth=a,this.adjustedRange=o}}const rV=(t,e,n)=>{let r,i,o=t,a=e;if(o===a&&n>0)return[o];let s=EG(o,a,n);if(0===s||!Number.isFinite(s))return[];if(s>0){o=Math.ceil(o/s),a=Math.floor(a/s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)*s}else{s=-s,o=Math.ceil(o*s),a=Math.floor(a*s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)/s}return i},iV=(t,e,n)=>{const[r,i]=t,[o,a]=e;let s,l;return r<i?(s=mG(r,i),l=n(o,a)):(s=mG(i,r),l=n(a,o)),vG(l,s)},oV=(t,e,n)=>{const r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=t[0]>t[r],s=a?[...t].reverse():t,l=a?[...e].reverse():e;for(let t=0;t<r;t+=1)i[t]=mG(s[t],s[t+1]),o[t]=n(l[t],l[t+1]);return e=>{const n=function(t,e,n,r){let i=n,o=r||t.length;const a=t=>t;for(;i<o;){const n=Math.floor((i+o)/2);a(t[n])>e?o=n:i=n+1}return i}(t,e,1,r)-1,a=i[n];return vG(o[n],a)(e)}},aV=(t,e,n,r)=>(Math.min(t.length,e.length)>2?oV:iV)(t,e,r?HG:n);class sV extends qG{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:VG,tickCount:5}}map(t){return kG(t)?this.output(t):this.options.unknown}invert(t){return kG(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...r]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...r)}getTicks(){const{tickMethod:t}=this.options,[e,n,r,...i]=this.getTickMethodOptions();return t(e,n,r,...i)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return wG}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,r=this.options.domain.map(t),i=Math.min(r.length,n.length);return e?function(t,e){const n=e<t?e:t,r=t>e?t:e;return t=>Math.min(Math.max(n,t),r)}(r[0],r[i-1]):Ie}composeOutput(t,e){const{domain:n,range:r,round:i,interpolate:o}=this.options,a=aV(n.map(t),r,o,i);this.output=vG(a,e,t)}composeInput(t,e,n){const{domain:r,range:i}=this.options,o=aV(i,r.map(t),VG);this.input=vG(e,n,o)}}class lV extends sV{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:WG,tickMethod:rV,tickCount:5}}chooseTransforms(){return[Ie,Ie]}clone(){return new lV(this.options)}}var cV=function(t){function e(e){var n=this,r=e.style,i=ze(e,["style"]);return(n=t.call(this,Me({},{type:"column"},Fe({style:r},i)))||this).columnsGroup=new ec({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return Be(e,t),e.prototype.render=function(){var t=this.attributes,e=t.columns,n=t.x,r=t.y;this.columnsGroup.style.transform="translate(".concat(n,", ").concat(r,")"),$z(this.columnsGroup).selectAll(".column").data(e.flat()).join(function(t){return t.append("rect").attr("className","column").each(function(t){this.attr(t)})},function(t){return t.each(function(t){this.attr(t)})},function(t){return t.remove()})},e.prototype.update=function(t){this.attr(bz({},this.attributes,t)),this.render()},e.prototype.clear=function(){this.removeChildren()},e}(Kl),uV=function(t){function e(e){var n=this,r=e.style,i=ze(e,["style"]);return(n=t.call(this,Me({},{type:"lines"},Fe({style:r},i)))||this).linesGroup=n.appendChild(new ec),n.areasGroup=n.appendChild(new ec),n.render(),n}return Be(e,t),e.prototype.render=function(){var t=this.attributes,e=t.lines,n=t.areas,r=t.x,i=t.y;this.style.transform="translate(".concat(r,", ").concat(i,")"),e&&this.renderLines(e),n&&this.renderAreas(n)},e.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},e.prototype.update=function(t){this.attr(bz({},this.attributes,t)),this.render()},e.prototype.renderLines=function(t){$z(this.linesGroup).selectAll(".line").data(t).join(function(t){return t.append("path").attr("className","line").each(function(t){this.attr(t)})},function(t){return t.each(function(t){this.attr(t)})},function(t){return t.remove()})},e.prototype.renderAreas=function(t){$z(this.linesGroup).selectAll(".area").data(t).join(function(t){return t.append("path").attr("className","area").each(function(t){this.attr(t)})},function(t){return t.each(function(t){this.style(t)})},function(t){return t.remove()})},e}(Kl);function hV(t,e){void 0===e&&(e=!1);var n=e?t.length-1:0,r=t.map(function(t,e){return He([e===n?"M":"L"],We(t),!1)});return e?r.reverse():r}function dV(t,e){if(void 0===e&&(e=!1),t.length<=2)return hV(t);for(var n=[],r=t.length,i=0;i<r;i+=1){var o=e?t[r-i-1]:t[i];Te(o,n.slice(-2))||n.push.apply(n,He([],We(o),!1))}var a=zz(n);return e?a.unshift(He(["M"],We(t[r-1]),!1)):a.unshift(He(["M"],We(t[0]),!1)),a}function fV(t,e,n){var r=ye(t);return r.push(["L",e,n],["L",0,n],["Z"]),r}function pV(t){return 0===t.length?[0,0]:[ee(ce(t,function(t){return ee(t)||0})),te(le(t,function(t){return te(t)||0}))]}function gV(t){for(var e=ye(t),n=e[0].length,r=We([Array(n).fill(0),Array(n).fill(0)],2),i=r[0],o=r[1],a=0;a<e.length;a+=1)for(var s=e[a],l=0;l<n;l+=1)s[l]>=0?(s[l]+=i[l],i[l]=s[l]):(s[l]+=o[l],o[l]=s[l]);return e}var vV=function(t){function e(e){return t.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Be(e,t),Object.defineProperty(e.prototype,"rawData",{get:function(){var t=this.attributes.data;if(!t||0===(null==t?void 0:t.length))return[[]];var e=ye(t);return ae(e[0])?[e]:e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.isStack?gV(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){var t=this.scales.y,e=We(t.getOptions().domain||[0,0],2),n=e[0],r=e[1];return r<0?t.map(r):t.map(n<0?0:n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"containerShape",{get:function(){var t=this.attributes;return{width:t.width,height:t.height}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linesStyle",{get:function(){var t=this,e=this.attributes,n=e.type,r=e.isStack,i=e.smooth;if("line"!==n)throw new Error("linesStyle can only be used in line type");var o=Jz(this.attributes,"area"),a=Jz(this.attributes,"line"),s=this.containerShape.width,l=this.data;if(0===l[0].length)return{lines:[],areas:[]};var c=this.scales,u=function(t,e){var n,r=e.x,i=e.y,o=We(i.getOptions().range||[0,0],2),a=o[0],s=o[1];return s>a&&(n=We([a,s],2),s=n[0],a=n[1]),t.map(function(t){return t.map(function(t,e){return[r.map(e),oe(i.map(t),s,a)]})})}(l,{x:c.x,y:c.y}),h=[];if(o){var d=this.baseline;h=r?i?function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=t[i],a=dV(o),s=void 0;if(0===i)s=fV(a,e,n);else{var l=dV(t[i-1],!0),c=o[0];l[0][0]="L",s=He(He(He([],We(a),!1),We(l),!1),[He(["M"],We(c),!1),["Z"]],!1)}r.push(s)}return r}(u,s,d):function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=hV(t[i]),a=void 0;if(0===i)a=fV(o,e,n);else{var s=hV(t[i-1],!0);s[0][0]="L",a=He(He(He([],We(o),!1),We(s),!1),[["Z"]],!1)}r.push(a)}return r}(u,s,d):function(t,e,n,r){return t.map(function(t){return fV(e?dV(t):hV(t),n,r)})}(u,i,s,d)}return{lines:u.map(function(e,n){return Fe({stroke:t.getColor(n),d:i?dV(e):hV(e)},a)}),areas:h.map(function(e,n){return Fe({d:e,fill:t.getColor(n)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnsStyle",{get:function(){var t=this,e=Jz(this.attributes,"column"),n=this.attributes,r=n.isStack,i=n.type,o=n.scale;if("column"!==i)throw new Error("columnsStyle can only be used in column type");var a=this.containerShape.height,s=this.rawData;if(!s)return{columns:[]};r&&(s=gV(s));var l=this.createScales(s),c=l.x,u=l.y,h=We(pV(s),2),d=h[0],f=h[1],p=new lV({domain:[0,f-(d>0?0:d)],range:[0,a*o]}),g=c.getBandWidth(),v=this.rawData;return{columns:s.map(function(n,i){return n.map(function(n,o){var a=g/s.length;return Fe(Fe({fill:t.getColor(i)},e),r?{x:c.map(o),y:u.map(n),width:g,height:p.map(v[i][o])}:{x:c.map(o)+a*i,y:n>=0?u.map(n):u.map(0),width:a,height:p.map(Math.abs(n))})})})}},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){var n,r,i;(n=e,r=".container",i="rect",n.querySelector(r)?$z(n).select(r):$z(n).append(i)).attr("className","container").node();var o=t.type,a=t.x,s=t.y,l="spark".concat(o),c=Fe({x:a,y:s},"line"===o?this.linesStyle:this.columnsStyle);$z(e).selectAll(".spark").data([o]).join(function(t){return t.append(function(t){return"line"===t?new uV({className:l,style:c}):new cV({className:l,style:c})}).attr("className","spark ".concat(l))},function(t){return t.update(c)},function(t){return t.remove()})},e.prototype.getColor=function(t){var e=this.attributes.color;return Yt(e)?e[t%e.length]:Ut(e)?e.call(null,t):e},e.prototype.createScales=function(t){var e,n,r=this.attributes,i=r.type,o=r.scale,a=r.range,s=void 0===a?[]:a,l=r.spacing,c=this.containerShape,u=c.width,h=c.height,d=We(pV(t),2),f=d[0],p=d[1],g=new lV({domain:[null!==(e=s[0])&&void 0!==e?e:f,null!==(n=s[1])&&void 0!==n?n:p],range:[h,h*(1-o)]});return"line"===i?{type:i,x:new lV({domain:[0,t[0].length-1],range:[0,u]}),y:g}:{type:i,x:new nV({domain:t[0].map(function(t,e){return e}),range:[0,u],paddingInner:l,paddingOuter:l/2,align:.5}),y:g}},e.tag="sparkline",e}(sG);function mV(t){if(!t)return{enter:!1,update:!1,exit:!1};var e=["enter","update","exit"],n=Object.fromEntries(Object.entries(t).filter(function(t){var n=We(t,1)[0];return!e.includes(n)}));return Object.fromEntries(e.map(function(e){return function(t){return"boolean"!=typeof t&&"enter"in t&&"update"in t&&"exit"in t}(t)?!1===t[e]?[e,!1]:[e,Fe(Fe({},t[e]),n)]:[e,n]}))}function yV(t,e){t?t.finished.then(e):e()}function bV(t,e){"update"in t?t.update(e):t.attr(e)}function xV(t,e,n){return 0===e.length?null:n?t.animate(e,n):(bV(t,{style:e.slice(-1)[0]}),null)}function EV(t,e,n){var r={},i={};return Object.entries(e).forEach(function(e){var n=We(e,2),o=n[0],a=n[1];if(!$t(a)){var s=t.style[o]||t.parsedStyle[o]||0;s!==a&&(r[o]=s,i[o]=a)}}),n?xV(t,[r,i],Fe({fill:"both"},n)):(bV(t,i),null)}function wV(t,e){return t.style.opacity||(t.style.opacity=1),EV(t,{opacity:0},e)}var kV={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},MV={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},SV={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},NV=mz({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),TV=mz({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),OV=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),e.prototype.render=function(t,e){var n=t.x,r=t.y,i=t.size,o=void 0===i?10:i,a=t.radius,s=void 0===a?o/4:a,l=t.orientation,c=ze(t,["x","y","size","radius","orientation"]),u=o,h=2.4*u,d=$z(e).maybeAppendByClassName(TV.iconRect,"rect").styles(Fe(Fe({},c),{width:u,height:h,radius:s,x:n-u/2,y:r-h/2,transformOrigin:"center"})),f=n+1/3*u-u/2,p=n+2/3*u-u/2,g=r+1/4*h-h/2,v=r+3/4*h-h/2;d.maybeAppendByClassName("".concat(TV.iconLine,"-1"),"line").styles(Fe({x1:f,x2:f,y1:g,y2:v},c)),d.maybeAppendByClassName("".concat(TV.iconLine,"-2"),"line").styles(Fe({x1:p,x2:p,y1:g,y2:v},c)),"vertical"===l&&(d.node().style.transform="rotate(90)")},e}(sG),CV=function(t){function e(e){return t.call(this,e,SV)||this}return Be(e,t),e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.x,i=n.y,o=n.showLabel,a=Jz(this.attributes,"label"),s=a.x,l=void 0===s?0:s,c=a.y,u=void 0===c?0:c,h=a.transform,d=a.transformOrigin,f=We(eG(ze(a,["x","y","transform","transformOrigin"]),[]),2),p=f[0],g=f[1],v=$z(t).maybeAppendByClassName(TV.labelGroup,"g").styles(g),m=Fe(Fe({},MV),p),y=m.text,b=ze(m,["text"]);Oz(!!o,v,function(t){e.label=t.maybeAppendByClassName(TV.label,"text").styles(Fe(Fe({},b),{x:r+l,y:i+u,transform:h,transformOrigin:d,text:"".concat(y)})),e.label.on("mousedown",function(t){t.stopPropagation()}),e.label.on("touchstart",function(t){t.stopPropagation()})})},e.prototype.renderIcon=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.orientation,o=e.type,a=Fe(Fe({x:n,y:r,orientation:i},kV),Jz(this.attributes,"icon")),s=this.attributes.iconShape,l=void 0===s?function(){return new OV({style:a})}:s;$z(t).maybeAppendByClassName(TV.iconGroup,"g").selectAll(TV.icon.class).data([l]).join(function(t){return t.append("string"==typeof l?l:function(){return l(o)}).attr("className",TV.icon.name)},function(t){return t.update(a)},function(t){return t.remove()})},e.prototype.render=function(t,e){this.renderIcon(e),this.renderLabel(e)},e}(sG),AV=function(t){function e(e){var n=t.call(this,e,Fe(Fe(Fe({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(t){return t.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},tG(SV,"handle")),tG(kV,"handleIcon")),tG(MV,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(t){return function(e){e.stopPropagation(),n.target=t,n.prevPos=n.getOrientVal(Nz(e));var r=n.availableSpace,i=r.x,o=r.y,a=n.getBBox(),s=a.x,l=a.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([i,o])-n.getOrientVal([+s,+l])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(t){var e=n.attributes,r=e.slidable,i=e.brushable,o=e.type;t.stopPropagation();var a=n.getOrientVal(Nz(t)),s=a-n.prevPos;if(s){var l=n.getRatio(s);switch(n.target){case"start":r&&n.setValuesOffset(l);break;case"end":r&&n.setValuesOffset(0,l);break;case"selection":r&&n.setValuesOffset(l,l);break;case"track":if(!i)return;n.selectionWidth+=l,"range"===o?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0)}n.prevPos=a}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(t){var e=n.attributes,r=e.onChange,i=e.type,o="range"===i?t:t[1],a="range"===i?n.getValues():n.getValues()[1],s=new Zs("valuechange",{detail:{oldValue:o,value:a}});n.dispatchEvent(s),null==r||r(a)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Be(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return this.attributes.values},set:function(t){this.attributes.values=this.clampValues(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sparklineStyle",{get:function(){if("horizontal"!==this.attributes.orientation)return null;var t=Jz(this.attributes,"sparkline");return Fe(Fe({zIndex:0},this.availableSpace),t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t=this.attributes,e=t.trackLength,n=t.trackSize,r=We(this.getOrientVal([[e,n],[n,e]]),2);return{width:r[0],height:r[1]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes;t.x,t.y;var e=We(Yz(t.padding),4),n=e[0],r=e[1],i=e[2],o=e[3],a=this.shape;return{x:o,y:n,width:a.width-(o+r),height:a.height-(n+i)}},enumerable:!1,configurable:!0}),e.prototype.getValues=function(){return this.values},e.prototype.setValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1),this.attributes.values=t;var n=!1!==e&&this.attributes.animate;this.updateSelectionArea(n),this.updateHandlesPosition(n)},e.prototype.updateSelectionArea=function(t){var e=this.calcSelectionArea();this.foregroundGroup.selectAll(NV.selection.class).each(function(n,r){EV(this,e[r],t)})},e.prototype.updateHandlesPosition=function(t){this.attributes.showHandle&&(this.startHandle&&EV(this.startHandle,this.getHandleStyle("start"),t),this.endHandle&&EV(this.endHandle,this.getHandleStyle("end"),t))},e.prototype.innerSetValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1);var n=this.values,r=this.clampValues(t);this.attributes.values=r,this.setValues(r),e&&this.onValueChange(n)},e.prototype.renderTrack=function(t){var e=this.attributes,n=e.x,r=e.y,i=Jz(this.attributes,"track");this.trackShape=$z(t).maybeAppendByClassName(NV.track,"rect").styles(Fe(Fe({x:n,y:r},this.shape),i))},e.prototype.renderBrushArea=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.brushable;this.brushArea=$z(t).maybeAppendByClassName(NV.brushArea,"rect").styles(Fe({x:n,y:r,fill:"transparent",cursor:i?"crosshair":"default"},this.shape))},e.prototype.renderSparkline=function(t){var e=this,n=this.attributes,r=n.x,i=n.y;Oz("horizontal"===n.orientation,$z(t).maybeAppendByClassName(NV.sparklineGroup,"g"),function(t){var n=Fe(Fe({},e.sparklineStyle),{x:r,y:i});t.maybeAppendByClassName(NV.sparkline,function(){return new vV({style:n})}).update(n)})},e.prototype.renderHandles=function(){var t,e=this,n=this.attributes,r=n.showHandle,i=n.type,o=r?"range"===i?["start","end"]:["end"]:[],a=this;null===(t=this.foregroundGroup)||void 0===t||t.selectAll(NV.handle.class).data(o.map(function(t){return{type:t}}),function(t){return t.type}).join(function(t){return t.append(function(t){var n=t.type;return new CV({style:e.getHandleStyle(n)})}).each(function(t){var e=t.type;this.attr("class","".concat(NV.handle.name," ").concat(e,"-handle"));var n="".concat(e,"Handle");a[n]=this,this.addEventListener("pointerdown",a.onDragStart(e))})},function(t){return t.each(function(t){var e=t.type;this.update(a.getHandleStyle(e))})},function(t){return t.each(function(t){var e=t.type,n="".concat(e,"Handle");a[n]=void 0}).remove()})},e.prototype.renderSelection=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.type,o=e.selectionType;this.foregroundGroup=$z(t).maybeAppendByClassName(NV.foreground,"g");var a=Jz(this.attributes,"selection"),s=function(t){return t.style("visibility",function(t){return t.show?"visible":"hidden"}).style("cursor",function(t){return"select"===o?"grab":"invert"===o?"crosshair":"default"}).styles(Fe(Fe({},a),{transform:"translate(".concat(n,", ").concat(r,")")}))},l=this;this.foregroundGroup.selectAll(NV.selection.class).data("value"===i?[]:this.calcSelectionArea().map(function(t,e){return{style:Fe({},t),index:e,show:"select"===o?1===e:1!==e}}),function(t){return t.index}).join(function(t){return t.append("rect").attr("className",NV.selection.name).call(s).each(function(t,e){var n=this;1===e?(l.selectionShape=$z(this),this.on("pointerdown",function(t){n.attr("cursor","grabbing"),l.onDragStart("selection")(t)}),l.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),l.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),l.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){n.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){n.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){n.attr("cursor","pointer")})):this.on("pointerdown",l.onDragStart("track"))})},function(t){return t.call(s)},function(t){return t.remove()}),this.updateSelectionArea(!1),this.renderHandles()},e.prototype.render=function(t,e){this.renderTrack(e),this.renderSparkline(e),this.renderBrushArea(e),this.renderSelection(e)},e.prototype.clampValues=function(t,e){var n;void 0===e&&(e=4);var r=We(this.range,2),i=r[0],o=r[1],a=We(this.getValues().map(function(t){return Bz(t,e)}),2),s=a[0],l=a[1],c=We(((Array.isArray(t)?t:[s,null!=t?t:l])||[s,l]).map(function(t){return Bz(t,e)}),2),u=c[0],h=c[1];if("value"===this.attributes.type)return[0,oe(h,i,o)];u>h&&(u=(n=We([h,u],2))[0],h=n[1]);var d=h-u;return d>o-i?[i,o]:u<i?s===i&&l===h?[i,h]:[i,d+i]:h>o?l===o&&s===u?[u,o]:[o-d,o]:[u,h]},e.prototype.calcSelectionArea=function(t){var e=We(this.clampValues(t),2),n=e[0],r=e[1],i=this.availableSpace,o=i.x,a=i.y,s=i.width,l=i.height;return this.getOrientVal([[{y:a,height:l,x:o,width:n*s},{y:a,height:l,x:n*s+o,width:(r-n)*s},{y:a,height:l,x:r*s,width:(1-r)*s}],[{x:o,width:s,y:a,height:n*l},{x:o,width:s,y:n*l+a,height:(r-n)*l},{x:o,width:s,y:r*l,height:(1-r)*l}]])},e.prototype.calcHandlePosition=function(t){var e=this.attributes.handleIconOffset,n=this.availableSpace,r=n.x,i=n.y,o=n.width,a=n.height,s=We(this.clampValues(),2),l=s[0],c=s[1],u="start"===t?-e:e,h=("start"===t?l:c)*this.getOrientVal([o,a])+u;return{x:r+this.getOrientVal([h,o/2]),y:i+this.getOrientVal([a/2,h])}},e.prototype.inferTextStyle=function(t){return"horizontal"===this.attributes.orientation?{}:"start"===t?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:"end"===t?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},e.prototype.calcHandleText=function(t){var e,n=this.attributes,r=n.type,i=n.orientation,o=n.formatter,a=n.autoFitLabel,s=Jz(this.attributes,"handle"),l=Jz(s,"label"),c=s.spacing,u=this.getHandleSize(),h=this.clampValues(),d=o("start"===t?h[0]:h[1]),f=new hz({style:Fe(Fe(Fe({},l),this.inferTextStyle(t)),{text:d})}),p=f.getBBox(),g=p.width,v=p.height;if(f.destroy(),!a){if("value"===r)return{text:d,x:0,y:-v-c};var m=c+u+("horizontal"===i?g/2:0);return(e={text:d})["horizontal"===i?"x":"y"]="start"===t?-m:m,e}var y=0,b=0,x=this.availableSpace,E=x.width,w=x.height,k=this.calcSelectionArea()[1],M=k.x,S=k.y,N=k.width,T=k.height,O=c+u;if("horizontal"===i){var C=O+g/2;if("start"===t)y=M-O-g>0?-C:C;else y=E-M-N-O>g?C:-C}else{var A=v+O;b="start"===t?S-u>v?-A:O:w-(S+T)-u>v?A:-O}return{x:y,y:b,text:d}},e.prototype.getHandleLabelStyle=function(t){var e=Jz(this.attributes,"handleLabel");return Fe(Fe(Fe({},e),this.calcHandleText(t)),this.inferTextStyle(t))},e.prototype.getHandleIconStyle=function(){var t=this.attributes.handleIconShape,e=Jz(this.attributes,"handleIcon"),n=this.getOrientVal(["ew-resize","ns-resize"]),r=this.getHandleSize();return Fe({cursor:n,shape:t,size:r},e)},e.prototype.getHandleStyle=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.showLabel,o=e.showLabelOnInteraction,a=e.orientation,s=this.calcHandlePosition(t),l=s.x,c=s.y,u=this.calcHandleText(t),h=i;return!i&&o&&(h=!!this.target),Fe(Fe(Fe({},tG(this.getHandleIconStyle(),"icon")),tG(Fe(Fe({},this.getHandleLabelStyle(t)),u),"label")),{transform:"translate(".concat(l+n,", ").concat(c+r,")"),orientation:a,showLabel:h,type:t,zIndex:3})},e.prototype.getHandleSize=function(){var t=this.attributes,e=t.handleIconSize,n=t.width,r=t.height;return e||Math.floor((this.getOrientVal([+r,+n])+4)/2.4)},e.prototype.getOrientVal=function(t){var e=We(t,2),n=e[0],r=e[1];return"horizontal"===this.attributes.orientation?n:r},e.prototype.setValuesOffset=function(t,e){void 0===e&&(e=0);var n=this.attributes.type,r=We(this.getValues(),2),i=[r[0]+("range"===n?t:0),r[1]+e].sort();this.innerSetValues(i,!0)},e.prototype.getRatio=function(t){var e=this.availableSpace,n=e.width,r=e.height;return t/this.getOrientVal([n,r])},e.prototype.dispatchCustomEvent=function(t,e,n){var r=this;t.on(e,function(t){t.stopPropagation(),r.dispatchEvent(new Zs(n,{detail:t}))})},e.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var t=this.brushArea;this.dispatchCustomEvent(t,"click","trackClick"),this.dispatchCustomEvent(t,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(t,"pointerleave","trackMouseleave"),t.on("pointerdown",this.onDragStart("track"))},e.prototype.onScroll=function(t){if(this.attributes.scrollable){var e=t.deltaX,n=t.deltaY||e,r=this.getRatio(n);this.setValuesOffset(r,r)}},e.tag="slider",e}(sG),PV={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new lc({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};Me({},PV,{style:{type:"arc"}}),Me({},PV,{style:{}});var RV=mz({mainGroup:"main-group",gridGroup:"grid-group",grid:"grid",lineGroup:"line-group",line:"line",tickGroup:"tick-group",tick:"tick",tickItem:"tick-item",labelGroup:"label-group",label:"label",labelItem:"label-item",titleGroup:"title-group",title:"title",lineFirst:"line-first",lineSecond:"line-second"},"axis"),DV=mz({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function LV(t){return t.reduce(function(t,e,n){return t.push(He([0===n?"M":"L"],We(e),!1)),t},[])}function _V(t,e,n){return"surround"===e.type?function(t,e,n){var r=e.connect,i=void 0===r?"line":r,o=e.center;if("line"===i)return LV(t);if(!o)return[];var a=Iz(t[0],o),s=n?0:1;return t.reduce(function(t,e,n){return 0===n?t.push(He(["M"],We(e),!1)):t.push(He(["A",a,a,0,0,s],We(e),!1)),t},[])}(t,e,n):LV(t)}function IV(t,e,n){var r=n.type,i=n.connect,o=n.center,a=n.closed?[["Z"]]:[],s=We([_V(t,n),_V(e.slice().reverse(),n,!0)],2),l=s[0],c=s[1],u=We([t[0],e.slice(-1)[0]],2),h=u[0],d=u[1],f=function(t,e){return[l,t,c,e,a].flat()};if("line"===i||"surround"===r)return f([He(["L"],We(d),!1)],[He(["L"],We(h),!1)]);if(!o)throw new Error("Arc grid need to specified center");var p=We([Iz(d,o),Iz(h,o)],2),g=p[0],v=p[1];return f([He(["A",g,g,0,0,1],We(d),!1),He(["L"],We(d),!1)],[He(["A",v,v,0,0,0],We(h),!1),He(["L"],We(h),!1)])}var jV=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),e.prototype.render=function(t,e){t.type,t.center,t.areaFill,t.closed;var n=ze(t,["type","center","areaFill","closed"]),r=function(t){var e=t.data,n=void 0===e?[]:e;return t.closed?n.map(function(t){var e=t.points,n=We(e,1)[0];return Fe(Fe({},t),{points:He(He([],We(e),!1),[n],!1)})}):n}(t),i=$z(e).maybeAppendByClassName(DV.lineGroup,"g"),o=$z(e).maybeAppendByClassName(DV.regionGroup,"g"),a=function(t,e,n,r){var i=n.animate,o=n.isBillboard,a=e.map(function(t,e){return{id:t.id||"grid-line-".concat(e),d:_V(t.points,n)}});return t.selectAll(DV.line.class).data(a,function(t){return t.id}).join(function(t){return t.append("path").each(function(t,e){var n=gz(Wz(Fe({d:t.d},r)),[t,e,a]);this.attr(Fe({class:DV.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:o},n))})},function(t){return t.transition(function(t,e){return EV(this,gz(Wz(Fe({d:t.d},r)),[t,e,a]),i.update)})},function(t){return t.transition(function(){var t=this,e=wV(this,i.exit);return yV(e,function(){return t.remove()}),e})}).transitions()}(i,r,t,n),s=function(t,e,n){var r=n.animate,i=n.connect,o=n.areaFill;if(e.length<2||!o||!i)return[];for(var a=Array.isArray(o)?o:[o,"transparent"],s=function(t){return a[t%a.length]},l=[],c=0;c<e.length-1;c++){var u=We([e[c].points,e[c+1].points],2),h=IV(u[0],u[1],n);l.push({d:h,fill:s(c)})}return t.selectAll(DV.region.class).data(l,function(t,e){return e}).join(function(t){return t.append("path").each(function(t,e){var n=gz(t,[t,e,l]);this.attr(n)}).attr("className",DV.region.name)},function(t){return t.transition(function(t,e){return EV(this,gz(t,[t,e,l]),r.update)})},function(t){return t.transition(function(){var t=this,e=wV(this,r.exit);return yV(e,function(){return t.remove()}),e})}).transitions()}(o,r,t);return He(He([],We(a),!1),We(s),!1)},e}(sG);function BV(t,e){return Object.fromEntries(Object.entries(t).map(function(t){var n=We(t,2);return[n[0],gz(n[1],e)]}))}function FV(t,e){return e&&Ut(e)?t.filter(e):t}function zV(t,e){var n=e.startAngle;return(e.endAngle-n)*t+n}function GV(t,e){if("linear"===e.type){var n=We(e.startPos,2),r=n[0],i=n[1],o=We(e.endPos,2),a=We([o[0]-r,o[1]-i],2);return jz([a[0],a[1]])}var s=dz(zV(t,e));return[-Math.sin(s),Math.cos(s)]}function VV(t,e,n){return function(t,e){return e?[t[1],-t[0]]:[-t[1],t[0]]}(GV(t,n),"positive"!==e)}function WV(t,e){return VV(t,e.labelDirection,e)}function HV(t,e){return"linear"===e.type?function(t,e){var n=We(e.startPos,2),r=n[0],i=n[1],o=We(e.endPos,2),a=We([o[0]-r,o[1]-i],2);return[r+a[0]*t,i+a[1]*t]}(t,e):function(t,e){var n=e.radius,r=We(e.center,2),i=r[0],o=r[1],a=dz(zV(t,e));return[i+n*Math.cos(a),o+n*Math.sin(a)]}(t,e)}function UV(t){return 0===GV(0,t)[1]}function $V(t){return 0===GV(0,t)[0]}function YV(t,e){return e-t===360}function qV(t,e,n,r,i){var o=e-t,a=We([i,i],2),s=a[0],l=a[1],c=We([dz(t),dz(e)],2),u=c[0],h=c[1],d=function(t){return[n+i*Math.cos(t),r+i*Math.sin(t)]},f=We(d(u),2),p=f[0],g=f[1],v=We(d(h),2),m=v[0],y=v[1];if(YV(t,e)){var b=We(d((h+u)/2),2);return[["M",p,g],["A",s,l,0,1,0,b[0],b[1]],["A",s,l,0,1,0,m,y]]}var x=o>180?1:0,E=t>e?0:1;return"M".concat(p,",").concat(g,",A").concat(s,",").concat(l,",0,").concat(x,",").concat(E,",").concat(m,",").concat(y)}function XV(t,e,n,r){var i=e.startAngle,o=e.endAngle,a=e.center,s=e.radius;return t.selectAll(RV.line.class).data([{d:qV.apply(void 0,He(He([i,o],We(a),!1),[s],!1))}],function(t,e){return e}).join(function(t){return t.append("path").attr("className",RV.line.name).styles(e).styles({d:function(t){return t.d}})},function(t){return t.transition(function(){var t=this,e=function(t,e,n,r){if(!r)return t.attr("__keyframe_data__",n),null;var i=r.duration,o=void 0===i?0:i,a=Az(e,n),s=Math.ceil(+o/16),l=new Array(s).fill(0).map(function(t,e,n){return{__keyframe_data__:a(e/(n.length-1))}});return t.animate(l,Fe({fill:"both"},r))}(this,function(t){var e=t.attributes,n=e.startAngle,r=e.endAngle,i=e.center,o=e.radius;return He(He([n,r],We(i),!1),[o],!1)}(this),He(He([i,o],We(a),!1),[s],!1),r.update);if(e){var n=function(){var e=Oe(t.attributes,"__keyframe_data__");t.style.d=qV.apply(void 0,He([],We(e),!1))};e.onframe=n,e.onfinish=n}return e}).styles(e)},function(t){return t.remove()}).styles(n).transitions()}function KV(t){var e=We(t,2),n=We(e[0],2),r=n[0],i=n[1],o=We(e[1],2);return{x1:r,y1:i,x2:o[0],y2:o[1]}}function ZV(t,e,n,r){var i=e.showTrunc,o=e.startPos,a=e.endPos,s=e.truncRange,l=e.lineExtension,c=We([o,a],2),u=We(c[0],2),h=u[0],d=u[1],f=We(c[1],2),p=f[0],g=f[1],v=We(l?function(t,e,n){void 0===n&&(n=[0,0]);var r=We([t,e,n],3),i=We(r[0],2),o=i[0],a=i[1],s=We(r[1],2),l=s[0],c=s[1],u=We(r[2],2),h=u[0],d=u[1],f=We([l-o,c-a],2),p=f[0],g=f[1],v=Math.sqrt(Math.pow(p,2)+Math.pow(g,2)),m=We([-h/v,d/v],2),y=m[0],b=m[1];return[y*p,y*g,b*p,b*g]}(o,a,l):new Array(4).fill(0),4),m=v[0],y=v[1],b=v[2],x=v[3],E=function(e){return t.selectAll(RV.line.class).data(e,function(t,e){return e}).join(function(t){return t.append("line").attr("className",function(t){return"".concat(RV.line.name," ").concat(t.className)}).styles(n).transition(function(t){return EV(this,KV(t.line),!1)})},function(t){return t.styles(n).transition(function(t){return EV(this,KV(t.line),r.update)})},function(t){return t.remove()}).transitions()};if(!i||!s)return E([{line:[[h+m,d+y],[p+b,g+x]],className:RV.line.name}]);var w=We(s,2),k=w[0],M=w[1],S=p-h,N=g-d,T=We([h+S*k,d+N*k],2),O=T[0],C=T[1],A=We([h+S*M,d+N*M],2),P=A[0],R=A[1],D=E([{line:[[h+m,d+y],[O,C]],className:RV.lineFirst.name},{line:[[P,R],[p+b,g+x]],className:RV.lineSecond.name}]);return function(t,e){e.truncRange,e.truncShape,e.lineExtension}(0,e),D}function QV(t,e,n){var r,i=e.type,o=Jz(e,"line");return r="linear"===i?ZV(t,e,Fz(o,"arrow"),n):XV(t,e,Fz(o,"arrow"),n),function(t,e,n,r){var i,o=n.showArrow,a=n.showTrunc,s=n.lineArrow,l=n.lineArrowOffset,c=n.lineArrowSize;if(i="arc"===e?t.select(RV.line.class):a?t.select(RV.lineSecond.class):t.select(RV.line.class),!o||!s||"arc"===n.type&&YV(n.startAngle,n.endAngle)){var u=i.node();u&&(u.style.markerEnd=void 0)}else{var h=Tz(s);h.attr(r),Hz(h,c),i.style("markerEnd",h).style("markerEndOffset",-l)}}(t,i,e,o),r}function JV(t){var e=t.type,n=t.gridCenter;return"linear"===e?n:n||t.center}function tW(t,e){var n=e.gridLength;return t.map(function(t,r){var i=t.value,o=We(HV(i,e),2),a=o[0],s=o[1],l=We(Pz(function(t,e){return VV(t,e.gridDirection,e)}(i,e),n),2);return{id:r,points:[[a,s],[a+l[0],s+l[1]]]}})}function eW(t,e,n,r){var i=Jz(n,"grid"),o=i.type,a=i.areaFill,s=JV(n),l=FV(e,n.gridFilter),c="segment"===o?tW(l,n):function(t,e){var n=e.gridControlAngles,r=JV(e);if(!r)throw new Error("grid center is not provide");if(t.length<2)throw new Error("Invalid grid data");if(!n||0===n.length)throw new Error("Invalid gridControlAngles");var i=We(r,2),o=i[0],a=i[1];return t.map(function(t,r){var i=We(HV(t.value,e),2),s=i[0],l=i[1],c=We([s-o,l-a],2),u=c[0],h=c[1],d=[];return n.forEach(function(t){var e=dz(t),n=We([Math.cos(e),Math.sin(e)],2),r=n[0],i=n[1],s=u*r-h*i+o,l=u*i+h*r+a;d.push([s,l])}),{points:d,id:r}})}(l,n),u=Fe(Fe({},i),{center:s,areaFill:Ut(a)?l.map(function(t,e){return gz(a,[t,e,l])}):a,animate:r,data:c});return t.selectAll(RV.grid.class).data([1]).join(function(t){return t.append(function(){return new jV({style:u})}).attr("className",RV.grid.name)},function(t){return t.transition(function(){return this.update(u)})},function(t){return t.remove()}).transitions()}var nW=function(){function t(t,e,n,r){this.set(t,e,n,r)}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),t.prototype.rotatedPoints=function(t,e,n){var r=this,i=r.x1,o=r.y1,a=r.x2,s=r.y2,l=Math.cos(t),c=Math.sin(t),u=e-e*l+n*c,h=n-e*c-n*l;return[[l*i-c*s+u,c*i+l*s+h],[l*a-c*s+u,c*a+l*s+h],[l*i-c*o+u,c*i+l*o+h],[l*a-c*o+u,c*a+l*o+h]]},t.prototype.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},t.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},t}();function rW(t,e){var n=t.getEulerAngles()||0;t.setEulerAngles(0);var r=t.getBounds(),i=We(r.min,2),o=i[0],a=i[1],s=We(r.max,2),l=s[0],c=s[1],u=t.getBBox(),h=u.width,d=u.height,f=0,p=0,g=o,v=a,m=kz(t);if(m){d-=1.5;var y=m.style.textAlign,b=m.style.textBaseline;"center"===y?g=(o+l)/2:"right"!==y&&"end"!==y||(g=l),"middle"===b?v=(a+c)/2:"bottom"===b&&(v=c)}var x=We(Yz(e),4),E=x[0],w=void 0===E?0:E,k=x[1],M=void 0===k?0:k,S=x[2],N=void 0===S?w:S,T=x[3],O=new nW((f+=o)-(void 0===T?M:T),(p+=a)-w,f+h+M,p+d+N);return t.setEulerAngles(n),O.rotatedPoints(dz(n),g,v)}function iW(t,e){return e[0]<=Math.max(t[0][0],t[1][0])&&e[0]<=Math.min(t[0][0],t[1][0])&&e[1]<=Math.max(t[0][1],t[1][1])&&e[1]<=Math.min(t[0][1],t[1][1])}function oW(t,e,n){var r=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return 0===r?0:r<0?2:1}function aW(t,e){var n=oW(t[0],t[1],e[0]),r=oW(t[0],t[1],e[1]),i=oW(e[0],e[1],t[0]),o=oW(e[0],e[1],t[1]);return n!==r&&i!==o||(!(0!==n||!iW(t,e[0]))||(!(0!==r||!iW(t,e[1]))||(!(0!==i||!iW(e,t[0]))||!(0!==o||!iW(e,t[1])))))}function sW(t,e){return e.every(function(e){return function(t,e){var n=t.length;if(n<3)return!1;var r=[e,[9999,e[1]]],i=0,o=0;do{var a=[t[o],t[(o+1)%n]];if(aW(a,r)){if(0===oW(a[0],e,a[1]))return iW(a,e);i++}o=(o+1)%n}while(0!==o);return!!(1&i)}(t,e)})}function lW(t,e){return[[t[0],t[1],t[2],t[3]],[t[2],t[3],t[4],t[5]],[t[4],t[5],t[6],t[7]],[t[6],t[7],t[0],t[1]]].some(function(t){return function(t,e){var n=We(t,4),r=n[0],i=n[1],o=n[2],a=n[3],s=We(e,4),l=s[0],c=s[1],u=o-r,h=a-i,d=s[2]-l,f=s[3]-c,p=u*f-d*h;if(0===p)return!1;var g=p>0,v=r-l,m=i-c,y=u*m-h*v;if(y<0===g)return!1;var b=d*m-f*v;return b<0!==g&&y>p!==g&&b>p!==g}(e,t)})}function cW(t,e,n){var r,i,o=e.crossPadding,a=new Set,s=null,l=function(t,e){var n=t.type,r=t.labelDirection,i=t.crossSize;if(!i)return!1;if("arc"===n){var o=t.center,a=t.radius,s=We(o,2),l=s[0],c=s[1],u="negative"===r?0:i,h=-a-u,d=a+u,f=We(Yz(e),4),p=f[0],g=f[1],v=f[2],m=f[3];return new nW(l+h-m,c+h-p,l+d+g,c+d+v)}var y=We(t.startPos,2),b=y[0],x=y[1],E=We(t.endPos,2),w=E[0],k=E[1],M=We($V(t)?[-e,0,e,0]:[0,e,0,-e],4),S=M[0],N=M[1],T=M[2],O=M[3],C=Pz(WV(0,t),i),A=new nW(b,x,w,k);return A.x1+=O,A.y1+=S,A.x2+=N+C[0],A.y2+=T+C[1],A}(e,o),c=function(t){return!l||function(t,e,n){var r=t.x1,i=t.x2,o=t.y1,a=t.y2;return sW([[r,o],[i,o],[i,a],[r,a]],rW(e,n))}(l,t)},u=function(t,e){return!t||!t.firstChild||!function(t,e,n){var r,i,o=rW(t,n).flat(1),a=rW(e,n).flat(1),s=[[o[0],o[1],o[2],o[3]],[o[0],o[1],o[4],o[5]],[o[4],o[5],o[6],o[7]],[o[2],o[3],o[6],o[7]]];try{for(var l=Ve(s),c=l.next();!c.done;c=l.next())if(lW(a,c.value))return!0}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}return!1}(t.firstChild,e.firstChild,Yz(n))};try{for(var h=Ve(t),d=h.next();!d.done;d=h.next()){var f=d.value;c(f)?!s||u(s,f)?s=f:(a.add(s),a.add(f)):a.add(f)}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return Array.from(a)}function uW(t,e){return void 0===e&&(e={}),$t(t)?0:"number"==typeof t?t:Math.floor(Ez(t,e))}var hW=function(t,e){var n=e.seq,r=void 0===n?2:n;return t.filter(function(t,e){return!(e%r)||(sz(t),!1)})},dW=function(t){return t.filter(xz)};var fW=new Map([["hide",function(t,e,n,r){var i=t.length,o=e.keepHeader,a=e.keepTail;if(!(i<=1||2===i&&o&&a)){var s,l,c=hW,u=function(t){return t.forEach(r.show),t},h=2,d=t.slice(),f=t.slice(),p=Math.min.apply(Math,He([1],We(t.map(function(t){return t.getBBox().width})),!1));if("linear"===n.type&&(UV(n)||$V(n))){var g=qz(t[0]).left,v=qz(t[i-1]).right,m=Math.abs(v-g)||1;h=Math.max(Math.floor(i*p/m),h)}for(o&&(s=d.splice(0,1)[0]),a&&(l=d.splice(-1,1)[0],d.reverse()),u(d);h<t.length&&cW(dW(l?He(He([l],We(f),!1),[s],!1):He([s],We(f),!1)),n,null==e?void 0:e.margin).length;){if(l&&!s&&h%2==0)d.splice(0,1).forEach(r.hide);else if(l&&s){d.splice(0,1).forEach(r.hide)}f=c(u(d),{seq:h}),h++}}}],["rotate",function(t,e,n,r){var i,o,a=e.optionalAngles,s=void 0===a?[0,45,90]:a,l=e.margin,c=e.recoverWhenFailed,u=void 0===c||c,h=t.map(function(t){return t.getLocalEulerAngles()}),d=function(){return cW(t,n,l).length<1},f=function(e){return t.forEach(function(t,n){var i=Array.isArray(e)?e[n]:e;r.rotate(t,+i)})};try{for(var p=Ve(s),g=p.next();!g.done;g=p.next()){if(f(g.value),d())return}}catch(t){i={error:t}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}u&&f(h)}],["ellipsis",function(t,e,n,r){if(!(t.length<=0)){var i=e.suffix,o=void 0===i?"...":i,a=e.minLength,s=e.maxLength,l=void 0===s?1/0:s,c=e.step,u=void 0===c?" ":c,h=e.margin,d=void 0===h?[0,0,0,0]:h,f=wz(r.getTextShape(t[0])),p=uW(u,f),g=a?uW(a,f):p,v=uW(l,f);($t(v)||v===1/0)&&(v=Math.max.apply(null,t.map(function(t){return t.getBBox().width})));var m=t.slice(),y=We(d,4);y[0],y[1],y[2],y[3];for(var b=function(e){if(m.forEach(function(t){r.ellipsis(r.getTextShape(t),e,o)}),(m=cW(t,n,d)).length<1)return{value:void 0}},x=v;x>g+p;x-=p){var E=b(x);if("object"==typeof E)return E.value}}}],["wrap",function(t,e,n,r,i){var o,a=e.maxLines,s=void 0===a?3:a,l=e.recoverWhenFailed,c=void 0===l||l,u=e.margin,h=void 0===u?[0,0,0,0]:u,d=gz(null!==(o=e.wordWrapWidth)&&void 0!==o?o:50,[i]),f=t.map(function(t){return t.attr("maxLines")||1}),p=Math.min.apply(Math,He([],We(f),!1)),g=function(){return cW(t,n,h).length<1},v=function(t){var e=t.type,n=t.labelDirection;return"linear"===e&&UV(t)?"negative"===n?"bottom":"top":"middle"}(n),m=function(e){return t.forEach(function(t,n){var i=Array.isArray(e)?e[n]:e;r.wrap(t,d,i,v)})};if(!(p>s)){if("linear"===n.type&&UV(n)){if(m(s),g())return}else for(var y=p;y<=s;y++)if(m(y),g())return;c&&m(f)}}]]);function pW(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce(function(t,e){return t*function(t){return"positive"===t?-1:1}(e)},1)}function gW(t){for(var e=t;e<0;)e+=360;return Math.round(e%360)}function vW(t,e){var n=We(t,2),r=n[0],i=n[1],o=We(e,2),a=o[0],s=o[1],l=We([r*a+i*s,r*s-i*a],2),c=l[0],u=l[1];return Math.atan2(u,c)}function mW(t,e,n){var r,i=n.labelAlign;if(null===(r=e.style.transform)||void 0===r?void 0:r.includes("rotate"))return e.getLocalEulerAngles();var o=WV(t.value,n),a=GV(t.value,n);return"horizontal"===i?0:function(t){var e=(t+360)%180;return Cz(e,-90,90)||(e+=180),e}(fz("perpendicular"===i?vW([1,0],o):vW([a[0]<0?-1:1,0],a)))}function yW(t,e,n){var r=n.type,i=n.labelAlign,o=WV(t,n),a=gW(e),s=gW(fz(vW([1,0],o))),l="center",c="middle";return"linear"===r?[90,270].includes(s)&&0===a?(l="center",c=1===o[1]?"top":"bottom"):s%180||![90,270].includes(a)?0===s?(Cz(a,0,90,!1,!0)||Cz(a,0,90)||Cz(a,270,360))&&(l="start"):90===s?Cz(a,0,90,!1,!0)?l="start":(Cz(a,90,180)||Cz(a,270,360))&&(l="end"):270===s?Cz(a,0,90,!1,!0)?l="end":(Cz(a,90,180)||Cz(a,270,360))&&(l="start"):180===s&&(90===a?l="start":(Cz(a,0,90)||Cz(a,270,360))&&(l="end")):l="center":"parallel"===i?c=Cz(s,0,180,!0)?"top":"bottom":"horizontal"===i?Cz(s,90,270,!1)?l="end":(Cz(s,270,360,!1)||Cz(s,0,90))&&(l="start"):"perpendicular"===i&&(l=Cz(s,90,270)?"end":"start"),{textAlign:l,textBaseline:c}}function bW(t,e,n){var r=n.showTick,i=n.tickLength,o=n.tickDirection,a=n.labelDirection,s=n.labelSpacing,l=e.indexOf(t),c=gz(s,[t,l,e]),u=We([WV(t.value,n),pW(a,o)],2),h=We(Rz(Pz(u[0],c+(1===u[1]?gz(r?i:0,[t,l,e]):0)),HV(t.value,n)),2);return{x:h[0],y:h[1]}}function xW(t,e,n,r){var i=r.labelRender,o=(Oe(r,"endPos.0",400)-Oe(r,"startPos.0",0))/n.length,a=Ut(i)?gz(i,[t,e,n,WV(t.value,r)]):t.label||"",s=function(t){var e=(new DOMParser).parseFromString(t,"text/html").body.firstElementChild;if(console.log(null==e?void 0:e.getClientRects(),11),!e)return 0;var n=e.getAttribute("style")||"",r=Object.fromEntries(n.split(";").map(function(t){return t.trim()}).filter(function(t){return t.includes(":")}).map(function(t){var e=We(t.split(":").map(function(t){return t.trim()}),2),n=e[0],r=e[1];return[n.toLowerCase(),r]})),i=function(t){if(!t)return 0;var e=t.match(/([\d.]+)px/);return e?parseFloat(e[1]):0};if(r.height)return i(r.height);var o,a=i(r["font-size"])||16,s=r["line-height"];o=s&&"normal"!==s?s.endsWith("px")?i(s):/^[\d.]+$/.test(s)?parseFloat(s)*a:a:1.2*a;var l=i(r["padding-top"]),c=i(r["padding-bottom"]);r.padding&&(1===(u=r.padding.split(/\s+/).map(i)).length||2===u.length?(l=u[0],c=u[0]):(3===u.length||4===u.length)&&(l=u[0],c=u[2]));var u,h=i(r["border-top-width"]),d=i(r["border-bottom-width"]);if(r.border){var f=r.border.match(/([\d.]+)px/);f&&(h=parseFloat(f[1]),d=parseFloat(f[1]))}return r["border-width"]&&(1===(u=r["border-width"].split(/\s+/).map(i)).length||2===u.length?(h=u[0],d=u[0]):(3===u.length||4===u.length)&&(h=u[0],d=u[2])),o+l+c+h+d}(a)||30;return function(){return e={width:o,height:s},"function"==typeof(t=a)?t():ne(t)||ae(t)?new rc({style:Fe(Fe({},e),{innerHTML:String(t)})}):t;var t,e}}function EW(t,e){["text","html"].includes(t.nodeName)&&t.attr(e)}function wW(t,e){!function(t,e,n,r){var i=e.labelOverlap,o=void 0===i?[]:i;o.length&&o.forEach(function(i){var o=i.type,a=fW.get(o);(function(t,e,n){return!(e.labelOverlap.length<1)&&("hide"===n?!function(t){for(var e=t;e;){if("offscreen"===e.className)return!0;e=e.parent}return!1}(t[0]):"rotate"===n?!t.some(function(t){var e;return!!(null===(e=t.attr("transform"))||void 0===e?void 0:e.includes("rotate"))}):"ellipsis"!==n&&"wrap"!==n||t.filter(function(t){return t.querySelector("text")}).length>=1)})(t,e,o)&&(null==a||a(t,i,e,r,n))})}(this.node().childNodes,t,e,{hide:sz,show:az,rotate:function(e,n){!function(t,e,n){e.setLocalEulerAngles(t);var r=yW(e.__data__.value,t,n),i=e.querySelector(RV.labelItem.class);i&&EW(i,r)}(+n,e,t)},ellipsis:function(t,e,n){t&&Sz(t,e||1/0,n)},wrap:function(t,e,n){var r,i;t&&(void 0===(r=n)&&(r=2),void 0===i&&(i="top"),Mz(t,{wordWrap:!0,wordWrapWidth:e,maxLines:r,textBaseline:i}))},getTextShape:function(t){return t.querySelector("text")}})}function kW(t,e,n,r,i){var o=n.indexOf(e),a=i.labelRender,s=$z(t).append(a?xW(e,o,n,i):function(t,e,n,r){var i=r.labelFormatter;return Ut(i)?function(){return Tz(gz(i,[t,e,n,WV(t.value,r)]))}:function(){return Tz(t.label||"")}}(e,o,n,i)).attr("className",RV.labelItem.name).node(),l=We(eG(BV(r,[e,o,n])),2),c=l[0],u=l[1],h=u.transform,d=ze(u,["transform"]);rG(s,h);var f=mW(e,s,i);return s.getLocalEulerAngles()||s.setLocalEulerAngles(f),EW(s,Fe(Fe({},yW(e.value,f,i)),c)),t.attr(d),s}function MW(t,e,n,r,i){var o,a,s,l=FV(e,n.labelFilter),c=Jz(n,"label"),u=t.selectAll(RV.label.class).data(l,function(t,e){return e}).join(function(t){return t.append("g").attr("className",RV.label.name).transition(function(t){kW(this,t,e,c,n);var r=bW(t,e,n),i=r.x,o=r.y;return this.style.transform="translate(".concat(i,", ").concat(o,")"),null})},function(t){return t.transition(function(t){var i=function(t,e,n,r){if(void 0===r&&(r="destroy"),function(t,e){return"text"===t.nodeName&&"text"===e.nodeName&&t.attributes.text===e.attributes.text}(t,e))return t.remove(),[null];var i=function(){"destroy"===r?t.destroy():"hide"===r&&sz(t),e.isVisible()&&az(e)};if(!n)return i(),[null];var o=n.duration,a=void 0===o?0:o,s=n.delay,l=void 0===s?0:s,c=Math.ceil(+a/2),u=+a/4,h=We(t.getGeometryBounds().center,2),d=h[0],f=h[1],p=We(e.getGeometryBounds().center,2),g=We([(d+p[0])/2-d,(f+p[1])/2-f],2),v=g[0],m=g[1],y=t.style.opacity,b=void 0===y?1:y,x=e.style.opacity,E=void 0===x?1:x,w=t.style.transform||"",k=e.style.transform||"",M=t.animate([{opacity:b,transform:"translate(0, 0) ".concat(w)},{opacity:0,transform:"translate(".concat(v,", ").concat(m,") ").concat(w)}],Fe(Fe({fill:"both"},n),{duration:l+c+u})),S=e.animate([{opacity:0,transform:"translate(".concat(-v,", ").concat(-m,") ").concat(k),offset:.01},{opacity:E,transform:"translate(0, 0) ".concat(k)}],Fe(Fe({fill:"both"},n),{duration:c+u,delay:l+c-u}));return yV(S,i),[M,S]}(this.querySelector(RV.labelItem.class),kW(this,t,e,c,n),r.update),o=bW(t,e,n),a=o.x,s=o.y,l=EV(this,{transform:"translate(".concat(a,", ").concat(s,")")},r.update);return He(He([],We(i),!1),[l],!1)})},function(t){return o=t,t.transition(function(){var t=this,e=wV(this.childNodes[0],r.exit);return yV(e,function(){return $z(t).remove()}),e}),o}).transitions();return s=function(){wW.call(t,n,i)},0===(a=u).length?s():Promise.all(a.map(function(t){return null==t?void 0:t.finished})).then(s),u}function SW(t,e){return VV(t,e.tickDirection,e)}function NW(t,e,n,r,i){var o=We(function(t,e){var n=We(t,2);return[[0,0],[n[0]*e,n[1]*e]]}(r,gz(i.tickLength,[t,e,n])),2),a=We(o[0],2),s=a[0],l=a[1],c=We(o[1],2);return{x1:s,x2:c[0],y1:l,y2:c[1]}}function TW(t,e,n,r,i,o){var a=function(t,e,n,r,i){var o=i.tickFormatter,a=SW(e.value,i),s="line";return Ut(o)&&(s=function(){return gz(o,[e,n,r,a])}),t.append(s).attr("className",RV.tickItem.name)}($z(this),t,e,n,r);!function(t,e,n,r,i,o,a){var s=SW(t.value,o),l=NW(t,e,n,s,o),c=l.x1,u=l.x2,h=l.y1,d=l.y2,f=We(eG(BV(a,[t,e,n,s])),2),p=f[0],g=f[1];"line"===r.node().nodeName&&r.styles(Fe({x1:c,x2:u,y1:h,y2:d},p)),i.attr(g),r.styles(p)}(t,e,n,a,this,r,i);var s=We(HV(t.value,r),2),l=s[0],c=s[1];return EV(this,{transform:"translate(".concat(l,", ").concat(c,")")},o)}function OW(t,e,n,r,i){var o=We(eG(Jz(r,"title")),2),a=o[0],s=o[1],l=s.transform,c=s.transformOrigin,u=ze(s,["transform","transformOrigin"]);e.styles(u);var h=l||function(t,e,n){var r=2*t.getGeometryBounds().halfExtents[1];if("vertical"===e){if("left"===n)return"rotate(-90) translate(0, ".concat(r/2,")");if("right"===n)return"rotate(-90) translate(0, -".concat(r/2,")")}return""}(t.node(),a.direction,a.position);t.styles(Fe(Fe({},a),{transformOrigin:c})),rG(t.node(),h);var d=function(t,e,n){var r=n.titlePosition,i=void 0===r?"lb":r,o=n.titleSpacing,a=oG(i),s=t.node().getLocalBounds(),l=We(s.min,2),c=l[0],u=l[1],h=We(s.halfExtents,2),d=h[0],f=h[1],p=We(e.node().getLocalBounds().halfExtents,2),g=p[0],v=p[1],m=We([c+d,u+f],2),y=m[0],b=m[1],x=We(Yz(o),4),E=x[0],w=x[1],k=x[2],M=x[3];if(["start","end"].includes(i)&&"linear"===n.type){var S=n.startPos,N=n.endPos,T=We("start"===i?[S,N]:[N,S],2),O=T[0],C=T[1],A=We(Pz(jz([-C[0]+O[0],-C[1]+O[1]]),E),2),P=A[0],R=A[1];return{x:O[0]+P,y:O[1]+R}}return a.includes("t")&&(b-=f+v+E),a.includes("r")&&(y+=d+g+w),a.includes("l")&&(y-=d+g+M),a.includes("b")&&(b+=f+v+k),{x:y,y:b}}($z(n._offscreen||n.querySelector(RV.mainGroup.class)),e,r),f=d.x,p=d.y;return EV(e.node(),{transform:"translate(".concat(f,", ").concat(p,")")},i)}function CW(t,e,n,r){var i=t.showLine,o=t.showTick,a=t.showLabel,s=Oz(i,e.maybeAppendByClassName(RV.lineGroup,"g"),function(e){return QV(e,t,r)})||[],l=Oz(o,e.maybeAppendByClassName(RV.tickGroup,"g"),function(e){return function(t,e,n,r){var i=FV(e,n.tickFilter),o=Jz(n,"tick");return t.selectAll(RV.tick.class).data(i,function(t){return t.id||t.label}).join(function(t){return t.append("g").attr("className",RV.tick.name).transition(function(t,e){return TW.call(this,t,e,i,n,o,!1)})},function(t){return t.transition(function(t,e){return this.removeChildren(),TW.call(this,t,e,i,n,o,r.update)})},function(t){return t.transition(function(){var t=this,e=wV(this.childNodes[0],r.exit);return yV(e,function(){return t.remove()}),e})}).transitions()}(e,n,t,r)})||[],c=Oz(a,e.maybeAppendByClassName(RV.labelGroup,"g"),function(i){return MW(i,n,t,r,e.node())})||[];return He(He(He([],We(s),!1),We(l),!1),We(c),!1).filter(function(t){return!!t})}var AW=function(t){function e(e){return t.call(this,e,PV)||this}return Be(e,t),e.prototype.render=function(t,e,n){var r=this,i=t.titleText,o=t.data,a=t.animate,s=t.showTitle,l=t.showGrid,c=t.dataThreshold,u=t.truncRange,h=function(t,e){if(t.length<=e)return t;for(var n=Math.floor(t.length/e),r=[],i=0;i<t.length;i+=n)r.push(t[i]);return r}(o,c).filter(function(t){var e=t.value;return!(u&&e>u[0]&&e<u[1])}),d=mV(void 0===n?a:n),f=Oz(l,$z(e).maybeAppendByClassName(RV.gridGroup,"g"),function(e){return eW(e,h,t,d)})||[],p=$z(e).maybeAppendByClassName(RV.mainGroup,"g");i&&(!this.initialized&&d.enter||this.initialized&&d.update)&&CW(t,$z(this.offscreenGroup),h,mV(!1));var g=CW(t,$z(p.node()),h,d),v=Oz(s,$z(e).maybeAppendByClassName(RV.titleGroup,"g"),function(e){return function(t,e,n,r){var i=n.titleText;return t.selectAll(RV.title.class).data([{title:i}].filter(function(t){return!!t.title}),function(t,e){return t.title}).join(function(o){return o.append(function(){return Tz(i)}).attr("className",RV.title.name).transition(function(){return OW($z(this),t,e,n,r.enter)})},function(i){return i.transition(function(){return OW($z(this),t,e,n,r.update)})},function(t){return t.remove()}).transitions()}(e,r,t,d)})||[];return He(He(He([],We(f),!1),We(g),!1),We(v),!1).flat().filter(function(t){return!!t})},e}(sG),PW=mz({text:"text"},"title");function RW(t,e){var n=Object.entries(e).reduce(function(e,n){var r=We(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e},{});t.styles(n)}var DW=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return Be(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,a=this.querySelector(PW.text.class);if(!a)return new pz(0,0,+e,+n);var s=a.getBBox(),l=s.width,c=s.height,u=We(Yz(i),4),h=u[0],d=u[1],f=u[2],p=u[3],g=We([0,0,+e,+n],4),v=g[0],m=g[1],y=g[2],b=g[3],x=oG(r);if(x.includes("i"))return new pz(v,m,y,b);x.forEach(function(t,r){var i,o,a,s;"t"===t&&(i=We(0===r?[c+f,+n-c-f]:[0,+n],2),m=i[0],b=i[1]),"r"===t&&(o=We([+e-l-p],1),y=o[0]),"b"===t&&(a=We([+n-c-h],1),b=a[0]),"l"===t&&(s=We(0===r?[l+d,+e-l-d]:[0,+e],2),v=s[0],y=s[1])});var E=We(Yz(o),4),w=E[0],k=E[1],M=E[2],S=E[3],N=We([S+k,w+M],2),T=N[0],O=N[1];return new pz(v+S,m+w,y-T,b-O)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new pz(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=ze(t,["width","height","position","spacing"]),i=We(eG(r),1)[0],o=function(t){var e,n,r,i,o=t,a=o.width,s=o.height,l=o.position,c=We([+a/2,+s/2],2),u=We([+c[0],+c[1],"center","middle"],4),h=u[0],d=u[1],f=u[2],p=u[3],g=oG(l);return g.includes("l")&&(h=(e=We([0,"start"],2))[0],f=e[1]),g.includes("r")&&(h=(n=We([+a,"end"],2))[0],f=n[1]),g.includes("t")&&(d=(r=We([0,"top"],2))[0],p=r[1]),g.includes("b")&&(d=(i=We([+s,"bottom"],2))[0],p=i[1]),{x:h,y:d,textAlign:f,textBaseline:p}}(t),a=o.x,s=o.y,l=o.textAlign,c=o.textBaseline;Oz(!!r.text,$z(e),function(t){n.title=t.maybeAppendByClassName(PW.text,"text").styles(i).call(RW,{x:a,y:s,textAlign:l,textBaseline:c}).node()})},e}(sG),LW=mz({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),_W=function(t){function e(e){var n=t.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:fG(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new ec({class:LW.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new ec({class:LW.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Be(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return oe(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=We(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map(function(e,n){return t.map(function(t){return t[n]})}))||[]}(this.pageViews.map(function(t){var e=t.getBBox();return[e.width,e.height]})).map(function(t){return Math.max.apply(Math,He([],We(t),!1))}),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,a=r.pageHeight;return{pageWidth:o,pageHeight:void 0===a?n:a}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,a=o.pageWidth,s=o.pageHeight;return new pz(n,r,a+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,a=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var l=We(this.getFollowingPageDiff(t),2),c=l[0],u=l[1];this.playState="running";var h=xV(a,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-c,", ").concat(-u,")")}],n);return yV(h,function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()}),h},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:oe(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:oe(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(LW.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach(function(e,n){t.includes(n)?az(e):sz(e)})},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,a=i.controllerPadding,s=r.getBBox(),l=s.width;s.height;var c=We("horizontal"===o?[-180,0]:[-90,90],2),u=c[0],h=c[1];e.setLocalEulerAngles(u),n.setLocalEulerAngles(h);var d=e.getBBox(),f=d.width,p=d.height,g=n.getBBox(),v=g.width,m=g.height,y=Math.max(f,l,v),b="horizontal"===o?{offset:[[0,0],[f/2+a,0],[f+l+2*a,0]],textAlign:"start"}:{offset:[[y/2,-p-a],[y/2,0],[y/2,m+a]],textAlign:"center"},x=We(b.offset,3),E=We(x[0],2),w=E[0],k=E[1],M=We(x[1],2),S=M[0],N=M[1],T=We(x[2],2),O=T[0],C=T[1],A=b.textAlign,P=r.querySelector("text");P&&(P.style.textAlign=A),e.setLocalPosition(w,k),r.setLocalPosition(S,N),n.setLocalPosition(O,C)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(LW.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=t<e?-1:1;return"horizontal"===n?[a*i,0]:[0,a*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=We(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes.controllerSpacing,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=this.pageViews.length>=2,s=t.maybeAppendByClassName(LW.controller,"g");if(lz(s.node(),a),a){var l=Jz(this.attributes,"button"),c=Jz(this.attributes,"pageNum"),u=We(eG(l),2),h=u[0],d=u[1],f=h.size,p=ze(h,["size"]),g=!s.select(LW.prevBtnGroup.class).node(),v=s.maybeAppendByClassName(LW.prevBtnGroup,"g").styles(d);this.prevBtnGroup=v.node();var m=v.maybeAppendByClassName(LW.prevBtn,"path"),y=s.maybeAppendByClassName(LW.nextBtnGroup,"g").styles(d);this.nextBtnGroup=y.node(),[m,y.maybeAppendByClassName(LW.nextBtn,"path")].forEach(function(t){t.styles(Fe(Fe({},p),{transformOrigin:"center"})),Hz(t.node(),f)});var b=s.maybeAppendByClassName(LW.pageInfoGroup,"g");this.pageInfoGroup=b.node(),b.maybeAppendByClassName(LW.pageInfo,"text").styles(c),this.updatePageInfo(),s.node().setLocalPosition(i+n,o/2),g&&(this.prevBtnGroup.addEventListener("click",function(){e.prev()}),this.nextBtnGroup.addEventListener("click",function(){e.next()}))}},e.prototype.render=function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i;this.attr("transform","translate(".concat(r,", ").concat(o,")"));var a=$z(e);this.renderClipPath(a),this.renderController(a),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=be(function(){return t.render(t.attributes,t)},50);this.playWindow.addEventListener(al.INSERTED,e),this.playWindow.addEventListener(al.REMOVED,e)},e}(sG);var IW;function jW(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}gG.registerSymbol("hiddenHandle",function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]}),gG.registerSymbol("verticalHandle",function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=t+.4*r;return[["M",t,e],["L",a,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",a,e-i],["Z"],["M",a,e+o],["L",t+r-2,e+o],["M",a,e-o],["L",t+r-2,e-o]]}),gG.registerSymbol("horizontalHandle",function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=e+.4*r;return[["M",t,e],["L",t-i,a],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,a],["Z"],["M",t-o,a],["L",t-o,e+r-2],["M",t+o,a],["L",t+o,e+r-2]]});var BW="component-poptip",FW="component-poptip-arrow",zW="component-poptip-text",GW=((IW={})[".".concat(BW)]={visibility:"visible",position:"absolute","background-color":"rgba(0, 0, 0)","box-shadow":"0px 0px 10px #aeaeae","border-radius":"3px",color:"#fff",opacity:.8,"font-size":"12px",padding:"4px 6px",display:"flex","justify-content":"center","align-items":"center","z-index":8,transition:"visibility 50ms"},IW[".".concat(zW)]={"text-align":"center"},IW[".".concat(BW,"[data-position='top']")]={transform:"translate(-50%, -100%)"},IW[".".concat(BW,"[data-position='left']")]={transform:"translate(-100%, -50%)"},IW[".".concat(BW,"[data-position='right']")]={transform:"translate(0, -50%)"},IW[".".concat(BW,"[data-position='bottom']")]={transform:"translate(-50%, 0)"},IW[".".concat(BW,"[data-position='top-left']")]={transform:"translate(0,-100%)"},IW[".".concat(BW,"[data-position='top-right']")]={transform:"translate(-100%,-100%)"},IW[".".concat(BW,"[data-position='left-top']")]={transform:"translate(-100%, 0)"},IW[".".concat(BW,"[data-position='left-bottom']")]={transform:"translate(-100%, -100%)"},IW[".".concat(BW,"[data-position='right-top']")]={transform:"translate(0, 0)"},IW[".".concat(BW,"[data-position='right-bottom']")]={transform:"translate(0, -100%)"},IW[".".concat(BW,"[data-position='bottom-left']")]={transform:"translate(0, 0)"},IW[".".concat(BW,"[data-position='bottom-right']")]={transform:"translate(-100%, 0)"},IW[".".concat(FW)]={width:"4px",height:"4px",transform:"rotate(45deg)","background-color":"rgba(0, 0, 0)",position:"absolute","z-index":-1},IW[".".concat(BW,"[data-position='top']")]={transform:"translate(-50%, calc(-100% - 5px))"},IW["[data-position='top'] .".concat(FW)]={bottom:"-2px"},IW[".".concat(BW,"[data-position='left']")]={transform:"translate(calc(-100% - 5px), -50%)"},IW["[data-position='left'] .".concat(FW)]={right:"-2px"},IW[".".concat(BW,"[data-position='right']")]={transform:"translate(5px, -50%)"},IW["[data-position='right'] .".concat(FW)]={left:"-2px"},IW[".".concat(BW,"[data-position='bottom']")]={transform:"translate(-50%, 5px)"},IW["[data-position='bottom'] .".concat(FW)]={top:"-2px"},IW[".".concat(BW,"[data-position='top-left']")]={transform:"translate(0, calc(-100% - 5px))"},IW["[data-position='top-left'] .".concat(FW)]={left:"10px",bottom:"-2px"},IW[".".concat(BW,"[data-position='top-right']")]={transform:"translate(-100%, calc(-100% - 5px))"},IW["[data-position='top-right'] .".concat(FW)]={right:"10px",bottom:"-2px"},IW[".".concat(BW,"[data-position='left-top']")]={transform:"translate(calc(-100% - 5px), 0)"},IW["[data-position='left-top'] .".concat(FW)]={right:"-2px",top:"8px"},IW[".".concat(BW,"[data-position='left-bottom']")]={transform:"translate(calc(-100% - 5px), -100%)"},IW["[data-position='left-bottom'] .".concat(FW)]={right:"-2px",bottom:"8px"},IW[".".concat(BW,"[data-position='right-top']")]={transform:"translate(5px, 0)"},IW["[data-position='right-top'] .".concat(FW)]={left:"-2px",top:"8px"},IW[".".concat(BW,"[data-position='right-bottom']")]={transform:"translate(5px, -100%)"},IW["[data-position='right-bottom'] .".concat(FW)]={left:"-2px",bottom:"8px"},IW[".".concat(BW,"[data-position='bottom-left']")]={transform:"translate(0, 5px)"},IW["[data-position='bottom-left'] .".concat(FW)]={top:"-2px",left:"8px"},IW[".".concat(BW,"[data-position='bottom-right']")]={transform:"translate(-100%, 5px)"},IW["[data-position='bottom-right'] .".concat(FW)]={top:"-2px",right:"8px"},IW);function VW(t){var e=t&&document.getElementById(t);return e||((e=document.createElement("div")).setAttribute("id",t),document.body.appendChild(e)),e}var WW=function(t){function e(n){var r=t.call(this,Me({style:{id:"component-poptip"}},e.defaultOptions,n))||this;return r.visibility="visible",r.map=new Map,r.domStyles="",r.initShape(),r.render(r.attributes,r),r}return Be(e,t),Object.defineProperty(e.prototype,"visible",{get:function(){return"visible"===this.visibility},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.visibility=this.style.visibility,this.updatePoptipElement()},e.prototype.update=function(t){this.attr(Me({},this.style,t)),this.render(this.attributes,this)},e.prototype.bind=function(t,e){var n=this;if(t){var r=this.style.text,i=function(i){var o=t,a=n.style,s=r;if(e){var l="function"==typeof e?e.call(null,i):e,c=l.html,u=l.target,h=ze(l,["html","target"]);a=function(t,e,n){return e&&me(t,e),n&&me(t,n),t}({},n.style,h),(u||!1===u)&&(o=u),"string"==typeof c&&(s=c)}var d=a.position,f=a.arrowPointAtCenter,p=a.follow,g=a.offset;if(o){var v=i,m=We(function(t,e,n,r,i,o){if(void 0===i&&(i=!1),void 0===o&&(o=!1),o)return[t,e];var a=n.getBoundingClientRect(),s=a.x,l=a.y,c=a.width,u=a.height;switch(r){case"top":return i?[s+c/2,l]:[t,l];case"left":return i?[s,l+u/2]:[s,e];case"bottom":return i?[s+c/2,l+u]:[t,l+u];case"right":return i?[s+c,l+u/2]:[s+c,e];case"top-right":case"right-top":return[s+c,l];case"left-bottom":case"bottom-left":return[s,l+u];case"right-bottom":case"bottom-right":return[s+c,l+u];default:return[s,l]}}(v.clientX,v.clientY,o,d,f,p),2),y=m[0],b=m[1];n.showTip(y,b,{text:s,position:d,offset:g})}else n.hideTip()},o=function(){n.hideTip()};t.addEventListener("mousemove",i),t.addEventListener("mouseleave",o),this.map.set(t,[i,o])}},e.prototype.unbind=function(t){if(this.map.has(t)){var e=We(this.map.get(t)||[],2),n=e[0],r=e[1];n&&t.removeEventListener("mousemove",n),r&&t.removeEventListener("mouseleave",r),this.map.delete(t)}},e.prototype.clear=function(){this.container.innerHTML=""},e.prototype.destroy=function(){var e,n=this;He([],We(this.map.keys()),!1).forEach(function(t){return n.unbind(t)}),null===(e=this.container)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.showTip=function(t,e,n){var r=Oe(n,"text");if((!r||"string"==typeof r)&&(this.applyStyles(),t&&e&&n)){var i=n.offset,o=n.position;if(o&&this.container.setAttribute("data-position",o),this.setOffsetPosition(t,e,i),"string"==typeof r){var a=this.container.querySelector(".".concat(zW));a&&(a.innerHTML=r)}this.visibility="visible",this.container.style.visibility="visible"}},e.prototype.hideTip=function(){this.visibility="hidden",this.container.style.visibility="hidden"},e.prototype.getContainer=function(){return this.container},e.prototype.getClassName=function(){var t=this.style.containerClassName;return"".concat(BW).concat(t?" ".concat(t):"")},e.prototype.initShape=function(){var t=this,e=this.style.id;this.container=function(t){var e,n,r=(e=VW,function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n||(n=e.apply(void 0,t)),n})(t);return r}(e),this.container.className=this.getClassName(),this.container.addEventListener("mousemove",function(){return t.showTip()}),this.container.addEventListener("mouseleave",function(){return t.hideTip()})},e.prototype.updatePoptipElement=function(){var t=this.container;this.clear();var e=this.style,n=e.id,r=e.template,i=e.text;this.container.setAttribute("id",n),this.container.className=this.getClassName();var o,a='<span class="'.concat(FW,'"></span>');t.innerHTML=a,ne(r)?t.innerHTML+=r:r&&((o=r)instanceof Element||o instanceof Document)&&t.appendChild(r),i&&(t.getElementsByClassName(zW)[0].textContent=i),this.applyStyles(),this.container.style.visibility=this.visibility},e.prototype.applyStyles=function(){var t=bz({},GW,this.style.domStyles),e=Object.entries(t).reduce(function(t,e){var n=We(e,2),r=n[0],i=n[1],o=Object.entries(i).reduce(function(t,e){var n=We(e,2),r=n[0],i=n[1];return"".concat(t).concat(r,": ").concat(i,";")},"");return"".concat(t).concat(r,"{").concat(o,"}")},"");if(this.domStyles!==e){this.domStyles=e;var n=this.container.querySelector("style");n&&this.container.removeChild(n),(n=document.createElement("style")).innerHTML=e,this.container.appendChild(n)}},e.prototype.setOffsetPosition=function(t,e,n){void 0===n&&(n=this.style.offset);var r=We(n,2),i=r[0],o=void 0===i?0:i,a=r[1],s=void 0===a?0:a;this.container.style.left="".concat(t+o,"px"),this.container.style.top="".concat(e+s,"px")},e.tag="poptip",e.defaultOptions={style:{x:0,y:0,width:0,height:0,target:null,visibility:"hidden",text:"",position:"top",follow:!1,offset:[0,0],domStyles:GW,template:'<div class="'.concat(zW,'"></div>')}},e}(sG),HW=mz({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",focusGroup:"focus-group",focus:"focus",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item"),UW={offset:[0,20],domStyles:{".component-poptip":{opacity:"1",padding:"8px 12px",background:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)"},".component-poptip-arrow":{display:"none"},".component-poptip-text":{color:"#000",lineHeight:"20px"}}};var $W=function(t){function e(e){return t.call(this,e,{span:[1,1],marker:function(){return new Zl({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return Be(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes,r=n.markerSize,i=n.focus,o=n.focusMarkerSize,a=t.node().getBBox(),s=a.width,l=a.height,c=e.node().getBBox(),u=c.width,h=c.height;return{markerWidth:r,labelWidth:s,valueWidth:u,focusWidth:i?null!=o?o:12:0,height:Math.max(r,l,h)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=We(Yz(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),e.prototype.setAttribute=function(e,n){t.prototype.setAttribute.call(this,e,n)},Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,a=i.focusWidth,s=i.height,l=this.actualSpace,c=l.labelWidth,u=l.valueWidth,h=We(this.spacing,3),d=h[0],f=h[1],p=h[2];if(r){var g=r-n-d-f-a-p,v=We(this.span,2);c=(t=We([v[0]*g,v[1]*g],2))[0],u=t[1]}return{width:o+c+u+d+f+a+p,height:s,markerWidth:o,labelWidth:c,valueWidth:u,focusWidth:a}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes,e=t.spacing,n=t.focus;if(!e)return[0,0,0];var r=We(Yz(e),3),i=r[0],o=r[1],a=r[2];return[i,this.showValue?o:0,n?a:0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.focusWidth,o=t.width,a=t.height,s=We(this.spacing,3),l=s[0],c=s[1];return{height:a,width:o,markerWidth:e,labelWidth:n,valueWidth:r,focusWidth:i,position:[e/2,e+l,e+n+l+c,e+n+r+l+c+s[2]+i/2]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(HW.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,a=void 0===o?t.lineWidth:o,s=e.markerStroke,l=void 0===s?t.stroke:s,c=+(i||a||(l?1:0))*Math.sqrt(2),u=this.markerGroup.node().getBBox(),h=u.width,d=u.height;return(1-c/Math.max(h,d))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes.marker,r=Jz(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(HW.markerGroup,"g").style("zIndex",0),Oz(!!n,this.markerGroup,function(){var t,i=e.markerGroup.node(),o=null===(t=i.childNodes)||void 0===t?void 0:t[0],a="string"==typeof n?new gG({style:{symbol:n},className:HW.marker.name}):n();o?a.nodeName===o.nodeName?o instanceof gG?o.update(Fe(Fe({},r),{symbol:n})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=Ve(Object.entries(i)),a=o.next();!a.done;a=o.next()){var s=We(a.value,2),l=s[0],c=s[1];"id"!==l&&"className"!==l&&t.attr(l,c)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(o,a),$z(o).styles(r)):(o.remove(),$z(a).attr("className",HW.marker.name).styles(r),i.appendChild(a)):(a instanceof gG||$z(a).attr("className",HW.marker.name).styles(r),i.appendChild(a)),e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]);var s=Hz(e.markerGroup.node(),e.scaleSize);e.markerGroup.node().style._transform="scale(".concat(s,")")})},e.prototype.renderLabel=function(t){var e=Jz(this.attributes,"label"),n=e.text,r=ze(e,["text"]);this.labelGroup=t.maybeAppendByClassName(HW.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(HW.label,function(){return Tz(n)}).styles(r)},e.prototype.renderValue=function(t){var e=this,n=Jz(this.attributes,"value"),r=n.text,i=ze(n,["text"]);this.valueGroup=t.maybeAppendByClassName(HW.valueGroup,"g").style("zIndex",0),Oz(this.showValue,this.valueGroup,function(){e.valueGroup.maybeAppendByClassName(HW.value,function(){return Tz(r)}).styles(i)})},e.prototype.createPoptip=function(){var t=this.attributes.poptip||{};t.render;var e=ze(t,["render"]),n=new WW({style:bz(UW,e)});return this.poptipGroup=n,n},e.prototype.bindPoptip=function(t){var e=this,n=this.attributes.poptip;n&&(this.poptipGroup||this.createPoptip()).bind(t,function(){var t=e.attributes,r=t.labelText,i=t.valueText,o=t.markerFill,a="string"==typeof r?r:null==r?void 0:r.attr("text"),s="string"==typeof i?i:null==i?void 0:i.attr("text");if("function"==typeof n.render)return{html:n.render({label:a,value:s,color:o})};var l="";return"string"!=typeof a&&"number"!=typeof a||(l+='<div class="component-poptip-label">'.concat(a,"</div>")),"string"!=typeof s&&"number"!=typeof s||(l+='<div class="component-poptip-value">'.concat(s,"</div>")),{html:l}})},e.prototype.renderFocus=function(t){var e=this,n=this.attributes,r=n.focus,i={x:0,y:0,size:n.focusMarkerSize,opacity:.6,symbol:"focus",stroke:"#aaaaaa",lineWidth:1};ve(r)||(this.focusGroup=t.maybeAppendByClassName(HW.focusGroup,"g").style("zIndex",0),Oz(r,this.focusGroup,function(){var n=new gG({style:Fe(Fe({},i),{symbol:"focus"})}),r=new Zl({style:{r:i.size/2,fill:"transparent"}}),o=e.focusGroup.node();o.appendChild(r),o.appendChild(n),n.update({opacity:0}),t.node().addEventListener("pointerenter",function(){n.update({opacity:1})}),t.node().addEventListener("pointerleave",function(){n.update({opacity:0})})}))},e.prototype.renderPoptip=function(t){var e=this;this.attributes.poptip&&[t.maybeAppendByClassName(HW.value,"g").node(),t.maybeAppendByClassName(HW.label,"g").node()].forEach(function(t){t&&e.bindPoptip(t)})},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,i=Jz(this.attributes,"background");this.background=t.maybeAppendByClassName(HW.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(HW.background,"rect").styles(Fe({width:n,height:r},i))},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=We(t.position,4),o=i[0],a=i[1],s=i[2],l=i[3],c=r/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(a,", ").concat(c,")")}),this.focusGroup&&this.focusGroup.styles({transform:"translate(".concat(l,", ").concat(c,")")}),Sz(this.labelGroup.select(HW.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(s,", ").concat(c,")")}),Sz(this.valueGroup.select(HW.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=$z(e),r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o;n.styles({transform:"translate(".concat(i,", ").concat(a,")")}),this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.renderPoptip(n),this.renderFocus(n),this.adjustLayout()},e}(sG),YW=mz({page:"item-page",navigator:"navigator",item:"item"},"items"),qW=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},XW=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:_e,mouseenter:_e,mouseleave:_e})||this;return n.navigatorShape=[0,0],n}return Be(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=t.poptip,i=t.focus,o=t.focusMarkerSize,a=Jz(this.attributes,"item"),s=e.map(function(t,s){var l=t.id,c=void 0===l?s:l,u=t.label,h=t.value;return{id:"".concat(c),index:s,style:Fe({layout:n,labelText:u,valueText:h,poptip:r,focus:i,focusMarkerSize:o},Object.fromEntries(Object.entries(a).map(function(n){var r=We(n,2);return[r[0],gz(r[1],[t,s,e])]})))}});return s},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,a=We(this.navigatorShape,1)[0],s=We(this.grid,2),l=s[0],c=s[1],u=c*l,h=0;return this.pageViews.children.map(function(e,s){var d,f,p=Math.floor(s/u),g=s%u,v=t.ifHorizontal(c,l),m=[Math.floor(g/v),g%v];"vertical"===n&&m.reverse();var y=We(m,2),b=y[0],x=y[1],E=(r-a-(c-1)*o)/c,w=e.getBBox().height,k=We([0,0],2),M=k[0],S=k[1];return"horizontal"===n?(M=(d=We([h,b*(w+i)],2))[0],S=d[1],h=x===c-1?0:h+E+o):(M=(f=We([x*(E+o),h],2))[0],S=f[1],h=b===l-1?0:h+w+i),{page:p,index:s,row:b,col:x,pageIndex:g,width:E,height:w,x:M,y:S}})},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=We(this.navigatorShape,1)[0],a=We(this.grid,2),s=a[0],l=a[1],c=We([e-o,n],2),u=c[0],h=c[1],d=We([0,0,0,0,0,0,0,0],8),f=d[0],p=d[1],g=d[2],v=d[3],m=d[4],y=d[5],b=d[6],x=d[7];return this.pageViews.children.map(function(t,e){var n,o,a,c,d=t.getBBox(),E=d.width,w=d.height,k=0===b?0:i,M=b+k+E;return M<=u&&qW(m,function(t){return t<l})?(n=We([b+k,x,M],3),f=n[0],p=n[1],b=n[2],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}):(o=We([y+1,0,0,x+w+r],4),y=o[0],m=o[1],b=o[2],(x=o[3])+w<=h&&qW(y,function(t){return t<s})?(a=We([b,x,E],3),f=a[0],p=a[1],b=a[2],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}):(c=We([0,0,E,0,g+1,0,0,0],8),f=c[0],p=c[1],b=c[2],x=c[3],g=c[4],v=c[5],y=c[6],m=c[7],{width:E,height:w,x:f,y:p,page:g,index:e,pageIndex:v++,row:y,col:m++}))})},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return jW(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(YW.item.class).forEach(function(e){t.appendChild(e)}),t.querySelectorAll(YW.page.class).forEach(function(e){t.removeChild(e).destroy()})},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave;this.flattenPage(t);var o=this.dispatchCustomEvent.bind(this);$z(t).selectAll(YW.item.class).data(this.renderData,function(t){return t.id}).join(function(t){return t.append(function(t){var e=t.style;return new $W({style:e})}).attr("className",YW.item.name).on("click",function(){null==n||n(this),o("itemClick",{item:this})}).on("pointerenter",function(){null==r||r(this),o("itemMouseenter",{item:this})}).on("pointerleave",function(){null==i||i(this),o("itemMouseleave",{item:this})})},function(t){return t.each(function(t){var e=t.style;this.update(e)})},function(t){return t.remove()})},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=We(this.navigatorShape,2),a=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-a,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce(function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t},{}))).map(function(t){var e=We(t,2);return{page:e[0],layouts:e[1]}}),i=He([],We(this.navigator.getContainer().children),!1);r.forEach(function(t){var e=t.layouts,r=n.pageViews.appendChild(new ec({className:YW.page.name}));e.forEach(function(t){var e=t.x,n=t.y,o=t.index,a=t.width,s=t.height,l=i[o];r.appendChild(l),Ce(l,"__layout__",t),l.update({x:e,y:n,width:a,height:s})})}),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes.orientation,n=Jz(this.attributes,"nav"),r=bz({orientation:e},n),i=this;return t.selectAll(YW.navigator.class).data(["nav"]).join(function(t){return t.append(function(){return new _W({style:r})}).attr("className",YW.navigator.name).each(function(){i.navigator=this})},function(t){return t.each(function(){this.update(r)})},function(t){return t.remove()}),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator($z(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new Zs(t,{detail:e});this.dispatchEvent(n)},e}(sG),KW=mz({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),ZW={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,ZW)||this}Be(e,t),e.prototype.render=function(t,e){var n=$z(e).maybeAppendByClassName(KW.markerGroup,"g");this.renderMarker(n);var r=$z(e).maybeAppendByClassName(KW.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,i=n.markerSymbol,o=void 0===i?jW(r,"horizontalHandle","verticalHandle"):i;Oz(!!o,t,function(t){var n=Jz(e.attributes,"marker"),r=Fe({symbol:o},n);e.marker=t.maybeAppendByClassName(KW.marker,function(){return new gG({style:r})}).update(r)})},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,i=n.orientation,o=n.spacing,a=void 0===o?0:o,s=n.formatter;Oz(r,t,function(t){var n,r=Jz(e.attributes,"label"),o=r.text,l=ze(r,["text"]),c=(null===(n=t.select(KW.marker.class))||void 0===n?void 0:n.node().getBBox())||{},u=c.width,h=void 0===u?0:u,d=c.height,f=We(jW(i,[0,(void 0===d?0:d)+a,"center","top"],[h+a,0,"start","middle"]),4),p=f[0],g=f[1],v=f[2],m=f[3];t.maybeAppendByClassName(KW.label,"text").styles(Fe(Fe({},l),{x:p,y:g,text:s(o).toString(),textAlign:v,textBaseline:m}))})}}(sG);var QW={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},JW=bz({},QW,{});bz({},QW,tG(ZW,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var tH=mz({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),eH=function(t){function e(e){return t.call(this,e,JW)||this}return Be(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,i=r.showTitle,o=r.titleText,a=We(eG(Jz(this.attributes,"title")),2),s=a[0],l=a[1];this.titleGroup=t.maybeAppendByClassName(tH.titleGroup,"g").styles(l);var c=Fe(Fe({width:e,height:n},s),{text:i?o:""});this.title=this.titleGroup.maybeAppendByClassName(tH.title,function(){return new DW({style:c})}).update(c)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,i=e.width,o=e.height,a=We(eG(Jz(this.attributes,"title",!0)),2),s=a[0],l=a[1],c=Fe(Fe({},s),{width:i,height:o,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName(tH.itemsGroup,"g").styles(Fe(Fe({},l),{transform:"translate(".concat(n,", ").concat(r,")")}));var u=this;this.itemsGroup.selectAll(tH.items.class).data(["items"]).join(function(t){return t.append(function(){return new XW({style:c})}).attr("className",tH.items.name).each(function(){u.items=$z(this)})},function(t){return t.update(c)},function(t){return t.remove()})},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().style.transform="translate(".concat(e,", ").concat(n,")")}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new pz(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,a=n.text,s=t.getBBox(),l=e.getBBox(),c=oG(r),u=We(Yz(a?i:0),4),h=u[0],d=u[1],f=u[2],p=u[3],g=We(Yz(o),4),v=g[0],m=g[1],y=g[2],b=g[3],x=We([p+d,h+f],2),E=x[0],w=x[1],k=We([b+m,v+y],2),M=k[0],S=k[1];if("l"===c[0])return new pz(s.x,s.y,l.width+s.width+E+M,Math.max(l.height+S,s.height));if("t"===c[0])return new pz(s.x,s.y,Math.max(l.width+M,s.width),l.height+s.height+w+S);var N=We([e.attributes.width||l.width,e.attributes.height||l.height],2),T=N[0],O=N[1];return new pz(l.x,l.y,T+s.width+E+M,O+s.height+w+S)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=this.attributes,r=n.width,i=n.height,o=n.x,a=void 0===o?0:o,s=n.y,l=void 0===s?0:s,c=$z(e);e.style.transform="translate(".concat(a,", ").concat(l,")"),this.renderTitle(c,r,i),this.renderItems(c,this.availableSpace),this.adjustLayout()},e}(sG),nH={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(t){return t.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},rH=mz({background:"background",labelGroup:"label-group",label:"label"},"indicator"),iH=function(t){function e(e){var n=t.call(this,e,nH)||this;return n.point=[0,0],n.group=n.appendChild(new ec({})),n.isMutationObserved=!0,n}return Be(e,t),e.prototype.renderBackground=function(){if(this.label){var t=this.attributes,e=t.position,n=We(Yz(t.padding),4),r=n[0],i=n[1],o=n[2],a=n[3],s=this.label.node().getLocalBounds(),l=s.min,c=s.max,u=new pz(l[0]-a,l[1]-r,c[0]+i-l[0]+a,c[1]+o-l[1]+r),h=this.getPath(e,u),d=Jz(this.attributes,"background");this.background=$z(this.group).maybeAppendByClassName(rH.background,"path").styles(Fe(Fe({},d),{d:h})),this.group.appendChild(this.label.node())}},e.prototype.renderLabel=function(){var t=this.attributes,e=t.formatter,n=t.labelText,r=We(eG(Jz(this.attributes,"label")),2),i=r[0],o=r[1];i.text;var a=ze(i,["text"]);(this.label=$z(this.group).maybeAppendByClassName(rH.labelGroup,"g").styles(o),n)&&this.label.maybeAppendByClassName(rH.label,function(){return Tz(e(n))}).style("text",e(n).toString()).selectAll("text").styles(a)},e.prototype.adjustLayout=function(){var t=We(this.point,2),e=t[0],n=t[1],r=this.attributes,i=r.x,o=r.y;this.group.attr("transform","translate(".concat(i-e,", ").concat(o-n,")"))},e.prototype.getPath=function(t,e){var n=this.attributes.radius,r=e.x,i=e.y,o=e.width,a=e.height,s=[["M",r+n,i],["L",r+o-n,i],["A",n,n,0,0,1,r+o,i+n],["L",r+o,i+a-n],["A",n,n,0,0,1,r+o-n,i+a],["L",r+n,i+a],["A",n,n,0,0,1,r,i+a-n],["L",r,i+n],["A",n,n,0,0,1,r+n,i],["Z"]],l={top:4,right:6,bottom:0,left:2}[t],c=this.createCorner([s[l].slice(-2),s[l+1].slice(-2)]);return s.splice.apply(s,He([l+1,1],We(c),!1)),s[0][0]="M",s},e.prototype.createCorner=function(t,e){void 0===e&&(e=10);var n=Xz.apply(void 0,He([],We(t),!1)),r=We(t,2),i=We(r[0],2),o=i[0],a=i[1],s=We(r[1],2),l=s[0],c=s[1],u=We(n?[l-o,[o,l]]:[c-a,[a,c]],2),h=u[0],d=We(u[1],2),f=d[0],p=d[1],g=h/2,v=e*(h/Math.abs(h)),m=v/2,y=v*Math.sqrt(3)/2*.8,b=We([f,f+g-m,f+g,f+g+m,p],5),x=b[0],E=b[1],w=b[2],k=b[3],M=b[4];return n?(this.point=[w,a-y],[["L",x,a],["L",E,a],["L",w,a-y],["L",k,a],["L",M,a]]):(this.point=[o+y,w],[["L",o,x],["L",o,E],["L",o+y,w],["L",o,k],["L",o,M]])},e.prototype.applyVisibility=function(){"hidden"===this.attributes.visibility?sz(this):az(this)},e.prototype.bindEvents=function(){this.label.on(al.BOUNDS_CHANGED,this.renderBackground)},e.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},e}(sG);function oH(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var aH={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function sH(t){var e;void 0===t&&(t="");var n=oH(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=Fe({flex:1},aH),e[".".concat(n.VALUE)]=Fe({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},aH),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var lH=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,a=oH(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(a.CONTAINER,'"></div>'),title:'<div class="'.concat(a.TITLE,'"></div>'),item:'<li class="'.concat(a.LIST_ITEM,'" data-index={index}>\n <span class="').concat(a.NAME,'">\n <span class="').concat(a.MARKER,'" style="background:{color}"></span>\n <span class="').concat(a.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(a.VALUE,'" title="{value}">{value}</span>\n </li>')},style:sH(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return Be(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map(function(t,e){var r=t.name,i=void 0===r?"":r,o=t.color,a=void 0===o?"black":o,s=t.index,l=ze(t,["name","color","index"]),c=Fe({name:i,color:a,index:null!=s?s:e},l);return Rn(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]}):t}(n.item,c))})},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=Rn(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:iG(this.element,t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,a=n.style,s=n.content,l=oH(r.prefixCls),c=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(c.innerHTML=r.title,c.getElementsByClassName(l.TITLE)[0].innerHTML=i):null===(e=null===(t=c.getElementsByClassName(l.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var u=this.HTMLTooltipItemsElements,h=document.createElement("ul");h.className=l.LIST,iG(h,u);var d=this.element.querySelector(".".concat(l.LIST));d?d.replaceWith(h):c.appendChild(h)}!function(t,e){Object.entries(e).forEach(function(e){var n=We(e,2),r=n[0],i=n[1];He([t],We(t.querySelectorAll(r)),!1).filter(function(t){return t.matches(r)}).forEach(function(t){t&&(t.style.cssText+=Object.entries(i).reduce(function(t,e){return"".concat(t).concat(e.join(":"),";")},""))})})}(c,a)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},a=this.elementSize,s=a.width,l=a.height,c=[-s/2,-l/2];return i.forEach(function(t){var e=We(c,2),n=e[0],i=e[1],a=We(o[t],2),u=a[0],h=a[1];c=[n+(s/2+r[0])*u,i+(l/2+r[1])*h]}),c},e.prototype.setOffsetPosition=function(t){var e=We(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=void 0===o?0:o,s=i.y,l=void 0===s?0:s,c=i.container,u=c.x,h=c.y;this.element.style.left="".concat(+a+u+n,"px"),this.element.style.top="".concat(+l+h+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=We(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=i.y,s=i.bounding,l=i.position;if(!s)return[n,r];var c=this.element,u=c.offsetWidth,h=c.offsetHeight,d=We([+o+n,+a+r],2),f=d[0],p=d[1],g={left:"right",right:"left",top:"bottom",bottom:"top"},v=s.x,m=s.y,y={left:f<v,right:f+u>v+s.width,top:p<m,bottom:p+h>m+s.height},b=[];l.split("-").forEach(function(t){y[t]?b.push(g[t]):b.push(t)});var x=b.join("-");return this.getRelativeOffsetFromCursor(x)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height;return new pz(r,i,o,a).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout(function(){e.element.style.transition=n},10)},e.tag="tooltip",e}(sG),cH=function(t){function e(n){var r=t.call(this,bz({},e.defaultOptions,n))||this;return r.hoverColor="#f5f5f5",r.selectedColor="#e6f7ff",r.background=r.appendChild(new fc({})),r.label=r.background.appendChild(new ec({})),r}return Be(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return Yz(this.style.padding)},enumerable:!1,configurable:!0}),e.prototype.renderLabel=function(){var t=this.style,e=t.label,n=t.value,r=Jz(this.attributes,"label");$z(this.label).maybeAppend(".label",function(){return Tz(e)}).attr("className","label").styles(r),this.label.attr("__data__",n)},e.prototype.renderBackground=function(){var t=this.label.getBBox(),e=We(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3],a=t.width,s=t.height,l=a+o+r,c=s+n+i,u=Jz(this.attributes,"background"),h=this.style,d=h.width,f=void 0===d?0:d,p=h.height,g=void 0===p?0:p,v=h.selected;this.background.attr(Fe(Fe({},u),{width:Math.max(l,f),height:Math.max(c,g),fill:v?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((c-s)/2,")")})},e.prototype.render=function(){this.renderLabel(),this.renderBackground()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("pointerenter",function(){t.style.selected||t.background.attr("fill",t.hoverColor)}),this.addEventListener("pointerleave",function(){t.style.selected||t.background.attr("fill",t.style.backgroundFill)});var e=this;this.addEventListener("click",function(){var n=t.style,r=n.label,i=n.value,o=n.onClick;null==o||o(i,{label:r,value:i},e)})},e.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},e}(sG),uH=function(t){function e(n){var r,i,o=t.call(this,bz({},e.defaultOptions,n))||this;o.currentValue=null===(r=e.defaultOptions.style)||void 0===r?void 0:r.defaultValue,o.isPointerInSelect=!1,o.select=o.appendChild(new fc({className:"select",style:{cursor:"pointer",width:0,height:0}})),o.dropdown=o.appendChild(new fc({className:"dropdown"}));var a=o.style.defaultValue;return a&&(null===(i=o.style.options)||void 0===i?void 0:i.some(function(t){return t.value===a}))&&(o.currentValue=a),o}return Be(e,t),e.prototype.setValue=function(t){this.currentValue=t,this.render()},e.prototype.getValue=function(){return this.currentValue},Object.defineProperty(e.prototype,"dropdownPadding",{get:function(){return Yz(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),e.prototype.renderSelect=function(){var t,e=this,n=this.style,r=n.x,i=n.y,o=n.width,a=n.height,s=n.bordered,l=n.showDropdownIcon,c=Jz(this.attributes,"select"),u=Jz(this.attributes,"placeholder");this.select.attr(Fe(Fe({x:r,y:i,width:o,height:a},c),{fill:"#fff",strokeWidth:s?1:0}));var h=this.dropdownPadding;l&&$z(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(r+o-10-h[1]-h[3],", ").concat(i+a/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var d=null===(t=this.style.options)||void 0===t?void 0:t.find(function(t){return t.value===e.currentValue}),f=Fe({x:r+h[3]},u);$z(this.select).selectAll(".placeholder").data(d?[]:[1]).join(function(t){return t.append("text").attr("className","placeholder").styles(f).style("y",function(){var t=this.getBBox();return i+(a-t.height)/2})},function(t){return t.styles(f)},function(t){return t.remove()});var p=Jz(this.attributes,"optionLabel"),g=Fe({x:r+h[3]},p);$z(this.select).selectAll(".value").data(d?[d]:[]).join(function(t){return t.append(function(t){return Tz(t.label)}).attr("className","value").styles(g).style("y",function(){var t=this.getBBox();return i+(a-t.height)/2})},function(t){return t.styles(g)},function(t){return t.remove()})},e.prototype.renderDropdown=function(){var t,e,n=this,r=this.style,i=r.x,o=r.y,a=r.width,s=r.height,l=r.options,c=r.onSelect,u=r.open,h=Jz(this.attributes,"dropdown"),d=Jz(this.attributes,"option"),f=this.dropdownPadding;$z(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(l,function(t){return t.value}).join(function(t){return t.append(function(t){return new cH({className:"dropdown-item",style:Fe(Fe(Fe({},t),d),{width:a-f[1]-f[3],selected:t.value===n.currentValue,onClick:function(t,e,r){n.setValue(t),null==c||c(t,e,r),n.dispatchEvent(new Zs("change",{detail:{value:t,option:e,item:r}})),sz(n.dropdown)}})})}).each(function(t,e){var n,r=(null===(n=this.parentNode)||void 0===n?void 0:n.children).reduce(function(t,n,r){return r<e&&(t+=n.getBBox().height),t},0);this.attr("transform","translate(".concat(f[3],", ").concat(f[0]+r,")"))})},function(t){return t.update(function(t){return{selected:t.value===n.currentValue}})},function(t){return t.remove()});var p=null===(e=null===(t=this.dropdown.getElementsByClassName("dropdown-container"))||void 0===t?void 0:t[0])||void 0===e?void 0:e.getBBox(),g=h.spacing;this.dropdown.attr(Fe({transform:"translate(".concat(i,", ").concat(o+s+g,")"),width:p.width+f[1]+f[3],height:p.height+f[0]+f[2]},h)),!u&&sz(this.dropdown)},e.prototype.render=function(){this.renderSelect(),this.renderDropdown()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("click",function(t){t.stopPropagation()}),this.select.addEventListener("click",function(){"visible"===t.dropdown.style.visibility?sz(t.dropdown):az(t.dropdown)}),this.addEventListener("pointerenter",function(){t.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){t.isPointerInSelect=!1}),null===document||void 0===document||document.addEventListener("click",function(){t.isPointerInSelect||sz(t.dropdown)})},e.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},e}(sG),hH=function(t){function e(n){var r=t.call(this,bz({},{style:{backgroundOpacity:e.backgroundOpacities.default}},e.defaultOptions,n))||this;return r.showBackground=!0,r.background=r.appendChild(new fc({})),r.icon=r.appendChild(new ec({})),r}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return Yz(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"iconSize",{get:function(){var t=this.attributes.size,e=We(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3];return Math.max(t-Math.max(o+r,n+i),2*this.lineWidth+1)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.size,i=r/2,o=Jz(this.attributes,"background");this.background.attr(Fe({x:e-i,y:n-i,width:r,height:r},o))},e.prototype.showIndicator=function(){if(this.label){var t=this.attributes.size,e=this.background.getBBox(),n=e.x,r=e.y;this.indicator.update({x:n+t/2,y:r-5,labelText:this.label,visibility:"visible"})}},e.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},e.prototype.connectedCallback=function(){var e;t.prototype.connectedCallback.call(this);var n=this.attributes.size,r=this.background.getBBox(),i=r.x,o=r.y,a=null===(e=this.ownerDocument)||void 0===e?void 0:e.defaultView;a&&(this.indicator=a.appendChild(new iH({style:{x:i+n/2,y:o-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},e.prototype.disconnectedCallback=function(){this.indicator.destroy()},e.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},e.prototype.bindEvents=function(){var t=this,n=this.attributes.onClick;if(this.addEventListener("click",function(){null==n||n(t)}),this.showBackground){var r=function(){return t.background.attr({opacity:e.backgroundOpacities.default})};this.addEventListener("pointerenter",function(){t.background.attr({opacity:e.backgroundOpacities.hover}),t.showIndicator()}),this.addEventListener("pointerleave",function(){r(),t.hideIndicator()}),this.addEventListener("pointerdown",function(){t.background.attr({opacity:e.backgroundOpacities.active})}),this.addEventListener("pointerup",function(){r()})}},e.tag="IconBase",e.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},e.backgroundOpacities={default:0,hover:.8,active:1},e}(sG),dH=function(t,e){return void 0===e&&(e="#565758"),new lc({style:{fill:e,d:"M ".concat(t,",").concat(t," L -").concat(t,",0 L ").concat(t,",-").concat(t," Z"),transformOrigin:"center"}})},fH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),e.prototype.arcPath=function(t,e,n){var r=We([n,n],2),i=r[0],o=r[1],a=function(r){return[t+n*Math.cos(r),e+n*Math.sin(r)]},s=We(a(-5/4*Math.PI),2),l=s[0],c=s[1],u=We(a(1/4*Math.PI),2),h=u[0],d=u[1];return"M".concat(l,",").concat(c,",A").concat(i,",").concat(o,",0,1,1,").concat(h,",").concat(d)},Object.defineProperty(e.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o+.5;$z(this.icon).maybeAppend(".reset","path").styles({stroke:r,lineWidth:o,d:this.arcPath(e,n,i/2-o),markerStart:dH(a,r)})},e}(hH),pH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e-o,n],[e,n+a],[e,n],[e+o,n-a],[e+o,n+a],[e,n]];$z(this.icon).maybeAppend(".backward","polygon").styles({points:s,fill:r})},e}(hH),gH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e+o,n],[e,n+a],[e,n],[e-o,n-a],[e-o,n+a],[e,n]];$z(this.icon).maybeAppend(".forward","polygon").styles({points:s,fill:r})},e}(hH),vH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3*Math.pow(3,.5)*.8,a=[[e+o,n],[e-o/2,n-i/2*.8],[e-o/2,n+i/2*.8],[e+o,n]];$z(this.icon).maybeAppend(".play","polygon").styles({points:a,fill:r})},e}(hH),mH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3,a=[[e-o,n-i/2],[e-o,n+i/2],[e-o/2,n+i/2],[e-o/2,n-i/2],[e-o,n-i/2],[e+o/2,n-i/2],[e+o/2,n+i/2],[e+o,n+i/2],[e+o,n-i/2]];$z(this.icon).maybeAppend(".pause","polygon").styles({points:a,fill:r})},e}(hH),yH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o;$z(this.icon).maybeAppend(".left-line","line").styles({x1:e-i/2,y1:n-i/2,x2:e-i/2,y2:n+i/2,stroke:r,lineWidth:o}),$z(this.icon).maybeAppend(".right-line","line").styles({x1:e+i/2,y1:n-i/2,x2:e+i/2,y2:n+i/2,stroke:r,lineWidth:o}),$z(this.icon).maybeAppend(".left-arrow","line").styles({x1:e,y1:n,x2:e-i/2+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:dH(2*o,r)}),$z(this.icon).maybeAppend(".right-arrow","line").styles({x1:e,y1:n,x2:e+i/2-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:dH(2*o,r)})},e}(hH),bH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;$z(this.icon).maybeAppend(".line","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o});var a=o;$z(this.icon).maybeAppend(".left-arrow","line").styles({x1:e-i/2-2*a,y1:n,x2:e-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:dH(2*o,r)}),$z(this.icon).maybeAppend(".right-arrow","line").styles({x1:e+i/2+2*a,y1:n,x2:e+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:dH(2*o,r)})},e}(hH),xH=function(t){return[[-t/2,-t/2],[-t/2,t/2],[t/2,t/2]]},EH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=(i-2*o-o)/4,s=(i-2*o-o)/2,l=We([e-i/2+o,n+i/2-2*o],2),c=l[0],u=l[1];$z(this.icon).maybeAppend(".coordinate","polyline").styles({points:xH(i).map(function(t){var r=We(t,2),i=r[0],o=r[1];return[i+e,o+n]}),stroke:r,lineWidth:o}),$z(this.icon).maybeAppend(".line","polyline").styles({points:[[c,u],[c+a,u-s],[c+2*a,u],[c+4*a,u-2*s]],stroke:r,lineWidth:o})},e}(hH),wH=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Be(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.data,e=this.attributes,n=e.x,r=e.y,i=e.color,o=this.iconSize,a=this.lineWidth,s=a,l=(o-s)/t.length,c=(o-2*s)/4,u=We([n-o/2+2*s,r+o/2-s],2),h=u[0],d=u[1];$z(this.icon).maybeAppend(".coordinate","polyline").styles({points:xH(o).map(function(t){var e=We(t,2),i=e[0],o=e[1];return[i+n,o+r]}),stroke:i,lineWidth:a}),$z(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(t,e){return{value:t,index:e}})).join(function(t){return t.append("line").attr("className","column").style("x1",function(t){var e=t.index;return h+l*e}).style("y1",d).style("x2",function(t){var e=t.index;return h+l*e}).style("y2",function(t){var e=t.value;return d-c*e}).styles({y1:d,stroke:i,lineWidth:a})})},e}(hH),kH=function(t){function e(e){var n=t.call(this,bz({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return Be(e,t),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;$z(this.icon).maybeAppend(".split","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o})},e}(hH),MH=function(t){function e(){var e=t.apply(this,He([],We(arguments),!1))||this;return e.showBackground=!1,e}return Be(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return Yz(0)},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.iconSize,e=this.attributes,n=e.x,r=e.y,i=e.speed,o=void 0===i?1:i,a=Re(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),s=oe(t,20,1/0),l=Fe(Fe({},a),{x:n-s/2,y:r-10,width:s,height:20,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:t/5,placeholderFontSize:t/2,optionPadding:0,optionLabelFontSize:t/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});$z(this.icon).maybeAppend(".speed",function(){return new uH({style:l})}).attr("className","speed").each(function(){this.update(l)})},e.tag="SpeedSelect",e}(hH),SH=function(t){function e(e){var n=t.call(this,e)||this;return n.icon=n.appendChild(new ec({})),n.currentType=n.attributes.type,n}return Be(e,t),e.prototype.getType=function(){return this.currentType},e.prototype.render=function(){var t=this,e=this.attributes;e.onChange;var n=ze(e,["onChange"]);$z(this.icon).selectAll(".icon").data([this.currentType]).join(function(e){return e.append(function(e){var n,r=null===(n=t.toggles.find(function(t){return We(t,1)[0]===e}))||void 0===n?void 0:n[1];if(!r)throw new Error("Invalid type: ".concat(e));return new r({})}).attr("className","icon").styles(n,!1).update({})},function(t){return t.styles({restStyles:n}).update({})},function(t){return t.remove()})},e.prototype.bindEvents=function(){var t=this,e=this.attributes.onChange;this.addEventListener("click",function(n){n.preventDefault(),n.stopPropagation();var r=(t.toggles.findIndex(function(e){return We(e,1)[0]===t.currentType})+1)%t.toggles.length,i=t.toggles[r][0];null==e||e(t.currentType),t.currentType=i,t.render()})},e.tag="ToggleIcon",e}(sG),NH=function(t){function e(e){var n=t.call(this,bz({},{style:{type:"play"}},e))||this;return n.toggles=[["play",vH],["pause",mH]],n}return Be(e,t),e}(SH),TH=function(t){function e(e){var n=t.call(this,bz({},{style:{type:"range"}},e))||this;return n.toggles=[["range",yH],["value",bH]],n}return Be(e,t),e}(SH),OH=function(t){function e(e){var n=t.call(this,bz({},{style:{type:"column"}},e))||this;return n.toggles=[["line",EH],["column",wH]],n}return Be(e,t),e}(SH),CH={reset:fH,speed:MH,backward:pH,playPause:NH,forward:gH,selectionType:TH,chartType:OH,split:kH},AH=function(t){function e(n){var r=t.call(this,bz({},e.defaultOptions,n))||this;return r.background=r.appendChild(new fc({})),r.functions=r.appendChild(new ec({})),r}return Be(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return Yz(this.attributes.padding)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.style,e=t.x,n=t.y,r=t.width,i=t.height,o=Jz(this.attributes,"background");this.background.attr(Fe({x:e,y:n,width:r,height:i},o))},e.prototype.renderFunctions=function(){var t,e=this,n=this.attributes,r=n.functions,i=n.iconSize,o=n.iconSpacing,a=n.x,s=n.y,l=n.width,c=n.height,u=n.align,h=We(this.padding,4),d=h[1],f=h[3],p=r.reduce(function(t,e){return t.length&&e.length?t.concat.apply(t,He(["split"],We(e),!1)):t.concat.apply(t,He([],We(e),!1))},[]),g=p.length*(i+o)-o,v={left:f+i/2,center:(l-g)/2+i/2,right:l-g-f-d+i/2}[u]||0;null===(t=this.speedSelect)||void 0===t||t.destroy(),this.functions.removeChildren(),p.forEach(function(t,n){var r,l=CH[t],u={x:a+n*(i+o)+v,y:s+c/2,size:i};if(l===MH?(u.speed=e.attributes.speed,u.onSelect=function(n){return e.handleFunctionChange(t,{value:n})}):[NH,TH,OH].includes(l)?(u.onChange=function(n){return e.handleFunctionChange(t,{value:n})},l===NH&&(u.type="play"===e.attributes.state?"pause":"play"),l===TH&&(u.type="range"===e.attributes.selectionType?"value":"range"),l===OH&&(u.type="line"===e.attributes.chartType?"column":"line")):u.onClick=function(){return e.handleFunctionChange(t,{value:t})},l===MH){var h=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView;h&&(e.speedSelect=new l({style:Fe(Fe({},u),{zIndex:100})}),h.appendChild(e.speedSelect))}else e.functions.appendChild(new l({style:u}))})},e.prototype.disconnectedCallback=function(){var e;t.prototype.disconnectedCallback.call(this),null===(e=this.speedSelect)||void 0===e||e.destroy()},e.prototype.render=function(){this.renderBackground(),this.renderFunctions()},e.prototype.handleFunctionChange=function(t,e){var n=this.attributes.onChange;null==n||n(t,e)},e.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},e}(sG),PH=function(t){function e(n){var r=t.call(this,bz({},e.defaultOptions,n))||this;return r.bindEvents(),r}return Be(e,t),e.prototype.bindEvents=function(){var t=this;this.addEventListener("mouseenter",function(){t.attr("lineWidth",Math.ceil(+(t.style.r||0)/2))}),this.addEventListener("mouseleave",function(){t.attr("lineWidth",0)})},e.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},e}(Zl),RH=function(t){function e(n){return t.call(this,bz({},e.defaultOptions,n))||this}return Be(e,t),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=Jz(this.attributes,"background");$z(this).maybeAppend("background","rect").attr("className","background").styles(Fe({x:e-r/2,y:n-i/2,width:r,height:i},o))},e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.iconSize,i=Jz(this.attributes,"icon"),o=r/2;$z(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(Fe({x1:e-1,y1:n-o,x2:e-1,y2:n+o},i)),$z(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(Fe({x1:e+1,y1:n-o,x2:e+1,y2:n+o},i))},e.prototype.renderBorder=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=Jz(this.attributes,"border"),s="start"===o?+r/2:-r/2;$z(this).maybeAppend("border","line").attr("className","border").styles(Fe({x1:s+e,y1:n-i/2,x2:s+e,y2:n+i/2},a))},e.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},e.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},e}(sG);function DH(t,e){return"number"==typeof t?LH(t):function(t,e){var n=new Date(t);switch(e){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(n.getHours())&&0===n.getMinutes()?nG(n,"HH:mm\nYYYY-MM-DD"):nG(n,"HH:mm");case"half-day":return n.getHours()<12?"AM\n".concat(nG(n,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(n.getDate())?nG(n,"DD\nYYYY-MM"):nG(n,"DD");case"week":return n.getDate()<=7?nG(n,"DD\nYYYY-MM"):nG(n,"DD");case"month":return[0,6].includes(n.getMonth())?nG(n,"MM月\nYYYY"):nG(n,"MM月");case"season":return[0].includes(n.getMonth())?nG(n,"MM月\nYYYY"):nG(n,"MM月");case"year":return nG(n,"YYYY");default:return nG(n,"YYYY-MM-DD HH:mm")}}(t,e)}function LH(t){var e=String(Math.floor(t/3600)).padStart(2,"0"),n=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(Math.floor(t%60)).padStart(2,"0");return t<3600?"".concat(n,":").concat(r):"".concat(e,":").concat(n,":").concat(r)}var _H=function(t){function e(n){var r=t.call(this,bz({},e.defaultOptions,n))||this;r.axis=r.appendChild(new AW({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),r.timeline=r.appendChild(new AV({style:{onChange:function(t){r.handleSliderChange(t)}}})),r.controller=r.appendChild(new AH({})),r.states={},r.handleSliderChange=function(t){var e,n=(e=r.states.values,Array.isArray(e)?He([],We(e),!1):e);r.setBySliderValues(t),r.dispatchOnChange(n)};var i=r.attributes,o=i.selectionType,a=i.chartType,s=i.speed,l=i.state,c=i.playMode,u=i.values;return r.states={chartType:a,playMode:c,selectionType:o,speed:s,state:l},r.setByTimebarValues(u),r}return Be(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.data.sort(function(t,e){return t.time<e.time?-1:t.time>e.time?1:0})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"space",{get:function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=t.controllerHeight,s=oe(+i-a,0,+i),l=new pz(e,n+ +i-a,+r,a),c=0,u="time"===o?10:s;return{axisBBox:"chart"===o?new pz(e,n+s-(c=35),+r,c):new pz,controllerBBox:l,timelineBBox:new pz(e,n+("time"===o?s:s-u),+r,u-c)}},enumerable:!1,configurable:!0}),e.prototype.setBySliderValues=function(t){var e,n,r=this.data,i=We(Array.isArray(t)?t:[0,t],2),o=i[0],a=i[1],s=r.length,l=r[Math.floor(o*s)],c=r[Math.ceil(a*s)-(Array.isArray(t)?0:1)];this.states.values=[null!==(e=null==l?void 0:l.time)&&void 0!==e?e:r[0].time,null!==(n=null==c?void 0:c.time)&&void 0!==n?n:1/0]},e.prototype.setByTimebarValues=function(t){var e,n,r,i=this.data,o=We(Array.isArray(t)?t:[void 0,t],2),a=o[0],s=o[1],l=i.find(function(t){return t.time===a}),c=i.find(function(t){return t.time===s});this.states.values=[null!==(e=null==l?void 0:l.time)&&void 0!==e?e:null===(n=i[0])||void 0===n?void 0:n.time,null!==(r=null==c?void 0:c.time)&&void 0!==r?r:1/0]},e.prototype.setByIndex=function(t){var e,n,r,i,o=this.data,a=We(t,2),s=a[0],l=a[1];this.states.values=[null!==(n=null===(e=o[s])||void 0===e?void 0:e.time)&&void 0!==n?n:o[0].time,null!==(i=null===(r=this.data[l])||void 0===r?void 0:r.time)&&void 0!==i?i:1/0]},Object.defineProperty(e.prototype,"sliderValues",{get:function(){var t,e=this.states,n=e.values,r=e.selectionType,i=We(Array.isArray(n)?n:[void 0,n],2),o=i[0],a=i[1],s=this.data,l=s.length,c="value"===r;return[(t=s.findIndex(function(t){return t.time===o}),c?0:t>-1?t/l:0),function(){if(a===1/0)return 1;var t=s.findIndex(function(t){return t.time===a});return t>-1?t/l:c?.5:1}()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){var t=this.states,e=t.values,n=t.selectionType,r=We(Array.isArray(e)?e:[this.data[0].time,e],2),i=r[0],o=r[1];return"value"===n?o:[i,o]},enumerable:!1,configurable:!0}),e.prototype.getDatumByRatio=function(t){var e=this.data,n=e.length;return e[Math.floor(t*(n-1))]},Object.defineProperty(e.prototype,"chartHandleIconShape",{get:function(){var t=this.states.selectionType,e=this.space.timelineBBox.height;return"range"===t?function(t){return new RH({style:{type:t,height:e,iconSize:e/6}})}:function(){return new ac({style:{x1:0,y1:-e/2,x2:0,y2:e/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),e.prototype.getChartStyle=function(t){var e=this,n=t.x,r=t.y,i=t.width,o=t.height,a=this.states,s=a.selectionType,l=a.chartType,c=this.data,u=this.attributes,h=u.type,d=u.labelFormatter,f=Jz(this.attributes,"chart");f.type;var p=ze(f,["type"]),g="range"===s;if("time"===h)return Fe({handleIconShape:function(){return new PH({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:g?-15:0,autoFitLabel:g,handleSpacing:g?-15:0,trackFill:"#edeeef",trackLength:i,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:s,values:this.sliderValues,formatter:function(t){if(d)return d(t);var n=e.getDatumByRatio(t).time;return"number"==typeof n?LH(n):nG(n,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},p);var v="range"===s?5:0,m=c.map(function(t){return t.value});return Fe({handleIconOffset:v,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:m,sparklineType:l,sparklineScale:.8,trackLength:i,trackSize:o,type:s,values:this.sliderValues,transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},p)},e.prototype.renderChart=function(t){void 0===t&&(t=this.space.timelineBBox),this.timeline.update(this.getChartStyle(t))},e.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},e.prototype.getAxisStyle=function(t){var e=this.data,n=this.attributes,r=n.interval,i=n.labelFormatter,o=Jz(this.attributes,"axis"),a=t.x,s=t.y,l=t.width,c=He(He([],We(e),!1),[{time:0}],!1).map(function(t,e,n){var r=t.time;return{label:"".concat(r),value:e/(n.length-1),time:r}}),u=Fe({startPos:[a,s],endPos:[a+l,s],data:c,labelFilter:function(t,e){return e<c.length-1},labelFormatter:function(t){var e=t.time;return i?i(e):DH(e,r)}},o);return u},e.prototype.renderAxis=function(t){void 0===t&&(t=this.space.axisBBox),"chart"===this.attributes.type&&this.axis.update(this.getAxisStyle(t))},e.prototype.renderController=function(t){void 0===t&&(t=this.space.controllerBBox);var e=this.attributes.type,n=this.states,r=n.state,i=n.speed,o=n.selectionType,a=n.chartType,s=Jz(this.attributes,"controller"),l=this,c=Fe(Fe(Fe({},t),{iconSize:20,speed:i,state:r,selectionType:o,chartType:a,onChange:function(t,e){var n=e.value;switch(t){case"reset":l.internalReset();break;case"speed":l.handleSpeedChange(n);break;case"backward":l.internalBackward();break;case"playPause":"play"===n?l.internalPlay():l.internalPause();break;case"forward":l.internalForward();break;case"selectionType":l.handleSelectionTypeChange(n);break;case"chartType":l.handleChartTypeChange(n)}}}),s);"time"===e&&(c.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(c)},e.prototype.dispatchOnChange=function(t){var e=this.data,n=this.attributes.onChange,r=this.states,i=r.values,o=r.selectionType,a=We(i,2),s=a[0],l=a[1],c=l===1/0?e.at(-1).time:l;t&&function(t,e){if(Array.isArray(t)){if(!Array.isArray(e))return!1;if(t[0]===e[0]){if(t[1]===e[1])return!0;if(t[1]===1/0||e[1]===1/0)return!0}return!1}return!Array.isArray(e)&&t===e}(t,"range"===o?[s,c]:c)||null==n||n("range"===o?[s,c]:c)},e.prototype.internalReset=function(t){var e,n,r=this.states.selectionType;this.internalPause(),this.setBySliderValues("range"===r?[0,1]:[0,0]),this.renderController(),this.updateSelection(),t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onReset)||void 0===n||n.call(e),this.dispatchOnChange())},e.prototype.reset=function(){this.internalReset()},e.prototype.moveSelection=function(t,e){var n=this.data,r=n.length,i=this.states,o=i.values,a=i.selectionType,s=i.playMode,l=We(o,2),c=l[0],u=l[1],h=n.findIndex(function(t){return t.time===c}),d=n.findIndex(function(t){return t.time===u});-1===d&&(d=r);var f,p="backward"===t?-1:1;"range"===a?"acc"===s?(f=[h,d+p],-1===p&&h===d&&(f=[h,r])):f=[h+p,d+p]:f=[h,d+p];var g=function(t){var e=We(t.sort(function(t,e){return t-e}),2),n=e[0],i=e[1],o=function(t){return oe(t,0,r)};return i>r?"value"===a?[0,0]:"acc"===s?[o(n),o(n)]:[0,o(i-n)]:n<0?"acc"===s?[0,o(i)]:[o(n+r-i),r]:[o(n),o(i)]}(f);return this.setByIndex(g),this.updateSelection(),g},e.prototype.internalBackward=function(t){var e,n,r=this.moveSelection("backward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onBackward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.backward=function(){this.internalBackward()},e.prototype.internalPlay=function(t){var e,n,r=this,i=this.data,o=this.attributes.loop,a=this.states.speed,s=void 0===a?1:a;this.playInterval=window.setInterval(function(){r.internalForward()[1]!==i.length||o||(r.internalPause(),r.renderController())},1e3/s),this.states.state="play",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPlay)||void 0===n||n.call(e))},e.prototype.play=function(){this.internalPlay()},e.prototype.internalPause=function(t){var e,n;clearInterval(this.playInterval),this.states.state="pause",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPause)||void 0===n||n.call(e))},e.prototype.pause=function(){this.internalPause()},e.prototype.internalForward=function(t){var e,n,r=this.moveSelection("forward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onForward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.forward=function(){this.internalForward()},e.prototype.handleSpeedChange=function(t){var e,n;this.states.speed=t,"play"===this.states.state&&(this.internalPause(!0),this.internalPlay(!0)),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSpeedChange)||void 0===n||n.call(e,t)},e.prototype.handleSelectionTypeChange=function(t){var e,n;this.states.selectionType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSelectionTypeChange)||void 0===n||n.call(e,t)},e.prototype.handleChartTypeChange=function(t){var e,n;this.states.chartType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onChartTypeChange)||void 0===n||n.call(e,t)},e.prototype.render=function(){var t=this.space,e=t.axisBBox,n=t.controllerBBox,r=t.timelineBBox;this.renderController(n),this.renderAxis(e),this.renderChart(r),"play"===this.states.state&&this.internalPlay()},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.internalPause(!0)},e.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},e}(sG);function IH(t){const{width:e,height:n,renderer:r}=t,i=function(t){var e;const{container:n,className:r,graphCanvas:i}=t;if(n)return"string"==typeof n?document.getElementById(n):n;const o=mB(r,!1),{width:a,height:s,containerStyle:l}=t,[c,u]=function(t){const{width:e,height:n,placement:r,graphCanvas:i}=t,[o,a]=i.getSize(),[s,l]=md(r);return[s*(o-e),l*(a-n)]}(t);return Object.assign(o.style,Object.assign({position:"absolute",left:c+"px",top:u+"px",width:a+"px",height:s+"px"},l)),null===(e=i.getContainer())||void 0===e||e.appendChild(o),o}(t);return[i,new Cc({width:e,height:n,container:i,renderer:r||new Up})]}class jH extends vB{constructor(e,n){super(e,Object.assign({},jH.defaultOptions,n)),this.typePrefix="__data__",this.draw=!1,this.fieldMap={node:new Map,edge:new Map,combo:new Map},this.selectedItems=[],this.bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)},this.changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=Oe(t,[r,"id"]),o=Oe(t,[r,"style","labelText"]),[a]=i.split("__"),s=this.fieldMap[a].get(o)||[];n.setElementState(Object.fromEntries(null==s?void 0:s.map(t=>[t,e])))},this.click=t=>{if("hover"===this.options.trigger)return;const e=Oe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter(t=>t!==e),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))},this.mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))},this.mouseenter=t=>{if("click"===this.options.trigger)return;const e=Oe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter(t=>t!==e):(this.selectedItems.push(e),this.changeState(t,"active"))},this.setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r}=this.context,{nodes:i,edges:o,combos:a}=n.getData(),s={},l=e=>Ut(t)?t(e):t,c={node:"circle",edge:"line",combo:"rect"},u={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},h=(t,e)=>{t.forEach(t=>{const{id:n}=t,i=Oe(t,["data",l(t)]),o=(null==r?void 0:r.getElementType(e,t))||"circle",a=((t,e)=>null==r?void 0:r.getElementComputedStyle(t,e))(e,t),h=("edge"===e?null==a?void 0:a.stroke:null==a?void 0:a.fill)||"#1783ff";n&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),s[i]||(s[i]={id:`${e}__${n}`,label:i,marker:u[o]||c[e],elementType:e,lineWidth:1,stroke:h,fill:h}))})};switch(e){case"node":h(i,"node");break;case"edge":h(o,"edge");break;case"combo":h(a,"combo");break;default:return[]}return Object.values(s)},this.createElement=()=>{if(this.draw)return void this.updateElement();const t=this.options,{width:e,height:n,nodeField:r,edgeField:i,comboField:o,trigger:a,position:s,container:l,containerStyle:c,className:u}=t,h=ze(t,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),d=this.getMarkerData(r,"node"),f=this.getMarkerData(i,"edge"),p=this.getMarkerData(o,"combo"),g=[...d,...p,...f],v=Object.assign({width:e,height:n,data:g,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:d.length},h,this.getEvents()),m=new eH({className:"legend",style:v});this.category=m;this.upsertCanvas().appendChild(m),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.container)||void 0===e||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:r=e,height:i=n,position:o,container:a,containerStyle:s,className:l}=this.options,[c,u]=IH({width:r,height:i,graphCanvas:t,container:a,containerStyle:s,placement:o,className:"legend"});return this.container=c,l&&c.classList.add(l),this.canvas=u,this.canvas}destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}jH.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class BH extends vB{constructor(t,e){super(t,Object.assign({},BH.defaultOptions,e)),this.onDraw=t=>{var e;(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.render)||this.onRender()},this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=t=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(t.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=t=>{if(!this.mask||!this.isMaskDragging)return;const{size:[e,n]}=this.options,{movementX:r,movementY:i}=t,{left:o,top:a,width:s,height:l}=this.mask.style,[,,c,u]=this.maskBBox;let h=parseInt(o)+r,d=parseInt(a)+i,f=parseInt(s),p=parseInt(l);h<0&&(h=0),d<0&&(d=0),h+f>e&&(h=zH(e-f,0)),d+p>n&&(d=zH(n-p,0)),f<c&&(r>0?(h=zH(h-r,0),f=FH(f+r,e)):r<0&&(f=FH(f-r,e))),p<u&&(i>0?(d=zH(d-i,0),p=FH(p+i,n)):i<0&&(p=FH(p-i,n))),Object.assign(this.mask.style,{left:h+"px",top:d+"px",width:f+"px",height:p+"px"});const g=parseInt(o)-h,v=parseInt(a)-d;if(0===g&&0===v)return;const m=this.context.canvas.getCamera().getZoom()/this.canvas.getCamera().getZoom();this.context.graph.translateBy([g*m,v*m],!1)},this.onMaskDragEnd=t=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(t.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=De(()=>{this.isMaskDragging||(this.updateMask(),this.setCamera())},32,{leading:!0}),this.setOnRender(),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),"delay"in t&&this.setOnRender(),this.bindEvents()}setOnRender(){this.onRender=be(()=>{this.renderMinimap(),this.renderMask()},this.options.delay)}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.onDraw),e.on(t.GraphEvent.AFTER_RENDER,this.onRender),e.on(t.GraphEvent.AFTER_ANIMATE,this.onRender),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.onDraw),e.off(t.GraphEvent.AFTER_RENDER,this.onRender),e.off(t.GraphEvent.AFTER_ANIMATE,this.onRender),e.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e,element:n}=this.context,r=e.getData(),i={nodes:r.nodes.filter(t=>null==n?void 0:n.getElement(Ih(t))),edges:r.edges.filter(t=>{const e=null==n?void 0:n.getElement(Ih(t));return e&&ev(e)}),combos:r.combos.filter(t=>null==n?void 0:n.getElement(Ih(t)))};if(!t)return i;const{nodes:o,edges:a,combos:s}=i;return{nodes:o.filter(e=>t(Ih(e),"node")),edges:a.filter(e=>t(Ih(e),"edge")),combos:s.filter(e=>t(Ih(e),"combo"))}}setShapes(t,e){const{nodes:n,edges:r,combos:i}=e,{shape:o}=this.options,{element:a}=this.context,s=(e,n)=>{const r=Ih(e),i=null==a?void 0:a.getElement(r);if(!i)return;const s=i.getShape("key");let l;if("string"==typeof o){const t=o;l=i.getShape(t).cloneNode()}else{const t=o(r,n,i);l=t===i?t.cloneNode(!0):t}l.setPosition(s.getPosition()),i.style.zIndex&&(l.style.zIndex=i.style.zIndex),l.id=i.id,t.appendChild(l)};t.removeChildren(),r.forEach(t=>s(t,"edge")),i.forEach(t=>s(t,"combo")),n.forEach(t=>s(t,"node"))}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:r,height:i}=this.canvas.getConfig();e===r&&n===i||this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:r,position:i,container:o,containerStyle:a}=this.options,[s,l]=IH({renderer:t,width:e,height:n,placement:i,className:"minimap",container:o,containerStyle:a,graphCanvas:this.context.canvas});r&&s.classList.add(r),this.container=s,this.canvas=l}return this.setCamera(),this.canvas}createLandmark(t,e,n){const r=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(r))return this.landmarkMap.get(r);const i=this.canvas.getCamera().createLandmark(r,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(r,i),i}setCamera(){var t;const{canvas:e}=this.context,n=null===(t=this.canvas)||void 0===t?void 0:t.getCamera();if(!n)return;const{size:[r,i],padding:o}=this.options,[a,s,l,c]=ch(o),{min:u,max:h,center:d}=e.getBounds("elements"),f=(r-c-s)/(h[0]-u[0]),p=(i-a-l)/(h[1]-u[1]),g=Math.min(f,p),v=this.createLandmark(d,d,g);n.gotoLandmark(v,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),r=t.getCanvasByViewport(e),i=this.canvas.canvas2Viewport(wd(n)),o=this.canvas.canvas2Viewport(wd(r)),a=o.x-i.x,s=o.y-i.y;return[i.x,i.y,a,s]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,r,i,o]=this.maskBBox;return n<0&&(i=FH(i+n,t),n=0),r<0&&(o=FH(o+r,e),r=0),n+i>t&&(i=zH(t-n,0)),r+o>e&&(o=zH(e-r,0)),[FH(n,t),FH(r,e),zH(i,0),zH(o,0)]}renderMask(){const{maskStyle:t}=this.options;this.mask||(this.mask=document.createElement("div"),this.mask.addEventListener("pointerdown",this.onMaskDragStart),this.mask.draggable=!0,this.mask.addEventListener("dragstart",t=>t.preventDefault&&t.preventDefault())),this.container.appendChild(this.mask),Object.assign(this.mask.style,Object.assign(Object.assign({},t),{cursor:"move",position:"absolute",pointerEvents:"auto"})),this.updateMask()}updateMask(){if(!this.mask)return;const[t,e,n,r]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:r+"px"})}destroy(){var t,e,n;this.unbindEvents(),null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.mask)||void 0===e||e.remove(),null===(n=this.container)||void 0===n||n.remove(),super.destroy()}}BH.defaultOptions={size:[240,160],shape:"key",padding:10,position:"right-bottom",maskStyle:{border:"1px solid #ddd",background:"rgba(0, 0, 0, 0.1)"},containerStyle:{border:"1px solid #ddd",background:"#fff"},delay:128};const FH=(t,e)=>Math.min(t,e),zH=(t,e)=>Math.max(t,e),GH={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class VH extends vB{constructor(t,e){super(t,Object.assign({},VH.defaultOptions,e)),this.initSnapline=()=>{const t=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=t.appendChild(new ac({style:Object.assign(Object.assign({},GH),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=t.appendChild(new ac({style:Object.assign(Object.assign({},GH),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(t,e,n)=>Ge(this,void 0,void 0,function*(){const{verticalX:r,horizontalY:i}=n,{tolerance:o}=this.options,{min:[a,s],max:[l,c],center:[u,h]}=e;let d=0,f=0;null!==r&&(WH(l,r)<o&&(d=r-l),WH(a,r)<o&&(d=r-a),WH(u,r)<o&&(d=r-u),0!==d&&(this.isVerticalSticking=!0)),null!==i&&(WH(c,i)<o&&(f=i-c),WH(s,i)<o&&(f=i-s),WH(h,i)<o&&(f=i-h),0!==f&&(this.isHorizontalSticking=!0)),0===d&&0===f||(yield this.context.graph.translateElementBy({[t]:[d,f]},!1))}),this.enableSnap=t=>{const{target:e}=t,n=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[r,i]=this.getDelta(t);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(r)<=n&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,-i]},!1),!1;if(this.isHorizontalSticking&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[0,-i]},!1),!1;if(this.isVerticalSticking&&Math.abs(r)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(t,e)=>{const{tolerance:n,shape:r}=this.options,{min:[i,o],max:[a,s],center:[l,c]}=e;let u=null,h=null,d=null,f=null,p=null,g=null;return this.getNodes().some(e=>{if(Te(t.id,e.id))return!1;const v=HH(e,r).getRenderBounds(),{min:[m,y],max:[b,x],center:[E,w]}=v;return null===u&&(WH(E,l)<n?u=E:WH(m,i)<n||WH(m,a)<n?u=m:(WH(b,a)<n||WH(b,i)<n)&&(u=b),null!==u&&(h=Math.min(y,o),d=Math.max(x,s))),null===f&&(WH(w,c)<n?f=w:WH(y,o)<n||WH(y,s)<n?f=y:(WH(x,s)<n||WH(x,o)<n)&&(f=x),null!==f&&(p=Math.min(m,i),g=Math.max(b,a))),null!==u&&null!==f}),{verticalX:u,verticalMinY:h,verticalMaxY:d,horizontalY:f,horizontalMinX:p,horizontalMaxX:g}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=t=>Ge(this,void 0,void 0,function*(){const{target:e}=t;if(this.options.autoSnap){if(!this.enableSnap(t))return}const n=HH(e,this.options.shape).getRenderBounds(),r=this.calcSnaplineMetadata(e,n);this.hideSnapline(),null===r.verticalX&&null===r.horizontalY||this.updateSnapline(r),this.options.autoSnap&&(yield this.autoSnapToLine(e.id,n,r))}),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,n=((null===(t=this.context.element)||void 0===t?void 0:t.getNodes())||[]).filter(t=>{var e;return ev(t)&&(null===(e=this.context.viewport)||void 0===e?void 0:e.isInViewport(t.getRenderBounds()))});return e?n.filter(t=>e(t)):n}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||GH.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:r,horizontalY:i,horizontalMinX:o,horizontalMaxX:a}=t,[s,l]=this.context.canvas.getSize(),{offset:c}=this.options;null!==i?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:o-c,y1:i,x2:c===1/0?s:a+c,y2:i,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",null!==e?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?l:r+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return rd([t.dx,t.dy],e)}bindEvents(){return Ge(this,void 0,void 0,function*(){const{graph:e}=this.context;e.on(t.NodeEvent.DRAG_START,this.onDragStart),e.on(t.NodeEvent.DRAG,this.onDrag),e.on(t.NodeEvent.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:e}=this.context;e.off(t.NodeEvent.DRAG_START,this.onDragStart),e.off(t.NodeEvent.DRAG,this.onDrag),e.off(t.NodeEvent.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;null===(t=this.horizontalLine)||void 0===t||t.destroy(),null===(e=this.verticalLine)||void 0===e||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}VH.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const WH=(t,e)=>Math.abs(t-e),HH=(t,e)=>"function"==typeof e?e(t):t.getShape(e),UH=["timestamp","time","date","datetime"];class $H extends vB{get padding(){return ch(this.options.padding)}constructor(t,e){super(t,Object.assign({},$H.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){var t;null===(t=this.timebar)||void 0===t||t.play()}pause(){var t;null===(t=this.timebar)||void 0===t||t.pause()}forward(){var t;null===(t=this.timebar)||void 0===t||t.forward()}backward(){var t;null===(t=this.timebar)||void 0===t||t.backward()}reset(){var t;null===(t=this.timebar)||void 0===t||t.reset()}update(t){super.update(t),this.backup(),this.upsertTimebar()}backup(){this.originalData=YH(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:r,data:i,x:o,y:a,width:s,height:l,mode:c}=e,u=ze(e,["onChange","timebarType","data","x","y","width","height","mode"]),h=t.getSize(),[d]=this.padding;this.upsertCanvas().ready.then(()=>{var t;const e=Object.assign(Object.assign({x:h[0]/2-s/2,y:d,onChange:t=>{const e=(Yt(t)?t:[t,t]).map(t=>function(t){return t instanceof Date}(t)?t.getTime():t);"modify"===this.options.mode?this.filterElements(e):this.hiddenElements(e),null==n||n(e)}},u),{data:i.map(t=>ae(t)?{time:t,value:0}:t),width:s,height:l,type:r});this.timebar?this.timebar.update(e):(this.timebar=new _H({style:e}),null===(t=this.canvas)||void 0===t||t.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,r=this.context.canvas,[i]=r.getSize(),[o,,a]=this.padding,[s,l]=IH({width:i,height:e+o+a,graphCanvas:r,className:"timebar",placement:n});return this.container=s,t&&s.classList.add(t),this.canvas=l,this.canvas}filterElements(t){return Ge(this,void 0,void 0,function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:r}=this.options,{graph:i,element:o}=this.context,a=YH(this.originalData);n.forEach(e=>{const n=`${e}s`;a[n]=(this.originalData[n]||[]).filter(e=>{const n=r(e);return!!qH(n,t)})});const s=[...a.nodes,...a.combos].map(t=>Ih(t));a.edges=a.edges.filter(t=>{const e=t.source,n=t.target;return s.includes(e)&&s.includes(n)}),i.setData(a),yield null===(e=o.draw({animation:!1,silence:!0}))||void 0===e?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:r}=this.options,i=[],o=[];n.forEach(e=>{var n;const a=`${e}s`;((null===(n=this.originalData)||void 0===n?void 0:n[a])||[]).forEach(e=>{const n=Ih(e),a=r(e);qH(a,t)?o.push(n):i.push(n)})}),e.hideElement(i,!1),e.showElement(o,!1)}destroy(){var t,e,n;const{graph:r}=this.context;this.originalData&&r.setData(Object.assign({},this.originalData)),null===(t=this.timebar)||void 0===t||t.destroy(),null===(e=this.canvas)||void 0===e||e.destroy(),null===(n=this.container)||void 0===n||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}$H.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:t=>XH(t,UH,void 0),loop:!1};const YH=t=>{const{nodes:e=[],edges:n=[],combos:r=[]}=t;return{nodes:[...e],edges:[...n],combos:[...r]}},qH=(t,e)=>{if(ae(e))return t===e;const[n,r]=e;return t>=n&&t<=r},XH=(t,e,n)=>{var r;for(let n=0;n<e.length;n++){const i=e[n],o=null===(r=t.data)||void 0===r?void 0:r[i];if(o)return o}return n},KH={fill:"#1D2129",wordWrap:!0,maxLines:1,textOverflow:"ellipsis",textBaseline:"top",textAlign:"start",x:0},ZH=Object.assign(Object.assign({},KH),{fillOpacity:.9,fontSize:16,fontWeight:"bold"}),QH=Object.assign(Object.assign({},KH),{fillOpacity:.65,fontSize:12,fontWeight:"normal"}),JH={align:"left",spacing:8,size:44,padding:[16,24,0,24]},tU="title",eU="subtitle";class nU extends vB{get padding(){return ch(this.options.padding)}constructor(t,e){super(t,Object.assign({},JH,e)),this.onRender=()=>{const t=this.updateCanvas();this.renderTitle(t)},this.bindEvents()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_RENDER,this.onRender),e.on(t.GraphEvent.AFTER_ANIMATE,this.onRender)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_RENDER,this.onRender),e.off(t.GraphEvent.AFTER_ANIMATE,this.onRender)}destroy(){var t,e;this.unbindEvents(),null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.container)||void 0===e||e.remove(),super.destroy()}updateCanvas(){const{size:t,className:e,align:n}=this.options,[r]=this.context.canvas.getSize(),[i=0,,o=0]=this.padding,a=t+i+o;if(this.canvas){const{width:t,height:e}=this.canvas.getConfig();r===t&&a===e||this.canvas.resize(r,a)}else{const t={left:"left-top",center:"top",right:"right-top"},[i,o]=IH({width:r,height:a,placement:t[n]||t.left,className:"title-canvas",graphCanvas:this.context.canvas});e&&i.classList.add(e),this.container=i,this.canvas=o}return this.canvas}renderTitle(t){const e=new rU({options:this.options,ctx:this.context});t.removeChildren(),e.getTitle().forEach(e=>{e&&t.appendChild(e)})}}class rU{get padding(){return ch(this.options.padding)}constructor(t){const{options:e,ctx:n}=t;this.options=e,this.context=n}getTitle(){const t=this.options,e=tU,n=t[e],r=eU,i=t[r],{spacing:o=44,padding:a,align:s}=t,l=ze(t,[e+"",r+"","spacing","padding","align"]),c=n,u=i,h=Kd(l,tU),d=Kd(l,eU),[f]=this.context.graph.getSize(),[p=0,g=0,,v=0]=this.padding,m=f,y=m-v-g;let b=null,x=v,E="left";switch(s){case"left":default:x=v,E="left";break;case"center":x=m/2,E="center";break;case"right":x=m-g,E="right"}const w=new uf({className:tU,style:Object.assign(Object.assign(Object.assign(Object.assign({},ZH),{wordWrapWidth:y-5,x:x,y:p,textAlign:E}),h),{text:c})}),k=w.getBBox();return u&&(b=new uf({className:"subTitle",style:Object.assign(Object.assign(Object.assign(Object.assign({},QH),{wordWrapWidth:y-5,x:x,y:k.height+o+p,textAlign:E}),d),{text:u})})),[w,b]}}class iU extends vB{constructor(t,e){super(t,Object.assign({},iU.defaultOptions,e)),this.$element=mB("toolbar",!1),this.onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");null==e||e(n,t.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),yB("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n }\n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),yB("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">\n <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>\n <symbol id="request-fullscreen" viewBox="0 0 1024 1024">\n <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Ge(this,void 0,void 0,function*(){e.update.call(this,t);const{className:n,position:r,style:i}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,i,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach(t=>{e[t]="8px"}),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(r)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return Ge(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(t=>{var e;return`\n <div class="g6-toolbar-item" value="${t.value}" title="${null!==(e=t.title)&&void 0!==e?e:""}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`}).join("")})}}iU.defaultOptions={position:"top-left"};class oU extends vB{constructor(t,e){super(t,Object.assign({},oU.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=(t,e)=>{const{enable:n}=this.options;return"function"==typeof n?n(t,e):n},this.onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?this.hide(t):this.show(t)},this.onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.show(t)},this.onPointerLeave=t=>{this.hide(t)},this.onCanvasMove=t=>{this.hide(t)},this.onPointerOver=t=>{this.show(t)},this.showById=t=>Ge(this,void 0,void 0,function*(){const e={target:{id:t}};yield this.show(e)}),this.getElementData=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}},this.show=t=>Ge(this,void 0,void 0,function*(){var e,n;const{client:r,target:{id:i}}=t;if(rv(t.target))return;const o=this.context.graph.getElementType(i),{getContent:a,title:s}=this.options,l=this.getElementData(i,o);if(!this.tooltipElement||!this.isEnable(t,l))return;let c,u,h={};if(a){if(h.content=yield a(t,l),!h.content)return}else{const t=this.context.graph.getElementRenderStyle(i),e="node"===o?t.fill:t.stroke;h={title:s||o,data:l.map(t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:e}))}}if(this.currentTarget=i,r)c=r.x,u=r.y;else{const t=Oe(l,"0.style",{x:0,y:0});c=t.x,u=t.y}null===(n=(e=this.options).onOpenChange)||void 0===n||n.call(e,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:c,y:u,style:{".tooltip":{visibility:"visible"}}}),h))}),this.hide=t=>{var e,n,r,i,o;if(!t)return null===(n=(e=this.options).onOpenChange)||void 0===n||n.call(e,!1),null===(r=this.tooltipElement)||void 0===r||r.hide(),void(this.currentTarget=null);if(!this.tooltipElement)return;if(!this.currentTarget)return;const{client:{x:a,y:s}}=t;null===(o=(i=this.options).onOpenChange)||void 0===o||o.call(i,!1),this.tooltipElement.hide(a,s),this.currentTarget=null},this.initTooltip=()=>{var t;const e=new lH({className:"tooltip",style:this.tooltipStyleProps});return null===(t=this.container)||void 0===t||t.appendChild(e.HTMLTooltipElement),e},this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"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(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&(null===(e=this.container)||void 0===e||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:a,enterable:s,container:l={x:-i,y:-r},title:c,offset:u}=this.options,[h,d]=e,[f,p]=t.getSize();return{x:h,y:d,container:l,title:c,bounding:{x:0,y:0,width:f,height:p},position:a,enterable:s,offset:u,style:o}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&(null===(t=this.container)||void 0===t||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}let aU;function sU(t,e){aU||(aU=document.createElement("canvas")),aU.width=t,aU.height=e;return aU.getContext("2d").clearRect(0,0,t,e),aU}oU.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};class lU extends vB{constructor(t,e){super(t,Object.assign({},lU.defaultOptions,e)),this.$element=mB("watermark");this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Ge(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:r,height:i,text:o,imageURL:a}=n,s=ze(n,["width","height","text","imageURL"]);Object.keys(s).forEach(e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])});const l=a?yield function(t,e,n,r){return Ge(this,void 0,void 0,function*(){const i=sU(t,e),o=i.getContext("2d"),{rotate:a,opacity:s}=r;a&&o.rotate(a),s&&(o.globalAlpha=s);const l=new Image;return l.crossOrigin="anonymous",l.src=n,new Promise(n=>{l.onload=function(){const r=t>l.width?(t-l.width)/2:0,a=e>l.height?(e-l.height)/2:0;o.drawImage(l,0,0,l.width,l.height,r,a,t-2*r,e-2*a),n(i.toDataURL())}})})}(r,i,a,s):yield function(t,e,n,r){return Ge(this,void 0,void 0,function*(){const i=sU(t,e),o=i.getContext("2d"),{rotate:a,opacity:s,textFill:l,textFontSize:c,textFontFamily:u,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:p}=r;return o.textAlign=f,o.textBaseline=p,o.translate(t/2,e/2),o.font=`${c}px ${u} ${h} ${d}`,a&&o.rotate(a),s&&(o.globalAlpha=s),l&&(o.fillStyle=l,o.fillText(`${n}`,0,0)),i.toDataURL()})}(r,i,o,s);this.$element.style.backgroundImage=`url(${l})`})}destroy(){super.destroy(),this.$element.remove()}}lU.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const cU=["#7E92B5","#F4664A","#FFBE3A"],uU={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},hU={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function dU(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeHaloStrokeOpacityActive:a=.15,nodeHaloStrokeOpacitySelected:s=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:c=.85,nodeOpacityInactive:u=.25,nodeBadgePalette:h=cU,nodePaletteOptions:d=uU,edgeColor:f,edgeColorDisabled:p,edgePaletteOptions:g=hU,comboColor:v,comboColorDisabled:m,comboStroke:y,comboStrokeDisabled:b,edgeColorInactive:x}=t;return{background:e,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:r,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:n,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65,size:32,stroke:o,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:s,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:o},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:a},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:o,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:u,donutOpacity:u,fillOpacity:u,iconOpacity:c,labelFill:n,labelFillOpacity:u,strokeOpacity:u},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:n,labelFillOpacity:.25,strokeOpacity:l}},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:f,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:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:f,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:x,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:p,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:n,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:m,fillOpacity:.25,labelOpacity:.25,stroke:b,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 fU=dU({bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:{type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"}),pU=dU({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"});class gU extends Kh{beforeDraw(t,e){return t}afterLayout(t,e){}}function vU(t,e,n,r,i){const o=Ih(r),a=`${n}s`,s=i?r:t.add[a].get(o)||t.update[a].get(o)||t.remove[a].get(o)||r;Object.entries(t).forEach(([t,n])=>{e===t?n[a].set(o,s):n[a].delete(o)})}function mU(t,e){return Object.keys(t).every(n=>t[n]===e[n])}const yU=(t,e,n,r)=>{const i=`${n}s`,o=Ih(r);t.add[i].has(o)||t.update[i].has(o)||t[e][i].set(Ih(r),r)};const bU=new WeakMap;const xU=(t,e,n=2)=>{if("object"!=typeof t||"object"!=typeof e)return t===e;const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const i of r){const r=t[i],o=e[i];if(n>1&&"object"==typeof r&&"object"==typeof o){if(!xU(r,o,n-1))return!1}else if(r!==o)return!1}return!0};function EU(t,e,n){Vu[t][e]&&$u(`The extension ${e} of ${t} has been registered before, and will be overridden.`),Object.assign(Vu[t],{[e]:n})}
/*!
* @antv/g-plugin-dragndrop
* @description A G plugin for Drag n Drop implemented with PointerEvents
* @version 2.0.38
* @date 7/30/2025, 1:35:41 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/var wU=function(){function t(e){s(this,t),this.dragndropPluginOptions=e}return c(t,[{key:"apply",value:function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,a=function(t){var e=t.target,r=e===i,a=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(a){var s=!1,l=t.timeStamp,c=[t.clientX,t.clientY],u=null,h=[t.clientX,t.clientY],d=function(){var t=cr(sr().mark(function t(o){var d,f,p,g,v,m;return sr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=2;break}if(d=o.timeStamp-l,f=yn([o.clientX,o.clientY],c),!(d<=n.dragndropPluginOptions.dragstartTimeThreshold||f<=n.dragndropPluginOptions.dragstartDistanceThreshold)){t.next=1;break}return t.abrupt("return");case 1:o.type="dragstart",a.dispatchEvent(o),s=!0;case 2:if(o.type="drag",o.dx=o.clientX-h[0],o.dy=o.clientY-h[1],a.dispatchEvent(o),h=[o.clientX,o.clientY],r){t.next=4;break}return p="pointer"===n.dragndropPluginOptions.overlap?[o.canvasX,o.canvasY]:e.getBounds().center,t.next=3,i.elementsFromPoint(p[0],p[1]);case 3:g=t.sent,v=g[g.indexOf(e)+1],m=(null==v?void 0:v.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?i:null),u!==m&&(u&&(o.type="dragleave",o.target=u,u.dispatchEvent(o)),m&&(o.type="dragenter",o.target=m,m.dispatchEvent(o)),(u=m)&&(o.type="dragover",o.target=u,u.dispatchEvent(o)));case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}();o.addEventListener("pointermove",d);var f=function(t){if(s){t.detail={preventClick:!0};var e=t.clone();u&&(e.type="drop",e.target=u,u.dispatchEvent(e)),e.type="dragend",a.dispatchEvent(e),s=!1}o.removeEventListener("pointermove",d)};e.addEventListener("pointerup",f,{once:!0}),e.addEventListener("pointerupoutside",f,{once:!0})}};r.hooks.init.tap(t.tag,function(){o.addEventListener("pointerdown",a)}),r.hooks.destroy.tap(t.tag,function(){o.removeEventListener("pointerdown",a)})}}])}();wU.tag="Dragndrop";var kU=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,e),(t=v(this,e)).name="dragndrop",t.options=n,t}return y(e,t),c(e,[{key:"init",value:function(){this.addRenderingPlugin(new wU(a({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)}}])}(vr);const MU=["main"],SU=["background","main","label","transient"];class NU{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||this.getLayers().main}getLayers(){return this.extends.layers}getRenderer(t){return this.extends.renderers[t]}getCamera(t="main"){return this.getLayer(t).getCamera()}getRoot(t="main"){return this.getLayer(t).getRoot()}getContextService(t="main"){return this.getLayer(t).getContextService()}setCursor(t){this.config.cursor=t,this.getLayer().setCursor(t)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(t){this.config={enableMultiLayer:!0},Object.assign(this.config,t);const e=this.config,{renderer:n,background:r,cursor:i,enableMultiLayer:o}=e,a=ze(e,["renderer","background","cursor","enableMultiLayer"]),s=o?SU:MU,l=TU(n,s),c=Object.fromEntries(s.map(t=>[t,new Cc(Object.assign(Object.assign({},a),{supportsMutipleCanvasesInOneContainer:o,renderer:l[t],background:o?"background"===t?r:void 0:r}))]));OU(c),this.extends={config:this.config,renderer:n,renderers:l,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const r=n.getCamera(),i=r.getPosition(),o=r.getFocalPoint();n.resize(t,e),r.setPosition(i),r.setFocalPoint(o)})}getBounds(t){return mh(Object.values(this.getLayers()).map(e=>t?e.getRoot().childNodes.find(e=>e.classList.includes(t)):e.getRoot()).filter(t=>(null==t?void 0:t.childNodes.length)>0).map(t=>t.getBounds()))}getContainer(){const t=this.extends.config.container;return"string"==typeof t?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const r=(null===(n=t.style)||void 0===n?void 0:n.$layer)||"main";return this.getLayer(r).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=TU(t,this.config.enableMultiLayer?SU:MU);this.extends.renderers=e,Object.entries(e).forEach(([t,e])=>this.getLayer(t).setRenderer(e)),OU(this.getLayers())}getCanvasByViewport(t){return Ed(this.getLayer().viewport2Canvas(wd(t)))}getViewportByCanvas(t){return Ed(this.getLayer().canvas2Viewport(wd(t)))}getViewportByClient(t){return Ed(this.getLayer().client2Viewport(wd(t)))}getClientByViewport(t){return Ed(this.getLayer().viewport2Client(wd(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(wd(t));return Ed(e.viewport2Canvas(n))}toDataURL(){return Ge(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,r=ze(t,["mode"]);let[i,o,a,s]=[0,0,0,0];if("viewport"===n)[a,s]=this.getSize();else if("overall"===n){const t=this.getBounds(),e=fh(t);[i,o]=t.min,[a,s]=e}const l=Rn('<div id="virtual-image"></div>'),c=new Cc({width:a,height:s,renderer:new Up,devicePixelRatio:e,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(),p=c.getCamera();if("viewport"===n)p.setZoom(f.getZoom()),p.setPosition(f.getPosition()),p.setFocalPoint(f.getFocalPoint());else if("overall"===n){const[t,e,n]=p.getPosition(),[r,a,s]=p.getFocalPoint();p.setPosition([t+i,e+o,n]),p.setFocalPoint([r+i,a+o,s])}const g=c.getContextService();return new Promise(t=>{c.addEventListener(kc.RERENDER,()=>Ge(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,300));const e=yield g.toDataURL(r);t(e)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function TU(t,e){return Object.fromEntries(e.map(e=>{const n=(null==t?void 0:t(e))||new Up;return n instanceof Up&&n.setConfig({enableDirtyRectangleRendering:!1}),"main"===e?n.registerPlugin(new kU({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function OU(t){Object.entries(t).forEach(([t,e])=>{const n=e.getContextService().getDomElement();(null==n?void 0:n.style)&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")),(null==n?void 0:n.parentElement)&&(n.parentElement.style.display="grid",n.parentElement.style.isolation="isolate")})}const CU=t=>t?parseInt(t):0;function AU(t){if(!t)return[0,0];let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||CU(e.width),r=t.clientHeight||CU(e.height);return[n-(CU(e.paddingLeft)+CU(e.paddingRight)),r-(CU(e.paddingTop)+CU(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(ae(e)?e:1,1),Math.max(ae(n)?n:1,1)]}class PU{constructor(t){this.type=t}}class RU extends PU{constructor(t,e){super(t),this.data=e}}class DU extends PU{constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class LU extends PU{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class _U extends PU{constructor(t,e){super(t),this.data=e}}function IU(t,e){t.emit(e.type,e)}function jU(t){var e;return(null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0}const BU="cachedStyle",FU=t=>`__${t}__`;function zU(t,e){return Oe(t,[BU,FU(e)])}class GU{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var r,i,o;null===(r=null==e?void 0:e.before)||void 0===r||r.call(e);const a=this.getTasks().map(([e,r])=>{var i,o,a;const{element:s,elementType:l,stage:c}=e,u=Qu(this.context.options,l,c,t);null===(i=null==r?void 0:r.before)||void 0===i||i.call(r);const h=u.length?th(s,this.inferStyle(e,n),u):null;return h?(null===(o=null==r?void 0:r.beforeAnimate)||void 0===o||o.call(r,h),h.finished.then(()=>{var t,e;null===(t=null==r?void 0:r.afterAnimate)||void 0===t||t.call(r,h),null===(e=null==r?void 0:r.after)||void 0===e||e.call(r),this.animations.delete(h)})):null===(a=null==r?void 0:r.after)||void 0===a||a.call(r),h}).filter(Boolean);a.forEach(t=>this.animations.add(t));const s=qu(a);return s?(null===(i=null==e?void 0:e.beforeAnimate)||void 0===i||i.call(e,s),s.finished.then(()=>{var t,n;null===(t=null==e?void 0:e.afterAnimate)||void 0===t||t.call(e,s),null===(n=null==e?void 0:e.after)||void 0===n||n.call(e),this.release()})):null===(o=null==e?void 0:e.after)||void 0===o||o.call(e),s}inferStyle(t,e){var n,r;const{element:i,elementType:o,stage:a,originalStyle:s,updatedStyle:l={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},s),l));const{modifiedStyle:c}=t,u={},h={};if("enter"===a)Object.assign(u,{opacity:0});else if("exit"===a)Object.assign(h,{opacity:0});else if("show"===a)Object.assign(u,{opacity:0}),Object.assign(h,{opacity:null!==(n=zU(i,"opacity"))&&void 0!==n?n:Ku("opacity")});else if("hide"===a)Object.assign(u,{opacity:null!==(r=zU(i,"opacity"))&&void 0!==r?r:Ku("opacity")}),Object.assign(h,{opacity:0});else if("collapse"===a){const{collapse:t}=e||{},{target:n,descendants:r,position:a}=t;if("node"===o){if(r.includes(i.id)){const[t,e,n]=a;Object.assign(h,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e]=a;Object.assign(h,{x:t,y:e,childrenNode:s.childrenNode})}}else"edge"===o&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if("expand"===a){const{expand:t}=e||{},{target:n,descendants:r,position:a}=t;if("node"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=a;Object.assign(u,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=a;Object.assign(u,{x:t,y:e,z:n,childrenNode:c.childrenNode})}}else"edge"===o&&Object.assign(u,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(u).length>0?Object.assign({},s,u):s,Object.keys(h).length>0?Object.assign({},c,h):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,r=null===(e=null===(t=n.document)||void 0===t?void 0:t.timeline)||void 0===e?void 0:e.animationsWithPromises;r&&(n.document.timeline.animationsWithPromises=r.filter(t=>"finished"!==t.playState))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class VU{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(e=!0){this.batchCount++,1===this.batchCount&&this.emit(new RU(t.GraphEvent.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,0===this.batchCount&&this.emit(new RU(t.GraphEvent.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class WU extends Xh{constructor(e){super(e),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof mc)return{type:"canvas",element:t};let e=t;for(;e;){if(Vg(e))return{type:"node",element:e};if(Wg(e))return{type:"edge",element:e};if(Hg(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:a,element:s}=r;if("destroyed"in s&&(rv(s)||s.destroyed))return;const{type:l,detail:c,button:u}=e,h=Object.assign(Object.assign({},e),{target:s,targetType:a,originalTarget:n});l===t.CommonEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${this.currentTargetType}:${t.CommonEvent.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:t.CommonEvent.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),s&&(Object.assign(h,{type:t.CommonEvent.POINTER_ENTER}),i.emit(`${a}:${t.CommonEvent.POINTER_ENTER}`,h))),this.currentTarget=s,this.currentTargetType=a),l===t.CommonEvent.CLICK&&2===u||(i.emit(`${a}:${l}`,h),i.emit(l,h)),l===t.CommonEvent.CLICK&&2===c&&(Object.assign(h,{type:t.CommonEvent.DBLCLICK}),i.emit(`${a}:${t.CommonEvent.DBLCLICK}`,h),i.emit(t.CommonEvent.DBLCLICK,h)),l===t.CommonEvent.POINTER_DOWN&&2===u&&(Object.assign(h,{type:t.CommonEvent.CONTEXT_MENU,preventDefault:()=>{var e;null===(e=o.getContainer())||void 0===e||e.addEventListener(t.CommonEvent.CONTEXT_MENU,t=>t.preventDefault(),{once:!0})}}),i.emit(`${a}:${t.CommonEvent.CONTEXT_MENU}`,h),i.emit(t.CommonEvent.CONTEXT_MENU,h))},this.forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach(t=>{e.addEventListener(t,this.forwardContainerEvents)});const n=this.context.canvas.document;n&&[t.CommonEvent.CLICK,t.CommonEvent.DBLCLICK,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE,t.CommonEvent.POINTER_ENTER,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_OUT,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_UP,t.CommonEvent.CONTEXT_MENU,t.CommonEvent.DRAG_START,t.CommonEvent.DRAG,t.CommonEvent.DRAG_END,t.CommonEvent.DRAG_ENTER,t.CommonEvent.DRAG_OVER,t.CommonEvent.DRAG_LEAVE,t.CommonEvent.DROP,t.CommonEvent.WHEEL].forEach(t=>{n.addEventListener(t,this.forwardCanvasEvents)})}destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach(t=>{e.removeEventListener(t,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function HU(t,e){const{data:n,style:r}=t,i=ze(t,["data","style"]),{data:o,style:a}=e,s=ze(e,["data","style"]),l=Object.assign(Object.assign({},i),s);return(n||o)&&Object.assign(l,{data:Object.assign(Object.assign({},n),o)}),(r||a)&&Object.assign(l,{style:Object.assign(Object.assign({},r),a)}),l}function UU(t){const{data:e,style:n}=t,r=ze(t,["data","style"]);return e&&(r.data=Object.assign({},e)),n&&(r.style=Object.assign({},n)),r}function $U(t={},e={}){const{states:n=[],data:r={},style:i={},children:o=[]}=t,a=ze(t,["states","data","style","children"]),{states:s=[],data:l={},style:c={},children:u=[]}=e,h=(t,e)=>t.length===e.length&&t.every((t,n)=>t===e[n]),d=(t,e)=>{const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(n=>t[n]===e[n])};return!!d(a,ze(e,["states","data","style","children"]))&&(!!h(o,u)&&(!!h(n,s)&&(!!d(r,l)&&!!d(i,c))))}function YU(t){const{id:e=Ih(t),style:n,data:r}=t,i=ze(t,["id","style","data"]),o=Object.assign(Object.assign({},t),{style:Object.assign({},n),data:Object.assign({},r)});return function(t){return"source"in t&&"target"in t}(t)?Object.assign({id:e,data:o},i):{id:e,data:o}}function qU(t){return t.data}class XU{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new pv}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Au.NodeUpdated||e===Au.EdgeUpdated||e===Au.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:UU(n),original:UU(r),type:e})}else this.changes.push({value:UU(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}isBatching(){return this.batchCount>0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce((e,n)=>{const r=qU(n);return this.isCombo(Ih(r))||(void 0===t||t.includes(Ih(r)))&&e.push(r),e},[])}getEdgeDatum(t){return qU(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const r=qU(n);return(void 0===t||t.includes(Ih(r)))&&e.push(r),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const r=qU(n);return this.isCombo(Ih(r))?((void 0===t||t.includes(Ih(r)))&&e.push(r),e):e},[])}getRootsData(t=zu){return this.model.getRoots(t).map(qU)}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(qU):[]}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Vd(e,t=>{t!==e&&n.push(t)},t=>this.getChildrenData(Ih(t)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e)return void $u("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?qU(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?zu:Fu,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(qU):[]}getElementsDataByType(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementDataById(t){return"edge"===this.getElementType(t)?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){return qU(this.model.getNode(t))}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const r=qU(n);return t?t.includes(Ih(r))&&e.push(r):e.push(r),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(t=>{var n;return null===(n=t.states)||void 0===n?void 0:n.includes(e)})}getElementState(t){var e;return(null===(e=this.getElementDataById(t))||void 0===e?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(qU)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(qU)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i,edges:o,combos:a}=this.getData(),s=Yh(i,e,t=>Ih(t),$U),l=Yh(o,n,t=>Ih(t),$U),c=Yh(a,r,t=>Ih(t),$U);this.batch(()=>{const t={nodes:s.enter,edges:l.enter,combos:c.enter};this.addData(t),this.computeZIndex(t,"add",!0);const e={nodes:s.update,edges:l.update,combos:c.update};this.updateData(e),this.computeZIndex(e,"update",!0);const n={nodes:s.exit.map(Ih),edges:l.exit.map(Ih),combos:c.exit.map(Ih)};this.removeData(n)})}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch(()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(t=>(this.pushChange({value:t,type:Au.NodeAdded}),YU(t)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(t=>(this.pushChange({value:t,type:Au.EdgeAdded}),YU(t)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(Fu)||e.attachTreeStructure(Fu),e.addNodes(t.map(t=>(this.comboIds.add(Ih(t)),this.pushChange({value:t,type:Au.ComboAdded}),YU(t)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),r=e.map(Ih);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...r]}]),this.addEdgeData(r.map(e=>({source:t,target:e})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:n=[],edges:r=[],combos:i=[]}=t;i.forEach(t=>{var n,r,i;const o=Ih(t);if("add"===e&&ae(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t))return;const a=this.getParentData(o,Fu),s=a?(null!==(i=null===(r=a.style)||void 0===r?void 0:r.zIndex)&&void 0!==i?i:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:o,style:{zIndex:s}}])})}),n.forEach(t=>{var n,r,i;const o=Ih(t);if("add"===e&&ae(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t)&&!("children"in t))return;let a=0;const s=this.getParentData(o,Fu);if(s)a=((null===(r=s.style)||void 0===r?void 0:r.zIndex)||0)+1;else{const t=this.getParentData(o,zu);t&&(a=(null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:o,style:{zIndex:a}}])})}),r.forEach(t=>{var e,n,r,i,o;if(ae(null===(e=t.style)||void 0===e?void 0:e.zIndex))return;let{id:a,source:s,target:l}=t;if(a){const t=this.getEdgeDatum(a);s=t.source,l=t.target}else a=Ih(t);if(!s||!l)return;const c=(null===(r=null===(n=this.getNodeLikeDatum(s))||void 0===n?void 0:n.style)||void 0===r?void 0:r.zIndex)||0,u=(null===(o=null===(i=this.getNodeLikeDatum(l))||void 0===i?void 0:i.style)||void 0===o?void 0:o.zIndex)||0;this.updateEdgeData([{id:Ih(t),style:{zIndex:Math.max(c,u)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),r=this.getElementDataById(t),i=this.getData();if(Object.assign(i,{[`${n}s`]:i[`${n}s`].filter(e=>Ih(e)!==t)}),"combo"===n&&!Yd(r)){const e=new Set(this.getAncestorsData(t,Fu).map(Ih));i.nodes=i.nodes.filter(t=>!e.has(Ih(t))),i.combos=i.combos.filter(t=>!e.has(Ih(t))),i.edges=i.edges.filter(({source:t,target:n})=>!e.has(t)&&!e.has(n))}return Math.max((null===(e=r.style)||void 0===e?void 0:e.zIndex)||0,0,...Object.values(i).flat().map(t=>{var e;return((null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(t=>{const n=Ih(t),r=jh(t);void 0!==r&&(e.hasTreeStructure(Fu)||e.attachTreeStructure(Fu),null===r&&this.refreshComboData(n),this.setParent(n,jh(t),Fu));const i=t.children||[];if(i.length){e.hasTreeStructure(zu)||e.attachTreeStructure(zu);const t=i.filter(t=>e.hasNode(t));t.forEach(t=>this.setParent(t,n,zu)),t.length!==i.length&&this.updateNodeData([{id:n,children:t}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(t=>{const r=Ih(t),i=qU(e.getNode(r));if($U(i,t))return;const o=HU(i,t);this.pushChange({value:o,original:i,type:Au.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach(t=>{this.pushChange({value:t,original:t,type:Au.NodeUpdated})}),e.forEach(t=>{this.pushChange({value:t,original:t,type:Au.EdgeUpdated})}),n.forEach(t=>{this.pushChange({value:t,original:t,type:Au.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=Ih(t);if(!e.hasNode(n))return;const r=HU(qU(e.getNode(n)),t);e.mergeNodeData(n,r)}syncEdgeDatum(t){const{model:e}=this,n=Ih(t);if(!e.hasEdge(n))return;const r=HU(qU(e.getEdge(n)),t);e.mergeEdgeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(t=>{const n=Ih(t),r=qU(e.getEdge(n));if($U(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=HU(r,t);this.pushChange({value:i,original:r,type:Au.EdgeUpdated}),e.mergeEdgeData(n,i)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(t=>{const r=Ih(t),i=qU(e.getNode(r));if($U(i,t))return;const o=HU(i,t);this.pushChange({value:o,original:i,type:Au.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:t},"update")}setParent(t,e,n,r=!0){if(t===e)return;const i=jh(this.getNodeLikeDatum(t));if(i!==e&&n===Fu){const n={id:t,combo:e};this.isCombo(t),this.syncNodeLikeDatum(n)}this.model.setParent(t,e,n),r&&n===Fu&&function(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}([i,e]).forEach(t=>{void 0!==t&&this.refreshComboData(t)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,Fu);e&&this.pushChange({value:e,original:e,type:Au.ComboUpdated}),n.forEach(t=>{this.pushChange({value:t,original:t,type:Au.ComboUpdated})})}getElementPosition(t){return yd(this.getElementDataById(t))}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=td(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])})}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every(t=>0===t))return;const o=this.getComboData([t])[0];if(!o)return;const a=new Set;Vd(o,t=>{const e=Ih(t);if(a.has(e))return;a.add(e);const[o,s,l]=yd(t),c=HU(t,{style:{x:o+n,y:s+r,z:l+i}});this.pushChange({value:c,original:t,type:this.isCombo(e)?Au.ComboUpdated:Au.NodeUpdated}),this.model.mergeNodeData(e,c)},t=>this.getChildrenData(Ih(t)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[r=0,i=0,o=0]=e,a=null===(n=this.getComboData([t]))||void 0===n?void 0:n[0];if(!a)return;const[s,l,c]=yd(a),u=r-s,h=i-l,d=o-c;Vd(a,t=>{const e=Ih(t),[n,r,i]=yd(t),o=HU(t,{style:{x:n+u,y:r+h,z:i+d}});this.pushChange({value:o,original:t,type:this.isCombo(e)?Au.ComboUpdated:Au.NodeUpdated}),this.model.mergeNodeData(e,o)},t=>this.getChildrenData(Ih(t)),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(Ih)),this.pushChange({value:this.getNodeData([t])[0],type:Au.NodeRemoved}),this.removeNodeLikeHierarchy(t)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(t=>this.pushChange({value:this.getEdgeData([t])[0],type:Au.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(t=>{this.pushChange({value:this.getComboData([t])[0],type:Au.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(Fu)){const e=jh(this.getNodeLikeDatum(t));this.setParent(t,void 0,Fu,!1),this.model.getChildren(t,Fu).forEach(t=>{const n=qU(t),r=Ih(n);this.setParent(Ih(n),e,Fu,!1);const i=HU(n,{id:Ih(n),combo:e});this.pushChange({value:i,original:n,type:this.isCombo(r)?Au.ComboUpdated:Au.NodeUpdated}),this.model.mergeNodeData(Ih(n),i)}),$t(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(Uu(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map(t=>t.id)),t.removeNodes(e.map(t=>t.id)),this.context={}}}class KU{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new ec({className:"elements"}))}}emit(t,e){e.silence||IU(this.context.graph,t)}forEachElementData(t){Gd.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:r,graph:i}=this.context,o=(null===(n=r[t])||void 0===n?void 0:n.type)||e.type;return o?"string"==typeof o?o:o.call(i,e):"edge"===t?"line":"circle"}getTheme(t){return Yu(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map(t=>n[t]||{}))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData((e,n)=>{var r,i;const o=Object.assign({},nf(null===(r=this.getTheme(e))||void 0===r?void 0:r.palette),nf(null===(i=t[e])||void 0===i?void 0:i.palette));(null==o?void 0:o.field)&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,a=t=>{const e="string"==typeof r?Wu("palette",r):r;if("function"==typeof e){const n={};return t.forEach(([t,r])=>{n[t]=e(o?1-r:r)}),n}if(Array.isArray(e)){const n=o?[...e].reverse():e,r={};return t.forEach(([t,i])=>{r[t]=n[i%e.length]}),r}return{}},s=(t,e)=>{var n;return"string"==typeof t?null===(n=e.data)||void 0===n?void 0:n[t]:null==t?void 0:t(e)};if("group"===n){const e=ie(t,t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"}),n=a(Object.keys(e).map((t,e)=>[t,e])),r={};return Object.entries(e).forEach(([t,e])=>{e.forEach(e=>{r[Ih(e)]=n[t]})}),r}if("value"===n){const[e,n]=t.reduce(([t,e],n)=>{const r=s(i,n);if("number"!=typeof r)throw new Error(Uu(`Palette field ${i} is not a number`));return[Math.min(t,r),Math.max(e,r)]},[1/0,-1/0]),r=n-e;return a(t.map(t=>[t.id,(s(i,t)-e)/r]))}}(n,o))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?"edge"===t?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:r}=this.context,i=(null===(n=r[t])||void 0===n?void 0:n.style)||{};"transform"in i&&Array.isArray(i.transform)&&(i.transform=[...i.transform]),this.defaultStyle[Ih(e.datum)]=tf(i,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];(void 0===t||t.includes(Ih(i)))&&this.computeElementDefaultStyle(n,{datum:i,graph:e})}})}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch(t){return[]}}getElementStateStyle(t,e,n){var r,i;const{options:o}=this.context;return tf((null===(i=null===(r=o[t])||void 0===r?void 0:r.state)||void 0===i?void 0:i[e])||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[Ih(n.datum)]=Object.assign({},...e.map(e=>this.getElementStateStyle(t,e,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];if(void 0===t||t.includes(Ih(i))){const t=this.getElementState(Ih(i));this.computeElementStatesStyle(n,t,{datum:i,graph:e})}}})}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getNodes(){return this.context.model.getNodeData().map(({id:t})=>this.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[Ih(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=Ih(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(t,n),o=e.style||{},a=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),l=this.getStateStyle(n),c=Object.assign({},r,i,o,a,s,l);if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!c.collapsed?[]:t.map(Ih).filter(t=>this.getElement(t));Object.assign(c,{childrenNode:e,childrenData:t})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:r=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(r),{type:n,stage:r,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:r,remove:i}}}=e;return this.destroyElements(i,t),this.createElements(n,t),this.updateElements(r,t),this.setAnimationTask(t,e)}preLayoutDraw(){return Ge(this,arguments,void 0,function*(t={animation:!0}){var e,n;const r=this.getDrawData(t);if(!r)return;const{data:{drawData:i}}=r;yield null===(n=null===(e=this.context.layout)||void 0===e?void 0:e.preLayout)||void 0===n?void 0:n.call(e,i);const{add:o,update:a,remove:s}=i;return this.destroyElements(s,t),this.createElements(o,t),this.updateElements(a,t),this.setAnimationTask(t,r)})}setAnimationTask(e,n){const{animation:r,silence:i}=e,{data:{dataChanges:o,drawData:a},stage:s,type:l}=n;return this.context.animation.animate(r,i?{}:{before:()=>this.emit(new RU(t.GraphEvent.BEFORE_DRAW,{dataChanges:o,animation:r,stage:s,render:"render"===l}),e),beforeAnimate:n=>this.emit(new DU(t.GraphEvent.BEFORE_ANIMATE,Pu.DRAW,n,a),e),afterAnimate:n=>this.emit(new DU(t.GraphEvent.AFTER_ANIMATE,Pu.DRAW,n,a),e),after:()=>this.emit(new RU(t.GraphEvent.AFTER_DRAW,{dataChanges:o,animation:r,stage:s,render:"render"===l,firstRender:!1===this.context.graph.rendered}),e)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),r=xF(n);if(0===r.length)return null;const{NodeAdded:i=[],NodeUpdated:o=[],NodeRemoved:a=[],EdgeAdded:s=[],EdgeUpdated:l=[],EdgeRemoved:c=[],ComboAdded:u=[],ComboUpdated:h=[],ComboRemoved:d=[]}=ie(r,t=>t.type),f=t=>new Map(t.map(t=>{const e=t.value;return[Ih(e),e]})),p={add:{nodes:f(i),edges:f(s),combos:f(u)},update:{nodes:f(o),edges:f(l),combos:f(h)},remove:{nodes:f(a),edges:f(c),combos:f(d)}},g=this.transformData(p,t);return e.clearChanges(),{dataChanges:n,drawData:g}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((t,n)=>n.beforeDraw(t,e),t)}createElement(e,n,r){var i;const o=Ih(n);if(this.getElement(o))return;const a=this.getElementType(e,n),s=this.getElementComputedStyle(e,n),l=Wu(e,a);if(!l)return $u(`The element ${a} of ${e} is not registered.`);this.emit(new LU(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n),r);const c=this.container.appendChild(new l({id:o,context:this.context,style:s}));this.shapeTypeMap[o]=a,this.elementMap[o]=c;const{stage:u="enter"}=r;null===(i=this.context.animation)||void 0===i||i.add({element:c,elementType:e,stage:u,originalStyle:Object.assign({},c.attributes),updatedStyle:s},{after:()=>{var i;this.emit(new LU(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n),r),null===(i=c.onCreate)||void 0===i||i.call(c)}})}createElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach(([t,n])=>{n.forEach(n=>this.createElement(t,n,e))})}getUpdateStageStyle(t,e,n){const{stage:r="update"}=n;if("translate"===r){if("node"===t||"combo"===t){const{style:{x:t=0,y:n=0,z:r=0}={}}=e;return{x:t,y:n,z:r}}return{}}return this.getElementComputedStyle(t,e)}updateElement(e,n,r){var i;const o=Ih(n),{stage:a="update"}=r,s=this.getElement(o);if(!s)return()=>null;this.emit(new LU(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n),r);const l=this.getElementType(e,n),c=this.getUpdateStageStyle(e,n,r);this.shapeTypeMap[o]!==l&&(s.destroy(),delete this.shapeTypeMap[o],delete this.elementMap[o],this.createElement(e,n,{animation:!1,silence:!0}));const u="visibility"!==a?a:"hidden"===c.visibility?"hide":"show";"hide"===u&&delete c.visibility,null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:u,originalStyle:Object.assign({},s.attributes),updatedStyle:c},{before:()=>{const t=this.elementMap[o];"collapse"!==a&&nv(t,c),"visibility"===a&&(function(t,e){return FU(e)in(Oe(t,BU)||{})}(t,"opacity")||function(t,e){const n=Array.isArray(e)?e:[e];Oe(t,BU)||Ce(t,BU,{}),n.forEach(e=>{Ce(Oe(t,BU),FU(e),t.attributes[e])})}(t,"opacity"),this.visibilityCache.set(t,"show"===u?"visible":"hidden"),"show"===u&&qh(t,"visible"))},after:()=>{var i;const s=this.elementMap[o];"collapse"===a&&nv(s,c),"hide"===u&&qh(s,this.visibilityCache.get(s)),this.emit(new LU(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n),r),null===(i=s.onUpdate)||void 0===i||i.call(s)}})}updateElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach(([t,n])=>{n.forEach(n=>this.updateElement(t,n,e))})}markDestroyElement(t){Object.values(t.remove).forEach(t=>{t.forEach(t=>{const e=Ih(t),n=this.getElement(e);n&&function(t){Ce(t,"__to_be_destroyed__",!0)}(n)})})}destroyElement(e,n,r){var i;const{stage:o="exit"}=r,a=Ih(n),s=this.elementMap[a];if(!s)return()=>null;this.emit(new LU(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n),r),null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:o,originalStyle:Object.assign({},s.attributes),updatedStyle:{}},{after:()=>{var i;this.clearElement(a),s.destroy(),null===(i=s.onDestroy)||void 0===i||i.call(s),this.emit(new LU(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n),r)}})}destroyElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["combo",i],["edge",r],["node",n]].forEach(([t,n])=>{n.forEach(n=>this.destroyElement(t,n,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,r;const i=null===(n=t.nodes)||void 0===n?void 0:n.find(t=>Ih(t)===e);if(i){const n=ed(yd(this.context.model.getNodeLikeDatum(e)),yd(i));null===(r=t.nodes)||void 0===r||r.forEach(t=>{var e,r,i;(null===(e=t.style)||void 0===e?void 0:e.x)&&(t.style.x+=n[0]),(null===(r=t.style)||void 0===r?void 0:r.y)&&(t.style.y+=n[1]),(null===(i=t.style)||void 0===i?void 0:i.z)&&(t.style.z+=n[2]||0)})}}collapseNode(e,n){return Ge(this,void 0,void 0,function*(){var r;const{animation:i}=n,{model:o}=this.context,a=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!a)return;const{drawData:s}=a,{add:l,remove:c,update:u}=s;this.markDestroyElement(s);const h={animation:i,stage:"collapse",data:s};this.destroyElements(c,h),this.createElements(l,h),this.updateElements(u,h),yield null===(r=this.context.animation.animate(i,{beforeAnimate:e=>this.emit(new DU(t.GraphEvent.BEFORE_ANIMATE,Pu.COLLAPSE,e,s),h),afterAnimate:e=>this.emit(new DU(t.GraphEvent.AFTER_ANIMATE,Pu.COLLAPSE,e,s),h)},{collapse:{target:e,descendants:Array.from(c.nodes).map(([,t])=>Ih(t)),position:yd(u.nodes.get(e))}}))||void 0===r?void 0:r.finished})}expandNode(e,n){return Ge(this,void 0,void 0,function*(){var r;const{model:i,layout:o}=this.context,{animation:a,align:s}=n,l=yd(i.getNodeData([e])[0]),c=this.computeChangesAndDrawData({stage:"expand",animation:a});if(this.createElements(c.drawData.add,{animation:!1,stage:"expand",target:e}),this.context.animation.clear(),this.computeStyle("expand"),!c)return;const{drawData:u}=c,{update:h,add:d}=u,f={animation:a,stage:"expand",data:u};d.edges.forEach(t=>h.edges.set(Ih(t),t)),d.nodes.forEach(t=>h.nodes.set(Ih(t),t)),this.updateElements(h,f),yield null===(r=this.context.animation.animate(a,{beforeAnimate:e=>this.emit(new DU(t.GraphEvent.BEFORE_ANIMATE,Pu.EXPAND,e,u),f),afterAnimate:e=>this.emit(new DU(t.GraphEvent.AFTER_ANIMATE,Pu.EXPAND,e,u),f)},{expand:{target:e,descendants:Array.from(d.nodes).map(([,t])=>Ih(t)),position:l}}))||void 0===r?void 0:r.finished})}collapseCombo(e,n){return Ge(this,void 0,void 0,function*(){var r;const{model:i,element:o}=this.context;if(i.getAncestorsData(e,Fu).some(t=>Yd(t)))return;const a=o.getElement(e),s=a.getComboPosition(Object.assign(Object.assign({},a.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:n});if(!l)return;const{dataChanges:c,drawData:u}=l;this.markDestroyElement(u);const{update:h,remove:d}=u,f={animation:n,stage:"collapse",data:u};this.destroyElements(d,f),this.updateElements(h,f);const p=t=>Array.from(t).map(([,t])=>Ih(t));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new RU(t.GraphEvent.BEFORE_DRAW,{dataChanges:c,animation:n}),f),beforeAnimate:e=>this.emit(new DU(t.GraphEvent.BEFORE_ANIMATE,Pu.COLLAPSE,e,u),f),afterAnimate:e=>this.emit(new DU(t.GraphEvent.AFTER_ANIMATE,Pu.COLLAPSE,e,u),f),after:()=>this.emit(new RU(t.GraphEvent.AFTER_DRAW,{dataChanges:c,animation:n}),f)},{collapse:{target:e,descendants:[...p(d.nodes),...p(d.combos)],position:s}}))||void 0===r?void 0:r.finished})}expandCombo(e,n){return Ge(this,void 0,void 0,function*(){var r;const{model:i}=this.context,o=yd(i.getComboData([e])[0]);this.computeStyle("expand");const a=this.computeChangesAndDrawData({stage:"expand",animation:n});if(!a)return;const{dataChanges:s,drawData:l}=a,{add:c,update:u}=l,h={animation:n,stage:"expand",data:l,target:e};this.createElements(c,h),this.updateElements(u,h);const d=t=>Array.from(t).map(([,t])=>Ih(t));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new RU(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:n}),h),beforeAnimate:e=>this.emit(new DU(t.GraphEvent.BEFORE_ANIMATE,Pu.EXPAND,e,l),h),afterAnimate:e=>this.emit(new DU(t.GraphEvent.AFTER_ANIMATE,Pu.EXPAND,e,l),h),after:()=>this.emit(new RU(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:n}),h)},{expand:{target:e,descendants:[...d(c.nodes),...d(c.combos)],position:o}}))||void 0===r?void 0:r.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={}}}class ZU{get presetOptions(){return{animation:!!Zu(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.instances=[],this.context=t}getLayoutInstance(){return this.instances}preLayout(e){return Ge(this,void 0,void 0,function*(){var n,r,i,o;const{graph:a,model:s}=this.context,{add:l}=e;IU(a,new RU(t.GraphEvent.BEFORE_LAYOUT,{type:"pre"}));const c=yield null===(n=this.context.layout)||void 0===n?void 0:n.simulate();null===(r=null==c?void 0:c.nodes)||void 0===r||r.forEach(t=>{const e=Ih(t),n=l.nodes.get(e);s.syncNodeLikeDatum(t),n&&Object.assign(n.style,t.style)}),null===(i=null==c?void 0:c.edges)||void 0===i||i.forEach(t=>{const e=Ih(t),n=l.edges.get(e);s.syncEdgeDatum(t),n&&Object.assign(n.style,t.style)}),null===(o=null==c?void 0:c.combos)||void 0===o||o.forEach(t=>{const e=Ih(t),n=l.combos.get(e);s.syncNodeLikeDatum(t),n&&Object.assign(n.style,t.style)}),IU(a,new RU(t.GraphEvent.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",e)})}postLayout(){return Ge(this,arguments,void 0,function*(e=this.options){if(!e)return;const n=Array.isArray(e)?e:[e],{graph:r}=this.context;IU(r,new RU(t.GraphEvent.BEFORE_LAYOUT,{type:"post"}));for(let e=0;e<n.length;e++){const i=n[e],o=this.getLayoutData(i),a=Object.assign(Object.assign({},this.presetOptions),i);IU(r,new RU(t.GraphEvent.BEFORE_STAGE_LAYOUT,{options:a,index:e}));const s=yield this.stepLayout(o,a,e);IU(r,new RU(t.GraphEvent.AFTER_STAGE_LAYOUT,{options:a,index:e})),i.animation||this.updateElementPosition(s,!1)}IU(r,new RU(t.GraphEvent.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(t,e){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(n=>n.afterLayout(t,e))}simulate(){return Ge(this,void 0,void 0,function*(){if(!this.options)return{};const t=Array.isArray(this.options)?this.options:[this.options];let e={};for(let n=0;n<t.length;n++){const r=t[n],i=this.getLayoutData(r);e=yield this.stepLayout(i,Object.assign(Object.assign(Object.assign({},this.presetOptions),r),{animation:!1}),n)}return e})}stepLayout(t,e,n){return Ge(this,void 0,void 0,function*(){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const{animation:r,enableWorker:i,iterations:o=300}=e,a=this.initGraphLayout(e);if(!a)return{};if(this.instances[n]=a,this.instance=a,i){const e=a;return this.supervisor=new uB(e.graphData2LayoutModel(t),e.instance,{iterations:o}),vv(yield this.supervisor.execute())}if(xE(a))return r?yield a.execute(t,{onTick:t=>{this.updateElementPosition(t,!1)}}):(a.execute(t),a.stop(),a.tick(o));const s=yield a.execute(t);if(r){const t=this.updateElementPosition(s,r);yield null==t?void 0:t.finished}return s})}treeLayout(t,e,n){return Ge(this,void 0,void 0,function*(){const{type:n,animation:r}=e,i=Wu("layout",n);if(!i)return{};const{nodes:o=[],edges:a=[]}=t,s=new pv({nodes:o.map(t=>({id:Ih(t),data:t.data||{}})),edges:a.map(t=>({id:Ih(t),source:t.source,target:t.target,data:t.data||{}}))});!function(t){if(t.hasTreeStructure(zu))return;t.attachTreeStructure(zu);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,zu)}}(s);const l={nodes:[],edges:[]},c={nodes:[],edges:[]};s.getRoots(zu).forEach(t=>{Vd(t,t=>{t.children=s.getSuccessors(t.id)},t=>s.getSuccessors(t.id),"TB");const n=i(t,e),{x:r,y:o,z:a=0}=n;Vd(n,t=>{const{id:e,x:n,y:i,z:s=0}=t;l.nodes.push({id:e,style:{x:r,y:o,z:a}}),c.nodes.push({id:e,style:{x:n,y:i,z:s}})},t=>t.children,"TB")});const u=this.inferTreeLayoutOffset(c);if(QU(c,u),r){QU(l,u),this.updateElementPosition(l,!1);const t=this.updateElementPosition(c,r);yield null==t?void 0:t.finished}return c})}inferTreeLayoutOffset(t){var e;let[n,r]=[1/0,-1/0],[i,o]=[1/0,-1/0];null===(e=t.nodes)||void 0===e||e.forEach(t=>{const{x:e=0,y:a=0}=t.style||{};n=Math.min(n,e),r=Math.max(r,e),i=Math.min(i,a),o=Math.max(o,a)});const{canvas:a}=this.context,s=a.getSize(),[l,c]=a.getCanvasByViewport([0,0]),[u,h]=a.getCanvasByViewport(s);if(n>=l&&r<=u&&i>=c&&o<=h)return[0,0];return[(l+u)/2-(n+r)/2,(c+h)/2-(i+o)/2]}stopLayout(){this.instance&&xE(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(t){const{nodeFilter:e=()=>!0,comboFilter:n=()=>!0,preLayout:r=!1,isLayoutInvisibleNodes:i=!1}=t,{nodes:o,edges:a,combos:s}=this.context.model.getData(),{element:l,model:c}=this.context,u=t=>l.getElement(t),h=r?t=>{var n;if(!i){if("hidden"===(null===(n=t.style)||void 0===n?void 0:n.visibility))return!1;if(c.getAncestorsData(t.id,zu).some(Yd))return!1;if(c.getAncestorsData(t.id,Fu).some(Yd))return!1}return e(t)}:t=>{const n=Ih(t),r=u(n);return!!r&&(!rv(r)&&e(t))},d=o.filter(h),f=s.filter(n),p=new Map(d.map(t=>[Ih(t),t]));f.forEach(t=>p.set(Ih(t),t));return{nodes:d,edges:a.filter(({source:t,target:e})=>p.has(t)&&p.has(e)),combos:f}}initGraphLayout(t){var e;const{element:n,viewport:r}=this.context,{type:i,enableWorker:o,animation:a,iterations:s}=t,l=ze(t,["type","enableWorker","animation","iterations"]),[c,u]=r.getCanvasSize(),h=[c/2,u/2],d=null!==(e=null==t?void 0:t.nodeSize)&&void 0!==e?e:t=>{const e=null==n?void 0:n.getElement(t.id);return e?e.attributes.size:null==n?void 0:n.getElementComputedStyle("node",t).size},f=Wu("layout",i);if(!f)return $u(`The layout of ${i} is not registered.`);const p=Object.getPrototypeOf(f.prototype)===gv.prototype?f:function(t,e){return class extends gv{constructor(e,n){if(super(e,n),this.instance=new t({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const t=this.instance;this.stop=t.stop.bind(t),this.tick=e=>vv(t.tick(e))}}execute(t,e){return Ge(this,void 0,void 0,function*(){return vv(yield this.instance.execute(this.graphData2LayoutModel(t),this.transformOptions(Me({},this.options,e))))})}transformOptions(t){if(!("onTick"in t))return t;const e=t.onTick;return t.onTick=t=>e(vv(t)),t}graphData2LayoutModel(t){const{nodes:n=[],edges:r=[],combos:i=[]}=t,o=n.map(t=>{const e=Ih(t),{data:n,style:r,combo:i}=t,o=ze(t,["data","style","combo"]),a={id:e,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),{data:n}),i?{parentId:i}:{}),{style:r}),o)};return(null==r?void 0:r.x)&&Object.assign(a.data,{x:r.x}),(null==r?void 0:r.y)&&Object.assign(a.data,{y:r.y}),(null==r?void 0:r.z)&&Object.assign(a.data,{z:r.z}),a}),a=new Map(o.map(t=>[t.id,t])),s=r.filter(t=>{const{source:e,target:n}=t;return a.has(e)&&a.has(n)}).map(t=>{const{source:e,target:n,data:r,style:i}=t;return{id:Ih(t),source:e,target:n,data:Object.assign({},r),style:Object.assign({},i)}}),l=i.map(t=>({id:Ih(t),data:Object.assign({_isCombo:!0},t.data),style:Object.assign({},t.style)})),c=new pv({nodes:[...o,...l],edges:s});return e.model.model.hasTreeStructure(Fu)&&(c.attachTreeStructure(Fu),o.forEach(t=>{const n=e.model.model.getParent(t.id,Fu);n&&c.hasNode(n.id)&&c.setParent(t.id,n.id,Fu)})),c}}}(f,this.context),g=new p(this.context),v={nodeSize:d,width:c,height:u,center:h};switch(g.id){case"d3-force":case"d3-force-3d":Object.assign(v,{center:{x:c/2,y:u/2,z:0}})}return Me(g.options,v,l),g}updateElementPosition(t,e){const{model:n,element:r}=this.context;return r?(n.updateData(t),r.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},null===(t=this.supervisor)||void 0===t||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const QU=(t,e)=>{var n;const[r,i]=e;null===(n=t.nodes)||void 0===n||n.forEach(t=>{if(t.style){const{x:e=0,y:n=0}=t.style;t.style.x=e+r,t.style.y=n+i}else t.style={x:r,y:i}})};function JU(t){return t.layout?(Array.isArray(t.layout)||"preLayout"in t.layout||["antv-dagre","combo-combined","compact-box","circular","concentric","dagre","fishbone","grid","indented","mds","radial","random","snake","dendrogram","mindmap"].includes(t.layout.type)&&(t.layout.preLayout=!0),t):t}class t$ extends Xh{constructor(t){super(t),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){const e=this.extensionMap[t];if(e)return e;$u(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find(e=>e.type===t);return n?this.extensionMap[n.key]:void 0}}const e$=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class n$ extends Xh{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...e$.slice(0,e$.length-1),...t,e$[e$.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}class r${get padding(){return ch(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,a]=[(r-e)/2,(t-n)/2,0];return[i,o,a]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:a=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,a],rotate:i},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const r=Object.entries(t.getLayers()).filter(([t])=>!["main"].includes(t)),i=r.map(([,t])=>t.getCamera()),o=e[n];if("function"==typeof o)return(...t)=>{const r=o.apply(e,t);return i.forEach(e=>{e[n].apply(e,t)}),r}}})}createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=Zu(this.context.options,t);return!!e&&Pe(Object.assign({},e),["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),a=e.getFocalPoint(),[s,l]=this.getCanvasCenter(),[c=0,u=0,h=0]=r,d=rd([-c,-u,-h],i);return"relative"===n?{position:td(o,d),focalPoint:td(a,d)}:{position:td([s,l,o[2]],d),focalPoint:td([s,l,a[2]],d)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return oe("relative"===r?n*i:i,...e)}transform(e,n){return Ge(this,void 0,void 0,function*(){const{graph:r}=this.context,{translate:i,rotate:o,scale:a,origin:s}=e;this.cancelAnimation();const l=this.getAnimation(n);if(IU(r,new _U(t.GraphEvent.BEFORE_TRANSFORM,e)),!o&&a&&!i&&s&&!l)return this.camera.setZoomByViewportPoint(this.getZoomOptions(e),s),void IU(r,new _U(t.GraphEvent.AFTER_TRANSFORM,e));const c={};if(i&&Object.assign(c,this.getTranslateOptions(e)),ae(o)&&Object.assign(c,this.getRotateOptions(e)),ae(a)&&Object.assign(c,{zoom:this.getZoomOptions(e)}),l)return IU(r,new DU(t.GraphEvent.BEFORE_ANIMATE,Pu.TRANSFORM,null,e)),new Promise(n=>{this.transformResolver=n,this.camera.gotoLandmark(this.createLandmark(c),Object.assign(Object.assign({},l),{onfinish:()=>{IU(r,new DU(t.GraphEvent.AFTER_ANIMATE,Pu.TRANSFORM,null,e)),IU(r,new _U(t.GraphEvent.AFTER_TRANSFORM,e)),this.transformResolver=void 0,n()}}))});this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),IU(r,new _U(t.GraphEvent.AFTER_TRANSFORM,e))})}fitView(t,e){return Ge(this,void 0,void 0,function*(){const[n,r,i,o]=this.padding,{when:a="always",direction:s="both"}=t||{},[l,c]=this.context.canvas.getSize(),u=l-o-r,h=c-n-i,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[p,g]=fh(f);if("overflow"===a&&!("x"===s&&p>=u||"y"===s&&g>=h||"both"===s&&p>=u&&g>=h))return yield this.fitCenter({animation:e});const v=u/p,m=h/g,y="x"===s?v:"y"===s?m:Math.min(v,m),b=this.getAnimation(e);Number.isFinite(y)&&(yield this.transform({mode:"relative",scale:y,translate:td(ed(this.getCanvasCenter(),this.getBBoxInViewport(d).center),rd(this.paddingOffset,y))},b))})}fitCenter(t){return Ge(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return Ge(this,arguments,void 0,function*(t,e={}){const{element:n}=this.context;if(!n)return;const r=mh(t.map(t=>{return r=n.getElement(t),e.shapes?r.getShape(e.shapes).getRenderBounds():r.getRenderBounds();var r}));yield this.focus(r,e)})}focus(t,e){return Ge(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),r=ed(e.position||this.getCanvasCenter(),n);yield this.transform({mode:"relative",translate:td(r,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[a,s]=r.getViewportByCanvas(n),l=new Mr;return l.setMinMax([i,o,0],[a,s,0]),l}isInViewport(t,e=!1,n=0){const{graph:r}=this.context,i=this.getCanvasSize(),[o,a]=r.getCanvasByViewport([0,0]),[s,l]=r.getCanvasByViewport(i);let c=new Mr;return c.setMinMax([o,a,0],[s,l,0]),n&&(c=vh(c,n)),sh(t)?yh(t,c):e?function(t,e){const[n,r]=t.min,[i,o]=t.max,[a,s]=e.min,[l,c]=e.max;return n>=a&&i<=l&&r>=s&&o<=c}(t,c):c.intersects(t)}cancelAnimation(){var t,e;(null===(t=this.camera.landmarks)||void 0===t?void 0:t.length)&&this.camera.cancelLandmarkAnimation(),null===(e=this.transformResolver)||void 0===e||e.call(this)}}class i$ extends cv{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new XU},this.isCollapsingExpanding=!1,this.onResize=be(()=>{this.resize()},300),this._setOptions(Object.assign({},i$.defaultOptions,t),!0),this.context.graph=this,this.options.autoResize&&(null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),Object.assign(this.options,function(t){return[JU].reduce((t,e)=>e(t),t)}(t)),e){const{data:e}=t;return void(e&&this.addData(e))}const{behaviors:n,combo:r,data:i,edge:o,layout:a,node:s,plugins:l,theme:c,transforms:u}=t;n&&this.setBehaviors(n),i&&this.setData(i),s&&this.setNode(s),o&&this.setEdge(o),r&&this.setCombo(r),a&&this.setLayout(a),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(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Ut(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Ut(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Ut(t)?t(this.getBehaviors()):t,null===(e=this.context.behavior)||void 0===e||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Ut(t)?t(this.getPlugins()):t,null===(e=this.context.plugin)||void 0===e||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Ut(t)?t(this.getTransforms()):t,null===(e=this.context.transform)||void 0===e||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}hasNode(t){return this.context.model.hasNode(t)}hasEdge(t){return this.context.model.hasEdge(t)}hasCombo(t){return this.context.model.hasCombo(t)}getElementData(t){return Array.isArray(t)?t.map(t=>this.context.model.getElementDataById(t)):this.context.model.getElementDataById(t)}getNodeData(t){return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):this.context.model.getNodeLikeDatum(t)}getEdgeData(t){return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):this.context.model.getEdgeDatum(t)}getComboData(t){return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):this.context.model.getNodeLikeDatum(t)}setData(t){this.context.model.setData(Ut(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Ut(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Ut(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Ut(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Ut(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Ut(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Ut(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Ut(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Ut(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Ut(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Ut(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Ut(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Ut(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return Ge(this,void 0,void 0,function*(){var e;if(this.context.canvas)return yield this.context.canvas.ready;const{container:n="container",width:r,height:i,renderer:o,cursor:a,background:s,canvas:l,devicePixelRatio:c=(null!==(e=globalThis.devicePixelRatio)&&void 0!==e?e:1)}=this.options;if(n instanceof NU)this.context.canvas=n,a&&n.setCursor(a),o&&n.setRenderer(o),yield n.ready;else{const e=ne(n)?document.getElementById(n):n,u=AU(e);this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:e,width:r,height:i});const h=Object.assign(Object.assign({},l),{container:e,width:r||u[0],height:i||u[1],background:s,renderer:o,cursor:a,devicePixelRatio:c}),d=new NU(h);this.context.canvas=d,yield d.ready,this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:d})}})}updateCanvas(e){var n,r;const{renderer:i,cursor:o,height:a,width:s}=e,l=this.context.canvas;l&&(i&&(this.emit(t.GraphEvent.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(t.GraphEvent.AFTER_RENDERER_CHANGE,{renderer:i})),o&&l.setCursor(o),(ae(s)||ae(a))&&this.setSize(null!==(n=null!=s?s:this.options.width)&&void 0!==n?n:0,null!==(r=null!=a?a:this.options.height)&&void 0!==r?r:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new VU(this.context)),this.context.plugin||(this.context.plugin=new t$(this.context)),this.context.viewport||(this.context.viewport=new r$(this.context)),this.context.transform||(this.context.transform=new n$(this.context)),this.context.element||(this.context.element=new KU(this.context)),this.context.animation||(this.context.animation=new GU(this.context)),this.context.layout||(this.context.layout=new ZU(this.context)),this.context.behavior||(this.context.behavior=new WU(this.context))}prepare(){return Ge(this,void 0,void 0,function*(){yield Promise.resolve(),this.destroyed?console.error(Uu("The graph instance has been destroyed")):(yield this.initCanvas(),this.initRuntime())})}render(){return Ge(this,void 0,void 0,function*(){if(yield this.prepare(),IU(this,new RU(t.GraphEvent.BEFORE_RENDER)),this.options.layout)if(this.rendered||(e=this.options.layout,Array.isArray(e)||!(null==e?void 0:e.preLayout))){const t=this.context.element.draw({type:"render"});yield Promise.all([null==t?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([null==t?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([null==t?void 0:t.finished,this.autoFit()])}var e;this.rendered=!0,IU(this,new RU(t.GraphEvent.AFTER_RENDER))})}draw(){return Ge(this,void 0,void 0,function*(){var t;yield this.prepare(),yield null===(t=this.context.element.draw())||void 0===t?void 0:t.finished})}layout(t){return Ge(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return Ge(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),null==e||e.clear()})}destroy(){var e;IU(this,new RU(t.GraphEvent.BEFORE_DESTROY));const{layout:n,animation:r,element:i,model:o,canvas:a,behavior:s,plugin:l}=this.context;null==l||l.destroy(),null==s||s.destroy(),null==n||n.destroy(),null==r||r.destroy(),null==i||i.destroy(),o.destroy(),null==a||a.destroy(),this.options={},this.context={},this.off(),null===(e=globalThis.removeEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize),this.destroyed=!0,IU(this,new RU(t.GraphEvent.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,n){var r;const i=AU(null===(r=this.context.canvas)||void 0===r?void 0:r.getContainer()),o=[e||i[0],n||i[1]];if(!this.context.canvas)return;const a=this.context.canvas.getSize();Te(o,a)||(IU(this,new RU(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:o})),this.context.canvas.resize(...o),IU(this,new RU(t.GraphEvent.AFTER_SIZE_CHANGE,{size:o})))}fitView(t,e){return Ge(this,void 0,void 0,function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.fitView(t,e)})}fitCenter(t){return Ge(this,void 0,void 0,function*(){var e;yield null===(e=this.context.viewport)||void 0===e?void 0:e.fitCenter({animation:t})})}autoFit(){return Ge(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(ne(t))"view"===t?yield this.fitView():"center"===t&&(yield this.fitCenter());else{const{type:e,animation:n}=t;"view"===e?yield this.fitView(t.options,n):"center"===e&&(yield this.fitCenter(n))}})}focusElement(t,e){return Ge(this,void 0,void 0,function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return Ge(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return Ge(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return Ge(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return Ge(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return Ge(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return Ge(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return ed([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return Ge(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach(([t,e])=>this.context.model.translateNodeLikeBy(t,e)),yield null===(i=this.context.element.draw({animation:a,stage:"translate"}))||void 0===i?void 0:i.finished})}translateElementTo(t,e){return Ge(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach(([t,e])=>this.context.model.translateNodeLikeTo(t,e)),yield null===(i=this.context.element.draw({animation:a,stage:"translate"}))||void 0===i?void 0:i.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Re(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return Ge(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach(([t,e])=>{const n=this.getElementType(t);s[`${n}s`].push({id:t,style:{visibility:e}})});const{model:l,element:c}=this.context;l.preventUpdateNodeLikeHierarchy(()=>{l.updateData(s)}),yield null===(i=c.draw({animation:a,stage:"visibility"}))||void 0===i?void 0:i.finished})}showElement(t,e){return Ge(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(t=>[t,"visible"])),e)})}hideElement(t,e){return Ge(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(t=>[t,"hidden"])),e)})}getElementVisibility(t){var e,n;const r=this.context.element.getElement(t);return null!==(n=null===(e=null==r?void 0:r.style)||void 0===e?void 0:e.visibility)&&void 0!==n?n:"visible"}setElementZIndex(t,e){return Ge(this,void 0,void 0,function*(){var n;const r={nodes:[],edges:[],combos:[]},i=qt(t)?t:{[t]:e};Object.entries(i).forEach(([t,e])=>{const n=this.getElementType(t);r[`${n}s`].push({id:t,style:{zIndex:e}})});const{model:o,element:a}=this.context;o.preventUpdateNodeLikeHierarchy(()=>o.updateData(r)),yield null===(n=a.draw({animation:!1,stage:"zIndex"}))||void 0===n?void 0:n.finished})}frontElement(t){return Ge(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,r={};e.map(t=>{const e=n.getFrontZIndex(t);if("combo"===n.getElementType(t)){const i=n.getAncestorsData(t,Fu).at(-1)||this.getComboData(t),o=[i,...n.getDescendantsData(Ih(i))],a=e-jU(i);o.forEach(t=>{r[Ih(t)]=this.getElementZIndex(Ih(t))+a});const{internal:s}=xg(o.map(Ih),t=>n.getRelatedEdgesData(t));s.forEach(t=>{const e=Ih(t);r[e]=this.getElementZIndex(e)+a})}else r[t]=e}),yield this.setElementZIndex(r)})}getElementZIndex(t){return jU(this.context.model.getElementDataById(t))}setElementState(t,e){return Ge(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,a]=qt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach(([t,e])=>{const n=this.getElementType(t);var r;s[`${n}s`].push({id:t,states:(r=e,r?Array.isArray(r)?r:[r]:[])})}),this.updateData(s),yield null===(i=this.context.element.draw({animation:a,stage:"state"}))||void 0===i?void 0:i.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return Ge(this,arguments,void 0,function*(t,e=!0){const{model:n,element:r}=this.context;if(Yd(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!0});const i=n.getElementType(t);yield this.frontElement(t),this.isCollapsingExpanding=!0,n.updateData("node"===i?{nodes:[{id:t,style:{collapsed:!0}}]}:{combos:[{id:t,style:{collapsed:!0}}]}),"node"===i?yield r.collapseNode(t,e):"combo"===i&&(yield r.collapseCombo(t,!!e.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return Ge(this,arguments,void 0,function*(t,e=!0){const{model:n,element:r}=this.context;if(!Yd(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!0});const i=n.getElementType(t);this.isCollapsingExpanding=!0,n.updateData("node"===i?{nodes:[{id:t,style:{collapsed:!1}}]}:{combos:[{id:t,style:{collapsed:!1}}]}),"node"===i?yield r.expandNode(t,e):"combo"===i&&(yield r.expandCombo(t,!!e.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return Ge(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}i$.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};const o$=(t,e)=>{const{source:n,target:r}=e,i=t.getElementDataById(n),o=t.getElementDataById(r),a=Eg(i,e=>t.getParentData(e,Fu)),s=Eg(o,e=>t.getParentData(e,Fu)),l={sourceNode:Ih(a),targetNode:Ih(s)};return e.style?Object.assign(e.style,l):e.style=l,e};class a$ extends gU{constructor(t,e){super(t,Me({},a$.defaultOptions,e)),this.assignSizeByCentrality=(t,e,n,r,i,o)=>{const a=[e,n],s=[r[0],i[0]],l=[r[1],i[1]],c=[r[2],i[2]],u=(t,e)=>{if("function"==typeof o)return o(t,a,e);switch(o){case"linear":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return i===r?o:o+(t-r)/(i-r)*(a-o)})(t,a,e);case"log":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return o+Math.log(t-r+1)/Math.log(i-r+1)*(a-o)})(t,a,e);case"pow":return((t,e,n,r=2)=>{const[i,o]=e,[a,s]=n;return a+Math.pow((t-i)/(o-i),r)*(s-a)})(t,a,e,2);case"sqrt":return((t,e,n)=>{const[r,i]=e,[o,a]=n;return o+Math.sqrt((t-r)/(i-r))*(a-o)})(t,a,e);default:return e[0]}};return[u(t,s),u(t,l),u(t,c)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),r=Jd(this.options.maxSize),i=Jd(this.options.minSize),o=this.getCentralities(this.options.centrality),a=o.size>0?Math.max(...o.values()):0,s=o.size>0?Math.min(...o.values()):0;return n.forEach(e=>{var n;const l=this.assignSizeByCentrality(o.get(Ih(e))||0,s,a,i,r,this.options.scale),c=null===(n=this.context.element)||void 0===n?void 0:n.getElement(Ih(e)),u={size:l};this.assignLabelStyle(u,l,e,c),c&&mU(u,c.attributes)||vU(t,c?"update":"add","node",Me(e,{style:u}),!0)}),t}assignLabelStyle(t,e,n,r){var i;const o=r?r.config.style:null===(i=this.context.element)||void 0===i?void 0:i.getElementComputedStyle("node",n);if(Object.assign(t,Pe(o,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const n=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:n,labelLineHeight:n+uh(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const r=Math.min(...t)/2,[i,o]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(o,Math.max(r,i))}getCentralities(t){const{model:e}=this.context,n=e.getData();if("function"==typeof t)return t(n);const r=e.getRelatedEdgesData.bind(e);return Fh(n,r,t)}}a$.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class s$ extends gU{constructor(t,e){super(t,Object.assign({},s$.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=yd(this.ref),{graph:n,model:r}=this.context;null===(t=r.getData().nodes)||void 0===t||t.forEach(t=>{var i;if(Ih(t)===Ih(this.ref))return;const o=fd(ed(yd(t),e)),a=Math.abs(o)>Math.PI/2,s=!t.children||0===t.children.length,l=Ih(t),c=null===(i=this.context.element)||void 0===i?void 0:i.getElement(l);if(!c||!c.isVisible())return;const u=(s?1:-1)*(Jd(n.getElementRenderStyle(l).size)[0]/2+this.options.offset),h=[["translate",u*Math.cos(o),u*Math.sin(o)],["rotate",a?Br(o)+180:Br(o)]];r.updateNodeData([{id:Ih(t),style:{labelTextAlign:a===s?"right":"left",labelTextBaseline:"middle",labelTransform:h}}])}),n.draw()}}s$.defaultOptions={offset:5};const l$=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class c$ extends gU{constructor(t,e){super(t,Object.assign({},c$.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=t=>{const{add:{edges:e},update:{nodes:n,edges:r,combos:i},remove:{edges:o}}=t,{model:a}=this.context,s=new Map,l=(t,e)=>{a.getRelatedEdgesData(e).forEach(t=>!s.has(Ih(t))&&s.set(Ih(t),t))};n.forEach(l),i.forEach(l);const c=e=>{const n=new Set(t.remove.edges.keys()),r=a.getEdgeData().filter(t=>!n.has(Ih(t))).map(t=>o$(a,t));h$(e,r).forEach(t=>{const e=Ih(t);s.has(e)||s.set(e,t)})};if(o.size&&o.forEach(c),e.size&&e.forEach(c),r.size){const t=EF(xF(a.getChanges())).update.edges;r.forEach(e=>{var n;c(e);const r=null===(n=t.find(t=>Ih(t.value)===Ih(e)))||void 0===n?void 0:n.original;r&&!d$(e,r)&&c(r)})}Ne(this.options.edges)||s.forEach((t,e)=>!this.options.edges.includes(e)&&s.delete(e));const u=a.getEdgeData().map(Ih);return new Map([...s].sort((t,e)=>u.indexOf(t[0])-u.indexOf(e[0])))},this.applyBundlingStyle=(t,e,n)=>{const{edgeMap:r,reverses:i}=u$(e);r.forEach(e=>{e.forEach((e,r,o)=>{var a;const s=o.length,l=e.style||{};if(e.source===e.target){const t=l$.length;l.loopPlacement=l$[r%t],l.loopDist=Math.floor(r/t)*n+50}else if(1===s)l.curveOffset=0;else{const t=(r%2==0?1:-1)*(i[`${e.source}|${e.target}|${r}`]?-1:1);l.curveOffset=s%2==1?t*Math.ceil(r/2)*n*2:t*(Math.floor(r/2)*n*2+n)}const c=Object.assign(e,{type:"quadratic",style:l}),u=null===(a=this.context.element)||void 0===a?void 0:a.getElement(Ih(e));u&&mU(c.style,u.attributes)||vU(t,u?"update":"add","edge",c,!0)})})},this.resetEdgeStyle=t=>{const e=t.style||{},n=this.cacheMergeStyle.get(Ih(t))||{};return Object.keys(n).forEach(r=>{Te(e[r],n[r])&&(t[r]?e[r]=t[r]:delete e[r])}),Object.assign(t,{style:e})},this.applyMergingStyle=(t,e)=>{const{edgeMap:n,reverses:r}=u$(e);n.forEach(e=>{var n;if(1===e.length){const r=e[0],i=null===(n=this.context.element)||void 0===n?void 0:n.getElement(Ih(r)),o=this.resetEdgeStyle(r);return void(i&&mU(o,i.attributes)||vU(t,i?"update":"add","edge",o))}const i=e.map(({source:t,target:e,style:n={}},i)=>{const{startArrow:o,endArrow:a}=n,s={},[l,c]=r[`${t}|${e}|${i}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return pe(o)&&(s[l]=o),pe(a)&&(s[c]=a),s}).reduce((t,e)=>Object.assign(Object.assign({},t),e),{});e.forEach((e,n,r)=>{var o;if(0!==n)return void vU(t,"remove","edge",e);const a=Object.assign({},Ut(this.options.style)?this.options.style(r):this.options.style,{childrenData:r});this.cacheMergeStyle.set(Ih(e),a);const s=Object.assign(Object.assign({},e),{type:"line",style:Object.assign(Object.assign(Object.assign({},e.style),i),a)}),l=null===(o=this.context.element)||void 0===o?void 0:o.getElement(Ih(e));l&&mU(s.style,l.attributes)||vU(t,l?"update":"add","edge",s,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return 0===e.size||("bundle"===this.options.mode?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}c$.defaultOptions={mode:"bundle",distance:15};const u$=t=>{const e=new Map,n=new Set,r={},i=new Map;for(const[o,a]of t){if(n.has(o))continue;const{source:s,target:l}=a,c=`${s}-${l}`;e.has(c)||(e.set(c,[]),i.set(c,new Set));const u=e.get(c),h=i.get(c);u&&h&&!h.has(o)&&(u.push(a),h.add(o),n.add(o));for(const[u,h]of t)if(!n.has(u)&&u!==o&&d$(a,h)){const t=e.get(c),o=i.get(c);t&&o&&!o.has(u)&&(t.push(h),o.add(u),s===h.target&&l===h.source&&(r[`${h.source}|${h.target}|${t.length-1}`]=!0),n.add(u))}}return{edgeMap:e,reverses:r}},h$=(t,e,n)=>e.filter(e=>d$(e,t)),d$=(t,e)=>{const{sourceNode:n,targetNode:r}=t.style||{},{sourceNode:i,targetNode:o}=e.style||{};return n===i&&r===o||n===o&&r===i};const f$={animation:{"combo-collapse":oh,"combo-expand":ah,"node-collapse":eh,"node-expand":nh,"path-in":rh,"path-out":ih,fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}]},behavior:{"brush-select":Bd,"click-select":$d,"collapse-expand":iv,"create-edge":av,"drag-canvas":sv,"drag-element-force":bv,"drag-element":lv,"fix-element-size":xv,"focus-element":Ev,"hover-activate":wv,"lasso-select":kv,"auto-adapt-label":Qh,"optimize-viewport-transform":Mv,"scroll-canvas":Sv,"zoom-canvas":Nv},combo:{circle:Qp,rect:Jp},edge:{cubic:Sg,line:Cg,polyline:zg,quadratic:Gg,"cubic-horizontal":Ng,"cubic-radial":Tg,"cubic-vertical":Og},layout:{"antv-dagre":Bb,"combo-combined":kE,"compact-box":Lm.compactBox,"d3-force":hw,"force-atlas2":Ej,circular:Vb,concentric:$b,dagre:vj,dendrogram:Lm.dendrogram,fishbone:hB,force:gx,fruchterman:kj,grid:Sj,indented:Lm.indented,mds:mE,mindmap:Lm.mindmap,radial:Ij,random:Wj,snake:gB},node:{circle:Mf,diamond:Nf,ellipse:Af,hexagon:Pf,html:$p,image:Yp,rect:qp,star:Xp,donut:Tf,triangle:Kp},palette:{spectral:["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)"],tableau:["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)"],oranges:["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)"],greens:["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)"],blues:["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)"]},theme:{dark:fU,light:pU},plugin:{"bubble-sets":nF,"edge-bundling":aF,"edge-filter-lens":gF,"grid-line":bF,background:bB,contextmenu:oF,fisheye:mF,fullscreen:yF,history:MF,hull:iz,legend:jH,minimap:BH,snapline:VH,timebar:$H,title:nU,toolbar:iU,tooltip:oU,watermark:lU},transform:{"arrange-draw-order":class extends gU{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,r=t=>{const n=[];return t.forEach((t,r)=>{const i=e.getAncestorsData(r,"combo").map(t=>Ih(t)).reverse();n.push([r,t,i.length])}),new Map(n.sort(([,,t],[,,e])=>e-t).map(([t,e])=>[t,e]))};return t.add.combos=r(n),t.update.combos=r(t.update.combos),t}},"collapse-expand-combo":class extends gU{beforeDraw(t,e){if("visibility"===e.stage)return t;if(!this.context.model.model.hasTreeStructure(Fu))return t;const{model:n}=this.context,{add:r,update:i}=t,o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[e,a]=o.pop();if(Yd(a)){const a=n.getDescendantsData(e),s=a.map(Ih),{internal:l,external:c}=xg(s,t=>n.getRelatedEdgesData(t));a.forEach(e=>{const r=Ih(e),i=o.findIndex(([t])=>t===r);-1!==i&&o.splice(i,1);const a=n.getElementType(r);vU(t,"remove",a,e)}),l.forEach(e=>vU(t,"remove","edge",e)),c.forEach(t=>{var e;const n=Ih(t);(null===(e=this.context.element)||void 0===e?void 0:e.getElement(n))?i.edges.set(n,t):r.edges.set(n,t)})}else{const r=n.getChildrenData(e),i=r.map(Ih),{edges:a}=xg(i,t=>n.getRelatedEdgesData(t));[...r,...a].forEach(e=>{var r;const i=Ih(e),a=n.getElementType(i),s=null===(r=this.context.element)||void 0===r?void 0:r.getElement(i);vU(t,s?"update":"add",a,e),"combo"===a&&o.push([i,e])})}}return t}},"collapse-expand-node":class extends gU{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(yU(e,"add","node",t),Yd(t))return;const n=Ih(t);yU(e,"add","node",t);this.context.model.getRelatedEdgesData(n).forEach(t=>{vU(e,"add","edge",t)});this.context.model.getChildrenData(n).forEach(t=>{this.handleExpand(t,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(zu))return t;const{add:{nodes:r,edges:i},update:{nodes:o}}=t,a=new Map,s=new Map;r.forEach((t,e)=>{Yd(t)&&a.set(e,t)}),i.forEach(t=>{if("node"!==e.getElementType(t.source))return;const n=e.getNodeData(t.source);Yd(n)&&a.set(t.source,n)}),o.forEach((t,e)=>{const n=this.getElement(e);if(!n)return;const r=n.attributes.collapsed;Yd(t)?r||a.set(e,t):r&&s.set(e,t)});const l=new Set;return a.forEach((e,r)=>{n.getDescendantsData(r).forEach(e=>{const r=Ih(e);if(l.has(r))return;vU(t,"remove","node",e);n.getRelatedEdgesData(r).forEach(e=>{vU(t,"remove","edge",e)}),l.add(r)})}),s.forEach((e,r)=>{n.getAncestorsData(r,zu).some(Yd)?vU(t,"remove","node",e):this.handleExpand(e,t)}),t}},"get-edge-actual-ends":class extends gU{beforeDraw(t){const{add:e,update:n}=t,{model:r}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,t])=>{o$(r,t)}),t}},"map-node-size":a$,"place-radial-labels":s$,"process-parallel-edges":c$,"update-related-edges":class extends gU{beforeDraw(t,e){const{stage:n}=e;if("visibility"===n)return t;const{model:r}=this.context,{update:{nodes:i,edges:o,combos:a}}=t,s=(t,e)=>{r.getRelatedEdgesData(e).forEach(t=>!o.has(Ih(t))&&o.set(Ih(t),t))};return i.forEach(s),a.forEach(s),t}}},shape:{circle:Zl,ellipse:tc,group:ec,html:rc,image:vf,line:ac,path:lc,polygon:uc,polyline:dc,rect:fc,text:gc,label:uf,badge:hf}};Object.entries(f$).forEach(([t,e])=>{Object.entries(e).forEach(([e,n])=>{EU(t,e,n)})});t.AntVDagreLayout=Bb,t.AutoAdaptLabel=Qh,t.Background=bB,t.Badge=hf,t.BaseBehavior=Zh,t.BaseCombo=Zp,t.BaseEdge=Mg,t.BaseLayout=gv,t.BaseNode=kf,t.BasePlugin=vB,t.BaseShape=sf,t.BaseTransform=gU,t.BrushSelect=Bd,t.BubbleSets=nF,t.CameraSetting=class extends vB{constructor(t,e){super(t,e),this.setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach(([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}})},this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,()=>this.setOptions(this.options))}getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Canvas=NU,t.Circle=Mf,t.CircleCombo=Qp,t.CircularLayout=Vb,t.ClickSelect=$d,t.CollapseExpand=iv,t.ComboCombinedLayout=kE,t.CompactBoxLayout=Lm.compactBox,t.ConcentricLayout=$b,t.Contextmenu=oF,t.CreateEdge=av,t.Cubic=Sg,t.CubicHorizontal=Ng,t.CubicRadial=Tg,t.CubicVertical=Og,t.D3ForceLayout=hw,t.DagreLayout=vj,t.DendrogramLayout=Lm.dendrogram,t.Diamond=Nf,t.Donut=Tf,t.DragCanvas=sv,t.DragElement=lv,t.DragElementForce=bv,t.EdgeBundling=aF,t.EdgeFilterLens=gF,t.Ellipse=Af,t.FishboneLayout=hB,t.Fisheye=mF,t.FixElementSize=xv,t.FocusElement=Ev,t.ForceAtlas2Layout=Ej,t.ForceLayout=gx,t.FruchtermanLayout=kj,t.Fullscreen=yF,t.Graph=i$,t.GridLayout=Sj,t.GridLine=bF,t.HTML=$p,t.Hexagon=Pf,t.History=MF,t.HoverActivate=wv,t.Hull=iz,t.Icon=Ef,t.Image=Yp,t.IndentedLayout=Lm.indented,t.Label=uf,t.LassoSelect=kv,t.Legend=jH,t.Line=Cg,t.MDSLayout=mE,t.MapNodeSize=a$,t.MindmapLayout=Lm.mindmap,t.Minimap=BH,t.OptimizeViewportTransform=Mv,t.PlaceRadialLabels=s$,t.Polyline=zg,t.ProcessParallelEdges=c$,t.Quadratic=Gg,t.RadialLayout=Ij,t.RandomLayout=Wj,t.Rect=qp,t.RectCombo=Jp,t.ScrollCanvas=Sv,t.Shortcut=jd,t.SnakeLayout=gB,t.Snapline=VH,t.Star=Xp,t.Timebar=$H,t.Title=nU,t.Toolbar=iU,t.Tooltip=oU,t.Triangle=Kp,t.Watermark=lU,t.ZoomCanvas=Nv,t.effect=function(t,e,n){bU.has(t)||bU.set(t,{});const r=bU.get(t);if(!r[e])return r[e]=n,!0;const i=r[e];return!xU(i,n)&&(r[e]=n,!0)},t.getExtension=Wu,t.getExtensions=function(t){return Vu[t]},t.iconfont={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"},t.idOf=Ih,t.invokeLayoutMethod=mv,t.isCollapsed=Yd,t.omitStyleProps=Qd,t.parseSize=Jd,t.positionOf=yd,t.register=EU,t.setVisibility=qh,t.subStyleProps=Kd,t.treeToGraphData=function(t,e){const{getNodeData:n=(t,e)=>{if(t.depth=e,!t.children)return t;const{children:n}=t,r=ze(t,["children"]);return Object.assign(Object.assign({},r),{children:n.map(t=>t.id)})},getEdgeData:r=(t,e)=>({source:t.id,target:e.id}),getChildren:i=t=>t.children||[]}=e||{},o=[],a=[];return Vd(t,(t,e)=>{o.push(n(t,e));const s=i(t);for(const e of s)a.push(r(t,e))},t=>i(t),"TB"),{nodes:o,edges:a}},t.version=Hu});