(function(bi,Ka){typeof exports=="object"&&typeof module<"u"?Ka(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ka):(bi=typeof globalThis<"u"?globalThis:bi||self,Ka(bi.CwlComponentTest={},bi.Vue))})(this,function(bi,Ka){"use strict";function zD(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(r,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}const gp=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return Si},get Circle(){return Hj},get Ellipse(){return qj},get Image(){return Zj},get Line(){return Kj},get Marker(){return Jj},get Path(){return _0},get Polygon(){return oU},get Polyline(){return sU},get Rect(){return lU},get Text(){return cU}},Symbol.toStringTag,{value:"Module"})),yp=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return oi},get Circle(){return pU},get Dom(){return gU},get Ellipse(){return yU},get Image(){return mU},get Line(){return bU},get Marker(){return xU},get Path(){return wU},get Polygon(){return EU},get Polyline(){return _U},get Rect(){return MU},get Text(){return IU}},Symbol.toStringTag,{value:"Module"}));var mp=function(r,e){return mp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},mp(r,e)};function It(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");mp(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var B=function(){return B=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},B.apply(this,arguments)};function Jr(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Ib(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function kb(r,e){return function(t,n){e(t,n,r)}}function Lb(r,e,t,n,i,a){function o(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",f=!e&&r?n.static?r:r.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),c,h=!1,d=t.length-1;d>=0;d--){var v={};for(var p in n)v[p]=p==="access"?{}:n[p];for(var p in n.access)v.access[p]=n.access[p];v.addInitializer=function(y){if(h)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(y||null))};var g=(0,t[d])(s==="accessor"?{get:l.get,set:l.set}:l[u],v);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(c=o(g.get))&&(l.get=c),(c=o(g.set))&&(l.set=c),(c=o(g.init))&&i.unshift(c)}else(c=o(g))&&(s==="field"?i.unshift(c):l[u]=c)}f&&Object.defineProperty(f,n.name,l),h=!0}function Nb(r,e,t){for(var n=arguments.length>2,i=0;i<e.length;i++)t=n?e[i].call(r,t):e[i].call(r);return n?t:void 0}function Ob(r){return typeof r=="symbol"?r:"".concat(r)}function Db(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function Pb(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Un(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})}function Xn(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}var wc=Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]};function Rb(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&wc(e,r,t)}function Ec(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a}function Bb(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(bp(arguments[e]));return r}function _c(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}function Yn(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}function zs(r){return this instanceof zs?(this.v=r,this):new zs(r)}function Fb(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(d){return function(v){return Promise.resolve(v).then(d,c)}}function s(d,v){n[d]&&(i[d]=function(p){return new Promise(function(g,y){a.push([d,p,g,y])>1||u(d,p)})},v&&(i[d]=v(i[d])))}function u(d,v){try{f(n[d](v))}catch(p){h(a[0][3],p)}}function f(d){d.value instanceof zs?Promise.resolve(d.value.v).then(l,c):h(a[0][2],d)}function l(d){u("next",d)}function c(d){u("throw",d)}function h(d,v){d(v),a.shift(),a.length&&u(a[0][0],a[0][1])}}function Gb(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(o){return(t=!t)?{value:zs(r[i](o)),done:!1}:a?a(o):o}:a}}function zb(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Ec=="function"?Ec(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(s,u){o=r[a](o),i(s,u,o.done,o.value)})}}function i(a,o,s,u){Promise.resolve(u).then(function(f){a({value:f,done:s})},o)}}function $b(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}var $D=Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e};function jb(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wc(e,r,t);return $D(e,r),e}function Ub(r){return r&&r.__esModule?r:{default:r}}function Xb(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function Yb(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t}function Wb(r,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?e===r:r.has(e)}function Vb(r,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,i;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],t&&(i=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),r.stack.push({value:e,dispose:n,async:t})}else t&&r.stack.push({async:!0});return e}var jD=typeof SuppressedError=="function"?SuppressedError:function(r,e,t){var n=new Error(t);return n.name="SuppressedError",n.error=r,n.suppressed=e,n};function Hb(r){function e(a){r.error=r.hasError?new jD(a,r.error,"An error was suppressed during disposal."):a,r.hasError=!0}var t,n=0;function i(){for(;t=r.stack.pop();)try{if(!t.async&&n===1)return n=0,r.stack.push(t),Promise.resolve().then(i);if(t.dispose){var a=t.dispose.call(t.value);if(t.async)return n|=2,Promise.resolve(a).then(i,function(o){return e(o),i()})}else n|=1}catch(o){e(o)}if(n===1)return r.hasError?Promise.reject(r.error):Promise.resolve();if(r.hasError)throw r.error}return i()}function qb(r,e){return typeof r=="string"&&/^\.\.?\//.test(r)?r.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,n,i,a,o){return n?e?".jsx":".js":i&&(!a||!o)?t:i+a+"."+o.toLowerCase()+"js"}):r}const UD=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:Vb,get __assign(){return B},__asyncDelegator:Gb,__asyncGenerator:Fb,__asyncValues:zb,__await:zs,__awaiter:Un,__classPrivateFieldGet:Xb,__classPrivateFieldIn:Wb,__classPrivateFieldSet:Yb,__createBinding:wc,__decorate:Ib,__disposeResources:Hb,__esDecorate:Lb,__exportStar:Rb,__extends:It,__generator:Xn,__importDefault:Ub,__importStar:jb,__makeTemplateObject:$b,__metadata:Pb,__param:kb,__propKey:Ob,__read:bp,__rest:Jr,__rewriteRelativeImportExtension:qb,__runInitializers:Nb,__setFunctionName:Db,__spread:Bb,__spreadArray:Yn,__spreadArrays:_c,__values:Ec,default:{__extends:It,__assign:B,__rest:Jr,__decorate:Ib,__param:kb,__esDecorate:Lb,__runInitializers:Nb,__propKey:Ob,__setFunctionName:Db,__metadata:Pb,__awaiter:Un,__generator:Xn,__createBinding:wc,__exportStar:Rb,__values:Ec,__read:bp,__spread:Bb,__spreadArrays:_c,__spreadArray:Yn,__await:zs,__asyncGenerator:Fb,__asyncDelegator:Gb,__asyncValues:zb,__makeTemplateObject:$b,__importStar:jb,__importDefault:Ub,__classPrivateFieldGet:Xb,__classPrivateFieldSet:Yb,__classPrivateFieldIn:Wb,__addDisposableResource:Vb,__disposeResources:Hb,__rewriteRelativeImportExtension:qb}},Symbol.toStringTag,{value:"Module"}));var On=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},Sc=function(r,e){return On(r)?r.indexOf(e)>-1:!1},Mc=function(r,e){if(!On(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},XD=function(r,e){return e===void 0&&(e=[]),Mc(r,function(t){return!Sc(e,t)})},YD={}.toString,xi=function(r,e){return YD.call(r)==="[object "+e+"]"};const _r=function(r){return xi(r,"Function")};var ct=function(r){return r==null};const vt=function(r){return Array.isArray?Array.isArray(r):xi(r,"Array")},un=function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"};function ye(r,e){if(r){var t;if(vt(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(un(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var Zb=Object.keys?function(r){return Object.keys(r)}:function(r){var e=[];return ye(r,function(t,n){_r(r)&&n==="prototype"||e.push(n)}),e};function Kb(r,e){var t=Zb(e),n=t.length;if(ct(r))return!n;for(var i=0;i<n;i+=1){var a=t[i];if(e[a]!==r[a]||!(a in r))return!1}return!0}var Cc=function(r){return typeof r=="object"&&r!==null},fn=function(r){if(!Cc(r)||!xi(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var e=r;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e};function WD(r,e){if(!vt(r))return null;var t;if(_r(e)&&(t=e),fn(e)&&(t=function(i){return Kb(i,e)}),t){for(var n=0;n<r.length;n+=1)if(t(r[n]))return r[n]}return null}function VD(r,e,t){t===void 0&&(t=0);for(var n=t;n<r.length;n++)if(e(r[n],n))return n;return-1}var HD=function(r,e){for(var t=null,n=0;n<r.length;n++){var i=r[n],a=i[e];if(!ct(a)){vt(a)?t=a[0]:t=a;break}}return t},qD=function(r){if(!vt(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e},Qb=function(r,e){if(e===void 0&&(e=[]),!vt(r))e.push(r);else for(var t=0;t<r.length;t+=1)Qb(r[t],e);return e};const ji=function(r){if(vt(r))return r.reduce(function(e,t){return Math.max(e,t)},r[0])},Ui=function(r){if(vt(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])};var Jb=function(r){var e=r.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(vt(r[0])){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);e=t}var i=ji(e),a=Ui(e);return{min:a,max:i}},ex=Array.prototype,ZD=ex.splice,KD=ex.indexOf,QD=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],a=-1;(a=KD.call(r,i))>-1;)ZD.call(r,a,1);return r},JD=Array.prototype.splice,tx=function(e,t){if(!On(e))return[];for(var n=e?t.length:0,i=n-1;n--;){var a=void 0,o=t[n];(n===i||o!==a)&&(a=o,JD.call(e,o,1))}return e},rx=function(r,e,t){if(!vt(r)&&!fn(r))return r;var n=t;return ye(r,function(i,a){n=e(n,i,a)}),n},eP=function(r,e){var t=[];if(!On(r))return t;for(var n=-1,i=[],a=r.length;++n<a;){var o=r[n];e(o,n,r)&&(t.push(o),i.push(n))}return tx(r,i),t};const Pe=function(r){return xi(r,"String")};function tP(r,e){var t;if(_r(e))t=function(i,a){return e(i)-e(a)};else{var n=[];Pe(e)?n.push(e):vt(e)&&(n=e),t=function(i,a){for(var o=0;o<n.length;o+=1){var s=n[o];if(i[s]>a[s])return 1;if(i[s]<a[s])return-1}return 0}}return r.sort(t),r}function af(r,e){e===void 0&&(e=new Map);var t=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];e.has(a)||(t.push(a),e.set(a,!0))}return t}var rP=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return af([].concat.apply([],r))};const nP=function(r,e){for(var t=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[e];if(!ct(o)){vt(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(t.push(u),n[u]=!0)}}}return t};function Xi(r){if(On(r))return r[0]}function ri(r){if(On(r)){var e=r;return e[e.length-1]}}function iP(r,e){return vt(r)||Pe(r)?r[0]===e:!1}function aP(r,e){return vt(r)||Pe(r)?r[r.length-1]===e:!1}var oP=function(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0},sP=function(r,e){for(var t=0;t<r.length;t++)if(e(r[t],t))return!0;return!1},uP=Object.prototype.hasOwnProperty;function Ac(r,e){if(!e||!vt(r))return{};for(var t={},n=_r(e)?e:function(s){return s[e]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),uP.call(t,i)?t[i].push(o):t[i]=[o]}return t}function nx(r,e){if(!e)return{0:r};if(!_r(e)){var t=vt(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var i="_",a=0,o=t.length;a<o;a++)i+=n[t[a]]&&n[t[a]].toString();return i}}return Ac(r,e)}const fP=function(r,e){if(!e)return[r];var t=nx(r,e),n=[];for(var i in t)n.push(t[i]);return n};function lP(r,e){return r["_wrap_"+e]}function Go(r,e){if(r["_wrap_"+e])return r["_wrap_"+e];var t=function(n){r[e](n)};return r["_wrap_"+e]=t,t}var ix={};function cP(r){var e=ix[r];if(!e){for(var t=r.toString(16),n=t.length;n<6;n++)t="0"+t;e="#"+t,ix[r]=e}return e}function hP(r){var e=0,t=0,n=0,i=0;return vt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var dP=function(r,e,t){return r<e?e:r>t?t:r},Tc=function(r,e){var t=e.toString(),n=t.indexOf(".");if(n===-1)return Math.round(r);var i=t.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))},ht=function(r){return xi(r,"Number")},vP=function(r){return ht(r)&&r%1!==0},pP=function(r){return ht(r)&&r%2===0},gP=Number.isInteger?Number.isInteger:function(r){return ht(r)&&r%1===0},yP=function(r){return ht(r)&&r<0},mP=1e-5;function ax(r,e,t){return t===void 0&&(t=mP),Math.abs(r-e)<t}var bP=function(r){return ht(r)&&r%2!==0},xP=function(r){return ht(r)&&r>0};const wP=function(r,e){if(vt(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=_r(e)?e(a):a[e];o>n&&(t=a,n=o)}return t}},EP=function(r,e){if(vt(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],o=_r(e)?e(a):a[e];o<n&&(t=a,n=o)}return t}};var Ic=function(r,e){return(r%e+e)%e},_P=180/Math.PI,SP=function(r){return _P*r};const MP=parseInt;var CP=Math.PI/180,kc=function(r){return CP*r};const ox=function(r,e){return r.hasOwnProperty(e)};var xp=Object.values?function(r){return Object.values(r)}:function(r){var e=[];return ye(r,function(t,n){_r(r)&&n==="prototype"||e.push(t)}),e};const AP=function(r,e){return Sc(xp(r),e)},$s=function(r){return ct(r)?"":r.toString()};var TP=function(r){return $s(r).toLowerCase()},IP=function(r){var e=$s(r);return e.charAt(0).toLowerCase()+e.substring(1)};function kP(r,e){return!r||!e?r:r.replace(/\\?\{([^{}]+)\}/g,function(t,n){return t.charAt(0)==="\\"?t.slice(1):e[n]===void 0?"":e[n]})}var LP=function(r){return $s(r).toUpperCase()},js=function(r){var e=$s(r);return e.charAt(0).toUpperCase()+e.substring(1)},NP={}.toString,sx=function(r){return NP.call(r).replace(/^\[object /,"").replace(/]$/,"")},OP=function(r){return xi(r,"Arguments")},of=function(r){return xi(r,"Boolean")},wp=function(r){return xi(r,"Date")},DP=function(r){return xi(r,"Error")};function PP(r){return ht(r)&&isFinite(r)}var RP=function(r){return r===null},BP=Object.prototype,ux=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||BP;return r===t},FP=function(r){return xi(r,"RegExp")},GP=function(r){return r===void 0},zP=function(r){return r instanceof Element||r instanceof HTMLDocument};function fx(r){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)};return e(r)}function lx(r){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(r)}function Ep(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function gt(r,e,t,n){return e&&Ep(r,e),t&&Ep(r,t),n&&Ep(r,n),r}var $P=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=r[0],n=1;n<r.length;n++){var i=r[n];_r(i)&&(i=i.prototype),gt(t.prototype,i)}},Vt=function(r){if(typeof r!="object"||r===null)return r;var e;if(vt(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=Vt(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=Vt(r[i]):e[i]=r[i]}return e};function sf(r,e,t){var n;return function(){var i=this,a=arguments,o=function(){n=null,t||r.apply(i,a)},s=t&&!n;clearTimeout(n),n=setTimeout(o,e),s&&r.apply(i,a)}}const cx=function(r,e){if(!_r(r))throw new TypeError("Expected a function");var t=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=e?e.apply(this,n):n[0],o=t.cache;if(o.has(a))return o.get(a);var s=r.apply(this,n);return o.set(a,s),s};return t.cache=new Map,t};var jP=5;function hx(r,e,t,n){t=t||0,n=n||jP;for(var i in e)if(e.hasOwnProperty(i)){var a=e[i];a!==null&&fn(a)?(fn(r[i])||(r[i]={}),t<n?hx(r[i],a,t+1,n):r[i]=e[i]):vt(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var gr=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n+=1)hx(r,e[n]);return r},UP=function(r,e,t,n){_r(e)||(t=e,e=r,r=function(){});var i=Object.create?function(o,s){return Object.create(o,{constructor:{value:s}})}:function(o,s){function u(){}u.prototype=o;var f=new u;return f.constructor=s,f},a=i(e.prototype,r);return r.prototype=gt(a,r.prototype),r.superclass=i(e.prototype,e),gt(a,t),gt(r,n),r},_p=function(r,e){if(!On(r))return-1;var t=Array.prototype.indexOf;if(t)return t.call(r,e);for(var n=-1,i=0;i<r.length;i++)if(r[i]===e){n=i;break}return n},XP=Object.prototype.hasOwnProperty;function dx(r){if(ct(r))return!0;if(On(r))return!r.length;var e=sx(r);if(e==="Map"||e==="Set")return!r.size;if(ux(r))return!Object.keys(r).length;for(var t in r)if(XP.call(r,t))return!1;return!0}var Qa=function(r,e){if(r===e)return!0;if(!r||!e||Pe(r)||Pe(e))return!1;if(On(r)||On(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=Qa(r[n],e[n]),!!t);n++);return t}if(Cc(r)||Cc(e)){var i=Object.keys(r),a=Object.keys(e);if(i.length!==a.length)return!1;for(var t=!0,n=0;n<i.length&&(t=Qa(r[i[n]],e[i[n]]),!!t);n++);return t}return!1};const YP=function(r,e,t){return _r(t)?!!t(r,e):Qa(r,e)};var zo=function(r,e){if(!On(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];t.push(e(i,n))}return t},WP=function(r){return r};const VP=function(r,e){e===void 0&&(e=WP);var t={};return un(r)&&!ct(r)&&Object.keys(r).forEach(function(n){t[n]=e(r[n],n)}),t},Ea=function(r,e,t){for(var n=0,i=Pe(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r},HP=function(r,e,t){var n=r,i=Pe(e)?e.split("."):e;return i.forEach(function(a,o){o<i.length-1?(un(n[a])||(n[a]=ht(i[o+1])?[]:{}),n=n[a]):n[a]=t}),r};var qP=Object.prototype.hasOwnProperty;const ZP=function(r,e){if(r===null||!fn(r))return{};var t={};return ye(e,function(n){qP.call(r,n)&&(t[n]=r[n])}),t},KP=function(r,e){return rx(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})},uf=function(r,e,t){var n,i,a,o,s=0;t||(t={});var u=function(){s=t.leading===!1?0:Date.now(),n=null,o=r.apply(i,a),n||(i=a=null)},f=function(){var l=Date.now();!s&&t.leading===!1&&(s=l);var c=e-(l-s);return i=this,a=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},vx=function(r){return On(r)?Array.prototype.slice.call(r):[]};var Lc={};const Yi=function(r){return r=r||"g",Lc[r]?Lc[r]+=1:Lc[r]=1,r+Lc[r]},ff=function(){},QP=function(r){return r};function Nc(r){return ct(r)?0:On(r)?r.length:Object.keys(r).length}var Oc;const lf=cx(function(r,e){e===void 0&&(e={});var t=e.fontSize,n=e.fontFamily,i=e.fontWeight,a=e.fontStyle,o=e.fontVariant;return Oc||(Oc=document.createElement("canvas").getContext("2d")),Oc.font=[a,o,i,t+"px",n].join(" "),Oc.measureText(Pe(r)?r:"").width},function(r,e){return e===void 0&&(e={}),_c([r],xp(e)).join("")}),JP=function(r,e,t,n){n===void 0&&(n="...");var i=16,a=lf(n,t),o=Pe(r)?r:$s(r),s=e,u=[],f,l;if(lf(r,t)<=e)return r;for(;f=o.substr(0,i),l=lf(f,t),!(l+a>s&&l>s);)if(u.push(f),s-=l,o=o.substr(i),!o)return u.join("");for(;f=o.substr(0,1),l=lf(f,t),!(l+a>s);)if(u.push(f),s-=l,o=o.substr(1),!o)return u.join("");return""+u.join("")+n};var e3=function(){function r(){this.map={}}return r.prototype.has=function(e){return this.map[e]!==void 0},r.prototype.get=function(e,t){var n=this.map[e];return n===void 0?t:n},r.prototype.set=function(e,t){this.map[e]=t},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(e){delete this.map[e]},r.prototype.size=function(){return Object.keys(this.map).length},r}();const t3=Object.freeze(Object.defineProperty({__proto__:null,Cache:e3,assign:gt,augment:$P,clamp:dP,clearAnimationFrame:lx,clone:Vt,contains:Sc,debounce:sf,deepMix:gr,difference:XD,each:ye,endsWith:aP,every:oP,extend:UP,filter:Mc,find:WD,findIndex:VD,firstValue:HD,fixedBase:Tc,flatten:qD,flattenDeep:Qb,forIn:ye,get:Ea,getEllipsisText:JP,getRange:Jb,getType:sx,getWrapBehavior:lP,group:fP,groupBy:Ac,groupToMap:nx,has:ox,hasKey:ox,hasValue:AP,head:Xi,identity:QP,includes:Sc,indexOf:_p,isArguments:OP,isArray:vt,isArrayLike:On,isBoolean:of,isDate:wp,isDecimal:vP,isElement:zP,isEmpty:dx,isEqual:Qa,isEqualWith:YP,isError:DP,isEven:pP,isFinite:PP,isFunction:_r,isInteger:gP,isMatch:Kb,isNegative:yP,isNil:ct,isNull:RP,isNumber:ht,isNumberEqual:ax,isObject:un,isObjectLike:Cc,isOdd:bP,isPlainObject:fn,isPositive:xP,isPrototype:ux,isRegExp:FP,isString:Pe,isType:xi,isUndefined:GP,keys:Zb,last:ri,lowerCase:TP,lowerFirst:IP,map:zo,mapValues:VP,max:ji,maxBy:wP,measureTextWidth:lf,memoize:cx,min:Ui,minBy:EP,mix:gt,mod:Ic,noop:ff,number2color:cP,omit:KP,parseRadius:hP,pick:ZP,pull:QD,pullAt:tx,reduce:rx,remove:eP,requestAnimationFrame:fx,set:HP,size:Nc,some:sP,sortBy:tP,startsWith:iP,substitute:kP,throttle:uf,toArray:vx,toDegree:SP,toInteger:MP,toRadian:kc,toString:$s,union:rP,uniq:af,uniqueId:Yi,upperCase:LP,upperFirst:js,values:xp,valuesOfKey:nP,wrapBehavior:Go},Symbol.toStringTag,{value:"Module"})),r3={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(e){return Object.assign(this,e),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(e){var t=this,n=this.events;this.graph=e,(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!0),ye(n,function(i,a){e.on(a,i)}),document.addEventListener("visibilitychange",function(){t.keydown=!1})},unbind:function(e){var t=this.events,n=e.get("canvas").get("draggable");(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!1),ye(t,function(i,a){e.off(a,i)}),e.get("canvas").set("draggable",n)},get:function(e){return this[e]},set:function(e,t){return this[e]=t,this}};var Sp=function(){function r(){}return r.registerBehavior=function(e,t){if(!t)throw new Error("please specify handler for this behavior: ".concat(e));var n=Vt(r3);Object.assign(n,t);var i=function(o){var s=this;Object.assign(this,this.getDefaultCfg(),o);var u=this.getEvents();this.events=null;var f={};u&&(ye(u,function(l,c){f[c]=Go(s,l)}),this.events=f)};i.prototype=n,r.types[e]=i},r.hasBehavior=function(e){return!!r.types[e]},r.getBehavior=function(e){return r.types[e]},r.types={},r}(),n3="*",px=function(){function r(){this._events={}}return r.prototype.on=function(e,t,n){return this._events[e]||(this._events[e]=[]),this._events[e].push({callback:t,once:!!n}),this},r.prototype.once=function(e,t){return this.on(e,t,!0)},r.prototype.emit=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=this._events[e]||[],o=this._events[n3]||[],s=function(u){for(var f=u.length,l=0;l<f;l++)if(u[l]){var c=u[l],h=c.callback,d=c.once;d&&(u.splice(l,1),u.length===0&&delete t._events[e],f--,l--),h.apply(t,n)}};s(a),s(o)},r.prototype.off=function(e,t){if(!e)this._events={};else if(!t)delete this._events[e];else{for(var n=this._events[e]||[],i=n.length,a=0;a<i;a++)n[a].callback===t&&(n.splice(a,1),i--,a--);n.length===0&&delete this._events[e]}return this},r.prototype.getEvents=function(){return this._events},r}(),bt=1e-6,Zt=typeof Float32Array<"u"?Float32Array:Array,wi=Math.random;function i3(r){Zt=r}var a3=Math.PI/180;function o3(r){return r*a3}function s3(r,e){return Math.abs(r-e)<=bt*Math.max(1,Math.abs(r),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});const u3=Object.freeze(Object.defineProperty({__proto__:null,get ARRAY_TYPE(){return Zt},EPSILON:bt,RANDOM:wi,equals:s3,setMatrixArrayType:i3,toRadian:o3},Symbol.toStringTag,{value:"Module"}));function f3(){var r=new Zt(4);return Zt!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}function l3(r){var e=new Zt(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function c3(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function h3(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}function d3(r,e,t,n){var i=new Zt(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function v3(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function p3(r,e){if(r===e){var t=e[1];r[1]=e[2],r[2]=t}else r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3];return r}function g3(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*a-i*n;return o?(o=1/o,r[0]=a*o,r[1]=-n*o,r[2]=-i*o,r[3]=t*o,r):null}function y3(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}function m3(r){return r[0]*r[3]-r[2]*r[1]}function gx(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*s+a*u,r[1]=i*s+o*u,r[2]=n*f+a*l,r[3]=i*f+o*l,r}function b3(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+a*s,r[1]=i*u+o*s,r[2]=n*-s+a*u,r[3]=i*-s+o*u,r}function x3(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1];return r[0]=n*s,r[1]=i*s,r[2]=a*u,r[3]=o*u,r}function w3(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=-t,r[3]=n,r}function E3(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}function _3(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function S3(r){return Math.hypot(r[0],r[1],r[2],r[3])}function M3(r,e,t,n){return r[2]=n[2]/n[0],t[0]=n[0],t[1]=n[1],t[3]=n[3]-r[2]*t[1],[r,e,t]}function C3(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function yx(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function A3(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function T3(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(t-o)<=bt*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-s)<=bt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=bt*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=bt*Math.max(1,Math.abs(a),Math.abs(f))}function I3(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function k3(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}var L3=gx,N3=yx;const O3=Object.freeze(Object.defineProperty({__proto__:null,LDU:M3,add:C3,adjoint:y3,clone:l3,copy:c3,create:f3,determinant:m3,equals:T3,exactEquals:A3,frob:S3,fromRotation:w3,fromScaling:E3,fromValues:d3,identity:h3,invert:g3,mul:L3,multiply:gx,multiplyScalar:I3,multiplyScalarAndAdd:k3,rotate:b3,scale:x3,set:v3,str:_3,sub:N3,subtract:yx,transpose:p3},Symbol.toStringTag,{value:"Module"}));function D3(){var r=new Zt(6);return Zt!=Float32Array&&(r[1]=0,r[2]=0,r[4]=0,r[5]=0),r[0]=1,r[3]=1,r}function P3(r){var e=new Zt(6);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e}function R3(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r}function B3(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function F3(r,e,t,n,i,a){var o=new Zt(6);return o[0]=r,o[1]=e,o[2]=t,o[3]=n,o[4]=i,o[5]=a,o}function G3(r,e,t,n,i,a,o){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r}function z3(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=t*a-n*i;return u?(u=1/u,r[0]=a*u,r[1]=-n*u,r[2]=-i*u,r[3]=t*u,r[4]=(i*s-a*o)*u,r[5]=(n*o-t*s)*u,r):null}function $3(r){return r[0]*r[3]-r[1]*r[2]}function mx(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=t[0],l=t[1],c=t[2],h=t[3],d=t[4],v=t[5];return r[0]=n*f+a*l,r[1]=i*f+o*l,r[2]=n*c+a*h,r[3]=i*c+o*h,r[4]=n*d+a*v+s,r[5]=i*d+o*v+u,r}function j3(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=Math.sin(t),l=Math.cos(t);return r[0]=n*l+a*f,r[1]=i*l+o*f,r[2]=n*-f+a*l,r[3]=i*-f+o*l,r[4]=s,r[5]=u,r}function U3(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=t[0],l=t[1];return r[0]=n*f,r[1]=i*f,r[2]=a*l,r[3]=o*l,r[4]=s,r[5]=u,r}function X3(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=t[0],l=t[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=n*f+a*l+s,r[5]=i*f+o*l+u,r}function Y3(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=-t,r[3]=n,r[4]=0,r[5]=0,r}function W3(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r[4]=0,r[5]=0,r}function V3(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=e[0],r[5]=e[1],r}function H3(r){return"mat2d("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+")"}function q3(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],1)}function Z3(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r}function bx(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r}function K3(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r}function Q3(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r}function J3(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]}function e5(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=e[0],f=e[1],l=e[2],c=e[3],h=e[4],d=e[5];return Math.abs(t-u)<=bt*Math.max(1,Math.abs(t),Math.abs(u))&&Math.abs(n-f)<=bt*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=bt*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-c)<=bt*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-h)<=bt*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=bt*Math.max(1,Math.abs(s),Math.abs(d))}var t5=mx,r5=bx;const n5=Object.freeze(Object.defineProperty({__proto__:null,add:Z3,clone:P3,copy:R3,create:D3,determinant:$3,equals:e5,exactEquals:J3,frob:q3,fromRotation:Y3,fromScaling:W3,fromTranslation:V3,fromValues:F3,identity:B3,invert:z3,mul:t5,multiply:mx,multiplyScalar:K3,multiplyScalarAndAdd:Q3,rotate:j3,scale:U3,set:G3,str:H3,sub:r5,subtract:bx,translate:X3},Symbol.toStringTag,{value:"Module"}));function xx(){var r=new Zt(9);return Zt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function i5(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function a5(r){var e=new Zt(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}function o5(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function s5(r,e,t,n,i,a,o,s,u){var f=new Zt(9);return f[0]=r,f[1]=e,f[2]=t,f[3]=n,f[4]=i,f[5]=a,f[6]=o,f[7]=s,f[8]=u,f}function u5(r,e,t,n,i,a,o,s,u,f){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r[8]=f,r}function f5(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function l5(r,e){if(r===e){var t=e[1],n=e[2],i=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=i}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function Mp(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=l*o-s*f,h=-l*a+s*u,d=f*a-o*u,v=t*c+n*h+i*d;return v?(v=1/v,r[0]=c*v,r[1]=(-l*n+i*f)*v,r[2]=(s*n-i*o)*v,r[3]=h*v,r[4]=(l*t-i*u)*v,r[5]=(-s*t+i*a)*v,r[6]=d*v,r[7]=(-f*t+n*u)*v,r[8]=(o*t-n*a)*v,r):null}function c5(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8];return r[0]=o*l-s*f,r[1]=i*f-n*l,r[2]=n*s-i*o,r[3]=s*u-a*l,r[4]=t*l-i*u,r[5]=i*a-t*s,r[6]=a*f-o*u,r[7]=n*u-t*f,r[8]=t*o-n*a,r}function h5(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],o=r[5],s=r[6],u=r[7],f=r[8];return e*(f*a-o*u)+t*(-f*i+o*s)+n*(u*i-a*s)}function Wi(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=t[0],d=t[1],v=t[2],p=t[3],g=t[4],y=t[5],m=t[6],b=t[7],x=t[8];return r[0]=h*n+d*o+v*f,r[1]=h*i+d*s+v*l,r[2]=h*a+d*u+v*c,r[3]=p*n+g*o+y*f,r[4]=p*i+g*s+y*l,r[5]=p*a+g*u+y*c,r[6]=m*n+b*o+x*f,r[7]=m*i+b*s+x*l,r[8]=m*a+b*u+x*c,r}function d5(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=t[0],d=t[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=u,r[6]=h*n+d*o+f,r[7]=h*i+d*s+l,r[8]=h*a+d*u+c,r}function v5(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=Math.sin(t),d=Math.cos(t);return r[0]=d*n+h*o,r[1]=d*i+h*s,r[2]=d*a+h*u,r[3]=d*o-h*n,r[4]=d*s-h*i,r[5]=d*u-h*a,r[6]=f,r[7]=l,r[8]=c,r}function p5(r,e,t){var n=t[0],i=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=i*e[3],r[4]=i*e[4],r[5]=i*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function Cp(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}function Ap(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=-t,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Tp(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function g5(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}function y5(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t+t,s=n+n,u=i+i,f=t*o,l=n*o,c=n*s,h=i*o,d=i*s,v=i*u,p=a*o,g=a*s,y=a*u;return r[0]=1-c-v,r[3]=l-y,r[6]=h+g,r[1]=l+y,r[4]=1-f-v,r[7]=d-p,r[2]=h-g,r[5]=d+p,r[8]=1-f-c,r}function m5(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=t*s-n*o,b=t*u-i*o,x=t*f-a*o,w=n*u-i*s,E=n*f-a*s,_=i*f-a*u,M=l*p-c*v,C=l*g-h*v,S=l*y-d*v,A=c*g-h*p,T=c*y-d*p,k=h*y-d*g,O=m*k-b*T+x*A+w*S-E*C+_*M;return O?(O=1/O,r[0]=(s*k-u*T+f*A)*O,r[1]=(u*S-o*k-f*C)*O,r[2]=(o*T-s*S+f*M)*O,r[3]=(i*T-n*k-a*A)*O,r[4]=(t*k-i*S+a*C)*O,r[5]=(n*S-t*T-a*M)*O,r[6]=(p*_-g*E+y*w)*O,r[7]=(g*x-v*_-y*b)*O,r[8]=(v*E-p*x+y*m)*O,r):null}function b5(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function x5(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function w5(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function E5(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}function wx(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}function _5(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}function S5(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r}function M5(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}function C5(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=r[8],c=e[0],h=e[1],d=e[2],v=e[3],p=e[4],g=e[5],y=e[6],m=e[7],b=e[8];return Math.abs(t-c)<=bt*Math.max(1,Math.abs(t),Math.abs(c))&&Math.abs(n-h)<=bt*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-d)<=bt*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-v)<=bt*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(o-p)<=bt*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-g)<=bt*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(u-y)<=bt*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(f-m)<=bt*Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(l-b)<=bt*Math.max(1,Math.abs(l),Math.abs(b))}var A5=Wi,T5=wx;const Ex=Object.freeze(Object.defineProperty({__proto__:null,add:E5,adjoint:c5,clone:a5,copy:o5,create:xx,determinant:h5,equals:C5,exactEquals:M5,frob:w5,fromMat2d:g5,fromMat4:i5,fromQuat:y5,fromRotation:Ap,fromScaling:Tp,fromTranslation:Cp,fromValues:s5,identity:f5,invert:Mp,mul:A5,multiply:Wi,multiplyScalar:_5,multiplyScalarAndAdd:S5,normalFromMat4:m5,projection:b5,rotate:v5,scale:p5,set:u5,str:x5,sub:T5,subtract:wx,translate:d5,transpose:l5},Symbol.toStringTag,{value:"Module"}));function I5(){var r=new Zt(16);return Zt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function k5(r){var e=new Zt(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function L5(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function N5(r,e,t,n,i,a,o,s,u,f,l,c,h,d,v,p){var g=new Zt(16);return g[0]=r,g[1]=e,g[2]=t,g[3]=n,g[4]=i,g[5]=a,g[6]=o,g[7]=s,g[8]=u,g[9]=f,g[10]=l,g[11]=c,g[12]=h,g[13]=d,g[14]=v,g[15]=p,g}function O5(r,e,t,n,i,a,o,s,u,f,l,c,h,d,v,p,g){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r[8]=f,r[9]=l,r[10]=c,r[11]=h,r[12]=d,r[13]=v,r[14]=p,r[15]=g,r}function _x(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function D5(r,e){if(r===e){var t=e[1],n=e[2],i=e[3],a=e[6],o=e[7],s=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=a,r[11]=e[14],r[12]=i,r[13]=o,r[14]=s}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function P5(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=t*s-n*o,b=t*u-i*o,x=t*f-a*o,w=n*u-i*s,E=n*f-a*s,_=i*f-a*u,M=l*p-c*v,C=l*g-h*v,S=l*y-d*v,A=c*g-h*p,T=c*y-d*p,k=h*y-d*g,O=m*k-b*T+x*A+w*S-E*C+_*M;return O?(O=1/O,r[0]=(s*k-u*T+f*A)*O,r[1]=(i*T-n*k-a*A)*O,r[2]=(p*_-g*E+y*w)*O,r[3]=(h*E-c*_-d*w)*O,r[4]=(u*S-o*k-f*C)*O,r[5]=(t*k-i*S+a*C)*O,r[6]=(g*x-v*_-y*b)*O,r[7]=(l*_-h*x+d*b)*O,r[8]=(o*T-s*S+f*M)*O,r[9]=(n*S-t*T-a*M)*O,r[10]=(v*E-p*x+y*m)*O,r[11]=(c*x-l*E-d*m)*O,r[12]=(s*C-o*A-u*M)*O,r[13]=(t*A-n*C+i*M)*O,r[14]=(p*b-v*w-g*m)*O,r[15]=(l*w-c*b+h*m)*O,r):null}function R5(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15];return r[0]=s*(h*y-d*g)-c*(u*y-f*g)+p*(u*d-f*h),r[1]=-(n*(h*y-d*g)-c*(i*y-a*g)+p*(i*d-a*h)),r[2]=n*(u*y-f*g)-s*(i*y-a*g)+p*(i*f-a*u),r[3]=-(n*(u*d-f*h)-s*(i*d-a*h)+c*(i*f-a*u)),r[4]=-(o*(h*y-d*g)-l*(u*y-f*g)+v*(u*d-f*h)),r[5]=t*(h*y-d*g)-l*(i*y-a*g)+v*(i*d-a*h),r[6]=-(t*(u*y-f*g)-o*(i*y-a*g)+v*(i*f-a*u)),r[7]=t*(u*d-f*h)-o*(i*d-a*h)+l*(i*f-a*u),r[8]=o*(c*y-d*p)-l*(s*y-f*p)+v*(s*d-f*c),r[9]=-(t*(c*y-d*p)-l*(n*y-a*p)+v*(n*d-a*c)),r[10]=t*(s*y-f*p)-o*(n*y-a*p)+v*(n*f-a*s),r[11]=-(t*(s*d-f*c)-o*(n*d-a*c)+l*(n*f-a*s)),r[12]=-(o*(c*g-h*p)-l*(s*g-u*p)+v*(s*h-u*c)),r[13]=t*(c*g-h*p)-l*(n*g-i*p)+v*(n*h-i*c),r[14]=-(t*(s*g-u*p)-o*(n*g-i*p)+v*(n*u-i*s)),r[15]=t*(s*h-u*c)-o*(n*h-i*c)+l*(n*u-i*s),r}function B5(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],o=r[5],s=r[6],u=r[7],f=r[8],l=r[9],c=r[10],h=r[11],d=r[12],v=r[13],p=r[14],g=r[15],y=e*o-t*a,m=e*s-n*a,b=e*u-i*a,x=t*s-n*o,w=t*u-i*o,E=n*u-i*s,_=f*v-l*d,M=f*p-c*d,C=f*g-h*d,S=l*p-c*v,A=l*g-h*v,T=c*g-h*p;return y*T-m*A+b*S+x*C-w*M+E*_}function Sx(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=e[9],d=e[10],v=e[11],p=e[12],g=e[13],y=e[14],m=e[15],b=t[0],x=t[1],w=t[2],E=t[3];return r[0]=b*n+x*s+w*c+E*p,r[1]=b*i+x*u+w*h+E*g,r[2]=b*a+x*f+w*d+E*y,r[3]=b*o+x*l+w*v+E*m,b=t[4],x=t[5],w=t[6],E=t[7],r[4]=b*n+x*s+w*c+E*p,r[5]=b*i+x*u+w*h+E*g,r[6]=b*a+x*f+w*d+E*y,r[7]=b*o+x*l+w*v+E*m,b=t[8],x=t[9],w=t[10],E=t[11],r[8]=b*n+x*s+w*c+E*p,r[9]=b*i+x*u+w*h+E*g,r[10]=b*a+x*f+w*d+E*y,r[11]=b*o+x*l+w*v+E*m,b=t[12],x=t[13],w=t[14],E=t[15],r[12]=b*n+x*s+w*c+E*p,r[13]=b*i+x*u+w*h+E*g,r[14]=b*a+x*f+w*d+E*y,r[15]=b*o+x*l+w*v+E*m,r}function F5(r,e,t){var n=t[0],i=t[1],a=t[2],o,s,u,f,l,c,h,d,v,p,g,y;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*a+e[12],r[13]=e[1]*n+e[5]*i+e[9]*a+e[13],r[14]=e[2]*n+e[6]*i+e[10]*a+e[14],r[15]=e[3]*n+e[7]*i+e[11]*a+e[15]):(o=e[0],s=e[1],u=e[2],f=e[3],l=e[4],c=e[5],h=e[6],d=e[7],v=e[8],p=e[9],g=e[10],y=e[11],r[0]=o,r[1]=s,r[2]=u,r[3]=f,r[4]=l,r[5]=c,r[6]=h,r[7]=d,r[8]=v,r[9]=p,r[10]=g,r[11]=y,r[12]=o*n+l*i+v*a+e[12],r[13]=s*n+c*i+p*a+e[13],r[14]=u*n+h*i+g*a+e[14],r[15]=f*n+d*i+y*a+e[15]),r}function G5(r,e,t){var n=t[0],i=t[1],a=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*i,r[6]=e[6]*i,r[7]=e[7]*i,r[8]=e[8]*a,r[9]=e[9]*a,r[10]=e[10]*a,r[11]=e[11]*a,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function z5(r,e,t,n){var i=n[0],a=n[1],o=n[2],s=Math.hypot(i,a,o),u,f,l,c,h,d,v,p,g,y,m,b,x,w,E,_,M,C,S,A,T,k,O,G;return s<bt?null:(s=1/s,i*=s,a*=s,o*=s,u=Math.sin(t),f=Math.cos(t),l=1-f,c=e[0],h=e[1],d=e[2],v=e[3],p=e[4],g=e[5],y=e[6],m=e[7],b=e[8],x=e[9],w=e[10],E=e[11],_=i*i*l+f,M=a*i*l+o*u,C=o*i*l-a*u,S=i*a*l-o*u,A=a*a*l+f,T=o*a*l+i*u,k=i*o*l+a*u,O=a*o*l-i*u,G=o*o*l+f,r[0]=c*_+p*M+b*C,r[1]=h*_+g*M+x*C,r[2]=d*_+y*M+w*C,r[3]=v*_+m*M+E*C,r[4]=c*S+p*A+b*T,r[5]=h*S+g*A+x*T,r[6]=d*S+y*A+w*T,r[7]=v*S+m*A+E*T,r[8]=c*k+p*O+b*G,r[9]=h*k+g*O+x*G,r[10]=d*k+y*O+w*G,r[11]=v*k+m*O+E*G,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function $5(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[4],o=e[5],s=e[6],u=e[7],f=e[8],l=e[9],c=e[10],h=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=a*i+f*n,r[5]=o*i+l*n,r[6]=s*i+c*n,r[7]=u*i+h*n,r[8]=f*i-a*n,r[9]=l*i-o*n,r[10]=c*i-s*n,r[11]=h*i-u*n,r}function j5(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[0],o=e[1],s=e[2],u=e[3],f=e[8],l=e[9],c=e[10],h=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=a*i-f*n,r[1]=o*i-l*n,r[2]=s*i-c*n,r[3]=u*i-h*n,r[8]=a*n+f*i,r[9]=o*n+l*i,r[10]=s*n+c*i,r[11]=u*n+h*i,r}function U5(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[0],o=e[1],s=e[2],u=e[3],f=e[4],l=e[5],c=e[6],h=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=a*i+f*n,r[1]=o*i+l*n,r[2]=s*i+c*n,r[3]=u*i+h*n,r[4]=f*i-a*n,r[5]=l*i-o*n,r[6]=c*i-s*n,r[7]=h*i-u*n,r}function X5(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function Y5(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function W5(r,e,t){var n=t[0],i=t[1],a=t[2],o=Math.hypot(n,i,a),s,u,f;return o<bt?null:(o=1/o,n*=o,i*=o,a*=o,s=Math.sin(e),u=Math.cos(e),f=1-u,r[0]=n*n*f+u,r[1]=i*n*f+a*s,r[2]=a*n*f-i*s,r[3]=0,r[4]=n*i*f-a*s,r[5]=i*i*f+u,r[6]=a*i*f+n*s,r[7]=0,r[8]=n*a*f+i*s,r[9]=i*a*f-n*s,r[10]=a*a*f+u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function V5(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function H5(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function q5(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Mx(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=n+n,u=i+i,f=a+a,l=n*s,c=n*u,h=n*f,d=i*u,v=i*f,p=a*f,g=o*s,y=o*u,m=o*f;return r[0]=1-(d+p),r[1]=c+m,r[2]=h-y,r[3]=0,r[4]=c-m,r[5]=1-(l+p),r[6]=v+g,r[7]=0,r[8]=h+y,r[9]=v-g,r[10]=1-(l+d),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function Z5(r,e){var t=new Zt(3),n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=n*n+i*i+a*a+o*o;return c>0?(t[0]=(s*o+l*n+u*a-f*i)*2/c,t[1]=(u*o+l*i+f*n-s*a)*2/c,t[2]=(f*o+l*a+s*i-u*n)*2/c):(t[0]=(s*o+l*n+u*a-f*i)*2,t[1]=(u*o+l*i+f*n-s*a)*2,t[2]=(f*o+l*a+s*i-u*n)*2),Mx(r,e,t),r}function Cx(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function Ax(r,e){var t=e[0],n=e[1],i=e[2],a=e[4],o=e[5],s=e[6],u=e[8],f=e[9],l=e[10];return r[0]=Math.hypot(t,n,i),r[1]=Math.hypot(a,o,s),r[2]=Math.hypot(u,f,l),r}function Tx(r,e){var t=new Zt(3);Ax(t,e);var n=1/t[0],i=1/t[1],a=1/t[2],o=e[0]*n,s=e[1]*i,u=e[2]*a,f=e[4]*n,l=e[5]*i,c=e[6]*a,h=e[8]*n,d=e[9]*i,v=e[10]*a,p=o+l+v,g=0;return p>0?(g=Math.sqrt(p+1)*2,r[3]=.25*g,r[0]=(c-d)/g,r[1]=(h-u)/g,r[2]=(s-f)/g):o>l&&o>v?(g=Math.sqrt(1+o-l-v)*2,r[3]=(c-d)/g,r[0]=.25*g,r[1]=(s+f)/g,r[2]=(h+u)/g):l>v?(g=Math.sqrt(1+l-o-v)*2,r[3]=(h-u)/g,r[0]=(s+f)/g,r[1]=.25*g,r[2]=(c+d)/g):(g=Math.sqrt(1+v-o-l)*2,r[3]=(s-f)/g,r[0]=(h+u)/g,r[1]=(c+d)/g,r[2]=.25*g),r}function K5(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=i+i,f=a+a,l=o+o,c=i*u,h=i*f,d=i*l,v=a*f,p=a*l,g=o*l,y=s*u,m=s*f,b=s*l,x=n[0],w=n[1],E=n[2];return r[0]=(1-(v+g))*x,r[1]=(h+b)*x,r[2]=(d-m)*x,r[3]=0,r[4]=(h-b)*w,r[5]=(1-(c+g))*w,r[6]=(p+y)*w,r[7]=0,r[8]=(d+m)*E,r[9]=(p-y)*E,r[10]=(1-(c+v))*E,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function Q5(r,e,t,n,i){var a=e[0],o=e[1],s=e[2],u=e[3],f=a+a,l=o+o,c=s+s,h=a*f,d=a*l,v=a*c,p=o*l,g=o*c,y=s*c,m=u*f,b=u*l,x=u*c,w=n[0],E=n[1],_=n[2],M=i[0],C=i[1],S=i[2],A=(1-(p+y))*w,T=(d+x)*w,k=(v-b)*w,O=(d-x)*E,G=(1-(h+y))*E,D=(g+m)*E,$=(v+b)*_,Y=(g-m)*_,N=(1-(h+p))*_;return r[0]=A,r[1]=T,r[2]=k,r[3]=0,r[4]=O,r[5]=G,r[6]=D,r[7]=0,r[8]=$,r[9]=Y,r[10]=N,r[11]=0,r[12]=t[0]+M-(A*M+O*C+$*S),r[13]=t[1]+C-(T*M+G*C+Y*S),r[14]=t[2]+S-(k*M+D*C+N*S),r[15]=1,r}function J5(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t+t,s=n+n,u=i+i,f=t*o,l=n*o,c=n*s,h=i*o,d=i*s,v=i*u,p=a*o,g=a*s,y=a*u;return r[0]=1-c-v,r[1]=l+y,r[2]=h-g,r[3]=0,r[4]=l-y,r[5]=1-f-v,r[6]=d+p,r[7]=0,r[8]=h+g,r[9]=d-p,r[10]=1-f-c,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function eR(r,e,t,n,i,a,o){var s=1/(t-e),u=1/(i-n),f=1/(a-o);return r[0]=a*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*u,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(i+n)*u,r[10]=(o+a)*f,r[11]=-1,r[12]=0,r[13]=0,r[14]=o*a*2*f,r[15]=0,r}function Ix(r,e,t,n,i){var a=1/Math.tan(e/2),o;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=(i+n)*o,r[14]=2*i*n*o):(r[10]=-1,r[14]=-2*n),r}var tR=Ix;function rR(r,e,t,n,i){var a=1/Math.tan(e/2),o;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=i*o,r[14]=i*n*o):(r[10]=-1,r[14]=-n),r}function nR(r,e,t,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(o+s),f=2/(i+a);return r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=f,r[6]=0,r[7]=0,r[8]=-((o-s)*u*.5),r[9]=(i-a)*f*.5,r[10]=n/(t-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*t/(t-n),r[15]=0,r}function kx(r,e,t,n,i,a,o){var s=1/(e-t),u=1/(n-i),f=1/(a-o);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*f,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=(o+a)*f,r[15]=1,r}var iR=kx;function aR(r,e,t,n,i,a,o){var s=1/(e-t),u=1/(n-i),f=1/(a-o);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=f,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=a*f,r[15]=1,r}function oR(r,e,t,n){var i,a,o,s,u,f,l,c,h,d,v=e[0],p=e[1],g=e[2],y=n[0],m=n[1],b=n[2],x=t[0],w=t[1],E=t[2];return Math.abs(v-x)<bt&&Math.abs(p-w)<bt&&Math.abs(g-E)<bt?_x(r):(l=v-x,c=p-w,h=g-E,d=1/Math.hypot(l,c,h),l*=d,c*=d,h*=d,i=m*h-b*c,a=b*l-y*h,o=y*c-m*l,d=Math.hypot(i,a,o),d?(d=1/d,i*=d,a*=d,o*=d):(i=0,a=0,o=0),s=c*o-h*a,u=h*i-l*o,f=l*a-c*i,d=Math.hypot(s,u,f),d?(d=1/d,s*=d,u*=d,f*=d):(s=0,u=0,f=0),r[0]=i,r[1]=s,r[2]=l,r[3]=0,r[4]=a,r[5]=u,r[6]=c,r[7]=0,r[8]=o,r[9]=f,r[10]=h,r[11]=0,r[12]=-(i*v+a*p+o*g),r[13]=-(s*v+u*p+f*g),r[14]=-(l*v+c*p+h*g),r[15]=1,r)}function sR(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=n[0],u=n[1],f=n[2],l=i-t[0],c=a-t[1],h=o-t[2],d=l*l+c*c+h*h;d>0&&(d=1/Math.sqrt(d),l*=d,c*=d,h*=d);var v=u*h-f*c,p=f*l-s*h,g=s*c-u*l;return d=v*v+p*p+g*g,d>0&&(d=1/Math.sqrt(d),v*=d,p*=d,g*=d),r[0]=v,r[1]=p,r[2]=g,r[3]=0,r[4]=c*g-h*p,r[5]=h*v-l*g,r[6]=l*p-c*v,r[7]=0,r[8]=l,r[9]=c,r[10]=h,r[11]=0,r[12]=i,r[13]=a,r[14]=o,r[15]=1,r}function uR(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function fR(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function lR(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}function Lx(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}function cR(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}function hR(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r[9]=e[9]+t[9]*n,r[10]=e[10]+t[10]*n,r[11]=e[11]+t[11]*n,r[12]=e[12]+t[12]*n,r[13]=e[13]+t[13]*n,r[14]=e[14]+t[14]*n,r[15]=e[15]+t[15]*n,r}function dR(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}function vR(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=r[8],c=r[9],h=r[10],d=r[11],v=r[12],p=r[13],g=r[14],y=r[15],m=e[0],b=e[1],x=e[2],w=e[3],E=e[4],_=e[5],M=e[6],C=e[7],S=e[8],A=e[9],T=e[10],k=e[11],O=e[12],G=e[13],D=e[14],$=e[15];return Math.abs(t-m)<=bt*Math.max(1,Math.abs(t),Math.abs(m))&&Math.abs(n-b)<=bt*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=bt*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-w)<=bt*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(o-E)<=bt*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(s-_)<=bt*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(u-M)<=bt*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(f-C)<=bt*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(l-S)<=bt*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-A)<=bt*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(h-T)<=bt*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(d-k)<=bt*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(v-O)<=bt*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-G)<=bt*Math.max(1,Math.abs(p),Math.abs(G))&&Math.abs(g-D)<=bt*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(y-$)<=bt*Math.max(1,Math.abs(y),Math.abs($))}var pR=Sx,gR=Lx;const yR=Object.freeze(Object.defineProperty({__proto__:null,add:lR,adjoint:R5,clone:k5,copy:L5,create:I5,determinant:B5,equals:vR,exactEquals:dR,frob:fR,fromQuat:J5,fromQuat2:Z5,fromRotation:W5,fromRotationTranslation:Mx,fromRotationTranslationScale:K5,fromRotationTranslationScaleOrigin:Q5,fromScaling:Y5,fromTranslation:X5,fromValues:N5,fromXRotation:V5,fromYRotation:H5,fromZRotation:q5,frustum:eR,getRotation:Tx,getScaling:Ax,getTranslation:Cx,identity:_x,invert:P5,lookAt:oR,mul:pR,multiply:Sx,multiplyScalar:cR,multiplyScalarAndAdd:hR,ortho:iR,orthoNO:kx,orthoZO:aR,perspective:tR,perspectiveFromFieldOfView:nR,perspectiveNO:Ix,perspectiveZO:rR,rotate:z5,rotateX:$5,rotateY:j5,rotateZ:U5,scale:G5,set:O5,str:uR,sub:gR,subtract:Lx,targetTo:sR,translate:F5,transpose:D5},Symbol.toStringTag,{value:"Module"}));function Ip(){var r=new Zt(3);return Zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function mR(r){var e=new Zt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Nx(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}function kp(r,e,t){var n=new Zt(3);return n[0]=r,n[1]=e,n[2]=t,n}function bR(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function xR(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function wR(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function Ox(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function Dx(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Px(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function ER(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function _R(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function SR(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function MR(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function CR(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}function AR(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function TR(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r}function Rx(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return Math.hypot(t,n,i)}function Bx(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return t*t+n*n+i*i}function Fx(r){var e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function IR(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function kR(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function Gx(r,e){var t=e[0],n=e[1],i=e[2],a=t*t+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r[2]=e[2]*a,r}function Lp(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Dc(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2];return r[0]=i*u-a*s,r[1]=a*o-n*u,r[2]=n*s-i*o,r}function LR(r,e,t,n){var i=e[0],a=e[1],o=e[2];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=o+n*(t[2]-o),r}function NR(r,e,t,n,i,a){var o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,f=o*(a-1),l=o*(3-2*a);return r[0]=e[0]*s+t[0]*u+n[0]*f+i[0]*l,r[1]=e[1]*s+t[1]*u+n[1]*f+i[1]*l,r[2]=e[2]*s+t[2]*u+n[2]*f+i[2]*l,r}function OR(r,e,t,n,i,a){var o=1-a,s=o*o,u=a*a,f=s*o,l=3*a*s,c=3*u*o,h=u*a;return r[0]=e[0]*f+t[0]*l+n[0]*c+i[0]*h,r[1]=e[1]*f+t[1]*l+n[1]*c+i[1]*h,r[2]=e[2]*f+t[2]*l+n[2]*c+i[2]*h,r}function DR(r,e){e=e||1;var t=wi()*2*Math.PI,n=wi()*2-1,i=Math.sqrt(1-n*n)*e;return r[0]=Math.cos(t)*i,r[1]=Math.sin(t)*i,r[2]=n*e,r}function PR(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[3]*n+t[7]*i+t[11]*a+t[15];return o=o||1,r[0]=(t[0]*n+t[4]*i+t[8]*a+t[12])/o,r[1]=(t[1]*n+t[5]*i+t[9]*a+t[13])/o,r[2]=(t[2]*n+t[6]*i+t[10]*a+t[14])/o,r}function Pc(r,e,t){var n=e[0],i=e[1],a=e[2];return r[0]=n*t[0]+i*t[3]+a*t[6],r[1]=n*t[1]+i*t[4]+a*t[7],r[2]=n*t[2]+i*t[5]+a*t[8],r}function RR(r,e,t){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1],f=e[2],l=i*f-a*u,c=a*s-n*f,h=n*u-i*s,d=i*h-a*c,v=a*l-n*h,p=n*c-i*l,g=o*2;return l*=g,c*=g,h*=g,d*=2,v*=2,p*=2,r[0]=s+l+d,r[1]=u+c+v,r[2]=f+h+p,r}function BR(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function FR(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function GR(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function zR(r,e){var t=r[0],n=r[1],i=r[2],a=e[0],o=e[1],s=e[2],u=Math.sqrt(t*t+n*n+i*i),f=Math.sqrt(a*a+o*o+s*s),l=u*f,c=l&&Lp(r,e)/l;return Math.acos(Math.min(Math.max(c,-1),1))}function $R(r){return r[0]=0,r[1]=0,r[2]=0,r}function jR(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function UR(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function XR(r,e){var t=r[0],n=r[1],i=r[2],a=e[0],o=e[1],s=e[2];return Math.abs(t-a)<=bt*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-o)<=bt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=bt*Math.max(1,Math.abs(i),Math.abs(s))}var YR=Ox,WR=Dx,VR=Px,HR=Rx,qR=Bx,zx=Nx,ZR=Fx,KR=function(){var r=Ip();return function(e,t,n,i,a,o){var s,u;for(t||(t=3),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],a(r,r,o),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}}();const QR=Object.freeze(Object.defineProperty({__proto__:null,add:wR,angle:zR,bezier:OR,ceil:ER,clone:mR,copy:bR,create:Ip,cross:Dc,dist:HR,distance:Rx,div:VR,divide:Px,dot:Lp,equals:XR,exactEquals:UR,floor:_R,forEach:KR,fromValues:kp,hermite:NR,inverse:kR,len:zx,length:Nx,lerp:LR,max:MR,min:SR,mul:WR,multiply:Dx,negate:IR,normalize:Gx,random:DR,rotateX:BR,rotateY:FR,rotateZ:GR,round:CR,scale:AR,scaleAndAdd:TR,set:xR,sqrDist:qR,sqrLen:ZR,squaredDistance:Bx,squaredLength:Fx,str:jR,sub:YR,subtract:Ox,transformMat3:Pc,transformMat4:PR,transformQuat:RR,zero:$R},Symbol.toStringTag,{value:"Module"}));function $x(){var r=new Zt(4);return Zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function jx(r){var e=new Zt(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function Ux(r,e,t,n){var i=new Zt(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function Xx(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function Yx(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function Wx(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function Vx(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function Hx(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r}function qx(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r}function JR(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r[3]=Math.ceil(e[3]),r}function eB(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r[3]=Math.floor(e[3]),r}function tB(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r}function rB(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r}function nB(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r[3]=Math.round(e[3]),r}function Zx(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function iB(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}function Kx(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],a=e[3]-r[3];return Math.hypot(t,n,i,a)}function Qx(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],a=e[3]-r[3];return t*t+n*n+i*i+a*a}function Np(r){var e=r[0],t=r[1],n=r[2],i=r[3];return Math.hypot(e,t,n,i)}function Op(r){var e=r[0],t=r[1],n=r[2],i=r[3];return e*e+t*t+n*n+i*i}function aB(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}function oB(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r[3]=1/e[3],r}function Jx(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*t+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),r[0]=t*o,r[1]=n*o,r[2]=i*o,r[3]=a*o,r}function ew(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function sB(r,e,t,n){var i=t[0]*n[1]-t[1]*n[0],a=t[0]*n[2]-t[2]*n[0],o=t[0]*n[3]-t[3]*n[0],s=t[1]*n[2]-t[2]*n[1],u=t[1]*n[3]-t[3]*n[1],f=t[2]*n[3]-t[3]*n[2],l=e[0],c=e[1],h=e[2],d=e[3];return r[0]=c*f-h*u+d*s,r[1]=-(l*f)+h*o-d*a,r[2]=l*u-c*o+d*i,r[3]=-(l*s)+c*a-h*i,r}function tw(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=o+n*(t[2]-o),r[3]=s+n*(t[3]-s),r}function uB(r,e){e=e||1;var t,n,i,a,o,s;do t=wi()*2-1,n=wi()*2-1,o=t*t+n*n;while(o>=1);do i=wi()*2-1,a=wi()*2-1,s=i*i+a*a;while(s>=1);var u=Math.sqrt((1-o)/s);return r[0]=e*t,r[1]=e*n,r[2]=e*i*u,r[3]=e*a*u,r}function fB(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*a+t[12]*o,r[1]=t[1]*n+t[5]*i+t[9]*a+t[13]*o,r[2]=t[2]*n+t[6]*i+t[10]*a+t[14]*o,r[3]=t[3]*n+t[7]*i+t[11]*a+t[15]*o,r}function lB(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2],f=t[3],l=f*n+s*a-u*i,c=f*i+u*n-o*a,h=f*a+o*i-s*n,d=-o*n-s*i-u*a;return r[0]=l*f+d*-o+c*-u-h*-s,r[1]=c*f+d*-s+h*-o-l*-u,r[2]=h*f+d*-u+l*-s-c*-o,r[3]=e[3],r}function cB(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function hB(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function rw(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function nw(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(t-o)<=bt*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-s)<=bt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=bt*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=bt*Math.max(1,Math.abs(a),Math.abs(f))}var dB=Vx,vB=Hx,pB=qx,gB=Kx,yB=Qx,mB=Np,bB=Op,xB=function(){var r=$x();return function(e,t,n,i,a,o){var s,u;for(t||(t=4),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],a(r,r,o),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}}();const wB=Object.freeze(Object.defineProperty({__proto__:null,add:Wx,ceil:JR,clone:jx,copy:Xx,create:$x,cross:sB,dist:gB,distance:Kx,div:pB,divide:qx,dot:ew,equals:nw,exactEquals:rw,floor:eB,forEach:xB,fromValues:Ux,inverse:oB,len:mB,length:Np,lerp:tw,max:rB,min:tB,mul:vB,multiply:Hx,negate:aB,normalize:Jx,random:uB,round:nB,scale:Zx,scaleAndAdd:iB,set:Yx,sqrDist:yB,sqrLen:bB,squaredDistance:Qx,squaredLength:Op,str:hB,sub:dB,subtract:Vx,transformMat4:fB,transformQuat:lB,zero:cB},Symbol.toStringTag,{value:"Module"}));function Rc(){var r=new Zt(4);return Zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function EB(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function iw(r,e,t){t=t*.5;var n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function _B(r,e){var t=Math.acos(e[3])*2,n=Math.sin(t/2);return n>bt?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),t}function SB(r,e){var t=Pp(r,e);return Math.acos(2*t*t-1)}function aw(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*l+o*s+i*f-a*u,r[1]=i*l+o*u+a*s-n*f,r[2]=a*l+o*f+n*u-i*s,r[3]=o*l-n*s-i*u-a*f,r}function ow(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+o*s,r[1]=i*u+a*s,r[2]=a*u-i*s,r[3]=o*u-n*s,r}function sw(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u-a*s,r[1]=i*u+o*s,r[2]=a*u+n*s,r[3]=o*u-i*s,r}function uw(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+i*s,r[1]=i*u-n*s,r[2]=a*u+o*s,r[3]=o*u-a*s,r}function MB(r,e){var t=e[0],n=e[1],i=e[2];return r[0]=t,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-i*i)),r}function fw(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=Math.sqrt(t*t+n*n+i*i),s=Math.exp(a),u=o>0?s*Math.sin(o)/o:0;return r[0]=t*u,r[1]=n*u,r[2]=i*u,r[3]=s*Math.cos(o),r}function lw(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=Math.sqrt(t*t+n*n+i*i),s=o>0?Math.atan2(o,a)/o:0;return r[0]=t*s,r[1]=n*s,r[2]=i*s,r[3]=.5*Math.log(t*t+n*n+i*i+a*a),r}function CB(r,e,t){return lw(r,e),hw(r,r,t),fw(r,r),r}function Bc(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=t[0],f=t[1],l=t[2],c=t[3],h,d,v,p,g;return d=i*u+a*f+o*l+s*c,d<0&&(d=-d,u=-u,f=-f,l=-l,c=-c),1-d>bt?(h=Math.acos(d),v=Math.sin(h),p=Math.sin((1-n)*h)/v,g=Math.sin(n*h)/v):(p=1-n,g=n),r[0]=p*i+g*u,r[1]=p*a+g*f,r[2]=p*o+g*l,r[3]=p*s+g*c,r}function AB(r){var e=wi(),t=wi(),n=wi(),i=Math.sqrt(1-e),a=Math.sqrt(e);return r[0]=i*Math.sin(2*Math.PI*t),r[1]=i*Math.cos(2*Math.PI*t),r[2]=a*Math.sin(2*Math.PI*n),r[3]=a*Math.cos(2*Math.PI*n),r}function TB(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*t+n*n+i*i+a*a,s=o?1/o:0;return r[0]=-t*s,r[1]=-n*s,r[2]=-i*s,r[3]=a*s,r}function IB(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function cw(r,e){var t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[a*3+a]-e[o*3+o]+1),r[i]=.5*n,n=.5/n,r[3]=(e[a*3+o]-e[o*3+a])*n,r[a]=(e[a*3+i]+e[i*3+a])*n,r[o]=(e[o*3+i]+e[i*3+o])*n}return r}function kB(r,e,t,n){var i=.5*Math.PI/180;e*=i,t*=i,n*=i;var a=Math.sin(e),o=Math.cos(e),s=Math.sin(t),u=Math.cos(t),f=Math.sin(n),l=Math.cos(n);return r[0]=a*u*l-o*s*f,r[1]=o*s*l+a*u*f,r[2]=o*u*f-a*s*l,r[3]=o*u*l+a*s*f,r}function LB(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var NB=jx,OB=Ux,Dp=Xx,DB=Yx,PB=Wx,RB=aw,hw=Zx,Pp=ew,BB=tw,Rp=Np,FB=Rp,Bp=Op,GB=Bp,Fp=Jx,zB=rw,$B=nw,jB=function(){var r=Ip(),e=kp(1,0,0),t=kp(0,1,0);return function(n,i,a){var o=Lp(i,a);return o<-.999999?(Dc(r,e,i),zx(r)<1e-6&&Dc(r,t,i),Gx(r,r),iw(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Dc(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,Fp(n,n))}}(),UB=function(){var r=Rc(),e=Rc();return function(t,n,i,a,o,s){return Bc(r,n,o,s),Bc(e,i,a,s),Bc(t,r,e,2*s*(1-s)),t}}(),XB=function(){var r=xx();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],Fp(e,cw(e,r))}}();const YB=Object.freeze(Object.defineProperty({__proto__:null,add:PB,calculateW:MB,clone:NB,conjugate:IB,copy:Dp,create:Rc,dot:Pp,equals:$B,exactEquals:zB,exp:fw,fromEuler:kB,fromMat3:cw,fromValues:OB,getAngle:SB,getAxisAngle:_B,identity:EB,invert:TB,len:FB,length:Rp,lerp:BB,ln:lw,mul:RB,multiply:aw,normalize:Fp,pow:CB,random:AB,rotateX:ow,rotateY:sw,rotateZ:uw,rotationTo:jB,scale:hw,set:DB,setAxes:XB,setAxisAngle:iw,slerp:Bc,sqlerp:UB,sqrLen:GB,squaredLength:Bp,str:LB},Symbol.toStringTag,{value:"Module"}));function WB(){var r=new Zt(8);return Zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0),r[3]=1,r}function VB(r){var e=new Zt(8);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e}function HB(r,e,t,n,i,a,o,s){var u=new Zt(8);return u[0]=r,u[1]=e,u[2]=t,u[3]=n,u[4]=i,u[5]=a,u[6]=o,u[7]=s,u}function qB(r,e,t,n,i,a,o){var s=new Zt(8);s[0]=r,s[1]=e,s[2]=t,s[3]=n;var u=i*.5,f=a*.5,l=o*.5;return s[4]=u*n+f*t-l*e,s[5]=f*n+l*r-u*t,s[6]=l*n+u*e-f*r,s[7]=-u*r-f*e-l*t,s}function dw(r,e,t){var n=t[0]*.5,i=t[1]*.5,a=t[2]*.5,o=e[0],s=e[1],u=e[2],f=e[3];return r[0]=o,r[1]=s,r[2]=u,r[3]=f,r[4]=n*f+i*u-a*s,r[5]=i*f+a*o-n*u,r[6]=a*f+n*s-i*o,r[7]=-n*o-i*s-a*u,r}function ZB(r,e){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r[4]=e[0]*.5,r[5]=e[1]*.5,r[6]=e[2]*.5,r[7]=0,r}function KB(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=0,r[5]=0,r[6]=0,r[7]=0,r}function QB(r,e){var t=Rc();Tx(t,e);var n=new Zt(3);return Cx(n,e),dw(r,t,n),r}function vw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r}function JB(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r}function eF(r,e,t,n,i,a,o,s,u){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r}var tF=Dp;function rF(r,e){return r[0]=e[4],r[1]=e[5],r[2]=e[6],r[3]=e[7],r}var nF=Dp;function iF(r,e){return r[4]=e[0],r[5]=e[1],r[6]=e[2],r[7]=e[3],r}function aF(r,e){var t=e[4],n=e[5],i=e[6],a=e[7],o=-e[0],s=-e[1],u=-e[2],f=e[3];return r[0]=(t*f+a*o+n*u-i*s)*2,r[1]=(n*f+a*s+i*o-t*u)*2,r[2]=(i*f+a*u+t*s-n*o)*2,r}function oF(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0]*.5,u=t[1]*.5,f=t[2]*.5,l=e[4],c=e[5],h=e[6],d=e[7];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=o*s+i*f-a*u+l,r[5]=o*u+a*s-n*f+c,r[6]=o*f+n*u-i*s+h,r[7]=-n*s-i*u-a*f+d,r}function sF(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return ow(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function uF(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return sw(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function fF(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return uw(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function lF(r,e,t){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1],f=e[2],l=e[3];return r[0]=s*o+l*n+u*a-f*i,r[1]=u*o+l*i+f*n-s*a,r[2]=f*o+l*a+s*i-u*n,r[3]=l*o-s*n-u*i-f*a,s=e[4],u=e[5],f=e[6],l=e[7],r[4]=s*o+l*n+u*a-f*i,r[5]=u*o+l*i+f*n-s*a,r[6]=f*o+l*a+s*i-u*n,r[7]=l*o-s*n-u*i-f*a,r}function cF(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*l+o*s+i*f-a*u,r[1]=i*l+o*u+a*s-n*f,r[2]=a*l+o*f+n*u-i*s,r[3]=o*l-n*s-i*u-a*f,s=t[4],u=t[5],f=t[6],l=t[7],r[4]=n*l+o*s+i*f-a*u,r[5]=i*l+o*u+a*s-n*f,r[6]=a*l+o*f+n*u-i*s,r[7]=o*l-n*s-i*u-a*f,r}function hF(r,e,t,n){if(Math.abs(n)<bt)return vw(r,e);var i=Math.hypot(t[0],t[1],t[2]);n=n*.5;var a=Math.sin(n),o=a*t[0]/i,s=a*t[1]/i,u=a*t[2]/i,f=Math.cos(n),l=e[0],c=e[1],h=e[2],d=e[3];r[0]=l*f+d*o+c*u-h*s,r[1]=c*f+d*s+h*o-l*u,r[2]=h*f+d*u+l*s-c*o,r[3]=d*f-l*o-c*s-h*u;var v=e[4],p=e[5],g=e[6],y=e[7];return r[4]=v*f+y*o+p*u-g*s,r[5]=p*f+y*s+g*o-v*u,r[6]=g*f+y*u+v*s-p*o,r[7]=y*f-v*o-p*s-g*u,r}function dF(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r}function pw(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[4],u=t[5],f=t[6],l=t[7],c=e[4],h=e[5],d=e[6],v=e[7],p=t[0],g=t[1],y=t[2],m=t[3];return r[0]=n*m+o*p+i*y-a*g,r[1]=i*m+o*g+a*p-n*y,r[2]=a*m+o*y+n*g-i*p,r[3]=o*m-n*p-i*g-a*y,r[4]=n*l+o*s+i*f-a*u+c*m+v*p+h*y-d*g,r[5]=i*l+o*u+a*s-n*f+h*m+v*g+d*p-c*y,r[6]=a*l+o*f+n*u-i*s+d*m+v*y+c*g-h*p,r[7]=o*l-n*s-i*u-a*f+v*m-c*p-h*g-d*y,r}var vF=pw;function pF(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r}var gw=Pp;function gF(r,e,t,n){var i=1-n;return gw(e,t)<0&&(n=-n),r[0]=e[0]*i+t[0]*n,r[1]=e[1]*i+t[1]*n,r[2]=e[2]*i+t[2]*n,r[3]=e[3]*i+t[3]*n,r[4]=e[4]*i+t[4]*n,r[5]=e[5]*i+t[5]*n,r[6]=e[6]*i+t[6]*n,r[7]=e[7]*i+t[7]*n,r}function yF(r,e){var t=Fc(e);return r[0]=-e[0]/t,r[1]=-e[1]/t,r[2]=-e[2]/t,r[3]=e[3]/t,r[4]=-e[4]/t,r[5]=-e[5]/t,r[6]=-e[6]/t,r[7]=e[7]/t,r}function mF(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=e[7],r}var yw=Rp,bF=yw,Fc=Bp,xF=Fc;function wF(r,e){var t=Fc(e);if(t>0){t=Math.sqrt(t);var n=e[0]/t,i=e[1]/t,a=e[2]/t,o=e[3]/t,s=e[4],u=e[5],f=e[6],l=e[7],c=n*s+i*u+a*f+o*l;r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=(s-n*c)/t,r[5]=(u-i*c)/t,r[6]=(f-a*c)/t,r[7]=(l-o*c)/t}return r}function EF(r){return"quat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+")"}function _F(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]}function SF(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=e[0],c=e[1],h=e[2],d=e[3],v=e[4],p=e[5],g=e[6],y=e[7];return Math.abs(t-l)<=bt*Math.max(1,Math.abs(t),Math.abs(l))&&Math.abs(n-c)<=bt*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=bt*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-d)<=bt*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-v)<=bt*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(s-p)<=bt*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-g)<=bt*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(f-y)<=bt*Math.max(1,Math.abs(f),Math.abs(y))}const MF=Object.freeze(Object.defineProperty({__proto__:null,add:dF,clone:VB,conjugate:mF,copy:vw,create:WB,dot:gw,equals:SF,exactEquals:_F,fromMat4:QB,fromRotation:KB,fromRotationTranslation:dw,fromRotationTranslationValues:qB,fromTranslation:ZB,fromValues:HB,getDual:rF,getReal:tF,getTranslation:aF,identity:JB,invert:yF,len:bF,length:yw,lerp:gF,mul:vF,multiply:pw,normalize:wF,rotateAroundAxis:hF,rotateByQuatAppend:lF,rotateByQuatPrepend:cF,rotateX:sF,rotateY:uF,rotateZ:fF,scale:pF,set:eF,setDual:iF,setReal:nF,sqrLen:xF,squaredLength:Fc,str:EF,translate:oF},Symbol.toStringTag,{value:"Module"}));function mw(){var r=new Zt(2);return Zt!=Float32Array&&(r[0]=0,r[1]=0),r}function CF(r){var e=new Zt(2);return e[0]=r[0],e[1]=r[1],e}function AF(r,e){var t=new Zt(2);return t[0]=r,t[1]=e,t}function TF(r,e){return r[0]=e[0],r[1]=e[1],r}function IF(r,e,t){return r[0]=e,r[1]=t,r}function ln(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function bw(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function xw(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}function ww(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}function kF(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}function LF(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}function Ja(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function eo(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function NF(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}function Sn(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function OF(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r}function Gc(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.hypot(t,n)}function Ew(r,e){var t=e[0]-r[0],n=e[1]-r[1];return t*t+n*n}function _w(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function Sw(r){var e=r[0],t=r[1];return e*e+t*t}function DF(r,e){return r[0]=-e[0],r[1]=-e[1],r}function PF(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}function to(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r}function Gp(r,e){return r[0]*e[0]+r[1]*e[1]}function RF(r,e,t){var n=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=n,r}function BF(r,e,t,n){var i=e[0],a=e[1];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r}function FF(r,e){e=e||1;var t=wi()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}function GF(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r}function zF(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i+t[4],r[1]=t[1]*n+t[3]*i+t[5],r}function $F(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[3]*i+t[6],r[1]=t[1]*n+t[4]*i+t[7],r}function jF(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r}function UF(r,e,t,n){var i=e[0]-t[0],a=e[1]-t[1],o=Math.sin(n),s=Math.cos(n);return r[0]=i*s-a*o+t[0],r[1]=i*o+a*s+t[1],r}function Mw(r,e){var t=r[0],n=r[1],i=e[0],a=e[1],o=Math.sqrt(t*t+n*n)*Math.sqrt(i*i+a*a),s=o&&(t*i+n*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function XF(r){return r[0]=0,r[1]=0,r}function YF(r){return"vec2("+r[0]+", "+r[1]+")"}function zp(r,e){return r[0]===e[0]&&r[1]===e[1]}function WF(r,e){var t=r[0],n=r[1],i=e[0],a=e[1];return Math.abs(t-i)<=bt*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(n-a)<=bt*Math.max(1,Math.abs(n),Math.abs(a))}var VF=_w,zc=bw,HF=xw,qF=ww,ZF=Gc,KF=Ew,QF=Sw,JF=function(){var r=mw();return function(e,t,n,i,a,o){var s,u;for(t||(t=2),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],a(r,r,o),e[s]=r[0],e[s+1]=r[1];return e}}();const e4=Object.freeze(Object.defineProperty({__proto__:null,glMatrix:u3,mat2:O3,mat2d:n5,mat3:Ex,mat4:yR,quat:YB,quat2:MF,vec2:Object.freeze(Object.defineProperty({__proto__:null,add:ln,angle:Mw,ceil:kF,clone:CF,copy:TF,create:mw,cross:RF,dist:ZF,distance:Gc,div:qF,divide:ww,dot:Gp,equals:WF,exactEquals:zp,floor:LF,forEach:JF,fromValues:AF,inverse:PF,len:VF,length:_w,lerp:BF,max:eo,min:Ja,mul:HF,multiply:xw,negate:DF,normalize:to,random:FF,rotate:UF,round:NF,scale:Sn,scaleAndAdd:OF,set:IF,sqrDist:KF,sqrLen:QF,squaredDistance:Ew,squaredLength:Sw,str:YF,sub:zc,subtract:bw,transformMat2:GF,transformMat2d:zF,transformMat3:$F,transformMat4:jF,zero:XF},Symbol.toStringTag,{value:"Module"})),vec3:QR,vec4:wB},Symbol.toStringTag,{value:"Module"}));function t4(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Cp(n,t),Wi(r,n,e)}function r4(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Ap(n,t),Wi(r,n,e)}function n4(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Tp(n,t),Wi(r,n,e)}function i4(r,e,t){return Wi(r,t,e)}function ni(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":t4(t,t,[a[1],a[2]]);break;case"s":n4(t,t,[a[1],a[2]]);break;case"r":r4(t,t,a[1]);break;case"m":i4(t,t,a[1]);break}}return t}var $o=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];a.push(f)}),i&&i.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];!l&&l!==0||!c&&c!==0||(a[l][c]=1,t||(a[c][l]=1))}),a},a4=function(e,t){return e===t},Cw=function(){function r(e,t){t===void 0&&(t=null),this.value=e,this.next=t}return r.prototype.toString=function(e){return e?e(this.value):"".concat(this.value)},r}(),Aw=function(){function r(e){e===void 0&&(e=a4),this.head=null,this.tail=null,this.compare=e}return r.prototype.prepend=function(e){var t=new Cw(e,this.head);return this.head=t,this.tail||(this.tail=t),this},r.prototype.append=function(e){var t=new Cw(e);return this.head?(this.tail.next=t,this.tail=t,this):(this.head=t,this.tail=t,this)},r.prototype.delete=function(e){if(!this.head)return null;for(var t=null;this.head&&this.compare(this.head.value,e);)t=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(t=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),t},r.prototype.find=function(e){var t=e.value,n=t===void 0?void 0:t,i=e.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var o=this.head;o;){if(a&&a(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},r.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var t=this.head;t.next;)t.next.next?t=t.next:t.next=null;return this.tail=t,e},r.prototype.deleteHead=function(){if(!this.head)return null;var e=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),e},r.prototype.fromArray=function(e){var t=this;return e.forEach(function(n){return t.append(n)}),this},r.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},r.prototype.reverse=function(){for(var e=this.head,t=null,n=null;e;)n=e.next,e.next=t,t=e,e=n;this.tail=this.head,this.head=t},r.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(t){return t.toString(e)}).toString()},r}(),o4=function(){function r(){this.linkedList=new Aw}return r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},r.prototype.enqueue=function(e){this.linkedList.append(e)},r.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toString=function(e){return this.linkedList.toString(e)},r}(),Wn=function(e,t,n){t===void 0&&(t=[]);var i=t.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var a=function(f){return f.source===e};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===e};return i.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===e?f.target:f.source};return i.map(s)},s4=function(e,t){return t.filter(function(n){return n.source===e})},$c=function(e,t){return t.filter(function(n){return n.source===e||n.target===e})},Tw=function(e){e===void 0&&(e=0);var t="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(e,"-").concat(t).concat(n)};function u4(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}var Iw=function(e,t,n,i){i===void 0&&(i=!0);var a=u4(n),o=new o4,s=e.edges,u=s===void 0?[]:s;o.enqueue(t);for(var f="",l=function(){var h=o.dequeue();a.enter({current:h,previous:f}),Wn(h,u,i?"target":void 0).forEach(function(d){a.allowTraversal({previous:f,current:h,next:d})&&o.enqueue(d)}),a.leave({current:h,previous:f}),f=h};!o.isEmpty();)l()},f4=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=Wn(v.id,a),g=function(b){var x=p[b];if(!s[x]){var w=n.filter(function(E){return E.id===x});w.length>0&&d(w[0])}},y=0;y<p.length;++y)g(y)},l=0;l<n.length;l++){var c=n[l];if(!s[c.id]){f(c);for(var h=[];u.length>0;)h.push(u.pop());o.push(h)}}return o},kw=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u={},f={},l=[],c=0,h=function g(y){u[y.id]=c,f[y.id]=c,c+=1,o.push(y),s[y.id]=!0;for(var m=Wn(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x<m.length;x++)b(x);if(f[y.id]===u[y.id]){for(var w=[];o.length>0;){var E=o.pop();if(s[E.id]=!1,w.push(E),E===y)break}w.length>0&&l.push(w)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};function $p(r,e){return e?kw(r):f4(r)}var _a=function(e){var t={},n=e.nodes,i=n===void 0?[]:n,a=e.edges,o=a===void 0?[]:a;return i.forEach(function(s){t[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){t[s.source].degree++,t[s.source].outDegree++,t[s.target].degree++,t[s.target].inDegree++}),t},Lw=function(e,t){var n=_a(e);return n[t]?_a(e)[t].inDegree:0},Nw=function(e,t){var n=_a(e);return n[t]?_a(e)[t].outDegree:0};function l4(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}function Ow(r,e,t,n,i){i===void 0&&(i=!0),n.enter({current:e,previous:t});var a=r.edges,o=a===void 0?[]:a;Wn(e,o,i?"target":void 0).forEach(function(s){n.allowTraversal({previous:t,current:e,next:s})&&Ow(r,s,e,n,i)}),n.leave({current:e,previous:t})}function jp(r,e,t,n){n===void 0&&(n=!0),Ow(r,e,"",l4(t),n)}var Up=function(e){var t=null,n=e.nodes,i=n===void 0?[]:n,a={},o={},s={},u={};i.forEach(function(c){o[c.id]=c});for(var f={enter:function(h){var d=h.current,v=h.previous;if(s[d]){t={};for(var p=d,g=v;g!==d;)t[p]=g,p=g,g=a[g];t[p]=g}else s[d]=d,delete o[d],a[d]=v},leave:function(h){var d=h.current;u[d]=d,delete s[d]},allowTraversal:function(h){var d=h.next;return t?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];jp(e,l,f)}return t},Xp=function(e,t,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=$p(e,!1),u=0,f=s;u<f.length;u++){var l=f[u];if(l.length)for(var c=l[0],h=c.id,d=[c],v=(i={},i[h]=c,i),p=(a={},a[h]=new Set,a);d.length>0;)for(var g=d.pop(),y=g.id,m=Wn(y,e.edges),b=function(E){var _,M=m[E],C=e.nodes.find(function(G){return G.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),t&&n?(S=!1,A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!0)):t&&!n&&A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!1),S){for(var k={},O=1;O<A.length;O+=1)k[A[O-1].id]=A[O];A.length&&(k[A[A.length-1].id]=A[0]),o.push(k)}p[M].add(g)}},x=0;x<m.length;x+=1)b(x)}return o},Yp=function(e,t,n){n===void 0&&(n=!0);for(var i=[],a=new Set,o=[],s=[],u={},f={},l=function(T){for(var k=[T];k.length>0;){var O=k.pop();a.has(O)&&(a.delete(O),o[O.id].forEach(function(G){k.push(G)}),o[O.id].clear())}},c=function A(T,k,O){var G=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return G;i.push(T),a.add(T);for(var D=O[T.id],$=0;$<D.length;$+=1){var Y=u[D[$]];if(Y===k){for(var N={},P=1;P<i.length;P+=1)N[i[P-1].id]=i[P];i.length&&(N[i[i.length-1].id]=i[0]),s.push(N),G=!0}else a.has(Y)||A(Y,k,O)&&(G=!0)}if(G)l(T);else for(var $=0;$<D.length;$+=1){var Y=u[D[$]];o[Y.id].has(T)||o[Y.id].add(T)}return i.pop(),G},h=e.nodes,d=h===void 0?[]:h,v=0;v<d.length;v+=1){var p=d[v],g=p.id;f[g]=v,u[v]=p}if(t&&n)for(var y=function(T){var k=t[T];f[d[T].id]=f[k],f[k]=0,u[0]=d.find(function(O){return O.id===k}),u[f[d[T].id]]=d[T]},v=0;v<t.length;v++)y(v);for(var m=function(T){for(var k,O,G=1/0,D=0;D<T.length;D+=1)for(var $=T[D],Y=0;Y<$.length;Y++){var N=f[$[Y].id];N<G&&(G=N,O=D)}for(var P=T[O],W=[],D=0;D<P.length;D+=1){var J=P[D];W[J.id]=[];for(var te=0,H=Wn(J.id,e.edges,"target").filter(function(Ne){return P.map(function(Ze){return Ze.id}).indexOf(Ne)>-1});te<H.length;te++){var pe=H[te];pe===J.id&&!(n===!1&&t.indexOf(J.id)>-1)?s.push((k={},k[J.id]=J,k)):W[J.id].push(f[pe])}}return{component:P,adjList:W,minIdx:G}},b=0;b<d.length;){var x=d.filter(function(A){return f[A.id]>=b}),w=kw({nodes:x,edges:e.edges}).filter(function(A){return A.length>1});if(w.length===0)break;var E=m(w),_=E.minIdx,M=E.adjList,C=E.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(t&&n&&t.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s},Dw=function(e,t,n,i){return i===void 0&&(i=!0),t?Yp(e,n,i):Xp(e,n,i)},c4=function(e,t,n){for(var i=1/0,a,o=0;o<t.length;o++){var s=t[o].id;!n[s]&&e[s]<=i&&(i=e[s],a=t[o])}return a},cf=function(e,t,n,i){var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var x=m.id;l[x]=1/0,x===t&&(l[x]=0)});for(var h=o.length,d=function(b){var x=c4(l,o,f),w=x.id;if(f[w]=!0,l[w]===1/0)return"continue";var E=[];n?E=s4(w,u):E=$c(w,u),E.forEach(function(_){var M=_.target,C=_.source,S=M===w?C:M,A=i&&_[i]?_[i]:1;l[S]>l[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.id)})},v=0;v<h;v++)d();c[t]=[t];var p={};for(var g in l)l[g]!==1/0&&Pw(t,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}};function Pw(r,e,t,n){if(r===e)return[r];if(n[e])return n[e];for(var i=[],a=0,o=t[e];a<o.length;a++){var s=o[a],u=Pw(r,s,t,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];vt(c)?i.push(Yn(Yn([],c,!0),[e],!1)):i.push([c,e])}}return n[e]=i,n[e]}var Rw=function(e,t,n,i,a){var o=cf(e,t,i,a),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}},Bw=function(e,t,n,i){var a;if(t===n)return[[t]];var o=e.edges,s=o===void 0?[]:o,u=[t],f=(a={},a[t]=!0,a),l=[],c=[],h=i?Wn(t,s,"target"):Wn(t,s);for(l.push(h);u.length>0&&l.length>0;){var d=l[l.length-1];if(d.length){var v=d.shift();v&&(u.push(v),f[v]=!0,h=i?Wn(v,s,"target"):Wn(v,s),l.push(h.filter(function(y){return!f[y]})))}else{var p=u.pop();f[p]=!1,l.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});c.push(g);var p=u.pop();f[p]=!1,l.pop()}}return c},hf=function(e,t){for(var n=$o(e,t),i=[],a=n.length,o=0;o<a;o+=1){i[o]=[];for(var s=0;s<a;s+=1)o===s?i[o][s]=0:n[o][s]===0||!n[o][s]?i[o][s]=1/0:i[o][s]=n[o][s]}for(var u=0;u<a;u+=1)for(var o=0;o<a;o+=1)for(var s=0;s<a;s+=1)i[o][s]>i[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},Fw=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var w=Tw();b.clusterId=w,f[w]={id:w,nodes:[b]},l[b.id]={node:b,idx:x}});var c=$o(e,t),h={};c.forEach(function(b,x){var w=o[x].id;h[w]={},b.forEach(function(E,_){if(E){var M=o[_].id;h[w][M]=E}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(w){var E={};Object.keys(h[w.id]).forEach(function(O){var G=h[w.id][O],D=l[O].node,$=D.clusterId;E[$]||(E[$]=0),E[$]+=G});var _=-1/0,M=[];if(Object.keys(E).forEach(function(O){_<E[O]?(_=E[O],M=[O]):_===E[O]&&M.push(O)}),!(M.length===1&&M[0]===w.clusterId)){var C=M.indexOf(w.clusterId);if(C>=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[w.clusterId],A=S.nodes.indexOf(w);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),k=f[M[T]];k.nodes.push(w),w.clusterId=k.id}}}),!x)return"break";d++};d<i;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var x=f[b];(!x.nodes||!x.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var x=b.source,w=b.target,E=b[n]||1,_=l[x].node.clusterId,M=l[w].node.clusterId,C="".concat(_,"---").concat(M);if(y[C])y[C].weight+=E,y[C].count++;else{var S={source:_,target:M,weight:E,count:1};y[C]=S,g.push(S)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},ii=function(){function r(e){this.arr=e}return r.prototype.getArr=function(){return this.arr||[]},r.prototype.add=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]+n[a];return new r(i)}},r.prototype.subtract=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]-n[a];return new r(i)}},r.prototype.avg=function(e){var t=[];if(e!==0)for(var n in this.arr)t[n]=this.arr[n]/e;return new r(t)},r.prototype.negate=function(){var e=[];for(var t in this.arr)e[t]=-this.arr[t];return new r(e)},r.prototype.squareEuclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return i}},r.prototype.euclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return Math.sqrt(i)}else console.error("The two vectors are unequal in length.")},r.prototype.normalize=function(){var e=[],t=Vt(this.arr);t.sort(function(o,s){return o-s});var n=t[t.length-1],i=t[0];for(var a in this.arr)e[a]=(this.arr[a]-i)/(n-i);return new r(e)},r.prototype.norm2=function(){var e;if(!(!((e=this.arr)===null||e===void 0)&&e.length))return 0;var t=0;for(var n in this.arr)t+=Math.pow(this.arr[n],2);return Math.sqrt(t)},r.prototype.dot=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=this.arr[a]*e.arr[a];return i}else console.error("The two vectors are unequal in length.")},r.prototype.equal=function(e){var t,n=e.arr;if(((t=this.arr)===null||t===void 0?void 0:t.length)!==(n==null?void 0:n.length))return!1;for(var i in this.arr)if(this.arr[i]!==n[i])return!1;return!0},r}(),Wp=function(e,t){t===void 0&&(t=void 0);var n=[];return e.forEach(function(i){t===void 0&&n.push(i),i[t]!==void 0&&n.push(i[t])}),n},Ei;(function(r){r.EuclideanDistance="euclideanDistance"})(Ei||(Ei={}));var h4=function(e,t,n){var i=[];t!=null&&t.length?i=t:(e.forEach(function(o){i=i.concat(Object.keys(o))}),i=af(i));var a={};return i.forEach(function(o){var s=[];e.forEach(function(u){u[o]!==void 0&&u[o]!==""&&s.push(u[o])}),s.length&&!(n!=null&&n.includes(o))&&(a[o]=af(s))}),a},Vp=function(e,t,n){var i=h4(e,t,n),a=[];if(!Object.keys(i).length)return a;var o=Object.values(i),s=o.every(function(u){return u.every(function(f){return typeof f=="number"})});return e.forEach(function(u,f){var l=[];Object.keys(i).forEach(function(c){var h=u[c],d=i[c],v=d.findIndex(function(y){return h===y}),p=[];if(s)p.push(h);else for(var g=0;g<d.length;g++)g===v?p.push(1):p.push(0);l=l.concat(p)}),a[f]=l}),a},Gw=function(e,t,n,i){n===void 0&&(n=Ei.EuclideanDistance);var a=0;switch(n){case Ei.EuclideanDistance:a=new ii(e).euclideanDistance(new ii(t));break}return a},zw=function(e,t,n,i){for(var a=t.length,o=2*i,s=0,u=0;u<a;u++)for(var f=e[u].clusterId,l=0;l<a;l++){var c=e[l].clusterId;if(f===c){var h=t[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},Hp=function(e,t){e===void 0&&(e=[]);for(var n=e.length,i=new ii([]),a=0;a<n;a++)i=i.add(new ii(t[a]));var o=i.avg(n);o.normalize();for(var s=0,a=0;a<n;a++){var u=new ii(t[a]),f=u.squareEuclideanDistance(o);s+=f}var l=[];e.forEach(function(){l.push([])});for(var a=0;a<n;a++){var u=new ii(t[a]);e[a].clusterInertial=0;for(var c=0;c<n;c++){if(a===c){l[a][c]=0;continue}var h=new ii(t[c]);l[a][c]=u.squareEuclideanDistance(h),e[a].clusterInertial+=l[a][c]}}for(var d=0,v=2*n*s,a=0;a<n;a++)for(var p=e[a].clusterId,c=0;c<n;c++){var g=e[c].clusterId;if(!(a===c||p!==g)){var y=e[a].clusterInertial*e[c].clusterInertial/Math.pow(v,2)-l[a][c]/v;d+=y}}return Number(d.toFixed(4))},qp=function(e,t,n,i,a,o,s,u,f){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=!1),o===void 0&&(o=void 0),s===void 0&&(s=[]),u===void 0&&(u=["id"]),f===void 0&&(f=1);var l=e.nodes,c=l===void 0?[]:l,h=e.edges,d=h===void 0?[]:h,v=[];if(a){c.forEach(function(N,P){N.properties=N.properties||{},N.originIndex=P});var p=[];c.every(function(N){return N.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(N){return N.nodeType}))),c.forEach(function(N){N.properties.nodeType=p.findIndex(function(P){return P===N.nodeType})}));var g=Wp(c,o);v=Vp(g,s,u)}var y=1,m={},b={};c.forEach(function(N,P){var W=String(y++);N.clusterId=W,m[W]={id:W,nodes:[N]},b[N.id]={node:N,idx:P}});var x=$o(e,t),w=[],E={},_=0;x.forEach(function(N,P){var W=0,J=c[P].id;E[J]={},N.forEach(function(te,H){if(te){W+=te;var pe=c[H].id;E[J][pe]=te,_+=te}}),w.push(W)}),_/=2;for(var M=1/0,C=1/0,S=0,A=[],T={};;){a&&c.every(function(N){return N.hasOwnProperty("properties")})?M=zw(c,x,w,_)+Hp(c,v)*f:M=zw(c,x,w,_),S===0&&(C=M,A=c,T=m);var k=M>0&&M>C&&M-C<i;if(M>C&&(A=c.map(function(N){return{node:N,clusterId:N.clusterId}}),T=Vt(m),C=M),k||S>100)break;S++,Object.keys(m).forEach(function(N){var P=0;d.forEach(function(W){var J=W.source,te=W.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===N&&pe!==N||pe===N&&H!==N)&&(P=P+(W[n]||1))}),m[N].sumTot=P}),c.forEach(function(N,P){var W=m[N.clusterId],J=0,te,H=w[P]/(2*_),pe=0,Te=W.nodes;Te.forEach(function(Wt){var dr=b[Wt.id].idx;pe+=x[P][dr]||0});var Ne=pe-W.sumTot*H,Ze=Te.filter(function(Wt){return Wt.id!==N.id});Ze.forEach(function(Wt,dr){v[Wt.originIndex]});var at=Hp(Ze,v)*f,nt=E[N.id];if(Object.keys(nt).forEach(function(Wt){var dr=b[Wt].node,lr=dr.clusterId;if(lr!==N.clusterId){var Ut=m[lr],ar=Ut.nodes;if(!(!ar||!ar.length)){var Zr=0;ar.forEach(function(Ge){var me=b[Ge.id].idx;Zr+=x[P][me]||0});var tt=Zr-Ut.sumTot*H,ae=ar.concat([N]);ae.forEach(function(Ge,me){v[Ge.originIndex]});var L=Hp(ae,v)*f,Se=tt-Ne;a&&(Se=tt+L-(Ne+at)),Se>J&&(J=Se,te=Ut)}}}),J>0){te.nodes.push(N);var St=N.clusterId;N.clusterId=te.id;var Mt=W.nodes.indexOf(N);W.nodes.splice(Mt,1);var fr=0,Ft=0;d.forEach(function(Wt){var dr=Wt.source,lr=Wt.target,Ut=b[dr].node.clusterId,ar=b[lr].node.clusterId;(Ut===te.id&&ar!==te.id||ar===te.id&&Ut!==te.id)&&(fr=fr+(Wt[n]||1)),(Ut===St&&ar!==St||ar===St&&Ut!==St)&&(Ft=Ft+(Wt[n]||1))}),te.sumTot=fr,W.sumTot=Ft}})}var O={},G=0;Object.keys(T).forEach(function(N){var P=T[N];if(!P.nodes||!P.nodes.length){delete T[N];return}var W=String(G+1);W!==N&&(P.id=W,P.nodes=P.nodes.map(function(J){return{id:J.id,clusterId:W}}),T[W]=P,O[N]=W,delete T[N],G++)}),A.forEach(function(N){var P=N.node,W=N.clusterId;P&&(P.clusterId=W,P.clusterId&&O[P.clusterId]&&(P.clusterId=O[P.clusterId]))});var D=[],$={};d.forEach(function(N){var P=N.source,W=N.target,J=N[n]||1,te=b[P].node.clusterId,H=b[W].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if($[pe])$[pe].weight+=J,$[pe].count++;else{var Te={source:te,target:H,weight:J,count:1};$[pe]=Te,D.push(Te)}}});var Y=[];return Object.keys(T).forEach(function(N){Y.push(T[N])}),{clusters:Y,clusterEdges:D}},$w=function(e,t,n,i,a,o,s,u){return t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=void 0),o===void 0&&(o=[]),s===void 0&&(s=["id"]),u===void 0&&(u=1),qp(e,t,n,i,!0,a,o,s,u)},jw=function(e,t){var n;t===void 0&&(t=1);for(var i=Vt(e),a=i.nodes,o=a===void 0?[]:a,s=i.edges,u=s===void 0?[]:s,f=function(){var h=_a({nodes:o,edges:u}),d=Object.keys(h);d.sort(function(g,y){var m,b;return((m=h[g])===null||m===void 0?void 0:m.degree)-((b=h[y])===null||b===void 0?void 0:b.degree)});var v=d[0];if(!o.length||((n=h[v])===null||n===void 0?void 0:n.degree)>=t)return"break";var p=o.findIndex(function(g){return g.id===v});o.splice(p,1),u=u.filter(function(g){return!(g.source===v||g.target===v)})};;){var l=f();if(l==="break")break}return{nodes:o,edges:u}},Uw=function(e,t,n){var i=[];switch(e){case Ei.EuclideanDistance:i=t[n];break;default:i=[];break}return i},Xw=function(e,t,n,i,a,o){t===void 0&&(t=3),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=["id"]),o===void 0&&(o=Ei.EuclideanDistance);var s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c={clusters:[{id:"0",nodes:u}],clusterEdges:[]};if(o===Ei.EuclideanDistance&&!u.every(function(W){return W.hasOwnProperty(n)}))return c;var h=[],d=[];if(o===Ei.EuclideanDistance&&(h=Wp(u,n),d=Vp(h,i,a)),!d.length)return c;for(var v=af(d.map(function(W){return W.join("")})),p=Math.min(t,u.length,v.length),g=0;g<u.length;g++)u[g].originIndex=g;for(var y=[],m=[],b=[],g=0;g<p;g++)if(g===0){var x=Math.floor(Math.random()*u.length);switch(o){case Ei.EuclideanDistance:y[g]=d[x];break;default:y[g]=[];break}m.push(x),b[g]=[u[x]],u[x].clusterId=String(g)}else{for(var w=-1/0,E=0,_=function(te){if(!m.includes(te)){for(var H=0,pe=0;pe<y.length;pe++){var Te=0;switch(o){case Ei.EuclideanDistance:Te=Gw(d[u[te].originIndex],y[pe],o);break}H+=Te}var Ne=H/y.length;Ne>w&&!y.find(function(Ze){return Qa(Ze,Uw(o,d,u[te].originIndex))})&&(w=Ne,E=te)}},M=0;M<u.length;M++)_(M);y[g]=Uw(o,d,E),m.push(E),b[g]=[u[E]],u[E].clusterId=String(g)}for(var C=0;;){for(var g=0;g<u.length;g++){var S=0,A=1/0;if(!(C===0&&m.includes(g))){for(var T=0;T<y.length;T++){var k=0;switch(o){case Ei.EuclideanDistance:k=Gw(d[g],y[T],o);break}k<A&&(A=k,S=T)}if(u[g].clusterId!==void 0)for(var O=b[Number(u[g].clusterId)].length-1;O>=0;O--)b[Number(u[g].clusterId)][O].id===u[g].id&&b[Number(u[g].clusterId)].splice(O,1);u[g].clusterId=String(S),b[S].push(u[g])}}for(var G=!1,g=0;g<b.length;g++){for(var D=b[g],$=new ii([]),T=0;T<D.length;T++)$=$.add(new ii(d[D[T].originIndex]));var Y=$.avg(D.length);Y.equal(new ii(y[g]))||(G=!0,y[g]=Y.getArr())}if(C++,u.every(function(W){return W.clusterId!==void 0})&&G||C>=1e3)break}var N=[],P={};return l.forEach(function(W){var J,te,H=W.source,pe=W.target,Te=(J=u.find(function(nt){return nt.id===H}))===null||J===void 0?void 0:J.clusterId,Ne=(te=u.find(function(nt){return nt.id===pe}))===null||te===void 0?void 0:te.clusterId,Ze="".concat(Te,"---").concat(Ne);if(P[Ze])P[Ze].count++;else{var at={source:Te,target:Ne,count:1};P[Ze]=at,N.push(at)}}),{clusters:b,clusterEdges:N}},Zp=function(e,t){var n=new ii(t),i=n.norm2(),a=new ii(e),o=a.norm2(),s=n.dot(a),u=i*o,f=u?s/u:0;return f},Yw=function(e,t,n,i,a){e===void 0&&(e=[]),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=[]);var o=Vt(e.filter(function(h){return h.id!==t.id})),s=e.findIndex(function(h){return h.id===t.id}),u=Wp(e,n),f=Vp(u,i,a),l=f[s],c=[];return o.forEach(function(h,d){if(h.id!==t.id){var v=f[d],p=Zp(v,l);c.push(p),h.cosineSimilarity=p}}),o.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:o}},d4=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t<n.length;t++){var i=n[t];this.parent[i]=i}}return r.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},r.prototype.union=function(e,t){var n=this.find(e),i=this.find(t);n!==i&&(n<i?(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]))},r.prototype.connected=function(e,t){return this.find(e)===this.find(t)},r}(),v4=function(e,t){return e-t},p4=function(){function r(e){e===void 0&&(e=v4),this.compareFn=e,this.list=[]}return r.prototype.getLeft=function(e){return 2*e+1},r.prototype.getRight=function(e){return 2*e+2},r.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},r.prototype.isEmpty=function(){return this.list.length<=0},r.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},r.prototype.delMin=function(){var e=this.top(),t=this.list.pop();return this.list.length>0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0?n=i:a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),g4=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],f=new Set;f.add(u);var l=function(g,y){return t?g.weight-y.weight:0},c=new p4(l);for($c(u.id,s).forEach(function(p){c.insert(p)});!c.isEmpty();){var h=c.delMin(),d=h.source,v=h.target;f.has(d)&&f.has(v)||(n.push(h),f.has(d)||(f.add(d),$c(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),$c(v,s).forEach(function(p){c.insert(p)})))}return n},Ww=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});t&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new d4(a.map(function(d){return d.id}));u.length>0;){var l=u.shift(),c=l.source,h=l.target;f.connected(c,h)||(n.push(l),f.union(c,h))}return n},Vw=function(e,t,n){var i={prim:g4,kruskal:Ww};return n?i[n](e,t):Ww(e,t)},Hw=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c=u.length,h,d={},v={},p=0;p<c;++p){var g=u[p],y=g.id;d[y]=1/c,v[y]=1/c}for(var m=_a(e);o>0&&i>t;){a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;if(h=0,m[g.id].inDegree===0)d[y]=0;else{for(var b=Wn(y,l,"source"),x=0;x<b.length;++x){var w=b[x],E=m[w].outDegree;E>0&&(h+=v[w]/E)}d[y]=n*h,a+=d[y]}}a=(1-a)/c,i=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;h=d[y]+a,i+=Math.abs(h-v[y]),v[y]=h}o-=1}return v},y4=-1,jc=-1,qw="-1",Vi="-1",Zw=-1,Kw=function(){function r(e,t,n,i){e===void 0&&(e=y4),t===void 0&&(t=jc),n===void 0&&(n=jc),i===void 0&&(i=qw),this.id=e,this.from=t,this.to=n,this.label=i}return r}(),m4=function(){function r(e,t){e===void 0&&(e=jc),t===void 0&&(t=Vi),this.id=e,this.label=t,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},r}(),Qw=function(){function r(e,t,n){e===void 0&&(e=jc),t===void 0&&(t=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=t,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return r.prototype.getNodeNum=function(){return this.nodes.length},r.prototype.addNode=function(e,t){if(!this.nodeMap[e]){var n=new m4(e,t);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[t]||(this.nodeLabelMap[t]=[]),this.nodeLabelMap[t].push(e)}},r.prototype.addEdge=function(e,t,n,i){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[t]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var a=new Kw(e,t,n,i);if(this.edges.push(a),this.edgeMap[e]=a,this.nodeMap[t].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new Kw(e,n,t,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}(),jo=function(){function r(e,t,n,i,a){this.fromNode=e,this.toNode=t,this.nodeEdgeNodeLabel={nodeLabel1:n||Vi,edgeLabel:i||qw,nodeLabel2:a||Vi}}return r.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r}(),Jw=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(e){var t=this.dfsEdgeList.length,n=e.length;if(t!==n)return!1;for(var i=0;i<t;i++)if(this.dfsEdgeList[i]!==e[i])return!1;return!0},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r.prototype.pushBack=function(e,t,n,i,a){return this.dfsEdgeList.push(new jo(e,t,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(e,t){e===void 0&&(e=Zw),t===void 0&&(t=!1);var n=new Qw(e,!0,t);return this.dfsEdgeList.forEach(function(i){var a=i.fromNode,o=i.toNode,s=i.nodeEdgeNodeLabel,u=s.nodeLabel1,f=s.edgeLabel,l=s.nodeLabel2;u!==Vi&&n.addNode(a,u),l!==Vi&&n.addNode(o,l),u!==Vi&&l!==u&&n.addEdge(void 0,a,o,f)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,t=this.dfsEdgeList.length,n=t-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=a)}return this.rmpath},r.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(t){e[t.fromNode]||(e[t.fromNode]=!0),e[t.toNode]||(e[t.toNode]=!0)}),Object.keys(e).length},r}(),Uc=function(){function r(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var t=e.edge;this.edges.push(t),this.nodesUsed[t.from]=1,this.nodesUsed[t.to]=1,this.edgesUsed[t.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},r.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},r}(),b4=function(){function r(e){var t=e.graphs,n=e.minSupport,i=n===void 0?2:n,a=e.minNodeNum,o=a===void 0?1:a,s=e.maxNodeNum,u=s===void 0?4:s,f=e.top,l=f===void 0?10:f,c=e.directed,h=c===void 0?!1:c,d=e.verbose,v=d===void 0?!1:d;this.graphs=t,this.dfsCode=new Jw,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=i,this.top=l,this.directed=h,this.counter=0,this.maxNodeNum=u,this.minNodeNum=o,this.verbose=v,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return r.prototype.findForwardRootEdges=function(e,t){var n=this,i=[],a=e.nodeMap;return t.edges.forEach(function(o){(n.directed||t.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(e,t,n,i){if(!this.directed&&t===n)return null;for(var a=e.nodeMap,o=a[n.to],s=o.edges,u=s.length,f=0;f<u;f++){var l=s[f];if(!(i.hasEdge(l)||l.to!==t.from)){if(this.directed){if(a[t.from].label<a[n.to].label||a[t.from].label===a[n.to].label&&t.label<=l.label)return l}else if(t.label<l.label||t.label===l.label&&a[t.to].label<=a[n.to].label)return l}}return null},r.prototype.findForwardPureEdges=function(e,t,n,i){for(var a=[],o=t.to,s=e.nodeMap[o].edges,u=s.length,f=0;f<u;f++){var l=s[f],c=e.nodeMap[l.to];n<=c.label&&!i.hasNode(c)&&a.push(l)}return a},r.prototype.findForwardRmpathEdges=function(e,t,n,i){for(var a=[],o=e.nodeMap,s=o[t.to].label,u=o[t.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;t.to===h.to||n>d||i.hasNode(o[h.to])||(t.label<h.label||t.label===h.label&&s<=d)&&a.push(h)}return a},r.prototype.getSupport=function(e){var t={};return e.forEach(function(n){t[n.graphId]||(t[n.graphId]=!0)}),Object.keys(t).length},r.prototype.findMinLabel=function(e){var t=void 0;return Object.keys(e).forEach(function(n){var i=e[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!t){t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<t.nodeLabel1||a===t.nodeLabel1&&o<t.edgeLabel||a===t.nodeLabel1&&o===t.edgeLabel&&s<t.nodeLabel2)&&(t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),t},r.prototype.isMin=function(){var e=this,t=this.dfsCode;if(this.verbose&&console.log("isMin checking",t),t.dfsEdgeList.length===1)return!0;var n=this.directed,i=t.toGraph(Zw,n),a=i.nodeMap,o=new Jw,s={};i.nodes.forEach(function(c){var h=e.findForwardRootEdges(i,c);h.forEach(function(d){var v=a[d.to],p="".concat(c.label,"-").concat(d.label,"-").concat(v.label);s[p]||(s[p]={projected:[],nodeLabel1:c.label,edgeLabel:d.label,nodeLabel2:v.label});var g={graphId:i.id,edge:d,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(u){o.dfsEdgeList.push(new jo(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var f=function c(h){for(var d=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[d[0]].toNode,g={},y=!1,m=0,b=n?-1:0,x=function($){if(y)return"break";h.forEach(function(Y){var N=new Uc(Y),P=e.findBackwardEdge(i,N.edges[d[$]],N.edges[d[0]],N);P&&(g[P.label]||(g[P.label]={projected:[],edgeLabel:P.label}),g[P.label].projected.push({graphId:i.id,edge:g,preNode:Y}),m=o.dfsEdgeList[d[$]].fromNode,y=!0)})},w=d.length-1;w>b;w--){var E=x(w);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new jo(p,m,Vi,_.edgeLabel,Vi));var M=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(D){var $=new Uc(D),Y=e.findForwardPureEdges(i,$.edges[d[0]],v,$);Y.length>0&&(y=!0,S=p,Y.forEach(function(N){var P="".concat(N.label,"-").concat(a[N.to].label);C[P]||(C[P]={projected:[],edgeLabel:N.label,nodeLabel2:a[N.to].label}),C[P].projected.push({graphId:i.id,edge:N,preNode:D})}))});for(var A=d.length,T=function($){if(y)return"break";var Y=d[$];h.forEach(function(N){var P=new Uc(N),W=e.findForwardRmpathEdges(i,P.edges[Y],v,P);W.length>0&&(y=!0,S=o.dfsEdgeList[Y].fromNode,W.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:N})}))})},w=0;w<A;w++){var k=T(w);if(k==="break")break}if(!y)return!0;var O=e.findMinLabel(C);o.dfsEdgeList.push(new jo(S,p+1,Vi,O.edgeLabel,O.nodeLabel2));var G=o.dfsEdgeList.length-1;return t.dfsEdgeList[G]!==o.dfsEdgeList[G]?!1:c(C["".concat(O.edgeLabel,"-").concat(O.nodeLabel2)].projected)},l="".concat(u.nodeLabel1,"-").concat(u.edgeLabel,"-").concat(u.nodeLabel2);return f(s[l].projected)}},r.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(Vt(e))}},r.prototype.subGraphMining=function(e){var t=this,n=this.getSupport(e);if(!(n<this.minSupport)&&this.isMin()){this.report();var i=this.dfsCode.getNodeNum(),a=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[a[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},f={};e.forEach(function(l){for(var c=t.graphs[l.graphId],h=c.nodeMap,d=new Uc(l),v=a.length-1;v>=0;v--){var p=t.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(t.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var w=t.findForwardRmpathEdges(c,d.edges[a[x]],s,d);w.forEach(function(E){var _="".concat(t.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[x]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;v<a.length;v++)m(v)}}),Object.keys(f).forEach(function(l){var c=f[l],h=c.toNodeId,d=c.edgeLabel;t.dfsCode.dfsEdgeList.push(new jo(o,h,"-1",d,"-1")),t.subGraphMining(f[l].projected),t.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;t.dfsCode.dfsEdgeList.push(new jo(h,o+1,Vi,d,v)),t.subGraphMining(u[l].projected),t.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,t=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={};return Object.keys(e).forEach(function(u){var f=e[u],l=f.nodeMap;f.nodes.forEach(function(c,h){var d=c.label,v="".concat(u,"-").concat(d);if(!s[v]){var p=a[d]||0;p++,a[d]=p}s[v]={graphKey:u,label:d},c.edges.forEach(function(g){var y=d,m=l[g.to].label;if(!t&&y>m){var b=m;m=y,y=b}var x=g.label,w="".concat(y,"-").concat(x,"-").concat(m);if(!o[w]){var E=o[w]||0;E++,o[w]=E}})})}),Object.keys(a).forEach(function(u){var f=a[u];if(!(f<n)){var l={nodes:[],edges:[]};l.nodes.push({id:"0",label:u}),i.push(l)}}),i},r.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var t=this.graphs;this.directed;var n={};Object.keys(t).forEach(function(i){var a=t[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=e.findForwardRootEdges(a,s);u.forEach(function(f){var l=o[f.to],c="".concat(s.label,"-").concat(f.label,"-").concat(l.label);n[c]||(n[c]={projected:[],nodeLabel1:s.label,edgeLabel:f.label,nodeLabel2:l.label});var h={graphId:i,edge:f,preNode:null};n[c].projected.push(h)})})}),Object.keys(n).forEach(function(i){var a=n[i],o=a.projected,s=a.nodeLabel1,u=a.edgeLabel,f=a.nodeLabel2;e.dfsCode.dfsEdgeList.push(new jo(0,1,s,u,f)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},r}(),x4=function(e,t,n,i){var a={};return Object.keys(e).forEach(function(o,s){var u=e[o],f=new Qw(s,!0,t),l={};u.nodes.forEach(function(c,h){f.addNode(h,c[n]),l[c.id]=h}),u.edges.forEach(function(c,h){var d=l[c.source],v=l[c.target];f.addEdge(-1,d,v,c[i])}),f&&f.getNodeNum()&&(a[f.id]=f)}),a},w4=function(e,t,n){var i=[];return e.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[t]=s.label,u))}),a.edges.forEach(function(s){var u;o.edges.push((u={source:"".concat(s.from),target:"".concat(s.to)},u[n]=s.label,u))}),i.push(o)}),i},eE="cluster",E4=function(e){var t=e.graphs,n=e.directed,i=n===void 0?!1:n,a=e.nodeLabelProp,o=a===void 0?eE:a,s=e.edgeLabelProp,u=s===void 0?eE:s,f=x4(t,i,o,u),l=e.minSupport,c=e.maxNodeNum,h=e.minNodeNum,d=e.verbose,v=e.top,p={graphs:f,minSupport:l,maxNodeNum:c,minNodeNum:h,top:v,verbose:d,directed:i},g=new b4(p);g.run();var y=w4(g.frequentSubgraphs,o,u);return y},tE=function(e,t,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=e.nodes;return t.forEach(function(s,u){a.push(rE(o,s,u,n,i))}),a},rE=function(e,t,n,i,a){var o=[n],s=[],u={};return t.forEach(function(f,l){if(f<=a&&n!==l){o.push(l),s.push(e[l]);var c=e[l][i];u[c]?(u[c].count++,u[c].dists.push(f)):u[c]={count:1,dists:[f]}}}),Object.keys(u).forEach(function(f){u[f].dists=u[f].dists.sort(function(l,c){return l-c})}),{nodeIdx:n,nodeId:e[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},_4=function(e,t,n,i,a){var o=Math.ceil(n/t),s={},u=0;return i.forEach(function(f,l){for(var c=0,h=0,d=f.nodeIdxs,v=f.neighborNum-1;c<o;){for(var p=d[1+Math.floor(Math.random()*v)],g=0;(s["".concat(l,"-").concat(p)]||s["".concat(p,"-").concat(l)])&&(p=Math.floor(Math.random()*t),g++,!(g>2*t)););if(g<2*t&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*t)break}if(c<o){var y=o-c;o=(o+y)/(t-l-1)}}),s},Xc=function(e,t,n,i){var a=n.nodes;return i||(i={}),Object.keys(e).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var f=e[o],l=(s=t[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=t[f.end])===null||u===void 0?void 0:u.nodeIdxs;if(!(!l||!c)){var h=new Set(c),d=l.filter(function(m){return h.has(m)});if(!(!d||!d.length)){for(var v={},p=d.length,g=0;g<p;g++){var y=a[d[g]];i[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&i[o].edges.push(m)})}}}}),i},Yc=function(e,t,n,i){var a,o,s={};e.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((a=t==null?void 0:t.edges)===null||a===void 0)&&a.length)||((o=t==null?void 0:t.nodes)===null||o===void 0?void 0:o.length)<2?0:(e.edges.forEach(function(f){var l=s[f.source][n],c=s[f.target][n],h=t==null?void 0:t.nodes[0][n],d=t==null?void 0:t.nodes[1][n],v=t==null?void 0:t.edges[0][i];f[i]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},S4=function(e,t,n){for(var i=1/0,a=0,o=function(f){var l=e[f],c=Object.keys(l).sort(function(m,b){return l[m]-l[b]}),h=10,d=[];c.forEach(function(m,b){d[b%h]||(d[b%h]={graphs:[],totalCount:0,aveCount:0}),d[b%h].graphs.push(m),d[b%h].totalCount+=l[m]});var v=0,p=[];d.forEach(function(m){var b=m.totalCount/m.graphs.length;m.aveCount=b,p.push(b);var x=0,w=m.length;m.graphs.forEach(function(E,_){var M=l[E];m.graphs.forEach(function(C,S){_!==S&&(x+=Math.abs(M-l[C]))})}),x/=w*(w-1)/2,v+=x}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(x,w){b!==w&&(g+=Math.abs(m-x))}),g/=p.length*(p.length-1)/2});var y=g-v;i<y&&(i=y,a=f)},s=0;s<t;s++)o(s);return{structure:n[a],structureCountMap:e[a]}},nE=function(e,t){var n={},i={};return e.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[t];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},iE=function(e,t,n){var i={},a={};return e.forEach(function(o,s){i["".concat(Tw)]={idx:s,edge:o};var u=o[t];a[u]||(a[u]=[]),a[u].push(o);var f=n[o.source];f&&(f.degree++,f.outDegree++);var l=n[o.target];l&&(l.degree++,l.inDegree++)}),{edgeMap:i,edgeLabelMap:a}},aE=function(e,t,n){var i=t.length,a={};return t.forEach(function(o,s){for(var u=n?0:s+1,f=e[s].id,l=u;l<i;l++)if(s!==l){var c=e[l].id,h=o[l];a["".concat(f,"-").concat(c)]=h,n||(a["".concat(c,"-").concat(f)]=h)}}),a},M4=function(e,t,n,i,a,o,s,u,f,l,c){var h,d="".concat(t.id,"-").concat(n.id);if(l&&l[d])return l[d];var v=c?c[d]:void 0;if(!v){var p=(h={},h[d]={start:i[t.id].idx,end:i[n.id].idx,distance:a},h);c=Xc(p,o,e,c),v=c[d]}return Yc(v,s,u,f)},oE=function(e,t,n,i){var a,o,s,u=(a=e[t])===null||a===void 0?void 0:a.degree,f=(o=e[t])===null||o===void 0?void 0:o.inDegree,l=(s=e[t])===null||s===void 0?void 0:s.outDegree;return e[t]===void 0&&(u=1/0,f=1/0,l=1/0,i[t].forEach(function(c){var h=n[c.id].degree;u>h&&(u=h);var d=n[c.id].inDegree;f>d&&(f=d);var v=n[c.id].outDegree;l>v&&(l=v)}),e[t]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},sE=function(e,t,n,i,a,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var f=e.nodes.length;if(f){var l=hf(e,n),c=hf(t,n),h=aE(e.nodes,l,n),d=aE(t.nodes,c,n),v=nE(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=nE(t.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;iE(e.edges,s,p);var x=iE(t.edges,s,m).edgeLabelMap,w=[];c==null||c.forEach(function(tt){w=w.concat(tt)}),a||(a=Math.max.apply(Math,Yn(Yn([],w,!1),[2],!1))),i||(i=a);var E=tE(e,l,o,i),_=tE(t,c,o,i),M=Math.min(100,f*(f-1)/2),C=_4(i,f,M,E,l),S=Xc(C,E,e),A=10,T=1,k=1,O=4,G={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:k,maxNodeNum:O,directed:n},D=E4(G).slice(0,A),$=D.length,Y=[];D.forEach(function(tt,ae){Y[ae]={},Object.keys(S).forEach(function(L){var Se=S[L],Ge=Yc(Se,tt,o,s);Y[ae][L]=Ge})});var N=S4(Y,$,D),P=N.structure,W=N.structureCountMap,J=t.nodes[0],te=[],H=(u=t.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;t.nodes.forEach(function(tt){var ae=tt[o],L=g[ae];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ae,J=tt)});var Te={},Ne={},Ze={},at={},nt={},St={};Object.keys(b).forEach(function(tt,ae){nt[tt]=[],n&&(St[tt]=[]);var L=b[tt],Se={};L.forEach(function(qe){var et=d["".concat(J.id,"-").concat(qe.id)];if(et&&nt[tt].push(et),Se["".concat(J.id,"-").concat(qe.id)]={start:0,end:m[qe.id].idx,distance:et},n){var yt=d["".concat(qe.id,"-").concat(J.id)];yt&&St[tt].push(yt)}}),nt[tt]=nt[tt].sort(function(qe,et){return qe-et}),n&&(St[tt]=St[tt].sort(function(qe,et){return qe-et})),Ne=Xc(Se,_,t,Ne);var Ge=[];if(Object.keys(Se).forEach(function(qe){if(Ze[qe]){Ge.push(Ze[qe]);return}var et=Ne[qe];Ze[qe]=Yc(et,P,o,s),Ge.push(Ze[qe])}),Ge=Ge.sort(function(qe,et){return et-qe}),at["".concat(J.id,"-").concat(tt)]=Ge,tt!==H)for(var me=(te==null?void 0:te.length)||0,Ye=function(et){var yt=te[et],Pt=E[p[yt.id].idx],cr=Pt.nodeLabelCountMap[tt],Rt=b[tt].length;if(!cr||cr.count<Rt)return te.splice(et,1),"continue";for(var hr=!1,ur=0;ur<Rt;ur++)if(cr.dists[ur]>nt[tt][ur]){hr=!0;break}if(hr)return te.splice(et,1),"continue";var xr={};Pt.neighbors.forEach(function(or){var jr=h["".concat(yt.id,"-").concat(or.id)];xr["".concat(yt.id,"-").concat(or.id)]={start:p[yt.id].idx,end:p[or.id].idx,distance:jr}}),S=Xc(xr,E,e,S);var vr=[];Object.keys(xr).forEach(function(or){if(W[or]){vr.push(W[or]);return}var jr=S[or];W[or]=Yc(jr,P,o,s),vr.push(W[or])}),vr=vr.sort(function(or,jr){return jr-or});for(var En=!1,ur=0;ur<Rt;ur++)if(vr[ur]<Ge[ur]){En=!0;break}if(En)return te.splice(et,1),"continue"},We=me-1;We>=0;We--)Ye(We)});var Mt=[];te==null||te.forEach(function(tt){for(var ae=p[tt.id].idx,L=rE(e.nodes,l[ae],ae,o,a),Se=L.neighbors,Ge=Se.length,me=!1,Ye=Ge-1;Ye>=0;Ye--){if(Se.length+1<t.nodes.length){me=!0;return}var We=Se[Ye],qe=We[o];if(!b[qe]||!b[qe].length){Se.splice(Ye,1);continue}if(!nt[qe]||!nt[qe].length){Se.splice(Ye,1);continue}var et="".concat(tt.id,"-").concat(We.id),yt=h[et],Pt=nt[qe].length-1,cr=nt[qe][Pt];if(yt>cr){Se.splice(Ye,1);continue}if(n){var Rt="".concat(We.id,"-").concat(tt.id),hr=h[Rt];Pt=St[qe].length-1;var ur=St[qe][Pt];if(hr>ur){Se.splice(Ye,1);continue}}var xr=W[et]?W[et]:M4(e,tt,We,p,yt,E,P,o,s,W,S),vr="".concat(J.id,"-").concat(qe),En=at[vr][at[vr].length-1];if(xr<En){Se.splice(Ye,1);continue}var or=oE(Te,qe,m,b),jr=or.minPatternNodeLabelDegree;if(or.minPatternNodeLabelInDegree,or.minPatternNodeLabelOutDegree,p[We.id].degree<jr){Se.splice(Ye,1);continue}}me||Mt.push({nodes:[tt].concat(Se)})});var fr=cf(t,J.id,!1).length,Ft={};n?(Object.keys(fr).forEach(function(tt){var ae=m[tt].node[o];Ft[ae]?Ft[ae].push(fr[tt]):Ft[ae]=[fr[tt]]}),Object.keys(Ft).forEach(function(tt){Ft[tt].sort(function(ae,L){return ae-L})})):Ft=nt;for(var Wt=Mt.length,dr=function(ae){var L=Mt[ae],Se=L.nodes[0],Ge={},me={};L.nodes.forEach(function(At,pr){me[At.id]={idx:pr,node:At,degree:0,inDegree:0,outDegree:0};var xt=At[o];Ge[xt]?Ge[xt]++:Ge[xt]=1});var Ye=[],We={};e.edges.forEach(function(At){me[At.source]&&me[At.target]&&(Ye.push(At),We[At[s]]?We[At[s]]++:We[At[s]]=1,me[At.source].degree++,me[At.target].degree++,me[At.source].outDegree++,me[At.target].inDegree++)});for(var qe=Object.keys(x).length,et=!1,yt=0;yt<qe;yt++){var Pt=Object.keys(x)[yt];if(!We[Pt]||We[Pt]<x[Pt].length){et=!0;break}}if(et)return Mt.splice(ae,1),"continue";var cr=Ye.length;if(cr<t.edges.length)return Mt.splice(ae,1),"break";for(var Rt=!1,hr=function(pr){var xt=Ye[pr],kr=xt[s],_n=x[kr];if(!_n||!_n.length)return We[kr]--,_n&&We[kr]<_n.length?(Rt=!0,"break"):(Ye.splice(pr,1),me[xt.source].degree--,me[xt.target].degree--,me[xt.source].outDegree--,me[xt.target].inDegree--,"continue");var Ss=me[xt.source].node[o],Ms=me[xt.target].node[o],Ha=!1;if(_n.forEach(function(Cs){var As=m[Cs.source].node,Ts=m[Cs.target].node;As[o]===Ss&&Ts[o]===Ms&&(Ha=!0),!n&&As[o]===Ms&&Ts[o]===Ss&&(Ha=!0)}),!Ha)return We[kr]--,_n&&We[kr]<_n.length?(Rt=!0,"break"):(Ye.splice(pr,1),me[xt.source].degree--,me[xt.target].degree--,me[xt.source].outDegree--,me[xt.target].inDegree--,"continue")},yt=cr-1;yt>=0;yt--){var ur=hr(yt);if(ur==="break")break}if(Rt)return Mt.splice(ae,1),"continue";L.edges=Ye;var xr=cf(L,L.nodes[0].id,!1).length;if(Object.keys(xr).reverse().forEach(function(At){if(!(At===L.nodes[0].id||Rt)){if(xr[At]===1/0){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var xt=L.nodes.indexOf(me[At].node);L.nodes.splice(xt,1),me[At]=void 0;return}var kr=p[At].node[o];if(!Ft[kr]||!Ft[kr].length||xr[At]>Ft[kr][Ft[kr].length-1]){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var xt=L.nodes.indexOf(me[At].node);L.nodes.splice(xt,1),me[At]=void 0}}}),Rt)return Mt.splice(ae,1),"continue";for(var vr=!0,En=0;vr&&!Rt;){vr=!1;var or=n?me[Se.id].degree<m[J.id].degree||me[Se.id].inDegree<m[J.id].inDegree||me[Se.id].outDegree<m[J.id].outDegree:me[Se.id].degree<m[J.id].degree;if(or){Rt=!0;break}if(Ge[Se[o]]<b[Se[o]].length){Rt=!0;break}for(var jr=L.nodes.length,Ri=jr-1;Ri>=0;Ri--){var Kr=L.nodes[Ri],Oo=me[Kr.id].degree,Jl=me[Kr.id].inDegree,ec=me[Kr.id].outDegree,pn=Kr[o],Va=oE(Te,pn,m,b),_s=Va.minPatternNodeLabelDegree,tc=Va.minPatternNodeLabelInDegree,rc=Va.minPatternNodeLabelOutDegree,nc=n?Oo<_s||Jl<tc||ec<rc:Oo<_s;if(nc){if(Ge[Kr[o]]--,Ge[Kr[o]]<b[Kr[o]].length){Rt=!0;break}L.nodes.splice(Ri,1),me[Kr.id]=void 0,vr=!0}}if(Rt||!vr&&En!==0)break;cr=Ye.length;for(var Bi=cr-1;Bi>=0;Bi--){var Ur=Ye[Bi];if(!me[Ur.source]||!me[Ur.target]){Ye.splice(Bi,1);var Fi=Ur[s];if(We[Fi]--,me[Ur.source]&&(me[Ur.source].degree--,me[Ur.source].outDegree--),me[Ur.target]&&(me[Ur.target].degree--,me[Ur.target].inDegree--),x[Fi]&&We[Fi]<x[Fi].length){Rt=!0;break}vr=!0}}En++}if(Rt||Rt||L.nodes.length<t.nodes.length||Ye.length<t.edges.length)return Mt.splice(ae,1),"continue"},lr=Wt-1;lr>=0;lr--){var Ut=dr(lr);if(Ut==="break")break}for(var ar=Mt.length,Zr=function(ae){var L=Mt[ae],Se={};L.edges.forEach(function(Ye){var We="".concat(Ye.source,"-").concat(Ye.target,"-").concat(Ye.label);Se[We]?Se[We]++:Se[We]=1});for(var Ge=function(We){var qe=Mt[We],et={};qe.edges.forEach(function(Pt){var cr="".concat(Pt.source,"-").concat(Pt.target,"-").concat(Pt.label);et[cr]?et[cr]++:et[cr]=1});var yt=!0;Object.keys(et).length!==Object.keys(Se).length?yt=!1:Object.keys(Se).forEach(function(Pt){et[Pt]!==Se[Pt]&&(yt=!1)}),yt&&Mt.splice(We,1)},me=ar-1;me>ae;me--)Ge(me);ar=Mt.length},lr=0;lr<=ar-1;lr++)Zr(lr);return Mt}}},Us=function(){function r(e){e===void 0&&(e=10),this.linkedList=new Aw,this.maxStep=e}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(e){this.linkedList.prepend(e),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(e){return e.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r}(),uE=Up;const C4=Object.freeze(Object.defineProperty({__proto__:null,GADDI:sE,Stack:Us,breadthFirstSearch:Iw,connectedComponent:$p,cosineSimilarity:Zp,default:{getAdjMatrix:$o,breadthFirstSearch:Iw,connectedComponent:$p,getDegree:_a,getInDegree:Lw,getOutDegree:Nw,detectCycle:Up,detectDirectedCycle:uE,detectAllCycles:Dw,detectAllDirectedCycle:Yp,detectAllUndirectedCycle:Xp,depthFirstSearch:jp,dijkstra:cf,findAllPath:Bw,findShortestPath:Rw,floydWarshall:hf,labelPropagation:Fw,louvain:qp,iLouvain:$w,kCore:jw,kMeans:Xw,cosineSimilarity:Zp,nodesCosineSimilarity:Yw,minimumSpanningTree:Vw,pageRank:Hw,getNeighbors:Wn,Stack:Us,GADDI:sE},depthFirstSearch:jp,detectAllCycles:Dw,detectAllDirectedCycle:Yp,detectAllUndirectedCycle:Xp,detectCycle:Up,detectDirectedCycle:uE,dijkstra:cf,findAllPath:Bw,findShortestPath:Rw,floydWarshall:hf,getAdjMatrix:$o,getDegree:_a,getInDegree:Lw,getNeighbors:Wn,getOutDegree:Nw,iLouvain:$w,kCore:jw,kMeans:Xw,labelPropagation:Fw,louvain:qp,minimumSpanningTree:Vw,nodesCosineSimilarity:Yw,pageRank:Hw},Symbol.toStringTag,{value:"Module"}));var Wc=ni,A4=function(e){return function(t,n){return t[e]-n[e]}},fE=function(e,t,n){return e>=t&&e<=n},Vc=function(e,t,n,i){var a=1e-4,o={x:n.x-e.x,y:n.y-e.y},s={x:t.x-e.x,y:t.y-e.y},u={x:i.x-n.x,y:i.y-n.y},f=s.x*u.y-s.y*u.x,l=f*f,c=1/f,h=s.x*s.x+s.y*s.y,d=u.x*u.x+u.y*u.y;if(l>a*h*d){var v=(o.x*u.y-o.y*u.x)*c,p=(o.x*s.y-o.y*s.x)*c;return!fE(v,0,1)||!fE(p,0,1)?null:{x:e.x+v*s.x,y:e.y+v*s.y}}return null},lE=function(e,t){var n=e.x,i=e.y,a=e.width,o=e.height,s=n+a/2,u=i+o/2,f=[],l={x:s,y:u};f.push({x:n,y:i}),f.push({x:n+a,y:i}),f.push({x:n+a,y:i+o}),f.push({x:n,y:i+o}),f.push({x:n,y:i});for(var c=null,h=1;h<f.length&&(c=Vc(f[h-1],f[h],l,t),!c);h++);return c},cE=function(e,t){var n=e.x,i=e.y,a=e.r,o=t.x,s=t.y,u=o-n,f=s-i;if(u*u+f*f<a*a)return null;var l=Math.atan(f/u);return{x:n+Math.abs(a*Math.cos(l))*Math.sign(u),y:i+Math.abs(a*Math.sin(l))*Math.sign(f)}},hE=function(e,t){var n=e.rx,i=e.ry,a=e.x,o=e.y,s=t.x-a,u=t.y-o,f=Math.atan2(u/i,s/n);return f<0&&(f+=2*Math.PI),{x:a+n*Math.cos(f),y:o+i*Math.sin(f)}},Xs=function(e,t,n){n===void 0&&(n=1);var i=[e.x,e.y,n];return(!t||isNaN(t[0]))&&(t=[1,0,0,0,1,0,0,0,1]),Pc(i,i,t),{x:i[0],y:i[1]}},dE=function(e,t,n){n===void 0&&(n=1),(!t||isNaN(t[0]))&&(t=[1,0,0,0,1,0,0,0,1]);var i=Mp([1,0,0,0,1,0,0,0,1],t);i||(i=[1,0,0,0,1,0,0,0,1]);var a=[e.x,e.y,n];return Pc(a,a,i),{x:a[0],y:a[1]}},Kp=function(e,t,n){var i=e.x-t.x,a=e.y-t.y,o=e.x-n.x,s=e.y-n.y,u=(e.x*e.x-t.x*t.x-t.y*t.y+e.y*e.y)/2,f=(e.x*e.x-n.x*n.x-n.y*n.y+e.y*e.y)/2,l=a*o-i*s;return{x:-(s*u-a*f)/l,y:-(i*f-o*u)/l}},Hc=function(e,t){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)},T4=function(e,t){var n=[];return e.forEach(function(i){var a=[];i.forEach(function(o){a.push(o*t)}),n.push(a)}),n},I4=function(e){for(var t=[],n=e.length,i=0;i<n;i+=1){t[i]=[];for(var a=0;a<n;a+=1)i===a?t[i][a]=0:e[i][a]===0||!e[i][a]?t[i][a]=1/0:t[i][a]=e[i][a]}for(var o=0;o<n;o+=1)for(var i=0;i<n;i+=1)for(var a=0;a<n;a+=1)t[i][a]>t[i][o]+t[o][a]&&(t[i][a]=t[i][o]+t[o][a]);return t},k4=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];a.push(f)}),i&&i.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];a[l][c]=1,t||(a[c][l]=1)}),a},vE=function(e,t){e.translate(t.x,t.y)},Qp=function(e,t,n,i){i===void 0&&(i={duration:500});var a=e.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var o=e.getCanvasBBox(),s=t.x-o.minX,u=t.y-o.minY;if(n){var f=s*a[0],l=u*a[4],c=0,h=0,d=0,v=0;e.animate(function(g){return d=f*g,v=l*g,a=Wc(a,[["t",d-c,v-h]]),c=d,h=v,{matrix:a}},i)}else{var p=Wc(a,[["t",s,u]]);e.setMatrix(p)}},L4=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=t;vt(t)||(i=[t,t]),vt(t)&&t.length===1&&(i=[t[0],t[0]]),n=Wc(n,[["s",i[0],i[1]]]),e.setMatrix(n)},N4=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Wc(n,[["r",t]]),e.setMatrix(n)},O4=function(e,t,n){for(var i=[],a=0;a<e;a++)i[a]=0;return n.forEach(function(o){o.source&&(i[t[o.source]]+=1),o.target&&(i[t[o.target]]+=1)}),i};function D4(r,e,t){return(t[0]-r[0])*(e[1]-r[1])===(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}var df=function(e,t,n){var i=!1,a=e.length,o=1e-6;function s(c){return Math.abs(c)<o?0:c<0?-1:1}if(a<=2)return!1;for(var u=0;u<a;u++){var f=e[u],l=e[(u+1)%a];if(D4(f,l,[t,n]))return!0;s(f[1]-n)>0!=s(l[1]-n)>0&&s(t-(n-f[1])*(f[0]-l[0])/(f[1]-l[1])-f[0])<0&&(i=!i)}return i},pE=function(e,t){return!(t.minX>e.maxX||t.maxX<e.minX||t.minY>e.maxY||t.maxY<e.minY)},P4=function(e,t){var n=!1;return ye(e,function(i){if(Vc(i.from,i.to,t.from,t.to))return n=!0,!1}),n},gE=function(e,t){var n=function(h){var d=h.map(function(p){return p[0]}),v=h.map(function(p){return p[1]});return{minX:Math.min.apply(null,d),maxX:Math.max.apply(null,d),minY:Math.min.apply(null,v),maxY:Math.max.apply(null,v)}},i=function(h){for(var d=[],v=h.length,p=0;p<v-1;p++){var g=h[p],y=h[p+1];d.push({from:{x:g[0],y:g[1]},to:{x:y[0],y:y[1]}})}if(d.length>1){var m=h[0],b=h[v-1];d.push({from:{x:b[0],y:b[1]},to:{x:m[0],y:m[1]}})}return d};if(e.length<2||t.length<2)return!1;var a=n(e),o=n(t);if(!pE(a,o))return!1;var s=!1;if(ye(t,function(c){if(df(e,c[0],c[1]))return s=!0,!1}),s||(ye(e,function(c){if(df(t,c[0],c[1]))return s=!0,!1}),s))return!0;var u=i(e),f=i(t),l=!1;return ye(f,function(c){if(P4(u,c))return l=!0,!1}),l},Uo=function(){function r(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}return r.prototype.getBBox=function(){var e=Math.min(this.x1,this.x2),t=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),i=Math.max(this.y1,this.y2),a={x:e,y:t,minX:e,minY:t,maxX:n,maxY:i,width:n-e,height:i-t};return a},r}(),Jp=function(e,t){var n={top:[e.minX,e.minY,e.maxX,e.minY],left:[e.minX,e.minY,e.minX,e.maxY],bottom:[e.minX,e.maxY,e.maxX,e.maxY],right:[e.maxX,e.minY,e.maxX,e.maxY]};return n[t]},R4=function(e,t){var n=(t.x2-t.x1)*(e.y1-t.y1)-(t.y2-t.y1)*(e.x1-t.x1),i=(e.x2-e.x1)*(e.y1-t.y1)-(e.y2-e.y1)*(e.x1-t.x1),a=(t.y2-t.y1)*(e.x2-e.x1)-(t.x2-t.x1)*(e.y2-e.y1);if(a){var o=n/a,s=i/a;if(o>=0&&o<=1&&s>=0&&s<=1)return o}return Number.POSITIVE_INFINITY},yE=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=0,o=[],s=0;s<4;s++){var u=Jp(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3];o[s]=Vc({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},{x:f,y:l},{x:c,y:h}),o[s]&&(a+=1)}return[o,a]},eg=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=Number.POSITIVE_INFINITY,o=0,s=0;s<4;s++){var u=Jp(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3],d=R4(t,new Uo(f,l,c,h));d=Math.abs(d-.5),d>=0&&d<=1&&(o+=1,a=d<a?d:a)}return o===0?-1:a},mE=function(e){var t=0,n=0;if(e.length>0){for(var i=0,a=e;i<a.length;i++){var o=a[i];t+=o.x,n+=o.y}t/=e.length,n/=e.length}return{x:t,y:n}},qc=function(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)},bE=function(e,t){var n=t.x1,i=t.y1,a=t.x2-n,o=t.y2-i,s=e.x-n,u=e.y-i,f=s*a+u*o,l;f<=0?l=0:(s=a-s,u=o-u,f=s*a+u*o,f<=0?l=0:l=f*f/(a*a+o*o));var c=s*s+u*u-l;return c<0&&(c=0),c},tg=function(e,t,n){return n===void 0&&(n=.001),Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<Math.pow(n,2)},xE=function(e,t){var n=e.x<t.x,i=e.x>t.x+t.width,a=e.y>t.y+t.height,o=e.y<t.y,s=n||i||a||o;if(!s)return 0;if(a&&!n&&!i)return Math.pow(t.y+t.height-e.y,2);if(o&&!n&&!i)return Math.pow(e.y-t.y,2);if(n&&!a&&!o)return Math.pow(t.x-e.x,2);if(i&&!a&&!o)return Math.pow(t.x+t.width-e.x,2);var u=Math.min(Math.abs(t.x-e.x),Math.abs(t.x+t.width-e.x)),f=Math.min(Math.abs(t.y-e.y),Math.abs(t.y+t.height-e.y));return u*u+f*f},B4=function(e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t.x,u=t.y,f=[a-n,o-i];if(zp(f,[0,0]))return NaN;var l=[-f[1],f[0]];to(l,l);var c=[s-n,u-i];return Math.abs(Gp(c,l))},rg=function(e,t,n){return e+(t-e)*n},ng=function(e,t,n){for(var i=Math.min(e.length,t.length),a=new Array(i),o=0;o<i;o++)a[o]=rg(e[o],t[o],n);return a};const F4=Object.freeze(Object.defineProperty({__proto__:null,Line:Uo,applyMatrix:Xs,compare:A4,distance:Hc,floydWarshall:I4,fractionToLine:eg,getAdjMatrix:k4,getBBoxBoundLine:Jp,getCircleCenterByPoints:Kp,getCircleIntersectByPoint:cE,getDegree:O4,getEllipseIntersectByPoint:hE,getLineIntersect:Vc,getPointsCenter:mE,getRectIntersectByPoint:lE,intersectBBox:pE,invertMatrix:dE,isPointInPolygon:df,isPointsOverlap:tg,isPolygonsIntersect:gE,itemIntersectByLine:yE,lerp:rg,lerpArray:ng,move:Qp,pointLineDistance:B4,pointLineSquareDist:bE,pointRectSquareDist:xE,rotate:N4,scale:L4,scaleMatrix:T4,squareDist:qc,translate:vE},Symbol.toStringTag,{value:"Module"}));var ro="rgb(95, 149, 255)",G4="rgb(255, 255, 255)",wE="rgb(0, 0, 0)",ig="rgb(247, 250, 255)",EE="rgb(239, 244, 255)",Zc="rgb(253, 253, 253)",_E="rgb(250, 250, 250)",Kc="rgb(224, 224, 224)",SE="rgb(234, 234, 234)",z4="rgb(245, 245, 245)",$4="rgb(191, 213, 255)",ME="#4572d9",j4="rgb(223, 234, 255)",er={mainStroke:ro,mainFill:EE,activeStroke:ro,activeFill:ig,inactiveStroke:$4,inactiveFill:ig,selectedStroke:ro,selectedFill:G4,highlightStroke:ME,highlightFill:j4,disableStroke:Kc,disableFill:_E,edgeMainStroke:Kc,edgeActiveStroke:ro,edgeInactiveStroke:SE,edgeSelectedStroke:ro,edgeHighlightStroke:ro,edgeDisableStroke:z4,comboMainStroke:Kc,comboMainFill:Zc,comboActiveStroke:ro,comboActiveFill:ig,comboInactiveStroke:Kc,comboInactiveFill:Zc,comboSelectedStroke:ro,comboSelectedFill:Zc,comboHighlightStroke:ME,comboHighlightFill:Zc,comboDisableStroke:SE,comboDisableFill:_E};const ft={version:"0.8.20",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:er.mainStroke,fill:EE},size:20,color:er.mainStroke,linkPoints:{size:8,lineWidth:1,fill:er.activeFill,stroke:er.activeStroke}},nodeStateStyles:{active:{fill:er.activeFill,stroke:er.activeStroke,lineWidth:2,shadowColor:er.mainStroke,shadowBlur:10},selected:{fill:er.selectedFill,stroke:er.selectedStroke,lineWidth:4,shadowColor:er.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:er.highlightFill,stroke:er.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:er.inactiveFill,stroke:er.inactiveStroke,lineWidth:1},disable:{fill:er.disableFill,stroke:er.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:wE,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:er.edgeMainStroke,lineAppendWidth:2},color:er.edgeMainStroke},edgeStateStyles:{active:{stroke:er.edgeActiveStroke,lineWidth:1},selected:{stroke:er.edgeSelectedStroke,lineWidth:2,shadowColor:er.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:er.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:er.edgeInactiveStroke,lineWidth:1},disable:{stroke:er.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:wE,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:er.comboMainFill,lineWidth:1,stroke:er.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:er.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:er.comboActiveStroke,lineWidth:1,fill:er.comboActiveFill},selected:{stroke:er.comboSelectedStroke,lineWidth:2,fill:er.comboSelectedFill,shadowColor:er.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:er.comboHighlightStroke,lineWidth:2,fill:er.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:er.comboInactiveStroke,fill:er.comboInactiveFill,lineWidth:1},disable:{stroke:er.comboDisableStroke,fill:er.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},windowFontFamily:typeof window<"u"&&window.getComputedStyle&&document.body&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},U4={" ":.3329986572265625,a:.5589996337890625,A:.6569992065429687,b:.58599853515625,B:.6769989013671875,c:.5469985961914062,C:.7279998779296875,d:.58599853515625,D:.705999755859375,e:.554998779296875,E:.63699951171875,f:.37299957275390627,F:.5769989013671875,g:.5909988403320312,G:.7479995727539063,h:.555999755859375,H:.7199996948242188,i:.255999755859375,I:.23699951171875,j:.26699981689453123,J:.5169998168945312,k:.5289993286132812,K:.6899993896484375,l:.23499908447265624,L:.5879989624023437,m:.854998779296875,M:.8819992065429687,n:.5589996337890625,N:.7189987182617188,o:.58599853515625,O:.7669998168945312,p:.58599853515625,P:.6419998168945312,q:.58599853515625,Q:.7669998168945312,r:.3649993896484375,R:.6759994506835938,s:.504998779296875,S:.6319992065429687,t:.354998779296875,T:.6189987182617187,u:.5599990844726562,U:.7139999389648437,v:.48199920654296874,V:.6389999389648438,w:.754998779296875,W:.929998779296875,x:.5089996337890625,X:.63699951171875,y:.4959991455078125,Y:.66199951171875,z:.48699951171875,Z:.6239990234375,0:.6,1:.40099945068359377,2:.6,3:.6,4:.6,5:.6,6:.6,7:.5469985961914062,8:.6,9:.6,"[":.3329986572265625,"]":.3329986572265625,",":.26399993896484375,".":.26399993896484375,";":.26399993896484375,":":.26399993896484375,"{":.3329986572265625,"}":.3329986572265625,"\\":.5,"|":.19499969482421875,"=":.604998779296875,"+":.604998779296875,"-":.604998779296875,_:.5,"`":.3329986572265625," ~":.8329986572265625,"!":.3329986572265625,"@":.8579986572265625,"#":.6,$:.6,"%":.9699996948242188,"^":.517999267578125,"&":.7259994506835937,"*":.505999755859375,"(":.3329986572265625,")":.3329986572265625,"<":.604998779296875,">":.604998779296875,"/":.5,"?":.53699951171875};var Hi=Math.PI,ag=Math.sin,og=Math.cos,cn=ag(Hi/8),hn=og(Hi/8),Qc=function(e,t){var n=e.getBBox(),i={x:n.minX,y:n.minY},a={x:n.maxX,y:n.maxY};if(t){var o=t.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),i=Xs(i,o),a=Xs(a,o)}var s=i.x,u=i.y,f=a.x,l=a.y;return{x:s,y:u,minX:s,minY:u,maxX:f,maxY:l,width:f-s,height:l-u}},CE=function(e){var t=e.sourceNode||e.targetNode,n=t.get("group"),i=n.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var a=t.getKeyShape(),o=a.getBBox(),s=e.loopCfg||{},u=s.dist||Math.max(o.width,o.height)*2,f=s.position||ft.defaultLoopPosition,l=[(o.minX+o.maxX)/2+i[6],(o.minY+o.maxY)/2+i[7]],c=[e.startPoint.x,e.startPoint.y],h=[e.endPoint.x,e.endPoint.y],d=o.height/2,v=o.width/2,p=d,g=d,y=p*cn,m=p*hn,b=g*cn,x=g*hn,w=a.get("type"),E=Math.min(d/2,v/2),_=Math.min(d,v),M=s!=null&&s.pointPadding?Math.min(_,s==null?void 0:s.pointPadding):E;if(c[0]===h[0]&&c[1]===h[1]){switch(f){case"top":w==="circle"?(c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]):(c=[l[0]-M,l[1]-d],h=[l[0]+M,l[1]-d]);break;case"top-right":p=d,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+y,l[1]-m],h=[l[0]+x,l[1]-b]):(c=[l[0]+v-M,l[1]-d],h=[l[0]+v,l[1]-d+M]);break;case"right":p=v,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+m,l[1]-y],h=[l[0]+x,l[1]+b]):(c=[l[0]+v,l[1]-M],h=[l[0]+v,l[1]+M]);break;case"bottom-right":p=v,g=d,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+m,l[1]+y],h=[l[0]+b,l[1]+x]):(c=[l[0]+v,l[1]+d-M],h=[l[0]+v-M,l[1]+d]);break;case"bottom":p=d,g=d,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+y,l[1]+m],h=[l[0]-b,l[1]+x]):(c=[l[0]-M,l[1]+d],h=[l[0]+M,l[1]+d]);break;case"bottom-left":p=d,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-y,l[1]+m],h=[l[0]-x,l[1]+b]):(c=[l[0]-v,l[1]+d-M],h=[l[0]-v+M,l[1]+d]);break;case"left":p=v,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-m,l[1]+y],h=[l[0]-x,l[1]-b]):(c=[l[0]-v,l[1]-M],h=[l[0]-v,l[1]+M]);break;case"top-left":p=v,g=d,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-m,l[1]-y],h=[l[0]-b,l[1]-x]):(c=[l[0]-v+M,l[1]-d],h=[l[0]-v,l[1]-d+M]);break;default:p=v,g=v,y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]}if(s.clockwise===!1){var C=[c[0],c[1]];c=[h[0],h[1]],h=[C[0],C[1]]}}var S=[c[0]-l[0],c[1]-l[1]],A=(p+u)/p,T=(g+u)/g;s.clockwise===!1&&(A=(g+u)/g,T=(p+u)/p);var k=Sn([0,0],S,A),O=[l[0]+k[0],l[1]+k[1]],G=[h[0]-l[0],h[1]-l[1]],D=Sn([0,0],G,T),$=[l[0]+D[0],l[1]+D[1]];return e.startPoint={x:c[0],y:c[1]},e.endPoint={x:h[0],y:h[1]},e.controlPoints=[{x:O[0],y:O[1]},{x:$[0],y:$[1]}],e},AE=function(e,t,n,i,a){var o=1e-4,s=[],u=e==null?void 0:e.getPoint(t);if(!u)return{x:0,y:0,angle:0};if(t<o)s=e.getStartTangent().reverse();else if(t>1-o)s=e.getEndTangent();else{var f=e==null?void 0:e.getPoint(t+o);s.push([u.x,u.y]),s.push([f.x,f.y])}var l=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]);if(l<0&&(l+=Hi*2),n&&(u.x+=og(l)*n,u.y+=ag(l)*n),i){var c=l-Hi/2;l>1/2*Hi&&l<3*1/2*Hi&&(c-=Hi),u.x+=og(c)*i,u.y+=ag(c)*i}var h={x:u.x,y:u.y,angle:l};return a?(l>.5*Hi&&l<1.5*Hi&&(l-=Hi),B({rotate:l},h)):h},X4=function r(e,t,n,i){if(i(e,t,n)===!1)return!1;if(e&&e.children){for(var a=e.children.length-1;a>=0;a--)if(!r(e.children[a],e,a,i))return!1}return!0},Y4=function r(e,t,n,i){if(e&&e.children){for(var a=e.children.length-1;a>=0;a--)if(!r(e.children[a],e,a,i))return}return i(e,t,n)!==!1},Mn=function(e,t){typeof t=="function"&&X4(e,null,-1,t)},qi=function(e,t){typeof t=="function"&&Y4(e,null,-1,t)},TE=function(e,t){return t*(U4[e]||1)},IE=function(e,t){var n=0,i=new RegExp("[一-龥]+");return e.split("").forEach(function(a){i.test(a)?n+=t:n+=TE(a,t)}),[n,t]},kE=function(e,t){return typeof t!="number"||t<=0||t>=e.length?e:e.substring(0,t)+"..."},sg=function(e,t){var n=[],i={},a={};e.forEach(function(u){a[u.id]=u}),e.forEach(function(u,f){var l=Vt(u);l.itemType="combo",l.children=void 0,l.parentId===l.id?(console.warn("The parentId for combo ".concat(l.id," can not be the same as the combo's id")),delete l.parentId):l.parentId&&!a[l.parentId]&&(console.warn("The parent combo for combo ".concat(l.id," does not exist!")),delete l.parentId);var c=i[l.id];if(c){if(l.children=c.children,i[l.id]=l,c=l,!c.parentId){n.push(c);return}var h=i[c.parentId];if(h)h.children?h.children.push(l):h.children=[l];else{var d={id:c.parentId,children:[c]};i[c.parentId]=d,i[l.id]=l}return}if(Pe(u.parentId)){var v=i[u.parentId];if(v)v.children?v.children.push(l):v.children=[l],i[l.id]=l;else{var p={id:u.parentId,children:[l]};i[p.id]=p,i[l.id]=l}}else n.push(l),i[l.id]=l});var o={};(t||[]).forEach(function(u){o[u.id]=u;var f=i[u.comboId];if(f){var l={id:u.id,comboId:u.comboId};f.children?f.children.push(l):f.children=[l],l.itemType="node",i[u.id]=l}});var s=0;return n.forEach(function(u){u.depth=s+10,Mn(u,function(f){var l,c=i[f.id].itemType;c==="node"?l=i[f.comboId]:l=i[f.parentId],l&&c==="node"?f.depth=s+1:f.depth=s+10,s<f.depth&&(s=f.depth);var h=o[f.id];return h&&(h.depth=f.depth),!0})}),n},ug=function(e,t,n){var i,a=e,o,s={root:{children:e}},u=!1,f="root";(e||[]).forEach(function(v){if(!u){if(v.id===t){o=v,v.itemType==="combo"?o.parentId=n:o.comboId=n,u=!0;return}Mn(v,function(p){var g;return s[p.id]={children:(p==null?void 0:p.children)||[]},a=(g=s[p.parentId||p.comboId||"root"])===null||g===void 0?void 0:g.children,p&&(p.removed||t===p.id)&&a?(f=p.parentId||p.comboId||"root",o=p,p.itemType==="combo"?o.parentId=n:o.comboId=n,u=!0,!1):!0})}}),a=(i=s[f])===null||i===void 0?void 0:i.children;var l=a?a.indexOf(o):-1;if(l>-1&&a.splice(l,1),u||(o={id:t,itemType:"node",comboId:n},s[t]={children:void 0}),t){var c=!1;if(n){var h=0;(e||[]).forEach(function(v){c||Mn(v,function(p){return n===p.id?(c=!0,p.children?p.children.push(o):p.children=[o],h=p.depth,o.itemType==="node"?o.depth=h+2:o.depth=h+1,!1):!0})})}else(!n||!c)&&o.itemType!=="node"&&e.push(o);var d=o.depth;Mn(o,function(v){return v.itemType==="node"?d+=2:d+=1,v.depth=d,!0})}return e},Jc=function(e,t,n){var i={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!e||e.length===0){var a=n==null?void 0:n.getModel(),o=a||{},s=o.x,u=o.y,f=o.fixSize,l=o.collapsed,c=o.fixCollapseSize,h=l?c:f,d=vt(h)?h:[h,h],v=d[0],p=d[1],g=[v/2,p/2];return{minX:s-g[0],minY:u-g[1],maxX:s+g[0],maxY:u+g[1],x:s,y:u,width:v,height:p}}return e.forEach(function(y){var m=t.findById(y.id);if(!(!m||!m.isVisible())){m.set("bboxCanvasCache",void 0);var b=m.getCanvasBBox();b.x&&i.minX>b.minX&&(i.minX=b.minX),b.y&&i.minY>b.minY&&(i.minY=b.minY),b.x&&i.maxX<b.maxX&&(i.maxX=b.maxX),b.y&&i.maxY<b.maxY&&(i.maxY=b.maxY)}}),i.x=(i.minX+i.maxX)/2,i.y=(i.minY+i.maxY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY,i.centerX=(i.minX+i.maxX)/2,i.centerY=(i.minY+i.maxY)/2,(n==null?void 0:n.getKeyShape().get("type"))==="circle"&&(i.width=Math.hypot(i.height,i.width),i.height=i.width),Object.keys(i).forEach(function(y){(i[y]===1/0||i[y]===-1/0)&&(i[y]=void 0)}),i},W4=function(e){var t=ht(e.x)||ht(e.y)||e.type||e.anchorPoints||e.size;return e.style&&(t=t||ht(e.style.r)||ht(e.style.width)||ht(e.style.height)||ht(e.style.rx)||ht(e.style.ry)),t},eh=function(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];if(!(n==="img"&&!Pe(i)))if(un(i)&&!vt(i)){var a={};Object.keys(i).forEach(function(o){var s=i[o];o==="img"&&!Pe(s)||(a[o]=Vt(s))}),t[n]=a}else t[n]=Vt(i)}),t},vf=function(e){var t=e.animateCfg,n=e.callback,i;if(!t)i={duration:500,callback:n};else if(i=Vt(t),t.callback){var a=t.callback;i.callback=function(){n(),a()}}else i.callback=n;return i};const V4=Object.freeze(Object.defineProperty({__proto__:null,cloneBesidesImg:eh,getAnimateCfgWithCallback:vf,getBBox:Qc,getComboBBox:Jc,getLabelPosition:AE,getLetterWidth:TE,getLoopCfgs:CE,getTextSize:IE,plainCombosToTrees:sg,reconstructTree:ug,shouldRefreshEdge:W4,traverseTree:Mn,traverseTreeUp:qi,truncateLabelByLength:kE},Symbol.toStringTag,{value:"Module"}));var LE=function(e){if(!e)return console.error("G6 Error Tips: the data must be defined"),!1;var t=e.nodes,n=e.edges,i=e.combos,a=i===void 0?[]:i;if(!t&&!n){var o=!0;return Mn(e,function(h){return Pe(h.id)?!0:(o=!1,!1)}),o}var s=(t||[]).find(function(h){return!Pe(h.id)});if(s)return console.warn("G6 Warning Tips: missing 'id' property, or %c".concat(s.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1;var u=(t||[]).map(function(h){return h.id}),f=a==null?void 0:a.map(function(h){return h.id}),l=Yn(Yn([],u,!0),f,!0),c=(n||[]).find(function(h){return!l.includes(h.source)||!l.includes(h.target)});return c?(console.warn("G6 Warning Tips: The source %c".concat(c.source,"%c or the target %c").concat(c.target,"%c of the edge do not exist in the nodes or combos."),"font-size: 20px; color: red;","","font-size: 20px; color: red;",""),!1):!0},H4=function(e,t){if(e==="node"||e==="combo"){if(t.id&&!Pe(t.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(t.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(e==="edge"&&(!t.source||!t.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0},q4=function(){function r(e){this.graph=e,this.destroyed=!1,this.modes=e.get("modes")||{default:[]},this.formatModes(),this.mode=e.get("defaultMode")||"default",this.currentBehaves=[],this.setMode(this.mode)}return r.prototype.formatModes=function(){var e=this.modes;ye(e,function(t){ye(t,function(n,i){Pe(n)&&(t[i]={type:n})})})},r.prototype.setBehaviors=function(e){var t=this.graph,n=this.modes[e],i=[],a;ye(n||[],function(o){var s=Sp.getBehavior(o.type||o);s&&(a=new s(o),a&&(a.bind(t),i.push(a)))}),this.currentBehaves=i},r.mergeBehaviors=function(e,t){return ye(t,function(n){e.indexOf(n)<0&&(Pe(n)&&(n={type:n}),e.push(n))}),e},r.filterBehaviors=function(e,t){var n=[];return e.forEach(function(i){var a="";Pe(i)?a=i:a=i.type,t.indexOf(a)<0&&n.push(i)}),n},r.prototype.setMode=function(e){var t=this,n=t.modes,i=t.graph,a=e,o=n[a];o&&(i.emit("beforemodechange",{mode:e}),ye(this.currentBehaves,function(s){s.delegate&&s.delegate.remove(),s.unbind(i)}),this.setBehaviors(a),i.emit("aftermodechange",{mode:e}),this.mode=e)},r.prototype.getMode=function(){return this.mode},r.prototype.manipulateBehaviors=function(e,t,n){var i=this,a;if(vt(e)?a=e:a=[e],vt(t))return ye(t,function(s){i.modes[s]?n?i.modes[s]=r.mergeBehaviors(i.modes[s]||[],a):i.modes[s]=r.filterBehaviors(i.modes[s]||[],a):n&&(i.modes[s]=a)}),this;var o=t;return t||(o=this.mode),this.modes[o]||n&&(this.modes[o]=a),n?this.modes[o]=r.mergeBehaviors(this.modes[o]||[],a):this.modes[o]=r.filterBehaviors(this.modes[o]||[],a),this.formatModes(),this.setMode(this.mode),this},r.prototype.updateBehavior=function(e,t,n){Pe(e)&&(e={type:e});var i=[];if(!n||n===this.mode||n==="default"){if(i=this.currentBehaves,!i||!i.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var a=i.length,o=0;o<a;o++){var s=i[o];if(s.type===e.type)return s.updateCfg(t),this;o===a-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}else{if(i=this.modes[n],!i||!i.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var u=i.length,o=0;o<u;o++){var s=i[o];if(s.type===e.type||s===e.type)return s===e.type&&(s={type:s}),Object.assign(s,t),i[o]=s,this;o===u-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}return this},r.prototype.destroy=function(){this.graph=null,this.modes=null,this.currentBehaves=null,this.destroyed=!0},r}(),pf=`	
\v\f\r   ᠎             　\u2028\u2029`,Z4=new RegExp("([a-z])["+pf+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+pf+"]*,?["+pf+"]*)+)","ig"),K4=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+pf+"]*,?["+pf+"]*","ig"),Ys=function(r){if(!r)return null;if(vt(r))return r;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},t=[];return String(r).replace(Z4,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(K4,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return r}),t},fg=function(r,e){for(var t=[],n=0,i=r.length;i-2*!e>n;n+=2){var a=[{x:+r[n-2],y:+r[n-1]},{x:+r[n],y:+r[n+1]},{x:+r[n+2],y:+r[n+3]},{x:+r[n+4],y:+r[n+5]}];e?n?i-4===n?a[3]={x:+r[0],y:+r[1]}:i-2===n&&(a[2]={x:+r[0],y:+r[1]},a[3]={x:+r[2],y:+r[3]}):a[0]={x:+r[i-2],y:+r[i-1]}:i-4===n?a[3]=a[2]:n||(a[0]={x:+r[n],y:+r[n+1]}),t.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return t},th=function(r,e,t,n,i){var a=[];if(i===null&&n===null&&(n=t),r=+r,e=+e,t=+t,n=+n,i!==null){var o=Math.PI/180,s=r+t*Math.cos(-n*o),u=r+t*Math.cos(-i*o),f=e+t*Math.sin(-n*o),l=e+t*Math.sin(-i*o);a=[["M",s,f],["A",t,t,0,+(i-n>180),0,u,l]]}else a=[["M",r,e],["m",0,-n],["a",t,n,0,1,1,0,2*n],["a",t,n,0,1,1,0,-2*n],["z"]];return a},lg=function(r){if(r=Ys(r),!r||!r.length)return[["M",0,0]];var e=[],t=0,n=0,i=0,a=0,o=0,s,u;r[0][0]==="M"&&(t=+r[0][1],n=+r[0][2],i=t,a=n,o++,e[0]=["M",t,n]);for(var f=r.length===3&&r[0][0]==="M"&&r[1][0].toUpperCase()==="R"&&r[2][0].toUpperCase()==="Z",l=void 0,c=void 0,h=o,d=r.length;h<d;h++){if(e.push(l=[]),c=r[h],s=c[0],s!==s.toUpperCase())switch(l[0]=s.toUpperCase(),l[0]){case"A":l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5],l[6]=+c[6]+t,l[7]=+c[7]+n;break;case"V":l[1]=+c[1]+n;break;case"H":l[1]=+c[1]+t;break;case"R":u=[t,n].concat(c.slice(1));for(var v=2,p=u.length;v<p;v++)u[v]=+u[v]+t,u[++v]=+u[v]+n;e.pop(),e=e.concat(fg(u,f));break;case"O":e.pop(),u=th(t,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);break;case"U":e.pop(),e=e.concat(th(t,n,c[1],c[2],c[3])),l=["U"].concat(e[e.length-1].slice(-2));break;case"M":i=+c[1]+t,a=+c[2]+n;break;default:for(var v=1,p=c.length;v<p;v++)l[v]=+c[v]+(v%2?t:n)}else if(s==="R")u=[t,n].concat(c.slice(1)),e.pop(),e=e.concat(fg(u,f)),l=["R"].concat(c.slice(-2));else if(s==="O")e.pop(),u=th(t,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);else if(s==="U")e.pop(),e=e.concat(th(t,n,c[1],c[2],c[3])),l=["U"].concat(e[e.length-1].slice(-2));else for(var g=0,y=c.length;g<y;g++)l[g]=c[g];if(s=s.toUpperCase(),s!=="O")switch(l[0]){case"Z":t=+i,n=+a;break;case"H":t=l[1];break;case"V":n=l[1];break;case"M":i=l[l.length-2],a=l[l.length-1];break;default:t=l[l.length-2],n=l[l.length-1]}}return e},rh=function(r,e,t,n){return[r,e,t,n,t,n]},NE=function(r,e,t,n,i,a){var o=.3333333333333333,s=2/3;return[o*r+s*t,o*e+s*n,o*i+s*t,o*a+s*n,i,a]},OE=function(r,e,t,n,i,a,o,s,u,f){t===n&&(t+=1);var l=Math.PI*120/180,c=Math.PI/180*(+i||0),h=[],d,v,p,g,y,m=function(Ne,Ze,at){var nt=Ne*Math.cos(at)-Ze*Math.sin(at),St=Ne*Math.sin(at)+Ze*Math.cos(at);return{x:nt,y:St}};if(f)v=f[0],p=f[1],g=f[2],y=f[3];else{d=m(r,e,-c),r=d.x,e=d.y,d=m(s,u,-c),s=d.x,u=d.y,r===s&&e===u&&(s+=1,u+=1);var b=(r-s)/2,x=(e-u)/2,w=b*b/(t*t)+x*x/(n*n);w>1&&(w=Math.sqrt(w),t=w*t,n=w*n);var E=t*t,_=n*n,M=(a===o?-1:1)*Math.sqrt(Math.abs((E*_-E*x*x-_*b*b)/(E*x*x+_*b*b)));g=M*t*x/n+(r+s)/2,y=M*-n*b/t+(e+u)/2,v=Math.asin(((e-y)/n).toFixed(9)),p=Math.asin(((u-y)/n).toFixed(9)),v=r<g?Math.PI-v:v,p=s<g?Math.PI-p:p,v<0&&(v=Math.PI*2+v),p<0&&(p=Math.PI*2+p),o&&v>p&&(v=v-Math.PI*2),!o&&p>v&&(p=p-Math.PI*2)}var C=p-v;if(Math.abs(C)>l){var S=p,A=s,T=u;p=v+l*(o&&p>v?1:-1),s=g+t*Math.cos(p),u=y+n*Math.sin(p),h=OE(s,u,t,n,i,0,o,A,T,[p,S,g,y])}C=p-v;var k=Math.cos(v),O=Math.sin(v),G=Math.cos(p),D=Math.sin(p),$=Math.tan(C/4),Y=4/3*t*$,N=4/3*n*$,P=[r,e],W=[r+Y*O,e-N*k],J=[s+Y*D,u-N*G],te=[s,u];if(W[0]=2*P[0]-W[0],W[1]=2*P[1]-W[1],f)return[W,J,te].concat(h);h=[W,J,te].concat(h).join().split(",");for(var H=[],pe=0,Te=h.length;pe<Te;pe++)H[pe]=pe%2?m(h[pe-1],h[pe],c).y:m(h[pe],h[pe+1],c).x;return H},cg=function(r,e){var t=lg(r),n=e&&lg(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=[],s=[],u="",f="",l,c=function(b,x,w){var E,_;if(!b)return["C",x.x,x.y,x.x,x.y,x.x,x.y];switch(!(b[0]in{T:1,Q:1})&&(x.qx=x.qy=null),b[0]){case"M":x.X=b[1],x.Y=b[2];break;case"A":b=["C"].concat(OE.apply(0,[x.x,x.y].concat(b.slice(1))));break;case"S":w==="C"||w==="S"?(E=x.x*2-x.bx,_=x.y*2-x.by):(E=x.x,_=x.y),b=["C",E,_].concat(b.slice(1));break;case"T":w==="Q"||w==="T"?(x.qx=x.x*2-x.qx,x.qy=x.y*2-x.qy):(x.qx=x.x,x.qy=x.y),b=["C"].concat(NE(x.x,x.y,x.qx,x.qy,b[1],b[2]));break;case"Q":x.qx=b[1],x.qy=b[2],b=["C"].concat(NE(x.x,x.y,b[1],b[2],b[3],b[4]));break;case"L":b=["C"].concat(rh(x.x,x.y,b[1],b[2]));break;case"H":b=["C"].concat(rh(x.x,x.y,b[1],x.y));break;case"V":b=["C"].concat(rh(x.x,x.y,x.x,b[1]));break;case"Z":b=["C"].concat(rh(x.x,x.y,x.X,x.Y));break}return b},h=function(b,x){if(b[x].length>7){b[x].shift();for(var w=b[x];w.length;)o[x]="A",n&&(s[x]="A"),b.splice(x++,0,["C"].concat(w.splice(0,6)));b.splice(x,1),l=Math.max(t.length,n&&n.length||0)}},d=function(b,x,w,E,_){b&&x&&b[_][0]==="M"&&x[_][0]!=="M"&&(x.splice(_,0,["M",E.x,E.y]),w.bx=0,w.by=0,w.x=b[_][1],w.y=b[_][2],l=Math.max(t.length,n&&n.length||0))};l=Math.max(t.length,n&&n.length||0);for(var v=0;v<l;v++){t[v]&&(u=t[v][0]),u!=="C"&&(o[v]=u,v&&(f=o[v-1])),t[v]=c(t[v],i,f),o[v]!=="A"&&u==="C"&&(o[v]="C"),h(t,v),n&&(n[v]&&(u=n[v][0]),u!=="C"&&(s[v]=u,v&&(f=s[v-1])),n[v]=c(n[v],a,f),s[v]!=="A"&&u==="C"&&(s[v]="C"),h(n,v)),d(t,n,i,a,v),d(n,t,a,i,v);var p=t[v],g=n&&n[v],y=p.length,m=n&&g.length;i.x=p[y-2],i.y=p[y-1],i.bx=parseFloat(p[y-4])||i.x,i.by=parseFloat(p[y-3])||i.y,a.bx=n&&(parseFloat(g[m-4])||a.x),a.by=n&&(parseFloat(g[m-3])||a.y),a.x=n&&g[m-2],a.y=n&&g[m-1]}return n?[t,n]:t},Q4=/,?([a-z]),?/gi,DE=function(r){return r.join(",").replace(Q4,"$1")},PE=function(r,e,t,n,i){var a=-3*e+9*t-9*n+3*i,o=r*a+6*e-12*t+6*n;return r*o-3*e+3*t},RE=function(r,e,t,n,i,a,o,s,u){u===null&&(u=1),u=u>1?1:u<0?0:u;for(var f=u/2,l=12,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,v=0;v<l;v++){var p=f*c[v]+f,g=PE(p,r,t,i,o),y=PE(p,e,n,a,s),m=g*g+y*y;d+=h[v]*Math.sqrt(m)}return f*d},J4=function(r,e,t,n,i,a,o,s){for(var u=[],f=[[],[]],l,c,h,d,v=0;v<2;++v){if(v===0?(c=6*r-12*t+6*i,l=-3*r+9*t-9*i+3*o,h=3*t-3*r):(c=6*e-12*n+6*a,l=-3*e+9*n-9*a+3*s,h=3*n-3*e),Math.abs(l)<1e-12){if(Math.abs(c)<1e-12)continue;d=-h/c,d>0&&d<1&&u.push(d);continue}var p=c*c-4*h*l,g=Math.sqrt(p);if(!(p<0)){var y=(-c+g)/(2*l);y>0&&y<1&&u.push(y);var m=(-c-g)/(2*l);m>0&&m<1&&u.push(m)}}for(var b=u.length,x=b,w;b--;)d=u[b],w=1-d,f[0][b]=w*w*w*r+3*w*w*d*t+3*w*d*d*i+d*d*d*o,f[1][b]=w*w*w*e+3*w*w*d*n+3*w*d*d*a+d*d*d*s;return f[0][x]=r,f[1][x]=e,f[0][x+1]=o,f[1][x+1]=s,f[0].length=f[1].length=x+2,{min:{x:Math.min.apply(0,f[0]),y:Math.min.apply(0,f[1])},max:{x:Math.max.apply(0,f[0]),y:Math.max.apply(0,f[1])}}},eG=function(r,e,t,n,i,a,o,s){if(!(Math.max(r,t)<Math.min(i,o)||Math.min(r,t)>Math.max(i,o)||Math.max(e,n)<Math.min(a,s)||Math.min(e,n)>Math.max(a,s))){var u=(r*n-e*t)*(i-o)-(r-t)*(i*s-a*o),f=(r*n-e*t)*(a-s)-(e-n)*(i*s-a*o),l=(r-t)*(a-s)-(e-n)*(i-o);if(l){var c=u/l,h=f/l,d=+c.toFixed(2),v=+h.toFixed(2);if(!(d<+Math.min(r,t).toFixed(2)||d>+Math.max(r,t).toFixed(2)||d<+Math.min(i,o).toFixed(2)||d>+Math.max(i,o).toFixed(2)||v<+Math.min(e,n).toFixed(2)||v>+Math.max(e,n).toFixed(2)||v<+Math.min(a,s).toFixed(2)||v>+Math.max(a,s).toFixed(2)))return{x:c,y:h}}}},no=function(r,e,t){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},BE=function(r,e,t,n,i){if(i)return[["M",+r+ +i,e],["l",t-i*2,0],["a",i,i,0,0,1,i,i],["l",0,n-i*2],["a",i,i,0,0,1,-i,i],["l",i*2-t,0],["a",i,i,0,0,1,-i,-i],["l",0,i*2-n],["a",i,i,0,0,1,i,-i],["z"]];var a=[["M",r,e],["l",t,0],["l",0,n],["l",-t,0],["z"]];return a.parsePathArray=DE,a},hg=function(r,e,t,n){return r===null&&(r=e=t=n=0),e===null&&(e=r.y,t=r.width,n=r.height,r=r.x),{x:r,y:e,width:t,w:t,height:n,h:n,x2:r+t,y2:e+n,cx:r+t/2,cy:e+n/2,r1:Math.min(t,n)/2,r2:Math.max(t,n)/2,r0:Math.sqrt(t*t+n*n)/2,path:BE(r,e,t,n),vb:[r,e,t,n].join(" ")}},tG=function(r,e){return r=hg(r),e=hg(e),no(e,r.x,r.y)||no(e,r.x2,r.y)||no(e,r.x,r.y2)||no(e,r.x2,r.y2)||no(r,e.x,e.y)||no(r,e.x2,e.y)||no(r,e.x,e.y2)||no(r,e.x2,e.y2)||(r.x<e.x2&&r.x>e.x||e.x<r.x2&&e.x>r.x)&&(r.y<e.y2&&r.y>e.y||e.y<r.y2&&e.y>r.y)},FE=function(r,e,t,n,i,a,o,s){vt(r)||(r=[r,e,t,n,i,a,o,s]);var u=J4.apply(null,r);return hg(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},GE=function(r,e,t,n,i,a,o,s,u){var f=1-u,l=Math.pow(f,3),c=Math.pow(f,2),h=u*u,d=h*u,v=l*r+c*3*u*t+f*3*u*u*i+d*o,p=l*e+c*3*u*n+f*3*u*u*a+d*s,g=r+2*u*(t-r)+h*(i-2*t+r),y=e+2*u*(n-e)+h*(a-2*n+e),m=t+2*u*(i-t)+h*(o-2*i+t),b=n+2*u*(a-n)+h*(s-2*a+n),x=f*r+u*t,w=f*e+u*n,E=f*i+u*o,_=f*a+u*s,M=90-Math.atan2(g-m,y-b)*180/Math.PI;return{x:v,y:p,m:{x:g,y},n:{x:m,y:b},start:{x,y:w},end:{x:E,y:_},alpha:M}},rG=function(r,e,t){var n=FE(r),i=FE(e);if(!tG(n,i))return t?0:[];for(var a=RE.apply(0,r),o=RE.apply(0,e),s=~~(a/8),u=~~(o/8),f=[],l=[],c={},h=t?0:[],d=0;d<s+1;d++){var v=GE.apply(0,r.concat(d/s));f.push({x:v.x,y:v.y,t:d/s})}for(var d=0;d<u+1;d++){var v=GE.apply(0,e.concat(d/u));l.push({x:v.x,y:v.y,t:d/u})}for(var d=0;d<s;d++)for(var p=0;p<u;p++){var g=f[d],y=f[d+1],m=l[p],b=l[p+1],x=Math.abs(y.x-g.x)<.001?"y":"x",w=Math.abs(b.x-m.x)<.001?"y":"x",E=eG(g.x,g.y,y.x,y.y,m.x,m.y,b.x,b.y);if(E){if(c[E.x.toFixed(4)]===E.y.toFixed(4))continue;c[E.x.toFixed(4)]=E.y.toFixed(4);var _=g.t+Math.abs((E[x]-g[x])/(y[x]-g[x]))*(y.t-g.t),M=m.t+Math.abs((E[w]-m[w])/(b[w]-m[w]))*(b.t-m.t);_>=0&&_<=1&&M>=0&&M<=1&&(t?h+=1:h.push({x:E.x,y:E.y,t1:_,t2:M}))}}return h},nG=function(r,e,t){r=cg(r),e=cg(e);for(var n,i,a,o,s,u,f,l,c,h,d=t?0:[],v=0,p=r.length;v<p;v++){var g=r[v];if(g[0]==="M")n=s=g[1],i=u=g[2];else{g[0]==="C"?(c=[n,i].concat(g.slice(1)),n=c[6],i=c[7]):(c=[n,i,n,i,s,u,s,u],n=s,i=u);for(var y=0,m=e.length;y<m;y++){var b=e[y];if(b[0]==="M")a=f=b[1],o=l=b[2];else{b[0]==="C"?(h=[a,o].concat(b.slice(1)),a=h[6],o=h[7]):(h=[a,o,a,o,f,l,f,l],a=f,o=l);var x=rG(c,h,t);if(t)d+=x;else{for(var w=0,E=x.length;w<E;w++)x[w].segment1=v,x[w].segment2=y,x[w].bez1=c,x[w].bez2=h;d=d.concat(x)}}}}}return d},iG=function(r,e){return nG(r,e)};function aG(r,e){var t=[],n=[];function i(a,o){if(a.length===1)t.push(a[0]),n.push(a[0]);else{for(var s=[],u=0;u<a.length-1;u++)u===0&&t.push(a[0]),u===a.length-2&&n.push(a[u+1]),s[u]=[(1-o)*a[u][0]+o*a[u+1][0],(1-o)*a[u][1]+o*a[u+1][1]];i(s,o)}}return r.length&&i(r,e),{left:t,right:n.reverse()}}function oG(r,e,t){var n=[[r[1],r[2]]];t=t||2;var i=[];e[0]==="A"?(n.push(e[6]),n.push(e[7])):e[0]==="C"?(n.push([e[1],e[2]]),n.push([e[3],e[4]]),n.push([e[5],e[6]])):e[0]==="S"||e[0]==="Q"?(n.push([e[1],e[2]]),n.push([e[3],e[4]])):n.push([e[1],e[2]]);for(var a=n,o=1/t,s=0;s<t-1;s++){var u=o/(1-o*s),f=aG(a,u);i.push(f.left),a=f.right}i.push(a);var l=i.map(function(c){var h=[];return c.length===4&&(h.push("C"),h=h.concat(c[2])),c.length>=3&&(c.length===3&&h.push("Q"),h=h.concat(c[1])),c.length===2&&h.push("L"),h=h.concat(c[c.length-1]),h});return l}var sG=function(r,e,t){if(t===1)return[[].concat(r)];var n=[];if(e[0]==="L"||e[0]==="C"||e[0]==="Q")n=n.concat(oG(r,e,t));else{var i=[].concat(r);i[0]==="M"&&(i[0]="L");for(var a=0;a<=t-1;a++)n.push(i)}return n},uG=function(r,e){if(r.length===1)return r;var t=r.length-1,n=e.length-1,i=t/n,a=[];if(r.length===1&&r[0][0]==="M"){for(var o=0;o<n-t;o++)r.push(r[0]);return r}for(var o=0;o<n;o++){var s=Math.floor(i*o);a[s]=(a[s]||0)+1}var u=a.reduce(function(f,l,c){return c===t?f.concat(r[t]):f.concat(sG(r[c],r[c+1],l))},[]);return u.unshift(r[0]),(e[n]==="Z"||e[n]==="z")&&u.push("Z"),u},fG=function(r,e){if(r.length!==e.length)return!1;var t=!0;return ye(r,function(n,i){if(n!==e[i])return t=!1,!1}),t};function lG(r,e,t){var n=null,i=t;return e<i&&(i=e,n="add"),r<i&&(i=r,n="del"),{type:n,min:i}}var cG=function(r,e){var t=r.length,n=e.length,i,a,o=0;if(t===0||n===0)return null;for(var s=[],u=0;u<=t;u++)s[u]=[],s[u][0]={min:u};for(var f=0;f<=n;f++)s[0][f]={min:f};for(var u=1;u<=t;u++){i=r[u-1];for(var f=1;f<=n;f++){a=e[f-1],fG(i,a)?o=0:o=1;var l=s[u-1][f].min+1,c=s[u][f-1].min+1,h=s[u-1][f-1].min+o;s[u][f]=lG(l,c,h)}}return s},zE=function(r,e){var t=cG(r,e),n=r.length,i=e.length,a=[],o=1,s=1;if(t[n][i].min!==n){for(var u=1;u<=n;u++){var f=t[u][u].min;s=u;for(var l=o;l<=i;l++)t[u][l].min<f&&(f=t[u][l].min,s=l);o=s,t[u][o].type&&a.push({index:u-1,type:t[u][o].type})}for(var u=a.length-1;u>=0;u--)o=a[u].index,a[u].type==="add"?r.splice(o,0,[].concat(r[o])):r.splice(o,1)}n=r.length;var c=i-n;if(n<i)for(var u=0;u<c;u++)r[n-1][0]==="z"||r[n-1][0]==="Z"?r.splice(n-2,0,r[n-2]):r.push(r[n-1]),n+=1;return r};function dg(r,e,t){for(var n=[].concat(r),i,a=1/(t+1),o=$E(e)[0],s=1;s<=t;s++)a*=s,i=Math.floor(r.length*a),i===0?n.unshift([o[0]*a+r[i][0]*(1-a),o[1]*a+r[i][1]*(1-a)]):n.splice(i,0,[o[0]*a+r[i][0]*(1-a),o[1]*a+r[i][1]*(1-a)]);return n}function $E(r){var e=[];switch(r[0]){case"M":e.push([r[1],r[2]]);break;case"L":e.push([r[1],r[2]]);break;case"A":e.push([r[6],r[7]]);break;case"Q":e.push([r[3],r[4]]),e.push([r[1],r[2]]);break;case"T":e.push([r[1],r[2]]);break;case"C":e.push([r[5],r[6]]),e.push([r[1],r[2]]),e.push([r[3],r[4]]);break;case"S":e.push([r[3],r[4]]),e.push([r[1],r[2]]);break;case"H":e.push([r[1],r[1]]);break;case"V":e.push([r[1],r[1]]);break}return e}var vg=function(r,e){if(r.length<=1)return r;for(var t,n=0;n<e.length;n++)if(r[n][0]!==e[n][0])switch(t=$E(r[n]),e[n][0]){case"M":r[n]=["M"].concat(t[0]);break;case"L":r[n]=["L"].concat(t[0]);break;case"A":r[n]=[].concat(e[n]),r[n][6]=t[0][0],r[n][7]=t[0][1];break;case"Q":if(t.length<2)if(n>0)t=dg(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["Q"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"T":r[n]=["T"].concat(t[0]);break;case"C":if(t.length<3)if(n>0)t=dg(t,r[n-1],2);else{r[n]=e[n];break}r[n]=["C"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"S":if(t.length<2)if(n>0)t=dg(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["S"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;default:r[n]=e[n]}return r};const hG=Object.freeze(Object.defineProperty({__proto__:null,catmullRomToBezier:fg,fillPath:uG,fillPathByDiff:zE,formatPath:vg,intersection:iG,parsePathArray:DE,parsePathString:Ys,pathToAbsolute:lg,pathToCurve:cg,rectPath:BE},Symbol.toStringTag,{value:"Module"}));var jE=function(){function r(e,t){this.bubbles=!0,this.target=null,this.currentTarget=null,this.delegateTarget=null,this.delegateObject=null,this.defaultPrevented=!1,this.propagationStopped=!1,this.shape=null,this.fromShape=null,this.toShape=null,this.propagationPath=[],this.type=e,this.name=e,this.originalEvent=t,this.timeStamp=t.timeStamp}return r.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},r.prototype.stopPropagation=function(){this.propagationStopped=!0},r.prototype.toString=function(){var e=this.type;return"[Event (type="+e+")]"},r.prototype.save=function(){},r.prototype.restore=function(){},r}();function UE(r,e){var t=r.indexOf(e);t!==-1&&r.splice(t,1)}var XE=typeof window<"u"&&typeof window.document<"u";function YE(r,e){if(r.isCanvas())return!0;for(var t=e.getParent(),n=!1;t;){if(t===r){n=!0;break}t=t.getParent()}return n}function pg(r){return r.cfg.visible&&r.cfg.capture}var dG=function(r){It(e,r);function e(t){var n=r.call(this)||this;n.destroyed=!1;var i=n.getDefaultCfg();return n.cfg=gt(i,t),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(t){return this.cfg[t]},e.prototype.set=function(t,n){this.cfg[t]=n},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(px),WE=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},vG=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),pG=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),gG=function(){function r(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"}return r}(),yG=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),mG=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),bG=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,xG=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,VE=3,wG=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",bG]],HE=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function qE(r){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new mG:typeof navigator<"u"?_G(navigator.userAgent):MG()}function EG(r){return r!==""&&wG.reduce(function(e,t){var n=t[0],i=t[1];if(e)return e;var a=i.exec(r);return!!a&&[n,a]},!1)}function _G(r){var e=EG(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new yG;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<VE&&(i=WE(WE([],i,!0),CG(VE-i.length),!0)):i=[];var a=i.join("."),o=SG(r),s=xG.exec(r);return s&&s[1]?new gG(t,a,o,s[1]):new vG(t,a,o)}function SG(r){for(var e=0,t=HE.length;e<t;e++){var n=HE[e],i=n[0],a=n[1],o=a.exec(r);if(o)return i}return null}function MG(){var r=typeof process<"u"&&process.version;return r?new pG(process.version.slice(1)):null}function CG(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}function ZE(r,e){var t=[],n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],u=r[5],f=r[6],l=r[7],c=r[8],h=e[0],d=e[1],v=e[2],p=e[3],g=e[4],y=e[5],m=e[6],b=e[7],x=e[8];return t[0]=h*n+d*o+v*f,t[1]=h*i+d*s+v*l,t[2]=h*a+d*u+v*c,t[3]=p*n+g*o+y*f,t[4]=p*i+g*s+y*l,t[5]=p*a+g*u+y*c,t[6]=m*n+b*o+x*f,t[7]=m*i+b*s+x*l,t[8]=m*a+b*u+x*c,t}function Xo(r,e){var t=[],n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function KE(r){var e=[],t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=r[8],c=l*o-s*f,h=-l*a+s*u,d=f*a-o*u,v=t*c+n*h+i*d;return v?(v=1/v,e[0]=c*v,e[1]=(-l*n+i*f)*v,e[2]=(s*n-i*o)*v,e[3]=h*v,e[4]=(l*t-i*u)*v,e[5]=(-s*t+i*a)*v,e[6]=d*v,e[7]=(-f*t+n*u)*v,e[8]=(o*t-n*a)*v,e):null}var gf=ni,gg="matrix",AG=["zIndex","capture","visible","type"],TG=["repeat"],IG=":",kG="*";function LG(r){for(var e=[],t=0;t<r.length;t++)vt(r[t])?e.push([].concat(r[t])):e.push(r[t]);return e}function NG(r,e){var t={},n=e.attrs;for(var i in r)t[i]=n[i];return t}function OG(r,e){var t={},n=e.attr();return ye(r,function(i,a){TG.indexOf(a)===-1&&!Qa(n[a],i)&&(t[a]=i)}),t}function DG(r,e){if(e.onFrame)return r;var t=e.startTime,n=e.delay,i=e.duration,a=Object.prototype.hasOwnProperty;return ye(r,function(o){t+n<o.startTime+o.delay+o.duration&&i>o.delay&&ye(e.toAttrs,function(s,u){a.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),r}var QE=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;n.attrs={};var i=n.getDefaultAttrs();return gt(i,t.attrs),n.attrs=i,n.initAttrs(i),n.initAnimate(),n}return e.prototype.getDefaultCfg=function(){return{visible:!0,capture:!0,zIndex:0}},e.prototype.getDefaultAttrs=function(){return{matrix:this.getDefaultMatrix(),opacity:1}},e.prototype.onCanvasChange=function(t){},e.prototype.initAttrs=function(t){},e.prototype.initAnimate=function(){this.set("animable",!0),this.set("animating",!1)},e.prototype.isGroup=function(){return!1},e.prototype.getParent=function(){return this.get("parent")},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.attr=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=n[0],o=n[1];if(!a)return this.attrs;if(un(a)){for(var s in a)this.setAttr(s,a[s]);return this.afterAttrsChange(a),this}return n.length===2?(this.setAttr(a,o),this.afterAttrsChange((t={},t[a]=o,t)),this):this.attrs[a]},e.prototype.isClipped=function(t,n){var i=this.getClip();return i&&!i.isHit(t,n)},e.prototype.setAttr=function(t,n){var i=this.attrs[t];i!==n&&(this.attrs[t]=n,this.onAttrChange(t,n,i))},e.prototype.onAttrChange=function(t,n,i){t==="matrix"&&this.set("totalMatrix",null)},e.prototype.afterAttrsChange=function(t){if(this.cfg.isClipShape){var n=this.cfg.applyTo;n&&n.onCanvasChange("clip")}else this.onCanvasChange("attr")},e.prototype.show=function(){return this.set("visible",!0),this.onCanvasChange("show"),this},e.prototype.hide=function(){return this.set("visible",!1),this.onCanvasChange("hide"),this},e.prototype.setZIndex=function(t){this.set("zIndex",t);var n=this.getParent();return n&&n.sort(),this},e.prototype.toFront=function(){var t=this.getParent();if(t){var n=t.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.push(this),this.onCanvasChange("zIndex")}},e.prototype.toBack=function(){var t=this.getParent();if(t){var n=t.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.unshift(this),this.onCanvasChange("zIndex")}},e.prototype.remove=function(t){t===void 0&&(t=!0);var n=this.getParent();n?(UE(n.getChildren(),this),n.get("clearing")||this.onCanvasChange("remove")):this.onCanvasChange("remove"),t&&this.destroy()},e.prototype.resetMatrix=function(){this.attr(gg,this.getDefaultMatrix()),this.onCanvasChange("matrix")},e.prototype.getMatrix=function(){return this.attr(gg)},e.prototype.setMatrix=function(t){this.attr(gg,t),this.onCanvasChange("matrix")},e.prototype.getTotalMatrix=function(){var t=this.cfg.totalMatrix;if(!t){var n=this.attr("matrix"),i=this.cfg.parentMatrix;i&&n?t=ZE(i,n):t=n||i,this.set("totalMatrix",t)}return t},e.prototype.applyMatrix=function(t){var n=this.attr("matrix"),i=null;t&&n?i=ZE(t,n):i=n||t,this.set("totalMatrix",i),this.set("parentMatrix",t)},e.prototype.getDefaultMatrix=function(){return null},e.prototype.applyToMatrix=function(t){var n=this.attr("matrix");return n?Xo(n,t):t},e.prototype.invertFromMatrix=function(t){var n=this.attr("matrix");if(n){var i=KE(n);if(i)return Xo(i,t)}return t},e.prototype.setClip=function(t){var n=this.getCanvas(),i=null;if(t){var a=this.getShapeBase(),o=js(t.type),s=a[o];s&&(i=new s({type:t.type,isClipShape:!0,applyTo:this,attrs:t.attrs,canvas:n}))}return this.set("clipShape",i),this.onCanvasChange("clip"),i},e.prototype.getClip=function(){var t=this.cfg.clipShape;return t||null},e.prototype.clone=function(){var t=this,n=this.attrs,i={};ye(n,function(s,u){vt(n[u])?i[u]=LG(n[u]):i[u]=n[u]});var a=this.constructor,o=new a({attrs:i});return ye(AG,function(s){o.set(s,t.get(s))}),o},e.prototype.destroy=function(){var t=this.destroyed;t||(this.attrs={},r.prototype.destroy.call(this))},e.prototype.isAnimatePaused=function(){return this.get("_pause").isPaused},e.prototype.animate=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(!(!this.get("timeline")&&!this.get("canvas"))){this.set("animating",!0);var i=this.get("timeline");i||(i=this.get("canvas").get("timeline"),this.set("timeline",i));var a=this.get("animations")||[];i.timer||i.initTimer();var o=t[0],s=t[1],u=t[2],f=u===void 0?"easeLinear":u,l=t[3],c=l===void 0?ff:l,h=t[4],d=h===void 0?0:h,v,p,g,y,m;_r(o)?(v=o,o={}):un(o)&&o.onFrame&&(v=o.onFrame,p=o.repeat),un(s)?(m=s,s=m.duration,f=m.easing||"easeLinear",d=m.delay||0,p=m.repeat||p||!1,c=m.callback||ff,g=m.pauseCallback||ff,y=m.resumeCallback||ff):(ht(c)&&(d=c,c=null),_r(f)?(c=f,f="easeLinear"):f=f||"easeLinear");var b=OG(o,this),x={fromAttrs:NG(b,this),toAttrs:b,duration:s,easing:f,repeat:p,callback:c,pauseCallback:g,resumeCallback:y,delay:d,startTime:i.getTime(),id:Yi(),onFrame:v,pathFormatted:!1};a.length>0?a=DG(a,x):i.addAnimator(this),a.push(x),this.set("animations",a),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var n=this;t===void 0&&(t=!0);var i=this.get("animations");ye(i,function(a){t&&(a.onFrame?n.attr(a.onFrame(1)):n.attr(a.toAttrs)),a.callback&&a.callback()}),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),n=this.get("animations"),i=t.getTime();return ye(n,function(a){a._paused=!0,a._pauseTime=i,a.pauseCallback&&a.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:i}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline"),n=t.getTime(),i=this.get("animations"),a=this.get("_pause").pauseTime;return ye(i,function(o){o.startTime=o.startTime+(n-a),o._paused=!1,o._pauseTime=null,o.resumeCallback&&o.resumeCallback()}),this.set("_pause",{isPaused:!1}),this.set("animations",i),this},e.prototype.emitDelegation=function(t,n){var i=this,a=n.propagationPath;this.getEvents();var o;t==="mouseenter"?o=n.fromShape:t==="mouseleave"&&(o=n.toShape);for(var s=function(c){var h=a[c],d=h.get("name");if(d){if((h.isGroup()||h.isCanvas&&h.isCanvas())&&o&&YE(h,o))return"break";vt(d)?ye(d,function(v){i.emitDelegateEvent(h,v,n)}):u.emitDelegateEvent(h,d,n)}},u=this,f=0;f<a.length;f++){var l=s(f);if(l==="break")break}},e.prototype.emitDelegateEvent=function(t,n,i){var a=this.getEvents(),o=n+IG+i.type;(a[o]||a[kG])&&(i.name=o,i.currentTarget=t,i.delegateTarget=this,i.delegateObject=t.get("delegateObject"),this.emit(o,i))},e.prototype.translate=function(t,n){t===void 0&&(t=0),n===void 0&&(n=0);var i=this.getMatrix(),a=gf(i,[["t",t,n]]);return this.setMatrix(a),this},e.prototype.move=function(t,n){var i=this.attr("x")||0,a=this.attr("y")||0;return this.translate(t-i,n-a),this},e.prototype.moveTo=function(t,n){return this.move(t,n)},e.prototype.scale=function(t,n){var i=this.getMatrix(),a=gf(i,[["s",t,n||t]]);return this.setMatrix(a),this},e.prototype.rotate=function(t){var n=this.getMatrix(),i=gf(n,[["r",t]]);return this.setMatrix(i),this},e.prototype.rotateAtStart=function(t){var n=this.attr(),i=n.x,a=n.y,o=this.getMatrix(),s=gf(o,[["t",-i,-a],["r",t],["t",i,a]]);return this.setMatrix(s),this},e.prototype.rotateAtPoint=function(t,n,i){var a=this.getMatrix(),o=gf(a,[["t",-t,-n],["r",i],["t",t,n]]);return this.setMatrix(o),this},e}(dG),JE={},yg="_INDEX";function e2(r,e){if(r.set("canvas",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){e2(n,e)})}}function t2(r,e){if(r.set("timeline",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){t2(n,e)})}}function PG(r,e,t){e.set("parent",null),e.set("canvas",null),UE(r.getChildren(),e)}function RG(r){return function(e,t){var n=r(e,t);return n===0?e[yg]-t[yg]:n}}var r2=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isCanvas=function(){return!1},e.prototype.getBBox=function(){var t=1/0,n=-1/0,i=1/0,a=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?ye(o,function(u){var f=u.getBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<t&&(t=l),c>n&&(n=c),h<i&&(i=h),d>a&&(a=d)}):(t=0,n=0,i=0,a=0);var s={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return s},e.prototype.getCanvasBBox=function(){var t=1/0,n=-1/0,i=1/0,a=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?ye(o,function(u){var f=u.getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<t&&(t=l),c>n&&(n=c),h<i&&(i=h),d>a&&(a=d)}):(t=0,n=0,i=0,a=0);var s={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return s},e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.children=[],t},e.prototype.onAttrChange=function(t,n,i){if(r.prototype.onAttrChange.call(this,t,n,i),t==="matrix"){var a=this.getTotalMatrix();this._applyChildrenMarix(a)}},e.prototype.applyMatrix=function(t){var n=this.getTotalMatrix();r.prototype.applyMatrix.call(this,t);var i=this.getTotalMatrix();i!==n&&this._applyChildrenMarix(i)},e.prototype._applyChildrenMarix=function(t){var n=this.getChildren();ye(n,function(i){i.applyMatrix(t)})},e.prototype.addShape=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t[0],a=t[1];un(i)?a=i:a.type=i;var o=JE[a.type];o||(o=js(a.type),JE[a.type]=o);var s=this.getShapeBase(),u=new s[o](a);return this.add(u),u},e.prototype.addGroup=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t[0],a=t[1],o;if(_r(i))a?o=new i(a):o=new i({parent:this});else{var s=i||{},u=this.getGroupBase();o=new u(s)}return this.add(o),o},e.prototype.getCanvas=function(){var t;return this.isCanvas()?t=this:t=this.get("canvas"),t},e.prototype.getShape=function(t,n,i){if(!pg(this))return null;var a=this.getChildren(),o;if(this.isCanvas())o=this._findShape(a,t,n,i);else{var s=[t,n,1];s=this.invertFromMatrix(s),this.isClipped(s[0],s[1])||(o=this._findShape(a,s[0],s[1],i))}return o},e.prototype._findShape=function(t,n,i,a){for(var o=null,s=t.length-1;s>=0;s--){var u=t[s];if(pg(u)&&(u.isGroup()?o=u.getShape(n,i,a):u.isHit(n,i)&&(o=u)),o)break}return o},e.prototype.add=function(t){var n=this.getCanvas(),i=this.getChildren(),a=this.get("timeline"),o=t.getParent();o&&PG(o,t),t.set("parent",this),n&&e2(t,n),a&&t2(t,a),i.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var n=this.getTotalMatrix();n&&t.applyMatrix(n)},e.prototype.getChildren=function(){return this.get("children")||[]},e.prototype.sort=function(){var t=this.getChildren();ye(t,function(n,i){return n[yg]=i,n}),t.sort(RG(function(n,i){return n.get("zIndex")-i.get("zIndex")})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),n=t.length-1;n>=0;n--)t[n].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),r.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var t=this.getChildren();return this.getChildByIndex(t.length-1)},e.prototype.getChildByIndex=function(t){var n=this.getChildren();return n[t]},e.prototype.getCount=function(){var t=this.getChildren();return t.length},e.prototype.contain=function(t){var n=this.getChildren();return n.indexOf(t)>-1},e.prototype.removeChild=function(t,n){n===void 0&&(n=!0),this.contain(t)&&t.remove(n)},e.prototype.findAll=function(t){var n=[],i=this.getChildren();return ye(i,function(a){t(a)&&n.push(a),a.isGroup()&&(n=n.concat(a.findAll(t)))}),n},e.prototype.find=function(t){var n=null,i=this.getChildren();return ye(i,function(a){if(t(a)?n=a:a.isGroup()&&(n=a.find(t)),n)return!1}),n},e.prototype.findById=function(t){return this.find(function(n){return n.get("id")===t})},e.prototype.findByClassName=function(t){return this.find(function(n){return n.get("className")===t})},e.prototype.findAllByName=function(t){return this.findAll(function(n){return n.get("name")===t})},e}(QE),Ws=0,yf=0,mf=0,n2=1e3,nh,bf,ih=0,Yo=0,ah=0,xf=typeof performance=="object"&&performance.now?performance:Date,i2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function a2(){return Yo||(i2(BG),Yo=xf.now()+ah)}function BG(){Yo=0}function mg(){this._call=this._time=this._next=null}mg.prototype=o2.prototype={constructor:mg,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?a2():+t)+(e==null?0:+e),!this._next&&bf!==this&&(bf?bf._next=this:nh=this,bf=this),this._call=r,this._time=t,bg()},stop:function(){this._call&&(this._call=null,this._time=1/0,bg())}};function o2(r,e,t){var n=new mg;return n.restart(r,e,t),n}function FG(){a2(),++Ws;for(var r=nh,e;r;)(e=Yo-r._time)>=0&&r._call.call(null,e),r=r._next;--Ws}function s2(){Yo=(ih=xf.now())+ah,Ws=yf=0;try{FG()}finally{Ws=0,zG(),Yo=0}}function GG(){var r=xf.now(),e=r-ih;e>n2&&(ah-=e,ih=r)}function zG(){for(var r,e=nh,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:nh=t);bf=r,bg(n)}function bg(r){if(!Ws){yf&&(yf=clearTimeout(yf));var e=r-Yo;e>24?(r<1/0&&(yf=setTimeout(s2,r-xf.now()-ah)),mf&&(mf=clearInterval(mf))):(mf||(ih=xf.now(),mf=setInterval(GG,n2)),Ws=1,i2(s2))}}function xg(r,e,t){r.prototype=e.prototype=t,t.constructor=r}function u2(r,e){var t=Object.create(r.prototype);for(var n in e)t[n]=e[n];return t}function wf(){}var Ef=.7,oh=1/Ef,Vs="\\s*([+-]?\\d+)\\s*",_f="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$G=/^#([0-9a-f]{3,8})$/,jG=new RegExp(`^rgb\\(${Vs},${Vs},${Vs}\\)$`),UG=new RegExp(`^rgb\\(${Zi},${Zi},${Zi}\\)$`),XG=new RegExp(`^rgba\\(${Vs},${Vs},${Vs},${_f}\\)$`),YG=new RegExp(`^rgba\\(${Zi},${Zi},${Zi},${_f}\\)$`),WG=new RegExp(`^hsl\\(${_f},${Zi},${Zi}\\)$`),VG=new RegExp(`^hsla\\(${_f},${Zi},${Zi},${_f}\\)$`),f2={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};xg(wf,Sf,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:l2,formatHex:l2,formatHex8:HG,formatHsl:qG,formatRgb:c2,toString:c2});function l2(){return this.rgb().formatHex()}function HG(){return this.rgb().formatHex8()}function qG(){return g2(this).formatHsl()}function c2(){return this.rgb().formatRgb()}function Sf(r){var e,t;return r=(r+"").trim().toLowerCase(),(e=$G.exec(r))?(t=e[1].length,e=parseInt(e[1],16),t===6?h2(e):t===3?new Dn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?sh(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?sh(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=jG.exec(r))?new Dn(e[1],e[2],e[3],1):(e=UG.exec(r))?new Dn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=XG.exec(r))?sh(e[1],e[2],e[3],e[4]):(e=YG.exec(r))?sh(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=WG.exec(r))?p2(e[1],e[2]/100,e[3]/100,1):(e=VG.exec(r))?p2(e[1],e[2]/100,e[3]/100,e[4]):f2.hasOwnProperty(r)?h2(f2[r]):r==="transparent"?new Dn(NaN,NaN,NaN,0):null}function h2(r){return new Dn(r>>16&255,r>>8&255,r&255,1)}function sh(r,e,t,n){return n<=0&&(r=e=t=NaN),new Dn(r,e,t,n)}function ZG(r){return r instanceof wf||(r=Sf(r)),r?(r=r.rgb(),new Dn(r.r,r.g,r.b,r.opacity)):new Dn}function wg(r,e,t,n){return arguments.length===1?ZG(r):new Dn(r,e,t,n??1)}function Dn(r,e,t,n){this.r=+r,this.g=+e,this.b=+t,this.opacity=+n}xg(Dn,wg,u2(wf,{brighter(r){return r=r==null?oh:Math.pow(oh,r),new Dn(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Ef:Math.pow(Ef,r),new Dn(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Dn(Wo(this.r),Wo(this.g),Wo(this.b),uh(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:d2,formatHex:d2,formatHex8:KG,formatRgb:v2,toString:v2}));function d2(){return`#${Vo(this.r)}${Vo(this.g)}${Vo(this.b)}`}function KG(){return`#${Vo(this.r)}${Vo(this.g)}${Vo(this.b)}${Vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function v2(){const r=uh(this.opacity);return`${r===1?"rgb(":"rgba("}${Wo(this.r)}, ${Wo(this.g)}, ${Wo(this.b)}${r===1?")":`, ${r})`}`}function uh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Wo(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Vo(r){return r=Wo(r),(r<16?"0":"")+r.toString(16)}function p2(r,e,t,n){return n<=0?r=e=t=NaN:t<=0||t>=1?r=e=NaN:e<=0&&(r=NaN),new _i(r,e,t,n)}function g2(r){if(r instanceof _i)return new _i(r.h,r.s,r.l,r.opacity);if(r instanceof wf||(r=Sf(r)),!r)return new _i;if(r instanceof _i)return r;r=r.rgb();var e=r.r/255,t=r.g/255,n=r.b/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=NaN,s=a-i,u=(a+i)/2;return s?(e===a?o=(t-n)/s+(t<n)*6:t===a?o=(n-e)/s+2:o=(e-t)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new _i(o,s,u,r.opacity)}function QG(r,e,t,n){return arguments.length===1?g2(r):new _i(r,e,t,n??1)}function _i(r,e,t,n){this.h=+r,this.s=+e,this.l=+t,this.opacity=+n}xg(_i,QG,u2(wf,{brighter(r){return r=r==null?oh:Math.pow(oh,r),new _i(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Ef:Math.pow(Ef,r),new _i(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,i=2*t-n;return new Dn(Eg(r>=240?r-240:r+120,i,n),Eg(r,i,n),Eg(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new _i(y2(this.h),fh(this.s),fh(this.l),uh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=uh(this.opacity);return`${r===1?"hsl(":"hsla("}${y2(this.h)}, ${fh(this.s)*100}%, ${fh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function y2(r){return r=(r||0)%360,r<0?r+360:r}function fh(r){return Math.max(0,Math.min(1,r||0))}function Eg(r,e,t){return(r<60?e+(t-e)*r/60:r<180?t:r<240?e+(t-e)*(240-r)/60:e)*255}const _g=r=>()=>r;function JG(r,e){return function(t){return r+t*e}}function e6(r,e,t){return r=Math.pow(r,t),e=Math.pow(e,t)-r,t=1/t,function(n){return Math.pow(r+n*e,t)}}function t6(r){return(r=+r)==1?m2:function(e,t){return t-e?e6(e,t,r):_g(isNaN(e)?t:e)}}function m2(r,e){var t=e-r;return t?JG(r,t):_g(isNaN(r)?e:r)}const b2=function r(e){var t=t6(e);function n(i,a){var o=t((i=wg(i)).r,(a=wg(a)).r),s=t(i.g,a.g),u=t(i.b,a.b),f=m2(i.opacity,a.opacity);return function(l){return i.r=o(l),i.g=s(l),i.b=u(l),i.opacity=f(l),i+""}}return n.gamma=r,n}(1);function x2(r,e){e||(e=[]);var t=r?Math.min(e.length,r.length):0,n=e.slice(),i;return function(a){for(i=0;i<t;++i)n[i]=r[i]*(1-a)+e[i]*a;return n}}function w2(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function r6(r,e){return(w2(e)?x2:E2)(r,e)}function E2(r,e){var t=e?e.length:0,n=r?Math.min(t,r.length):0,i=new Array(n),a=new Array(t),o;for(o=0;o<n;++o)i[o]=lh(r[o],e[o]);for(;o<t;++o)a[o]=e[o];return function(s){for(o=0;o<n;++o)a[o]=i[o](s);return a}}function n6(r,e){var t=new Date;return r=+r,e=+e,function(n){return t.setTime(r*(1-n)+e*n),t}}function Sg(r,e){return r=+r,e=+e,function(t){return r*(1-t)+e*t}}function i6(r,e){var t={},n={},i;(r===null||typeof r!="object")&&(r={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in r?t[i]=lh(r[i],e[i]):n[i]=e[i];return function(a){for(i in t)n[i]=t[i](a);return n}}var Mg=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cg=new RegExp(Mg.source,"g");function a6(r){return function(){return r}}function o6(r){return function(e){return r(e)+""}}function s6(r,e){var t=Mg.lastIndex=Cg.lastIndex=0,n,i,a,o=-1,s=[],u=[];for(r=r+"",e=e+"";(n=Mg.exec(r))&&(i=Cg.exec(e));)(a=i.index)>t&&(a=e.slice(t,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,u.push({i:o,x:Sg(n,i)})),t=Cg.lastIndex;return t<e.length&&(a=e.slice(t),s[o]?s[o]+=a:s[++o]=a),s.length<2?u[0]?o6(u[0].x):a6(e):(e=u.length,function(f){for(var l=0,c;l<e;++l)s[(c=u[l]).i]=c.x(f);return s.join("")})}function lh(r,e){var t=typeof e,n;return e==null||t==="boolean"?_g(e):(t==="number"?Sg:t==="string"?(n=Sf(e))?(e=n,b2):s6:e instanceof Sf?b2:e instanceof Date?n6:w2(e)?x2:Array.isArray(e)?E2:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?i6:Sg)(r,e)}function u6(r){return+r}function f6(r){return r*r}function l6(r){return r*(2-r)}function _2(r){return((r*=2)<=1?r*r:--r*(2-r)+1)/2}function c6(r){return r*r*r}function h6(r){return--r*r*r+1}function S2(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var Ag=3,d6=function r(e){e=+e;function t(n){return Math.pow(n,e)}return t.exponent=r,t}(Ag),v6=function r(e){e=+e;function t(n){return 1-Math.pow(1-n,e)}return t.exponent=r,t}(Ag),M2=function r(e){e=+e;function t(n){return((n*=2)<=1?Math.pow(n,e):2-Math.pow(2-n,e))/2}return t.exponent=r,t}(Ag),C2=Math.PI,A2=C2/2;function p6(r){return+r==1?1:1-Math.cos(r*A2)}function g6(r){return Math.sin(r*A2)}function T2(r){return(1-Math.cos(C2*r))/2}function io(r){return(Math.pow(2,-10*r)-.0009765625)*1.0009775171065494}function y6(r){return io(1-+r)}function m6(r){return 1-io(r)}function I2(r){return((r*=2)<=1?io(1-r):2-io(r-1))/2}function b6(r){return 1-Math.sqrt(1-r*r)}function x6(r){return Math.sqrt(1- --r*r)}function k2(r){return((r*=2)<=1?1-Math.sqrt(1-r*r):Math.sqrt(1-(r-=2)*r)+1)/2}var Tg=4/11,w6=6/11,E6=8/11,_6=3/4,S6=9/11,M6=10/11,C6=15/16,A6=21/22,T6=63/64,ch=1/Tg/Tg;function I6(r){return 1-Mf(1-r)}function Mf(r){return(r=+r)<Tg?ch*r*r:r<E6?ch*(r-=w6)*r+_6:r<M6?ch*(r-=S6)*r+C6:ch*(r-=A6)*r+T6}function k6(r){return((r*=2)<=1?1-Mf(1-r):Mf(r-1)+1)/2}var Ig=1.70158,L6=function r(e){e=+e;function t(n){return(n=+n)*n*(e*(n-1)+n)}return t.overshoot=r,t}(Ig),N6=function r(e){e=+e;function t(n){return--n*n*((n+1)*e+n)+1}return t.overshoot=r,t}(Ig),L2=function r(e){e=+e;function t(n){return((n*=2)<1?n*n*((e+1)*n-e):(n-=2)*n*((e+1)*n+e)+2)/2}return t.overshoot=r,t}(Ig),Hs=2*Math.PI,kg=1,Lg=.3,O6=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Hs);function i(a){return e*io(- --a)*Math.sin((n-a)/t)}return i.amplitude=function(a){return r(a,t*Hs)},i.period=function(a){return r(e,a)},i}(kg,Lg),N2=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Hs);function i(a){return 1-e*io(a=+a)*Math.sin((a+n)/t)}return i.amplitude=function(a){return r(a,t*Hs)},i.period=function(a){return r(e,a)},i}(kg,Lg),D6=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Hs);function i(a){return((a=a*2-1)<0?e*io(-a)*Math.sin((n-a)/t):2-e*io(a)*Math.sin((n+a)/t))/2}return i.amplitude=function(a){return r(a,t*Hs)},i.period=function(a){return r(e,a)},i}(kg,Lg);const P6=Object.freeze(Object.defineProperty({__proto__:null,easeBack:L2,easeBackIn:L6,easeBackInOut:L2,easeBackOut:N6,easeBounce:Mf,easeBounceIn:I6,easeBounceInOut:k6,easeBounceOut:Mf,easeCircle:k2,easeCircleIn:b6,easeCircleInOut:k2,easeCircleOut:x6,easeCubic:S2,easeCubicIn:c6,easeCubicInOut:S2,easeCubicOut:h6,easeElastic:N2,easeElasticIn:O6,easeElasticInOut:D6,easeElasticOut:N2,easeExp:I2,easeExpIn:y6,easeExpInOut:I2,easeExpOut:m6,easeLinear:u6,easePoly:M2,easePolyIn:d6,easePolyInOut:M2,easePolyOut:v6,easeQuad:_2,easeQuadIn:f6,easeQuadInOut:_2,easeQuadOut:l6,easeSin:T2,easeSinIn:p6,easeSinInOut:T2,easeSinOut:g6},Symbol.toStringTag,{value:"Module"}));var R6={};function B6(r){return R6[r.toLowerCase()]||P6[r]}var F6=function(r){return["fill","stroke","fillStyle","strokeStyle"].includes(r)},G6=function(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)},O2=[1,0,0,0,1,0,0,0,1];function z6(r,e,t){var n={},i=e.fromAttrs,a=e.toAttrs;if(!r.destroyed){var o;for(var s in a)if(!Qa(i[s],a[s]))if(s==="path"){var u=a[s],f=i[s];u.length>f.length?(u=Ys(a[s]),f=Ys(i[s]),f=zE(f,u),f=vg(f,u),e.fromAttrs.path=f,e.toAttrs.path=u):e.pathFormatted||(u=Ys(a[s]),f=Ys(i[s]),f=vg(f,u),e.fromAttrs.path=f,e.toAttrs.path=u,e.pathFormatted=!0),n[s]=[];for(var l=0;l<u.length;l++){for(var c=u[l],h=f[l],d=[],v=0;v<c.length;v++)ht(c[v])&&h&&ht(h[v])?(o=lh(h[v],c[v]),d.push(o(t))):d.push(c[v]);n[s].push(d)}}else if(s==="matrix"){var p=r6(i[s]||O2,a[s]||O2),g=p(t);n[s]=g}else F6(s)&&G6(a[s])?n[s]=a[s]:_r(a[s])||(o=lh(i[s],a[s]),n[s]=o(t));r.attr(n)}}function $6(r,e,t){var n=e.startTime,i=e.delay;if(t<n+i||e._paused)return!1;var a,o=e.duration,s=e.easing,u=B6(s);if(t=t-n-e.delay,e.repeat)a=t%o/o,a=u(a);else if(a=t/o,a<1)a=u(a);else return e.onFrame?r.attr(e.onFrame(1)):r.attr(e.toAttrs),!0;if(e.onFrame){var f=e.onFrame(a);r.attr(f)}else z6(r,e,a);return!1}var j6=function(){function r(e){this.animators=[],this.current=0,this.timer=null,this.canvas=e}return r.prototype.initTimer=function(){var e=this,t=!1,n,i,a;this.timer=o2(function(o){if(e.current=o,e.animators.length>0){for(var s=e.animators.length-1;s>=0;s--){if(n=e.animators[s],n.destroyed){e.removeAnimator(s);continue}if(!n.isAnimatePaused()){i=n.get("animations");for(var u=i.length-1;u>=0;u--)a=i[u],t=$6(n,a,o),t&&(i.splice(u,1),t=!1,a.callback&&a.callback())}i.length===0&&e.removeAnimator(s)}var f=e.canvas.get("autoDraw");f||e.canvas.draw()}})},r.prototype.addAnimator=function(e){this.animators.push(e)},r.prototype.removeAnimator=function(e){this.animators.splice(e,1)},r.prototype.isAnimating=function(){return!!this.animators.length},r.prototype.stop=function(){this.timer&&this.timer.stop()},r.prototype.stopAllAnimations=function(e){e===void 0&&(e=!0),this.animators.forEach(function(t){t.stopAnimate(e)}),this.animators=[],this.canvas.draw()},r.prototype.getTime=function(){return this.current},r}(),U6=40,D2=0,P2=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function R2(r,e,t){t.name=e,t.target=r,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}function X6(r,e,t){if(t.bubbles){var n=void 0,i=!1;if(e==="mouseenter"?(n=t.fromShape,i=!0):e==="mouseleave"&&(i=!0,n=t.toShape),r.isCanvas()&&i)return;if(n&&YE(r,n)){t.bubbles=!1;return}t.name=e,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}}var Y6=function(){function r(e){var t=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(n){var i=n.type;t._triggerEvent(i,n)},this._onDocumentMove=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&(t.dragging||t.currentShape)){var o=t._getPointInfo(n);t.dragging&&t._emitEvent("drag",n,o,t.draggingShape)}},this._onDocumentMouseUp=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&t.dragging){var o=t._getPointInfo(n);t.draggingShape&&t._emitEvent("drop",n,o,null),t._emitEvent("dragend",n,o,t.draggingShape),t._afterDrag(t.draggingShape,o,n)}},this.canvas=e.canvas}return r.prototype.init=function(){this._bindEvents()},r.prototype._bindEvents=function(){var e=this,t=this.canvas.get("el");ye(P2,function(n){t.addEventListener(n,e._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._clearEvents=function(){var e=this,t=this.canvas.get("el");ye(P2,function(n){t.removeEventListener(n,e._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._getEventObj=function(e,t,n,i,a,o){var s=new jE(e,t);return s.fromShape=a,s.toShape=o,s.x=n.x,s.y=n.y,s.clientX=n.clientX,s.clientY=n.clientY,s.propagationPath.push(i),s},r.prototype._getShape=function(e,t){return this.canvas.getShape(e.x,e.y,t)},r.prototype._getPointInfo=function(e){var t=this.canvas,n=t.getClientByEvent(e),i=t.getPointByEvent(e);return{x:i.x,y:i.y,clientX:n.x,clientY:n.y}},r.prototype._triggerEvent=function(e,t){var n=this._getPointInfo(t),i=this._getShape(n,t),a=this["_on"+e],o=!1;if(a)a.call(this,n,i,t);else{var s=this.currentShape;e==="mouseenter"||e==="dragenter"||e==="mouseover"?(this._emitEvent(e,t,n,null,null,i),i&&this._emitEvent(e,t,n,i,null,i),e==="mouseenter"&&this.draggingShape&&this._emitEvent("dragenter",t,n,null)):e==="mouseleave"||e==="dragleave"||e==="mouseout"?(o=!0,s&&this._emitEvent(e,t,n,s,s,null),this._emitEvent(e,t,n,null,s,null),e==="mouseleave"&&this.draggingShape&&this._emitEvent("dragleave",t,n,null)):this._emitEvent(e,t,n,i,null,null)}if(o||(this.currentShape=i),i&&!i.get("destroyed")){var u=this.canvas,f=u.get("el");f.style.cursor=i.attr("cursor")||u.get("cursor")}},r.prototype._onmousedown=function(e,t,n){n.button===D2&&(this.mousedownShape=t,this.mousedownPoint=e,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,e,t,null,null)},r.prototype._emitMouseoverEvents=function(e,t,n,i){var a=this.canvas.get("el");n!==i&&(n&&(this._emitEvent("mouseout",e,t,n,n,i),this._emitEvent("mouseleave",e,t,n,n,i),(!i||i.get("destroyed"))&&(a.style.cursor=this.canvas.get("cursor"))),i&&(this._emitEvent("mouseover",e,t,i,n,i),this._emitEvent("mouseenter",e,t,i,n,i)))},r.prototype._emitDragoverEvents=function(e,t,n,i,a){i?(i!==n&&(n&&this._emitEvent("dragleave",e,t,n,n,i),this._emitEvent("dragenter",e,t,i,n,i)),a||this._emitEvent("dragover",e,t,i)):n&&this._emitEvent("dragleave",e,t,n,n,i),a&&this._emitEvent("dragover",e,t,i)},r.prototype._afterDrag=function(e,t,n){e&&(e.set("capture",!0),this.draggingShape=null),this.dragging=!1;var i=this._getShape(t,n);i!==e&&this._emitMouseoverEvents(n,t,e,i),this.currentShape=i},r.prototype._onmouseup=function(e,t,n){if(n.button===D2){var i=this.draggingShape;this.dragging?(i&&this._emitEvent("drop",n,e,t),this._emitEvent("dragend",n,e,i),this._afterDrag(i,e,n)):(this._emitEvent("mouseup",n,e,t),t===this.mousedownShape&&this._emitEvent("click",n,e,t),this.mousedownShape=null,this.mousedownPoint=null)}},r.prototype._ondragover=function(e,t,n){n.preventDefault();var i=this.currentShape;this._emitDragoverEvents(n,e,i,t,!0)},r.prototype._onmousemove=function(e,t,n){var i=this.canvas,a=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,e,a,t,!1),this._emitEvent("drag",n,e,o);else{var s=this.mousedownPoint;if(s){var u=this.mousedownShape,f=n.timeStamp,l=f-this.mousedownTimeStamp,c=s.clientX-e.clientX,h=s.clientY-e.clientY,d=c*c+h*h;l>120||d>U6?u&&u.get("draggable")?(o=this.mousedownShape,o.set("capture",!1),this.draggingShape=o,this.dragging=!0,this._emitEvent("dragstart",n,e,o),this.mousedownShape=null,this.mousedownPoint=null):!u&&i.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,e,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t))}else this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)}},r.prototype._emitEvent=function(e,t,n,i,a,o){var s=this._getEventObj(e,t,n,i,a,o);if(i){s.shape=i,R2(i,e,s);for(var u=i.getParent();u;)u.emitDelegation(e,s),s.propagationStopped||X6(u,e,s),s.propagationPath.push(u),u=u.getParent()}else{var f=this.canvas;R2(f,e,s)}},r.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},r}(),B2="px",F2=qE(),W6=F2&&F2.name==="firefox",G2=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.cursor="default",t.supportCSSTransform=!1,t},e.prototype.initContainer=function(){var t=this.get("container");Pe(t)&&(t=document.getElementById(t),this.set("container",t))},e.prototype.initDom=function(){var t=this.createDom();this.set("el",t);var n=this.get("container");n.appendChild(t),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var t=new Y6({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new j6(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,n){var i=this.get("el");XE&&(i.style.width=t+B2,i.style.height=n+B2)},e.prototype.changeSize=function(t,n){this.setDOMSize(t,n),this.set("width",t),this.set("height",n),this.onCanvasChange("changeSize")},e.prototype.getRenderer=function(){return this.get("renderer")},e.prototype.getCursor=function(){return this.get("cursor")},e.prototype.setCursor=function(t){this.set("cursor",t);var n=this.get("el");XE&&n&&(n.style.cursor=t)},e.prototype.getPointByEvent=function(t){var n=this.get("supportCSSTransform");if(n){if(W6&&!ct(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!ct(t.offsetX))return{x:t.offsetX,y:t.offsetY}}var i=this.getClientByEvent(t),a=i.x,o=i.y;return this.getPointByClient(a,o)},e.prototype.getClientByEvent=function(t){var n=t;return t.touches&&(t.type==="touchend"?n=t.changedTouches[0]:n=t.touches[0]),{x:n.clientX,y:n.clientY}},e.prototype.getPointByClient=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t-a.left,y:n-a.top}},e.prototype.getClientByPoint=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t+a.left,y:n+a.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.parentNode.removeChild(t)},e.prototype.clearEvents=function(){var t=this.get("eventController");t.destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var t=this.get("timeline");this.get("destroyed")||(this.clear(),t&&t.stop(),this.clearEvents(),this.removeDom(),r.prototype.destroy.call(this))},e}(r2),z2=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var t=r.prototype.clone.call(this),n=this.getChildren(),i=0;i<n.length;i++){var a=n[i];t.add(a.clone())}return t},e}(r2),$2=function(r){It(e,r);function e(t){return r.call(this,t)||this}return e.prototype._isInBBox=function(t,n){var i=this.getBBox();return i.minX<=t&&i.maxX>=t&&i.minY<=n&&i.maxY>=n},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t),this.clearCacheBBox()},e.prototype.getBBox=function(){var t=this.cfg.bbox;return t||(t=this.calculateBBox(),this.set("bbox",t)),t},e.prototype.getCanvasBBox=function(){var t=this.cfg.canvasBBox;return t||(t=this.calculateCanvasBBox(),this.set("canvasBBox",t)),t},e.prototype.applyMatrix=function(t){r.prototype.applyMatrix.call(this,t),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var t=this.getBBox(),n=this.getTotalMatrix(),i=t.minX,a=t.minY,o=t.maxX,s=t.maxY;if(n){var u=Xo(n,[t.minX,t.minY]),f=Xo(n,[t.maxX,t.minY]),l=Xo(n,[t.minX,t.maxY]),c=Xo(n,[t.maxX,t.maxY]);i=Math.min(u[0],f[0],l[0],c[0]),o=Math.max(u[0],f[0],l[0],c[0]),a=Math.min(u[1],f[1],l[1],c[1]),s=Math.max(u[1],f[1],l[1],c[1])}var h=this.attrs;if(h.shadowColor){var d=h.shadowBlur,v=d===void 0?0:d,p=h.shadowOffsetX,g=p===void 0?0:p,y=h.shadowOffsetY,m=y===void 0?0:y,b=i-v+g,x=o+v+g,w=a-v+m,E=s+v+m;i=Math.min(i,b),o=Math.max(o,x),a=Math.min(a,w),s=Math.max(s,E)}return{x:i,y:a,minX:i,minY:a,maxX:o,maxY:s,width:o-i,height:s-a}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(t,n){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(t,n){var i=this.get("startArrowShape"),a=this.get("endArrowShape"),o=[t,n,1];o=this.invertFromMatrix(o);var s=o[0],u=o[1],f=this._isInBBox(s,u);return this.isOnlyHitBox()?f:!!(f&&!this.isClipped(s,u)&&(this.isInShape(s,u)||i&&i.isHit(s,u)||a&&a.isHit(s,u)))},e}(QE),j2=new Map;function Ki(r,e){j2.set(r,e)}function U2(r){return j2.get(r)}function X2(r){var e=r.attr(),t=e.x,n=e.y,i=e.width,a=e.height;return{x:t,y:n,width:i,height:a}}function Y2(r){var e=r.attr(),t=e.x,n=e.y,i=e.r;return{x:t-i,y:n-i,width:i*2,height:i*2}}function Cn(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function hh(r,e){return Math.abs(r-e)<.001}function qs(r,e){var t=Ui(r),n=Ui(e),i=ji(r),a=ji(e);return{x:t,y:n,width:i-t,height:a-n}}function dh(r){return(r+Math.PI*2)%(Math.PI*2)}const dn={box:function(r,e,t,n){return qs([r,t],[e,n])},length:function(r,e,t,n){return Cn(r,e,t,n)},pointAt:function(r,e,t,n,i){return{x:(1-i)*r+i*t,y:(1-i)*e+i*n}},pointDistance:function(r,e,t,n,i,a){var o=(t-r)*(i-r)+(n-e)*(a-e);if(o<0)return Cn(r,e,i,a);var s=(t-r)*(t-r)+(n-e)*(n-e);return o>s?Cn(t,n,i,a):this.pointToLine(r,e,t,n,i,a)},pointToLine:function(r,e,t,n,i,a){var o=[t-r,n-e];if(zp(o,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-e)*(a-e));var s=[-o[1],o[0]];to(s,s);var u=[i-r,a-e];return Math.abs(Gp(u,s))},tangentAngle:function(r,e,t,n){return Math.atan2(n-e,t-r)}};var V6=1e-4;function W2(r,e,t,n,i,a){var o,s=1/0,u=[t,n],f=20;a&&a>200&&(f=a/10);for(var l=1/f,c=l/10,h=0;h<=f;h++){var d=h*l,v=[i.apply(null,r.concat([d])),i.apply(null,e.concat([d]))],p=Cn(u[0],u[1],v[0],v[1]);p<s&&(o=d,s=p)}if(o===0)return{x:r[0],y:e[0]};if(o===1){var g=r.length;return{x:r[g-1],y:e[g-1]}}s=1/0;for(var h=0;h<32&&!(c<V6);h++){var y=o-c,m=o+c,v=[i.apply(null,r.concat([y])),i.apply(null,e.concat([y]))],p=Cn(u[0],u[1],v[0],v[1]);if(y>=0&&p<s)o=y,s=p;else{var b=[i.apply(null,r.concat([m])),i.apply(null,e.concat([m]))],x=Cn(u[0],u[1],b[0],b[1]);m<=1&&x<s?(o=m,s=x):c*=.5}}return{x:i.apply(null,r.concat([o])),y:i.apply(null,e.concat([o]))}}function H6(r,e){for(var t=0,n=r.length,i=0;i<n;i++){var a=r[i],o=e[i],s=r[(i+1)%n],u=e[(i+1)%n];t+=Cn(a,o,s,u)}return t/2}function ao(r,e,t,n){var i=1-n;return i*i*r+2*n*i*e+n*n*t}function V2(r,e,t){var n=r+t-2*e;if(hh(n,0))return[.5];var i=(r-e)/n;return i<=1&&i>=0?[i]:[]}function H2(r,e,t,n){return 2*(1-n)*(e-r)+2*n*(t-e)}function q2(r,e,t,n,i,a,o){var s=ao(r,t,i,o),u=ao(e,n,a,o),f=dn.pointAt(r,e,t,n,o),l=dn.pointAt(t,n,i,a,o);return[[r,e,f.x,f.y,s,u],[s,u,l.x,l.y,i,a]]}function Ng(r,e,t,n,i,a,o){if(o===0)return(Cn(r,e,t,n)+Cn(t,n,i,a)+Cn(r,e,i,a))/2;var s=q2(r,e,t,n,i,a,.5),u=s[0],f=s[1];return u.push(o-1),f.push(o-1),Ng.apply(null,u)+Ng.apply(null,f)}const Z2={box:function(r,e,t,n,i,a){var o=V2(r,t,i)[0],s=V2(e,n,a)[0],u=[r,i],f=[e,a];return o!==void 0&&u.push(ao(r,t,i,o)),s!==void 0&&f.push(ao(e,n,a,s)),qs(u,f)},length:function(r,e,t,n,i,a){return Ng(r,e,t,n,i,a,3)},nearestPoint:function(r,e,t,n,i,a,o,s){return W2([r,t,i],[e,n,a],o,s,ao)},pointDistance:function(r,e,t,n,i,a,o,s){var u=this.nearestPoint(r,e,t,n,i,a,o,s);return Cn(u.x,u.y,o,s)},interpolationAt:ao,pointAt:function(r,e,t,n,i,a,o){return{x:ao(r,t,i,o),y:ao(e,n,a,o)}},divide:function(r,e,t,n,i,a,o){return q2(r,e,t,n,i,a,o)},tangentAngle:function(r,e,t,n,i,a,o){var s=H2(r,t,i,o),u=H2(e,n,a,o),f=Math.atan2(u,s);return dh(f)}};function oo(r,e,t,n,i){var a=1-i;return a*a*a*r+3*e*i*a*a+3*t*i*i*a+n*i*i*i}function K2(r,e,t,n,i){var a=1-i;return 3*(a*a*(e-r)+2*a*i*(t-e)+i*i*(n-t))}function Og(r,e,t,n){var i=-3*r+9*e-9*t+3*n,a=6*r-12*e+6*t,o=3*e-3*r,s=[],u,f,l;if(hh(i,0))hh(a,0)||(u=-o/a,u>=0&&u<=1&&s.push(u));else{var c=a*a-4*i*o;hh(c,0)?s.push(-a/(2*i)):c>0&&(l=Math.sqrt(c),u=(-a+l)/(2*i),f=(-a-l)/(2*i),u>=0&&u<=1&&s.push(u),f>=0&&f<=1&&s.push(f))}return s}function Q2(r,e,t,n,i,a,o,s,u){var f=oo(r,t,i,o,u),l=oo(e,n,a,s,u),c=dn.pointAt(r,e,t,n,u),h=dn.pointAt(t,n,i,a,u),d=dn.pointAt(i,a,o,s,u),v=dn.pointAt(c.x,c.y,h.x,h.y,u),p=dn.pointAt(h.x,h.y,d.x,d.y,u);return[[r,e,c.x,c.y,v.x,v.y,f,l],[f,l,p.x,p.y,d.x,d.y,o,s]]}function Dg(r,e,t,n,i,a,o,s,u){if(u===0)return H6([r,t,i,o],[e,n,a,s]);var f=Q2(r,e,t,n,i,a,o,s,.5),l=f[0],c=f[1];return l.push(u-1),c.push(u-1),Dg.apply(null,l)+Dg.apply(null,c)}const Cf={extrema:Og,box:function(r,e,t,n,i,a,o,s){for(var u=[r,o],f=[e,s],l=Og(r,t,i,o),c=Og(e,n,a,s),h=0;h<l.length;h++)u.push(oo(r,t,i,o,l[h]));for(var h=0;h<c.length;h++)f.push(oo(e,n,a,s,c[h]));return qs(u,f)},length:function(r,e,t,n,i,a,o,s){return Dg(r,e,t,n,i,a,o,s,3)},nearestPoint:function(r,e,t,n,i,a,o,s,u,f,l){return W2([r,t,i,o],[e,n,a,s],u,f,oo,l)},pointDistance:function(r,e,t,n,i,a,o,s,u,f,l){var c=this.nearestPoint(r,e,t,n,i,a,o,s,u,f,l);return Cn(c.x,c.y,u,f)},interpolationAt:oo,pointAt:function(r,e,t,n,i,a,o,s,u){return{x:oo(r,t,i,o,u),y:oo(e,n,a,s,u)}},divide:function(r,e,t,n,i,a,o,s,u){return Q2(r,e,t,n,i,a,o,s,u)},tangentAngle:function(r,e,t,n,i,a,o,s,u){var f=K2(r,t,i,o,u),l=K2(e,n,a,s,u);return dh(Math.atan2(l,f))}};function J2(r,e){var t=Math.abs(r);return e>0?t:t*-1}const q6={box:function(r,e,t,n){return{x:r-t,y:e-n,width:t*2,height:n*2}},length:function(r,e,t,n){return Math.PI*(3*(t+n)-Math.sqrt((3*t+n)*(t+3*n)))},nearestPoint:function(r,e,t,n,i,a){var o=t,s=n;if(o===0||s===0)return{x:r,y:e};for(var u=i-r,f=a-e,l=Math.abs(u),c=Math.abs(f),h=o*o,d=s*s,v=Math.PI/4,p,g,y=0;y<4;y++){p=o*Math.cos(v),g=s*Math.sin(v);var m=(h-d)*Math.pow(Math.cos(v),3)/o,b=(d-h)*Math.pow(Math.sin(v),3)/s,x=p-m,w=g-b,E=l-m,_=c-b,M=Math.hypot(w,x),C=Math.hypot(_,E),S=M*Math.asin((x*_-w*E)/(M*C)),A=S/Math.sqrt(h+d-p*p-g*g);v+=A,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:r+J2(p,u),y:e+J2(g,f)}},pointDistance:function(r,e,t,n,i,a){var o=this.nearestPoint(r,e,t,n,i,a);return Cn(o.x,o.y,i,a)},pointAt:function(r,e,t,n,i){var a=2*Math.PI*i;return{x:r+t*Math.cos(a),y:e+n*Math.sin(a)}},tangentAngle:function(r,e,t,n,i){var a=2*Math.PI*i,o=Math.atan2(n*Math.cos(a),-t*Math.sin(a));return dh(o)}};function Z6(r,e,t,n,i,a,o,s){return-1*t*Math.cos(i)*Math.sin(s)-n*Math.sin(i)*Math.cos(s)}function K6(r,e,t,n,i,a,o,s){return-1*t*Math.sin(i)*Math.sin(s)+n*Math.cos(i)*Math.cos(s)}function Q6(r,e,t){return Math.atan(-e/r*Math.tan(t))}function J6(r,e,t){return Math.atan(e/(r*Math.tan(t)))}function e_(r,e,t,n,i,a){return t*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function t_(r,e,t,n,i,a){return t*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function ez(r,e,t,n){var i=Math.atan2(n*r,t*e);return(i+Math.PI*2)%(Math.PI*2)}function r_(r,e,t){return{x:r*Math.cos(t),y:e*Math.sin(t)}}function n_(r,e,t){var n=Math.cos(t),i=Math.sin(t);return[r*n-e*i,r*i+e*n]}const tz={box:function(r,e,t,n,i,a,o){for(var s=Q6(t,n,i),u=1/0,f=-1/0,l=[a,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var h=s+c;a<o?a<h&&h<o&&l.push(h):o<h&&h<a&&l.push(h)}for(var c=0;c<l.length;c++){var d=e_(r,e,t,n,i,l[c]);d<u&&(u=d),d>f&&(f=d)}for(var v=J6(t,n,i),p=1/0,g=-1/0,y=[a,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var m=v+c;a<o?a<m&&m<o&&y.push(m):o<m&&m<a&&y.push(m)}for(var c=0;c<y.length;c++){var b=t_(r,e,t,n,i,y[c]);b<p&&(p=b),b>g&&(g=b)}return{x:u,y:p,width:f-u,height:g-p}},length:function(r,e,t,n,i,a,o){},nearestPoint:function(r,e,t,n,i,a,o,s,u){var f=n_(s-r,u-e,-i),l=f[0],c=f[1],h=q6.nearestPoint(0,0,t,n,l,c),d=ez(t,n,h.x,h.y);d<a?h=r_(t,n,a):d>o&&(h=r_(t,n,o));var v=n_(h.x,h.y,i);return{x:v[0]+r,y:v[1]+e}},pointDistance:function(r,e,t,n,i,a,o,s,u){var f=this.nearestPoint(r,e,t,n,s,u);return Cn(f.x,f.y,s,u)},pointAt:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a;return{x:e_(r,e,t,n,i,u),y:t_(r,e,t,n,i,u)}},tangentAngle:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a,f=Z6(r,e,t,n,i,a,o,u),l=K6(r,e,t,n,i,a,o,u);return dh(Math.atan2(l,f))}};function i_(r){for(var e=0,t=[],n=0;n<r.length-1;n++){var i=r[n],a=r[n+1],o=Cn(i[0],i[1],a[0],a[1]),s={from:i,to:a,length:o};t.push(s),e+=o}return{segments:t,totalLength:e}}function rz(r){if(r.length<2)return 0;for(var e=0,t=0;t<r.length-1;t++){var n=r[t],i=r[t+1];e+=Cn(n[0],n[1],i[0],i[1])}return e}function nz(r,e){if(e>1||e<0||r.length<2)return null;var t=i_(r),n=t.segments,i=t.totalLength;if(i===0)return{x:r[0][0],y:r[0][1]};for(var a=0,o=null,s=0;s<n.length;s++){var u=n[s],f=u.from,l=u.to,c=u.length/i;if(e>=a&&e<=a+c){var h=(e-a)/c;o=dn.pointAt(f[0],f[1],l[0],l[1],h);break}a+=c}return o}function iz(r,e){if(e>1||e<0||r.length<2)return 0;for(var t=i_(r),n=t.segments,i=t.totalLength,a=0,o=0,s=0;s<n.length;s++){var u=n[s],f=u.from,l=u.to,c=u.length/i;if(e>=a&&e<=a+c){o=Math.atan2(l[1]-f[1],l[0]-f[0]);break}a+=c}return o}function az(r,e,t){for(var n=1/0,i=0;i<r.length-1;i++){var a=r[i],o=r[i+1],s=dn.pointDistance(a[0],a[1],o[0],o[1],e,t);s<n&&(n=s)}return n}const a_={box:function(r){for(var e=[],t=[],n=0;n<r.length;n++){var i=r[n];e.push(i[0]),t.push(i[1])}return qs(e,t)},length:function(r){return rz(r)},pointAt:function(r,e){return nz(r,e)},pointDistance:function(r,e,t){return az(r,e,t)},tangentAngle:function(r,e){return iz(r,e)}};function o_(r,e){return!r||!e?r||e:{minX:Math.min(r.minX,e.minX),minY:Math.min(r.minY,e.minY),maxX:Math.max(r.maxX,e.maxX),maxY:Math.max(r.maxY,e.maxY)}}function Pg(r,e){var t=r.get("startArrowShape"),n=r.get("endArrowShape"),i=null,a=null;return t&&(i=t.getCanvasBBox(),e=o_(e,i)),n&&(a=n.getCanvasBBox(),e=o_(e,a)),e}function oz(r){for(var e=r.attr(),t=e.points,n=[],i=[],a=0;a<t.length;a++){var o=t[a];n.push(o[0]),i.push(o[1])}var s=qs(n,i),u=s.x,f=s.y,l=s.width,c=s.height,h={minX:u,minY:f,maxX:u+l,maxY:f+c};return h=Pg(r,h),{x:h.minX,y:h.minY,width:h.maxX-h.minX,height:h.maxY-h.minY}}function sz(r){for(var e=r.attr(),t=e.points,n=[],i=[],a=0;a<t.length;a++){var o=t[a];n.push(o[0]),i.push(o[1])}return qs(n,i)}var Rg=null;function s_(){if(!Rg){var r=document.createElement("canvas");r.width=1,r.height=1,Rg=r.getContext("2d")}return Rg}function u_(r,e,t){var n=1;if(Pe(r)&&(n=r.split(`
`).length),n>1){var i=uz(e,t);return e*n+i*(n-1)}return e}function uz(r,e){return e?e-r:r*.14}function fz(r,e){var t=s_(),n=0;if(ct(r)||r==="")return n;if(t.save(),t.font=e,Pe(r)&&r.includes(`
`)){var i=r.split(`
`);ye(i,function(a){var o=t.measureText(a).width;n<o&&(n=o)})}else n=t.measureText(r).width;return t.restore(),n}function f_(r){var e=r.fontSize,t=r.fontFamily,n=r.fontWeight,i=r.fontStyle,a=r.fontVariant;return[i,a,n,e+"px",t].join(" ").trim()}function lz(r){var e=r.attr(),t=e.x,n=e.y,i=e.text,a=e.fontSize,o=e.lineHeight,s=e.font;s||(s=f_(e));var u=fz(i,s),f;if(!u)f={x:t,y:n,width:0,height:0};else{var l=e.textAlign,c=e.textBaseline,h=u_(i,a,o),d={x:t,y:n-h};l&&(l==="end"||l==="right"?d.x-=u:l==="center"&&(d.x-=u/2)),c&&(c==="top"?d.y+=h:c==="middle"&&(d.y+=h/2)),f={x:d.x,y:d.y,width:u,height:h}}return f}var cz=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig,hz=/[^\s\,]+/ig;function dz(r){var e=r||[];if(vt(e))return e;if(Pe(e))return e=e.match(cz),ye(e,function(t,n){if(t=t.match(hz),t[0].length>1){var i=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=i}ye(t,function(a,o){isNaN(a)||(t[o]=+a)}),e[n]=t}),e}function vz(r,e,t,n){var i=[],a=!!n,o,s,u,f,l,c,h;if(a){u=n[0],f=n[1];for(var d=0,v=r.length;d<v;d+=1){var p=r[d];u=Ja([0,0],u,p),f=eo([0,0],f,p)}}for(var d=0,g=r.length;d<g;d+=1){var p=r[d];if(d===0&&!t)h=p;else if(d===g-1&&!t)c=p,i.push(h),i.push(c);else{var y=[d?d-1:g-1,d-1][t?0:1];o=r[y],s=r[t?(d+1)%g:d+1];var m=[0,0];m=zc(m,s,o),m=Sn(m,m,e);var b=Gc(p,o),x=Gc(p,s),w=b+x;w!==0&&(b/=w,x/=w);var E=Sn([0,0],m,-b),_=Sn([0,0],m,x);c=ln([0,0],p,E),l=ln([0,0],p,_),l=Ja([0,0],l,eo([0,0],s,p)),l=eo([0,0],l,Ja([0,0],s,p)),E=zc([0,0],l,p),E=Sn([0,0],E,-b/x),c=ln([0,0],p,E),c=Ja([0,0],c,eo([0,0],o,p)),c=eo([0,0],c,Ja([0,0],o,p)),_=zc([0,0],p,c),_=Sn([0,0],_,x/b),l=ln([0,0],p,_),a&&(c=eo([0,0],c,u),c=Ja([0,0],c,f),l=eo([0,0],l,u),l=Ja([0,0],l,f)),i.push(h),i.push(c),h=l}}return t&&i.push(i.shift()),i}function l_(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=[[0,0],[1,1]]);for(var n=!!e,i=[],a=0,o=r.length;a<o;a+=2)i.push([r[a],r[a+1]]);for(var s=vz(i,.4,n,t),u=i.length,f=[],l,c,h,a=0;a<u-1;a+=1)l=s[a*2],c=s[a*2+1],h=i[a+1],f.push(["C",l[0],l[1],c[0],c[1],h[0],h[1]]);return n&&(l=s[u],c=s[u+1],h=i[0],f.push(["C",l[0],l[1],c[0],c[1],h[0],h[1]])),f}var Af=`	
\v\f\r   ᠎             　\u2028\u2029`,pz=new RegExp("([a-z])["+Af+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+Af+"]*,?["+Af+"]*)+)","ig"),gz=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+Af+"]*,?["+Af+"]*","ig");function Bg(r){if(!r)return null;if(vt(r))return r;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},t=[];return String(r).replace(pz,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(gz,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return""}),t}var yz=/[a-z]/;function c_(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function h_(r){var e=Bg(r);if(!e||!e.length)return[["M",0,0]];for(var t=!1,n=0;n<e.length;n++){var i=e[n][0];if(yz.test(i)||["V","H","T","S"].indexOf(i)>=0){t=!0;break}}if(!t)return e;var a=[],o=0,s=0,u=0,f=0,l=0,c=e[0];(c[0]==="M"||c[0]==="m")&&(o=+c[1],s=+c[2],u=o,f=s,l++,a[0]=["M",o,s]);for(var n=l,h=e.length;n<h;n++){var d=e[n],v=a[n-1],p=[],i=d[0],g=i.toUpperCase();if(i!==g)switch(p[0]=g,g){case"A":p[1]=d[1],p[2]=d[2],p[3]=d[3],p[4]=d[4],p[5]=d[5],p[6]=+d[6]+o,p[7]=+d[7]+s;break;case"V":p[1]=+d[1]+s;break;case"H":p[1]=+d[1]+o;break;case"M":u=+d[1]+o,f=+d[2]+s,p[1]=u,p[2]=f;break;default:for(var y=1,m=d.length;y<m;y++)p[y]=+d[y]+(y%2?o:s)}else p=e[n];switch(g){case"Z":o=+u,s=+f;break;case"H":o=p[1],p=["L",o,s];break;case"V":s=p[1],p=["L",o,s];break;case"T":o=p[1],s=p[2];var b=c_([v[1],v[2]],[v[3],v[4]]);p=["Q",b[0],b[1],o,s];break;case"S":o=p[p.length-2],s=p[p.length-1];var x=v.length,w=c_([v[x-4],v[x-3]],[v[x-2],v[x-1]]);p=["C",w[0],w[1],p[1],p[2],o,s];break;case"M":u=p[p.length-2],f=p[p.length-1];break;default:o=p[p.length-2],s=p[p.length-1]}a.push(p)}return a}function vh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Fg(r,e){return vh(r)*vh(e)?(r[0]*e[0]+r[1]*e[1])/(vh(r)*vh(e)):1}function d_(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(Fg(r,e))}function Gg(r,e){return r[0]===e[0]&&r[1]===e[1]}function mz(r,e){var t=e[1],n=e[2],i=Ic(kc(e[3]),Math.PI*2),a=e[4],o=e[5],s=r[0],u=r[1],f=e[6],l=e[7],c=Math.cos(i)*(s-f)/2+Math.sin(i)*(u-l)/2,h=-1*Math.sin(i)*(s-f)/2+Math.cos(i)*(u-l)/2,d=c*c/(t*t)+h*h/(n*n);d>1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var v=t*t*(h*h)+n*n*(c*c),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*h/n:0,y=t?p*-n*c/t:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=d_([1,0],x),_=d_(x,w);return Fg(x,w)<=-1&&(_=Math.PI),Fg(x,w)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:Gg(r,[f,l])?0:t,ry:Gg(r,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:i,arcFlag:a,sweepFlag:o}}function v_(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function p_(r){r=dz(r);for(var e=[],t=null,n=null,i=null,a=0,o=r.length,s=0;s<o;s++){var u=r[s];n=r[s+1];var f=u[0],l={command:f,prePoint:t,params:u,startTangent:null,endTangent:null};switch(f){case"M":i=[u[1],u[2]],a=s;break;case"A":var c=mz(t,u);l.arcParams=c;break}if(f==="Z")t=i,n=r[a+1];else{var h=u.length;t=[u[h-2],u[h-1]]}n&&n[0]==="Z"&&(n=r[a],e[a]&&(e[a].prePoint=t)),l.currentPoint=t,e[a]&&Gg(t,e[a].currentPoint)&&(e[a].prePoint=l.prePoint);var d=n?[n[n.length-2],n[n.length-1]]:null;l.nextPoint=d;var v=l.prePoint;if(["L","H","V"].includes(f))l.startTangent=[v[0]-t[0],v[1]-t[1]],l.endTangent=[t[0]-v[0],t[1]-v[1]];else if(f==="Q"){var p=[u[1],u[2]];l.startTangent=[v[0]-p[0],v[1]-p[1]],l.endTangent=[t[0]-p[0],t[1]-p[1]]}else if(f==="T"){var g=e[s-1],p=v_(g.currentPoint,v);g.command==="Q"?(l.command="Q",l.startTangent=[v[0]-p[0],v[1]-p[1]],l.endTangent=[t[0]-p[0],t[1]-p[1]]):(l.command="TL",l.startTangent=[v[0]-t[0],v[1]-t[1]],l.endTangent=[t[0]-v[0],t[1]-v[1]])}else if(f==="C"){var y=[u[1],u[2]],m=[u[3],u[4]];l.startTangent=[v[0]-y[0],v[1]-y[1]],l.endTangent=[t[0]-m[0],t[1]-m[1]],l.startTangent[0]===0&&l.startTangent[1]===0&&(l.startTangent=[y[0]-m[0],y[1]-m[1]]),l.endTangent[0]===0&&l.endTangent[1]===0&&(l.endTangent=[m[0]-y[0],m[1]-y[1]])}else if(f==="S"){var g=e[s-1],y=v_(g.currentPoint,v),m=[u[1],u[2]];g.command==="C"?(l.command="C",l.startTangent=[v[0]-y[0],v[1]-y[1]],l.endTangent=[t[0]-m[0],t[1]-m[1]]):(l.command="SQ",l.startTangent=[v[0]-m[0],v[1]-m[1]],l.endTangent=[t[0]-m[0],t[1]-m[1]])}else if(f==="A"){var b=.001,x=l.arcParams||{},w=x.cx,E=w===void 0?0:w,_=x.cy,M=_===void 0?0:_,C=x.rx,S=C===void 0?0:C,A=x.ry,T=A===void 0?0:A,k=x.sweepFlag,O=k===void 0?0:k,G=x.startAngle,D=G===void 0?0:G,$=x.endAngle,Y=$===void 0?0:$;O===0&&(b*=-1);var N=S*Math.cos(D-b)+E,P=T*Math.sin(D-b)+M;l.startTangent=[N-i[0],P-i[1]];var W=S*Math.cos(D+Y+b)+E,J=T*Math.sin(D+Y-b)+M;l.endTangent=[v[0]-W,v[1]-J]}e.push(l)}return e}function bz(r,e){for(var t=[],n=[],i=[],a=0;a<r.length;a++){var o=r[a],s=o.currentPoint,u=o.params,f=o.prePoint,l=void 0;switch(o.command){case"Q":l=Z2.box(f[0],f[1],u[1],u[2],u[3],u[4]);break;case"C":l=Cf.box(f[0],f[1],u[1],u[2],u[3],u[4],u[5],u[6]);break;case"A":var c=o.arcParams;l=tz.box(c.cx,c.cy,c.rx,c.ry,c.xRotation,c.startAngle,c.endAngle);break;default:t.push(s[0]),n.push(s[1]);break}l&&(o.box=l,t.push(l.x,l.x+l.width),n.push(l.y,l.y+l.height)),e&&(o.command==="L"||o.command==="M")&&o.prePoint&&o.nextPoint&&i.push(o)}t=t.filter(function(y){return!Number.isNaN(y)&&y!==1/0&&y!==-1/0}),n=n.filter(function(y){return!Number.isNaN(y)&&y!==1/0&&y!==-1/0});var h=Ui(t),d=Ui(n),v=ji(t),p=ji(n);if(i.length===0)return{x:h,y:d,width:v-h,height:p-d};for(var a=0;a<i.length;a++){var o=i[a],s=o.currentPoint,g=void 0;s[0]===h?(g=ph(o,e),h=h-g.xExtra):s[0]===v&&(g=ph(o,e),v=v+g.xExtra),s[1]===d?(g=ph(o,e),d=d-g.yExtra):s[1]===p&&(g=ph(o,e),p=p+g.yExtra)}return{x:h,y:d,width:v-h,height:p-d}}function ph(r,e){var t=r.prePoint,n=r.currentPoint,i=r.nextPoint,a=Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2),o=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),s=Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2),u=Math.acos((a+o-s)/(2*Math.sqrt(a)*Math.sqrt(o)));if(!u||Math.sin(u)===0||ax(u,0))return{xExtra:0,yExtra:0};var f=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),l=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));f=f>Math.PI/2?Math.PI-f:f,l=l>Math.PI/2?Math.PI-l:l;var c={xExtra:Math.cos(u/2-f)*(e/2*(1/Math.sin(u/2)))-e/2||0,yExtra:Math.cos(l-u/2)*(e/2*(1/Math.sin(u/2)))-e/2||0};return c}function xz(r){var e=r.attr(),t=e.path,n=e.stroke,i=n?e.lineWidth:0,a=r.get("segments")||p_(t),o=bz(a,i),s=o.x,u=o.y,f=o.width,l=o.height,c={minX:s,minY:u,maxX:s+f,maxY:u+l};return c=Pg(r,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function wz(r){var e=r.attr(),t=e.x1,n=e.y1,i=e.x2,a=e.y2,o=Math.min(t,i),s=Math.max(t,i),u=Math.min(n,a),f=Math.max(n,a),l={minX:o,maxX:s,minY:u,maxY:f};return l=Pg(r,l),{x:l.minX,y:l.minY,width:l.maxX-l.minX,height:l.maxY-l.minY}}function Ez(r){var e=r.attr(),t=e.x,n=e.y,i=e.rx,a=e.ry;return{x:t-i,y:n-a,width:i*2,height:a*2}}Ki("rect",X2),Ki("image",X2),Ki("circle",Y2),Ki("marker",Y2),Ki("polyline",oz),Ki("polygon",sz),Ki("text",lz),Ki("path",xz),Ki("line",wz),Ki("ellipse",Ez);var _z=function(r){It(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.item=n.item,i.canvasX=n.canvasX,i.canvasY=n.canvasY,i.wheelDelta=n.wheelDelta,i.detail=n.detail,i}return e}(jE),zg=function(e){return"".concat(e,"-").concat(Math.random()).concat(Date.now())},$g=function(e){if(vt(e))switch(e.length){case 4:return e;case 3:return e.push(e[1]),e;case 2:return e.concat(e);case 1:return[e[0],e[0],e[0],e[0]];default:return[0,0,0,0]}if(ht(e))return[e,e,e,e];if(Pe(e)){var t=parseInt(e,10);return[t,t,t,t]}return[0,0,0,0]},Sz=function(e){var t=new _z(e.type,e);return t.clientX=e.clientX,t.clientY=e.clientY,t.x=e.x,t.y=e.y,t.target=e.target,t.currentTarget=e.currentTarget,t.bubbles=!0,t.item=e.item,t},Mz=function(e){if(!e)return!1;for(var t=9,n=[1,0,0,0,1,0,0,0,1],i=0;i<t;i++)if(e[i]!==n[i])return!0;return!1},Qi=function(e){return Number.isNaN(Number(e))},g_=function(e){for(var t=1/0,n=-1/0,i=1/0,a=-1/0,o=0;o<e.length;o++){var s=e[o],u=s.getBBox(),f=u.minX,l=u.minY,c=u.maxX,h=u.maxY;f<t&&(t=f),l<i&&(i=l),c>n&&(n=c),h>a&&(a=h)}var d=Math.floor(t),v=Math.floor(i),p=Math.ceil(n)-Math.floor(t),g=Math.ceil(a)-Math.floor(i);return{x:d,y:v,width:p,height:g,minX:t,minY:i,maxX:n,maxY:a}},Cz=function(e,t,n,i,a){t===void 0&&(t=15),n===void 0&&(n="quadratic"),i===void 0&&(i=void 0),a===void 0&&(a=void 0);for(var o=e.length,s=t*2,u=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],f={},l=[],c={},h=0;h<o;h++){var d=e[h],v=d.source,p=d.target,g="".concat(v,"-").concat(p);if(!l[h]){f[g]||(f[g]=[]),l[h]=!0,f[g].push(d);for(var y=0;y<o;y++)if(h!==y){var m=e[y],b=m.source,x=m.target;l[y]||(v===x&&p===b?(f[g].push(m),l[y]=!0,c["".concat(b,"|").concat(x,"|").concat(f[g].length-1)]=!0):v===b&&p===x&&(f[g].push(m),l[y]=!0))}}}for(var w in f)for(var E=f[w],_=E.length,M=0;M<_;M++){var C=E[M];if(C.source===C.target){a&&(C.type=a),C.loopCfg={position:u[M%8],dist:Math.floor(M/8)*20+50};continue}if(_===1&&i&&C.source!==C.target){C.type=i;continue}C.type=n;var S=(M%2===0?1:-1)*(c["".concat(C.source,"|").concat(C.target,"|").concat(M)]?-1:1);_%2===1?C.curveOffset=S*Math.ceil(M/2)*s:C.curveOffset=S*(Math.floor(M/2)*s+t)}return e};const Az=Object.freeze(Object.defineProperty({__proto__:null,calculationItemsBBox:g_,cloneEvent:Sz,formatPadding:$g,isNaN:Qi,isViewportChanged:Mz,processParallelEdges:Cz,uniqueId:zg},Symbol.toStringTag,{value:"Module"}));var xe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ji(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ea(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var so={};const Tz=ea(e4);Object.defineProperty(so,"__esModule",{value:!0});var uo=Tz;function y_(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return uo.mat3.fromTranslation(n,t),uo.mat3.multiply(r,n,e)}so.leftTranslate=y_;function m_(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return uo.mat3.fromRotation(n,t),uo.mat3.multiply(r,n,e)}so.leftRotate=m_;function b_(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return uo.mat3.fromScaling(n,t),uo.mat3.multiply(r,n,e)}so.leftScale=b_;function Iz(r,e,t){return uo.mat3.multiply(r,t,e)}function kz(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":y_(t,t,[a[1],a[2]]);break;case"s":b_(t,t,[a[1],a[2]]);break;case"r":m_(t,t,a[1]);break;case"m":Iz(t,t,a[1]);break}}return t}var x_=so.transform=kz;function w_(r,e){return r[0]*e[1]-e[0]*r[1]}so.direction=w_;function Lz(r,e,t){var n=uo.vec2.angle(r,e),i=w_(r,e)>=0;return t?i?Math.PI*2-n:n:i?n:Math.PI*2-n}so.angleTo=Lz;function Nz(r,e,t){return t?(r[0]=e[1],r[1]=-1*e[0]):(r[0]=-1*e[1],r[1]=e[0]),r}so.vertical=Nz;var Oz=function(){function r(e){this.destroyed=!1,this.graph=e,this.destroyed=!1}return r.prototype.getViewCenter=function(){var e=this.getFormatPadding(),t=this.graph,n=this.graph.get("width"),i=t.get("height");return{x:(n-e[1]-e[3])/2+e[3],y:(i-e[0]-e[2])/2+e[0]}},r.prototype.fitCenter=function(e,t){var n=this.graph,i=n.get("group"),a,o=n.getNodes();if(o.length>n.get("optimizeThreshold")){var s=1/0,u=1/0,f=-1/0,l=-1/0;o.forEach(function(x){var w=x.getModel(),E=w.x,_=w.y;s>E&&(s=E),u>_&&(u=_),f<E&&(f=E),l<_&&(l=_)});var c=i.getMatrix()||[1,0,0,0,1,0,0,0,1],h=Xs({x:s,y:u},c),d=h.x,v=h.y,p=Xs({x:f,y:l},c),g=p.x,y=p.y;a={minX:d,maxX:g,minY:v,maxY:y,width:g-d,height:y-v,x:d,y:v}}else a=i.getCanvasBBox();if(!(a.width===0||a.height===0)){var m=this.getViewCenter(),b={x:a.x+a.width/2,y:a.y+a.height/2};n.translate(m.x-b.x,m.y-b.y,e,t)}},r.prototype.animatedFitView=function(e,t,n,i,a,o,s,u){var f=this.graph;n=n||{duration:500,easing:"easeCubic"};var l=[1,0,0,0,1,0,0,0,1],c=i.x+a.x-o.x-i.minX,h=i.y+a.y-o.y-i.minY;if(!(Qi(c)||Qi(h))){var d=x_(l,[["t",c,h]]);if(!u){var v=vf({animateCfg:n,callback:function(){f.emit("viewportchange",{action:"translate",matrix:d})}});e.animate(function(x){return{matrix:ng(t,d,x)}},v);return}var p=f.get("minZoom"),g=f.get("maxZoom"),y=s;p&&s<p?(y=p,console.warn("fitview failed, ratio out of range, ratio: %f",s,"graph minzoom has been used instead")):g&&s>g&&(y=g,console.warn("fitview failed, ratio out of range, ratio: %f",s,"graph maxzoom has been used instead"));var m=x_(d,[["t",-a.x,-a.y],["s",y,y],["t",a.x,a.y]]),b=vf({animateCfg:n,callback:function(){e.setMatrix(m),f.emit("viewportchange",{action:"translate",matrix:d}),f.emit("viewportchange",{action:"zoom",matrix:m})}});e.stopAnimate(),e.setMatrix(t),e.animate(function(x){return{matrix:ng(t,m,x)}},b)}},r.prototype.fitView=function(e,t){var n=this.graph,i=this.getFormatPadding(),a=n.get("width"),o=n.get("height"),s=n.get("group"),u=s.getMatrix()||[1,0,0,0,1,0,0,0,1];s.resetMatrix();var f,l=n.getNodes();if(l.length>n.get("optimizeThreshold")){var c=1/0,h=1/0,d=-1/0,v=-1/0;l.forEach(function(E){var _=E.getModel(),M=_.x,C=_.y;c>M&&(c=M),h>C&&(h=C),d<M&&(d=M),v<C&&(v=C)}),f={minX:c,maxX:d,minY:h,maxY:v,width:d-c,height:v-h,x:c,y:h}}else f=s.getCanvasBBox();if(!(f.width===0||f.height===0)){var p=this.getViewCenter(),g={x:f.x+f.width/2,y:f.y+f.height/2},y=(a-i[1]-i[3])/f.width,m=(o-i[0]-i[2])/f.height,b=y;if(y>m&&(b=m),e)this.animatedFitView(s,u,t,f,p,g,b,!0);else{var x=p.x-g.x,w=p.y-g.y;if(Qi(x)||Qi(w))return;n.translate(x,w),n.zoom(b,p)||console.warn("zoom failed, ratio out of range, ratio: %f",b)}}},r.prototype.fitViewByRules=function(e,t,n){var i=e.onlyOutOfViewPort,a=i===void 0?!1:i,o=e.direction,s=o===void 0?"both":o,u=e.ratioRule,f=u===void 0?"min":u,l=this.graph,c=this.getFormatPadding(),h=l.get("width"),d=l.get("height"),v=l.get("group"),p=v.getMatrix()||[1,0,0,0,1,0,0,0,1];v.resetMatrix();var g,y=l.getNodes();if(y.length>l.get("optimizeThreshold")){var m=1/0,b=1/0,x=-1/0,w=-1/0;y.forEach(function(O){var G=O.getModel(),D=G.x,$=G.y;m>D&&(m=D),b>$&&(b=$),x<D&&(x=D),w<$&&(w=$)}),g={minX:m,maxX:x,minY:b,maxY:w,width:x-m,height:w-b,x:m,y:b}}else g=v.getCanvasBBox();if(!(g.width===0||g.height===0)){var E=this.getViewCenter(),_={x:g.x+g.width/2,y:g.y+g.height/2},M=(h-c[1]-c[3])/g.width,C=(d-c[0]-c[2])/g.height,S;if(s==="x"?S=M:s==="y"?S=C:S=f==="max"?Math.max(M,C):Math.min(M,C),a&&(S=S<1?S:1),t)this.animatedFitView(v,p,n,g,E,_,S,!0);else{var A=l.getZoom(),T=A*S,k=l.get("minZoom");T<k&&(T=k,console.warn("fitview failed, ratio out of range, ratio: %f",S,"graph minzoom has been used instead")),l.translate(E.x-_.x,E.y-_.y),l.zoomTo(T,E)}}},r.prototype.getFormatPadding=function(){var e=this.graph.get("fitViewPadding");return $g(e)},r.prototype.focusPoint=function(e,t,n){var i=this,a=this.getViewCenter(),o=this.getPointByCanvas(a.x,a.y),s=this.graph.get("group").getMatrix();if(s||(s=[1,0,0,0,1,0,0,0,1]),t){var u=(o.x-e.x)*s[0],f=(o.y-e.y)*s[4],l=0,c=0,h=0,d=0;this.graph.get("canvas").animate(function(v){h=u*v,d=f*v,i.graph.translate(h-l,d-c),l=h,c=d},B({},n))}else this.graph.translate((o.x-e.x)*s[0],(o.y-e.y)*s[4])},r.prototype.getPointByCanvas=function(e,t){var n=this.graph.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=dE({x:e,y:t},n);return i},r.prototype.getPointByClient=function(e,t){var n=this.graph.get("canvas"),i=n.getPointByClient(e,t);return this.getPointByCanvas(i.x,i.y)},r.prototype.getClientByPoint=function(e,t){var n=this.graph.get("canvas"),i=this.getCanvasByPoint(e,t),a=n.getClientByPoint(i.x,i.y);return{x:a.x,y:a.y}},r.prototype.getCanvasByPoint=function(e,t){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Xs({x:e,y:t},n)},r.prototype.focus=function(e,t,n){if(Pe(e)&&(e=this.graph.findById(e)),e){var i=0,a=0;if(e.getType&&e.getType()==="edge"){var o=e.getSource().get("group").getMatrix(),s=e.getTarget().get("group").getMatrix();o&&s?(i=(o[6]+s[6])/2,a=(o[7]+s[7])/2):(o||s)&&(i=o?o[6]:s[6],a=o?o[7]:s[7])}else{var u=e.get("group"),f=u.getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]),i=f[6],a=f[7]}this.focusPoint({x:i,y:a},t,n)}},r.prototype.focusItems=function(e,t,n,i){if(e.length){var a=this.graph,o=this.getFormatPadding(),s=a.get("width"),u=a.get("height"),f=a.get("group"),l=f.getMatrix()||[1,0,0,0,1,0,0,0,1];f.resetMatrix();for(var c={x:0,y:0,minX:Number.MAX_SAFE_INTEGER,minY:Number.MAX_SAFE_INTEGER,maxX:Number.MIN_SAFE_INTEGER,maxY:Number.MIN_SAFE_INTEGER,width:0,height:0},h=0,d=e;h<d.length;h++){var v=d[h],p=v.getBBox();p.minX<c.minX&&(c.minX=p.minX),p.minY<c.minY&&(c.minY=p.minY),p.maxX>c.maxX&&(c.maxX=p.maxX),p.maxY>c.maxY&&(c.maxY=p.maxY)}if(c.x=c.minX,c.y=c.minY,c.width=c.maxX-c.minX,c.height=c.maxY-c.minY,!(c.width===0||c.height===0)){var g=this.getViewCenter(),y={x:c.x+c.width/2,y:c.y+c.height/2},m=(s-o[1]-o[3])/c.width,b=(u-o[0]-o[2])/c.height,x=m;m>b&&(x=b),n?this.animatedFitView(f,l,i,c,g,y,x,t):(a.translate(g.x-y.x,g.y-y.y),t&&!a.zoom(x,g)&&console.warn("zoom failed, ratio out of range, ratio: %f",x))}}},r.prototype.changeSize=function(e,t){var n=this.graph;if(!ht(e)||!ht(t))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:e,height:t});var i=n.get("canvas");i.changeSize(e,t);var a=n.get("plugins");a.forEach(function(o){o.get("gridContainer")&&o.positionInit()})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!1},r}();function jg(r){"@babel/helpers - typeof";return jg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jg(r)}function E_(r){if(typeof r!="string")return r;var e=function(_){if(typeof _!="string")return _;try{return JSON.parse(_.trim())}catch{return _.trim()}},t=e(r);if(typeof t!="string")return t;for(var n=function(_){return _[_.length-1]},i=r.trim(),a=[],o=[],s=function(){for(var _=[],M=0;M<arguments.length;M++)_[M]=arguments[M];return _.some(function(C){return n(o)===C})},u=function(){return n(a)},f=null,l=0,c="";l<i.length;){var h=i[l],d=s('"',"'");if(!d&&!h.trim()){l+=1;continue}var v=i[l-1]==="\\",p=s("}"),g=s("]"),y=s(","),m=u();if(d)if(n(o)===h&&!v){o.pop();var b=e(c);m.push(b),f=b,c=""}else c+=h;else if(g&&h===",")c&&(m.push(e(c)),c="");else if(p&&h===":")o.push(","),c&&(m.push(c),c="");else if(y&&h===",")c&&(m.push(e(c)),c=""),o.pop();else if(h==="}"&&(p||y)){c&&(m.push(e(c)),c=""),y&&o.pop();for(var x={},w=1;w<m.length;w+=2)x[m[w-1]]=m[w];a.pop(),a.length&&n(a).push(x),o.pop(),f=x}else h==="]"&&g?(c&&(m.push(e(c)),c=""),a.pop(),a.length&&n(a).push(m),o.pop(),f=m):h==="{"?(a.push([]),o.push("}")):h==="["?(a.push([]),o.push("]")):h==='"'?o.push('"'):h==="'"?o.push("'"):c+=h;l+=1}return f||c}var Dz=function(e){return e.split("-").reduce(function(t,n){return t+n.charAt(0).toUpperCase()+n.slice(1)})},Pz=function(e){return function(t){for(var n=e.length,i=[],a=0,o="";a<n;)if(e[a]==="{"&&e[a+1]==="{")i.push(o),o="",a+=2;else if(e[a]==="}"&&e[a+1]==="}"){if(i.length){var s=i.pop();o=Ea(t,o,s.endsWith("=")?'"{'.concat(o,'}"'):o),i.push(s+o)}a+=2,o=""}else o+=e[a],a+=1;return i.push(o),i.map(function(u,f){return i[f-1]&&i[f-1].endsWith("=")?'"{'.concat(u,'}"'):u}).join("")}};function __(r,e){var t={},n=r.getAttributeNames&&r.getAttributeNames()||[],i=r.children&&Array.from(r.children).map(function(s){return __(s,e)}),a={},o=r.tagName?r.tagName.toLowerCase():"group";return o==="text"&&(t.text=r.innerText),a.type=o,o==="img"&&(a.type="image"),Array.from(n).forEach(function(s){var u=Dz(s),f=r.getAttribute(s);try{if(u==="style"||u==="attrs"){var l=E_(f);t=B(B({},t),l)}else a[u]=E_(f)}catch(c){if(u==="style")throw c;a[u]=f}}),a.attrs=t,e&&e.style&&a.name&&jg(e.style[a.name])==="object"&&(a.attrs=B(B({},a.attrs),e.style[a.name])),e&&e.style&&a.keyshape&&(a.attrs=B(B({},a.attrs),e.style)),i.length&&(a.children=i),a}function Rz(r,e,t){var n=r.attrs,i=n===void 0?{}:n,a={x:e.x||0,y:e.y||0,width:t.width||0,height:t.height||0},o,s;switch(r.type){case"maker":case"circle":i.r&&(s=2*i.r,o=2*i.r);break;case"text":i.text&&(s=IE(i.text,i.fontSize||12)[0],o=16,a.y+=o,a.height=o,a.width=s,r.attrs=B({fontSize:12,fill:"#000"},i));break;default:i.width&&(s=i.width),i.height&&(o=i.height)}return o>=0&&(a.height=o),s>=0&&(a.width=s),i.marginTop&&(a.y+=i.marginTop),i.marginLeft&&(a.x+=i.marginLeft),a}function S_(r,e){var t;e===void 0&&(e={x:0,y:0});var n=B({x:0,y:0,width:0,height:0},e);if(!((t=r.children)===null||t===void 0)&&t.length){var i=r.attrs,a=i===void 0?{}:i,o=a.marginTop,s=B({},e);o&&(s.y+=o);for(var u=0;u<r.children.length;u++){r.children[u].attrs.key="".concat(a.key||"root"," -").concat(u," ");var f=S_(r.children[u],s);if(f.bbox){var l=f.bbox;f.attrs.next==="inline"?s.x+=f.bbox.width:s.y+=f.bbox.height,l.width+l.x>n.width&&(n.width=l.width+l.x),l.height+l.y>n.height&&(n.height=l.height+l.y)}}}return r.bbox=Rz(r,e,n),r.attrs=B(B({},r.attrs),r.bbox),r}function M_(r,e){var t,n,i,a,o=(r||{}).type,s=((e==null?void 0:e.attrs)||{}).key;if(s&&r&&(r.attrs.key=s),!r&&e)return{action:"delete",val:e,type:o,key:s};if(r&&!e)return{action:"add",val:r,type:o};if(!r&&!e)return{action:"same",type:o};var u=[];if(((t=r.children)===null||t===void 0?void 0:t.length)>0||((n=e.children)===null||n===void 0?void 0:n.length)>0)for(var f=Math.max((i=r.children)===null||i===void 0?void 0:i.length,(a=e.children)===null||a===void 0?void 0:a.length),l=e.children||[],c=r.children||[],h=0;h<f;h+=1)u.push(M_(c[h],l[h]));var d=Object.keys(e.attrs),v=Object.keys(r.attrs);return e.type!==r.type?{action:"restructure",nowTarget:r,formerTarget:e,key:s,children:u}:d.filter(function(p){return p!=="children"}).some(function(p){return r.attrs[p]!==e.attrs[p]||!v.includes(p)})?{action:"change",val:r,children:u,type:o,key:s}:{action:"same",children:u,type:o,key:s}}function C_(r){var e={},t=function(i){var a=typeof r=="function"?r(i):r,o=Pz(a)(i),s=document.createElement("div");s.innerHTML=o;var u=s.children[0],f=S_(__(u,i));return s.remove(),f};return{draw:function(i,a){var o=t(i),s=a,u=function f(l){var c=l.attrs,h=c===void 0?{}:c,d=l.bbox,v=l.type,p=l.children,g=Jr(l,["attrs","bbox","type","children"]);if(l.type!=="group"){var y=a.addShape(l.type,B({attrs:h,origin:{bbox:d,type:v,children:p}},g));l.keyshape&&(s=y)}l.children&&l.children.forEach(function(m){return f(m)})};return u(o),e[i.id]=[o],s},update:function(i,a){e[i.id]||(e[i.id]=[]);var o=a.getContainer(),s=o.get("children"),u=t(i),f=e[i.id].pop(),l=M_(u,f),c=function v(p){var g;p.type!=="group"&&o.addShape(p.type,{attrs:p.attrs}),!((g=p.children)===null||g===void 0)&&g.length&&p.children.map(function(y){return v(y)})},h=function v(p){var g,y=s.find(function(m){return m.attrs.key===p.attrs.key});y&&o.removeChild(y),!((g=p.children)===null||g===void 0)&&g.length&&p.children.map(function(m){return v(m)})},d=function v(p){var g=p.key;if(p.type!=="group"){var y=s.find(function(b){return b.attrs.key===g});switch(p.action){case"change":if(y){var m=p.val.keyshape?a.getOriginStyle():{};y.attr(B(B({},m),p.val.attrs))}break;case"add":c(p.val);break;case"delete":h(p.val);break;case"restructure":h(p.formerTarget),c(p.nowTarget);break}}p.children&&p.children.forEach(function(b){return v(b)})};d(l),e[i.id].push(u)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var Ug={};function A_(r){return Ug[r]||(Ug[r]=js(r)),Ug[r]}var Bz={defaultShapeType:"defaultType",className:null,getShape:function(e){var t=this,n=t[e]||t[t.defaultShapeType]||t["simple-circle"];return n},draw:function(e,t,n){var i=this.getShape(e);n.shapeMap={};var a=i.draw(t,n);return i.afterDraw&&i.afterDraw(t,n,a),a},baseUpdate:function(e,t,n,i){var a,o,s=this.getShape(e);s.update&&(s.mergeStyle=(a=s.getOptions)===null||a===void 0?void 0:a.call(s,t,i),(o=s.update)===null||o===void 0||o.call(s,t,n,i)),s.afterUpdate&&s.afterUpdate(t,n)},setState:function(e,t,n,i){var a=this.getShape(e);a.setState(t,n,i)},shouldUpdate:function(e){var t=this.getShape(e);return!!t.update},getControlPoints:function(e,t){var n=this.getShape(e);return n.getControlPoints(t)},getAnchorPoints:function(e,t){var n=this.getShape(e);return n.getAnchorPoints(t)}},Xg={options:{},draw:function(e,t){return this.drawShape(e,t)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var t=this.options.anchorPoints,n=e.anchorPoints||t;return n}},yr=function(){function r(){}return r.registerFactory=function(e,t){var n=A_(e),i=Bz,a=B(B({},i),t);return r[n]=a,a.className=n,a},r.getFactory=function(e){var t=A_(e);return r[t]},r.registerNode=function(e,t,n){var i=r.Node,a;if(typeof t=="string"||typeof t=="function"){var o=C_(t);a=B(B({},i.getShape("single-node")),o)}else if(t.jsx){var s=t.jsx,o=C_(s);a=B(B(B({},i.getShape("single-node")),o),t)}else{i.getShape(n);var u=n?i.getShape(n):Xg;a=B(B({},u),t)}return a.type=e,a.itemType="node",i[e]=a,a},r.registerEdge=function(e,t,n){var i=r.Edge,a=n?i.getShape(n):Xg,o=B(B({},a),t);return o.type=e,o.itemType="edge",i[e]=o,o},r.registerCombo=function(e,t,n){var i=r.Combo,a=n?i.getShape(n):Xg,o=B(B({},a),t);return o.type=e,o.itemType="combo",i[e]=o,o},r}();yr.registerFactory("node",{defaultShapeType:"circle"}),yr.registerFactory("edge",{defaultShapeType:"line"}),yr.registerFactory("combo",{defaultShapeType:"circle"});var Yg="bboxCache",Wg="bboxCanvasCache",T_=function(){function r(e){this._cfg={},this.destroyed=!1,this.optimize=!1;var t={id:void 0,type:"item",model:{},group:void 0,animate:!1,visible:!0,locked:!1,event:!0,keyShape:void 0,states:[]};this._cfg=Object.assign(t,this.getDefaultCfg(),e);var n=this.get("model"),i=n.id,a=this.get("type");typeof i>"u"?i=zg(a):typeof i!="string"&&(i=String(i)),this.get("model").id=i,this.set("id",i);var o=e.group;o&&(o.set("item",this),o.set("id",i)),this.init(),this.draw();var s=n.shape||n.type||(a==="edge"?"line":"circle"),u=this.get("shapeFactory");if(u&&u[s]){var f=u[s].options;if(f&&f.stateStyles){var l=this.get("styles")||n.stateStyles;l=gr({},f.stateStyles,l),this.set("styles",l)}}}return r.prototype.calculateBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Qc(e,t);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},r.prototype.calculateCanvasBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Qc(e,t);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},r.prototype.drawInner=function(){var e=this,t=e.get("shapeFactory"),n=e.get("group"),i=e.get("model");n.clear();var a=i.visible;if(a!==void 0&&!a&&e.changeVisibility(a),!!t){e.updatePosition(i);var o=e.getShapeCfg(i),s=o.type,u=t.draw(s,o,n);u&&(e.set("keyShape",u),u.set("isKeyShape",!0),u.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",s),this.restoreStates(t,s)}},r.prototype.setOriginStyle=function(){var e=this.get("group"),t=e.get("children"),n=this.getKeyShape(),i=this,a=n.get("name");if(this.get("originStyle")){var d=this.get("originStyle");a&&!d[a]&&(d[a]={});for(var v=this.getCurrentStatesStyle(),p=function(y){var m=t[y],b=m.get("name"),x=m.attr();if(b&&b!==a){var w=v[b];d[b]||(d[b]={}),w?Object.keys(x).forEach(function(M){var C=x[M];C!==w[M]&&(d[b][M]=C)}):d[b]=m.get("type")!=="image"?Vt(x):i.getShapeStyleByName(b)}else{var E=m.attr(),_={};Object.keys(v).forEach(function(M){var C=v[M];(M===a||!fn(C))&&(_[M]=C)}),Object.keys(E).forEach(function(M){var C=E[M];_[M]!==C&&(a?d[a][M]=C:d[M]=C)})}},s=0;s<t.length;s++)p(s);delete d.path,delete d.matrix,delete d.x,delete d.y,d[a]&&(delete d[a].x,delete d[a].y,delete d[a].matrix,delete d[a].path),i.set("originStyle",d)}else{for(var o={},s=0;s<t.length;s++){var u=t[s],f=u.get("type"),l=u.get("name");if(l&&l!==a)o[l]=f!=="image"?Vt(u.attr()):i.getShapeStyleByName(l),f==="text"&&o[l]&&(delete o[l].x,delete o[l].y,delete o[l].matrix);else{var c=i.getShapeStyleByName();if(delete c.path,delete c.matrix,!a)Object.assign(o,c);else if(l)o[a]=c;else{var h=zg("shape");u.set("name",h),e.shapeMap[h]=u,o[h]=f!=="image"?Vt(u.attr()):i.getShapeStyleByName(l)}}}i.set("originStyle",o)}},r.prototype.restoreStates=function(e,t){var n=this,i=n.get("states");ye(i,function(a){e.setState(t,a,!0,n)})},r.prototype.init=function(){var e=yr.getFactory(this.get("type"));this.set("shapeFactory",e)},r.prototype.get=function(e){return this._cfg[e]},r.prototype.set=function(e,t){fn(e)?this._cfg=B(B({},this._cfg),e):this._cfg[e]=t},r.prototype.getDefaultCfg=function(){return{}},r.prototype.clearCache=function(){this.set(Yg,null),this.set(Wg,null)},r.prototype.beforeDraw=function(){},r.prototype.afterDraw=function(){},r.prototype.afterUpdate=function(){},r.prototype.draw=function(){this.beforeDraw(),this.drawInner(),this.afterDraw()},r.prototype.getShapeStyleByName=function(e){var t=this.get("group"),n;if(e?n=t.shapeMap[e]||t.find(function(a){return a.get("name")===e}):n=this.getKeyShape(),n){var i={};return ye(n.attr(),function(a,o){(o!=="img"||Pe(a))&&(i[o]=a)}),i}return{}},r.prototype.getShapeCfg=function(e,t){var n=this.get("styles");if(n){var i=e;return i.style=B(B({},n),e.style),i}return e},r.prototype.getStateStyle=function(e){var t=this.get("styles"),n=t&&t[e];return n},r.prototype.getOriginStyle=function(){return this.get("originStyle")},r.prototype.getCurrentStatesStyle=function(){var e=this,t={},n=e.getStates();return!n||!n.length?this.get("originStyle"):(ye(e.getStates(),function(i){t=Object.assign(t,e.getStateStyle(i))}),t)},r.prototype.setState=function(e,t){var n=this.get("states"),i=this.get("shapeFactory"),a=e,o=e;Pe(t)&&(a="".concat(e,":").concat(t),o="".concat(e,":"));var s=n;if(of(t)){var u=n.indexOf(o);if(t){if(u>-1)return;n.push(a)}else u>-1&&n.splice(u,1)}else if(Pe(t)){var f=n.filter(function(h){return h.includes(o)});f.length>0&&this.clearStates(f),s=s.filter(function(h){return!h.includes(o)}),s.push(a),this.set("states",s)}if(i){var l=this.get("model"),c=l.type;i.setState(c,e,t,this)}},r.prototype.clearStates=function(e){var t=this,n=t.getStates(),i=t.get("shapeFactory"),a=t.get("model"),o=a.type;e||(e=n),Pe(e)&&(e=[e]);var s=n.filter(function(u){return e.indexOf(u)===-1});t.set("states",s),e.forEach(function(u){i.setState(o,u,!1,t)})},r.prototype.setOptimize=function(e){this.optimize=e},r.prototype.getContainer=function(){return this.get("group")},r.prototype.getKeyShape=function(){return this.get("keyShape")},r.prototype.getModel=function(){return this.get("model")},r.prototype.getType=function(){return this.get("type")},r.prototype.getID=function(){return this.get("id")},r.prototype.isItem=function(){return!0},r.prototype.getStates=function(){return this.get("states")},r.prototype.hasState=function(e){var t=this.getStates();return t.indexOf(e)>=0},r.prototype.refresh=function(e){var t=this.get("model");this.updatePosition(t),this.updateShape(e),this.afterUpdate(),this.clearCache()},r.prototype.getUpdateType=function(e){},r.prototype.update=function(e,t){t===void 0&&(t=void 0);var n=this.get("model");if(t==="move")this.updatePosition(e);else{var i=n.visible,a=e.visible;i!==a&&a!==void 0&&this.changeVisibility(a);var o={x:n.x,y:n.y};e.x=isNaN(+e.x)?n.x:+e.x,e.y=isNaN(+e.y)?n.y:+e.y;var s=this.get("styles");if(e.stateStyles){var u=e.stateStyles;gt(s,u),delete e.stateStyles}Object.assign(n,e),(o.x!==e.x||o.y!==e.y)&&this.updatePosition(e),this.updateShape(t)}this.afterUpdate(),this.clearCache()},r.prototype.updateShape=function(e){var t=this.get("shapeFactory"),n=this.get("model"),i=n.type;if(t.shouldUpdate(i)&&i===this.get("currentShape")){var a=this.getShapeCfg(n,e);t.baseUpdate(i,a,this,e),e!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(t,i)},r.prototype.updatePosition=function(e){var t=this.get("model"),n=isNaN(+e.x)?+t.x:+e.x,i=isNaN(+e.y)?+t.y:+e.y,a=this.get("group");if(isNaN(n)||isNaN(i))return!1;t.x=n,t.y=i;var o=a.getMatrix();return o&&o[6]===n&&o[7]===i?!1:(a.resetMatrix(),vE(a,{x:n,y:i}),this.clearCache(),!0)},r.prototype.getBBox=function(){var e=this.get(Yg);return e||(e=this.calculateBBox(),this.set(Yg,e)),e},r.prototype.getCanvasBBox=function(){var e=this.get(Wg);return e||(e=this.calculateCanvasBBox(),this.set(Wg,e)),e},r.prototype.toFront=function(){var e=this.get("group");e.toFront()},r.prototype.toBack=function(){var e=this.get("group");e.toBack()},r.prototype.show=function(){this.changeVisibility(!0)},r.prototype.hide=function(){this.changeVisibility(!1)},r.prototype.changeVisibility=function(e){var t=this.get("group");e?t.show():t.hide(),this.set("visible",e)},r.prototype.isVisible=function(){return this.get("visible")},r.prototype.enableCapture=function(e){var t=this.get("group");t&&t.set("capture",e)},r.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),t=this.get("group");e&&t.stopAnimate(),t.shapeMap={},this.clearCache(),t.remove(),this._cfg=null,this.destroyed=!0}},r}(),gh={source:"start",target:"end"},ta="Node",Zs="Point",Fz="Anchor",I_=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(t,n){var i=gh[t]+Zs,a=t+ta,o=this.get(a);o&&!o.destroyed&&o.removeEdge(this),fn(n)?(this.set(i,n),this.set(a,null)):n&&(n.addEdge(this),this.set(a,n),this.set(i,null))},e.prototype.getLinkPoint=function(t,n,i){var a=gh[t]+Zs,o=t+ta,s=this.get(a);if(!s){var u=this.get(o),f=t+Fz,l=this.getPrePoint(t,i),c=n[f];ct(c)||(s=u.getLinkPointByAnchor(c)),s=s||u.getLinkPoint(l),ct(s.index)||this.set("".concat(t,"AnchorIndex"),s.index)}return s},e.prototype.getPrePoint=function(t,n){if(n&&n.length){var i=t==="source"?0:n.length-1;return n[i]}var a=t==="source"?"target":"source";return this.getEndPoint(a)},e.prototype.getEndPoint=function(t){var n=t+ta,i=gh[t]+Zs,a=this.get(n);return a&&!a.destroyed?a.get("model"):this.get(i)},e.prototype.getControlPointsByCenter=function(t){var n=this.getEndPoint("source"),i=this.getEndPoint("target"),a=this.get("shapeFactory"),o=t.type;return a.getControlPoints(o,{startPoint:n,endPoint:i})},e.prototype.getEndCenter=function(t){var n=t+ta,i=gh[t]+Zs,a=this.get(n);if(a){var o=a.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(i)},e.prototype.init=function(){r.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(t,n){var i=this,a=i.get("linkCenter"),o=n!=null&&n.includes("move")?t:r.prototype.getShapeCfg.call(this,t);if(a)o.startPoint=i.getEndCenter("source"),o.endPoint=i.getEndCenter("target");else{var s=o.controlPoints||i.getControlPointsByCenter(o);o.startPoint=i.getLinkPoint("source",t,s),o.endPoint=i.getLinkPoint("target",t,s)}return o.sourceNode=i.get("sourceNode"),o.targetNode=i.get("targetNode"),o},e.prototype.getModel=function(){var t=this.get("model"),n=this.get("source".concat(ta)),i=this.get("target".concat(ta));return n?delete t["source".concat(ta)]:t.source=this.get("start".concat(Zs)),i?delete t["target".concat(ta)]:t.target=this.get("end".concat(Zs)),!Pe(t.source)&&!fn(t.source)&&(t.source=t.source.getID()),!Pe(t.target)&&!fn(t.target)&&(t.target=t.target.getID()),t},e.prototype.setSource=function(t){this.setEnd("source",t),this.set("source",t)},e.prototype.setTarget=function(t){this.setEnd("target",t),this.set("target",t)},e.prototype.getSource=function(){return this.get("source")},e.prototype.getTarget=function(){return this.get("target")},e.prototype.updatePosition=function(){return!1},e.prototype.update=function(t,n){n===void 0&&(n=void 0);var i=this.get("model"),a=i.visible,o=t.visible;a!==o&&o!==void 0&&this.changeVisibility(o);var s=this.get("source"),u=this.get("target");if(!(!s||s.destroyed||!u||u.destroyed)){var f=this.get("styles");if(t.stateStyles){var l=t.stateStyles;gt(f,l),delete t.stateStyles}Object.assign(i,t),this.updateShape(n),this.afterUpdate(),this.clearCache()}},e.prototype.destroy=function(){var t=this.get("source".concat(ta)),n=this.get("target".concat(ta));t&&!t.destroyed&&t.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),r.prototype.destroy.call(this)},e}(T_),Vg="anchorPointsCache",Gz="bboxCache",Hg=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getNearestPoint=function(t,n){for(var i=0,a=t[0],o=Hc(t[0],n),s=0;s<t.length;s++){var u=t[s],f=Hc(u,n);f<o&&(a=u,o=f,i=s)}return a.anchorIndex=i,a},e.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getInEdges=function(){var t=this;return this.get("edges").filter(function(n){return n.get("target")===t})},e.prototype.getOutEdges=function(){var t=this;return this.get("edges").filter(function(n){return n.get("source")===t})},e.prototype.getNeighbors=function(t){var n=this,i=this.get("edges");if(t==="target"){var a=function(f){return f.getSource()===n};return i.filter(a).map(function(u){return u.getTarget()})}if(t==="source"){var o=function(f){return f.getTarget()===n};return i.filter(o).map(function(u){return u.getSource()})}var s=function(f){return f.getSource()===n?f.getTarget():f.getSource()};return i.map(s)},e.prototype.getLinkPointByAnchor=function(t){var n=this.getAnchorPoints();return n[t]},e.prototype.getLinkPoint=function(t){var n=this.get("keyShape"),i=n.get("type"),a=this.get("type"),o,s,u=this.getBBox();a==="combo"?(o=u.centerX||(u.maxX+u.minX)/2,s=u.centerY||(u.maxY+u.minY)/2):(o=u.centerX,s=u.centerY);var f=this.getAnchorPoints(),l;switch(i){case"circle":l=cE({x:o,y:s,r:u.width/2},t);break;case"ellipse":l=hE({x:o,y:s,rx:u.width/2,ry:u.height/2},t);break;default:l=lE(u,t)}var c=l;return f.length&&(c||(c=t),c=this.getNearestPoint(f,c)),c||(c={x:o,y:s}),c},e.prototype.getAnchorPoints=function(){var t=this.get(Vg);if(!t){t=[];var n=this.get("shapeFactory"),i=this.getBBox(),a=this.get("model"),o=this.getShapeCfg(a),s=a.type,u=n.getAnchorPoints(s,o)||[];ye(u,function(f,l){var c={x:i.minX+f[0]*i.width,y:i.minY+f[1]*i.height,anchorIndex:l};t.push(c)}),this.set(Vg,t)}return t},e.prototype.addEdge=function(t){this.get("edges").push(t)},e.prototype.lock=function(){this.set("locked",!0)},e.prototype.unlock=function(){this.set("locked",!1)},e.prototype.hasLocked=function(){return this.get("locked")},e.prototype.removeEdge=function(t){var n=this.getEdges(),i=n.indexOf(t);i>-1&&n.splice(i,1)},e.prototype.clearCache=function(){this.set(Gz,null),this.set(Vg,null)},e.prototype.getUpdateType=function(t){var n,i,a,o,s;if(t){var u=!ct(t.x),f=!ct(t.y),l=Object.keys(t);if(l.length===1&&(u||f)||l.length===2&&u&&f)return"move";if(ht(t.x)||ht(t.y)||t.type||t.anchorPoints||t.size||t!=null&&t.style&&(!((n=t==null?void 0:t.style)===null||n===void 0)&&n.r||!((i=t==null?void 0:t.style)===null||i===void 0)&&i.width||!((a=t==null?void 0:t.style)===null||a===void 0)&&a.height||!((o=t==null?void 0:t.style)===null||o===void 0)&&o.rx||!((s=t==null?void 0:t.style)===null||s===void 0)&&s.ry))return"bbox|label";var c=l.includes("label")||l.includes("labelCfg");return c?"style|label":"style"}},e.prototype.setState=function(t,n){var i=this;if(this.optimize){r.prototype.setState.call(this,t,n);return}this.runWithBBoxAffected(function(){return r.prototype.setState.call(i,t,n)})},e.prototype.clearStates=function(t){var n=this;if(this.optimize){r.prototype.clearStates.call(this,t);return}this.runWithBBoxAffected(function(){return r.prototype.clearStates.call(n,t)})},e.prototype.runWithBBoxAffected=function(t){var n=["r","width","height","rx","ry","lineWidth"],i=this.getKeyShape().attr(),a={};Object.keys(this.getKeyShape().attr()).forEach(function(f){n.includes(f)&&(a[f]=i[f])}),t();for(var o=this.getKeyShape().attr(),s=0;s<n.length;s++){var u=n[s];if(o[u]!==a[u]){this.clearCache(),this.getEdges().forEach(function(f){return f.refresh()});break}}},e}(T_),k_="bboxCache",L_="bboxCanvasCache",yh="sizeCache",N_="anchorPointsCache",O_=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},e.prototype.getShapeCfg=function(t){var n=this.get("styles"),i=this.get("bbox");if(n&&i){var a=t,o=ht(t.size)?[t.size,t.size]:t.size,s=ht(t.fixSize)?[t.fixSize,t.fixSize]:t.fixSize,u=o||s||ft.defaultCombo.size,f={r:(Math.max(i.width,i.height)||Math.max(u[0],u[1]))/2,width:i.width||u[0],height:i.height||u[1]};a.style=B(B(B({},n),t.style),f);var l=t.padding||ft.defaultCombo.padding;return ht(l)?(f.r+=l,f.width+=l*2,f.height+=l*2):(f.r=f.r+Math.max.apply(Math,l),f.width+=l[1]+l[3]||l[1]*2,f.height+=l[0]+l[2]||l[0]*2),this.set(yh,f),a}return t},e.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var t=this.get("keyShape"),n=this.get("group"),i=this.get(k_)||{},a=i.x,o=i.x,s=this.get(yh),u=Qc(t,n);if(u.centerX=(u.minX+u.maxX)/2,u.centerY=(u.minY+u.maxY)/2,s){s.width=Math.max(s.width,u.width),s.height=Math.max(s.height,u.height),this.set(yh,s);var f=t.get("type");f==="circle"?(u.width=s.r*2,u.height=s.r*2):(u.width=s.width,u.height=s.height),u.minX=u.centerX-u.width/2,u.minY=u.centerY-u.height/2,u.maxX=u.centerX+u.width/2,u.maxY=u.centerY+u.height/2}else u.width=u.maxX-u.minX,u.height=u.maxY-u.minY,u.centerX=(u.minX+u.maxX)/2,u.centerY=(u.minY+u.maxY)/2;return u.x=u.minX,u.y=u.minY,(u.x!==a||u.y!==o)&&this.set(N_,null),u}},e.prototype.getChildren=function(){var t=this;return{nodes:t.getNodes(),combos:t.getCombos()}},e.prototype.getNodes=function(){var t=this;return t.get("nodes")},e.prototype.getCombos=function(){var t=this;return t.get("combos")},e.prototype.addChild=function(t){var n=this,i=t.getType();switch(i){case"node":n.addNode(t);break;case"combo":n.addCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.addCombo=function(t){var n=this;return n.get("combos").push(t),!0},e.prototype.addNode=function(t){var n=this;return n.get("nodes").push(t),!0},e.prototype.removeChild=function(t){var n=this,i=t.getType();switch(i){case"node":n.removeNode(t);break;case"combo":n.removeCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.removeCombo=function(t){if(t){var n=this.getCombos(),i=n.indexOf(t);return i>-1?(n.splice(i,1),!0):!1}},e.prototype.removeNode=function(t){if(t){var n=this.getNodes(),i=n.indexOf(t);return i>-1?(n.splice(i,1),!0):!1}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){this.set(L_,null);var t=this.calculateCanvasBBox();return t},e.prototype.clearCache=function(){this.set(k_,null),this.set(L_,null),this.set(N_,null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),n=this.get("group");t&&n.stopAnimate(),n.shapeMap={},this.clearCache(),this.set(yh,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},e}(Hg),mh="node",bh="edge",D_="vedge",Tf="combo",zz="default",P_="Mapper",Sa="stateStyles",$z=function(){function r(e){var t=this;this.edgeToBeUpdateMap={},this.throttleRefresh=uf(function(n){var i=t.graph;if(!(!i||i.get("destroyed"))){var a=t.edgeToBeUpdateMap;if(a){var o=Object.values(a);o.length&&(o.forEach(function(s){var u=s.edge;if(!(!u||u.destroyed)){var f=u.getSource(),l=u.getTarget();!f||f.destroyed||!l||l.destroyed||u.refresh(s.updateType)}}),t.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=e,this.destroyed=!1}return r.prototype.addItem=function(e,t){var n=this.graph,i=e===D_?bh:e,a=n.get("".concat(i,"Group"))||n.get("group"),o=js(i),s=null,u=n.get(i+js(Sa))||{},f=n.get(zz+o);t[Sa]&&(u=t[Sa]),f&&ye(f,function(E,_){un(E)&&!vt(E)?t[_]=gr({},E,t[_]):vt(E)?t[_]=t[_]||Vt(f[_]):t[_]=t[_]||f[_]});var l=n.get(i+P_);if(l){var c=l(t);c[Sa]&&(u=c[Sa],delete c[Sa]),ye(c,function(E,_){un(E)&&!vt(E)?t[_]=gr({},t[_],E):t[_]=c[_]||t[_]})}if(n.emit("beforeadditem",{type:e,model:t}),e===bh||e===D_){var h=void 0,d=void 0;if(h=t.source,d=t.target,h&&Pe(h)&&(h=n.findById(h)),d&&Pe(d)&&(d=n.findById(d)),!h||!d){console.warn("The source or target node of edge ".concat(t.id," does not exist!"));return}h.getType&&h.getType()==="combo"&&(t.isComboEdge=!0),d.getType&&d.getType()==="combo"&&(t.isComboEdge=!0),s=new I_({model:t,source:h,target:d,styles:u,linkCenter:n.get("linkCenter"),group:a.addGroup()})}else if(e===mh)s=new Hg({model:t,styles:u,group:a.addGroup()});else if(e===Tf){var v=t.children,p=Jc(v,n),g=void 0,y=void 0;if(isNaN(p.x)?isNaN(t.x)&&(g=Math.random()*100):g=p.x,isNaN(p.y)?isNaN(t.y)&&(y=Math.random()*100):y=p.y,isNaN(t.x)||isNaN(t.y))t.x=g,t.y=y;else{var m=t.x-g,b=t.y-y;this.updateComboSucceeds(t.id,m,b,v)}var x=a.addGroup();x.setZIndex(t.depth),s=new O_({model:t,styles:u,animate:n.get("animate"),bbox:t.collapsed?Jc([],n):p,group:x}),!t.collapsed&&s.getKeyShape().get("type")==="circle"&&(p.width=Math.hypot(p.height,p.width),p.height=p.width,s.set("bbox",p),s.refresh());var w=s.getModel();(v||[]).forEach(function(E){var _=n.findById(E.id);s.addChild(_),E.depth=w.depth+2})}if(s)return s.setOptimize(n.getNodes().length>n.get("optimizeThreshold")),n.get("".concat(e,"s")).push(s),n.get("itemMap")[s.get("id")]=s,n.emit("afteradditem",{item:s,model:t}),s},r.prototype.updateItem=function(e,t){var n=this,i,a,o=this.graph;if(Pe(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s="";e.getType&&(s=e.getType());var u=o.get(s+P_),f=e.getModel(),l=f.x,c=f.y,h=e.getUpdateType(t);if(u){var d=gr({},f,t),v=u(d),p=gr({},f,v,t);v[Sa]&&(e.set("styles",p[Sa]),delete p[Sa]),ye(p,function(S,A){t[A]=S})}else ye(t,function(S,A){f[A]&&un(S)&&!vt(S)&&(t[A]=B(B({},f[A]),t[A]))});if(o.emit("beforeupdateitem",{item:e,cfg:t}),s===bh){if(t.source){var g=t.source;Pe(g)&&(g=o.findById(g)),e.setSource(g)}if(t.target){var y=t.target;Pe(y)&&(y=o.findById(y)),e.setTarget(y)}e.update(t)}else if(s===mh){e.update(t,h);var m=e.getEdges();h==="move"?ye(m,function(S){n.edgeToBeUpdateMap[S.getID()]={edge:S,updateType:h},n.throttleRefresh()}):h!=null&&h.includes("bbox")&&ye(m,function(S){S.refresh(h)})}else if(s===Tf){if(e.update(t,h),!isNaN(t.x)||!isNaN(t.y)){var b=t.x-l||0,x=t.y-c||0;this.updateComboSucceeds(f.id,b,x)}var w=e.getEdges(),E=(h==null?void 0:h.includes("bbox"))||h==="move";if(E&&s===Tf){var _=e.get("shapeFactory"),M=f.type||"circle",C=f.animate===void 0||t.animate===void 0?(a=(i=_[M])===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.animate:f.animate||t.animate;C?setTimeout(function(){if(!(!e||e.destroyed)){var S=e.getKeyShape();!S||S.destroyed||ye(w,function(A){A&&!A.destroyed&&A.refresh()})}},201):ye(w,function(S){S.refresh()})}}e.setOptimize(o.getNodes().length>o.get("optimizeThreshold")),o.emit("afterupdateitem",{item:e,cfg:t})}},r.prototype.updateCombo=function(e,t,n){var i=this,a,o,s=this.graph;if(Pe(e)&&(e=s.findById(e)),!(!e||e.destroyed)){var u=e.getModel(),f=Jc(t,s,e),l=f.x,c=f.y;e.set("bbox",f);var h=l,d=c;n?(h=isNaN(u.x)?l:u.x,d=isNaN(u.y)?c:u.y):(h=isNaN(l)?u.x:l,d=isNaN(c)?u.y:c),e.update({x:h,y:d});var v=e.get("shapeFactory"),p=u.type||"circle",g=u.animate===void 0?(o=(a=v[p])===null||a===void 0?void 0:a.options)===null||o===void 0?void 0:o.animate:u.animate;g?setTimeout(function(){if(!(!e||e.destroyed)){var y=e.getKeyShape();!y||y.destroyed||(e.getShapeCfg(u),i.updateComboEdges(e))}},201):this.updateComboEdges(e)}},r.prototype.updateComboEdges=function(e){for(var t,n,i=e.getEdges()||[],a=0;a<i.length;a++){var o=i[a];!(o!=null&&o.destroyed)&&!(!((t=o==null?void 0:o.getSource())===null||t===void 0)&&t.destroyed)&&!(!((n=o==null?void 0:o.getTarget())===null||n===void 0)&&n.destroyed)&&o.refresh()}},r.prototype.collapseCombo=function(e,t){t===void 0&&(t=!0);var n=this.graph;Pe(e)&&(e=n.findById(e));var i=e.getChildren();i.nodes.forEach(function(a){n.hideItem(a,t)}),i.combos.forEach(function(a){n.hideItem(a,t)})},r.prototype.updateComboSucceeds=function(e,t,n,i){var a=this;i===void 0&&(i=[]);var o=this.graph;if(!(!t&&!n)){var s=i;if(!(s!=null&&s.length)){var u=o.get("comboTrees");u==null||u.forEach(function(f){Mn(f,function(l){return l.id===e?(s=l.children,!1):!0})})}s==null||s.forEach(function(f){var l=o.findById(f.id);if(l){var c=l.getModel();a.updateItem(f.id,{x:(c.x||0)+t,y:(c.y||0)+n})}})}},r.prototype.expandCombo=function(e,t){t===void 0&&(t=!0);var n=this.graph;Pe(e)&&(e=n.findById(e));var i=e.getChildren(),a=new Set;i.nodes.forEach(function(o){n.showItem(o,t),o.getEdges().forEach(function(s){return a.add(s)})}),i.combos.forEach(function(o){o.getModel().collapsed?o.show():n.showItem(o,t),o.getEdges().forEach(function(s){return a.add(s)})}),a.forEach(function(o){return o.refresh()})},r.prototype.removeItem=function(e){var t=this,n=this.graph;if(Pe(e)&&(e=n.findById(e)),!(!e||e.destroyed)){var i=Vt(e.getModel()),a="";e.getType&&(a=e.getType()),n.emit("beforeremoveitem",{item:i,type:a});var o=n.get("".concat(a,"s")),s=o.indexOf(e);if(s>-1&&o.splice(s,1),a===bh){var u=n.get("v".concat(a,"s")),f=u.indexOf(e);f>-1&&u.splice(f,1)}var l=e.get("id"),c=n.get("itemMap");delete c[l];var h=n.get("comboTrees"),d=e.get("id");if(a===mh){var v=e.getModel().comboId;if(h&&v){var p=h,g=!1;h.forEach(function(E){g||Mn(E,function(_){if(_.id===d&&p){var M=p.indexOf(_);return p.splice(M,1),g=!0,!1}return p=_.children,!0})})}for(var y=e.getEdges(),m=y.length-1;m>=0;m--)n.removeItem(y[m],!1);v&&n.updateCombo(v)}else if(a===Tf){var b=e.getModel().parentId,x,w=!1;(h||[]).forEach(function(_){w||Mn(_,function(M){return M.id===d?(x=M,w=!0,!1):!0})}),x.removed=!0,x&&x.children&&x.children.forEach(function(_){t.removeItem(_.id)});for(var y=e.getEdges(),m=y.length;m>=0;m--)n.removeItem(y[m],!1);b&&n.updateCombo(b)}e.destroy(),n.emit("afterremoveitem",{item:i,type:a})}},r.prototype.setItemState=function(e,t,n){var i=this.graph,a=t;Pe(n)&&(a="".concat(t,":").concat(n)),!(e.hasState(a)===n&&n||Pe(n)&&e.hasState(a))&&(i.emit("beforeitemstatechange",{item:e,state:a,enabled:n}),e.setState(t,n),i.autoPaint(),i.emit("afteritemstatechange",{item:e,state:a,enabled:n}))},r.prototype.priorityState=function(e,t){var n=this.graph,i=e;Pe(e)&&(i=n.findById(e)),this.setItemState(i,t,!1),this.setItemState(i,t,!0)},r.prototype.clearItemStates=function(e,t){var n=this.graph;Pe(e)&&(e=n.findById(e)),n.emit("beforeitemstatesclear",{item:e,states:t}),e.clearStates(t),n.emit("afteritemstatesclear",{item:e,states:t})},r.prototype.refreshItem=function(e){var t=this.graph;Pe(e)&&(e=t.findById(e)),t.emit("beforeitemrefresh",{item:e}),e.refresh(),t.emit("afteritemrefresh",{item:e})},r.prototype.addCombos=function(e,t){var n=this,i=this.graph;(e||[]).forEach(function(o){qi(o,function(s){var u;return t.forEach(function(f){f.id===s.id&&(f.children=s.children,f.depth=s.depth,u=f)}),u&&n.addItem("combo",u),!0})});var a=i.get("comboGroup");a&&a.sort()},r.prototype.changeItemVisibility=function(e,t){var n=this,i=this.graph;if(Pe(e)&&(e=i.findById(e)),!e){console.warn("The item to be shown or hidden does not exist!");return}if(i.emit("beforeitemvisibilitychange",{item:e,visible:t}),e.changeVisibility(t),e.getType&&e.getType()===mh){var a=e.getEdges();ye(a,function(l){t&&!(l.get("source").isVisible()&&l.get("target").isVisible())||n.changeItemVisibility(l,t)})}else if(e.getType&&e.getType()===Tf){var o=i.get("comboTrees"),s=e.get("id"),u=[],f=!1;(o||[]).forEach(function(c){f||!c.children||c.children.length===0||Mn(c,function(h){return h.id===s?(u=h.children,f=!0,!1):!0})}),u&&(!t||t&&!e.getModel().collapsed)&&u.forEach(function(c){var h=i.findById(c.id);n.changeItemVisibility(h,t)});var a=e.getEdges();ye(a,function(c){t&&!(c.get("source").isVisible()&&c.get("target").isVisible())||n.changeItemVisibility(c,t)})}return i.emit("afteritemvisibilitychange",{item:e,visible:t}),e},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),jz=function(){function r(e){this.graph=e,this.destroyed=!1}return r.prototype.updateState=function(e,t,n){var i=this.graph.get("states"),a=t;Pe(n)&&(a="".concat(t,":").concat(n)),i[a]||(i[a]=[]),n?i[a].push(e):i[a]=i[a].filter(function(o){return o!==e}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:i})},r.prototype.updateStates=function(e,t,n){var i=this.graph.get("states"),a=Pe(t)?[t]:t;a.forEach(function(o){var s=o;i[s]||(i[s]=[]),Pe(n)&&(s="".concat(o,":").concat(n)),n?i[s].push(e):i[s]=i[s].filter(function(u){return u!==e})}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:t})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),Uz=function(e,t){return!e||!t?e:e.replace(/\\?\{([^{}]+)\}/g,function(n,i){if(n.charAt(0)==="\\")return n.slice(1);var a=t[i];return a===0&&(a="0"),a||""})},R_=function(e){var t=[];if(e.length<2)throw new Error("point length must largn than 2, now it's ".concat(e.length));for(var n=0,i=e;n<i.length;n++){var a=i[n],o=a.x,s=a.y;t.push(o),t.push(s)}var u=l_(t);return u.unshift(["M",e[0].x,e[0].y]),u},xh=function(e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=0);var a={x:(1-n)*e.x+n*t.x,y:(1-n)*e.y+n*t.y},o=[0,0];to(o,[t.x-e.x,t.y-e.y]),(!o||!o[0]&&!o[1])&&(o=[0,0]);var s=[-o[1]*i,o[0]*i];return a.x+=s[0],a.y+=s[1],a},Xz=function(e,t){var n=e.length;if(!n)return"";for(var i="",a="",o=0;o<n;o++){var s=e[o];o===0?a="M{x} {y}":a="L{x} {y}",i+=Uz(a,s)}return t&&(i+="Z"),i},qg=function(e){var t=[];return e.forEach(function(n){var i=n[0];if(i!=="A")for(var a=1;a<n.length;a=a+2)t.push([n[a],n[a+1]]);else{var o=n.length;t.push([n[o-2],n[o-1]])}}),t},Zg=function(e){if(e.length<2)throw new Error("point length must largn than 2, now it's ".concat(e.length));var t=e[0],n=e[1],i=e[e.length-1],a=e[e.length-2];e.unshift(i),e.unshift(a),e.push(t),e.push(n);for(var o=[],s=1;s<e.length-2;s+=1){var u=e[s-1].x,f=e[s-1].y,l=e[s].x,c=e[s].y,h=e[s+1].x,d=e[s+1].y,v=s!==e.length-2?e[s+2].x:h,p=s!==e.length-2?e[s+2].y:d,g=l+(h-u)/6,y=c+(d-f)/6,m=h-(v-l)/6,b=d-(p-c)/6;o.push(["C",g,y,m,b,h,d])}return o.unshift(["M",i.x,i.y]),o},B_=function(e,t){return Sn([0,0],to([0,0],e),t)},F_=function(e,t){var n=[e[1]-t[1],t[0]-e[0]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]);if(i===0)throw new Error("p0 should not be equal to p1");return[n[0]/i,n[1]/i]},G_=function(e,t){return[t[0]-e[0],t[1]-e[1]]};function Kg(r,e){var t=function(c){var h=[c[0][0],c[0][1]-e],d=[c[0][0],c[0][1]+e];return"M ".concat(h," A ").concat(e,",").concat(e,",0,0,0,").concat(d," A ").concat(e,",").concat(e,",0,0,0,").concat(h)},n=function(c){var h=Sn([0,0],F_(c[0],c[1]),e),d=Sn([0,0],h,-1),v=ln([0,0],c[0],h),p=ln([0,0],c[1],h),g=ln([0,0],c[1],d),y=ln([0,0],c[0],d);return"M ".concat(v," L ").concat(p," A ").concat([e,e,"0,0,0",g].join(",")," L ").concat(y," A ").concat([e,e,"0,0,0",v].join(","))};if(!r||r.length<1)return"";if(r.length===1)return t(r);if(r.length===2)return n(r);for(var i=new Array(r.length),a=0;a<i.length;++a){var o=a===0?r[r.length-1]:r[a-1],s=r[a],u=Sn([0,0],F_(o,s),e);i[a]=[ln([0,0],o,u),ln([0,0],s,u)]}var f="A ".concat([e,e,"0,0,0,"].join(","));return i=i.map(function(l,c){var h="";return c===0&&(h="M ".concat(i[i.length-1][1]," ")),h+="".concat(f+l[0]," L ").concat(l[1]),h}),i.join(" ")}function z_(r,e){var t=r.length,n=function(l){var c=[l[0][0],l[0][1]-e],h=[l[0][0],l[0][1]+e];return"M ".concat(c," A ").concat([e,e,"0,0,0",h].join(",")," A ").concat([e,e,"0,0,0",c].join(","))},i=function(l){var c=G_(l[0],l[1]),h=B_(c,e),d=ln([0,0],l[0],Sn([0,0],h,-1)),v=ln([0,0],l[1],h),p=1.2*e,g=B_(to([0,0],c),p),y=Sn([0,0],g,-1),m=ln([0,0],d,y),b=ln([0,0],v,y),x=ln([0,0],d,g);return"M ".concat(d," C ").concat([m,b,v].join(",")," S ").concat([x,d].join(",")," Z")};if(!r||t<1)return"";if(t===1)return n(r);if(t===2)return i(r);for(var a=r.map(function(f,l){var c=r[(l+1)%t];return{p:f,v:to([0,0],G_(f,c))}}),o=0;o<a.length;++o){var s=o>0?o-1:t-1,u=to([0,0],ln([0,0],a[s].v,Sn([0,0],a[o].v,-1)));a[o].p=ln([0,0],a[o].p,Sn([0,0],u,e))}return a.map(function(f){var l=f.p;return{x:l[0],y:l[1]}})}var Yz=function(e,t){for(var n=[],i=0;i<5;i++){var a=Math.cos((18+72*i)/180*Math.PI)*e,o=Math.sin((18+72*i)/180*Math.PI)*e,s=Math.cos((54+72*i)/180*Math.PI)*t,u=Math.sin((54+72*i)/180*Math.PI)*t;i===0?n.push(["M",a,-o]):n.push(["L",a,-o]),n.push(["L",s,-u])}return n.push(["Z"]),n};const Wz=Object.freeze(Object.defineProperty({__proto__:null,getClosedSpline:Zg,getControlPoint:xh,getSpline:R_,getStarPath:Yz,paddedHull:z_,pathToPoints:qg,pointsToPolygon:Xz,roundedHull:Kg},Symbol.toStringTag,{value:"Module"}));var $_=function(e,t,n){return(e.y-n.y)*(t.x-n.x)-(e.x-n.x)*(t.y-n.y)},j_=function(e){var t=e.map(function(c){return{x:c.getModel().x,y:c.getModel().y}});t.sort(function(c,h){return c.x===h.x?c.y-h.y:c.x-h.x});for(var n={},i=t.length-1;i>=0;i--){var a=t[i],o=a.x,s=a.y;n["".concat(o,"-").concat(s)]&&t.splice(i,1),n["".concat(o,"-").concat(s)]=!0}if(t.length===1)return t;for(var u=[],i=0;i<t.length;i++){for(;u.length>=2&&$_(u[u.length-2],u[u.length-1],t[i])<=0;)u.pop();u.push(t[i])}for(var f=[],i=t.length-1;i>=0;i--){for(;f.length>=2&&$_(f[f.length-2],f[f.length-1],t[i])<=0;)f.pop();f.push(t[i])}f.pop(),u.pop();var l=u.concat(f);return l},Vz={maxRoutingIterations:100,maxMarchingIterations:100,pixelGroupSize:2,edgeR0:10,edgeR1:10,nodeR0:5,nodeR1:10,morphBuffer:5,threshold:.001,skip:16,nodeInfluenceFactor:1,edgeInfluenceFactor:1,negativeNodeInfluenceFactor:-.5};function Hz(r,e,t){var n=!1,i=function(u,f){return e.cells[u+f*e.width]},a=function(u,f){var l=0;return i(u-1,f-1)>=t&&(l+=1),i(u,f-1)>t&&(l+=2),i(u-1,f)>t&&(l+=4),i(u,f)>t&&(l+=8),l},o=function(u,f){for(var l=u,c=f,h,d,v=0;v<e.width*e.height;v++){if(h=l,d=c,r.findIndex(function(g){return g.x===l&&g.y===c})>-1){if(!(r[0].x!==l||r[0].y!==c))return!0}else r.push({x:l,y:c});var p=a(l,c);switch(p){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:l++;break;case 12:case 14:case 4:l--;break;case 6:h===0&&(d===-1?l-=1:l+=1);break;case 1:case 13:case 5:c--;break;case 9:h===1&&(d===0?c-=1:c+=1);break;case 10:case 8:case 11:c++;break;default:return console.warn("Marching squares invalid state: ".concat(p)),!0}}};this.march=function(){for(var s=0;s<e.width&&!n;s+=1)for(var u=0;u<e.height&&!n;u+=1)i(s,u)>t&&a(s,u)!==15&&(n=o(s,u));return n}}var qz=function(e,t,n){var i=Math.ceil(e/n),a=Math.ceil(t/n),o=new Float32Array(Math.max(0,i*a)).fill(0);return{cells:o,width:i,height:a}},Zz=function(e,t,n){var i=null,a=Number.POSITIVE_INFINITY;return t.forEach(function(o){var s={x:e.getModel().x,y:e.getModel().y},u={x:o.getModel().x,y:o.getModel().y},f=qc(s,u),l=new Uo(s.x,s.y,u.x,u.y),c=n.reduce(function(h,d){return eg(d,l)>0?h+1:h},0);f*Math.pow(c+1,2)<a&&(i=o,a=f*Math.pow(c+1,2))}),i},U_=function(e,t){var n=Number.POSITIVE_INFINITY,i=null;return e.forEach(function(a){var o=eg(a,t);o>=0&&o<n&&(i=a,n=o)}),i},Kz=function(e,t,n,i){var a=[],o=[];o.push(e);for(var s=!0,u=0,f=function(d,v){var p=!1;return v.forEach(function(g){p||(tg(d,{x:g.x1,y:g.y1})||tg(d,{x:g.x2,y:g.y2}))&&(p=!0)}),p},l=function(d,v){for(var p=0,g=v;p<g.length;p++){var y=g[p],m=y.getBBox(),b=[[m.x,m.y],[m.x+m.width,m.y],[m.x,m.y+m.height],[m.x+m.width,m.y+m.height]];if(df(b,d.x,d.y))return!0}return!1};s&&u<n;){s=!1;for(var c=function(){var d=o.pop(),v=U_(t,d);if(v){var p=yE(v,d),g=p[0],y=p[1];if(y===2){var m=function(x){for(var w=i,E=X_(v,w,g,x),_=f(E,o)||f(E,a),M=l(E,t);!_&&M&&w>=1;)w/=1.5,E=X_(v,w,g,x),_=f(E,o)||f(E,a),M=l(E,t);E&&!_&&(!x||!M)&&(o.push(new Uo(d.x1,d.y1,E.x,E.y)),o.push(new Uo(E.x,E.y,d.x2,d.y2)),s=!0)};m(!0),s||m(!1)}}s||a.push(d),u+=1};!s&&o.length;)c()}for(;o.length;)a.push(o.pop());return a};function Qz(r,e,t,n,i){var a=Zz(r,t,e);if(a===null)return[];var o=function(c){for(var h=[];c.length>0;){var d=c.pop();if(c.length===0){h.push(d);break}var v=c.pop(),p=new Uo(d.x1,d.y1,v.x2,v.y2),g=U_(e,p);g?(h.push(d),c.push(v)):c.push(p)}return h},s=new Uo(r.getModel().x,r.getModel().y,a.getModel().x,a.getModel().y),u=Kz(s,e,n,i),f=o(u);return f}var Jz=function(e,t,n){var i=Object.assign(Vz,n),a=mE(e.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));e=e.sort(function(m,b){return qc({x:m.getModel().x,y:m.getModel().y},a)-qc({x:b.getModel().x,y:b.getModel().y},a)});var o=[],s=[];e.forEach(function(m){var b=Qz(m,t,o,i.maxRoutingIterations,i.morphBuffer);b.forEach(function(x){s.push(x)}),o.push(m)});for(var u=e8(e,s,i.nodeR0),f=qz(u.width,u.height,i.pixelGroupSize),l=[],c=[],h=0;h<i.maxMarchingIterations;h++)if(t8(e,t,s,u,f,i),l=[],c=[],!!new Hz(l,f,i.threshold).march()){var d=l.map(function(m){return{x:Math.round(m.x*i.pixelGroupSize+u.minX),y:Math.round(m.y*i.pixelGroupSize+u.minY)}});if(d){var v=d.length;if(i.skip>1)for(v=Math.floor(d.length/i.skip);v<3&&i.skip>1;)i.skip-=1,v=Math.floor(d.length/i.skip);for(var p=0,g=0;g<v;g+=1,p+=i.skip)c.push({x:d[p].x,y:d[p].y})}var y=function(){for(var b=0,x=e;b<x.length;b++){var w=x[b],E=c.map(function(_){return[_.x,_.y]});if(!df(E,w.getBBox().centerX,w.getBBox().centerY))return!1}return!0};if(c&&y())return c;if(i.threshold*=.9,h<=i.maxMarchingIterations*.5)i.memberInfluenceFactor*=1.2,i.edgeInfluenceFactor*=1.2;else if(i.nonMemberInfluenceFactor!==0&&t.length>0)i.nonMemberInfluenceFactor*=.8;else break}return c};function e8(r,e,t){var n={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},i=[];r.forEach(function(u){i.push(u.getBBox())}),e.forEach(function(u){i.push(u.getBBox())});for(var a=0,o=i;a<o.length;a++){var s=o[a];n.minX=(s.minX<n.minX?s.minX:n.minX)-t,n.minY=(s.minY<n.minY?s.minY:n.minY)-t,n.maxX=(s.maxX>n.maxX?s.maxX:n.maxX)+t,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+t}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}function t8(r,e,t,n,i,a){function o(d,v){var p=Math.floor((d-v)/a.pixelGroupSize);return p<0?0:p}function s(d,v){return d*a.pixelGroupSize+v}var u=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),f=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1),l=function(v,p){var g=Math.min(o(v.minX,p+n.minX),i.width),y=Math.min(o(v.minY,p+n.minY),i.height),m=Math.min(o(v.maxX,-p+n.minX),i.width),b=Math.min(o(v.maxY,-p+n.minY),i.height);return[g,y,m,b]},c=function(v,p){for(var g=v.getBBox(),y=l(g,a.nodeR1),m=y[0],b=y[1],x=y[2],w=y[3],E=b;E<w;E+=1)for(var _=m;_<x;_+=1)if(!(p<0&&i[_+E*i.width]<=0)){var M=s(_,n.minX),C=s(E,n.minY),S=xE({x:M,y:C},{x:g.minX,y:g.minY,width:g.width,height:g.height});if(S<Math.pow(a.nodeR1,2)){var A=Math.sqrt(S)-a.nodeR1;i.cells[_+E*i.width]+=p*A*A}}},h=function(v,p){for(var g=v.getBBox(),y=l(g,a.edgeR1),m=y[0],b=y[1],x=y[2],w=y[3],E=b;E<w;E+=1)for(var _=m;_<x;_+=1)if(!(p<0&&i.cells[_+E*i.width]<=0)){var M=s(_,n.minX),C=s(E,n.minY),S=bE({x:M,y:C},v);if(S<Math.pow(a.edgeR1,2)){var A=Math.sqrt(S)-a.edgeR1;i.cells[_+E*i.width]+=p*A*A}}};a.nodeInfluenceFactor&&r.forEach(function(d){c(d,a.nodeInfluenceFactor/u)}),a.edgeInfluenceFactor&&t.forEach(function(d){h(d,a.edgeInfluenceFactor/f)}),a.negativeNodeInfluenceFactor&&e.forEach(function(d){c(d,a.negativeNodeInfluenceFactor/u)})}function X_(r,e,t,n){var i=r.getBBox(),a=t[0],o=t[1],s=t[2],u=t[3],f={topLeft:{x:i.minX-e,y:i.minY-e},topRight:{x:i.maxX+e,y:i.minY-e},bottomLeft:{x:i.minX-e,y:i.maxY+e},bottomRight:{x:i.maxX+e,y:i.maxY+e}},l=i.height*i.width;function c(v,p){return i.width*((v.y-i.minY+(p.y-i.minY))*.5)}if(o){if(a)return n?f.topLeft:f.bottomRight;if(s)return n?f.bottomLeft:f.topRight;var h=c(o,u);return h<l*.5?o.y>u.y?n?f.topLeft:f.bottomRight:n?f.topRight:f.bottomLeft:o.y<u.y?n?f.bottomLeft:f.topRight:n?f.bottomRight:f.topLeft}if(u){if(a)return n?f.topRight:f.bottomLeft;if(s)return n?f.bottomRight:f.topLeft}var d=c(a,s);return d<l*.5?a.x>s.x?n?f.topLeft:f.bottomRight:n?f.bottomLeft:f.topRight:a.x<s.x?n?f.topRight:f.bottomLeft:n?f.bottomRight:f.topLeft}var Y_=function(){function r(e,t){this.cfg=gr(this.getDefaultCfg(),t),this.graph=e,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map(function(n){return Pe(n)?e.findById(n):n}),this.nonMembers=this.cfg.nonMembers.map(function(n){return Pe(n)?e.findById(n):n}),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()}return r.prototype.getDefaultCfg=function(){return{id:"g6-hull",type:"round-convex",members:[],nonMembers:[],style:{fill:"lightblue",stroke:"blue",opacity:.2},padding:10}},r.prototype.setPadding=function(){var e=this.members.length&&this.members[0].getKeyShape().getCanvasBBox().width/2;this.padding=this.cfg.padding>0?this.cfg.padding+e:10+e,this.cfg.bubbleCfg={nodeR0:this.padding-e,nodeR1:this.padding-e,morphBuffer:this.padding-e}},r.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),this.type!=="round-convex"&&this.type!=="smooth-convex"&&this.type!=="bubble"&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},r.prototype.calcPath=function(e,t){var n,i,a;switch(this.type){case"round-convex":n=j_(e),a=Kg(n.map(function(o){return[o.x,o.y]}),this.padding),i=Bg(a);break;case"smooth-convex":n=j_(e),n.length===2?(a=Kg(n.map(function(o){return[o.x,o.y]}),this.padding),i=Bg(a)):n.length>2&&(a=z_(n.map(function(o){return[o.x,o.y]}),this.padding),i=Zg(a));break;case"bubble":n=Jz(e,t,this.cfg.bubbleCfg),i=n.length>=2&&Zg(n);break}return i},r.prototype.render=function(){this.group.addShape("path",{attrs:B({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},r.prototype.addMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e)),this.members.push(e);var t=this.nonMembers.indexOf(e);return t>-1&&this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.addNonMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e)),this.nonMembers.push(e);var t=this.members.indexOf(e);return t>-1&&this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.removeMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e));var t=this.members.indexOf(e);return t>-1?(this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.removeNonMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e));var t=this.nonMembers.indexOf(e);return t>-1?(this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.updateData=function(e,t){var n=this;this.group.findById(this.id).remove(),e&&(this.members=e.map(function(i){return Pe(i)?n.graph.findById(i):i})),t&&(this.nonMembers=t.map(function(i){return Pe(i)?n.graph.findById(i):i})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.updateStyle=function(e){var t=this.group.findById(this.id);t.attr(B({},e))},r.prototype.updateCfg=function(e){var t=this;this.cfg=gr(this.cfg,e),this.id=this.cfg.id,this.group=this.cfg.group,e.members&&(this.members=this.cfg.members.map(function(n){return Pe(n)?t.graph.findById(n):n})),e.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return Pe(n)?t.graph.findById(n):n})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.contain=function(e){var t=this,n;Pe(e)?n=this.graph.findById(e):n=e;var i,a=n.getKeyShape();if(n.get("type")==="path")i=qg(a.attr("path"));else{var o=a.getCanvasBBox();i=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return i=i.map(function(s){var u=t.graph.getPointByCanvas(s[0],s[1]);return[u.x,u.y]}),gE(i,qg(this.path))},r.prototype.destroy=function(){this.group.remove(),this.cfg=null},r}(),If=ni,r8="node",W_=function(r){It(e,r);function e(t){var n=r.call(this)||this;return n.sortCombos=sf(function(){var i=n.get("comboSorted");if(!(!n||n.destroyed||i)){n.set("comboSorted",!0);var a=[],o={},s=n.get("comboTrees");(s||[]).forEach(function(f){Mn(f,function(l){return a[l.depth]?a[l.depth].push(l.id):a[l.depth]=[l.id],o[l.id]=l.depth,!0})});var u=n.getEdges().concat(n.get("vedges"));(u||[]).forEach(function(f){var l=f.getModel(),c=o[l.source]||0,h=o[l.target]||0,d=Math.max(c,h);a[d]?a[d].push(l.id):a[d]=[l.id]}),a.forEach(function(f){if(!(!f||!f.length))for(var l=f.length-1;l>=0;l--){var c=n.findById(f[l]);c&&c.toFront()}})}},500,!1),n.cfg=gr(n.getDefaultCfg(),t),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new Us(n.cfg.maxStep),n.redoStack=new Us(n.cfg.maxStep)),n}return e.prototype.init=function(){this.initCanvas();var t=new Oz(this),n=new q4(this),i=new $z(this),a=new jz(this);this.set({viewController:t,modeController:n,itemController:i,stateController:a}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas");if(t){var n=t.get("el"),i=(n||{}).id,a=i===void 0?"g6":i,o=t.addGroup({id:"".concat(a,"-root"),className:ft.rootContainerClassName});if(this.get("groupByTypes")){var s=o.addGroup({id:"".concat(a,"-edge"),className:ft.edgeContainerClassName}),u=o.addGroup({id:"".concat(a,"-node"),className:ft.nodeContainerClassName}),f=o.addGroup({id:"".concat(a,"-combo"),className:ft.comboContainerClassName});f.toBack(),this.set({nodeGroup:u,edgeGroup:s,comboGroup:f})}var l=o.addGroup({id:"".concat(a,"-delegate"),className:ft.delegateContainerClassName});this.set({delegateGroup:l}),this.set("group",o)}},e.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.02,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[],optimizeThreshold:1e3}},e.prototype.set=function(t,n){return fn(t)?this.cfg=B(B({},this.cfg),t):this.cfg[t]=n,t==="enabledStack"&&n&&!this.undoStack&&!this.redoStack&&(this.undoStack=new Us(this.cfg.maxStep),this.redoStack=new Us(this.cfg.maxStep)),this},e.prototype.get=function(t){var n;return(n=this.cfg)===null||n===void 0?void 0:n[t]},e.prototype.getGroup=function(){return this.get("group")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.getMinZoom=function(){return this.get("minZoom")},e.prototype.setMinZoom=function(t){return this.set("minZoom",t)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(t){return this.set("maxZoom",t)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(t,n){Pe(t)&&(t=this.findById(t));var i=this.get("itemController");n||(n=t.get("states")),i.clearItemStates(t,n);var a=this.get("stateController");a.updateStates(t,n,!1)},e.prototype.node=function(t){typeof t=="function"&&this.set("nodeMapper",t)},e.prototype.edge=function(t){typeof t=="function"&&this.set("edgeMapper",t)},e.prototype.combo=function(t){typeof t=="function"&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,n){var i,a=this.get("".concat(t,"s"));return ye(a,function(o,s){if(n(o,s))return i=o,i}),i},e.prototype.findAll=function(t,n){var i=[];return ye(this.get("".concat(t,"s")),function(a,o){n(a,o)&&i.push(a)}),i},e.prototype.findAllByState=function(t,n,i){return i?this.findAll(t,function(a){return a.hasState(n)&&i(a)}):this.findAll(t,function(a){return a.hasState(n)})},e.prototype.translate=function(t,n,i,a){var o=this,s=this.get("group"),u=Vt(s.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),i){var f=vf({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:s.getMatrix()})}});Qp(s,{x:s.getCanvasBBox().x+t,y:s.getCanvasBBox().y+n},i,f||{duration:500,easing:"easeCubic"})}else u=If(u,[["t",t,n]]),s.setMatrix(u),this.emit("viewportchange",{action:"translate",matrix:u}),this.autoPaint()},e.prototype.moveTo=function(t,n,i,a){var o=this.get("group");Qp(o,{x:t,y:n},i,a||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},e.prototype.fitView=function(t,n,i,a){t&&this.set("fitViewPadding",t);var o=this.get("viewController");n?o.fitViewByRules(n,i,a):o.fitView(i,a),this.autoPaint()},e.prototype.fitCenter=function(t,n){var i=this.get("viewController");i.fitCenter(t,n),this.autoPaint()},e.prototype.addBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!0),this},e.prototype.removeBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!1),this},e.prototype.updateBehavior=function(t,n,i){var a=this.get("modeController");return a.updateBehavior(t,n,i),this},e.prototype.zoom=function(t,n,i,a){var o=this,s=this.get("group"),u=Vt(s.getMatrix())||[1,0,0,0,1,0,0,0,1],f=this.get("minZoom"),l=this.get("maxZoom"),c=this.getZoom()||1,h=c*t,d=t,v=!1;if(f&&h<f?(d=f/c,v=!0):l&&h>l&&(d=l/c,v=!0),n?u=If(u,[["t",-n.x,-n.y],["s",d,d],["t",n.x,n.y]]):u=If(u,[["s",d,d]]),i){var p=Vt(s.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var g=p[0],y=g*d,m=vf({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:s.getMatrix()})}});s.animate(function(b){if(b===1)p=u;else{var x=rg(g,y,b)/p[0];n?p=If(p,[["t",-n.x,-n.y],["s",x,x],["t",n.x,n.y]]):p=If(p,[["s",x,x]])}return{matrix:p}},m)}else s.setMatrix(u),this.emit("viewportchange",{action:"zoom",matrix:u}),this.autoPaint();return!v},e.prototype.zoomTo=function(t,n,i,a){var o=t/this.getZoom();return this.zoom(o,n,i,a)},e.prototype.focusItem=function(t,n,i){var a=this.get("viewController"),o=!1;n?o=!0:n===void 0&&(o=this.get("animate"));var s={};i?s=i:i===void 0&&(s=this.get("animateCfg")),a.focus(t,o,s),this.autoPaint()},e.prototype.focusItems=function(t,n,i,a){var o=this.get("viewController");o.focusItems(t,n,i,a)},e.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},e.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},e.prototype.getPointByClient=function(t,n){var i=this.get("viewController");return i.getPointByClient(t,n)},e.prototype.getClientByPoint=function(t,n){var i=this.get("viewController");return i.getClientByPoint(t,n)},e.prototype.getPointByCanvas=function(t,n){var i=this.get("viewController");return i.getPointByCanvas(t,n)},e.prototype.getCanvasByPoint=function(t,n){var i=this.get("viewController");return i.getCanvasByPoint(t,n)},e.prototype.getGraphCenterPoint=function(){var t=this.get("group").getCanvasBBox();return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(t,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!0);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.getType(),u={},f={};switch(s){case"node":u.nodes=[{id:o,visible:!1}],f.nodes=[{id:o,visible:!0}];break;case"edge":u.nodes=[{id:o,visible:!1}],f.edges=[{id:o,visible:!0}];break;case"combo":u.nodes=[{id:o,visible:!1}],f.combos=[{id:o,visible:!0}];break}this.pushStack("visible",{before:u,after:f})}},e.prototype.hideItem=function(t,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!1);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.getType(),u={},f={};switch(s){case"node":u.nodes=[{id:o,visible:!0}],f.nodes=[{id:o,visible:!1}];break;case"edge":u.nodes=[{id:o,visible:!0}],f.edges=[{id:o,visible:!1}];break;case"combo":u.nodes=[{id:o,visible:!0}],f.combos=[{id:o,visible:!1}];break}this.pushStack("visible",{before:u,after:f})}},e.prototype.refreshItem=function(t){var n=this.get("itemController");n.refreshItem(t)},e.prototype.setAutoPaint=function(t){var n=this;n.set("autoPaint",t);var i=n.get("canvas");i.set("autoDraw",t)},e.prototype.remove=function(t,n){n===void 0&&(n=!0),this.removeItem(t,n)},e.prototype.removeItem=function(t,n){n===void 0&&(n=!0);var i=t;if(Pe(t)&&(i=this.findById(t)),!i&&Pe(t))console.warn("The item ".concat(t," to be removed does not exist!"));else if(i){var a="";if(i.getType&&(a=i.getType()),n&&this.get("enabledStack")){var o=B(B({},i.getModel()),{itemType:a}),s={};switch(a){case"node":{s.nodes=[o],s.edges=[];for(var u=i.getEdges(),f=u.length-1;f>=0;f--)s.edges.push(B(B({},u[f].getModel()),{itemType:"edge"}));break}case"edge":s.edges=[o];break;case"combo":s.combos=[o];break}this.pushStack("delete",{before:s,after:{}})}if(a==="node"){var l=i.getModel();l.comboId&&this.updateComboTree(i,void 0,!1)}var c=this.get("itemController");if(c.removeItem(i),a==="combo"){var h=ug(this.get("comboTrees"));this.set("comboTrees",h)}}},e.prototype.innerAddItem=function(t,n,i){if(!H4(t,n))return!1;if(n.id&&this.findById(n.id)){console.warn("This item exists already. Be sure the id %c".concat(n.id,"%c is unique."),"font-size: 20px; color: red;","");return}var a,o=this.get("comboTrees")||[];if(t==="combo"){var s=this.get("itemMap"),u=!1;if(o.forEach(function(v){u||qi(v,function(p){if(n.parentId===p.id){u=!0;var g=B({id:n.id,depth:p.depth+2},n);p.children?p.children.push(g):p.children=[g],n.depth=g.depth,a=i.addItem(t,n)}var y=s[p.id];return u&&y&&y.getType&&y.getType()==="combo"&&i.updateCombo(y,p.children),!0})}),!u){var f=B({id:n.id,depth:0},n);n.depth=f.depth,o.push(f),a=i.addItem(t,n)}this.set("comboTrees",o),n.collapsed&&(this.collapseCombo(a,!1),this.updateCombo(a))}else if(t==="node"&&Pe(n.comboId)&&o){var l=this.findById(n.comboId);l&&l.getType&&l.getType()!=="combo"&&console.warn("'".concat(n.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),a=i.addItem(t,n);var c=this.get("itemMap"),h=!1,d=!1;o.forEach(function(v){d||h||qi(v,function(p){if(p.id===n.id)return d=!0,!1;if(n.comboId===p.id&&!d){h=!0;var g=Vt(n);g.itemType="node",p.children?p.children.push(g):p.children=[g],g.depth=p.depth+1}return h&&c[p.id].getType&&c[p.id].getType()==="combo"&&i.updateCombo(c[p.id],p.children),!0})})}else a=i.addItem(t,n);if(t==="node"&&n.comboId||t==="combo"&&n.parentId){var l=this.findById(n.comboId||n.parentId);l&&l.getType&&l.getType()==="combo"&&l.addChild(a)}return a},e.prototype.addItem=function(t,n,i,a){i===void 0&&(i=!0),a===void 0&&(a=!0);var o=this.get("comboSorted");this.set("comboSorted",o&&!a);var s=this.get("itemController"),u=this.innerAddItem(t,n,s);if(u===!1||u===!0)return u;var f=this.get("combos");if(f&&f.length>0&&this.sortCombos(),this.autoPaint(),i&&this.get("enabledStack")){var l=B(B({},u.getModel()),{itemType:t}),c={};switch(t){case"node":c.nodes=[l];break;case"edge":c.edges=[l];break;case"combo":c.combos=[l];break}this.pushStack("add",{before:{},after:c})}return u},e.prototype.addItems=function(t,n,i){t===void 0&&(t=[]),n===void 0&&(n=!0),i===void 0&&(i=!0);var a=this.get("comboSorted");this.set("comboSorted",a&&!i);for(var o=this.get("itemController"),s=[],u=0;u<t.length;u++){var f=t[u];f.type!=="edge"&&f.type!=="vedge"?s.push(this.innerAddItem(f.type,f.model,o)):s.push(void 0)}for(var u=0;u<t.length;u++){var f=t[u];(f.type==="edge"||f.type==="vedge")&&(s[u]=this.innerAddItem(f.type,f.model,o))}if(i){var l=this.get("combos");l&&l.length>0&&this.sortCombos()}if(this.autoPaint(),n&&this.get("enabledStack")){for(var c={nodes:[],edges:[],combos:[]},u=0;u<t.length;u++){var h=t[u].type,d=s[u];if(d&&d!==!0){var v=B(B({},d.getModel()),{itemType:h});switch(h){case"node":c.nodes.push(v);break;case"edge":c.edges.push(v);break;case"combo":c.combos.push(v);break}}}this.pushStack("addItems",{before:{},after:c})}return s},e.prototype.add=function(t,n,i,a){return i===void 0&&(i=!0),a===void 0&&(a=!0),this.addItem(t,n,i,a)},e.prototype.updateItem=function(t,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController"),s;Pe(t)?s=this.findById(t):s=t;var u=i&&this.get("enabledStack"),f;u&&(f=Vt(s.getModel()));var l="";s.getType&&(l=s.getType());var c=Yn([],s.getStates(),!0);if(l==="combo"&&ye(c,function(p){return a.setItemState(s,p,!1)}),o.updateItem(s,n),l==="combo"&&ye(c,function(p){return a.setItemState(s,p,!0)}),u){var h={nodes:[],edges:[],combos:[]},d={nodes:[],edges:[],combos:[]},v=B({id:f.id},n);switch(l){case"node":h.nodes.push(f),d.nodes.push(v);break;case"edge":h.edges.push(f),d.edges.push(v);break;case"combo":h.combos.push(f),d.combos.push(v);break}this.pushStack("update",{before:h,after:d})}},e.prototype.update=function(t,n,i){i===void 0&&(i=!0),this.updateItem(t,n,i)},e.prototype.setItemState=function(t,n,i){Pe(t)&&(t=this.findById(t));var a=this.get("itemController");a.setItemState(t,n,i);var o=this.get("stateController");o.updateState(t,n,i)},e.prototype.priorityState=function(t,n){var i=this.get("itemController");i.priorityState(t,n)},e.prototype.data=function(t){LE(t),this.set("data",t)},e.prototype.render=function(){var t=this;this.set("comboSorted",!1);var n=this.get("data");if(this.get("enabledStack")&&this.clearStack(),!n)throw new Error("data must be defined first");var i=n.nodes,a=i===void 0?[]:i,o=n.edges,s=o===void 0?[]:o,u=n.combos,f=u===void 0?[]:u;if(this.clear(!0),this.emit("beforerender"),t.addItems(a.map(function(g){return{type:"node",model:g}}),!1,!1),(f==null?void 0:f.length)!==0){var l=sg(f,a);this.set("comboTrees",l),t.addCombos(f)}t.addItems(s.map(function(g){return{type:"edge",model:g}}),!1,!1);var c=t.get("animate");(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",!1);var h=t.get("layoutController");if(h){if(h.layout(d),this.destroyed)return}else d();function d(){(t.get("comboTrees")||[]).forEach(function(g){qi(g,function(y){var m=t.findById(y.id);return m.getType()==="combo"&&y.collapsed&&(t.collapseCombo(y.id,!1),t.updateCombo(m)),!0})}),t.get("fitView")?t.fitView():t.get("fitCenter")&&t.fitCenter(),t.autoPaint(),t.emit("afterrender"),(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",c),setTimeout(function(){var g;(g=t.getCombos())===null||g===void 0||g.forEach(function(y){y.set("animate",!0)})},0)}if(!this.get("groupByTypes"))if(f&&f.length!==0)this.sortCombos();else if(n.nodes&&n.edges&&n.nodes.length<n.edges.length){var v=this.getNodes();v.forEach(function(g){g.toFront()})}else{var p=this.getEdges();p.forEach(function(g){g.toBack()})}},e.prototype.read=function(t){this.data(t),this.render()},e.prototype.diffItems=function(t,n,i){var a=this,o,s=this.get("itemMap");ye(i,function(u){if(o=s[u.id],o){if(a.get("animate")&&t===r8){var f=o.getContainer().getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]),o.set("originAttrs",{x:f[6],y:f[7]})}a.updateItem(o,u,!1)}else o=a.addItem(t,u,!1);o&&n["".concat(t,"s")].push(o)})},e.prototype.changeData=function(t,n){var i=this,a;n===void 0&&(n=!0);var o=this,s=t||o.get("data");if(!LE(s))return this;this.emit("beforechangedata"),n&&this.get("enabledStack")&&this.pushStack("changedata",{before:o.save(),after:s}),this.set("comboSorted",!1),this.removeHulls(),this.getNodes().map(function(m){return o.clearItemStates(m)}),this.getEdges().map(function(m){return o.clearItemStates(m)});var u=this.get("canvas"),f=u.get("localRefresh");u.set("localRefresh",!1),o.get("data")||(o.data(s),o.render());var l=this.get("itemMap"),c={nodes:[],edges:[]},h=s.combos;if(h){var d=sg(h,s.nodes);this.set("comboTrees",d)}else this.set("comboTrees",[]);this.diffItems("node",c,s.nodes),ye(l,function(m,b){l[b].getModel().depth=0,!(m.getType&&m.getType()==="edge")&&(m.getType&&m.getType()==="combo"?(delete l[b],m.destroy()):c.nodes.indexOf(m)<0&&(delete l[b],o.remove(m,!1)))});for(var v=this.getCombos(),p=v.length,g=p-1;g>=0;g--)v[g].destroyed&&v.splice(g,1);h&&(o.addCombos(h),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",c,s.edges),ye(l,function(m,b){m.getType&&(m.getType()==="node"||m.getType()==="combo")||c.edges.indexOf(m)<0&&(delete l[b],o.remove(m,!1))}),(this.get("comboTrees")||[]).forEach(function(m){qi(m,function(b){var x=i.findById(b.id);return x.getType()==="combo"&&b.collapsed&&i.collapseCombo(b.id,!1),!0})}),this.set({nodes:c.nodes,edges:c.edges});var y=this.get("layoutController");return y&&(y.changeData(function(){setTimeout(function(){var m;(m=o.getCombos())===null||m===void 0||m.forEach(function(b){b.set("animate",!0)})},0)}),o.get("animate")&&!y.getLayoutType()?(o.positionsAnimate(),(a=o.getCombos())===null||a===void 0||a.forEach(function(m){return m.set("animate",!0)})):o.autoPaint()),setTimeout(function(){u.set("localRefresh",f)},16),this.set("data",s),this.emit("afterchangedata"),this},e.prototype.addCombos=function(t){var n=this,i=n.get("comboTrees"),a=this.get("itemController");a.addCombos(i,t)},e.prototype.createCombo=function(t,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController");this.set("comboSorted",!1);var s="",u;if(t){if(Pe(t))s=t,u={id:t};else{if(s=t.id,!s){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}u=t}var f=i&&this.get("enabledStack"),l={nodes:[],combos:[]};f&&n.forEach(function(y){var m=a.findById(y),b=m.getType();if(!(b!=="node"&&b!=="combo")){var x=m.getModel();l["".concat(b,"s")].push({id:y,parentId:b==="node"?x.comboId:x.parentId})}});var c=this.get("comboTrees"),h=new Set(n),d=new Map;c&&(c.forEach(function(y){qi(y,function(m,b,x){if(h.has(m.id)){if(b){var w=a.findById(b.id),E=a.findById(m.id);b.children.splice(x,1),w.removeChild(E),o.updateCombo(w,b.children)}m.itemType==="combo"&&d.set(m.id,m)}return!0})}),c=c.filter(function(y){return!h.has(y.id)}),this.set("comboTrees",c));var v={nodes:[],combos:[]},p=n.map(function(y){var m=a.findById(y),b=m.getModel(),x="";m.getType&&(x=m.getType());var w=d.get(y)||{id:m.getID(),itemType:x};return x==="combo"?(w.parentId=s,b.parentId=s):x==="node"&&(w.comboId=s,b.comboId=s),f&&v["".concat(x,"s")].push({id:b.id,parentId:s}),w});u.children=p,this.addItem("combo",u,!1),this.set("comboSorted",!1),c&&(c.forEach(function(y){Mn(y,function(m){return m.id===s?(m.itemType="combo",m.children=p,!1):!0})}),this.sortCombos()),f&&(v.combos.push(u),this.pushStack("createCombo",{before:l,after:v}));var g=this.findById(s);!g.getModel().parentId&&g.getChildren().combos.length&&this.updateComboTree(g,void 0,!1),setTimeout(function(){g.set("animate",!0)},0)}},e.prototype.uncombo=function(t,n){var i=this,a,o;n===void 0&&(n=!0);var s=this,u=t;if(Pe(t)&&(u=this.findById(t)),!u||u.getType&&u.getType()!=="combo"){console.warn("The item is not a combo!");return}var f=u.getModel(),l=u.getModel().parentId,c=s.get("comboTrees");c||(c=[]);var h=this.get("itemMap"),d=u.get("id"),v,p=[],g=this.get("combos"),y=this.findById(l),m=n&&this.get("enabledStack"),b={};if(m&&(b=Vt(f),b.children=[]),c.forEach(function(_){v||qi(_,function(M){var C;if(M.id===d){v=M;var S=u.getEdges().map(function(k){return k.getID()});S.forEach(function(k){i.removeItem(k,!1)});var A=g.indexOf(u);g.splice(A,1),delete h[d];var T=Vt(u.getModel());u.destroy(),i.emit("afterremoveitem",{item:T,type:"combo"})}if(l&&v&&M.id===l){y.removeCombo(u),p=M.children;var A=p.indexOf(v);return A!==-1&&p.splice(A,1),(C=v.children)===null||C===void 0||C.forEach(function(O){var G=i.findById(O.id),D=G.getModel();G.getType&&G.getType()==="combo"?(O.parentId=l,delete O.comboId,D.parentId=l,delete D.comboId):G.getType&&G.getType()==="node"&&(O.comboId=l,D.comboId=l),y.addChild(G),p.push(O)}),i.updateCombo(y),!1}return!0})}),!l&&v){var x=c.indexOf(v);c.splice(x,1),(a=v.children)===null||a===void 0||a.forEach(function(_){_.parentId=void 0;var M=i.findById(_.id).getModel();delete M.parentId,delete M.comboId,_.itemType!=="node"&&c.push(_)})}if(m){var w={nodes:[],combos:[]},E={nodes:[],combos:[]};(o=v.children)===null||o===void 0||o.forEach(function(_){var M=i.findById(_.id),C=M.getType();C!=="node"&&C!=="combo"||(w["".concat(C,"s")].push({id:_.id,parentId:d}),E["".concat(C,"s")].push({id:_.id,parentId:l}))}),w.combos.push(b),this.pushStack("uncombo",{before:w,after:E})}},e.prototype.updateCombos=function(t){var n=this;t===void 0&&(t=!1);var i=this,a=this.get("comboTrees"),o=i.get("itemController"),s=i.get("itemMap");(a||[]).forEach(function(u){qi(u,function(f){var l;if(!f)return!0;var c=s[f.id];if(((l=c==null?void 0:c.getType)===null||l===void 0?void 0:l.call(c))==="combo"){var h=Yn([],c.getStates(),!0);ye(h,function(d){return n.setItemState(c,d,!1)}),o.updateCombo(c,f.children,t),ye(h,function(d){return n.setItemState(c,d,!0)})}return!0})}),i.sortCombos()},e.prototype.updateCombo=function(t){var n=this,i=this,a=t,o;if(Pe(t)&&(a=this.findById(t)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}o=a.get("id");var s=this.get("comboTrees"),u=i.get("itemController"),f=i.get("itemMap");(s||[]).forEach(function(l){qi(l,function(c){if(!c)return!0;var h=f[c.id];if(o===c.id&&h&&h.getType&&h.getType()==="combo"){var d=Yn([],h.getStates(),!0);ye(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!1)}),u.updateCombo(h,c.children),ye(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!0)}),o&&(o=c.parentId)}return!0})})},e.prototype.updateComboTree=function(t,n,i){i===void 0&&(i=!0);var a=this;this.set("comboSorted",!1);var o;Pe(t)?o=a.findById(t):o=t;var s=o.getModel(),u=s.comboId||s.parentId,f="";if(o.getType&&(f=o.getType()),n&&f==="combo"){var l=this.get("comboTrees"),c=!0,h;if((l||[]).forEach(function(m){h||Mn(m,function(b){if(!h)return b.id===o.getID()&&(h=b),!0})}),Mn(h,function(m){return m.id===n?(c=!1,!1):!0}),!c){console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");return}}if(i&&this.get("enabledStack")){var d={},v={};f==="combo"?(d.combos=[{id:s.id,parentId:s.parentId}],v.combos=[{id:s.id,parentId:n}]):f==="node"&&(d.nodes=[{id:s.id,parentId:s.comboId}],v.nodes=[{id:s.id,parentId:n}]),this.pushStack("updateComboTree",{before:d,after:v})}if(s.parentId||s.comboId){var p=this.findById(s.parentId||s.comboId);p&&p.removeChild(o)}if(f==="combo"?s.parentId=n:f==="node"&&(s.comboId=n),n){var g=this.findById(n);g&&g.addChild(o)}if(u){var g=this.findById(u);g&&g.removeChild(o)}var y=ug(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},e.prototype.save=function(){var t=[],n=[],i=[];return ye(this.get("nodes"),function(a){t.push(a.getModel())}),ye(this.get("edges"),function(a){n.push(a.getModel())}),ye(this.get("combos"),function(a){i.push(a.getModel())}),{nodes:t,edges:n,combos:i}},e.prototype.changeSize=function(t,n){var i=this.get("viewController");return i.changeSize(t,n),this},e.prototype.refresh=function(){var t=this;if(t.emit("beforegraphrefresh"),t.get("animate"))t.positionsAnimate();else{var n=t.get("nodes"),i=t.get("edges"),a=t.get("edges");ye(n,function(o){o.refresh()}),ye(i,function(o){o.refresh()}),ye(a,function(o){o.refresh()})}t.emit("aftergraphrefresh"),t.autoPaint()},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.getComboChildren=function(t){if(Pe(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo does not exist!");return}return t.getChildren()},e.prototype.positionsAnimate=function(t){var n=this;n.emit("beforeanimate");var i=n.get("animateCfg"),a=i.onFrame,o=t?n.getNodes().concat(n.getCombos()):n.getNodes(),s=o.map(function(f){var l=f.getModel();return{id:l.id,x:l.x,y:l.y}});n.stopAnimate();var u=n.get("canvas");n.animating=!0,setTimeout(function(){u.animate(function(f){ye(s,function(l){var c=n.findById(l.id);if(!(!c||c.destroyed)){var h=c.get("originAttrs"),d=c.get("model"),v=c.getContainer().getMatrix();if(h==null&&(v&&(h={x:v[6],y:v[7]}),c.set("originAttrs",h||0)),a){var p=a(c,f,l,h||{x:0,y:0});c.set("model",Object.assign(d,p))}else h?(d.x=h.x+(l.x-h.x)*f,d.y=h.y+(l.y-h.y)*f):(d.x=l.x,d.y=l.y)}}),n.refreshPositions(t)},{duration:i.duration,easing:i.easing,callback:function(){ye(o,function(l){l.set("originAttrs",null)}),i.callback&&i.callback(),n.emit("afteranimate"),n.animating=!1}})},0)},e.prototype.refreshPositions=function(t){var n=this;n.emit("beforegraphrefreshposition");var i=n.get("nodes"),a=n.get("edges"),o=n.get("vedges"),s=n.get("combos"),u,f={},l=function(h){ye(h,function(d){u=d.getModel();var v=d.get("originAttrs");if(!(v&&u.x===v.x&&u.y===v.y)){var p=d.updatePosition({x:u.x,y:u.y});f[u.id]=p,u.comboId&&(f[u.comboId]=f[u.comboId]||p),u.parentId&&(f[u.parentId]=f[u.parentId]||p)}})};l(s),l(i),s&&s.length!==0&&(t&&l(s),n.updateCombos()),ye(a,function(c){var h=c.getSource().getModel(),d=c.getTarget();if(!fn(d)){var v=d.getModel();(f[h.id]||f[v.id]||c.getModel().isComboEdge)&&c.refresh()}}),ye(o,function(c){c.refresh()}),n.emit("aftergraphrefreshposition"),n.autoPaint()},e.prototype.stopAnimate=function(){var t=this.get("canvas"),n=t.cfg.timeline;n&&n.stopAllAnimations()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var t=this.get("group").getMatrix();return t?t[0]:1},e.prototype.getCurrentMode=function(){var t=this.get("modeController");return t.getMode()},e.prototype.setMode=function(t){var n=this.get("modeController");return n.setMode(t),this},e.prototype.clear=function(t){var n;return t===void 0&&(t=!1),(n=this.get("canvas"))===null||n===void 0||n.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,n,i,a){var o=this;t===void 0&&(t={}),a===void 0&&(a=!0);var s=this.get("layoutController");if(Pe(t)&&(t={type:t}),n){var u=i;u||(n==="begin"?u={x:0,y:0}:u={x:this.getWidth()/2,y:this.getHeight()/2}),u=this.getPointByCanvas(u.x,u.y);var f=["force","gForce","fruchterman","force2"];f.includes(t.type)||!t.type&&f.includes(s==null?void 0:s.layoutType)?t.center=[u.x,u.y]:this.once("afterlayout",function(h){var d=o.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];u.x=u.x*d[0]+d[6],u.y=u.y*d[0]+d[7];var v=o.getGroup().getCanvasBBox(),p=v.minX,g=v.maxX,y=v.minY,m=v.maxY,b={x:(p+g)/2,y:(y+m)/2};n==="begin"&&(b.x=p,b.y=y),o.translate(u.x-b.x,u.y-b.y)})}var l=B({},this.get("layout")),c={};Object.assign(c,l,t),t.pipes&&!t.type?delete c.type:!t.pipes&&c.type&&delete c.pipes,this.set("layout",c),s&&(s.isLayoutTypeSame(c)&&c.gpuEnabled===l.gpuEnabled?s.updateLayoutCfg(c):s.changeLayout(c),a&&this.get("enabledStack")&&this.pushStack("layout",{before:l,after:c}))},e.prototype.destroyLayout=function(){var t=this.get("layoutController");t==null||t.destroyLayout()},e.prototype.layout=function(){var t,n=this.get("layoutController"),i=this.get("layout");if(!(!i||!n)){if(i.workerEnabled){n.layout();return}!((t=n.layoutMethods)===null||t===void 0)&&t.length?n.relayout(!0):n.layout()}},e.prototype.collapseCombo=function(t,n){var i=this;if(n===void 0&&(n=!0),!this.destroyed){if(Pe(t)&&(t=this.findById(t)),!t){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"collapse",item:t});var a=t.getModel(),o=this.get("itemController");o.collapseCombo(t,n),a.collapsed=!0;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||Mn(h,function(d){if(l&&d.depth<=a.depth)return!1;if(a.id===d.id&&(l=!0),l){var v=i.findById(d.id);v&&v.getType&&v.getType()==="combo"&&(u=u.concat(v.getNodes()),u=u.concat(v.getCombos()))}return!0})});var c={};s.forEach(function(h){var d=h.getModel(),v=d.isVEdge,p=d.size,g=p===void 0?1:p;if(!(h.isVisible()&&!v)){var y=h.getSource(),m=h.getTarget(),b=null,x;if(y.getModel().id===a.id||u.includes(y)&&!u.includes(m)?(b=m,x=!1):(m.getModel().id===a.id||!u.includes(y)&&u.includes(m))&&(b=y,x=!0),b){if(v){i.removeItem(h,!1);return}for(var w=b.getModel();!b.isVisible();){var E=w.parentId,_=w.comboId,M=E||_;if(b=i.findById(M),!b||!M)return;w=b.getModel()}var C=w.id,S=x?{source:C,target:a.id,size:g,isVEdge:!0}:{source:a.id,target:C,size:g,isVEdge:!0},A="".concat(S.source,"-").concat(S.target);if(c[A]){c[A].size+=g;return}c[A]=S}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})}},e.prototype.expandCombo=function(t,n){var i=this;if(n===void 0&&(n=!0),Pe(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var a=t.getModel(),o=this.get("itemController");o.expandCombo(t,n),a.collapsed=!1;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||Mn(h,function(d){if(l&&d.depth<=a.depth)return!1;if(a.id===d.id&&(l=!0),l){var v=i.findById(d.id);v&&v.getType&&v.getType()==="combo"&&(u=u.concat(v.getNodes()),u=u.concat(v.getCombos()))}return!0})});var c={};s.forEach(function(h){if(!(h.isVisible()&&!h.getModel().isVEdge)){var d=h.getSource(),v=h.getTarget(),p=d.get("id"),g=v.get("id"),y=null,m;if(p===a.id||u.includes(d)&&!u.includes(v)?(y=v,m=!1):g===a.id||!u.includes(d)&&u.includes(v)?(y=d,m=!0):u.includes(d)&&u.includes(v)&&d.isVisible()&&v.isVisible()&&h.show(),y){var b=h.getModel(),x=b.isVEdge,w=b.size,E=w===void 0?1:w;if(x){i.removeItem(h,!1);return}for(var _=y.getModel();!y.isVisible();){var M=_.parentId,C=_.comboId,S=M||C;if(y=i.findById(S),!y||!S)return;_=y.getModel()}for(var A=_.id,T=m?v:d,k=T.getModel();!T.isVisible();){var O=k.parentId,G=k.comboId,D=O||G;if(T=i.findById(D),!T||!D)return;if(k.comboId===a.id||k.parentId===a.id)break;k=T.getModel()}var $=k.id;if(A){var Y=m?{source:A,target:$,isVEdge:!0,size:E}:{source:$,target:A,isVEdge:!0,size:E},N="".concat(Y.source,"-").concat(Y.target);if(c[N]){c[N].size+=E;return}c[N]=Y}}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})},e.prototype.collapseExpandCombo=function(t,n){if(n===void 0&&(n=!0),Pe(t)&&(t=this.findById(t)),!(!t||t.getType&&t.getType()!=="combo")){for(var i=t.getModel(),a=this.findById(i.parentId);a;){var o=a.getModel();if(o.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),a=void 0;return}a=this.findById(o.parentId)}var s=i.collapsed;s?this.expandCombo(t,n):this.collapseCombo(t,n),this.updateCombo(t)}},e.prototype.getNeighbors=function(t,n){var i=t;return Pe(t)&&(i=this.findById(t)),i.getNeighbors(n)},e.prototype.getNodeDegree=function(t,n,i){n===void 0&&(n=void 0),i===void 0&&(i=!1);var a=t;Pe(t)&&(a=this.findById(t));var o=this.get("degrees");(!o||i)&&(o=_a(this.save()),this.set("degrees",o));var s=o[a.getID()],u=0;if(!s)return 0;switch(n){case"in":u=s.inDegree;break;case"out":u=s.outDegree;break;case"all":u=s;break;default:u=s.degree;break}return u},e.prototype.getUndoStack=function(){return this.undoStack},e.prototype.getRedoStack=function(){return this.redoStack},e.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},e.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear(),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack}))},e.prototype.pushStack=function(t,n,i){if(t===void 0&&(t="update"),i===void 0&&(i="undo"),!this.get("enabledStack")){console.warn("请先启用 undo & redo 功能，在实例化 Graph 时候配置 enabledStack: true !");return}var a=n?Vt(n):{before:{},after:Vt(this.save())};i==="redo"?this.redoStack.push({action:t,data:a}):this.undoStack.push({action:t,data:a}),this.emit("stackchange",{action:t,stackType:i,undoStack:this.undoStack,redoStack:this.redoStack})},e.prototype.getAdjMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix");return(!i||!t)&&(i=$o(this.save(),n),this.set("adjMatrix",i)),i},e.prototype.getShortestPathMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix"),a=this.get("shortestPathMatrix");return(!i||!t)&&(i=$o(this.save(),n),this.set("adjMatrix",i)),(!a||!t)&&(a=hf(this.save(),n),this.set("shortestPathMatrix",a)),a},e.prototype.on=function(t,n,i){return r.prototype.on.call(this,t,n,i)},e.prototype.destroy=function(){var t,n,i,a,o;this.emit("beforedestroy"),this.clear(),this.clearStack(),(t=this.get("itemController"))===null||t===void 0||t.destroy(),(n=this.get("modeController"))===null||n===void 0||n.destroy(),(i=this.get("viewController"))===null||i===void 0||i.destroy(),(a=this.get("stateController"))===null||a===void 0||a.destroy(),(o=this.get("canvas"))===null||o===void 0||o.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null,this.emit("afterdestroy")},e.prototype.createHull=function(t){if(!t.members||t.members.length<1){console.warn("Create hull failed! The members is empty.");return}var n=this.get("hullGroup"),i=this.get("hullMap");if(i||(i={},this.set("hullMap",i)),(!n||n.get("destroyed"))&&(n=this.get("group").addGroup({id:"hullGroup"}),n.toBack(),this.set("hullGroup",n)),i[t.id])return console.warn("Existed hull id."),i[t.id];var a=n.addGroup({id:"".concat(t.id,"-container")}),o=new Y_(this,B(B({},t),{group:a})),s=o.id;return i[s]=o,o},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var n,i;Pe(t)?i=this.getHullById(t):i=t,(n=this.get("hullMap"))===null||n===void 0||delete n[i.id],i.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();!t||!Object.keys(t).length||(Object.keys(t).forEach(function(n){var i=t[n];i.destroy()}),this.set("hullMap",{}))},e}(px);function Qg(r){"@babel/helpers - typeof";return Qg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qg(r)}var Ks=ni,V_="-shape",Jg="-label",wh=["startArrow","endArrow"],H_={lineWidth:1,stroke:void 0,fill:void 0,lineAppendWidth:1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,x:0,y:0,r:10,width:20,height:20,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},n8={lineWidth:1,stroke:"#000",lineDash:void 0,startArrow:!1,endArrow:!1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},Eh={edge:n8,node:H_,combo:H_},e0="-label-bg",t0={options:{labelCfg:{style:{fontFamily:ft.windowFontFamily}},descriptionCfg:{style:{fontFamily:ft.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(e){return{}},getOptions:function(e,t){return t==="move"||t!=null&&t.includes("bbox")?e:gr({},this.options,this.getCustomConfig(e)||{},e)},draw:function(e,t){t.shapeMap={},this.mergeStyle=this.getOptions(e);var n=this.drawShape(e,t);if(n.set("className",this.itemType+V_),t.shapeMap[this.itemType+V_]=n,e.label){var i=this.drawLabel(e,t);i.set("className",this.itemType+Jg),t.shapeMap[this.itemType+Jg]=i}return n},afterDraw:function(e,t,n){},drawShape:function(e,t){return null},drawLabel:function(e,t){var n=(this.mergeStyle||this.getOptions(e)||{}).labelCfg,i=n||{},a=this.getLabelStyle(e,i,t),o=a.rotate;delete a.rotate;var s=t.addShape("text",{attrs:a,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(t.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""){var u=s.getBBox(),f=[1,0,0,0,1,0,0,0,1];if(a.rotateCenter)switch(a.rotateCenter){case"center":f=Ks(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":f=Ks(f,[["t",-a.x,-a.y],["r",o],["t",a.x,a.y]]);break;case"leftcenter":f=Ks(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);break;default:f=Ks(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else f=Ks(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);s.setMatrix(f)}if(a.background){var l=this.drawLabelBg(e,t,s),c=this.itemType+e0;l.set("classname",c),t.shapeMap[c]=l,s.toFront()}return s},drawLabelBg:function(e,t,n){var i=this.options.labelCfg,a=gt({},i,e.labelCfg),o=this.getLabelBgStyleByPosition(n,a),s=t.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return t.shapeMap["text-bg-shape"]=s,s},getLabelStyleByPosition:function(e,t,n){return{text:e.label}},getLabelBgStyleByPosition:function(e,t){return{}},getLabelStyle:function(e,t,n){var i=this.getLabelStyleByPosition(e,t,n),a="".concat(this.itemType,"Label"),o=ft[a]?ft[a].style:null;return B(B(B({},o),i),t.style)},getShapeStyle:function(e){return e.style},update:function(e,t,n){this.updateShapeStyle(e,t,n),this.updateLabel(e,t,n)},updateShapeStyle:function(e,t,n){var i,a=t.getContainer(),o=t.getKeyShape(),s=gt({},o.attr(),e.style),u=function(c){var h,d=s[c];if(fn(d)){var v=((i=a.shapeMap)===null||i===void 0?void 0:i[c])||a.find(function(p){return p.get("name")===c});v==null||v.attr(d)}else o.attr((h={},h[c]=d,h))};for(var f in s)u(f)},updateLabel:function(e,t,n){var i,a,o=t.getContainer(),s=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,u=s===void 0?{}:s,f=this.itemType+Jg,l=o.shapeMap[f]||o.find(function(x){return x.get("className")===f}),c=this.itemType+e0,h=o.shapeMap[c]||o.find(function(x){return x.get("className")===c});if(l&&e.label===void 0&&(o.removeChild(l),delete o.shapeMap[f],h&&(o.removeChild(h),delete o.shapeMap[c])),e.label||e.label==="")if(l){(!n||n==="bbox|label"||this.itemType==="edge"&&n!=="style")&&(u=gr(u,e.labelCfg));var v=this.getLabelStyleByPosition(e,u,o),p=(i=e.labelCfg)===null||i===void 0?void 0:i.style,g=B(B({},v),p),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=Ks(m,[["t",-g.x,-g.y],["r",y],["t",g.x,g.y]]),g.matrix=m,l.attr(g)}else((a=l.getMatrix())===null||a===void 0?void 0:a[4])!==1&&l.resetMatrix(),l.attr(g);if(!h)g.background&&(h=this.drawLabelBg(e,o,l),h.set("classname",c),o.shapeMap[c]=h,l.toFront());else if(g.background){var b=this.getLabelBgStyleByPosition(l,u);h.attr(b)}else o.removeChild(h)}else{var d=this.drawLabel(e,o);d.set("className",f),o.shapeMap[f]=d}},afterUpdate:function(e,t){},setState:function(e,t,n){var i,a,o,s=n.get("keyShape");if(!(!s||s.destroyed)){var u=n.getType(),f=of(t)?e:"".concat(e,":").concat(t),l=this.getStateStyle(f,n),c=n.getStateStyle(f);if(!(!c&&!l)){var h=gt({},c||l),d=n.getContainer(),v={x:1,y:1,cx:1,cy:1,matrix:1};if(u==="combo"&&(v.r=1,v.width=1,v.height=1),t){var p=function(D){var $,Y=h[D];if(fn(Y)&&!wh.includes(D)){var N=((o=d.shapeMap)===null||o===void 0?void 0:o[D])||d.find(function(P){return P.get("name")===D});N==null||N.attr(Y)}else s.attr(($={},$[D]=Y,$))};for(var g in h)p(g)}else{var y=eh(n.getCurrentStatesStyle()),m=n.getModel(),b=gt({},m.style,eh(n.getOriginStyle())),x=s.get("name"),w=s.attr(),E={};Object.keys(w).forEach(function(G){if(G!=="img"){var D=w[G];D&&Qg(D)==="object"?E[G]=Vt(D):E[G]=D}});var _={},M=function(D){var $=h[D];if(fn($)&&!wh.includes(D)){var Y=d.shapeMap[D]||d.find(function(W){return W.get("name")===D});if(Y){var N=eh(Y.attr());ye($,function(W,J){if(D===x&&E[J]&&!v[J]){delete E[J];var te=b[D][J]||Eh[u][J];s.attr(J,te)}else if(N[J]||N[J]===0){delete N[J];var H=b[D][J]||Eh[u][J];Y.attr(J,H)}}),_[D]=N}}else if(E[D]&&!v[D]){delete E[D];var P=b[D]||(b[x]?b[x][D]:void 0)||Eh[u][D];s.attr(D,P)}};for(var C in h)M(C);x?_[x]=E:gt(_,E);for(var g in y)if(!v[g]){var S=y[g];(!fn(S)||wh.includes(g))&&(x?(gt(b[x],(a={},a[g]=S,a)),delete b[g]):gt(b,(i={},i[g]=S,i)),delete y[g])}var A={};gr(A,b,_,y);var T=!1,k=function(D){var $,Y,N=A[D];if(fn(N)&&!wh.includes(D)){var P=d.shapeMap[D]||d.find(function(J){return J.get("name")===D});P&&((P.get("type")==="text"||P.get("labelRelated"))&&(delete N.x,delete N.y,delete N.matrix),D===x&&(u==="combo"&&(delete N.r,delete N.width,delete N.height),T=!0),P.attr(N))}else if(!T){var W=N||Eh[u][D];u==="combo"?x||s.attr(($={},$[D]=W,$)):s.attr((Y={},Y[D]=W,Y))}};for(var O in A)k(O)}}}},getStateStyle:function(e,t){var n=t.getModel(),i=t.getType(),a=this.getOptions(n),o=a.stateStyles,s=a.style,u=s===void 0?{}:s,f=n.stateStyles?n.stateStyles[e]:o&&o[e];return i==="combo"?Vt(f):gt({},u,f)},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var t,n,i=(e==null?void 0:e.anchorPoints)||((t=this.getCustomConfig(e))===null||t===void 0?void 0:t.anchorPoints)||((n=this.options)===null||n===void 0?void 0:n.anchorPoints);return i}},i8={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:ft.nodeLabel.offset,getSize:function(e){var t,n=((t=this.mergeStyle)===null||t===void 0?void 0:t.size)||e.size||this.getOptions({}).size||ft.defaultNode.size;return vt(n)&&n.length===1&&(n=[n[0],n[0]]),vt(n)||(n=[n,n]),n},getLabelStyleByPosition:function(e,t){var n=t.maxLength,i=e.label;n&&(i=kE(i,n));var a=t.position||this.labelPosition;if(a==="center")return{x:0,y:0,text:i,textBaseline:"middle",textAlign:"center"};var o=t.offset;ct(o)&&(o=this.offset);var s=this.getSize(e),u;switch(a){case"top":u={x:0,y:-s[1]/2-o,textBaseline:"bottom",textAlign:"center"};break;case"bottom":u={x:0,y:s[1]/2+o,textBaseline:"top",textAlign:"center"};break;case"left":u={x:-s[0]/2-o,y:0,textBaseline:"middle",textAlign:"right"};break;default:u={x:s[0]/2+o,y:0,textBaseline:"middle",textAlign:"left"};break}return u.text=i,u},getLabelBgStyleByPosition:function(e,t){var n;if(!e)return{};var i=(n=t.style)===null||n===void 0?void 0:n.background;if(!i)return{};var a=e.getBBox(),o=$g(i.padding),s=a.width+o[1]+o[3],u=a.height+o[0]+o[2];return B(B({x:a.minX-o[3],y:a.minY-o[0]},i),{width:s,height:u})},drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e),a=t.addShape(n,{attrs:i,draggable:!0,name:"node-shape"});return t.shapeMap["node-shape"]=a,a},updateLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=t.shapeMap["link-point-left"]||t.find(function(A){return A.get("className")==="link-point-left"}),a=t.shapeMap["link-point-right"]||t.find(function(A){return A.get("className")==="link-point-right"}),o=t.shapeMap["link-point-top"]||t.find(function(A){return A.get("className")==="link-point-top"}),s=t.shapeMap["link-point-bottom"]||t.find(function(A){return A.get("className")==="link-point-bottom"}),u;i&&(u=i.attr()),a&&!u&&(u=a.attr()),o&&!u&&(u=o.attr()),s&&!u&&(u=s.attr()),u||(u=n);var f=gt({},u,e.linkPoints),l=f.fill,c=f.stroke,h=f.lineWidth,d=f.size/2;d||(d=f.r);var v=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},p=v.left,g=v.right,y=v.top,m=v.bottom,b=this.getSize(e),x=b[0],w=b[1],E={r:d,fill:l,stroke:c,lineWidth:h};if(i)!p&&p!==void 0?(i.remove(),delete t.shapeMap["link-point-left"]):i.attr(B(B({},E),{x:-x/2,y:0}));else if(p){var _="link-point-left";t.shapeMap[_]=t.addShape("circle",{attrs:B(B({},E),{x:-x/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(a)!g&&g!==void 0&&(a.remove(),delete t.shapeMap["link-point-right"]),a.attr(B(B({},E),{x:x/2,y:0}));else if(g){var M="link-point-right";t.shapeMap[M]=t.addShape("circle",{attrs:B(B({},E),{x:x/2,y:0}),className:M,name:M,isAnchorPoint:!0})}if(o)!y&&y!==void 0&&(o.remove(),delete t.shapeMap["link-point-top"]),o.attr(B(B({},E),{x:0,y:-w/2}));else if(y){var C="link-point-top";t.shapeMap[C]=t.addShape("circle",{attrs:B(B({},E),{x:0,y:-w/2}),className:C,name:C,isAnchorPoint:!0})}if(s)!m&&m!==void 0?(s.remove(),delete t.shapeMap["link-point-bottom"]):s.attr(B(B({},E),{x:0,y:w/2}));else if(m){var S="link-point-bottom";t.shapeMap[S]=t.addShape("circle",{attrs:B(B({},E),{x:0,y:w/2}),className:S,name:S,isAnchorPoint:!0})}},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(B({},n)),this.updateLabel(e,t,a),i&&this.updateIcon(e,t)},updateIcon:function(e,t){var n=this,i=t.getContainer(),a=(this.mergeStyle||this.getOptions(e)).icon,o=e.icon?e.icon:{show:void 0,text:void 0},s=o.show,u=o.text,f=i.shapeMap["".concat(this.type,"-icon")]||i.find(function(y){return y.get("name")==="".concat(n.type,"-icon")});if(f)if(s||s===void 0){var l=gt({},f.attr(),a),c=l.width,h=c===void 0?20:c,d=l.height,v=d===void 0?20:d;(l.fontFamily==="iconfont"||l.hasOwnProperty("text"))&&(h=0,v=0),f.attr(B(B({},l),{x:-h/2,y:-v/2}))}else f.remove(),delete i.shapeMap["".concat(this.type,"-icon")];else if(s){var p="".concat(this.type,"-icon");if(u)i.shapeMap[p]=i.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:p,name:p});else{var h=a.width,v=a.height;i.shapeMap[p]=i.addShape("image",{attrs:B(B({},a),{x:-h/2,y:-v/2}),className:p,name:p})}var g=i.shapeMap["node-label"]||i.find(function(y){return y.get("name")==="node-label"});g&&g.toFront()}}},a8=B(B({},t0),i8);yr.registerNode("single-node",a8);var _h="edge-shape";function o8(r){var e=r;return r==="start"?e="end":r==="end"&&(e="start"),e}var s8={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:ft.defaultEdge.size,style:{x:0,y:0,stroke:ft.defaultEdge.style.stroke,lineAppendWidth:ft.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:ft.edgeLabel.style.fill,fontSize:ft.edgeLabel.style.fontSize,fontFamily:ft.windowFontFamily}},stateStyles:B({},ft.edgeStateStyles)},getPath:function(e){var t=[];return ye(e,function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=gt({},t,n,e.style),a=e.size||ft.defaultEdge.size;e=this.getPathPoints(e);var o=e.startPoint,s=e.endPoint,u=this.getControlPoints(e),f=[o];u&&(f=f.concat(u)),f.push(s);var l=this.getPath(f),c=gt({},ft.defaultEdge.style,{stroke:ft.defaultEdge.color,lineWidth:a,path:l},i);return c},updateShapeStyle:function(e,t,n){var i,a=t.getContainer(),o=((i=t.getKeyShape)===null||i===void 0?void 0:i.call(t))||a.shapeMap["edge-shape"],s=e.size;e=this.getPathPoints(e);var u=e.startPoint,f=e.endPoint,l=this.getControlPoints(e),c=[u];l&&(c=c.concat(l)),c.push(f);var h=o.attr(),d=e.style||{};d.stroke===void 0&&(d.stroke=e.color);var v=e.sourceNode,p=e.targetNode,g={radius:d.radius};l||(g={source:v,target:p,offset:d.offset,radius:d.radius});var y=this.getPath(c,g),m={};n==="move"?m={path:y}:(h.endArrow&&d.endArrow===!1&&(e.style.endArrow={path:""}),h.startArrow&&d.startArrow===!1&&(e.style.startArrow={path:""}),m=B({},e.style),m.lineWidth===void 0&&(m.lineWdith=(ht(s)?s:s==null?void 0:s[0])||h.lineWidth),m.path===void 0&&(m.path=y),m.stroke===void 0&&(m.stroke=h.stroke||e.color)),o&&o.attr(m)},getLabelStyleByPosition:function(e,t,n){var i=t.position||this.labelPosition,a={},o=n==null?void 0:n.shapeMap[_h],s;i==="start"?s=0:i==="end"?s=1:s=.5;var u=t.refX||this.refX,f=t.refY||this.refY;if(e.startPoint.x===e.endPoint.x&&e.startPoint.y===e.endPoint.y)return a.x=e.startPoint.x+u,a.y=e.startPoint.y+f,a.text=e.label,a;var l;ct(t.autoRotate)?l=this.labelAutoRotate:l=t.autoRotate;var c=AE(o,s,u,f,l);return a.x=c.x,a.y=c.y,a.rotate=c.rotate,a.textAlign=this._getTextAlign(i,c.angle),a.text=e.label,a},getLabelBgStyleByPosition:function(e,t){if(!e)return{};var n=e.getBBox(),i=t.style&&t.style.background;if(!i)return{};var a=i.padding,o=n.width+a[1]+a[3],s=n.height+a[0]+a[2],u=B(B({},i),{width:o,height:s,x:n.minX-a[3],y:n.minY-a[0],matrix:[1,0,0,0,1,0,0,0,1]}),f;return ct(t.autoRotate)?f=this.labelAutoRotate:f=t.autoRotate,f&&(u.matrix=e.attr("matrix")||[1,0,0,0,1,0,0,0,1]),u},_getTextAlign:function(e,t){var n="center";return t?(t=t%(Math.PI*2),e!=="center"&&(t>=0&&t<=Math.PI/2||t>=3/2*Math.PI&&t<2*Math.PI?n=e:n=o8(e)),n):e},getControlPoints:function(e){return e.controlPoints},getPathPoints:function(e){return e},drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("path",{className:_h,name:_h,attrs:n});return t.shapeMap[_h]=i,i},drawLabel:function(e,t){var n=this.options.labelCfg,i=gr({},n,e.labelCfg),a=this.getLabelStyle(e,i,t),o=a.rotate;delete a.rotate;var s=t.addShape("text",{attrs:a,name:"text-shape",labelRelated:!0,draggable:!0});if(t.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""&&s.rotateAtStart(o),a.background){var u=this.drawLabelBg(e,t,s,a,o),f=this.itemType+e0;u.set("classname",f),t.shapeMap[f]=u,s.toFront()}return s},drawLabelBg:function(e,t,n,i,a){var o=this.options.labelCfg,s=gr({},o,e.labelCfg),u=this.getLabelBgStyleByPosition(n,s),f=t.addShape("rect",{name:"text-bg-shape",attrs:u,labelRelated:!0});return t.shapeMap["text-bg-shape"]=f,f}},u8=B(B({},t0),s8);yr.registerEdge("single-edge",u8),yr.registerEdge("line",{getControlPoints:function(){}},"single-edge"),yr.registerEdge("spline",{getPath:function(e){var t=R_(e);return t}},"single-edge"),yr.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint,i={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a,o;if(e.controlPoints!==void 0){if(o=e.controlPoints[0],a=Kp(t,o,n),t.x<=n.x&&t.y>n.y?this.clockwise=a.x>o.x?0:1:t.x<=n.x&&t.y<n.y?this.clockwise=a.x>o.x?1:0:t.x>n.x&&t.y<=n.y?this.clockwise=a.y<o.y?0:1:this.clockwise=a.y<o.y?1:0,(o.x-t.x)/(o.y-t.y)===(n.x-t.x)/(n.y-t.y))return[]}else{e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),vt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),e.curveOffset<0?this.clockwise=0:this.clockwise=1;var s={x:n.x-t.x,y:n.y-t.y},u=Math.atan2(s.y,s.x);o={x:e.curveOffset*Math.cos(-Math.PI/2+u)+i.x,y:e.curveOffset*Math.sin(-Math.PI/2+u)+i.y},a=Kp(t,o,n)}var f=Hc(t,a),l=[{x:f,y:f}];return l},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),e.length===2?t.push(["L",e[1].x,e[1].y]):t.push(["A",e[1].x,e[1].y,0,0,this.clockwise,e[2].x,e[2].y]),t}},"single-edge"),yr.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(e){var t=e.controlPoints;if(!t||!t.length){var n=e.startPoint,i=e.endPoint;e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),vt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),vt(e.curvePosition)&&(e.curvePosition=e.curveOffset[0]);var a=xh(n,i,e.curvePosition,e.curveOffset);t=[a]}return t},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),t.push(["Q",e[1].x,e[1].y,e[2].x,e[2].y]),t}},"single-edge"),yr.registerEdge("cubic",{curvePosition:[1/2,1/2],curveOffset:[-20,20],getControlPoints:function(e){var t=e.controlPoints;if(e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),ht(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),ht(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]),!t||!t.length||t.length<2){var n=e.startPoint,i=e.endPoint,a=xh(n,i,e.curvePosition[0],e.curveOffset[0]),o=xh(n,i,e.curvePosition[1],e.curveOffset[1]);t=[a,o]}return t},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),t.push(["C",e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y]),t}},"single-edge"),yr.registerEdge("cubic-vertical",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint;e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.minCurveOffset===void 0&&(e.minCurveOffset=this.minCurveOffset),ht(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),ht(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),ht(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var i=n.y-t.y,a=[0,0];e.curveOffset?a=e.curveOffset:Math.abs(i)<Math.abs(e.minCurveOffset[0])&&(a=e.minCurveOffset);var o={x:t.x,y:t.y+i*this.curvePosition[0]+a[0]},s={x:n.x,y:n.y-i*this.curvePosition[1]+a[1]};return[o,s]}},"cubic"),yr.registerEdge("cubic-horizontal",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint;e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.minCurveOffset===void 0&&(e.minCurveOffset=this.minCurveOffset),ht(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),ht(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),ht(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var i=n.x-t.x,a=[0,0];e.curveOffset?a=e.curveOffset:Math.abs(i)<Math.abs(e.minCurveOffset[0])&&(a=e.minCurveOffset);var o={x:t.x+i*this.curvePosition[0]+a[0],y:t.y},s={x:n.x-i*this.curvePosition[1]+a[1],y:n.y},u=[o,s];return u}},"cubic"),yr.registerEdge("loop",{getPathPoints:function(e){return CE(e)},getControlPoints:function(e){return e.controlPoints},afterDraw:function(e){e.controlPoints=void 0},afterUpdate:function(e){e.controlPoints=void 0}},"cubic");var f8={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:ft.comboLabel.refX,refY:ft.comboLabel.refY,options:{style:{stroke:ft.defaultCombo.style.stroke,fill:ft.defaultCombo.style.fill,lineWidth:ft.defaultCombo.style.lineWidth},labelCfg:{style:{fill:ft.comboLabel.style.fill,fontSize:ft.comboLabel.style.fontSize,fontFamily:ft.windowFontFamily}},stateStyles:B({},ft.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},getSize:function(e){var t=Vt(e.size||this.options.size||ft.defaultCombo.size);return vt(t)&&t.length===1&&(t=[t[0],t[0]]),vt(t)||(t=[t,t]),t},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition,i=e.style,a=e.padding||this.options.padding;vt(a)&&(a=Math.max.apply(Math,a));var o=t.refX,s=t.refY;ct(o)&&(o=this.refX),ct(s)&&(s=this.refY);var u=this.getSize(e),f=Math.max(i.r,u[0]/2)||u[0]/2,l=f+a,c;switch(n){case"top":c={x:0,y:-l-s,textBaseline:"bottom",textAlign:"center"};break;case"bottom":c={x:0,y:l+s,textBaseline:"bottom",textAlign:"center"};break;case"left":c={x:-l+o,y:0,textAlign:"left"};break;case"center":c={x:0,y:0,text:e.label,textAlign:"center"};break;default:c={x:l+o,y:0,textAlign:"right"};break}return c.text=e.label,c},drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e),a=t.addShape(n,{attrs:i,draggable:!0,name:"combo-shape"});return a},updateCollapsedIcon:function(e,t,n){var i=e.collapsed,a=e.collapsedSubstituteIcon,o=a===void 0?{}:a,s=Object.assign({},this.options.collapsedSubstituteIcon,o),u=s.show,f=s.img,l=s.width,c=s.height,h=t.getContainer(),d=h.find(function(y){return y.get("name")==="combo-collapsed-substitute-icon"}),v=d&&!d.destroyed,p=t.get("keyShape");if(i&&u){if(v)d.show();else{var g={width:l||n.r*2||n.width,height:c||n.r*2||n.height};d=h.addShape("image",{attrs:B({img:f,x:-g.width/2,y:-g.height/2},g),name:"combo-collapsed-substitute-icon",draggable:!0})}p.hide()}else v&&(d.hide(),p.show())},updateShape:function(e,t,n){var i=this,a=t.get("keyShape"),o=t.get("animate"),s=o&&(e.animate===void 0?this.options.animate:e.animate);s&&a.animate?(e.collapsed||this.updateCollapsedIcon(e,t,n),a.animate(n,{duration:200,easing:"easeLinear",callback:function(){e.collapsed&&i.updateCollapsedIcon(e,t,n)}})):(a.attr(B({},n)),this.updateCollapsedIcon(e,t,n)),this.updateLabel(e,t)}},l8=B(B({},t0),f8);yr.registerCombo("single-combo",l8),yr.registerCombo("circle",{options:{size:[ft.defaultCombo.size[0],ft.defaultCombo.size[0]],padding:Math.max.apply(Math,ft.defaultCombo.padding),animate:!0,style:{stroke:ft.defaultCombo.style.stroke,fill:ft.defaultCombo.style.fill,lineWidth:ft.defaultCombo.style.lineWidth},labelCfg:{style:{fill:ft.comboLabel.style.fill,fontSize:ft.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:B({},ft.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"circle",labelPosition:"top",drawShape:function(e,t){var n=this.getShapeStyle(e);delete n.height,delete n.width;var i=t.addShape("circle",{attrs:n,className:"circle-combo",name:"circle-combo",draggable:!0});return i},getShapeStyle:function(e){var t=this.options.style,n=e.padding||this.options.padding;vt(n)&&(n=Math.max.apply(Math,n));var i={stroke:e.color},a=gt({},t,i,e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;if(o)s=ht(o)?o/2:o[0]/2;else{var u=this.getSize(e);!ht(a.r)||isNaN(a.r)?s=u[0]/2||ft.defaultCombo.style.r:s=Math.max(a.r,u[0]/2)||u[0]/2}a.r=s+n;var f=B({x:0,y:0},a);return e.style?e.style.r=s:e.style={r:s},f},update:function(e,t){var n=this.getSize(e),i=e.padding||this.options.padding;vt(i)&&(i=Math.max.apply(Math,i));var a=Vt(e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;o?s=ht(o)?o/2:o[0]/2:s=Math.max(a.r,n[0]/2)||n[0]/2,a.r=s+i;var u=t.get("sizeCache");u&&(u.r=a.r);var f={stroke:e.color},l=t.get("keyShape"),c=gt({},l.attr(),f,a);e.style?e.style.r=s:e.style={r:s},this.updateShape(e,t,c,!0)}},"single-combo"),yr.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:ft.defaultCombo.style.stroke,fill:ft.defaultCombo.style.fill,lineWidth:ft.defaultCombo.style.lineWidth},labelCfg:{style:{fill:ft.comboLabel.style.fill,fontSize:ft.comboLabel.style.fontSize,fontFamily:ft.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:B({},ft.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"rect",labelPosition:"top",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"rect-combo",name:"rect-combo",draggable:!0});return i},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition,i=e.style,a=e.padding||this.options.padding;ht(a)&&(a=[a,a,a,a]);var o=t.refX,s=t.refY;ct(o)&&(o=this.refX),ct(s)&&(s=this.refY);var u=-i.width/2-a[3],f=i.width/2+a[1],l=-i.height/2-a[0],c=i.height/2+a[2],h;switch(n){case"top":h={x:u+o,y:l+s,textBaseline:"top",textAlign:"left"};break;case"bottom":h={x:0,y:c+s,textBaseline:"top",textAlign:"center"};break;case"left":h={x:u+s,y:0,textAlign:"left"};break;case"center":h={x:0,y:0,text:e.label,textAlign:"center"};break;case"top-center":h={x:0,y:l+s,textBaseline:"top",textAlign:"center"};break;default:h={x:f+o,y:0,textAlign:"right"};break}return h.text=e.label,h},getShapeStyle:function(e){var t=this.options.style,n=e.padding||this.options.padding;ht(n)&&(n=[n,n,n,n]);var i={stroke:e.color},a=gt({},t,i,e.style),o=this.getSize(e),s,u,f=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;f?ht(f)?(s=f,u=f):(s=f[0],u=f[1]):(!ht(a.width)||isNaN(a.width)?s=o[0]||ft.defaultCombo.style.width:s=Math.max(a.width,o[0])||o[0],!ht(a.height)||isNaN(a.height)?u=o[1]||ft.defaultCombo.style.height:u=Math.max(a.height,o[1])||o[1]);var l=-s/2-n[3],c=-u/2-n[0];a.width=s+n[1]+n[3],a.height=u+n[0]+n[2];var h=B({x:l,y:c},a);return e.style?(e.style.width=s,e.style.height=u):e.style={width:s,height:u},h},update:function(e,t){var n=this.getSize(e),i=e.padding||this.options.padding;ht(i)&&(i=[i,i,i,i]);var a=Vt(e.style),o,s,u=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;u?ht(u)?(o=u,s=u):(o=u[0],s=u[1]):(o=Math.max(a.width,n[0])||n[0],s=Math.max(a.height,n[1])||n[1]),a.width=o+i[1]+i[3],a.height=s+i[0]+i[2];var f=t.get("sizeCache");f&&(f.width=a.width,f.height=a.height),a.x=-o/2-i[3],a.y=-s/2-i[0];var l={stroke:e.color},c=t.get("keyShape"),h=gt({},c.attr(),l,a);e.style?(e.style.width=o,e.style.height=s):e.style={width:o,height:s},this.updateShape(e,t,h,!1)}},"single-combo"),yr.registerNode("simple-circle",{options:{size:ft.defaultNode.size,style:{x:0,y:0,stroke:ft.defaultNode.style.stroke,fill:ft.defaultNode.style.fill,lineWidth:ft.defaultNode.style.lineWidth},labelCfg:{style:{fill:ft.nodeLabel.style.fill,fontSize:ft.nodeLabel.style.fontSize,fontFamily:ft.windowFontFamily}},stateStyles:B({},ft.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",shapeMap:{},drawShape:function(e,t){var n=this.getShapeStyle(e),i="".concat(this.type,"-keyShape"),a=t.addShape("circle",{attrs:n,className:"".concat(this.type,"-keyShape"),name:i,draggable:!0});return t.shapeMap[i]=a,a},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gr({},t,n),a=this.getSize(e),o=a[0]/2,s=B({x:0,y:0,r:o},i);return s},update:function(e,t,n){var i=this.getSize(e),a={stroke:e.color,r:i[0]/2},o=t.get("keyShape"),s=gr({},o.attr(),a,e.style);this.updateShape(e,t,s,!0,n)}},"single-node"),yr.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:ft.defaultNode.style.stroke,fill:ft.defaultNode.style.fill,lineWidth:ft.defaultNode.style.lineWidth},labelCfg:{style:{fill:ft.nodeLabel.style.fill,fontSize:ft.nodeLabel.style.fontSize,fontFamily:ft.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:B({},ft.nodeStateStyles)},shapeType:"simple-rect",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return i},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t,n){t.getContainer();var i=(this.mergeStyle||this.getOptions(e)).style,a=this.getSize(e),o=t.get("keyShape");e.size||(a[0]=o.attr("width")||i.width,a[1]=o.attr("height")||i.height);var s={stroke:e.color,x:-a[0]/2,y:-a[1]/2,width:a[0],height:a[1]},u=gt({},i,o.attr(),s);u=gt(u,e.style),this.updateShape(e,t,u,!1,n)}},"single-node"),yr.registerNode("image",{options:{img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",size:200,labelCfg:{style:{fontFamily:ft.windowFontFamily}},clipCfg:{show:!1,type:"circle",r:50,rx:50,ry:35,width:50,height:35,points:[[30,12],[12,30],[30,48],[48,30]],path:[["M",25,25],["L",50,25],["A",12.5,12.5,0,1,1,50,50],["A",12.5,12.5,0,1,0,50,50],["L",25,75],["Z"]],x:0,y:0}},shapeType:"image",labelPosition:"bottom",drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e);delete i.fill;var a=t.addShape(n,{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return this.drawClip(e,a),a},drawClip:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).clipCfg;if(n.show){var i=n.type,a=n.x,o=n.y,s=n.style;if(i==="circle"){var u=n.r;t.setClip({type:"circle",attrs:B({r:u,x:a,y:o},s)})}else if(i==="rect"){var f=n.width,l=n.height,c=a-f/2,h=o-l/2;t.setClip({type:"rect",attrs:B({x:c,y:h,width:f,height:l},s)})}else if(i==="ellipse"){var d=n.rx,v=n.ry;t.setClip({type:"ellipse",attrs:B({x:a,y:o,rx:d,ry:v},s)})}else if(i==="polygon"){var p=n.points;t.setClip({type:"polygon",attrs:B({points:p},s)})}else if(i==="path"){var g=n.path;t.setClip({type:"path",attrs:B({path:g},s)})}}},getShapeStyle:function(e){var t=this.mergeStyle||this.getOptions(e),n=t.style,i=t.img,a=this.getSize(e),o=a[0],s=a[1];n&&(o=n.width||a[0],s=n.height||a[1]);var u=B({x:-o/2,y:-s/2,width:o,height:s,img:i},n);return u},updateShapeStyle:function(e,t){var n=t.getContainer(),i="".concat(this.itemType,"-shape"),a=n.shapeMap[i]||n.find(function(s){return s.get("className")===i})||t.getKeyShape(),o=this.getShapeStyle(e);a&&!a.destroyed&&a.attr(o)}},"single-node");const q_={triangle:function(e,t,n){e===void 0&&(e=10),t===void 0&&(t=15),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",0 L ").concat(i+t,",-").concat(e/2," L ").concat(i+t,",").concat(e/2," Z");return a},vee:function(e,t,n){e===void 0&&(e=15),t===void 0&&(t=20),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",0 L ").concat(i+t,",-").concat(e/2,`
        L `).concat(i+2*t/3,",0 L ").concat(i+t,",").concat(e/2," Z");return a},circle:function(e,t){e===void 0&&(e=5),t===void 0&&(t=0);var n=t*2,i="M ".concat(n,`, 0
            a `).concat(e,",").concat(e," 0 1,0 ").concat(e*2,`,0
            a `).concat(e,",").concat(e," 0 1,0 ").concat(-e*2,",0");return i},rect:function(e,t,n){e===void 0&&(e=10),t===void 0&&(t=10),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",").concat(-e/2,` 
        L `).concat(i+t,",").concat(-e/2,` 
        L `).concat(i+t,",").concat(e/2,` 
        L `).concat(i,",").concat(e/2," Z");return a},diamond:function(e,t,n){e===void 0&&(e=15),t===void 0&&(t=15),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,`,0 
        L `).concat(i+t/2,",").concat(-e/2,` 
        L `).concat(i+t,`,0 
        L `).concat(i+t/2,",").concat(e/2," Z");return a},triangleRect:function(e,t,n,i,a,o){e===void 0&&(e=15),t===void 0&&(t=15),n===void 0&&(n=15),i===void 0&&(i=3),a===void 0&&(a=5),o===void 0&&(o=0);var s=o*2,u=s+t+a,f="M ".concat(s,",0 L ").concat(s+t,",-").concat(e/2," L ").concat(s+t,",").concat(e/2,` Z
            M `).concat(u,", -").concat(n/2,`
            L `).concat(u+i," -").concat(n/2,`
            L `).concat(u+i," ").concat(n/2,`
            L `).concat(u," ").concat(n/2,`
            Z`);return f}},Z_={collapse:function(e,t,n){return[["M",e-n,t],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",e-n+4,t],["L",e+n-4,t]]},expand:function(e,t,n){return[["M",e-n,t],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",e-n+4,t],["L",e-n+2*n-4,t],["M",e-n+n,t-n+4],["L",e,t+n-4]]},upTriangle:function(e,t,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",e-i,t+a],["L",e+i,t+a],["L",e,t-n],["Z"]]},downTriangle:function(e,t,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",e-i,t-a],["L",e+i,t-a],["L",e,t+n],["Z"]]}};var c8=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"];const h8=Object.freeze(Object.defineProperty({__proto__:null,defaultSubjectColors:c8},Symbol.toStringTag,{value:"Module"}));var K_=function(e){return e==="force"||e==="g6force"||e==="gForce"||e==="force2"};const d8=Object.freeze(Object.defineProperty({__proto__:null,isForce:K_},Symbol.toStringTag,{value:"Module"}));var v8=ni,bn=B(B(B(B(B(B(B({},Az),V4),Wz),F4),h8),d8),{transform:v8,mat3:Ex}),Q_=function(){function r(e){this.graph=e,this.layoutCfg=e.get("layout")||{},this.layoutType=this.getLayoutType(),this.layoutMethods=[],this.initLayout()}return r.prototype.initLayout=function(){},r.prototype.getLayoutType=function(){return this.getLayoutCfgType(this.layoutCfg)},r.prototype.getLayoutCfgType=function(e){var t=e.type;if(t)return t;var n=e.pipes;return Array.isArray(n)?n.map(function(i){return(i==null?void 0:i.type)||""}):null},r.prototype.isLayoutTypeSame=function(e){var t=this.getLayoutCfgType(e),n=Array.isArray(this.layoutType),i=Array.isArray(t);return n&&i?this.layoutType.every(function(a,o){return a===t[o]}):Array.isArray(t)||Array.isArray(this.layoutType)?!1:(e==null?void 0:e.type)===this.layoutType},r.prototype.refreshLayout=function(){var e=this,t=e.graph,n=e.layoutType,i=e.layoutCfg,a=i===void 0?{}:i;if(t){var o=a.animate,s=o===void 0&&(n==="force"||n==="force2"),u=K_(n)&&(o||s);t.get("animate")&&!u?t.positionsAnimate(n==="comboCombined"):t.refreshPositions(n==="comboCombined")}},r.prototype.changeLayout=function(e){var t=e.disableTriggerLayout,n=Jr(e,["disableTriggerLayout"]);this.layoutCfg=n,this.layoutType=n.type||this.layoutType,!t&&this.layout()},r.prototype.changeData=function(e){this.layout(e)},r.prototype.destoryLayoutMethods=function(){var e=this.layoutMethods,t=[];return e==null||e.forEach(function(n){var i,a=(i=n.getType)===null||i===void 0?void 0:i.call(n);a&&t.push(a),n.destroy()}),this.layoutMethods=[],t},r.prototype.destroyLayout=function(){this.destoryLayoutMethods();var e=this.graph;e&&!e.get("destroyed")&&e.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0},r.prototype.setDataFromGraph=function(){for(var e,t=[],n=[],i=[],a=[],o=[],s=[],u=[],f=this.graph.getNodes(),l=this.graph.getEdges(),c=this.graph.getCombos(),h=f.length,d=0;d<h;d++){var v=f[d];if(!(!v||v.destroyed)){var p=v.getModel();if(!v.isVisible()){n.push(p);continue}t.push(p)}}for(var g=l.length,d=0;d<g;d++){var y=l[d];if(!(!y||y.destroyed)){var p=y.getModel();if(!y.isVisible()){a.push(p);continue}p.isComboEdge?o.push(p):i.push(p)}}for(var m=c.length,d=0;d<m;d++){var b=c[d];if(!b.destroyed){var p=b.getModel();if(!b.isVisible()){u.push(p);continue}s.push(p)}}return{nodes:t,hiddenNodes:n,edges:i,hiddenEdges:a,combos:s,hiddenCombos:u,comboEdges:o,vedges:(e=this.graph.get("vedges"))===null||e===void 0?void 0:e.map(function(x){return x.getModel()})}},r.prototype.relayout=function(e){var t=this,n=this,i=n.graph,a=n.layoutMethods,o=n.layoutCfg;if(!(!i||i.get("destroyed"))){var s=Promise.resolve();if(e){this.data=this.setDataFromGraph();var u=this.data.nodes;if(!u)return!1;s=this.initPositions(o.center,u)}i.emit("beforelayout"),a==null||a.forEach(function(f,l){var c=o[l]||o;s=s.then(function(){var h,d=t.execLayoutMethod(c,l);return l===a.length-1&&((h=o.onAllLayoutEnd)===null||h===void 0||h.call(o)),d})})}},r.prototype.filterLayoutData=function(e,t){var n=e.nodes,i=e.edges,a=Jr(e,["nodes","edges"]);if(!n)return e;var o,s;_r(t==null?void 0:t.nodesFilter)?o=t.nodesFilter:o=function(){return!0};var u=n.filter(o);if(_r(t==null?void 0:t.edgesFilter))s=t.edgesFilter;else{var f=u.reduce(function(l,c){return l[c.id]=!0,l},{});s=function(c){return f[c.source]&&f[c.target]}}return B({nodes:u,edges:i.filter(s)},a)},r.prototype.getLayoutBBox=function(e){var t=this.graph,n=Ac(t.getNodes(),function(o){return o.getModel().layoutOrder}),i=Object.values(n).map(function(o){var s=g_(o);return s.size=[s.width,s.height],s}),a=Object.values(Ac(e,"layoutOrder"));return{groupNodes:a,layoutNodes:i}},r.prototype.layoutAnimate=function(){},r.prototype.moveToZero=function(){var e=this.graph,t=e.get("data"),n=t.nodes;if(!(n[0].x===void 0||n[0].x===null||Qi(n[0].x))){for(var i=[0,0],a=n.length,o=0;o<a;o++){var s=n[o];i[0]+=s.x,i[1]+=s.y}i[0]/=n.length,i[1]/=n.length;for(var o=0;o<a;o++){var s=n[o];s.x-=i[0],s.y-=i[1]}}},r.prototype.initPositions=function(e,t){var n;return Un(this,void 0,void 0,function(){var i,a,o;return Xn(this,function(s){return i=this.graph,t!=null&&t.length?(a=t.filter(function(u){return Qi(u.x)||Qi(u.y)}),o=a?a.length:0,o?[2,(n=this.initWithPreset)===null||n===void 0?void 0:n.call(this,function(){},function(){var u=i.get("width")*.85,f=i.get("height")*.85,l=Math.ceil(Math.sqrt(o)*(u/f)),c=Math.ceil(o/l),h=u/(l-1),d=f/(c-1);(!isFinite(h)||!h)&&(h=0),(!isFinite(d)||!h)&&(d=0);for(var v=e[0]-u/2,p=e[1]-f/2,g=0;g<o;g++){var y=a[g];Qi(+y.x)&&(y.x=g%l*h+v),Qi(+y.y)&&(y.y=Math.floor(g/l)*d+p)}})]:[2]):[2,Promise.resolve()]})})},r.prototype.destroy=function(){this.graph=null,this.destoryLayoutMethods(),this.destroyed=!0},r}(),J_=function(){function r(e){this.graph=e,this.destroyed=!1,this.initEvents()}return r}(),Ma=yr.registerNode,eS=yr.registerEdge,p8=yr.registerCombo,tS=Sp.registerBehavior,Qe=ft;ft.version,yr.registerNode,yr.registerEdge,yr.registerCombo,Sp.registerBehavior;var r0={},Kt={},Sh={},fo={};Object.defineProperty(fo,"__esModule",{value:!0}),fo.MESSAGE=fo.ALGORITHM=void 0;var g8={pageRank:"pageRank",breadthFirstSearch:"breadthFirstSearch",connectedComponent:"connectedComponent",depthFirstSearch:"depthFirstSearch",detectCycle:"detectCycle",detectDirectedCycle:"detectDirectedCycle",detectAllCycles:"detectAllCycles",detectAllDirectedCycle:"detectAllDirectedCycle",detectAllUndirectedCycle:"detectAllUndirectedCycle",dijkstra:"dijkstra",findAllPath:"findAllPath",findShortestPath:"findShortestPath",floydWarshall:"floydWarshall",getAdjMatrix:"getAdjMatrix",getDegree:"getDegree",getInDegree:"getInDegree",getNeighbors:"getNeighbors",getOutDegree:"getOutDegree",labelPropagation:"labelPropagation",louvain:"louvain",GADDI:"GADDI",minimumSpanningTree:"minimumSpanningTree",SUCCESS:"SUCCESS",FAILURE:"FAILURE"};fo.ALGORITHM=g8;var y8={SUCCESS:"SUCCESS",FAILURE:"FAILURE"};fo.MESSAGE=y8;var Mh={},rS={},Ho={};Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.default=void 0;var m8=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];a.push(f)}),i&&i.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];!l&&l!==0||!c&&c!==0||(a[l][c]=1,t||(a[c][l]=1))}),a},b8=m8;Ho.default=b8;var Ch={},Ah={},Qs={};Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.default=Qs.LinkedListNode=void 0;var x8=function(e,t){return e===t},n0=function(){function r(e,t){t===void 0&&(t=null),this.value=e,this.next=t}return r.prototype.toString=function(e){return e?e(this.value):"".concat(this.value)},r}();Qs.LinkedListNode=n0;var w8=function(){function r(e){e===void 0&&(e=x8),this.head=null,this.tail=null,this.compare=e}return r.prototype.prepend=function(e){var t=new n0(e,this.head);return this.head=t,this.tail||(this.tail=t),this},r.prototype.append=function(e){var t=new n0(e);return this.head?(this.tail.next=t,this.tail=t,this):(this.head=t,this.tail=t,this)},r.prototype.delete=function(e){if(!this.head)return null;for(var t=null;this.head&&this.compare(this.head.value,e);)t=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(t=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),t},r.prototype.find=function(e){var t=e.value,n=t===void 0?void 0:t,i=e.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var o=this.head;o;){if(a&&a(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},r.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var t=this.head;t.next;)t.next.next?t=t.next:t.next=null;return this.tail=t,e},r.prototype.deleteHead=function(){if(!this.head)return null;var e=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),e},r.prototype.fromArray=function(e){var t=this;return e.forEach(function(n){return t.append(n)}),this},r.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},r.prototype.reverse=function(){for(var e=this.head,t=null,n=null;e;)n=e.next,e.next=t,t=e,e=n;this.tail=this.head,this.head=t},r.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(t){return t.toString(e)}).toString()},r}(),E8=w8;Qs.default=E8,Object.defineProperty(Ah,"__esModule",{value:!0}),Ah.default=void 0;var _8=S8(Qs);function S8(r){return r&&r.__esModule?r:{default:r}}var M8=function(){function r(){this.linkedList=new _8.default}return r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},r.prototype.enqueue=function(e){this.linkedList.append(e)},r.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toString=function(e){return this.linkedList.toString(e)},r}(),C8=M8;Ah.default=C8;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.uniqueId=Vr.getOutEdgesNodeId=Vr.getNeighbors=Vr.getEdgesByNodeId=void 0;var A8=function(e,t,n){t===void 0&&(t=[]);var i=t.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var a=function(f){return f.source===e};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===e};return i.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===e?f.target:f.source};return i.map(s)};Vr.getNeighbors=A8;var T8=function(e,t){return t.filter(function(n){return n.source===e})};Vr.getOutEdgesNodeId=T8;var I8=function(e,t){return t.filter(function(n){return n.source===e||n.target===e})};Vr.getEdgesByNodeId=I8;var k8=function(e){e===void 0&&(e=0);var t="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(e,"-").concat(t).concat(n)};Vr.uniqueId=k8,Object.defineProperty(Ch,"__esModule",{value:!0}),Ch.default=void 0;var L8=O8(Ah),N8=Vr;function O8(r){return r&&r.__esModule?r:{default:r}}function D8(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}var P8=function(e,t,n,i){i===void 0&&(i=!0);var a=D8(n),o=new L8.default,s=e.edges,u=s===void 0?[]:s;o.enqueue(t);for(var f="",l=function(){var h=o.dequeue();a.enter({current:h,previous:f}),(0,N8.getNeighbors)(h,u,i?"target":void 0).forEach(function(d){a.allowTraversal({previous:f,current:h,next:d})&&o.enqueue(d)}),a.leave({current:h,previous:f}),f=h};!o.isEmpty();)l()},R8=P8;Ch.default=R8;var lo={};Object.defineProperty(lo,"__esModule",{value:!0}),lo.default=B8,lo.detectStrongConnectComponents=lo.detectConnectedComponents=void 0;var nS=Vr,iS=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=(0,nS.getNeighbors)(v.id,a),g=function(b){var x=p[b];if(!s[x]){var w=n.filter(function(E){return E.id===x});w.length>0&&d(w[0])}},y=0;y<p.length;++y)g(y)},l=0;l<n.length;l++){var c=n[l];if(!s[c.id]){f(c);for(var h=[];u.length>0;)h.push(u.pop());o.push(h)}}return o};lo.detectConnectedComponents=iS;var aS=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u={},f={},l=[],c=0,h=function g(y){u[y.id]=c,f[y.id]=c,c+=1,o.push(y),s[y.id]=!0;for(var m=(0,nS.getNeighbors)(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x<m.length;x++)b(x);if(f[y.id]===u[y.id]){for(var w=[];o.length>0;){var E=o.pop();if(s[E.id]=!1,w.push(E),E===y)break}w.length>0&&l.push(w)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};lo.detectStrongConnectComponents=aS;function B8(r,e){return e?aS(r):iS(r)}var Ca={};Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.getOutDegree=Ca.getInDegree=Ca.default=void 0;var kf=function(e){var t={},n=e.nodes,i=n===void 0?[]:n,a=e.edges,o=a===void 0?[]:a;return i.forEach(function(s){t[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){t[s.source].degree++,t[s.source].outDegree++,t[s.target].degree++,t[s.target].inDegree++}),t},F8=kf;Ca.default=F8;var G8=function(e,t){var n=kf(e);return n[t]?kf(e)[t].inDegree:0};Ca.getInDegree=G8;var z8=function(e,t){var n=kf(e);return n[t]?kf(e)[t].outDegree:0};Ca.getOutDegree=z8;var ra={},Th={};Object.defineProperty(Th,"__esModule",{value:!0}),Th.default=U8;var $8=Vr;function j8(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}function oS(r,e,t,n,i){i===void 0&&(i=!0),n.enter({current:e,previous:t});var a=r.edges,o=a===void 0?[]:a;(0,$8.getNeighbors)(e,o,i?"target":void 0).forEach(function(s){n.allowTraversal({previous:t,current:e,next:s})&&oS(r,s,e,n,i)}),n.leave({current:e,previous:t})}function U8(r,e,t,n){n===void 0&&(n=!0),oS(r,e,"",j8(t),n)}function i0(r){"@babel/helpers - typeof";return i0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i0(r)}Object.defineProperty(ra,"__esModule",{value:!0}),ra.detectAllUndirectedCycle=ra.detectAllDirectedCycle=ra.detectAllCycles=ra.default=void 0;var X8=W8(Th),sS=Y8(lo),uS=Vr;function fS(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(fS=function(i){return i?t:e})(r)}function Y8(r,e){if(r&&r.__esModule)return r;if(r===null||i0(r)!=="object"&&typeof r!="function")return{default:r};var t=fS(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)){var o=i?Object.getOwnPropertyDescriptor(r,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=r[a]}return n.default=r,t&&t.set(r,n),n}function W8(r){return r&&r.__esModule?r:{default:r}}var V8=function(e){var t=null,n=e.nodes,i=n===void 0?[]:n,a={},o={},s={},u={};i.forEach(function(c){o[c.id]=c});for(var f={enter:function(h){var d=h.current,v=h.previous;if(s[d]){t={};for(var p=d,g=v;g!==d;)t[p]=g,p=g,g=a[g];t[p]=g}else s[d]=d,delete o[d],a[d]=v},leave:function(h){var d=h.current;u[d]=d,delete s[d]},allowTraversal:function(h){var d=h.next;return t?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];(0,X8.default)(e,l,f)}return t},lS=function(e,t,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=(0,sS.default)(e,!1),u=0,f=s;u<f.length;u++){var l=f[u];if(l.length)for(var c=l[0],h=c.id,d=[c],v=(i={},i[h]=c,i),p=(a={},a[h]=new Set,a);d.length>0;)for(var g=d.pop(),y=g.id,m=(0,uS.getNeighbors)(y,e.edges),b=function(E){var _,M=m[E],C=e.nodes.find(function(G){return G.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),t&&n?(S=!1,A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!0)):t&&!n&&A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!1),S){for(var k={},O=1;O<A.length;O+=1)k[A[O-1].id]=A[O];A.length&&(k[A[A.length-1].id]=A[0]),o.push(k)}p[M].add(g)}},x=0;x<m.length;x+=1)b(x)}return o};ra.detectAllUndirectedCycle=lS;var cS=function(e,t,n){n===void 0&&(n=!0);for(var i=[],a=new Set,o=[],s=[],u={},f={},l=function(T){for(var k=[T];k.length>0;){var O=k.pop();a.has(O)&&(a.delete(O),o[O.id].forEach(function(G){k.push(G)}),o[O.id].clear())}},c=function A(T,k,O){var G=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return G;i.push(T),a.add(T);for(var D=O[T.id],$=0;$<D.length;$+=1){var Y=u[D[$]];if(Y===k){for(var N={},P=1;P<i.length;P+=1)N[i[P-1].id]=i[P];i.length&&(N[i[i.length-1].id]=i[0]),s.push(N),G=!0}else a.has(Y)||A(Y,k,O)&&(G=!0)}if(G)l(T);else for(var $=0;$<D.length;$+=1){var Y=u[D[$]];o[Y.id].has(T)||o[Y.id].add(T)}return i.pop(),G},h=e.nodes,d=h===void 0?[]:h,v=0;v<d.length;v+=1){var p=d[v],g=p.id;f[g]=v,u[v]=p}if(t&&n)for(var y=function(T){var k=t[T];f[d[T].id]=f[k],f[k]=0,u[0]=d.find(function(O){return O.id===k}),u[f[d[T].id]]=d[T]},v=0;v<t.length;v++)y(v);for(var m=function(T){for(var k,O,G=1/0,D=0;D<T.length;D+=1)for(var $=T[D],Y=0;Y<$.length;Y++){var N=f[$[Y].id];N<G&&(G=N,O=D)}for(var P=T[O],W=[],D=0;D<P.length;D+=1){var J=P[D];W[J.id]=[];for(var te=0,H=(0,uS.getNeighbors)(J.id,e.edges,"target").filter(function(Ne){return P.map(function(Ze){return Ze.id}).indexOf(Ne)>-1});te<H.length;te++){var pe=H[te];pe===J.id&&!(n===!1&&t.indexOf(J.id)>-1)?s.push((k={},k[J.id]=J,k)):W[J.id].push(f[pe])}}return{component:P,adjList:W,minIdx:G}},b=0;b<d.length;){var x=d.filter(function(A){return f[A.id]>=b}),w=(0,sS.detectStrongConnectComponents)({nodes:x,edges:e.edges}).filter(function(A){return A.length>1});if(w.length===0)break;var E=m(w),_=E.minIdx,M=E.adjList,C=E.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(t&&n&&t.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s};ra.detectAllDirectedCycle=cS;var H8=function(e,t,n,i){return i===void 0&&(i=!0),t?cS(e,n,i):lS(e,n,i)};ra.detectAllCycles=H8;var q8=V8;ra.default=q8;var Js={};const hS=ea(UD),Lf=ea(t3);Object.defineProperty(Js,"__esModule",{value:!0}),Js.default=void 0;var dS=hS,Z8=Lf,vS=Vr,K8=function(e,t,n){for(var i=1/0,a,o=0;o<t.length;o++){var s=t[o].id;!n[s]&&e[s]<=i&&(i=e[s],a=t[o])}return a},Q8=function(e,t,n,i){var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var x=m.id;l[x]=1/0,x===t&&(l[x]=0)});for(var h=o.length,d=function(b){var x=K8(l,o,f),w=x.id;if(f[w]=!0,l[w]===1/0)return"continue";var E=[];n?E=(0,vS.getOutEdgesNodeId)(w,u):E=(0,vS.getEdgesByNodeId)(w,u),E.forEach(function(_){var M=_.target,C=_.source,S=M===w?C:M,A=i&&_[i]?_[i]:1;l[S]>l[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.id)})},v=0;v<h;v++)d();c[t]=[t];var p={};for(var g in l)l[g]!==1/0&&pS(t,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}},J8=Q8;Js.default=J8;function pS(r,e,t,n){if(r===e)return[r];if(n[e])return n[e];for(var i=[],a=0,o=t[e];a<o.length;a++){var s=o[a],u=pS(r,s,t,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];(0,Z8.isArray)(c)?i.push((0,dS.__spreadArray)((0,dS.__spreadArray)([],c,!0),[e],!1)):i.push([c,e])}}return n[e]=i,n[e]}var eu={};Object.defineProperty(eu,"__esModule",{value:!0}),eu.findShortestPath=eu.findAllPath=void 0;var e$=t$(Js),Ih=Vr;function t$(r){return r&&r.__esModule?r:{default:r}}var r$=function(e,t,n,i,a){var o=(0,e$.default)(e,t,i,a),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}};eu.findShortestPath=r$;var n$=function(e,t,n,i){var a;if(t===n)return[[t]];var o=e.edges,s=o===void 0?[]:o,u=[t],f=(a={},a[t]=!0,a),l=[],c=[],h=i?(0,Ih.getNeighbors)(t,s,"target"):(0,Ih.getNeighbors)(t,s);for(l.push(h);u.length>0&&l.length>0;){var d=l[l.length-1];if(d.length){var v=d.shift();v&&(u.push(v),f[v]=!0,h=i?(0,Ih.getNeighbors)(v,s,"target"):(0,Ih.getNeighbors)(v,s),l.push(h.filter(function(y){return!f[y]})))}else{var p=u.pop();f[p]=!1,l.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});c.push(g);var p=u.pop();f[p]=!1,l.pop()}}return c};eu.findAllPath=n$;var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.default=void 0;var i$=a$(Ho);function a$(r){return r&&r.__esModule?r:{default:r}}var o$=function(e,t){for(var n=(0,i$.default)(e,t),i=[],a=n.length,o=0;o<a;o+=1){i[o]=[];for(var s=0;s<a;s+=1)o===s?i[o][s]=0:n[o][s]===0||!n[o][s]?i[o][s]=1/0:i[o][s]=n[o][s]}for(var u=0;u<a;u+=1)for(var o=0;o<a;o+=1)for(var s=0;s<a;s+=1)i[o][s]>i[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},s$=o$;Nf.default=s$;var kh={};Object.defineProperty(kh,"__esModule",{value:!0}),kh.default=void 0;var u$=l$(Ho),f$=Vr;function l$(r){return r&&r.__esModule?r:{default:r}}var c$=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var w=(0,f$.uniqueId)();b.clusterId=w,f[w]={id:w,nodes:[b]},l[b.id]={node:b,idx:x}});var c=(0,u$.default)(e,t),h={};c.forEach(function(b,x){var w=o[x].id;h[w]={},b.forEach(function(E,_){if(E){var M=o[_].id;h[w][M]=E}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(w){var E={};Object.keys(h[w.id]).forEach(function(O){var G=h[w.id][O],D=l[O].node,$=D.clusterId;E[$]||(E[$]=0),E[$]+=G});var _=-1/0,M=[];if(Object.keys(E).forEach(function(O){_<E[O]?(_=E[O],M=[O]):_===E[O]&&M.push(O)}),!(M.length===1&&M[0]===w.clusterId)){var C=M.indexOf(w.clusterId);if(C>=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[w.clusterId],A=S.nodes.indexOf(w);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),k=f[M[T]];k.nodes.push(w),w.clusterId=k.id}}}),!x)return"break";d++};d<i;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var x=f[b];(!x.nodes||!x.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var x=b.source,w=b.target,E=b[n]||1,_=l[x].node.clusterId,M=l[w].node.clusterId,C="".concat(_,"---").concat(M);if(y[C])y[C].weight+=E,y[C].count++;else{var S={source:_,target:M,weight:E,count:1};y[C]=S,g.push(S)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},h$=c$;kh.default=h$;var Lh={},Of={};Object.defineProperty(Of,"__esModule",{value:!0}),Of.default=void 0;var d$=Lf,v$=function(){function r(e){this.arr=e}return r.prototype.getArr=function(){return this.arr||[]},r.prototype.add=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]+n[a];return new r(i)}},r.prototype.subtract=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]-n[a];return new r(i)}},r.prototype.avg=function(e){var t=[];if(e!==0)for(var n in this.arr)t[n]=this.arr[n]/e;return new r(t)},r.prototype.negate=function(){var e=[];for(var t in this.arr)e[t]=-this.arr[t];return new r(e)},r.prototype.squareEuclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return i}},r.prototype.euclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return Math.sqrt(i)}else console.error("The two vectors are unequal in length.")},r.prototype.normalize=function(){var e=[],t=(0,d$.clone)(this.arr);t.sort(function(o,s){return o-s});var n=t[t.length-1],i=t[0];for(var a in this.arr)e[a]=(this.arr[a]-i)/(n-i);return new r(e)},r.prototype.norm2=function(){var e;if(!(!((e=this.arr)===null||e===void 0)&&e.length))return 0;var t=0;for(var n in this.arr)t+=Math.pow(this.arr[n],2);return Math.sqrt(t)},r.prototype.dot=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=this.arr[a]*e.arr[a];return i}else console.error("The two vectors are unequal in length.")},r.prototype.equal=function(e){var t,n=e.arr;if(((t=this.arr)===null||t===void 0?void 0:t.length)!==(n==null?void 0:n.length))return!1;for(var i in this.arr)if(this.arr[i]!==n[i])return!1;return!0},r}(),p$=v$;Of.default=p$;var na={},tu={};Object.defineProperty(tu,"__esModule",{value:!0}),tu.secondReg=tu.dateReg=void 0;var g$=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;tu.secondReg=g$;var y$=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;tu.dateReg=y$,Object.defineProperty(na,"__esModule",{value:!0}),na.getPropertyWeight=na.getAllSortProperties=na.getAllProperties=na.default=void 0;var gS=tu,a0=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=100);var n={};e.forEach(function(a){a.properties&&Object.keys(a.properties).forEach(function(o){if(o==="id"||!"".concat(a.properties[o]).match(gS.secondReg)&&!"".concat(a.properties[o]).match(gS.dateReg)&&isNaN(Number(a.properties[o]))){n.hasOwnProperty(o)&&delete n[o];return}n.hasOwnProperty(o)?n[o]+=1:n[o]=1})});var i=Object.keys(n).sort(function(a,o){return n[o]-n[a]});return i.length<t?i:i.slice(0,t)};na.getAllSortProperties=a0;var m$=function(e,t){return t.map(function(n){return e.hasOwnProperty(n)?e[n]:0})},yS=function(e){for(var t=a0(e),n=[],i=0;i<e.length;i++)n[i]=m$(e[i].properties,t);return n};na.getPropertyWeight=yS;var mS=function(e,t){t===void 0&&(t=void 0);var n=[];return e.forEach(function(i){t===void 0&&n.push(i),i[t]!==void 0&&n.push(i[t])}),n};na.getAllProperties=mS;var b$={getAllSortProperties:a0,getPropertyWeight:yS,getAllProperties:mS};na.default=b$;var ia={},Df={};Object.defineProperty(Df,"__esModule",{value:!0}),Df.DistanceType=void 0;var o0;Df.DistanceType=o0,function(r){r.EuclideanDistance="euclideanDistance"}(o0||(Df.DistanceType=o0={})),Object.defineProperty(ia,"__esModule",{value:!0}),ia.oneHot=ia.getDistance=ia.getAllKeyValueMap=ia.default=void 0;var bS=Lf,xS=Df,wS=x$(Of);function x$(r){return r&&r.__esModule?r:{default:r}}var s0=function(e,t,n){var i=[];t!=null&&t.length?i=t:(e.forEach(function(o){i=i.concat(Object.keys(o))}),i=(0,bS.uniq)(i));var a={};return i.forEach(function(o){var s=[];e.forEach(function(u){u[o]!==void 0&&u[o]!==""&&s.push(u[o])}),s.length&&!(n!=null&&n.includes(o))&&(a[o]=(0,bS.uniq)(s))}),a};ia.getAllKeyValueMap=s0;var ES=function(e,t,n){var i=s0(e,t,n),a=[];if(!Object.keys(i).length)return a;var o=Object.values(i),s=o.every(function(u){return u.every(function(f){return typeof f=="number"})});return e.forEach(function(u,f){var l=[];Object.keys(i).forEach(function(c){var h=u[c],d=i[c],v=d.findIndex(function(y){return h===y}),p=[];if(s)p.push(h);else for(var g=0;g<d.length;g++)g===v?p.push(1):p.push(0);l=l.concat(p)}),a[f]=l}),a};ia.oneHot=ES;var _S=function(e,t,n,i){n===void 0&&(n=xS.DistanceType.EuclideanDistance);var a=0;switch(n){case xS.DistanceType.EuclideanDistance:a=new wS.default(e).euclideanDistance(new wS.default(t));break}return a};ia.getDistance=_S;var w$={getAllKeyValueMap:s0,oneHot:ES,getDistance:_S};ia.default=w$,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.default=void 0;var E$=Lf,_$=SS(Ho),Pf=SS(Of),S$=na,M$=ia;function SS(r){return r&&r.__esModule?r:{default:r}}var MS=function(e,t,n,i){for(var a=t.length,o=2*i,s=0,u=0;u<a;u++)for(var f=e[u].clusterId,l=0;l<a;l++){var c=e[l].clusterId;if(f===c){var h=t[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},u0=function(e,t){e===void 0&&(e=[]);for(var n=e.length,i=new Pf.default([]),a=0;a<n;a++)i=i.add(new Pf.default(t[a]));var o=i.avg(n);o.normalize();for(var s=0,a=0;a<n;a++){var u=new Pf.default(t[a]),f=u.squareEuclideanDistance(o);s+=f}var l=[];e.forEach(function(){l.push([])});for(var a=0;a<n;a++){var u=new Pf.default(t[a]);e[a].clusterInertial=0;for(var c=0;c<n;c++){if(a===c){l[a][c]=0;continue}var h=new Pf.default(t[c]);l[a][c]=u.squareEuclideanDistance(h),e[a].clusterInertial+=l[a][c]}}for(var d=0,v=2*n*s,a=0;a<n;a++)for(var p=e[a].clusterId,c=0;c<n;c++){var g=e[c].clusterId;if(!(a===c||p!==g)){var y=e[a].clusterInertial*e[c].clusterInertial/Math.pow(v,2)-l[a][c]/v;d+=y}}return Number(d.toFixed(4))},C$=function(e,t,n,i,a,o,s,u,f){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=!1),o===void 0&&(o=void 0),s===void 0&&(s=[]),u===void 0&&(u=["id"]),f===void 0&&(f=1);var l=e.nodes,c=l===void 0?[]:l,h=e.edges,d=h===void 0?[]:h,v=[];if(a){c.forEach(function(N,P){N.properties=N.properties||{},N.originIndex=P});var p=[];c.every(function(N){return N.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(N){return N.nodeType}))),c.forEach(function(N){N.properties.nodeType=p.findIndex(function(P){return P===N.nodeType})}));var g=(0,S$.getAllProperties)(c,o);v=(0,M$.oneHot)(g,s,u)}var y=1,m={},b={};c.forEach(function(N,P){var W=String(y++);N.clusterId=W,m[W]={id:W,nodes:[N]},b[N.id]={node:N,idx:P}});var x=(0,_$.default)(e,t),w=[],E={},_=0;x.forEach(function(N,P){var W=0,J=c[P].id;E[J]={},N.forEach(function(te,H){if(te){W+=te;var pe=c[H].id;E[J][pe]=te,_+=te}}),w.push(W)}),_/=2;for(var M=1/0,C=1/0,S=0,A=[],T={};;){a&&c.every(function(N){return N.hasOwnProperty("properties")})?M=MS(c,x,w,_)+u0(c,v)*f:M=MS(c,x,w,_),S===0&&(C=M,A=c,T=m);var k=M>0&&M>C&&M-C<i;if(M>C&&(A=c.map(function(N){return{node:N,clusterId:N.clusterId}}),T=(0,E$.clone)(m),C=M),k||S>100)break;S++,Object.keys(m).forEach(function(N){var P=0;d.forEach(function(W){var J=W.source,te=W.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===N&&pe!==N||pe===N&&H!==N)&&(P=P+(W[n]||1))}),m[N].sumTot=P}),c.forEach(function(N,P){var W=m[N.clusterId],J=0,te,H=w[P]/(2*_),pe=0,Te=W.nodes;Te.forEach(function(Wt){var dr=b[Wt.id].idx;pe+=x[P][dr]||0});var Ne=pe-W.sumTot*H,Ze=Te.filter(function(Wt){return Wt.id!==N.id});Ze.forEach(function(Wt,dr){v[Wt.originIndex]});var at=u0(Ze,v)*f,nt=E[N.id];if(Object.keys(nt).forEach(function(Wt){var dr=b[Wt].node,lr=dr.clusterId;if(lr!==N.clusterId){var Ut=m[lr],ar=Ut.nodes;if(!(!ar||!ar.length)){var Zr=0;ar.forEach(function(Ge){var me=b[Ge.id].idx;Zr+=x[P][me]||0});var tt=Zr-Ut.sumTot*H,ae=ar.concat([N]);ae.forEach(function(Ge,me){v[Ge.originIndex]});var L=u0(ae,v)*f,Se=tt-Ne;a&&(Se=tt+L-(Ne+at)),Se>J&&(J=Se,te=Ut)}}}),J>0){te.nodes.push(N);var St=N.clusterId;N.clusterId=te.id;var Mt=W.nodes.indexOf(N);W.nodes.splice(Mt,1);var fr=0,Ft=0;d.forEach(function(Wt){var dr=Wt.source,lr=Wt.target,Ut=b[dr].node.clusterId,ar=b[lr].node.clusterId;(Ut===te.id&&ar!==te.id||ar===te.id&&Ut!==te.id)&&(fr=fr+(Wt[n]||1)),(Ut===St&&ar!==St||ar===St&&Ut!==St)&&(Ft=Ft+(Wt[n]||1))}),te.sumTot=fr,W.sumTot=Ft}})}var O={},G=0;Object.keys(T).forEach(function(N){var P=T[N];if(!P.nodes||!P.nodes.length){delete T[N];return}var W=String(G+1);W!==N&&(P.id=W,P.nodes=P.nodes.map(function(J){return{id:J.id,clusterId:W}}),T[W]=P,O[N]=W,delete T[N],G++)}),A.forEach(function(N){var P=N.node,W=N.clusterId;P&&(P.clusterId=W,P.clusterId&&O[P.clusterId]&&(P.clusterId=O[P.clusterId]))});var D=[],$={};d.forEach(function(N){var P=N.source,W=N.target,J=N[n]||1,te=b[P].node.clusterId,H=b[W].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if($[pe])$[pe].weight+=J,$[pe].count++;else{var Te={source:te,target:H,weight:J,count:1};$[pe]=Te,D.push(Te)}}});var Y=[];return Object.keys(T).forEach(function(N){Y.push(T[N])}),{clusters:Y,clusterEdges:D}},A$=C$;Lh.default=A$;var Nh={},Oh={};Object.defineProperty(Oh,"__esModule",{value:!0}),Oh.default=void 0;var T$=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t<n.length;t++){var i=n[t];this.parent[i]=i}}return r.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},r.prototype.union=function(e,t){var n=this.find(e),i=this.find(t);n!==i&&(n<i?(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]))},r.prototype.connected=function(e,t){return this.find(e)===this.find(t)},r}(),I$=T$;Oh.default=I$;var Dh={};Object.defineProperty(Dh,"__esModule",{value:!0}),Dh.default=void 0;var k$=function(e,t){return e-t},L$=function(){function r(e){e===void 0&&(e=k$),this.compareFn=e,this.list=[]}return r.prototype.getLeft=function(e){return 2*e+1},r.prototype.getRight=function(e){return 2*e+2},r.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},r.prototype.isEmpty=function(){return this.list.length<=0},r.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},r.prototype.delMin=function(){var e=this.top(),t=this.list.pop();return this.list.length>0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0?n=i:a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),N$=L$;Dh.default=N$,Object.defineProperty(Nh,"__esModule",{value:!0}),Nh.default=void 0;var O$=CS(Oh),D$=CS(Dh),f0=Vr;function CS(r){return r&&r.__esModule?r:{default:r}}var P$=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],f=new Set;f.add(u);var l=function(g,y){return t?g.weight-y.weight:0},c=new D$.default(l);for((0,f0.getEdgesByNodeId)(u.id,s).forEach(function(p){c.insert(p)});!c.isEmpty();){var h=c.delMin(),d=h.source,v=h.target;f.has(d)&&f.has(v)||(n.push(h),f.has(d)||(f.add(d),(0,f0.getEdgesByNodeId)(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),(0,f0.getEdgesByNodeId)(v,s).forEach(function(p){c.insert(p)})))}return n},AS=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});t&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new O$.default(a.map(function(d){return d.id}));u.length>0;){var l=u.shift(),c=l.source,h=l.target;f.connected(c,h)||(n.push(l),f.union(c,h))}return n},R$=function(e,t,n){var i={prim:P$,kruskal:AS};return n?i[n](e,t):AS(e,t)},B$=R$;Nh.default=B$;var Ph={};Object.defineProperty(Ph,"__esModule",{value:!0}),Ph.default=void 0;var F$=z$(Ca),G$=Vr;function z$(r){return r&&r.__esModule?r:{default:r}}var $$=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c=u.length,h,d={},v={},p=0;p<c;++p){var g=u[p],y=g.id;d[y]=1/c,v[y]=1/c}for(var m=(0,F$.default)(e);o>0&&i>t;){a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;if(h=0,m[g.id].inDegree===0)d[y]=0;else{for(var b=(0,G$.getNeighbors)(y,l,"source"),x=0;x<b.length;++x){var w=b[x],E=m[w].outDegree;E>0&&(h+=v[w]/E)}d[y]=n*h,a+=d[y]}}a=(1-a)/c,i=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;h=d[y]+a,i+=Math.abs(h-v[y]),v[y]=h}o-=1}return v},j$=$$;Ph.default=j$;var Rh={},Bh={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.VACANT_NODE_LABEL=Hr.VACANT_NODE_ID=Hr.VACANT_GRAPH_ID=Hr.VACANT_EDGE_LABEL=Hr.VACANT_EDGE_ID=Hr.Node=Hr.Graph=Hr.Edge=Hr.AUTO_EDGE_ID=void 0;var TS=-1;Hr.VACANT_EDGE_ID=TS;var Rf=-1;Hr.VACANT_NODE_ID=Rf;var IS="-1";Hr.VACANT_EDGE_LABEL=IS;var kS="-1";Hr.VACANT_NODE_LABEL=kS;var U$=-1;Hr.VACANT_GRAPH_ID=U$;var X$="-1";Hr.AUTO_EDGE_ID=X$;var l0=function(){function r(e,t,n,i){e===void 0&&(e=TS),t===void 0&&(t=Rf),n===void 0&&(n=Rf),i===void 0&&(i=IS),this.id=e,this.from=t,this.to=n,this.label=i}return r}();Hr.Edge=l0;var LS=function(){function r(e,t){e===void 0&&(e=Rf),t===void 0&&(t=kS),this.id=e,this.label=t,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},r}();Hr.Node=LS;var Y$=function(){function r(e,t,n){e===void 0&&(e=Rf),t===void 0&&(t=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=t,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return r.prototype.getNodeNum=function(){return this.nodes.length},r.prototype.addNode=function(e,t){if(!this.nodeMap[e]){var n=new LS(e,t);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[t]||(this.nodeLabelMap[t]=[]),this.nodeLabelMap[t].push(e)}},r.prototype.addEdge=function(e,t,n,i){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[t]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var a=new l0(e,t,n,i);if(this.edges.push(a),this.edgeMap[e]=a,this.nodeMap[t].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new l0(e,n,t,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}();Hr.Graph=Y$,Object.defineProperty(Bh,"__esModule",{value:!0}),Bh.default=void 0;var W$=Lf,Pn=Hr,qo=function(){function r(e,t,n,i,a){this.fromNode=e,this.toNode=t,this.nodeEdgeNodeLabel={nodeLabel1:n||Pn.VACANT_NODE_LABEL,edgeLabel:i||Pn.VACANT_EDGE_LABEL,nodeLabel2:a||Pn.VACANT_NODE_LABEL}}return r.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r}(),NS=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(e){var t=this.dfsEdgeList.length,n=e.length;if(t!==n)return!1;for(var i=0;i<t;i++)if(this.dfsEdgeList[i]!==e[i])return!1;return!0},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r.prototype.pushBack=function(e,t,n,i,a){return this.dfsEdgeList.push(new qo(e,t,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(e,t){e===void 0&&(e=Pn.VACANT_GRAPH_ID),t===void 0&&(t=!1);var n=new Pn.Graph(e,!0,t);return this.dfsEdgeList.forEach(function(i){var a=i.fromNode,o=i.toNode,s=i.nodeEdgeNodeLabel,u=s.nodeLabel1,f=s.edgeLabel,l=s.nodeLabel2;u!==Pn.VACANT_NODE_LABEL&&n.addNode(a,u),l!==Pn.VACANT_NODE_LABEL&&n.addNode(o,l),u!==Pn.VACANT_NODE_LABEL&&l!==u&&n.addEdge(void 0,a,o,f)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,t=this.dfsEdgeList.length,n=t-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=a)}return this.rmpath},r.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(t){e[t.fromNode]||(e[t.fromNode]=!0),e[t.toNode]||(e[t.toNode]=!0)}),Object.keys(e).length},r}(),Fh=function(){function r(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var t=e.edge;this.edges.push(t),this.nodesUsed[t.from]=1,this.nodesUsed[t.to]=1,this.edgesUsed[t.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},r.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},r}(),V$=function(){function r(e){var t=e.graphs,n=e.minSupport,i=n===void 0?2:n,a=e.minNodeNum,o=a===void 0?1:a,s=e.maxNodeNum,u=s===void 0?4:s,f=e.top,l=f===void 0?10:f,c=e.directed,h=c===void 0?!1:c,d=e.verbose,v=d===void 0?!1:d;this.graphs=t,this.dfsCode=new NS,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=i,this.top=l,this.directed=h,this.counter=0,this.maxNodeNum=u,this.minNodeNum=o,this.verbose=v,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return r.prototype.findForwardRootEdges=function(e,t){var n=this,i=[],a=e.nodeMap;return t.edges.forEach(function(o){(n.directed||t.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(e,t,n,i){if(!this.directed&&t===n)return null;for(var a=e.nodeMap,o=a[n.to],s=o.edges,u=s.length,f=0;f<u;f++){var l=s[f];if(!(i.hasEdge(l)||l.to!==t.from)){if(this.directed){if(a[t.from].label<a[n.to].label||a[t.from].label===a[n.to].label&&t.label<=l.label)return l}else if(t.label<l.label||t.label===l.label&&a[t.to].label<=a[n.to].label)return l}}return null},r.prototype.findForwardPureEdges=function(e,t,n,i){for(var a=[],o=t.to,s=e.nodeMap[o].edges,u=s.length,f=0;f<u;f++){var l=s[f],c=e.nodeMap[l.to];n<=c.label&&!i.hasNode(c)&&a.push(l)}return a},r.prototype.findForwardRmpathEdges=function(e,t,n,i){for(var a=[],o=e.nodeMap,s=o[t.to].label,u=o[t.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;t.to===h.to||n>d||i.hasNode(o[h.to])||(t.label<h.label||t.label===h.label&&s<=d)&&a.push(h)}return a},r.prototype.getSupport=function(e){var t={};return e.forEach(function(n){t[n.graphId]||(t[n.graphId]=!0)}),Object.keys(t).length},r.prototype.findMinLabel=function(e){var t=void 0;return Object.keys(e).forEach(function(n){var i=e[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!t){t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<t.nodeLabel1||a===t.nodeLabel1&&o<t.edgeLabel||a===t.nodeLabel1&&o===t.edgeLabel&&s<t.nodeLabel2)&&(t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),t},r.prototype.isMin=function(){var e=this,t=this.dfsCode;if(this.verbose&&console.log("isMin checking",t),t.dfsEdgeList.length===1)return!0;var n=this.directed,i=t.toGraph(Pn.VACANT_GRAPH_ID,n),a=i.nodeMap,o=new NS,s={};i.nodes.forEach(function(c){var h=e.findForwardRootEdges(i,c);h.forEach(function(d){var v=a[d.to],p="".concat(c.label,"-").concat(d.label,"-").concat(v.label);s[p]||(s[p]={projected:[],nodeLabel1:c.label,edgeLabel:d.label,nodeLabel2:v.label});var g={graphId:i.id,edge:d,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(u){o.dfsEdgeList.push(new qo(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var f=function c(h){for(var d=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[d[0]].toNode,g={},y=!1,m=0,b=n?-1:0,x=function($){if(y)return"break";h.forEach(function(Y){var N=new Fh(Y),P=e.findBackwardEdge(i,N.edges[d[$]],N.edges[d[0]],N);P&&(g[P.label]||(g[P.label]={projected:[],edgeLabel:P.label}),g[P.label].projected.push({graphId:i.id,edge:g,preNode:Y}),m=o.dfsEdgeList[d[$]].fromNode,y=!0)})},w=d.length-1;w>b;w--){var E=x(w);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new qo(p,m,Pn.VACANT_NODE_LABEL,_.edgeLabel,Pn.VACANT_NODE_LABEL));var M=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(D){var $=new Fh(D),Y=e.findForwardPureEdges(i,$.edges[d[0]],v,$);Y.length>0&&(y=!0,S=p,Y.forEach(function(N){var P="".concat(N.label,"-").concat(a[N.to].label);C[P]||(C[P]={projected:[],edgeLabel:N.label,nodeLabel2:a[N.to].label}),C[P].projected.push({graphId:i.id,edge:N,preNode:D})}))});for(var A=d.length,T=function($){if(y)return"break";var Y=d[$];h.forEach(function(N){var P=new Fh(N),W=e.findForwardRmpathEdges(i,P.edges[Y],v,P);W.length>0&&(y=!0,S=o.dfsEdgeList[Y].fromNode,W.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:N})}))})},w=0;w<A;w++){var k=T(w);if(k==="break")break}if(!y)return!0;var O=e.findMinLabel(C);o.dfsEdgeList.push(new qo(S,p+1,Pn.VACANT_NODE_LABEL,O.edgeLabel,O.nodeLabel2));var G=o.dfsEdgeList.length-1;return t.dfsEdgeList[G]!==o.dfsEdgeList[G]?!1:c(C["".concat(O.edgeLabel,"-").concat(O.nodeLabel2)].projected)},l="".concat(u.nodeLabel1,"-").concat(u.edgeLabel,"-").concat(u.nodeLabel2);return f(s[l].projected)}},r.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,W$.clone)(e))}},r.prototype.subGraphMining=function(e){var t=this,n=this.getSupport(e);if(!(n<this.minSupport)&&this.isMin()){this.report();var i=this.dfsCode.getNodeNum(),a=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[a[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},f={};e.forEach(function(l){for(var c=t.graphs[l.graphId],h=c.nodeMap,d=new Fh(l),v=a.length-1;v>=0;v--){var p=t.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(t.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var w=t.findForwardRmpathEdges(c,d.edges[a[x]],s,d);w.forEach(function(E){var _="".concat(t.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[x]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;v<a.length;v++)m(v)}}),Object.keys(f).forEach(function(l){var c=f[l],h=c.toNodeId,d=c.edgeLabel;t.dfsCode.dfsEdgeList.push(new qo(o,h,"-1",d,"-1")),t.subGraphMining(f[l].projected),t.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;t.dfsCode.dfsEdgeList.push(new qo(h,o+1,Pn.VACANT_NODE_LABEL,d,v)),t.subGraphMining(u[l].projected),t.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,t=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={};return Object.keys(e).forEach(function(u){var f=e[u],l=f.nodeMap;f.nodes.forEach(function(c,h){var d=c.label,v="".concat(u,"-").concat(d);if(!s[v]){var p=a[d]||0;p++,a[d]=p}s[v]={graphKey:u,label:d},c.edges.forEach(function(g){var y=d,m=l[g.to].label;if(!t&&y>m){var b=m;m=y,y=b}var x=g.label,w="".concat(y,"-").concat(x,"-").concat(m);if(!o[w]){var E=o[w]||0;E++,o[w]=E}})})}),Object.keys(a).forEach(function(u){var f=a[u];if(!(f<n)){var l={nodes:[],edges:[]};l.nodes.push({id:"0",label:u}),i.push(l)}}),i},r.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var t=this.graphs;this.directed;var n={};Object.keys(t).forEach(function(i){var a=t[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=e.findForwardRootEdges(a,s);u.forEach(function(f){var l=o[f.to],c="".concat(s.label,"-").concat(f.label,"-").concat(l.label);n[c]||(n[c]={projected:[],nodeLabel1:s.label,edgeLabel:f.label,nodeLabel2:l.label});var h={graphId:i,edge:f,preNode:null};n[c].projected.push(h)})})}),Object.keys(n).forEach(function(i){var a=n[i],o=a.projected,s=a.nodeLabel1,u=a.edgeLabel,f=a.nodeLabel2;e.dfsCode.dfsEdgeList.push(new qo(0,1,s,u,f)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},r}(),H$=function(e,t,n,i){var a={};return Object.keys(e).forEach(function(o,s){var u=e[o],f=new Pn.Graph(s,!0,t),l={};u.nodes.forEach(function(c,h){f.addNode(h,c[n]),l[c.id]=h}),u.edges.forEach(function(c,h){var d=l[c.source],v=l[c.target];f.addEdge(-1,d,v,c[i])}),f&&f.getNodeNum()&&(a[f.id]=f)}),a},q$=function(e,t,n){var i=[];return e.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[t]=s.label,u))}),a.edges.forEach(function(s){var u;o.edges.push((u={source:"".concat(s.from),target:"".concat(s.to)},u[n]=s.label,u))}),i.push(o)}),i},OS="cluster",Z$=function(e){var t=e.graphs,n=e.directed,i=n===void 0?!1:n,a=e.nodeLabelProp,o=a===void 0?OS:a,s=e.edgeLabelProp,u=s===void 0?OS:s,f=H$(t,i,o,u),l=e.minSupport,c=e.maxNodeNum,h=e.minNodeNum,d=e.verbose,v=e.top,p={graphs:f,minSupport:l,maxNodeNum:c,minNodeNum:h,top:v,verbose:d,directed:i},g=new V$(p);g.run();var y=q$(g.frequentSubgraphs,o,u);return y},K$=Z$;Bh.default=K$,Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.default=void 0;var DS=hS,PS=c0(Nf),Q$=c0(Bh),RS=c0(Js),J$=Vr;function c0(r){return r&&r.__esModule?r:{default:r}}var BS=function(e,t,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=e.nodes;return t.forEach(function(s,u){a.push(FS(o,s,u,n,i))}),a},FS=function(e,t,n,i,a){var o=[n],s=[],u={};return t.forEach(function(f,l){if(f<=a&&n!==l){o.push(l),s.push(e[l]);var c=e[l][i];u[c]?(u[c].count++,u[c].dists.push(f)):u[c]={count:1,dists:[f]}}}),Object.keys(u).forEach(function(f){u[f].dists=u[f].dists.sort(function(l,c){return l-c})}),{nodeIdx:n,nodeId:e[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},ej=function(e,t,n,i,a){var o=Math.ceil(n/t),s={},u=0;return i.forEach(function(f,l){for(var c=0,h=0,d=f.nodeIdxs,v=f.neighborNum-1;c<o;){for(var p=d[1+Math.floor(Math.random()*v)],g=0;(s["".concat(l,"-").concat(p)]||s["".concat(p,"-").concat(l)])&&(p=Math.floor(Math.random()*t),g++,!(g>2*t)););if(g<2*t&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*t)break}if(c<o){var y=o-c;o=(o+y)/(t-l-1)}}),s},Gh=function(e,t,n,i){var a=n.nodes;return i||(i={}),Object.keys(e).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var f=e[o],l=(s=t[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=t[f.end])===null||u===void 0?void 0:u.nodeIdxs;if(!(!l||!c)){var h=new Set(c),d=l.filter(function(m){return h.has(m)});if(!(!d||!d.length)){for(var v={},p=d.length,g=0;g<p;g++){var y=a[d[g]];i[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&i[o].edges.push(m)})}}}}),i},zh=function(e,t,n,i){var a,o,s={};e.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((a=t==null?void 0:t.edges)===null||a===void 0)&&a.length)||((o=t==null?void 0:t.nodes)===null||o===void 0?void 0:o.length)<2?0:(e.edges.forEach(function(f){var l=s[f.source][n],c=s[f.target][n],h=t==null?void 0:t.nodes[0][n],d=t==null?void 0:t.nodes[1][n],v=t==null?void 0:t.edges[0][i];f[i]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},tj=function(e,t,n){for(var i=1/0,a=0,o=function(f){var l=e[f],c=Object.keys(l).sort(function(m,b){return l[m]-l[b]}),h=10,d=[];c.forEach(function(m,b){d[b%h]||(d[b%h]={graphs:[],totalCount:0,aveCount:0}),d[b%h].graphs.push(m),d[b%h].totalCount+=l[m]});var v=0,p=[];d.forEach(function(m){var b=m.totalCount/m.graphs.length;m.aveCount=b,p.push(b);var x=0,w=m.length;m.graphs.forEach(function(E,_){var M=l[E];m.graphs.forEach(function(C,S){_!==S&&(x+=Math.abs(M-l[C]))})}),x/=w*(w-1)/2,v+=x}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(x,w){b!==w&&(g+=Math.abs(m-x))}),g/=p.length*(p.length-1)/2});var y=g-v;i<y&&(i=y,a=f)},s=0;s<t;s++)o(s);return{structure:n[a],structureCountMap:e[a]}},GS=function(e,t){var n={},i={};return e.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[t];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},zS=function(e,t,n){var i={},a={};return e.forEach(function(o,s){i["".concat(J$.uniqueId)]={idx:s,edge:o};var u=o[t];a[u]||(a[u]=[]),a[u].push(o);var f=n[o.source];f&&(f.degree++,f.outDegree++);var l=n[o.target];l&&(l.degree++,l.inDegree++)}),{edgeMap:i,edgeLabelMap:a}},$S=function(e,t,n){var i=t.length,a={};return t.forEach(function(o,s){for(var u=n?0:s+1,f=e[s].id,l=u;l<i;l++)if(s!==l){var c=e[l].id,h=o[l];a["".concat(f,"-").concat(c)]=h,n||(a["".concat(c,"-").concat(f)]=h)}}),a},rj=function(e,t,n,i,a,o,s,u,f,l,c){var h,d="".concat(t.id,"-").concat(n.id);if(l&&l[d])return l[d];var v=c?c[d]:void 0;if(!v){var p=(h={},h[d]={start:i[t.id].idx,end:i[n.id].idx,distance:a},h);c=Gh(p,o,e,c),v=c[d]}return zh(v,s,u,f)},jS=function(e,t,n,i){var a,o,s,u=(a=e[t])===null||a===void 0?void 0:a.degree,f=(o=e[t])===null||o===void 0?void 0:o.inDegree,l=(s=e[t])===null||s===void 0?void 0:s.outDegree;return e[t]===void 0&&(u=1/0,f=1/0,l=1/0,i[t].forEach(function(c){var h=n[c.id].degree;u>h&&(u=h);var d=n[c.id].inDegree;f>d&&(f=d);var v=n[c.id].outDegree;l>v&&(l=v)}),e[t]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},nj=function(e,t,n,i,a,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var f=e.nodes.length;if(f){var l=(0,PS.default)(e,n),c=(0,PS.default)(t,n),h=$S(e.nodes,l,n),d=$S(t.nodes,c,n),v=GS(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=GS(t.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;zS(e.edges,s,p);var x=zS(t.edges,s,m).edgeLabelMap,w=[];c==null||c.forEach(function(tt){w=w.concat(tt)}),a||(a=Math.max.apply(Math,(0,DS.__spreadArray)((0,DS.__spreadArray)([],w,!1),[2],!1))),i||(i=a);var E=BS(e,l,o,i),_=BS(t,c,o,i),M=Math.min(100,f*(f-1)/2),C=ej(i,f,M,E,l),S=Gh(C,E,e),A=10,T=1,k=1,O=4,G={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:k,maxNodeNum:O,directed:n},D=(0,Q$.default)(G).slice(0,A),$=D.length,Y=[];D.forEach(function(tt,ae){Y[ae]={},Object.keys(S).forEach(function(L){var Se=S[L],Ge=zh(Se,tt,o,s);Y[ae][L]=Ge})});var N=tj(Y,$,D),P=N.structure,W=N.structureCountMap,J=t.nodes[0],te=[],H=(u=t.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;t.nodes.forEach(function(tt){var ae=tt[o],L=g[ae];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ae,J=tt)});var Te={},Ne={},Ze={},at={},nt={},St={};Object.keys(b).forEach(function(tt,ae){nt[tt]=[],n&&(St[tt]=[]);var L=b[tt],Se={};L.forEach(function(qe){var et=d["".concat(J.id,"-").concat(qe.id)];if(et&&nt[tt].push(et),Se["".concat(J.id,"-").concat(qe.id)]={start:0,end:m[qe.id].idx,distance:et},n){var yt=d["".concat(qe.id,"-").concat(J.id)];yt&&St[tt].push(yt)}}),nt[tt]=nt[tt].sort(function(qe,et){return qe-et}),n&&(St[tt]=St[tt].sort(function(qe,et){return qe-et})),Ne=Gh(Se,_,t,Ne);var Ge=[];if(Object.keys(Se).forEach(function(qe){if(Ze[qe]){Ge.push(Ze[qe]);return}var et=Ne[qe];Ze[qe]=zh(et,P,o,s),Ge.push(Ze[qe])}),Ge=Ge.sort(function(qe,et){return et-qe}),at["".concat(J.id,"-").concat(tt)]=Ge,tt!==H)for(var me=(te==null?void 0:te.length)||0,Ye=function(et){var yt=te[et],Pt=E[p[yt.id].idx],cr=Pt.nodeLabelCountMap[tt],Rt=b[tt].length;if(!cr||cr.count<Rt)return te.splice(et,1),"continue";for(var hr=!1,ur=0;ur<Rt;ur++)if(cr.dists[ur]>nt[tt][ur]){hr=!0;break}if(hr)return te.splice(et,1),"continue";var xr={};Pt.neighbors.forEach(function(or){var jr=h["".concat(yt.id,"-").concat(or.id)];xr["".concat(yt.id,"-").concat(or.id)]={start:p[yt.id].idx,end:p[or.id].idx,distance:jr}}),S=Gh(xr,E,e,S);var vr=[];Object.keys(xr).forEach(function(or){if(W[or]){vr.push(W[or]);return}var jr=S[or];W[or]=zh(jr,P,o,s),vr.push(W[or])}),vr=vr.sort(function(or,jr){return jr-or});for(var En=!1,ur=0;ur<Rt;ur++)if(vr[ur]<Ge[ur]){En=!0;break}if(En)return te.splice(et,1),"continue"},We=me-1;We>=0;We--)Ye(We)});var Mt=[];te==null||te.forEach(function(tt){for(var ae=p[tt.id].idx,L=FS(e.nodes,l[ae],ae,o,a),Se=L.neighbors,Ge=Se.length,me=!1,Ye=Ge-1;Ye>=0;Ye--){if(Se.length+1<t.nodes.length){me=!0;return}var We=Se[Ye],qe=We[o];if(!b[qe]||!b[qe].length){Se.splice(Ye,1);continue}if(!nt[qe]||!nt[qe].length){Se.splice(Ye,1);continue}var et="".concat(tt.id,"-").concat(We.id),yt=h[et],Pt=nt[qe].length-1,cr=nt[qe][Pt];if(yt>cr){Se.splice(Ye,1);continue}if(n){var Rt="".concat(We.id,"-").concat(tt.id),hr=h[Rt];Pt=St[qe].length-1;var ur=St[qe][Pt];if(hr>ur){Se.splice(Ye,1);continue}}var xr=W[et]?W[et]:rj(e,tt,We,p,yt,E,P,o,s,W,S),vr="".concat(J.id,"-").concat(qe),En=at[vr][at[vr].length-1];if(xr<En){Se.splice(Ye,1);continue}var or=jS(Te,qe,m,b),jr=or.minPatternNodeLabelDegree;if(or.minPatternNodeLabelInDegree,or.minPatternNodeLabelOutDegree,p[We.id].degree<jr){Se.splice(Ye,1);continue}}me||Mt.push({nodes:[tt].concat(Se)})});var fr=(0,RS.default)(t,J.id,!1).length,Ft={};n?(Object.keys(fr).forEach(function(tt){var ae=m[tt].node[o];Ft[ae]?Ft[ae].push(fr[tt]):Ft[ae]=[fr[tt]]}),Object.keys(Ft).forEach(function(tt){Ft[tt].sort(function(ae,L){return ae-L})})):Ft=nt;for(var Wt=Mt.length,dr=function(ae){var L=Mt[ae],Se=L.nodes[0],Ge={},me={};L.nodes.forEach(function(At,pr){me[At.id]={idx:pr,node:At,degree:0,inDegree:0,outDegree:0};var xt=At[o];Ge[xt]?Ge[xt]++:Ge[xt]=1});var Ye=[],We={};e.edges.forEach(function(At){me[At.source]&&me[At.target]&&(Ye.push(At),We[At[s]]?We[At[s]]++:We[At[s]]=1,me[At.source].degree++,me[At.target].degree++,me[At.source].outDegree++,me[At.target].inDegree++)});for(var qe=Object.keys(x).length,et=!1,yt=0;yt<qe;yt++){var Pt=Object.keys(x)[yt];if(!We[Pt]||We[Pt]<x[Pt].length){et=!0;break}}if(et)return Mt.splice(ae,1),"continue";var cr=Ye.length;if(cr<t.edges.length)return Mt.splice(ae,1),"break";for(var Rt=!1,hr=function(pr){var xt=Ye[pr],kr=xt[s],_n=x[kr];if(!_n||!_n.length)return We[kr]--,_n&&We[kr]<_n.length?(Rt=!0,"break"):(Ye.splice(pr,1),me[xt.source].degree--,me[xt.target].degree--,me[xt.source].outDegree--,me[xt.target].inDegree--,"continue");var Ss=me[xt.source].node[o],Ms=me[xt.target].node[o],Ha=!1;if(_n.forEach(function(Cs){var As=m[Cs.source].node,Ts=m[Cs.target].node;As[o]===Ss&&Ts[o]===Ms&&(Ha=!0),!n&&As[o]===Ms&&Ts[o]===Ss&&(Ha=!0)}),!Ha)return We[kr]--,_n&&We[kr]<_n.length?(Rt=!0,"break"):(Ye.splice(pr,1),me[xt.source].degree--,me[xt.target].degree--,me[xt.source].outDegree--,me[xt.target].inDegree--,"continue")},yt=cr-1;yt>=0;yt--){var ur=hr(yt);if(ur==="break")break}if(Rt)return Mt.splice(ae,1),"continue";L.edges=Ye;var xr=(0,RS.default)(L,L.nodes[0].id,!1).length;if(Object.keys(xr).reverse().forEach(function(At){if(!(At===L.nodes[0].id||Rt)){if(xr[At]===1/0){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var xt=L.nodes.indexOf(me[At].node);L.nodes.splice(xt,1),me[At]=void 0;return}var kr=p[At].node[o];if(!Ft[kr]||!Ft[kr].length||xr[At]>Ft[kr][Ft[kr].length-1]){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var xt=L.nodes.indexOf(me[At].node);L.nodes.splice(xt,1),me[At]=void 0}}}),Rt)return Mt.splice(ae,1),"continue";for(var vr=!0,En=0;vr&&!Rt;){vr=!1;var or=n?me[Se.id].degree<m[J.id].degree||me[Se.id].inDegree<m[J.id].inDegree||me[Se.id].outDegree<m[J.id].outDegree:me[Se.id].degree<m[J.id].degree;if(or){Rt=!0;break}if(Ge[Se[o]]<b[Se[o]].length){Rt=!0;break}for(var jr=L.nodes.length,Ri=jr-1;Ri>=0;Ri--){var Kr=L.nodes[Ri],Oo=me[Kr.id].degree,Jl=me[Kr.id].inDegree,ec=me[Kr.id].outDegree,pn=Kr[o],Va=jS(Te,pn,m,b),_s=Va.minPatternNodeLabelDegree,tc=Va.minPatternNodeLabelInDegree,rc=Va.minPatternNodeLabelOutDegree,nc=n?Oo<_s||Jl<tc||ec<rc:Oo<_s;if(nc){if(Ge[Kr[o]]--,Ge[Kr[o]]<b[Kr[o]].length){Rt=!0;break}L.nodes.splice(Ri,1),me[Kr.id]=void 0,vr=!0}}if(Rt||!vr&&En!==0)break;cr=Ye.length;for(var Bi=cr-1;Bi>=0;Bi--){var Ur=Ye[Bi];if(!me[Ur.source]||!me[Ur.target]){Ye.splice(Bi,1);var Fi=Ur[s];if(We[Fi]--,me[Ur.source]&&(me[Ur.source].degree--,me[Ur.source].outDegree--),me[Ur.target]&&(me[Ur.target].degree--,me[Ur.target].inDegree--),x[Fi]&&We[Fi]<x[Fi].length){Rt=!0;break}vr=!0}}En++}if(Rt||Rt||L.nodes.length<t.nodes.length||Ye.length<t.edges.length)return Mt.splice(ae,1),"continue"},lr=Wt-1;lr>=0;lr--){var Ut=dr(lr);if(Ut==="break")break}for(var ar=Mt.length,Zr=function(ae){var L=Mt[ae],Se={};L.edges.forEach(function(Ye){var We="".concat(Ye.source,"-").concat(Ye.target,"-").concat(Ye.label);Se[We]?Se[We]++:Se[We]=1});for(var Ge=function(We){var qe=Mt[We],et={};qe.edges.forEach(function(Pt){var cr="".concat(Pt.source,"-").concat(Pt.target,"-").concat(Pt.label);et[cr]?et[cr]++:et[cr]=1});var yt=!0;Object.keys(et).length!==Object.keys(Se).length?yt=!1:Object.keys(Se).forEach(function(Pt){et[Pt]!==Se[Pt]&&(yt=!1)}),yt&&Mt.splice(We,1)},me=ar-1;me>ae;me--)Ge(me);ar=Mt.length},lr=0;lr<=ar-1;lr++)Zr(lr);return Mt}}},ij=nj;Rh.default=ij,function(r){function e(x){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},e(x)}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"GADDI",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(r,"breadthFirstSearch",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"connectedComponent",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"depthFirstSearch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"detectCycle",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(r,"dijkstra",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"findAllPath",{enumerable:!0,get:function(){return f.findAllPath}}),Object.defineProperty(r,"findShortestPath",{enumerable:!0,get:function(){return f.findShortestPath}}),Object.defineProperty(r,"floydWarshall",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"getAdjMatrix",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(r,"getDegree",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"getInDegree",{enumerable:!0,get:function(){return a.getInDegree}}),Object.defineProperty(r,"getNeighbors",{enumerable:!0,get:function(){return g.getNeighbors}}),Object.defineProperty(r,"getOutDegree",{enumerable:!0,get:function(){return a.getOutDegree}}),Object.defineProperty(r,"labelPropagation",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"louvain",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(r,"minimumSpanningTree",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(r,"pageRank",{enumerable:!0,get:function(){return v.default}});var t=b(Ho),n=b(Ch),i=b(lo),a=m(Ca),o=b(ra),s=b(Th),u=b(Js),f=eu,l=b(Nf),c=b(kh),h=b(Lh),d=b(Nh),v=b(Ph),p=b(Rh),g=Vr;function y(x){if(typeof WeakMap!="function")return null;var w=new WeakMap,E=new WeakMap;return(y=function(M){return M?E:w})(x)}function m(x,w){if(x&&x.__esModule)return x;if(x===null||e(x)!=="object"&&typeof x!="function")return{default:x};var E=y(w);if(E&&E.has(x))return E.get(x);var _={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in x)if(C!=="default"&&Object.prototype.hasOwnProperty.call(x,C)){var S=M?Object.getOwnPropertyDescriptor(x,C):null;S&&(S.get||S.set)?Object.defineProperty(_,C,S):_[C]=x[C]}return _.default=x,E&&E.set(x,_),_}function b(x){return x&&x.__esModule?x:{default:x}}}(rS);function h0(r){"@babel/helpers - typeof";return h0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h0(r)}Object.defineProperty(Mh,"__esModule",{value:!0}),Mh.default=void 0;var d0=aj(rS),US=fo;function XS(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(XS=function(i){return i?t:e})(r)}function aj(r,e){if(r&&r.__esModule)return r;if(r===null||h0(r)!=="object"&&typeof r!="function")return{default:r};var t=XS(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)){var o=i?Object.getOwnPropertyDescriptor(r,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=r[a]}return n.default=r,t&&t.set(r,n),n}var v0=typeof self<"u"?self:{};v0.onmessage=function(r){var e=r.data,t=e._algorithmType,n=e.data;if(t){if(typeof d0[t]=="function"){var i=d0[t].apply(d0,n);v0.postMessage({_algorithmType:US.MESSAGE.SUCCESS,data:i});return}v0.postMessage({_algorithmType:US.MESSAGE.FAILURE})}};var oj=null;Mh.default=oj,Object.defineProperty(Sh,"__esModule",{value:!0}),Sh.default=void 0;var sj=fo,uj=fj(Mh);function fj(r){return r&&r.__esModule?r:{default:r}}var lj=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new Promise(function(i,a){var o=new uj.default;o.postMessage({_algorithmType:e,data:t}),o.onmessage=function(s){var u=s.data,f=u.data,l=u._algorithmType;sj.MESSAGE.SUCCESS===l?i(f):a(),o.terminate()}})}},cj=lj;Sh.default=cj,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.pageRankAsync=Kt.minimumSpanningTreeAsync=Kt.louvainAsync=Kt.labelPropagationAsync=Kt.getOutDegreeAsync=Kt.getNeighborsAsync=Kt.getInDegreeAsync=Kt.getDegreeAsync=Kt.getAdjMatrixAsync=Kt.floydWarshallAsync=Kt.findShortestPathAsync=Kt.findAllPathAsync=Kt.dijkstraAsync=Kt.detectCycleAsync=Kt.detectAllUndirectedCycleAsync=Kt.detectAllDirectedCycleAsync=Kt.detectAllCyclesAsync=Kt.connectedComponentAsync=Kt.GADDIAsync=void 0;var en=hj(Sh),tn=fo;function hj(r){return r&&r.__esModule?r:{default:r}}var dj=function(e,t){return(0,en.default)(tn.ALGORITHM.getAdjMatrix).apply(void 0,[e,t])};Kt.getAdjMatrixAsync=dj;var vj=function(e,t){return(0,en.default)(tn.ALGORITHM.connectedComponent).apply(void 0,[e,t])};Kt.connectedComponentAsync=vj;var pj=function(e){return(0,en.default)(tn.ALGORITHM.getDegree)(e)};Kt.getDegreeAsync=pj;var gj=function(e,t){return(0,en.default)(tn.ALGORITHM.getInDegree)(e,t)};Kt.getInDegreeAsync=gj;var yj=function(e,t){return(0,en.default)(tn.ALGORITHM.getOutDegree)(e,t)};Kt.getOutDegreeAsync=yj;var mj=function(e){return(0,en.default)(tn.ALGORITHM.detectCycle)(e)};Kt.detectCycleAsync=mj;var bj=function(e){return(0,en.default)(tn.ALGORITHM.detectAllCycles)(e)};Kt.detectAllCyclesAsync=bj;var xj=function(e){return(0,en.default)(tn.ALGORITHM.detectAllDirectedCycle)(e)};Kt.detectAllDirectedCycleAsync=xj;var wj=function(e){return(0,en.default)(tn.ALGORITHM.detectAllUndirectedCycle)(e)};Kt.detectAllUndirectedCycleAsync=wj;var Ej=function(e,t,n,i){return(0,en.default)(tn.ALGORITHM.dijkstra).apply(void 0,[e,t,n,i])};Kt.dijkstraAsync=Ej;var _j=function(e,t,n,i){return(0,en.default)(tn.ALGORITHM.findAllPath).apply(void 0,[e,t,n,i])};Kt.findAllPathAsync=_j;var Sj=function(e,t,n,i,a){return(0,en.default)(tn.ALGORITHM.findShortestPath).apply(void 0,[e,t,n,i,a])};Kt.findShortestPathAsync=Sj;var Mj=function(e,t){return(0,en.default)(tn.ALGORITHM.floydWarshall).apply(void 0,[e,t])};Kt.floydWarshallAsync=Mj;var Cj=function(e,t,n,i){return i===void 0&&(i=1e3),(0,en.default)(tn.ALGORITHM.labelPropagation)(e,t,n,i)};Kt.labelPropagationAsync=Cj;var Aj=function(e,t,n,i){return(0,en.default)(tn.ALGORITHM.louvain)(e,t,n,i)};Kt.louvainAsync=Aj;var Tj=function(e,t,n){return(0,en.default)(tn.ALGORITHM.minimumSpanningTree).apply(void 0,[e,t,n])};Kt.minimumSpanningTreeAsync=Tj;var Ij=function(e,t,n){return(0,en.default)(tn.ALGORITHM.pageRank).apply(void 0,[e,t,n])};Kt.pageRankAsync=Ij;var kj=function(e,t,n){return(0,en.default)(tn.ALGORITHM.getNeighbors).apply(void 0,[e,t,n])};Kt.getNeighborsAsync=kj;var Lj=function(e,t,n,i,a,o,s){return n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),(0,en.default)(tn.ALGORITHM.GADDI).apply(void 0,[e,t,n,i,a,o,s])};Kt.GADDIAsync=Lj,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"GADDIAsync",{enumerable:!0,get:function(){return e.GADDIAsync}}),Object.defineProperty(r,"connectedComponentAsync",{enumerable:!0,get:function(){return e.connectedComponentAsync}}),r.default=void 0,Object.defineProperty(r,"detectAllCyclesAsync",{enumerable:!0,get:function(){return e.detectAllCyclesAsync}}),Object.defineProperty(r,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllDirectedCycleAsync}}),Object.defineProperty(r,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllUndirectedCycleAsync}}),Object.defineProperty(r,"detectCycleAsync",{enumerable:!0,get:function(){return e.detectCycleAsync}}),r.detectDirectedCycleAsync=void 0,Object.defineProperty(r,"dijkstraAsync",{enumerable:!0,get:function(){return e.dijkstraAsync}}),Object.defineProperty(r,"findAllPathAsync",{enumerable:!0,get:function(){return e.findAllPathAsync}}),Object.defineProperty(r,"findShortestPathAsync",{enumerable:!0,get:function(){return e.findShortestPathAsync}}),Object.defineProperty(r,"floydWarshallAsync",{enumerable:!0,get:function(){return e.floydWarshallAsync}}),Object.defineProperty(r,"getAdjMatrixAsync",{enumerable:!0,get:function(){return e.getAdjMatrixAsync}}),Object.defineProperty(r,"getDegreeAsync",{enumerable:!0,get:function(){return e.getDegreeAsync}}),Object.defineProperty(r,"getInDegreeAsync",{enumerable:!0,get:function(){return e.getInDegreeAsync}}),Object.defineProperty(r,"getNeighborsAsync",{enumerable:!0,get:function(){return e.getNeighborsAsync}}),Object.defineProperty(r,"getOutDegreeAsync",{enumerable:!0,get:function(){return e.getOutDegreeAsync}}),Object.defineProperty(r,"labelPropagationAsync",{enumerable:!0,get:function(){return e.labelPropagationAsync}}),Object.defineProperty(r,"louvainAsync",{enumerable:!0,get:function(){return e.louvainAsync}}),Object.defineProperty(r,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return e.minimumSpanningTreeAsync}}),Object.defineProperty(r,"pageRankAsync",{enumerable:!0,get:function(){return e.pageRankAsync}});var e=Kt,t=e.detectCycleAsync;r.detectDirectedCycleAsync=t;var n={getAdjMatrixAsync:e.getAdjMatrixAsync,connectedComponentAsync:e.connectedComponentAsync,getDegreeAsync:e.getDegreeAsync,getInDegreeAsync:e.getInDegreeAsync,getOutDegreeAsync:e.getOutDegreeAsync,detectCycleAsync:e.detectCycleAsync,detectDirectedCycleAsync:t,detectAllCyclesAsync:e.detectAllCyclesAsync,detectAllDirectedCycleAsync:e.detectAllDirectedCycleAsync,detectAllUndirectedCycleAsync:e.detectAllUndirectedCycleAsync,dijkstraAsync:e.dijkstraAsync,findAllPathAsync:e.findAllPathAsync,findShortestPathAsync:e.findShortestPathAsync,floydWarshallAsync:e.floydWarshallAsync,labelPropagationAsync:e.labelPropagationAsync,louvainAsync:e.louvainAsync,minimumSpanningTreeAsync:e.minimumSpanningTreeAsync,pageRankAsync:e.pageRankAsync,getNeighborsAsync:e.getNeighborsAsync,GADDIAsync:e.GADDIAsync};r.default=n}(r0);const Nj=zD({__proto__:null,default:Ji(r0)},[r0]);function Oj(){return window?window.devicePixelRatio:1}function YS(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function Zo(r,e,t,n,i,a){return i>=r&&i<=r+t&&a>=e&&a<=e+n}function Bf(r,e){return!(e.minX>r.maxX||e.maxX<r.minX||e.minY>r.maxY||e.maxY<r.minY)}function Dj(r,e){return!r||!e?r||e:{minX:Math.min(r.minX,e.minX),minY:Math.min(r.minY,e.minY),maxX:Math.max(r.maxX,e.maxX),maxY:Math.max(r.maxY,e.maxY)}}function WS(r,e){return r[0]===e[0]&&r[1]===e[1]}var Pj=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,Rj=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,Bj=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,VS=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function HS(r,e){var t=r.match(VS);ye(t,function(n){var i=n.split(":");e.addColorStop(i[0],i[1])})}function Fj(r,e,t){var n=Pj.exec(t),i=parseFloat(n[1])%360*(Math.PI/180),a=n[2],o=e.getBBox(),s,u;i>=0&&i<1/2*Math.PI?(s={x:o.minX,y:o.minY},u={x:o.maxX,y:o.maxY}):1/2*Math.PI<=i&&i<Math.PI?(s={x:o.maxX,y:o.minY},u={x:o.minX,y:o.maxY}):Math.PI<=i&&i<3/2*Math.PI?(s={x:o.maxX,y:o.maxY},u={x:o.minX,y:o.minY}):(s={x:o.minX,y:o.maxY},u={x:o.maxX,y:o.minY});var f=Math.tan(i),l=f*f,c=(u.x-s.x+f*(u.y-s.y))/(l+1)+s.x,h=f*(u.x-s.x+f*(u.y-s.y))/(l+1)+s.y,d=r.createLinearGradient(s.x,s.y,c,h);return HS(a,d),d}function Gj(r,e,t){var n=Rj.exec(t),i=parseFloat(n[1]),a=parseFloat(n[2]),o=parseFloat(n[3]),s=n[4];if(o===0){var u=s.match(VS);return u[u.length-1].split(":")[1]}var f=e.getBBox(),l=f.maxX-f.minX,c=f.maxY-f.minY,h=Math.sqrt(l*l+c*c)/2,d=r.createRadialGradient(f.minX+l*i,f.minY+c*a,0,f.minX+l/2,f.minY+c/2,o*h);return HS(s,d),d}function zj(r,e,t){if(e.get("patternSource")&&e.get("patternSource")===t)return e.get("pattern");var n,i,a=Bj.exec(t),o=a[1],s=a[2];function u(){n=r.createPattern(i,o),e.set("pattern",n),e.set("patternSource",t)}switch(o){case"a":o="repeat";break;case"x":o="repeat-x";break;case"y":o="repeat-y";break;case"n":o="no-repeat";break;default:o="no-repeat"}return i=new Image,s.match(/^data:/i)||(i.crossOrigin="Anonymous"),i.src=s,i.complete?u():(i.onload=u,i.src=i.src),n}function $j(r,e,t){var n=e.getBBox();if(isNaN(n.x)||isNaN(n.y)||isNaN(n.width)||isNaN(n.height))return t;if(Pe(t)){if(t[1]==="("||t[2]==="("){if(t[0]==="l")return Fj(r,e,t);if(t[0]==="r")return Gj(r,e,t);if(t[0]==="p")return zj(r,e,t)}return t}if(t instanceof CanvasPattern)return t}function jj(r){var e=0,t=0,n=0,i=0;return vt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,[e,t,n,i]}function $h(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function p0(r,e){return $h(r)*$h(e)?(r[0]*e[0]+r[1]*e[1])/($h(r)*$h(e)):1}function qS(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(p0(r,e))}function ZS(r,e){var t=e[1],n=e[2],i=Ic(kc(e[3]),Math.PI*2),a=e[4],o=e[5],s=r[0],u=r[1],f=e[6],l=e[7],c=Math.cos(i)*(s-f)/2+Math.sin(i)*(u-l)/2,h=-1*Math.sin(i)*(s-f)/2+Math.cos(i)*(u-l)/2,d=c*c/(t*t)+h*h/(n*n);d>1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var v=t*t*(h*h)+n*n*(c*c),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*h/n:0,y=t?p*-n*c/t:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=qS([1,0],x),_=qS(x,w);return p0(x,w)<=-1&&(_=Math.PI),p0(x,w)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:WS(r,[f,l])?0:t,ry:WS(r,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:i,arcFlag:a,sweepFlag:o}}var jh=Math.sin,Uh=Math.cos,g0=Math.atan2,Xh=Math.PI;function KS(r,e,t,n,i,a,o){var s=e.stroke,u=e.lineWidth,f=t-i,l=n-a,c=g0(l,f),h=new _0({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*Uh(Xh/6)+","+10*jh(Xh/6)+" L0,0 L"+10*Uh(Xh/6)+",-"+10*jh(Xh/6),stroke:s,lineWidth:u}});h.translate(i,a),h.rotateAtPoint(i,a,c),r.set(o?"startArrowShape":"endArrowShape",h)}function QS(r,e,t,n,i,a,o){var s=e.startArrow,u=e.endArrow,f=e.stroke,l=e.lineWidth,c=o?s:u,h=c.d,d=c.fill,v=c.stroke,p=c.lineWidth,g=Jr(c,["d","fill","stroke","lineWidth"]),y=t-i,m=n-a,b=g0(m,y);h&&(i=i-Uh(b)*h,a=a-jh(b)*h);var x=new _0({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:B(B({},g),{stroke:v||f,lineWidth:p||l,fill:d})});x.translate(i,a),x.rotateAtPoint(i,a,b),r.set(o?"startArrowShape":"endArrowShape",x)}function Ko(r,e,t,n,i){var a=g0(n-e,t-r);return{dx:Uh(a)*i,dy:jh(a)*i}}function y0(r,e,t,n,i,a){typeof e.startArrow=="object"?QS(r,e,t,n,i,a,!0):e.startArrow?KS(r,e,t,n,i,a,!0):r.set("startArrowShape",null)}function m0(r,e,t,n,i,a){typeof e.endArrow=="object"?QS(r,e,t,n,i,a,!1):e.endArrow?KS(r,e,t,n,i,a,!1):r.set("startArrowShape",null)}var JS={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function ru(r,e){var t=e.attr();for(var n in t){var i=t[n],a=JS[n]?JS[n]:n;a==="matrix"&&i?r.transform(i[0],i[1],i[3],i[4],i[6],i[7]):a==="lineDash"&&r.setLineDash?vt(i)&&r.setLineDash(i):(a==="strokeStyle"||a==="fillStyle"?i=$j(r,e,i):a==="globalAlpha"&&(i=i*r.globalAlpha),r[a]=i)}}function b0(r,e,t){for(var n=0;n<e.length;n++){var i=e[n];i.cfg.visible?i.draw(r,t):i.skipDraw()}}function Uj(r,e,t){var n=r.get("refreshElements");ye(n,function(i){if(i!==r)for(var a=i.cfg.parent;a&&a!==r&&!a.cfg.refresh;)a.cfg.refresh=!0,a=a.cfg.parent}),n[0]===r?w0(e):x0(e,t)}function x0(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(n.cfg.visible)if(n.cfg.hasChanged)n.cfg.refresh=!0,n.isGroup()&&w0(n.cfg.children);else if(n.cfg.refresh)n.isGroup()&&x0(n.cfg.children,e);else{var i=Xj(n,e);n.cfg.refresh=i,i&&n.isGroup()&&x0(n.cfg.children,e)}}}function eM(r){for(var e=0;e<r.length;e++){var t=r[e];t.cfg.hasChanged=!1,t.isGroup()&&!t.destroyed&&eM(t.cfg.children)}}function w0(r,e){for(var t=0;t<r.length;t++){var n=r[t];n.cfg.visible&&(n.cfg.refresh=!0,n.isGroup()&&w0(n.get("children")))}}function Xj(r,e){var t=r.cfg.cacheCanvasBBox,n=r.cfg.isInView&&t&&Bf(t,e);return n}function tM(r,e,t,n){var i=t.path,a=t.startArrow,o=t.endArrow;if(i){var s=[0,0],u=[0,0],f={dx:0,dy:0};e.beginPath();for(var l=0;l<i.length;l++){var c=i[l],h=c[0];if(l===0&&a&&a.d){var d=r.getStartTangent();f=Ko(d[0][0],d[0][1],d[1][0],d[1][1],a.d)}else if(l===i.length-2&&i[l+1][0]==="Z"&&o&&o.d){var v=i[l+1];if(v[0]==="Z"){var d=r.getEndTangent();f=Ko(d[0][0],d[0][1],d[1][0],d[1][1],o.d)}}else if(l===i.length-1&&o&&o.d&&i[0]!=="Z"){var d=r.getEndTangent();f=Ko(d[0][0],d[0][1],d[1][0],d[1][1],o.d)}var p=f.dx,g=f.dy;switch(h){case"M":e.moveTo(c[1]-p,c[2]-g),u=[c[1],c[2]];break;case"L":e.lineTo(c[1]-p,c[2]-g);break;case"Q":e.quadraticCurveTo(c[1],c[2],c[3]-p,c[4]-g);break;case"C":e.bezierCurveTo(c[1],c[2],c[3],c[4],c[5]-p,c[6]-g);break;case"A":{var y=void 0;n?(y=n[l],y||(y=ZS(s,c),n[l]=y)):y=ZS(s,c);var m=y.cx,b=y.cy,x=y.rx,w=y.ry,E=y.startAngle,_=y.endAngle,M=y.xRotation,C=y.sweepFlag;if(e.ellipse)e.ellipse(m,b,x,w,M,E,_,1-C);else{var S=x>w?x:w,A=x>w?1:x/w,T=x>w?w/x:1;e.translate(m,b),e.rotate(M),e.scale(A,T),e.arc(0,0,S,E,_,1-C),e.scale(1/A,1/T),e.rotate(-M),e.translate(-m,-b)}break}case"Z":e.closePath();break}if(h==="Z")s=u;else{var k=c.length;s=[c[k-2],c[k-1]]}}}}function rM(r,e){var t=r.get("canvas");t&&(e==="remove"&&(r._cacheCanvasBBox=r.get("cacheCanvasBBox")),r.get("hasChanged")||(r.set("hasChanged",!0),r.cfg.parent&&r.cfg.parent.get("hasChanged")||(t.refreshElement(r,e,t),t.get("autoDraw")&&t.draw())))}function Yj(r){var e;if(r.destroyed)e=r._cacheCanvasBBox;else{var t=r.get("cacheCanvasBBox"),n=t&&!!(t.width&&t.height),i=r.getCanvasBBox(),a=i&&!!(i.width&&i.height);n&&a?e=Dj(t,i):n?e=t:a&&(e=i)}return e}function Wj(r){if(!r.length)return null;var e=[],t=[],n=[],i=[];return ye(r,function(a){var o=Yj(a);o&&(e.push(o.minX),t.push(o.minY),n.push(o.maxX),i.push(o.maxY))}),{minX:Ui(e),minY:Ui(t),maxX:ji(n),maxY:ji(i)}}function Vj(r,e){return!r||!e||!Bf(r,e)?null:{minX:Math.max(r.minX,e.minX),minY:Math.max(r.minY,e.minY),maxX:Math.min(r.maxX,e.maxX),maxY:Math.min(r.maxY,e.maxY)}}var nM=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onCanvasChange=function(t){rM(this,t)},e.prototype.getShapeBase=function(){return gp},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(t,n){n&&(t.save(),ru(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.cacheCanvasBBox=function(){var t=this.cfg.children,n=[],i=[];ye(t,function(h){var d=h.cfg.cacheCanvasBBox;d&&h.cfg.isInView&&(n.push(d.minX,d.maxX),i.push(d.minY,d.maxY))});var a=null;if(n.length){var o=Ui(n),s=ji(n),u=Ui(i),f=ji(i);a={minX:o,minY:u,x:o,y:u,maxX:s,maxY:f,width:s-o,height:f-u};var l=this.cfg.canvas;if(l){var c=l.getViewRange();this.set("isInView",Bf(a,c))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",a)},e.prototype.draw=function(t,n){var i=this.cfg.children,a=n?this.cfg.refresh:!0;i.length&&a&&(t.save(),ru(t,this),this._applyClip(t,this.getClip()),b0(t,i,n),t.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},e}(z2),Si=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return gp},e.prototype.getGroupBase=function(){return nM},e.prototype.onCanvasChange=function(t){rM(this,t)},e.prototype.calculateBBox=function(){var t=this.get("type"),n=this.getHitLineWidth(),i=U2(t),a=i(this),o=n/2,s=a.x-o,u=a.y-o,f=a.x+a.width+o,l=a.y+a.height+o;return{x:s,minX:s,y:u,minY:u,width:a.width+n,height:a.height+n,maxX:f,maxY:l}},e.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},e.prototype.isStroke=function(){return!!this.attrs.stroke},e.prototype._applyClip=function(t,n){n&&(t.save(),ru(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.draw=function(t,n){var i=this.cfg.clipShape;if(n){if(this.cfg.refresh===!1){this.set("hasChanged",!1);return}var a=this.getCanvasBBox();if(!Bf(n,a)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}t.save(),ru(t,this),this._applyClip(t,i),this.drawPath(t),t.restore(),this._afterDraw()},e.prototype.getCanvasViewBox=function(){var t=this.cfg.canvas;return t?t.getViewRange():null},e.prototype.cacheCanvasBBox=function(){var t=this.getCanvasViewBox();if(t){var n=this.getCanvasBBox(),i=Bf(n,t);this.set("isInView",i),i?this.set("cacheCanvasBBox",n):this.set("cacheCanvasBBox",null)}},e.prototype._afterDraw=function(){this.cacheCanvasBBox(),this.set("hasChanged",!1),this.set("refresh",null)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("isInView",null),this.set("hasChanged",!1)},e.prototype.drawPath=function(t){this.createPath(t),this.strokeAndFill(t),this.afterDrawPath(t)},e.prototype.fill=function(t){t.fill()},e.prototype.stroke=function(t){t.stroke()},e.prototype.strokeAndFill=function(t){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isFill()&&(!ct(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(t.globalAlpha=o),this.stroke(t)),this.afterDrawPath(t)},e.prototype.createPath=function(t){},e.prototype.afterDrawPath=function(t){},e.prototype.isInShape=function(t,n){var i=this.isStroke(),a=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var t=this.attrs;return t.lineWidth+t.lineAppendWidth},e}($2),Hj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=s.x,f=s.y,l=s.r,c=o/2,h=YS(u,f,t,n);return a&&i?h<=l+c:a?h<=l:i?h>=l-c&&h<=l+c:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.r;t.beginPath(),t.arc(i,a,o,0,Math.PI*2,!1),t.closePath()},e}(Si);function Yh(r,e,t,n){return r/(t*t)+e/(n*n)}var qj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=o/2,f=s.x,l=s.y,c=s.rx,h=s.ry,d=(t-f)*(t-f),v=(n-l)*(n-l);return a&&i?Yh(d,v,c+u,h+u)<=1:a?Yh(d,v,c,h)<=1:i?Yh(d,v,c-u,h-u)>=1&&Yh(d,v,c+u,h+u)<=1:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.rx,s=n.ry;if(t.beginPath(),t.ellipse)t.ellipse(i,a,o,s,0,0,Math.PI*2,!1);else{var u=o>s?o:s,f=o>s?1:o/s,l=o>s?s/o:1;t.save(),t.translate(i,a),t.scale(f,l),t.arc(0,0,u,0,Math.PI*2),t.restore(),t.closePath()}},e}(Si);function iM(r){return r instanceof HTMLElement&&Pe(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS"}var Zj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(t){this._setImage(t.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(this.get("toDraw")===!0){var t=this.get("canvas");t?t.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(t){var n=this,i=this.attrs;if(Pe(t)){var a=new Image;a.onload=function(){if(n.destroyed)return!1;n.attr("img",a),n.set("loading",!1),n._afterLoading();var o=n.get("callback");o&&o.call(n)},a.crossOrigin="Anonymous",a.src=t,this.set("loading",!0)}else t instanceof Image?(i.width||(i.width=t.width),i.height||(i.height=t.height)):iM(t)&&(i.width||(i.width=Number(t.getAttribute("width"))),i.height||(i.height,Number(t.getAttribute("height"))))},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t==="img"&&this._setImage(n)},e.prototype.createPath=function(t){if(this.get("loading")){this.set("toDraw",!0),this.set("context",t);return}var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.sx,f=n.sy,l=n.swidth,c=n.sheight,h=n.img;(h instanceof Image||iM(h))&&(!ct(u)&&!ct(f)&&!ct(l)&&!ct(c)?t.drawImage(h,u,f,l,c,i,a,o,s):t.drawImage(h,i,a,o,s))},e}(Si);function co(r,e,t,n,i,a,o){var s=Math.min(r,t),u=Math.max(r,t),f=Math.min(e,n),l=Math.max(e,n),c=i/2;return a>=s-c&&a<=u+c&&o>=f-c&&o<=l+c?dn.pointToLine(r,e,t,n,a,o)<=i/2:!1}var Kj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),this.setArrow()},e.prototype.setArrow=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2,s=t.startArrow,u=t.endArrow;s&&y0(this,t,a,o,n,i),u&&m0(this,t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){if(!i||!o)return!1;var s=this.attr(),u=s.x1,f=s.y1,l=s.x2,c=s.y2;return co(u,f,l,c,o,t,n)},e.prototype.createPath=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2,u=n.startArrow,f=n.endArrow,l={dx:0,dy:0},c={dx:0,dy:0};u&&u.d&&(l=Ko(i,a,o,s,n.startArrow.d)),f&&f.d&&(c=Ko(i,a,o,s,n.endArrow.d)),t.beginPath(),t.moveTo(i+l.dx,a+l.dy),t.lineTo(o-c.dx,s-c.dy)},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return dn.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return dn.pointAt(i,a,o,s,t)},e}(Si),Qj={circle:function(r,e,t){return[["M",r-t,e],["A",t,t,0,1,0,r+t,e],["A",t,t,0,1,0,r-t,e]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["Z"]]},"triangle-down":function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}},Jj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.initAttrs=function(t){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["symbol","x","y","r","radius"].indexOf(t)!==-1&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(t){return ct(t.r)?t.radius:t.r},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.symbol||"circle",o=this._getR(t),s,u;if(_r(a))s=a,u=s(n,i,o),u=h_(u);else{if(s=e.Symbols[a],!s)return console.warn(a+" marker is not supported."),null;u=s(n,i,o)}return u},e.prototype.createPath=function(t){var n=this._getPath(),i=this.get("paramsCache");tM(this,t,{path:n},i)},e.Symbols=Qj,e}(Si);function aM(r,e,t){var n=s_();return r.createPath(n),n.isPointInPath(e,t)}var eU=1e-6;function E0(r){return Math.abs(r)<eU?0:r<0?-1:1}function tU(r,e,t){return(t[0]-r[0])*(e[1]-r[1])===(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}function oM(r,e,t){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var o=r[a],s=r[(a+1)%i];if(tU(o,s,[e,t]))return!0;E0(o[1]-t)>0!=E0(s[1]-t)>0&&E0(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function Ff(r,e,t,n,i,a,o,s){var u=(Math.atan2(s-e,o-r)+Math.PI*2)%(Math.PI*2);if(u<n||u>i)return!1;var f={x:r+t*Math.cos(u),y:e+t*Math.sin(u)};return YS(f.x,f.y,o,s)<=a/2}var rU=ni;function nU(r){for(var e=!1,t=r.length,n=0;n<t;n++){var i=r[n],a=i[0];if(a==="C"||a==="A"||a==="Q"){e=!0;break}}return e}function iU(r,e,t,n,i){for(var a=!1,o=e/2,s=0;s<r.length;s++){var u=r[s],f=u.currentPoint,l=u.params,c=u.prePoint,h=u.box;if(!(h&&!Zo(h.x-o,h.y-o,h.width+e,h.height+e,t,n))){switch(u.command){case"L":case"Z":a=co(c[0],c[1],f[0],f[1],e,t,n);break;case"Q":var d=Z2.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],t,n);a=d<=e/2;break;case"C":var v=Cf.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],l[5],l[6],t,n,i);a=v<=e/2;break;case"A":var p=u.arcParams,g=p.cx,y=p.cy,m=p.rx,b=p.ry,x=p.startAngle,w=p.endAngle,E=p.xRotation,_=[t,n,1],M=m>b?m:b,C=m>b?1:m/b,S=m>b?b/m:1,A=rU(null,[["t",-g,-y],["r",-E],["s",1/C,1/S]]);Pc(_,_,A),a=Ff(0,0,M,x,w,e,_[0],_[1]);break}if(a)break}}return a}function aU(r){for(var e=r.length,t=[],n=[],i=[],a=0;a<e;a++){var o=r[a],s=o[0];s==="M"?(i.length&&(n.push(i),i=[]),i.push([o[1],o[2]])):s==="Z"?i.length&&(t.push(i),i=[]):i.push([o[1],o[2]])}return i.length>0&&n.push(i),{polygons:t,polylines:n}}const Wh=B({hasArc:nU,extractPolygons:aU,isPointInStroke:iU},hG);function sM(r,e,t){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=oM(a,e,t),n)break}return n}var _0=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this._setPathArr(t.path),this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t==="path"&&this._setPathArr(n),this.setArrow()},e.prototype._setPathArr=function(t){this.attrs.path=h_(t);var n=Wh.hasArc(t);this.set("hasArc",n),this.set("paramsCache",{}),this.set("segments",null),this.set("curve",null),this.set("tCache",null),this.set("totalLength",null)},e.prototype.getSegments=function(){var t=this.get("segements");return t||(t=p_(this.attr("path")),this.set("segments",t)),t},e.prototype.setArrow=function(){var t=this.attr(),n=t.startArrow,i=t.endArrow;if(n){var a=this.getStartTangent();y0(this,t,a[0][0],a[0][1],a[1][0],a[1][1])}if(i){var a=this.getEndTangent();m0(this,t,a[0][0],a[0][1],a[1][0],a[1][1])}},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.getSegments(),u=this.get("hasArc"),f=!1;if(i){var l=this.getTotalLength();f=Wh.isPointInStroke(s,o,t,n,l)}if(!f&&a)if(u)f=aM(this,t,n);else{var c=this.attr("path"),h=Wh.extractPolygons(c);f=sM(h.polygons,t,n)||sM(h.polylines,t,n)}return f},e.prototype.createPath=function(t){var n=this.attr(),i=this.get("paramsCache");tM(this,t,n,i)},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.get("totalLength");return ct(t)?(this._calculateCurve(),this._setTcache(),this.get("totalLength")):t},e.prototype.getPoint=function(t){var n=this.get("tCache");n||(this._calculateCurve(),this._setTcache(),n=this.get("tCache"));var i,a,o=this.get("curve");if(!n||n.length===0)return o?{x:o[0][1],y:o[0][2]}:null;ye(n,function(l,c){t>=l[0]&&t<=l[1]&&(i=(t-l[0])/(l[1]-l[0]),a=c)});var s=o[a];if(ct(s)||ct(a))return null;var u=s.length,f=o[a+1];return Cf.pointAt(s[u-2],s[u-1],f[1],f[2],f[3],f[4],f[5],f[6],i)},e.prototype._calculateCurve=function(){var t=this.attr().path;this.set("curve",Wh.pathToCurve(t))},e.prototype._setTcache=function(){var t=0,n=0,i=[],a,o,s,u,f=this.get("curve");if(f){if(ye(f,function(l,c){s=f[c+1],u=l.length,s&&(t+=Cf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6])||0)}),this.set("totalLength",t),t===0){this.set("tCache",[]);return}ye(f,function(l,c){s=f[c+1],u=l.length,s&&(a=[],a[0]=n/t,o=Cf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6]),n+=o||0,a[1]=n/t,i.push(a))}),this.set("tCache",i)}},e.prototype.getStartTangent=function(){var t=this.getSegments(),n;if(t.length>1){var i=t[0].currentPoint,a=t[1].currentPoint,o=t[1].startTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([a[0],a[1]]),n.push([i[0],i[1]]))}return n},e.prototype.getEndTangent=function(){var t=this.getSegments(),n=t.length,i;if(n>1){var a=t[n-2].currentPoint,o=t[n-1].currentPoint,s=t[n-1].endTangent;i=[],s?(i.push([o[0]-s[0],o[1]-s[1]]),i.push([o[0],o[1]])):(i.push([a[0],a[1]]),i.push([o[0],o[1]]))}return i},e}(Si);function uM(r,e,t,n,i){var a=r.length;if(a<2)return!1;for(var o=0;o<a-1;o++){var s=r[o][0],u=r[o][1],f=r[o+1][0],l=r[o+1][1];if(co(s,u,f,l,e,t,n))return!0}if(i){var c=r[0],h=r[a-1];if(co(c[0],c[1],h[0],h[1],e,t,n))return!0}return!1}var oU=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr().points,u=!1;return i&&(u=uM(s,o,t,n,!0)),!u&&a&&(u=oM(s,t,n)),u},e.prototype.createPath=function(t){var n=this.attr(),i=n.points;if(!(i.length<2)){t.beginPath();for(var a=0;a<i.length;a++){var o=i[a];a===0?t.moveTo(o[0],o[1]):t.lineTo(o[0],o[1])}t.closePath()}},e}(Si),sU=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),this.setArrow(),["points"].indexOf(t)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.setArrow=function(){var t=this.attr(),n=this.attrs,i=n.points,a=n.startArrow,o=n.endArrow,s=i.length,u=i[0][0],f=i[0][1],l=i[s-1][0],c=i[s-1][1];a&&y0(this,t,i[1][0],i[1][1],u,f),o&&m0(this,t,i[s-2][0],i[s-2][1],l,c)},e.prototype.isFill=function(){return!1},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){if(!i||!o)return!1;var s=this.attr().points;return uM(s,o,t,n,!1)},e.prototype.isStroke=function(){return!0},e.prototype.createPath=function(t){var n=this.attr(),i=n.points,a=n.startArrow,o=n.endArrow,s=i.length;if(!(i.length<2)){var u=i[0][0],f=i[0][1],l=i[s-1][0],c=i[s-1][1];if(a&&a.d){var h=Ko(u,f,i[1][0],i[1][1],a.d);u+=h.dx,f+=h.dy}if(o&&o.d){var h=Ko(i[s-2][0],i[s-2][1],l,c,o.d);l-=h.dx,c-=h.dy}t.beginPath(),t.moveTo(u,f);for(var d=0;d<s-1;d++){var v=i[d];t.lineTo(v[0],v[1])}t.lineTo(l,c)}},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return ct(n)?(this.set("totalLength",a_.length(t)),this.get("totalLength")):n},e.prototype.getPoint=function(t){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return ye(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),dn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;ye(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=dn.length(u[0],u[1],t[f+1][0],t[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(Si);function uU(r,e,t,n,i,a,o){var s=i/2;return Zo(r-s,e-s,t,i,a,o)||Zo(r+t-s,e-s,i,n,a,o)||Zo(r+s,e+n-s,t,i,a,o)||Zo(r-s,e+s,i,n,a,o)}function fU(r,e,t,n,i,a,o,s){return co(r+i,e,r+t-i,e,a,o,s)||co(r+t,e+i,r+t,e+n-i,a,o,s)||co(r+t-i,e+n,r+i,e+n,a,o,s)||co(r,e+n-i,r,e+i,a,o,s)||Ff(r+t-i,e+i,i,1.5*Math.PI,2*Math.PI,a,o,s)||Ff(r+t-i,e+n-i,i,0,.5*Math.PI,a,o,s)||Ff(r+i,e+n-i,i,.5*Math.PI,Math.PI,a,o,s)||Ff(r+i,e+i,i,Math.PI,1.5*Math.PI,a,o,s)}var lU=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=s.x,f=s.y,l=s.width,c=s.height,h=s.radius;if(h){var v=!1;return i&&(v=fU(u,f,l,c,h,o,t,n)),!v&&a&&(v=aM(this,t,n)),v}else{var d=o/2;if(a&&i)return Zo(u-d,f-d,l+d,c+d,t,n);if(a)return Zo(u,f,l,c,t,n);if(i)return uU(u,f,l,c,o,t,n)}},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.radius;if(t.beginPath(),u===0)t.rect(i,a,o,s);else{var f=jj(u),l=f[0],c=f[1],h=f[2],d=f[3];t.moveTo(i+l,a),t.lineTo(i+o-c,a),c!==0&&t.arc(i+o-c,a+c,c,-Math.PI/2,0),t.lineTo(i+o,a+s-h),h!==0&&t.arc(i+o-h,a+s-h,h,0,Math.PI/2),t.lineTo(i+d,a+s),d!==0&&t.arc(i+d,a+s-d,d,Math.PI/2,Math.PI),t.lineTo(i,a+l),l!==0&&t.arc(i+l,a+l,l,Math.PI,Math.PI*1.5),t.closePath()}},e}(Si),cU=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.isOnlyHitBox=function(){return!0},e.prototype.initAttrs=function(t){this._assembleFont(),t.text&&this._setText(t.text)},e.prototype._assembleFont=function(){var t=this.attrs;t.font=f_(t)},e.prototype._setText=function(t){var n=null;Pe(t)&&t.indexOf(`
`)!==-1&&(n=t.split(`
`)),this.set("textArr",n)},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t.startsWith("font")&&this._assembleFont(),t==="text"&&this._setText(n)},e.prototype._getSpaceingY=function(){var t=this.attrs,n=t.lineHeight,i=t.fontSize*1;return n?n-i:i*.14},e.prototype._drawTextArr=function(t,n,i){var a=this.attrs,o=a.textBaseline,s=a.x,u=a.y,f=a.fontSize*1,l=this._getSpaceingY(),c=u_(a.text,a.fontSize,a.lineHeight),h;ye(n,function(d,v){h=u+v*(l+f)-c+f,o==="middle"&&(h+=c-f-(c-f)/2),o==="top"&&(h+=c-f),ct(d)||(i?t.fillText(d,s,h):t.strokeText(d,s,h))})},e.prototype._drawText=function(t,n){var i=this.attr(),a=i.x,o=i.y,s=this.get("textArr");if(s)this._drawTextArr(t,s,n);else{var u=i.text;ct(u)||(n?t.fillText(u,a,o):t.strokeText(u,a,o))}},e.prototype.strokeAndFill=function(t){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(t.globalAlpha=a),this.stroke(t)),this.isFill()&&(!ct(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.afterDrawPath(t)},e.prototype.fill=function(t){this._drawText(t,!0)},e.prototype.stroke=function(t){this._drawText(t,!1)},e}(Si);function hU(r,e){if(e){var t=KE(e);return Xo(t,r)}return r}function fM(r,e,t){var n=r.getTotalMatrix();if(n){var i=hU([e,t,1],n),a=i[0],o=i[1];return[a,o]}return[e,t]}function lM(r,e,t){if(r.isCanvas&&r.isCanvas())return!0;if(!pg(r)||r.cfg.isInView===!1)return!1;if(r.cfg.clipShape){var n=fM(r,e,t),i=n[0],a=n[1];if(r.isClipped(i,a))return!1}var o=r.cfg.cacheCanvasBBox||r.getCanvasBBox();return e>=o.minX&&e<=o.maxX&&t>=o.minY&&t<=o.maxY}function cM(r,e,t){if(!lM(r,e,t))return null;for(var n=null,i=r.getChildren(),a=i.length,o=a-1;o>=0;o--){var s=i[o];if(s.isGroup())n=cM(s,e,t);else if(lM(s,e,t)){var u=s,f=fM(s,e,t),l=f[0],c=f[1];u.isInShape(l,c)&&(n=s)}if(n)break}return n}var Aa=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.renderer="canvas",t.autoDraw=!0,t.localRefresh=!0,t.refreshElements=[],t.clipView=!0,t.quickHit=!1,t},e.prototype.onCanvasChange=function(t){(t==="attr"||t==="sort"||t==="changeSize")&&(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return gp},e.prototype.getGroupBase=function(){return nM},e.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||Oj();return t>=1?Math.ceil(t):1},e.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},e.prototype.createDom=function(){var t=document.createElement("canvas"),n=t.getContext("2d");return this.set("context",n),t},e.prototype.setDOMSize=function(t,n){r.prototype.setDOMSize.call(this,t,n);var i=this.get("context"),a=this.get("el"),o=this.getPixelRatio();a.width=o*t,a.height=o*n,o>1&&i.scale(o,o)},e.prototype.clear=function(){r.prototype.clear.call(this),this._clearFrame();var t=this.get("context"),n=this.get("el");t.clearRect(0,0,n.width,n.height)},e.prototype.getShape=function(t,n){var i;return this.get("quickHit")?i=cM(this,t,n):i=r.prototype.getShape.call(this,t,n,null),i},e.prototype._getRefreshRegion=function(){var t=this.get("refreshElements"),n=this.getViewRange(),i;if(t.length&&t[0]===this)i=n;else if(i=Wj(t),i){i.minX=Math.floor(i.minX),i.minY=Math.floor(i.minY),i.maxX=Math.ceil(i.maxX),i.maxY=Math.ceil(i.maxY),i.maxY+=1;var a=this.get("clipView");a&&(i=Vj(i,n))}return i},e.prototype.refreshElement=function(t){var n=this.get("refreshElements");n.push(t)},e.prototype._clearFrame=function(){var t=this.get("drawFrame");t&&(lx(t),this.set("drawFrame",null),this.set("refreshElements",[]))},e.prototype.draw=function(){var t=this.get("drawFrame");this.get("autoDraw")&&t||this._startDraw()},e.prototype._drawAll=function(){var t=this.get("context"),n=this.get("el"),i=this.getChildren();t.clearRect(0,0,n.width,n.height),ru(t,this),b0(t,i),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var t=this.get("context"),n=this.get("refreshElements"),i=this.getChildren(),a=this._getRefreshRegion();a?(t.clearRect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.save(),t.beginPath(),t.rect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.clip(),ru(t,this),Uj(this,i,a),b0(t,i,a),t.restore()):n.length&&eM(n),ye(n,function(o){o.get("hasChanged")&&o.set("hasChanged",!1)}),this.set("refreshElements",[])},e.prototype._startDraw=function(){var t=this,n=this.get("drawFrame"),i=this.get("drawFrameCallback");n||(n=fx(function(){t.get("localRefresh")?t._drawRegion():t._drawAll(),t.set("drawFrame",null),i&&i()}),this.set("drawFrame",n))},e.prototype.skipDraw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.width=0,t.height=0,t.parentNode.removeChild(t)},e}(G2),S0={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},ir={opacity:"opacity",fillStyle:"fill",fill:"fill",fillOpacity:"fill-opacity",strokeStyle:"stroke",strokeOpacity:"stroke-opacity",stroke:"stroke",x:"x",y:"y",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",x1:"x1",x2:"x2",y1:"y1",y2:"y2",lineCap:"stroke-linecap",lineJoin:"stroke-linejoin",lineWidth:"stroke-width",lineDash:"stroke-dasharray",lineDashOffset:"stroke-dashoffset",miterLimit:"stroke-miterlimit",font:"font",fontSize:"font-size",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",fontFamily:"font-family",startArrow:"marker-start",endArrow:"marker-end",path:"d",class:"class",id:"id",style:"style",preserveAspectRatio:"preserveAspectRatio"};function ai(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function hM(r){var e=S0[r.type],t=r.getParent();if(!e)throw new Error("the type "+r.type+" is not supported by svg");var n=ai(e);if(r.get("id")&&(n.id=r.get("id")),r.set("el",n),r.set("attrs",{}),t){var i=t.get("el");i||(i=t.createDom(),t.set("el",i)),i.appendChild(n)}return n}function dM(r,e){var t=r.get("el"),n=vx(t.children).sort(e),i=document.createDocumentFragment();n.forEach(function(a){i.appendChild(a)}),t.appendChild(i)}function dU(r,e){var t=r.parentNode,n=Array.from(t.childNodes).filter(function(s){return s.nodeType===1&&s.nodeName.toLowerCase()!=="defs"}),i=n[e],a=n.indexOf(r);if(i){if(a>e)t.insertBefore(r,i);else if(a<e){var o=n[e+1];o?t.insertBefore(r,o):t.appendChild(r)}}else t.appendChild(r)}function vU(r,e){var t=r.cfg.el,n=r.attr(),i={dx:n.shadowOffsetX,dy:n.shadowOffsetY,blur:n.shadowBlur,color:n.shadowColor};if(!i.dx&&!i.dy&&!i.blur&&!i.color)t.removeAttribute("filter");else{var a=e.find("filter",i);a||(a=e.addShadow(i)),t.setAttribute("filter","url(#"+a+")")}}function Gf(r){var e=r.attr().matrix;if(e){for(var t=r.cfg.el,n=[],i=0;i<9;i+=3)n.push(e[i]+","+e[i+1]);n=n.join(","),n.indexOf("NaN")===-1?t.setAttribute("transform","matrix("+n+")"):console.warn("invalid matrix:",e)}}function zf(r,e){var t=r.getClip(),n=r.get("el");if(!t)n.removeAttribute("clip-path");else if(t&&!n.hasAttribute("clip-path")){hM(t),t.createPath(e);var i=e.addClip(t);n.setAttribute("clip-path","url(#"+i+")")}}function vM(r,e){e.forEach(function(t){t.draw(r)})}function pM(r,e){var t=r.get("canvas");if(t&&t.get("autoDraw")){var n=t.get("context"),i=r.getParent(),a=i?i.getChildren():[t],o=r.get("el");if(e==="remove"){var s=r.get("isClipShape");if(s){var u=o&&o.parentNode,f=u&&u.parentNode;u&&f&&f.removeChild(u)}else o&&o.parentNode&&o.parentNode.removeChild(o)}else if(e==="show")o.setAttribute("visibility","visible");else if(e==="hide")o.setAttribute("visibility","hidden");else if(e==="zIndex")dU(o,a.indexOf(r));else if(e==="sort"){var l=r.get("children");l&&l.length&&dM(r,function(c,h){return l.indexOf(c)-l.indexOf(h)?1:0})}else e==="clear"?o&&(o.innerHTML=""):e==="matrix"?Gf(r):e==="clip"?zf(r,n):e==="attr"||e==="add"&&r.draw(n)}}var gM=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isEntityGroup=function(){return!0},e.prototype.createDom=function(){var t=ai("g");this.set("el",t);var n=this.getParent();if(n){var i=n.get("el");i||(i=n.createDom(),n.set("el",i)),i.appendChild(t)}return t},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.createPath(i,t)}},e.prototype.onCanvasChange=function(t){pM(this,t)},e.prototype.getShapeBase=function(){return yp},e.prototype.getGroupBase=function(){return e},e.prototype.draw=function(t){var n=this.getChildren(),i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||this.createDom(),zf(this,t),this.createPath(t),n.length&&vM(t,n))},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){ir[s]&&a.setAttribute(ir[s],o)}),Gf(this)},e}(z2),oi=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="svg",t.canFill=!1,t.canStroke=!1,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.draw(i,t)}},e.prototype.getShapeBase=function(){return yp},e.prototype.getGroupBase=function(){return gM},e.prototype.onCanvasChange=function(t){pM(this,t)},e.prototype.calculateBBox=function(){var t=this.get("el"),n=null;if(t)n=t.getBBox();else{var i=U2(this.get("type"));i&&(n=i(this))}if(n){var a=n.x,o=n.y,s=n.width,u=n.height,f=this.getHitLineWidth(),l=f/2,c=a-l,h=o-l,d=a+s+l,v=o+u+l;return{x:c,y:h,minX:c,minY:h,maxX:d,maxY:v,width:s+f,height:u+f}}return{x:0,y:0,minX:0,minY:0,maxX:0,maxY:0,width:0,height:0}},e.prototype.isFill=function(){var t=this.attr(),n=t.fill,i=t.fillStyle;return(n||i||this.isClipShape())&&this.canFill},e.prototype.isStroke=function(){var t=this.attr(),n=t.stroke,i=t.strokeStyle;return(n||i)&&this.canStroke},e.prototype.draw=function(t,n){var i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||hM(this),zf(this,t),this.createPath(t,n),this.shadow(t,n),this.strokeAndFill(t,n),this.transform(n))},e.prototype.createPath=function(t,n){},e.prototype.strokeAndFill=function(t,n){var i=n||this.attr(),a=i.fill,o=i.fillStyle,s=i.stroke,u=i.strokeStyle,f=i.fillOpacity,l=i.strokeOpacity,c=i.lineWidth,h=this.get("el");this.canFill&&(n?"fill"in i?this._setColor(t,"fill",a):"fillStyle"in i&&this._setColor(t,"fill",o):this._setColor(t,"fill",a||o),f&&h.setAttribute(ir.fillOpacity,f)),this.canStroke&&c>0&&(n?"stroke"in i?this._setColor(t,"stroke",s):"strokeStyle"in i&&this._setColor(t,"stroke",u):this._setColor(t,"stroke",s||u),l&&h.setAttribute(ir.strokeOpacity,l),c&&h.setAttribute(ir.lineWidth,c))},e.prototype._setColor=function(t,n,i){var a=this.get("el");if(!i){a.setAttribute(ir[n],"none");return}if(i=i.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(i)){var o=t.find("gradient",i);o||(o=t.addGradient(i)),a.setAttribute(ir[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(i)){var o=t.find("pattern",i);o||(o=t.addPattern(i)),a.setAttribute(ir[n],"url(#"+o+")")}else a.setAttribute(ir[n],i)},e.prototype.shadow=function(t,n){var i=this.attr(),a=n||i,o=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,f=a.shadowColor;(o||s||u||f)&&vU(this,t)},e.prototype.transform=function(t){var n=this.attr(),i=(t||n).matrix;i&&Gf(this)},e.prototype.isInShape=function(t,n){return this.isPointInPath(t,n)},e.prototype.isPointInPath=function(t,n){var i=this.get("el"),a=this.get("canvas"),o=a.get("el").getBoundingClientRect(),s=t+o.left,u=n+o.top,f=document.elementFromPoint(s,u);return!!(f&&f.isEqualNode(i))},e.prototype.getHitLineWidth=function(){var t=this.attrs,n=t.lineWidth,i=t.lineAppendWidth;return this.isStroke()?n+i:0},e}($2),pU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="circle",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,r:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):ir[s]&&a.setAttribute(ir[s],o)})},e}(oi),gU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dom",t.canFill=!1,t.canStroke=!1,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");if(ye(n||i,function(f,l){ir[l]&&a.setAttribute(ir[l],f)}),typeof i.html=="function"){var o=i.html.call(this,i);if(o instanceof Element||o instanceof HTMLDocument){for(var s=a.childNodes,u=s.length-1;u>=0;u--)a.removeChild(s[u]);a.appendChild(o)}else a.innerHTML=o}else a.innerHTML=i.html},e}(oi),yU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="ellipse",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):ir[s]&&a.setAttribute(ir[s],o)})},e}(oi),mU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="image",t.canFill=!1,t.canStroke=!1,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");ye(n||a,function(s,u){u==="img"?i._setImage(a.img):ir[u]&&o.setAttribute(ir[u],s)})},e.prototype.setAttr=function(t,n){this.attrs[t]=n,t==="img"&&this._setImage(n)},e.prototype._setImage=function(t){var n=this.attr(),i=this.get("el");if(Pe(t))i.setAttribute("href",t);else if(t instanceof window.Image)n.width||(i.setAttribute("width",t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",t.height),this.attr("height",t.height)),i.setAttribute("href",t.src);else if(t instanceof HTMLElement&&Pe(t.nodeName)&&t.nodeName.toUpperCase()==="CANVAS")i.setAttribute("href",t.toDataURL());else if(t instanceof ImageData){var a=document.createElement("canvas");a.setAttribute("width",""+t.width),a.setAttribute("height",""+t.height),a.getContext("2d").putImageData(t,0,0),n.width||(i.setAttribute("width",""+t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",""+t.height),this.attr("height",t.height)),i.setAttribute("href",a.toDataURL())}},e}(oi),bU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="line",t.canFill=!1,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=un(o)?t.addArrow(i,ir[s]):t.getDefaultArrow(i,ir[s]);a.setAttribute(ir[s],"url(#"+u+")")}else a.removeAttribute(ir[s]);else ir[s]&&a.setAttribute(ir[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return dn.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return dn.pointAt(i,a,o,s,t)},e}(oi),Vh={circle:function(r,e,t){return[["M",r,e],["m",-t,0],["a",t,t,0,1,0,t*2,0],["a",t,t,0,1,0,-t*2,0]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["z"]]},triangleDown:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}};const yM={get:function(r){return Vh[r]},register:function(r,e){Vh[r]=e},remove:function(r){delete Vh[r]},getAll:function(){return Vh}};var xU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="marker",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t){var n=this.get("el");n.setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var t=this._getPath();return vt(t)?t.map(function(n){return n.join(" ")}).join(""):t},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.r||t.radius,o=t.symbol||"circle",s;return _r(o)?s=o:s=yM.get(o),s?s(n,i,a):(console.warn(s+" symbol is not exist."),null)},e.symbolsFactory=yM,e}(oi),wU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="path",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");ye(n||a,function(s,u){if(u==="path"&&vt(s))o.setAttribute("d",i._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var f=un(s)?t.addArrow(a,ir[u]):t.getDefaultArrow(a,ir[u]);o.setAttribute(ir[u],"url(#"+f+")")}else o.removeAttribute(ir[u]);else ir[u]&&o.setAttribute(ir[u],s)})},e.prototype._formatPath=function(t){var n=t.map(function(i){return i.join(" ")}).join("");return~n.indexOf("NaN")?"":n},e.prototype.getTotalLength=function(){var t=this.get("el");return t?t.getTotalLength():null},e.prototype.getPoint=function(t){var n=this.get("el"),i=this.getTotalLength();if(i===0)return null;var a=n?n.getPointAtLength(t*i):null;return a?{x:a.x,y:a.y}:null},e}(oi),EU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polygon",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="points"&&vt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ir[s]&&a.setAttribute(ir[s],o)})},e}(oi),_U=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polyline",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["points"].indexOf(t)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="points"&&vt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ir[s]&&a.setAttribute(ir[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return ct(n)?(this.set("totalLength",a_.length(t)),this.get("totalLength")):n},e.prototype.getPoint=function(t){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return ye(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),dn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;ye(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=dn.length(u[0],u[1],t[f+1][0],t[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(oi);function SU(r){var e=0,t=0,n=0,i=0;return vt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var MU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="rect",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el"),s=!1,u=["x","y","width","height","radius"];ye(n||a,function(f,l){u.indexOf(l)!==-1&&!s?(o.setAttribute("d",i._assembleRect(a)),s=!0):u.indexOf(l)===-1&&ir[l]&&o.setAttribute(ir[l],f)})},e.prototype._assembleRect=function(t){var n=t.x,i=t.y,a=t.width,o=t.height,s=t.radius;if(!s)return"M "+n+","+i+" l "+a+",0 l 0,"+o+" l"+-a+" 0 z";var u=SU(s);vt(s)?s.length===1?u.r1=u.r2=u.r3=u.r4=s[0]:s.length===2?(u.r1=u.r3=s[0],u.r2=u.r4=s[1]):s.length===3?(u.r1=s[0],u.r2=u.r4=s[1],u.r3=s[2]):(u.r1=s[0],u.r2=s[1],u.r3=s[2],u.r4=s[3]):u.r1=u.r2=u.r3=u.r4=s;var f=[["M "+(n+u.r1)+","+i],["l "+(a-u.r1-u.r2)+",0"],["a "+u.r2+","+u.r2+",0,0,1,"+u.r2+","+u.r2],["l 0,"+(o-u.r2-u.r3)],["a "+u.r3+","+u.r3+",0,0,1,"+-u.r3+","+u.r3],["l "+(u.r3+u.r4-a)+",0"],["a "+u.r4+","+u.r4+",0,0,1,"+-u.r4+","+-u.r4],["l 0,"+(u.r4+u.r1-o)],["a "+u.r1+","+u.r1+",0,0,1,"+u.r1+","+-u.r1],["z"]];return f.join(" ")},e}(oi),mM=.3,CU={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},AU={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},TU={left:"left",start:"left",center:"middle",right:"end",end:"end"},IU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="text",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");this._setFont(),ye(n||a,function(s,u){u==="text"?i._setText(""+s):u==="matrix"&&s?Gf(i):ir[u]&&o.setAttribute(ir[u],s)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var t=this.get("el"),n=this.attr(),i=n.textBaseline,a=n.textAlign,o=qE();o&&o.name==="firefox"?t.setAttribute("dominant-baseline",AU[i]||"alphabetic"):t.setAttribute("alignment-baseline",CU[i]||"baseline"),t.setAttribute("text-anchor",TU[a]||"left")},e.prototype._setText=function(t){var n=this.get("el"),i=this.attr(),a=i.x,o=i.textBaseline,s=o===void 0?"bottom":o;if(!t)n.innerHTML="";else if(~t.indexOf(`
`)){var u=t.split(`
`),f=u.length-1,l="";ye(u,function(c,h){h===0?s==="alphabetic"?l+='<tspan x="'+a+'" dy="'+-f+'em">'+c+"</tspan>":s==="top"?l+='<tspan x="'+a+'" dy="0.9em">'+c+"</tspan>":s==="middle"?l+='<tspan x="'+a+'" dy="'+-(f-1)/2+'em">'+c+"</tspan>":s==="bottom"?l+='<tspan x="'+a+'" dy="-'+(f+mM)+'em">'+c+"</tspan>":s==="hanging"&&(l+='<tspan x="'+a+'" dy="'+(-(f-1)-mM)+'em">'+c+"</tspan>"):l+='<tspan x="'+a+'" dy="1em">'+c+"</tspan>"}),n.innerHTML=l}else n.innerHTML=t},e}(oi),kU=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,LU=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,NU=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function bM(r){var e=r.match(NU);if(!e)return"";var t="";return e.sort(function(n,i){return n=n.split(":"),i=i.split(":"),Number(n[0])-Number(i[0])}),ye(e,function(n){n=n.split(":"),t+='<stop offset="'+n[0]+'" stop-color="'+n[1]+'"></stop>'}),t}function OU(r,e){var t=kU.exec(r),n=Ic(kc(parseFloat(t[1])),Math.PI*2),i=t[2],a,o;n>=0&&n<.5*Math.PI?(a={x:0,y:0},o={x:1,y:1}):.5*Math.PI<=n&&n<Math.PI?(a={x:1,y:0},o={x:0,y:1}):Math.PI<=n&&n<1.5*Math.PI?(a={x:1,y:1},o={x:0,y:0}):(a={x:0,y:1},o={x:1,y:0});var s=Math.tan(n),u=s*s,f=(o.x-a.x+s*(o.y-a.y))/(u+1)+a.x,l=s*(o.x-a.x+s*(o.y-a.y))/(u+1)+a.y;e.setAttribute("x1",a.x),e.setAttribute("y1",a.y),e.setAttribute("x2",f),e.setAttribute("y2",l),e.innerHTML=bM(i)}function DU(r,e){var t=LU.exec(r),n=parseFloat(t[1]),i=parseFloat(t[2]),a=parseFloat(t[3]),o=t[4];e.setAttribute("cx",n),e.setAttribute("cy",i),e.setAttribute("r",a),e.innerHTML=bM(o)}var PU=function(){function r(e){this.cfg={};var t=null,n=Yi("gradient_");return e.toLowerCase()[0]==="l"?(t=ai("linearGradient"),OU(e,t)):(t=ai("radialGradient"),DU(e,t)),t.setAttribute("id",n),this.el=t,this.id=n,this.cfg=e,this}return r.prototype.match=function(e,t){return this.cfg===t},r}(),RU={shadowColor:"color",shadowOpacity:"opacity",shadowBlur:"blur",shadowOffsetX:"dx",shadowOffsetY:"dy"},BU={x:"-40%",y:"-40%",width:"200%",height:"200%"},FU=function(){function r(e){this.type="filter",this.cfg={},this.type="filter";var t=ai("filter");return ye(BU,function(n,i){t.setAttribute(i,n)}),this.el=t,this.id=Yi("filter_"),this.el.id=this.id,this.cfg=e,this._parseShadow(e,t),this}return r.prototype.match=function(e,t){if(this.type!==e)return!1;var n=!0,i=this.cfg;return ye(Object.keys(i),function(a){if(i[a]!==t[a])return n=!1,!1}),n},r.prototype.update=function(e,t){var n=this.cfg;return n[RU[e]]=t,this._parseShadow(n,this.el),this},r.prototype._parseShadow=function(e,t){var n=`<feDropShadow
      dx="`+(e.dx||0)+`"
      dy="`+(e.dy||0)+`"
      stdDeviation="`+(e.blur?e.blur/10:0)+`"
      flood-color="`+(e.color?e.color:"#000")+`"
      flood-opacity="`+(e.opacity?e.opacity:1)+`"
      />`;t.innerHTML=n},r}(),xM=function(){function r(e,t){this.cfg={};var n=ai("marker"),i=Yi("marker_");n.setAttribute("id",i);var a=ai("path");a.setAttribute("stroke",e.stroke||"none"),a.setAttribute("fill",e.fill||"none"),n.appendChild(a),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=a,this.id=i;var o=e[t==="marker-start"?"startArrow":"endArrow"];return this.stroke=e.stroke||"#000",o===!0?this._setDefaultPath(t,a):(this.cfg=o,this._setMarker(e.lineWidth,a)),this}return r.prototype.match=function(){return!1},r.prototype._setDefaultPath=function(e,t){var n=this.el;t.setAttribute("d","M0,0 L"+10*Math.cos(Math.PI/6)+",5 L0,10"),n.setAttribute("refX",""+10*Math.cos(Math.PI/6)),n.setAttribute("refY","5")},r.prototype._setMarker=function(e,t){var n=this.el,i=this.cfg.path,a=this.cfg.d;vt(i)&&(i=i.map(function(o){return o.join(" ")}).join("")),t.setAttribute("d",i),n.appendChild(t),a&&n.setAttribute("refX",""+a/e)},r.prototype.update=function(e){var t=this.child;t.attr?t.attr("fill",e):t.setAttribute("fill",e)},r}(),GU=function(){function r(e){this.type="clip",this.cfg={};var t=ai("clipPath");this.el=t,this.id=Yi("clip_"),t.id=this.id;var n=e.cfg.el;return t.appendChild(n),this.cfg=e,this}return r.prototype.match=function(){return!1},r.prototype.remove=function(){var e=this.el;e.parentNode.removeChild(e)},r}(),zU=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,$U=function(){function r(e){this.cfg={};var t=ai("pattern");t.setAttribute("patternUnits","userSpaceOnUse");var n=ai("image");t.appendChild(n);var i=Yi("pattern_");t.id=i,this.el=t,this.id=i,this.cfg=e;var a=zU.exec(e),o=a[2];n.setAttribute("href",o);var s=new Image;o.match(/^data:/i)||(s.crossOrigin="Anonymous"),s.src=o;function u(){t.setAttribute("width",""+s.width),t.setAttribute("height",""+s.height)}return s.complete?u():(s.onload=u,s.src=s.src),this}return r.prototype.match=function(e,t){return this.cfg===t},r}(),jU=function(){function r(e){var t=ai("defs"),n=Yi("defs_");t.id=n,e.appendChild(t),this.children=[],this.defaultArrow={},this.el=t,this.canvas=e}return r.prototype.find=function(e,t){for(var n=this.children,i=null,a=0;a<n.length;a++)if(n[a].match(e,t)){i=n[a].id;break}return i},r.prototype.findById=function(e){for(var t=this.children,n=null,i=0;i<t.length;i++)if(t[i].id===e){n=t[i];break}return n},r.prototype.add=function(e){this.children.push(e),e.canvas=this.canvas,e.parent=this},r.prototype.getDefaultArrow=function(e,t){var n=e.stroke||e.strokeStyle;if(this.defaultArrow[n])return this.defaultArrow[n].id;var i=new xM(e,t);return this.defaultArrow[n]=i,this.el.appendChild(i.el),this.add(i),i.id},r.prototype.addGradient=function(e){var t=new PU(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addArrow=function(e,t){var n=new xM(e,t);return this.el.appendChild(n.el),this.add(n),n.id},r.prototype.addShadow=function(e){var t=new FU(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addPattern=function(e){var t=new $U(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addClip=function(e){var t=new GU(e);return this.el.appendChild(t.el),this.add(t),t.id},r}(),$f=function(r){It(e,r);function e(t){return r.call(this,B(B({},t),{autoDraw:!0,renderer:"svg"}))||this}return e.prototype.getShapeBase=function(){return yp},e.prototype.getGroupBase=function(){return gM},e.prototype.getShape=function(t,n,i){var a=i.target||i.srcElement;if(!S0[a.tagName]){for(var o=a.parentNode;o&&!S0[o.tagName];)o=o.parentNode;a=o}return this.find(function(s){return s.get("el")===a})},e.prototype.createDom=function(){var t=ai("svg"),n=new jU(t);return t.setAttribute("width",""+this.get("width")),t.setAttribute("height",""+this.get("height")),this.set("context",n),t},e.prototype.onCanvasChange=function(t){var n=this.get("context"),i=this.get("el");if(t==="sort"){var a=this.get("children");a&&a.length&&dM(this,function(s,u){return a.indexOf(s)-a.indexOf(u)?1:0})}else if(t==="clear"){if(i){i.innerHTML="";var o=n.el;o.innerHTML="",i.appendChild(o)}}else t==="matrix"?Gf(this):t==="clip"?zf(this,n):t==="changeSize"&&(i.setAttribute("width",""+this.get("width")),i.setAttribute("height",""+this.get("height")))},e.prototype.draw=function(){var t=this.get("context"),n=this.getChildren();zf(this,t),n.length&&vM(t,n)},e}(G2),wM={exports:{}},UU={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]},EM={exports:{}},XU=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")},YU=XU,WU=Array.prototype.concat,VU=Array.prototype.slice,_M=EM.exports=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var a=e[n];YU(a)?t=WU.call(t,VU.call(a)):t.push(a)}return t};_M.wrap=function(r){return function(){return r(_M(arguments))}};var HU=EM.exports,jf=UU,Uf=HU,SM=Object.hasOwnProperty,MM=Object.create(null);for(var M0 in jf)SM.call(jf,M0)&&(MM[jf[M0]]=M0);var Vn=wM.exports={to:{},get:{}};Vn.get=function(r){var e=r.substring(0,3).toLowerCase(),t,n;switch(e){case"hsl":t=Vn.get.hsl(r),n="hsl";break;case"hwb":t=Vn.get.hwb(r),n="hwb";break;default:t=Vn.get.rgb(r),n="rgb";break}return t?{model:n,value:t}:null},Vn.get.rgb=function(r){if(!r)return null;var e=/^#([a-f0-9]{3,4})$/i,t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],s,u,f;if(s=r.match(t)){for(f=s[2],s=s[1],u=0;u<3;u++){var l=u*2;o[u]=parseInt(s.slice(l,l+2),16)}f&&(o[3]=parseInt(f,16)/255)}else if(s=r.match(e)){for(s=s[1],f=s[3],u=0;u<3;u++)o[u]=parseInt(s[u]+s[u],16);f&&(o[3]=parseInt(f+f,16)/255)}else if(s=r.match(n)){for(u=0;u<3;u++)o[u]=parseInt(s[u+1],0);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else if(s=r.match(i)){for(u=0;u<3;u++)o[u]=Math.round(parseFloat(s[u+1])*2.55);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else return(s=r.match(a))?s[1]==="transparent"?[0,0,0,0]:SM.call(jf,s[1])?(o=jf[s[1]],o[3]=1,o):null:null;for(u=0;u<3;u++)o[u]=ho(o[u],0,255);return o[3]=ho(o[3],0,1),o},Vn.get.hsl=function(r){if(!r)return null;var e=/^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*)?\)$/,t=r.match(e);if(t){var n=parseFloat(t[4]),i=(parseFloat(t[1])%360+360)%360,a=ho(parseFloat(t[2]),0,100),o=ho(parseFloat(t[3]),0,100),s=ho(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null},Vn.get.hwb=function(r){if(!r)return null;var e=/^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*)?\)$/,t=r.match(e);if(t){var n=parseFloat(t[4]),i=(parseFloat(t[1])%360+360)%360,a=ho(parseFloat(t[2]),0,100),o=ho(parseFloat(t[3]),0,100),s=ho(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null},Vn.to.hex=function(){var r=Uf(arguments);return"#"+Hh(r[0])+Hh(r[1])+Hh(r[2])+(r[3]<1?Hh(Math.round(r[3]*255)):"")},Vn.to.rgb=function(){var r=Uf(arguments);return r.length<4||r[3]===1?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"},Vn.to.rgb.percent=function(){var r=Uf(arguments),e=Math.round(r[0]/255*100),t=Math.round(r[1]/255*100),n=Math.round(r[2]/255*100);return r.length<4||r[3]===1?"rgb("+e+"%, "+t+"%, "+n+"%)":"rgba("+e+"%, "+t+"%, "+n+"%, "+r[3]+")"},Vn.to.hsl=function(){var r=Uf(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"},Vn.to.hwb=function(){var r=Uf(arguments),e="";return r.length>=4&&r[3]!==1&&(e=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+e+")"},Vn.to.keyword=function(r){return MM[r.slice(0,3)]};function ho(r,e,t){return Math.min(Math.max(e,r),t)}function Hh(r){var e=Math.round(r).toString(16).toUpperCase();return e.length<2?"0"+e:e}var qU=wM.exports,CM={exports:{}},ZU={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]},Qo=ZU,AM={};for(var C0 in Qo)Qo.hasOwnProperty(C0)&&(AM[Qo[C0]]=C0);var Et=CM.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var Rn in Et)if(Et.hasOwnProperty(Rn)){if(!("channels"in Et[Rn]))throw new Error("missing channels property: "+Rn);if(!("labels"in Et[Rn]))throw new Error("missing channel labels property: "+Rn);if(Et[Rn].labels.length!==Et[Rn].channels)throw new Error("channel and label counts mismatch: "+Rn);var KU=Et[Rn].channels,QU=Et[Rn].labels;delete Et[Rn].channels,delete Et[Rn].labels,Object.defineProperty(Et[Rn],"channels",{value:KU}),Object.defineProperty(Et[Rn],"labels",{value:QU})}Et.rgb.hsl=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=a-i,s,u,f;return a===i?s=0:e===a?s=(t-n)/o:t===a?s=2+(n-e)/o:n===a&&(s=4+(e-t)/o),s=Math.min(s*60,360),s<0&&(s+=360),f=(i+a)/2,a===i?u=0:f<=.5?u=o/(a+i):u=o/(2-a-i),[s,u*100,f*100]},Et.rgb.hsv=function(r){var e,t,n,i,a,o=r[0]/255,s=r[1]/255,u=r[2]/255,f=Math.max(o,s,u),l=f-Math.min(o,s,u),c=function(h){return(f-h)/6/l+1/2};return l===0?i=a=0:(a=l/f,e=c(o),t=c(s),n=c(u),o===f?i=n-t:s===f?i=1/3+e-n:u===f&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,a*100,f*100]},Et.rgb.hwb=function(r){var e=r[0],t=r[1],n=r[2],i=Et.rgb.hsl(r)[0],a=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[i,a*100,n*100]},Et.rgb.cmyk=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i,a,o,s;return s=Math.min(1-e,1-t,1-n),i=(1-e-s)/(1-s)||0,a=(1-t-s)/(1-s)||0,o=(1-n-s)/(1-s)||0,[i*100,a*100,o*100,s*100]};function JU(r,e){return Math.pow(r[0]-e[0],2)+Math.pow(r[1]-e[1],2)+Math.pow(r[2]-e[2],2)}Et.rgb.keyword=function(r){var e=AM[r];if(e)return e;var t=1/0,n;for(var i in Qo)if(Qo.hasOwnProperty(i)){var a=Qo[i],o=JU(r,a);o<t&&(t=o,n=i)}return n},Et.keyword.rgb=function(r){return Qo[r]},Et.rgb.xyz=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=e*.4124+t*.3576+n*.1805,a=e*.2126+t*.7152+n*.0722,o=e*.0193+t*.1192+n*.9505;return[i*100,a*100,o*100]},Et.rgb.lab=function(r){var e=Et.rgb.xyz(r),t=e[0],n=e[1],i=e[2],a,o,s;return t/=95.047,n/=100,i/=108.883,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,a=116*n-16,o=500*(t-n),s=200*(n-i),[a,o,s]},Et.hsl.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i,a,o,s,u;if(t===0)return u=n*255,[u,u,u];n<.5?a=n*(1+t):a=n+t-n*t,i=2*n-a,s=[0,0,0];for(var f=0;f<3;f++)o=e+1/3*-(f-1),o<0&&o++,o>1&&o--,6*o<1?u=i+(a-i)*6*o:2*o<1?u=a:3*o<2?u=i+(a-i)*(2/3-o)*6:u=i,s[f]=u*255;return s},Et.hsl.hsv=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=t,a=Math.max(n,.01),o,s;return n*=2,t*=n<=1?n:2-n,i*=a<=1?a:2-a,s=(n+t)/2,o=n===0?2*i/(a+i):2*t/(n+t),[e,o*100,s*100]},Et.hsv.rgb=function(r){var e=r[0]/60,t=r[1]/100,n=r[2]/100,i=Math.floor(e)%6,a=e-Math.floor(e),o=255*n*(1-t),s=255*n*(1-t*a),u=255*n*(1-t*(1-a));switch(n*=255,i){case 0:return[n,u,o];case 1:return[s,n,o];case 2:return[o,n,u];case 3:return[o,s,n];case 4:return[u,o,n];case 5:return[n,o,s]}},Et.hsv.hsl=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=Math.max(n,.01),a,o,s;return s=(2-t)*n,a=(2-t)*i,o=t*i,o/=a<=1?a:2-a,o=o||0,s/=2,[e,o*100,s*100]},Et.hwb.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i=t+n,a,o,s,u;i>1&&(t/=i,n/=i),a=Math.floor(6*e),o=1-n,s=6*e-a,a&1&&(s=1-s),u=t+s*(o-t);var f,l,c;switch(a){default:case 6:case 0:f=o,l=u,c=t;break;case 1:f=u,l=o,c=t;break;case 2:f=t,l=o,c=u;break;case 3:f=t,l=u,c=o;break;case 4:f=u,l=t,c=o;break;case 5:f=o,l=t,c=u;break}return[f*255,l*255,c*255]},Et.cmyk.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i=r[3]/100,a,o,s;return a=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),s=1-Math.min(1,n*(1-i)+i),[a*255,o*255,s*255]},Et.xyz.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i,a,o;return i=e*3.2406+t*-1.5372+n*-.4986,a=e*-.9689+t*1.8758+n*.0415,o=e*.0557+t*-.204+n*1.057,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]},Et.xyz.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return e/=95.047,t/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=116*t-16,a=500*(e-t),o=200*(t-n),[i,a,o]},Et.lab.xyz=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;a=(e+16)/116,i=t/500+a,o=a-n/200;var s=Math.pow(a,3),u=Math.pow(i,3),f=Math.pow(o,3);return a=s>.008856?s:(a-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=f>.008856?f:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},Et.lab.lch=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return i=Math.atan2(n,t),a=i*360/2/Math.PI,a<0&&(a+=360),o=Math.sqrt(t*t+n*n),[e,o,a]},Et.lch.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return o=n/360*2*Math.PI,i=t*Math.cos(o),a=t*Math.sin(o),[e,i,a]},Et.rgb.ansi16=function(r){var e=r[0],t=r[1],n=r[2],i=1 in arguments?arguments[1]:Et.rgb.hsv(r)[2];if(i=Math.round(i/50),i===0)return 30;var a=30+(Math.round(n/255)<<2|Math.round(t/255)<<1|Math.round(e/255));return i===2&&(a+=60),a},Et.hsv.ansi16=function(r){return Et.rgb.ansi16(Et.hsv.rgb(r),r[2])},Et.rgb.ansi256=function(r){var e=r[0],t=r[1],n=r[2];if(e===t&&t===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var i=16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5);return i},Et.ansi16.rgb=function(r){var e=r%10;if(e===0||e===7)return r>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var t=(~~(r>50)+1)*.5,n=(e&1)*t*255,i=(e>>1&1)*t*255,a=(e>>2&1)*t*255;return[n,i,a]},Et.ansi256.rgb=function(r){if(r>=232){var e=(r-232)*10+8;return[e,e,e]}r-=16;var t,n=Math.floor(r/36)/5*255,i=Math.floor((t=r%36)/6)/5*255,a=t%6/5*255;return[n,i,a]},Et.rgb.hex=function(r){var e=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255),t=e.toString(16).toUpperCase();return"000000".substring(t.length)+t},Et.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var t=e[0];e[0].length===3&&(t=t.split("").map(function(s){return s+s}).join(""));var n=parseInt(t,16),i=n>>16&255,a=n>>8&255,o=n&255;return[i,a,o]},Et.rgb.hcg=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.max(Math.max(e,t),n),a=Math.min(Math.min(e,t),n),o=i-a,s,u;return o<1?s=a/(1-o):s=0,o<=0?u=0:i===e?u=(t-n)/o%6:i===t?u=2+(n-e)/o:u=4+(e-t)/o+4,u/=6,u%=1,[u*360,o*100,s*100]},Et.hsl.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1,i=0;return t<.5?n=2*e*t:n=2*e*(1-t),n<1&&(i=(t-.5*n)/(1-n)),[r[0],n*100,i*100]},Et.hsv.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=e*t,i=0;return n<1&&(i=(t-n)/(1-n)),[r[0],n*100,i*100]},Et.hcg.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100;if(t===0)return[n*255,n*255,n*255];var i=[0,0,0],a=e%1*6,o=a%1,s=1-o,u=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return u=(1-t)*n,[(t*i[0]+u)*255,(t*i[1]+u)*255,(t*i[2]+u)*255]},Et.hcg.hsv=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e),i=0;return n>0&&(i=e/n),[r[0],i*100,n*100]},Et.hcg.hsl=function(r){var e=r[1]/100,t=r[2]/100,n=t*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[r[0],i*100,n*100]},Et.hcg.hwb=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e);return[r[0],(n-e)*100,(1-n)*100]},Et.hwb.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1-t,i=n-e,a=0;return i<1&&(a=(n-i)/(1-i)),[r[0],i*100,a*100]},Et.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]},Et.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]},Et.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]},Et.gray.hsl=Et.gray.hsv=function(r){return[0,0,r[0]]},Et.gray.hwb=function(r){return[0,100,r[0]]},Et.gray.cmyk=function(r){return[0,0,0,r[0]]},Et.gray.lab=function(r){return[r[0],0,0]},Et.gray.hex=function(r){var e=Math.round(r[0]/100*255)&255,t=(e<<16)+(e<<8)+e,n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n},Et.rgb.gray=function(r){var e=(r[0]+r[1]+r[2])/3;return[e/255*100]};var TM=CM.exports,qh=TM;function e9(){for(var r={},e=Object.keys(qh),t=e.length,n=0;n<t;n++)r[e[n]]={distance:-1,parent:null};return r}function t9(r){var e=e9(),t=[r];for(e[r].distance=0;t.length;)for(var n=t.pop(),i=Object.keys(qh[n]),a=i.length,o=0;o<a;o++){var s=i[o],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,t.unshift(s))}return e}function r9(r,e){return function(t){return e(r(t))}}function n9(r,e){for(var t=[e[r].parent,r],n=qh[e[r].parent][r],i=e[r].parent;e[i].parent;)t.unshift(e[i].parent),n=r9(qh[e[i].parent][i],n),i=e[i].parent;return n.conversion=t,n}var i9=function(r){for(var e=t9(r),t={},n=Object.keys(e),i=n.length,a=0;a<i;a++){var o=n[a],s=e[o];s.parent!==null&&(t[o]=n9(o,e))}return t},A0=TM,a9=i9,nu={},o9=Object.keys(A0);function s9(r){var e=function(t){return t==null?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),r(t))};return"conversion"in r&&(e.conversion=r.conversion),e}function u9(r){var e=function(t){if(t==null)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=r(t);if(typeof n=="object")for(var i=n.length,a=0;a<i;a++)n[a]=Math.round(n[a]);return n};return"conversion"in r&&(e.conversion=r.conversion),e}o9.forEach(function(r){nu[r]={},Object.defineProperty(nu[r],"channels",{value:A0[r].channels}),Object.defineProperty(nu[r],"labels",{value:A0[r].labels});var e=a9(r),t=Object.keys(e);t.forEach(function(n){var i=e[n];nu[r][n]=u9(i),nu[r][n].raw=s9(i)})});var f9=nu,Xf=qU,Hn=f9,T0=[].slice,IM=["keyword","gray","hex"],I0={};Object.keys(Hn).forEach(function(r){I0[T0.call(Hn[r].labels).sort().join("")]=r});var Zh={};function xn(r,e){if(!(this instanceof xn))return new xn(r,e);if(e&&e in IM&&(e=null),e&&!(e in Hn))throw new Error("Unknown model: "+e);var t,n;if(r==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(r instanceof xn)this.model=r.model,this.color=r.color.slice(),this.valpha=r.valpha;else if(typeof r=="string"){var i=Xf.get(r);if(i===null)throw new Error("Unable to parse color from string: "+r);this.model=i.model,n=Hn[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(r.length){this.model=e||"rgb",n=Hn[this.model].channels;var a=T0.call(r,0,n);this.color=k0(a,n),this.valpha=typeof r[n]=="number"?r[n]:1}else if(typeof r=="number")r&=16777215,this.model="rgb",this.color=[r>>16&255,r>>8&255,r&255],this.valpha=1;else{this.valpha=1;var o=Object.keys(r);"alpha"in r&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof r.alpha=="number"?r.alpha:0);var s=o.sort().join("");if(!(s in I0))throw new Error("Unable to parse color from object: "+JSON.stringify(r));this.model=I0[s];var u=Hn[this.model].labels,f=[];for(t=0;t<u.length;t++)f.push(r[u[t]]);this.color=k0(f)}if(Zh[this.model])for(n=Hn[this.model].channels,t=0;t<n;t++){var l=Zh[this.model][t];l&&(this.color[t]=l(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}xn.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(r){var e=this.model in Xf.to?this:this.rgb();e=e.round(typeof r=="number"?r:1);var t=e.valpha===1?e.color:e.color.concat(this.valpha);return Xf.to[e.model](t)},percentString:function(r){var e=this.rgb().round(typeof r=="number"?r:1),t=e.valpha===1?e.color:e.color.concat(this.valpha);return Xf.to.rgb.percent(t)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var r={},e=Hn[this.model].channels,t=Hn[this.model].labels,n=0;n<e;n++)r[t[n]]=this.color[n];return this.valpha!==1&&(r.alpha=this.valpha),r},unitArray:function(){var r=this.rgb().color;return r[0]/=255,r[1]/=255,r[2]/=255,this.valpha!==1&&r.push(this.valpha),r},unitObject:function(){var r=this.rgb().object();return r.r/=255,r.g/=255,r.b/=255,this.valpha!==1&&(r.alpha=this.valpha),r},round:function(r){return r=Math.max(r||0,0),new xn(this.color.map(c9(r)).concat(this.valpha),this.model)},alpha:function(r){return arguments.length?new xn(this.color.concat(Math.max(0,Math.min(1,r))),this.model):this.valpha},red:Dr("rgb",0,rn(255)),green:Dr("rgb",1,rn(255)),blue:Dr("rgb",2,rn(255)),hue:Dr(["hsl","hsv","hsl","hwb","hcg"],0,function(r){return(r%360+360)%360}),saturationl:Dr("hsl",1,rn(100)),lightness:Dr("hsl",2,rn(100)),saturationv:Dr("hsv",1,rn(100)),value:Dr("hsv",2,rn(100)),chroma:Dr("hcg",1,rn(100)),gray:Dr("hcg",2,rn(100)),white:Dr("hwb",1,rn(100)),wblack:Dr("hwb",2,rn(100)),cyan:Dr("cmyk",0,rn(100)),magenta:Dr("cmyk",1,rn(100)),yellow:Dr("cmyk",2,rn(100)),black:Dr("cmyk",3,rn(100)),x:Dr("xyz",0,rn(100)),y:Dr("xyz",1,rn(100)),z:Dr("xyz",2,rn(100)),l:Dr("lab",0,rn(100)),a:Dr("lab",1),b:Dr("lab",2),keyword:function(r){return arguments.length?new xn(r):Hn[this.model].keyword(this.color)},hex:function(r){return arguments.length?new xn(r):Xf.to.hex(this.rgb().round().color)},rgbNumber:function(){var r=this.rgb().color;return(r[0]&255)<<16|(r[1]&255)<<8|r[2]&255},luminosity:function(){for(var r=this.rgb().color,e=[],t=0;t<r.length;t++){var n=r[t]/255;e[t]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(r){var e=this.luminosity(),t=r.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level:function(r){var e=this.contrast(r);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var r=this.rgb().color,e=(r[0]*299+r[1]*587+r[2]*114)/1e3;return e<128},isLight:function(){return!this.isDark()},negate:function(){for(var r=this.rgb(),e=0;e<3;e++)r.color[e]=255-r.color[e];return r},lighten:function(r){var e=this.hsl();return e.color[2]+=e.color[2]*r,e},darken:function(r){var e=this.hsl();return e.color[2]-=e.color[2]*r,e},saturate:function(r){var e=this.hsl();return e.color[1]+=e.color[1]*r,e},desaturate:function(r){var e=this.hsl();return e.color[1]-=e.color[1]*r,e},whiten:function(r){var e=this.hwb();return e.color[1]+=e.color[1]*r,e},blacken:function(r){var e=this.hwb();return e.color[2]+=e.color[2]*r,e},grayscale:function(){var r=this.rgb().color,e=r[0]*.3+r[1]*.59+r[2]*.11;return xn.rgb(e,e,e)},fade:function(r){return this.alpha(this.valpha-this.valpha*r)},opaquer:function(r){return this.alpha(this.valpha+this.valpha*r)},rotate:function(r){var e=this.hsl(),t=e.color[0];return t=(t+r)%360,t=t<0?360+t:t,e.color[0]=t,e},mix:function(r,e){if(!r||!r.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof r);var t=r.rgb(),n=this.rgb(),i=e===void 0?.5:e,a=2*i-1,o=t.alpha()-n.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,u=1-s;return xn.rgb(s*t.red()+u*n.red(),s*t.green()+u*n.green(),s*t.blue()+u*n.blue(),t.alpha()*i+n.alpha()*(1-i))}},Object.keys(Hn).forEach(function(r){if(IM.indexOf(r)===-1){var e=Hn[r].channels;xn.prototype[r]=function(){if(this.model===r)return new xn(this);if(arguments.length)return new xn(arguments,r);var t=typeof arguments[e]=="number"?e:this.valpha;return new xn(h9(Hn[this.model][r].raw(this.color)).concat(t),r)},xn[r]=function(t){return typeof t=="number"&&(t=k0(T0.call(arguments),e)),new xn(t,r)}}});function l9(r,e){return Number(r.toFixed(e))}function c9(r){return function(e){return l9(e,r)}}function Dr(r,e,t){return r=Array.isArray(r)?r:[r],r.forEach(function(n){(Zh[n]||(Zh[n]=[]))[e]=t}),r=r[0],function(n){var i;return arguments.length?(t&&(n=t(n)),i=this[r](),i.color[e]=n,i):(i=this[r]().color[e],t&&(i=t(i)),i)}}function rn(r){return function(e){return Math.max(0,Math.min(r,e))}}function h9(r){return Array.isArray(r)?r:[r]}function k0(r,e){for(var t=0;t<e;t++)typeof r[t]!="number"&&(r[t]=0);return r}var d9=xn;const Yf=Ji(d9);function Kh(r){"@babel/helpers - typeof";return Kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kh(r)}var v9=/^\s+/,p9=/\s+$/;function _t(r,e){if(r=r||"",e=e||{},r instanceof _t)return r;if(!(this instanceof _t))return new _t(r,e);var t=g9(r);this._originalInput=r,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}_t.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,i,a,o,s;return t=e.r/255,n=e.g/255,i=e.b/255,t<=.03928?a=t/12.92:a=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),.2126*a+.7152*o+.0722*s},setAlpha:function(e){return this._a=PM(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=LM(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=LM(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+i+"%)":"hsva("+t+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=kM(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=kM(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+i+"%)":"hsla("+t+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return NM(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return x9(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Cr(this._r,255)*100)+"%",g:Math.round(Cr(this._g,255)*100)+"%",b:Math.round(Cr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Cr(this._r,255)*100)+"%, "+Math.round(Cr(this._g,255)*100)+"%, "+Math.round(Cr(this._b,255)*100)+"%)":"rgba("+Math.round(Cr(this._r,255)*100)+"%, "+Math.round(Cr(this._g,255)*100)+"%, "+Math.round(Cr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:N9[NM(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+OM(this._r,this._g,this._b,this._a),n=t,i=this._gradientType?"GradientType = 1, ":"";if(e){var a=_t(e);n="#"+OM(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,i=this._a<1&&this._a>=0,a=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return a?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return _t(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(S9,arguments)},brighten:function(){return this._applyModification(M9,arguments)},darken:function(){return this._applyModification(C9,arguments)},desaturate:function(){return this._applyModification(w9,arguments)},saturate:function(){return this._applyModification(E9,arguments)},greyscale:function(){return this._applyModification(_9,arguments)},spin:function(){return this._applyModification(A9,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(k9,arguments)},complement:function(){return this._applyCombination(T9,arguments)},monochromatic:function(){return this._applyCombination(L9,arguments)},splitcomplement:function(){return this._applyCombination(I9,arguments)},triad:function(){return this._applyCombination(DM,[3])},tetrad:function(){return this._applyCombination(DM,[4])}},_t.fromRatio=function(r,e){if(Kh(r)=="object"){var t={};for(var n in r)r.hasOwnProperty(n)&&(n==="a"?t[n]=r[n]:t[n]=Wf(r[n]));r=t}return _t(r,e)};function g9(r){var e={r:0,g:0,b:0},t=1,n=null,i=null,a=null,o=!1,s=!1;return typeof r=="string"&&(r=R9(r)),Kh(r)=="object"&&(Ta(r.r)&&Ta(r.g)&&Ta(r.b)?(e=y9(r.r,r.g,r.b),o=!0,s=String(r.r).substr(-1)==="%"?"prgb":"rgb"):Ta(r.h)&&Ta(r.s)&&Ta(r.v)?(n=Wf(r.s),i=Wf(r.v),e=b9(r.h,n,i),o=!0,s="hsv"):Ta(r.h)&&Ta(r.s)&&Ta(r.l)&&(n=Wf(r.s),a=Wf(r.l),e=m9(r.h,n,a),o=!0,s="hsl"),r.hasOwnProperty("a")&&(t=r.a)),t=PM(t),{ok:o,format:r.format||s,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function y9(r,e,t){return{r:Cr(r,255)*255,g:Cr(e,255)*255,b:Cr(t,255)*255}}function kM(r,e,t){r=Cr(r,255),e=Cr(e,255),t=Cr(t,255);var n=Math.max(r,e,t),i=Math.min(r,e,t),a,o,s=(n+i)/2;if(n==i)a=o=0;else{var u=n-i;switch(o=s>.5?u/(2-n-i):u/(n+i),n){case r:a=(e-t)/u+(e<t?6:0);break;case e:a=(t-r)/u+2;break;case t:a=(r-e)/u+4;break}a/=6}return{h:a,s:o,l:s}}function m9(r,e,t){var n,i,a;r=Cr(r,360),e=Cr(e,100),t=Cr(t,100);function o(f,l,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?f+(l-f)*6*c:c<1/2?l:c<2/3?f+(l-f)*(2/3-c)*6:f}if(e===0)n=i=a=t;else{var s=t<.5?t*(1+e):t+e-t*e,u=2*t-s;n=o(u,s,r+1/3),i=o(u,s,r),a=o(u,s,r-1/3)}return{r:n*255,g:i*255,b:a*255}}function LM(r,e,t){r=Cr(r,255),e=Cr(e,255),t=Cr(t,255);var n=Math.max(r,e,t),i=Math.min(r,e,t),a,o,s=n,u=n-i;if(o=n===0?0:u/n,n==i)a=0;else{switch(n){case r:a=(e-t)/u+(e<t?6:0);break;case e:a=(t-r)/u+2;break;case t:a=(r-e)/u+4;break}a/=6}return{h:a,s:o,v:s}}function b9(r,e,t){r=Cr(r,360)*6,e=Cr(e,100),t=Cr(t,100);var n=Math.floor(r),i=r-n,a=t*(1-e),o=t*(1-i*e),s=t*(1-(1-i)*e),u=n%6,f=[t,o,a,a,s,t][u],l=[s,t,t,o,a,a][u],c=[a,a,s,t,t,o][u];return{r:f*255,g:l*255,b:c*255}}function NM(r,e,t,n){var i=[Mi(Math.round(r).toString(16)),Mi(Math.round(e).toString(16)),Mi(Math.round(t).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function x9(r,e,t,n,i){var a=[Mi(Math.round(r).toString(16)),Mi(Math.round(e).toString(16)),Mi(Math.round(t).toString(16)),Mi(RM(n))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function OM(r,e,t,n){var i=[Mi(RM(n)),Mi(Math.round(r).toString(16)),Mi(Math.round(e).toString(16)),Mi(Math.round(t).toString(16))];return i.join("")}_t.equals=function(r,e){return!r||!e?!1:_t(r).toRgbString()==_t(e).toRgbString()},_t.random=function(){return _t.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function w9(r,e){e=e===0?0:e||10;var t=_t(r).toHsl();return t.s-=e/100,t.s=Qh(t.s),_t(t)}function E9(r,e){e=e===0?0:e||10;var t=_t(r).toHsl();return t.s+=e/100,t.s=Qh(t.s),_t(t)}function _9(r){return _t(r).desaturate(100)}function S9(r,e){e=e===0?0:e||10;var t=_t(r).toHsl();return t.l+=e/100,t.l=Qh(t.l),_t(t)}function M9(r,e){e=e===0?0:e||10;var t=_t(r).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),_t(t)}function C9(r,e){e=e===0?0:e||10;var t=_t(r).toHsl();return t.l-=e/100,t.l=Qh(t.l),_t(t)}function A9(r,e){var t=_t(r).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,_t(t)}function T9(r){var e=_t(r).toHsl();return e.h=(e.h+180)%360,_t(e)}function DM(r,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=_t(r).toHsl(),n=[_t(r)],i=360/e,a=1;a<e;a++)n.push(_t({h:(t.h+a*i)%360,s:t.s,l:t.l}));return n}function I9(r){var e=_t(r).toHsl(),t=e.h;return[_t(r),_t({h:(t+72)%360,s:e.s,l:e.l}),_t({h:(t+216)%360,s:e.s,l:e.l})]}function k9(r,e,t){e=e||6,t=t||30;var n=_t(r).toHsl(),i=360/t,a=[_t(r)];for(n.h=(n.h-(i*e>>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(_t(n));return a}function L9(r,e){e=e||6;for(var t=_t(r).toHsv(),n=t.h,i=t.s,a=t.v,o=[],s=1/e;e--;)o.push(_t({h:n,s:i,v:a})),a=(a+s)%1;return o}_t.mix=function(r,e,t){t=t===0?0:t||50;var n=_t(r).toRgb(),i=_t(e).toRgb(),a=t/100,o={r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a};return _t(o)},_t.readability=function(r,e){var t=_t(r),n=_t(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)},_t.isReadable=function(r,e,t){var n=_t.readability(r,e),i,a;switch(a=!1,i=B9(t),i.level+i.size){case"AAsmall":case"AAAlarge":a=n>=4.5;break;case"AAlarge":a=n>=3;break;case"AAAsmall":a=n>=7;break}return a},_t.mostReadable=function(r,e,t){var n=null,i=0,a,o,s,u;t=t||{},o=t.includeFallbackColors,s=t.level,u=t.size;for(var f=0;f<e.length;f++)a=_t.readability(r,e[f]),a>i&&(i=a,n=_t(e[f]));return _t.isReadable(r,n,{level:s,size:u})||!o?n:(t.includeFallbackColors=!1,_t.mostReadable(r,["#fff","#000"],t))};var L0=_t.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},N9=_t.hexNames=O9(L0);function O9(r){var e={};for(var t in r)r.hasOwnProperty(t)&&(e[r[t]]=t);return e}function PM(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}function Cr(r,e){D9(r)&&(r="100%");var t=P9(r);return r=Math.min(e,Math.max(0,parseFloat(r))),t&&(r=parseInt(r*e,10)/100),Math.abs(r-e)<1e-6?1:r%e/parseFloat(e)}function Qh(r){return Math.min(1,Math.max(0,r))}function qn(r){return parseInt(r,16)}function D9(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}function P9(r){return typeof r=="string"&&r.indexOf("%")!=-1}function Mi(r){return r.length==1?"0"+r:""+r}function Wf(r){return r<=1&&(r=r*100+"%"),r}function RM(r){return Math.round(parseFloat(r)*255).toString(16)}function BM(r){return qn(r)/255}var Ci=function(){var r="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+r+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ta(r){return!!Ci.CSS_UNIT.exec(r)}function R9(r){r=r.replace(v9,"").replace(p9,"").toLowerCase();var e=!1;if(L0[r])r=L0[r],e=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Ci.rgb.exec(r))?{r:t[1],g:t[2],b:t[3]}:(t=Ci.rgba.exec(r))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Ci.hsl.exec(r))?{h:t[1],s:t[2],l:t[3]}:(t=Ci.hsla.exec(r))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Ci.hsv.exec(r))?{h:t[1],s:t[2],v:t[3]}:(t=Ci.hsva.exec(r))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Ci.hex8.exec(r))?{r:qn(t[1]),g:qn(t[2]),b:qn(t[3]),a:BM(t[4]),format:e?"name":"hex8"}:(t=Ci.hex6.exec(r))?{r:qn(t[1]),g:qn(t[2]),b:qn(t[3]),format:e?"name":"hex"}:(t=Ci.hex4.exec(r))?{r:qn(t[1]+""+t[1]),g:qn(t[2]+""+t[2]),b:qn(t[3]+""+t[3]),a:BM(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Ci.hex3.exec(r))?{r:qn(t[1]+""+t[1]),g:qn(t[2]+""+t[2]),b:qn(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function B9(r){var e,t;return r=r||{level:"AA",size:"small"},e=(r.level||"AA").toUpperCase(),t=(r.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var Jh=2,FM=.16,F9=.05,G9=.05,z9=.15,GM=5,zM=4,$9=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function $M(r,e,t){var n;return Math.round(r.h)>=60&&Math.round(r.h)<=240?n=t?Math.round(r.h)-Jh*e:Math.round(r.h)+Jh*e:n=t?Math.round(r.h)+Jh*e:Math.round(r.h)-Jh*e,n<0?n+=360:n>=360&&(n-=360),n}function jM(r,e,t){if(r.h===0&&r.s===0)return r.s;var n;return t?n=r.s-FM*e:e===zM?n=r.s+FM:n=r.s+F9*e,n>1&&(n=1),t&&e===GM&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function UM(r,e,t){var n;return t?n=r.v+G9*e:n=r.v-z9*e,n>1&&(n=1),Number(n.toFixed(2))}function ed(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=[],n=_t(r),i=GM;i>0;i-=1){var a=n.toHsv(),o=_t({h:$M(a,i,!0),s:jM(a,i,!0),v:UM(a,i,!0)}).toHexString();t.push(o)}t.push(n.toHexString());for(var s=1;s<=zM;s+=1){var u=n.toHsv(),f=_t({h:$M(u,s),s:jM(u,s),v:UM(u,s)}).toHexString();t.push(f)}return e.theme==="dark"?$9.map(function(l){var c=l.index,h=l.opacity,d=_t.mix(e.backgroundColor||"#141414",t[c],h*100).toHexString();return d}):t}var N0={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},O0={},D0={};Object.keys(N0).forEach(function(r){O0[r]=ed(N0[r]),O0[r].primary=O0[r][5],D0[r]=ed(N0[r],{theme:"dark",backgroundColor:"#141414"}),D0[r].primary=D0[r][5]});var nn=function(e,t,n){var i=Yf(e),a=Yf(t);return Yf([(1-n)*i.red()+n*a.red(),(1-n)*i.green()+n*a.green(),(1-n)*i.blue()+n*a.blue()]).rgb()},j9=function(e,t,n){t===void 0&&(t="#fff");var i=nn(t,e,.05).rgb().toString(),a=nn(t,e,.1).rgb().toString(),o=nn(t,e,.2).rgb().toString(),s=nn(t,e,.4).rgb().toString(),u=nn(t,n,.02).rgb().toString(),f=nn(t,n,.05).rgb().toString(),l=nn(t,n,.1).rgb().toString(),c=nn(t,n,.2).rgb().toString(),h=nn(t,n,.3).rgb().toString(),d=ed(e,{theme:"default",backgroundColor:t}),v=Yf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:e,mainFill:a,activeStroke:e,activeFill:i,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:t,highlightStroke:g,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:h,edgeActiveStroke:e,edgeInactiveStroke:c,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:l,comboMainStroke:h,comboMainFill:u,comboActiveStroke:e,comboActiveFill:i,comboInactiveStroke:h,comboInactiveFill:u,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:c,comboDisableFill:f}},U9=function(e,t,n){t===void 0&&(t="#fff");var i=nn(t,e,.2).rgb().toString(),a=nn(t,e,.3).rgb().toString(),o=nn(t,e,.6).rgb().toString(),s=nn(t,e,.8).rgb().toString(),u=nn(t,n,.2).rgb().toString(),f=nn(t,n,.25).rgb().toString(),l=nn(t,n,.3).rgb().toString(),c=nn(t,n,.4).rgb().toString(),h=nn(t,n,.5).rgb().toString(),d=ed(e,{theme:"dark",backgroundColor:t}),v=Yf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:s,mainFill:i,activeStroke:e,activeFill:a,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:i,highlightStroke:e,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:n,edgeActiveStroke:e,edgeInactiveStroke:n,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:l,comboMainStroke:c,comboMainFill:f,comboActiveStroke:e,comboActiveFill:u,comboInactiveStroke:c,comboInactiveFill:f,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:f,comboDisableStroke:c,comboDisableFill:u}},P0=function(e,t,n,i){return t===void 0&&(t="#fff"),n===void 0&&(n="default"),n==="default"?j9(e,t,"rgb(150, 150, 150)"):U9(e,t,"#777")},X9=function(e,t,n,i){t===void 0&&(t="#fff"),n===void 0&&(n="default");var a=[];return e.forEach(function(o){a.push(P0(o,t,n))}),a};const Y9=Object.freeze(Object.defineProperty({__proto__:null,getColorSetsBySubjectColors:X9,getColorsWithSubjectColor:P0,mixColor:nn},Symbol.toStringTag,{value:"Module"}));var W9="rgb(95, 149, 255)",V9="rgb(255, 255, 255)",XM="rgb(0, 0, 0)",Jt=P0(W9,V9);const Jo={version:"0.8.20",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:Jt.mainStroke,fill:Jt.mainFill},size:20,color:Jt.mainStroke,linkPoints:{size:8,lineWidth:1,fill:Jt.activeFill,stroke:Jt.activeStroke}},nodeStateStyles:{active:{fill:Jt.activeFill,stroke:Jt.activeStroke,lineWidth:2,shadowColor:Jt.mainStroke,shadowBlur:10},selected:{fill:Jt.selectedFill,stroke:Jt.selectedStroke,lineWidth:4,shadowColor:Jt.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:Jt.highlightFill,stroke:Jt.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:Jt.inactiveFill,stroke:Jt.inactiveStroke,lineWidth:1},disable:{fill:Jt.disableFill,stroke:Jt.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:XM,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:Jt.edgeMainStroke,lineAppendWidth:2},color:Jt.edgeMainStroke},edgeStateStyles:{active:{stroke:Jt.edgeActiveStroke,lineWidth:1},selected:{stroke:Jt.edgeSelectedStroke,lineWidth:2,shadowColor:Jt.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Jt.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:Jt.edgeInactiveStroke,lineWidth:1},disable:{stroke:Jt.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:XM,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:Jt.comboMainFill,lineWidth:1,stroke:Jt.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:Jt.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:Jt.comboActiveStroke,lineWidth:1,fill:Jt.comboActiveFill},selected:{stroke:Jt.comboSelectedStroke,lineWidth:2,fill:Jt.comboSelectedFill,shadowColor:Jt.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Jt.comboHighlightStroke,lineWidth:2,fill:Jt.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:Jt.comboInactiveStroke,fill:Jt.comboInactiveFill,lineWidth:1},disable:{stroke:Jt.comboDisableStroke,fill:Jt.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"};function td(r,e,t){if(r){if(typeof r.addEventListener=="function")return r.addEventListener(e,t,!1),{remove:function(){r.removeEventListener(e,t,!1)}};if(typeof r.attachEvent=="function")return r.attachEvent("on"+e,t),{remove:function(){r.detachEvent("on"+e,t)}}}}var Vf,R0,YM,B0;function H9(){Vf=document.createElement("table"),R0=document.createElement("tr"),YM=/^\s*<(\w+|!)[^>]*>/,B0={tr:document.createElement("tbody"),tbody:Vf,thead:Vf,tfoot:Vf,td:R0,th:R0,"*":document.createElement("div")}}function wr(r){Vf||H9();var e=YM.test(r)&&RegExp.$1;(!e||!(e in B0))&&(e="*");var t=B0[e];r=typeof r=="string"?r.replace(/(^\s*)|(\s*$)/g,""):r,t.innerHTML=""+r;var n=t.childNodes[0];return n&&t.contains(n)&&t.removeChild(n),n}function jt(r,e){if(r)for(var t in e)e.hasOwnProperty(t)&&(r.style[t]=e[t]);return r}var q9=bn.cloneEvent,Z9=bn.isViewportChanged,K9=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;return n.extendEvents=[],n.dragging=!1,n.mousedown=!1,n.preItem=null,n.destroy(),n.graph=t,n.destroyed=!1,n.initEvents(),n}return e.prototype.initEvents=function(){var t=this,n=t.graph,i=t.extendEvents,a=i===void 0?[]:i,o=n.get("canvas"),s=o.get("el"),u=Go(this,"onCanvasEvents"),f=Go(this,"onExtendEvents"),l=Go(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,a.push(td(s,"wheel",l)),typeof window<"u"&&(a.push(td(window,"keydown",f)),a.push(td(window,"keyup",f)),a.push(td(window,"focus",f))),this.resetHandler&&n.off("afterchangedata",this.resetHandler),this.resetHandler=Go(this,"resetStatus"),n.on("afterchangedata",this.resetHandler)},e.getItemRoot=function(t){for(;t&&!t.get("item");)t=t.get("parent");return t},e.prototype.onCanvasEvents=function(t){var n=this,i=this.graph,a=i.get("canvas"),o=t.target,s=t.type;switch(s){case"drag":this.onCanvasEvents(Object.assign({},t,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},t,{type:"mouseup"}));break;case"mousedown":this.mousedown=!0;break;case"dragend":case"mouseup":setTimeout(function(){return n.mousedown=!1});break;case"click":if(!this.mousedown)return;break}t.canvasX=t.x,t.canvasY=t.y;var u={x:t.canvasX,y:t.canvasY},f=i.get("group"),l=f.getMatrix();if(l||(l=[1,0,0,0,1,0,0,0,1]),Z9(l)&&(u=i.getPointByClient(t.clientX,t.clientY)),t.x=u.x,t.y=u.y,t.currentTarget=i,o===a){(s==="mousemove"||s==="mouseleave")&&this.handleMouseMove(t,"canvas"),t.target=a,t.item=null,i.emit(s,t),i.emit("canvas:".concat(s),t);return}var c=e.getItemRoot(o);if(!c){i.emit(s,t);return}var h=c.get("item");if(!h.destroyed){var d=h.getType();if(t.target=o,t.item=h,t.canvasX===t.x&&t.canvasY===t.y){var v=i.getCanvasByPoint(t.x,t.y);t.canvasX=v.x,t.canvasY=v.y}t.name&&!t.name.includes(":")?(i.emit("".concat(d,":").concat(s),t),i.emit(s,t)):t.name&&i.emit(t.name,t),s==="dragstart"&&(this.dragging=!0),s==="dragend"&&(this.dragging=!1),s==="mousemove"&&this.handleMouseMove(t,d)}},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){ct(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,n){var i=this,a=i.graph,o=i.preItem,s=a.get("canvas"),u=t.target===s?null:t.item;t=q9(t),o&&o!==u&&!o.destroyed&&(t.item=o,this.emitCustomEvent(o.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(o.getType(),"dragleave",t)),u&&o!==u&&(t.item=u,this.emitCustomEvent(n,"mouseenter",t),this.dragging&&this.emitCustomEvent(n,"dragenter",t)),this.preItem=u},e.prototype.emitCustomEvent=function(t,n,i){i.type=n,this.graph.emit("".concat(t,":").concat(n),i)},e.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},e.prototype.destroy=function(){var t=this,n=t.graph,i=t.canvasHandler,a=t.extendEvents,o=n.get("canvas");o.off("*",i),ye(a,function(s){s.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(J_),Ht={},Ia={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.Base=void 0;var Q9=function(){function r(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.vedges=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return r.prototype.layout=function(e){return this.init(e),this.execute(!0)},r.prototype.init=function(e){this.nodes=e.nodes||[],this.edges=e.edges||[],this.combos=e.combos||[],this.comboEdges=e.comboEdges||[],this.hiddenNodes=e.hiddenNodes||[],this.hiddenEdges=e.hiddenEdges||[],this.hiddenCombos=e.hiddenCombos||[],this.vedges=e.vedges||[]},r.prototype.execute=function(e){},r.prototype.executeWithWorker=function(){},r.prototype.getDefaultCfg=function(){return{}},r.prototype.updateCfg=function(e){e&&Object.assign(this,e)},r.prototype.getType=function(){return"base"},r.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},r}();Pr.Base=Q9;var F0={},iu={};Object.defineProperty(iu,"__esModule",{value:!0}),iu.camelize=iu.isString=void 0;var J9=function(r){return typeof r=="string"};iu.isString=J9;var e7=function(r){var e=Object.create(null);return function(t){var n=e[t];return n||(e[t]=r(t))}},t7=/-(\w)/g;iu.camelize=e7(function(r){return r.replace(t7,function(e,t){return t?t.toUpperCase():""})});var Hf={};Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.isArray=void 0,Hf.isArray=Array.isArray;var rd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.toNumber=r.isNaN=r.isNumber=void 0;var e=function(i){return typeof i=="number"};r.isNumber=e;var t=function(i){return Number.isNaN(Number(i))};r.isNaN=t;var n=function(i){var a=parseFloat(i);return(0,r.isNaN)(a)?i:a};r.toNumber=n})(rd);var nd={},G0={};(function(r){var e=xe&&xe.__assign||function(){return e=Object.assign||function(i){for(var a,o=1,s=arguments.length;o<s;o++){a=arguments[o];for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u])}return i},e.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),r.clone=r.isObject=void 0;var t=function(i){return i!==null&&typeof i=="object"};r.isObject=t;var n=function(i){if(i===null)return i;if(i instanceof Date)return new Date(i.getTime());if(i instanceof Array){var a=[];return i.forEach(function(s){a.push(s)}),a.map(function(s){return(0,r.clone)(s)})}if(typeof i=="object"&&Object.keys(i).length){var o=e({},i);return Object.keys(o).forEach(function(s){o[s]=(0,r.clone)(o[s])}),o}return i};r.clone=n})(G0),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.getCoreNodeAndRelativeLeafNodes=r.getAvgNodePosition=r.getLayoutBBox=r.traverseTreeUp=r.scaleMatrix=r.getAdjMatrix=r.floydWarshall=r.getDegreeMap=r.getDegree=r.getEdgeTerminal=void 0;var e=Hf,t=rd,n=G0,i=function(m,b){var x=m[b];return(0,n.isObject)(x)?x.cell:x};r.getEdgeTerminal=i;var a=function(m,b,x){for(var w=[],E=0;E<m;E++)w[E]={in:0,out:0,all:0};return x&&x.forEach(function(_){var M=(0,r.getEdgeTerminal)(_,"source"),C=(0,r.getEdgeTerminal)(_,"target");M&&w[b[M]]&&(w[b[M]].out+=1,w[b[M]].all+=1),C&&w[b[C]]&&(w[b[C]].in+=1,w[b[C]].all+=1)}),w};r.getDegree=a;var o=function(m,b){var x={};return m.forEach(function(w){x[w.id]={in:0,out:0,all:0}}),b&&b.forEach(function(w){var E=(0,r.getEdgeTerminal)(w,"source"),_=(0,r.getEdgeTerminal)(w,"target");E&&(x[E].out+=1,x[E].all+=1),_&&(x[_].in+=1,x[_].all+=1)}),x};r.getDegreeMap=o;var s=function(m){for(var b=[],x=m.length,w=0;w<x;w+=1){b[w]=[];for(var E=0;E<x;E+=1)w===E?b[w][E]=0:m[w][E]===0||!m[w][E]?b[w][E]=1/0:b[w][E]=m[w][E]}for(var _=0;_<x;_+=1)for(var w=0;w<x;w+=1)for(var E=0;E<x;E+=1)b[w][E]>b[w][_]+b[_][E]&&(b[w][E]=b[w][_]+b[_][E]);return b};r.floydWarshall=s;var u=function(m,b){var x=m.nodes,w=m.edges,E=[],_={};if(!x)throw new Error("invalid nodes data!");return x&&x.forEach(function(M,C){_[M.id]=C;var S=[];E.push(S)}),w==null||w.forEach(function(M){var C=(0,r.getEdgeTerminal)(M,"source"),S=(0,r.getEdgeTerminal)(M,"target"),A=_[C],T=_[S];A===void 0||T===void 0||(E[A][T]=1,b||(E[T][A]=1))}),E};r.getAdjMatrix=u;var f=function(m,b){var x=[];return m.forEach(function(w){var E=[];w.forEach(function(_){E.push(_*b)}),x.push(E)}),x};r.scaleMatrix=f;var l=function(m,b){if(m&&m.children){for(var x=m.children.length-1;x>=0;x--)if(!l(m.children[x],b))return}return!!b(m)},c=function(m,b){typeof b=="function"&&l(m,b)};r.traverseTreeUp=c;var h=function(m){var b=1/0,x=1/0,w=-1/0,E=-1/0;return m.forEach(function(_){var M=_.size;(0,e.isArray)(M)?M.length===1&&(M=[M[0],M[0]]):(0,t.isNumber)(M)?M=[M,M]:(M===void 0||isNaN(M))&&(M=[30,30]);var C=[M[0]/2,M[1]/2],S=_.x-C[0],A=_.x+C[0],T=_.y-C[1],k=_.y+C[1];b>S&&(b=S),x>T&&(x=T),w<A&&(w=A),E<k&&(E=k)}),{minX:b,minY:x,maxX:w,maxY:E}};r.getLayoutBBox=h;var d=function(m){var b={x:0,y:0};m.forEach(function(w){b.x+=w.x||0,b.y+=w.y||0});var x=m.length||1;return{x:b.x/x,y:b.y/x}};r.getAvgNodePosition=d;var v=function(m,b,x){var w,E;return m==="source"?((w=x==null?void 0:x.find(function(_){return _.target===b.id}))===null||w===void 0?void 0:w.source)||{}:((E=x==null?void 0:x.find(function(_){return _.source===b.id}))===null||E===void 0?void 0:E.target)||{}},p=function(m,b,x){var w=[];switch(m){case"source":w=x==null?void 0:x.filter(function(_){return _.source===b.id}).map(function(_){return _.target});break;case"target":w=x==null?void 0:x.filter(function(_){return _.target===b.id}).map(function(_){return _.source});break;case"both":w=x==null?void 0:x.filter(function(_){return _.source===b.id}).map(function(_){return _.target}).concat(x==null?void 0:x.filter(function(_){return _.target===b.id}).map(function(_){return _.source}));break}var E=new Set(w);return Array.from(E)},g=function(m,b,x,w,E){var _=x[b]||"",M=(w==null?void 0:w.filter(function(C){return C[b]===_}))||[];return m==="leaf"&&(M=M.filter(function(C){var S,A;return((S=E[C.id])===null||S===void 0?void 0:S.in)===0||((A=E[C.id])===null||A===void 0?void 0:A.out)===0})),M},y=function(m,b,x,w,E,_){var M=E[b.id],C=M.in,S=M.out,A=b,T=[];C===0?(A=v("source",b,x),T=p("both",A,x).map(function(O){return _[O]})):S===0&&(A=v("target",b,x),T=p("both",A,x).map(function(O){return _[O]})),T=T.filter(function(O){return E[O.id]&&(E[O.id].in===0||E[O.id].out===0)});var k=g(m,w,b,T,E);return{coreNode:A,relativeLeafNodes:T,sameTypeLeafNodes:k}};r.getCoreNodeAndRelativeLeafNodes=y}(nd);var z0={},WM;function r7(){return WM||(WM=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.getFuncByUnknownType=r.getFunc=r.isFunction=void 0;var e=Ir(),t=rd,n=function(o){return typeof o=="function"};r.isFunction=n;var i=function(o,s,u){var f;return u?f=u:(0,t.isNumber)(o)?f=function(){return o}:f=function(){return s},f};r.getFunc=i;var a=function(o,s,u){return u===void 0&&(u=!0),!s&&s!==0?function(f){return f.size?(0,e.isArray)(f.size)?f.size[0]>f.size[1]?f.size[0]:f.size[1]:(0,e.isObject)(f.size)?f.size.width>f.size.height?f.size.width:f.size.height:f.size:o}:(0,r.isFunction)(s)?s:(0,t.isNumber)(s)?function(){return s}:(0,e.isArray)(s)?function(){if(u){var f=Math.max.apply(Math,s);return isNaN(f)?o:f}return s}:(0,e.isObject)(s)?function(){if(u){var f=Math.max(s.width,s.height);return isNaN(f)?o:f}return[s.width,s.height]}:function(){return o}};r.getFuncByUnknownType=a}(z0)),z0}var VM;function Ir(){return VM||(VM=1,function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(iu,r),t(Hf,r),t(rd,r),t(nd,r),t(G0,r),t(r7(),r)}(F0)),F0}var n7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.getLayoutByName=Ia.unRegisterLayout=Ia.registerLayout=void 0;var i7=Pr,a7=Ir(),vo=new Map,o7=function(r,e){if(vo.get(r)&&console.warn("The layout with the name ".concat(r," exists already, it will be overridden")),(0,a7.isObject)(e)){var t=function(n){n7(i,n);function i(a){var o=this,s;o=n.call(this)||this;var u=o,f={},l=Object.assign({},u.getDefaultCfg(),((s=e.getDefaultCfg)===null||s===void 0?void 0:s.call(e))||{});return Object.assign(f,l,e,a),Object.keys(f).forEach(function(c){var h=f[c];u[c]=h}),o}return i}(i7.Base);vo.set(r,t)}else vo.set(r,e);return vo.get(r)};Ia.registerLayout=o7;var s7=function(r){vo.has(r)&&vo.delete(r)};Ia.unRegisterLayout=s7;var u7=function(r){return vo.has(r)?vo.get(r):null};Ia.getLayoutByName=u7;var $0={},qf={},f7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(qf,"__esModule",{value:!0}),qf.GridLayout=void 0;var au=Ir(),l7=Pr,c7=function(r){f7(e,r);function e(t){var n=r.call(this)||this;return n.begin=[0,0],n.preventOverlap=!0,n.preventOverlapPadding=10,n.condense=!1,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.row=0,n.col=0,n.cellWidth=0,n.cellHeight=0,n.cellUsed={},n.id2manPos={},n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges,a=t.begin,o=n.length;if(o===0)return t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i};if(o===1)return n[0].x=a[0],n[0].y=a[1],t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i};var s=t.sortBy,u=t.width,f=t.height,l=t.condense,c=t.preventOverlapPadding,h=t.preventOverlap,d=t.nodeSpacing,v=t.nodeSize,p=[];n.forEach(function(T){p.push(T)});var g={};if(p.forEach(function(T,k){g[T.id]=k}),(s==="degree"||!(0,au.isString)(s)||p[0][s]===void 0)&&(s="degree",(0,au.isNaN)(n[0].degree))){var y=(0,au.getDegree)(p.length,g,i);p.forEach(function(T,k){T.degree=y[k].all})}p.sort(function(T,k){return k[s]-T[s]}),!u&&typeof window<"u"&&(u=window.innerWidth),!f&&typeof window<"u"&&(f=window.innerHeight);var m=t.rows,b=t.cols!=null?t.cols:t.columns;if(t.cells=o,m!=null&&b!=null?(t.rows=m,t.cols=b):m!=null&&b==null?(t.rows=m,t.cols=Math.ceil(t.cells/t.rows)):m==null&&b!=null?(t.cols=b,t.rows=Math.ceil(t.cells/t.cols)):(t.splits=Math.sqrt(t.cells*t.height/t.width),t.rows=Math.round(t.splits),t.cols=Math.round(t.width/t.height*t.splits)),t.rows=Math.max(t.rows,1),t.cols=Math.max(t.cols,1),t.cols*t.rows>t.cells){var x=t.small(),w=t.large();(x-1)*w>=t.cells?t.small(x-1):(w-1)*x>=t.cells&&t.large(w-1)}else for(;t.cols*t.rows<t.cells;){var x=t.small(),w=t.large();(w+1)*x>=t.cells?t.large(w+1):t.small(x+1)}if(t.cellWidth=u/t.cols,t.cellHeight=f/t.rows,l&&(t.cellWidth=0,t.cellHeight=0),h||d){var E=(0,au.getFuncByUnknownType)(10,d),_=(0,au.getFuncByUnknownType)(30,v,!1);p.forEach(function(T){(!T.x||!T.y)&&(T.x=0,T.y=0);var k=_(T)||30,O,G;(0,au.isArray)(k)?(O=k[0],G=k[1]):(O=k,G=k);var D=E!==void 0?E(T):c,$=O+D,Y=G+D;t.cellWidth=Math.max(t.cellWidth,$),t.cellHeight=Math.max(t.cellHeight,Y)})}t.cellUsed={},t.row=0,t.col=0,t.id2manPos={};for(var M=0;M<p.length;M++){var C=p[M],S=void 0;if(t.position&&(S=t.position(C)),S&&(S.row!==void 0||S.col!==void 0)){var A={row:S.row,col:S.col};if(A.col===void 0)for(A.col=0;t.used(A.row,A.col);)A.col++;else if(A.row===void 0)for(A.row=0;t.used(A.row,A.col);)A.row++;t.id2manPos[C.id]=A,t.use(A.row,A.col)}t.getPos(C)}return t.onLayoutEnd&&t.onLayoutEnd(),{edges:i,nodes:p}},e.prototype.small=function(t){var n=this,i,a=n.rows||5,o=n.cols||5;if(t==null)i=Math.min(a,o);else{var s=Math.min(a,o);s===n.rows?n.rows=t:n.cols=t}return i},e.prototype.large=function(t){var n=this,i,a=n.rows||5,o=n.cols||5;if(t==null)i=Math.max(a,o);else{var s=Math.max(a,o);s===n.rows?n.rows=t:n.cols=t}return i},e.prototype.used=function(t,n){var i=this;return i.cellUsed["c-".concat(t,"-").concat(n)]||!1},e.prototype.use=function(t,n){var i=this;i.cellUsed["c-".concat(t,"-").concat(n)]=!0},e.prototype.moveToNextCell=function(){var t=this,n=t.cols||5;t.col++,t.col>=n&&(t.col=0,t.row++)},e.prototype.getPos=function(t){var n=this,i=n.begin,a=n.cellWidth,o=n.cellHeight,s,u,f=n.id2manPos[t.id];if(f)s=f.col*a+a/2+i[0],u=f.row*o+o/2+i[1];else{for(;n.used(n.row,n.col);)n.moveToNextCell();s=n.col*a+a/2+i[0],u=n.row*o+o/2+i[1],n.use(n.row,n.col),n.moveToNextCell()}t.x=s,t.y=u},e.prototype.getType=function(){return"grid"},e}(l7.Base);qf.GridLayout=c7;var Zf={},h7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Zf,"__esModule",{value:!0}),Zf.RandomLayout=void 0;var d7=Pr,v7=function(r){h7(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var t=this,n=t.nodes,i=.9,a=t.center;return!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),n&&n.forEach(function(o){o.x=(Math.random()-.5)*i*t.width+a[0],o.y=(Math.random()-.5)*i*t.height+a[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(d7.Base);Zf.RandomLayout=v7;var Kf={},p7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Kf,"__esModule",{value:!0}),Kf.GForceLayout=void 0;var g7=Pr,An=Ir(),j0=function(r,e){var t;return r?(0,An.isNumber)(r)?t=function(n){return r}:t=r:t=function(n){return e},t},y7=function(r){p7(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=500,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.preventOverlap=!0,n.collideStrength=1,n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.animate=!0,n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t,n,i=this,a=i.nodes;if(i.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(i.timeInterval),!a||a.length===0){(t=i.onLayoutEnd)===null||t===void 0||t.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var o=i.center;if(a.length===1){a[0].x=o[0],a[0].y=o[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var s={},u={};a.forEach(function(v,p){(0,An.isNumber)(v.x)||(v.x=Math.random()*i.width),(0,An.isNumber)(v.y)||(v.y=Math.random()*i.height),s[v.id]=v,u[v.id]=p}),i.nodeMap=s,i.nodeIdxMap=u,i.linkDistance=j0(i.linkDistance,1),i.nodeStrength=j0(i.nodeStrength,1),i.edgeStrength=j0(i.edgeStrength,1);var f=i.nodeSize,l;if(i.preventOverlap){var c=i.nodeSpacing,h;(0,An.isNumber)(c)?h=function(){return c}:(0,An.isFunction)(c)?h=c:h=function(){return 0},f?(0,An.isArray)(f)?l=function(v){return Math.max(f[0],f[1])+h(v)}:l=function(v){return f+h(v)}:l=function(v){return v.size?(0,An.isArray)(v.size)?Math.max(v.size[0],v.size[1])+h(v):(0,An.isObject)(v.size)?Math.max(v.size.width,v.size.height)+h(v):v.size+h(v):10+h(v)}}i.nodeSize=l;var d=i.edges;i.degrees=(0,An.getDegree)(a.length,i.nodeIdxMap,d),i.getMass||(i.getMass=function(v){var p=v.mass||i.degrees[i.nodeIdxMap[v.id]].all||1;return p}),i.run()},e.prototype.run=function(){var t,n=this,i=n.maxIteration,a=n.nodes,o=n.workerEnabled,s=n.minMovement,u=n.animate;if(a)if(o||!u){for(var f=0;f<i;f++){var l=n.runOneStep(f);if(n.reachMoveThreshold(a,l,s))break}(t=n.onLayoutEnd)===null||t===void 0||t.call(n)}else{if(typeof window>"u")return;var c=0;this.timeInterval=window.setInterval(function(){var h,d;if(a){var v=n.runOneStep(c)||[];n.reachMoveThreshold(a,v,s)&&((h=n.onLayoutEnd)===null||h===void 0||h.call(n),window.clearInterval(n.timeInterval)),c++,c>=i&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))}},0)}},e.prototype.reachMoveThreshold=function(t,n,i){var a=0;return t.forEach(function(o,s){var u=o.x-n[s].x,f=o.y-n[s].y;a+=Math.sqrt(u*u+f*f)}),a/=t.length,a<i},e.prototype.runOneStep=function(t){var n,i=this,a=i.nodes,o=i.edges,s=[],u=[];if(a){a.forEach(function(c,h){s[2*h]=0,s[2*h+1]=0,u[2*h]=0,u[2*h+1]=0}),i.calRepulsive(s,a),o&&i.calAttractive(s,o),i.calGravity(s,a);var f=Math.max(.02,i.interval-t*.002);i.updateVelocity(s,u,f,a);var l=[];return a.forEach(function(c){l.push({x:c.x,y:c.y})}),i.updatePosition(u,f,a),(n=i.tick)===null||n===void 0||n.call(i),l}},e.prototype.calRepulsive=function(t,n){var i=this,a=i.getMass,o=i.factor,s=i.coulombDisScale,u=i.preventOverlap,f=i.collideStrength,l=f===void 0?1:f,c=i.nodeStrength,h=i.nodeSize;n.forEach(function(d,v){var p=a?a(d):1;n.forEach(function(g,y){if(!(v>=y)){var m=d.x-g.x,b=d.y-g.y;m===0&&b===0&&(m=Math.random()*.01,b=Math.random()*.01);var x=m*m+b*b,w=Math.sqrt(x),E=(w+.1)*s,_=m/w,M=b/w,C=(c(d)+c(g))*.5*o/(E*E),S=a?a(g):1;if(t[2*v]+=_*C,t[2*v+1]+=M*C,t[2*y]-=_*C,t[2*y+1]-=M*C,u&&(h(d)+h(g))/2>w){var A=l*(c(d)+c(g))*.5/x;t[2*v]+=_*A/p,t[2*v+1]+=M*A/p,t[2*y]-=_*A/S,t[2*y+1]-=M*A/S}}})})},e.prototype.calAttractive=function(t,n){var i=this,a=i.nodeMap,o=i.nodeIdxMap,s=i.linkDistance,u=i.edgeStrength,f=i.nodeSize,l=i.getMass;n.forEach(function(c,h){var d=(0,An.getEdgeTerminal)(c,"source"),v=(0,An.getEdgeTerminal)(c,"target"),p=a[d],g=a[v],y=g.x-p.x,m=g.y-p.y;y===0&&m===0&&(y=Math.random()*.01,m=Math.random()*.01);var b=Math.sqrt(y*y+m*m),x=y/b,w=m/b,E=s(c,p,g)||1+(f(p)+f(g)||0)/2,_=E-b,M=_*u(c),C=o[d],S=o[v],A=l?l(p):1,T=l?l(g):1;t[2*C]-=x*M/A,t[2*C+1]-=w*M/A,t[2*S]+=x*M/T,t[2*S+1]+=w*M/T})},e.prototype.calGravity=function(t,n){for(var i=this,a=i.center,o=i.gravity,s=i.degrees,u=n.length,f=0;f<u;f++){var l=n[f],c=l.x-a[0],h=l.y-a[1],d=o;if(i.getCenter){var v=i.getCenter(l,s[f].all);v&&(0,An.isNumber)(v[0])&&(0,An.isNumber)(v[1])&&(0,An.isNumber)(v[2])&&(c=l.x-v[0],h=l.y-v[1],d=v[2])}d&&(t[2*f]-=d*c,t[2*f+1]-=d*h)}},e.prototype.updateVelocity=function(t,n,i,a){var o=this,s=i*o.damping;a.forEach(function(u,f){var l=t[2*f]*s||.01,c=t[2*f+1]*s||.01,h=Math.sqrt(l*l+c*c);if(h>o.maxSpeed){var d=o.maxSpeed/h;l=d*l,c=d*c}n[2*f]=l,n[2*f+1]=c})},e.prototype.updatePosition=function(t,n,i){i.forEach(function(a,o){if((0,An.isNumber)(a.fx)&&(0,An.isNumber)(a.fy)){a.x=a.fx,a.y=a.fy;return}var s=t[2*o]*n,u=t[2*o+1]*n;a.x+=s,a.y+=u})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(g7.Base);Kf.GForceLayout=y7;var Qf={},id={};function m7(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return HM(this.cover(e,t),e,t,r)}function HM(r,e,t,n){if(isNaN(e)||isNaN(t))return r;var i,a=r._root,o={data:n},s=r._x0,u=r._y0,f=r._x1,l=r._y1,c,h,d,v,p,g,y,m;if(!a)return r._root=o,r;for(;a.length;)if((p=e>=(c=(s+f)/2))?s=c:f=c,(g=t>=(h=(u+l)/2))?u=h:l=h,i=a,!(a=a[y=g<<1|p]))return i[y]=o,r;if(d=+r._x.call(null,a.data),v=+r._y.call(null,a.data),e===d&&t===v)return o.next=a,i?i[y]=o:r._root=o,r;do i=i?i[y]=new Array(4):r._root=new Array(4),(p=e>=(c=(s+f)/2))?s=c:f=c,(g=t>=(h=(u+l)/2))?u=h:l=h;while((y=g<<1|p)===(m=(v>=h)<<1|d>=c));return i[m]=a,i[y]=o,r}function b7(r){var e,t,n=r.length,i,a,o=new Array(n),s=new Array(n),u=1/0,f=1/0,l=-1/0,c=-1/0;for(t=0;t<n;++t)isNaN(i=+this._x.call(null,e=r[t]))||isNaN(a=+this._y.call(null,e))||(o[t]=i,s[t]=a,i<u&&(u=i),i>l&&(l=i),a<f&&(f=a),a>c&&(c=a));if(u>l||f>c)return this;for(this.cover(u,f).cover(l,c),t=0;t<n;++t)HM(this,o[t],s[t],r[t]);return this}function x7(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(t))i=(t=Math.floor(r))+1,a=(n=Math.floor(e))+1;else{for(var o=i-t||1,s=this._root,u,f;t>r||r>=i||n>e||e>=a;)switch(f=(e<n)<<1|r<t,u=new Array(4),u[f]=s,s=u,o*=2,f){case 0:i=t+o,a=n+o;break;case 1:t=i-o,a=n+o;break;case 2:i=t+o,n=a-o;break;case 3:t=i-o,n=a-o;break}this._root&&this._root.length&&(this._root=s)}return this._x0=t,this._y0=n,this._x1=i,this._y1=a,this}function w7(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function E7(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function In(r,e,t,n,i){this.node=r,this.x0=e,this.y0=t,this.x1=n,this.y1=i}function _7(r,e,t){var n,i=this._x0,a=this._y0,o,s,u,f,l=this._x1,c=this._y1,h=[],d=this._root,v,p;for(d&&h.push(new In(d,i,a,l,c)),t==null?t=1/0:(i=r-t,a=e-t,l=r+t,c=e+t,t*=t);v=h.pop();)if(!(!(d=v.node)||(o=v.x0)>l||(s=v.y0)>c||(u=v.x1)<i||(f=v.y1)<a))if(d.length){var g=(o+u)/2,y=(s+f)/2;h.push(new In(d[3],g,y,u,f),new In(d[2],o,y,g,f),new In(d[1],g,s,u,y),new In(d[0],o,s,g,y)),(p=(e>=y)<<1|r>=g)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-p],h[h.length-1-p]=v)}else{var m=r-+this._x.call(null,d.data),b=e-+this._y.call(null,d.data),x=m*m+b*b;if(x<t){var w=Math.sqrt(t=x);i=r-w,a=e-w,l=r+w,c=e+w,n=d.data}}return n}function S7(r){if(isNaN(l=+this._x.call(null,r))||isNaN(c=+this._y.call(null,r)))return this;var e,t=this._root,n,i,a,o=this._x0,s=this._y0,u=this._x1,f=this._y1,l,c,h,d,v,p,g,y;if(!t)return this;if(t.length)for(;;){if((v=l>=(h=(o+u)/2))?o=h:u=h,(p=c>=(d=(s+f)/2))?s=d:f=d,e=t,!(t=t[g=p<<1|v]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,y=g)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(a=t.next)&&delete t.next,i?(a?i.next=a:delete i.next,this):e?(a?e[g]=a:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[y]=t:this._root=t),this):(this._root=a,this)}function M7(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function C7(){return this._root}function A7(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function T7(r){var e=[],t,n=this._root,i,a,o,s,u;for(n&&e.push(new In(n,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(n=t.node,a=t.x0,o=t.y0,s=t.x1,u=t.y1)&&n.length){var f=(a+s)/2,l=(o+u)/2;(i=n[3])&&e.push(new In(i,f,l,s,u)),(i=n[2])&&e.push(new In(i,a,l,f,u)),(i=n[1])&&e.push(new In(i,f,o,s,l)),(i=n[0])&&e.push(new In(i,a,o,f,l))}return this}function I7(r){var e=[],t=[],n;for(this._root&&e.push(new In(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var a,o=n.x0,s=n.y0,u=n.x1,f=n.y1,l=(o+u)/2,c=(s+f)/2;(a=i[0])&&e.push(new In(a,o,s,l,c)),(a=i[1])&&e.push(new In(a,l,s,u,c)),(a=i[2])&&e.push(new In(a,o,c,l,f)),(a=i[3])&&e.push(new In(a,l,c,u,f))}t.push(n)}for(;n=t.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function k7(r){return r[0]}function L7(r){return arguments.length?(this._x=r,this):this._x}function N7(r){return r[1]}function O7(r){return arguments.length?(this._y=r,this):this._y}function ad(r,e,t){var n=new U0(e??k7,t??N7,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function U0(r,e,t,n,i,a){this._x=r,this._y=e,this._x0=t,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function qM(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var kn=ad.prototype=U0.prototype;kn.copy=function(){var r=new U0(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,n;if(!e)return r;if(!e.length)return r._root=qM(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var i=0;i<4;++i)(n=e.source[i])&&(n.length?t.push({source:n,target:e.target[i]=new Array(4)}):e.target[i]=qM(n));return r},kn.add=m7,kn.addAll=b7,kn.cover=x7,kn.data=w7,kn.extent=E7,kn.find=_7,kn.remove=S7,kn.removeAll=M7,kn.root=C7,kn.size=A7,kn.visit=T7,kn.visitAfter=I7,kn.x=L7,kn.y=O7;const D7=ea(Object.freeze(Object.defineProperty({__proto__:null,quadtree:ad},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(id,"__esModule",{value:!0}),id.forceNBody=void 0;var P7=D7,R7=.81,ZM=.1;function B7(r,e,t,n,i){var a=t/n,o=r.map(function(u,f){var l=e[u.id],c=l.data,h=l.x,d=l.y,v=l.size,p=c.layout.force.nodeStrength;return{x:h,y:d,size:v,index:f,vx:0,vy:0,weight:a*p}}),s=(0,P7.quadtree)(o,function(u){return u.x},function(u){return u.y}).visitAfter(F7);return o.forEach(function(u){z7(u,s)}),o.map(function(u,f){var l=e[r[f].id],c=l.data.layout.force.mass,h=c===void 0?1:c;i[2*f]=u.vx/h,i[2*f+1]=u.vy/h}),i}id.forceNBody=B7;function F7(r){var e=0,t=0,n=0;if(r.length){for(var i=0;i<4;i++){var a=r[i];a&&a.weight&&(e+=a.weight,t+=a.x*a.weight,n+=a.y*a.weight)}r.x=t/e,r.y=n/e,r.weight=e}else{var a=r;r.x=a.data.x,r.y=a.data.y,r.weight=a.data.weight}}var G7=function(r,e,t,n,i,a){var o=a.x-r.x||ZM,s=a.y-r.y||ZM,u=n-e,f=o*o+s*s,l=Math.sqrt(f)*f;if(u*u*R7<f){var c=r.weight/l;return a.vx+=o*c,a.vy+=s*c,!0}if(r.length)return!1;if(r.data!==a){var c=r.data.weight/l;a.vx+=o*c,a.vy+=s*c}};function z7(r,e){e.visit(function(t,n,i,a,o){return G7(t,n,i,a,o,r)})}var $7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ai=xe&&xe.__assign||function(){return Ai=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ai.apply(this,arguments)};Object.defineProperty(Qf,"__esModule",{value:!0}),Qf.Force2Layout=void 0;var j7=Pr,an=Ir(),U7=id,X0=function(r,e){var t;return r?(0,an.isNumber)(r)?t=function(n){return r}:t=r:t=function(n){return e},t},X7=function(r){$7(e,r);function e(t){var n=r.call(this)||this;n.maxIteration=1e3,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=500,n.minMovement=.4,n.interval=.02,n.factor=1,n.linkDistance=200,n.gravity=0,n.clusterNodeStrength=20,n.preventOverlap=!0,n.distanceThresholdMode="mean",n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.judgingDistance=0,n.centripetalOptions={leaf:2,single:2,others:1,center:function(a){return{x:n.width/2,y:n.height/2}}};var i=t.getMass;return n.propsGetMass=i,n.updateCfg(t),n}return e.prototype.getCentripetalOptions=function(){var t=this,n=t.leafCluster,i=t.clustering,a=t.nodeClusterBy,o=t.nodes,s=t.nodeMap,u=t.clusterNodeStrength,f=function(b){return typeof u=="function"?u(b):u},l={},c;if(n){c=this.getSameTypeLeafMap()||{};var h=Array.from(new Set(o==null?void 0:o.map(function(b){return b[a]})))||[];l={single:100,leaf:function(b,x,w){var E=c[b.id]||{},_=E.relativeLeafNodes,M=E.sameTypeLeafNodes;return(M==null?void 0:M.length)===(_==null?void 0:_.length)||(h==null?void 0:h.length)===1?1:f(b)},others:1,center:function(b,x,w){var E,_=(((E=b.data)===null||E===void 0?void 0:E.layout)||{}).degree;if(!_)return{x:100,y:100};var M;if(_===1){var C=(c[b.id]||{}).sameTypeLeafNodes,S=C===void 0?[]:C;S.length===1?M=void 0:S.length>1&&(M=(0,an.getAvgNodePosition)(S))}else M=void 0;return{x:M==null?void 0:M.x,y:M==null?void 0:M.y}}}}if(i){c||(c=this.getSameTypeLeafMap());var d=Array.from(new Set(o.map(function(b,x){return b[a]}))).filter(function(b){return b!==void 0}),v={};d.forEach(function(b){var x=o.filter(function(w){return w[a]===b}).map(function(w){return s[w.id]});v[b]=(0,an.getAvgNodePosition)(x)}),l={single:function(b){return f(b)},leaf:function(b){return f(b)},others:function(b){return f(b)},center:function(b,x,w){var E=v[b[a]];return{x:E==null?void 0:E.x,y:E==null?void 0:E.y}}}}this.centripetalOptions=Ai(Ai({},this.centripetalOptions),l);var p=this.centripetalOptions,g=p.leaf,y=p.single,m=p.others;g&&typeof g!="function"&&(this.centripetalOptions.leaf=function(){return g}),y&&typeof y!="function"&&(this.centripetalOptions.single=function(){return y}),m&&typeof m!="function"&&(this.centripetalOptions.others=function(){return m})},e.prototype.updateCfg=function(t){t&&Object.assign(this,t)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t=this;t.stop();var n=t.nodes,i=t.edges,a=t.defSpringLen;if(t.judgingDistance=0,!n||n.length===0){t.onLayoutEnd([]);return}!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var o=t.center;if(n.length===1){n[0].x=o[0],n[0].y=o[1],t.onLayoutEnd([Ai({},n[0])]);return}t.degreesMap=(0,an.getDegreeMap)(n,i),t.propsGetMass?t.getMass=t.propsGetMass:t.getMass=function(d){var v=1;(0,an.isNumber)(d.mass)&&(v=d.mass);var p=t.degreesMap[d.id].all;return!p||p<5?v:p*5*v};var s=t.nodeSize,u;if(t.preventOverlap){var f=t.nodeSpacing,l;(0,an.isNumber)(f)?l=function(){return f}:(0,an.isFunction)(f)?l=f:l=function(){return 0},s?(0,an.isArray)(s)?u=function(d){return Math.max(s[0],s[1])+l(d)}:u=function(d){return s+l(d)}:u=function(d){return d.size?(0,an.isArray)(d.size)?Math.max(d.size[0],d.size[1])+l(d):(0,an.isObject)(d.size)?Math.max(d.size.width,d.size.height)+l(d):d.size+l(d):10+l(d)}}t.nodeSize=u,t.linkDistance=X0(t.linkDistance,1),t.nodeStrength=X0(t.nodeStrength,1),t.edgeStrength=X0(t.edgeStrength,1);var c={},h={};n.forEach(function(d,v){(0,an.isNumber)(d.x)||(d.x=Math.random()*t.width),(0,an.isNumber)(d.y)||(d.y=Math.random()*t.height);var p=t.degreesMap[d.id];c[d.id]=Ai(Ai({},d),{data:Ai(Ai({},d.data),{size:t.nodeSize(d)||30,layout:{inDegree:p.in,outDegree:p.out,degree:p.all,tDegree:p.in,sDegree:p.out,force:{mass:t.getMass(d),nodeStrength:t.nodeStrength(d,i)}}})}),h[d.id]=v}),t.nodeMap=c,t.nodeIdxMap=h,t.edgeInfos=[],i==null||i.forEach(function(d){var v=c[d.source],p=c[d.target];!v||!p?elf.edgeInfos.push({}):t.edgeInfos.push({edgeStrength:t.edgeStrength(d),linkDistance:a?a(Ai(Ai({},d),{source:v,target:p}),v,p):t.linkDistance(d,v,p)||1+(s(v)+s(v)||0)/2})}),this.getCentripetalOptions(),t.onLayoutEnd=t.onLayoutEnd||function(){},t.run()},e.prototype.run=function(){var t=this,n=t.maxIteration,i=t.nodes,a=t.edges,o=t.workerEnabled,s=t.minMovement,u=t.animate,f=t.nodeMap,l=t.height;if(t.currentMinY=0,t.currentMaxY=l,!!i){var c=[];if(i.forEach(function(y,m){c[2*m]=0,c[2*m+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var h={};a.forEach(function(y){var m=y.source,b=y.target;h[m]=h[m]||[],h[m].push(y),h[b]=h[b]||[],h[b].push(y)}),this.relatedEdges=h}var d=n,v=!u;if(o||v){for(var p=0;(t.judgingDistance>s||p<1)&&p<d;p++)t.runOneStep(p,c);t.onLayoutEnd(Object.values(f))}else{if(typeof window>"u")return;var g=0;this.timeInterval=window.setInterval(function(){i&&(t.runOneStep(g,c),g++,(g>=d||t.judgingDistance<s)&&(t.onLayoutEnd(Object.values(f)),window.clearInterval(t.timeInterval)))},0)}}},e.prototype.runOneStep=function(t,n){var i,a=this,o=a.nodes,s=a.edges;a.nodeMap;var u=a.monitor,f=[];if(o!=null&&o.length){a.calRepulsive(f),s&&a.calAttractive(f),a.calGravity(f),a.attractToSide(f);var l=a.interval;if(a.updateVelocity(f,n,l),a.updatePosition(n,l),(i=a.tick)===null||i===void 0||i.call(a),u){var c=this.calTotalEnergy(f);u({energy:c,nodes:o,edges:s,iterations:t})}}},e.prototype.calTotalEnergy=function(t){var n=this,i=n.nodes,a=n.nodeMap;if(!(i!=null&&i.length))return 0;var o=0;return i.forEach(function(s,u){var f=t[2*u],l=t[2*u+1],c=f*f+l*l,h=a[s.id].data.layout.force.mass,d=h===void 0?1:h;o+=d*c*.5}),o},e.prototype.calRepulsive=function(t){var n=this,i=n.nodes,a=n.nodeMap,o=n.factor,s=n.coulombDisScale;n.nodeSize,(0,U7.forceNBody)(i,a,o,s*s,t)},e.prototype.calAttractive=function(t){var n=this,i=n.edges,a=n.nodeMap,o=n.nodeIdxMap,s=n.edgeInfos;n.nodeSize,i.forEach(function(u,f){var l=(0,an.getEdgeTerminal)(u,"source"),c=(0,an.getEdgeTerminal)(u,"target"),h=a[l],d=a[c];if(!(!h||!d)){var v=d.x-h.x,p=d.y-h.y;!v&&!p&&(v=Math.random()*.01,p=Math.random()*.01);var g=Math.sqrt(v*v+p*p),y=v/g,m=p/g,b=s[f]||{},x=b.linkDistance,w=x===void 0?200:x,E=b.edgeStrength,_=E===void 0?200:E,M=w-g,C=M*_,S=h.data.layout.force.mass||1,A=d.data.layout.force.mass||1,T=1/S,k=1/A,O=y*C,G=m*C,D=2*o[l],$=2*o[c];t[D]-=O*T,t[D+1]-=G*T,t[$]+=O*k,t[$+1]+=G*k}})},e.prototype.calGravity=function(t){var n,i=this,a=i.nodes,o=i.edges,s=o===void 0?[]:o,u=i.nodeMap,f=i.width,l=i.height,c=i.center,h=i.gravity,d=i.degreesMap,v=i.centripetalOptions;if(a)for(var p=a.length,g=0;g<p;g++){var y=2*g,m=u[a[g].id],b=m.data.layout.force.mass,x=b===void 0?1:b,w=0,E=0,_=h,M=d[m.id],C=M.in,S=M.out,A=M.all,T=(n=i.getCenter)===null||n===void 0?void 0:n.call(i,m,A);if(T){var k=T[0],O=T[1],G=T[2];w=m.x-k,E=m.y-O,_=G}else w=m.x-c[0],E=m.y-c[1];if(_&&(t[y]-=_*w/x,t[y+1]-=_*E/x),v){var D=v.leaf,$=v.single,Y=v.others,N=v.center,P=(N==null?void 0:N(m,a,s,f,l))||{x:0,y:0,centerStrength:0},W=P.x,J=P.y,te=P.centerStrength;if(!(0,an.isNumber)(W)||!(0,an.isNumber)(J))continue;var H=(m.x-W)/x,pe=(m.y-J)/x;if(te&&(t[y]-=te*H,t[y+1]-=te*pe),A===0){var Te=$(m);if(!Te)continue;t[y]-=Te*H,t[y+1]-=Te*pe;continue}if(C===0||S===0){var Ne=D(m,a,s);if(!Ne)continue;t[y]-=Ne*H,t[y+1]-=Ne*pe;continue}var Ze=Y(m);if(!Ze)continue;t[y]-=Ze*H,t[y+1]-=Ze*pe}}},e.prototype.attractToSide=function(t){var n=this,i=n.defSideCoe;n.height;var a=n.nodes,o=n.relatedEdges,s=n.currentMinY,u=s===void 0?0:s,f=n.currentMaxY,l=f===void 0?this.height:f;!i||typeof i!="function"||!(a!=null&&a.length)||a.forEach(function(c,h){var d=i(c,o[c.id]||[]);if(d!==0){var v=d<0?u:l,p=Math.abs(d);t[2*h+1]-=p*(c.y-v)}})},e.prototype.updateVelocity=function(t,n,i){var a=this,o=a.nodes,s=a.damping,u=a.maxSpeed;o!=null&&o.length&&o.forEach(function(f,l){var c=(n[2*l]+t[2*l]*i)*s||.01,h=(n[2*l+1]+t[2*l+1]*i)*s||.01,d=Math.sqrt(c*c+h*h);if(d>u){var v=u/d;c=v*c,h=v*h}n[2*l]=c,n[2*l+1]=h})},e.prototype.updatePosition=function(t,n){var i=this,a=i.nodes,o=i.distanceThresholdMode,s=i.nodeMap;if(!(a!=null&&a.length)){this.judgingDistance=0;return}var u=0;o==="max"?i.judgingDistance=-1/0:o==="min"&&(i.judgingDistance=1/0);var f=1/0,l=-1/0;a.forEach(function(c,h){var d=s[c.id];if((0,an.isNumber)(c.fx)&&(0,an.isNumber)(c.fy)){c.x=c.fx,c.y=c.fy,d.x=c.x,d.y=c.y;return}var v=t[2*h]*n,p=t[2*h+1]*n;c.x+=v,c.y+=p,d.x=c.x,d.y=c.y,c.y<f&&(f=c.y),c.y>l&&(l=c.y);var g=Math.sqrt(v*v+p*p);switch(o){case"max":i.judgingDistance<g&&(i.judgingDistance=g);break;case"min":i.judgingDistance>g&&(i.judgingDistance=g);break;default:u=u+g;break}}),this.currentMinY=f,this.currentMaxY=l,(!o||o==="mean")&&(i.judgingDistance=u/a.length)},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,n=t.nodeClusterBy,i=t.nodes,a=t.edges,o=t.nodeMap,s=t.degreesMap;if(i!=null&&i.length){var u={};return i.forEach(function(f,l){var c=s[f.id].all;c===1&&(u[f.id]=(0,an.getCoreNodeAndRelativeLeafNodes)("leaf",f,a,n,s,o))}),u}},e}(j7.Base);Qf.Force2Layout=X7;var Y0={},od={};function Y7(r,e){var t,n=1;r==null&&(r=0),e==null&&(e=0);function i(){var a,o=t.length,s,u=0,f=0;for(a=0;a<o;++a)s=t[a],u+=s.x,f+=s.y;for(u=(u/o-r)*n,f=(f/o-e)*n,a=0;a<o;++a)s=t[a],s.x-=u,s.y-=f}return i.initialize=function(a){t=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(e=+a,i):e},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function on(r){return function(){return r}}function po(r){return(r()-.5)*1e-6}function W7(r){return r.x+r.vx}function V7(r){return r.y+r.vy}function H7(r){var e,t,n,i=1,a=1;typeof r!="function"&&(r=on(r==null?1:+r));function o(){for(var f,l=e.length,c,h,d,v,p,g,y=0;y<a;++y)for(c=ad(e,W7,V7).visitAfter(s),f=0;f<l;++f)h=e[f],p=t[h.index],g=p*p,d=h.x+h.vx,v=h.y+h.vy,c.visit(m);function m(b,x,w,E,_){var M=b.data,C=b.r,S=p+C;if(M){if(M.index>h.index){var A=d-M.x-M.vx,T=v-M.y-M.vy,k=A*A+T*T;k<S*S&&(A===0&&(A=po(n),k+=A*A),T===0&&(T=po(n),k+=T*T),k=(S-(k=Math.sqrt(k)))/k*i,h.vx+=(A*=k)*(S=(C*=C)/(g+C)),h.vy+=(T*=k)*S,M.vx-=A*(S=1-S),M.vy-=T*S)}return}return x>d+S||E<d-S||w>v+S||_<v-S}}function s(f){if(f.data)return f.r=t[f.data.index];for(var l=f.r=0;l<4;++l)f[l]&&f[l].r>f.r&&(f.r=f[l].r)}function u(){if(e){var f,l=e.length,c;for(t=new Array(l),f=0;f<l;++f)c=e[f],t[c.index]=+r(c,f,e)}}return o.initialize=function(f,l){e=f,n=l,u()},o.iterations=function(f){return arguments.length?(a=+f,o):a},o.strength=function(f){return arguments.length?(i=+f,o):i},o.radius=function(f){return arguments.length?(r=typeof f=="function"?f:on(+f),u(),o):r},o}function q7(r){return r.index}function KM(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function Z7(r){var e=q7,t=c,n,i=on(30),a,o,s,u,f,l=1;r==null&&(r=[]);function c(g){return 1/Math.min(s[g.source.index],s[g.target.index])}function h(g){for(var y=0,m=r.length;y<l;++y)for(var b=0,x,w,E,_,M,C,S;b<m;++b)x=r[b],w=x.source,E=x.target,_=E.x+E.vx-w.x-w.vx||po(f),M=E.y+E.vy-w.y-w.vy||po(f),C=Math.sqrt(_*_+M*M),C=(C-a[b])/C*g*n[b],_*=C,M*=C,E.vx-=_*(S=u[b]),E.vy-=M*S,w.vx+=_*(S=1-S),w.vy+=M*S}function d(){if(o){var g,y=o.length,m=r.length,b=new Map(o.map((w,E)=>[e(w,E,o),w])),x;for(g=0,s=new Array(y);g<m;++g)x=r[g],x.index=g,typeof x.source!="object"&&(x.source=KM(b,x.source)),typeof x.target!="object"&&(x.target=KM(b,x.target)),s[x.source.index]=(s[x.source.index]||0)+1,s[x.target.index]=(s[x.target.index]||0)+1;for(g=0,u=new Array(m);g<m;++g)x=r[g],u[g]=s[x.source.index]/(s[x.source.index]+s[x.target.index]);n=new Array(m),v(),a=new Array(m),p()}}function v(){if(o)for(var g=0,y=r.length;g<y;++g)n[g]=+t(r[g],g,r)}function p(){if(o)for(var g=0,y=r.length;g<y;++g)a[g]=+i(r[g],g,r)}return h.initialize=function(g,y){o=g,f=y,d()},h.links=function(g){return arguments.length?(r=g,d(),h):r},h.id=function(g){return arguments.length?(e=g,h):e},h.iterations=function(g){return arguments.length?(l=+g,h):l},h.strength=function(g){return arguments.length?(t=typeof g=="function"?g:on(+g),v(),h):t},h.distance=function(g){return arguments.length?(i=typeof g=="function"?g:on(+g),p(),h):i},h}var K7={value:()=>{}};function QM(){for(var r=0,e=arguments.length,t={},n;r<e;++r){if(!(n=arguments[r]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new sd(t)}function sd(r){this._=r}function Q7(r,e){return r.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}sd.prototype=QM.prototype={constructor:sd,on:function(r,e){var t=this._,n=Q7(r+"",t),i,a=-1,o=n.length;if(arguments.length<2){for(;++a<o;)if((i=(r=n[a]).type)&&(i=J7(t[i],r.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<o;)if(i=(r=n[a]).type)t[i]=JM(t[i],r.name,e);else if(e==null)for(i in t)t[i]=JM(t[i],r.name,null);return this},copy:function(){var r={},e=this._;for(var t in e)r[t]=e[t].slice();return new sd(r)},call:function(r,e){if((i=arguments.length-2)>0)for(var t=new Array(i),n=0,i,a;n<i;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(a=this._[r],n=0,i=a.length;n<i;++n)a[n].value.apply(e,t)},apply:function(r,e,t){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],i=0,a=n.length;i<a;++i)n[i].value.apply(e,t)}};function J7(r,e){for(var t=0,n=r.length,i;t<n;++t)if((i=r[t]).name===e)return i.value}function JM(r,e,t){for(var n=0,i=r.length;n<i;++n)if(r[n].name===e){r[n]=K7,r=r.slice(0,n).concat(r.slice(n+1));break}return t!=null&&r.push({name:e,value:t}),r}var ou=0,Jf=0,el=0,eC=1e3,ud,tl,fd=0,es=0,ld=0,rl=typeof performance=="object"&&performance.now?performance:Date,tC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function rC(){return es||(tC(eX),es=rl.now()+ld)}function eX(){es=0}function W0(){this._call=this._time=this._next=null}W0.prototype=nC.prototype={constructor:W0,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?rC():+t)+(e==null?0:+e),!this._next&&tl!==this&&(tl?tl._next=this:ud=this,tl=this),this._call=r,this._time=t,V0()},stop:function(){this._call&&(this._call=null,this._time=1/0,V0())}};function nC(r,e,t){var n=new W0;return n.restart(r,e,t),n}function tX(){rC(),++ou;for(var r=ud,e;r;)(e=es-r._time)>=0&&r._call.call(null,e),r=r._next;--ou}function iC(){es=(fd=rl.now())+ld,ou=Jf=0;try{tX()}finally{ou=0,nX(),es=0}}function rX(){var r=rl.now(),e=r-fd;e>eC&&(ld-=e,fd=r)}function nX(){for(var r,e=ud,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:ud=t);tl=r,V0(n)}function V0(r){if(!ou){Jf&&(Jf=clearTimeout(Jf));var e=r-es;e>24?(r<1/0&&(Jf=setTimeout(iC,r-rl.now()-ld)),el&&(el=clearInterval(el))):(el||(fd=rl.now(),el=setInterval(rX,eC)),ou=1,tC(iC))}}const iX=1664525,aX=1013904223,aC=4294967296;function oX(){let r=1;return()=>(r=(iX*r+aX)%aC)/aC}function sX(r){return r.x}function uX(r){return r.y}var fX=10,lX=Math.PI*(3-Math.sqrt(5));function cX(r){var e,t=1,n=.001,i=1-Math.pow(n,1/300),a=0,o=.6,s=new Map,u=nC(c),f=QM("tick","end"),l=oX();r==null&&(r=[]);function c(){h(),f.call("tick",e),t<n&&(u.stop(),f.call("end",e))}function h(p){var g,y=r.length,m;p===void 0&&(p=1);for(var b=0;b<p;++b)for(t+=(a-t)*i,s.forEach(function(x){x(t)}),g=0;g<y;++g)m=r[g],m.fx==null?m.x+=m.vx*=o:(m.x=m.fx,m.vx=0),m.fy==null?m.y+=m.vy*=o:(m.y=m.fy,m.vy=0);return e}function d(){for(var p=0,g=r.length,y;p<g;++p){if(y=r[p],y.index=p,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),isNaN(y.x)||isNaN(y.y)){var m=fX*Math.sqrt(.5+p),b=p*lX;y.x=m*Math.cos(b),y.y=m*Math.sin(b)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function v(p){return p.initialize&&p.initialize(r,l),p}return d(),e={tick:h,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(p){return arguments.length?(r=p,d(),s.forEach(v),e):r},alpha:function(p){return arguments.length?(t=+p,e):t},alphaMin:function(p){return arguments.length?(n=+p,e):n},alphaDecay:function(p){return arguments.length?(i=+p,e):+i},alphaTarget:function(p){return arguments.length?(a=+p,e):a},velocityDecay:function(p){return arguments.length?(o=1-p,e):1-o},randomSource:function(p){return arguments.length?(l=p,s.forEach(v),e):l},force:function(p,g){return arguments.length>1?(g==null?s.delete(p):s.set(p,v(g)),e):s.get(p)},find:function(p,g,y){var m=0,b=r.length,x,w,E,_,M;for(y==null?y=1/0:y*=y,m=0;m<b;++m)_=r[m],x=p-_.x,w=g-_.y,E=x*x+w*w,E<y&&(M=_,y=E);return M},on:function(p,g){return arguments.length>1?(f.on(p,g),e):f.on(p)}}}function hX(){var r,e,t,n,i=on(-30),a,o=1,s=1/0,u=.81;function f(d){var v,p=r.length,g=ad(r,sX,uX).visitAfter(c);for(n=d,v=0;v<p;++v)e=r[v],g.visit(h)}function l(){if(r){var d,v=r.length,p;for(a=new Array(v),d=0;d<v;++d)p=r[d],a[p.index]=+i(p,d,r)}}function c(d){var v=0,p,g,y=0,m,b,x;if(d.length){for(m=b=x=0;x<4;++x)(p=d[x])&&(g=Math.abs(p.value))&&(v+=p.value,y+=g,m+=g*p.x,b+=g*p.y);d.x=m/y,d.y=b/y}else{p=d,p.x=p.data.x,p.y=p.data.y;do v+=a[p.data.index];while(p=p.next)}d.value=v}function h(d,v,p,g){if(!d.value)return!0;var y=d.x-e.x,m=d.y-e.y,b=g-v,x=y*y+m*m;if(b*b/u<x)return x<s&&(y===0&&(y=po(t),x+=y*y),m===0&&(m=po(t),x+=m*m),x<o&&(x=Math.sqrt(o*x)),e.vx+=y*d.value*n/x,e.vy+=m*d.value*n/x),!0;if(d.length||x>=s)return;(d.data!==e||d.next)&&(y===0&&(y=po(t),x+=y*y),m===0&&(m=po(t),x+=m*m),x<o&&(x=Math.sqrt(o*x)));do d.data!==e&&(b=a[d.data.index]*n/x,e.vx+=y*b,e.vy+=m*b);while(d=d.next)}return f.initialize=function(d,v){r=d,t=v,l()},f.strength=function(d){return arguments.length?(i=typeof d=="function"?d:on(+d),l(),f):i},f.distanceMin=function(d){return arguments.length?(o=d*d,f):Math.sqrt(o)},f.distanceMax=function(d){return arguments.length?(s=d*d,f):Math.sqrt(s)},f.theta=function(d){return arguments.length?(u=d*d,f):Math.sqrt(u)},f}function dX(r,e,t){var n,i=on(.1),a,o;typeof r!="function"&&(r=on(+r)),e==null&&(e=0),t==null&&(t=0);function s(f){for(var l=0,c=n.length;l<c;++l){var h=n[l],d=h.x-e||1e-6,v=h.y-t||1e-6,p=Math.sqrt(d*d+v*v),g=(o[l]-p)*a[l]*f/p;h.vx+=d*g,h.vy+=v*g}}function u(){if(n){var f,l=n.length;for(a=new Array(l),o=new Array(l),f=0;f<l;++f)o[f]=+r(n[f],f,n),a[f]=isNaN(o[f])?0:+i(n[f],f,n)}}return s.initialize=function(f){n=f,u()},s.strength=function(f){return arguments.length?(i=typeof f=="function"?f:on(+f),u(),s):i},s.radius=function(f){return arguments.length?(r=typeof f=="function"?f:on(+f),u(),s):r},s.x=function(f){return arguments.length?(e=+f,s):e},s.y=function(f){return arguments.length?(t=+f,s):t},s}function vX(r){var e=on(.1),t,n,i;typeof r!="function"&&(r=on(r==null?0:+r));function a(s){for(var u=0,f=t.length,l;u<f;++u)l=t[u],l.vx+=(i[u]-l.x)*n[u]*s}function o(){if(t){var s,u=t.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(t[s],s,t))?0:+e(t[s],s,t)}}return a.initialize=function(s){t=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:on(+s),o(),a):e},a.x=function(s){return arguments.length?(r=typeof s=="function"?s:on(+s),o(),a):r},a}function pX(r){var e=on(.1),t,n,i;typeof r!="function"&&(r=on(r==null?0:+r));function a(s){for(var u=0,f=t.length,l;u<f;++u)l=t[u],l.vy+=(i[u]-l.y)*n[u]*s}function o(){if(t){var s,u=t.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(t[s],s,t))?0:+e(t[s],s,t)}}return a.initialize=function(s){t=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:on(+s),o(),a):e},a.y=function(s){return arguments.length?(r=typeof s=="function"?s:on(+s),o(),a):r},a}const H0=ea(Object.freeze(Object.defineProperty({__proto__:null,forceCenter:Y7,forceCollide:H7,forceLink:Z7,forceManyBody:hX,forceRadial:dX,forceSimulation:cX,forceX:vX,forceY:pX},Symbol.toStringTag,{value:"Module"})));var q0={},gX=xe&&xe.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),yX=xe&&xe.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),mX=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gX(e,r,t);return yX(e,r),e};Object.defineProperty(q0,"__esModule",{value:!0});var su=mX(H0),cd=Ir();function bX(){function r(H){return function(){return H}}var e=function(H){return H.cluster},t=r(1),n=r(-1),i=r(100),a=r(.1),o=[0,0],s=[],u={},f=[],l=100,c=100,h={none:{x:0,y:0}},d=[],v,p="force",g=!0,y=.1;function m(H){if(!g)return m;v.tick(),M();for(var pe=0,Te=s.length,Ne=void 0,Ze=H*y;pe<Te;++pe)Ne=s[pe],Ne.vx+=(h[e(Ne)].x-Ne.x)*Ze,Ne.vy+=(h[e(Ne)].y-Ne.y)*Ze}function b(){s&&x()}function x(){if(!(!s||!s.length)){if(e(s[0])===void 0)throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");var H=w();v=su.forceSimulation(H.nodes).force("x",su.forceX(l).strength(.1)).force("y",su.forceY(c).strength(.1)).force("collide",su.forceCollide(function(pe){return pe.r}).iterations(4)).force("charge",su.forceManyBody().strength(n)).force("links",su.forceLink(H.nodes.length?H.links:[]).distance(i).strength(a)),d=v.nodes(),M()}}function w(){var H=[],pe=[],Te={},Ne=[],Ze={},at=[];return Ze=E(s),at=_(f),Ne=Object.keys(Ze),Ne.forEach(function(nt,St){var Mt=Ze[nt];H.push({id:nt,size:Mt.count,r:Math.sqrt(Mt.sumforceNodeSize/Math.PI)}),Te[nt]=St}),at.forEach(function(nt){var St=(0,cd.getEdgeTerminal)(nt,"source"),Mt=(0,cd.getEdgeTerminal)(nt,"target"),fr=Te[St],Ft=Te[Mt];fr!==void 0&&Ft!==void 0&&pe.push({source:fr,target:Ft,count:nt.count})}),{nodes:H,links:pe}}function E(H){var pe={};return H.forEach(function(Te){var Ne=e(Te);pe[Ne]||(pe[Ne]={count:0,sumforceNodeSize:0})}),H.forEach(function(Te){var Ne=e(Te),Ze=t(Te),at=pe[Ne];at.count=at.count+1,at.sumforceNodeSize=at.sumforceNodeSize+Math.PI*(Ze*Ze)*1.3,pe[Ne]=at}),pe}function _(H){var pe={},Te=[];H.forEach(function(Ze){var at=C(Ze),nt=0;pe[at]!==void 0&&(nt=pe[at]),nt+=1,pe[at]=nt});var Ne=Object.entries(pe);return Ne.forEach(function(Ze){var at=Ze[0],nt=Ze[1],St=at.split("~")[0],Mt=at.split("~")[1];St!==void 0&&Mt!==void 0&&Te.push({source:St,target:Mt,count:nt})}),Te}function M(){return h={none:{x:0,y:0}},d.forEach(function(H){h[H.id]={x:H.x-o[0],y:H.y-o[1]}}),h}function C(H){var pe=(0,cd.getEdgeTerminal)(H,"source"),Te=(0,cd.getEdgeTerminal)(H,"target"),Ne=e(u[pe]),Ze=e(u[Te]);return Ne<=Ze?"".concat(Ne,"~").concat(Ze):"".concat(Ze,"~").concat(Ne)}function S(H){u={},H.forEach(function(pe){u[pe.id]=pe})}function A(H){return arguments.length?(p=H,b(),m):p}function T(H){return arguments.length?typeof H=="string"?(e=function(pe){return pe[H]},m):(e=H,m):e}function k(H){return arguments.length?(g=H,m):g}function O(H){return arguments.length?(y=H,m):y}function G(H){return arguments.length?(l=H,m):l}function D(H){return arguments.length?(c=H,m):c}function $(H){return arguments.length?(S(H||[]),s=H||[],m):s}function Y(H){return arguments.length?(f=H||[],b(),m):f}function N(H){return arguments.length?(typeof H=="function"?t=H:t=r(+H),b(),m):t}function P(H){return arguments.length?(typeof H=="function"?n=H:n=r(+H),b(),m):n}function W(H){return arguments.length?(typeof H=="function"?i=H:i=r(+H),b(),m):i}function J(H){return arguments.length?(typeof H=="function"?a=H:a=r(+H),b(),m):a}function te(H){return arguments.length?(o=H,m):o}return m.initialize=function(H){s=H,b()},m.template=A,m.groupBy=T,m.enableGrouping=k,m.strength=O,m.centerX=G,m.centerY=D,m.nodes=$,m.links=Y,m.forceNodeSize=N,m.nodeSize=m.forceNodeSize,m.forceCharge=P,m.forceLinkDistance=W,m.forceLinkStrength=J,m.offset=te,m.getFocis=M,m}q0.default=bX;var ka={};Object.defineProperty(ka,"__esModule",{value:!0}),ka.FORCE_LAYOUT_TYPE_MAP=ka.LAYOUT_MESSAGE=void 0,ka.LAYOUT_MESSAGE={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"},ka.FORCE_LAYOUT_TYPE_MAP={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0};var xX=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),wX=xe&&xe.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),EX=xe&&xe.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),_X=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wX(e,r,t);return EX(e,r),e},SX=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(od,"__esModule",{value:!0}),od.ForceLayout=void 0;var uu=_X(H0),MX=SX(q0),ts=Ir(),CX=Pr,AX=ka,TX=function(r){xX(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.nodeStrength=null,n.edgeStrength=null,n.preventOverlap=!1,n.clusterNodeStrength=null,n.clusterEdgeStrength=null,n.clusterEdgeDistance=null,n.clusterNodeSize=null,n.clusterFociStrength=null,n.linkDistance=50,n.alphaDecay=.028,n.alphaMin=.001,n.alpha=.3,n.collideStrength=1,n.workerEnabled=!1,n.tick=function(){},n.onLayoutEnd=function(){},n.ticking=void 0,t&&n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],nodeStrength:null,edgeStrength:null,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,linkDistance:50,forceSimulation:null,alphaDecay:.028,alphaMin:.001,alpha:.3,collideStrength:1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10,tick:function(){},onLayoutEnd:function(){},workerEnabled:!1}},e.prototype.init=function(t){var n=this;n.nodes=t.nodes||[];var i=t.edges||[];n.edges=i.map(function(a){var o={},s=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(a).forEach(function(u){s.indexOf(u)>-1||(o[u]=a[u])}),o}),n.ticking=!1},e.prototype.execute=function(t){var n=this,i=n.nodes,a=n.edges;if(!n.ticking){var o=n.forceSimulation,s=n.alphaMin,u=n.alphaDecay,f=n.alpha;if(o){if(t){if(n.clustering&&n.clusterForce&&(n.clusterForce.nodes(i),n.clusterForce.links(a)),o.nodes(i),a&&n.edgeForce)n.edgeForce.links(a);else if(a&&!n.edgeForce){var h=uu.forceLink().id(function(g){return g.id}).links(a);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}}n.preventOverlap&&n.overlapProcess(o),o.alpha(f).restart(),this.ticking=!0}else try{var l=uu.forceManyBody();if(n.nodeStrength&&l.strength(n.nodeStrength),o=uu.forceSimulation().nodes(i),n.clustering){var c=(0,MX.default)();c.centerX(n.center[0]).centerY(n.center[1]).template("force").strength(n.clusterFociStrength),a&&c.links(a),i&&c.nodes(i),c.forceLinkDistance(n.clusterEdgeDistance).forceLinkStrength(n.clusterEdgeStrength).forceCharge(n.clusterNodeStrength).forceNodeSize(n.clusterNodeSize),n.clusterForce=c,o.force("group",c)}if(o.force("center",uu.forceCenter(n.center[0],n.center[1])).force("charge",l).alpha(f).alphaDecay(u).alphaMin(s),n.preventOverlap&&n.overlapProcess(o),a){var h=uu.forceLink().id(function(p){return p.id}).links(a);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}if(n.workerEnabled&&!kX()&&(n.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!n.workerEnabled)o.on("tick",function(){n.tick()}).on("end",function(){n.ticking=!1,n.onLayoutEnd&&n.onLayoutEnd()}),n.ticking=!0;else{o.stop();for(var d=IX(o),v=1;v<=d;v++)o.tick(),postMessage({nodes:i,currentTick:v,totalTicks:d,type:AX.LAYOUT_MESSAGE.TICK},void 0);n.ticking=!1}n.forceSimulation=o,n.ticking=!0}catch(p){n.ticking=!1,console.warn(p)}}},e.prototype.overlapProcess=function(t){var n=this,i=n.nodeSize,a=n.nodeSpacing,o,s,u=n.collideStrength;if((0,ts.isNumber)(a)?s=function(){return a}:(0,ts.isFunction)(a)?s=a:s=function(){return 0},!i)o=function(h){if(h.size){if((0,ts.isArray)(h.size)){var d=h.size[0]>h.size[1]?h.size[0]:h.size[1];return d/2+s(h)}if((0,ts.isObject)(h.size)){var d=h.size.width>h.size.height?h.size.width:h.size.height;return d/2+s(h)}return h.size/2+s(h)}return 10+s(h)};else if((0,ts.isFunction)(i))o=function(h){var d=i(h);return d+s(h)};else if((0,ts.isArray)(i)){var f=i[0]>i[1]?i[0]:i[1],l=f/2;o=function(h){return l+s(h)}}else if((0,ts.isNumber)(i)){var c=i/2;o=function(h){return c+s(h)}}else o=function(){return 10};t.force("collisionForce",uu.forceCollide(o).strength(u))},e.prototype.updateCfg=function(t){var n=this;n.ticking&&(n.forceSimulation.stop(),n.ticking=!1),n.forceSimulation=null,Object.assign(n,t)},e.prototype.destroy=function(){var t=this;t.ticking&&(t.forceSimulation.stop(),t.ticking=!1),t.nodes=null,t.edges=null,t.destroyed=!0},e}(CX.Base);od.ForceLayout=TX;function IX(r){var e=r.alphaMin(),t=r.alphaTarget(),n=r.alpha(),i=Math.log((e-t)/(n-t))/Math.log(1-r.alphaDecay()),a=Math.ceil(i);return a}function kX(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}(function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(od,r)})(Y0);var nl={},LX=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(nl,"__esModule",{value:!0}),nl.CircularLayout=void 0;var NX=Pr,aa=Ir();function OX(r,e,t,n){r.forEach(function(i,a){r[a].children=[],r[a].parent=[]}),n?e.forEach(function(i){var a=(0,aa.getEdgeTerminal)(i,"source"),o=(0,aa.getEdgeTerminal)(i,"target"),s=0;a&&(s=t[a]);var u=0;o&&(u=t[o]);var f=r[s].children,l=r[u].parent;f.push(r[u].id),l.push(r[s].id)}):e.forEach(function(i){var a=(0,aa.getEdgeTerminal)(i,"source"),o=(0,aa.getEdgeTerminal)(i,"target"),s=0;a&&(s=t[a]);var u=0;o&&(u=t[o]);var f=r[s].children,l=r[u].children;f.push(r[u].id),l.push(r[s].id)})}function DX(r,e,t){for(var n=t.length,i=0;i<n;i++){var a=(0,aa.getEdgeTerminal)(t[i],"source"),o=(0,aa.getEdgeTerminal)(t[i],"target");if(r.id===a&&e.id===o||e.id===a&&r.id===o)return!0}return!1}function PX(r,e){var t=r.degree,n=e.degree;return t<n?-1:t>n?1:0}var RX=function(r){LX(e,r);function e(t){var n=r.call(this)||this;return n.radius=null,n.nodeSize=void 0,n.startRadius=null,n.endRadius=null,n.startAngle=0,n.endAngle=2*Math.PI,n.clockwise=!0,n.divisions=1,n.ordering=null,n.angleRatio=1,n.nodes=[],n.edges=[],n.nodeMap={},n.degrees=[],n.width=300,n.height=300,n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},e.prototype.execute=function(){var t,n=this,i=n.nodes,a=n.edges,o=i.length;if(o===0){n.onLayoutEnd&&n.onLayoutEnd();return}!n.width&&typeof window<"u"&&(n.width=window.innerWidth),!n.height&&typeof window<"u"&&(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var s=n.center;if(o===1){i[0].x=s[0],i[0].y=s[1],n.onLayoutEnd&&n.onLayoutEnd();return}var u=n.radius,f=n.startRadius,l=n.endRadius,c=n.divisions,h=n.startAngle,d=n.endAngle,v=n.angleRatio,p=n.ordering,g=n.clockwise,y=n.nodeSpacing,m=n.nodeSize,b=(d-h)/o,x={};i.forEach(function(D,$){x[D.id]=$}),n.nodeMap=x;var w=(0,aa.getDegree)(i.length,x,a);if(n.degrees=w,y){var E=(0,aa.getFuncByUnknownType)(10,y),_=(0,aa.getFuncByUnknownType)(10,m),M=-1/0;i.forEach(function(D){var $=_(D);M<$&&(M=$)});var C=0;i.forEach(function(D,$){$===0?C+=M||10:C+=(E(D)||0)+(M||10)}),u=C/(2*Math.PI)}else!u&&!f&&!l?u=n.height>n.width?n.width/2:n.height/2:!f&&l?f=l:f&&!l&&(l=f);var S=b*v,A=[];p==="topology"?A=n.topologyOrdering():p==="topology-directed"?A=n.topologyOrdering(!0):p==="degree"?A=n.degreeOrdering():A=i;for(var T=Math.ceil(o/c),k=0;k<o;++k){var O=u;!O&&f!==null&&l!==null&&(O=f+k*(l-f)/(o-1)),O||(O=10+k*100/(o-1));var G=h+k%T*S+2*Math.PI/c*Math.floor(k/T);g||(G=d-k%T*S-2*Math.PI/c*Math.floor(k/T)),A[k].x=s[0]+Math.cos(G)*O,A[k].y=s[1]+Math.sin(G)*O,A[k].weight=w[k].all}return(t=n.onLayoutEnd)===null||t===void 0||t.call(n),{nodes:A,edges:this.edges}},e.prototype.topologyOrdering=function(t){t===void 0&&(t=!1);var n=this,i=n.degrees,a=n.edges,o=n.nodes,s=(0,aa.clone)(o),u=n.nodeMap,f=[s[0]],l=[o[0]],c=[],h=o.length;c[0]=!0,OX(s,a,u,t);var d=0;return s.forEach(function(v,p){if(p!==0)if((p===h-1||i[p].all!==i[p+1].all||DX(f[d],v,a))&&!c[p])f.push(v),l.push(o[u[v.id]]),c[p]=!0,d++;else{for(var g=f[d].children,y=!1,m=0;m<g.length;m++){var b=u[g[m]];if(i[b].all===i[p].all&&!c[b]){f.push(s[b]),l.push(o[u[s[b].id]]),c[b]=!0,y=!0;break}}for(var x=0;!y&&(c[x]||(f.push(s[x]),l.push(o[u[s[x].id]]),c[x]=!0,y=!0),x++,x!==h););}}),l},e.prototype.degreeOrdering=function(){var t=this,n=t.nodes,i=[],a=t.degrees;return n.forEach(function(o,s){o.degree=a[s].all,i.push(o)}),i.sort(PX),i},e.prototype.getType=function(){return"circular"},e}(NX.Base);nl.CircularLayout=RX;var fu={},Z0={},K0={},Q0={},J0={},ey={};Object.defineProperty(ey,"__esModule",{value:!0});var BX=function(r,e){if(r!=="next"&&r!=="prev")return e},oC=function(r){r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev},FX=function(){function r(){var e={};e.prev=e,e.next=e.prev,this.shortcut=e}return r.prototype.dequeue=function(){var e=this.shortcut,t=e.prev;if(t&&t!==e)return oC(t),t},r.prototype.enqueue=function(e){var t=this.shortcut;e.prev&&e.next&&oC(e),e.next=t.next,t.next.prev=e,t.next=e,e.prev=t},r.prototype.toString=function(){for(var e=[],t=this.shortcut,n=t.prev;n!==t;)e.push(JSON.stringify(n,BX)),n=n==null?void 0:n.prev;return"[".concat(e.join(", "),"]")},r}();ey.default=FX;var lu;(function(r){r.DEFAULT_EDGE_NAME="\0",r.GRAPH_NODE="\0",r.EDGE_KEY_DELIM=""})(lu||(lu={}));function sC(r,e){var t=r.get(e)||0;r.set(e,t+1)}function uC(r,e){var t=r.get(e);t!==void 0&&(t=t-1,t>0?r.set(e,t):r.delete(e))}function fC(r,e,t,n){var i=String(e),a=String(t);if(!r&&i>a){var o=i;i=a,a=o}return i+lu.EDGE_KEY_DELIM+a+lu.EDGE_KEY_DELIM+(n===void 0?lu.DEFAULT_EDGE_NAME:n)}function lC(r,e,t,n){var i=String(e),a=String(t),o={v:e,w:t};if(!r&&i>a){var s=o.v;o.v=o.w,o.w=s}return n!==void 0&&(o.name=n),o}function ty(r,e){return fC(r,e.v,e.w,e.name)}function cC(r){return typeof r=="function"}var GX=function(e){return e.nodes().map(function(t){var n=e.node(t),i=e.parent(t),a={id:t,value:n,parent:i};return a.value===void 0&&delete a.value,a.parent===void 0&&delete a.parent,a})},zX=function(e){return e.edges().map(function(t){var n=e.edge(t),i={v:t.v,w:t.w,value:n,name:t.name};return i.name===void 0&&delete i.name,i.value===void 0&&delete i.value,i})},$X=function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:GX(e),edges:zX(e),value:e.graph()};return t.value===void 0&&delete t.value,t},jX=function(e){var t=new rs(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(function(n){t.setNode(n.id,n.value),n.parent&&t.setParent(n.id,n.parent)}),e.edges.forEach(function(n){t.setEdge(n.v,n.w,n.value,n.name)}),t};function hC(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function dC(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hC(Object(t),!0).forEach(function(n){UX(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hC(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function UX(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XX(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function YX(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function WX(r,e,t){return e&&YX(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}var VX={compound:!1,multigraph:!1,directed:!0},rs=function(){function r(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};XX(this,r),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=lu.GRAPH_NODE,this.label=void 0,this.nodeCountNum=0,this.edgeCountNum=0,this.defaultNodeLabelFn=function(){},this.defaultEdgeLabelFn=function(){},this.parentMap=void 0,this.childrenMap=void 0,this.nodesLabelMap=new Map,this.inEdgesMap=new Map,this.outEdgesMap=new Map,this.predecessorsMap=new Map,this.successorsMap=new Map,this.edgesMap=new Map,this.edgesLabelsMap=new Map,this.isDirected=function(){return e.directed},this.isMultigraph=function(){return e.multigraph},this.isCompound=function(){return e.compound},this.setGraph=function(i){return e.label=i,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(i){return cC(i)?e.defaultNodeLabelFn=i:e.defaultNodeLabelFn=function(){return i},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(i){return e.nodesLabelMap.get(i)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter(function(i){var a;return!(!((a=e.inEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.sinks=function(){return e.nodes().filter(function(i){var a;return!(!((a=e.outEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.setNodes=function(i,a){return i.map(function(o){return e.setNode(o,a)}),e},this.hasNode=function(i){return e.nodesLabelMap.has(i)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(i){if(e.isCompound()){var a,o=(a=e.parentMap)===null||a===void 0?void 0:a.get(i);if(o!==e.GRAPH_NODE)return o}},this.removeFromParentsChildList=function(i){var a=e.parentMap.get(i);e.childrenMap.get(a).delete(i)},this.setParent=function(i,a){var o,s;e.checkCompound();for(var u=a===void 0?e.GRAPH_NODE:a,f=e.parent(u);f;){if(i===f)throw new Error("Setting "+a+" as parent of "+i+" would create a cycle");f=e.parent(f)}a&&e.setNode(a),e.setNode(i),e.removeFromParentsChildList(i),(o=e.parentMap)===null||o===void 0||o.set(i,u);var l=e.childrenMap.get(u);return l.set(i,!0),(s=e.childrenMap)===null||s===void 0||s.set(u,l),e},this.children=function(i){var a=i===void 0?e.GRAPH_NODE:i;if(e.isCompound()){var o,s=(o=e.childrenMap)===null||o===void 0?void 0:o.get(a);return s?Array.from(s.keys()):void 0}if(a===e.GRAPH_NODE)return e.nodes();if(i&&e.hasNode(i))return[]},this.predecessors=function(i){var a=e.predecessorsMap.get(i);return a?Array.from(a.keys()):void 0},this.successors=function(i){var a=e.successorsMap.get(i);return a?Array.from(a.keys()):void 0},this.neighbors=function(i){var a;if(e.hasNode(i))return Array.from(new Set((a=e.predecessors(i))===null||a===void 0?void 0:a.concat(e.successors(i))))},this.isLeaf=function(i){var a;if(e.isDirected()){var o;return!(!((o=e.successors(i))===null||o===void 0)&&o.length)}return!(!((a=e.neighbors(i))===null||a===void 0)&&a.length)},this.filterNodes=function(i){var a=e.directed,o=e.multigraph,s=e.compound,u=new r({directed:a,multigraph:o,compound:s});if(u.setGraph(e.graph()),e.nodes().forEach(function(l){i(l)&&u.setNode(l,e.node(l))}),e.edges().forEach(function(l){u.hasNode(l.v)&&u.hasNode(l.w)&&u.setEdgeObj(l,e.edge(l))}),s){var f=function(c){for(var h=e.parent(c);h!==void 0&&!u.hasNode(h);)h=e.parent(h);return h};u.nodes().forEach(function(l){u.setParent(l,f(l))})}return u},this.setDefaultEdgeLabel=function(i){return cC(i)?e.defaultEdgeLabelFn=i:e.defaultEdgeLabelFn=function(){return i},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(i,a){return e.setEdge(i.v,i.w,a,i.name)},this.setPath=function(i,a){return i.reduce(function(o,s){return e.setEdge(o,s,a),s}),e},this.edgeFromArgs=function(i,a,o){return e.edge({v:i,w:a,name:o})},this.edge=function(i){return e.edgesLabelsMap.get(ty(e.isDirected(),i))},this.hasEdge=function(i,a,o){return e.edgesLabelsMap.has(ty(e.isDirected(),{v:i,w:a,name:o}))},this.removeEdgeObj=function(i){var a=i.v,o=i.w,s=i.name;return e.removeEdge(a,o,s)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(i,a){var o=e.inEdgesMap.get(i);if(o)return Array.from(o.values()).filter(function(s){return!a||s.v===a})},this.outEdges=function(i,a){var o=e.outEdgesMap.get(i);if(o)return Array.from(o.values()).filter(function(s){return!a||s.w===a})},this.nodeEdges=function(i,a){var o;if(e.hasNode(i))return(o=e.inEdges(i,a))===null||o===void 0?void 0:o.concat(e.outEdges(i,a))},this.toJSON=function(){return $X(e)},this.nodeInDegree=function(i){var a=e.inEdgesMap.get(i);return a?a.size:0},this.nodeOutDegree=function(i){var a=e.outEdgesMap.get(i);return a?a.size:0},this.nodeDegree=function(i){return e.nodeInDegree(i)+e.nodeOutDegree(i)},this.source=function(i){return i.v},this.target=function(i){return i.w};var n=dC(dC({},VX),t);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return WX(r,[{key:"setNode",value:function(t,n){var i=this.nodesLabelMap,a=this.defaultNodeLabelFn,o=this.isCompound,s=this.parentMap,u=this.childrenMap,f=this.inEdgesMap,l=this.outEdgesMap,c=this.predecessorsMap,h=this.successorsMap;if(i.has(t))return n!==void 0&&i.set(t,n),this;if(i.set(t,n||a(t)),o()){var d;s==null||s.set(t,this.GRAPH_NODE),u==null||u.set(t,new Map),u!=null&&u.has(this.GRAPH_NODE)||u==null||u.set(this.GRAPH_NODE,new Map),u==null||(d=u.get(this.GRAPH_NODE))===null||d===void 0||d.set(t,!0)}return[f,l,c,h].forEach(function(v){return v.set(t,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(t){var n=this;if(this.hasNode(t)){var i=function(g){n.removeEdge(g.v,g.w,g.name)},a=this.inEdgesMap,o=this.outEdgesMap,s=this.predecessorsMap,u=this.successorsMap,f=this.nodesLabelMap;if(this.isCompound()){var l,c,h;this.removeFromParentsChildList(t),(l=this.parentMap)===null||l===void 0||l.delete(t),(c=this.children(t))===null||c===void 0||c.forEach(function(p){return n.setParent(p)}),(h=this.childrenMap)===null||h===void 0||h.delete(t)}var d=a.get(t),v=o.get(t);Array.from(d.values()).forEach(function(p){return i(p)}),Array.from(v.values()).forEach(function(p){return i(p)}),f.delete(t),a.delete(t),o.delete(t),s.delete(t),u.delete(t),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(t,n,i,a){var o,s,u=lC(this.isDirected(),t,n,a),f=ty(this.isDirected(),u),l=u.v,c=u.w;if(this.edgesLabelsMap.has(f))return this.edgesLabelsMap.set(f,i),this;if(a!==void 0&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(c),this.edgesLabelsMap.set(f,i||this.defaultEdgeLabelFn(l,c,a)),Object.freeze(u),this.edgesMap.set(f,u);var h=this.predecessorsMap.get(c),d=this.successorsMap.get(l);return sC(h,l),sC(d,c),(o=this.inEdgesMap.get(c))===null||o===void 0||o.set(f,u),(s=this.outEdgesMap.get(l))===null||s===void 0||s.set(f,u),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(t,n,i){var a=fC(this.isDirected(),t,n,i),o=this.edgesMap.get(a);if(o){var s=lC(this.isDirected(),t,n,i),u=s.v,f=s.w;this.edgesLabelsMap.delete(a),this.edgesMap.delete(a);var l=this.predecessorsMap.get(f),c=this.successorsMap.get(u);uC(l,u),uC(c,f),this.inEdgesMap.get(f).delete(a),this.outEdgesMap.get(u).delete(a),this.edgeCountNum-=1}return this}}]),r}();rs.fromJSON=jX;function ry(r){"@babel/helpers - typeof";return ry=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ry(r)}function HX(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function qX(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function ZX(r,e,t){return e&&qX(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function ns(){return typeof Reflect<"u"&&Reflect.get?ns=Reflect.get:ns=function(e,t,n){var i=KX(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},ns.apply(this,arguments)}function KX(r,e){for(;!Object.prototype.hasOwnProperty.call(r,e)&&(r=La(r),r!==null););return r}function QX(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ny(r,e)}function ny(r,e){return ny=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ny(r,e)}function JX(r){var e=rY();return function(){var n=La(r),i;if(e){var a=La(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return eY(this,i)}}function eY(r,e){if(e&&(ry(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tY(r)}function tY(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function rY(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function La(r){return La=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},La(r)}var nY=function(r){QX(t,r);var e=JX(t);function t(){var n;HX(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a)),n.eventPool={},n}return ZX(t,[{key:"appendEvent",value:function(i,a){this.eventPool[i]||(this.eventPool[i]=[]),this.eventPool[i].push(a)}},{key:"removeEvent",value:function(i,a){if(this.eventPool[i]){var o=this.eventPool[i].indexOf(a);o>-1&&this.eventPool[i].splice(o,1)}}},{key:"emitEvent",value:function(i){for(var a=arguments.length,o=new Array(a>1?a-1:0),s=1;s<a;s++)o[s-1]=arguments[s];this.eventPool[i]&&this.eventPool[i].forEach(function(u){u.apply(void 0,o)})}},{key:"setNode",value:function(i,a){return ns(La(t.prototype),"setNode",this).call(this,i,a),this.emitEvent("nodeAdd",i,a),this}},{key:"removeNode",value:function(i){return ns(La(t.prototype),"removeNode",this).call(this,i),this.emitEvent("nodeRemove",i),this}},{key:"setEdge",value:function(i,a,o,s){return ns(La(t.prototype),"setEdge",this).call(this,i,a,o,s),this.emitEvent("edgeAdd",i,a,o,s),this}},{key:"removeEdge",value:function(i,a,o){return ns(La(t.prototype),"removeEdge",this).call(this,i,a,o),this.emitEvent("edgeRemove",i,a,o),this}}]),t}(rs);function iY(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function aY(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var vC=iY(function r(){var e=this;aY(this,r),this.arr=[],this.keyIndice=new Map,this.size=function(){return e.arr.length},this.keys=function(){return e.arr.map(function(t){return t.key})},this.has=function(t){return e.keyIndice.has(t)},this.priority=function(t){var n=e.keyIndice.get(t);if(n!==void 0)return e.arr[n].priority},this.swap=function(t,n){var i=e.arr,a=e.keyIndice,o=[i[t],i[n]],s=o[0],u=o[1];i[t]=u,i[n]=s,a.set(s.key,n),a.set(u.key,t)},this.innerDecrease=function(t){for(var n=e.arr,i=n[t].priority,a,o=t;o!==0;){var s;if(a=o>>1,((s=n[a])===null||s===void 0?void 0:s.priority)<i)break;e.swap(o,a),o=a}},this.heapify=function(t){var n=e.arr,i=t<<1,a=i+1,o=t;i<n.length&&(o=n[i].priority<n[o].priority?i:o,a<n.length&&(o=n[a].priority<n[o].priority?a:o),o!==t&&(e.swap(t,o),e.heapify(o)))},this.min=function(){if(e.size()===0)throw new Error("Queue underflow");return e.arr[0].key},this.add=function(t,n){var i=e.keyIndice,a=e.arr;if(!i.has(t)){var o=a.length;return i.set(t,o),a.push({key:t,priority:n}),e.innerDecrease(o),!0}return!1},this.removeMin=function(){e.swap(0,e.arr.length-1);var t=e.arr.pop();return e.keyIndice.delete(t.key),e.heapify(0),t.key},this.decrease=function(t,n){if(!e.has(t))throw new Error("There's no key named ".concat(t));var i=e.keyIndice.get(t);if(n>e.arr[i].priority)throw new Error("New priority is greater than current priority.Key: ".concat(t," Old: + ").concat(e.arr[i].priority," New: ").concat(n));e.arr[i].priority=n,e.innerDecrease(i)}}),oY=function(e,t){var n=new rs,i=new Map,a=new vC,o;function s(l){var c=l.v===o?l.w:l.v,h=a.priority(c);if(h!==void 0){var d=t(l);d<h&&(i.set(c,o),a.decrease(c,d))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(l){a.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),a.decrease(e.nodes()[0],0);for(var u=!1;a.size()>0;){var f;if(o=a.removeMin(),i.has(o))n.setEdge(o,i.get(o));else{if(u)throw new Error("Input graph is not connected: "+e.graph());u=!0}(f=e.nodeEdges(o))===null||f===void 0||f.forEach(s)}return n},sY=function(e){var t=new Set,n=[],i=e.nodes();return i.forEach(function(a){for(var o=[],s=[a];s.length>0;){var u=s.pop();if(!t.has(u)){var f,l;t.add(u),o.push(u),(f=e.successors(u))===null||f===void 0||f.forEach(function(c){return s.push(c)}),(l=e.predecessors(u))===null||l===void 0||l.forEach(function(c){return s.push(c)})}}o.length&&n.push(o)}),n},uY=function r(e,t,n,i,a,o){i.includes(t)||(i.push(t),n||o.push(t),a(t).forEach(function(s){return r(e,s,n,i,a,o)}),n&&o.push(t))},iy=function(e,t,n){var i=Array.isArray(t)?t:[t],a=function(f){return e.isDirected()?e.successors(f):e.neighbors(f)},o=[],s=[];return i.forEach(function(u){if(e.hasNode(u))uY(e,u,n==="post",s,a,o);else throw new Error("Graph does not have node: "+u)}),o};function fY(r,e){return dY(r)||hY(r,e)||cY(r,e)||lY()}function lY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cY(r,e){if(r){if(typeof r=="string")return pC(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pC(r,e)}}function pC(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function hY(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],i=!0,a=!1,o,s;try{for(t=t.call(r);!(i=(o=t.next()).done)&&(n.push(o.value),!(e&&n.length===e));i=!0);}catch(u){a=!0,s=u}finally{try{!i&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function dY(r){if(Array.isArray(r))return r}var vY=function(){return 1},gC=function(e,t,n,i){return pY(e,t,n||vY,i||function(a){return e.outEdges(a)})},pY=function(e,t,n,i){var a=new Map,o=new vC,s,u,f=function(h){var d=h.v!==s?h.v:h.w,v=a.get(d),p=n(h),g=u.distance+p;if(p<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+p);g<v.distance&&(v.distance=g,v.predecessor=s,o.decrease(d,g))};for(e.nodes().forEach(function(c){var h=c===t?0:Number.POSITIVE_INFINITY;a.set(c,{distance:h}),o.add(c,h)});o.size()>0&&(s=o.removeMin(),u=a.get(s),!(u&&u.distance===Number.POSITIVE_INFINITY));)i(s).forEach(f);var l={};return Array.from(a.entries()).forEach(function(c){var h=fY(c,2),d=h[0],v=h[1];return l[String(d)]=v,l}),l},gY=function(e,t,n){var i={};return e.nodes().forEach(function(a){return i[String(a)]=gC(e,a,t,n),i}),i},yC=function(e){var t=0,n=[],i=new Map,a=[];function o(s){var u,f={onStack:!0,lowlink:t,index:t};if(i.set(s,f),t+=1,n.push(s),(u=e.successors(s))===null||u===void 0||u.forEach(function(d){var v;if(i.has(d)){if(!((v=i.get(d))===null||v===void 0)&&v.onStack){var g=i.get(d);f.lowlink=Math.min(f.lowlink,g.index)}}else{o(d);var p=i.get(d);f.lowlink=Math.min(f.lowlink,p.lowlink)}}),f.lowlink===f.index){var l=[],c;do{c=n.pop();var h=i.get(c);h.onStack=!1,l.push(c)}while(s!==c);a.push(l)}}return e.nodes().forEach(function(s){i.has(s)||o(s)}),a},yY=function(e){return yC(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})};function ay(r){"@babel/helpers - typeof";return ay=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ay(r)}function mY(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function bY(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function xY(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&il(r,e)}function wY(r){var e=mC();return function(){var n=al(r),i;if(e){var a=al(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return EY(this,i)}}function EY(r,e){if(e&&(ay(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _Y(r)}function _Y(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function oy(r){var e=typeof Map=="function"?new Map:void 0;return oy=function(n){if(n===null||!SY(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return hd(n,arguments,al(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),il(i,n)},oy(r)}function hd(r,e,t){return mC()?hd=Reflect.construct:hd=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),f=new u;return o&&il(f,o.prototype),f},hd.apply(null,arguments)}function mC(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function SY(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function il(r,e){return il=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},il(r,e)}function al(r){return al=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},al(r)}var sy=function(r){xY(t,r);var e=wY(t);function t(){return bY(this,t),e.apply(this,arguments)}return mY(t)}(oy(Error));function bC(r){var e=new Set,t=new Set,n=[];function i(a){if(t.has(a))throw new sy;if(!e.has(a)){var o;t.add(a),e.add(a),(o=r.predecessors(a))===null||o===void 0||o.forEach(i),t.delete(a),n.push(a)}}if(r.sinks().forEach(i),e.size!==r.nodeCount())throw new sy;return n}var MY=function(e){try{bC(e)}catch(t){if(t instanceof sy)return!1;throw t}return!0},CY=function(e,t){return iy(e,t,"post")},AY=function(e,t){return iy(e,t,"pre")},TY=function(){return 1};function IY(r,e,t){return kY(r,e||TY,t||function(n){return r.outEdges(n)})}function kY(r,e,t){var n={},i=r.nodes();return i.forEach(function(a){var o=String(a);n[o]={},n[o][o]={distance:0},i.forEach(function(s){a!==s&&(n[o][String(s)]={distance:Number.POSITIVE_INFINITY})}),t(a).forEach(function(s){var u=s.v===a?s.w:s.v,f=e(s);n[o][String(u)]={distance:f,predecessor:a}})}),i.forEach(function(a){var o=String(a),s=n[o];i.forEach(function(u){var f=String(u),l=n[f];i.forEach(function(c){var h=String(c),d=l[o],v=s[h],p=l[h],g=d.distance+v.distance;g<p.distance&&(p.distance=g,p.predecessor=v.predecessor)})})}),n}const LY=Object.freeze(Object.defineProperty({__proto__:null,components:sY,dfs:iy,dijkstra:gC,dijkstraAll:gY,findCycles:yY,floydWarshall:IY,isAcyclic:MY,postorder:CY,preorder:AY,prim:oY,tarjan:yC,topsort:bC},Symbol.toStringTag,{value:"Module"}));var NY=function(e,t){for(var n=e.nodes(),i=0;i<n.length;i++){var a=n[i];if(t.hasNode(a))return!0}return!1},xC=function(e,t){for(var n=e.edges(),i=0;i<n.length;i++){var a=n[i];if(t.hasEdge(a.v,a.w,a.name))return!0}return!1},wC=function(e,t){var n=e.nodes(),i=n.filter(function(a){return t.hasNode(a)});return i},EC=function(e,t){var n=e.edges(),i=n.filter(function(a){return t.hasEdge(a.v,a.w,a.name)});return i},_C=function(e,t){return e.isCompound()===t.isCompound()&&e.isDirected()===t.isDirected()&&e.isMultigraph()===t.isMultigraph()},dd=function(e,t){var n=wC(e,t);return n.length===e.nodes().length},uy=function(e,t){var n=EC(e,t);return n.length===e.edges().length},OY=function(e,t){return _C(e,t)&&e.nodeCount()===t.nodeCount()&&dd(e,t)&&e.edgeCount()===t.edgeCount()&&uy(e,t)},DY=function(e,t){return dd(e,t)&&uy(e,t)};function PY(r,e){return GY(r)||FY(r,e)||BY(r,e)||RY()}function RY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BY(r,e){if(r){if(typeof r=="string")return SC(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return SC(r,e)}}function SC(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function FY(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],i=!0,a=!1,o,s;try{for(t=t.call(r);!(i=(o=t.next()).done)&&(n.push(o.value),!(e&&n.length===e));i=!0);}catch(u){a=!0,s=u}finally{try{!i&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function GY(r){if(Array.isArray(r))return r}function zY(r){return r instanceof rs}function vd(r){if(r.isMultigraph())return!1;for(var e=r.edges(),t=new Map,n=0;n<e.length;n++){var i=e[n];if(i.v===i.w)return!1;var a=[i.v,i.w].sort(),o=PY(a,2),s=o[0],u=o[1],f="".concat(s,"-").concat(u);if(t.has(f))return!1;t.set(f,!0)}return!0}function $Y(r){return r.nodes().length===0}function jY(r){for(var e=r.edges(),t=0;t<e.length;t++){var n=e[t];if(n.v===n.w)return!0}return!1}const UY=Object.freeze(Object.defineProperty({__proto__:null,hasSelfLoop:jY,isGraph:zY,isNullGraph:$Y,isSimpleGraph:vd},Symbol.toStringTag,{value:"Module"}));var XY=function(e,t){if(!vd(e)||!vd(t)||!dd(e,t)||xC(e,t))return!1;var n=e.nodeCount();return e.edgeCount()+t.edgeCount()===n*(n-1)/2};const YY=Object.freeze(Object.defineProperty({__proto__:null,containAllSameEdges:uy,containAllSameNodes:dd,containSameEdges:xC,containSameNodes:NY,getSameEdges:EC,getSameNodes:wC,isGraphComplement:XY,isGraphContainsAnother:DY,isGraphOptionSame:_C,isGraphSame:OY},Symbol.toStringTag,{value:"Module"}));var WY=function(e){if(!vd(e))return null;for(var t=e.nodeCount(),n=new rs({compound:e.isCompound(),directed:e.isDirected(),multigraph:e.isMultigraph()}),i=e.nodes(),a=0;a<t;a++){var o=i[a];n.setNode(o,e.node(o));for(var s=a+1;s<t;s++){var u=i[s];e.hasEdge(o,u)||n.setEdge(o,u)}}return n};const pd=ea(Object.freeze(Object.defineProperty({__proto__:null,Graph:rs,GraphWithEvent:nY,algorithm:LY,comparision:YY,essence:UY,generate:Object.freeze(Object.defineProperty({__proto__:null,getGraphComplement:WY},Symbol.toStringTag,{value:"Module"}))},Symbol.toStringTag,{value:"Module"})));var MC=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),VY=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(J0,"__esModule",{value:!0});var HY=VY(ey),qY=pd,ZY=function(r){MC(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(HY.default),KY=function(r){MC(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(qY.Graph),QY=function(){return 1},JY=function(r,e){var t;if(r.nodeCount()<=1)return[];var n=tW(r,e||QY),i=eW(n.graph,n.buckets,n.zeroIdx);return(t=i.map(function(a){return r.outEdges(a.v,a.w)}))===null||t===void 0?void 0:t.flat()},eW=function(r,e,t){for(var n=[],i=e[e.length-1],a=e[0],o;r.nodeCount();){for(;o=a.dequeue();)fy(r,e,t,o);for(;o=i.dequeue();)fy(r,e,t,o);if(r.nodeCount()){for(var s=e.length-2;s>0;--s)if(o=e[s].dequeue(),o){n=n.concat(fy(r,e,t,o,!0));break}}}return n},fy=function(r,e,t,n,i){var a,o,s=[];return(a=r.inEdges(n.v))===null||a===void 0||a.forEach(function(u){var f=r.edge(u),l=r.node(u.v);i&&s.push({v:u.v,w:u.w,in:0,out:0}),l.out===void 0&&(l.out=0),l.out-=f,ly(e,t,l)}),(o=r.outEdges(n.v))===null||o===void 0||o.forEach(function(u){var f=r.edge(u),l=u.w,c=r.node(l);c.in===void 0&&(c.in=0),c.in-=f,ly(e,t,c)}),r.removeNode(n.v),i?s:void 0},tW=function(r,e){var t=new KY,n=0,i=0;r.nodes().forEach(function(f){t.setNode(f,{v:f,in:0,out:0})}),r.edges().forEach(function(f){var l=t.edge(f)||0,c=(e==null?void 0:e(f))||1,h=l+c;t.setEdge(f.v,f.w,h),i=Math.max(i,t.node(f.v).out+=c),n=Math.max(n,t.node(f.w).in+=c)});for(var a=[],o=i+n+3,s=0;s<o;s++)a.push(new ZY);var u=n+1;return t.nodes().forEach(function(f){ly(a,u,t.node(f))}),{buckets:a,zeroIdx:u,graph:t}},ly=function(r,e,t){t.out?t.in?r[t.out-t.in+e].enqueue(t):r[r.length-1].enqueue(t):r[0].enqueue(t)};J0.default=JY;var rW=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Q0,"__esModule",{value:!0});var nW=rW(J0),iW=function(r){var e=function(n){return function(i){var a;return((a=n.edge(i))===null||a===void 0?void 0:a.weight)||1}},t=r.graph().acyclicer==="greedy"?(0,nW.default)(r,e(r)):aW(r);t==null||t.forEach(function(n){var i=r.edge(n);r.removeEdgeObj(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,"rev-".concat(Math.random()))})},aW=function(r){var e=[],t={},n={},i=function(a){var o;n[a]||(n[a]=!0,t[a]=!0,(o=r.outEdges(a))===null||o===void 0||o.forEach(function(s){t[s.w]?e.push(s):i(s.w)}),delete t[a])};return r.nodes().forEach(i),e},oW=function(r){r.edges().forEach(function(e){var t=r.edge(e);if(t.reversed){r.removeEdgeObj(e);var n=t.forwardName;delete t.reversed,delete t.forwardName,r.setEdge(e.w,e.v,t,n)}})};Q0.default={run:iW,undo:oW};var cy={},Zn={},Na={},sW=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Na,"__esModule",{value:!0}),Na.Graph=void 0;var uW=pd,fW=function(r){sW(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(uW.Graph);Na.Graph=fW,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.minBy=r.notime=r.time=r.partition=r.maxRank=r.addBorderNode=r.removeEmptyRanks=r.normalizeRanks=r.buildLayerMatrix=r.intersectRect=r.predecessorWeights=r.successorWeights=r.zipObject=r.asNonCompoundGraph=r.simplify=r.addDummyNode=void 0;var e=Ir(),t=Na,n=function(x,w){return Number(x)-Number(w)},i=function(x,w,E,_){var M;do M="".concat(_).concat(Math.random());while(x.hasNode(M));return E.dummy=w,x.setNode(M,E),M};r.addDummyNode=i;var a=function(x){var w=new t.Graph().setGraph(x.graph());return x.nodes().forEach(function(E){w.setNode(E,x.node(E))}),x.edges().forEach(function(E){var _=w.edgeFromArgs(E.v,E.w)||{weight:0,minlen:1},M=x.edge(E);w.setEdge(E.v,E.w,{weight:_.weight+M.weight,minlen:Math.max(_.minlen,M.minlen)})}),w};r.simplify=a;var o=function(x){var w=new t.Graph({multigraph:x.isMultigraph()}).setGraph(x.graph());return x.nodes().forEach(function(E){var _;!((_=x.children(E))===null||_===void 0)&&_.length||w.setNode(E,x.node(E))}),x.edges().forEach(function(E){w.setEdgeObj(E,x.edge(E))}),w};r.asNonCompoundGraph=o;var s=function(x,w){return x==null?void 0:x.reduce(function(E,_,M){return E[_]=w[M],E},{})};r.zipObject=s;var u=function(x){var w={};return x.nodes().forEach(function(E){var _,M={};(_=x.outEdges(E))===null||_===void 0||_.forEach(function(C){var S;M[C.w]=(M[C.w]||0)+(((S=x.edge(C))===null||S===void 0?void 0:S.weight)||0)}),w[E]=M}),w};r.successorWeights=u;var f=function(x){var w=x.nodes(),E=w.map(function(_){var M,C={};return(M=x.inEdges(_))===null||M===void 0||M.forEach(function(S){C[S.v]=(C[S.v]||0)+x.edge(S).weight}),C});return(0,r.zipObject)(w,E)};r.predecessorWeights=f;var l=function(x,w){var E=Number(x.x),_=Number(x.y),M=Number(w.x)-E,C=Number(w.y)-_,S=Number(x.width)/2,A=Number(x.height)/2;if(!M&&!C)return{x:0,y:0};var T,k;return Math.abs(C)*S>Math.abs(M)*A?(C<0&&(A=-A),T=A*M/C,k=A):(M<0&&(S=-S),T=S,k=S*C/M),{x:E+T,y:_+k}};r.intersectRect=l;var c=function(x){for(var w=[],E=(0,r.maxRank)(x)+1,_=0;_<E;_++)w.push([]);x.nodes().forEach(function(M){var C=x.node(M);if(C){var S=C.rank;S!==void 0&&w[S]&&w[S].push(M)}});for(var _=0;_<E;_++)w[_]=w[_].sort(function(C,S){var A,T;return n((A=x.node(C))===null||A===void 0?void 0:A.order,(T=x.node(S))===null||T===void 0?void 0:T.order)});return w};r.buildLayerMatrix=c;var h=function(x){var w=x.nodes().filter(function(_){var M;return((M=x.node(_))===null||M===void 0?void 0:M.rank)!==void 0}).map(function(_){return x.node(_).rank}),E=Math.min.apply(Math,w);x.nodes().forEach(function(_){var M=x.node(_);M.hasOwnProperty("rank")&&E!==1/0&&(M.rank-=E)})};r.normalizeRanks=h;var d=function(x){var w=x.nodes(),E=w.filter(function(k){var O;return((O=x.node(k))===null||O===void 0?void 0:O.rank)!==void 0}).map(function(k){return x.node(k).rank}),_=Math.min.apply(Math,E),M=[];w.forEach(function(k){var O,G=(((O=x.node(k))===null||O===void 0?void 0:O.rank)||0)-_;M[G]||(M[G]=[]),M[G].push(k)});for(var C=0,S=x.graph().nodeRankFactor||0,A=0;A<M.length;A++){var T=M[A];T===void 0?A%S!==0&&(C-=1):C&&(T==null||T.forEach(function(k){var O=x.node(k);O&&(O.rank=O.rank||0,O.rank+=C)}))}};r.removeEmptyRanks=d;var v=function(x,w,E,_){var M={width:0,height:0};return(0,e.isNumber)(E)&&(0,e.isNumber)(_)&&(M.rank=E,M.order=_),(0,r.addDummyNode)(x,"border",M,w)};r.addBorderNode=v;var p=function(x){var w;return x.nodes().forEach(function(E){var _,M=(_=x.node(E))===null||_===void 0?void 0:_.rank;M!==void 0&&(w===void 0||M>w)&&(w=M)}),w||(w=0),w};r.maxRank=p;var g=function(x,w){var E={lhs:[],rhs:[]};return x==null||x.forEach(function(_){w(_)?E.lhs.push(_):E.rhs.push(_)}),E};r.partition=g;var y=function(x,w){var E=Date.now();try{return w()}finally{console.log("".concat(x," time: ").concat(Date.now()-E,"ms"))}};r.time=y;var m=function(x,w){return w()};r.notime=m;var b=function(x,w){return x.reduce(function(E,_){var M=w(E),C=w(_);return M>C?_:E})};r.minBy=b}(Zn),Object.defineProperty(cy,"__esModule",{value:!0});var lW=Zn,cW=function(r){r.graph().dummyChains=[],r.edges().forEach(function(e){return hW(r,e)})},hW=function(r,e){var t=e.v,n=r.node(t).rank,i=e.w,a=r.node(i).rank,o=e.name,s=r.edge(e),u=s.labelRank;if(a!==n+1){r.removeEdgeObj(e);var f=r.graph(),l,c,h;for(h=0,++n;n<a;++h,++n)s.points=[],c={edgeLabel:s,width:0,height:0,edgeObj:e,rank:n},l=(0,lW.addDummyNode)(r,"edge",c,"_d"),n===u&&(c.width=s.width,c.height=s.height,c.dummy="edge-label",c.labelpos=s.labelpos),r.setEdge(t,l,{weight:s.weight},o),h===0&&(f.dummyChains||(f.dummyChains=[]),f.dummyChains.push(l)),t=l;r.setEdge(t,i,{weight:s.weight},o)}},dW=function(r){var e;(e=r.graph().dummyChains)===null||e===void 0||e.forEach(function(t){var n=r.node(t),i=n.edgeLabel,a;n.edgeObj&&r.setEdgeObj(n.edgeObj,i);for(var o=t;n.dummy;)a=r.successors(o)[0],r.removeNode(o),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),o=a,n=r.node(o)})};cy.default={run:cW,undo:dW};var hy={},Ti={};Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.slack=Ti.longestPathWithLayer=Ti.longestPath=void 0;var CC=function(r){var e,t={},n=function(i){var a,o=r.node(i);if(!o)return 0;if(t[i])return o.rank;t[i]=!0;var s;return(a=r.outEdges(i))===null||a===void 0||a.forEach(function(u){var f=n(u.w),l=r.edge(u).minlen,c=f-l;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),o.rank=s,s};(e=r.sources())===null||e===void 0||e.forEach(function(i){return n(i)})};Ti.longestPath=CC;var AC=function(r){var e,t={},n,i=function(s){var u,f=r.node(s);if(!f)return 0;if(t[s])return f.rank;t[s]=!0;var l;return(u=r.outEdges(s))===null||u===void 0||u.forEach(function(c){var h=i(c.w),d=r.edge(c).minlen,v=h-d;v&&(l===void 0||v<l)&&(l=v)}),l||(l=0),(n===void 0||l<n)&&(n=l),f.rank=l,l};(e=r.sources())===null||e===void 0||e.forEach(function(s){r.node(s)&&i(s)}),n===void 0&&(n=0);var a={},o=function(s,u){var f,l=r.node(s),c=isNaN(l.layer)?u:l.layer;(l.rank===void 0||l.rank<c)&&(l.rank=c),!a[s]&&(a[s]=!0,(f=r.outEdges(s))===null||f===void 0||f.map(function(h){o(h.w,c+r.edge(h).minlen)}))};r.nodes().forEach(function(s){var u=r.node(s);u&&(isNaN(u.layer)?u.rank-=n:o(s,u.layer))})};Ti.longestPathWithLayer=AC;var TC=function(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen};Ti.slack=TC,Ti.default={longestPath:CC,longestPathWithLayer:AC,slack:TC};var go={};Object.defineProperty(go,"__esModule",{value:!0}),go.feasibleTreeWithLayer=go.feasibleTree=void 0;var is=Ti,vW=Zn,IC=Na,kC=function(r){var e=new IC.Graph({directed:!1}),t=r.nodes()[0],n=r.nodeCount();e.setNode(t,{});for(var i,a;pW(e,r)<n;)i=NC(e,r),a=e.hasNode(i.v)?(0,is.slack)(r,i):-(0,is.slack)(r,i),OC(e,r,a);return e};go.feasibleTree=kC;var pW=function(r,e){var t=function(n){e.nodeEdges(n).forEach(function(i){var a=i.v,o=n===a?i.w:a;!r.hasNode(o)&&!(0,is.slack)(e,i)&&(r.setNode(o,{}),r.setEdge(n,o,{}),t(o))})};return r.nodes().forEach(t),r.nodeCount()},LC=function(r){var e=new IC.Graph({directed:!1}),t=r.nodes()[0],n=r.nodes().filter(function(o){return!!r.node(o)}).length;e.setNode(t,{});for(var i,a;gW(e,r)<n;)i=NC(e,r),a=e.hasNode(i.v)?(0,is.slack)(r,i):-(0,is.slack)(r,i),OC(e,r,a);return e};go.feasibleTreeWithLayer=LC;var gW=function(r,e){var t=function(n){var i;(i=e.nodeEdges(n))===null||i===void 0||i.forEach(function(a){var o=a.v,s=n===o?a.w:o;!r.hasNode(s)&&(e.node(s).layer!==void 0||!(0,is.slack)(e,a))&&(r.setNode(s,{}),r.setEdge(n,s,{}),t(s))})};return r.nodes().forEach(t),r.nodeCount()},NC=function(r,e){return(0,vW.minBy)(e.edges(),function(t){return r.hasNode(t.v)!==r.hasNode(t.w)?(0,is.slack)(e,t):1/0})},OC=function(r,e,t){r.nodes().forEach(function(n){e.node(n).rank||(e.node(n).rank=0),e.node(n).rank+=t})};go.default={feasibleTree:kC,feasibleTreeWithLayer:LC};var DC={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.exchangeEdges=r.enterEdge=r.leaveEdge=r.initLowLimValues=r.calcCutValue=r.initCutValues=void 0;var e=go,t=Ti,n=Zn,i=pd,a=i.algorithm.preorder,o=i.algorithm.postorder,s=function(b){var x=(0,n.simplify)(b);(0,t.longestPath)(x);var w=(0,e.feasibleTree)(x);(0,r.initLowLimValues)(w),(0,r.initCutValues)(w,x);for(var E,_;E=(0,r.leaveEdge)(w);)_=(0,r.enterEdge)(w,x,E),(0,r.exchangeEdges)(w,x,E,_)},u=function(b,x){var w=o(b,b.nodes());w=w==null?void 0:w.slice(0,(w==null?void 0:w.length)-1),w==null||w.forEach(function(E){f(b,x,E)})};r.initCutValues=u;var f=function(b,x,w){var E=b.node(w),_=E.parent;b.edgeFromArgs(w,_).cutvalue=(0,r.calcCutValue)(b,x,w)},l=function(b,x,w){var E,_=b.node(w),M=_.parent,C=!0,S=x.edgeFromArgs(w,M),A=0;return S||(C=!1,S=x.edgeFromArgs(M,w)),A=S.weight,(E=x.nodeEdges(w))===null||E===void 0||E.forEach(function(T){var k=T.v===w,O=k?T.w:T.v;if(O!==M){var G=k===C,D=x.edge(T).weight;if(A+=G?D:-D,y(b,w,O)){var $=b.edgeFromArgs(w,O).cutvalue;A+=G?-$:$}}}),A};r.calcCutValue=l;var c=function(b,x){x===void 0&&(x=b.nodes()[0]),h(b,{},1,x)};r.initLowLimValues=c;var h=function(b,x,w,E,_){var M,C=w,S=w,A=b.node(E);return x[E]=!0,(M=b.neighbors(E))===null||M===void 0||M.forEach(function(T){x[T]||(S=h(b,x,S,T,E))}),A.low=C,A.lim=S++,_?A.parent=_:delete A.parent,S},d=function(b){return b.edges().find(function(x){return b.edge(x).cutvalue<0})};r.leaveEdge=d;var v=function(b,x,w){var E=w.v,_=w.w;x.hasEdge(E,_)||(E=w.w,_=w.v);var M=b.node(E),C=b.node(_),S=M,A=!1;M.lim>C.lim&&(S=C,A=!0);var T=x.edges().filter(function(k){return A===m(b,b.node(k.v),S)&&A!==m(b,b.node(k.w),S)});return(0,n.minBy)(T,function(k){return(0,t.slack)(x,k)})};r.enterEdge=v;var p=function(b,x,w,E){var _=w.v,M=w.w;b.removeEdge(_,M),b.setEdge(E.v,E.w,{}),(0,r.initLowLimValues)(b),(0,r.initCutValues)(b,x),g(b,x)};r.exchangeEdges=p;var g=function(b,x){var w=b.nodes().find(function(_){var M;return!(!((M=x.node(_))===null||M===void 0)&&M.parent)}),E=a(b,w);E=E==null?void 0:E.slice(1),E==null||E.forEach(function(_){var M=b.node(_).parent,C=x.edgeFromArgs(_,M),S=!1;C||(C=x.edgeFromArgs(M,_),S=!0),x.node(_).rank=x.node(M).rank+(S?C.minlen:-C.minlen)})},y=function(b,x,w){return b.hasEdge(x,w)},m=function(b,x,w){return w.low<=x.lim&&x.lim<=w.lim};r.default=s})(DC);var yW=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(hy,"__esModule",{value:!0});var PC=Ti,mW=go,bW=yW(DC),xW=function(r){switch(r.graph().ranker){case"network-simplex":EW(r);break;case"tight-tree":RC(r);break;case"longest-path":wW(r);break;default:RC(r)}},wW=PC.longestPath,RC=function(r){(0,PC.longestPathWithLayer)(r),(0,mW.feasibleTreeWithLayer)(r)},EW=function(r){(0,bW.default)(r)};hy.default=xW;var dy={};Object.defineProperty(dy,"__esModule",{value:!0});var _W=function(r){var e,t={},n=0,i=function(a){var o,s=n;(o=r.children(a))===null||o===void 0||o.forEach(i),t[a]={low:s,lim:n++}};return(e=r.children())===null||e===void 0||e.forEach(i),t},SW=function(r,e,t,n){var i=[],a=[],o=Math.min(e[t].low,e[n].low),s=Math.max(e[t].lim,e[n].lim),u,f;u=t;do u=r.parent(u),i.push(u);while(u&&(e[u].low>o||s>e[u].lim));for(f=u,u=n;u&&u!==f;)a.push(u),u=r.parent(u);return{lca:f,path:i.concat(a.reverse())}},MW=function(r){var e,t=_W(r);(e=r.graph().dummyChains)===null||e===void 0||e.forEach(function(n){var i,a,o=n,s=r.node(o),u=s.edgeObj;if(u)for(var f=SW(r,t,u.v,u.w),l=f.path,c=f.lca,h=0,d=l[h],v=!0;o!==u.w;){if(s=r.node(o),v){for(;d!==c&&((i=r.node(d))===null||i===void 0?void 0:i.maxRank)<s.rank;)h++,d=l[h];d===c&&(v=!1)}if(!v){for(;h<l.length-1&&((a=r.node(l[h+1]))===null||a===void 0?void 0:a.minRank)<=s.rank;)h++;d=l[h]}r.setParent(o,d),o=r.successors(o)[0]}})};dy.default=MW;var vy={};Object.defineProperty(vy,"__esModule",{value:!0});var py=Zn,CW=function(r){var e,t=(0,py.addDummyNode)(r,"root",{},"_root"),n=AW(r),i=Math.max.apply(Math,Object.values(n));Math.abs(i)===1/0&&(i=1);var a=i-1,o=2*a+1;r.graph().nestingRoot=t,r.edges().forEach(function(u){r.edge(u).minlen*=o});var s=TW(r)+1;(e=r.children())===null||e===void 0||e.forEach(function(u){BC(r,t,o,s,a,n,u)}),r.graph().nodeRankFactor=o},BC=function(r,e,t,n,i,a,o){var s=r.children(o);if(!(s!=null&&s.length)){o!==e&&r.setEdge(e,o,{weight:0,minlen:t});return}var u=(0,py.addBorderNode)(r,"_bt"),f=(0,py.addBorderNode)(r,"_bb"),l=r.node(o);r.setParent(u,o),l.borderTop=u,r.setParent(f,o),l.borderBottom=f,s==null||s.forEach(function(c){BC(r,e,t,n,i,a,c);var h=r.node(c),d=h.borderTop?h.borderTop:c,v=h.borderBottom?h.borderBottom:c,p=h.borderTop?n:2*n,g=d!==v?1:i-a[o]+1;r.setEdge(u,d,{minlen:g,weight:p,nestingEdge:!0}),r.setEdge(v,f,{minlen:g,weight:p,nestingEdge:!0})}),r.parent(o)||r.setEdge(e,u,{weight:0,minlen:i+a[o]})},AW=function(r){var e,t={},n=function(i,a){var o=r.children(i);o==null||o.forEach(function(s){return n(s,a+1)}),t[i]=a};return(e=r.children())===null||e===void 0||e.forEach(function(i){return n(i,1)}),t},TW=function(r){var e=0;return r.edges().forEach(function(t){e+=r.edge(t).weight}),e},IW=function(r){var e=r.graph();e.nestingRoot&&r.removeNode(e.nestingRoot),delete e.nestingRoot,r.edges().forEach(function(t){var n=r.edge(t);n.nestingEdge&&r.removeEdgeObj(t)})};vy.default={run:CW,cleanup:IW};var gy={};Object.defineProperty(gy,"__esModule",{value:!0});var kW=Zn,LW=function(r){var e,t=function(n){var i=r.children(n),a=r.node(n);if(i!=null&&i.length&&i.forEach(function(u){return t(u)}),a.hasOwnProperty("minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,s=a.maxRank+1;o<s;o+=1)FC(r,"borderLeft","_bl",n,a,o),FC(r,"borderRight","_br",n,a,o)}};(e=r.children())===null||e===void 0||e.forEach(function(n){return t(n)})},FC=function(r,e,t,n,i,a){var o={rank:a,borderType:e,width:0,height:0},s=i[e][a-1],u=(0,kW.addDummyNode)(r,"border",o,t);i[e][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})};gy.default=LW;var yy={};Object.defineProperty(yy,"__esModule",{value:!0});var NW=function(r){var e,t=(e=r.graph().rankdir)===null||e===void 0?void 0:e.toLowerCase();(t==="lr"||t==="rl")&&GC(r)},OW=function(r){var e,t=(e=r.graph().rankdir)===null||e===void 0?void 0:e.toLowerCase();(t==="bt"||t==="rl")&&DW(r),(t==="lr"||t==="rl")&&(PW(r),GC(r))},GC=function(r){r.nodes().forEach(function(e){zC(r.node(e))}),r.edges().forEach(function(e){zC(r.edge(e))})},zC=function(r){var e=r.width;r.width=r.height,r.height=e},DW=function(r){r.nodes().forEach(function(e){my(r.node(e))}),r.edges().forEach(function(e){var t,n=r.edge(e);(t=n.points)===null||t===void 0||t.forEach(function(i){return my(i)}),n.hasOwnProperty("y")&&my(n)})},my=function(r){r!=null&&r.y&&(r.y=-r.y)},PW=function(r){r.nodes().forEach(function(e){by(r.node(e))}),r.edges().forEach(function(e){var t,n=r.edge(e);(t=n.points)===null||t===void 0||t.forEach(function(i){return by(i)}),n.hasOwnProperty("x")&&by(n)})},by=function(r){var e=r.x;r.x=r.y,r.y=e};yy.default={adjust:NW,undo:OW};var xy={},wy={};function $C(r){return[parseInt(r.substr(1,2),16),parseInt(r.substr(3,2),16),parseInt(r.substr(5,2),16)]}function Ey(r){var e=Math.round(r).toString(16);return e.length===1?"0".concat(e):e}function jC(r){return"#".concat(Ey(r[0])).concat(Ey(r[1])).concat(Ey(r[2]))}var Bn=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},gd=function(r,e){return Bn(r)?r.indexOf(e)>-1:!1},UC=function(r,e){if(!Bn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},RW=function(r,e){return e===void 0&&(e=[]),UC(r,function(t){return!gd(e,t)})};function si(r){return typeof r=="function"}function yo(r){return r==null}function qr(r){return Array.isArray(r)}const yd=function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"};function cu(r,e){if(r){var t;if(qr(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(yd(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var XC=Object.keys?function(r){return Object.keys(r)}:function(r){var e=[];return cu(r,function(t,n){si(r)&&n==="prototype"||e.push(n)}),e};function YC(r,e){var t=XC(e),n=t.length;if(yo(r))return!n;for(var i=0;i<n;i+=1){var a=t[i];if(e[a]!==r[a]||!(a in r))return!1}return!0}var md=function(r){return typeof r=="object"&&r!==null},BW={}.toString,hu=function(r,e){return BW.call(r)==="[object "+e+"]"},du=function(r){if(!md(r)||!hu(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var e=r;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e};function FW(r,e){if(!qr(r))return null;var t;if(si(e)&&(t=e),du(e)&&(t=function(i){return YC(i,e)}),t){for(var n=0;n<r.length;n+=1)if(t(r[n]))return r[n]}return null}function GW(r,e,t){t===void 0&&(t=0);for(var n=t;n<r.length;n++)if(e(r[n],n))return n;return-1}var zW=function(r,e){for(var t=null,n=0;n<r.length;n++){var i=r[n],a=i[e];if(!yo(a)){qr(a)?t=a[0]:t=a;break}}return t},$W=function(r){if(!qr(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e},WC=function(r,e){if(e===void 0&&(e=[]),!qr(r))e.push(r);else for(var t=0;t<r.length;t+=1)WC(r[t],e);return e};function VC(r){if(!Array.isArray(r))return-1/0;var e=r.length;if(!e)return-1/0;for(var t=r[0],n=1;n<e;n++)t=Math.max(t,r[n]);return t}const HC=function(r){if(qr(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])};var jW=function(r){var e=r.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(qr(r[0])){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);e=t}var i=VC(e),a=HC(e);return{min:a,max:i}},qC=Array.prototype,UW=qC.splice,XW=qC.indexOf,YW=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],a=-1;(a=XW.call(r,i))>-1;)UW.call(r,a,1);return r},WW=Array.prototype.splice,ZC=function(e,t){if(!Bn(e))return[];for(var n=e?t.length:0,i=n-1;n--;){var a=void 0,o=t[n];(n===i||o!==a)&&(a=o,WW.call(e,o,1))}return e},KC=function(r,e,t){if(!qr(r)&&!du(r))return r;var n=t;return cu(r,function(i,a){n=e(n,i,a)}),n},VW=function(r,e){var t=[];if(!Bn(r))return t;for(var n=-1,i=[],a=r.length;++n<a;){var o=r[n];e(o,n,r)&&(t.push(o),i.push(n))}return ZC(r,i),t};function mo(r){return typeof r=="string"}function HW(r,e){var t;if(si(e))t=function(i,a){return e(i)-e(a)};else{var n=[];mo(e)?n.push(e):qr(e)&&(n=e),t=function(i,a){for(var o=0;o<n.length;o+=1){var s=n[o];if(i[s]>a[s])return 1;if(i[s]<a[s])return-1}return 0}}return r.sort(t),r}function QC(r,e){e===void 0&&(e=new Map);var t=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];e.has(a)||(t.push(a),e.set(a,!0))}return t}var qW=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return QC([].concat.apply([],r))};const ZW=function(r,e){for(var t=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[e];if(!yo(o)){qr(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(t.push(u),n[u]=!0)}}}return t};function KW(r){if(Bn(r))return r[0]}function QW(r){if(Bn(r)){var e=r;return e[e.length-1]}}function JW(r,e){return qr(r)||mo(r)?r[0]===e:!1}function eV(r,e){return qr(r)||mo(r)?r[r.length-1]===e:!1}var tV=function(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0},rV=function(r,e){for(var t=0;t<r.length;t++)if(e(r[t],t))return!0;return!1},nV=Object.prototype.hasOwnProperty;function JC(r,e){if(!e||!qr(r))return{};for(var t={},n=si(e)?e:function(s){return s[e]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),nV.call(t,i)?t[i].push(o):t[i]=[o]}return t}function eA(r,e){if(!e)return{0:r};if(!si(e)){var t=qr(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var i="_",a=0,o=t.length;a<o;a++)i+=n[t[a]]&&n[t[a]].toString();return i}}return JC(r,e)}const iV=function(r,e){if(!e)return[r];var t=eA(r,e),n=[];for(var i in t)n.push(t[i]);return n};function aV(r,e){return r["_wrap_"+e]}function oV(r,e){if(r["_wrap_"+e])return r["_wrap_"+e];var t=function(n){r[e](n)};return r["_wrap_"+e]=t,t}var tA={};function sV(r){var e=tA[r];if(!e){for(var t=r.toString(16),n=t.length;n<6;n++)t="0"+t;e="#"+t,tA[r]=e}return e}function uV(r){var e=0,t=0,n=0,i=0;return qr(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var fV=function(r,e,t){return r<e?e:r>t?t:r},lV=function(r,e){var t=e.toString(),n=t.indexOf(".");if(n===-1)return Math.round(r);var i=t.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))};function Oa(r){return typeof r=="number"}function cV(r){return Oa(r)&&r%1!==0}function hV(r){return Oa(r)&&r%2===0}function dV(r){return Oa(r)&&r%1===0}function vV(r){return Oa(r)&&r<0}var pV=1e-5;function gV(r,e,t){return t===void 0&&(t=pV),r===e||Math.abs(r-e)<t}function yV(r){return Oa(r)&&r%2!==0}var mV=function(r){return Oa(r)&&r>0};const bV=function(r,e){if(qr(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=si(e)?e(a):a[e];o>n&&(t=a,n=o)}return t}},xV=function(r,e){if(qr(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],o=si(e)?e(a):a[e];o<n&&(t=a,n=o)}return t}};var wV=function(r,e){return(r%e+e)%e},EV=180/Math.PI,_V=function(r){return EV*r};const SV=parseInt;var MV=Math.PI/180,CV=function(r){return MV*r};const rA=function(r,e){return r.hasOwnProperty(e)};var nA=Object.values?function(r){return Object.values(r)}:function(r){var e=[];return cu(r,function(t,n){si(r)&&n==="prototype"||e.push(t)}),e};const AV=function(r,e){return gd(nA(r),e)},ol=function(r){return yo(r)?"":r.toString()};var TV=function(r){return ol(r).toLowerCase()},IV=function(r){var e=ol(r);return e.charAt(0).toLowerCase()+e.substring(1)};function kV(r,e){return!r||!e?r:r.replace(/\\?\{([^{}]+)\}/g,function(t,n){return t.charAt(0)==="\\"?t.slice(1):e[n]===void 0?"":e[n]})}var LV=function(r){return ol(r).toUpperCase()},NV=function(r){var e=ol(r);return e.charAt(0).toUpperCase()+e.substring(1)},OV={}.toString,iA=function(r){return OV.call(r).replace(/^\[object /,"").replace(/]$/,"")},DV=function(r){return hu(r,"Arguments")},PV=function(r){return hu(r,"Boolean")};function RV(r){return r instanceof Date}var BV=function(r){return hu(r,"Error")};function FV(r){return Oa(r)&&isFinite(r)}function GV(r){return r===null}var zV=Object.prototype,aA=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||zV;return r===t},$V=function(r){return hu(r,"RegExp")},jV=function(r){return r===void 0};function UV(r){return r instanceof Element||r instanceof Document}function XV(r){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)};return e(r)}function YV(r){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(r)}function _y(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function vu(r,e,t,n){return e&&_y(r,e),t&&_y(r,t),n&&_y(r,n),r}var WV=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=r[0],n=1;n<r.length;n++){var i=r[n];si(i)&&(i=i.prototype),vu(t.prototype,i)}},Sy=function(r){if(typeof r!="object"||r===null)return r;var e;if(qr(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=Sy(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=Sy(r[i]):e[i]=r[i]}return e};function VV(r,e,t){var n;return function(){var i=this,a=arguments,o=function(){n=null,t||r.apply(i,a)},s=t&&!n;clearTimeout(n),n=setTimeout(o,e),s&&r.apply(i,a)}}function HV(r){var e,t,n,i=r||1;function a(s,u){++e>i&&(n=t,o(1),++e),t[s]=u}function o(s){e=0,t=Object.create(null),s||(n=Object.create(null))}return o(),{clear:o,has:function(s){return t[s]!==void 0||n[s]!==void 0},get:function(s){var u=t[s];if(u!==void 0)return u;if((u=n[s])!==void 0)return a(s,u),u},set:function(s,u){t[s]!==void 0?t[s]=u:a(s,u)}}}var My=new Map;function oA(r,e,t){t===void 0&&(t=128);var n=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e?e.apply(this,i):i[0];My.has(r)||My.set(r,HV(t));var s=My.get(r);if(s.has(o))return s.get(o);var u=r.apply(this,i);return s.set(o,u),u};return n}var qV=5;function ZV(r,e){if(Object.hasOwn)return Object.hasOwn(r,e);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),e)}function sA(r,e,t,n){t=t||0,n=n||qV;for(var i in e)if(ZV(e,i)){var a=e[i];a!==null&&du(a)?(du(r[i])||(r[i]={}),t<n?sA(r[i],a,t+1,n):r[i]=e[i]):qr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var KV=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n+=1)sA(r,e[n]);return r},QV=function(r,e,t,n){si(e)||(t=e,e=r,r=function(){});var i=Object.create?function(o,s){return Object.create(o,{constructor:{value:s}})}:function(o,s){function u(){}u.prototype=o;var f=new u;return f.constructor=s,f},a=i(e.prototype,r);return r.prototype=vu(a,r.prototype),r.superclass=i(e.prototype,e),vu(a,t),vu(r,n),r},JV=function(r,e){if(!Bn(r))return-1;var t=Array.prototype.indexOf;if(t)return t.call(r,e);for(var n=-1,i=0;i<r.length;i++)if(r[i]===e){n=i;break}return n},eH=Object.prototype.hasOwnProperty;function tH(r){if(yo(r))return!0;if(Bn(r))return!r.length;var e=iA(r);if(e==="Map"||e==="Set")return!r.size;if(aA(r))return!Object.keys(r).length;for(var t in r)if(eH.call(r,t))return!1;return!0}var bd=function(r,e){if(r===e)return!0;if(!r||!e||mo(r)||mo(e))return!1;if(Bn(r)||Bn(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=bd(r[n],e[n]),!!t);n++);return t}if(md(r)||md(e)){var i=Object.keys(r),a=Object.keys(e);if(i.length!==a.length)return!1;for(var t=!0,n=0;n<i.length&&(t=bd(r[i[n]],e[i[n]]),!!t);n++);return t}return!1};const rH=function(r,e,t){return si(t)?!!t(r,e):bd(r,e)};var nH=function(r,e){if(!Bn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];t.push(e(i,n))}return t},iH=function(r){return r};const aH=function(r,e){e===void 0&&(e=iH);var t={};return yd(r)&&!yo(r)&&Object.keys(r).forEach(function(n){t[n]=e(r[n],n)}),t},oH=function(r,e,t){for(var n=0,i=mo(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r},sH=function(r,e,t){var n=r,i=mo(e)?e.split("."):e;return i.forEach(function(a,o){o<i.length-1?(yd(n[a])||(n[a]=Oa(i[o+1])?[]:{}),n=n[a]):n[a]=t}),r};var uH=Object.prototype.hasOwnProperty;const fH=function(r,e){if(r===null||!du(r))return{};var t={};return cu(e,function(n){uH.call(r,n)&&(t[n]=r[n])}),t},lH=function(r,e){return KC(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})},cH=function(r,e,t){var n,i,a,o,s=0;t||(t={});var u=function(){s=t.leading===!1?0:Date.now(),n=null,o=r.apply(i,a),n||(i=a=null)},f=function(){var l=Date.now();!s&&t.leading===!1&&(s=l);var c=e-(l-s);return i=this,a=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},hH=function(r){return Bn(r)?Array.prototype.slice.call(r):[]};var xd={};const dH=function(r){return r=r||"g",xd[r]?xd[r]+=1:xd[r]=1,r+xd[r]},vH=function(){},pH=function(r){return r};function gH(r){return yo(r)?0:Bn(r)?r.length:Object.keys(r).length}var yH=function(){function r(){this.map={}}return r.prototype.has=function(e){return this.map[e]!==void 0},r.prototype.get=function(e,t){var n=this.map[e];return n===void 0?t:n},r.prototype.set=function(e,t){this.map[e]=t},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(e){delete this.map[e]},r.prototype.size=function(){return Object.keys(this.map).length},r}(),mH=/rgba?\(([\s.,0-9]+)\)/;function bH(){var r=document.getElementById("antv-web-colour-picker");return r||(r=document.createElement("i"),r.id="antv-web-colour-picker",r.title="Web Colour Picker",r.style.display="none",document.body.appendChild(r),r)}function xH(r){if(r[0]==="#"&&r.length===7)return r;var e=bH();e.style.color=r;var t=document.defaultView.getComputedStyle(e,"").getPropertyValue("color"),n=mH.exec(t),i=n[1].split(/\s*,\s*/).map(function(a){return Number(a)});return t=jC(i),t}var uA=oA(xH,function(r){return r},256);function Cy(r,e,t,n){return r[n]+(e[n]-r[n])*t}function wH(r,e){var t=isNaN(Number(e))||e<0?0:e>1?1:Number(e),n=r.length-1,i=Math.floor(n*t),a=n*t-i,o=r[i],s=i===n?o:r[i+1];return jC([Cy(o,s,a,0),Cy(o,s,a,1),Cy(o,s,a,2)])}function EH(r){var e=typeof r=="string"?r.split("-"):r,t=e.map(function(n){return $C(n.indexOf("#")===-1?uA(n):n)});return function(n){return wH(t,n)}}var _H=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,SH=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,MH=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function CH(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)}function AH(r){if(CH(r)){var e,t=void 0;if(r[0]==="l"){var n=_H.exec(r),i=+n[1]+90;t=n[2],e="linear-gradient(".concat(i,"deg, ")}else if(r[0]==="r"){e="radial-gradient(";var n=SH.exec(r);t=n[4]}var a=t.match(MH);return a.forEach(function(o,s){var u=o.split(":");e+="".concat(u[1]," ").concat(Number(u[0])*100,"%"),s!==a.length-1&&(e+=", ")}),e+=")",e}return r}function TH(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Cp(n,t),Wi(r,n,e)}function IH(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Ap(n,t),Wi(r,n,e)}function kH(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Tp(n,t),Wi(r,n,e)}function LH(r,e,t){return Wi(r,t,e)}function NH(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":TH(t,t,[a[1],a[2]]);break;case"s":kH(t,t,[a[1],a[2]]);break;case"r":IH(t,t,a[1]);break;case"m":LH(t,t,a[1]);break}}return t}function fA(r,e){return r[0]*e[1]-e[0]*r[1]}function OH(r,e,t){var n=Mw(r,e),i=fA(r,e)>=0;return t?i?Math.PI*2-n:n:i?n:Math.PI*2-n}function DH(r,e,t){return t?(r[0]=e[1],r[1]=-1*e[0]):(r[0]=-1*e[1],r[1]=e[0]),r}function PH(r,e){if(e==="off")return[].concat(r);var t=typeof e=="number"&&e>=1?Math.pow(10,e):1;return r.map(function(n){var i=n.slice(1).map(Number).map(function(a){return e?Math.round(a*t)/t:Math.round(a)});return[n[0]].concat(i)})}function RH(r,e){return e===void 0&&(e="off"),PH(r,e).map(function(t){return t[0]+t.slice(1).join(" ")}).join("")}var lA={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function BH(r,e,t){if(r[t].length>7){r[t].shift();for(var n=r[t],i=t;n.length;)e[t]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(t,1)}}var sl={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function cA(r){return Array.isArray(r)&&r.every(function(e){var t=e[0].toLowerCase();return sl[t]===e.length-1&&"achlmqstvz".includes(t)})}function hA(r){return cA(r)&&r.every(function(e){var t=e[0];return t===t.toUpperCase()})}function dA(r){return hA(r)&&r.every(function(e){var t=e[0];return"ACLMQZ".includes(t)})}function vA(r){for(var e=r.pathValue[r.segmentStart],t=e.toLowerCase(),n=r.data;n.length>=sl[t]&&(t==="m"&&n.length>2?(r.segments.push([e].concat(n.splice(0,2))),t="l",e=e==="m"?"l":"L"):r.segments.push([e].concat(n.splice(0,sl[t]))),!!sl[t]););}function FH(r){var e=r.index,t=r.pathValue,n=t.charCodeAt(e);if(n===48){r.param=0,r.index+=1;return}if(n===49){r.param=1,r.index+=1;return}r.err='[path-util]: invalid Arc flag "'.concat(t[e],'", expecting 0 or 1 at index ').concat(e)}function GH(r){return r>=48&&r<=57||r===43||r===45||r===46}function pu(r){return r>=48&&r<=57}function zH(r){var e=r.max,t=r.pathValue,n=r.index,i=n,a=!1,o=!1,s=!1,u=!1,f;if(i>=e){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(f=t.charCodeAt(i),(f===43||f===45)&&(i+=1,f=t.charCodeAt(i)),!pu(f)&&f!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(t[i],'" is not a number');return}if(f!==46){if(a=f===48,i+=1,f=t.charCodeAt(i),a&&i<e&&f&&pu(f)){r.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(t[n],'" illegal number');return}for(;i<e&&pu(t.charCodeAt(i));)i+=1,o=!0;f=t.charCodeAt(i)}if(f===46){for(u=!0,i+=1;pu(t.charCodeAt(i));)i+=1,s=!0;f=t.charCodeAt(i)}if(f===101||f===69){if(u&&!o&&!s){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(t[i],'" invalid float exponent');return}if(i+=1,f=t.charCodeAt(i),(f===43||f===45)&&(i+=1),i<e&&pu(t.charCodeAt(i)))for(;i<e&&pu(t.charCodeAt(i));)i+=1;else{r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(t[i],'" invalid integer exponent');return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function $H(r){var e=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];return r===10||r===13||r===8232||r===8233||r===32||r===9||r===11||r===12||r===160||r>=5760&&e.includes(r)}function wd(r){for(var e=r.pathValue,t=r.max;r.index<t&&$H(e.charCodeAt(r.index));)r.index+=1}function jH(r){switch(r|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}function UH(r){return(r|32)===97}function XH(r){var e=r.max,t=r.pathValue,n=r.index,i=t.charCodeAt(n),a=sl[t[n].toLowerCase()];if(r.segmentStart=n,!jH(i)){r.err='[path-util]: Invalid path value "'.concat(t[n],'" is not a path command');return}if(r.index+=1,wd(r),r.data=[],!a){vA(r);return}for(;;){for(var o=a;o>0;o-=1){if(UH(i)&&(o===3||o===4)?FH(r):zH(r),r.err.length)return;r.data.push(r.param),wd(r),r.index<e&&t.charCodeAt(r.index)===44&&(r.index+=1,wd(r))}if(r.index>=r.max||!GH(t.charCodeAt(r.index)))break}vA(r)}var YH=function(){function r(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r}();function Ed(r){if(cA(r))return[].concat(r);var e=new YH(r);for(wd(e);e.index<e.max&&!e.err.length;)XH(e);return e.err?e.err:e.segments}function pA(r){if(hA(r))return[].concat(r);var e=Ed(r),t=0,n=0,i=0,a=0;return e.map(function(o){var s=o.slice(1).map(Number),u=o[0],f=u.toUpperCase();if(u==="M")return t=s[0],n=s[1],i=t,a=n,["M",t,n];var l;if(u!==f)switch(f){case"A":l=[f,s[0],s[1],s[2],s[3],s[4],s[5]+t,s[6]+n];break;case"V":l=[f,s[0]+n];break;case"H":l=[f,s[0]+t];break;default:{var c=s.map(function(d,v){return d+(v%2?n:t)});l=[f].concat(c)}}else l=[f].concat(s);var h=l.length;switch(f){case"Z":t=i,n=a;break;case"H":t=l[1];break;case"V":n=l[1];break;default:t=l[h-2],n=l[h-1],f==="M"&&(i=t,a=n)}return l})}function WH(r,e){var t=r[0],n=e.x1,i=e.y1,a=e.x2,o=e.y2,s=r.slice(1).map(Number),u=r;if("TQ".includes(t)||(e.qx=null,e.qy=null),t==="H")u=["L",r[1],i];else if(t==="V")u=["L",n,r[1]];else if(t==="S"){var f=n*2-a,l=i*2-o;e.x1=f,e.y1=l,u=["C",f,l].concat(s)}else if(t==="T"){var c=n*2-e.qx,h=i*2-e.qy;e.qx=c,e.qy=h,u=["Q",c,h].concat(s)}else if(t==="Q"){var d=s[0],v=s[1];e.qx=d,e.qy=v}return u}function _d(r){if(dA(r))return[].concat(r);for(var e=pA(r),t=B({},lA),n=0;n<e.length;n+=1){e[n]=WH(e[n],t);var i=e[n],a=i.length;t.x1=+i[a-2],t.y1=+i[a-1],t.x2=+i[a-4]||t.x1,t.y2=+i[a-3]||t.y1}return e}function VH(r){return dA(r)&&r.every(function(e){var t=e[0];return"MC".includes(t)})}function Sd(r,e,t){var n=r*Math.cos(t)-e*Math.sin(t),i=r*Math.sin(t)+e*Math.cos(t);return{x:n,y:i}}function Ay(r,e,t,n,i,a,o,s,u,f){var l=r,c=e,h=t,d=n,v=s,p=u,g=Math.PI*120/180,y=Math.PI/180*(+i||0),m=[],b,x,w,E,_;if(f)x=f[0],w=f[1],E=f[2],_=f[3];else{b=Sd(l,c,-y),l=b.x,c=b.y,b=Sd(v,p,-y),v=b.x,p=b.y;var M=(l-v)/2,C=(c-p)/2,S=M*M/(h*h)+C*C/(d*d);S>1&&(S=Math.sqrt(S),h*=S,d*=S);var A=h*h,T=d*d,k=(a===o?-1:1)*Math.sqrt(Math.abs((A*T-A*C*C-T*M*M)/(A*C*C+T*M*M)));E=k*h*C/d+(l+v)/2,_=k*-d*M/h+(c+p)/2,x=Math.asin(((c-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),w=Math.asin(((p-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),x=l<E?Math.PI-x:x,w=v<E?Math.PI-w:w,x<0&&(x=Math.PI*2+x),w<0&&(w=Math.PI*2+w),o&&x>w&&(x-=Math.PI*2),!o&&w>x&&(w-=Math.PI*2)}var O=w-x;if(Math.abs(O)>g){var G=w,D=v,$=p;w=x+g*(o&&w>x?1:-1),v=E+h*Math.cos(w),p=_+d*Math.sin(w),m=Ay(v,p,h,d,i,0,o,D,$,[w,G,E,_])}O=w-x;var Y=Math.cos(x),N=Math.sin(x),P=Math.cos(w),W=Math.sin(w),J=Math.tan(O/4),te=4/3*h*J,H=4/3*d*J,pe=[l,c],Te=[l+te*N,c-H*Y],Ne=[v+te*W,p-H*P],Ze=[v,p];if(Te[0]=2*pe[0]-Te[0],Te[1]=2*pe[1]-Te[1],f)return Te.concat(Ne,Ze,m);m=Te.concat(Ne,Ze,m);for(var at=[],nt=0,St=m.length;nt<St;nt+=1)at[nt]=nt%2?Sd(m[nt-1],m[nt],y).y:Sd(m[nt],m[nt+1],y).x;return at}function HH(r,e,t,n,i,a){var o=.3333333333333333,s=2/3;return[o*r+s*t,o*e+s*n,o*i+s*t,o*a+s*n,i,a]}function bo(r,e,t){var n=r[0],i=r[1],a=e[0],o=e[1];return[n+(a-n)*t,i+(o-i)*t]}var gA=function(r,e,t,n){var i=.5,a=bo([r,e],[t,n],i);return Yn(Yn([],a,!0),[t,n,t,n],!1)};function qH(r,e){var t=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],o,s=e.x1,u=e.y1,f=e.x,l=e.y;switch("TQ".includes(t)||(e.qx=null,e.qy=null),t){case"M":return e.x=i,e.y=a,r;case"A":return o=[s,u].concat(n),["C"].concat(Ay(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9]));case"Q":return e.qx=i,e.qy=a,o=[s,u].concat(n),["C"].concat(HH(o[0],o[1],o[2],o[3],o[4],o[5]));case"L":return["C"].concat(gA(s,u,i,a));case"Z":return s===f&&u===l?["C",s,u,f,l,f,l]:["C"].concat(gA(s,u,f,l))}return r}function yA(r,e){if(e===void 0&&(e=!1),VH(r)){var t=[].concat(r);return e?[t,[]]:t}for(var n=_d(r),i=B({},lA),a=[],o="",s=n.length,u,f,l=[],c=0;c<s;c+=1){n[c]&&(o=n[c][0]),a[c]=o;var h=qH(n[c],i);n[c]=h,BH(n,a,c),s=n.length,o==="Z"&&l.push(c),u=n[c],f=u.length,i.x1=+u[f-2],i.y1=+u[f-1],i.x2=+u[f-4]||i.x1,i.y2=+u[f-3]||i.y1}return e?[n,l]:n}function ZH(r){return Ed(r)}function KH(r){return r.map(function(e){return Array.isArray(e)?[].concat(e):e})}function QH(r){var e=r.slice(1).map(function(t,n,i){return n?i[n-1].slice(-2).concat(t.slice(1)):r[0].slice(1).concat(t.slice(1))}).map(function(t){return t.map(function(n,i){return t[t.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map(function(t){return["C"].concat(t.slice(2))}))}function gu(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}function Ty(r,e,t,n,i){var a=gu([r,e],[t,n]),o={x:0,y:0};if(typeof i=="number")if(i<=0)o={x:r,y:e};else if(i>=a)o={x:t,y:n};else{var s=bo([r,e],[t,n],i/a),u=s[0],f=s[1];o={x:u,y:f}}return{length:a,point:o,min:{x:Math.min(r,t),y:Math.min(e,n)},max:{x:Math.max(r,t),y:Math.max(e,n)}}}function mA(r,e){var t=r.x,n=r.y,i=e.x,a=e.y,o=t*i+n*a,s=Math.sqrt((Math.pow(t,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),u=t*a-n*i<0?-1:1,f=u*Math.acos(o/s);return f}function JH(r,e,t,n,i,a,o,s,u,f){var l=Math.abs,c=Math.sin,h=Math.cos,d=Math.sqrt,v=Math.PI,p=l(t),g=l(n),y=(i%360+360)%360,m=y*(v/180);if(r===s&&e===u)return{x:r,y:e};if(p===0||g===0)return Ty(r,e,s,u,f).point;var b=(r-s)/2,x=(e-u)/2,w={x:h(m)*b+c(m)*x,y:-c(m)*b+h(m)*x},E=Math.pow(w.x,2)/Math.pow(p,2)+Math.pow(w.y,2)/Math.pow(g,2);E>1&&(p*=d(E),g*=d(E));var _=Math.pow(p,2)*Math.pow(g,2)-Math.pow(p,2)*Math.pow(w.y,2)-Math.pow(g,2)*Math.pow(w.x,2),M=Math.pow(p,2)*Math.pow(w.y,2)+Math.pow(g,2)*Math.pow(w.x,2),C=_/M;C=C<0?0:C;var S=(a!==o?1:-1)*d(C),A={x:S*(p*w.y/g),y:S*(-(g*w.x)/p)},T={x:h(m)*A.x-c(m)*A.y+(r+s)/2,y:c(m)*A.x+h(m)*A.y+(e+u)/2},k={x:(w.x-A.x)/p,y:(w.y-A.y)/g},O=mA({x:1,y:0},k),G={x:(-w.x-A.x)/p,y:(-w.y-A.y)/g},D=mA(k,G);!o&&D>0?D-=2*v:o&&D<0&&(D+=2*v),D%=2*v;var $=O+D*f,Y=p*h($),N=g*c($),P={x:h(m)*Y-c(m)*N+T.x,y:c(m)*Y+h(m)*N+T.y};return P}function eq(r,e,t,n,i,a,o,s,u,f,l){var c,h=l.bbox,d=h===void 0?!0:h,v=l.length,p=v===void 0?!0:v,g=l.sampleSize,y=g===void 0?30:g,m=typeof f=="number",b=r,x=e,w=0,E=[b,x,w],_=[b,x],M=0,C={x:0,y:0},S=[{x:b,y:x}];m&&f<=0&&(C={x:b,y:x});for(var A=0;A<=y;A+=1){if(M=A/y,c=JH(r,e,t,n,i,a,o,s,u,M),b=c.x,x=c.y,d&&S.push({x:b,y:x}),p&&(w+=gu(_,[b,x])),_=[b,x],m&&w>=f&&f>E[2]){var T=(w-f)/(w-E[2]);C={x:_[0]*(1-T)+E[0]*T,y:_[1]*(1-T)+E[1]*T}}E=[b,x,w]}return m&&f>=w&&(C={x:s,y:u}),{length:w,point:C,min:{x:Math.min.apply(null,S.map(function(k){return k.x})),y:Math.min.apply(null,S.map(function(k){return k.y}))},max:{x:Math.max.apply(null,S.map(function(k){return k.x})),y:Math.max.apply(null,S.map(function(k){return k.y}))}}}function tq(r,e,t,n,i,a,o,s,u){var f=1-u;return{x:Math.pow(f,3)*r+3*Math.pow(f,2)*u*t+3*f*Math.pow(u,2)*i+Math.pow(u,3)*o,y:Math.pow(f,3)*e+3*Math.pow(f,2)*u*n+3*f*Math.pow(u,2)*a+Math.pow(u,3)*s}}function bA(r,e,t,n,i,a,o,s,u,f){var l,c=f.bbox,h=c===void 0?!0:c,d=f.length,v=d===void 0?!0:d,p=f.sampleSize,g=p===void 0?10:p,y=typeof u=="number",m=r,b=e,x=0,w=[m,b,x],E=[m,b],_=0,M={x:0,y:0},C=[{x:m,y:b}];y&&u<=0&&(M={x:m,y:b});for(var S=0;S<=g;S+=1){if(_=S/g,l=tq(r,e,t,n,i,a,o,s,_),m=l.x,b=l.y,h&&C.push({x:m,y:b}),v&&(x+=gu(E,[m,b])),E=[m,b],y&&x>=u&&u>w[2]){var A=(x-u)/(x-w[2]);M={x:E[0]*(1-A)+w[0]*A,y:E[1]*(1-A)+w[1]*A}}w=[m,b,x]}return y&&u>=x&&(M={x:o,y:s}),{length:x,point:M,min:{x:Math.min.apply(null,C.map(function(T){return T.x})),y:Math.min.apply(null,C.map(function(T){return T.y}))},max:{x:Math.max.apply(null,C.map(function(T){return T.x})),y:Math.max.apply(null,C.map(function(T){return T.y}))}}}function rq(r,e,t,n,i,a,o){var s=1-o;return{x:Math.pow(s,2)*r+2*s*o*t+Math.pow(o,2)*i,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*a}}function nq(r,e,t,n,i,a,o,s){var u,f=s.bbox,l=f===void 0?!0:f,c=s.length,h=c===void 0?!0:c,d=s.sampleSize,v=d===void 0?10:d,p=typeof o=="number",g=r,y=e,m=0,b=[g,y,m],x=[g,y],w=0,E={x:0,y:0},_=[{x:g,y}];p&&o<=0&&(E={x:g,y});for(var M=0;M<=v;M+=1){if(w=M/v,u=rq(r,e,t,n,i,a,w),g=u.x,y=u.y,l&&_.push({x:g,y}),h&&(m+=gu(x,[g,y])),x=[g,y],p&&m>=o&&o>b[2]){var C=(m-o)/(m-b[2]);E={x:x[0]*(1-C)+b[0]*C,y:x[1]*(1-C)+b[1]*C}}b=[g,y,m]}return p&&o>=m&&(E={x:i,y:a}),{length:m,point:E,min:{x:Math.min.apply(null,_.map(function(S){return S.x})),y:Math.min.apply(null,_.map(function(S){return S.y}))},max:{x:Math.max.apply(null,_.map(function(S){return S.x})),y:Math.max.apply(null,_.map(function(S){return S.y}))}}}function Md(r,e,t){for(var n,i,a,o,s,u,f=_d(r),l=typeof e=="number",c,h=[],d,v=0,p=0,g=0,y=0,m,b=[],x=[],w=0,E={x:0,y:0},_=E,M=E,C=E,S=0,A=0,T=f.length;A<T;A+=1)m=f[A],d=m[0],c=d==="M",h=c?h:[v,p].concat(m.slice(1)),c?(g=m[1],y=m[2],E={x:g,y},_=E,w=0,l&&e<.001&&(C=E)):d==="L"?(n=Ty(h[0],h[1],h[2],h[3],(e||0)-S),w=n.length,E=n.min,_=n.max,M=n.point):d==="A"?(i=eq(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],(e||0)-S,t||{}),w=i.length,E=i.min,_=i.max,M=i.point):d==="C"?(a=bA(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],(e||0)-S,t||{}),w=a.length,E=a.min,_=a.max,M=a.point):d==="Q"?(o=nq(h[0],h[1],h[2],h[3],h[4],h[5],(e||0)-S,t||{}),w=o.length,E=o.min,_=o.max,M=o.point):d==="Z"&&(h=[v,p,g,y],s=Ty(h[0],h[1],h[2],h[3],(e||0)-S),w=s.length,E=s.min,_=s.max,M=s.point),l&&S<e&&S+w>=e&&(C=M),x.push(_),b.push(E),S+=w,u=d!=="Z"?m.slice(-2):[g,y],v=u[0],p=u[1];return l&&e>=S&&(C={x:v,y:p}),{length:S,point:C,min:{x:Math.min.apply(null,b.map(function(k){return k.x})),y:Math.min.apply(null,b.map(function(k){return k.y}))},max:{x:Math.max.apply(null,x.map(function(k){return k.x})),y:Math.max.apply(null,x.map(function(k){return k.y}))}}}function iq(r,e){if(!r)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var t=Md(r,void 0,B(B({},e),{length:!1})),n=t.min,i=n.x,a=n.y,o=t.max,s=o.x,u=o.y,f=s-i,l=u-a;return{width:f,height:l,x:i,y:a,x2:s,y2:u,cx:i+f/2,cy:a+l/2,cz:Math.max(f,l)+Math.min(f,l)/2}}function ul(r,e){return Md(r,void 0,B(B({},e),{bbox:!1,length:!0})).length}function aq(r,e){if(!r)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var t=Md(r,void 0,B(B({},e),{bbox:!0,length:!0})),n=t.length,i=t.min,a=i.x,o=i.y,s=t.max,u=s.x,f=s.y,l=u-a,c=f-o;return{length:n,width:l,height:c,x:a,y:o,x2:u,y2:f,cx:a+l/2,cy:o+c/2,cz:Math.max(l,c)+Math.min(l,c)/2}}function oq(r){var e=r.length,t=e-1;return r.map(function(n,i){return r.map(function(a,o){var s=i+o,u;return o===0||r[s]&&r[s][0]==="M"?(u=r[s],["M"].concat(u.slice(-2))):(s>=e&&(s-=t),r[s])})})}function sq(r,e){var t=r.length-1,n=[],i=0,a=0,o=oq(r);return o.forEach(function(s,u){r.slice(1).forEach(function(f,l){a+=gu(r[(u+l)%t].slice(-2),e[l%t].slice(-2))}),n[u]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),o[i]}function uq(r,e,t,n,i,a,o,s){return 3*((s-e)*(t+i)-(o-r)*(n+a)+n*(r-i)-t*(e-a)+s*(i+r/3)-o*(a+e/3))/20}function xA(r){var e=0,t=0,n=0;return yA(r).map(function(i){var a;switch(i[0]){case"M":return e=i[1],t=i[2],0;default:var o=i.slice(1),s=o[0],u=o[1],f=o[2],l=o[3],c=o[4],h=o[5];return n=uq(e,t,s,u,f,l,c,h),a=i.slice(-2),e=a[0],t=a[1],n}}).reduce(function(i,a){return i+a},0)}function fq(r){return xA(r)>=0}function Cd(r,e,t){return Md(r,e,B(B({},t),{bbox:!1,length:!0})).point}function lq(r,e){var t=Ed(r);if(typeof t=="string")throw TypeError(t);var n=t.slice(),i=ul(n),a=n.length-1,o=0,s=0,u=t[0],f=u.slice(-2),l=f[0],c=f[1],h={x:l,y:c};if(a<=0||!e||!Number.isFinite(e))return{segment:u,index:0,length:s,point:h,lengthAtSegment:o};if(e>=i)return n=t.slice(0,-1),o=ul(n),s=i-o,{segment:t[a],index:a,length:s,lengthAtSegment:o};for(var d=[];a>0;)u=n[a],n=n.slice(0,-1),o=ul(n),s=i-o,i=o,d.push({segment:u,index:a,length:s,lengthAtSegment:o}),a-=1;return d.find(function(v){var p=v.lengthAtSegment;return p<=e})}function cq(r,e){for(var t=Ed(r),n=_d(t),i=ul(t),a=function(w){var E=w.x-e.x,_=w.y-e.y;return E*E+_*_},o=8,s,u=0,f,l=0,c=1/0,h=0;h<=i;h+=o)s=Cd(n,h),u=a(s),u<c&&(f=s,l=h,c=u);o/=2;for(var d,v,p=0,g=0,y=0,m=0;o>.5;)p=l-o,d=Cd(n,p),y=a(d),g=l+o,v=Cd(n,g),m=a(v),p>=0&&y<c?(f=d,l=p,c=y):g<=i&&m<c?(f=v,l=g,c=m):o/=2;var b=lq(t,l),x=Math.sqrt(c);return{closest:f,distance:x,segment:b}}function hq(r,e){var t=cq(r,e).distance;return Math.abs(t)<.001}function dq(r,e){e===void 0&&(e=.5);var t=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),o=bo(t,n,e),s=bo(n,i,e),u=bo(i,a,e),f=bo(o,s,e),l=bo(s,u,e),c=bo(f,l,e);return[["C"].concat(o,f,c),["C"].concat(l,u,a)]}function wA(r){return r.map(function(e,t,n){var i=t&&n[t-1].slice(-2).concat(e.slice(1)),a=t?bA(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,o;return t?o=a?dq(i):[e,e]:o=[e],{s:e,ss:o,l:a}})}function EA(r,e,t){var n=wA(r),i=wA(e),a=n.length,o=i.length,s=n.filter(function(g){return g.l}).length,u=i.filter(function(g){return g.l}).length,f=n.filter(function(g){return g.l}).reduce(function(g,y){var m=y.l;return g+m},0)/s||0,l=i.filter(function(g){return g.l}).reduce(function(g,y){var m=y.l;return g+m},0)/u||0,c=t||Math.max(a,o),h=[f,l],d=[c-a,c-o],v=0,p=[n,i].map(function(g,y){return g.l===c?g.map(function(m){return m.s}):g.map(function(m,b){return v=b&&d[y]&&m.l>=h[y],d[y]-=v?1:0,v?m.ss:[m.s]}).flat()});return p[0].length===p[1].length?p:EA(p[0],p[1],c)}var vq=1e-6;function Iy(r){return Math.abs(r)<vq?0:r<0?-1:1}function pq(r,e,t){return(t[0]-r[0])*(e[1]-r[1])===(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}function ky(r,e,t){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var o=r[a],s=r[(a+1)%i];if(pq(o,s,[e,t]))return!0;Iy(o[1]-t)>0!=Iy(s[1]-t)>0&&Iy(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}var _A=function(r,e,t){return r>=e&&r<=t};function gq(r,e,t,n){var i=.001,a={x:t.x-r.x,y:t.y-r.y},o={x:e.x-r.x,y:e.y-r.y},s={x:n.x-t.x,y:n.y-t.y},u=o.x*s.y-o.y*s.x,f=u*u,l=o.x*o.x+o.y*o.y,c=s.x*s.x+s.y*s.y,h=null;if(f>i*l*c){var d=(a.x*s.y-a.y*s.x)/u,v=(a.x*o.y-a.y*o.x)/u;_A(d,0,1)&&_A(v,0,1)&&(h={x:r.x+d*o.x,y:r.y+d*o.y})}return h}function SA(r){for(var e=[],t=r.length,n=0;n<t-1;n++){var i=r[n],a=r[n+1];e.push({from:{x:i[0],y:i[1]},to:{x:a[0],y:a[1]}})}if(e.length>1){var o=r[0],s=r[t-1];e.push({from:{x:s[0],y:s[1]},to:{x:o[0],y:o[1]}})}return e}function yq(r,e){var t=!1;return r.forEach(function(n){if(gq(n.from,n.to,e.from,e.to))return t=!0,!1}),t}function MA(r){var e=r.map(function(n){return n[0]}),t=r.map(function(n){return n[1]});return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,t),maxY:Math.max.apply(null,t)}}function mq(r,e){return!(e.minX>r.maxX||e.maxX<r.minX||e.minY>r.maxY||e.maxY<r.minY)}function bq(r,e){if(r.length<2||e.length<2)return!1;var t=MA(r),n=MA(e);if(!mq(t,n))return!1;var i=!1;if(e.forEach(function(u){if(ky(r,u[0],u[1]))return i=!0,!1}),i||(r.forEach(function(u){if(ky(e,u[0],u[1]))return i=!0,!1}),i))return!0;var a=SA(r),o=SA(e),s=!1;return o.forEach(function(u){if(yq(a,u))return s=!0,!1}),s}function xq(r){var e=document.createElement("div");e.innerHTML=r;var t=e.childNodes[0];return t&&e.contains(t)&&e.removeChild(t),t}function wq(r,e){if(r)return Object.keys(e).forEach(function(t){r.style[t]=e[t]}),r}const CA=ea(Object.freeze(Object.defineProperty({__proto__:null,Cache:yH,angleTo:OH,arcToCubic:Ay,assign:vu,augment:WV,clamp:fV,clearAnimationFrame:YV,clone:Sy,clonePath:KH,contains:gd,createDOM:xq,debounce:VV,deepMix:KV,difference:RW,direction:fA,distanceSquareRoot:gu,each:cu,endsWith:eV,equalizeSegments:EA,every:tV,extend:QV,filter:UC,find:FW,findIndex:GW,firstValue:zW,fixedBase:lV,flatten:$W,flattenDeep:WC,forIn:cu,get:oH,getDrawDirection:fq,getPathArea:xA,getPathBBox:iq,getPathBBoxTotalLength:aq,getPointAtLength:Cd,getRange:jW,getRotatedCurve:sq,getTotalLength:ul,getType:iA,getWrapBehavior:aV,gradient:EH,group:iV,groupBy:JC,groupToMap:eA,has:rA,hasKey:rA,hasValue:AV,head:KW,identity:pH,includes:gd,indexOf:JV,isArguments:DV,isArray:qr,isArrayLike:Bn,isBoolean:PV,isDate:RV,isDecimal:cV,isElement:UV,isEmpty:tH,isEqual:bd,isEqualWith:rH,isError:BV,isEven:hV,isFinite:FV,isFunction:si,isInteger:dV,isMatch:YC,isNegative:vV,isNil:yo,isNull:GV,isNumber:Oa,isNumberEqual:gV,isObject:yd,isObjectLike:md,isOdd:yV,isPlainObject:du,isPointInPolygon:ky,isPointInStroke:hq,isPolygonsIntersect:bq,isPositive:mV,isPrototype:aA,isRegExp:$V,isString:mo,isType:hu,isUndefined:jV,keys:XC,last:QW,lowerCase:TV,lowerFirst:IV,map:nH,mapValues:aH,max:VC,maxBy:bV,memoize:oA,min:HC,minBy:xV,mix:vu,mod:wV,modifyCSS:wq,noop:vH,normalizePath:_d,number2color:sV,omit:lH,parseRadius:uV,path2Absolute:pA,path2Array:ZH,path2Curve:yA,path2String:RH,pick:fH,pull:YW,pullAt:ZC,reduce:KC,remove:VW,requestAnimationFrame:XV,reverseCurve:QH,rgb2arr:$C,set:sH,size:gH,some:rV,sortBy:HW,startsWith:JW,substitute:kV,throttle:cH,toArray:hH,toCSSGradient:AH,toDegree:_V,toInteger:SV,toRGB:uA,toRadian:CV,toString:ol,transform:NH,union:qW,uniq:QC,uniqueId:dH,upperCase:LV,upperFirst:NV,values:nA,valuesOfKey:ZW,vertical:DH,wrapBehavior:oV},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(wy,"__esModule",{value:!0});var Eq=CA,_q=function(r){for(var e={},t=r.nodes().filter(function(c){var h;return!(!((h=r.children(c))===null||h===void 0)&&h.length)}),n=t.map(function(c){return r.node(c).rank}),i=(0,Eq.max)(n),a=[],o=0;o<i+1;o++)a.push([]);var s=function(c){var h;if(!e.hasOwnProperty(c)){e[c]=!0;var d=r.node(c);isNaN(d.rank)||a[d.rank].push(c),(h=r.successors(c))===null||h===void 0||h.forEach(function(v){return s(v)})}},u=t.sort(function(c,h){return r.node(c).rank-r.node(h).rank}),f=u.filter(function(c){return r.node(c).fixorder!==void 0}),l=f.sort(function(c,h){return r.node(c).fixorder-r.node(h).fixorder});return l==null||l.forEach(function(c){isNaN(r.node(c).rank)||a[r.node(c).rank].push(c),e[c]=!0}),u==null||u.forEach(s),a};wy.default=_q;var Ly={};Object.defineProperty(Ly,"__esModule",{value:!0});var Sq=Zn,Mq=function(r,e,t){for(var n=(0,Sq.zipObject)(t,t.map(function(l,c){return c})),i=e.map(function(l){var c,h=(c=r.outEdges(l))===null||c===void 0?void 0:c.map(function(d){return{pos:n[d.w]||0,weight:r.edge(d).weight}});return h==null?void 0:h.sort(function(d,v){return d.pos-v.pos})}),a=i.flat().filter(function(l){return l!==void 0}),o=1;o<t.length;)o<<=1;var s=2*o-1;o-=1;var u=Array(s).fill(0,0,s),f=0;return a==null||a.forEach(function(l){if(l){var c=l.pos+o;u[c]+=l.weight;for(var h=0;c>0;)c%2&&(h+=u[c+1]),c=c-1>>1,u[c]+=l.weight;f+=l.weight*h}}),f},Cq=function(r,e){for(var t=0,n=1;n<(e==null?void 0:e.length);n+=1)t+=Mq(r,e[n-1],e[n]);return t};Ly.default=Cq;var Ny={};Object.defineProperty(Ny,"__esModule",{value:!0});var Aq=Na,Tq=function(r,e,t){var n=Iq(r),i=new Aq.Graph({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return r.nodes().forEach(function(a){var o,s=r.node(a),u=r.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,u||n),(o=r[t](a))===null||o===void 0||o.forEach(function(f){var l=f.v===a?f.w:f.v,c=i.edgeFromArgs(l,a),h=c!==void 0?c.weight:0;i.setEdge(l,a,{weight:r.edge(f).weight+h})}),s.hasOwnProperty("minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i},Iq=function(r){for(var e;r.hasNode(e="_root".concat(Math.random())););return e};Ny.default=Tq;var Oy={};Object.defineProperty(Oy,"__esModule",{value:!0});var kq=function(r,e,t){var n={},i;t==null||t.forEach(function(a){for(var o=r.parent(a),s,u;o;){if(s=r.parent(o),s?(u=n[s],n[s]=o):(u=i,i=o),u&&u!==o){e.setEdge(u,o);return}o=s}})};Oy.default=kq;var Dy={},Py={};Object.defineProperty(Py,"__esModule",{value:!0});var Lq=function(r,e){return e.map(function(t){var n=r.inEdges(t);if(!(n!=null&&n.length))return{v:t};{var i={sum:0,weight:0};return n==null||n.forEach(function(a){var o=r.edge(a),s=r.node(a.v);i.sum+=o.weight*s.order,i.weight+=o.weight}),{v:t,barycenter:i.sum/i.weight,weight:i.weight}}})};Py.default=Lq;var Ry={};Object.defineProperty(Ry,"__esModule",{value:!0});var Nq=function(r,e){var t,n,i,a={};r==null||r.forEach(function(s,u){a[s.v]={i:u,indegree:0,in:[],out:[],vs:[s.v]};var f=a[s.v];s.barycenter!==void 0&&(f.barycenter=s.barycenter,f.weight=s.weight)}),(t=e.edges())===null||t===void 0||t.forEach(function(s){var u=a[s.v],f=a[s.w];u!==void 0&&f!==void 0&&(f.indegree++,u.out.push(a[s.w]))});var o=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,function(s){return!s.indegree});return Oq(o)},Oq=function(r){for(var e,t,n=[],i=function(f){return function(l){l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&Dq(f,l)}},a=function(f){return function(l){l.in.push(f),--l.indegree===0&&r.push(l)}},o=function(){var f=r.pop();n.push(f),(e=f.in.reverse())===null||e===void 0||e.forEach(function(l){return i(f)(l)}),(t=f.out)===null||t===void 0||t.forEach(function(l){return a(f)(l)})};r!=null&&r.length;)o();var s=n.filter(function(f){return!f.merged}),u=["vs","i","barycenter","weight"];return s.map(function(f){var l={};return u==null||u.forEach(function(c){f[c]!==void 0&&(l[c]=f[c])}),l})},Dq=function(r,e){var t,n=0,i=0;r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),r.vs=(t=e.vs)===null||t===void 0?void 0:t.concat(r.vs),r.barycenter=n/i,r.weight=i,r.i=Math.min(e.i,r.i),e.merged=!0};Ry.default=Nq;var By={};Object.defineProperty(By,"__esModule",{value:!0});var Pq=Zn,Rq=function(r,e,t,n){var i=(0,Pq.partition)(r,function(h){var d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),a=i.lhs,o=i.rhs.sort(function(h,d){return-h.i- -d.i}),s=[],u=0,f=0,l=0;a==null||a.sort(Bq(!!e,!!t)),l=AA(s,o,l),a==null||a.forEach(function(h){var d;l+=(d=h.vs)===null||d===void 0?void 0:d.length,s.push(h.vs),u+=h.barycenter*h.weight,f+=h.weight,l=AA(s,o,l)});var c={vs:s.flat()};return f&&(c.barycenter=u/f,c.weight=f),c},AA=function(r,e,t){for(var n=t,i;e.length&&(i=e[e.length-1]).i<=n;)e.pop(),r==null||r.push(i.vs),n++;return n},Bq=function(r,e){return function(t,n){if(t.fixorder!==void 0&&n.fixorder!==void 0)return t.fixorder-n.fixorder;if(t.barycenter<n.barycenter)return-1;if(t.barycenter>n.barycenter)return 1;if(e&&t.order!==void 0&&n.order!==void 0){if(t.order<n.order)return-1;if(t.order>n.order)return 1}return r?n.i-t.i:t.i-n.i}};By.default=Rq;var Fy=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Dy,"__esModule",{value:!0});var Fq=Fy(Py),Gq=Fy(Ry),zq=Fy(By),TA=function(r,e,t,n,i,a){var o,s,u,f,l=r.children(e),c=r.node(e),h=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,v={};h&&(l=l==null?void 0:l.filter(function(x){return x!==h&&x!==d}));var p=(0,Fq.default)(r,l||[]);p==null||p.forEach(function(x){var w;if(!((w=r.children(x.v))===null||w===void 0)&&w.length){var E=TA(r,x.v,t,n,a);v[x.v]=E,E.hasOwnProperty("barycenter")&&jq(x,E)}});var g=(0,Gq.default)(p,t);$q(g,v),(o=g.filter(function(x){return x.vs.length>0}))===null||o===void 0||o.forEach(function(x){var w=r.node(x.vs[0]);w&&(x.fixorder=w.fixorder,x.order=w.order)});var y=(0,zq.default)(g,n,i,a);if(h&&(y.vs=[h,y.vs,d].flat(),!((s=r.predecessors(h))===null||s===void 0)&&s.length)){var m=r.node(((u=r.predecessors(h))===null||u===void 0?void 0:u[0])||""),b=r.node(((f=r.predecessors(d))===null||f===void 0?void 0:f[0])||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y},$q=function(r,e){r==null||r.forEach(function(t){var n,i=(n=t.vs)===null||n===void 0?void 0:n.map(function(a){return e[a]?e[a].vs:a});t.vs=i.flat()})},jq=function(r,e){r.barycenter!==void 0?(r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight):(r.barycenter=e.barycenter,r.weight=e.weight)};Dy.default=TA;var fl=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xy,"__esModule",{value:!0});var IA=fl(wy),kA=fl(Ly),Uq=fl(Ny),Xq=fl(Oy),Yq=fl(Dy),LA=Ir(),Wq=Na,Gy=Zn,Vq=function(r,e){for(var t=(0,Gy.maxRank)(r),n=[],i=[],a=1;a<t+1;a++)n.push(a);for(var a=t-1;a>-1;a--)i.push(a);var o=NA(r,n,"inEdges"),s=NA(r,i,"outEdges"),u=(0,IA.default)(r);zy(r,u);for(var f=Number.POSITIVE_INFINITY,l,a=0,c=0;c<4;++a,++c){OA(a%2?o:s,a%4>=2,!1,e),u=(0,Gy.buildLayerMatrix)(r);var h=(0,kA.default)(r,u);h<f&&(c=0,l=(0,LA.clone)(u),f=h)}u=(0,IA.default)(r),zy(r,u);for(var a=0,c=0;c<4;++a,++c){OA(a%2?o:s,a%4>=2,!0,e),u=(0,Gy.buildLayerMatrix)(r);var h=(0,kA.default)(r,u);h<f&&(c=0,l=(0,LA.clone)(u),f=h)}zy(r,l)},NA=function(r,e,t){return e.map(function(n){return(0,Uq.default)(r,n,t)})},OA=function(r,e,t,n){var i=new Wq.Graph;r==null||r.forEach(function(a){for(var o,s=a.graph().root,u=(0,Yq.default)(a,s,i,e,t,n),f=0;f<((o=u.vs)===null||o===void 0?void 0:o.length);f++){var l=a.node(u.vs[f]);l&&(l.order=f)}(0,Xq.default)(a,i,u.vs)})},zy=function(r,e){e==null||e.forEach(function(t){t==null||t.forEach(function(n,i){r.node(n).order=i})})};xy.default=Vq;var $y={},DA={};(function(r){var e=xe&&xe.__extends||function(){var x=function(w,E){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,M){_.__proto__=M}||function(_,M){for(var C in M)Object.prototype.hasOwnProperty.call(M,C)&&(_[C]=M[C])},x(w,E)};return function(w,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");x(w,E);function _(){this.constructor=w}w.prototype=E===null?Object.create(E):(_.prototype=E.prototype,new _)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.width=r.sep=r.positionX=r.balance=r.alignCoordinates=r.findSmallestWidthAlignment=r.buildBlockGraph=r.horizontalCompaction=r.verticalAlignment=r.hasConflict=r.addConflict=r.findOtherInnerSegmentNode=r.findType2Conflicts=r.findType1Conflicts=void 0;var t=pd,n=CA,i=Zn,a=function(x){e(w,x);function w(){return x!==null&&x.apply(this,arguments)||this}return w}(t.Graph),o=function(x,w){var E={},_=function(M,C){var S=0,A=0,T=M.length,k=C==null?void 0:C[(C==null?void 0:C.length)-1];return C==null||C.forEach(function(O,G){var D,$=(0,r.findOtherInnerSegmentNode)(x,O),Y=$?x.node($).order:T;($||O===k)&&((D=C.slice(A,G+1))===null||D===void 0||D.forEach(function(N){var P;(P=x.predecessors(N))===null||P===void 0||P.forEach(function(W){var J,te=x.node(W),H=te.order;(H<S||Y<H)&&!(te.dummy&&(!((J=x.node(N))===null||J===void 0)&&J.dummy))&&(0,r.addConflict)(E,W,N)})}),A=G+1,S=Y)}),C};return w!=null&&w.length&&w.reduce(_),E};r.findType1Conflicts=o;var s=function(x,w){var E={};function _(A,T,k,O,G){for(var D,$,Y,N=T;N<k;N++)Y=A[N],!((D=x.node(Y))===null||D===void 0)&&D.dummy&&(($=x.predecessors(Y))===null||$===void 0||$.forEach(function(P){var W=x.node(P);W.dummy&&(W.order<O||W.order>G)&&(0,r.addConflict)(E,P,Y)}))}function M(A){return JSON.stringify(A.slice(1))}function C(A,T){var k=M(A);T.get(k)||(_.apply(void 0,A),T.set(k,!0))}var S=function(A,T){var k=-1,O,G=0,D=new Map;return T==null||T.forEach(function($,Y){var N;if(((N=x.node($))===null||N===void 0?void 0:N.dummy)==="border"){var P=x.predecessors($)||[];P.length&&(O=x.node(P[0]).order,C([T,G,Y,k,O],D),G=Y,k=O)}C([T,G,T.length,O,A.length],D)}),T};return w!=null&&w.length&&w.reduce(S),E};r.findType2Conflicts=s;var u=function(x,w){var E,_;if(!((E=x.node(w))===null||E===void 0)&&E.dummy)return(_=x.predecessors(w))===null||_===void 0?void 0:_.find(function(M){return x.node(M).dummy})};r.findOtherInnerSegmentNode=u;var f=function(x,w,E){var _=w,M=E;if(_>M){var C=_;_=M,M=C}var S=x[_];S||(x[_]=S={}),S[M]=!0};r.addConflict=f;var l=function(x,w,E){var _=w,M=E;if(_>M){var C=w;_=M,M=C}return!!x[_]};r.hasConflict=l;var c=function(x,w,E,_){var M={},C={},S={};return w==null||w.forEach(function(A){A==null||A.forEach(function(T,k){M[T]=T,C[T]=T,S[T]=k})}),w==null||w.forEach(function(A){var T=-1;A==null||A.forEach(function(k){var O=_(k);if(O.length){O=O.sort(function(N,P){return S[N]-S[P]});for(var G=(O.length-1)/2,D=Math.floor(G),$=Math.ceil(G);D<=$;++D){var Y=O[D];C[k]===k&&T<S[Y]&&!(0,r.hasConflict)(E,k,Y)&&(C[Y]=k,C[k]=M[k]=M[Y],T=S[Y])}}})}),{root:M,align:C}};r.verticalAlignment=c;var h=function(x,w,E,_,M){var C,S={},A=(0,r.buildBlockGraph)(x,w,E,M),T=M?"borderLeft":"borderRight",k=function(D,$){for(var Y=A.nodes(),N=Y.pop(),P={};N;)P[N]?D(N):(P[N]=!0,Y.push(N),Y=Y.concat($(N))),N=Y.pop()},O=function(D){S[D]=(A.inEdges(D)||[]).reduce(function($,Y){return Math.max($,(S[Y.v]||0)+A.edge(Y))},0)},G=function(D){var $=(A.outEdges(D)||[]).reduce(function(N,P){return Math.min(N,(S[P.w]||0)-A.edge(P))},Number.POSITIVE_INFINITY),Y=x.node(D);$!==Number.POSITIVE_INFINITY&&Y.borderType!==T&&(S[D]=Math.max(S[D],$))};return k(O,A.predecessors.bind(A)),k(G,A.successors.bind(A)),(C=Object.values(_))===null||C===void 0||C.forEach(function(D){S[D]=S[E[D]]}),S};r.horizontalCompaction=h;var d=function(x,w,E,_){var M=new a,C=x.graph(),S=(0,r.sep)(C.nodesep,C.edgesep,_);return w==null||w.forEach(function(A){var T;A==null||A.forEach(function(k){var O=E[k];if(M.setNode(O),T){var G=E[T],D=M.edgeFromArgs(G,O);M.setEdge(G,O,Math.max(S(x,k,T),D||0))}T=k})}),M};r.buildBlockGraph=d;var v=function(x,w){return(0,i.minBy)(Object.values(w),function(E){var _,M=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return(_=Object.keys(E))===null||_===void 0||_.forEach(function(S){var A=E[S],T=(0,r.width)(x,S)/2;M=Math.max(A+T,M),C=Math.min(A-T,C)}),M-C})};r.findSmallestWidthAlignment=v;function p(x,w){var E=Object.values(w),_=(0,n.min)(E),M=(0,n.max)(E);["u","d"].forEach(function(C){["l","r"].forEach(function(S){var A=C+S,T=x[A],k;if(T!==w){var O=Object.values(T);k=S==="l"?_-(0,n.min)(O):M-(0,n.max)(O),k&&(x[A]={},Object.keys(T).forEach(function(G){x[A][G]=T[G]+k}))}})})}r.alignCoordinates=p;var g=function(x,w){var E={};return Object.keys(x.ul).forEach(function(_){if(w)E[_]=x[w.toLowerCase()][_];else{var M=Object.values(x).map(function(C){return C[_]});E[_]=(M[0]+M[1])/2}}),E};r.balance=g;var y=function(x){var w=(0,i.buildLayerMatrix)(x),E=Object.assign((0,r.findType1Conflicts)(x,w),(0,r.findType2Conflicts)(x,w)),_={},M;["u","d"].forEach(function(S){M=S==="u"?w:Object.values(w).reverse(),["l","r"].forEach(function(A){A==="r"&&(M=M.map(function(G){return Object.values(G).reverse()}));var T=(S==="u"?x.predecessors:x.successors).bind(x),k=(0,r.verticalAlignment)(x,M,E,T),O=(0,r.horizontalCompaction)(x,M,k.root,k.align,A==="r");A==="r"&&Object.keys(O).forEach(function(G){O[G]=-O[G]}),_[S+A]=O})});var C=(0,r.findSmallestWidthAlignment)(x,_);return p(_,C),(0,r.balance)(_,x.graph().align)};r.positionX=y;var m=function(x,w,E){return function(_,M,C){var S=_.node(M),A=_.node(C),T=0,k;if(T+=S.width/2,S.hasOwnProperty("labelpos"))switch((S.labelpos||"").toLowerCase()){case"l":k=-S.width/2;break;case"r":k=S.width/2;break}if(k&&(T+=E?k:-k),k=0,T+=(S.dummy?w:x)/2,T+=(A.dummy?w:x)/2,T+=A.width/2,A.labelpos)switch((A.labelpos||"").toLowerCase()){case"l":k=A.width/2;break;case"r":k=-A.width/2;break}return k&&(T+=E?k:-k),k=0,T}};r.sep=m;var b=function(x,w){return x.node(w).width||0};r.width=b})(DA);var PA=xe&&xe.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))};Object.defineProperty($y,"__esModule",{value:!0});var jy=Zn,as=DA,Hq=function(r){var e=(0,jy.buildLayerMatrix)(r),t=r.graph().ranksep,n=0;e==null||e.forEach(function(i){var a=i.map(function(s){return r.node(s).height}),o=Math.max.apply(Math,PA(PA([],a,!1),[0],!1));i==null||i.forEach(function(s){r.node(s).y=n+o/2}),n+=o+t})},qq=function(r){var e=(0,jy.buildLayerMatrix)(r),t=Object.assign((0,as.findType1Conflicts)(r,e),(0,as.findType2Conflicts)(r,e)),n={},i=[];["u","d"].forEach(function(o){i=o==="u"?e:Object.values(e).reverse(),["l","r"].forEach(function(s){s==="r"&&(i=i.map(function(c){return Object.values(c).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),f=(0,as.verticalAlignment)(r,i,t,u),l=(0,as.horizontalCompaction)(r,i,f.root,f.align,s==="r");s==="r"&&Object.keys(l).forEach(function(c){return l[c]=-l[c]}),n[o+s]=l})});var a=(0,as.findSmallestWidthAlignment)(r,n);return a&&(0,as.alignCoordinates)(n,a),(0,as.balance)(n,r.graph().align)},Zq=function(r){var e,t=(0,jy.asNonCompoundGraph)(r);Hq(t);var n=qq(t);(e=Object.keys(n))===null||e===void 0||e.forEach(function(i){t.node(i).x=n[i]})};$y.default=Zq;var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0});var Kq=function(r,e){for(var t=r.nodes().filter(function(s){var u;return!(!((u=r.children(s))===null||u===void 0)&&u.length)}),n=t.map(function(s){return r.node(s).rank}),i=Math.max.apply(Math,n),a=[],o=0;o<i+1;o++)a[o]=[];e==null||e.forEach(function(s){var u=r.node(s);!u||u!=null&&u.dummy||isNaN(u.rank)||(u.fixorder=a[u.rank].length,a[u.rank].push(s))})};Uy.default=Kq;var Ad=xe&&xe.__assign||function(){return Ad=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ad.apply(this,arguments)},oa=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(K0,"__esModule",{value:!0});var RA=oa(Q0),BA=oa(cy),Qq=oa(hy),sa=Zn,Jq=oa(dy),FA=oa(vy),eZ=oa(gy),GA=oa(yy),tZ=oa(xy),rZ=oa($y),nZ=oa(Uy),iZ=Na,aZ=function(r,e){var t=e&&e.debugTiming?sa.time:sa.notime;t("layout",function(){e&&!e.keepNodeOrder&&e.prevGraph&&t("  inheritOrder",function(){sZ(r,e.prevGraph)});var n=t("  buildLayoutGraph",function(){return pZ(r)});e&&e.edgeLabelSpace===!1||t("  makeSpaceForEdgeLabels",function(){gZ(n)});try{t("  runLayout",function(){oZ(n,t,e)})}catch(i){if(i.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:
`,i);return}throw i}t("  updateInputGraph",function(){uZ(r,n)})})},oZ=function(r,e,t){e("    removeSelfEdges",function(){MZ(r)}),e("    acyclic",function(){RA.default.run(r)}),e("    nestingGraph.run",function(){FA.default.run(r)}),e("    rank",function(){(0,Qq.default)((0,sa.asNonCompoundGraph)(r))}),e("    injectEdgeLabelProxies",function(){yZ(r)}),e("    removeEmptyRanks",function(){(0,sa.removeEmptyRanks)(r)}),e("    nestingGraph.cleanup",function(){FA.default.cleanup(r)}),e("    normalizeRanks",function(){(0,sa.normalizeRanks)(r)}),e("    assignRankMinMax",function(){mZ(r)}),e("    removeEdgeLabelProxies",function(){bZ(r)}),e("    normalize.run",function(){BA.default.run(r)}),e("    parentDummyChains",function(){(0,Jq.default)(r)}),e("    addBorderSegments",function(){(0,eZ.default)(r)}),t&&t.keepNodeOrder&&e("    initDataOrder",function(){(0,nZ.default)(r,t.nodeOrder)}),e("    order",function(){(0,tZ.default)(r,t==null?void 0:t.keepNodeOrder)}),e("    insertSelfEdges",function(){CZ(r)}),e("    adjustCoordinateSystem",function(){GA.default.adjust(r)}),e("    position",function(){(0,rZ.default)(r)}),e("    positionSelfEdges",function(){AZ(r)}),e("    removeBorderNodes",function(){SZ(r)}),e("    normalize.undo",function(){BA.default.undo(r)}),e("    fixupEdgeLabelCoords",function(){EZ(r)}),e("    undoCoordinateSystem",function(){GA.default.undo(r)}),e("    translateGraph",function(){xZ(r)}),e("    assignNodeIntersects",function(){wZ(r)}),e("    reversePoints",function(){_Z(r)}),e("    acyclic.undo",function(){RA.default.undo(r)})},sZ=function(r,e){r.nodes().forEach(function(t){var n=r.node(t),i=e.node(t);i!==void 0?(n.fixorder=i._order,delete i._order):delete n.fixorder})},uZ=function(r,e){r.nodes().forEach(function(t){var n,i=r.node(t);if(i){var a=e.node(t);i.x=a.x,i.y=a.y,i._order=a.order,i._rank=a.rank,!((n=e.children(t))===null||n===void 0)&&n.length&&(i.width=a.width,i.height=a.height)}}),r.edges().forEach(function(t){var n=r.edge(t),i=e.edge(t);n.points=i?i.points:[],i&&i.hasOwnProperty("x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=e.graph().width,r.graph().height=e.graph().height},fZ=["nodesep","edgesep","ranksep","marginx","marginy"],lZ={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Xy=["acyclicer","ranker","rankdir","align"],cZ=["width","height","layer","fixorder"],hZ={width:0,height:0},dZ=["minlen","weight","width","height","labeloffset"],vZ={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Yy=["labelpos"],pZ=function(r){var e=new iZ.Graph({multigraph:!0,compound:!0}),t=Vy(r.graph()),n={};return Xy==null||Xy.forEach(function(i){t[i]!==void 0&&(n[i]=t[i])}),e.setGraph(Object.assign({},lZ,Wy(t,fZ),n)),r.nodes().forEach(function(i){var a=Vy(r.node(i)),o=Ad(Ad({},hZ),a),s=Wy(o,cZ);e.setNode(i,s),e.setParent(i,r.parent(i))}),r.edges().forEach(function(i){var a=Vy(r.edge(i)),o={};Yy==null||Yy.forEach(function(s){a[s]!==void 0&&(o[s]=a[s])}),e.setEdgeObj(i,Object.assign({},vZ,Wy(a,dZ),o))}),e},gZ=function(r){var e=r.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,r.nodes().forEach(function(t){var n=r.node(t);isNaN(n.layer)||n.layer||(n.layer=0)}),r.edges().forEach(function(t){var n,i=r.edge(t);i.minlen*=2,((n=i.labelpos)===null||n===void 0?void 0:n.toLowerCase())!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})},yZ=function(r){r.edges().forEach(function(e){var t=r.edge(e);if(t.width&&t.height){var n=r.node(e.v),i=r.node(e.w),a={e,rank:(i.rank-n.rank)/2+n.rank};(0,sa.addDummyNode)(r,"edge-proxy",a,"_ep")}})},mZ=function(r){var e=0;r.nodes().forEach(function(t){var n,i,a=r.node(t);a.borderTop&&(a.minRank=(n=r.node(a.borderTop))===null||n===void 0?void 0:n.rank,a.maxRank=(i=r.node(a.borderBottom))===null||i===void 0?void 0:i.rank,e=Math.max(e,a.maxRank||-1/0))}),r.graph().maxRank=e},bZ=function(r){r.nodes().forEach(function(e){var t=r.node(e);t.dummy==="edge-proxy"&&(r.edge(t.e).labelRank=t.rank,r.removeNode(e))})},xZ=function(r){var e,t=0,n,i=0,a=r.graph(),o=a.marginx||0,s=a.marginy||0,u=function(f){if(f){var l=f.x,c=f.y,h=f.width,d=f.height;!isNaN(l)&&!isNaN(h)&&(e===void 0&&(e=l-h/2),e=Math.min(e,l-h/2),t=Math.max(t,l+h/2)),!isNaN(c)&&!isNaN(d)&&(n===void 0&&(n=c-d/2),n=Math.min(n,c-d/2),i=Math.max(i,c+d/2))}};r.nodes().forEach(function(f){u(r.node(f))}),r.edges().forEach(function(f){var l=r.edge(f);l!=null&&l.hasOwnProperty("x")&&u(l)}),e-=o,n-=s,r.nodes().forEach(function(f){var l=r.node(f);l&&(l.x-=e,l.y-=n)}),r.edges().forEach(function(f){var l,c=r.edge(f);(l=c.points)===null||l===void 0||l.forEach(function(h){h.x-=e,h.y-=n}),c.hasOwnProperty("x")&&(c.x-=e),c.hasOwnProperty("y")&&(c.y-=n)}),a.width=t-e+o,a.height=i-n+s},wZ=function(r){r.edges().forEach(function(e){var t=r.edge(e),n=r.node(e.v),i=r.node(e.w),a,o;t.points?(a=t.points[0],o=t.points[t.points.length-1]):(t.points=[],a=i,o=n),t.points.unshift((0,sa.intersectRect)(n,a)),t.points.push((0,sa.intersectRect)(i,o))})},EZ=function(r){r.edges().forEach(function(e){var t=r.edge(e);if(t!=null&&t.hasOwnProperty("x"))switch((t.labelpos==="l"||t.labelpos==="r")&&(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset;break}})},_Z=function(r){r.edges().forEach(function(e){var t,n=r.edge(e);n.reversed&&((t=n.points)===null||t===void 0||t.reverse())})},SZ=function(r){r.nodes().forEach(function(e){var t,n,i;if(!((t=r.children(e))===null||t===void 0)&&t.length){var a=r.node(e),o=r.node(a.borderTop),s=r.node(a.borderBottom),u=r.node(a.borderLeft[((n=a.borderLeft)===null||n===void 0?void 0:n.length)-1]),f=r.node(a.borderRight[((i=a.borderRight)===null||i===void 0?void 0:i.length)-1]);a.width=Math.abs((f==null?void 0:f.x)-(u==null?void 0:u.x))||10,a.height=Math.abs((s==null?void 0:s.y)-(o==null?void 0:o.y))||10,a.x=((u==null?void 0:u.x)||0)+a.width/2,a.y=((o==null?void 0:o.y)||0)+a.height/2}}),r.nodes().forEach(function(e){var t;((t=r.node(e))===null||t===void 0?void 0:t.dummy)==="border"&&r.removeNode(e)})},MZ=function(r){r.edges().forEach(function(e){if(e.v===e.w){var t=r.node(e.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e,label:r.edge(e)}),r.removeEdgeObj(e)}})},CZ=function(r){var e=(0,sa.buildLayerMatrix)(r);e==null||e.forEach(function(t){var n=0;t==null||t.forEach(function(i,a){var o,s=r.node(i);s.order=a+n,(o=s.selfEdges)===null||o===void 0||o.forEach(function(u){(0,sa.addDummyNode)(r,"selfedge",{width:u.label.width,height:u.label.height,rank:s.rank,order:a+ ++n,e:u.e,label:u.label},"_se")}),delete s.selfEdges})})},AZ=function(r){r.nodes().forEach(function(e){var t=r.node(e);if(t.dummy==="selfedge"){var n=r.node(t.e.v),i=n.x+n.width/2,a=n.y,o=t.x-i,s=n.height/2;r.setEdgeObj(t.e,t.label),r.removeNode(e),t.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{y:a,x:i+o},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],t.label.x=t.x,t.label.y=t.y}})},Wy=function(r,e){var t={};return e==null||e.forEach(function(n){r[n]!==void 0&&(t[n]=+r[n])}),t},Vy=function(r){r===void 0&&(r={});var e={};return Object.keys(r).forEach(function(t){e[t.toLowerCase()]=r[t]}),e};K0.default=aZ;var TZ=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Z0,"__esModule",{value:!0});var IZ=TZ(K0),zA=Zn;Z0.default={layout:IZ.default,util:{time:zA.time,notime:zA.notime}};var kZ=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),LZ=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(fu,"__esModule",{value:!0}),fu.DagreLayout=void 0;var NZ=LZ(Z0),Kn=Ir(),OZ=Pr,$A=Na,DZ=function(r){kZ(e,r);function e(t){var n=r.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.ranksep=50,n.controlPoints=!1,n.sortByCombo=!1,n.edgeLabelSpace=!0,n.radial=!1,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.layoutNode=function(i){var a=n,o=a.nodes,s=o.find(function(f){return f.id===i});if(s){var u=s.layout!==!1;return u}return!0},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,nodeSize:void 0,nodesepFunc:void 0,ranksepFunc:void 0,nodesep:50,ranksep:50,controlPoints:!1,radial:!1,focusNode:null}},e.prototype.execute=function(){var t=this,n,i,a,o,s=this,u=s.nodes,f=s.nodeSize,l=s.rankdir,c=s.combos,h=s.begin,d=s.radial,v=s.comboEdges,p=v===void 0?[]:v,g=s.vedges,y=g===void 0?[]:g;if(u){var m=s.edges||[],b=new $A.Graph({multigraph:!0,compound:!0});s.nodeMap={};var x={};u.forEach(function(ae){s.nodeMap[ae.id]=ae,ae.comboId&&(x[ae.comboId]=x[ae.comboId]||[],x[ae.comboId].push(ae.id))});var w=[],E={};!((n=s.nodeOrder)===null||n===void 0)&&n.length?(s.nodeOrder.forEach(function(ae){E[ae]=!0,w.push(s.nodeMap[ae])}),u.forEach(function(ae){E[ae.id]||w.push(ae)})):w=u;var _;f?(0,Kn.isArray)(f)?_=function(){return f}:_=function(){return[f,f]}:_=function(ae){return ae.size?(0,Kn.isArray)(ae.size)?ae.size:(0,Kn.isObject)(ae.size)?[ae.size.width||40,ae.size.height||40]:[ae.size,ae.size]:[40,40]};var M=(0,Kn.getFunc)(s.ranksep,50,s.ranksepFunc),C=(0,Kn.getFunc)(s.nodesep,50,s.nodesepFunc),S=C,A=M;(l==="LR"||l==="RL")&&(S=M,A=C),b.setDefaultEdgeLabel(function(){return{}}),b.setGraph(s);var T={};this.sortByCombo&&c&&c.forEach(function(ae){if(T[ae.id]=ae,ae.collapsed){var L=_(ae),Se=A(ae),Ge=S(ae),me=L[0]+2*Ge,Ye=L[1]+2*Se;b.setNode(ae.id,{width:me,height:Ye})}ae.parentId&&(T[ae.parentId]||b.setNode(ae.parentId,{}),b.setParent(ae.id,ae.parentId))}),w.filter(function(ae){return ae.layout!==!1}).forEach(function(ae){var L=_(ae),Se=A(ae),Ge=S(ae),me=L[0]+2*Ge,Ye=L[1]+2*Se,We=ae.layer;(0,Kn.isNumber)(We)?b.setNode(ae.id,{width:me,height:Ye,layer:We}):b.setNode(ae.id,{width:me,height:Ye}),t.sortByCombo&&ae.comboId&&(T[ae.comboId]||(T[ae.comboId]={id:ae.comboId},b.setNode(ae.comboId,{})),b.setParent(ae.id,ae.comboId))}),m.forEach(function(ae){var L=(0,Kn.getEdgeTerminal)(ae,"source"),Se=(0,Kn.getEdgeTerminal)(ae,"target");t.layoutNode(L)&&t.layoutNode(Se)&&b.setEdge(L,Se,{weight:ae.weight||1})}),(i=p==null?void 0:p.concat(y||[]))===null||i===void 0||i.forEach(function(ae){var L,Se,Ge=ae.source,me=ae.target,Ye=!((L=T[Ge])===null||L===void 0)&&L.collapsed?[Ge]:x[Ge]||[Ge],We=!((Se=T[me])===null||Se===void 0)&&Se.collapsed?[me]:x[me]||[me];Ye.forEach(function(qe){We.forEach(function(et){b.setEdge(qe,et,{weight:ae.weight||1})})})});var k=void 0;!((a=s.preset)===null||a===void 0)&&a.nodes&&(k=new $A.Graph({multigraph:!0,compound:!0}),s.preset.nodes.forEach(function(ae){k==null||k.setNode(ae.id,ae)})),NZ.default.layout(b,{prevGraph:k,edgeLabelSpace:s.edgeLabelSpace,keepNodeOrder:!!s.nodeOrder,nodeOrder:s.nodeOrder});var O=[0,0];if(h){var G=1/0,D=1/0;b.nodes().forEach(function(ae){var L=b.node(ae);G>L.x&&(G=L.x),D>L.y&&(D=L.y)}),b.edges().forEach(function(ae){var L,Se=b.edge(ae);(L=Se.points)===null||L===void 0||L.forEach(function(Ge){G>Ge.x&&(G=Ge.x),D>Ge.y&&(D=Ge.y)})}),O[0]=h[0]-G,O[1]=h[1]-D}var $=l==="LR"||l==="RL";if(d){var Y=this,N=Y.focusNode,P=Y.ranksep,W=Y.getRadialPos,J=(0,Kn.isString)(N)?N:N==null?void 0:N.id,te=J?(o=b.node(J))===null||o===void 0?void 0:o._rank:0,H=[],pe=$?"y":"x",Te=$?"height":"width",Ne=1/0,Ze=-1/0;b.nodes().forEach(function(ae){var L=b.node(ae);if(s.nodeMap[ae]){var Se=C(s.nodeMap[ae]);if(te===0)H[L._rank]||(H[L._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),H[L._rank].nodes.push(ae),H[L._rank].totalWidth+=Se*2+L[Te],H[L._rank].maxSize<Math.max(L.width,L.height)&&(H[L._rank].maxSize=Math.max(L.width,L.height));else{var Ge=L._rank-te;if(Ge===0)H[Ge]||(H[Ge]={nodes:[],totalWidth:0,maxSize:-1/0}),H[Ge].nodes.push(ae),H[Ge].totalWidth+=Se*2+L[Te],H[Ge].maxSize<Math.max(L.width,L.height)&&(H[Ge].maxSize=Math.max(L.width,L.height));else{var me=Math.abs(Ge);H[me]||(H[me]={left:[],right:[],totalWidth:0,maxSize:-1/0}),H[me].totalWidth+=Se*2+L[Te],H[me].maxSize<Math.max(L.width,L.height)&&(H[me].maxSize=Math.max(L.width,L.height)),Ge<0?H[me].left.push(ae):H[me].right.push(ae)}}var Ye=L[pe]-L[Te]/2-Se,We=L[pe]+L[Te]/2+Se;Ye<Ne&&(Ne=Ye),We>Ze&&(Ze=We)}});var at=P||50,nt={},St=(Ze-Ne)/.9,Mt=[(Ne+Ze-St)*.5,(Ne+Ze+St)*.5],fr=function(ae,L,Se,Ge){Se===void 0&&(Se=-1/0),Ge===void 0&&(Ge=[0,1]);var me=Se;return ae.forEach(function(Ye){var We=b.node(Ye);nt[Ye]=L;var qe=W(We[pe],Mt,St,L,Ge),et=qe.x,yt=qe.y;if(s.nodeMap[Ye]){s.nodeMap[Ye].x=et+O[0],s.nodeMap[Ye].y=yt+O[1],s.nodeMap[Ye]._order=We._order;var Pt=M(s.nodeMap[Ye]);me<Pt&&(me=Pt)}}),me},Ft=!0,Wt=0;H.forEach(function(ae){var L,Se,Ge,me,Ye,We,qe;if(!(!(!((L=ae==null?void 0:ae.nodes)===null||L===void 0)&&L.length)&&!(!((Se=ae==null?void 0:ae.left)===null||Se===void 0)&&Se.length)&&!(!((Ge=ae==null?void 0:ae.right)===null||Ge===void 0)&&Ge.length))){if(Ft&&ae.nodes.length===1){var et=ae.nodes[0];if(!s.nodeMap[et])return;s.nodeMap[et].x=O[0],s.nodeMap[et].y=O[1],nt[ae.nodes[0]]=0,at=M(s.nodeMap[et]),Ft=!1;return}at=Math.max(at,ae.totalWidth/(2*Math.PI));var yt=-1/0;if(te===0||!((me=ae.nodes)===null||me===void 0)&&me.length)yt=fr(ae.nodes,at,yt,[0,1]);else{var Pt=((Ye=ae.left)===null||Ye===void 0?void 0:Ye.length)/(((We=ae.left)===null||We===void 0?void 0:We.length)+((qe=ae.right)===null||qe===void 0?void 0:qe.length));yt=fr(ae.left,at,yt,[0,Pt]),yt=fr(ae.right,at,yt,[Pt+.05,1])}at+=yt,Ft=!1,Wt-ae.maxSize}}),b.edges().forEach(function(ae){var L,Se,Ge,me=b.edge(ae),Ye=m.findIndex(function(hr){var ur=(0,Kn.getEdgeTerminal)(hr,"source"),xr=(0,Kn.getEdgeTerminal)(hr,"target");return ur===ae.v&&xr===ae.w});if(!(Ye<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Ye].type!=="loop"){var We=pe==="x"?"y":"x",qe=(L=me==null?void 0:me.points)===null||L===void 0?void 0:L.slice(1,me.points.length-1),et=[],yt=(Se=b.node(ae.v))===null||Se===void 0?void 0:Se[We],Pt=yt-((Ge=b.node(ae.w))===null||Ge===void 0?void 0:Ge[We]),cr=nt[ae.v],Rt=cr-nt[ae.w];qe==null||qe.forEach(function(hr){var ur=(hr[We]-yt)/Pt*Rt+cr,xr=W(hr[pe],Mt,St,ur);et.push({x:xr.x+O[0],y:xr.y+O[1]})}),m[Ye].controlPoints=et}})}else{var dr=new Set,lr=l==="BT"||l==="RL",Ut=lr?function(ae,L){return L-ae}:function(ae,L){return ae-L};b.nodes().forEach(function(ae){var L=b.node(ae);if(L){var Se=t.nodeMap[ae];Se||(Se=c==null?void 0:c.find(function(Ge){return Ge.id===ae})),Se&&(Se.x=L.x+O[0],Se.y=L.y+O[1],Se._order=L._order,dr.add($?Se.x:Se.y))}});var ar=Array.from(dr).sort(Ut),Zr=$?function(ae,L){return ae.x!==L.x}:function(ae,L){return ae.y!==L.y},tt=$?function(ae,L,Se){var Ge=Math.max(L.y,Se.y),me=Math.min(L.y,Se.y);return ae.filter(function(Ye){return Ye.y<=Ge&&Ye.y>=me})}:function(ae,L,Se){var Ge=Math.max(L.x,Se.x),me=Math.min(L.x,Se.x);return ae.filter(function(Ye){return Ye.x<=Ge&&Ye.x>=me})};b.edges().forEach(function(ae){var L,Se=b.edge(ae),Ge=m.findIndex(function(We){var qe=(0,Kn.getEdgeTerminal)(We,"source"),et=(0,Kn.getEdgeTerminal)(We,"target");return qe===ae.v&&et===ae.w});if(!(Ge<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Ge].type!=="loop"){(L=Se==null?void 0:Se.points)===null||L===void 0||L.forEach(function(We){We.x+=O[0],We.y+=O[1]});var me=s.nodeMap[ae.v],Ye=s.nodeMap[ae.w];m[Ge].controlPoints=PZ(Se==null?void 0:Se.points,me,Ye,ar,$,Zr,tt)}})}return s.onLayoutEnd&&s.onLayoutEnd(),{nodes:u,edges:m}}},e.prototype.getRadialPos=function(t,n,i,a,o){o===void 0&&(o=[0,1]);var s=(t-n[0])/i;s=s*(o[1]-o[0])+o[0];var u=s*2*Math.PI;return{x:Math.cos(u)*a,y:Math.sin(u)*a}},e.prototype.getType=function(){return"dagre"},e}(OZ.Base);fu.DagreLayout=DZ;var PZ=function(r,e,t,n,i,a,o){var s=(r==null?void 0:r.slice(1,r.length-1))||[];if(e&&t){var u=e.x,f=e.y,l=t.x,c=t.y;if(i&&(u=e.y,f=e.x,l=t.y,c=t.x),c!==f&&u!==l){var h=n.indexOf(f),d=n[h+1];if(d){var v=s[0],p=i?{x:(f+d)/2,y:(v==null?void 0:v.y)||l}:{x:(v==null?void 0:v.x)||l,y:(f+d)/2};(!v||a(v,p))&&s.unshift(p)}var g=n.indexOf(c),y=Math.abs(g-h);if(y===1)s=o(s,e,t),s.length||s.push(i?{x:(f+c)/2,y:u}:{x:u,y:(f+c)/2});else if(y>1){var m=n[g-1];if(m){var b=s[s.length-1],x=i?{x:(c+m)/2,y:(b==null?void 0:b.y)||l}:{x:(b==null?void 0:b.x)||u,y:(c+m)/2};(!b||a(b,x))&&s.push(x)}}}}return s},ll={};const Td={graph:{meta:{rankDir:"TB",nodeSep:50,rankSep:50,edgeSep:5,align:void 0}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};function Hy(r={},e=Td){var t,n,i,a;const o=JSON.parse(JSON.stringify(e)),s=((t=r==null?void 0:r.graph)===null||t===void 0?void 0:t.meta)||{},u=((n=r==null?void 0:r.subScene)===null||n===void 0?void 0:n.meta)||{},f=((i=r==null?void 0:r.nodeSize)===null||i===void 0?void 0:i.meta)||{},l=((a=r==null?void 0:r.nodeSize)===null||a===void 0?void 0:a.node)||{},c=o.nodeSize.bridge;return{graph:{meta:Object.assign(o.graph.meta,s)},subScene:{meta:Object.assign(o.subScene.meta,u)},nodeSize:{meta:Object.assign(o.nodeSize.meta,f),node:Object.assign(o.nodeSize.node,l),bridge:c}}}function jA(r){return`◬${r}◬`}const yu=jA("ROOT"),UA=jA("BRIDGE_GRAPH");var Fn,os,mu,qy;(function(r){r[r.META=0]="META",r[r.NODE=1]="NODE",r[r.BRIDGE=2]="BRIDGE"})(Fn||(Fn={})),function(r){r[r.INCLUDE=0]="INCLUDE",r[r.EXCLUDE=1]="EXCLUDE",r[r.UNSPECIFIED=2]="UNSPECIFIED"}(os||(os={})),function(r){r[r.META=0]="META",r[r.CORE=1]="CORE",r[r.BRIDGE=2]="BRIDGE"}(mu||(mu={})),function(r){r[r.META=0]="META",r[r.OP=1]="OP",r[r.SERIES=2]="SERIES"}(qy||(qy={}));var Id=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zy(r,e){return r(e={exports:{}},e.exports),e.exports}var RZ=function(){this.__data__=[],this.size=0},bu=function(r,e){return r===e||r!=r&&e!=e},kd=function(r,e){for(var t=r.length;t--;)if(bu(r[t][0],e))return t;return-1},BZ=Array.prototype.splice,FZ=function(r){var e=this.__data__,t=kd(e,r);return!(t<0)&&(t==e.length-1?e.pop():BZ.call(e,t,1),--this.size,!0)},GZ=function(r){var e=this.__data__,t=kd(e,r);return t<0?void 0:e[t][1]},zZ=function(r){return kd(this.__data__,r)>-1},$Z=function(r,e){var t=this.__data__,n=kd(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this};function xu(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}xu.prototype.clear=RZ,xu.prototype.delete=FZ,xu.prototype.get=GZ,xu.prototype.has=zZ,xu.prototype.set=$Z;var Ld=xu,jZ=function(){this.__data__=new Ld,this.size=0},UZ=function(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t},XZ=function(r){return this.__data__.get(r)},YZ=function(r){return this.__data__.has(r)},XA=typeof Id=="object"&&Id&&Id.Object===Object&&Id,WZ=typeof self=="object"&&self&&self.Object===Object&&self,Ii=XA||WZ||Function("return this")(),ui=Ii.Symbol,YA=Object.prototype,VZ=YA.hasOwnProperty,HZ=YA.toString,cl=ui?ui.toStringTag:void 0,qZ=function(r){var e=VZ.call(r,cl),t=r[cl];try{r[cl]=void 0;var n=!0}catch{}var i=HZ.call(r);return n&&(e?r[cl]=t:delete r[cl]),i},ZZ=Object.prototype.toString,KZ=function(r){return ZZ.call(r)},WA=ui?ui.toStringTag:void 0,xo=function(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":WA&&WA in Object(r)?qZ(r):KZ(r)},Gn=function(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")},VA,hl=function(r){if(!Gn(r))return!1;var e=xo(r);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"},Ky=Ii["__core-js_shared__"],HA=(VA=/[^.]+$/.exec(Ky&&Ky.keys&&Ky.keys.IE_PROTO||""))?"Symbol(src)_1."+VA:"",QZ=function(r){return!!HA&&HA in r},JZ=Function.prototype.toString,ss=function(r){if(r!=null){try{return JZ.call(r)}catch{}try{return r+""}catch{}}return""},eK=/^\[object .+?Constructor\]$/,tK=Function.prototype,rK=Object.prototype,nK=tK.toString,iK=rK.hasOwnProperty,aK=RegExp("^"+nK.call(iK).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oK=function(r){return!(!Gn(r)||QZ(r))&&(hl(r)?aK:eK).test(ss(r))},sK=function(r,e){return r==null?void 0:r[e]},us=function(r,e){var t=sK(r,e);return oK(t)?t:void 0},dl=us(Ii,"Map"),vl=us(Object,"create"),uK=function(){this.__data__=vl?vl(null):{},this.size=0},fK=function(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e},lK=Object.prototype.hasOwnProperty,cK=function(r){var e=this.__data__;if(vl){var t=e[r];return t==="__lodash_hash_undefined__"?void 0:t}return lK.call(e,r)?e[r]:void 0},hK=Object.prototype.hasOwnProperty,dK=function(r){var e=this.__data__;return vl?e[r]!==void 0:hK.call(e,r)},vK=function(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=vl&&e===void 0?"__lodash_hash_undefined__":e,this};function wu(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}wu.prototype.clear=uK,wu.prototype.delete=fK,wu.prototype.get=cK,wu.prototype.has=dK,wu.prototype.set=vK;var qA=wu,pK=function(){this.size=0,this.__data__={hash:new qA,map:new(dl||Ld),string:new qA}},gK=function(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null},Nd=function(r,e){var t=r.__data__;return gK(e)?t[typeof e=="string"?"string":"hash"]:t.map},yK=function(r){var e=Nd(this,r).delete(r);return this.size-=e?1:0,e},mK=function(r){return Nd(this,r).get(r)},bK=function(r){return Nd(this,r).has(r)},xK=function(r,e){var t=Nd(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this};function Eu(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}Eu.prototype.clear=pK,Eu.prototype.delete=yK,Eu.prototype.get=mK,Eu.prototype.has=bK,Eu.prototype.set=xK;var Od=Eu,wK=function(r,e){var t=this.__data__;if(t instanceof Ld){var n=t.__data__;if(!dl||n.length<199)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Od(n)}return t.set(r,e),this.size=t.size,this};function _u(r){var e=this.__data__=new Ld(r);this.size=e.size}_u.prototype.clear=jZ,_u.prototype.delete=UZ,_u.prototype.get=XZ,_u.prototype.has=YZ,_u.prototype.set=wK;var Su=_u,Qy=function(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r},Dd=function(){try{var r=us(Object,"defineProperty");return r({},"",{}),r}catch{}}(),Pd=function(r,e,t){e=="__proto__"&&Dd?Dd(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t},EK=Object.prototype.hasOwnProperty,Rd=function(r,e,t){var n=r[e];EK.call(r,e)&&bu(n,t)&&(t!==void 0||e in r)||Pd(r,e,t)},pl=function(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var s=e[a],u=void 0;u===void 0&&(u=r[s]),i?Pd(t,s,u):Rd(t,s,u)}return t},_K=function(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n},ki=function(r){return r!=null&&typeof r=="object"},ZA=function(r){return ki(r)&&xo(r)=="[object Arguments]"},KA=Object.prototype,SK=KA.hasOwnProperty,MK=KA.propertyIsEnumerable,Mu=ZA(function(){return arguments}())?ZA:function(r){return ki(r)&&SK.call(r,"callee")&&!MK.call(r,"callee")},Rr=Array.isArray,CK=function(){return!1},fs=Zy(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t?Ii.Buffer:void 0,a=(i?i.isBuffer:void 0)||CK;r.exports=a}),AK=/^(?:0|[1-9]\d*)$/,Bd=function(r,e){var t=typeof r;return!!(e=e??9007199254740991)&&(t=="number"||t!="symbol"&&AK.test(r))&&r>-1&&r%1==0&&r<e},Jy=function(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=9007199254740991},Sr={};Sr["[object Float32Array]"]=Sr["[object Float64Array]"]=Sr["[object Int8Array]"]=Sr["[object Int16Array]"]=Sr["[object Int32Array]"]=Sr["[object Uint8Array]"]=Sr["[object Uint8ClampedArray]"]=Sr["[object Uint16Array]"]=Sr["[object Uint32Array]"]=!0,Sr["[object Arguments]"]=Sr["[object Array]"]=Sr["[object ArrayBuffer]"]=Sr["[object Boolean]"]=Sr["[object DataView]"]=Sr["[object Date]"]=Sr["[object Error]"]=Sr["[object Function]"]=Sr["[object Map]"]=Sr["[object Number]"]=Sr["[object Object]"]=Sr["[object RegExp]"]=Sr["[object Set]"]=Sr["[object String]"]=Sr["[object WeakMap]"]=!1;var TK=function(r){return ki(r)&&Jy(r.length)&&!!Sr[xo(r)]},Fd=function(r){return function(e){return r(e)}},Cu=Zy(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t&&XA.process,a=function(){try{var o=n&&n.require&&n.require("util").types;return o||i&&i.binding&&i.binding("util")}catch{}}();r.exports=a}),QA=Cu&&Cu.isTypedArray,gl=QA?Fd(QA):TK,IK=Object.prototype.hasOwnProperty,JA=function(r,e){var t=Rr(r),n=!t&&Mu(r),i=!t&&!n&&fs(r),a=!t&&!n&&!i&&gl(r),o=t||n||i||a,s=o?_K(r.length,String):[],u=s.length;for(var f in r)!e&&!IK.call(r,f)||o&&(f=="length"||i&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Bd(f,u))||s.push(f);return s},kK=Object.prototype,Gd=function(r){var e=r&&r.constructor;return r===(typeof e=="function"&&e.prototype||kK)},eT=function(r,e){return function(t){return r(e(t))}},LK=eT(Object.keys,Object),NK=Object.prototype.hasOwnProperty,em=function(r){if(!Gd(r))return LK(r);var e=[];for(var t in Object(r))NK.call(r,t)&&t!="constructor"&&e.push(t);return e},Da=function(r){return r!=null&&Jy(r.length)&&!hl(r)},wo=function(r){return Da(r)?JA(r):em(r)},OK=function(r,e){return r&&pl(e,wo(e),r)},DK=function(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e},PK=Object.prototype.hasOwnProperty,RK=function(r){if(!Gn(r))return DK(r);var e=Gd(r),t=[];for(var n in r)(n!="constructor"||!e&&PK.call(r,n))&&t.push(n);return t},ls=function(r){return Da(r)?JA(r,!0):RK(r)},BK=function(r,e){return r&&pl(e,ls(e),r)},tT=Zy(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t?Ii.Buffer:void 0,a=i?i.allocUnsafe:void 0;r.exports=function(o,s){if(s)return o.slice();var u=o.length,f=a?a(u):new o.constructor(u);return o.copy(f),f}}),rT=function(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e},nT=function(r,e){for(var t=-1,n=r==null?0:r.length,i=0,a=[];++t<n;){var o=r[t];e(o,t,r)&&(a[i++]=o)}return a},iT=function(){return[]},FK=Object.prototype.propertyIsEnumerable,aT=Object.getOwnPropertySymbols,tm=aT?function(r){return r==null?[]:(r=Object(r),nT(aT(r),function(e){return FK.call(r,e)}))}:iT,GK=function(r,e){return pl(r,tm(r),e)},rm=function(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r},zd=eT(Object.getPrototypeOf,Object),oT=Object.getOwnPropertySymbols?function(r){for(var e=[];r;)rm(e,tm(r)),r=zd(r);return e}:iT,zK=function(r,e){return pl(r,oT(r),e)},sT=function(r,e,t){var n=e(r);return Rr(r)?n:rm(n,t(r))},nm=function(r){return sT(r,wo,tm)},$K=function(r){return sT(r,ls,oT)},im=us(Ii,"DataView"),am=us(Ii,"Promise"),Au=us(Ii,"Set"),om=us(Ii,"WeakMap"),jK=ss(im),UK=ss(dl),XK=ss(am),YK=ss(Au),WK=ss(om),cs=xo;(im&&cs(new im(new ArrayBuffer(1)))!="[object DataView]"||dl&&cs(new dl)!="[object Map]"||am&&cs(am.resolve())!="[object Promise]"||Au&&cs(new Au)!="[object Set]"||om&&cs(new om)!="[object WeakMap]")&&(cs=function(r){var e=xo(r),t=e=="[object Object]"?r.constructor:void 0,n=t?ss(t):"";if(n)switch(n){case jK:return"[object DataView]";case UK:return"[object Map]";case XK:return"[object Promise]";case YK:return"[object Set]";case WK:return"[object WeakMap]"}return e});var hs=cs,VK=Object.prototype.hasOwnProperty,HK=function(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&VK.call(r,"index")&&(t.index=r.index,t.input=r.input),t},$d=Ii.Uint8Array,sm=function(r){var e=new r.constructor(r.byteLength);return new $d(e).set(new $d(r)),e},qK=function(r,e){var t=e?sm(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)},ZK=/\w*$/,KK=function(r){var e=new r.constructor(r.source,ZK.exec(r));return e.lastIndex=r.lastIndex,e},uT=ui?ui.prototype:void 0,fT=uT?uT.valueOf:void 0,QK=function(r){return fT?Object(fT.call(r)):{}},lT=function(r,e){var t=e?sm(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)},JK=function(r,e,t){var n=r.constructor;switch(e){case"[object ArrayBuffer]":return sm(r);case"[object Boolean]":case"[object Date]":return new n(+r);case"[object DataView]":return qK(r,t);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 lT(r,t);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(r);case"[object RegExp]":return KK(r);case"[object Set]":return new n;case"[object Symbol]":return QK(r)}},cT=Object.create,hT=function(){function r(){}return function(e){if(!Gn(e))return{};if(cT)return cT(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),dT=function(r){return typeof r.constructor!="function"||Gd(r)?{}:hT(zd(r))},eQ=function(r){return ki(r)&&hs(r)=="[object Map]"},vT=Cu&&Cu.isMap,tQ=vT?Fd(vT):eQ,rQ=function(r){return ki(r)&&hs(r)=="[object Set]"},pT=Cu&&Cu.isSet,nQ=pT?Fd(pT):rQ,Er={};Er["[object Arguments]"]=Er["[object Array]"]=Er["[object ArrayBuffer]"]=Er["[object DataView]"]=Er["[object Boolean]"]=Er["[object Date]"]=Er["[object Float32Array]"]=Er["[object Float64Array]"]=Er["[object Int8Array]"]=Er["[object Int16Array]"]=Er["[object Int32Array]"]=Er["[object Map]"]=Er["[object Number]"]=Er["[object Object]"]=Er["[object RegExp]"]=Er["[object Set]"]=Er["[object String]"]=Er["[object Symbol]"]=Er["[object Uint8Array]"]=Er["[object Uint8ClampedArray]"]=Er["[object Uint16Array]"]=Er["[object Uint32Array]"]=!0,Er["[object Error]"]=Er["[object Function]"]=Er["[object WeakMap]"]=!1;var gT=function r(e,t,n,i,a,o){var s,u=1&t,f=2&t,l=4&t;if(s!==void 0)return s;if(!Gn(e))return e;var c=Rr(e);if(c){if(s=HK(e),!u)return rT(e,s)}else{var h=hs(e),d=h=="[object Function]"||h=="[object GeneratorFunction]";if(fs(e))return tT(e,u);if(h=="[object Object]"||h=="[object Arguments]"||d&&!a){if(s=f||d?{}:dT(e),!u)return f?zK(e,BK(s,e)):GK(e,OK(s,e))}else{if(!Er[h])return a?e:{};s=JK(e,h,u)}}o||(o=new Su);var v=o.get(e);if(v)return v;o.set(e,s),nQ(e)?e.forEach(function(g){s.add(r(g,t,n,g,e,o))}):tQ(e)&&e.forEach(function(g,y){s.set(y,r(g,t,n,y,e,o))});var p=c?void 0:(l?f?$K:nm:f?ls:wo)(e);return Qy(p||e,function(g,y){p&&(g=e[y=g]),Rd(s,y,r(g,t,n,y,e,o))}),s},iQ=function(r){return gT(r,4)},um=function(r){return function(){return r}},fm=function(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),s=o.length;s--;){var u=o[++i];if(t(a[u],u,a)===!1)break}return e}}(),lm=function(r,e){return r&&fm(r,e,wo)},jd=function(r,e){return function(t,n){if(t==null)return t;if(!Da(t))return r(t,n);for(var i=t.length,a=-1,o=Object(t);++a<i&&n(o[a],a,o)!==!1;);return t}}(lm),ds=function(r){return r},yT=function(r){return typeof r=="function"?r:ds},mT=function(r,e){return(Rr(r)?Qy:jd)(r,yT(e))},bT=mT,aQ=function(r,e){var t=[];return jd(r,function(n,i,a){e(n,i,a)&&t.push(n)}),t},oQ=function(r){return this.__data__.set(r,"__lodash_hash_undefined__"),this},sQ=function(r){return this.__data__.has(r)};function Ud(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Od;++e<t;)this.add(r[e])}Ud.prototype.add=Ud.prototype.push=oQ,Ud.prototype.has=sQ;var xT=Ud,uQ=function(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1},wT=function(r,e){return r.has(e)},ET=function(r,e,t,n,i,a){var o=1&t,s=r.length,u=e.length;if(s!=u&&!(o&&u>s))return!1;var f=a.get(r),l=a.get(e);if(f&&l)return f==e&&l==r;var c=-1,h=!0,d=2&t?new xT:void 0;for(a.set(r,e),a.set(e,r);++c<s;){var v=r[c],p=e[c];if(n)var g=o?n(p,v,c,e,r,a):n(v,p,c,r,e,a);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!uQ(e,function(y,m){if(!wT(d,m)&&(v===y||i(v,y,t,n,a)))return d.push(m)})){h=!1;break}}else if(v!==p&&!i(v,p,t,n,a)){h=!1;break}}return a.delete(r),a.delete(e),h},fQ=function(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t},cm=function(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t},_T=ui?ui.prototype:void 0,hm=_T?_T.valueOf:void 0,lQ=function(r,e,t,n,i,a,o){switch(t){case"[object DataView]":if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(r.byteLength!=e.byteLength||!a(new $d(r),new $d(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return bu(+r,+e);case"[object Error]":return r.name==e.name&&r.message==e.message;case"[object RegExp]":case"[object String]":return r==e+"";case"[object Map]":var s=fQ;case"[object Set]":var u=1&n;if(s||(s=cm),r.size!=e.size&&!u)return!1;var f=o.get(r);if(f)return f==e;n|=2,o.set(r,e);var l=ET(s(r),s(e),n,i,a,o);return o.delete(r),l;case"[object Symbol]":if(hm)return hm.call(r)==hm.call(e)}return!1},cQ=Object.prototype.hasOwnProperty,hQ=function(r,e,t,n,i,a){var o=1&t,s=nm(r),u=s.length;if(u!=nm(e).length&&!o)return!1;for(var f=u;f--;){var l=s[f];if(!(o?l in e:cQ.call(e,l)))return!1}var c=a.get(r),h=a.get(e);if(c&&h)return c==e&&h==r;var d=!0;a.set(r,e),a.set(e,r);for(var v=o;++f<u;){var p=r[l=s[f]],g=e[l];if(n)var y=o?n(g,p,l,e,r,a):n(p,g,l,r,e,a);if(!(y===void 0?p===g||i(p,g,t,n,a):y)){d=!1;break}v||(v=l=="constructor")}if(d&&!v){var m=r.constructor,b=e.constructor;m==b||!("constructor"in r)||!("constructor"in e)||typeof m=="function"&&m instanceof m&&typeof b=="function"&&b instanceof b||(d=!1)}return a.delete(r),a.delete(e),d},ST=Object.prototype.hasOwnProperty,dQ=function(r,e,t,n,i,a){var o=Rr(r),s=Rr(e),u=o?"[object Array]":hs(r),f=s?"[object Array]":hs(e),l=(u=u=="[object Arguments]"?"[object Object]":u)=="[object Object]",c=(f=f=="[object Arguments]"?"[object Object]":f)=="[object Object]",h=u==f;if(h&&fs(r)){if(!fs(e))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new Su),o||gl(r)?ET(r,e,t,n,i,a):lQ(r,e,u,t,n,i,a);if(!(1&t)){var d=l&&ST.call(r,"__wrapped__"),v=c&&ST.call(e,"__wrapped__");if(d||v){var p=d?r.value():r,g=v?e.value():e;return a||(a=new Su),i(p,g,t,n,a)}}return!!h&&(a||(a=new Su),hQ(r,e,t,n,i,a))},MT=function r(e,t,n,i,a){return e===t||(e==null||t==null||!ki(e)&&!ki(t)?e!=e&&t!=t:dQ(e,t,n,i,r,a))},vQ=function(r,e,t,n){var i=t.length,a=i;if(r==null)return!a;for(r=Object(r);i--;){var o=t[i];if(o[2]?o[1]!==r[o[0]]:!(o[0]in r))return!1}for(;++i<a;){var s=(o=t[i])[0],u=r[s],f=o[1];if(o[2]){if(u===void 0&&!(s in r))return!1}else{var l=new Su,c;if(!(c===void 0?MT(f,u,3,n,l):c))return!1}}return!0},CT=function(r){return r==r&&!Gn(r)},pQ=function(r){for(var e=wo(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,CT(i)]}return e},AT=function(r,e){return function(t){return t!=null&&t[r]===e&&(e!==void 0||r in Object(t))}},gQ=function(r){var e=pQ(r);return e.length==1&&e[0][2]?AT(e[0][0],e[0][1]):function(t){return t===r||vQ(t,r,e)}},vs=function(r){return typeof r=="symbol"||ki(r)&&xo(r)=="[object Symbol]"},yQ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mQ=/^\w*$/,dm=function(r,e){if(Rr(r))return!1;var t=typeof r;return!(t!="number"&&t!="symbol"&&t!="boolean"&&r!=null&&!vs(r))||mQ.test(r)||!yQ.test(r)||e!=null&&r in Object(e)};function vm(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=t.cache;if(a.has(i))return a.get(i);var o=r.apply(this,n);return t.cache=a.set(i,o)||a,o};return t.cache=new(vm.Cache||Od),t}vm.Cache=Od;var bQ=vm,xQ=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wQ=/\\(\\)?/g,EQ=function(r){var e=bQ(r,function(n){return t.size===500&&t.clear(),n}),t=e.cache;return e}(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(xQ,function(t,n,i,a){e.push(i?a.replace(wQ,"$1"):n||t)}),e}),Tu=function(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i},TT=ui?ui.prototype:void 0,IT=TT?TT.toString:void 0,_Q=function r(e){if(typeof e=="string")return e;if(Rr(e))return Tu(e,r)+"";if(vs(e))return IT?IT.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t},kT=function(r){return r==null?"":_Q(r)},Xd=function(r,e){return Rr(r)?r:dm(r,e)?[r]:EQ(kT(r))},yl=function(r){if(typeof r=="string"||vs(r))return r;var e=r+"";return e=="0"&&1/r==-1/0?"-0":e},Yd=function(r,e){for(var t=0,n=(e=Xd(e,r)).length;r!=null&&t<n;)r=r[yl(e[t++])];return t&&t==n?r:void 0},SQ=function(r,e,t){var n=r==null?void 0:Yd(r,e);return n===void 0?t:n},MQ=function(r,e){return r!=null&&e in Object(r)},LT=function(r,e,t){for(var n=-1,i=(e=Xd(e,r)).length,a=!1;++n<i;){var o=yl(e[n]);if(!(a=r!=null&&t(r,o)))break;r=r[o]}return a||++n!=i?a:!!(i=r==null?0:r.length)&&Jy(i)&&Bd(o,i)&&(Rr(r)||Mu(r))},NT=function(r,e){return r!=null&&LT(r,e,MQ)},CQ=function(r,e){return dm(r)&&CT(e)?AT(yl(r),e):function(t){var n=SQ(t,r);return n===void 0&&n===e?NT(t,r):MT(e,n,3)}},OT=function(r){return function(e){return e==null?void 0:e[r]}},AQ=function(r){return function(e){return Yd(e,r)}},TQ=function(r){return dm(r)?OT(yl(r)):AQ(r)},Pa=function(r){return typeof r=="function"?r:r==null?ds:typeof r=="object"?Rr(r)?CQ(r[0],r[1]):gQ(r):TQ(r)},DT=function(r,e){return(Rr(r)?nT:aQ)(r,Pa(e))},IQ=Object.prototype.hasOwnProperty,kQ=function(r,e){return r!=null&&IQ.call(r,e)},PT=function(r,e){return r!=null&&LT(r,e,kQ)},LQ=Object.prototype.hasOwnProperty,NQ=function(r){if(r==null)return!0;if(Da(r)&&(Rr(r)||typeof r=="string"||typeof r.splice=="function"||fs(r)||gl(r)||Mu(r)))return!r.length;var e=hs(r);if(e=="[object Map]"||e=="[object Set]")return!r.size;if(Gd(r))return!em(r).length;for(var t in r)if(LQ.call(r,t))return!1;return!0},RT=function(r){return r===void 0},BT=function(r,e){var t=-1,n=Da(r)?Array(r.length):[];return jd(r,function(i,a,o){n[++t]=e(i,a,o)}),n},FT=function(r,e){return(Rr(r)?Tu:BT)(r,Pa(e))},OQ=function(r,e,t,n){var i=-1,a=r==null?0:r.length;for(n&&a&&(t=r[++i]);++i<a;)t=e(t,r[i],i,r);return t},DQ=function(r,e,t,n,i){return i(r,function(a,o,s){t=n?(n=!1,a):e(t,a,o,s)}),t},GT=function(r,e,t){var n=Rr(r)?OQ:DQ,i=arguments.length<3;return n(r,Pa(e),t,i,jd)},PQ=function(r){return typeof r=="string"||!Rr(r)&&ki(r)&&xo(r)=="[object String]"},RQ=OT("length"),BQ=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),FQ=function(r){return BQ.test(r)},GQ="[\\ud800-\\udfff]",pm="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",gm="\\ud83c[\\udffb-\\udfff]",zT="[^\\ud800-\\udfff]",$T="(?:\\ud83c[\\udde6-\\uddff]){2}",jT="[\\ud800-\\udbff][\\udc00-\\udfff]",UT="(?:"+pm+"|"+gm+")?",zQ="[\\ufe0e\\ufe0f]?"+UT+("(?:\\u200d(?:"+[zT,$T,jT].join("|")+")[\\ufe0e\\ufe0f]?"+UT+")*"),$Q="(?:"+[zT+pm+"?",pm,$T,jT,GQ].join("|")+")",XT=RegExp(gm+"(?="+gm+")|"+$Q+zQ,"g"),jQ=function(r){for(var e=XT.lastIndex=0;XT.test(r);)++e;return e},UQ=function(r){return FQ(r)?jQ(r):RQ(r)},XQ=function(r){if(r==null)return 0;if(Da(r))return PQ(r)?UQ(r):r.length;var e=hs(r);return e=="[object Map]"||e=="[object Set]"?r.size:em(r).length},YQ=function(r,e,t){var n=Rr(r),i=n||fs(r)||gl(r);if(e=Pa(e),t==null){var a=r&&r.constructor;t=i?n?new a:[]:Gn(r)&&hl(a)?hT(zd(r)):{}}return(i?Qy:lm)(r,function(o,s,u){return e(t,o,s,u)}),t},YT=ui?ui.isConcatSpreadable:void 0,WQ=function(r){return Rr(r)||Mu(r)||!!(YT&&r&&r[YT])},ym=function(e,t,n,i,a){var o=-1,s=e.length;for(n||(n=WQ),a||(a=[]);++o<s;){var u=e[o];n(u)?rm(a,u):i||(a[a.length]=u)}return a},VQ=function(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)},WT=Math.max,VT=function(r,e,t){return e=WT(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=WT(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=t(o),VQ(r,this,s)}},HQ=Dd?function(r,e){return Dd(r,"toString",{configurable:!0,enumerable:!1,value:um(e),writable:!0})}:ds,qQ=Date.now,HT=function(r){var e=0,t=0;return function(){var n=qQ(),i=16-(n-t);if(t=n,i>0){if(++e>=800)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}(HQ),Wd=function(r,e){return HT(VT(r,e,ds),r+"")},qT=function(r,e,t,n){for(var i=r.length,a=t+-1;++a<i;)if(e(r[a],a,r))return a;return-1},ZQ=function(r){return r!=r},KQ=function(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1},QQ=function(r,e,t){return e==e?KQ(r,e,t):qT(r,ZQ,t)},JQ=function(r,e){return!!(r!=null&&r.length)&&QQ(r,e,0)>-1},eJ=function(){},tJ=Au&&1/cm(new Au([,-0]))[1]==1/0?function(r){return new Au(r)}:eJ,rJ=function(r,e,t){var n=-1,i=JQ,a=r.length,o=!0,s=[],u=s;if(a>=200){var f=tJ(r);if(f)return cm(f);o=!1,i=wT,u=new xT}else u=s;e:for(;++n<a;){var l=r[n],c=l;if(l=l!==0?l:0,o&&c==c){for(var h=u.length;h--;)if(u[h]===c)continue e;s.push(l)}else i(u,c,t)||(u!==s&&u.push(c),s.push(l))}return s},ZT=function(r){return ki(r)&&Da(r)},nJ=Wd(function(r){return rJ(ym(r,1,ZT,!0))}),iJ=function(r,e){return Tu(e,function(t){return r[t]})},Vd,KT=function(r){return r==null?[]:iJ(r,wo(r))};try{Vd={clone:iQ,constant:um,each:bT,filter:DT,has:PT,isArray:Rr,isEmpty:NQ,isFunction:hl,isUndefined:RT,keys:wo,map:FT,reduce:GT,size:XQ,transform:YQ,union:nJ,values:KT}}catch{}Vd||(Vd=window._);var ut=Vd,mm=tr;function tr(r){this._isDirected=!ut.has(r,"directed")||r.directed,this._isMultigraph=!!ut.has(r,"multigraph")&&r.multigraph,this._isCompound=!!ut.has(r,"compound")&&r.compound,this._label=void 0,this._defaultNodeLabelFn=ut.constant(void 0),this._defaultEdgeLabelFn=ut.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function QT(r,e){r[e]?r[e]++:r[e]=1}function JT(r,e){--r[e]||delete r[e]}function ml(r,e,t,n){var i=""+e,a=""+t;if(!r&&i>a){var o=i;i=a,a=o}return i+""+a+""+(ut.isUndefined(n)?"\0":n)}function aJ(r,e,t,n){var i=""+e,a=""+t;if(!r&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}function bm(r,e){return ml(r,e.v,e.w,e.name)}tr.prototype._nodeCount=0,tr.prototype._edgeCount=0,tr.prototype.isDirected=function(){return this._isDirected},tr.prototype.isMultigraph=function(){return this._isMultigraph},tr.prototype.isCompound=function(){return this._isCompound},tr.prototype.setGraph=function(r){return this._label=r,this},tr.prototype.graph=function(){return this._label},tr.prototype.setDefaultNodeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultNodeLabelFn=r,this},tr.prototype.nodeCount=function(){return this._nodeCount},tr.prototype.nodes=function(){return ut.keys(this._nodes)},tr.prototype.sources=function(){var r=this;return ut.filter(this.nodes(),function(e){return ut.isEmpty(r._in[e])})},tr.prototype.sinks=function(){var r=this;return ut.filter(this.nodes(),function(e){return ut.isEmpty(r._out[e])})},tr.prototype.setNodes=function(r,e){var t=arguments,n=this;return ut.each(r,function(i){t.length>1?n.setNode(i,e):n.setNode(i)}),this},tr.prototype.setNode=function(r,e){return ut.has(this._nodes,r)?(arguments.length>1&&(this._nodes[r]=e),this):(this._nodes[r]=arguments.length>1?e:this._defaultNodeLabelFn(r),this._isCompound&&(this._parent[r]="\0",this._children[r]={},this._children["\0"][r]=!0),this._in[r]={},this._preds[r]={},this._out[r]={},this._sucs[r]={},++this._nodeCount,this)},tr.prototype.node=function(r){return this._nodes[r]},tr.prototype.hasNode=function(r){return ut.has(this._nodes,r)},tr.prototype.removeNode=function(r){var e=this;if(ut.has(this._nodes,r)){var t=function(n){e.removeEdge(e._edgeObjs[n])};delete this._nodes[r],this._isCompound&&(this._removeFromParentsChildList(r),delete this._parent[r],ut.each(this.children(r),function(n){e.setParent(n)}),delete this._children[r]),ut.each(ut.keys(this._in[r]),t),delete this._in[r],delete this._preds[r],ut.each(ut.keys(this._out[r]),t),delete this._out[r],delete this._sucs[r],--this._nodeCount}return this},tr.prototype.setParent=function(r,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ut.isUndefined(e))e="\0";else{for(var t=e+="";!ut.isUndefined(t);t=this.parent(t))if(t===r)throw new Error("Setting "+e+" as parent of "+r+" would create a cycle");this.setNode(e)}return this.setNode(r),this._removeFromParentsChildList(r),this._parent[r]=e,this._children[e][r]=!0,this},tr.prototype._removeFromParentsChildList=function(r){delete this._children[this._parent[r]][r]},tr.prototype.parent=function(r){if(this._isCompound){var e=this._parent[r];if(e!=="\0")return e}},tr.prototype.children=function(r){if(ut.isUndefined(r)&&(r="\0"),this._isCompound){var e=this._children[r];if(e)return ut.keys(e)}else{if(r==="\0")return this.nodes();if(this.hasNode(r))return[]}},tr.prototype.predecessors=function(r){var e=this._preds[r];if(e)return ut.keys(e)},tr.prototype.successors=function(r){var e=this._sucs[r];if(e)return ut.keys(e)},tr.prototype.neighbors=function(r){var e=this.predecessors(r);if(e)return ut.union(e,this.successors(r))},tr.prototype.isLeaf=function(r){return(this.isDirected()?this.successors(r):this.neighbors(r)).length===0},tr.prototype.filterNodes=function(r){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var t=this;ut.each(this._nodes,function(a,o){r(o)&&e.setNode(o,a)}),ut.each(this._edgeObjs,function(a){e.hasNode(a.v)&&e.hasNode(a.w)&&e.setEdge(a,t.edge(a))});var n={};function i(a){var o=t.parent(a);return o===void 0||e.hasNode(o)?(n[a]=o,o):o in n?n[o]:i(o)}return this._isCompound&&ut.each(e.nodes(),function(a){e.setParent(a,i(a))}),e},tr.prototype.setDefaultEdgeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultEdgeLabelFn=r,this},tr.prototype.edgeCount=function(){return this._edgeCount},tr.prototype.edges=function(){return ut.values(this._edgeObjs)},tr.prototype.setPath=function(r,e){var t=this,n=arguments;return ut.reduce(r,function(i,a){return n.length>1?t.setEdge(i,a,e):t.setEdge(i,a),a}),this},tr.prototype.setEdge=function(){var r,e,t,n,i=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(r=a.v,e=a.w,t=a.name,arguments.length===2&&(n=arguments[1],i=!0)):(r=a,e=arguments[1],t=arguments[3],arguments.length>2&&(n=arguments[2],i=!0)),r=""+r,e=""+e,ut.isUndefined(t)||(t=""+t);var o=ml(this._isDirected,r,e,t);if(ut.has(this._edgeLabels,o))return i&&(this._edgeLabels[o]=n),this;if(!ut.isUndefined(t)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(e),this._edgeLabels[o]=i?n:this._defaultEdgeLabelFn(r,e,t);var s=aJ(this._isDirected,r,e,t);return r=s.v,e=s.w,Object.freeze(s),this._edgeObjs[o]=s,QT(this._preds[e],r),QT(this._sucs[r],e),this._in[e][o]=s,this._out[r][o]=s,this._edgeCount++,this},tr.prototype.edge=function(r,e,t){var n=arguments.length===1?bm(this._isDirected,arguments[0]):ml(this._isDirected,r,e,t);return this._edgeLabels[n]},tr.prototype.hasEdge=function(r,e,t){var n=arguments.length===1?bm(this._isDirected,arguments[0]):ml(this._isDirected,r,e,t);return ut.has(this._edgeLabels,n)},tr.prototype.removeEdge=function(r,e,t){var n=arguments.length===1?bm(this._isDirected,arguments[0]):ml(this._isDirected,r,e,t),i=this._edgeObjs[n];return i&&(r=i.v,e=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],JT(this._preds[e],r),JT(this._sucs[r],e),delete this._in[e][n],delete this._out[r][n],this._edgeCount--),this},tr.prototype.inEdges=function(r,e){var t=this._in[r];if(t){var n=ut.values(t);return e?ut.filter(n,function(i){return i.v===e}):n}},tr.prototype.outEdges=function(r,e){var t=this._out[r];if(t){var n=ut.values(t);return e?ut.filter(n,function(i){return i.w===e}):n}},tr.prototype.nodeEdges=function(r,e){var t=this.inEdges(r,e);if(t)return t.concat(this.outEdges(r,e))};var eI={Graph:mm,version:"2.1.8"},oJ={write:function(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:sJ(r),edges:uJ(r)};return ut.isUndefined(r.graph())||(e.value=ut.clone(r.graph())),e},read:function(r){var e=new mm(r.options).setGraph(r.value);return ut.each(r.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),ut.each(r.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function sJ(r){return ut.map(r.nodes(),function(e){var t=r.node(e),n=r.parent(e),i={v:e};return ut.isUndefined(t)||(i.value=t),ut.isUndefined(n)||(i.parent=n),i})}function uJ(r){return ut.map(r.edges(),function(e){var t=r.edge(e),n={v:e.v,w:e.w};return ut.isUndefined(e.name)||(n.name=e.name),ut.isUndefined(t)||(n.value=t),n})}var fJ=function(r){var e,t={},n=[];function i(a){ut.has(t,a)||(t[a]=!0,e.push(a),ut.each(r.successors(a),i),ut.each(r.predecessors(a),i))}return ut.each(r.nodes(),function(a){e=[],i(a),e.length&&n.push(e)}),n},tI=fi;function fi(){this._arr=[],this._keyIndices={}}fi.prototype.size=function(){return this._arr.length},fi.prototype.keys=function(){return this._arr.map(function(r){return r.key})},fi.prototype.has=function(r){return ut.has(this._keyIndices,r)},fi.prototype.priority=function(r){var e=this._keyIndices[r];if(e!==void 0)return this._arr[e].priority},fi.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},fi.prototype.add=function(r,e){var t=this._keyIndices;if(r=String(r),!ut.has(t,r)){var n=this._arr,i=n.length;return t[r]=i,n.push({key:r,priority:e}),this._decrease(i),!0}return!1},fi.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},fi.prototype.decrease=function(r,e){var t=this._keyIndices[r];if(e>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[t].priority+" New: "+e);this._arr[t].priority=e,this._decrease(t)},fi.prototype._heapify=function(r){var e=this._arr,t=2*r,n=t+1,i=r;t<e.length&&(i=e[t].priority<e[i].priority?t:i,n<e.length&&(i=e[n].priority<e[i].priority?n:i),i!==r&&(this._swap(r,i),this._heapify(i)))},fi.prototype._decrease=function(r){for(var e,t=this._arr,n=t[r].priority;r!==0&&!(t[e=r>>1].priority<n);)this._swap(r,e),r=e},fi.prototype._swap=function(r,e){var t=this._arr,n=this._keyIndices,i=t[r],a=t[e];t[r]=a,t[e]=i,n[a.key]=r,n[i.key]=e};var rI=function(r,e,t,n){return function(i,a,o,s){var u,f,l={},c=new tI,h=function(d){var v=d.v!==u?d.v:d.w,p=l[v],g=o(d),y=f.distance+g;if(g<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+d+" Weight: "+g);y<p.distance&&(p.distance=y,p.predecessor=u,c.decrease(v,y))};for(i.nodes().forEach(function(d){var v=d===a?0:Number.POSITIVE_INFINITY;l[d]={distance:v},c.add(d,v)});c.size()>0&&(u=c.removeMin(),(f=l[u]).distance!==Number.POSITIVE_INFINITY);)s(u).forEach(h);return l}(r,String(e),t||lJ,n||function(i){return r.outEdges(i)})},lJ=ut.constant(1),cJ=function(r,e,t){return ut.transform(r.nodes(),function(n,i){n[i]=rI(r,i,e,t)},{})},nI=function(r){var e=0,t=[],n={},i=[];function a(o){var s=n[o]={onStack:!0,lowlink:e,index:e++};if(t.push(o),r.successors(o).forEach(function(l){ut.has(n,l)?n[l].onStack&&(s.lowlink=Math.min(s.lowlink,n[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,n[l].lowlink))}),s.lowlink===s.index){var u,f=[];do u=t.pop(),n[u].onStack=!1,f.push(u);while(o!==u);i.push(f)}}return r.nodes().forEach(function(o){ut.has(n,o)||a(o)}),i},hJ=function(r){return ut.filter(nI(r),function(e){return e.length>1||e.length===1&&r.hasEdge(e[0],e[0])})},dJ=function(r,e,t){return function(n,i,a){var o={},s=n.nodes();return s.forEach(function(u){o[u]={},o[u][u]={distance:0},s.forEach(function(f){u!==f&&(o[u][f]={distance:Number.POSITIVE_INFINITY})}),a(u).forEach(function(f){var l=f.v===u?f.w:f.v,c=i(f);o[u][l]={distance:c,predecessor:u}})}),s.forEach(function(u){var f=o[u];s.forEach(function(l){var c=o[l];s.forEach(function(h){var d=c[u],v=f[h],p=c[h],g=d.distance+v.distance;g<p.distance&&(p.distance=g,p.predecessor=v.predecessor)})})}),o}(r,e||vJ,t||function(n){return r.outEdges(n)})},vJ=ut.constant(1),xm=iI;function iI(r){var e={},t={},n=[];if(ut.each(r.sinks(),function i(a){if(ut.has(t,a))throw new Hd;ut.has(e,a)||(t[a]=!0,e[a]=!0,ut.each(r.predecessors(a),i),delete t[a],n.push(a))}),ut.size(e)!==r.nodeCount())throw new Hd;return n}function Hd(){}iI.CycleException=Hd,Hd.prototype=new Error;var aI=function(r,e,t){ut.isArray(e)||(e=[e]);var n=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return ut.each(e,function(o){if(!r.hasNode(o))throw new Error("Graph does not have node: "+o);oI(r,o,t==="post",a,n,i)}),i};function oI(r,e,t,n,i,a){ut.has(n,e)||(n[e]=!0,t||a.push(e),ut.each(i(e),function(o){oI(r,o,t,n,i,a)}),t&&a.push(e))}var qd,pJ={Graph:eI.Graph,json:oJ,alg:{components:fJ,dijkstra:rI,dijkstraAll:cJ,findCycles:hJ,floydWarshall:dJ,isAcyclic:function(r){try{xm(r)}catch(e){if(e instanceof xm.CycleException)return!1;throw e}return!0},postorder:function(r,e){return aI(r,e,"post")},preorder:function(r,e){return aI(r,e,"pre")},prim:function(r,e){var t,n=new mm,i={},a=new tI;function o(u){var f=u.v===t?u.w:u.v,l=a.priority(f);if(l!==void 0){var c=e(u);c<l&&(i[f]=t,a.decrease(f,c))}}if(r.nodeCount()===0)return n;ut.each(r.nodes(),function(u){a.add(u,Number.POSITIVE_INFINITY),n.setNode(u)}),a.decrease(r.nodes()[0],0);for(var s=!1;a.size()>0;){if(t=a.removeMin(),ut.has(i,t))n.setEdge(t,i[t]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(t).forEach(o)}return n},tarjan:nI,topsort:xm},version:eI.version};try{qd=pJ}catch{}qd||(qd=window.graphlib);var Li=qd,gJ=function(r){return gT(r,5)},bl=function(r,e,t){if(!Gn(t))return!1;var n=typeof e;return!!(n=="number"?Da(t)&&Bd(e,t.length):n=="string"&&e in t)&&bu(t[e],r)},sI=Object.prototype,yJ=sI.hasOwnProperty,mJ=Wd(function(r,e){r=Object(r);var t=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&bl(e[0],e[1],i)&&(n=1);++t<n;)for(var a=e[t],o=ls(a),s=-1,u=o.length;++s<u;){var f=o[s],l=r[f];(l===void 0||bu(l,sI[f])&&!yJ.call(r,f))&&(r[f]=a[f])}return r}),bJ=function(r){return function(e,t,n){var i=Object(e);if(!Da(e)){var a=Pa(t);e=wo(e),t=function(s){return a(i[s],s,i)}}var o=r(e,t,n);return o>-1?i[a?e[o]:o]:void 0}},xJ=/^\s+|\s+$/g,wJ=/^[-+]0x[0-9a-f]+$/i,EJ=/^0b[01]+$/i,_J=/^0o[0-7]+$/i,SJ=parseInt,MJ=function(r){if(typeof r=="number")return r;if(vs(r))return NaN;if(Gn(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Gn(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(xJ,"");var t=EJ.test(r);return t||_J.test(r)?SJ(r.slice(2),t?2:8):wJ.test(r)?NaN:+r},Zd=function(r){return r?(r=MJ(r))===1/0||r===-1/0?17976931348623157e292*(r<0?-1:1):r==r?r:0:r===0?r:0},CJ=function(r){var e=Zd(r),t=e%1;return e==e?t?e-t:e:0},AJ=Math.max,TJ=bJ(function(r,e,t){var n=r==null?0:r.length;if(!n)return-1;var i=t==null?0:CJ(t);return i<0&&(i=AJ(n+i,0)),qT(r,Pa(e),i)}),uI=function(r){return r!=null&&r.length?ym(r):[]},IJ=function(r,e){return r==null?r:fm(r,yT(e),ls)},kJ=function(r){var e=r==null?0:r.length;return e?r[e-1]:void 0},LJ=function(r,e){var t={};return e=Pa(e),lm(r,function(n,i,a){Pd(t,i,e(n,i,a))}),t},wm=function(r,e,t){for(var n=-1,i=r.length;++n<i;){var a=r[n],o=e(a);if(o!=null&&(s===void 0?o==o&&!vs(o):t(o,s)))var s=o,u=a}return u},NJ=function(r,e){return r>e},OJ=function(r){return r&&r.length?wm(r,ds,NJ):void 0},Em=function(r,e,t){(t!==void 0&&!bu(r[e],t)||t===void 0&&!(e in r))&&Pd(r,e,t)},DJ=Function.prototype,PJ=Object.prototype,fI=DJ.toString,RJ=PJ.hasOwnProperty,BJ=fI.call(Object),FJ=function(r){if(!ki(r)||xo(r)!="[object Object]")return!1;var e=zd(r);if(e===null)return!0;var t=RJ.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&fI.call(t)==BJ},lI=function(r,e){if((e!=="constructor"||typeof r[e]!="function")&&e!="__proto__")return r[e]},GJ=function(r){return pl(r,ls(r))},zJ=function(r,e,t,n,i,a,o){var s=lI(r,t),u=lI(e,t),f=o.get(u);if(f)Em(r,t,f);else{var l=void 0,c=l===void 0;if(c){var h=Rr(u),d=!h&&fs(u),v=!h&&!d&&gl(u);l=u,h||d||v?Rr(s)?l=s:ZT(s)?l=rT(s):d?(c=!1,l=tT(u,!0)):v?(c=!1,l=lT(u,!0)):l=[]:FJ(u)||Mu(u)?(l=s,Mu(s)?l=GJ(s):Gn(s)&&!hl(s)||(l=dT(u))):c=!1}c&&(o.set(u,l),i(l,u,n,a,o),o.delete(u)),Em(r,t,l)}},$J=function r(e,t,n,i,a){e!==t&&fm(t,function(o,s){if(a||(a=new Su),Gn(o))zJ(e,t,s,n,r,i,a);else{var u=void 0;u===void 0&&(u=o),Em(e,s,u)}},ls)},jJ=function(r){return Wd(function(e,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&bl(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var s=t[n];s&&r(e,s,n,a)}return e})}(function(r,e,t){$J(r,e,t)}),cI=function(r,e){return r<e},UJ=function(r){return r&&r.length?wm(r,ds,cI):void 0},XJ=function(r,e){return r&&r.length?wm(r,Pa(e),cI):void 0},YJ=function(){return Ii.Date.now()},WJ=function(r,e,t,n){if(!Gn(r))return r;for(var i=-1,a=(e=Xd(e,r)).length,o=a-1,s=r;s!=null&&++i<a;){var u=yl(e[i]),f=t;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=o){var l=s[u];(f=void 0)==void 0&&(f=Gn(l)?l:Bd(e[i+1])?[]:{})}Rd(s,u,f),s=s[u]}return r},VJ=function(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],s=Yd(r,o);t(s,o)&&WJ(a,Xd(o,r),s)}return a},HJ=function(r,e){return VJ(r,e,function(t,n){return NT(r,n)})},qJ=function(r){return HT(VT(r,void 0,uI),r+"")}(function(r,e){return r==null?{}:HJ(r,e)}),ZJ=Math.ceil,KJ=Math.max,QJ=function(r,e,t,n){for(var i=-1,a=KJ(ZJ((e-r)/(t||1)),0),o=Array(a);a--;)o[++i]=r,r+=t;return o},JJ=function(r){return function(e,t,n){return n&&typeof n!="number"&&bl(e,t,n)&&(t=n=void 0),e=Zd(e),t===void 0?(t=e,e=0):t=Zd(t),n=n===void 0?e<t?1:-1:Zd(n),QJ(e,t,n)}}(),eee=function(r,e){var t=r.length;for(r.sort(e);t--;)r[t]=r[t].value;return r},tee=function(r,e){if(r!==e){var t=r!==void 0,n=r===null,i=r==r,a=vs(r),o=e!==void 0,s=e===null,u=e==e,f=vs(e);if(!s&&!f&&!a&&r>e||a&&o&&u&&!s&&!f||n&&o&&u||!t&&u||!i)return 1;if(!n&&!a&&!f&&r<e||f&&t&&i&&!n&&!a||s&&t&&i||!o&&i||!u)return-1}return 0},ree=function(r,e,t){for(var n=-1,i=r.criteria,a=e.criteria,o=i.length,s=t.length;++n<o;){var u=tee(i[n],a[n]);if(u)return n>=s?u:u*(t[n]=="desc"?-1:1)}return r.index-e.index},nee=function(r,e,t){e=e.length?Tu(e,function(a){return Rr(a)?function(o){return Yd(o,a.length===1?a[0]:a)}:a}):[ds];var n=-1;e=Tu(e,Fd(Pa));var i=BT(r,function(a,o,s){return{criteria:Tu(e,function(u){return u(a)}),index:++n,value:a}});return eee(i,function(a,o){return ree(a,o,t)})},iee=Wd(function(r,e){if(r==null)return[];var t=e.length;return t>1&&bl(r,e[0],e[1])?e=[]:t>2&&bl(e[0],e[1],e[2])&&(e=[e[0]]),nee(r,ym(e),[])}),aee=0,oee=function(r){var e=++aee;return kT(r)+e},see=function(r,e,t){for(var n=-1,i=r.length,a=e.length,o={};++n<i;){var s=n<a?e[n]:void 0;t(o,r[n],s)}return o},Kd,uee=function(r,e){return see(r||[],e||[],Rd)};try{Kd={cloneDeep:gJ,constant:um,defaults:mJ,each:bT,filter:DT,find:TJ,flatten:uI,forEach:mT,forIn:IJ,has:PT,isUndefined:RT,last:kJ,map:FT,mapValues:LJ,max:OJ,merge:jJ,min:UJ,minBy:XJ,now:YJ,pick:qJ,range:JJ,reduce:GT,sortBy:iee,uniqueId:oee,values:KT,zipObject:uee}}catch{}Kd||(Kd=window._);var K=Kd,fee=Qd;function Qd(){var r={};r._next=r._prev=r,this._sentinel=r}function hI(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function lee(r,e){if(r!=="_next"&&r!=="_prev")return e}Qd.prototype.dequeue=function(){var r=this._sentinel,e=r._prev;if(e!==r)return hI(e),e},Qd.prototype.enqueue=function(r){var e=this._sentinel;r._prev&&r._next&&hI(r),r._next=e._next,e._next._prev=r,e._next=r,r._prev=e},Qd.prototype.toString=function(){for(var r=[],e=this._sentinel,t=e._prev;t!==e;)r.push(JSON.stringify(t,lee)),t=t._prev;return"["+r.join(", ")+"]"};var cee=Li.Graph,hee=function(r,e){if(r.nodeCount()<=1)return[];var t=function(i,a){var o=new cee,s=0,u=0;K.forEach(i.nodes(),function(c){o.setNode(c,{v:c,in:0,out:0})}),K.forEach(i.edges(),function(c){var h=o.edge(c.v,c.w)||0,d=a(c),v=h+d;o.setEdge(c.v,c.w,v),u=Math.max(u,o.node(c.v).out+=d),s=Math.max(s,o.node(c.w).in+=d)});var f=K.range(u+s+3).map(function(){return new fee}),l=s+1;return K.forEach(o.nodes(),function(c){Sm(f,l,o.node(c))}),{graph:o,buckets:f,zeroIdx:l}}(r,e||dee),n=function(i,a,o){for(var s,u=[],f=a[a.length-1],l=a[0];i.nodeCount();){for(;s=l.dequeue();)_m(i,a,o,s);for(;s=f.dequeue();)_m(i,a,o,s);if(i.nodeCount()){for(var c=a.length-2;c>0;--c)if(s=a[c].dequeue()){u=u.concat(_m(i,a,o,s,!0));break}}}return u}(t.graph,t.buckets,t.zeroIdx);return K.flatten(K.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)},dee=K.constant(1);function _m(r,e,t,n,i){var a=i?[]:void 0;return K.forEach(r.inEdges(n.v),function(o){var s=r.edge(o),u=r.node(o.v);i&&a.push({v:o.v,w:o.w}),u.out-=s,Sm(e,t,u)}),K.forEach(r.outEdges(n.v),function(o){var s=r.edge(o),u=o.w,f=r.node(u);f.in-=s,Sm(e,t,f)}),r.removeNode(n.v),a}function Sm(r,e,t){t.out?t.in?r[t.out-t.in+e].enqueue(t):r[r.length-1].enqueue(t):r[0].enqueue(t)}var dI={run:function(r){var e=r.graph().acyclicer==="greedy"?hee(r,function(t){return function(n){return t.edge(n).weight}}(r)):function(t){var n=[],i={},a={};function o(s){K.has(a,s)||(a[s]=!0,i[s]=!0,K.forEach(t.outEdges(s),function(u){K.has(i,u.w)?n.push(u):o(u.w)}),delete i[s])}return K.forEach(t.nodes(),o),n}(r);K.forEach(e,function(t){var n=r.edge(t);r.removeEdge(t),n.forwardName=t.name,n.reversed=!0,r.setEdge(t.w,t.v,n,K.uniqueId("rev"))})},undo:function(r){K.forEach(r.edges(),function(e){var t=r.edge(e);if(t.reversed){r.removeEdge(e);var n=t.forwardName;delete t.reversed,delete t.forwardName,r.setEdge(e.w,e.v,t,n)}})}},vI=Li.Graph,vn={addDummyNode:pI,simplify:function(r){var e=new vI().setGraph(r.graph());return K.forEach(r.nodes(),function(t){e.setNode(t,r.node(t))}),K.forEach(r.edges(),function(t){var n=e.edge(t.v,t.w)||{weight:0,minlen:1},i=r.edge(t);e.setEdge(t.v,t.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e},asNonCompoundGraph:function(r){var e=new vI({multigraph:r.isMultigraph()}).setGraph(r.graph());return K.forEach(r.nodes(),function(t){r.children(t).length||e.setNode(t,r.node(t))}),K.forEach(r.edges(),function(t){e.setEdge(t,r.edge(t))}),e},successorWeights:function(r){var e=K.map(r.nodes(),function(t){var n={};return K.forEach(r.outEdges(t),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return K.zipObject(r.nodes(),e)},predecessorWeights:function(r){var e=K.map(r.nodes(),function(t){var n={};return K.forEach(r.inEdges(t),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return K.zipObject(r.nodes(),e)},intersectRect:function(r,e){var t,n,i=r.x,a=r.y,o=e.x-i,s=e.y-a,u=r.width/2,f=r.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*u>Math.abs(o)*f?(s<0&&(f=-f),t=f*o/s,n=f):(o<0&&(u=-u),t=u,n=u*s/o),{x:i+t,y:a+n}},buildLayerMatrix:function(r){var e=K.map(K.range(gI(r)+1),function(){return[]});return K.forEach(r.nodes(),function(t){var n=r.node(t),i=n.rank;K.isUndefined(i)||(e[i][n.order]=t)}),e},normalizeRanks:function(r){var e=K.min(K.map(r.nodes(),function(t){return r.node(t).rank}));K.forEach(r.nodes(),function(t){var n=r.node(t);K.has(n,"rank")&&(n.rank-=e)})},removeEmptyRanks:function(r){var e=K.min(K.map(r.nodes(),function(a){return r.node(a).rank})),t=[];K.forEach(r.nodes(),function(a){var o=r.node(a).rank-e;t[o]||(t[o]=[]),t[o].push(a)});var n=0,i=r.graph().nodeRankFactor;K.forEach(t,function(a,o){K.isUndefined(a)&&o%i!=0?--n:n&&K.forEach(a,function(s){r.node(s).rank+=n})})},addBorderNode:function(r,e,t,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=t,i.order=n),pI(r,"border",i,e)},maxRank:gI,partition:function(r,e){var t={lhs:[],rhs:[]};return K.forEach(r,function(n){e(n)?t.lhs.push(n):t.rhs.push(n)}),t},time:function(r,e){var t=K.now();try{return e()}finally{console.log(r+" time: "+(K.now()-t)+"ms")}},notime:function(r,e){return e()}};function pI(r,e,t,n){var i;do i=K.uniqueId(n);while(r.hasNode(i));return t.dummy=e,r.setNode(i,t),i}function gI(r){return K.max(K.map(r.nodes(),function(e){var t=r.node(e).rank;if(!K.isUndefined(t))return t}))}var yI={run:function(r){r.graph().dummyChains=[],K.forEach(r.edges(),function(e){(function(t,n){var i,a,o,s=n.v,u=t.node(s).rank,f=n.w,l=t.node(f).rank,c=n.name,h=t.edge(n),d=h.labelRank;if(l!==u+1){for(t.removeEdge(n),o=0,++u;u<l;++o,++u)h.points=[],a={width:0,height:0,edgeLabel:h,edgeObj:n,rank:u},i=vn.addDummyNode(t,"edge",a,"_d"),u===d&&(a.width=h.width,a.height=h.height,a.dummy="edge-label",a.labelpos=h.labelpos),t.setEdge(s,i,{weight:h.weight},c),o===0&&t.graph().dummyChains.push(i),s=i;t.setEdge(s,f,{weight:h.weight},c)}})(r,e)})},undo:function(r){K.forEach(r.graph().dummyChains,function(e){var t,n=r.node(e),i=n.edgeLabel;for(r.setEdge(n.edgeObj,i);n.dummy;)t=r.successors(e)[0],r.removeNode(e),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),e=t,n=r.node(e)})}},mI=function(r){var e={};K.forEach(r.sources(),function t(n){var i=r.node(n);if(K.has(e,n))return i.rank;e[n]=!0;var a=K.min(K.map(r.outEdges(n),function(o){return t(o.w)-r.edge(o).minlen}));return a!==Number.POSITIVE_INFINITY&&a!=null||(a=0),i.rank=a})},bI=function(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen},vee=Li.Graph,Jd=bI,xI=function(r){var e,t,n=new vee({directed:!1}),i=r.nodes()[0],a=r.nodeCount();for(n.setNode(i,{});pee(n,r)<a;)e=gee(n,r),t=n.hasNode(e.v)?Jd(r,e):-Jd(r,e),yee(n,r,t);return n};function pee(r,e){return K.forEach(r.nodes(),function t(n){K.forEach(e.nodeEdges(n),function(i){var a=i.v,o=n===a?i.w:a;r.hasNode(o)||Jd(e,i)||(r.setNode(o,{}),r.setEdge(n,o,{}),t(o))})}),r.nodeCount()}function gee(r,e){return K.minBy(e.edges(),function(t){if(r.hasNode(t.v)!==r.hasNode(t.w))return Jd(e,t)})}function yee(r,e,t){K.forEach(r.nodes(),function(n){e.node(n).rank+=t})}var mee=bI,bee=mI,xee=Li.alg.preorder,wee=Li.alg.postorder,Eee=vn.simplify,_ee=ps;function ps(r){r=Eee(r),bee(r);var e,t=xI(r);for(Cm(t),Mm(t,r);e=_I(t);)MI(t,r,e,SI(t,r,e))}function Mm(r,e){var t=wee(r,r.nodes());t=t.slice(0,t.length-1),K.forEach(t,function(n){(function(i,a,o){var s=i.node(o).parent;i.edge(o,s).cutvalue=wI(i,a,o)})(r,e,n)})}function wI(r,e,t){var n=r.node(t).parent,i=!0,a=e.edge(t,n),o=0;return a||(i=!1,a=e.edge(n,t)),o=a.weight,K.forEach(e.nodeEdges(t),function(s){var u,f,l=s.v===t,c=l?s.w:s.v;if(c!==n){var h=l===i,d=e.edge(s).weight;if(o+=h?d:-d,u=t,f=c,r.hasEdge(u,f)){var v=r.edge(t,c).cutvalue;o+=h?-v:v}}}),o}function Cm(r,e){arguments.length<2&&(e=r.nodes()[0]),EI(r,{},1,e)}function EI(r,e,t,n,i){var a=t,o=r.node(n);return e[n]=!0,K.forEach(r.neighbors(n),function(s){K.has(e,s)||(t=EI(r,e,t,s,n))}),o.low=a,o.lim=t++,i?o.parent=i:delete o.parent,t}function _I(r){return K.find(r.edges(),function(e){return r.edge(e).cutvalue<0})}function SI(r,e,t){var n=t.v,i=t.w;e.hasEdge(n,i)||(n=t.w,i=t.v);var a=r.node(n),o=r.node(i),s=a,u=!1;a.lim>o.lim&&(s=o,u=!0);var f=K.filter(e.edges(),function(l){return u===CI(r,r.node(l.v),s)&&u!==CI(r,r.node(l.w),s)});return K.minBy(f,function(l){return mee(e,l)})}function MI(r,e,t,n){var i=t.v,a=t.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),Cm(r),Mm(r,e),function(o,s){var u=K.find(o.nodes(),function(l){return!s.node(l).parent}),f=xee(o,u);f=f.slice(1),K.forEach(f,function(l){var c=o.node(l).parent,h=s.edge(l,c),d=!1;h||(h=s.edge(c,l),d=!0),s.node(l).rank=s.node(c).rank+(d?h.minlen:-h.minlen)})}(r,e)}function CI(r,e,t){return t.low<=e.lim&&e.lim<=t.lim}ps.initLowLimValues=Cm,ps.initCutValues=Mm,ps.calcCutValue=wI,ps.leaveEdge=_I,ps.enterEdge=SI,ps.exchangeEdges=MI;var AI=mI,See=function(r){switch(r.graph().ranker){case"network-simplex":TI(r);break;case"tight-tree":(function(e){AI(e),xI(e)})(r);break;case"longest-path":Mee(r);break;default:TI(r)}},Mee=AI;function TI(r){_ee(r)}var Cee=function(r){var e=function(t){var n={},i=0;function a(o){var s=i;K.forEach(t.children(o),a),n[o]={low:s,lim:i++}}return K.forEach(t.children(),a),n}(r);K.forEach(r.graph().dummyChains,function(t){for(var n=r.node(t),i=n.edgeObj,a=function(c,h,d,v){var p,g,y=[],m=[],b=Math.min(h[d].low,h[v].low),x=Math.max(h[d].lim,h[v].lim);p=d;do p=c.parent(p),y.push(p);while(p&&(h[p].low>b||x>h[p].lim));for(g=p,p=v;(p=c.parent(p))!==g;)m.push(p);return{path:y.concat(m.reverse()),lca:g}}(r,e,i.v,i.w),o=a.path,s=a.lca,u=0,f=o[u],l=!0;t!==i.w;){if(n=r.node(t),l){for(;(f=o[u])!==s&&r.node(f).maxRank<n.rank;)u++;f===s&&(l=!1)}if(!l){for(;u<o.length-1&&r.node(f=o[u+1]).minRank<=n.rank;)u++;f=o[u]}r.setParent(t,f),t=r.successors(t)[0]}})},II={run:function(r){var e=vn.addDummyNode(r,"root",{},"_root"),t=function(o){var s={};function u(f,l){var c=o.children(f);c&&c.length&&K.forEach(c,function(h){u(h,l+1)}),s[f]=l}return K.forEach(o.children(),function(f){u(f,1)}),s}(r),n=K.max(K.values(t))-1,i=2*n+1;r.graph().nestingRoot=e,K.forEach(r.edges(),function(o){r.edge(o).minlen*=i});var a=function(o){return K.reduce(o.edges(),function(s,u){return s+o.edge(u).weight},0)}(r)+1;K.forEach(r.children(),function(o){kI(r,e,i,a,n,t,o)}),r.graph().nodeRankFactor=i},cleanup:function(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,K.forEach(r.edges(),function(t){r.edge(t).nestingEdge&&r.removeEdge(t)})}};function kI(r,e,t,n,i,a,o){var s=r.children(o);if(s.length){var u=vn.addBorderNode(r,"_bt"),f=vn.addBorderNode(r,"_bb"),l=r.node(o);r.setParent(u,o),l.borderTop=u,r.setParent(f,o),l.borderBottom=f,K.forEach(s,function(c){kI(r,e,t,n,i,a,c);var h=r.node(c),d=h.borderTop?h.borderTop:c,v=h.borderBottom?h.borderBottom:c,p=h.borderTop?n:2*n,g=d!==v?1:i-a[o]+1;r.setEdge(u,d,{weight:p,minlen:g,nestingEdge:!0}),r.setEdge(v,f,{weight:p,minlen:g,nestingEdge:!0})}),r.parent(o)||r.setEdge(e,u,{weight:0,minlen:i+a[o]})}else o!==e&&r.setEdge(e,o,{weight:0,minlen:t})}var Aee=function(r){K.forEach(r.children(),function e(t){var n=r.children(t),i=r.node(t);if(n.length&&K.forEach(n,e),K.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)LI(r,"borderLeft","_bl",t,i,a),LI(r,"borderRight","_br",t,i,a)}})};function LI(r,e,t,n,i,a){var o={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=vn.addDummyNode(r,"border",o,t);i[e][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})}var NI={adjust:function(r){var e=r.graph().rankdir.toLowerCase();e!=="lr"&&e!=="rl"||OI(r)},undo:function(r){var e=r.graph().rankdir.toLowerCase();e!=="bt"&&e!=="rl"||function(t){K.forEach(t.nodes(),function(n){Am(t.node(n))}),K.forEach(t.edges(),function(n){var i=t.edge(n);K.forEach(i.points,Am),K.has(i,"y")&&Am(i)})}(r),e!=="lr"&&e!=="rl"||(function(t){K.forEach(t.nodes(),function(n){Tm(t.node(n))}),K.forEach(t.edges(),function(n){var i=t.edge(n);K.forEach(i.points,Tm),K.has(i,"x")&&Tm(i)})}(r),OI(r))}};function OI(r){K.forEach(r.nodes(),function(e){DI(r.node(e))}),K.forEach(r.edges(),function(e){DI(r.edge(e))})}function DI(r){var e=r.width;r.width=r.height,r.height=e}function Am(r){r.y=-r.y}function Tm(r){var e=r.x;r.x=r.y,r.y=e}var Tee=function(r){var e={},t=K.filter(r.nodes(),function(s){return!r.children(s).length}),n=K.max(K.map(t,function(s){return r.node(s).rank})),i=K.map(K.range(n+1),function(){return[]});function a(s){if(!K.has(e,s)){e[s]=!0;var u=r.node(s);i[u.rank].push(s),K.forEach(r.successors(s),a)}}var o=K.sortBy(t,function(s){return r.node(s).rank});return K.forEach(o,a),i},Iee=function(r,e){for(var t=0,n=1;n<e.length;++n)t+=kee(r,e[n-1],e[n]);return t};function kee(r,e,t){for(var n=K.zipObject(t,K.map(t,function(f,l){return l})),i=K.flatten(K.map(e,function(f){return K.sortBy(K.map(r.outEdges(f),function(l){return{pos:n[l.w],weight:r.edge(l).weight}}),"pos")}),!0),a=1;a<t.length;)a<<=1;var o=2*a-1;a-=1;var s=K.map(new Array(o),function(){return 0}),u=0;return K.forEach(i.forEach(function(f){var l=f.pos+a;s[l]+=f.weight;for(var c=0;l>0;)l%2&&(c+=s[l+1]),s[l=l-1>>1]+=f.weight;u+=f.weight*c})),u}var Lee=function(r,e){return K.map(e,function(t){var n=r.inEdges(t);if(n.length){var i=K.reduce(n,function(a,o){var s=r.edge(o),u=r.node(o.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:t,barycenter:i.sum/i.weight,weight:i.weight}}return{v:t}})},Nee=function(r,e){var t={};return K.forEach(r,function(n,i){var a=t[n.v]={indegree:0,in:[],out:[],vs:[n.v],i};K.isUndefined(n.barycenter)||(a.barycenter=n.barycenter,a.weight=n.weight)}),K.forEach(e.edges(),function(n){var i=t[n.v],a=t[n.w];K.isUndefined(i)||K.isUndefined(a)||(a.indegree++,i.out.push(t[n.w]))}),function(n){var i=[];function a(u){return function(f){f.merged||(K.isUndefined(f.barycenter)||K.isUndefined(u.barycenter)||f.barycenter>=u.barycenter)&&function(l,c){var h=0,d=0;l.weight&&(h+=l.barycenter*l.weight,d+=l.weight),c.weight&&(h+=c.barycenter*c.weight,d+=c.weight),l.vs=c.vs.concat(l.vs),l.barycenter=h/d,l.weight=d,l.i=Math.min(c.i,l.i),c.merged=!0}(u,f)}}function o(u){return function(f){f.in.push(u),--f.indegree==0&&n.push(f)}}for(;n.length;){var s=n.pop();i.push(s),K.forEach(s.in.reverse(),a(s)),K.forEach(s.out,o(s))}return K.map(K.filter(i,function(u){return!u.merged}),function(u){return K.pick(u,["vs","i","barycenter","weight"])})}(K.filter(t,function(n){return!n.indegree}))},Oee=function(r,e){var t=vn.partition(r,function(c){return K.has(c,"barycenter")}),n=t.lhs,i=K.sortBy(t.rhs,function(c){return-c.i}),a=[],o=0,s=0,u=0;n.sort((f=!!e,function(c,h){return c.barycenter<h.barycenter?-1:c.barycenter>h.barycenter?1:f?h.i-c.i:c.i-h.i})),u=PI(a,i,u),K.forEach(n,function(c){u+=c.vs.length,a.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=PI(a,i,u)});var f,l={vs:K.flatten(a,!0)};return s&&(l.barycenter=o/s,l.weight=s),l};function PI(r,e,t){for(var n;e.length&&(n=K.last(e)).i<=t;)e.pop(),r.push(n.vs),t++;return t}var Dee=function r(e,t,n,i){var a=e.children(t),o=e.node(t),s=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};s&&(a=K.filter(a,function(p){return p!==s&&p!==u}));var l=Lee(e,a);K.forEach(l,function(p){if(e.children(p.v).length){var g=r(e,p.v,n,i);f[p.v]=g,K.has(g,"barycenter")&&(y=p,m=g,K.isUndefined(y.barycenter)?(y.barycenter=m.barycenter,y.weight=m.weight):(y.barycenter=(y.barycenter*y.weight+m.barycenter*m.weight)/(y.weight+m.weight),y.weight+=m.weight))}var y,m});var c=Nee(l,n);(function(p,g){K.forEach(p,function(y){y.vs=K.flatten(y.vs.map(function(m){return g[m]?g[m].vs:m}),!0)})})(c,f);var h=Oee(c,i);if(s&&(h.vs=K.flatten([s,h.vs,u],!0),e.predecessors(s).length)){var d=e.node(e.predecessors(s)[0]),v=e.node(e.predecessors(u)[0]);K.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+v.order)/(h.weight+2),h.weight+=2}return h},Pee=Li.Graph,Ree=function(r,e,t){var n=function(a){for(var o;a.hasNode(o=K.uniqueId("_root")););return o}(r),i=new Pee({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return K.forEach(r.nodes(),function(a){var o=r.node(a),s=r.parent(a);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||n),K.forEach(r[t](a),function(u){var f=u.v===a?u.w:u.v,l=i.edge(f,a),c=K.isUndefined(l)?0:l.weight;i.setEdge(f,a,{weight:r.edge(u).weight+c})}),K.has(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),i},Bee=function(r,e,t){var n,i={};K.forEach(t,function(a){for(var o,s,u=r.parent(a);u;){if((o=r.parent(u))?(s=i[o],i[o]=u):(s=n,n=u),s&&s!==u)return void e.setEdge(s,u);u=o}})},Fee=Li.Graph,Gee=function(r){var e=vn.maxRank(r),t=RI(r,K.range(1,e+1),"inEdges"),n=RI(r,K.range(e-1,-1,-1),"outEdges"),i=Tee(r);BI(r,i);for(var a,o=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){zee(s%2?t:n,s%4>=2),i=vn.buildLayerMatrix(r);var f=Iee(r,i);f<o&&(u=0,a=K.cloneDeep(i),o=f)}BI(r,a)};function RI(r,e,t){return K.map(e,function(n){return Ree(r,n,t)})}function zee(r,e){var t=new Fee;K.forEach(r,function(n){var i=n.graph().root,a=Dee(n,i,t,e);K.forEach(a.vs,function(o,s){n.node(o).order=s}),Bee(n,t,a.vs)})}function BI(r,e){K.forEach(e,function(t){K.forEach(t,function(n,i){r.node(n).order=i})})}var $ee=Li.Graph,jee=function(r){var e,t=vn.buildLayerMatrix(r),n=K.merge(Uee(r,t),Xee(r,t)),i={};K.forEach(["u","d"],function(o){e=o==="u"?t:K.values(t).reverse(),K.forEach(["l","r"],function(s){s==="r"&&(e=K.map(e,function(c){return K.values(c).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),f=Wee(r,e,n,u),l=Vee(r,e,f.root,f.align,s==="r");s==="r"&&(l=K.mapValues(l,function(c){return-c})),i[o+s]=l})});var a=Hee(r,i);return qee(i,a),Zee(i,r.graph().align)};function Uee(r,e){var t={};return K.reduce(e,function(n,i){var a=0,o=0,s=n.length,u=K.last(i);return K.forEach(i,function(f,l){var c=function(d,v){if(d.node(v).dummy)return K.find(d.predecessors(v),function(p){return d.node(p).dummy})}(r,f),h=c?r.node(c).order:s;(c||f===u)&&(K.forEach(i.slice(o,l+1),function(d){K.forEach(r.predecessors(d),function(v){var p=r.node(v),g=p.order;!(g<a||h<g)||p.dummy&&r.node(d).dummy||FI(t,v,d)})}),o=l+1,a=h)}),i}),t}function Xee(r,e){var t={};function n(i,a,o,s,u){var f;K.forEach(K.range(a,o),function(l){f=i[l],r.node(f).dummy&&K.forEach(r.predecessors(f),function(c){var h=r.node(c);h.dummy&&(h.order<s||h.order>u)&&FI(t,c,f)})})}return K.reduce(e,function(i,a){var o,s=-1,u=0;return K.forEach(a,function(f,l){if(r.node(f).dummy==="border"){var c=r.predecessors(f);c.length&&(o=r.node(c[0]).order,n(a,u,l,s,o),u=l,s=o)}n(a,u,a.length,o,i.length)}),a}),t}function FI(r,e,t){if(e>t){var n=e;e=t,t=n}var i=r[e];i||(r[e]=i={}),i[t]=!0}function Yee(r,e,t){if(e>t){var n=e;e=t,t=n}return K.has(r[e],t)}function Wee(r,e,t,n){var i={},a={},o={};return K.forEach(e,function(s){K.forEach(s,function(u,f){i[u]=u,a[u]=u,o[u]=f})}),K.forEach(e,function(s){var u=-1;K.forEach(s,function(f){var l=n(f);if(l.length)for(var c=((l=K.sortBy(l,function(p){return o[p]})).length-1)/2,h=Math.floor(c),d=Math.ceil(c);h<=d;++h){var v=l[h];a[f]===f&&u<o[v]&&!Yee(t,f,v)&&(a[v]=f,a[f]=i[f]=i[v],u=o[v])}})}),{root:i,align:a}}function Vee(r,e,t,n,i){var a={},o=function(f,l,c,h){var d=new $ee,v=f.graph(),p=function(g,y,m){return function(b,x,w){var E,_=b.node(x),M=b.node(w),C=0;if(C+=_.width/2,K.has(_,"labelpos"))switch(_.labelpos.toLowerCase()){case"l":E=-_.width/2;break;case"r":E=_.width/2}if(E&&(C+=m?E:-E),E=0,C+=(_.dummy?y:g)/2,C+=(M.dummy?y:g)/2,C+=M.width/2,K.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":E=M.width/2;break;case"r":E=-M.width/2}return E&&(C+=m?E:-E),E=0,C}}(v.nodesep,v.edgesep,h);return K.forEach(l,function(g){var y;K.forEach(g,function(m){var b=c[m];if(d.setNode(b),y){var x=c[y],w=d.edge(x,b);d.setEdge(x,b,Math.max(p(f,m,y),w||0))}y=m})}),d}(r,e,t,i),s=i?"borderLeft":"borderRight";function u(f,l){for(var c=o.nodes(),h=c.pop(),d={};h;)d[h]?f(h):(d[h]=!0,c.push(h),c=c.concat(l(h))),h=c.pop()}return u(function(f){a[f]=o.inEdges(f).reduce(function(l,c){return Math.max(l,a[c.v]+o.edge(c))},0)},o.predecessors.bind(o)),u(function(f){var l=o.outEdges(f).reduce(function(h,d){return Math.min(h,a[d.w]-o.edge(d))},Number.POSITIVE_INFINITY),c=r.node(f);l!==Number.POSITIVE_INFINITY&&c.borderType!==s&&(a[f]=Math.max(a[f],l))},o.successors.bind(o)),K.forEach(n,function(f){a[f]=a[t[f]]}),a}function Hee(r,e){return K.minBy(K.values(e),function(t){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return K.forIn(t,function(a,o){var s=function(u,f){return u.node(f).width}(r,o)/2;n=Math.max(a+s,n),i=Math.min(a-s,i)}),n-i})}function qee(r,e){var t=K.values(e),n=K.min(t),i=K.max(t);K.forEach(["u","d"],function(a){K.forEach(["l","r"],function(o){var s,u=a+o,f=r[u];if(f!==e){var l=K.values(f);(s=o==="l"?n-K.min(l):i-K.max(l))&&(r[u]=K.mapValues(f,function(c){return c+s}))}})})}function Zee(r,e){return K.mapValues(r.ul,function(t,n){if(e)return r[e.toLowerCase()][n];var i=K.sortBy(K.map(r,n));return(i[1]+i[2])/2})}var Kee=jee,Qee=function(r){(function(e){var t=vn.buildLayerMatrix(e),n=e.graph().ranksep,i=0;K.forEach(t,function(a){var o=K.max(K.map(a,function(s){return e.node(s).height}));K.forEach(a,function(s){e.node(s).y=i+o/2}),i+=o+n})})(r=vn.asNonCompoundGraph(r)),K.forEach(Kee(r),function(e,t){r.node(t).x=e})},Jee=vn.normalizeRanks,ete=vn.removeEmptyRanks,Eo=vn,tte=Li.Graph,rte=function(r,e){var t=e&&e.debugTiming?Eo.time:Eo.notime;t("layout",function(){var n=t("  buildLayoutGraph",function(){return function(i){var a=new tte({multigraph:!0,compound:!0}),o=km(i.graph());return a.setGraph(K.merge({},ite,Im(o,nte),K.pick(o,ate))),K.forEach(i.nodes(),function(s){var u=km(i.node(s));a.setNode(s,K.defaults(Im(u,ote),ste)),a.setParent(s,i.parent(s))}),K.forEach(i.edges(),function(s){var u=km(i.edge(s));a.setEdge(s,K.merge({},fte,Im(u,ute),K.pick(u,lte)))}),a}(r)});t("  runLayout",function(){(function(i,a){a("    makeSpaceForEdgeLabels",function(){(function(o){var s=o.graph();s.ranksep/=2,K.forEach(o.edges(),function(u){var f=o.edge(u);f.minlen*=2,f.labelpos.toLowerCase()!=="c"&&(s.rankdir==="TB"||s.rankdir==="BT"?f.width+=f.labeloffset:f.height+=f.labeloffset)})})(i)}),a("    removeSelfEdges",function(){(function(o){K.forEach(o.edges(),function(s){if(s.v===s.w){var u=o.node(s.v);u.selfEdges||(u.selfEdges=[]),u.selfEdges.push({e:s,label:o.edge(s)}),o.removeEdge(s)}})})(i)}),a("    acyclic",function(){dI.run(i)}),a("    nestingGraph.run",function(){II.run(i)}),a("    rank",function(){See(Eo.asNonCompoundGraph(i))}),a("    injectEdgeLabelProxies",function(){(function(o){K.forEach(o.edges(),function(s){var u=o.edge(s);if(u.width&&u.height){var f=o.node(s.v),l={rank:(o.node(s.w).rank-f.rank)/2+f.rank,e:s};Eo.addDummyNode(o,"edge-proxy",l,"_ep")}})})(i)}),a("    removeEmptyRanks",function(){ete(i)}),a("    nestingGraph.cleanup",function(){II.cleanup(i)}),a("    normalizeRanks",function(){Jee(i)}),a("    assignRankMinMax",function(){(function(o){var s=0;K.forEach(o.nodes(),function(u){var f=o.node(u);f.borderTop&&(f.minRank=o.node(f.borderTop).rank,f.maxRank=o.node(f.borderBottom).rank,s=K.max(s,f.maxRank))}),o.graph().maxRank=s})(i)}),a("    removeEdgeLabelProxies",function(){(function(o){K.forEach(o.nodes(),function(s){var u=o.node(s);u.dummy==="edge-proxy"&&(o.edge(u.e).labelRank=u.rank,o.removeNode(s))})})(i)}),a("    normalize.run",function(){yI.run(i)}),a("    parentDummyChains",function(){Cee(i)}),a("    addBorderSegments",function(){Aee(i)}),a("    order",function(){Gee(i)}),a("    insertSelfEdges",function(){(function(o){var s=Eo.buildLayerMatrix(o);K.forEach(s,function(u){var f=0;K.forEach(u,function(l,c){var h=o.node(l);h.order=c+f,K.forEach(h.selfEdges,function(d){Eo.addDummyNode(o,"selfedge",{width:d.label.width,height:d.label.height,rank:h.rank,order:c+ ++f,e:d.e,label:d.label},"_se")}),delete h.selfEdges})})})(i)}),a("    adjustCoordinateSystem",function(){NI.adjust(i)}),a("    position",function(){Qee(i)}),a("    positionSelfEdges",function(){(function(o){K.forEach(o.nodes(),function(s){var u=o.node(s);if(u.dummy==="selfedge"){var f=o.node(u.e.v),l=f.x+f.width/2,c=f.y,h=u.x-l,d=f.height/2;o.setEdge(u.e,u.label),o.removeNode(s),u.label.points=[{x:l+2*h/3,y:c-d},{x:l+5*h/6,y:c-d},{x:l+h,y:c},{x:l+5*h/6,y:c+d},{x:l+2*h/3,y:c+d}],u.label.x=u.x,u.label.y=u.y}})})(i)}),a("    removeBorderNodes",function(){(function(o){K.forEach(o.nodes(),function(s){if(o.children(s).length){var u=o.node(s),f=o.node(u.borderTop),l=o.node(u.borderBottom),c=o.node(K.last(u.borderLeft)),h=o.node(K.last(u.borderRight));u.width=Math.abs(h.x-c.x),u.height=Math.abs(l.y-f.y),u.x=c.x+u.width/2,u.y=f.y+u.height/2}}),K.forEach(o.nodes(),function(s){o.node(s).dummy==="border"&&o.removeNode(s)})})(i)}),a("    normalize.undo",function(){yI.undo(i)}),a("    fixupEdgeLabelCoords",function(){(function(o){K.forEach(o.edges(),function(s){var u=o.edge(s);if(K.has(u,"x"))switch(u.labelpos!=="l"&&u.labelpos!=="r"||(u.width-=u.labeloffset),u.labelpos){case"l":u.x-=u.width/2+u.labeloffset;break;case"r":u.x+=u.width/2+u.labeloffset}})})(i)}),a("    undoCoordinateSystem",function(){NI.undo(i)}),a("    translateGraph",function(){(function(o){var s=Number.POSITIVE_INFINITY,u=0,f=Number.POSITIVE_INFINITY,l=0,c=o.graph(),h=c.marginx||0,d=c.marginy||0;function v(p){var g=p.x,y=p.y,m=p.width,b=p.height;s=Math.min(s,g-m/2),u=Math.max(u,g+m/2),f=Math.min(f,y-b/2),l=Math.max(l,y+b/2)}K.forEach(o.nodes(),function(p){v(o.node(p))}),K.forEach(o.edges(),function(p){var g=o.edge(p);K.has(g,"x")&&v(g)}),s-=h,f-=d,K.forEach(o.nodes(),function(p){var g=o.node(p);g.x-=s,g.y-=f}),K.forEach(o.edges(),function(p){var g=o.edge(p);K.forEach(g.points,function(y){y.x-=s,y.y-=f}),K.has(g,"x")&&(g.x-=s),K.has(g,"y")&&(g.y-=f)}),c.width=u-s+h,c.height=l-f+d})(i)}),a("    assignNodeIntersects",function(){(function(o){K.forEach(o.edges(),function(s){var u,f,l=o.edge(s),c=o.node(s.v),h=o.node(s.w);l.points?(u=l.points[0],f=l.points[l.points.length-1]):(l.points=[],u=h,f=c),l.points.unshift(Eo.intersectRect(c,u)),l.points.push(Eo.intersectRect(h,f))})})(i)}),a("    reversePoints",function(){(function(o){K.forEach(o.edges(),function(s){var u=o.edge(s);u.reversed&&u.points.reverse()})})(i)}),a("    acyclic.undo",function(){dI.undo(i)})})(n,t)}),t("  updateInputGraph",function(){(function(i,a){K.forEach(i.nodes(),function(o){var s=i.node(o),u=a.node(o);s&&(s.x=u.x,s.y=u.y,a.children(o).length&&(s.width=u.width,s.height=u.height))}),K.forEach(i.edges(),function(o){var s=i.edge(o),u=a.edge(o);s.points=u.points,K.has(u,"x")&&(s.x=u.x,s.y=u.y)}),i.graph().width=a.graph().width,i.graph().height=a.graph().height})(r,n)})})},nte=["nodesep","edgesep","ranksep","marginx","marginy"],ite={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ate=["acyclicer","ranker","rankdir","align"],ote=["width","height"],ste={width:0,height:0},ute=["minlen","weight","width","height","labeloffset"],fte={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lte=["labelpos"];function Im(r,e){return K.mapValues(K.pick(r,e),Number)}function km(r){var e={};return K.forEach(r,function(t,n){e[n.toLowerCase()]=t}),e}var cte=Li.Graph,GI={graphlib:Li,layout:rte,debug:{debugOrdering:function(r){var e=vn.buildLayerMatrix(r),t=new cte({compound:!0,multigraph:!0}).setGraph({});return K.forEach(r.nodes(),function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+r.node(n).rank)}),K.forEach(r.edges(),function(n){t.setEdge(n.v,n.w,{},n.name)}),K.forEach(e,function(n,i){var a="layer"+i;t.setNode(a,{rank:"same"}),K.reduce(n,function(o,s){return t.setEdge(o,s,{style:"invis"}),s})}),t}},util:{time:vn.time,notime:vn.notime},version:"0.8.5"},hte=GI.graphlib,dte=GI.layout;class vte{constructor(e){this.cardinality=1,this.include=os.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=Fn.NODE,this.name=e.name,this.attr=e.attr||{},this.inputs=e.inputs,this.path=e.path||[],this.width=e.width,this.height=e.height}}class pte{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}function gte(r){const e=new pte;return r.nodes.map(t=>new vte(t)).forEach(t=>{e.nodes[t.name]=t,t.inputs.forEach(n=>{(function(i,a,o){o.name!==a.name&&i.edges.push(Object.assign(Object.assign({},o.attr),{v:o.name,w:a.name}))})(e,t,n)})}),e}class yte{constructor(e,t={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=os.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=Fn.META,this.path=[],this.name=e,this.metaGraph=Lm(e,mu.META,t)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(e=>this.metaGraph.node(e))}leaves(){let e,t=[],n=[this];for(;n.length;){let i=n.shift();i.isGroupNode?(e=i.metaGraph,e.nodes().forEach(a=>n.push(e.node(a)))):t.push(i.name)}return t}}class mte{constructor(e,t){this.v=e,this.w=t,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,t){this.baseEdgeList.push(e)}}function zI(r,e={}){return new yte(r,e)}function $I(r,e){return new mte(r,e)}function Lm(r,e,t){const n=t||{},i=new hte.Graph(n);return i.setGraph({name:r,rankdir:n.rankdir,type:e,align:n.align}),i}class bte{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=zI(yu,this.graphOptions),this.index[yu]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,t){this.index[e]=t}getBridgeGraph(e){const t=this.index[e];if(!t)throw Error("Could not find node in hierarchy: "+e);if(!("metaGraph"in t))return null;const n=t;if(n.bridgeGraph)return n.bridgeGraph;const i=Lm(UA,mu.BRIDGE,this.graphOptions);if(n.bridgeGraph=i,!t.parentNode||!("metaGraph"in t.parentNode))return i;const a=t.parentNode;return[a.metaGraph,this.getBridgeGraph(a.name)].forEach(o=>{o.edges().filter(s=>s.v===e||s.w===e).forEach(s=>{const u=s.w===e;o.edge(s).baseEdgeList.forEach(f=>{const[l,c]=u?[f.w,s.v]:[f.v,s.w],h=this.getChildName(e,l),d={v:u?c:h,w:u?h:c};let v=i.edge(d);v||(v=$I(d.v,d.w),v.inbound=u,i.setEdge(d.v,d.w,v)),v.addBaseEdge(f,this)})})}),i}getChildName(e,t){let n=this.index[t];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+t)}getPredecessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!0)}getSuccessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!1)}getOneWayEdges(e,t){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const i=e.parentNode,a=i.metaGraph,o=this.getBridgeGraph(i.name);return jI(a,e,t,n),jI(o,e,t,n),n}}function xte(r,e){const{rankDirection:t,align:n}=e,i=new bte({rankdir:t,align:n});return function(a,o){Object.keys(o.nodes).forEach(s=>{const u=o.nodes[s],f=u.path;let l=a.root;l.depth=Math.max(f.length,l.depth);for(let c=0;c<f.length&&(l.depth=Math.max(l.depth,f.length-c),l.cardinality+=u.cardinality,c!==f.length-1);c++){const h=f[c];let d=a.node(h);d||(d=zI(h,a.graphOptions),d.path=u.path.slice(0,c+1),d.parentNode=l,a.setNode(h,d),l.metaGraph.setNode(h,d)),l=d}a.setNode(u.name,u),u.parentNode=l,l.metaGraph.setNode(u.name,u)})}(i,r),function(a,o){const s=a.getNodeMap();let u=[],f=[];const l=(c,h)=>{let d=0;for(;c;)h[d++]=c.name,c=c.parentNode;return d-1};o.edges.forEach(c=>{u=[],f=[];let h=l(o.nodes[c.v],u),d=l(o.nodes[c.w],f);for(;u[h]===f[d];)if(h--,d--,h<0||d<0)throw Error("No difference found between ancestor paths.");const v=s[u[h+1]],p=u[h],g=f[d];let y=v.metaGraph.edge(p,g);y||(y=$I(p,g),v.metaGraph.setEdge(p,g,y)),y.addBaseEdge(c,a)})}(i,r),i}function jI(r,e,t,n){(t?r.inEdges(e.name):r.outEdges(e.name)).forEach(i=>{const a=r.edge(i);n.push(a)})}class wte{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new XI(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(e){if(e in this.hasSubHierarchy)return;this.hasSubHierarchy[e]=!0;const t=this.index[e];if(t.node.type!==Fn.META)return;const n=t,i=n.node.metaGraph,a=n.coreGraph;i.nodes().forEach(l=>{const c=this.getOrCreateRenderNodeByName(l);a.setNode(l,c)}),i.edges().forEach(l=>{const c=i.edge(l),h=new UI(c);a.setEdge(l.v,l.w,h)});const o=n.node.parentNode;if(!o)return;const s=this.getRenderNodeByName(o.name),u=(l,...c)=>c.concat([l?"IN":"OUT"]).join("~~"),f=this.hierarchy.getBridgeGraph(e);f.edges().forEach(l=>{const c=f.edge(l),h=!!i.node(l.w),[d,v]=h?[l.w,l.v]:[l.v,l.w],p=w=>{const E=h?{v:w,w:e}:{v:e,w};return s.coreGraph.edge(E)};let g=p(v);g||(g=p(u(h,v,o.name)));const y=u(h,e),m=u(h,v,e);let b=a.node(m);if(!b){let w=a.node(y);if(!w){const _={name:y,type:Fn.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:os.UNSPECIFIED,inbound:h,attr:{}};w=new ev(_),this.index[y]=w,a.setNode(y,w)}const E={name:m,type:Fn.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:os.UNSPECIFIED,inbound:h,attr:{}};b=new ev(E),this.index[m]=b,a.setNode(m,b),a.setParent(m,y),w.node.cardinality++}const x=new UI(c);x.adjoiningMetaEdge=g,h?a.setEdge(m,d,x):a.setEdge(d,m,x)})}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const t=this.getNodeByName(e);return t?(this.index[e]=t.isGroupNode?new XI(t,this.hierarchy.graphOptions):new ev(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class ev{constructor(e){this.node=e,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=e.width||0,this.height=e.height||0,this.displayName=e.name,this.attr=e.attr}}class UI{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class XI extends ev{constructor(e,t){super(e);const n=e.metaGraph.graph();t.compound=!0,this.coreGraph=Lm(n.name,mu.CORE,t)}}function YI(r,e){r.node.isGroupNode&&function(t,n){const i=Hy(n);t.coreGraph.nodes().map(a=>t.coreGraph.node(a)).forEach(a=>{var o,s,u,f,l,c;const{height:h,width:d}=a;switch(a.node.type){case Fn.NODE:Object.assign(a,i.nodeSize.node),a.height=h||i.nodeSize.node.height,a.width=d||i.nodeSize.node.width;break;case Fn.BRIDGE:Object.assign(a,i.nodeSize.bridge);break;case Fn.META:a.expanded?YI(a,n):(Object.assign(a,i.nodeSize.meta),a.height=i.nodeSize.meta.height,a.width=i.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+a.node.type)}if(!a.expanded){const v=a.attr;(function(p,g=!1){if(p.coreBox.width=p.width,p.coreBox.height=p.height,!g){const y=`${p.displayName}`.length,m=3;p.width=Math.max(p.coreBox.width,y*m)}})(a,n&&(a.node.type===0&&!!(!((s=(o=n==null?void 0:n.nodeSize)===null||o===void 0?void 0:o.meta)===null||s===void 0)&&s.width)||a.node.type===1&&(!!(!((f=(u=n==null?void 0:n.nodeSize)===null||u===void 0?void 0:u.node)===null||f===void 0)&&f.width)||!!v.width)||a.node.type===2&&!!(!((c=(l=n==null?void 0:n.nodeSize)===null||l===void 0?void 0:l.bridge)===null||c===void 0)&&c.width)))}})}(r,e),r.node.type===Fn.META&&function(t,n){const i=Hy(n),a=i.subScene.meta;Object.assign(t,a);const{nodeSep:o,rankSep:s,edgeSep:u,align:f}=i.graph.meta,l={nodesep:o,ranksep:s,edgesep:u,align:f};Object.assign(t.coreBox,function(d,v){const{ranksep:p,nodesep:g,edgesep:y,align:m}=v;Object.assign(d.graph(),{ranksep:p,nodesep:g,edgesep:y,align:m});const b=[];if(d.nodes().forEach(M=>{d.node(M).node.type!==Fn.BRIDGE&&b.push(M)}),!b.length)return{width:0,height:0};dte(d);let x=1/0,w=1/0,E=-1/0,_=-1/0;return b.forEach(M=>{const C=d.node(M),S=.5*C.width,A=C.x-S,T=C.x+S;x=A<x?A:x,E=T>E?T:E;const k=.5*C.height,O=C.y-k,G=C.y+k;w=O<w?O:w,_=G>_?G:_}),d.edges().forEach(M=>{const C=d.edge(M),S=d.node(C.metaEdge.v),A=d.node(C.metaEdge.w);if(C.points.length===3&&function(O){let G=WI(O[0],O[1]);for(let D=1;D<O.length-1;D++){const $=WI(O[D],O[D+1]);if(Math.abs($-G)>1)return!1;G=$}return!0}(C.points)){if(S!=null){const O=S.expanded?S.x:Nm(S);C.points[0].x=O}if(A!=null){const O=A.expanded?A.x:Nm(A);C.points[2].x=O}C.points=[C.points[0],C.points[1]]}const T=C.points[C.points.length-2];A!=null&&(C.points[C.points.length-1]=VI(T,A));const k=C.points[1];S!=null&&(C.points[0]=VI(k,S)),C.points.forEach(O=>{x=O.x<x?O.x:x,E=O.x>E?O.x:E,w=O.y<w?O.y:w,_=O.y>_?O.y:_})}),d.nodes().forEach(M=>{const C=d.node(M);C.x-=x,C.y-=w}),d.edges().forEach(M=>{d.edge(M).points.forEach(C=>{C.x-=x,C.y-=w})}),{width:E-x,height:_-w}}(t.coreGraph,l));let c=0;t.coreGraph.nodeCount()>0&&c++;const h=c<=1?0:c;t.coreBox.width+=h+h,t.coreBox.height=a.labelHeight+t.coreBox.height,t.width=t.coreBox.width+a.paddingLeft+a.paddingRight,t.height=t.paddingTop+t.coreBox.height+t.paddingBottom}(r,e)}function WI(r,e){const t=e.x-r.x,n=e.y-r.y;return 180*Math.atan(n/t)/Math.PI}function Nm(r){return r.expanded?r.x:r.x-r.width/2+0+r.coreBox.width/2}function VI(r,e){const t=e.expanded?e.x:Nm(e),n=e.y,i=r.x-t,a=r.y-n;let o,s,u=e.expanded?e.width:e.coreBox.width,f=e.expanded?e.height:e.coreBox.height;return Math.abs(a)*u/2>Math.abs(i)*f/2?(a<0&&(f=-f),o=a===0?0:f/2*i/a,s=f/2):(i<0&&(u=-u),o=u/2,s=i===0?0:u/2*a/i),{x:t+o,y:n+s}}function Ete(r,e,t){var n,i,a,o;const s=r.nodes.filter((c,h,d)=>d.findIndex(v=>v.id===c.id)!==h).map(c=>c.id);if(s.length)throw new Error(`Duplicated ids found: ${s.join(", ")}`);const u=function(c){const h={nodes:[]},d=c.compound,v=Object.keys(d||{}),p=new Map,g=(m,b=[])=>{if(p.has(m))return p.get(m);for(let x=0;x<v.length;x++){let w=v[x];if(d&&d[w].indexOf(m)!==-1)return b.unshift(w),g(w,b)}return b.length===0&&p.set(m,b),b},y=m=>c.edges.filter(b=>b.w===m).map(b=>({name:b.v}));return c.nodes.forEach(m=>{const b=m.id,x=[...g(b),b];let w=y(b);h.nodes.push({name:b,path:x,inputs:w,width:m.width,height:m.height,attr:Object.assign({},m)})}),h}(r),f=function(c,h){const d=(p,g)=>{for(let y of g.values())if(y.includes(p))return!0;return!1},v=(p,g=[])=>{if(Object.keys(p).length===0)return[...new Set(g)];const y=new Map(Object.keys(p).map(b=>[b,p[b]])),m={};for(let[b,x]of y)d(b,y)?m[b]=x:g=g.concat(b,x);return v(m,g)};return v(c).filter(p=>h.includes(p))}(r.compound||{},(e==null?void 0:e.expanded)||[]),l=function(c,h){return function(d){return new wte(d)}(xte(gte(c),h))}(u,{rankDirection:((i=(n=t==null?void 0:t.graph)===null||n===void 0?void 0:n.meta)===null||i===void 0?void 0:i.rankDir)||(e==null?void 0:e.rankDirection)||Td.graph.meta.rankDir,align:((o=(a=t==null?void 0:t.graph)===null||a===void 0?void 0:a.meta)===null||o===void 0?void 0:o.align)||Td.graph.meta.align});return function(c,h){h.forEach(d=>{const v=c.getRenderInfoNodes().find(y=>y.displayName===d);let p=v&&v.node&&v.node.name||"";const g=c.getRenderNodeByName(p);if(!g)throw new Error(`No nodes found: ${p}`);g.expanded=!0,c.buildSubHierarchy(p)})}(l,f),YI(l.root,t),HI(l.root)}function _te(r,e=!1){const t=JSON.parse(JSON.stringify(r)),n={nodes:[t],edges:[...t.edges]};return t.nodes.forEach(function i(a){(a.type===0||a.type===1)&&n.nodes.push(a),a.type===0&&(n.edges=n.edges.concat(a.edges)),Array.isArray(a.nodes)&&a.nodes.forEach(i)}),e&&n.nodes.forEach(i=>{const a=n.nodes.find(o=>o.id===i.parentNodeName);if(a){const o=a.x-a.width/2+a.paddingLeft,s=a.y-a.height/2+a.labelHeight+a.paddingTop;a.id!==yu&&(i.x+=o,i.y+=s),i.type===0&&i.edges.forEach(u=>{u.points.forEach(f=>{f.x+=i.x-i.width/2+i.paddingLeft,f.y+=i.y-i.height/2+i.labelHeight+i.paddingTop})})}}),n}function Ste(r,e,t,n){var i,a;let o=[];const s=((i=t.find(c=>c.id===r))===null||i===void 0?void 0:i.path)||[],u=((a=t.find(c=>c.id===e))===null||a===void 0?void 0:a.path)||[],f=[yu,...s].slice(0,s.length).reverse(),l=[yu,...u].slice(0,u.length);return f.forEach(c=>{const h=t.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||r)&&v.w===((n==null?void 0:n.w)||e))))}),l.filter(c=>!f.includes(c)).forEach(c=>{const h=t.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||r)&&v.w===((n==null?void 0:n.w)||e))))}),o}function HI(r){const e=r.coreGraph.nodes().map(n=>r.coreGraph.node(n));return Object.assign(Object.assign({},qI(r)),{expanded:r.expanded,nodes:r.expanded?(t=e,t.map(n=>n.node.type===Fn.META?HI(n):qI(n))):[],edges:r.expanded?Mte(r):[]});var t}function qI(r){return{id:r.node.name,name:r.node.name,type:r.node.type,cardinality:r.node.cardinality,attr:r.attr,parentNodeName:r.node.parentNode?r.node.parentNode.name:null,coreBox:Object.assign({},r.coreBox),x:r.x,y:r.y,width:r.width,height:r.height,radius:r.radius,labelHeight:r.labelHeight,labelOffset:r.labelOffset,outboxWidth:r.outboxWidth,paddingLeft:r.paddingLeft,paddingTop:r.paddingTop,paddingRight:r.paddingRight,paddingBottom:r.paddingBottom,path:r.node.path}}function Mte(r){return r.coreGraph.edges().map(e=>({renderInfoEdge:r.coreGraph.edge(e),edge:e})).filter(({renderInfoEdge:e})=>e.metaEdge).map(({edge:e,renderInfoEdge:t})=>{const n=function(i,a){const o=a.points.map(s=>Object.assign({},s));if(a.adjoiningMetaEdge){const s=a.adjoiningMetaEdge.points,u=a.metaEdge.inbound,f=u?s[s.length-1]:s[0],l=o[u?0:o.length-1],c=i.x-i.width/2,h=i.y-i.height/2,d=f.x-c,v=f.y-h,p=-i.paddingLeft,g=-(i.paddingTop+i.labelHeight);l.x=d+p,l.y=v+g}return o}(r,t);return{adjoiningEdge:t.adjoiningMetaEdge?{w:t.adjoiningMetaEdge.metaEdge.w,v:t.adjoiningMetaEdge.metaEdge.v}:null,inbound:t.metaEdge.inbound,w:e.w,v:e.v,points:n,weight:t.weight,baseEdgeList:t.metaEdge.baseEdgeList,parentNodeName:r.node.name}})}const Cte=ea(Object.freeze(Object.defineProperty({__proto__:null,BRIDGE_GRAPH_NAME:UA,get GraphType(){return mu},get HierarchyNodeType(){return qy},get InclusionType(){return os},LAYOUT_CONFIG:Td,get NodeType(){return Fn},ROOT_NAME:yu,buildGraph:Ete,flatGraph:_te,getEdges:Ste,mergeConfig:Hy},Symbol.toStringTag,{value:"Module"})));var Ate=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ni=xe&&xe.__assign||function(){return Ni=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ni.apply(this,arguments)},Iu=xe&&xe.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))};Object.defineProperty(ll,"__esModule",{value:!0}),ll.DagreCompoundLayout=void 0;var Tte=Pr,li=Cte,tv=Ir(),Ite=function(r){Ate(e,r);function e(t){var n=r.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.edgesep=5,n.ranksep=50,n.controlPoints=!0,n.anchorPoint=!0,n.nodes=[],n.edges=[],n.combos=[],n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,begin:void 0,nodeSize:void 0,nodesep:50,ranksep:50,controlPoints:!0,anchorPoint:!0}},e.prototype.init=function(t){var n=t.hiddenNodes||[],i=t.hiddenEdges||[],a=t.hiddenCombos||[];this.nodes=this.getDataByOrder((t.nodes||[]).concat(n)),this.edges=this.getDataByOrder((t.edges||[]).concat(i)),this.combos=(t.combos||[]).concat(a.map(function(o){return Ni(Ni({},o),{collapsed:!0})}))},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges;if(n){var a=t.getLayoutConfig(),o=a.graphDef,s=a.graphOption,u=a.graphSettings,f=(0,li.buildGraph)(o,s,u),l=(0,li.flatGraph)(f,!0);return this.updatePosition(l),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i}}},e.prototype.getNodePath=function(t){var n=this,i=n.nodes,a=n.combos,o=i.find(function(u){return u.id===t}),s=function(u,f){f===void 0&&(f=[]);var l=a.find(function(c){return c.id===u});return l?(f.unshift(u),l.parentId?s(l.parentId,f):f):f};return o&&o.comboId?s(o.comboId,[t]):[t]},e.prototype.getLayoutConfig=function(){var t,n,i,a=this,o=a.nodes,s=a.edges,u=a.combos,f=a.nodeSize,l=a.rankdir,c=a.align,h=a.edgesep,d=a.nodesep,v=a.ranksep,p=a.settings,g=(u||[]).reduce(function(D,$){var Y=o.filter(function(P){return P.comboId===$.id}).map(function(P){return P.id}),N=(u||[]).filter(function(P){return P.parentId===$.id}).map(function(P){return P.id});return(Y.length||N.length)&&(D[$.id]=Iu(Iu([],Y,!0),N,!0)),D},{}),y;f?(0,tv.isArray)(f)?y=function(){return f}:y=function(){return[f,f]}:y=function(D){return D&&D.size?(0,tv.isArray)(D.size)?D.size:(0,tv.isObject)(D.size)?[D.size.width||40,D.size.height||40]:[D.size,D.size]:[40,40]};var m=function(D){return D&&D.size?(0,tv.isArray)(D.size)?D.size:[D.size,D.size]:[80,40]},b=m(u==null?void 0:u[0]),x=b[0],w=b[1],E=(n=(t=a.graphSettings)===null||t===void 0?void 0:t.subScene)===null||n===void 0?void 0:n.meta,_=((i=u.find(function(D){return!D.collapsed}))===null||i===void 0?void 0:i.padding)||[20,20,20,20],M=_[0],C=_[1],S=_[2],A=_[3],T={compound:g,nodes:Iu([],(o||[]).map(function(D){var $=y(D),Y=$[0],N=$[1];return Ni(Ni({},D),{width:Y,height:N})}),!0),edges:Iu([],(s||[]).map(function(D){return Ni(Ni({},D),{v:D.source,w:D.target})}),!0)},k={expanded:(u||[]).filter(function(D){return!D.collapsed}).map(function(D){return D.id})},O={graph:{meta:{align:c,rankDir:l,nodeSep:d,edgeSep:h,rankSep:v}},subScene:{meta:{paddingTop:M||(E==null?void 0:E.paddingTop)||20,paddingRight:C||(E==null?void 0:E.paddingRight)||20,paddingBottom:S||(E==null?void 0:E.paddingBottom)||20,paddingLeft:A||(E==null?void 0:E.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:x,height:w}}},G=(0,li.mergeConfig)(p,Ni({},(0,li.mergeConfig)(O,li.LAYOUT_CONFIG)));return a.graphSettings=G,{graphDef:T,graphOption:k,graphSettings:G}},e.prototype.updatePosition=function(t){var n=t.nodes,i=t.edges;this.updateNodePosition(n,i),this.updateEdgePosition(n,i)},e.prototype.getBegin=function(t,n){var i=this,a=i.begin,o=[0,0];if(a){var s=1/0,u=1/0;t.forEach(function(f){s>f.x&&(s=f.x),u>f.y&&(u=f.y)}),n.forEach(function(f){f.points.forEach(function(l){s>l.x&&(s=l.x),u>l.y&&(u=l.y)})}),o[0]=a[0]-s,o[1]=a[1]-u}return o},e.prototype.updateNodePosition=function(t,n){var i=this,a=i.combos,o=i.nodes,s=i.edges,u=i.anchorPoint,f=i.graphSettings,l=this.getBegin(t,n);t.forEach(function(c){var h,d=c.x,v=c.y,p=c.id,g=c.type,y=c.coreBox;if(g===li.HierarchyNodeType.META&&p!==li.ROOT_NAME){var m=a.findIndex(function(_){return _.id===p}),b=(h=f==null?void 0:f.subScene)===null||h===void 0?void 0:h.meta;a[m].offsetX=d+l[0],a[m].offsetY=v+l[1],a[m].fixSize=[y.width,y.height],a[m].fixCollapseSize=[y.width,y.height],c.expanded?a[m].padding=[b==null?void 0:b.paddingTop,b==null?void 0:b.paddingRight,b==null?void 0:b.paddingBottom,b==null?void 0:b.paddingLeft]:a[m].padding=[0,0,0,0]}else if(g===li.HierarchyNodeType.OP){var m=o.findIndex(function(M){return M.id===p});if(o[m].x=d+l[0],o[m].y=v+l[1],u){var x=[],w=n.filter(function(M){return M.v===p}),E=n.filter(function(M){return M.w===p});w.length>0&&w.forEach(function(M){var C=M.points[0],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var k=s.find(function(O){return O.source===T.v&&O.target===T.w});k&&(k.sourceAnchor=x.length-1)})}),E.length>0&&E.forEach(function(M){var C=M.points[M.points.length-1],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var k=s.find(function(O){return O.source===T.v&&O.target===T.w});k&&(k.targetAnchor=x.length-1)})}),o[m].anchorPoints=x.length>0?x:o[m].anchorPoints||[]}}})},e.prototype.updateEdgePosition=function(t,n){var i=this,a=i.combos,o=i.edges,s=i.controlPoints,u=this.getBegin(t,n);s&&(a.forEach(function(f){f.inEdges=[],f.outEdges=[]}),o.forEach(function(f){var l,c,h,d,v=t.find(function(_){return _.id===f.source}),p=t.find(function(_){return _.id===f.target}),g=[],y=[];if(v&&p)y=(0,li.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,t);else if(!v||!p){var m=i.getNodePath(f.source),b=i.getNodePath(f.target),x=m.reverse().slice(v?0:1).find(function(_){return t.find(function(M){return M.id===_})}),w=b.reverse().slice(p?0:1).find(function(_){return t.find(function(M){return M.id===_})});v=t.find(function(_){return _.id===x}),p=t.find(function(_){return _.id===w}),y=(0,li.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,t,{v:f.source,w:f.target})}if(g=y.reduce(function(_,M){return Iu(Iu([],_,!0),M.points.map(function(C){return Ni(Ni({},C),{x:C.x+u[0],y:C.y+u[1]})}),!0)},[]),g=g.slice(1,-1),f.controlPoints=g,(p==null?void 0:p.type)===li.NodeType.META){var E=a.findIndex(function(_){return _.id===(p==null?void 0:p.id)});if(!a[E]||!((l=a[E].inEdges)===null||l===void 0)&&l.some(function(_){return _.source===v.id&&_.target===p.id}))return;(c=a[E].inEdges)===null||c===void 0||c.push({source:v.id,target:p.id,controlPoints:g})}if((v==null?void 0:v.type)===li.NodeType.META){var E=a.findIndex(function(M){return M.id===(v==null?void 0:v.id)});if(!a[E]||!((h=a[E].outEdges)===null||h===void 0)&&h.some(function(M){return M.source===v.id&&M.target===p.id}))return;(d=a[E].outEdges)===null||d===void 0||d.push({source:v.id,target:p.id,controlPoints:g})}}))},e.prototype.getType=function(){return"dagreCompound"},e.prototype.getDataByOrder=function(t){return t.every(function(n){return n.layoutOrder!==void 0})||t.forEach(function(n,i){n.layoutOrder=i}),t.sort(function(n,i){return n.layoutOrder-i.layoutOrder})},e}(Tte.Base);ll.DagreCompoundLayout=Ite;var Om={},rv={},Dm={};const kte=Object.prototype.toString;function nv(r){const e=kte.call(r);return e.endsWith("Array]")&&!e.includes("Big")}function Lte(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!nv(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;s<a;s++)r[s]>o&&(o=r[s]);return o}function Nte(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!nv(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;s<a;s++)r[s]<o&&(o=r[s]);return o}function ZI(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(nv(r)){if(r.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!nv(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(r.length);var n=Nte(r),i=Lte(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=e.min,o=a===void 0?e.autoMinMax?n:0:a,s=e.max,u=s===void 0?e.autoMinMax?i:1:s;if(o>=u)throw new RangeError("min option must be smaller than max option");for(var f=(u-o)/(i-n),l=0;l<r.length;l++)t[l]=(r[l]-n)*f+o;return t}const iv=" ".repeat(2),KI=" ".repeat(4);function Ote(){return QI(this)}function QI(r,e={}){const{maxRows:t=15,maxColumns:n=10,maxNumSize:i=8}=e;return`${r.constructor.name} {
${iv}[
${KI}${Dte(r,t,n,i)}
${iv}]
${iv}rows: ${r.rows}
${iv}columns: ${r.columns}
}`}function Dte(r,e,t,n){const{rows:i,columns:a}=r,o=Math.min(i,e),s=Math.min(a,t),u=[];for(let f=0;f<o;f++){let l=[];for(let c=0;c<s;c++)l.push(Pte(r.get(f,c),n));u.push(`${l.join(" ")}`)}return s!==a&&(u[u.length-1]+=` ... ${a-t} more columns`),o!==i&&u.push(`... ${i-e} more rows`),u.join(`
${KI}`)}function Pte(r,e){const t=String(r);if(t.length<=e)return t.padEnd(e," ");const n=r.toPrecision(e-2);if(n.length<=e)return n;const i=r.toExponential(e-2),a=i.indexOf("e"),o=i.slice(a);return i.slice(0,e-o.length)+o}function Rte(r,e){r.prototype.add=function(n){return typeof n=="number"?this.addS(n):this.addM(n)},r.prototype.addS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n);return this},r.prototype.addM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n.get(i,a));return this},r.add=function(n,i){return new e(n).add(i)},r.prototype.sub=function(n){return typeof n=="number"?this.subS(n):this.subM(n)},r.prototype.subS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n);return this},r.prototype.subM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n.get(i,a));return this},r.sub=function(n,i){return new e(n).sub(i)},r.prototype.subtract=r.prototype.sub,r.prototype.subtractS=r.prototype.subS,r.prototype.subtractM=r.prototype.subM,r.subtract=r.sub,r.prototype.mul=function(n){return typeof n=="number"?this.mulS(n):this.mulM(n)},r.prototype.mulS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n);return this},r.prototype.mulM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n.get(i,a));return this},r.mul=function(n,i){return new e(n).mul(i)},r.prototype.multiply=r.prototype.mul,r.prototype.multiplyS=r.prototype.mulS,r.prototype.multiplyM=r.prototype.mulM,r.multiply=r.mul,r.prototype.div=function(n){return typeof n=="number"?this.divS(n):this.divM(n)},r.prototype.divS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n);return this},r.prototype.divM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n.get(i,a));return this},r.div=function(n,i){return new e(n).div(i)},r.prototype.divide=r.prototype.div,r.prototype.divideS=r.prototype.divS,r.prototype.divideM=r.prototype.divM,r.divide=r.div,r.prototype.mod=function(n){return typeof n=="number"?this.modS(n):this.modM(n)},r.prototype.modS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n);return this},r.prototype.modM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n.get(i,a));return this},r.mod=function(n,i){return new e(n).mod(i)},r.prototype.modulus=r.prototype.mod,r.prototype.modulusS=r.prototype.modS,r.prototype.modulusM=r.prototype.modM,r.modulus=r.mod,r.prototype.and=function(n){return typeof n=="number"?this.andS(n):this.andM(n)},r.prototype.andS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n);return this},r.prototype.andM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n.get(i,a));return this},r.and=function(n,i){return new e(n).and(i)},r.prototype.or=function(n){return typeof n=="number"?this.orS(n):this.orM(n)},r.prototype.orS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n);return this},r.prototype.orM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n.get(i,a));return this},r.or=function(n,i){return new e(n).or(i)},r.prototype.xor=function(n){return typeof n=="number"?this.xorS(n):this.xorM(n)},r.prototype.xorS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n);return this},r.prototype.xorM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n.get(i,a));return this},r.xor=function(n,i){return new e(n).xor(i)},r.prototype.leftShift=function(n){return typeof n=="number"?this.leftShiftS(n):this.leftShiftM(n)},r.prototype.leftShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n);return this},r.prototype.leftShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n.get(i,a));return this},r.leftShift=function(n,i){return new e(n).leftShift(i)},r.prototype.signPropagatingRightShift=function(n){return typeof n=="number"?this.signPropagatingRightShiftS(n):this.signPropagatingRightShiftM(n)},r.prototype.signPropagatingRightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n);return this},r.prototype.signPropagatingRightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n.get(i,a));return this},r.signPropagatingRightShift=function(n,i){return new e(n).signPropagatingRightShift(i)},r.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},r.prototype.rightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n);return this},r.prototype.rightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n.get(i,a));return this},r.rightShift=function(n,i){return new e(n).rightShift(i)},r.prototype.zeroFillRightShift=r.prototype.rightShift,r.prototype.zeroFillRightShiftS=r.prototype.rightShiftS,r.prototype.zeroFillRightShiftM=r.prototype.rightShiftM,r.zeroFillRightShift=r.rightShift,r.prototype.not=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,~this.get(n,i));return this},r.not=function(n){return new e(n).not()},r.prototype.abs=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.abs(this.get(n,i)));return this},r.abs=function(n){return new e(n).abs()},r.prototype.acos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acos(this.get(n,i)));return this},r.acos=function(n){return new e(n).acos()},r.prototype.acosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acosh(this.get(n,i)));return this},r.acosh=function(n){return new e(n).acosh()},r.prototype.asin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asin(this.get(n,i)));return this},r.asin=function(n){return new e(n).asin()},r.prototype.asinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asinh(this.get(n,i)));return this},r.asinh=function(n){return new e(n).asinh()},r.prototype.atan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atan(this.get(n,i)));return this},r.atan=function(n){return new e(n).atan()},r.prototype.atanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atanh(this.get(n,i)));return this},r.atanh=function(n){return new e(n).atanh()},r.prototype.cbrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cbrt(this.get(n,i)));return this},r.cbrt=function(n){return new e(n).cbrt()},r.prototype.ceil=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.ceil(this.get(n,i)));return this},r.ceil=function(n){return new e(n).ceil()},r.prototype.clz32=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.clz32(this.get(n,i)));return this},r.clz32=function(n){return new e(n).clz32()},r.prototype.cos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cos(this.get(n,i)));return this},r.cos=function(n){return new e(n).cos()},r.prototype.cosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cosh(this.get(n,i)));return this},r.cosh=function(n){return new e(n).cosh()},r.prototype.exp=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.exp(this.get(n,i)));return this},r.exp=function(n){return new e(n).exp()},r.prototype.expm1=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.expm1(this.get(n,i)));return this},r.expm1=function(n){return new e(n).expm1()},r.prototype.floor=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.floor(this.get(n,i)));return this},r.floor=function(n){return new e(n).floor()},r.prototype.fround=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.fround(this.get(n,i)));return this},r.fround=function(n){return new e(n).fround()},r.prototype.log=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log(this.get(n,i)));return this},r.log=function(n){return new e(n).log()},r.prototype.log1p=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log1p(this.get(n,i)));return this},r.log1p=function(n){return new e(n).log1p()},r.prototype.log10=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log10(this.get(n,i)));return this},r.log10=function(n){return new e(n).log10()},r.prototype.log2=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log2(this.get(n,i)));return this},r.log2=function(n){return new e(n).log2()},r.prototype.round=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.round(this.get(n,i)));return this},r.round=function(n){return new e(n).round()},r.prototype.sign=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sign(this.get(n,i)));return this},r.sign=function(n){return new e(n).sign()},r.prototype.sin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sin(this.get(n,i)));return this},r.sin=function(n){return new e(n).sin()},r.prototype.sinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sinh(this.get(n,i)));return this},r.sinh=function(n){return new e(n).sinh()},r.prototype.sqrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sqrt(this.get(n,i)));return this},r.sqrt=function(n){return new e(n).sqrt()},r.prototype.tan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tan(this.get(n,i)));return this},r.tan=function(n){return new e(n).tan()},r.prototype.tanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tanh(this.get(n,i)));return this},r.tanh=function(n){return new e(n).tanh()},r.prototype.trunc=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.trunc(this.get(n,i)));return this},r.trunc=function(n){return new e(n).trunc()},r.pow=function(n,i){return new e(n).pow(i)},r.prototype.pow=function(n){return typeof n=="number"?this.powS(n):this.powM(n)},r.prototype.powS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,Math.pow(this.get(i,a),n));return this},r.prototype.powM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,Math.pow(this.get(i,a),n.get(i,a)));return this}}function ci(r,e,t){let n=t?r.rows:r.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function hi(r,e,t){let n=t?r.columns:r.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function ku(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Lu(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function JI(r,e,t){return{row:ek(r,e),column:tk(r,t)}}function ek(r,e){if(typeof e!="object")throw new TypeError("unexpected type for row indices");if(e.some(n=>n<0||n>=r.rows))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function tk(r,e){if(typeof e!="object")throw new TypeError("unexpected type for column indices");if(e.some(n=>n<0||n>=r.columns))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function Pm(r,e,t,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(ov("startRow",e),ov("endRow",t),ov("startColumn",n),ov("endColumn",i),e>t||n>i||e<0||e>=r.rows||t<0||t>=r.rows||n<0||n>=r.columns||i<0||i>=r.columns)throw new RangeError("Submatrix indices are out of range")}function av(r,e=0){let t=[];for(let n=0;n<r;n++)t.push(e);return t}function ov(r,e){if(typeof e!="number")throw new TypeError(`${r} must be a number`)}function Bte(r){let e=av(r.rows);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[t]+=r.get(t,n);return e}function Fte(r){let e=av(r.columns);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[n]+=r.get(t,n);return e}function Gte(r){let e=0;for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)e+=r.get(t,n);return e}function zte(r){let e=av(r.rows,1);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[t]*=r.get(t,n);return e}function $te(r){let e=av(r.columns,1);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[n]*=r.get(t,n);return e}function jte(r){let e=1;for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)e*=r.get(t,n);return e}function Ute(r,e,t){const n=r.rows,i=r.columns,a=[];for(let o=0;o<n;o++){let s=0,u=0,f=0;for(let l=0;l<i;l++)f=r.get(o,l)-t[o],s+=f,u+=f*f;e?a.push((u-s*s/i)/(i-1)):a.push((u-s*s/i)/i)}return a}function Xte(r,e,t){const n=r.rows,i=r.columns,a=[];for(let o=0;o<i;o++){let s=0,u=0,f=0;for(let l=0;l<n;l++)f=r.get(l,o)-t[o],s+=f,u+=f*f;e?a.push((u-s*s/n)/(n-1)):a.push((u-s*s/n)/n)}return a}function Yte(r,e,t){const n=r.rows,i=r.columns,a=n*i;let o=0,s=0,u=0;for(let f=0;f<n;f++)for(let l=0;l<i;l++)u=r.get(f,l)-t,o+=u,s+=u*u;return e?(s-o*o/a)/(a-1):(s-o*o/a)/a}function Wte(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e[t])}function Vte(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e[n])}function Hte(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e)}function qte(r){const e=[];for(let t=0;t<r.rows;t++){let n=0;for(let i=0;i<r.columns;i++)n+=Math.pow(r.get(t,i),2)/(r.columns-1);e.push(Math.sqrt(n))}return e}function Zte(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e[t])}function Kte(r){const e=[];for(let t=0;t<r.columns;t++){let n=0;for(let i=0;i<r.rows;i++)n+=Math.pow(r.get(i,t),2)/(r.rows-1);e.push(Math.sqrt(n))}return e}function Qte(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e[n])}function Jte(r){const e=r.size-1;let t=0;for(let n=0;n<r.columns;n++)for(let i=0;i<r.rows;i++)t+=Math.pow(r.get(i,n),2)/e;return Math.sqrt(t)}function ere(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e)}class qt{static from1DArray(e,t,n){if(e*t!==n.length)throw new RangeError("data length does not match given dimensions");let a=new dt(e,t);for(let o=0;o<e;o++)for(let s=0;s<t;s++)a.set(o,s,n[o*t+s]);return a}static rowVector(e){let t=new dt(1,e.length);for(let n=0;n<e.length;n++)t.set(0,n,e[n]);return t}static columnVector(e){let t=new dt(e.length,1);for(let n=0;n<e.length;n++)t.set(n,0,e[n]);return t}static zeros(e,t){return new dt(e,t)}static ones(e,t){return new dt(e,t).fill(1)}static rand(e,t,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new dt(e,t);for(let o=0;o<e;o++)for(let s=0;s<t;s++)a.set(o,s,i());return a}static randInt(e,t,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:o=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");let s=a-i,u=new dt(e,t);for(let f=0;f<e;f++)for(let l=0;l<t;l++){let c=i+Math.round(o()*s);u.set(f,l,c)}return u}static eye(e,t,n){t===void 0&&(t=e),n===void 0&&(n=1);let i=Math.min(e,t),a=this.zeros(e,t);for(let o=0;o<i;o++)a.set(o,o,n);return a}static diag(e,t,n){let i=e.length;t===void 0&&(t=i),n===void 0&&(n=t);let a=Math.min(i,t,n),o=this.zeros(t,n);for(let s=0;s<a;s++)o.set(s,s,e[s]);return o}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new dt(n,i);for(let o=0;o<n;o++)for(let s=0;s<i;s++)a.set(o,s,Math.min(e.get(o,s),t.get(o,s)));return a}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new this(n,i);for(let o=0;o<n;o++)for(let s=0;s<i;s++)a.set(o,s,Math.max(e.get(o,s),t.get(o,s)));return a}static checkMatrix(e){return qt.isMatrix(e)?e:new dt(e)}static isMatrix(e){return e!=null&&e.klass==="Matrix"}get size(){return this.rows*this.columns}apply(e){if(typeof e!="function")throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.call(this,t,n);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let n=0;n<this.columns;n++)e[t].push(this.get(t,n))}return e}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isSymmetric(){if(this.isSquare()){for(let e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&a===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>n?(a=!0,n=t):(i=!1,a=!0);e++}return i}isReducedEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&a===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>n?(a=!0,n=t):(i=!1,a=!0);for(let o=t+1;o<this.rows;o++)this.get(e,o)!==0&&(i=!1);e++}return i}echelonForm(){let e=this.clone(),t=0,n=0;for(;t<e.rows&&n<e.columns;){let i=t;for(let a=t;a<e.rows;a++)e.get(a,n)>e.get(i,n)&&(i=a);if(e.get(i,n)===0)n++;else{e.swapRows(t,i);let a=e.get(t,n);for(let o=n;o<e.columns;o++)e.set(t,o,e.get(t,o)/a);for(let o=t+1;o<e.rows;o++){let s=e.get(o,n)/e.get(t,n);e.set(o,n,0);for(let u=n+1;u<e.columns;u++)e.set(o,u,e.get(o,u)-e.get(t,u)*s)}t++,n++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,n=e.rows,i=n-1;for(;i>=0;)if(e.maxRow(i)===0)i--;else{let a=0,o=!1;for(;a<n&&o===!1;)e.get(i,a)===1?o=!0:a++;for(let s=0;s<i;s++){let u=e.get(s,a);for(let f=a;f<t;f++){let l=e.get(s,f)-u*e.get(i,f);e.set(s,f,l)}}i--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{rows:t=1,columns:n=1}=e;if(!Number.isInteger(t)||t<=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 i=new dt(this.rows*t,this.columns*n);for(let a=0;a<t;a++)for(let o=0;o<n;o++)i.setSubMatrix(this,this.rows*a,this.columns*o);return i}fill(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,e);return this}neg(){return this.mulS(-1)}getRow(e){ci(this,e);let t=[];for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}getRowVector(e){return dt.rowVector(this.getRow(e))}setRow(e,t){ci(this,e),t=ku(this,t);for(let n=0;n<this.columns;n++)this.set(e,n,t[n]);return this}swapRows(e,t){ci(this,e),ci(this,t);for(let n=0;n<this.columns;n++){let i=this.get(e,n);this.set(e,n,this.get(t,n)),this.set(t,n,i)}return this}getColumn(e){hi(this,e);let t=[];for(let n=0;n<this.rows;n++)t.push(this.get(n,e));return t}getColumnVector(e){return dt.columnVector(this.getColumn(e))}setColumn(e,t){hi(this,e),t=Lu(this,t);for(let n=0;n<this.rows;n++)this.set(n,e,t[n]);return this}swapColumns(e,t){hi(this,e),hi(this,t);for(let n=0;n<this.rows;n++){let i=this.get(n,e);this.set(n,e,this.get(n,t)),this.set(n,t,i)}return this}addRowVector(e){e=ku(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[n]);return this}subRowVector(e){e=ku(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[n]);return this}mulRowVector(e){e=ku(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[n]);return this}divRowVector(e){e=ku(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[n]);return this}addColumnVector(e){e=Lu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[t]);return this}subColumnVector(e){e=Lu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[t]);return this}mulColumnVector(e){e=Lu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[t]);return this}divColumnVector(e){e=Lu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[t]);return this}mulRow(e,t){ci(this,e);for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this}mulColumn(e,t){hi(this,e);for(let n=0;n<this.rows;n++)this.set(n,e,this.get(n,e)*t);return this}max(){let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxIndex(){let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}min(){let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minIndex(){let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}maxRow(e){ci(this,e);let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}maxRowIndex(e){ci(this,e);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)>t&&(t=this.get(e,i),n[1]=i);return n}minRow(e){ci(this,e);let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}minRowIndex(e){ci(this,e);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)<t&&(t=this.get(e,i),n[1]=i);return n}maxColumn(e){hi(this,e);let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e));return t}maxColumnIndex(e){hi(this,e);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)>t&&(t=this.get(i,e),n[0]=i);return n}minColumn(e){hi(this,e);let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e));return t}minColumnIndex(e){hi(this,e);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)<t&&(t=this.get(i,e),n[0]=i);return n}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let n=0;n<e;n++)t.push(this.get(n,n));return t}norm(e="frobenius"){let t=0;if(e==="max")return this.max();if(e==="frobenius"){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)t=t+this.get(n,i)*this.get(n,i);return Math.sqrt(t)}else throw new RangeError(`unknown norm type: ${e}`)}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n),this.set(t,n,e);return this}dot(e){qt.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}mmul(e){e=dt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.columns,a=new dt(t,i),o=new Float64Array(n);for(let s=0;s<i;s++){for(let u=0;u<n;u++)o[u]=e.get(u,s);for(let u=0;u<t;u++){let f=0;for(let l=0;l<n;l++)f+=this.get(u,l)*o[l];a.set(u,s,f)}}return a}strassen2x2(e){e=dt.checkMatrix(e);let t=new dt(2,2);const n=this.get(0,0),i=e.get(0,0),a=this.get(0,1),o=e.get(0,1),s=this.get(1,0),u=e.get(1,0),f=this.get(1,1),l=e.get(1,1),c=(n+f)*(i+l),h=(s+f)*i,d=n*(o-l),v=f*(u-i),p=(n+a)*l,g=(s-n)*(i+o),y=(a-f)*(u+l),m=c+v-p+y,b=d+p,x=h+v,w=c-h+d+g;return t.set(0,0,m),t.set(0,1,b),t.set(1,0,x),t.set(1,1,w),t}strassen3x3(e){e=dt.checkMatrix(e);let t=new dt(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),o=this.get(1,0),s=this.get(1,1),u=this.get(1,2),f=this.get(2,0),l=this.get(2,1),c=this.get(2,2),h=e.get(0,0),d=e.get(0,1),v=e.get(0,2),p=e.get(1,0),g=e.get(1,1),y=e.get(1,2),m=e.get(2,0),b=e.get(2,1),x=e.get(2,2),w=(n+i+a-o-s-l-c)*g,E=(n-o)*(-d+g),_=s*(-h+d+p-g-y-m+x),M=(-n+o+s)*(h-d+g),C=(o+s)*(-h+d),S=n*h,A=(-n+f+l)*(h-v+y),T=(-n+f)*(v-y),k=(f+l)*(-h+v),O=(n+i+a-s-u-f-l)*y,G=l*(-h+v+p-g-y-m+b),D=(-a+l+c)*(g+m-b),$=(a-c)*(g-b),Y=a*m,N=(l+c)*(-m+b),P=(-a+s+u)*(y+m-x),W=(a-u)*(y-x),J=(s+u)*(-m+x),te=i*p,H=u*b,pe=o*v,Te=f*d,Ne=c*x,Ze=S+Y+te,at=w+M+C+S+D+Y+N,nt=S+A+k+O+Y+P+J,St=E+_+M+S+Y+P+W,Mt=E+M+C+S+H,fr=Y+P+W+J+pe,Ft=S+A+T+G+D+$+Y,Wt=D+$+Y+N+Te,dr=S+A+T+k+Ne;return t.set(0,0,Ze),t.set(0,1,at),t.set(0,2,nt),t.set(1,0,St),t.set(1,1,Mt),t.set(1,2,fr),t.set(2,0,Ft),t.set(2,1,Wt),t.set(2,2,dr),t}mmulStrassen(e){e=dt.checkMatrix(e);let t=this.clone(),n=t.rows,i=t.columns,a=e.rows,o=e.columns;i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${o} matrix: dimensions do not match.`);function s(c,h,d){let v=c.rows,p=c.columns;if(v===h&&p===d)return c;{let g=qt.zeros(h,d);return g=g.setSubMatrix(c,0,0),g}}let u=Math.max(n,a),f=Math.max(i,o);t=s(t,u,f),e=s(e,u,f);function l(c,h,d,v){if(d<=512||v<=512)return c.mmul(h);d%2===1&&v%2===1?(c=s(c,d+1,v+1),h=s(h,d+1,v+1)):d%2===1?(c=s(c,d+1,v),h=s(h,d+1,v)):v%2===1&&(c=s(c,d,v+1),h=s(h,d,v+1));let p=parseInt(c.rows/2,10),g=parseInt(c.columns/2,10),y=c.subMatrix(0,p-1,0,g-1),m=h.subMatrix(0,p-1,0,g-1),b=c.subMatrix(0,p-1,g,c.columns-1),x=h.subMatrix(0,p-1,g,h.columns-1),w=c.subMatrix(p,c.rows-1,0,g-1),E=h.subMatrix(p,h.rows-1,0,g-1),_=c.subMatrix(p,c.rows-1,g,c.columns-1),M=h.subMatrix(p,h.rows-1,g,h.columns-1),C=l(qt.add(y,_),qt.add(m,M),p,g),S=l(qt.add(w,_),m,p,g),A=l(y,qt.sub(x,M),p,g),T=l(_,qt.sub(E,m),p,g),k=l(qt.add(y,b),M,p,g),O=l(qt.sub(w,y),qt.add(m,x),p,g),G=l(qt.sub(b,_),qt.add(E,M),p,g),D=qt.add(C,T);D.sub(k),D.add(G);let $=qt.add(A,k),Y=qt.add(S,T),N=qt.sub(C,S);N.add(A),N.add(O);let P=qt.zeros(2*D.rows,2*D.columns);return P=P.setSubMatrix(D,0,0),P=P.setSubMatrix($,D.rows,0),P=P.setSubMatrix(Y,0,D.columns),P=P.setSubMatrix(N,D.rows,D.columns),P.subMatrix(0,d-1,0,v-1)}return l(t,e,u,f)}scaleRows(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const o=this.getRow(a);ZI(o,{min:t,max:n,output:o}),i.setRow(a,o)}return i}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const o=this.getColumn(a);ZI(o,{min:t,max:n,output:o}),i.setColumn(a,o)}return i}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let n=0;n<e;n++){let i=this.get(t,n),a=this.get(t,this.columns-1-n);this.set(t,n,a),this.set(t,this.columns-1-n,i)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let n=0;n<e;n++){let i=this.get(n,t),a=this.get(this.rows-1-n,t);this.set(n,t,a),this.set(this.rows-1-n,t,i)}return this}kroneckerProduct(e){e=dt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.rows,a=e.columns,o=new dt(t*i,n*a);for(let s=0;s<t;s++)for(let u=0;u<n;u++)for(let f=0;f<i;f++)for(let l=0;l<a;l++)o.set(i*s+f,a*u+l,this.get(s,u)*e.get(f,l));return o}transpose(){let e=new dt(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(n,t,this.get(t,n));return e}sortRows(e=rk){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=rk){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,n,i){Pm(this,e,t,n,i);let a=new dt(t-e+1,i-n+1);for(let o=e;o<=t;o++)for(let s=n;s<=i;s++)a.set(o-e,s-n,this.get(o,s));return a}subMatrixRow(e,t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.columns-1),t>n||t<0||t>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new dt(e.length,n-t+1);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.rows)throw new RangeError(`Row index out of range: ${e[a]}`);i.set(a,o-t,this.get(e[a],o))}return i}subMatrixColumn(e,t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.rows-1),t>n||t<0||t>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new dt(n-t+1,e.length);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.columns)throw new RangeError(`Column index out of range: ${e[a]}`);i.set(o-t,a,this.get(o,e[a]))}return i}setSubMatrix(e,t,n){e=dt.checkMatrix(e);let i=t+e.rows-1,a=n+e.columns-1;Pm(this,t,i,n,a);for(let o=0;o<e.rows;o++)for(let s=0;s<e.columns;s++)this.set(t+o,n+s,e.get(o,s));return this}selection(e,t){let n=JI(this,e,t),i=new dt(e.length,t.length);for(let a=0;a<n.row.length;a++){let o=n.row[a];for(let s=0;s<n.column.length;s++){let u=n.column[s];i.set(a,s,this.get(o,u))}}return i}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let n=0;n<e;n++)t+=this.get(n,n);return t}clone(){let e=new dt(this.rows,this.columns);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(t,n,this.get(t,n));return e}sum(e){switch(e){case"row":return Bte(this);case"column":return Fte(this);case void 0:return Gte(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return zte(this);case"column":return $te(this);case void 0:return jte(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":{for(let n=0;n<this.rows;n++)t[n]/=this.columns;return t}case"column":{for(let n=0;n<this.columns;n++)t[n]/=this.rows;return t}case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(e)}=t;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(e){case"row":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return Ute(this,n,i)}case"column":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return Xte(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return Yte(this,n,i)}default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){typeof e=="object"&&(t=e,e=void 0);const n=this.variance(e,t);if(e===void 0)return Math.sqrt(n);for(let i=0;i<n.length;i++)n[i]=Math.sqrt(n[i]);return n}center(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{center:n=this.mean(e)}=t;switch(e){case"row":{if(!Array.isArray(n))throw new TypeError("center must be an array");return Wte(this,n),this}case"column":{if(!Array.isArray(n))throw new TypeError("center must be an array");return Vte(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return Hte(this,n),this}default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");let n=t.scale;switch(e){case"row":{if(n===void 0)n=qte(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return Zte(this,n),this}case"column":{if(n===void 0)n=Kte(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return Qte(this,n),this}case void 0:{if(n===void 0)n=Jte(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return ere(this,n),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return QI(this,e)}}qt.prototype.klass="Matrix",typeof Symbol<"u"&&(qt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ote);function rk(r,e){return r-e}qt.random=qt.rand,qt.randomInt=qt.randInt,qt.diagonal=qt.diag,qt.prototype.diagonal=qt.prototype.diag,qt.identity=qt.eye,qt.prototype.negate=qt.prototype.neg,qt.prototype.tensorProduct=qt.prototype.kroneckerProduct;class dt extends qt{constructor(e,t){if(super(),dt.isMatrix(e))return e.clone();if(Number.isInteger(e)&&e>0)if(this.data=[],Number.isInteger(t)&&t>0)for(let n=0;n<e;n++)this.data.push(new Float64Array(t));else throw new TypeError("nColumns must be a positive integer");else if(Array.isArray(e)){const n=e;if(e=n.length,t=n[0].length,typeof t!="number"||t===0)throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<e;i++){if(n[i].length!==t)throw new RangeError("Inconsistent array dimensions");this.data.push(Float64Array.from(n[i]))}}else throw new TypeError("First argument must be a positive number or an array");return this.rows=e,this.columns=t,this}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}removeRow(e){if(ci(this,e),this.rows===1)throw new RangeError("A matrix cannot have less than one row");return this.data.splice(e,1),this.rows-=1,this}addRow(e,t){return t===void 0&&(t=e,e=this.rows),ci(this,e,!0),t=Float64Array.from(ku(this,t)),this.data.splice(e,0,t),this.rows+=1,this}removeColumn(e){if(hi(this,e),this.columns===1)throw new RangeError("A matrix cannot have less than one column");for(let t=0;t<this.rows;t++){const n=new Float64Array(this.columns-1);for(let i=0;i<e;i++)n[i]=this.data[t][i];for(let i=e+1;i<this.columns;i++)n[i-1]=this.data[t][i];this.data[t]=n}return this.columns-=1,this}addColumn(e,t){typeof t>"u"&&(t=e,e=this.columns),hi(this,e,!0),t=Lu(this,t);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<e;a++)i[a]=this.data[n][a];for(i[a++]=t[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}}Rte(qt,dt);class Ra extends qt{constructor(e,t,n){super(),this.matrix=e,this.rows=t,this.columns=n}}class tre extends Ra{constructor(e,t){hi(e,t),super(e,e.rows,1),this.column=t}set(e,t,n){return this.matrix.set(e,this.column,n),this}get(e){return this.matrix.get(e,this.column)}}class rre extends Ra{constructor(e,t){t=tk(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,n){return this.matrix.set(e,this.columnIndices[t],n),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}}class nre extends Ra{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(e,this.columns-t-1,n),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}}class ire extends Ra{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(this.rows-e-1,t,n),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}}class are extends Ra{constructor(e,t){ci(e,t),super(e,1,e.columns),this.row=t}set(e,t,n){return this.matrix.set(this.row,t,n),this}get(e,t){return this.matrix.get(this.row,t)}}class ore extends Ra{constructor(e,t){t=ek(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,n){return this.matrix.set(this.rowIndices[e],t,n),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}}class sv extends Ra{constructor(e,t,n){let i=JI(e,t,n);super(e,i.row.length,i.column.length),this.rowIndices=i.row,this.columnIndices=i.column}set(e,t,n){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],n),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class sre extends Ra{constructor(e,t,n,i,a){Pm(e,t,n,i,a),super(e,n-t+1,a-i+1),this.startRow=t,this.startColumn=i}set(e,t,n){return this.matrix.set(this.startRow+e,this.startColumn+t,n),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}}class ure extends Ra{constructor(e){super(e,e.columns,e.rows)}set(e,t,n){return this.matrix.set(t,e,n),this}get(e,t){return this.matrix.get(t,e)}}class nk extends qt{constructor(e,t={}){const{rows:n=1}=t;if(e.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=e.length/n,this.data=e}set(e,t,n){let i=this._calculateIndex(e,t);return this.data[i]=n,this}get(e,t){let n=this._calculateIndex(e,t);return this.data[n]}_calculateIndex(e,t){return e*this.columns+t}}class Qn extends qt{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}}function fre(r,e){if(Array.isArray(r))return r[0]&&Array.isArray(r[0])?new Qn(r):new nk(r,e);throw new Error("the argument is not an array")}class uv{constructor(e){e=Qn.checkMatrix(e);let t=e.clone(),n=t.rows,i=t.columns,a=new Float64Array(n),o=1,s,u,f,l,c,h,d,v,p;for(s=0;s<n;s++)a[s]=s;for(v=new Float64Array(n),u=0;u<i;u++){for(s=0;s<n;s++)v[s]=t.get(s,u);for(s=0;s<n;s++){for(p=Math.min(s,u),c=0,f=0;f<p;f++)c+=t.get(s,f)*v[f];v[s]-=c,t.set(s,u,v[s])}for(l=u,s=u+1;s<n;s++)Math.abs(v[s])>Math.abs(v[l])&&(l=s);if(l!==u){for(f=0;f<i;f++)h=t.get(l,f),t.set(l,f,t.get(u,f)),t.set(u,f,h);d=a[l],a[l]=a[u],a[u]=d,o=-o}if(u<n&&t.get(u,u)!==0)for(s=u+1;s<n;s++)t.set(s,u,t.get(s,u)/t.get(u,u))}this.LU=t,this.pivotVector=a,this.pivotSign=o}isSingular(){let e=this.LU,t=e.columns;for(let n=0;n<t;n++)if(e.get(n,n)===0)return!0;return!1}solve(e){e=dt.checkMatrix(e);let t=this.LU;if(t.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=e.columns,a=e.subMatrixRow(this.pivotVector,0,i-1),o=t.columns,s,u,f;for(f=0;f<o;f++)for(s=f+1;s<o;s++)for(u=0;u<i;u++)a.set(s,u,a.get(s,u)-a.get(f,u)*t.get(s,f));for(f=o-1;f>=0;f--){for(u=0;u<i;u++)a.set(f,u,a.get(f,u)/t.get(f,f));for(s=0;s<f;s++)for(u=0;u<i;u++)a.set(s,u,a.get(s,u)-a.get(f,u)*t.get(s,f))}return a}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let t=this.pivotSign,n=e.columns;for(let i=0;i<n;i++)t*=e.get(i,i);return t}get lowerTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new dt(t,n);for(let a=0;a<t;a++)for(let o=0;o<n;o++)a>o?i.set(a,o,e.get(a,o)):a===o?i.set(a,o,1):i.set(a,o,0);return i}get upperTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new dt(t,n);for(let a=0;a<t;a++)for(let o=0;o<n;o++)a<=o?i.set(a,o,e.get(a,o)):i.set(a,o,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Ba(r,e){let t=0;return Math.abs(r)>Math.abs(e)?(t=e/r,Math.abs(r)*Math.sqrt(1+t*t)):e!==0?(t=r/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class Rm{constructor(e){e=Qn.checkMatrix(e);let t=e.clone(),n=e.rows,i=e.columns,a=new Float64Array(i),o,s,u,f;for(u=0;u<i;u++){let l=0;for(o=u;o<n;o++)l=Ba(l,t.get(o,u));if(l!==0){for(t.get(u,u)<0&&(l=-l),o=u;o<n;o++)t.set(o,u,t.get(o,u)/l);for(t.set(u,u,t.get(u,u)+1),s=u+1;s<i;s++){for(f=0,o=u;o<n;o++)f+=t.get(o,u)*t.get(o,s);for(f=-f/t.get(u,u),o=u;o<n;o++)t.set(o,s,t.get(o,s)+f*t.get(o,u))}}a[u]=-l}this.QR=t,this.Rdiag=a}solve(e){e=dt.checkMatrix(e);let t=this.QR,n=t.rows;if(e.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=e.columns,a=e.clone(),o=t.columns,s,u,f,l;for(f=0;f<o;f++)for(u=0;u<i;u++){for(l=0,s=f;s<n;s++)l+=t.get(s,f)*a.get(s,u);for(l=-l/t.get(f,f),s=f;s<n;s++)a.set(s,u,a.get(s,u)+l*t.get(s,f))}for(f=o-1;f>=0;f--){for(u=0;u<i;u++)a.set(f,u,a.get(f,u)/this.Rdiag[f]);for(s=0;s<f;s++)for(u=0;u<i;u++)a.set(s,u,a.get(s,u)-a.get(f,u)*t.get(s,f))}return a.subMatrix(0,o-1,0,i-1)}isFullRank(){let e=this.QR.columns;for(let t=0;t<e;t++)if(this.Rdiag[t]===0)return!1;return!0}get upperTriangularMatrix(){let e=this.QR,t=e.columns,n=new dt(t,t),i,a;for(i=0;i<t;i++)for(a=0;a<t;a++)i<a?n.set(i,a,e.get(i,a)):i===a?n.set(i,a,this.Rdiag[i]):n.set(i,a,0);return n}get orthogonalMatrix(){let e=this.QR,t=e.rows,n=e.columns,i=new dt(t,n),a,o,s,u;for(s=n-1;s>=0;s--){for(a=0;a<t;a++)i.set(a,s,0);for(i.set(s,s,1),o=s;o<n;o++)if(e.get(s,s)!==0){for(u=0,a=s;a<t;a++)u+=e.get(a,s)*i.get(a,o);for(u=-u/e.get(s,s),a=s;a<t;a++)i.set(a,o,i.get(a,o)+u*e.get(a,s))}}return i}}class Nu{constructor(e,t={}){e=Qn.checkMatrix(e);let n=e.rows,i=e.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=t;let u=!!a,f=!!o,l=!1,c;if(n<i)if(!s)c=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{c=e.transpose(),n=c.rows,i=c.columns,l=!0;let S=u;u=f,f=S}else c=e.clone();let h=Math.min(n,i),d=Math.min(n+1,i),v=new Float64Array(d),p=new dt(n,h),g=new dt(i,i),y=new Float64Array(i),m=new Float64Array(n),b=new Float64Array(d);for(let S=0;S<d;S++)b[S]=S;let x=Math.min(n-1,i),w=Math.max(0,Math.min(i-2,n)),E=Math.max(x,w);for(let S=0;S<E;S++){if(S<x){v[S]=0;for(let A=S;A<n;A++)v[S]=Ba(v[S],c.get(A,S));if(v[S]!==0){c.get(S,S)<0&&(v[S]=-v[S]);for(let A=S;A<n;A++)c.set(A,S,c.get(A,S)/v[S]);c.set(S,S,c.get(S,S)+1)}v[S]=-v[S]}for(let A=S+1;A<i;A++){if(S<x&&v[S]!==0){let T=0;for(let k=S;k<n;k++)T+=c.get(k,S)*c.get(k,A);T=-T/c.get(S,S);for(let k=S;k<n;k++)c.set(k,A,c.get(k,A)+T*c.get(k,S))}y[A]=c.get(S,A)}if(u&&S<x)for(let A=S;A<n;A++)p.set(A,S,c.get(A,S));if(S<w){y[S]=0;for(let A=S+1;A<i;A++)y[S]=Ba(y[S],y[A]);if(y[S]!==0){y[S+1]<0&&(y[S]=0-y[S]);for(let A=S+1;A<i;A++)y[A]/=y[S];y[S+1]+=1}if(y[S]=-y[S],S+1<n&&y[S]!==0){for(let A=S+1;A<n;A++)m[A]=0;for(let A=S+1;A<n;A++)for(let T=S+1;T<i;T++)m[A]+=y[T]*c.get(A,T);for(let A=S+1;A<i;A++){let T=-y[A]/y[S+1];for(let k=S+1;k<n;k++)c.set(k,A,c.get(k,A)+T*m[k])}}if(f)for(let A=S+1;A<i;A++)g.set(A,S,y[A])}}let _=Math.min(i,n+1);if(x<i&&(v[x]=c.get(x,x)),n<_&&(v[_-1]=0),w+1<_&&(y[w]=c.get(w,_-1)),y[_-1]=0,u){for(let S=x;S<h;S++){for(let A=0;A<n;A++)p.set(A,S,0);p.set(S,S,1)}for(let S=x-1;S>=0;S--)if(v[S]!==0){for(let A=S+1;A<h;A++){let T=0;for(let k=S;k<n;k++)T+=p.get(k,S)*p.get(k,A);T=-T/p.get(S,S);for(let k=S;k<n;k++)p.set(k,A,p.get(k,A)+T*p.get(k,S))}for(let A=S;A<n;A++)p.set(A,S,-p.get(A,S));p.set(S,S,1+p.get(S,S));for(let A=0;A<S-1;A++)p.set(A,S,0)}else{for(let A=0;A<n;A++)p.set(A,S,0);p.set(S,S,1)}}if(f)for(let S=i-1;S>=0;S--){if(S<w&&y[S]!==0)for(let A=S+1;A<i;A++){let T=0;for(let k=S+1;k<i;k++)T+=g.get(k,S)*g.get(k,A);T=-T/g.get(S+1,S);for(let k=S+1;k<i;k++)g.set(k,A,g.get(k,A)+T*g.get(k,S))}for(let A=0;A<i;A++)g.set(A,S,0);g.set(S,S,1)}let M=_-1,C=Number.EPSILON;for(;_>0;){let S,A;for(S=_-2;S>=-1&&S!==-1;S--){const T=Number.MIN_VALUE+C*Math.abs(v[S]+Math.abs(v[S+1]));if(Math.abs(y[S])<=T||Number.isNaN(y[S])){y[S]=0;break}}if(S===_-2)A=4;else{let T;for(T=_-1;T>=S&&T!==S;T--){let k=(T!==_?Math.abs(y[T]):0)+(T!==S+1?Math.abs(y[T-1]):0);if(Math.abs(v[T])<=C*k){v[T]=0;break}}T===S?A=3:T===_-1?A=1:(A=2,S=T)}switch(S++,A){case 1:{let T=y[_-2];y[_-2]=0;for(let k=_-2;k>=S;k--){let O=Ba(v[k],T),G=v[k]/O,D=T/O;if(v[k]=O,k!==S&&(T=-D*y[k-1],y[k-1]=G*y[k-1]),f)for(let $=0;$<i;$++)O=G*g.get($,k)+D*g.get($,_-1),g.set($,_-1,-D*g.get($,k)+G*g.get($,_-1)),g.set($,k,O)}break}case 2:{let T=y[S-1];y[S-1]=0;for(let k=S;k<_;k++){let O=Ba(v[k],T),G=v[k]/O,D=T/O;if(v[k]=O,T=-D*y[k],y[k]=G*y[k],u)for(let $=0;$<n;$++)O=G*p.get($,k)+D*p.get($,S-1),p.set($,S-1,-D*p.get($,k)+G*p.get($,S-1)),p.set($,k,O)}break}case 3:{const T=Math.max(Math.abs(v[_-1]),Math.abs(v[_-2]),Math.abs(y[_-2]),Math.abs(v[S]),Math.abs(y[S])),k=v[_-1]/T,O=v[_-2]/T,G=y[_-2]/T,D=v[S]/T,$=y[S]/T,Y=((O+k)*(O-k)+G*G)/2,N=k*G*(k*G);let P=0;(Y!==0||N!==0)&&(Y<0?P=0-Math.sqrt(Y*Y+N):P=Math.sqrt(Y*Y+N),P=N/(Y+P));let W=(D+k)*(D-k)+P,J=D*$;for(let te=S;te<_-1;te++){let H=Ba(W,J);H===0&&(H=Number.MIN_VALUE);let pe=W/H,Te=J/H;if(te!==S&&(y[te-1]=H),W=pe*v[te]+Te*y[te],y[te]=pe*y[te]-Te*v[te],J=Te*v[te+1],v[te+1]=pe*v[te+1],f)for(let Ne=0;Ne<i;Ne++)H=pe*g.get(Ne,te)+Te*g.get(Ne,te+1),g.set(Ne,te+1,-Te*g.get(Ne,te)+pe*g.get(Ne,te+1)),g.set(Ne,te,H);if(H=Ba(W,J),H===0&&(H=Number.MIN_VALUE),pe=W/H,Te=J/H,v[te]=H,W=pe*y[te]+Te*v[te+1],v[te+1]=-Te*y[te]+pe*v[te+1],J=Te*y[te+1],y[te+1]=pe*y[te+1],u&&te<n-1)for(let Ne=0;Ne<n;Ne++)H=pe*p.get(Ne,te)+Te*p.get(Ne,te+1),p.set(Ne,te+1,-Te*p.get(Ne,te)+pe*p.get(Ne,te+1)),p.set(Ne,te,H)}y[_-2]=W;break}case 4:{if(v[S]<=0&&(v[S]=v[S]<0?-v[S]:0,f))for(let T=0;T<=M;T++)g.set(T,S,-g.get(T,S));for(;S<M&&!(v[S]>=v[S+1]);){let T=v[S];if(v[S]=v[S+1],v[S+1]=T,f&&S<i-1)for(let k=0;k<i;k++)T=g.get(k,S+1),g.set(k,S+1,g.get(k,S)),g.set(k,S,T);if(u&&S<n-1)for(let k=0;k<n;k++)T=p.get(k,S+1),p.set(k,S+1,p.get(k,S)),p.set(k,S,T);S++}_--;break}}}if(l){let S=g;g=p,p=S}this.m=n,this.n=i,this.s=v,this.U=p,this.V=g}solve(e){let t=e,n=this.threshold,i=this.s.length,a=dt.zeros(i,i);for(let h=0;h<i;h++)Math.abs(this.s[h])<=n?a.set(h,h,0):a.set(h,h,1/this.s[h]);let o=this.U,s=this.rightSingularVectors,u=s.mmul(a),f=s.rows,l=o.rows,c=dt.zeros(f,l);for(let h=0;h<f;h++)for(let d=0;d<l;d++){let v=0;for(let p=0;p<i;p++)v+=u.get(h,p)*o.get(d,p);c.set(h,d,v)}return c.mmul(t)}solveForDiagonal(e){return this.solve(dt.diag(e))}inverse(){let e=this.V,t=this.threshold,n=e.rows,i=e.columns,a=new dt(n,this.s.length);for(let l=0;l<n;l++)for(let c=0;c<i;c++)Math.abs(this.s[c])>t&&a.set(l,c,e.get(l,c)/this.s[c]);let o=this.U,s=o.rows,u=o.columns,f=new dt(n,s);for(let l=0;l<n;l++)for(let c=0;c<s;c++){let h=0;for(let d=0;d<u;d++)h+=a.get(l,d)*o.get(c,d);f.set(l,c,h)}return f}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>e&&t++;return t}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 dt.diag(this.s)}}function lre(r,e=!1){return r=Qn.checkMatrix(r),e?new Nu(r).inverse():ik(r,dt.eye(r.rows))}function ik(r,e,t=!1){return r=Qn.checkMatrix(r),e=Qn.checkMatrix(e),t?new Nu(r).solve(e):r.isSquare()?new uv(r).solve(e):new Rm(r).solve(e)}function fv(r){if(r=dt.checkMatrix(r),r.isSquare()){let e,t,n,i;if(r.columns===2)return e=r.get(0,0),t=r.get(0,1),n=r.get(1,0),i=r.get(1,1),e*i-t*n;if(r.columns===3){let a,o,s;return a=new sv(r,[1,2],[1,2]),o=new sv(r,[1,2],[0,2]),s=new sv(r,[1,2],[0,1]),e=r.get(0,0),t=r.get(0,1),n=r.get(0,2),e*fv(a)-t*fv(o)+n*fv(s)}else return new uv(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function cre(r,e){let t=[];for(let n=0;n<r;n++)n!==e&&t.push(n);return t}function hre(r,e,t,n=1e-9,i=1e-9){if(r>i)return new Array(e.rows+1).fill(0);{let a=e.addRow(t,[0]);for(let o=0;o<a.rows;o++)Math.abs(a.get(o,0))<n&&a.set(o,0,0);return a.to1DArray()}}function dre(r,e={}){const{thresholdValue:t=1e-9,thresholdError:n=1e-9}=e;r=dt.checkMatrix(r);let i=r.rows,a=new dt(i,i);for(let o=0;o<i;o++){let s=dt.columnVector(r.getRow(o)),u=r.subMatrixRow(cre(i,o)).transpose(),l=new Nu(u).solve(s),c=dt.sub(s,u.mmul(l)).abs().max();a.setRow(o,hre(c,l,o,t,n))}return a}function vre(r,e=Number.EPSILON){r=dt.checkMatrix(r);let t=new Nu(r,{autoTranspose:!0}),n=t.leftSingularVectors,i=t.rightSingularVectors,a=t.diagonal;for(let o=0;o<a.length;o++)Math.abs(a[o])>e?a[o]=1/a[o]:a[o]=0;return i.mmul(dt.diag(a).mmul(n.transpose()))}function pre(r,e=r,t={}){r=new dt(r);let n=!1;if(typeof e=="object"&&!dt.isMatrix(e)&&!Array.isArray(e)?(t=e,e=r,n=!0):e=new dt(e),r.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=t;i&&(r=r.center("column"),n||(e=e.center("column")));const a=r.transpose().mmul(e);for(let o=0;o<a.rows;o++)for(let s=0;s<a.columns;s++)a.set(o,s,a.get(o,s)*(1/(r.rows-1)));return a}function gre(r,e=r,t={}){r=new dt(r);let n=!1;if(typeof e=="object"&&!dt.isMatrix(e)&&!Array.isArray(e)?(t=e,e=r,n=!0):e=new dt(e),r.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:a=!0}=t;i&&(r.center("column"),n||e.center("column")),a&&(r.scale("column"),n||e.scale("column"));const o=r.standardDeviation("column",{unbiased:!0}),s=n?o:e.standardDeviation("column",{unbiased:!0}),u=r.transpose().mmul(e);for(let f=0;f<u.rows;f++)for(let l=0;l<u.columns;l++)u.set(f,l,u.get(f,l)*(1/(o[f]*s[l]))*(1/(r.rows-1)));return u}class ak{constructor(e,t={}){const{assumeSymmetric:n=!1}=t;if(e=Qn.checkMatrix(e),!e.isSquare())throw new Error("Matrix is not a square matrix");let i=e.columns,a=new dt(i,i),o=new Float64Array(i),s=new Float64Array(i),u=e,f,l,c=!1;if(n?c=!0:c=e.isSymmetric(),c){for(f=0;f<i;f++)for(l=0;l<i;l++)a.set(f,l,u.get(f,l));yre(i,s,o,a),mre(i,s,o,a)}else{let h=new dt(i,i),d=new Float64Array(i);for(l=0;l<i;l++)for(f=0;f<i;f++)h.set(f,l,u.get(f,l));bre(i,h,d,a),xre(i,s,o,a,h)}this.n=i,this.e=s,this.d=o,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 e=this.n,t=this.e,n=this.d,i=new dt(e,e),a,o;for(a=0;a<e;a++){for(o=0;o<e;o++)i.set(a,o,0);i.set(a,a,n[a]),t[a]>0?i.set(a,a+1,t[a]):t[a]<0&&i.set(a,a-1,t[a])}return i}}function yre(r,e,t,n){let i,a,o,s,u,f,l,c;for(u=0;u<r;u++)t[u]=n.get(r-1,u);for(s=r-1;s>0;s--){for(c=0,o=0,f=0;f<s;f++)c=c+Math.abs(t[f]);if(c===0)for(e[s]=t[s-1],u=0;u<s;u++)t[u]=n.get(s-1,u),n.set(s,u,0),n.set(u,s,0);else{for(f=0;f<s;f++)t[f]/=c,o+=t[f]*t[f];for(i=t[s-1],a=Math.sqrt(o),i>0&&(a=-a),e[s]=c*a,o=o-i*a,t[s-1]=i-a,u=0;u<s;u++)e[u]=0;for(u=0;u<s;u++){for(i=t[u],n.set(u,s,i),a=e[u]+n.get(u,u)*i,f=u+1;f<=s-1;f++)a+=n.get(f,u)*t[f],e[f]+=n.get(f,u)*i;e[u]=a}for(i=0,u=0;u<s;u++)e[u]/=o,i+=e[u]*t[u];for(l=i/(o+o),u=0;u<s;u++)e[u]-=l*t[u];for(u=0;u<s;u++){for(i=t[u],a=e[u],f=u;f<=s-1;f++)n.set(f,u,n.get(f,u)-(i*e[f]+a*t[f]));t[u]=n.get(s-1,u),n.set(s,u,0)}}t[s]=o}for(s=0;s<r-1;s++){if(n.set(r-1,s,n.get(s,s)),n.set(s,s,1),o=t[s+1],o!==0){for(f=0;f<=s;f++)t[f]=n.get(f,s+1)/o;for(u=0;u<=s;u++){for(a=0,f=0;f<=s;f++)a+=n.get(f,s+1)*n.get(f,u);for(f=0;f<=s;f++)n.set(f,u,n.get(f,u)-a*t[f])}}for(f=0;f<=s;f++)n.set(f,s+1,0)}for(u=0;u<r;u++)t[u]=n.get(r-1,u),n.set(r-1,u,0);n.set(r-1,r-1,1),e[0]=0}function mre(r,e,t,n){let i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b;for(o=1;o<r;o++)e[o-1]=e[o];e[r-1]=0;let x=0,w=0,E=Number.EPSILON;for(f=0;f<r;f++){for(w=Math.max(w,Math.abs(t[f])+Math.abs(e[f])),l=f;l<r&&!(Math.abs(e[l])<=E*w);)l++;if(l>f)do{for(i=t[f],c=(t[f+1]-i)/(2*e[f]),h=Ba(c,1),c<0&&(h=-h),t[f]=e[f]/(c+h),t[f+1]=e[f]*(c+h),d=t[f+1],a=i-t[f],o=f+2;o<r;o++)t[o]-=a;for(x=x+a,c=t[l],v=1,p=v,g=v,y=e[f+1],m=0,b=0,o=l-1;o>=f;o--)for(g=p,p=v,b=m,i=v*e[o],a=v*c,h=Ba(c,e[o]),e[o+1]=m*h,m=e[o]/h,v=c/h,c=v*t[o]-m*i,t[o+1]=a+m*(v*i+m*t[o]),u=0;u<r;u++)a=n.get(u,o+1),n.set(u,o+1,m*n.get(u,o)+v*a),n.set(u,o,v*n.get(u,o)-m*a);c=-m*b*g*y*e[f]/d,e[f]=m*c,t[f]=v*c}while(Math.abs(e[f])>E*w);t[f]=t[f]+x,e[f]=0}for(o=0;o<r-1;o++){for(u=o,c=t[o],s=o+1;s<r;s++)t[s]<c&&(u=s,c=t[s]);if(u!==o)for(t[u]=t[o],t[o]=c,s=0;s<r;s++)c=n.get(s,o),n.set(s,o,n.get(s,u)),n.set(s,u,c)}}function bre(r,e,t,n){let i=0,a=r-1,o,s,u,f,l,c,h;for(c=i+1;c<=a-1;c++){for(h=0,f=c;f<=a;f++)h=h+Math.abs(e.get(f,c-1));if(h!==0){for(u=0,f=a;f>=c;f--)t[f]=e.get(f,c-1)/h,u+=t[f]*t[f];for(s=Math.sqrt(u),t[c]>0&&(s=-s),u=u-t[c]*s,t[c]=t[c]-s,l=c;l<r;l++){for(o=0,f=a;f>=c;f--)o+=t[f]*e.get(f,l);for(o=o/u,f=c;f<=a;f++)e.set(f,l,e.get(f,l)-o*t[f])}for(f=0;f<=a;f++){for(o=0,l=a;l>=c;l--)o+=t[l]*e.get(f,l);for(o=o/u,l=c;l<=a;l++)e.set(f,l,e.get(f,l)-o*t[l])}t[c]=h*t[c],e.set(c,c-1,h*s)}}for(f=0;f<r;f++)for(l=0;l<r;l++)n.set(f,l,f===l?1:0);for(c=a-1;c>=i+1;c--)if(e.get(c,c-1)!==0){for(f=c+1;f<=a;f++)t[f]=e.get(f,c-1);for(l=c;l<=a;l++){for(s=0,f=c;f<=a;f++)s+=t[f]*n.get(f,l);for(s=s/t[c]/e.get(c,c-1),f=c;f<=a;f++)n.set(f,l,n.get(f,l)+s*t[f])}}}function xre(r,e,t,n,i){let a=r-1,o=0,s=r-1,u=Number.EPSILON,f=0,l=0,c=0,h=0,d=0,v=0,p=0,g=0,y,m,b,x,w,E,_,M,C,S,A,T,k,O,G;for(y=0;y<r;y++)for((y<o||y>s)&&(t[y]=i.get(y,y),e[y]=0),m=Math.max(y-1,0);m<r;m++)l=l+Math.abs(i.get(y,m));for(;a>=o;){for(x=a;x>o&&(v=Math.abs(i.get(x-1,x-1))+Math.abs(i.get(x,x)),v===0&&(v=l),!(Math.abs(i.get(x,x-1))<u*v));)x--;if(x===a)i.set(a,a,i.get(a,a)+f),t[a]=i.get(a,a),e[a]=0,a--,g=0;else if(x===a-1){if(_=i.get(a,a-1)*i.get(a-1,a),c=(i.get(a-1,a-1)-i.get(a,a))/2,h=c*c+_,p=Math.sqrt(Math.abs(h)),i.set(a,a,i.get(a,a)+f),i.set(a-1,a-1,i.get(a-1,a-1)+f),M=i.get(a,a),h>=0){for(p=c>=0?c+p:c-p,t[a-1]=M+p,t[a]=t[a-1],p!==0&&(t[a]=M-_/p),e[a-1]=0,e[a]=0,M=i.get(a,a-1),v=Math.abs(M)+Math.abs(p),c=M/v,h=p/v,d=Math.sqrt(c*c+h*h),c=c/d,h=h/d,m=a-1;m<r;m++)p=i.get(a-1,m),i.set(a-1,m,h*p+c*i.get(a,m)),i.set(a,m,h*i.get(a,m)-c*p);for(y=0;y<=a;y++)p=i.get(y,a-1),i.set(y,a-1,h*p+c*i.get(y,a)),i.set(y,a,h*i.get(y,a)-c*p);for(y=o;y<=s;y++)p=n.get(y,a-1),n.set(y,a-1,h*p+c*n.get(y,a)),n.set(y,a,h*n.get(y,a)-c*p)}else t[a-1]=M+c,t[a]=M+c,e[a-1]=p,e[a]=-p;a=a-2,g=0}else{if(M=i.get(a,a),C=0,_=0,x<a&&(C=i.get(a-1,a-1),_=i.get(a,a-1)*i.get(a-1,a)),g===10){for(f+=M,y=o;y<=a;y++)i.set(y,y,i.get(y,y)-M);v=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),M=C=.75*v,_=-.4375*v*v}if(g===30&&(v=(C-M)/2,v=v*v+_,v>0)){for(v=Math.sqrt(v),C<M&&(v=-v),v=M-_/((C-M)/2+v),y=o;y<=a;y++)i.set(y,y,i.get(y,y)-v);f+=v,M=C=_=.964}for(g=g+1,w=a-2;w>=x&&(p=i.get(w,w),d=M-p,v=C-p,c=(d*v-_)/i.get(w+1,w)+i.get(w,w+1),h=i.get(w+1,w+1)-p-d-v,d=i.get(w+2,w+1),v=Math.abs(c)+Math.abs(h)+Math.abs(d),c=c/v,h=h/v,d=d/v,!(w===x||Math.abs(i.get(w,w-1))*(Math.abs(h)+Math.abs(d))<u*(Math.abs(c)*(Math.abs(i.get(w-1,w-1))+Math.abs(p)+Math.abs(i.get(w+1,w+1))))));)w--;for(y=w+2;y<=a;y++)i.set(y,y-2,0),y>w+2&&i.set(y,y-3,0);for(b=w;b<=a-1&&(O=b!==a-1,b!==w&&(c=i.get(b,b-1),h=i.get(b+1,b-1),d=O?i.get(b+2,b-1):0,M=Math.abs(c)+Math.abs(h)+Math.abs(d),M!==0&&(c=c/M,h=h/M,d=d/M)),M!==0);b++)if(v=Math.sqrt(c*c+h*h+d*d),c<0&&(v=-v),v!==0){for(b!==w?i.set(b,b-1,-v*M):x!==w&&i.set(b,b-1,-i.get(b,b-1)),c=c+v,M=c/v,C=h/v,p=d/v,h=h/c,d=d/c,m=b;m<r;m++)c=i.get(b,m)+h*i.get(b+1,m),O&&(c=c+d*i.get(b+2,m),i.set(b+2,m,i.get(b+2,m)-c*p)),i.set(b,m,i.get(b,m)-c*M),i.set(b+1,m,i.get(b+1,m)-c*C);for(y=0;y<=Math.min(a,b+3);y++)c=M*i.get(y,b)+C*i.get(y,b+1),O&&(c=c+p*i.get(y,b+2),i.set(y,b+2,i.get(y,b+2)-c*d)),i.set(y,b,i.get(y,b)-c),i.set(y,b+1,i.get(y,b+1)-c*h);for(y=o;y<=s;y++)c=M*n.get(y,b)+C*n.get(y,b+1),O&&(c=c+p*n.get(y,b+2),n.set(y,b+2,n.get(y,b+2)-c*d)),n.set(y,b,n.get(y,b)-c),n.set(y,b+1,n.get(y,b+1)-c*h)}}}if(l!==0){for(a=r-1;a>=0;a--)if(c=t[a],h=e[a],h===0)for(x=a,i.set(a,a,1),y=a-1;y>=0;y--){for(_=i.get(y,y)-c,d=0,m=x;m<=a;m++)d=d+i.get(y,m)*i.get(m,a);if(e[y]<0)p=_,v=d;else if(x=y,e[y]===0?i.set(y,a,_!==0?-d/_:-d/(u*l)):(M=i.get(y,y+1),C=i.get(y+1,y),h=(t[y]-c)*(t[y]-c)+e[y]*e[y],E=(M*v-p*d)/h,i.set(y,a,E),i.set(y+1,a,Math.abs(M)>Math.abs(p)?(-d-_*E)/M:(-v-C*E)/p)),E=Math.abs(i.get(y,a)),u*E*E>1)for(m=y;m<=a;m++)i.set(m,a,i.get(m,a)/E)}else if(h<0)for(x=a-1,Math.abs(i.get(a,a-1))>Math.abs(i.get(a-1,a))?(i.set(a-1,a-1,h/i.get(a,a-1)),i.set(a-1,a,-(i.get(a,a)-c)/i.get(a,a-1))):(G=lv(0,-i.get(a-1,a),i.get(a-1,a-1)-c,h),i.set(a-1,a-1,G[0]),i.set(a-1,a,G[1])),i.set(a,a-1,0),i.set(a,a,1),y=a-2;y>=0;y--){for(S=0,A=0,m=x;m<=a;m++)S=S+i.get(y,m)*i.get(m,a-1),A=A+i.get(y,m)*i.get(m,a);if(_=i.get(y,y)-c,e[y]<0)p=_,d=S,v=A;else if(x=y,e[y]===0?(G=lv(-S,-A,_,h),i.set(y,a-1,G[0]),i.set(y,a,G[1])):(M=i.get(y,y+1),C=i.get(y+1,y),T=(t[y]-c)*(t[y]-c)+e[y]*e[y]-h*h,k=(t[y]-c)*2*h,T===0&&k===0&&(T=u*l*(Math.abs(_)+Math.abs(h)+Math.abs(M)+Math.abs(C)+Math.abs(p))),G=lv(M*d-p*S+h*A,M*v-p*A-h*S,T,k),i.set(y,a-1,G[0]),i.set(y,a,G[1]),Math.abs(M)>Math.abs(p)+Math.abs(h)?(i.set(y+1,a-1,(-S-_*i.get(y,a-1)+h*i.get(y,a))/M),i.set(y+1,a,(-A-_*i.get(y,a)-h*i.get(y,a-1))/M)):(G=lv(-d-C*i.get(y,a-1),-v-C*i.get(y,a),p,h),i.set(y+1,a-1,G[0]),i.set(y+1,a,G[1]))),E=Math.max(Math.abs(i.get(y,a-1)),Math.abs(i.get(y,a))),u*E*E>1)for(m=y;m<=a;m++)i.set(m,a-1,i.get(m,a-1)/E),i.set(m,a,i.get(m,a)/E)}for(y=0;y<r;y++)if(y<o||y>s)for(m=y;m<r;m++)n.set(y,m,i.get(y,m));for(m=r-1;m>=o;m--)for(y=o;y<=s;y++){for(p=0,b=o;b<=Math.min(m,s);b++)p=p+n.get(y,b)*i.get(b,m);n.set(y,m,p)}}}function lv(r,e,t,n){let i,a;return Math.abs(t)>Math.abs(n)?(i=n/t,a=t+i*n,[(r+i*e)/a,(e-i*r)/a]):(i=t/n,a=n+i*t,[(i*r+e)/a,(i*e-r)/a])}class ok{constructor(e){if(e=Qn.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,n=t.rows,i=new dt(n,n),a=!0,o,s,u;for(s=0;s<n;s++){let f=0;for(u=0;u<s;u++){let l=0;for(o=0;o<u;o++)l+=i.get(u,o)*i.get(s,o);l=(t.get(s,u)-l)/i.get(u,u),i.set(s,u,l),f=f+l*l}for(f=t.get(s,s)-f,a&=f>0,i.set(s,s,Math.sqrt(Math.max(f,0))),u=s+1;u<n;u++)i.set(s,u,0)}this.L=i,this.positiveDefinite=!!a}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=Qn.checkMatrix(e);let t=this.L,n=t.rows;if(e.rows!==n)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=e.columns,a=e.clone(),o,s,u;for(u=0;u<n;u++)for(s=0;s<i;s++){for(o=0;o<u;o++)a.set(u,s,a.get(u,s)-a.get(o,s)*t.get(u,o));a.set(u,s,a.get(u,s)/t.get(u,u))}for(u=n-1;u>=0;u--)for(s=0;s<i;s++){for(o=u+1;o<n;o++)a.set(u,s,a.get(u,s)-a.get(o,s)*t.get(o,u));a.set(u,s,a.get(u,s)/t.get(u,u))}return a}get lowerTriangularMatrix(){return this.L}}class sk{constructor(e,t={}){e=Qn.checkMatrix(e);let{Y:n}=t;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:o=1e-10}=t;let s;if(n){if(Array.isArray(n)&&typeof n[0]=="number"?n=dt.columnVector(n):n=Qn.checkMatrix(n),!n.isColumnVector()||n.rows!==e.rows)throw new Error("Y must be a column vector of length X.rows");s=n}else s=e.getColumnVector(0);let u=1,f,l,c,h;for(let d=0;d<a&&u>o;d++)c=e.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),c=c.div(c.norm()),f=e.mmul(c).div(c.transpose().mmul(c).get(0,0)),d>0&&(u=f.clone().sub(h).pow(2).sum()),h=f.clone(),n?(l=n.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0)),l=l.div(l.norm()),s=n.mmul(l).div(l.transpose().mmul(l).get(0,0))):s=f;if(n){let d=e.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0));d=d.div(d.norm());let v=e.clone().sub(f.clone().mmul(d.transpose())),p=s.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0)),g=n.clone().sub(f.clone().mulS(p.get(0,0)).mmul(l.transpose()));this.t=f,this.p=d.transpose(),this.w=c.transpose(),this.q=l,this.u=s,this.s=f.transpose().mmul(f),this.xResidual=v,this.yResidual=g,this.betas=p}else this.w=c.transpose(),this.s=f.transpose().mmul(f).sqrt(),i?this.t=f.clone().div(this.s.get(0,0)):this.t=f,this.xResidual=e.sub(f.mmul(c.transpose()))}}const uk=ea(Object.freeze(Object.defineProperty({__proto__:null,AbstractMatrix:qt,CHO:ok,CholeskyDecomposition:ok,EVD:ak,EigenvalueDecomposition:ak,LU:uv,LuDecomposition:uv,Matrix:dt,MatrixColumnSelectionView:rre,MatrixColumnView:tre,MatrixFlipColumnView:nre,MatrixFlipRowView:ire,MatrixRowSelectionView:ore,MatrixRowView:are,MatrixSelectionView:sv,MatrixSubView:sre,MatrixTransposeView:ure,NIPALS:sk,Nipals:sk,QR:Rm,QrDecomposition:Rm,SVD:Nu,SingularValueDecomposition:Nu,WrapperMatrix1D:nk,WrapperMatrix2D:Qn,correlation:gre,covariance:pre,default:dt,determinant:fv,inverse:lre,linearDependencies:dre,pseudoInverse:vre,solve:ik,wrap:fre},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(Dm,"__esModule",{value:!0});var xl=uk,wre=function(){function r(e){this.distances=e.distances,this.dimension=e.dimension||2,this.linkDistance=e.linkDistance}return r.prototype.layout=function(){var e=this,t=e.dimension,n=e.distances,i=e.linkDistance;try{var a=xl.Matrix.mul(xl.Matrix.pow(n,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);var f=new xl.SingularValueDecomposition(a),l=xl.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(p){return xl.Matrix.mul([p],[l]).toJSON()[0].splice(0,t)})}catch{for(var c=[],h=0;h<n.length;h++){var d=Math.random()*i,v=Math.random()*i;c.push([d,v])}return c}},r}();Dm.default=wre;var Bm={};Object.defineProperty(Bm,"__esModule",{value:!0});var Ere=800,_re=function(){function r(e){this.disp=[],this.positions=e.positions,this.adjMatrix=e.adjMatrix,this.focusID=e.focusID,this.radii=e.radii,this.iterations=e.iterations||10,this.height=e.height||10,this.width=e.width||10,this.speed=e.speed||100,this.gravity=e.gravity||10,this.nodeSizeFunc=e.nodeSizeFunc,this.k=e.k||5,this.strictRadial=e.strictRadial,this.nodes=e.nodes}return r.prototype.layout=function(){var e=this,t=e.positions,n=[],i=e.iterations,a=e.width/10;e.maxDisplace=a,e.disp=n;for(var o=0;o<i;o++)t.forEach(function(s,u){n[u]={x:0,y:0}}),e.getRepulsion(),e.updatePositions();return t},r.prototype.getRepulsion=function(){var e=this,t=e.positions,n=e.nodes,i=e.disp,a=e.k,o=e.radii||[];t.forEach(function(s,u){i[u]={x:0,y:0},t.forEach(function(f,l){if(u!==l&&o[u]===o[l]){var c=s[0]-f[0],h=s[1]-f[1],d=Math.sqrt(c*c+h*h);if(d===0){d=1;var v=u>l?1:-1;c=.01*v,h=.01*v}if(d<e.nodeSizeFunc(n[u])/2+e.nodeSizeFunc(n[l])/2){var p=a*a/d;i[u].x+=c/d*p,i[u].y+=h/d*p}}})})},r.prototype.updatePositions=function(){var e=this,t=e.positions,n=e.disp,i=e.speed,a=e.strictRadial,o=e.focusID,s=e.maxDisplace||e.width/10;a&&n.forEach(function(f,l){var c=t[l][0]-t[o][0],h=t[l][1]-t[o][1],d=Math.sqrt(c*c+h*h),v=h/d,p=-c/d,g=Math.sqrt(f.x*f.x+f.y*f.y),y=Math.acos((v*f.x+p*f.y)/g);y>Math.PI/2&&(y-=Math.PI/2,v*=-1,p*=-1);var m=Math.cos(y)*g;f.x=v*m,f.y=p*m});var u=e.radii;t.forEach(function(f,l){if(l!==o){var c=Math.sqrt(n[l].x*n[l].x+n[l].y*n[l].y);if(c>0&&l!==o){var h=Math.min(s*(i/Ere),c);if(f[0]+=n[l].x/c*h,f[1]+=n[l].y/c*h,a){var d=f[0]-t[o][0],v=f[1]-t[o][1],p=Math.sqrt(d*d+v*v);d=d/p*u[l],v=v/p*u[l],f[0]=t[o][0]+d,f[1]=t[o][1]+v}}}})},r}();Bm.default=_re;var Sre=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),fk=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rv,"__esModule",{value:!0}),rv.RadialLayout=void 0;var di=Ir(),Mre=Pr,Cre=fk(Dm),Are=fk(Bm);function Tre(r){for(var e=r.length,t=r[0].length,n=[],i=0;i<e;i++){for(var a=[],o=0;o<t;o++)r[i][o]!==0?a.push(1/(r[i][o]*r[i][o])):a.push(0);n.push(a)}return n}function Ire(r,e){var t=-1;return r.forEach(function(n,i){n.id===e&&(t=i)}),t}function lk(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}var kre=function(r){Sre(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,strictRadial:!0,maxPreventOverlapIteration:200,sortBy:void 0,sortStrength:10}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges||[];if(!n||n.length===0){t.onLayoutEnd&&t.onLayoutEnd();return}!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var a=t.center;if(n.length===1){n[0].x=a[0],n[0].y=a[1],t.onLayoutEnd&&t.onLayoutEnd();return}var o=t.linkDistance,s=null;if((0,di.isString)(t.focusNode)){for(var u=!1,f=0;f<n.length;f++)n[f].id===t.focusNode&&(s=n[f],t.focusNode=s,u=!0,f=n.length);u||(s=null)}else s=t.focusNode;s||(s=n[0],t.focusNode=s);var l=Ire(n,s.id);l<0&&(l=0),t.focusIndex=l;var c=(0,di.getAdjMatrix)({nodes:n,edges:i},!1),h=(0,di.floydWarshall)(c),d=t.maxToFocus(h,l);t.handleInfinity(h,l,d+1),t.distances=h;var v=h[l],p=t.width||500,g=t.height||500,y=p-a[0]>a[0]?a[0]:p-a[0],m=g-a[1]>a[1]?a[1]:g-a[1];y===0&&(y=p/2),m===0&&(m=g/2);var b=m>y?y:m,x=Math.max.apply(Math,v),w=[];v.forEach(function(Y,N){t.unitRadius||(t.unitRadius=b/x),w[N]=Y*t.unitRadius}),t.radii=w;var E=t.eIdealDisMatrix();t.eIdealDistances=E;var _=Tre(E);t.weights=_;var M=new Cre.default({linkDistance:o,distances:E}),C=M.layout();C.forEach(function(Y){(0,di.isNaN)(Y[0])&&(Y[0]=Math.random()*o),(0,di.isNaN)(Y[1])&&(Y[1]=Math.random()*o)}),t.positions=C,C.forEach(function(Y,N){n[N].x=Y[0]+a[0],n[N].y=Y[1]+a[1]}),C.forEach(function(Y){Y[0]-=C[l][0],Y[1]-=C[l][1]}),t.run();var S=t.preventOverlap,A=t.nodeSize,T,k=t.strictRadial;if(S){var O=t.nodeSpacing,G;(0,di.isNumber)(O)?G=function(){return O}:(0,di.isFunction)(O)?G=O:G=function(){return 0},A?(0,di.isArray)(A)?T=function(Y){var N=A[0]>A[1]?A[0]:A[1];return N+G(Y)}:T=function(Y){return A+G(Y)}:T=function(Y){if(Y.size){if((0,di.isArray)(Y.size)){var N=Y.size[0]>Y.size[1]?Y.size[0]:Y.size[1];return N+G(Y)}if((0,di.isObject)(Y.size)){var N=Y.size.width>Y.size.height?Y.size.width:Y.size.height;return N+G(Y)}return Y.size+G(Y)}return 10+G(Y)};var D={nodes:n,nodeSizeFunc:T,adjMatrix:c,positions:C,radii:w,height:g,width:p,strictRadial:k,focusID:l,iterations:t.maxPreventOverlapIteration||200,k:C.length/4.5},$=new Are.default(D);C=$.layout()}return C.forEach(function(Y,N){n[N].x=Y[0]+a[0],n[N].y=Y[1]+a[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i}},e.prototype.run=function(){for(var t=this,n=t.maxIteration,i=t.positions||[],a=t.weights||[],o=t.eIdealDistances||[],s=t.radii||[],u=0;u<=n;u++){var f=u/n;t.oneIteration(f,i,s,o,a)}},e.prototype.oneIteration=function(t,n,i,a,o){var s=this,u=1-t,f=s.focusIndex;n.forEach(function(l,c){var h=lk(l,[0,0]),d=h===0?0:1/h;if(c!==f){var v=0,p=0,g=0;n.forEach(function(m,b){if(c!==b){var x=lk(l,m),w=x===0?0:1/x,E=a[b][c];g+=o[c][b],v+=o[c][b]*(m[0]+E*(l[0]-m[0])*w),p+=o[c][b]*(m[1]+E*(l[1]-m[1])*w)}});var y=i[c]===0?0:1/i[c];g*=u,g+=t*y*y,v*=u,v+=t*y*l[0]*d,l[0]=v/g,p*=u,p+=t*y*l[1]*d,l[1]=p/g}})},e.prototype.eIdealDisMatrix=function(){var t=this,n=t.nodes;if(!n)return[];var i=t.distances,a=t.linkDistance,o=t.radii||[],s=t.unitRadius||50,u=[];return i&&i.forEach(function(f,l){var c=[];f.forEach(function(h,d){if(l===d)c.push(0);else if(o[l]===o[d])if(t.sortBy==="data")c.push(h*(Math.abs(l-d)*t.sortStrength)/(o[l]/s));else if(t.sortBy){var v=n[l][t.sortBy]||0,p=n[d][t.sortBy]||0;(0,di.isString)(v)&&(v=v.charCodeAt(0)),(0,di.isString)(p)&&(p=p.charCodeAt(0)),c.push(h*(Math.abs(v-p)*t.sortStrength)/(o[l]/s))}else c.push(h*a/(o[l]/s));else{var g=(a+s)/2;c.push(h*g)}}),u.push(c)}),u},e.prototype.handleInfinity=function(t,n,i){for(var a=t.length,o=0;o<a;o++)if(t[n][o]===1/0){t[n][o]=i,t[o][n]=i;for(var s=0;s<a;s++)t[o][s]!==1/0&&t[n][s]===1/0&&(t[n][s]=i+t[o][s],t[s][n]=i+t[o][s])}for(var o=0;o<a;o++)if(o!==n){for(var s=0;s<a;s++)if(t[o][s]===1/0){var u=Math.abs(t[n][o]-t[n][s]);u=u===0?1:u,t[o][s]=u}}},e.prototype.maxToFocus=function(t,n){for(var i=0,a=0;a<t[n].length;a++)t[n][a]!==1/0&&(i=t[n][a]>i?t[n][a]:i);return i},e.prototype.getType=function(){return"radial"},e}(Mre.Base);rv.RadialLayout=kre,function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(rv,r)}(Om);var wl={},Lre=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(wl,"__esModule",{value:!0}),wl.ConcentricLayout=void 0;var ua=Ir(),Nre=Pr,Ore=function(r){Lre(e,r);function e(t){var n=r.call(this)||this;return n.nodeSize=30,n.minNodeSpacing=10,n.nodeSpacing=10,n.preventOverlap=!1,n.equidistant=!1,n.startAngle=3/2*Math.PI,n.clockwise=!0,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{nodeSize:30,minNodeSpacing:10,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"}},e.prototype.execute=function(){var t,n,i=this,a=i.nodes,o=i.edges,s=a.length;if(s===0){(t=i.onLayoutEnd)===null||t===void 0||t.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var u=i.center;if(s===1){a[0].x=u[0],a[0].y=u[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var f=i.nodeSize,l=i.nodeSpacing,c=[],h,d=0;(0,ua.isArray)(f)?h=Math.max(f[0],f[1]):h=f,(0,ua.isArray)(l)?d=Math.max(l[0],l[1]):(0,ua.isNumber)(l)&&(d=l),a.forEach(function(k){c.push(k);var O=h;(0,ua.isArray)(k.size)?O=Math.max(k.size[0],k.size[1]):(0,ua.isNumber)(k.size)?O=k.size:(0,ua.isObject)(k.size)&&(O=Math.max(k.size.width,k.size.height)),h=Math.max(h,O),(0,ua.isFunction)(l)&&(d=Math.max(l(k),d))}),i.clockwise=i.counterclockwise!==void 0?!i.counterclockwise:i.clockwise;var v={},p={};if(c.forEach(function(k,O){v[k.id]=k,p[k.id]=O}),(i.sortBy==="degree"||!(0,ua.isString)(i.sortBy)||c[0][i.sortBy]===void 0)&&(i.sortBy="degree",!(0,ua.isNumber)(a[0].degree))){var g=(0,ua.getDegree)(a.length,p,o);c.forEach(function(k,O){k.degree=g[O].all})}c.sort(function(k,O){return O[i.sortBy]-k[i.sortBy]}),i.maxValueNode=c[0],i.maxLevelDiff=i.maxLevelDiff||i.maxValueNode[i.sortBy]/4;var y=[[]],m=y[0];c.forEach(function(k){if(m.length>0){var O=Math.abs(m[0][i.sortBy]-k[i.sortBy]);i.maxLevelDiff&&O>=i.maxLevelDiff&&(m=[],y.push(m))}m.push(k)});var b=h+(d||i.minNodeSpacing);if(!i.preventOverlap){var x=y.length>0&&y[0].length>1,w=Math.min(i.width,i.height)/2-b,E=w/(y.length+(x?1:0));b=Math.min(b,E)}var _=0;if(y.forEach(function(k){var O=i.sweep;O===void 0&&(O=2*Math.PI-2*Math.PI/k.length);var G=k.dTheta=O/Math.max(1,k.length-1);if(k.length>1&&i.preventOverlap){var D=Math.cos(G)-Math.cos(0),$=Math.sin(G)-Math.sin(0),Y=Math.sqrt(b*b/(D*D+$*$));_=Math.max(Y,_)}k.r=_,_+=b}),i.equidistant){for(var M=0,C=0,S=0;S<y.length;S++){var A=y[S],T=A.r-C;M=Math.max(M,T)}C=0,y.forEach(function(k,O){O===0&&(C=k.r),k.r=C,C+=M})}return y.forEach(function(k){var O=k.dTheta,G=k.r;k.forEach(function(D,$){var Y=i.startAngle+(i.clockwise?1:-1)*O*$;D.x=u[0]+G*Math.cos(Y),D.y=u[1]+G*Math.sin(Y)})}),i.onLayoutEnd&&i.onLayoutEnd(),{nodes:a,edges:o}},e.prototype.getType=function(){return"concentric"},e}(Nre.Base);wl.ConcentricLayout=Ore;var El={},Dre=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(El,"__esModule",{value:!0}),El.MDSLayout=void 0;var _l=uk,Fm=Ir(),Pre=Pr,Rre=function(r){Dre(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.linkDistance=50,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges,a=i===void 0?[]:i,o=t.center;if(!n||n.length===0){t.onLayoutEnd&&t.onLayoutEnd();return}if(n.length===1){n[0].x=o[0],n[0].y=o[1],t.onLayoutEnd&&t.onLayoutEnd();return}var s=t.linkDistance,u=(0,Fm.getAdjMatrix)({nodes:n,edges:a},!1),f=(0,Fm.floydWarshall)(u);t.handleInfinity(f);var l=(0,Fm.scaleMatrix)(f,s);t.scaledDistances=l;var c=t.runMDS();return t.positions=c,c.forEach(function(h,d){n[d].x=h[0]+o[0],n[d].y=h[1]+o[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:a}},e.prototype.runMDS=function(){var t=this,n=2,i=t.scaledDistances,a=_l.Matrix.mul(_l.Matrix.pow(i,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);var f=new _l.SingularValueDecomposition(a),l=_l.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(c){return _l.Matrix.mul([c],[l]).toJSON()[0].splice(0,n)})},e.prototype.handleInfinity=function(t){var n=-999999;t.forEach(function(i){i.forEach(function(a){a!==1/0&&n<a&&(n=a)})}),t.forEach(function(i,a){i.forEach(function(o,s){o===1/0&&(t[a][s]=n)})})},e.prototype.getType=function(){return"mds"},e}(Pre.Base);El.MDSLayout=Rre;var Sl={},Bre=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Sl,"__esModule",{value:!0}),Sl.FruchtermanLayout=void 0;var Fre=Pr,Br=Ir(),Gre=800,zre=function(r){Bre(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=1e3,n.workerEnabled=!1,n.gravity=10,n.speed=5,n.clustering=!1,n.clusterGravity=10,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.onLayoutEnd=function(){},n.tick=function(){},n.animate=!0,n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},e.prototype.execute=function(){var t=this,n,i,a=this,o=a.nodes;if(a.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(a.timeInterval),!o||o.length===0){(n=a.onLayoutEnd)===null||n===void 0||n.call(a);return}!a.width&&typeof window<"u"&&(a.width=window.innerWidth),!a.height&&typeof window<"u"&&(a.height=window.innerHeight),a.center||(a.center=[a.width/2,a.height/2]);var s=a.center;if(o.length===1){o[0].x=s[0],o[0].y=s[1],(i=a.onLayoutEnd)===null||i===void 0||i.call(a);return}var u={},f={};return o.forEach(function(l,c){(0,Br.isNumber)(l.x)||(l.x=Math.random()*t.width),(0,Br.isNumber)(l.y)||(l.y=Math.random()*t.height),u[l.id]=l,f[l.id]=c}),a.nodeMap=u,a.nodeIdxMap=f,a.run()},e.prototype.run=function(){var t,n=this,i=n.nodes;if(i){var a=n.edges,o=n.maxIteration,s=n.workerEnabled,u=n.clustering,f=n.animate,l={};if(u&&i.forEach(function(d){l[d.cluster]===void 0&&(l[d.cluster]={name:d.cluster,cx:0,cy:0,count:0})}),s||!f){for(var c=0;c<o;c++)n.runOneStep(l);(t=n.onLayoutEnd)===null||t===void 0||t.call(n)}else{if(typeof window>"u")return;var h=0;this.timeInterval=window.setInterval(function(){var d;n.runOneStep(l),h++,h>=o&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))},0)}return{nodes:i,edges:a}}},e.prototype.runOneStep=function(t){var n,i=this,a=i.nodes;if(a){var o=i.edges,s=i.center,u=i.gravity,f=i.speed,l=i.clustering,c=i.height*i.width,h=Math.sqrt(c)/10,d=c/(a.length+1),v=Math.sqrt(d),p=[];if(a.forEach(function(m,b){p[b]={x:0,y:0}}),i.applyCalculate(a,o,p,v,d),l){for(var g in t)t[g].cx=0,t[g].cy=0,t[g].count=0;a.forEach(function(m){var b=t[m.cluster];(0,Br.isNumber)(m.x)&&(b.cx+=m.x),(0,Br.isNumber)(m.y)&&(b.cy+=m.y),b.count++});for(var g in t)t[g].cx/=t[g].count,t[g].cy/=t[g].count;var y=i.clusterGravity||u;a.forEach(function(m,b){if(!(!(0,Br.isNumber)(m.x)||!(0,Br.isNumber)(m.y))){var x=t[m.cluster],w=Math.sqrt((m.x-x.cx)*(m.x-x.cx)+(m.y-x.cy)*(m.y-x.cy)),E=v*y;p[b].x-=E*(m.x-x.cx)/w,p[b].y-=E*(m.y-x.cy)/w}})}a.forEach(function(m,b){if(!(!(0,Br.isNumber)(m.x)||!(0,Br.isNumber)(m.y))){var x=.01*v*u;p[b].x-=x*(m.x-s[0]),p[b].y-=x*(m.y-s[1])}}),a.forEach(function(m,b){if((0,Br.isNumber)(m.fx)&&(0,Br.isNumber)(m.fy)){m.x=m.fx,m.y=m.fy;return}if(!(!(0,Br.isNumber)(m.x)||!(0,Br.isNumber)(m.y))){var x=Math.sqrt(p[b].x*p[b].x+p[b].y*p[b].y);if(x>0){var w=Math.min(h*(f/Gre),x);m.x+=p[b].x/x*w,m.y+=p[b].y/x*w}}}),(n=i.tick)===null||n===void 0||n.call(i)}},e.prototype.applyCalculate=function(t,n,i,a,o){var s=this;s.calRepulsive(t,i,o),n&&s.calAttractive(n,i,a)},e.prototype.calRepulsive=function(t,n,i){t.forEach(function(a,o){n[o]={x:0,y:0},t.forEach(function(s,u){if(o!==u&&!(!(0,Br.isNumber)(a.x)||!(0,Br.isNumber)(s.x)||!(0,Br.isNumber)(a.y)||!(0,Br.isNumber)(s.y))){var f=a.x-s.x,l=a.y-s.y,c=f*f+l*l;if(c===0){c=1;var h=o>u?1:-1;f=.01*h,l=.01*h}var d=i/c;n[o].x+=f*d,n[o].y+=l*d}})})},e.prototype.calAttractive=function(t,n,i){var a=this;t.forEach(function(o){var s=(0,Br.getEdgeTerminal)(o,"source"),u=(0,Br.getEdgeTerminal)(o,"target");if(!(!s||!u)){var f=a.nodeIdxMap[s],l=a.nodeIdxMap[u];if(f!==l){var c=a.nodeMap[s],h=a.nodeMap[u];if(!(!(0,Br.isNumber)(h.x)||!(0,Br.isNumber)(c.x)||!(0,Br.isNumber)(h.y)||!(0,Br.isNumber)(c.y))){var d=h.x-c.x,v=h.y-c.y,p=Math.sqrt(d*d+v*v),g=p*p/i;n[l].x-=d/p*g,n[l].y-=v/p*g,n[f].x+=d/p*g,n[f].y+=v/p*g}}}})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(Fre.Base);Sl.FruchtermanLayout=zre;var Ml={};function ck(r,e,t,n,i,a,o){try{var s=r[a](o),u=s.value}catch(f){return void t(f)}s.done?e(u):Promise.resolve(u).then(n,i)}function _o(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(u){ck(a,n,i,o,s,"next",u)}function s(u){ck(a,n,i,o,s,"throw",u)}o(void 0)})}}function Ou(r){"@babel/helpers - typeof";return Ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ou(r)}function $re(r,e){if(Ou(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Ou(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function hk(r){var e=$re(r,"string");return Ou(e)=="symbol"?e:e+""}function Je(r,e,t){return(e=hk(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Oi(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function dk(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,hk(n.key),n)}}function Di(r,e,t){return e&&dk(r.prototype,e),t&&dk(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var jre=typeof xe=="object"&&xe&&xe.Object===Object&&xe,vk=jre,Ure=vk,Xre=typeof self=="object"&&self&&self.Object===Object&&self,Yre=Ure||Xre||Function("return this")(),Wre=Yre,Vre=Wre,Hre=Vre.Symbol,pk=Hre,gk=pk,yk=Object.prototype,qre=yk.hasOwnProperty,Zre=yk.toString,Cl=gk?gk.toStringTag:void 0;function Kre(r){var e=qre.call(r,Cl),t=r[Cl];try{r[Cl]=void 0;var n=!0}catch{}var i=Zre.call(r);return n&&(e?r[Cl]=t:delete r[Cl]),i}var Qre=Kre,Jre=Object.prototype,ene=Jre.toString;function tne(r){return ene.call(r)}var rne=tne,mk=pk,nne=Qre,ine=rne,ane="[object Null]",one="[object Undefined]",bk=mk?mk.toStringTag:void 0;function sne(r){return r==null?r===void 0?one:ane:bk&&bk in Object(r)?nne(r):ine(r)}var Gm=sne,une=9007199254740991;function fne(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=une}var lne=fne;function cne(r){return r!=null&&typeof r=="object"}var zm=cne,hne=Gm,dne=lne,vne=zm,pne="[object Arguments]",gne="[object Array]",yne="[object Boolean]",mne="[object Date]",bne="[object Error]",xne="[object Function]",wne="[object Map]",Ene="[object Number]",_ne="[object Object]",Sne="[object RegExp]",Mne="[object Set]",Cne="[object String]",Ane="[object WeakMap]",Tne="[object ArrayBuffer]",Ine="[object DataView]",kne="[object Float32Array]",Lne="[object Float64Array]",Nne="[object Int8Array]",One="[object Int16Array]",Dne="[object Int32Array]",Pne="[object Uint8Array]",Rne="[object Uint8ClampedArray]",Bne="[object Uint16Array]",Fne="[object Uint32Array]",Mr={};Mr[kne]=Mr[Lne]=Mr[Nne]=Mr[One]=Mr[Dne]=Mr[Pne]=Mr[Rne]=Mr[Bne]=Mr[Fne]=!0,Mr[pne]=Mr[gne]=Mr[Tne]=Mr[yne]=Mr[Ine]=Mr[mne]=Mr[bne]=Mr[xne]=Mr[wne]=Mr[Ene]=Mr[_ne]=Mr[Sne]=Mr[Mne]=Mr[Cne]=Mr[Ane]=!1;function Gne(r){return vne(r)&&dne(r.length)&&!!Mr[hne(r)]}var zne=Gne;function $ne(r){return function(e){return r(e)}}var jne=$ne,cv={exports:{}};cv.exports,function(r,e){var t=vk,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();r.exports=s}(cv,cv.exports);var Une=cv.exports,Xne=zne,Yne=jne,xk=Une,wk=xk&&xk.isTypedArray,Wne=wk?Yne(wk):Xne,Vne=Wne;const hv=Ji(Vne);var Hne=Gm,qne=zm,Zne="[object Number]";function Kne(r){return typeof r=="number"||qne(r)&&Hne(r)==Zne}var Qne=Kne;const Jne=Ji(Qne);var eie=Array.isArray,tie=eie;const rie=Ji(tie);var Ek={exports:{}},_k={exports:{}};(function(r){function e(t){"@babel/helpers - typeof";return r.exports=e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,e(t)}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports})(_k);var nie=_k.exports;(function(r){var e=nie.default;function t(){r.exports=t=function(){return i},r.exports.__esModule=!0,r.exports.default=r.exports;var n,i={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(N,P,W){N[P]=W.value},u=typeof Symbol=="function"?Symbol:{},f=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function h(N,P,W){return Object.defineProperty(N,P,{value:W,enumerable:!0,configurable:!0,writable:!0}),N[P]}try{h({},"")}catch{h=function(W,J,te){return W[J]=te}}function d(N,P,W,J){var te=P&&P.prototype instanceof x?P:x,H=Object.create(te.prototype),pe=new $(J||[]);return s(H,"_invoke",{value:k(N,W,pe)}),H}function v(N,P,W){try{return{type:"normal",arg:N.call(P,W)}}catch(J){return{type:"throw",arg:J}}}i.wrap=d;var p="suspendedStart",g="suspendedYield",y="executing",m="completed",b={};function x(){}function w(){}function E(){}var _={};h(_,f,function(){return this});var M=Object.getPrototypeOf,C=M&&M(M(Y([])));C&&C!==a&&o.call(C,f)&&(_=C);var S=E.prototype=x.prototype=Object.create(_);function A(N){["next","throw","return"].forEach(function(P){h(N,P,function(W){return this._invoke(P,W)})})}function T(N,P){function W(te,H,pe,Te){var Ne=v(N[te],N,H);if(Ne.type!=="throw"){var Ze=Ne.arg,at=Ze.value;return at&&e(at)=="object"&&o.call(at,"__await")?P.resolve(at.__await).then(function(nt){W("next",nt,pe,Te)},function(nt){W("throw",nt,pe,Te)}):P.resolve(at).then(function(nt){Ze.value=nt,pe(Ze)},function(nt){return W("throw",nt,pe,Te)})}Te(Ne.arg)}var J;s(this,"_invoke",{value:function(H,pe){function Te(){return new P(function(Ne,Ze){W(H,pe,Ne,Ze)})}return J=J?J.then(Te,Te):Te()}})}function k(N,P,W){var J=p;return function(te,H){if(J===y)throw Error("Generator is already running");if(J===m){if(te==="throw")throw H;return{value:n,done:!0}}for(W.method=te,W.arg=H;;){var pe=W.delegate;if(pe){var Te=O(pe,W);if(Te){if(Te===b)continue;return Te}}if(W.method==="next")W.sent=W._sent=W.arg;else if(W.method==="throw"){if(J===p)throw J=m,W.arg;W.dispatchException(W.arg)}else W.method==="return"&&W.abrupt("return",W.arg);J=y;var Ne=v(N,P,W);if(Ne.type==="normal"){if(J=W.done?m:g,Ne.arg===b)continue;return{value:Ne.arg,done:W.done}}Ne.type==="throw"&&(J=m,W.method="throw",W.arg=Ne.arg)}}}function O(N,P){var W=P.method,J=N.iterator[W];if(J===n)return P.delegate=null,W==="throw"&&N.iterator.return&&(P.method="return",P.arg=n,O(N,P),P.method==="throw")||W!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+W+"' method")),b;var te=v(J,N.iterator,P.arg);if(te.type==="throw")return P.method="throw",P.arg=te.arg,P.delegate=null,b;var H=te.arg;return H?H.done?(P[N.resultName]=H.value,P.next=N.nextLoc,P.method!=="return"&&(P.method="next",P.arg=n),P.delegate=null,b):H:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,b)}function G(N){var P={tryLoc:N[0]};1 in N&&(P.catchLoc=N[1]),2 in N&&(P.finallyLoc=N[2],P.afterLoc=N[3]),this.tryEntries.push(P)}function D(N){var P=N.completion||{};P.type="normal",delete P.arg,N.completion=P}function $(N){this.tryEntries=[{tryLoc:"root"}],N.forEach(G,this),this.reset(!0)}function Y(N){if(N||N===""){var P=N[f];if(P)return P.call(N);if(typeof N.next=="function")return N;if(!isNaN(N.length)){var W=-1,J=function te(){for(;++W<N.length;)if(o.call(N,W))return te.value=N[W],te.done=!1,te;return te.value=n,te.done=!0,te};return J.next=J}}throw new TypeError(e(N)+" is not iterable")}return w.prototype=E,s(S,"constructor",{value:E,configurable:!0}),s(E,"constructor",{value:w,configurable:!0}),w.displayName=h(E,c,"GeneratorFunction"),i.isGeneratorFunction=function(N){var P=typeof N=="function"&&N.constructor;return!!P&&(P===w||(P.displayName||P.name)==="GeneratorFunction")},i.mark=function(N){return Object.setPrototypeOf?Object.setPrototypeOf(N,E):(N.__proto__=E,h(N,c,"GeneratorFunction")),N.prototype=Object.create(S),N},i.awrap=function(N){return{__await:N}},A(T.prototype),h(T.prototype,l,function(){return this}),i.AsyncIterator=T,i.async=function(N,P,W,J,te){te===void 0&&(te=Promise);var H=new T(d(N,P,W,J),te);return i.isGeneratorFunction(P)?H:H.next().then(function(pe){return pe.done?pe.value:H.next()})},A(S),h(S,c,"Generator"),h(S,f,function(){return this}),h(S,"toString",function(){return"[object Generator]"}),i.keys=function(N){var P=Object(N),W=[];for(var J in P)W.push(J);return W.reverse(),function te(){for(;W.length;){var H=W.pop();if(H in P)return te.value=H,te.done=!1,te}return te.done=!0,te}},i.values=Y,$.prototype={constructor:$,reset:function(P){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(D),!P)for(var W in this)W.charAt(0)==="t"&&o.call(this,W)&&!isNaN(+W.slice(1))&&(this[W]=n)},stop:function(){this.done=!0;var P=this.tryEntries[0].completion;if(P.type==="throw")throw P.arg;return this.rval},dispatchException:function(P){if(this.done)throw P;var W=this;function J(Ze,at){return pe.type="throw",pe.arg=P,W.next=Ze,at&&(W.method="next",W.arg=n),!!at}for(var te=this.tryEntries.length-1;te>=0;--te){var H=this.tryEntries[te],pe=H.completion;if(H.tryLoc==="root")return J("end");if(H.tryLoc<=this.prev){var Te=o.call(H,"catchLoc"),Ne=o.call(H,"finallyLoc");if(Te&&Ne){if(this.prev<H.catchLoc)return J(H.catchLoc,!0);if(this.prev<H.finallyLoc)return J(H.finallyLoc)}else if(Te){if(this.prev<H.catchLoc)return J(H.catchLoc,!0)}else{if(!Ne)throw Error("try statement without catch or finally");if(this.prev<H.finallyLoc)return J(H.finallyLoc)}}}},abrupt:function(P,W){for(var J=this.tryEntries.length-1;J>=0;--J){var te=this.tryEntries[J];if(te.tryLoc<=this.prev&&o.call(te,"finallyLoc")&&this.prev<te.finallyLoc){var H=te;break}}H&&(P==="break"||P==="continue")&&H.tryLoc<=W&&W<=H.finallyLoc&&(H=null);var pe=H?H.completion:{};return pe.type=P,pe.arg=W,H?(this.method="next",this.next=H.finallyLoc,b):this.complete(pe)},complete:function(P,W){if(P.type==="throw")throw P.arg;return P.type==="break"||P.type==="continue"?this.next=P.arg:P.type==="return"?(this.rval=this.arg=P.arg,this.method="return",this.next="end"):P.type==="normal"&&W&&(this.next=W),b},finish:function(P){for(var W=this.tryEntries.length-1;W>=0;--W){var J=this.tryEntries[W];if(J.finallyLoc===P)return this.complete(J.completion,J.afterLoc),D(J),b}},catch:function(P){for(var W=this.tryEntries.length-1;W>=0;--W){var J=this.tryEntries[W];if(J.tryLoc===P){var te=J.completion;if(te.type==="throw"){var H=te.arg;D(J)}return H}}throw Error("illegal catch attempt")},delegateYield:function(P,W,J){return this.delegate={iterator:Y(P),resultName:W,nextLoc:J},this.method==="next"&&(this.arg=n),b}},i}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports})(Ek);var iie=Ek.exports,dv=iie(),aie=dv;try{regeneratorRuntime=dv}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=dv:Function("r","regeneratorRuntime = r")(dv)}const Tn=Ji(aie);var oie=1;function Sk(){return oie++}var Le;(function(r){r[r.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",r[r.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",r[r.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r[r.ZERO=0]="ZERO",r[r.ONE=1]="ONE",r[r.SRC_COLOR=768]="SRC_COLOR",r[r.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.DST_ALPHA=772]="DST_ALPHA",r[r.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",r[r.DST_COLOR=774]="DST_COLOR",r[r.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",r[r.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.BLEND_EQUATION=32777]="BLEND_EQUATION",r[r.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",r[r.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",r[r.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",r[r.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",r[r.MAX_EXT=32776]="MAX_EXT",r[r.MIN_EXT=32775]="MIN_EXT",r[r.BLEND_DST_RGB=32968]="BLEND_DST_RGB",r[r.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",r[r.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",r[r.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",r[r.CONSTANT_COLOR=32769]="CONSTANT_COLOR",r[r.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",r[r.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",r[r.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",r[r.BLEND_COLOR=32773]="BLEND_COLOR",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",r[r.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",r[r.STREAM_DRAW=35040]="STREAM_DRAW",r[r.STATIC_DRAW=35044]="STATIC_DRAW",r[r.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",r[r.BUFFER_SIZE=34660]="BUFFER_SIZE",r[r.BUFFER_USAGE=34661]="BUFFER_USAGE",r[r.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",r[r.FRONT=1028]="FRONT",r[r.BACK=1029]="BACK",r[r.FRONT_AND_BACK=1032]="FRONT_AND_BACK",r[r.CULL_FACE=2884]="CULL_FACE",r[r.BLEND=3042]="BLEND",r[r.DITHER=3024]="DITHER",r[r.STENCIL_TEST=2960]="STENCIL_TEST",r[r.DEPTH_TEST=2929]="DEPTH_TEST",r[r.SCISSOR_TEST=3089]="SCISSOR_TEST",r[r.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",r[r.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",r[r.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",r[r.NO_ERROR=0]="NO_ERROR",r[r.INVALID_ENUM=1280]="INVALID_ENUM",r[r.INVALID_VALUE=1281]="INVALID_VALUE",r[r.INVALID_OPERATION=1282]="INVALID_OPERATION",r[r.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",r[r.CW=2304]="CW",r[r.CCW=2305]="CCW",r[r.LINE_WIDTH=2849]="LINE_WIDTH",r[r.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",r[r.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",r[r.CULL_FACE_MODE=2885]="CULL_FACE_MODE",r[r.FRONT_FACE=2886]="FRONT_FACE",r[r.DEPTH_RANGE=2928]="DEPTH_RANGE",r[r.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",r[r.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",r[r.DEPTH_FUNC=2932]="DEPTH_FUNC",r[r.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",r[r.STENCIL_FUNC=2962]="STENCIL_FUNC",r[r.STENCIL_FAIL=2964]="STENCIL_FAIL",r[r.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",r[r.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",r[r.STENCIL_REF=2967]="STENCIL_REF",r[r.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",r[r.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",r[r.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",r[r.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",r[r.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",r[r.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",r[r.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",r[r.VIEWPORT=2978]="VIEWPORT",r[r.SCISSOR_BOX=3088]="SCISSOR_BOX",r[r.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",r[r.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",r[r.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",r[r.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",r[r.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",r[r.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",r[r.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",r[r.RED_BITS=3410]="RED_BITS",r[r.GREEN_BITS=3411]="GREEN_BITS",r[r.BLUE_BITS=3412]="BLUE_BITS",r[r.ALPHA_BITS=3413]="ALPHA_BITS",r[r.DEPTH_BITS=3414]="DEPTH_BITS",r[r.STENCIL_BITS=3415]="STENCIL_BITS",r[r.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",r[r.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",r[r.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",r[r.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",r[r.SAMPLES=32937]="SAMPLES",r[r.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",r[r.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",r[r.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",r[r.DONT_CARE=4352]="DONT_CARE",r[r.FASTEST=4353]="FASTEST",r[r.NICEST=4354]="NICEST",r[r.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",r[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.INT=5124]="INT",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.FLOAT=5126]="FLOAT",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.ALPHA=6406]="ALPHA",r[r.RGB=6407]="RGB",r[r.RGBA=6408]="RGBA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",r[r.VERTEX_SHADER=35633]="VERTEX_SHADER",r[r.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",r[r.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",r[r.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",r[r.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",r[r.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",r[r.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",r[r.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",r[r.SHADER_TYPE=35663]="SHADER_TYPE",r[r.DELETE_STATUS=35712]="DELETE_STATUS",r[r.LINK_STATUS=35714]="LINK_STATUS",r[r.VALIDATE_STATUS=35715]="VALIDATE_STATUS",r[r.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",r[r.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",r[r.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",r[r.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",r[r.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",r[r.NEVER=512]="NEVER",r[r.LESS=513]="LESS",r[r.EQUAL=514]="EQUAL",r[r.LEQUAL=515]="LEQUAL",r[r.GREATER=516]="GREATER",r[r.NOTEQUAL=517]="NOTEQUAL",r[r.GEQUAL=518]="GEQUAL",r[r.ALWAYS=519]="ALWAYS",r[r.KEEP=7680]="KEEP",r[r.REPLACE=7681]="REPLACE",r[r.INCR=7682]="INCR",r[r.DECR=7683]="DECR",r[r.INVERT=5386]="INVERT",r[r.INCR_WRAP=34055]="INCR_WRAP",r[r.DECR_WRAP=34056]="DECR_WRAP",r[r.VENDOR=7936]="VENDOR",r[r.RENDERER=7937]="RENDERER",r[r.VERSION=7938]="VERSION",r[r.NEAREST=9728]="NEAREST",r[r.LINEAR=9729]="LINEAR",r[r.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",r[r.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",r[r.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",r[r.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE=5890]="TEXTURE",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r[r.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",r[r.TEXTURE0=33984]="TEXTURE0",r[r.TEXTURE1=33985]="TEXTURE1",r[r.TEXTURE2=33986]="TEXTURE2",r[r.TEXTURE3=33987]="TEXTURE3",r[r.TEXTURE4=33988]="TEXTURE4",r[r.TEXTURE5=33989]="TEXTURE5",r[r.TEXTURE6=33990]="TEXTURE6",r[r.TEXTURE7=33991]="TEXTURE7",r[r.TEXTURE8=33992]="TEXTURE8",r[r.TEXTURE9=33993]="TEXTURE9",r[r.TEXTURE10=33994]="TEXTURE10",r[r.TEXTURE11=33995]="TEXTURE11",r[r.TEXTURE12=33996]="TEXTURE12",r[r.TEXTURE13=33997]="TEXTURE13",r[r.TEXTURE14=33998]="TEXTURE14",r[r.TEXTURE15=33999]="TEXTURE15",r[r.TEXTURE16=34e3]="TEXTURE16",r[r.TEXTURE17=34001]="TEXTURE17",r[r.TEXTURE18=34002]="TEXTURE18",r[r.TEXTURE19=34003]="TEXTURE19",r[r.TEXTURE20=34004]="TEXTURE20",r[r.TEXTURE21=34005]="TEXTURE21",r[r.TEXTURE22=34006]="TEXTURE22",r[r.TEXTURE23=34007]="TEXTURE23",r[r.TEXTURE24=34008]="TEXTURE24",r[r.TEXTURE25=34009]="TEXTURE25",r[r.TEXTURE26=34010]="TEXTURE26",r[r.TEXTURE27=34011]="TEXTURE27",r[r.TEXTURE28=34012]="TEXTURE28",r[r.TEXTURE29=34013]="TEXTURE29",r[r.TEXTURE30=34014]="TEXTURE30",r[r.TEXTURE31=34015]="TEXTURE31",r[r.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",r[r.REPEAT=10497]="REPEAT",r[r.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r[r.FLOAT_VEC2=35664]="FLOAT_VEC2",r[r.FLOAT_VEC3=35665]="FLOAT_VEC3",r[r.FLOAT_VEC4=35666]="FLOAT_VEC4",r[r.INT_VEC2=35667]="INT_VEC2",r[r.INT_VEC3=35668]="INT_VEC3",r[r.INT_VEC4=35669]="INT_VEC4",r[r.BOOL=35670]="BOOL",r[r.BOOL_VEC2=35671]="BOOL_VEC2",r[r.BOOL_VEC3=35672]="BOOL_VEC3",r[r.BOOL_VEC4=35673]="BOOL_VEC4",r[r.FLOAT_MAT2=35674]="FLOAT_MAT2",r[r.FLOAT_MAT3=35675]="FLOAT_MAT3",r[r.FLOAT_MAT4=35676]="FLOAT_MAT4",r[r.SAMPLER_2D=35678]="SAMPLER_2D",r[r.SAMPLER_CUBE=35680]="SAMPLER_CUBE",r[r.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",r[r.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",r[r.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",r[r.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",r[r.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",r[r.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",r[r.COMPILE_STATUS=35713]="COMPILE_STATUS",r[r.LOW_FLOAT=36336]="LOW_FLOAT",r[r.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",r[r.HIGH_FLOAT=36338]="HIGH_FLOAT",r[r.LOW_INT=36339]="LOW_INT",r[r.MEDIUM_INT=36340]="MEDIUM_INT",r[r.HIGH_INT=36341]="HIGH_INT",r[r.FRAMEBUFFER=36160]="FRAMEBUFFER",r[r.RENDERBUFFER=36161]="RENDERBUFFER",r[r.RGBA4=32854]="RGBA4",r[r.RGB5_A1=32855]="RGB5_A1",r[r.RGB565=36194]="RGB565",r[r.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",r[r.STENCIL_INDEX=6401]="STENCIL_INDEX",r[r.STENCIL_INDEX8=36168]="STENCIL_INDEX8",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r[r.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",r[r.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",r[r.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",r[r.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",r[r.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",r[r.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",r[r.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",r[r.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",r[r.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",r[r.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",r[r.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",r[r.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",r[r.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",r[r.NONE=0]="NONE",r[r.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",r[r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",r[r.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",r[r.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",r[r.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",r[r.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",r[r.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",r[r.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",r[r.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",r[r.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",r[r.COPY_SRC=1]="COPY_SRC",r[r.COPY_DST=2]="COPY_DST",r[r.SAMPLED=4]="SAMPLED",r[r.STORAGE=8]="STORAGE",r[r.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(Le||(Le={}));var sie=function(){function r(){Oi(this,r),this.config=void 0}return Di(r,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),r}(),Al;(function(r){r.Void="Void",r.Boolean="Boolean",r.Float="Float",r.Uint32="Uint32",r.Int32="Int32",r.Vector="Vector",r.Vector2Float="vec2<f32>",r.Vector3Float="vec3<f32>",r.Vector4Float="vec4<f32>",r.Vector2Boolean="vec2<bool>",r.Vector3Boolean="vec3<bool>",r.Vector4Boolean="vec4<bool>",r.Vector2Uint="vec2<u32>",r.Vector3Uint="vec3<u32>",r.Vector4Uint="vec4<u32>",r.Vector2Int="vec2<i32>",r.Vector3Int="vec3<i32>",r.Vector4Int="vec4<i32>",r.Matrix="Matrix",r.Matrix3x3Float="mat3x3<f32>",r.Matrix4x4Float="mat4x4<i32>",r.Struct="Struct",r.FloatArray="Float[]",r.Vector4FloatArray="vec4<f32>[]"})(Al||(Al={}));var Mk;(function(r){r.Program="Program",r.Identifier="Identifier",r.VariableDeclaration="VariableDeclaration",r.BlockStatement="BlockStatement",r.ReturnStatement="ReturnStatement",r.FunctionDeclaration="FunctionDeclaration",r.VariableDeclarator="VariableDeclarator",r.AssignmentExpression="AssignmentExpression",r.LogicalExpression="LogicalExpression",r.BinaryExpression="BinaryExpression",r.ArrayExpression="ArrayExpression",r.UnaryExpression="UnaryExpression",r.UpdateExpression="UpdateExpression",r.FunctionExpression="FunctionExpression",r.MemberExpression="MemberExpression",r.ConditionalExpression="ConditionalExpression",r.ExpressionStatement="ExpressionStatement",r.CallExpression="CallExpression",r.NumThreadStatement="NumThreadStatement",r.StorageStatement="StorageStatement",r.DoWhileStatement="DoWhileStatement",r.WhileStatement="WhileStatement",r.ForStatement="ForStatement",r.BreakStatement="BreakStatement",r.ContinueStatement="ContinueStatement",r.IfStatement="IfStatement",r.ImportedFunctionStatement="ImportedFunctionStatement"})(Mk||(Mk={}));var Du;(function(r){r.Input="Input",r.Output="Output",r.Uniform="Uniform",r.Workgroup="Workgroup",r.UniformConstant="UniformConstant",r.Image="Image",r.StorageBuffer="StorageBuffer",r.Private="Private",r.Function="Function"})(Du||(Du={}));var Tl;(function(r){r.GLSL100="GLSL100",r.GLSL450="GLSL450",r.WGSL="WGSL"})(Tl||(Tl={}));var uie="__DefineValuePlaceholder__";function fie(){if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function Ck(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ak(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ck(Object(t),!0).forEach(function(n){Je(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ck(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Tk=function(){function r(e,t){Oi(this,r),this.engine=e,this.configService=t,this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}return Di(r,[{key:"init",value:function(){var t=this.configService.get(),n=t.canvas,i=t.engineOptions;this.initPromise=this.engine.init(Ak({canvas:n||fie(),antialiasing:!1},i))}},{key:"setBundle",value:function(t){this.compiledBundle=JSON.parse(JSON.stringify(t))}},{key:"setDispatch",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=t),this}},{key:"setMaxIteration",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=t),this}},{key:"setBinding",value:function(t,n){var i=this;if(typeof t=="string"){var a=Jne(n)||hv(n)||rie(n);if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find(function(u){return u.name===t});if(o)return o.value=n,this;var s=this.compiledBundle.context.uniforms.find(function(u){return u.name===t});s&&(a?(s.data=n,s.isReferer=!1,s.storageClass===Du.Uniform?this.model&&this.model.updateUniform(t,n):this.model&&this.model.updateBuffer(t,n)):(s.isReferer=!0,s.data=n))}}else Object.keys(t).forEach(function(u){i.setBinding(u,t[u])});return this}},{key:"execute",value:function(){var e=_o(Tn.mark(function n(){var i=this,a,o,s=arguments;return Tn.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(a=s.length>0&&s[0]!==void 0?s[0]:1,!this.dirty){f.next=6;break}return this.compiledBundle.context&&(a>1?this.compiledBundle.context.maxIteration=a:this.compiledBundle.context.maxIteration++),f.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter(function(l){var c=l.isReferer;return c}).forEach(function(l){var c=l.data,h=l.name;i.model.confirmInput(c.model,h)}),o=0;o<a;o++)this.model.run();return this.engine.endFrame(),f.abrupt("return",this);case 12:case"end":return f.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"getOutput",value:function(){var e=_o(Tn.mark(function n(){return Tn.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.model.readData());case 1:case"end":return a.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"compile",value:function(){var e=_o(Tn.mark(function n(){var i,a,o;return Tn.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.initPromise;case 2:return i=Ak({},this.compiledBundle.context),a=this.engine.supportWebGPU?this.engine.useWGSL?Tl.WGSL:Tl.GLSL450:Tl.GLSL100,o=this.compiledBundle.shaders[a],i.defines.filter(function(f){return f.runtime}).forEach(function(f){var l="".concat(uie).concat(f.name);o=o.replace(l,"".concat(f.value))}),i.shader=o,i.uniforms.forEach(function(f){if(!f.data&&f.storageClass===Du.StorageBuffer){var l=1;f.type===Al.FloatArray?l=1:f.type===Al.Vector4FloatArray&&(l=4),f.data=new Float32Array(i.output.length*l).fill(0)}}),this.compiledBundle.context=i,u.next=11,this.engine.createComputeModel(this.compiledBundle.context);case 11:this.model=u.sent;case 12:case"end":return u.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()}]),r}(),Ik={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(xe,function(){var t=function(I){return I instanceof Uint8Array||I instanceof Uint16Array||I instanceof Uint32Array||I instanceof Int8Array||I instanceof Int16Array||I instanceof Int32Array||I instanceof Float32Array||I instanceof Float64Array||I instanceof Uint8ClampedArray},n=function(I,F){for(var V=Object.keys(F),ce=0;ce<V.length;++ce)I[V[ce]]=F[V[ce]];return I},i=`
`;function a(I){return typeof atob<"u"?atob(I):"base64:"+I}function o(I){var F=new Error("(regl) "+I);throw console.error(F),F}function s(I,F){I||o(F)}function u(I){return I?": "+I:""}function f(I,F,V){I in F||o("unknown parameter ("+I+")"+u(V)+". possible values: "+Object.keys(F).join())}function l(I,F){t(I)||o("invalid parameter type"+u(F)+". must be a typed array")}function c(I,F){switch(F){case"number":return typeof I=="number";case"object":return typeof I=="object";case"string":return typeof I=="string";case"boolean":return typeof I=="boolean";case"function":return typeof I=="function";case"undefined":return typeof I>"u";case"symbol":return typeof I=="symbol"}}function h(I,F,V){c(I,F)||o("invalid parameter type"+u(V)+". expected "+F+", got "+typeof I)}function d(I,F){I>=0&&(I|0)===I||o("invalid parameter type, ("+I+")"+u(F)+". must be a nonnegative integer")}function v(I,F,V){F.indexOf(I)<0&&o("invalid value"+u(V)+". must be one of: "+F)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(I){Object.keys(I).forEach(function(F){p.indexOf(F)<0&&o('invalid regl constructor argument "'+F+'". must be one of '+p)})}function y(I,F){for(I=I+"";I.length<F;)I=" "+I;return I}function m(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function b(I,F){this.number=I,this.line=F,this.errors=[]}function x(I,F,V){this.file=I,this.line=F,this.message=V}function w(){var I=new Error,F=(I.stack||I).toString(),V=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(F);if(V)return V[1];var ce=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(F);return ce?ce[1]:"unknown"}function E(){var I=new Error,F=(I.stack||I).toString(),V=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(F);if(V)return V[1];var ce=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(F);return ce?ce[1]:"unknown"}function _(I,F){var V=I.split(`
`),ce=1,we=0,le={unknown:new m,0:new m};le.unknown.name=le[0].name=F||w(),le.unknown.lines.push(new b(0,""));for(var de=0;de<V.length;++de){var Ie=V[de],Oe=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Ie);if(Oe)switch(Oe[1]){case"line":var Fe=/(\d+)(\s+\d+)?/.exec(Oe[2]);Fe&&(ce=Fe[1]|0,Fe[2]&&(we=Fe[2]|0,we in le||(le[we]=new m)));break;case"define":var De=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Oe[2]);De&&(le[we].name=De[1]?a(De[2]):De[2]);break}le[we].lines.push(new b(ce++,Ie))}return Object.keys(le).forEach(function($e){var Ve=le[$e];Ve.lines.forEach(function(ke){Ve.index[ke.number]=ke})}),le}function M(I){var F=[];return I.split(`
`).forEach(function(V){if(!(V.length<5)){var ce=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(V);ce?F.push(new x(ce[1]|0,ce[2]|0,ce[3].trim())):V.length>0&&F.push(new x("unknown",0,V))}}),F}function C(I,F){F.forEach(function(V){var ce=I[V.file];if(ce){var we=ce.index[V.line];if(we){we.errors.push(V),ce.hasErrors=!0;return}}I.unknown.hasErrors=!0,I.unknown.lines[0].errors.push(V)})}function S(I,F,V,ce,we){if(!I.getShaderParameter(F,I.COMPILE_STATUS)){var le=I.getShaderInfoLog(F),de=ce===I.FRAGMENT_SHADER?"fragment":"vertex";$(V,"string",de+" shader source must be a string",we);var Ie=_(V,we),Oe=M(le);C(Ie,Oe),Object.keys(Ie).forEach(function(Fe){var De=Ie[Fe];if(!De.hasErrors)return;var $e=[""],Ve=[""];function ke(je,oe){$e.push(je),Ve.push(oe||"")}ke("file number "+Fe+": "+De.name+`
`,"color:red;text-decoration:underline;font-weight:bold"),De.lines.forEach(function(je){if(je.errors.length>0){ke(y(je.number,4)+"|  ","background-color:yellow; font-weight:bold"),ke(je.line+i,"color:red; background-color:yellow; font-weight:bold");var oe=0;je.errors.forEach(function(ve){var Be=ve.message,Ke=/^\s*'(.*)'\s*:\s*(.*)$/.exec(Be);if(Ke){var Me=Ke[1];switch(Be=Ke[2],Me){case"assign":Me="=";break}oe=Math.max(je.line.indexOf(Me,oe),0)}else oe=0;ke(y("| ",6)),ke(y("^^^",oe+3)+i,"font-weight:bold"),ke(y("| ",6)),ke(Be+i,"font-weight:bold")}),ke(y("| ",6)+i)}else ke(y(je.number,4)+"|  "),ke(je.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(Ve[0]=$e.join("%c"),console.log.apply(console,Ve)):console.log($e.join(""))}),s.raise("Error compiling "+de+" shader, "+Ie[0].name)}}function A(I,F,V,ce,we){if(!I.getProgramParameter(F,I.LINK_STATUS)){var le=I.getProgramInfoLog(F),de=_(V,we),Ie=_(ce,we),Oe='Error linking program with vertex shader, "'+Ie[0].name+'", and fragment shader "'+de[0].name+'"';typeof document<"u"?console.log("%c"+Oe+i+"%c"+le,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Oe+i+le),s.raise(Oe)}}function T(I){I._commandRef=w()}function k(I,F,V,ce){T(I);function we(Oe){return Oe?ce.id(Oe):0}I._fragId=we(I.static.frag),I._vertId=we(I.static.vert);function le(Oe,Fe){Object.keys(Fe).forEach(function(De){Oe[ce.id(De)]=!0})}var de=I._uniformSet={};le(de,F.static),le(de,F.dynamic);var Ie=I._attributeSet={};le(Ie,V.static),le(Ie,V.dynamic),I._hasCount="count"in I.static||"count"in I.dynamic||"elements"in I.static||"elements"in I.dynamic}function O(I,F){var V=E();o(I+" in command "+(F||w())+(V==="unknown"?"":" called from "+V))}function G(I,F,V){I||O(F,V||w())}function D(I,F,V,ce){I in F||O("unknown parameter ("+I+")"+u(V)+". possible values: "+Object.keys(F).join(),ce||w())}function $(I,F,V,ce){c(I,F)||O("invalid parameter type"+u(V)+". expected "+F+", got "+typeof I,ce||w())}function Y(I){I()}function N(I,F,V){I.texture?v(I.texture._texture.internalformat,F,"unsupported texture format for attachment"):v(I.renderbuffer._renderbuffer.format,V,"unsupported renderbuffer format for attachment")}var P=33071,W=9728,J=9984,te=9985,H=9986,pe=9987,Te=5120,Ne=5121,Ze=5122,at=5123,nt=5124,St=5125,Mt=5126,fr=32819,Ft=32820,Wt=33635,dr=34042,lr=36193,Ut={};Ut[Te]=Ut[Ne]=1,Ut[Ze]=Ut[at]=Ut[lr]=Ut[Wt]=Ut[fr]=Ut[Ft]=2,Ut[nt]=Ut[St]=Ut[Mt]=Ut[dr]=4;function ar(I,F){return I===Ft||I===fr||I===Wt?2:I===dr?4:Ut[I]*F}function Zr(I){return!(I&I-1)&&!!I}function tt(I,F,V){var ce,we=F.width,le=F.height,de=F.channels;s(we>0&&we<=V.maxTextureSize&&le>0&&le<=V.maxTextureSize,"invalid texture shape"),(I.wrapS!==P||I.wrapT!==P)&&s(Zr(we)&&Zr(le),"incompatible wrap mode for texture, both width and height must be power of 2"),F.mipmask===1?we!==1&&le!==1&&s(I.minFilter!==J&&I.minFilter!==H&&I.minFilter!==te&&I.minFilter!==pe,"min filter requires mipmap"):(s(Zr(we)&&Zr(le),"texture must be a square power of 2 to support mipmapping"),s(F.mipmask===(we<<1)-1,"missing or incomplete mipmap data")),F.type===Mt&&(V.extensions.indexOf("oes_texture_float_linear")<0&&s(I.minFilter===W&&I.magFilter===W,"filter not supported, must enable oes_texture_float_linear"),s(!I.genMipmaps,"mipmap generation not supported with float textures"));var Ie=F.images;for(ce=0;ce<16;++ce)if(Ie[ce]){var Oe=we>>ce,Fe=le>>ce;s(F.mipmask&1<<ce,"missing mipmap data");var De=Ie[ce];if(s(De.width===Oe&&De.height===Fe,"invalid shape for mip images"),s(De.format===F.format&&De.internalformat===F.internalformat&&De.type===F.type,"incompatible type for mip image"),!De.compressed)if(De.data){var $e=Math.ceil(ar(De.type,de)*Oe/De.unpackAlignment)*De.unpackAlignment;s(De.data.byteLength===$e*Fe,"invalid data for image, buffer size is inconsistent with image format")}else De.element||De.copy}else I.genMipmaps||s((F.mipmask&1<<ce)===0,"extra mipmap data");F.compressed&&s(!I.genMipmaps,"mipmap generation for compressed images not supported")}function ae(I,F,V,ce){var we=I.width,le=I.height,de=I.channels;s(we>0&&we<=ce.maxTextureSize&&le>0&&le<=ce.maxTextureSize,"invalid texture shape"),s(we===le,"cube map must be square"),s(F.wrapS===P&&F.wrapT===P,"wrap mode not supported by cube map");for(var Ie=0;Ie<V.length;++Ie){var Oe=V[Ie];s(Oe.width===we&&Oe.height===le,"inconsistent cube map face shape"),F.genMipmaps&&(s(!Oe.compressed,"can not generate mipmap for compressed textures"),s(Oe.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var Fe=Oe.images,De=0;De<16;++De){var $e=Fe[De];if($e){var Ve=we>>De,ke=le>>De;s(Oe.mipmask&1<<De,"missing mipmap data"),s($e.width===Ve&&$e.height===ke,"invalid shape for mip images"),s($e.format===I.format&&$e.internalformat===I.internalformat&&$e.type===I.type,"incompatible type for mip image"),$e.compressed||($e.data?s($e.data.byteLength===Ve*ke*Math.max(ar($e.type,de),$e.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):$e.element||$e.copy)}}}}var L=n(s,{optional:Y,raise:o,commandRaise:O,command:G,parameter:f,commandParameter:D,constructor:g,type:h,commandType:$,isTypedArray:l,nni:d,oneOf:v,shaderError:S,linkError:A,callSite:E,saveCommandRef:T,saveDrawInfo:k,framebufferFormat:N,guessCommand:w,texture2D:tt,textureCube:ae}),Se=0,Ge=0,me=5,Ye=6;function We(I,F){this.id=Se++,this.type=I,this.data=F}function qe(I){return I.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function et(I){if(I.length===0)return[];var F=I.charAt(0),V=I.charAt(I.length-1);if(I.length>1&&F===V&&(F==='"'||F==="'"))return['"'+qe(I.substr(1,I.length-2))+'"'];var ce=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(I);if(ce)return et(I.substr(0,ce.index)).concat(et(ce[1])).concat(et(I.substr(ce.index+ce[0].length)));var we=I.split(".");if(we.length===1)return['"'+qe(I)+'"'];for(var le=[],de=0;de<we.length;++de)le=le.concat(et(we[de]));return le}function yt(I){return"["+et(I).join("][")+"]"}function Pt(I,F){return new We(I,yt(F+""))}function cr(I){return typeof I=="function"&&!I._reglType||I instanceof We}function Rt(I,F){if(typeof I=="function")return new We(Ge,I);if(typeof I=="number"||typeof I=="boolean")return new We(me,I);if(Array.isArray(I))return new We(Ye,I.map((V,ce)=>Rt(V,F+"["+ce+"]")));if(I instanceof We)return I;L(!1,"invalid option type in uniform "+F)}var hr={DynamicVariable:We,define:Pt,isDynamic:cr,unbox:Rt,accessor:yt},ur={next:typeof requestAnimationFrame=="function"?function(I){return requestAnimationFrame(I)}:function(I){return setTimeout(I,16)},cancel:typeof cancelAnimationFrame=="function"?function(I){return cancelAnimationFrame(I)}:clearTimeout},xr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function vr(){var I={"":0},F=[""];return{id:function(V){var ce=I[V];return ce||(ce=I[V]=F.length,F.push(V),ce)},str:function(V){return F[V]}}}function En(I,F,V){var ce=document.createElement("canvas");n(ce.style,{border:0,margin:0,padding:0,top:0,left:0}),I.appendChild(ce),I===document.body&&(ce.style.position="absolute",n(I.style,{margin:0,padding:0}));function we(){var Ie=window.innerWidth,Oe=window.innerHeight;if(I!==document.body){var Fe=I.getBoundingClientRect();Ie=Fe.right-Fe.left,Oe=Fe.bottom-Fe.top}ce.width=V*Ie,ce.height=V*Oe,n(ce.style,{width:Ie+"px",height:Oe+"px"})}var le;I!==document.body&&typeof ResizeObserver=="function"?(le=new ResizeObserver(function(){setTimeout(we)}),le.observe(I)):window.addEventListener("resize",we,!1);function de(){le?le.disconnect():window.removeEventListener("resize",we),I.removeChild(ce)}return we(),{canvas:ce,onDestroy:de}}function or(I,F){function V(ce){try{return I.getContext(ce,F)}catch{return null}}return V("webgl")||V("experimental-webgl")||V("webgl-experimental")}function jr(I){return typeof I.nodeName=="string"&&typeof I.appendChild=="function"&&typeof I.getBoundingClientRect=="function"}function Ri(I){return typeof I.drawArrays=="function"||typeof I.drawElements=="function"}function Kr(I){return typeof I=="string"?I.split():(L(Array.isArray(I),"invalid extension array"),I)}function Oo(I){return typeof I=="string"?(L(typeof document<"u","not supported outside of DOM"),document.querySelector(I)):I}function Jl(I){var F=I||{},V,ce,we,le,de={},Ie=[],Oe=[],Fe=typeof window>"u"?1:window.devicePixelRatio,De=!1,$e=function(je){je&&L.raise(je)},Ve=function(){};if(typeof F=="string"?(L(typeof document<"u","selector queries only supported in DOM enviroments"),V=document.querySelector(F),L(V,"invalid query string for element")):typeof F=="object"?jr(F)?V=F:Ri(F)?(le=F,we=le.canvas):(L.constructor(F),"gl"in F?le=F.gl:"canvas"in F?we=Oo(F.canvas):"container"in F&&(ce=Oo(F.container)),"attributes"in F&&(de=F.attributes,L.type(de,"object","invalid context attributes")),"extensions"in F&&(Ie=Kr(F.extensions)),"optionalExtensions"in F&&(Oe=Kr(F.optionalExtensions)),"onDone"in F&&(L.type(F.onDone,"function","invalid or missing onDone callback"),$e=F.onDone),"profile"in F&&(De=!!F.profile),"pixelRatio"in F&&(Fe=+F.pixelRatio,L(Fe>0,"invalid pixel ratio"))):L.raise("invalid arguments to regl"),V&&(V.nodeName.toLowerCase()==="canvas"?we=V:ce=V),!le){if(!we){L(typeof document<"u","must manually specify webgl context outside of DOM environments");var ke=En(ce||document.body,$e,Fe);if(!ke)return null;we=ke.canvas,Ve=ke.onDestroy}de.premultipliedAlpha===void 0&&(de.premultipliedAlpha=!0),le=or(we,de)}return le?{gl:le,canvas:we,container:ce,extensions:Ie,optionalExtensions:Oe,pixelRatio:Fe,profile:De,onDone:$e,onDestroy:Ve}:(Ve(),$e("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function ec(I,F){var V={};function ce(de){L.type(de,"string","extension name must be string");var Ie=de.toLowerCase(),Oe;try{Oe=V[Ie]=I.getExtension(Ie)}catch{}return!!Oe}for(var we=0;we<F.extensions.length;++we){var le=F.extensions[we];if(!ce(le))return F.onDestroy(),F.onDone('"'+le+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return F.optionalExtensions.forEach(ce),{extensions:V,restore:function(){Object.keys(V).forEach(function(de){if(V[de]&&!ce(de))throw new Error("(regl): error restoring extension "+de)})}}}function pn(I,F){for(var V=Array(I),ce=0;ce<I;++ce)V[ce]=F(ce);return V}var Va=5120,_s=5121,tc=5122,rc=5123,nc=5124,Bi=5125,Ur=5126;function Fi(I){for(var F=16;F<=1<<28;F*=16)if(I<=F)return F;return 0}function At(I){var F,V;return F=(I>65535)<<4,I>>>=F,V=(I>255)<<3,I>>>=V,F|=V,V=(I>15)<<2,I>>>=V,F|=V,V=(I>3)<<1,I>>>=V,F|=V,F|I>>1}function pr(){var I=pn(8,function(){return[]});function F(le){var de=Fi(le),Ie=I[At(de)>>2];return Ie.length>0?Ie.pop():new ArrayBuffer(de)}function V(le){I[At(le.byteLength)>>2].push(le)}function ce(le,de){var Ie=null;switch(le){case Va:Ie=new Int8Array(F(de),0,de);break;case _s:Ie=new Uint8Array(F(de),0,de);break;case tc:Ie=new Int16Array(F(2*de),0,de);break;case rc:Ie=new Uint16Array(F(2*de),0,de);break;case nc:Ie=new Int32Array(F(4*de),0,de);break;case Bi:Ie=new Uint32Array(F(4*de),0,de);break;case Ur:Ie=new Float32Array(F(4*de),0,de);break;default:return null}return Ie.length!==de?Ie.subarray(0,de):Ie}function we(le){V(le.buffer)}return{alloc:F,free:V,allocType:ce,freeType:we}}var xt=pr();xt.zero=pr();var kr=3408,_n=3410,Ss=3411,Ms=3412,Ha=3413,Cs=3414,As=3415,Ts=33901,oce=33902,sce=3379,uce=3386,fce=34921,lce=36347,cce=36348,hce=35661,dce=35660,vce=34930,pce=36349,gce=34076,yce=34024,mce=7936,bce=7937,xce=7938,wce=35724,Ece=34047,_ce=36063,Sce=34852,$v=3553,ZN=34067,Mce=34069,Cce=33984,ic=6408,D1=5126,KN=5121,P1=36160,Ace=36053,Tce=36064,Ice=16384,kce=function(I,F){var V=1;F.ext_texture_filter_anisotropic&&(V=I.getParameter(Ece));var ce=1,we=1;F.webgl_draw_buffers&&(ce=I.getParameter(Sce),we=I.getParameter(_ce));var le=!!F.oes_texture_float;if(le){var de=I.createTexture();I.bindTexture($v,de),I.texImage2D($v,0,ic,1,1,0,ic,D1,null);var Ie=I.createFramebuffer();if(I.bindFramebuffer(P1,Ie),I.framebufferTexture2D(P1,Tce,$v,de,0),I.bindTexture($v,null),I.checkFramebufferStatus(P1)!==Ace)le=!1;else{I.viewport(0,0,1,1),I.clearColor(1,0,0,1),I.clear(Ice);var Oe=xt.allocType(D1,4);I.readPixels(0,0,1,1,ic,D1,Oe),I.getError()?le=!1:(I.deleteFramebuffer(Ie),I.deleteTexture(de),le=Oe[0]===1),xt.freeType(Oe)}}var Fe=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),De=!0;if(!Fe){var $e=I.createTexture(),Ve=xt.allocType(KN,36);I.activeTexture(Cce),I.bindTexture(ZN,$e),I.texImage2D(Mce,0,ic,3,3,0,ic,KN,Ve),xt.freeType(Ve),I.bindTexture(ZN,null),I.deleteTexture($e),De=!I.getError()}return{colorBits:[I.getParameter(_n),I.getParameter(Ss),I.getParameter(Ms),I.getParameter(Ha)],depthBits:I.getParameter(Cs),stencilBits:I.getParameter(As),subpixelBits:I.getParameter(kr),extensions:Object.keys(F).filter(function(ke){return!!F[ke]}),maxAnisotropic:V,maxDrawbuffers:ce,maxColorAttachments:we,pointSizeDims:I.getParameter(Ts),lineWidthDims:I.getParameter(oce),maxViewportDims:I.getParameter(uce),maxCombinedTextureUnits:I.getParameter(hce),maxCubeMapSize:I.getParameter(gce),maxRenderbufferSize:I.getParameter(yce),maxTextureUnits:I.getParameter(vce),maxTextureSize:I.getParameter(sce),maxAttributes:I.getParameter(fce),maxVertexUniforms:I.getParameter(lce),maxVertexTextureUnits:I.getParameter(dce),maxVaryingVectors:I.getParameter(cce),maxFragmentUniforms:I.getParameter(pce),glsl:I.getParameter(wce),renderer:I.getParameter(bce),vendor:I.getParameter(mce),version:I.getParameter(xce),readFloat:le,npotTextureCube:De}};function Gi(I){return!!I&&typeof I=="object"&&Array.isArray(I.shape)&&Array.isArray(I.stride)&&typeof I.offset=="number"&&I.shape.length===I.stride.length&&(Array.isArray(I.data)||t(I.data))}var ti=function(I){return Object.keys(I).map(function(F){return I[F]})},jv={shape:Dce,flatten:Oce};function Lce(I,F,V){for(var ce=0;ce<F;++ce)V[ce]=I[ce]}function Nce(I,F,V,ce){for(var we=0,le=0;le<F;++le)for(var de=I[le],Ie=0;Ie<V;++Ie)ce[we++]=de[Ie]}function QN(I,F,V,ce,we,le){for(var de=le,Ie=0;Ie<F;++Ie)for(var Oe=I[Ie],Fe=0;Fe<V;++Fe)for(var De=Oe[Fe],$e=0;$e<ce;++$e)we[de++]=De[$e]}function JN(I,F,V,ce,we){for(var le=1,de=V+1;de<F.length;++de)le*=F[de];var Ie=F[V];if(F.length-V===4){var Oe=F[V+1],Fe=F[V+2],De=F[V+3];for(de=0;de<Ie;++de)QN(I[de],Oe,Fe,De,ce,we),we+=le}else for(de=0;de<Ie;++de)JN(I[de],F,V+1,ce,we),we+=le}function Oce(I,F,V,ce){var we=1;if(F.length)for(var le=0;le<F.length;++le)we*=F[le];else we=0;var de=ce||xt.allocType(V,we);switch(F.length){case 0:break;case 1:Lce(I,F[0],de);break;case 2:Nce(I,F[0],F[1],de);break;case 3:QN(I,F[0],F[1],F[2],de,0);break;default:JN(I,F,0,de,0)}return de}function Dce(I){for(var F=[],V=I;V.length;V=V[0])F.push(V.length);return F}var R1={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Pce=5120,Rce=5122,Bce=5124,Fce=5121,Gce=5123,zce=5125,$ce=5126,jce=5126,Is={int8:Pce,int16:Rce,int32:Bce,uint8:Fce,uint16:Gce,uint32:zce,float:$ce,float32:jce},Uce=35048,Xce=35040,Uv={dynamic:Uce,stream:Xce,static:35044},B1=jv.flatten,eO=jv.shape,tO=35044,Yce=35040,F1=5121,G1=5126,Do=[];Do[5120]=1,Do[5122]=2,Do[5124]=4,Do[5121]=1,Do[5123]=2,Do[5125]=4,Do[5126]=4;function Xv(I){return R1[Object.prototype.toString.call(I)]|0}function rO(I,F){for(var V=0;V<F.length;++V)I[V]=F[V]}function nO(I,F,V,ce,we,le,de){for(var Ie=0,Oe=0;Oe<V;++Oe)for(var Fe=0;Fe<ce;++Fe)I[Ie++]=F[we*Oe+le*Fe+de]}function Wce(I,F,V,ce){var we=0,le={};function de(oe){this.id=we++,this.buffer=I.createBuffer(),this.type=oe,this.usage=tO,this.byteLength=0,this.dimension=1,this.dtype=F1,this.persistentData=null,V.profile&&(this.stats={size:0})}de.prototype.bind=function(){I.bindBuffer(this.type,this.buffer)},de.prototype.destroy=function(){Ve(this)};var Ie=[];function Oe(oe,ve){var Be=Ie.pop();return Be||(Be=new de(oe)),Be.bind(),$e(Be,ve,Yce,0,1,!1),Be}function Fe(oe){Ie.push(oe)}function De(oe,ve,Be){oe.byteLength=ve.byteLength,I.bufferData(oe.type,ve,Be)}function $e(oe,ve,Be,Ke,Me,rt){var Ae;if(oe.usage=Be,Array.isArray(ve)){if(oe.dtype=Ke||G1,ve.length>0){var Ue;if(Array.isArray(ve[0])){Ae=eO(ve);for(var Ce=1,Xe=1;Xe<Ae.length;++Xe)Ce*=Ae[Xe];oe.dimension=Ce,Ue=B1(ve,Ae,oe.dtype),De(oe,Ue,Be),rt?oe.persistentData=Ue:xt.freeType(Ue)}else if(typeof ve[0]=="number"){oe.dimension=Me;var pt=xt.allocType(oe.dtype,ve.length);rO(pt,ve),De(oe,pt,Be),rt?oe.persistentData=pt:xt.freeType(pt)}else t(ve[0])?(oe.dimension=ve[0].length,oe.dtype=Ke||Xv(ve[0])||G1,Ue=B1(ve,[ve.length,ve[0].length],oe.dtype),De(oe,Ue,Be),rt?oe.persistentData=Ue:xt.freeType(Ue)):L.raise("invalid buffer data")}}else if(t(ve))oe.dtype=Ke||Xv(ve),oe.dimension=Me,De(oe,ve,Be),rt&&(oe.persistentData=new Uint8Array(new Uint8Array(ve.buffer)));else if(Gi(ve)){Ae=ve.shape;var Tt=ve.stride,He=ve.offset,ze=0,_e=0,Ct=0,Nt=0;Ae.length===1?(ze=Ae[0],_e=1,Ct=Tt[0],Nt=0):Ae.length===2?(ze=Ae[0],_e=Ae[1],Ct=Tt[0],Nt=Tt[1]):L.raise("invalid shape"),oe.dtype=Ke||Xv(ve.data)||G1,oe.dimension=_e;var ot=xt.allocType(oe.dtype,ze*_e);nO(ot,ve.data,ze,_e,Ct,Nt,He),De(oe,ot,Be),rt?oe.persistentData=ot:xt.freeType(ot)}else ve instanceof ArrayBuffer?(oe.dtype=F1,oe.dimension=Me,De(oe,ve,Be),rt&&(oe.persistentData=new Uint8Array(new Uint8Array(ve)))):L.raise("invalid buffer data")}function Ve(oe){F.bufferCount--,ce(oe);var ve=oe.buffer;L(ve,"buffer must not be deleted already"),I.deleteBuffer(ve),oe.buffer=null,delete le[oe.id]}function ke(oe,ve,Be,Ke){F.bufferCount++;var Me=new de(ve);le[Me.id]=Me;function rt(Ce){var Xe=tO,pt=null,Tt=0,He=0,ze=1;return Array.isArray(Ce)||t(Ce)||Gi(Ce)||Ce instanceof ArrayBuffer?pt=Ce:typeof Ce=="number"?Tt=Ce|0:Ce&&(L.type(Ce,"object","buffer arguments must be an object, a number or an array"),"data"in Ce&&(L(pt===null||Array.isArray(pt)||t(pt)||Gi(pt),"invalid data for buffer"),pt=Ce.data),"usage"in Ce&&(L.parameter(Ce.usage,Uv,"invalid buffer usage"),Xe=Uv[Ce.usage]),"type"in Ce&&(L.parameter(Ce.type,Is,"invalid buffer type"),He=Is[Ce.type]),"dimension"in Ce&&(L.type(Ce.dimension,"number","invalid dimension"),ze=Ce.dimension|0),"length"in Ce&&(L.nni(Tt,"buffer length must be a nonnegative integer"),Tt=Ce.length|0)),Me.bind(),pt?$e(Me,pt,Xe,He,ze,Ke):(Tt&&I.bufferData(Me.type,Tt,Xe),Me.dtype=He||F1,Me.usage=Xe,Me.dimension=ze,Me.byteLength=Tt),V.profile&&(Me.stats.size=Me.byteLength*Do[Me.dtype]),rt}function Ae(Ce,Xe){L(Xe+Ce.byteLength<=Me.byteLength,"invalid buffer subdata call, buffer is too small.  Can't write data of size "+Ce.byteLength+" starting from offset "+Xe+" to a buffer of size "+Me.byteLength),I.bufferSubData(Me.type,Xe,Ce)}function Ue(Ce,Xe){var pt=(Xe||0)|0,Tt;if(Me.bind(),t(Ce)||Ce instanceof ArrayBuffer)Ae(Ce,pt);else if(Array.isArray(Ce)){if(Ce.length>0)if(typeof Ce[0]=="number"){var He=xt.allocType(Me.dtype,Ce.length);rO(He,Ce),Ae(He,pt),xt.freeType(He)}else if(Array.isArray(Ce[0])||t(Ce[0])){Tt=eO(Ce);var ze=B1(Ce,Tt,Me.dtype);Ae(ze,pt),xt.freeType(ze)}else L.raise("invalid buffer data")}else if(Gi(Ce)){Tt=Ce.shape;var _e=Ce.stride,Ct=0,Nt=0,ot=0,Gt=0;Tt.length===1?(Ct=Tt[0],Nt=1,ot=_e[0],Gt=0):Tt.length===2?(Ct=Tt[0],Nt=Tt[1],ot=_e[0],Gt=_e[1]):L.raise("invalid shape");var kt=Array.isArray(Ce.data)?Me.dtype:Xv(Ce.data),Bt=xt.allocType(kt,Ct*Nt);nO(Bt,Ce.data,Ct,Nt,ot,Gt,Ce.offset),Ae(Bt,pt),xt.freeType(Bt)}else L.raise("invalid data for buffer subdata");return rt}return Be||rt(oe),rt._reglType="buffer",rt._buffer=Me,rt.subdata=Ue,V.profile&&(rt.stats=Me.stats),rt.destroy=function(){Ve(Me)},rt}function je(){ti(le).forEach(function(oe){oe.buffer=I.createBuffer(),I.bindBuffer(oe.type,oe.buffer),I.bufferData(oe.type,oe.persistentData||oe.byteLength,oe.usage)})}return V.profile&&(F.getTotalBufferSize=function(){var oe=0;return Object.keys(le).forEach(function(ve){oe+=le[ve].stats.size}),oe}),{create:ke,createStream:Oe,destroyStream:Fe,clear:function(){ti(le).forEach(Ve),Ie.forEach(Ve)},getBuffer:function(oe){return oe&&oe._buffer instanceof de?oe._buffer:null},restore:je,_initBuffer:$e}}var Vce=0,Hce=0,qce=1,Zce=1,Kce=4,Qce=4,ju={points:Vce,point:Hce,lines:qce,line:Zce,triangles:Kce,triangle:Qce,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Jce=0,ehe=1,ac=4,the=5120,Uu=5121,iO=5122,Xu=5123,aO=5124,ks=5125,z1=34963,rhe=35040,nhe=35044;function ihe(I,F,V,ce){var we={},le=0,de={uint8:Uu,uint16:Xu};F.oes_element_index_uint&&(de.uint32=ks);function Ie(je){this.id=le++,we[this.id]=this,this.buffer=je,this.primType=ac,this.vertCount=0,this.type=0}Ie.prototype.bind=function(){this.buffer.bind()};var Oe=[];function Fe(je){var oe=Oe.pop();return oe||(oe=new Ie(V.create(null,z1,!0,!1)._buffer)),$e(oe,je,rhe,-1,-1,0,0),oe}function De(je){Oe.push(je)}function $e(je,oe,ve,Be,Ke,Me,rt){je.buffer.bind();var Ae;if(oe){var Ue=rt;!rt&&(!t(oe)||Gi(oe)&&!t(oe.data))&&(Ue=F.oes_element_index_uint?ks:Xu),V._initBuffer(je.buffer,oe,ve,Ue,3)}else I.bufferData(z1,Me,ve),je.buffer.dtype=Ae||Uu,je.buffer.usage=ve,je.buffer.dimension=3,je.buffer.byteLength=Me;if(Ae=rt,!rt){switch(je.buffer.dtype){case Uu:case the:Ae=Uu;break;case Xu:case iO:Ae=Xu;break;case ks:case aO:Ae=ks;break;default:L.raise("unsupported type for element array")}je.buffer.dtype=Ae}je.type=Ae,L(Ae!==ks||!!F.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Ce=Ke;Ce<0&&(Ce=je.buffer.byteLength,Ae===Xu?Ce>>=1:Ae===ks&&(Ce>>=2)),je.vertCount=Ce;var Xe=Be;if(Be<0){Xe=ac;var pt=je.buffer.dimension;pt===1&&(Xe=Jce),pt===2&&(Xe=ehe),pt===3&&(Xe=ac)}je.primType=Xe}function Ve(je){ce.elementsCount--,L(je.buffer!==null,"must not double destroy elements"),delete we[je.id],je.buffer.destroy(),je.buffer=null}function ke(je,oe){var ve=V.create(null,z1,!0),Be=new Ie(ve._buffer);ce.elementsCount++;function Ke(Me){if(!Me)ve(),Be.primType=ac,Be.vertCount=0,Be.type=Uu;else if(typeof Me=="number")ve(Me),Be.primType=ac,Be.vertCount=Me|0,Be.type=Uu;else{var rt=null,Ae=nhe,Ue=-1,Ce=-1,Xe=0,pt=0;Array.isArray(Me)||t(Me)||Gi(Me)?rt=Me:(L.type(Me,"object","invalid arguments for elements"),"data"in Me&&(rt=Me.data,L(Array.isArray(rt)||t(rt)||Gi(rt),"invalid data for element buffer")),"usage"in Me&&(L.parameter(Me.usage,Uv,"invalid element buffer usage"),Ae=Uv[Me.usage]),"primitive"in Me&&(L.parameter(Me.primitive,ju,"invalid element buffer primitive"),Ue=ju[Me.primitive]),"count"in Me&&(L(typeof Me.count=="number"&&Me.count>=0,"invalid vertex count for elements"),Ce=Me.count|0),"type"in Me&&(L.parameter(Me.type,de,"invalid buffer type"),pt=de[Me.type]),"length"in Me?Xe=Me.length|0:(Xe=Ce,pt===Xu||pt===iO?Xe*=2:(pt===ks||pt===aO)&&(Xe*=4))),$e(Be,rt,Ae,Ue,Ce,Xe,pt)}return Ke}return Ke(je),Ke._reglType="elements",Ke._elements=Be,Ke.subdata=function(Me,rt){return ve.subdata(Me,rt),Ke},Ke.destroy=function(){Ve(Be)},Ke}return{create:ke,createStream:Fe,destroyStream:De,getElements:function(je){return typeof je=="function"&&je._elements instanceof Ie?je._elements:null},clear:function(){ti(we).forEach(Ve)}}}var oO=new Float32Array(1),ahe=new Uint32Array(oO.buffer),ohe=5123;function sO(I){for(var F=xt.allocType(ohe,I.length),V=0;V<I.length;++V)if(isNaN(I[V]))F[V]=65535;else if(I[V]===1/0)F[V]=31744;else if(I[V]===-1/0)F[V]=64512;else{oO[0]=I[V];var ce=ahe[0],we=ce>>>31<<15,le=(ce<<1>>>24)-127,de=ce>>13&1023;if(le<-24)F[V]=we;else if(le<-14){var Ie=-14-le;F[V]=we+(de+1024>>Ie)}else le>15?F[V]=we+31744:F[V]=we+(le+15<<10)+de}return F}function Lr(I){return Array.isArray(I)||t(I)}var uO=function(I){return!(I&I-1)&&!!I},she=34467,ba=3553,$1=34067,Yv=34069,Ls=6408,j1=6406,Wv=6407,oc=6409,Vv=6410,fO=32854,U1=32855,lO=36194,uhe=32819,fhe=32820,lhe=33635,che=34042,X1=6402,Hv=34041,Y1=35904,W1=35906,Yu=36193,V1=33776,H1=33777,q1=33778,Z1=33779,cO=35986,hO=35987,dO=34798,vO=35840,pO=35841,gO=35842,yO=35843,mO=36196,Wu=5121,K1=5123,Q1=5125,sc=5126,hhe=10242,dhe=10243,vhe=10497,J1=33071,phe=33648,ghe=10240,yhe=10241,eb=9728,mhe=9729,tb=9984,bO=9985,xO=9986,rb=9987,bhe=33170,qv=4352,xhe=4353,whe=4354,Ehe=34046,_he=3317,She=37440,Mhe=37441,Che=37443,wO=37444,uc=33984,Ahe=[tb,xO,bO,rb],Zv=[0,oc,Vv,Wv,Ls],yi={};yi[oc]=yi[j1]=yi[X1]=1,yi[Hv]=yi[Vv]=2,yi[Wv]=yi[Y1]=3,yi[Ls]=yi[W1]=4;function Vu(I){return"[object "+I+"]"}var EO=Vu("HTMLCanvasElement"),_O=Vu("OffscreenCanvas"),SO=Vu("CanvasRenderingContext2D"),MO=Vu("ImageBitmap"),CO=Vu("HTMLImageElement"),AO=Vu("HTMLVideoElement"),The=Object.keys(R1).concat([EO,_O,SO,MO,CO,AO]),Hu=[];Hu[Wu]=1,Hu[sc]=4,Hu[Yu]=2,Hu[K1]=2,Hu[Q1]=4;var gn=[];gn[fO]=2,gn[U1]=2,gn[lO]=2,gn[Hv]=4,gn[V1]=.5,gn[H1]=.5,gn[q1]=1,gn[Z1]=1,gn[cO]=.5,gn[hO]=1,gn[dO]=1,gn[vO]=.5,gn[pO]=.25,gn[gO]=.5,gn[yO]=.25,gn[mO]=.5;function TO(I){return Array.isArray(I)&&(I.length===0||typeof I[0]=="number")}function IO(I){if(!Array.isArray(I))return!1;var F=I.length;return!(F===0||!Lr(I[0]))}function Ns(I){return Object.prototype.toString.call(I)}function kO(I){return Ns(I)===EO}function LO(I){return Ns(I)===_O}function Ihe(I){return Ns(I)===SO}function khe(I){return Ns(I)===MO}function Lhe(I){return Ns(I)===CO}function Nhe(I){return Ns(I)===AO}function nb(I){if(!I)return!1;var F=Ns(I);return The.indexOf(F)>=0?!0:TO(I)||IO(I)||Gi(I)}function NO(I){return R1[Object.prototype.toString.call(I)]|0}function Ohe(I,F){var V=F.length;switch(I.type){case Wu:case K1:case Q1:case sc:var ce=xt.allocType(I.type,V);ce.set(F),I.data=ce;break;case Yu:I.data=sO(F);break;default:L.raise("unsupported texture type, must specify a typed array")}}function OO(I,F){return xt.allocType(I.type===Yu?sc:I.type,F)}function DO(I,F){I.type===Yu?(I.data=sO(F),xt.freeType(F)):I.data=F}function Dhe(I,F,V,ce,we,le){for(var de=I.width,Ie=I.height,Oe=I.channels,Fe=de*Ie*Oe,De=OO(I,Fe),$e=0,Ve=0;Ve<Ie;++Ve)for(var ke=0;ke<de;++ke)for(var je=0;je<Oe;++je)De[$e++]=F[V*ke+ce*Ve+we*je+le];DO(I,De)}function Kv(I,F,V,ce,we,le){var de;if(typeof gn[I]<"u"?de=gn[I]:de=yi[I]*Hu[F],le&&(de*=6),we){for(var Ie=0,Oe=V;Oe>=1;)Ie+=de*Oe*Oe,Oe/=2;return Ie}else return de*V*ce}function Phe(I,F,V,ce,we,le,de){var Ie={"don't care":qv,"dont care":qv,nice:whe,fast:xhe},Oe={repeat:vhe,clamp:J1,mirror:phe},Fe={nearest:eb,linear:mhe},De=n({mipmap:rb,"nearest mipmap nearest":tb,"linear mipmap nearest":bO,"nearest mipmap linear":xO,"linear mipmap linear":rb},Fe),$e={none:0,browser:wO},Ve={uint8:Wu,rgba4:uhe,rgb565:lhe,"rgb5 a1":fhe},ke={alpha:j1,luminance:oc,"luminance alpha":Vv,rgb:Wv,rgba:Ls,rgba4:fO,"rgb5 a1":U1,rgb565:lO},je={};F.ext_srgb&&(ke.srgb=Y1,ke.srgba=W1),F.oes_texture_float&&(Ve.float32=Ve.float=sc),F.oes_texture_half_float&&(Ve.float16=Ve["half float"]=Yu),F.webgl_depth_texture&&(n(ke,{depth:X1,"depth stencil":Hv}),n(Ve,{uint16:K1,uint32:Q1,"depth stencil":che})),F.webgl_compressed_texture_s3tc&&n(je,{"rgb s3tc dxt1":V1,"rgba s3tc dxt1":H1,"rgba s3tc dxt3":q1,"rgba s3tc dxt5":Z1}),F.webgl_compressed_texture_atc&&n(je,{"rgb atc":cO,"rgba atc explicit alpha":hO,"rgba atc interpolated alpha":dO}),F.webgl_compressed_texture_pvrtc&&n(je,{"rgb pvrtc 4bppv1":vO,"rgb pvrtc 2bppv1":pO,"rgba pvrtc 4bppv1":gO,"rgba pvrtc 2bppv1":yO}),F.webgl_compressed_texture_etc1&&(je["rgb etc1"]=mO);var oe=Array.prototype.slice.call(I.getParameter(she));Object.keys(je).forEach(function(X){var he=je[X];oe.indexOf(he)>=0&&(ke[X]=he)});var ve=Object.keys(ke);V.textureFormats=ve;var Be=[];Object.keys(ke).forEach(function(X){var he=ke[X];Be[he]=X});var Ke=[];Object.keys(Ve).forEach(function(X){var he=Ve[X];Ke[he]=X});var Me=[];Object.keys(Fe).forEach(function(X){var he=Fe[X];Me[he]=X});var rt=[];Object.keys(De).forEach(function(X){var he=De[X];rt[he]=X});var Ae=[];Object.keys(Oe).forEach(function(X){var he=Oe[X];Ae[he]=X});var Ue=ve.reduce(function(X,he){var fe=ke[he];return fe===oc||fe===j1||fe===oc||fe===Vv||fe===X1||fe===Hv||F.ext_srgb&&(fe===Y1||fe===W1)?X[fe]=fe:fe===U1||he.indexOf("rgba")>=0?X[fe]=Ls:X[fe]=Wv,X},{});function Ce(){this.internalformat=Ls,this.format=Ls,this.type=Wu,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=wO,this.width=0,this.height=0,this.channels=0}function Xe(X,he){X.internalformat=he.internalformat,X.format=he.format,X.type=he.type,X.compressed=he.compressed,X.premultiplyAlpha=he.premultiplyAlpha,X.flipY=he.flipY,X.unpackAlignment=he.unpackAlignment,X.colorSpace=he.colorSpace,X.width=he.width,X.height=he.height,X.channels=he.channels}function pt(X,he){if(!(typeof he!="object"||!he)){if("premultiplyAlpha"in he&&(L.type(he.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),X.premultiplyAlpha=he.premultiplyAlpha),"flipY"in he&&(L.type(he.flipY,"boolean","invalid texture flip"),X.flipY=he.flipY),"alignment"in he&&(L.oneOf(he.alignment,[1,2,4,8],"invalid texture unpack alignment"),X.unpackAlignment=he.alignment),"colorSpace"in he&&(L.parameter(he.colorSpace,$e,"invalid colorSpace"),X.colorSpace=$e[he.colorSpace]),"type"in he){var fe=he.type;L(F.oes_texture_float||!(fe==="float"||fe==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),L(F.oes_texture_half_float||!(fe==="half float"||fe==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),L(F.webgl_depth_texture||!(fe==="uint16"||fe==="uint32"||fe==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(fe,Ve,"invalid texture type"),X.type=Ve[fe]}var it=X.width,zt=X.height,j=X.channels,R=!1;"shape"in he?(L(Array.isArray(he.shape)&&he.shape.length>=2,"shape must be an array"),it=he.shape[0],zt=he.shape[1],he.shape.length===3&&(j=he.shape[2],L(j>0&&j<=4,"invalid number of channels"),R=!0),L(it>=0&&it<=V.maxTextureSize,"invalid width"),L(zt>=0&&zt<=V.maxTextureSize,"invalid height")):("radius"in he&&(it=zt=he.radius,L(it>=0&&it<=V.maxTextureSize,"invalid radius")),"width"in he&&(it=he.width,L(it>=0&&it<=V.maxTextureSize,"invalid width")),"height"in he&&(zt=he.height,L(zt>=0&&zt<=V.maxTextureSize,"invalid height")),"channels"in he&&(j=he.channels,L(j>0&&j<=4,"invalid number of channels"),R=!0)),X.width=it|0,X.height=zt|0,X.channels=j|0;var Z=!1;if("format"in he){var ie=he.format;L(F.webgl_depth_texture||!(ie==="depth"||ie==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(ie,ke,"invalid texture format");var se=X.internalformat=ke[ie];X.format=Ue[se],ie in Ve&&("type"in he||(X.type=Ve[ie])),ie in je&&(X.compressed=!0),Z=!0}!R&&Z?X.channels=yi[X.format]:R&&!Z?X.channels!==Zv[X.format]&&(X.format=X.internalformat=Zv[X.channels]):Z&&R&&L(X.channels===yi[X.format],"number of channels inconsistent with specified format")}}function Tt(X){I.pixelStorei(She,X.flipY),I.pixelStorei(Mhe,X.premultiplyAlpha),I.pixelStorei(Che,X.colorSpace),I.pixelStorei(_he,X.unpackAlignment)}function He(){Ce.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function ze(X,he){var fe=null;if(nb(he)?fe=he:he&&(L.type(he,"object","invalid pixel data type"),pt(X,he),"x"in he&&(X.xOffset=he.x|0),"y"in he&&(X.yOffset=he.y|0),nb(he.data)&&(fe=he.data)),L(!X.compressed||fe instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),he.copy){L(!fe,"can not specify copy and data field for the same texture");var it=we.viewportWidth,zt=we.viewportHeight;X.width=X.width||it-X.xOffset,X.height=X.height||zt-X.yOffset,X.needsCopy=!0,L(X.xOffset>=0&&X.xOffset<it&&X.yOffset>=0&&X.yOffset<zt&&X.width>0&&X.width<=it&&X.height>0&&X.height<=zt,"copy texture read out of bounds")}else if(!fe)X.width=X.width||1,X.height=X.height||1,X.channels=X.channels||4;else if(t(fe))X.channels=X.channels||4,X.data=fe,!("type"in he)&&X.type===Wu&&(X.type=NO(fe));else if(TO(fe))X.channels=X.channels||4,Ohe(X,fe),X.alignment=1,X.needsFree=!0;else if(Gi(fe)){var j=fe.data;!Array.isArray(j)&&X.type===Wu&&(X.type=NO(j));var R=fe.shape,Z=fe.stride,ie,se,ee,Q,re,U;R.length===3?(ee=R[2],U=Z[2]):(L(R.length===2,"invalid ndarray pixel data, must be 2 or 3D"),ee=1,U=1),ie=R[0],se=R[1],Q=Z[0],re=Z[1],X.alignment=1,X.width=ie,X.height=se,X.channels=ee,X.format=X.internalformat=Zv[ee],X.needsFree=!0,Dhe(X,j,Q,re,U,fe.offset)}else if(kO(fe)||LO(fe)||Ihe(fe))kO(fe)||LO(fe)?X.element=fe:X.element=fe.canvas,X.width=X.element.width,X.height=X.element.height,X.channels=4;else if(khe(fe))X.element=fe,X.width=fe.width,X.height=fe.height,X.channels=4;else if(Lhe(fe))X.element=fe,X.width=fe.naturalWidth,X.height=fe.naturalHeight,X.channels=4;else if(Nhe(fe))X.element=fe,X.width=fe.videoWidth,X.height=fe.videoHeight,X.channels=4;else if(IO(fe)){var q=X.width||fe[0].length,z=X.height||fe.length,ne=X.channels;Lr(fe[0][0])?ne=ne||fe[0][0].length:ne=ne||1;for(var ue=jv.shape(fe),be=1,Ee=0;Ee<ue.length;++Ee)be*=ue[Ee];var ge=OO(X,be);jv.flatten(fe,ue,"",ge),DO(X,ge),X.alignment=1,X.width=q,X.height=z,X.channels=ne,X.format=X.internalformat=Zv[ne],X.needsFree=!0}X.type===sc?L(V.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):X.type===Yu&&L(V.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function _e(X,he,fe){var it=X.element,zt=X.data,j=X.internalformat,R=X.format,Z=X.type,ie=X.width,se=X.height;Tt(X),it?I.texImage2D(he,fe,R,R,Z,it):X.compressed?I.compressedTexImage2D(he,fe,j,ie,se,0,zt):X.needsCopy?(ce(),I.copyTexImage2D(he,fe,R,X.xOffset,X.yOffset,ie,se,0)):I.texImage2D(he,fe,R,ie,se,0,R,Z,zt||null)}function Ct(X,he,fe,it,zt){var j=X.element,R=X.data,Z=X.internalformat,ie=X.format,se=X.type,ee=X.width,Q=X.height;Tt(X),j?I.texSubImage2D(he,zt,fe,it,ie,se,j):X.compressed?I.compressedTexSubImage2D(he,zt,fe,it,Z,ee,Q,R):X.needsCopy?(ce(),I.copyTexSubImage2D(he,zt,fe,it,X.xOffset,X.yOffset,ee,Q)):I.texSubImage2D(he,zt,fe,it,ee,Q,ie,se,R)}var Nt=[];function ot(){return Nt.pop()||new He}function Gt(X){X.needsFree&&xt.freeType(X.data),He.call(X),Nt.push(X)}function kt(){Ce.call(this),this.genMipmaps=!1,this.mipmapHint=qv,this.mipmask=0,this.images=Array(16)}function Bt(X,he,fe){var it=X.images[0]=ot();X.mipmask=1,it.width=X.width=he,it.height=X.height=fe,it.channels=X.channels=4}function rr(X,he){var fe=null;if(nb(he))fe=X.images[0]=ot(),Xe(fe,X),ze(fe,he),X.mipmask=1;else if(pt(X,he),Array.isArray(he.mipmap))for(var it=he.mipmap,zt=0;zt<it.length;++zt)fe=X.images[zt]=ot(),Xe(fe,X),fe.width>>=zt,fe.height>>=zt,ze(fe,it[zt]),X.mipmask|=1<<zt;else fe=X.images[0]=ot(),Xe(fe,X),ze(fe,he),X.mipmask=1;Xe(X,X.images[0]),X.compressed&&(X.internalformat===V1||X.internalformat===H1||X.internalformat===q1||X.internalformat===Z1)&&L(X.width%4===0&&X.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function Gr(X,he){for(var fe=X.images,it=0;it<fe.length;++it){if(!fe[it])return;_e(fe[it],he,it)}}var Qr=[];function Xt(){var X=Qr.pop()||new kt;Ce.call(X),X.mipmask=0;for(var he=0;he<16;++he)X.images[he]=null;return X}function Xr(X){for(var he=X.images,fe=0;fe<he.length;++fe)he[fe]&&Gt(he[fe]),he[fe]=null;Qr.push(X)}function mr(){this.minFilter=eb,this.magFilter=eb,this.wrapS=J1,this.wrapT=J1,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=qv}function zr(X,he){if("min"in he){var fe=he.min;L.parameter(fe,De),X.minFilter=De[fe],Ahe.indexOf(X.minFilter)>=0&&!("faces"in he)&&(X.genMipmaps=!0)}if("mag"in he){var it=he.mag;L.parameter(it,Fe),X.magFilter=Fe[it]}var zt=X.wrapS,j=X.wrapT;if("wrap"in he){var R=he.wrap;typeof R=="string"?(L.parameter(R,Oe),zt=j=Oe[R]):Array.isArray(R)&&(L.parameter(R[0],Oe),L.parameter(R[1],Oe),zt=Oe[R[0]],j=Oe[R[1]])}else{if("wrapS"in he){var Z=he.wrapS;L.parameter(Z,Oe),zt=Oe[Z]}if("wrapT"in he){var ie=he.wrapT;L.parameter(ie,Oe),j=Oe[ie]}}if(X.wrapS=zt,X.wrapT=j,"anisotropic"in he){var se=he.anisotropic;L(typeof se=="number"&&se>=1&&se<=V.maxAnisotropic,"aniso samples must be between 1 and "),X.anisotropic=he.anisotropic}if("mipmap"in he){var ee=!1;switch(typeof he.mipmap){case"string":L.parameter(he.mipmap,Ie,"invalid mipmap hint"),X.mipmapHint=Ie[he.mipmap],X.genMipmaps=!0,ee=!0;break;case"boolean":ee=X.genMipmaps=he.mipmap;break;case"object":L(Array.isArray(he.mipmap),"invalid mipmap type"),X.genMipmaps=!1,ee=!0;break;default:L.raise("invalid mipmap type")}ee&&!("min"in he)&&(X.minFilter=tb)}}function Yr(X,he){I.texParameteri(he,yhe,X.minFilter),I.texParameteri(he,ghe,X.magFilter),I.texParameteri(he,hhe,X.wrapS),I.texParameteri(he,dhe,X.wrapT),F.ext_texture_filter_anisotropic&&I.texParameteri(he,Ehe,X.anisotropic),X.genMipmaps&&(I.hint(bhe,X.mipmapHint),I.generateMipmap(he))}var Wr=0,sn={},yn=V.maxTextureUnits,Nr=Array(yn).map(function(){return null});function Ot(X){Ce.call(this),this.mipmask=0,this.internalformat=Ls,this.id=Wr++,this.refCount=1,this.target=X,this.texture=I.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new mr,de.profile&&(this.stats={size:0})}function mn(X){I.activeTexture(uc),I.bindTexture(X.target,X.texture)}function sr(){var X=Nr[0];X?I.bindTexture(X.target,X.texture):I.bindTexture(ba,null)}function mt(X){var he=X.texture;L(he,"must not double destroy texture");var fe=X.unit,it=X.target;fe>=0&&(I.activeTexture(uc+fe),I.bindTexture(it,null),Nr[fe]=null),I.deleteTexture(he),X.texture=null,X.params=null,X.pixels=null,X.refCount=0,delete sn[X.id],le.textureCount--}n(Ot.prototype,{bind:function(){var X=this;X.bindCount+=1;var he=X.unit;if(he<0){for(var fe=0;fe<yn;++fe){var it=Nr[fe];if(it){if(it.bindCount>0)continue;it.unit=-1}Nr[fe]=X,he=fe;break}he>=yn&&L.raise("insufficient number of texture units"),de.profile&&le.maxTextureUnits<he+1&&(le.maxTextureUnits=he+1),X.unit=he,I.activeTexture(uc+he),I.bindTexture(X.target,X.texture)}return he},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&mt(this)}});function $t(X,he){var fe=new Ot(ba);sn[fe.id]=fe,le.textureCount++;function it(R,Z){var ie=fe.texInfo;mr.call(ie);var se=Xt();return typeof R=="number"?typeof Z=="number"?Bt(se,R|0,Z|0):Bt(se,R|0,R|0):R?(L.type(R,"object","invalid arguments to regl.texture"),zr(ie,R),rr(se,R)):Bt(se,1,1),ie.genMipmaps&&(se.mipmask=(se.width<<1)-1),fe.mipmask=se.mipmask,Xe(fe,se),L.texture2D(ie,se,V),fe.internalformat=se.internalformat,it.width=se.width,it.height=se.height,mn(fe),Gr(se,ba),Yr(ie,ba),sr(),Xr(se),de.profile&&(fe.stats.size=Kv(fe.internalformat,fe.type,se.width,se.height,ie.genMipmaps,!1)),it.format=Be[fe.internalformat],it.type=Ke[fe.type],it.mag=Me[ie.magFilter],it.min=rt[ie.minFilter],it.wrapS=Ae[ie.wrapS],it.wrapT=Ae[ie.wrapT],it}function zt(R,Z,ie,se){L(!!R,"must specify image data");var ee=Z|0,Q=ie|0,re=se|0,U=ot();return Xe(U,fe),U.width=0,U.height=0,ze(U,R),U.width=U.width||(fe.width>>re)-ee,U.height=U.height||(fe.height>>re)-Q,L(fe.type===U.type&&fe.format===U.format&&fe.internalformat===U.internalformat,"incompatible format for texture.subimage"),L(ee>=0&&Q>=0&&ee+U.width<=fe.width&&Q+U.height<=fe.height,"texture.subimage write out of bounds"),L(fe.mipmask&1<<re,"missing mipmap data"),L(U.data||U.element||U.needsCopy,"missing image data"),mn(fe),Ct(U,ba,ee,Q,re),sr(),Gt(U),it}function j(R,Z){var ie=R|0,se=Z|0||ie;if(ie===fe.width&&se===fe.height)return it;it.width=fe.width=ie,it.height=fe.height=se,mn(fe);for(var ee=0;fe.mipmask>>ee;++ee){var Q=ie>>ee,re=se>>ee;if(!Q||!re)break;I.texImage2D(ba,ee,fe.format,Q,re,0,fe.format,fe.type,null)}return sr(),de.profile&&(fe.stats.size=Kv(fe.internalformat,fe.type,ie,se,!1,!1)),it}return it(X,he),it.subimage=zt,it.resize=j,it._reglType="texture2d",it._texture=fe,de.profile&&(it.stats=fe.stats),it.destroy=function(){fe.decRef()},it}function Qt(X,he,fe,it,zt,j){var R=new Ot($1);sn[R.id]=R,le.cubeCount++;var Z=new Array(6);function ie(Q,re,U,q,z,ne){var ue,be=R.texInfo;for(mr.call(be),ue=0;ue<6;++ue)Z[ue]=Xt();if(typeof Q=="number"||!Q){var Ee=Q|0||1;for(ue=0;ue<6;++ue)Bt(Z[ue],Ee,Ee)}else if(typeof Q=="object")if(re)rr(Z[0],Q),rr(Z[1],re),rr(Z[2],U),rr(Z[3],q),rr(Z[4],z),rr(Z[5],ne);else if(zr(be,Q),pt(R,Q),"faces"in Q){var ge=Q.faces;for(L(Array.isArray(ge)&&ge.length===6,"cube faces must be a length 6 array"),ue=0;ue<6;++ue)L(typeof ge[ue]=="object"&&!!ge[ue],"invalid input for cube map face"),Xe(Z[ue],R),rr(Z[ue],ge[ue])}else for(ue=0;ue<6;++ue)rr(Z[ue],Q);else L.raise("invalid arguments to cube map");for(Xe(R,Z[0]),V.npotTextureCube||L(uO(R.width)&&uO(R.height),"your browser does not support non power or two texture dimensions"),be.genMipmaps?R.mipmask=(Z[0].width<<1)-1:R.mipmask=Z[0].mipmask,L.textureCube(R,be,Z,V),R.internalformat=Z[0].internalformat,ie.width=Z[0].width,ie.height=Z[0].height,mn(R),ue=0;ue<6;++ue)Gr(Z[ue],Yv+ue);for(Yr(be,$1),sr(),de.profile&&(R.stats.size=Kv(R.internalformat,R.type,ie.width,ie.height,be.genMipmaps,!0)),ie.format=Be[R.internalformat],ie.type=Ke[R.type],ie.mag=Me[be.magFilter],ie.min=rt[be.minFilter],ie.wrapS=Ae[be.wrapS],ie.wrapT=Ae[be.wrapT],ue=0;ue<6;++ue)Xr(Z[ue]);return ie}function se(Q,re,U,q,z){L(!!re,"must specify image data"),L(typeof Q=="number"&&Q===(Q|0)&&Q>=0&&Q<6,"invalid face");var ne=U|0,ue=q|0,be=z|0,Ee=ot();return Xe(Ee,R),Ee.width=0,Ee.height=0,ze(Ee,re),Ee.width=Ee.width||(R.width>>be)-ne,Ee.height=Ee.height||(R.height>>be)-ue,L(R.type===Ee.type&&R.format===Ee.format&&R.internalformat===Ee.internalformat,"incompatible format for texture.subimage"),L(ne>=0&&ue>=0&&ne+Ee.width<=R.width&&ue+Ee.height<=R.height,"texture.subimage write out of bounds"),L(R.mipmask&1<<be,"missing mipmap data"),L(Ee.data||Ee.element||Ee.needsCopy,"missing image data"),mn(R),Ct(Ee,Yv+Q,ne,ue,be),sr(),Gt(Ee),ie}function ee(Q){var re=Q|0;if(re!==R.width){ie.width=R.width=re,ie.height=R.height=re,mn(R);for(var U=0;U<6;++U)for(var q=0;R.mipmask>>q;++q)I.texImage2D(Yv+U,q,R.format,re>>q,re>>q,0,R.format,R.type,null);return sr(),de.profile&&(R.stats.size=Kv(R.internalformat,R.type,ie.width,ie.height,!1,!0)),ie}}return ie(X,he,fe,it,zt,j),ie.subimage=se,ie.resize=ee,ie._reglType="textureCube",ie._texture=R,de.profile&&(ie.stats=R.stats),ie.destroy=function(){R.decRef()},ie}function Or(){for(var X=0;X<yn;++X)I.activeTexture(uc+X),I.bindTexture(ba,null),Nr[X]=null;ti(sn).forEach(mt),le.cubeCount=0,le.textureCount=0}de.profile&&(le.getTotalTextureSize=function(){var X=0;return Object.keys(sn).forEach(function(he){X+=sn[he].stats.size}),X});function wa(){for(var X=0;X<yn;++X){var he=Nr[X];he&&(he.bindCount=0,he.unit=-1,Nr[X]=null)}ti(sn).forEach(function(fe){fe.texture=I.createTexture(),I.bindTexture(fe.target,fe.texture);for(var it=0;it<32;++it)if(fe.mipmask&1<<it)if(fe.target===ba)I.texImage2D(ba,it,fe.internalformat,fe.width>>it,fe.height>>it,0,fe.internalformat,fe.type,null);else for(var zt=0;zt<6;++zt)I.texImage2D(Yv+zt,it,fe.internalformat,fe.width>>it,fe.height>>it,0,fe.internalformat,fe.type,null);Yr(fe.texInfo,fe.target)})}function Gs(){for(var X=0;X<yn;++X){var he=Nr[X];he&&(he.bindCount=0,he.unit=-1,Nr[X]=null),I.activeTexture(uc+X),I.bindTexture(ba,null),I.bindTexture($1,null)}}return{create2D:$t,createCube:Qt,clear:Or,getTexture:function(X){return null},restore:wa,refresh:Gs}}var Po=36161,Qv=32854,PO=32855,RO=36194,BO=33189,FO=36168,GO=34041,zO=35907,$O=34836,jO=34842,UO=34843,zi=[];zi[Qv]=2,zi[PO]=2,zi[RO]=2,zi[BO]=2,zi[FO]=1,zi[GO]=4,zi[zO]=4,zi[$O]=16,zi[jO]=8,zi[UO]=6;function XO(I,F,V){return zi[I]*F*V}var Rhe=function(I,F,V,ce,we){var le={rgba4:Qv,rgb565:RO,"rgb5 a1":PO,depth:BO,stencil:FO,"depth stencil":GO};F.ext_srgb&&(le.srgba=zO),F.ext_color_buffer_half_float&&(le.rgba16f=jO,le.rgb16f=UO),F.webgl_color_buffer_float&&(le.rgba32f=$O);var de=[];Object.keys(le).forEach(function(ke){var je=le[ke];de[je]=ke});var Ie=0,Oe={};function Fe(ke){this.id=Ie++,this.refCount=1,this.renderbuffer=ke,this.format=Qv,this.width=0,this.height=0,we.profile&&(this.stats={size:0})}Fe.prototype.decRef=function(){--this.refCount<=0&&De(this)};function De(ke){var je=ke.renderbuffer;L(je,"must not double destroy renderbuffer"),I.bindRenderbuffer(Po,null),I.deleteRenderbuffer(je),ke.renderbuffer=null,ke.refCount=0,delete Oe[ke.id],ce.renderbufferCount--}function $e(ke,je){var oe=new Fe(I.createRenderbuffer());Oe[oe.id]=oe,ce.renderbufferCount++;function ve(Ke,Me){var rt=0,Ae=0,Ue=Qv;if(typeof Ke=="object"&&Ke){var Ce=Ke;if("shape"in Ce){var Xe=Ce.shape;L(Array.isArray(Xe)&&Xe.length>=2,"invalid renderbuffer shape"),rt=Xe[0]|0,Ae=Xe[1]|0}else"radius"in Ce&&(rt=Ae=Ce.radius|0),"width"in Ce&&(rt=Ce.width|0),"height"in Ce&&(Ae=Ce.height|0);"format"in Ce&&(L.parameter(Ce.format,le,"invalid renderbuffer format"),Ue=le[Ce.format])}else typeof Ke=="number"?(rt=Ke|0,typeof Me=="number"?Ae=Me|0:Ae=rt):Ke?L.raise("invalid arguments to renderbuffer constructor"):rt=Ae=1;if(L(rt>0&&Ae>0&&rt<=V.maxRenderbufferSize&&Ae<=V.maxRenderbufferSize,"invalid renderbuffer size"),!(rt===oe.width&&Ae===oe.height&&Ue===oe.format))return ve.width=oe.width=rt,ve.height=oe.height=Ae,oe.format=Ue,I.bindRenderbuffer(Po,oe.renderbuffer),I.renderbufferStorage(Po,Ue,rt,Ae),L(I.getError()===0,"invalid render buffer format"),we.profile&&(oe.stats.size=XO(oe.format,oe.width,oe.height)),ve.format=de[oe.format],ve}function Be(Ke,Me){var rt=Ke|0,Ae=Me|0||rt;return rt===oe.width&&Ae===oe.height||(L(rt>0&&Ae>0&&rt<=V.maxRenderbufferSize&&Ae<=V.maxRenderbufferSize,"invalid renderbuffer size"),ve.width=oe.width=rt,ve.height=oe.height=Ae,I.bindRenderbuffer(Po,oe.renderbuffer),I.renderbufferStorage(Po,oe.format,rt,Ae),L(I.getError()===0,"invalid render buffer format"),we.profile&&(oe.stats.size=XO(oe.format,oe.width,oe.height))),ve}return ve(ke,je),ve.resize=Be,ve._reglType="renderbuffer",ve._renderbuffer=oe,we.profile&&(ve.stats=oe.stats),ve.destroy=function(){oe.decRef()},ve}we.profile&&(ce.getTotalRenderbufferSize=function(){var ke=0;return Object.keys(Oe).forEach(function(je){ke+=Oe[je].stats.size}),ke});function Ve(){ti(Oe).forEach(function(ke){ke.renderbuffer=I.createRenderbuffer(),I.bindRenderbuffer(Po,ke.renderbuffer),I.renderbufferStorage(Po,ke.format,ke.width,ke.height)}),I.bindRenderbuffer(Po,null)}return{create:$e,clear:function(){ti(Oe).forEach(De)},restore:Ve}},qa=36160,ib=36161,Os=3553,Jv=34069,YO=36064,WO=36096,VO=36128,HO=33306,qO=36053,Bhe=36054,Fhe=36055,Ghe=36057,zhe=36061,$he=36193,jhe=5121,Uhe=5126,ZO=6407,KO=6408,Xhe=6402,Yhe=[ZO,KO],ab=[];ab[KO]=4,ab[ZO]=3;var ep=[];ep[jhe]=1,ep[Uhe]=4,ep[$he]=2;var Whe=32854,Vhe=32855,Hhe=36194,qhe=33189,Zhe=36168,QO=34041,Khe=35907,Qhe=34836,Jhe=34842,ede=34843,tde=[Whe,Vhe,Hhe,Khe,Jhe,ede,Qhe],qu={};qu[qO]="complete",qu[Bhe]="incomplete attachment",qu[Ghe]="incomplete dimensions",qu[Fhe]="incomplete, missing attachment",qu[zhe]="unsupported";function rde(I,F,V,ce,we,le){var de={cur:null,next:null,dirty:!1,setFBO:null},Ie=["rgba"],Oe=["rgba4","rgb565","rgb5 a1"];F.ext_srgb&&Oe.push("srgba"),F.ext_color_buffer_half_float&&Oe.push("rgba16f","rgb16f"),F.webgl_color_buffer_float&&Oe.push("rgba32f");var Fe=["uint8"];F.oes_texture_half_float&&Fe.push("half float","float16"),F.oes_texture_float&&Fe.push("float","float32");function De(He,ze,_e){this.target=He,this.texture=ze,this.renderbuffer=_e;var Ct=0,Nt=0;ze?(Ct=ze.width,Nt=ze.height):_e&&(Ct=_e.width,Nt=_e.height),this.width=Ct,this.height=Nt}function $e(He){He&&(He.texture&&He.texture._texture.decRef(),He.renderbuffer&&He.renderbuffer._renderbuffer.decRef())}function Ve(He,ze,_e){if(He)if(He.texture){var Ct=He.texture._texture,Nt=Math.max(1,Ct.width),ot=Math.max(1,Ct.height);L(Nt===ze&&ot===_e,"inconsistent width/height for supplied texture"),Ct.refCount+=1}else{var Gt=He.renderbuffer._renderbuffer;L(Gt.width===ze&&Gt.height===_e,"inconsistent width/height for renderbuffer"),Gt.refCount+=1}}function ke(He,ze){ze&&(ze.texture?I.framebufferTexture2D(qa,He,ze.target,ze.texture._texture.texture,0):I.framebufferRenderbuffer(qa,He,ib,ze.renderbuffer._renderbuffer.renderbuffer))}function je(He){var ze=Os,_e=null,Ct=null,Nt=He;typeof He=="object"&&(Nt=He.data,"target"in He&&(ze=He.target|0)),L.type(Nt,"function","invalid attachment data");var ot=Nt._reglType;return ot==="texture2d"?(_e=Nt,L(ze===Os)):ot==="textureCube"?(_e=Nt,L(ze>=Jv&&ze<Jv+6,"invalid cube map target")):ot==="renderbuffer"?(Ct=Nt,ze=ib):L.raise("invalid regl object for attachment"),new De(ze,_e,Ct)}function oe(He,ze,_e,Ct,Nt){if(_e){var ot=ce.create2D({width:He,height:ze,format:Ct,type:Nt});return ot._texture.refCount=0,new De(Os,ot,null)}else{var Gt=we.create({width:He,height:ze,format:Ct});return Gt._renderbuffer.refCount=0,new De(ib,null,Gt)}}function ve(He){return He&&(He.texture||He.renderbuffer)}function Be(He,ze,_e){He&&(He.texture?He.texture.resize(ze,_e):He.renderbuffer&&He.renderbuffer.resize(ze,_e),He.width=ze,He.height=_e)}var Ke=0,Me={};function rt(){this.id=Ke++,Me[this.id]=this,this.framebuffer=I.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Ae(He){He.colorAttachments.forEach($e),$e(He.depthAttachment),$e(He.stencilAttachment),$e(He.depthStencilAttachment)}function Ue(He){var ze=He.framebuffer;L(ze,"must not double destroy framebuffer"),I.deleteFramebuffer(ze),He.framebuffer=null,le.framebufferCount--,delete Me[He.id]}function Ce(He){var ze;I.bindFramebuffer(qa,He.framebuffer);var _e=He.colorAttachments;for(ze=0;ze<_e.length;++ze)ke(YO+ze,_e[ze]);for(ze=_e.length;ze<V.maxColorAttachments;++ze)I.framebufferTexture2D(qa,YO+ze,Os,null,0);I.framebufferTexture2D(qa,HO,Os,null,0),I.framebufferTexture2D(qa,WO,Os,null,0),I.framebufferTexture2D(qa,VO,Os,null,0),ke(WO,He.depthAttachment),ke(VO,He.stencilAttachment),ke(HO,He.depthStencilAttachment);var Ct=I.checkFramebufferStatus(qa);!I.isContextLost()&&Ct!==qO&&L.raise("framebuffer configuration not supported, status = "+qu[Ct]),I.bindFramebuffer(qa,de.next?de.next.framebuffer:null),de.cur=de.next,I.getError()}function Xe(He,ze){var _e=new rt;le.framebufferCount++;function Ct(ot,Gt){var kt;L(de.next!==_e,"can not update framebuffer which is currently in use");var Bt=0,rr=0,Gr=!0,Qr=!0,Xt=null,Xr=!0,mr="rgba",zr="uint8",Yr=1,Wr=null,sn=null,yn=null,Nr=!1;if(typeof ot=="number")Bt=ot|0,rr=Gt|0||Bt;else if(!ot)Bt=rr=1;else{L.type(ot,"object","invalid arguments for framebuffer");var Ot=ot;if("shape"in Ot){var mn=Ot.shape;L(Array.isArray(mn)&&mn.length>=2,"invalid shape for framebuffer"),Bt=mn[0],rr=mn[1]}else"radius"in Ot&&(Bt=rr=Ot.radius),"width"in Ot&&(Bt=Ot.width),"height"in Ot&&(rr=Ot.height);("color"in Ot||"colors"in Ot)&&(Xt=Ot.color||Ot.colors,Array.isArray(Xt)&&L(Xt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),Xt||("colorCount"in Ot&&(Yr=Ot.colorCount|0,L(Yr>0,"invalid color buffer count")),"colorTexture"in Ot&&(Xr=!!Ot.colorTexture,mr="rgba4"),"colorType"in Ot&&(zr=Ot.colorType,Xr?(L(F.oes_texture_float||!(zr==="float"||zr==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),L(F.oes_texture_half_float||!(zr==="half float"||zr==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):zr==="half float"||zr==="float16"?(L(F.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),mr="rgba16f"):(zr==="float"||zr==="float32")&&(L(F.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),mr="rgba32f"),L.oneOf(zr,Fe,"invalid color type")),"colorFormat"in Ot&&(mr=Ot.colorFormat,Ie.indexOf(mr)>=0?Xr=!0:Oe.indexOf(mr)>=0?Xr=!1:Xr?L.oneOf(Ot.colorFormat,Ie,"invalid color format for texture"):L.oneOf(Ot.colorFormat,Oe,"invalid color format for renderbuffer"))),("depthTexture"in Ot||"depthStencilTexture"in Ot)&&(Nr=!!(Ot.depthTexture||Ot.depthStencilTexture),L(!Nr||F.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Ot&&(typeof Ot.depth=="boolean"?Gr=Ot.depth:(Wr=Ot.depth,Qr=!1)),"stencil"in Ot&&(typeof Ot.stencil=="boolean"?Qr=Ot.stencil:(sn=Ot.stencil,Gr=!1)),"depthStencil"in Ot&&(typeof Ot.depthStencil=="boolean"?Gr=Qr=Ot.depthStencil:(yn=Ot.depthStencil,Gr=!1,Qr=!1))}var sr=null,mt=null,$t=null,Qt=null;if(Array.isArray(Xt))sr=Xt.map(je);else if(Xt)sr=[je(Xt)];else for(sr=new Array(Yr),kt=0;kt<Yr;++kt)sr[kt]=oe(Bt,rr,Xr,mr,zr);L(F.webgl_draw_buffers||sr.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),L(sr.length<=V.maxColorAttachments,"too many color attachments, not supported"),Bt=Bt||sr[0].width,rr=rr||sr[0].height,Wr?mt=je(Wr):Gr&&!Qr&&(mt=oe(Bt,rr,Nr,"depth","uint32")),sn?$t=je(sn):Qr&&!Gr&&($t=oe(Bt,rr,!1,"stencil","uint8")),yn?Qt=je(yn):!Wr&&!sn&&Qr&&Gr&&(Qt=oe(Bt,rr,Nr,"depth stencil","depth stencil")),L(!!Wr+!!sn+!!yn<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var Or=null;for(kt=0;kt<sr.length;++kt)if(Ve(sr[kt],Bt,rr),L(!sr[kt]||sr[kt].texture&&Yhe.indexOf(sr[kt].texture._texture.format)>=0||sr[kt].renderbuffer&&tde.indexOf(sr[kt].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+kt+" is invalid"),sr[kt]&&sr[kt].texture){var wa=ab[sr[kt].texture._texture.format]*ep[sr[kt].texture._texture.type];Or===null?Or=wa:L(Or===wa,"all color attachments much have the same number of bits per pixel.")}return Ve(mt,Bt,rr),L(!mt||mt.texture&&mt.texture._texture.format===Xhe||mt.renderbuffer&&mt.renderbuffer._renderbuffer.format===qhe,"invalid depth attachment for framebuffer object"),Ve($t,Bt,rr),L(!$t||$t.renderbuffer&&$t.renderbuffer._renderbuffer.format===Zhe,"invalid stencil attachment for framebuffer object"),Ve(Qt,Bt,rr),L(!Qt||Qt.texture&&Qt.texture._texture.format===QO||Qt.renderbuffer&&Qt.renderbuffer._renderbuffer.format===QO,"invalid depth-stencil attachment for framebuffer object"),Ae(_e),_e.width=Bt,_e.height=rr,_e.colorAttachments=sr,_e.depthAttachment=mt,_e.stencilAttachment=$t,_e.depthStencilAttachment=Qt,Ct.color=sr.map(ve),Ct.depth=ve(mt),Ct.stencil=ve($t),Ct.depthStencil=ve(Qt),Ct.width=_e.width,Ct.height=_e.height,Ce(_e),Ct}function Nt(ot,Gt){L(de.next!==_e,"can not resize a framebuffer which is currently in use");var kt=Math.max(ot|0,1),Bt=Math.max(Gt|0||kt,1);if(kt===_e.width&&Bt===_e.height)return Ct;for(var rr=_e.colorAttachments,Gr=0;Gr<rr.length;++Gr)Be(rr[Gr],kt,Bt);return Be(_e.depthAttachment,kt,Bt),Be(_e.stencilAttachment,kt,Bt),Be(_e.depthStencilAttachment,kt,Bt),_e.width=Ct.width=kt,_e.height=Ct.height=Bt,Ce(_e),Ct}return Ct(He,ze),n(Ct,{resize:Nt,_reglType:"framebuffer",_framebuffer:_e,destroy:function(){Ue(_e),Ae(_e)},use:function(ot){de.setFBO({framebuffer:Ct},ot)}})}function pt(He){var ze=Array(6);function _e(Nt){var ot;L(ze.indexOf(de.next)<0,"can not update framebuffer which is currently in use");var Gt={color:null},kt=0,Bt=null,rr="rgba",Gr="uint8",Qr=1;if(typeof Nt=="number")kt=Nt|0;else if(!Nt)kt=1;else{L.type(Nt,"object","invalid arguments for framebuffer");var Xt=Nt;if("shape"in Xt){var Xr=Xt.shape;L(Array.isArray(Xr)&&Xr.length>=2,"invalid shape for framebuffer"),L(Xr[0]===Xr[1],"cube framebuffer must be square"),kt=Xr[0]}else"radius"in Xt&&(kt=Xt.radius|0),"width"in Xt?(kt=Xt.width|0,"height"in Xt&&L(Xt.height===kt,"must be square")):"height"in Xt&&(kt=Xt.height|0);("color"in Xt||"colors"in Xt)&&(Bt=Xt.color||Xt.colors,Array.isArray(Bt)&&L(Bt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),Bt||("colorCount"in Xt&&(Qr=Xt.colorCount|0,L(Qr>0,"invalid color buffer count")),"colorType"in Xt&&(L.oneOf(Xt.colorType,Fe,"invalid color type"),Gr=Xt.colorType),"colorFormat"in Xt&&(rr=Xt.colorFormat,L.oneOf(Xt.colorFormat,Ie,"invalid color format for texture"))),"depth"in Xt&&(Gt.depth=Xt.depth),"stencil"in Xt&&(Gt.stencil=Xt.stencil),"depthStencil"in Xt&&(Gt.depthStencil=Xt.depthStencil)}var mr;if(Bt)if(Array.isArray(Bt))for(mr=[],ot=0;ot<Bt.length;++ot)mr[ot]=Bt[ot];else mr=[Bt];else{mr=Array(Qr);var zr={radius:kt,format:rr,type:Gr};for(ot=0;ot<Qr;++ot)mr[ot]=ce.createCube(zr)}for(Gt.color=Array(mr.length),ot=0;ot<mr.length;++ot){var Yr=mr[ot];L(typeof Yr=="function"&&Yr._reglType==="textureCube","invalid cube map"),kt=kt||Yr.width,L(Yr.width===kt&&Yr.height===kt,"invalid cube map shape"),Gt.color[ot]={target:Jv,data:mr[ot]}}for(ot=0;ot<6;++ot){for(var Wr=0;Wr<mr.length;++Wr)Gt.color[Wr].target=Jv+ot;ot>0&&(Gt.depth=ze[0].depth,Gt.stencil=ze[0].stencil,Gt.depthStencil=ze[0].depthStencil),ze[ot]?ze[ot](Gt):ze[ot]=Xe(Gt)}return n(_e,{width:kt,height:kt,color:mr})}function Ct(Nt){var ot,Gt=Nt|0;if(L(Gt>0&&Gt<=V.maxCubeMapSize,"invalid radius for cube fbo"),Gt===_e.width)return _e;var kt=_e.color;for(ot=0;ot<kt.length;++ot)kt[ot].resize(Gt);for(ot=0;ot<6;++ot)ze[ot].resize(Gt);return _e.width=_e.height=Gt,_e}return _e(He),n(_e,{faces:ze,resize:Ct,_reglType:"framebufferCube",destroy:function(){ze.forEach(function(Nt){Nt.destroy()})}})}function Tt(){de.cur=null,de.next=null,de.dirty=!0,ti(Me).forEach(function(He){He.framebuffer=I.createFramebuffer(),Ce(He)})}return n(de,{getFramebuffer:function(He){if(typeof He=="function"&&He._reglType==="framebuffer"){var ze=He._framebuffer;if(ze instanceof rt)return ze}return null},create:Xe,createCube:pt,clear:function(){ti(Me).forEach(Ue)},restore:Tt})}var nde=5126,JO=34962;function ob(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=nde,this.offset=0,this.stride=0,this.divisor=0}function ide(I,F,V,ce,we){for(var le=V.maxAttributes,de=new Array(le),Ie=0;Ie<le;++Ie)de[Ie]=new ob;var Oe=0,Fe={},De={Record:ob,scope:{},state:de,currentVAO:null,targetVAO:null,restore:Ve()?Me:function(){},createVAO:rt,getVAO:je,destroyBuffer:$e,setVAO:Ve()?oe:ve,clear:Ve()?Be:function(){}};function $e(Ae){for(var Ue=0;Ue<de.length;++Ue){var Ce=de[Ue];Ce.buffer===Ae&&(I.disableVertexAttribArray(Ue),Ce.buffer=null)}}function Ve(){return F.oes_vertex_array_object}function ke(){return F.angle_instanced_arrays}function je(Ae){return typeof Ae=="function"&&Ae._vao?Ae._vao:null}function oe(Ae){if(Ae!==De.currentVAO){var Ue=Ve();Ae?Ue.bindVertexArrayOES(Ae.vao):Ue.bindVertexArrayOES(null),De.currentVAO=Ae}}function ve(Ae){if(Ae!==De.currentVAO){if(Ae)Ae.bindAttrs();else for(var Ue=ke(),Ce=0;Ce<de.length;++Ce){var Xe=de[Ce];Xe.buffer?(I.enableVertexAttribArray(Ce),I.vertexAttribPointer(Ce,Xe.size,Xe.type,Xe.normalized,Xe.stride,Xe.offfset),Ue&&Xe.divisor&&Ue.vertexAttribDivisorANGLE(Ce,Xe.divisor)):(I.disableVertexAttribArray(Ce),I.vertexAttrib4f(Ce,Xe.x,Xe.y,Xe.z,Xe.w))}De.currentVAO=Ae}}function Be(){ti(Fe).forEach(function(Ae){Ae.destroy()})}function Ke(){this.id=++Oe,this.attributes=[];var Ae=Ve();Ae?this.vao=Ae.createVertexArrayOES():this.vao=null,Fe[this.id]=this,this.buffers=[]}Ke.prototype.bindAttrs=function(){for(var Ae=ke(),Ue=this.attributes,Ce=0;Ce<Ue.length;++Ce){var Xe=Ue[Ce];Xe.buffer?(I.enableVertexAttribArray(Ce),I.bindBuffer(JO,Xe.buffer.buffer),I.vertexAttribPointer(Ce,Xe.size,Xe.type,Xe.normalized,Xe.stride,Xe.offset),Ae&&Xe.divisor&&Ae.vertexAttribDivisorANGLE(Ce,Xe.divisor)):(I.disableVertexAttribArray(Ce),I.vertexAttrib4f(Ce,Xe.x,Xe.y,Xe.z,Xe.w))}for(var pt=Ue.length;pt<le;++pt)I.disableVertexAttribArray(pt)},Ke.prototype.refresh=function(){var Ae=Ve();Ae&&(Ae.bindVertexArrayOES(this.vao),this.bindAttrs(),De.currentVAO=this)},Ke.prototype.destroy=function(){if(this.vao){var Ae=Ve();this===De.currentVAO&&(De.currentVAO=null,Ae.bindVertexArrayOES(null)),Ae.deleteVertexArrayOES(this.vao),this.vao=null}Fe[this.id]&&(delete Fe[this.id],ce.vaoCount-=1)};function Me(){var Ae=Ve();Ae&&ti(Fe).forEach(function(Ue){Ue.refresh()})}function rt(Ae){var Ue=new Ke;ce.vaoCount+=1;function Ce(Xe){L(Array.isArray(Xe),"arguments to vertex array constructor must be an array"),L(Xe.length<le,"too many attributes"),L(Xe.length>0,"must specify at least one attribute");var pt={},Tt=Ue.attributes;Tt.length=Xe.length;for(var He=0;He<Xe.length;++He){var ze=Xe[He],_e=Tt[He]=new ob,Ct=ze.data||ze;if(Array.isArray(Ct)||t(Ct)||Gi(Ct)){var Nt;Ue.buffers[He]&&(Nt=Ue.buffers[He],t(Ct)&&Nt._buffer.byteLength>=Ct.byteLength?Nt.subdata(Ct):(Nt.destroy(),Ue.buffers[He]=null)),Ue.buffers[He]||(Nt=Ue.buffers[He]=we.create(ze,JO,!1,!0)),_e.buffer=we.getBuffer(Nt),_e.size=_e.buffer.dimension|0,_e.normalized=!1,_e.type=_e.buffer.dtype,_e.offset=0,_e.stride=0,_e.divisor=0,_e.state=1,pt[He]=1}else we.getBuffer(ze)?(_e.buffer=we.getBuffer(ze),_e.size=_e.buffer.dimension|0,_e.normalized=!1,_e.type=_e.buffer.dtype,_e.offset=0,_e.stride=0,_e.divisor=0,_e.state=1):we.getBuffer(ze.buffer)?(_e.buffer=we.getBuffer(ze.buffer),_e.size=(+ze.size||_e.buffer.dimension)|0,_e.normalized=!!ze.normalized||!1,"type"in ze?(L.parameter(ze.type,Is,"invalid buffer type"),_e.type=Is[ze.type]):_e.type=_e.buffer.dtype,_e.offset=(ze.offset||0)|0,_e.stride=(ze.stride||0)|0,_e.divisor=(ze.divisor||0)|0,_e.state=1,L(_e.size>=1&&_e.size<=4,"size must be between 1 and 4"),L(_e.offset>=0,"invalid offset"),L(_e.stride>=0&&_e.stride<=255,"stride must be between 0 and 255"),L(_e.divisor>=0,"divisor must be positive"),L(!_e.divisor||!!F.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in ze?(L(He>0,"first attribute must not be a constant"),_e.x=+ze.x||0,_e.y=+ze.y||0,_e.z=+ze.z||0,_e.w=+ze.w||0,_e.state=2):L(!1,"invalid attribute spec for location "+He)}for(var ot=0;ot<Ue.buffers.length;++ot)!pt[ot]&&Ue.buffers[ot]&&(Ue.buffers[ot].destroy(),Ue.buffers[ot]=null);return Ue.refresh(),Ce}return Ce.destroy=function(){for(var Xe=0;Xe<Ue.buffers.length;++Xe)Ue.buffers[Xe]&&Ue.buffers[Xe].destroy();Ue.buffers.length=0,Ue.destroy()},Ce._vao=Ue,Ce._reglType="vao",Ce(Ae)}return De}var eD=35632,ade=35633,ode=35718,sde=35721;function ude(I,F,V,ce){var we={},le={};function de(oe,ve,Be,Ke){this.name=oe,this.id=ve,this.location=Be,this.info=Ke}function Ie(oe,ve){for(var Be=0;Be<oe.length;++Be)if(oe[Be].id===ve.id){oe[Be].location=ve.location;return}oe.push(ve)}function Oe(oe,ve,Be){var Ke=oe===eD?we:le,Me=Ke[ve];if(!Me){var rt=F.str(ve);Me=I.createShader(oe),I.shaderSource(Me,rt),I.compileShader(Me),L.shaderError(I,Me,rt,oe,Be),Ke[ve]=Me}return Me}var Fe={},De=[],$e=0;function Ve(oe,ve){this.id=$e++,this.fragId=oe,this.vertId=ve,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,ce.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function ke(oe,ve,Be){var Ke,Me,rt=Oe(eD,oe.fragId),Ae=Oe(ade,oe.vertId),Ue=oe.program=I.createProgram();if(I.attachShader(Ue,rt),I.attachShader(Ue,Ae),Be)for(Ke=0;Ke<Be.length;++Ke){var Ce=Be[Ke];I.bindAttribLocation(Ue,Ce[0],Ce[1])}I.linkProgram(Ue),L.linkError(I,Ue,F.str(oe.fragId),F.str(oe.vertId),ve);var Xe=I.getProgramParameter(Ue,ode);ce.profile&&(oe.stats.uniformsCount=Xe);var pt=oe.uniforms;for(Ke=0;Ke<Xe;++Ke)if(Me=I.getActiveUniform(Ue,Ke),Me)if(Me.size>1)for(var Tt=0;Tt<Me.size;++Tt){var He=Me.name.replace("[0]","["+Tt+"]");Ie(pt,new de(He,F.id(He),I.getUniformLocation(Ue,He),Me))}else Ie(pt,new de(Me.name,F.id(Me.name),I.getUniformLocation(Ue,Me.name),Me));var ze=I.getProgramParameter(Ue,sde);ce.profile&&(oe.stats.attributesCount=ze);var _e=oe.attributes;for(Ke=0;Ke<ze;++Ke)Me=I.getActiveAttrib(Ue,Ke),Me&&Ie(_e,new de(Me.name,F.id(Me.name),I.getAttribLocation(Ue,Me.name),Me))}ce.profile&&(V.getMaxUniformsCount=function(){var oe=0;return De.forEach(function(ve){ve.stats.uniformsCount>oe&&(oe=ve.stats.uniformsCount)}),oe},V.getMaxAttributesCount=function(){var oe=0;return De.forEach(function(ve){ve.stats.attributesCount>oe&&(oe=ve.stats.attributesCount)}),oe});function je(){we={},le={};for(var oe=0;oe<De.length;++oe)ke(De[oe],null,De[oe].attributes.map(function(ve){return[ve.location,ve.name]}))}return{clear:function(){var oe=I.deleteShader.bind(I);ti(we).forEach(oe),we={},ti(le).forEach(oe),le={},De.forEach(function(ve){I.deleteProgram(ve.program)}),De.length=0,Fe={},V.shaderCount=0},program:function(oe,ve,Be,Ke){L.command(oe>=0,"missing vertex shader",Be),L.command(ve>=0,"missing fragment shader",Be);var Me=Fe[ve];Me||(Me=Fe[ve]={});var rt=Me[oe];if(rt&&(rt.refCount++,!Ke))return rt;var Ae=new Ve(ve,oe);return V.shaderCount++,ke(Ae,Be,Ke),rt||(Me[oe]=Ae),De.push(Ae),n(Ae,{destroy:function(){if(Ae.refCount--,Ae.refCount<=0){I.deleteProgram(Ae.program);var Ue=De.indexOf(Ae);De.splice(Ue,1),V.shaderCount--}Me[Ae.vertId].refCount<=0&&(I.deleteShader(le[Ae.vertId]),delete le[Ae.vertId],delete Fe[Ae.fragId][Ae.vertId]),Object.keys(Fe[Ae.fragId]).length||(I.deleteShader(we[Ae.fragId]),delete we[Ae.fragId],delete Fe[Ae.fragId])}})},restore:je,shader:Oe,frag:-1,vert:-1}}var fde=6408,fc=5121,lde=3333,tp=5126;function cde(I,F,V,ce,we,le,de){function Ie(De){var $e;F.next===null?(L(we.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),$e=fc):(L(F.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),$e=F.next.colorAttachments[0].texture._texture.type,le.oes_texture_float?(L($e===fc||$e===tp,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),$e===tp&&L(de.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):L($e===fc,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Ve=0,ke=0,je=ce.framebufferWidth,oe=ce.framebufferHeight,ve=null;t(De)?ve=De:De&&(L.type(De,"object","invalid arguments to regl.read()"),Ve=De.x|0,ke=De.y|0,L(Ve>=0&&Ve<ce.framebufferWidth,"invalid x offset for regl.read"),L(ke>=0&&ke<ce.framebufferHeight,"invalid y offset for regl.read"),je=(De.width||ce.framebufferWidth-Ve)|0,oe=(De.height||ce.framebufferHeight-ke)|0,ve=De.data||null),ve&&($e===fc?L(ve instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):$e===tp&&L(ve instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),L(je>0&&je+Ve<=ce.framebufferWidth,"invalid width for read pixels"),L(oe>0&&oe+ke<=ce.framebufferHeight,"invalid height for read pixels"),V();var Be=je*oe*4;return ve||($e===fc?ve=new Uint8Array(Be):$e===tp&&(ve=ve||new Float32Array(Be))),L.isTypedArray(ve,"data buffer for regl.read() must be a typedarray"),L(ve.byteLength>=Be,"data buffer for regl.read() too small"),I.pixelStorei(lde,4),I.readPixels(Ve,ke,je,oe,fde,$e,ve),ve}function Oe(De){var $e;return F.setFBO({framebuffer:De.framebuffer},function(){$e=Ie(De)}),$e}function Fe(De){return!De||!("framebuffer"in De)?Ie(De):Oe(De)}return Fe}function Zu(I){return Array.prototype.slice.call(I)}function Ku(I){return Zu(I).join("")}function hde(){var I=0,F=[],V=[];function ce($e){for(var Ve=0;Ve<V.length;++Ve)if(V[Ve]===$e)return F[Ve];var ke="g"+I++;return F.push(ke),V.push($e),ke}function we(){var $e=[];function Ve(){$e.push.apply($e,Zu(arguments))}var ke=[];function je(){var oe="v"+I++;return ke.push(oe),arguments.length>0&&($e.push(oe,"="),$e.push.apply($e,Zu(arguments)),$e.push(";")),oe}return n(Ve,{def:je,toString:function(){return Ku([ke.length>0?"var "+ke.join(",")+";":"",Ku($e)])}})}function le(){var $e=we(),Ve=we(),ke=$e.toString,je=Ve.toString;function oe(ve,Be){Ve(ve,Be,"=",$e.def(ve,Be),";")}return n(function(){$e.apply($e,Zu(arguments))},{def:$e.def,entry:$e,exit:Ve,save:oe,set:function(ve,Be,Ke){oe(ve,Be),$e(ve,Be,"=",Ke,";")},toString:function(){return ke()+je()}})}function de(){var $e=Ku(arguments),Ve=le(),ke=le(),je=Ve.toString,oe=ke.toString;return n(Ve,{then:function(){return Ve.apply(Ve,Zu(arguments)),this},else:function(){return ke.apply(ke,Zu(arguments)),this},toString:function(){var ve=oe();return ve&&(ve="else{"+ve+"}"),Ku(["if(",$e,"){",je(),"}",ve])}})}var Ie=we(),Oe={};function Fe($e,Ve){var ke=[];function je(){var Me="a"+ke.length;return ke.push(Me),Me}Ve=Ve||0;for(var oe=0;oe<Ve;++oe)je();var ve=le(),Be=ve.toString,Ke=Oe[$e]=n(ve,{arg:je,toString:function(){return Ku(["function(",ke.join(),"){",Be(),"}"])}});return Ke}function De(){var $e=['"use strict";',Ie,"return {"];Object.keys(Oe).forEach(function(je){$e.push('"',je,'":',Oe[je].toString(),",")}),$e.push("}");var Ve=Ku($e).replace(/;/g,`;
`).replace(/}/g,`}
`).replace(/{/g,`{
`),ke=Function.apply(null,F.concat(Ve));return ke.apply(null,V)}return{global:Ie,link:ce,block:we,proc:Fe,scope:le,cond:de,compile:De}}var Qu="xyzw".split(""),tD=5121,Ju=1,sb=2,ub=0,fb=1,lb=2,cb=3,rp=4,rD=5,nD=6,iD="dither",aD="blend.enable",oD="blend.color",hb="blend.equation",db="blend.func",sD="depth.enable",uD="depth.func",fD="depth.range",lD="depth.mask",vb="colorMask",cD="cull.enable",hD="cull.face",pb="frontFace",gb="lineWidth",dD="polygonOffset.enable",yb="polygonOffset.offset",vD="sample.alpha",pD="sample.enable",mb="sample.coverage",gD="stencil.enable",yD="stencil.mask",bb="stencil.func",xb="stencil.opFront",lc="stencil.opBack",mD="scissor.enable",np="scissor.box",Za="viewport",cc="profile",Ds="framebuffer",hc="vert",dc="frag",Ps="elements",Rs="primitive",Bs="count",ip="offset",ap="instances",vc="vao",wb="Width",Eb="Height",ef=Ds+wb,tf=Ds+Eb,dde=Za+wb,vde=Za+Eb,bD="drawingBuffer",xD=bD+wb,wD=bD+Eb,pde=[db,hb,bb,xb,lc,mb,Za,np,yb],rf=34962,gde=34963,yde=35632,mde=35633,ED=3553,bde=34067,xde=2884,wde=3042,Ede=3024,_de=2960,Sde=2929,Mde=3089,Cde=32823,Ade=32926,Tde=32928,_b=5126,op=35664,sp=35665,up=35666,Sb=5124,fp=35667,lp=35668,cp=35669,Mb=35670,hp=35671,dp=35672,vp=35673,pc=35674,gc=35675,yc=35676,mc=35678,bc=35680,_D=4,xc=1028,Fs=1029,SD=2304,Cb=2305,Ide=32775,kde=32776,Lde=519,Ro=7680,MD=0,CD=1,AD=32774,Nde=513,TD=36160,Ode=36064,xa={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},ID=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],nf={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Bo={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},kD={frag:yde,vert:mde},Ab={cw:SD,ccw:Cb};function pp(I){return Array.isArray(I)||t(I)||Gi(I)}function LD(I){return I.sort(function(F,V){return F===Za?-1:V===Za?1:F<V?-1:1})}function Ln(I,F,V,ce){this.thisDep=I,this.contextDep=F,this.propDep=V,this.append=ce}function Fo(I){return I&&!(I.thisDep||I.contextDep||I.propDep)}function Fr(I){return new Ln(!1,!1,!1,I)}function jn(I,F){var V=I.type;if(V===ub){var ce=I.data.length;return new Ln(!0,ce>=1,ce>=2,F)}else if(V===rp){var we=I.data;return new Ln(we.thisDep,we.contextDep,we.propDep,F)}else{if(V===rD)return new Ln(!1,!1,!1,F);if(V===nD){for(var le=!1,de=!1,Ie=!1,Oe=0;Oe<I.data.length;++Oe){var Fe=I.data[Oe];if(Fe.type===fb)Ie=!0;else if(Fe.type===lb)de=!0;else if(Fe.type===cb)le=!0;else if(Fe.type===ub){le=!0;var De=Fe.data;De>=1&&(de=!0),De>=2&&(Ie=!0)}else Fe.type===rp&&(le=le||Fe.data.thisDep,de=de||Fe.data.contextDep,Ie=Ie||Fe.data.propDep)}return new Ln(le,de,Ie,F)}else return new Ln(V===cb,V===lb,V===fb,F)}}var ND=new Ln(!1,!1,!1,function(){});function Dde(I,F,V,ce,we,le,de,Ie,Oe,Fe,De,$e,Ve,ke,je){var oe=Fe.Record,ve={add:32774,subtract:32778,"reverse subtract":32779};V.ext_blend_minmax&&(ve.min=Ide,ve.max=kde);var Be=V.angle_instanced_arrays,Ke=V.webgl_draw_buffers,Me={dirty:!0,profile:je.profile},rt={},Ae=[],Ue={},Ce={};function Xe(j){return j.replace(".","_")}function pt(j,R,Z){var ie=Xe(j);Ae.push(j),rt[ie]=Me[ie]=!!Z,Ue[ie]=R}function Tt(j,R,Z){var ie=Xe(j);Ae.push(j),Array.isArray(Z)?(Me[ie]=Z.slice(),rt[ie]=Z.slice()):Me[ie]=rt[ie]=Z,Ce[ie]=R}pt(iD,Ede),pt(aD,wde),Tt(oD,"blendColor",[0,0,0,0]),Tt(hb,"blendEquationSeparate",[AD,AD]),Tt(db,"blendFuncSeparate",[CD,MD,CD,MD]),pt(sD,Sde,!0),Tt(uD,"depthFunc",Nde),Tt(fD,"depthRange",[0,1]),Tt(lD,"depthMask",!0),Tt(vb,vb,[!0,!0,!0,!0]),pt(cD,xde),Tt(hD,"cullFace",Fs),Tt(pb,pb,Cb),Tt(gb,gb,1),pt(dD,Cde),Tt(yb,"polygonOffset",[0,0]),pt(vD,Ade),pt(pD,Tde),Tt(mb,"sampleCoverage",[1,!1]),pt(gD,_de),Tt(yD,"stencilMask",-1),Tt(bb,"stencilFunc",[Lde,0,-1]),Tt(xb,"stencilOpSeparate",[xc,Ro,Ro,Ro]),Tt(lc,"stencilOpSeparate",[Fs,Ro,Ro,Ro]),pt(mD,Mde),Tt(np,"scissor",[0,0,I.drawingBufferWidth,I.drawingBufferHeight]),Tt(Za,Za,[0,0,I.drawingBufferWidth,I.drawingBufferHeight]);var He={gl:I,context:Ve,strings:F,next:rt,current:Me,draw:$e,elements:le,buffer:we,shader:De,attributes:Fe.state,vao:Fe,uniforms:Oe,framebuffer:Ie,extensions:V,timer:ke,isBufferArgs:pp},ze={primTypes:ju,compareFuncs:nf,blendFuncs:xa,blendEquations:ve,stencilOps:Bo,glTypes:Is,orientationType:Ab};L.optional(function(){He.isArrayLike=Lr}),Ke&&(ze.backBuffer=[Fs],ze.drawBuffer=pn(ce.maxDrawbuffers,function(j){return j===0?[0]:pn(j,function(R){return Ode+R})}));var _e=0;function Ct(){var j=hde(),R=j.link,Z=j.global;j.id=_e++,j.batchId="0";var ie=R(He),se=j.shared={props:"a0"};Object.keys(He).forEach(function(q){se[q]=Z.def(ie,".",q)}),L.optional(function(){j.CHECK=R(L),j.commandStr=L.guessCommand(),j.command=R(j.commandStr),j.assert=function(q,z,ne){q("if(!(",z,"))",this.CHECK,".commandRaise(",R(ne),",",this.command,");")},ze.invalidBlendCombinations=ID});var ee=j.next={},Q=j.current={};Object.keys(Ce).forEach(function(q){Array.isArray(Me[q])&&(ee[q]=Z.def(se.next,".",q),Q[q]=Z.def(se.current,".",q))});var re=j.constants={};Object.keys(ze).forEach(function(q){re[q]=Z.def(JSON.stringify(ze[q]))}),j.invoke=function(q,z){switch(z.type){case ub:var ne=["this",se.context,se.props,j.batchId];return q.def(R(z.data),".call(",ne.slice(0,Math.max(z.data.length+1,4)),")");case fb:return q.def(se.props,z.data);case lb:return q.def(se.context,z.data);case cb:return q.def("this",z.data);case rp:return z.data.append(j,q),z.data.ref;case rD:return z.data.toString();case nD:return z.data.map(function(ue){return j.invoke(q,ue)})}},j.attribCache={};var U={};return j.scopeAttrib=function(q){var z=F.id(q);if(z in U)return U[z];var ne=Fe.scope[z];ne||(ne=Fe.scope[z]=new oe);var ue=U[z]=R(ne);return ue},j}function Nt(j){var R=j.static,Z=j.dynamic,ie;if(cc in R){var se=!!R[cc];ie=Fr(function(Q,re){return se}),ie.enable=se}else if(cc in Z){var ee=Z[cc];ie=jn(ee,function(Q,re){return Q.invoke(re,ee)})}return ie}function ot(j,R){var Z=j.static,ie=j.dynamic;if(Ds in Z){var se=Z[Ds];return se?(se=Ie.getFramebuffer(se),L.command(se,"invalid framebuffer object"),Fr(function(Q,re){var U=Q.link(se),q=Q.shared;re.set(q.framebuffer,".next",U);var z=q.context;return re.set(z,"."+ef,U+".width"),re.set(z,"."+tf,U+".height"),U})):Fr(function(Q,re){var U=Q.shared;re.set(U.framebuffer,".next","null");var q=U.context;return re.set(q,"."+ef,q+"."+xD),re.set(q,"."+tf,q+"."+wD),"null"})}else if(Ds in ie){var ee=ie[Ds];return jn(ee,function(Q,re){var U=Q.invoke(re,ee),q=Q.shared,z=q.framebuffer,ne=re.def(z,".getFramebuffer(",U,")");L.optional(function(){Q.assert(re,"!"+U+"||"+ne,"invalid framebuffer object")}),re.set(z,".next",ne);var ue=q.context;return re.set(ue,"."+ef,ne+"?"+ne+".width:"+ue+"."+xD),re.set(ue,"."+tf,ne+"?"+ne+".height:"+ue+"."+wD),ne})}else return null}function Gt(j,R,Z){var ie=j.static,se=j.dynamic;function ee(U){if(U in ie){var q=ie[U];L.commandType(q,"object","invalid "+U,Z.commandStr);var z=!0,ne=q.x|0,ue=q.y|0,be,Ee;return"width"in q?(be=q.width|0,L.command(be>=0,"invalid "+U,Z.commandStr)):z=!1,"height"in q?(Ee=q.height|0,L.command(Ee>=0,"invalid "+U,Z.commandStr)):z=!1,new Ln(!z&&R&&R.thisDep,!z&&R&&R.contextDep,!z&&R&&R.propDep,function(lt,Dt){var st=lt.shared.context,wt=be;"width"in q||(wt=Dt.def(st,".",ef,"-",ne));var Lt=Ee;return"height"in q||(Lt=Dt.def(st,".",tf,"-",ue)),[ne,ue,wt,Lt]})}else if(U in se){var ge=se[U],Re=jn(ge,function(lt,Dt){var st=lt.invoke(Dt,ge);L.optional(function(){lt.assert(Dt,st+"&&typeof "+st+'==="object"',"invalid "+U)});var wt=lt.shared.context,Lt=Dt.def(st,".x|0"),nr=Dt.def(st,".y|0"),Tr=Dt.def('"width" in ',st,"?",st,".width|0:","(",wt,".",ef,"-",Lt,")"),Nn=Dt.def('"height" in ',st,"?",st,".height|0:","(",wt,".",tf,"-",nr,")");return L.optional(function(){lt.assert(Dt,Tr+">=0&&"+Nn+">=0","invalid "+U)}),[Lt,nr,Tr,Nn]});return R&&(Re.thisDep=Re.thisDep||R.thisDep,Re.contextDep=Re.contextDep||R.contextDep,Re.propDep=Re.propDep||R.propDep),Re}else return R?new Ln(R.thisDep,R.contextDep,R.propDep,function(lt,Dt){var st=lt.shared.context;return[0,0,Dt.def(st,".",ef),Dt.def(st,".",tf)]}):null}var Q=ee(Za);if(Q){var re=Q;Q=new Ln(Q.thisDep,Q.contextDep,Q.propDep,function(U,q){var z=re.append(U,q),ne=U.shared.context;return q.set(ne,"."+dde,z[2]),q.set(ne,"."+vde,z[3]),z})}return{viewport:Q,scissor_box:ee(np)}}function kt(j,R){var Z=j.static,ie=typeof Z[dc]=="string"&&typeof Z[hc]=="string";if(ie){if(Object.keys(R.dynamic).length>0)return null;var se=R.static,ee=Object.keys(se);if(ee.length>0&&typeof se[ee[0]]=="number"){for(var Q=[],re=0;re<ee.length;++re)L(typeof se[ee[re]]=="number","must specify all vertex attribute locations when using vaos"),Q.push([se[ee[re]]|0,ee[re]]);return Q}}return null}function Bt(j,R,Z){var ie=j.static,se=j.dynamic;function ee(z){if(z in ie){var ne=F.id(ie[z]);L.optional(function(){De.shader(kD[z],ne,L.guessCommand())});var ue=Fr(function(){return ne});return ue.id=ne,ue}else if(z in se){var be=se[z];return jn(be,function(Ee,ge){var Re=Ee.invoke(ge,be),lt=ge.def(Ee.shared.strings,".id(",Re,")");return L.optional(function(){ge(Ee.shared.shader,".shader(",kD[z],",",lt,",",Ee.command,");")}),lt})}return null}var Q=ee(dc),re=ee(hc),U=null,q;return Fo(Q)&&Fo(re)?(U=De.program(re.id,Q.id,null,Z),q=Fr(function(z,ne){return z.link(U)})):q=new Ln(Q&&Q.thisDep||re&&re.thisDep,Q&&Q.contextDep||re&&re.contextDep,Q&&Q.propDep||re&&re.propDep,function(z,ne){var ue=z.shared.shader,be;Q?be=Q.append(z,ne):be=ne.def(ue,".",dc);var Ee;re?Ee=re.append(z,ne):Ee=ne.def(ue,".",hc);var ge=ue+".program("+Ee+","+be;return L.optional(function(){ge+=","+z.command}),ne.def(ge+")")}),{frag:Q,vert:re,progVar:q,program:U}}function rr(j,R){var Z=j.static,ie=j.dynamic;function se(){if(Ps in Z){var z=Z[Ps];pp(z)?z=le.getElements(le.create(z,!0)):z&&(z=le.getElements(z),L.command(z,"invalid elements",R.commandStr));var ne=Fr(function(be,Ee){if(z){var ge=be.link(z);return be.ELEMENTS=ge,ge}return be.ELEMENTS=null,null});return ne.value=z,ne}else if(Ps in ie){var ue=ie[Ps];return jn(ue,function(be,Ee){var ge=be.shared,Re=ge.isBufferArgs,lt=ge.elements,Dt=be.invoke(Ee,ue),st=Ee.def("null"),wt=Ee.def(Re,"(",Dt,")"),Lt=be.cond(wt).then(st,"=",lt,".createStream(",Dt,");").else(st,"=",lt,".getElements(",Dt,");");return L.optional(function(){be.assert(Lt.else,"!"+Dt+"||"+st,"invalid elements")}),Ee.entry(Lt),Ee.exit(be.cond(wt).then(lt,".destroyStream(",st,");")),be.ELEMENTS=st,st})}return null}var ee=se();function Q(){if(Rs in Z){var z=Z[Rs];return L.commandParameter(z,ju,"invalid primitve",R.commandStr),Fr(function(ue,be){return ju[z]})}else if(Rs in ie){var ne=ie[Rs];return jn(ne,function(ue,be){var Ee=ue.constants.primTypes,ge=ue.invoke(be,ne);return L.optional(function(){ue.assert(be,ge+" in "+Ee,"invalid primitive, must be one of "+Object.keys(ju))}),be.def(Ee,"[",ge,"]")})}else if(ee)return Fo(ee)?ee.value?Fr(function(ue,be){return be.def(ue.ELEMENTS,".primType")}):Fr(function(){return _D}):new Ln(ee.thisDep,ee.contextDep,ee.propDep,function(ue,be){var Ee=ue.ELEMENTS;return be.def(Ee,"?",Ee,".primType:",_D)});return null}function re(z,ne){if(z in Z){var ue=Z[z]|0;return L.command(!ne||ue>=0,"invalid "+z,R.commandStr),Fr(function(Ee,ge){return ne&&(Ee.OFFSET=ue),ue})}else if(z in ie){var be=ie[z];return jn(be,function(Ee,ge){var Re=Ee.invoke(ge,be);return ne&&(Ee.OFFSET=Re,L.optional(function(){Ee.assert(ge,Re+">=0","invalid "+z)})),Re})}else if(ne&&ee)return Fr(function(Ee,ge){return Ee.OFFSET="0",0});return null}var U=re(ip,!0);function q(){if(Bs in Z){var z=Z[Bs]|0;return L.command(typeof z=="number"&&z>=0,"invalid vertex count",R.commandStr),Fr(function(){return z})}else if(Bs in ie){var ne=ie[Bs];return jn(ne,function(Ee,ge){var Re=Ee.invoke(ge,ne);return L.optional(function(){Ee.assert(ge,"typeof "+Re+'==="number"&&'+Re+">=0&&"+Re+"===("+Re+"|0)","invalid vertex count")}),Re})}else if(ee)if(Fo(ee)){if(ee)return U?new Ln(U.thisDep,U.contextDep,U.propDep,function(Ee,ge){var Re=ge.def(Ee.ELEMENTS,".vertCount-",Ee.OFFSET);return L.optional(function(){Ee.assert(ge,Re+">=0","invalid vertex offset/element buffer too small")}),Re}):Fr(function(Ee,ge){return ge.def(Ee.ELEMENTS,".vertCount")});var ue=Fr(function(){return-1});return L.optional(function(){ue.MISSING=!0}),ue}else{var be=new Ln(ee.thisDep||U.thisDep,ee.contextDep||U.contextDep,ee.propDep||U.propDep,function(Ee,ge){var Re=Ee.ELEMENTS;return Ee.OFFSET?ge.def(Re,"?",Re,".vertCount-",Ee.OFFSET,":-1"):ge.def(Re,"?",Re,".vertCount:-1")});return L.optional(function(){be.DYNAMIC=!0}),be}return null}return{elements:ee,primitive:Q(),count:q(),instances:re(ap,!1),offset:U}}function Gr(j,R){var Z=j.static,ie=j.dynamic,se={};return Ae.forEach(function(ee){var Q=Xe(ee);function re(U,q){if(ee in Z){var z=U(Z[ee]);se[Q]=Fr(function(){return z})}else if(ee in ie){var ne=ie[ee];se[Q]=jn(ne,function(ue,be){return q(ue,be,ue.invoke(be,ne))})}}switch(ee){case cD:case aD:case iD:case gD:case sD:case mD:case dD:case vD:case pD:case lD:return re(function(U){return L.commandType(U,"boolean",ee,R.commandStr),U},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="boolean"',"invalid flag "+ee,U.commandStr)}),z});case uD:return re(function(U){return L.commandParameter(U,nf,"invalid "+ee,R.commandStr),nf[U]},function(U,q,z){var ne=U.constants.compareFuncs;return L.optional(function(){U.assert(q,z+" in "+ne,"invalid "+ee+", must be one of "+Object.keys(nf))}),q.def(ne,"[",z,"]")});case fD:return re(function(U){return L.command(Lr(U)&&U.length===2&&typeof U[0]=="number"&&typeof U[1]=="number"&&U[0]<=U[1],"depth range is 2d array",R.commandStr),U},function(U,q,z){L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===2&&typeof "+z+'[0]==="number"&&typeof '+z+'[1]==="number"&&'+z+"[0]<="+z+"[1]","depth range must be a 2d array")});var ne=q.def("+",z,"[0]"),ue=q.def("+",z,"[1]");return[ne,ue]});case db:return re(function(U){L.commandType(U,"object","blend.func",R.commandStr);var q="srcRGB"in U?U.srcRGB:U.src,z="srcAlpha"in U?U.srcAlpha:U.src,ne="dstRGB"in U?U.dstRGB:U.dst,ue="dstAlpha"in U?U.dstAlpha:U.dst;return L.commandParameter(q,xa,Q+".srcRGB",R.commandStr),L.commandParameter(z,xa,Q+".srcAlpha",R.commandStr),L.commandParameter(ne,xa,Q+".dstRGB",R.commandStr),L.commandParameter(ue,xa,Q+".dstAlpha",R.commandStr),L.command(ID.indexOf(q+", "+ne)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+q+", "+ne+")",R.commandStr),[xa[q],xa[ne],xa[z],xa[ue]]},function(U,q,z){var ne=U.constants.blendFuncs;L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid blend func, must be an object")});function ue(st,wt){var Lt=q.def('"',st,wt,'" in ',z,"?",z,".",st,wt,":",z,".",st);return L.optional(function(){U.assert(q,Lt+" in "+ne,"invalid "+ee+"."+st+wt+", must be one of "+Object.keys(xa))}),Lt}var be=ue("src","RGB"),Ee=ue("dst","RGB");L.optional(function(){var st=U.constants.invalidBlendCombinations;U.assert(q,st+".indexOf("+be+'+", "+'+Ee+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var ge=q.def(ne,"[",be,"]"),Re=q.def(ne,"[",ue("src","Alpha"),"]"),lt=q.def(ne,"[",Ee,"]"),Dt=q.def(ne,"[",ue("dst","Alpha"),"]");return[ge,lt,Re,Dt]});case hb:return re(function(U){if(typeof U=="string")return L.commandParameter(U,ve,"invalid "+ee,R.commandStr),[ve[U],ve[U]];if(typeof U=="object")return L.commandParameter(U.rgb,ve,ee+".rgb",R.commandStr),L.commandParameter(U.alpha,ve,ee+".alpha",R.commandStr),[ve[U.rgb],ve[U.alpha]];L.commandRaise("invalid blend.equation",R.commandStr)},function(U,q,z){var ne=U.constants.blendEquations,ue=q.def(),be=q.def(),Ee=U.cond("typeof ",z,'==="string"');return L.optional(function(){function ge(Re,lt,Dt){U.assert(Re,Dt+" in "+ne,"invalid "+lt+", must be one of "+Object.keys(ve))}ge(Ee.then,ee,z),U.assert(Ee.else,z+"&&typeof "+z+'==="object"',"invalid "+ee),ge(Ee.else,ee+".rgb",z+".rgb"),ge(Ee.else,ee+".alpha",z+".alpha")}),Ee.then(ue,"=",be,"=",ne,"[",z,"];"),Ee.else(ue,"=",ne,"[",z,".rgb];",be,"=",ne,"[",z,".alpha];"),q(Ee),[ue,be]});case oD:return re(function(U){return L.command(Lr(U)&&U.length===4,"blend.color must be a 4d array",R.commandStr),pn(4,function(q){return+U[q]})},function(U,q,z){return L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===4","blend.color must be a 4d array")}),pn(4,function(ne){return q.def("+",z,"[",ne,"]")})});case yD:return re(function(U){return L.commandType(U,"number",Q,R.commandStr),U|0},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="number"',"invalid stencil.mask")}),q.def(z,"|0")});case bb:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.cmp||"keep",z=U.ref||0,ne="mask"in U?U.mask:-1;return L.commandParameter(q,nf,ee+".cmp",R.commandStr),L.commandType(z,"number",ee+".ref",R.commandStr),L.commandType(ne,"number",ee+".mask",R.commandStr),[nf[q],z,ne]},function(U,q,z){var ne=U.constants.compareFuncs;L.optional(function(){function ge(){U.assert(q,Array.prototype.join.call(arguments,""),"invalid stencil.func")}ge(z+"&&typeof ",z,'==="object"'),ge('!("cmp" in ',z,")||(",z,".cmp in ",ne,")")});var ue=q.def('"cmp" in ',z,"?",ne,"[",z,".cmp]",":",Ro),be=q.def(z,".ref|0"),Ee=q.def('"mask" in ',z,"?",z,".mask|0:-1");return[ue,be,Ee]});case xb:case lc:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.fail||"keep",z=U.zfail||"keep",ne=U.zpass||"keep";return L.commandParameter(q,Bo,ee+".fail",R.commandStr),L.commandParameter(z,Bo,ee+".zfail",R.commandStr),L.commandParameter(ne,Bo,ee+".zpass",R.commandStr),[ee===lc?Fs:xc,Bo[q],Bo[z],Bo[ne]]},function(U,q,z){var ne=U.constants.stencilOps;L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid "+ee)});function ue(be){return L.optional(function(){U.assert(q,'!("'+be+'" in '+z+")||("+z+"."+be+" in "+ne+")","invalid "+ee+"."+be+", must be one of "+Object.keys(Bo))}),q.def('"',be,'" in ',z,"?",ne,"[",z,".",be,"]:",Ro)}return[ee===lc?Fs:xc,ue("fail"),ue("zfail"),ue("zpass")]});case yb:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.factor|0,z=U.units|0;return L.commandType(q,"number",Q+".factor",R.commandStr),L.commandType(z,"number",Q+".units",R.commandStr),[q,z]},function(U,q,z){L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid "+ee)});var ne=q.def(z,".factor|0"),ue=q.def(z,".units|0");return[ne,ue]});case hD:return re(function(U){var q=0;return U==="front"?q=xc:U==="back"&&(q=Fs),L.command(!!q,Q,R.commandStr),q},function(U,q,z){return L.optional(function(){U.assert(q,z+'==="front"||'+z+'==="back"',"invalid cull.face")}),q.def(z,'==="front"?',xc,":",Fs)});case gb:return re(function(U){return L.command(typeof U=="number"&&U>=ce.lineWidthDims[0]&&U<=ce.lineWidthDims[1],"invalid line width, must be a positive number between "+ce.lineWidthDims[0]+" and "+ce.lineWidthDims[1],R.commandStr),U},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="number"&&'+z+">="+ce.lineWidthDims[0]+"&&"+z+"<="+ce.lineWidthDims[1],"invalid line width")}),z});case pb:return re(function(U){return L.commandParameter(U,Ab,Q,R.commandStr),Ab[U]},function(U,q,z){return L.optional(function(){U.assert(q,z+'==="cw"||'+z+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),q.def(z+'==="cw"?'+SD+":"+Cb)});case vb:return re(function(U){return L.command(Lr(U)&&U.length===4,"color.mask must be length 4 array",R.commandStr),U.map(function(q){return!!q})},function(U,q,z){return L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===4","invalid color.mask")}),pn(4,function(ne){return"!!"+z+"["+ne+"]"})});case mb:return re(function(U){L.command(typeof U=="object"&&U,Q,R.commandStr);var q="value"in U?U.value:1,z=!!U.invert;return L.command(typeof q=="number"&&q>=0&&q<=1,"sample.coverage.value must be a number between 0 and 1",R.commandStr),[q,z]},function(U,q,z){L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid sample.coverage")});var ne=q.def('"value" in ',z,"?+",z,".value:1"),ue=q.def("!!",z,".invert");return[ne,ue]})}}),se}function Qr(j,R){var Z=j.static,ie=j.dynamic,se={};return Object.keys(Z).forEach(function(ee){var Q=Z[ee],re;if(typeof Q=="number"||typeof Q=="boolean")re=Fr(function(){return Q});else if(typeof Q=="function"){var U=Q._reglType;U==="texture2d"||U==="textureCube"?re=Fr(function(q){return q.link(Q)}):U==="framebuffer"||U==="framebufferCube"?(L.command(Q.color.length>0,'missing color attachment for framebuffer sent to uniform "'+ee+'"',R.commandStr),re=Fr(function(q){return q.link(Q.color[0])})):L.commandRaise('invalid data for uniform "'+ee+'"',R.commandStr)}else Lr(Q)?re=Fr(function(q){var z=q.global.def("[",pn(Q.length,function(ne){return L.command(typeof Q[ne]=="number"||typeof Q[ne]=="boolean","invalid uniform "+ee,q.commandStr),Q[ne]}),"]");return z}):L.commandRaise('invalid or missing data for uniform "'+ee+'"',R.commandStr);re.value=Q,se[ee]=re}),Object.keys(ie).forEach(function(ee){var Q=ie[ee];se[ee]=jn(Q,function(re,U){return re.invoke(U,Q)})}),se}function Xt(j,R){var Z=j.static,ie=j.dynamic,se={};return Object.keys(Z).forEach(function(ee){var Q=Z[ee],re=F.id(ee),U=new oe;if(pp(Q))U.state=Ju,U.buffer=we.getBuffer(we.create(Q,rf,!1,!0)),U.type=0;else{var q=we.getBuffer(Q);if(q)U.state=Ju,U.buffer=q,U.type=0;else if(L.command(typeof Q=="object"&&Q,"invalid data for attribute "+ee,R.commandStr),"constant"in Q){var z=Q.constant;U.buffer="null",U.state=sb,typeof z=="number"?U.x=z:(L.command(Lr(z)&&z.length>0&&z.length<=4,"invalid constant for attribute "+ee,R.commandStr),Qu.forEach(function(lt,Dt){Dt<z.length&&(U[lt]=z[Dt])}))}else{pp(Q.buffer)?q=we.getBuffer(we.create(Q.buffer,rf,!1,!0)):q=we.getBuffer(Q.buffer),L.command(!!q,'missing buffer for attribute "'+ee+'"',R.commandStr);var ne=Q.offset|0;L.command(ne>=0,'invalid offset for attribute "'+ee+'"',R.commandStr);var ue=Q.stride|0;L.command(ue>=0&&ue<256,'invalid stride for attribute "'+ee+'", must be integer betweeen [0, 255]',R.commandStr);var be=Q.size|0;L.command(!("size"in Q)||be>0&&be<=4,'invalid size for attribute "'+ee+'", must be 1,2,3,4',R.commandStr);var Ee=!!Q.normalized,ge=0;"type"in Q&&(L.commandParameter(Q.type,Is,"invalid type for attribute "+ee,R.commandStr),ge=Is[Q.type]);var Re=Q.divisor|0;"divisor"in Q&&(L.command(Re===0||Be,'cannot specify divisor for attribute "'+ee+'", instancing not supported',R.commandStr),L.command(Re>=0,'invalid divisor for attribute "'+ee+'"',R.commandStr)),L.optional(function(){var lt=R.commandStr,Dt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(Q).forEach(function(st){L.command(Dt.indexOf(st)>=0,'unknown parameter "'+st+'" for attribute pointer "'+ee+'" (valid parameters are '+Dt+")",lt)})}),U.buffer=q,U.state=Ju,U.size=be,U.normalized=Ee,U.type=ge||q.dtype,U.offset=ne,U.stride=ue,U.divisor=Re}}se[ee]=Fr(function(lt,Dt){var st=lt.attribCache;if(re in st)return st[re];var wt={isStream:!1};return Object.keys(U).forEach(function(Lt){wt[Lt]=U[Lt]}),U.buffer&&(wt.buffer=lt.link(U.buffer),wt.type=wt.type||wt.buffer+".dtype"),st[re]=wt,wt})}),Object.keys(ie).forEach(function(ee){var Q=ie[ee];function re(U,q){var z=U.invoke(q,Q),ne=U.shared,ue=U.constants,be=ne.isBufferArgs,Ee=ne.buffer;L.optional(function(){U.assert(q,z+"&&(typeof "+z+'==="object"||typeof '+z+'==="function")&&('+be+"("+z+")||"+Ee+".getBuffer("+z+")||"+Ee+".getBuffer("+z+".buffer)||"+be+"("+z+'.buffer)||("constant" in '+z+"&&(typeof "+z+'.constant==="number"||'+ne.isArrayLike+"("+z+".constant))))",'invalid dynamic attribute "'+ee+'"')});var ge={isStream:q.def(!1)},Re=new oe;Re.state=Ju,Object.keys(Re).forEach(function(wt){ge[wt]=q.def(""+Re[wt])});var lt=ge.buffer,Dt=ge.type;q("if(",be,"(",z,")){",ge.isStream,"=true;",lt,"=",Ee,".createStream(",rf,",",z,");",Dt,"=",lt,".dtype;","}else{",lt,"=",Ee,".getBuffer(",z,");","if(",lt,"){",Dt,"=",lt,".dtype;",'}else if("constant" in ',z,"){",ge.state,"=",sb,";","if(typeof "+z+'.constant === "number"){',ge[Qu[0]],"=",z,".constant;",Qu.slice(1).map(function(wt){return ge[wt]}).join("="),"=0;","}else{",Qu.map(function(wt,Lt){return ge[wt]+"="+z+".constant.length>"+Lt+"?"+z+".constant["+Lt+"]:0;"}).join(""),"}}else{","if(",be,"(",z,".buffer)){",lt,"=",Ee,".createStream(",rf,",",z,".buffer);","}else{",lt,"=",Ee,".getBuffer(",z,".buffer);","}",Dt,'="type" in ',z,"?",ue.glTypes,"[",z,".type]:",lt,".dtype;",ge.normalized,"=!!",z,".normalized;");function st(wt){q(ge[wt],"=",z,".",wt,"|0;")}return st("size"),st("offset"),st("stride"),st("divisor"),q("}}"),q.exit("if(",ge.isStream,"){",Ee,".destroyStream(",lt,");","}"),ge}se[ee]=jn(Q,re)}),se}function Xr(j,R){var Z=j.static,ie=j.dynamic;if(vc in Z){var se=Z[vc];return se!==null&&Fe.getVAO(se)===null&&(se=Fe.createVAO(se)),Fr(function(Q){return Q.link(Fe.getVAO(se))})}else if(vc in ie){var ee=ie[vc];return jn(ee,function(Q,re){var U=Q.invoke(re,ee);return re.def(Q.shared.vao+".getVAO("+U+")")})}return null}function mr(j){var R=j.static,Z=j.dynamic,ie={};return Object.keys(R).forEach(function(se){var ee=R[se];ie[se]=Fr(function(Q,re){return typeof ee=="number"||typeof ee=="boolean"?""+ee:Q.link(ee)})}),Object.keys(Z).forEach(function(se){var ee=Z[se];ie[se]=jn(ee,function(Q,re){return Q.invoke(re,ee)})}),ie}function zr(j,R,Z,ie,se){var ee=j.static,Q=j.dynamic;L.optional(function(){var st=[Ds,hc,dc,Ps,Rs,ip,Bs,ap,cc,vc].concat(Ae);function wt(Lt){Object.keys(Lt).forEach(function(nr){L.command(st.indexOf(nr)>=0,'unknown parameter "'+nr+'"',se.commandStr)})}wt(ee),wt(Q)});var re=kt(j,R),U=ot(j),q=Gt(j,U,se),z=rr(j,se),ne=Gr(j,se),ue=Bt(j,se,re);function be(st){var wt=q[st];wt&&(ne[st]=wt)}be(Za),be(Xe(np));var Ee=Object.keys(ne).length>0,ge={framebuffer:U,draw:z,shader:ue,state:ne,dirty:Ee,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(ge.profile=Nt(j),ge.uniforms=Qr(Z,se),ge.drawVAO=ge.scopeVAO=Xr(j),!ge.drawVAO&&ue.program&&!re&&V.angle_instanced_arrays){var Re=!0,lt=ue.program.attributes.map(function(st){var wt=R.static[st];return Re=Re&&!!wt,wt});if(Re&&lt.length>0){var Dt=Fe.getVAO(Fe.createVAO(lt));ge.drawVAO=new Ln(null,null,null,function(st,wt){return st.link(Dt)}),ge.useVAO=!0}}return re?ge.useVAO=!0:ge.attributes=Xt(R,se),ge.context=mr(ie),ge}function Yr(j,R,Z){var ie=j.shared,se=ie.context,ee=j.scope();Object.keys(Z).forEach(function(Q){R.save(se,"."+Q);var re=Z[Q],U=re.append(j,R);Array.isArray(U)?ee(se,".",Q,"=[",U.join(),"];"):ee(se,".",Q,"=",U,";")}),R(ee)}function Wr(j,R,Z,ie){var se=j.shared,ee=se.gl,Q=se.framebuffer,re;Ke&&(re=R.def(se.extensions,".webgl_draw_buffers"));var U=j.constants,q=U.drawBuffer,z=U.backBuffer,ne;Z?ne=Z.append(j,R):ne=R.def(Q,".next"),ie||R("if(",ne,"!==",Q,".cur){"),R("if(",ne,"){",ee,".bindFramebuffer(",TD,",",ne,".framebuffer);"),Ke&&R(re,".drawBuffersWEBGL(",q,"[",ne,".colorAttachments.length]);"),R("}else{",ee,".bindFramebuffer(",TD,",null);"),Ke&&R(re,".drawBuffersWEBGL(",z,");"),R("}",Q,".cur=",ne,";"),ie||R("}")}function sn(j,R,Z){var ie=j.shared,se=ie.gl,ee=j.current,Q=j.next,re=ie.current,U=ie.next,q=j.cond(re,".dirty");Ae.forEach(function(z){var ne=Xe(z);if(!(ne in Z.state)){var ue,be;if(ne in Q){ue=Q[ne],be=ee[ne];var Ee=pn(Me[ne].length,function(Re){return q.def(ue,"[",Re,"]")});q(j.cond(Ee.map(function(Re,lt){return Re+"!=="+be+"["+lt+"]"}).join("||")).then(se,".",Ce[ne],"(",Ee,");",Ee.map(function(Re,lt){return be+"["+lt+"]="+Re}).join(";"),";"))}else{ue=q.def(U,".",ne);var ge=j.cond(ue,"!==",re,".",ne);q(ge),ne in Ue?ge(j.cond(ue).then(se,".enable(",Ue[ne],");").else(se,".disable(",Ue[ne],");"),re,".",ne,"=",ue,";"):ge(se,".",Ce[ne],"(",ue,");",re,".",ne,"=",ue,";")}}}),Object.keys(Z.state).length===0&&q(re,".dirty=false;"),R(q)}function yn(j,R,Z,ie){var se=j.shared,ee=j.current,Q=se.current,re=se.gl;LD(Object.keys(Z)).forEach(function(U){var q=Z[U];if(!(ie&&!ie(q))){var z=q.append(j,R);if(Ue[U]){var ne=Ue[U];Fo(q)?z?R(re,".enable(",ne,");"):R(re,".disable(",ne,");"):R(j.cond(z).then(re,".enable(",ne,");").else(re,".disable(",ne,");")),R(Q,".",U,"=",z,";")}else if(Lr(z)){var ue=ee[U];R(re,".",Ce[U],"(",z,");",z.map(function(be,Ee){return ue+"["+Ee+"]="+be}).join(";"),";")}else R(re,".",Ce[U],"(",z,");",Q,".",U,"=",z,";")}})}function Nr(j,R){Be&&(j.instancing=R.def(j.shared.extensions,".angle_instanced_arrays"))}function Ot(j,R,Z,ie,se){var ee=j.shared,Q=j.stats,re=ee.current,U=ee.timer,q=Z.profile;function z(){return typeof performance>"u"?"Date.now()":"performance.now()"}var ne,ue;function be(st){ne=R.def(),st(ne,"=",z(),";"),typeof se=="string"?st(Q,".count+=",se,";"):st(Q,".count++;"),ke&&(ie?(ue=R.def(),st(ue,"=",U,".getNumPendingQueries();")):st(U,".beginQuery(",Q,");"))}function Ee(st){st(Q,".cpuTime+=",z(),"-",ne,";"),ke&&(ie?st(U,".pushScopeStats(",ue,",",U,".getNumPendingQueries(),",Q,");"):st(U,".endQuery();"))}function ge(st){var wt=R.def(re,".profile");R(re,".profile=",st,";"),R.exit(re,".profile=",wt,";")}var Re;if(q){if(Fo(q)){q.enable?(be(R),Ee(R.exit),ge("true")):ge("false");return}Re=q.append(j,R),ge(Re)}else Re=R.def(re,".profile");var lt=j.block();be(lt),R("if(",Re,"){",lt,"}");var Dt=j.block();Ee(Dt),R.exit("if(",Re,"){",Dt,"}")}function mn(j,R,Z,ie,se){var ee=j.shared;function Q(U){switch(U){case op:case fp:case hp:return 2;case sp:case lp:case dp:return 3;case up:case cp:case vp:return 4;default:return 1}}function re(U,q,z){var ne=ee.gl,ue=R.def(U,".location"),be=R.def(ee.attributes,"[",ue,"]"),Ee=z.state,ge=z.buffer,Re=[z.x,z.y,z.z,z.w],lt=["buffer","normalized","offset","stride"];function Dt(){R("if(!",be,".buffer){",ne,".enableVertexAttribArray(",ue,");}");var wt=z.type,Lt;if(z.size?Lt=R.def(z.size,"||",q):Lt=q,R("if(",be,".type!==",wt,"||",be,".size!==",Lt,"||",lt.map(function(Tr){return be+"."+Tr+"!=="+z[Tr]}).join("||"),"){",ne,".bindBuffer(",rf,",",ge,".buffer);",ne,".vertexAttribPointer(",[ue,Lt,wt,z.normalized,z.stride,z.offset],");",be,".type=",wt,";",be,".size=",Lt,";",lt.map(function(Tr){return be+"."+Tr+"="+z[Tr]+";"}).join(""),"}"),Be){var nr=z.divisor;R("if(",be,".divisor!==",nr,"){",j.instancing,".vertexAttribDivisorANGLE(",[ue,nr],");",be,".divisor=",nr,";}")}}function st(){R("if(",be,".buffer){",ne,".disableVertexAttribArray(",ue,");",be,".buffer=null;","}if(",Qu.map(function(wt,Lt){return be+"."+wt+"!=="+Re[Lt]}).join("||"),"){",ne,".vertexAttrib4f(",ue,",",Re,");",Qu.map(function(wt,Lt){return be+"."+wt+"="+Re[Lt]+";"}).join(""),"}")}Ee===Ju?Dt():Ee===sb?st():(R("if(",Ee,"===",Ju,"){"),Dt(),R("}else{"),st(),R("}"))}ie.forEach(function(U){var q=U.name,z=Z.attributes[q],ne;if(z){if(!se(z))return;ne=z.append(j,R)}else{if(!se(ND))return;var ue=j.scopeAttrib(q);L.optional(function(){j.assert(R,ue+".state","missing attribute "+q)}),ne={},Object.keys(new oe).forEach(function(be){ne[be]=R.def(ue,".",be)})}re(j.link(U),Q(U.info.type),ne)})}function sr(j,R,Z,ie,se){for(var ee=j.shared,Q=ee.gl,re,U=0;U<ie.length;++U){var q=ie[U],z=q.name,ne=q.info.type,ue=Z.uniforms[z],be=j.link(q),Ee=be+".location",ge;if(ue){if(!se(ue))continue;if(Fo(ue)){var Re=ue.value;if(L.command(Re!==null&&typeof Re<"u",'missing uniform "'+z+'"',j.commandStr),ne===mc||ne===bc){L.command(typeof Re=="function"&&(ne===mc&&(Re._reglType==="texture2d"||Re._reglType==="framebuffer")||ne===bc&&(Re._reglType==="textureCube"||Re._reglType==="framebufferCube")),"invalid texture for uniform "+z,j.commandStr);var lt=j.link(Re._texture||Re.color[0]._texture);R(Q,".uniform1i(",Ee,",",lt+".bind());"),R.exit(lt,".unbind();")}else if(ne===pc||ne===gc||ne===yc){L.optional(function(){L.command(Lr(Re),"invalid matrix for uniform "+z,j.commandStr),L.command(ne===pc&&Re.length===4||ne===gc&&Re.length===9||ne===yc&&Re.length===16,"invalid length for matrix uniform "+z,j.commandStr)});var Dt=j.global.def("new Float32Array(["+Array.prototype.slice.call(Re)+"])"),st=2;ne===gc?st=3:ne===yc&&(st=4),R(Q,".uniformMatrix",st,"fv(",Ee,",false,",Dt,");")}else{switch(ne){case _b:L.commandType(Re,"number","uniform "+z,j.commandStr),re="1f";break;case op:L.command(Lr(Re)&&Re.length===2,"uniform "+z,j.commandStr),re="2f";break;case sp:L.command(Lr(Re)&&Re.length===3,"uniform "+z,j.commandStr),re="3f";break;case up:L.command(Lr(Re)&&Re.length===4,"uniform "+z,j.commandStr),re="4f";break;case Mb:L.commandType(Re,"boolean","uniform "+z,j.commandStr),re="1i";break;case Sb:L.commandType(Re,"number","uniform "+z,j.commandStr),re="1i";break;case hp:L.command(Lr(Re)&&Re.length===2,"uniform "+z,j.commandStr),re="2i";break;case fp:L.command(Lr(Re)&&Re.length===2,"uniform "+z,j.commandStr),re="2i";break;case dp:L.command(Lr(Re)&&Re.length===3,"uniform "+z,j.commandStr),re="3i";break;case lp:L.command(Lr(Re)&&Re.length===3,"uniform "+z,j.commandStr),re="3i";break;case vp:L.command(Lr(Re)&&Re.length===4,"uniform "+z,j.commandStr),re="4i";break;case cp:L.command(Lr(Re)&&Re.length===4,"uniform "+z,j.commandStr),re="4i";break}R(Q,".uniform",re,"(",Ee,",",Lr(Re)?Array.prototype.slice.call(Re):Re,");")}continue}else ge=ue.append(j,R)}else{if(!se(ND))continue;ge=R.def(ee.uniforms,"[",F.id(z),"]")}ne===mc?(L(!Array.isArray(ge),"must specify a scalar prop for textures"),R("if(",ge,"&&",ge,'._reglType==="framebuffer"){',ge,"=",ge,".color[0];","}")):ne===bc&&(L(!Array.isArray(ge),"must specify a scalar prop for cube maps"),R("if(",ge,"&&",ge,'._reglType==="framebufferCube"){',ge,"=",ge,".color[0];","}")),L.optional(function(){function Nn($i,GD){j.assert(R,$i,'bad data or missing for uniform "'+z+'".  '+GD)}function Tb($i){L(!Array.isArray(ge),"must not specify an array type for uniform"),Nn("typeof "+ge+'==="'+$i+'"',"invalid type, expected "+$i)}function mi($i,GD){Array.isArray(ge)?L(ge.length===$i,"must have length "+$i):Nn(ee.isArrayLike+"("+ge+")&&"+ge+".length==="+$i,"invalid vector, should have length "+$i,j.commandStr)}function FD($i){L(!Array.isArray(ge),"must not specify a value type"),Nn("typeof "+ge+'==="function"&&'+ge+'._reglType==="texture'+($i===ED?"2d":"Cube")+'"',"invalid texture type",j.commandStr)}switch(ne){case Sb:Tb("number");break;case fp:mi(2);break;case lp:mi(3);break;case cp:mi(4);break;case _b:Tb("number");break;case op:mi(2);break;case sp:mi(3);break;case up:mi(4);break;case Mb:Tb("boolean");break;case hp:mi(2);break;case dp:mi(3);break;case vp:mi(4);break;case pc:mi(4);break;case gc:mi(9);break;case yc:mi(16);break;case mc:FD(ED);break;case bc:FD(bde);break}});var wt=1;switch(ne){case mc:case bc:var Lt=R.def(ge,"._texture");R(Q,".uniform1i(",Ee,",",Lt,".bind());"),R.exit(Lt,".unbind();");continue;case Sb:case Mb:re="1i";break;case fp:case hp:re="2i",wt=2;break;case lp:case dp:re="3i",wt=3;break;case cp:case vp:re="4i",wt=4;break;case _b:re="1f";break;case op:re="2f",wt=2;break;case sp:re="3f",wt=3;break;case up:re="4f",wt=4;break;case pc:re="Matrix2fv";break;case gc:re="Matrix3fv";break;case yc:re="Matrix4fv";break}if(R(Q,".uniform",re,"(",Ee,","),re.charAt(0)==="M"){var nr=Math.pow(ne-pc+2,2),Tr=j.global.def("new Float32Array(",nr,")");Array.isArray(ge)?R("false,(",pn(nr,function(Nn){return Tr+"["+Nn+"]="+ge[Nn]}),",",Tr,")"):R("false,(Array.isArray(",ge,")||",ge," instanceof Float32Array)?",ge,":(",pn(nr,function(Nn){return Tr+"["+Nn+"]="+ge+"["+Nn+"]"}),",",Tr,")")}else wt>1?R(pn(wt,function(Nn){return Array.isArray(ge)?ge[Nn]:ge+"["+Nn+"]"})):(L(!Array.isArray(ge),"uniform value must not be an array"),R(ge));R(");")}}function mt(j,R,Z,ie){var se=j.shared,ee=se.gl,Q=se.draw,re=ie.draw;function U(){var Lt=re.elements,nr,Tr=R;return Lt?((Lt.contextDep&&ie.contextDynamic||Lt.propDep)&&(Tr=Z),nr=Lt.append(j,Tr)):nr=Tr.def(Q,".",Ps),nr&&Tr("if("+nr+")"+ee+".bindBuffer("+gde+","+nr+".buffer.buffer);"),nr}function q(){var Lt=re.count,nr,Tr=R;return Lt?((Lt.contextDep&&ie.contextDynamic||Lt.propDep)&&(Tr=Z),nr=Lt.append(j,Tr),L.optional(function(){Lt.MISSING&&j.assert(R,"false","missing vertex count"),Lt.DYNAMIC&&j.assert(Tr,nr+">=0","missing vertex count")})):(nr=Tr.def(Q,".",Bs),L.optional(function(){j.assert(Tr,nr+">=0","missing vertex count")})),nr}var z=U();function ne(Lt){var nr=re[Lt];return nr?nr.contextDep&&ie.contextDynamic||nr.propDep?nr.append(j,Z):nr.append(j,R):R.def(Q,".",Lt)}var ue=ne(Rs),be=ne(ip),Ee=q();if(typeof Ee=="number"){if(Ee===0)return}else Z("if(",Ee,"){"),Z.exit("}");var ge,Re;Be&&(ge=ne(ap),Re=j.instancing);var lt=z+".type",Dt=re.elements&&Fo(re.elements);function st(){function Lt(){Z(Re,".drawElementsInstancedANGLE(",[ue,Ee,lt,be+"<<(("+lt+"-"+tD+")>>1)",ge],");")}function nr(){Z(Re,".drawArraysInstancedANGLE(",[ue,be,Ee,ge],");")}z?Dt?Lt():(Z("if(",z,"){"),Lt(),Z("}else{"),nr(),Z("}")):nr()}function wt(){function Lt(){Z(ee+".drawElements("+[ue,Ee,lt,be+"<<(("+lt+"-"+tD+")>>1)"]+");")}function nr(){Z(ee+".drawArrays("+[ue,be,Ee]+");")}z?Dt?Lt():(Z("if(",z,"){"),Lt(),Z("}else{"),nr(),Z("}")):nr()}Be&&(typeof ge!="number"||ge>=0)?typeof ge=="string"?(Z("if(",ge,">0){"),st(),Z("}else if(",ge,"<0){"),wt(),Z("}")):st():wt()}function $t(j,R,Z,ie,se){var ee=Ct(),Q=ee.proc("body",se);return L.optional(function(){ee.commandStr=R.commandStr,ee.command=ee.link(R.commandStr)}),Be&&(ee.instancing=Q.def(ee.shared.extensions,".angle_instanced_arrays")),j(ee,Q,Z,ie),ee.compile().body}function Qt(j,R,Z,ie){Nr(j,R),Z.useVAO?Z.drawVAO?R(j.shared.vao,".setVAO(",Z.drawVAO.append(j,R),");"):R(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(R(j.shared.vao,".setVAO(null);"),mn(j,R,Z,ie.attributes,function(){return!0})),sr(j,R,Z,ie.uniforms,function(){return!0}),mt(j,R,R,Z)}function Or(j,R){var Z=j.proc("draw",1);Nr(j,Z),Yr(j,Z,R.context),Wr(j,Z,R.framebuffer),sn(j,Z,R),yn(j,Z,R.state),Ot(j,Z,R,!1,!0);var ie=R.shader.progVar.append(j,Z);if(Z(j.shared.gl,".useProgram(",ie,".program);"),R.shader.program)Qt(j,Z,R,R.shader.program);else{Z(j.shared.vao,".setVAO(null);");var se=j.global.def("{}"),ee=Z.def(ie,".id"),Q=Z.def(se,"[",ee,"]");Z(j.cond(Q).then(Q,".call(this,a0);").else(Q,"=",se,"[",ee,"]=",j.link(function(re){return $t(Qt,j,R,re,1)}),"(",ie,");",Q,".call(this,a0);"))}Object.keys(R.state).length>0&&Z(j.shared.current,".dirty=true;")}function wa(j,R,Z,ie){j.batchId="a1",Nr(j,R);function se(){return!0}mn(j,R,Z,ie.attributes,se),sr(j,R,Z,ie.uniforms,se),mt(j,R,R,Z)}function Gs(j,R,Z,ie){Nr(j,R);var se=Z.contextDep,ee=R.def(),Q="a0",re="a1",U=R.def();j.shared.props=U,j.batchId=ee;var q=j.scope(),z=j.scope();R(q.entry,"for(",ee,"=0;",ee,"<",re,";++",ee,"){",U,"=",Q,"[",ee,"];",z,"}",q.exit);function ne(lt){return lt.contextDep&&se||lt.propDep}function ue(lt){return!ne(lt)}if(Z.needsContext&&Yr(j,z,Z.context),Z.needsFramebuffer&&Wr(j,z,Z.framebuffer),yn(j,z,Z.state,ne),Z.profile&&ne(Z.profile)&&Ot(j,z,Z,!1,!0),ie)Z.useVAO?Z.drawVAO?ne(Z.drawVAO)?z(j.shared.vao,".setVAO(",Z.drawVAO.append(j,z),");"):q(j.shared.vao,".setVAO(",Z.drawVAO.append(j,q),");"):q(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(q(j.shared.vao,".setVAO(null);"),mn(j,q,Z,ie.attributes,ue),mn(j,z,Z,ie.attributes,ne)),sr(j,q,Z,ie.uniforms,ue),sr(j,z,Z,ie.uniforms,ne),mt(j,q,z,Z);else{var be=j.global.def("{}"),Ee=Z.shader.progVar.append(j,z),ge=z.def(Ee,".id"),Re=z.def(be,"[",ge,"]");z(j.shared.gl,".useProgram(",Ee,".program);","if(!",Re,"){",Re,"=",be,"[",ge,"]=",j.link(function(lt){return $t(wa,j,Z,lt,2)}),"(",Ee,");}",Re,".call(this,a0[",ee,"],",ee,");")}}function X(j,R){var Z=j.proc("batch",2);j.batchId="0",Nr(j,Z);var ie=!1,se=!0;Object.keys(R.context).forEach(function(be){ie=ie||R.context[be].propDep}),ie||(Yr(j,Z,R.context),se=!1);var ee=R.framebuffer,Q=!1;ee?(ee.propDep?ie=Q=!0:ee.contextDep&&ie&&(Q=!0),Q||Wr(j,Z,ee)):Wr(j,Z,null),R.state.viewport&&R.state.viewport.propDep&&(ie=!0);function re(be){return be.contextDep&&ie||be.propDep}sn(j,Z,R),yn(j,Z,R.state,function(be){return!re(be)}),(!R.profile||!re(R.profile))&&Ot(j,Z,R,!1,"a1"),R.contextDep=ie,R.needsContext=se,R.needsFramebuffer=Q;var U=R.shader.progVar;if(U.contextDep&&ie||U.propDep)Gs(j,Z,R,null);else{var q=U.append(j,Z);if(Z(j.shared.gl,".useProgram(",q,".program);"),R.shader.program)Gs(j,Z,R,R.shader.program);else{Z(j.shared.vao,".setVAO(null);");var z=j.global.def("{}"),ne=Z.def(q,".id"),ue=Z.def(z,"[",ne,"]");Z(j.cond(ue).then(ue,".call(this,a0,a1);").else(ue,"=",z,"[",ne,"]=",j.link(function(be){return $t(Gs,j,R,be,2)}),"(",q,");",ue,".call(this,a0,a1);"))}}Object.keys(R.state).length>0&&Z(j.shared.current,".dirty=true;")}function he(j,R){var Z=j.proc("scope",3);j.batchId="a2";var ie=j.shared,se=ie.current;Yr(j,Z,R.context),R.framebuffer&&R.framebuffer.append(j,Z),LD(Object.keys(R.state)).forEach(function(Q){var re=R.state[Q],U=re.append(j,Z);Lr(U)?U.forEach(function(q,z){Z.set(j.next[Q],"["+z+"]",q)}):Z.set(ie.next,"."+Q,U)}),Ot(j,Z,R,!0,!0),[Ps,ip,Bs,ap,Rs].forEach(function(Q){var re=R.draw[Q];re&&Z.set(ie.draw,"."+Q,""+re.append(j,Z))}),Object.keys(R.uniforms).forEach(function(Q){var re=R.uniforms[Q].append(j,Z);Array.isArray(re)&&(re="["+re.join()+"]"),Z.set(ie.uniforms,"["+F.id(Q)+"]",re)}),Object.keys(R.attributes).forEach(function(Q){var re=R.attributes[Q].append(j,Z),U=j.scopeAttrib(Q);Object.keys(new oe).forEach(function(q){Z.set(U,"."+q,re[q])})}),R.scopeVAO&&Z.set(ie.vao,".targetVAO",R.scopeVAO.append(j,Z));function ee(Q){var re=R.shader[Q];re&&Z.set(ie.shader,"."+Q,re.append(j,Z))}ee(hc),ee(dc),Object.keys(R.state).length>0&&(Z(se,".dirty=true;"),Z.exit(se,".dirty=true;")),Z("a1(",j.shared.context,",a0,",j.batchId,");")}function fe(j){if(!(typeof j!="object"||Lr(j))){for(var R=Object.keys(j),Z=0;Z<R.length;++Z)if(hr.isDynamic(j[R[Z]]))return!0;return!1}}function it(j,R,Z){var ie=R.static[Z];if(!ie||!fe(ie))return;var se=j.global,ee=Object.keys(ie),Q=!1,re=!1,U=!1,q=j.global.def("{}");ee.forEach(function(ne){var ue=ie[ne];if(hr.isDynamic(ue)){typeof ue=="function"&&(ue=ie[ne]=hr.unbox(ue));var be=jn(ue,null);Q=Q||be.thisDep,U=U||be.propDep,re=re||be.contextDep}else{switch(se(q,".",ne,"="),typeof ue){case"number":se(ue);break;case"string":se('"',ue,'"');break;case"object":Array.isArray(ue)&&se("[",ue.join(),"]");break;default:se(j.link(ue));break}se(";")}});function z(ne,ue){ee.forEach(function(be){var Ee=ie[be];if(hr.isDynamic(Ee)){var ge=ne.invoke(ue,Ee);ue(q,".",be,"=",ge,";")}})}R.dynamic[Z]=new hr.DynamicVariable(rp,{thisDep:Q,contextDep:re,propDep:U,ref:q,append:z}),delete R.static[Z]}function zt(j,R,Z,ie,se){var ee=Ct();ee.stats=ee.link(se),Object.keys(R.static).forEach(function(re){it(ee,R,re)}),pde.forEach(function(re){it(ee,j,re)});var Q=zr(j,R,Z,ie,ee);return Or(ee,Q),he(ee,Q),X(ee,Q),n(ee.compile(),{destroy:function(){Q.shader.program.destroy()}})}return{next:rt,current:Me,procs:function(){var j=Ct(),R=j.proc("poll"),Z=j.proc("refresh"),ie=j.block();R(ie),Z(ie);var se=j.shared,ee=se.gl,Q=se.next,re=se.current;ie(re,".dirty=false;"),Wr(j,R),Wr(j,Z,null,!0);var U;Be&&(U=j.link(Be)),V.oes_vertex_array_object&&Z(j.link(V.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var q=0;q<ce.maxAttributes;++q){var z=Z.def(se.attributes,"[",q,"]"),ne=j.cond(z,".buffer");ne.then(ee,".enableVertexAttribArray(",q,");",ee,".bindBuffer(",rf,",",z,".buffer.buffer);",ee,".vertexAttribPointer(",q,",",z,".size,",z,".type,",z,".normalized,",z,".stride,",z,".offset);").else(ee,".disableVertexAttribArray(",q,");",ee,".vertexAttrib4f(",q,",",z,".x,",z,".y,",z,".z,",z,".w);",z,".buffer=null;"),Z(ne),Be&&Z(U,".vertexAttribDivisorANGLE(",q,",",z,".divisor);")}return Z(j.shared.vao,".currentVAO=null;",j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"),Object.keys(Ue).forEach(function(ue){var be=Ue[ue],Ee=ie.def(Q,".",ue),ge=j.block();ge("if(",Ee,"){",ee,".enable(",be,")}else{",ee,".disable(",be,")}",re,".",ue,"=",Ee,";"),Z(ge),R("if(",Ee,"!==",re,".",ue,"){",ge,"}")}),Object.keys(Ce).forEach(function(ue){var be=Ce[ue],Ee=Me[ue],ge,Re,lt=j.block();if(lt(ee,".",be,"("),Lr(Ee)){var Dt=Ee.length;ge=j.global.def(Q,".",ue),Re=j.global.def(re,".",ue),lt(pn(Dt,function(st){return ge+"["+st+"]"}),");",pn(Dt,function(st){return Re+"["+st+"]="+ge+"["+st+"];"}).join("")),R("if(",pn(Dt,function(st){return ge+"["+st+"]!=="+Re+"["+st+"]"}).join("||"),"){",lt,"}")}else ge=ie.def(Q,".",ue),Re=ie.def(re,".",ue),lt(ge,");",re,".",ue,"=",ge,";"),R("if(",ge,"!==",Re,"){",lt,"}");Z(lt)}),j.compile()}(),compile:zt}}function Pde(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var Rde=34918,Bde=34919,OD=35007,Fde=function(I,F){if(!F.ext_disjoint_timer_query)return null;var V=[];function ce(){return V.pop()||F.ext_disjoint_timer_query.createQueryEXT()}function we(Be){V.push(Be)}var le=[];function de(Be){var Ke=ce();F.ext_disjoint_timer_query.beginQueryEXT(OD,Ke),le.push(Ke),ke(le.length-1,le.length,Be)}function Ie(){F.ext_disjoint_timer_query.endQueryEXT(OD)}function Oe(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var Fe=[];function De(){return Fe.pop()||new Oe}function $e(Be){Fe.push(Be)}var Ve=[];function ke(Be,Ke,Me){var rt=De();rt.startQueryIndex=Be,rt.endQueryIndex=Ke,rt.sum=0,rt.stats=Me,Ve.push(rt)}var je=[],oe=[];function ve(){var Be,Ke,Me=le.length;if(Me!==0){oe.length=Math.max(oe.length,Me+1),je.length=Math.max(je.length,Me+1),je[0]=0,oe[0]=0;var rt=0;for(Be=0,Ke=0;Ke<le.length;++Ke){var Ae=le[Ke];F.ext_disjoint_timer_query.getQueryObjectEXT(Ae,Bde)?(rt+=F.ext_disjoint_timer_query.getQueryObjectEXT(Ae,Rde),we(Ae)):le[Be++]=Ae,je[Ke+1]=rt,oe[Ke+1]=Be}for(le.length=Be,Be=0,Ke=0;Ke<Ve.length;++Ke){var Ue=Ve[Ke],Ce=Ue.startQueryIndex,Xe=Ue.endQueryIndex;Ue.sum+=je[Xe]-je[Ce];var pt=oe[Ce],Tt=oe[Xe];Tt===pt?(Ue.stats.gpuTime+=Ue.sum/1e6,$e(Ue)):(Ue.startQueryIndex=pt,Ue.endQueryIndex=Tt,Ve[Be++]=Ue)}Ve.length=Be}}return{beginQuery:de,endQuery:Ie,pushScopeStats:ke,update:ve,getNumPendingQueries:function(){return le.length},clear:function(){V.push.apply(V,le);for(var Be=0;Be<V.length;Be++)F.ext_disjoint_timer_query.deleteQueryEXT(V[Be]);le.length=0,V.length=0},restore:function(){le.length=0,V.length=0}}},Gde=16384,zde=256,$de=1024,jde=34962,DD="webglcontextlost",PD="webglcontextrestored",RD=1,Ude=2,Xde=3;function BD(I,F){for(var V=0;V<I.length;++V)if(I[V]===F)return V;return-1}function Yde(I){var F=Jl(I);if(!F)return null;var V=F.gl,ce=V.getContextAttributes(),we=V.isContextLost(),le=ec(V,F);if(!le)return null;var de=vr(),Ie=Pde(),Oe=le.extensions,Fe=Fde(V,Oe),De=xr(),$e=V.drawingBufferWidth,Ve=V.drawingBufferHeight,ke={tick:0,time:0,viewportWidth:$e,viewportHeight:Ve,framebufferWidth:$e,framebufferHeight:Ve,drawingBufferWidth:$e,drawingBufferHeight:Ve,pixelRatio:F.pixelRatio},je={},oe={elements:null,primitive:4,count:-1,offset:0,instances:-1},ve=kce(V,Oe),Be=Wce(V,Ie,F,Me),Ke=ide(V,Oe,ve,Ie,Be);function Me(mt){return Ke.destroyBuffer(mt)}var rt=ihe(V,Oe,Be,Ie),Ae=ude(V,de,Ie,F),Ue=Phe(V,Oe,ve,function(){pt.procs.poll()},ke,Ie,F),Ce=Rhe(V,Oe,ve,Ie,F),Xe=rde(V,Oe,ve,Ue,Ce,Ie),pt=Dde(V,de,Oe,ve,Be,rt,Ue,Xe,je,Ke,Ae,oe,ke,Fe,F),Tt=cde(V,Xe,pt.procs.poll,ke,ce,Oe,ve),He=pt.next,ze=V.canvas,_e=[],Ct=[],Nt=[],ot=[F.onDestroy],Gt=null;function kt(){if(_e.length===0){Fe&&Fe.update(),Gt=null;return}Gt=ur.next(kt),yn();for(var mt=_e.length-1;mt>=0;--mt){var $t=_e[mt];$t&&$t(ke,null,0)}V.flush(),Fe&&Fe.update()}function Bt(){!Gt&&_e.length>0&&(Gt=ur.next(kt))}function rr(){Gt&&(ur.cancel(kt),Gt=null)}function Gr(mt){mt.preventDefault(),we=!0,rr(),Ct.forEach(function($t){$t()})}function Qr(mt){V.getError(),we=!1,le.restore(),Ae.restore(),Be.restore(),Ue.restore(),Ce.restore(),Xe.restore(),Ke.restore(),Fe&&Fe.restore(),pt.procs.refresh(),Bt(),Nt.forEach(function($t){$t()})}ze&&(ze.addEventListener(DD,Gr,!1),ze.addEventListener(PD,Qr,!1));function Xt(){_e.length=0,rr(),ze&&(ze.removeEventListener(DD,Gr),ze.removeEventListener(PD,Qr)),Ae.clear(),Xe.clear(),Ce.clear(),Ue.clear(),rt.clear(),Be.clear(),Ke.clear(),Fe&&Fe.clear(),ot.forEach(function(mt){mt()})}function Xr(mt){L(!!mt,"invalid args to regl({...})"),L.type(mt,"object","invalid args to regl({...})");function $t(se){var ee=n({},se);delete ee.uniforms,delete ee.attributes,delete ee.context,delete ee.vao,"stencil"in ee&&ee.stencil.op&&(ee.stencil.opBack=ee.stencil.opFront=ee.stencil.op,delete ee.stencil.op);function Q(re){if(re in ee){var U=ee[re];delete ee[re],Object.keys(U).forEach(function(q){ee[re+"."+q]=U[q]})}}return Q("blend"),Q("depth"),Q("cull"),Q("stencil"),Q("polygonOffset"),Q("scissor"),Q("sample"),"vao"in se&&(ee.vao=se.vao),ee}function Qt(se,ee){var Q={},re={};return Object.keys(se).forEach(function(U){var q=se[U];if(hr.isDynamic(q)){re[U]=hr.unbox(q,U);return}else if(ee&&Array.isArray(q)){for(var z=0;z<q.length;++z)if(hr.isDynamic(q[z])){re[U]=hr.unbox(q,U);return}}Q[U]=q}),{dynamic:re,static:Q}}var Or=Qt(mt.context||{},!0),wa=Qt(mt.uniforms||{},!0),Gs=Qt(mt.attributes||{},!1),X=Qt($t(mt),!1),he={gpuTime:0,cpuTime:0,count:0},fe=pt.compile(X,Gs,wa,Or,he),it=fe.draw,zt=fe.batch,j=fe.scope,R=[];function Z(se){for(;R.length<se;)R.push(null);return R}function ie(se,ee){var Q;if(we&&L.raise("context lost"),typeof se=="function")return j.call(this,null,se,0);if(typeof ee=="function")if(typeof se=="number")for(Q=0;Q<se;++Q)j.call(this,null,ee,Q);else if(Array.isArray(se))for(Q=0;Q<se.length;++Q)j.call(this,se[Q],ee,Q);else return j.call(this,se,ee,0);else if(typeof se=="number"){if(se>0)return zt.call(this,Z(se|0),se|0)}else if(Array.isArray(se)){if(se.length)return zt.call(this,se,se.length)}else return it.call(this,se)}return n(ie,{stats:he,destroy:function(){fe.destroy()}})}var mr=Xe.setFBO=Xr({framebuffer:hr.define.call(null,RD,"framebuffer")});function zr(mt,$t){var Qt=0;pt.procs.poll();var Or=$t.color;Or&&(V.clearColor(+Or[0]||0,+Or[1]||0,+Or[2]||0,+Or[3]||0),Qt|=Gde),"depth"in $t&&(V.clearDepth(+$t.depth),Qt|=zde),"stencil"in $t&&(V.clearStencil($t.stencil|0),Qt|=$de),L(!!Qt,"called regl.clear with no buffer specified"),V.clear(Qt)}function Yr(mt){if(L(typeof mt=="object"&&mt,"regl.clear() takes an object as input"),"framebuffer"in mt)if(mt.framebuffer&&mt.framebuffer_reglType==="framebufferCube")for(var $t=0;$t<6;++$t)mr(n({framebuffer:mt.framebuffer.faces[$t]},mt),zr);else mr(mt,zr);else zr(null,mt)}function Wr(mt){L.type(mt,"function","regl.frame() callback must be a function"),_e.push(mt);function $t(){var Qt=BD(_e,mt);L(Qt>=0,"cannot cancel a frame twice");function Or(){var wa=BD(_e,Or);_e[wa]=_e[_e.length-1],_e.length-=1,_e.length<=0&&rr()}_e[Qt]=Or}return Bt(),{cancel:$t}}function sn(){var mt=He.viewport,$t=He.scissor_box;mt[0]=mt[1]=$t[0]=$t[1]=0,ke.viewportWidth=ke.framebufferWidth=ke.drawingBufferWidth=mt[2]=$t[2]=V.drawingBufferWidth,ke.viewportHeight=ke.framebufferHeight=ke.drawingBufferHeight=mt[3]=$t[3]=V.drawingBufferHeight}function yn(){ke.tick+=1,ke.time=Ot(),sn(),pt.procs.poll()}function Nr(){Ue.refresh(),sn(),pt.procs.refresh(),Fe&&Fe.update()}function Ot(){return(xr()-De)/1e3}Nr();function mn(mt,$t){L.type($t,"function","listener callback must be a function");var Qt;switch(mt){case"frame":return Wr($t);case"lost":Qt=Ct;break;case"restore":Qt=Nt;break;case"destroy":Qt=ot;break;default:L.raise("invalid event, must be one of frame,lost,restore,destroy")}return Qt.push($t),{cancel:function(){for(var Or=0;Or<Qt.length;++Or)if(Qt[Or]===$t){Qt[Or]=Qt[Qt.length-1],Qt.pop();return}}}}var sr=n(Xr,{clear:Yr,prop:hr.define.bind(null,RD),context:hr.define.bind(null,Ude),this:hr.define.bind(null,Xde),draw:Xr({}),buffer:function(mt){return Be.create(mt,jde,!1,!1)},elements:function(mt){return rt.create(mt,!1)},texture:Ue.create2D,cube:Ue.createCube,renderbuffer:Ce.create,framebuffer:Xe.create,framebufferCube:Xe.createCube,vao:Ke.createVAO,attributes:ce,frame:Wr,on:mn,limits:ve,hasExtension:function(mt){return ve.extensions.indexOf(mt.toLowerCase())>=0},read:Tt,destroy:Xt,_gl:V,_refresh:Nr,poll:function(){yn(),Fe&&Fe.update()},now:Ot,stats:Ie});return F.onDone(null,sr),sr}return Yde})})(Ik);var lie=Ik.exports;const cie=Ji(lie);var hie=function(){function r(e,t){Oi(this,r),this.attribute=void 0,this.buffer=void 0;var n=t.buffer,i=t.offset,a=t.stride,o=t.normalized,s=t.size,u=t.divisor;this.buffer=n,this.attribute={buffer:n.get(),offset:i||0,stride:a||0,normalized:o||!1,divisor:u||0},s&&(this.attribute.size=s)}return Di(r,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),r}(),Fa,Il,Ga,vi,kl,So,Ll,vv,fa,gs,wn,la,ca,pv,die=(Fa={},Je(Fa,Le.POINTS,"points"),Je(Fa,Le.LINES,"lines"),Je(Fa,Le.LINE_LOOP,"line loop"),Je(Fa,Le.LINE_STRIP,"line strip"),Je(Fa,Le.TRIANGLES,"triangles"),Je(Fa,Le.TRIANGLE_FAN,"triangle fan"),Je(Fa,Le.TRIANGLE_STRIP,"triangle strip"),Fa),kk=(Il={},Je(Il,Le.STATIC_DRAW,"static"),Je(Il,Le.DYNAMIC_DRAW,"dynamic"),Je(Il,Le.STREAM_DRAW,"stream"),Il),$m=(Ga={},Je(Ga,Le.BYTE,"int8"),Je(Ga,Le.UNSIGNED_INT,"int16"),Je(Ga,Le.INT,"int32"),Je(Ga,Le.UNSIGNED_BYTE,"uint8"),Je(Ga,Le.UNSIGNED_SHORT,"uint16"),Je(Ga,Le.UNSIGNED_INT,"uint32"),Je(Ga,Le.FLOAT,"float"),Ga),vie=(vi={},Je(vi,Le.ALPHA,"alpha"),Je(vi,Le.LUMINANCE,"luminance"),Je(vi,Le.LUMINANCE_ALPHA,"luminance alpha"),Je(vi,Le.RGB,"rgb"),Je(vi,Le.RGBA,"rgba"),Je(vi,Le.RGBA4,"rgba4"),Je(vi,Le.RGB5_A1,"rgb5 a1"),Je(vi,Le.RGB565,"rgb565"),Je(vi,Le.DEPTH_COMPONENT,"depth"),Je(vi,Le.DEPTH_STENCIL,"depth stencil"),vi),pie=(kl={},Je(kl,Le.DONT_CARE,"dont care"),Je(kl,Le.NICEST,"nice"),Je(kl,Le.FASTEST,"fast"),kl),Lk=(So={},Je(So,Le.NEAREST,"nearest"),Je(So,Le.LINEAR,"linear"),Je(So,Le.LINEAR_MIPMAP_LINEAR,"mipmap"),Je(So,Le.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Je(So,Le.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Je(So,Le.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),So),Nk=(Ll={},Je(Ll,Le.REPEAT,"repeat"),Je(Ll,Le.CLAMP_TO_EDGE,"clamp"),Je(Ll,Le.MIRRORED_REPEAT,"mirror"),Ll),gie=(vv={},Je(vv,Le.NONE,"none"),Je(vv,Le.BROWSER_DEFAULT_WEBGL,"browser"),vv),yie=(fa={},Je(fa,Le.NEVER,"never"),Je(fa,Le.ALWAYS,"always"),Je(fa,Le.LESS,"less"),Je(fa,Le.LEQUAL,"lequal"),Je(fa,Le.GREATER,"greater"),Je(fa,Le.GEQUAL,"gequal"),Je(fa,Le.EQUAL,"equal"),Je(fa,Le.NOTEQUAL,"notequal"),fa),Ok=(gs={},Je(gs,Le.FUNC_ADD,"add"),Je(gs,Le.MIN_EXT,"min"),Je(gs,Le.MAX_EXT,"max"),Je(gs,Le.FUNC_SUBTRACT,"subtract"),Je(gs,Le.FUNC_REVERSE_SUBTRACT,"reverse subtract"),gs),gv=(wn={},Je(wn,Le.ZERO,"zero"),Je(wn,Le.ONE,"one"),Je(wn,Le.SRC_COLOR,"src color"),Je(wn,Le.ONE_MINUS_SRC_COLOR,"one minus src color"),Je(wn,Le.SRC_ALPHA,"src alpha"),Je(wn,Le.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Je(wn,Le.DST_COLOR,"dst color"),Je(wn,Le.ONE_MINUS_DST_COLOR,"one minus dst color"),Je(wn,Le.DST_ALPHA,"dst alpha"),Je(wn,Le.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Je(wn,Le.CONSTANT_COLOR,"constant color"),Je(wn,Le.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Je(wn,Le.CONSTANT_ALPHA,"constant alpha"),Je(wn,Le.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Je(wn,Le.SRC_ALPHA_SATURATE,"src alpha saturate"),wn),mie=(la={},Je(la,Le.NEVER,"never"),Je(la,Le.ALWAYS,"always"),Je(la,Le.LESS,"less"),Je(la,Le.LEQUAL,"lequal"),Je(la,Le.GREATER,"greater"),Je(la,Le.GEQUAL,"gequal"),Je(la,Le.EQUAL,"equal"),Je(la,Le.NOTEQUAL,"notequal"),la),Pu=(ca={},Je(ca,Le.ZERO,"zero"),Je(ca,Le.KEEP,"keep"),Je(ca,Le.REPLACE,"replace"),Je(ca,Le.INVERT,"invert"),Je(ca,Le.INCR,"increment"),Je(ca,Le.DECR,"decrement"),Je(ca,Le.INCR_WRAP,"increment wrap"),Je(ca,Le.DECR_WRAP,"decrement wrap"),ca),bie=(pv={},Je(pv,Le.FRONT,"front"),Je(pv,Le.BACK,"back"),pv),xie=function(){function r(e,t){Oi(this,r),this.buffer=void 0;var n=t.data,i=t.usage,a=t.type;this.buffer=e.buffer({data:n,usage:kk[i||Le.STATIC_DRAW],type:$m[a||Le.UNSIGNED_BYTE]})}return Di(r,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(t){var n=t.data,i=t.offset;this.buffer.subdata(n,i)}}]),r}();function jm(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function wie(r){if(Array.isArray(r))return jm(r)}function Eie(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function _ie(r,e){if(r){if(typeof r=="string")return jm(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?jm(r,e):void 0}}function Sie(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mie(r){return wie(r)||Eie(r)||_ie(r)||Sie()}function Dk(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Pk(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dk(Object(t),!0).forEach(function(n){Je(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Dk(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Cie=`attribute vec3 a_Position;
attribute vec2 a_TexCoord;

varying vec2 v_TexCoord;

void main() {
  gl_Position = vec4(a_Position, 1.0);
  v_TexCoord = a_TexCoord;
}`,Rk=0,Aie=function(){function r(e,t){var n=this;Oi(this,r),this.reGl=e,this.context=t,this.entity=Sk(),this.texFBO=void 0,this.computeCommand=void 0,this.textureCache={},this.outputTextureName=void 0,this.swapOutputTextureName=void 0,this.compiledPingpong=void 0,this.dynamicPingpong=void 0;var i={};this.context.uniforms.forEach(function(f){var l=f.name,c=f.type,h=f.data,d=f.isReferer,v=f.storageClass;if(v===Du.StorageBuffer){if(d)n.textureCache[l]={data:void 0},i["".concat(l,"Size")]=function(){return h.compiledBundle.context.output.textureSize};else{n.textureCache[l]=n.calcDataTexture(l,c,h);var p=n.textureCache[l],g=p.textureWidth,y=p.isOutput;i["".concat(l,"Size")]=[g,g],y&&(n.outputTextureName=l,n.context.needPingpong&&(n.outputTextureName="".concat(l,"Output"),n.textureCache[n.outputTextureName]=n.calcDataTexture(l,c,h)))}i[l]=function(){return n.textureCache[l].texture}}else if(v===Du.Uniform){if(h&&(Array.isArray(h)||hv(h))&&h.length>16)throw new Error("invalid data type ".concat(c));i[l]=function(){return f.data}}});var a=this.getOuputDataTexture(),o=a.textureWidth,s=a.texelCount;i.u_OutputTextureSize=[o,o],i.u_OutputTexelCount=s,this.context.output.textureSize=[o,o];var u={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
  precision highp float;
#else
  precision mediump float;
#endif
`.concat(this.context.shader),uniforms:i,vert:Cie,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return Di(r,[{key:"run",value:function(){var t=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use(function(){t.computeCommand()})}},{key:"readData",value:function(){var e=_o(Tn.mark(function n(){var i=this,a,o,s,u,f,l,c,h;return Tn.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){a=i.reGl.read()}),!a){v.next=6;break}if(o=this.getOuputDataTexture(),s=o.originalDataLength,u=o.elementsPerTexel,f=o.typedArrayConstructor,l=f===void 0?Float32Array:f,c=[],u!==4)for(h=0;h<a.length;h+=4)u===1?c.push(a[h]):u===2?c.push(a[h],a[h+1]):c.push(a[h],a[h+1],a[h+2]);else c=a;return v.abrupt("return",new l(c.slice(0,s)));case 6:return v.abrupt("return",new Float32Array);case 7:case"end":return v.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"confirmInput",value:function(t,n){var i;this.entity===t.entity?(this.dynamicPingpong=!0,i=this):i=t,this.textureCache[n].id=i.getOuputDataTexture().id,this.textureCache[n].texture=i.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(t,n){var i=this.context.uniforms.find(function(u){var f=u.name;return f===t});if(i){var a=this.calcDataTexture(t,i.type,n),o=a.texture,s=a.data;this.textureCache[t].data=s,this.textureCache[t].texture=o}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var t=this.context.output.name;this.textureCache[t].id=this.getOuputDataTexture().id,this.textureCache[t].texture=this.getOuputDataTexture().texture}var n=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=n}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var t=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=t}},{key:"cloneDataTexture",value:function(t){var n=t.data,i=t.textureWidth;return Pk(Pk({},t),{},{id:Rk++,texture:this.reGl.texture({width:i,height:i,data:n,type:"float"})})}},{key:"calcDataTexture",value:function(t,n,i){var a=1;n===Al.Vector4FloatArray&&(a=4);for(var o=[],s=0;s<i.length;s+=a)a===1?o.push(i[s],0,0,0):a===2?o.push(i[s],i[s+1],0,0):a===3?o.push(i[s],i[s+1],i[s+2],0):a===4&&o.push(i[s],i[s+1],i[s+2],i[s+3]);var u=i.length,f=Math.ceil(u/a),l=Math.ceil(Math.sqrt(f)),c=l*l;f<c&&o.push.apply(o,Mie(new Array((c-f)*4).fill(0)));var h=this.reGl.texture({width:l,height:l,data:o,type:"float"});return{id:Rk++,data:o,originalDataLength:u,typedArrayConstructor:hv(i)?i.constructor:void 0,textureWidth:l,texture:h,texelCount:f,elementsPerTexel:a,isOutput:t===this.context.output.name}}}]),r}(),Tie=function(){function r(e,t){Oi(this,r),this.elements=void 0;var n=t.data,i=t.usage,a=t.type,o=t.count;this.elements=e.elements({data:n,usage:kk[i||Le.STATIC_DRAW],type:$m[a||Le.UNSIGNED_BYTE],count:o})}return Di(r,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(t){var n=t.data;this.elements.subdata(n)}},{key:"destroy",value:function(){this.elements.destroy()}}]),r}(),Iie=function(){function r(e,t){Oi(this,r),this.framebuffer=void 0;var n=t.width,i=t.height,a=t.color,o=t.colors;t.depth,t.stencil;var s={width:n,height:i};Array.isArray(o)&&(s.colors=o.map(function(u){return u.get()})),a&&typeof a!="boolean"&&(s.color=a.get()),this.framebuffer=e.framebuffer(s)}return Di(r,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(t){var n=t.width,i=t.height;this.framebuffer.resize(n,i)}}]),r}();function kie(r,e){return function(t){return r(e(t))}}var Lie=kie,Nie=Lie,Oie=Nie(Object.getPrototypeOf,Object),Die=Oie,Pie=Gm,Rie=Die,Bie=zm,Fie="[object Object]",Gie=Function.prototype,zie=Object.prototype,Bk=Gie.toString,$ie=zie.hasOwnProperty,jie=Bk.call(Object);function Uie(r){if(!Bie(r)||Pie(r)!=Fie)return!1;var e=Rie(r);if(e===null)return!0;var t=$ie.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Bk.call(t)==jie}var Xie=Uie;const Yie=Ji(Xie);function Um(r){var e={};return Object.keys(r).forEach(function(t){Xm(t,r[t],e,"")}),e}function Xm(r,e,t,n){if(e===null||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)&&typeof e[0]=="number"||hv(e)||e===""||e.resize!==void 0){t["".concat(n&&n+".").concat(r)]=e;return}Yie(e)&&Object.keys(e).forEach(function(i){Xm(i,e[i],t,"".concat(n&&n+".").concat(r))}),Array.isArray(e)&&e.forEach(function(i,a){Object.keys(i).forEach(function(o){Xm(o,i[o],t,"".concat(n&&n+".").concat(r,"[").concat(a,"]"))})})}function Fk(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ru(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fk(Object(t),!0).forEach(function(n){Je(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fk(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Wie=function(){function r(e,t){Oi(this,r),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=e;var n=t.vs,i=t.fs,a=t.defines,o=t.attributes,s=t.uniforms,u=t.primitive,f=t.count,l=t.elements,c=t.depth,h=t.blend,d=t.stencil,v=t.cull,p=t.instances,g=t.scissor,y=t.viewport,m={};s&&(this.uniforms=Um(s),Object.keys(s).forEach(function(E){m[E]=e.prop(E)}));var b={};Object.keys(o).forEach(function(E){b[E]=o[E].get()});var x=a&&this.generateDefines(a)||"",w={attributes:b,frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
  precision highp float;
#else
  precision mediump float;
#endif
`.concat(x,`
`).concat(i),uniforms:m,vert:`
`.concat(x,`
`).concat(n),primitive:die[u===void 0?Le.TRIANGLES:u]};p&&(w.instances=p),f&&(w.count=f),l&&(w.elements=l.get()),g&&(w.scissor=g),y&&(w.viewport=y),this.initDepthDrawParams({depth:c},w),this.initBlendDrawParams({blend:h},w),this.initStencilDrawParams({stencil:d},w),this.initCullDrawParams({cull:v},w),this.drawCommand=e(w)}return Di(r,[{key:"addUniforms",value:function(t){this.uniforms=Ru(Ru({},this.uniforms),Um(t))}},{key:"draw",value:function(t){var n=Ru(Ru({},this.uniforms),Um(t.uniforms||{})),i={};Object.keys(n).forEach(function(a){var o=Ou(n[a]);o==="boolean"||o==="number"||Array.isArray(n[a])||n[a].BYTES_PER_ELEMENT?i[a]=n[a]:o==="string"||(i[a]=n[a].get())}),this.drawCommand(i)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(t,n){var i=t.depth;i&&(n.depth={enable:i.enable===void 0?!0:!!i.enable,mask:i.mask===void 0?!0:!!i.mask,func:yie[i.func||Le.LESS],range:i.range||[0,1]})}},{key:"initBlendDrawParams",value:function(t,n){var i=t.blend;if(i){var a=i.enable,o=i.func,s=i.equation,u=i.color,f=u===void 0?[0,0,0,0]:u;n.blend={enable:!!a,func:{srcRGB:gv[o&&o.srcRGB||Le.SRC_ALPHA],srcAlpha:gv[o&&o.srcAlpha||Le.SRC_ALPHA],dstRGB:gv[o&&o.dstRGB||Le.ONE_MINUS_SRC_ALPHA],dstAlpha:gv[o&&o.dstAlpha||Le.ONE_MINUS_SRC_ALPHA]},equation:{rgb:Ok[s&&s.rgb||Le.FUNC_ADD],alpha:Ok[s&&s.alpha||Le.FUNC_ADD]},color:f}}}},{key:"initStencilDrawParams",value:function(t,n){var i=t.stencil;if(i){var a=i.enable,o=i.mask,s=o===void 0?-1:o,u=i.func,f=u===void 0?{cmp:Le.ALWAYS,ref:0,mask:-1}:u,l=i.opFront,c=l===void 0?{fail:Le.KEEP,zfail:Le.KEEP,zpass:Le.KEEP}:l,h=i.opBack,d=h===void 0?{fail:Le.KEEP,zfail:Le.KEEP,zpass:Le.KEEP}:h;n.stencil={enable:!!a,mask:s,func:Ru(Ru({},f),{},{cmp:mie[f.cmp]}),opFront:{fail:Pu[c.fail],zfail:Pu[c.zfail],zpass:Pu[c.zpass]},opBack:{fail:Pu[d.fail],zfail:Pu[d.zfail],zpass:Pu[d.zpass]}}}}},{key:"initCullDrawParams",value:function(t,n){var i=t.cull;if(i){var a=i.enable,o=i.face,s=o===void 0?Le.BACK:o;n.cull={enable:!!a,face:bie[s]}}}},{key:"generateDefines",value:function(t){return Object.keys(t).map(function(n){return"#define ".concat(n," ").concat(Number(t[n]))}).join(`
`)}}]),r}(),Vie=function(){function r(e,t){Oi(this,r),this.texture=void 0,this.width=void 0,this.height=void 0;var n=t.data,i=t.type,a=i===void 0?Le.UNSIGNED_BYTE:i,o=t.width,s=t.height,u=t.flipY,f=u===void 0?!1:u,l=t.format,c=l===void 0?Le.RGBA:l,h=t.mipmap,d=h===void 0?!1:h,v=t.wrapS,p=v===void 0?Le.CLAMP_TO_EDGE:v,g=t.wrapT,y=g===void 0?Le.CLAMP_TO_EDGE:g,m=t.aniso,b=m===void 0?0:m,x=t.alignment,w=x===void 0?1:x,E=t.premultiplyAlpha,_=E===void 0?!1:E,M=t.mag,C=M===void 0?Le.NEAREST:M,S=t.min,A=S===void 0?Le.NEAREST:S,T=t.colorSpace,k=T===void 0?Le.BROWSER_DEFAULT_WEBGL:T;this.width=o,this.height=s;var O={width:o,height:s,type:$m[a],format:vie[c],wrapS:Nk[p],wrapT:Nk[y],mag:Lk[C],min:Lk[A],alignment:w,flipY:f,colorSpace:gie[k],premultiplyAlpha:_,aniso:b};n&&(O.data=n),typeof d=="number"?O.mipmap=pie[d]:typeof d=="boolean"&&(O.mipmap=d),this.texture=e.texture(O)}return Di(r,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(t){var n=t.width,i=t.height;this.texture.resize(n,i),this.width=n,this.height=i}},{key:"destroy",value:function(){this.texture.destroy()}}]),r}(),Hie=function(){function r(){var e=this;Oi(this,r),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var t=_o(Tn.mark(function n(i){return Tn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!i.uniforms){o.next=3;break}return o.next=3,Promise.all(Object.keys(i.uniforms).map(function(){var s=_o(Tn.mark(function u(f){var l;return Tn.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(i.uniforms[f]&&i.uniforms[f].load!==void 0)){h.next=5;break}return h.next=3,i.uniforms[f].load();case 3:l=h.sent,i.uniforms[f]=l;case 5:case"end":return h.stop()}},u)}));return function(u){return s.apply(this,arguments)}}()));case 3:return o.abrupt("return",new Wie(e.gl,i));case 4:case"end":return o.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new hie(e.gl,t)},this.createBuffer=function(t){return new xie(e.gl,t)},this.createElements=function(t){return new Tie(e.gl,t)},this.createTexture2D=function(t){return new Vie(e.gl,t)},this.createFramebuffer=function(t){return new Iie(e.gl,t)},this.useFramebuffer=function(t,n){e.gl({framebuffer:t?t.get():null})(n)},this.createComputeModel=function(){var t=_o(Tn.mark(function n(i){return Tn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Aie(e.gl,i));case 1:case"end":return o.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.clear=function(t){var n=t.color,i=t.depth,a=t.stencil,o=t.framebuffer,s=o===void 0?null:o,u={color:n,depth:i,stencil:a};u.framebuffer=s===null?s:s.get(),e.gl.clear(u)},this.setScissor=function(t){e.gl&&e.gl._gl&&(t.enable&&t.box?(e.gl._gl.enable(Le.SCISSOR_TEST),e.gl._gl.scissor(t.box.x,t.box.y,t.box.width,t.box.height)):e.gl._gl.disable(Le.SCISSOR_TEST),e.gl._refresh())},this.viewport=function(t){var n=t.x,i=t.y,a=t.width,o=t.height;e.gl&&e.gl._gl&&(e.gl._gl.viewport(n,i,a,o),e.gl._refresh())},this.readPixels=function(t){var n=t.framebuffer,i=t.x,a=t.y,o=t.width,s=t.height,u={x:i,y:a,width:o,height:s};return n&&(u.framebuffer=n.get()),e.gl.read(u)},this.getCanvas=function(){return e.$canvas},this.getGLContext=function(){return e.gl._gl},this.destroy=function(){e.gl&&(e.gl.destroy(),e.inited=!1)}}return Di(r,[{key:"init",value:function(){var e=_o(Tn.mark(function n(i){return Tn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!this.inited){o.next=2;break}return o.abrupt("return");case 2:return this.$canvas=i.canvas,o.next=5,new Promise(function(s,u){cie({canvas:i.canvas,attributes:{alpha:!0,antialias:i.antialias,premultipliedAlpha:!0},pixelRatio:1,extensions:["OES_element_index_uint","OES_texture_float","OES_standard_derivatives","angle_instanced_arrays"],optionalExtensions:["EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture"],profile:!0,onDone:function(l,c){(l||!c)&&u(l),s(c)}})});case 5:this.gl=o.sent,this.inited=!0;case 7:case"end":return o.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),r}(),qie=function(){function r(){Oi(this,r),this.engine=void 0,this.configService=new sie}return Di(r,[{key:"setConfig",value:function(t){this.configService.set(t)}},{key:"setEngine",value:function(t){this.engine=t}},{key:"createEntity",value:function(){return Sk()}},{key:"createKernel",value:function(t){var n=new Tk(this.engine,this.configService);return typeof t=="string"?n.setBundle(JSON.parse(t)):n.setBundle(t),n.init(),n}},{key:"destroy",value:function(){this.engine.destroy()}}],[{key:"create",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=new r;return n.setConfig(t),n.setEngine(new Hie),n}}]),r}();const Gk=ea(Object.freeze(Object.defineProperty({__proto__:null,Kernel:Tk,World:qie},Symbol.toStringTag,{value:"Module"})));var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.arrayToTextureData=Jn.attributesToTextureData=Jn.buildTextureDataWithTwoEdgeAttr=Jn.buildTextureData=Jn.proccessToFunc=void 0;var Zie=Ir(),yv=nd,Kie=function(r,e){var t;return r?(0,Zie.isNumber)(r)?t=function(){return r}:t=r:t=function(){return e||1},t};Jn.proccessToFunc=Kie;var Qie=function(r,e){var t=[],n=[],i={},a=0;for(a=0;a<r.length;a++){var o=r[a];i[o.id]=a,t.push(o.x),t.push(o.y),t.push(0),t.push(0),n.push([])}for(a=0;a<e.length;a++){var s=e[a],u=(0,yv.getEdgeTerminal)(s,"source"),f=(0,yv.getEdgeTerminal)(s,"target");!isNaN(i[u])&&!isNaN(i[f])&&(n[i[u]].push(i[f]),n[i[f]].push(i[u]))}var l=0;for(a=0;a<r.length;a++){var c=t.length,h=n[a],d=h.length;t[a*4+2]=c,t[a*4+3]=d,l=Math.max(l,d);for(var v=0;v<d;++v){var p=h[v];t.push(+p)}}for(;t.length%4!==0;)t.push(0);return{maxEdgePerVetex:l,array:new Float32Array(t)}};Jn.buildTextureData=Qie;var Jie=function(r,e,t,n){var i=[],a=[],o={},s=0;for(s=0;s<r.length;s++){var u=r[s];o[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),a.push([])}for(s=0;s<e.length;s++){var f=e[s],l=(0,yv.getEdgeTerminal)(f,"source"),c=(0,yv.getEdgeTerminal)(f,"target");a[o[l]].push(o[c]),a[o[l]].push(t(f)),a[o[l]].push(n(f)),a[o[l]].push(0),a[o[c]].push(o[l]),a[o[c]].push(t(f)),a[o[c]].push(n(f)),a[o[c]].push(0)}var h=0;for(s=0;s<r.length;s++){var d=i.length,v=a[s],p=v.length;i[s*4+2]=d+1048576*p/4,i[s*4+3]=0,h=Math.max(h,p/4);for(var g=0;g<p;++g){var y=v[g];i.push(+y)}}for(;i.length%4!==0;)i.push(0);return{maxEdgePerVetex:h,array:new Float32Array(i)}};Jn.buildTextureDataWithTwoEdgeAttr=Jie;var eae=function(r,e){var t=[],n=r.length,i={};return e.forEach(function(a){r.forEach(function(o,s){if(i[a[o]]===void 0&&(i[a[o]]=Object.keys(i).length),t.push(i[a[o]]),s===n-1)for(;t.length%4!==0;)t.push(0)})}),{array:new Float32Array(t),count:Object.keys(i).length}};Jn.attributesToTextureData=eae;var tae=function(r){for(var e=[],t=r.length,n=r[0].length,i=function(o){r.forEach(function(s,u){if(e.push(s[o]),u===t-1)for(;e.length%4!==0;)e.push(0)})},a=0;a<n;a++)i(a);return new Float32Array(e)};Jn.arrayToTextureData=tae;var ha={};Object.defineProperty(ha,"__esModule",{value:!0}),ha.clusterBundle=ha.clusterCode=ha.fruchtermanBundle=ha.fruchtermanCode=void 0,ha.fruchtermanCode=`
import { globalInvocationID } from 'g-webgpu';
const MAX_EDGE_PER_VERTEX;
const VERTEX_COUNT;
@numthreads(1, 1, 1)
class Fruchterman {
  @in @out
  u_Data: vec4[];
  @in
  u_K: float;
  @in
  u_K2: float;
  
  @in
  u_Center: vec2;
  @in
  u_Gravity: float;
  @in
  u_ClusterGravity: float;
  @in
  u_Speed: float;
  @in
  u_MaxDisplace: float;
  @in
  u_Clustering: float;
  @in
  u_AttributeArray: vec4[];
  @in
  u_ClusterCenters: vec4[];
  calcRepulsive(i: int, currentNode: vec4): vec2 {
    let dx = 0, dy = 0;
    for (let j = 0; j < VERTEX_COUNT; j++) {
      if (i != j) {
        const nextNode = this.u_Data[j];
        const xDist = currentNode[0] - nextNode[0];
        const yDist = currentNode[1] - nextNode[1];
        const dist = (xDist * xDist + yDist * yDist) + 0.01;
        let param = this.u_K2 / dist;
        
        if (dist > 0.0) {
          dx += param * xDist;
          dy += param * yDist;
          if (xDist == 0 && yDist == 0) {
            const sign = i < j ? 1 : -1;
            dx += param * sign;
            dy += param * sign;
          }
        }
      }
    }
    return [dx, dy];
  }
  calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { // 
    let dx = 0, dy = 0;
    const vx = currentNode[0] - this.u_Center[0];
    const vy = currentNode[1] - this.u_Center[1];
    const gf = 0.01 * this.u_K * this.u_Gravity;
    dx = gf * vx;
    dy = gf * vy;
    if (this.u_Clustering == 1) {
      const clusterIdx = int(nodeAttributes[0]);
      const center = this.u_ClusterCenters[clusterIdx];
      const cvx = currentNode[0] - center[0];
      const cvy = currentNode[1] - center[1];
      const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;
      const parma = this.u_K * this.u_ClusterGravity / dist;
      dx += parma * cvx;
      dy += parma * cvy;
    }
    return [dx, dy];
  }
  calcAttractive(i: int, currentNode: vec4): vec2 {
    let dx = 0, dy = 0;
    const arr_offset = int(floor(currentNode[2] + 0.5));
    const length = int(floor(currentNode[3] + 0.5));
    const node_buffer: vec4;
    for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {
      if (p >= length) break;
      const arr_idx = arr_offset + p;
      // when arr_idx % 4 == 0 update currentNodedx_buffer
      const buf_offset = arr_idx - arr_idx / 4 * 4;
      if (p == 0 || buf_offset == 0) {
        node_buffer = this.u_Data[int(arr_idx / 4)];
      }
      const float_j = buf_offset == 0 ? node_buffer[0] :
                      buf_offset == 1 ? node_buffer[1] :
                      buf_offset == 2 ? node_buffer[2] :
                                        node_buffer[3];
      const nextNode = this.u_Data[int(float_j)];
      const xDist = currentNode[0] - nextNode[0];
      const yDist = currentNode[1] - nextNode[1];
      const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;
      let attractiveF = dist / this.u_K;
    
      if (dist > 0.0) {
        dx -= xDist * attractiveF;
        dy -= yDist * attractiveF;
        if (xDist == 0 && yDist == 0) {
          const sign = i < int(float_j) ? 1 : -1;
          dx -= sign * attractiveF;
          dy -= sign * attractiveF;
        }
      }
    }
    return [dx, dy];
  }
  @main
  compute() {
    const i = globalInvocationID.x;
    const currentNode = this.u_Data[i];
    let dx = 0, dy = 0;
    if (i >= VERTEX_COUNT) {
      this.u_Data[i] = currentNode;
      return;
    }

    // [gravity, fx, fy, 0]
    const nodeAttributes = this.u_AttributeArray[i];

    if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {
      // the node is fixed
      this.u_Data[i] = [
        nodeAttributes[1],
        nodeAttributes[2],
        currentNode[2],
        currentNode[3]
      ];
      return;
    }

    // repulsive
    const repulsive = this.calcRepulsive(i, currentNode);
    dx += repulsive[0];
    dy += repulsive[1];
    // attractive
    const attractive = this.calcAttractive(i, currentNode);
    dx += attractive[0];
    dy += attractive[1];
    // gravity
    const gravity = this.calcGravity(currentNode, nodeAttributes);
    dx -= gravity[0];
    dy -= gravity[1];
    // speed
    dx *= this.u_Speed;
    dy *= this.u_Speed;

    // move
    const distLength = sqrt(dx * dx + dy * dy);
    if (distLength > 0.0) {
      const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);
      this.u_Data[i] = [
        currentNode[0] + dx / distLength * limitedDist,
        currentNode[1] + dy / distLength * limitedDist,
        currentNode[2],
        currentNode[3]
      ];
    }
  }
}
`,ha.fruchtermanBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n  vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n  vec2 normAddr2D = float(address1D) * conv_const;\\n  return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n  \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n  return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n  return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n  return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n  return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n  return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n  return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n  return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n  return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n  return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n  gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2<f32>","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',ha.clusterCode=`
import { globalInvocationID } from 'g-webgpu';
const VERTEX_COUNT;
const CLUSTER_COUNT;
@numthreads(1, 1, 1)
class CalcCenter {
  @in
  u_Data: vec4[];
  @in
  u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]
  @in @out
  u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]
  @main
  compute() {
    const i = globalInvocationID.x;
    const center = this.u_ClusterCenters[i];
    let sumx = 0;
    let sumy = 0;
    let count = 0;
    for (let j = 0; j < VERTEX_COUNT; j++) {
      const attributes = this.u_NodeAttributes[j];
      const clusterIdx = int(attributes[0]);
      const vertex = this.u_Data[j];
      if (clusterIdx == i) {
        sumx += vertex.x;
        sumy += vertex.y;
        count += 1;
      }
    }
    this.u_ClusterCenters[i] = [
      sumx / count,
      sumy / count,
      count,
      i
    ];
  }
}
`,ha.clusterBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n  vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n  vec2 normAddr2D = float(address1D) * conv_const;\\n  return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n  \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n  return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n  return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n  return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n  return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n  return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n  return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n  return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n  return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n  return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n  gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}';var rae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),mv=xe&&xe.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})},bv=xe&&xe.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(Ml,"__esModule",{value:!0}),Ml.FruchtermanGPULayout=void 0;var nae=Pr,Bu=Ir(),zk=Gk,$k=Jn,jk=ha,iae=ka,aae=function(r){rae(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=1e3,n.gravity=10,n.speed=1,n.clustering=!1,n.clusterField="cluster",n.clusterGravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return mv(this,void 0,void 0,function(){var t,n,i,a,o,s=this;return bv(this,function(u){switch(u.label){case 0:return t=this,n=t.nodes,!n||n.length===0?(t.onLayoutEnd&&t.onLayoutEnd(),[2]):(!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),i=t.center,n.length===1?(n[0].x=i[0],n[0].y=i[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(a={},o={},n.forEach(function(f,l){(0,Bu.isNumber)(f.x)||(f.x=Math.random()*s.width),(0,Bu.isNumber)(f.y)||(f.y=Math.random()*s.height),a[f.id]=f,o[f.id]=l}),t.nodeMap=a,t.nodeIdxMap=o,[4,t.run()]));case 1:return u.sent(),[2]}})})},e.prototype.executeWithWorker=function(t,n){return mv(this,void 0,void 0,function(){var i,a,o,s,u,f=this;return bv(this,function(l){switch(l.label){case 0:return i=this,a=i.nodes,o=i.center,!a||a.length===0?[2]:a.length===1?(a[0].x=o[0],a[0].y=o[1],[2]):(s={},u={},a.forEach(function(c,h){(0,Bu.isNumber)(c.x)||(c.x=Math.random()*f.width),(0,Bu.isNumber)(c.y)||(c.y=Math.random()*f.height),s[c.id]=c,u[c.id]=h}),i.nodeMap=s,i.nodeIdxMap=u,[4,i.run(t,n)]);case 1:return l.sent(),[2]}})})},e.prototype.run=function(t,n){return mv(this,void 0,void 0,function(){var i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b,x,w,E,_,M,C,S,A,T,k,O=this;return bv(this,function(G){switch(G.label){case 0:for(i=this,a=i.nodes,o=i.edges,s=i.maxIteration,u=i.center,f=i.height*i.width,l=Math.sqrt(f)/10,c=f/(a.length+1),h=Math.sqrt(c),d=i.speed,v=i.clustering,p=(0,$k.attributesToTextureData)([i.clusterField],a),g=p.array,y=p.count,a.forEach(function(D,$){var Y=0,N=0;(0,Bu.isNumber)(D.fx)&&(0,Bu.isNumber)(D.fy)&&(Y=D.fx||.001,N=D.fy||.001),g[4*$+1]=Y,g[4*$+2]=N}),m=a.length,b=(0,$k.buildTextureData)(a,o),x=b.maxEdgePerVetex,w=b.array,E=i.workerEnabled,E?_=zk.World.create({canvas:t,engineOptions:{supportCompute:!0}}):_=zk.World.create({engineOptions:{supportCompute:!0}}),M=i.onLayoutEnd,C=[],S=0;S<y;S++)C.push(0,0,0,0);return A=_.createKernel(jk.fruchtermanBundle).setDispatch([m,1,1]).setBinding({u_Data:w,u_K:h,u_K2:c,u_Gravity:i.gravity,u_ClusterGravity:i.clusterGravity||i.gravity||1,u_Speed:d,u_MaxDisplace:l,u_Clustering:v?1:0,u_Center:u,u_AttributeArray:g,u_ClusterCenters:C,MAX_EDGE_PER_VERTEX:x,VERTEX_COUNT:m}),v&&(T=_.createKernel(jk.clusterBundle).setDispatch([y,1,1]).setBinding({u_Data:w,u_NodeAttributes:g,u_ClusterCenters:C,VERTEX_COUNT:m,CLUSTER_COUNT:y})),k=function(){return mv(O,void 0,void 0,function(){var D,$;return bv(this,function(Y){switch(Y.label){case 0:D=0,Y.label=1;case 1:return D<s?[4,A.execute()]:[3,6];case 2:return Y.sent(),v?(T.setBinding({u_Data:A}),[4,T.execute()]):[3,4];case 3:Y.sent(),A.setBinding({u_ClusterCenters:T}),Y.label=4;case 4:A.setBinding({u_MaxDisplace:l*=.99}),Y.label=5;case 5:return D++,[3,1];case 6:return[4,A.getOutput()];case 7:return $=Y.sent(),t?n.postMessage({type:iae.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:$}):a.forEach(function(N,P){var W=$[4*P],J=$[4*P+1];N.x=W,N.y=J}),M&&M(),[2]}})})},[4,k()];case 1:return G.sent(),[2]}})})},e.prototype.getType=function(){return"fruchterman-gpu"},e}(nae.Base);Ml.FruchtermanGPULayout=aae;var Nl={},da={};Object.defineProperty(da,"__esModule",{value:!0}),da.aveMovementBundle=da.aveMovementCode=da.gForceBundle=da.gForceCode=void 0,da.gForceCode=`
import { globalInvocationID } from 'g-webgpu';

const MAX_EDGE_PER_VERTEX;
const VERTEX_COUNT;
const SHIFT_20 = 1048576;

@numthreads(1, 1, 1)
class GGForce {
  @in @out
  u_Data: vec4[];

  @in
  u_damping: float;
  
  @in
  u_maxSpeed: float;

  @in
  u_minMovement: float;

  @in
  u_AveMovement: vec4[];

  @in
  u_coulombDisScale: float;

  @in
  u_factor: float;

  @in
  u_NodeAttributeArray1: vec4[];

  @in
  u_NodeAttributeArray2: vec4[];

  @in
  u_interval: float;

  unpack_float(packedValue: float): ivec2 {
    const packedIntValue = int(packedValue);
    const v0 = packedIntValue / SHIFT_20;
    return [v0, packedIntValue - v0 * SHIFT_20];
  }

  calcRepulsive(i: int, currentNode: vec4): vec2 {
    let ax = 0, ay = 0;
    for (let j: int = 0; j < VERTEX_COUNT; j++) {
      if (i != j) {
        const nextNode = this.u_Data[j];
        const vx = currentNode[0] - nextNode[0];
        const vy = currentNode[1] - nextNode[1];
        const dist = sqrt(vx * vx + vy * vy) + 0.01;
        const n_dist = (dist + 0.1) * this.u_coulombDisScale;
        const direx = vx / dist;
        const direy = vy / dist;
        const attributesi = this.u_NodeAttributeArray1[i];
        const attributesj = this.u_NodeAttributeArray1[j];
        const massi = attributesi[0];
        const nodeStrengthi = attributesi[2];
        const nodeStrengthj = attributesj[2];
        const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;
        // const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);
        const param = nodeStrength * this.u_factor / (n_dist * n_dist);
        ax += direx * param;
        ay += direy * param;
      }
    }
    return [ax, ay];
  }

  calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {
    // note: attributes2 = [centerX, centerY, gravity, 0]

    const vx = currentNode[0] - attributes2[0];
    const vy = currentNode[1] - attributes2[1];
    
    const ax = vx * attributes2[2];
    const ay = vy * attributes2[2];
    
    return [ax, ay];
  }

  calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {
    // note: attributes1 = [mass, degree, nodeSterngth, 0]

    const mass = attributes1[0];
    let ax = 0, ay = 0;
    // const arr_offset = int(floor(currentNode[2] + 0.5));
    // const length = int(floor(currentNode[3] + 0.5));

    const compressed = this.unpack_float(currentNode[2]);
    const length = compressed[0];
    const arr_offset = compressed[1];

    const node_buffer: vec4;
    for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {
      if (p >= length) break;
      const arr_idx = arr_offset + 4 * p; // i 节点的第 p 条边开始的小格子位置
      const buf_offset = arr_idx - arr_idx / 4 * 4;
      if (p == 0 || buf_offset == 0) {
        node_buffer = this.u_Data[int(arr_idx / 4)]; // 大格子，大格子位置=小个子位置 / 4，
      }

      let float_j: float = node_buffer[0];

      const nextNode = this.u_Data[int(float_j)];
      const vx = nextNode[0] - currentNode[0];
      const vy = nextNode[1] - currentNode[1];
      const dist = sqrt(vx * vx + vy * vy) + 0.01;
      const direx = vx / dist;
      const direy = vy / dist;
      const edgeLength = node_buffer[1];
      const edgeStrength = node_buffer[2];
      const diff: float = edgeLength - dist;//edgeLength
      // const param = diff * this.u_stiffness / mass; //
      const param = diff * edgeStrength / mass; // 
      ax -= direx * param;
      ay -= direy * param;
    }
    return [ax, ay];
  }

  @main
  compute() {
    const i = globalInvocationID.x;
    const currentNode = this.u_Data[i];
    const movement = u_AveMovement[0];
    let ax = 0, ay = 0;

    if (i >= VERTEX_COUNT || movement.x < u_minMovement) {
      this.u_Data[i] = currentNode;
      return;
    }

    // 每个节点属性占两个数组中各一格
    // [mass, degree, nodeStrength, fx]
    const nodeAttributes1 = this.u_NodeAttributeArray1[i];
    // [centerX, centerY, centerGravity, fy]
    const nodeAttributes2 = this.u_NodeAttributeArray2[i];

    // repulsive
    const repulsive = this.calcRepulsive(i, currentNode);
    ax += repulsive[0];
    ay += repulsive[1];

    // attractive
    const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);
    ax += attractive[0];
    ay += attractive[1];

    // gravity
    const gravity = this.calcGravity(i, currentNode, nodeAttributes2);
    ax -= gravity[0];
    ay -= gravity[1];

    // speed
    const param = this.u_interval * this.u_damping;
    let vx = ax * param;
    let vy = ay * param;
    const vlength = sqrt(vx * vx + vy * vy) + 0.0001;
    if (vlength > this.u_maxSpeed) {
      const param2 = this.u_maxSpeed / vlength;
      vx = param2 * vx;
      vy = param2 * vy;
    }

    // move
    if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {
      this.u_Data[i] = [
        nodeAttributes1[3],
        nodeAttributes2[3],
        currentNode[2],
        0
      ];
    } else {
      const distx = vx * this.u_interval;
      const disty = vy * this.u_interval;
      const distLength = sqrt(distx * distx + disty * disty);
      this.u_Data[i] = [
        currentNode[0] + distx,
        currentNode[1] + disty,
        currentNode[2],
        distLength
      ];
    }
    
    // the avarage move distance
    // need to share memory
    
  }
}
`,da.gForceBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n  vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n  vec2 normAddr2D = float(address1D) * conv_const;\\n  return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n  \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n  return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n  return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n  return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n  return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n  return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n  return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n  return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n  return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n  return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n  return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n  return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n  return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {float distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\ngl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n  gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',da.aveMovementCode=`
const VERTEX_COUNT;
@numthreads(1, 1, 1)
class CalcAveMovement {
  @in
  u_Data: vec4[];
  @in
  u_iter: float;
  @in @out
  u_AveMovement: vec4[];
  @main
  compute() {
    let movement = 0;
    for (let j: int = 0; j < VERTEX_COUNT; j++) {
      const vertex = this.u_Data[j];
      movement += vertex[3];
    }
    movement = movement / float(VERTEX_COUNT);
    this.u_AveMovement[0] = [movement, 0, 0, 0];
  }
}
`,da.aveMovementBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n  vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n  vec2 normAddr2D = float(address1D) * conv_const;\\n  return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n  \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n  return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n  return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n  return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n  return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n  return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n  return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1);     \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n  + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n                + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n  gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}';var oae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ym=xe&&xe.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})},Wm=xe&&xe.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(Nl,"__esModule",{value:!0}),Nl.GForceGPULayout=void 0;var sae=Pr,za=Ir(),Uk=Gk,$a=Jn,uae=nd,Xk=da,fae=ka,lae=function(r){oae(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=1e3,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return Ym(this,void 0,void 0,function(){var t,n,i,a,o;return Wm(this,function(s){switch(s.label){case 0:return t=this,n=t.nodes,!n||n.length===0?(t.onLayoutEnd&&t.onLayoutEnd(),[2]):(!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),i=t.center,n.length===1?(n[0].x=i[0],n[0].y=i[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(a={},o={},n.forEach(function(u,f){(0,za.isNumber)(u.x)||(u.x=Math.random()*t.width),(0,za.isNumber)(u.y)||(u.y=Math.random()*t.height),a[u.id]=u,o[u.id]=f}),t.nodeMap=a,t.nodeIdxMap=o,t.nodeStrength=(0,$a.proccessToFunc)(t.nodeStrength,1),t.edgeStrength=(0,$a.proccessToFunc)(t.edgeStrength,1),[4,t.run()]));case 1:return s.sent(),[2]}})})},e.prototype.executeWithWorker=function(t,n){var i=this,a=i.nodes,o=i.center;if(!(!a||a.length===0)){if(a.length===1){a[0].x=o[0],a[0].y=o[1];return}var s={},u={};a.forEach(function(f,l){(0,za.isNumber)(f.x)||(f.x=Math.random()*i.width),(0,za.isNumber)(f.y)||(f.y=Math.random()*i.height),s[f.id]=f,u[f.id]=l}),i.nodeMap=s,i.nodeIdxMap=u,i.nodeStrength=(0,$a.proccessToFunc)(i.nodeStrength,1),i.edgeStrength=(0,$a.proccessToFunc)(i.edgeStrength,1),i.run(t,n)}},e.prototype.run=function(t,n){return Ym(this,void 0,void 0,function(){var i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b,x,w,E,_,M,C,S,A,T,k,O,G=this;return Wm(this,function(D){switch(D.label){case 0:for(i=this,a=i.nodes,o=i.edges,s=i.maxIteration,!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),u=a.length,i.linkDistance=(0,$a.proccessToFunc)(i.linkDistance),i.edgeStrength=(0,$a.proccessToFunc)(i.edgeStrength),f=(0,$a.buildTextureDataWithTwoEdgeAttr)(a,o,i.linkDistance,i.edgeStrength),l=f.maxEdgePerVetex,c=f.array,i.degrees=(0,uae.getDegree)(a.length,i.nodeIdxMap,o).map(function($){return $.all}),h=[],d=[],v=[],p=[],g=[],y=[],m=[],i.getMass||(i.getMass=function($){return i.degrees[i.nodeIdxMap[$.id]]||1}),b=i.gravity,x=i.center,a.forEach(function($,Y){h.push(i.getMass($)),d.push(i.nodeStrength($)),i.degrees[Y]||(i.degrees[Y]=0);var N=[x[0],x[1],b];if(i.getCenter){var P=i.getCenter($,i.degrees[Y]);P&&(0,za.isNumber)(P[0])&&(0,za.isNumber)(P[1])&&(0,za.isNumber)(P[2])&&(N=P)}v.push(N[0]),p.push(N[1]),g.push(N[2]),(0,za.isNumber)($.fx)&&(0,za.isNumber)($.fy)?(y.push($.fx||.001),m.push($.fy||.001)):(y.push(0),m.push(0))}),w=(0,$a.arrayToTextureData)([h,i.degrees,d,y]),E=(0,$a.arrayToTextureData)([v,p,g,m]),_=i.workerEnabled,_?M=Uk.World.create({canvas:t,engineOptions:{supportCompute:!0}}):M=Uk.World.create({engineOptions:{supportCompute:!0}}),C=i.onLayoutEnd,S=[],c.forEach(function($){S.push($)}),A=0;A<4;A++)S.push(0);return T=M.createKernel(Xk.gForceBundle).setDispatch([u,1,1]).setBinding({u_Data:c,u_damping:i.damping,u_maxSpeed:i.maxSpeed,u_minMovement:i.minMovement,u_coulombDisScale:i.coulombDisScale,u_factor:i.factor,u_NodeAttributeArray1:w,u_NodeAttributeArray2:E,MAX_EDGE_PER_VERTEX:l,VERTEX_COUNT:u,u_AveMovement:S,u_interval:i.interval}),k=M.createKernel(Xk.aveMovementBundle).setDispatch([1,1,1]).setBinding({u_Data:c,VERTEX_COUNT:u,u_AveMovement:[0,0,0,0]}),O=function(){return Ym(G,void 0,void 0,function(){var $,Y,N;return Wm(this,function(P){switch(P.label){case 0:$=0,P.label=1;case 1:return $<s?[4,T.execute()]:[3,5];case 2:return P.sent(),k.setBinding({u_Data:T}),[4,k.execute()];case 3:P.sent(),Y=Math.max(.02,i.interval-$*.002),T.setBinding({u_interval:Y,u_AveMovement:k}),P.label=4;case 4:return $++,[3,1];case 5:return[4,T.getOutput()];case 6:return N=P.sent(),t?n.postMessage({type:fae.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:N}):a.forEach(function(W,J){var te=N[4*J],H=N[4*J+1];W.x=te,W.y=H}),C&&C(),[2]}})})},[4,O()];case 1:return D.sent(),[2]}})})},e.prototype.getType=function(){return"gForce-gpu"},e}(sae.Base);Nl.GForceGPULayout=lae;var Ol={},cae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ol,"__esModule",{value:!0}),Ol.ComboForceLayout=void 0;var hae=Pr,Yt=Ir(),dae=function(r){cae(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.maxIteration=100,n.gravity=10,n.comboGravity=10,n.linkDistance=10,n.alpha=1,n.alphaMin=.001,n.alphaDecay=1-Math.pow(n.alphaMin,1/300),n.alphaTarget=0,n.velocityDecay=.6,n.edgeStrength=.6,n.nodeStrength=30,n.preventOverlap=!1,n.preventNodeOverlap=!1,n.preventComboOverlap=!1,n.collideStrength=void 0,n.nodeCollideStrength=.5,n.comboCollideStrength=.5,n.comboSpacing=20,n.comboPadding=10,n.optimizeRangeFactor=1,n.onTick=function(){},n.onLayoutEnd=function(){},n.depthAttractiveForceScale=1,n.depthRepulsiveForceScale=2,n.nodes=[],n.edges=[],n.combos=[],n.comboTrees=[],n.width=300,n.height=300,n.bias=[],n.nodeMap={},n.oriComboMap={},n.indexMap={},n.comboMap={},n.previousLayouted=!1,n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:100,center:[0,0],gravity:10,speed:1,comboGravity:30,preventOverlap:!1,preventComboOverlap:!0,preventNodeOverlap:!0,nodeSpacing:void 0,collideStrength:void 0,nodeCollideStrength:.5,comboCollideStrength:.5,comboSpacing:20,comboPadding:10,edgeStrength:.6,nodeStrength:30,linkDistance:10}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.center;if(t.comboTree={id:"comboTreeRoot",depth:-1,children:t.comboTrees},!n||n.length===0){t.onLayoutEnd&&t.onLayoutEnd();return}if(n.length===1){n[0].x=i[0],n[0].y=i[1],t.onLayoutEnd&&t.onLayoutEnd();return}t.initVals(),t.run(),t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){var t=this,n=t.nodes,i=t.previousLayouted?t.maxIteration/5:t.maxIteration;!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight);var a=t.center,o=t.velocityDecay,s=t.comboMap;t.previousLayouted||t.initPos(s);for(var u=function(h){var d=[];n.forEach(function(v,p){d[p]={x:0,y:0}}),t.applyCalculate(d),t.applyComboCenterForce(d),n.forEach(function(v,p){!(0,Yt.isNumber)(v.x)||!(0,Yt.isNumber)(v.y)||(v.x+=d[p].x*o,v.y+=d[p].y*o)}),t.alpha+=(t.alphaTarget-t.alpha)*t.alphaDecay,t.onTick()},f=0;f<i;f++)u();var l=[0,0];n.forEach(function(h){!(0,Yt.isNumber)(h.x)||!(0,Yt.isNumber)(h.y)||(l[0]+=h.x,l[1]+=h.y)}),l[0]/=n.length,l[1]/=n.length;var c=[a[0]-l[0],a[1]-l[1]];n.forEach(function(h,d){!(0,Yt.isNumber)(h.x)||!(0,Yt.isNumber)(h.y)||(h.x+=c[0],h.y+=c[1])}),t.combos.forEach(function(h){var d=s[h.id];d&&d.empty&&(h.x=d.cx||h.x,h.y=d.cy||h.y)}),t.previousLayouted=!0},e.prototype.initVals=function(){var t=this,n=t.edges,i=t.nodes,a=t.combos,o={},s={},u={};i.forEach(function($,Y){s[$.id]=$,u[$.id]=Y}),t.nodeMap=s,t.indexMap=u;var f={};a.forEach(function($){f[$.id]=$}),t.oriComboMap=f,t.comboMap=t.getComboMap();var l=t.preventOverlap;t.preventComboOverlap=t.preventComboOverlap||l,t.preventNodeOverlap=t.preventNodeOverlap||l;var c=t.collideStrength;c&&(t.comboCollideStrength=c,t.nodeCollideStrength=c),t.comboCollideStrength=t.comboCollideStrength?t.comboCollideStrength:0,t.nodeCollideStrength=t.nodeCollideStrength?t.nodeCollideStrength:0;for(var h=0;h<n.length;++h){var d=(0,Yt.getEdgeTerminal)(n[h],"source"),v=(0,Yt.getEdgeTerminal)(n[h],"target");o[d]?o[d]++:o[d]=1,o[v]?o[v]++:o[v]=1}for(var p=[],h=0;h<n.length;++h){var d=(0,Yt.getEdgeTerminal)(n[h],"source"),v=(0,Yt.getEdgeTerminal)(n[h],"target");p[h]=o[d]/(o[d]+o[v])}this.bias=p;var g=t.nodeSize,y=t.nodeSpacing,m,b;if((0,Yt.isNumber)(y)?b=function(){return y}:(0,Yt.isFunction)(y)?b=y:b=function(){return 0},this.nodeSpacing=b,!g)m=function($){if($.size){if((0,Yt.isArray)($.size)){var Y=$.size[0]>$.size[1]?$.size[0]:$.size[1];return Y/2}if((0,Yt.isObject)($.size)){var Y=$.size.width>$.size.height?$.size.width:$.size.height;return Y/2}return $.size/2}return 10};else if((0,Yt.isFunction)(g))m=function($){return g($)};else if((0,Yt.isArray)(g)){var x=g[0]>g[1]?g[0]:g[1],w=x/2;m=function($){return w}}else{var E=g/2;m=function($){return E}}this.nodeSize=m;var _=t.comboSpacing,M;(0,Yt.isNumber)(_)?M=function(){return _}:(0,Yt.isFunction)(_)?M=_:M=function(){return 0},this.comboSpacing=M;var C=t.comboPadding,S;(0,Yt.isNumber)(C)?S=function(){return C}:(0,Yt.isArray)(C)?S=function(){return Math.max.apply(null,C)}:(0,Yt.isFunction)(C)?S=C:S=function(){return 0},this.comboPadding=S;var A=this.linkDistance,T;A||(A=10),(0,Yt.isNumber)(A)?T=function($){return A}:T=A,this.linkDistance=T;var k=this.edgeStrength,O;k||(k=1),(0,Yt.isNumber)(k)?O=function($){return k}:O=k,this.edgeStrength=O;var G=this.nodeStrength,D;G||(G=30),(0,Yt.isNumber)(G)?D=function($){return G}:D=G,this.nodeStrength=D},e.prototype.initPos=function(t){var n=this,i=n.nodes;i.forEach(function(a,o){var s=a.comboId,u=t[s];s&&u?(a.x=u.cx+100/(o+1),a.y=u.cy+100/(o+1)):(a.x=100/(o+1),a.y=100/(o+1))})},e.prototype.getComboMap=function(){var t=this,n=t.nodeMap,i=t.comboTrees,a=t.oriComboMap,o={};return(i||[]).forEach(function(s){var u=[];(0,Yt.traverseTreeUp)(s,function(f){if(f.itemType==="node"||!a[f.id])return!0;if(o[f.id]===void 0){var l={id:f.id,name:f.id,cx:0,cy:0,count:0,depth:t.oriComboMap[f.id].depth||0,children:[]};o[f.id]=l}var c=f.children;c&&c.forEach(function(v){if(!o[v.id]&&!n[v.id])return!0;u.push(v)});var h=o[f.id];if(h.cx=0,h.cy=0,u.length===0){h.empty=!0;var d=a[f.id];h.cx=d.x,h.cy=d.y}return u.forEach(function(v){if(h.count++,v.itemType!=="node"){var p=o[v.id];(0,Yt.isNumber)(p.cx)&&(h.cx+=p.cx),(0,Yt.isNumber)(p.cy)&&(h.cy+=p.cy);return}var g=n[v.id];g&&((0,Yt.isNumber)(g.x)&&(h.cx+=g.x),(0,Yt.isNumber)(g.y)&&(h.cy+=g.y))}),h.cx/=h.count||1,h.cy/=h.count||1,h.children=u,!0})}),o},e.prototype.applyComboCenterForce=function(t){var n=this,i=n.gravity,a=n.comboGravity||i,o=this.alpha,s=n.comboTrees,u=n.indexMap,f=n.nodeMap,l=n.comboMap;(s||[]).forEach(function(c){(0,Yt.traverseTreeUp)(c,function(h){if(h.itemType==="node")return!0;var d=l[h.id];if(!d)return!0;var v=l[h.id],p=(v.depth+1)/10*.5,g=v.cx,y=v.cy;return v.cx=0,v.cy=0,v.children.forEach(function(m){if(m.itemType!=="node"){var b=l[m.id];b&&(0,Yt.isNumber)(b.cx)&&(v.cx+=b.cx),b&&(0,Yt.isNumber)(b.cy)&&(v.cy+=b.cy);return}var x=f[m.id],w=x.x-g||.005,E=x.y-y||.005,_=Math.sqrt(w*w+E*E),M=u[x.id],C=a*o/_*p;t[M].x-=w*C,t[M].y-=E*C,(0,Yt.isNumber)(x.x)&&(v.cx+=x.x),(0,Yt.isNumber)(x.y)&&(v.cy+=x.y)}),v.cx/=v.count||1,v.cy/=v.count||1,!0})})},e.prototype.applyCalculate=function(t){var n=this,i=n.comboMap,a=n.nodes,o={};a.forEach(function(u,f){a.forEach(function(l,c){if(!(f<c)){var h=u.x-l.x||.005,d=u.y-l.y||.005,v=h*h+d*d,p=Math.sqrt(v);v<1&&(v=p),o["".concat(u.id,"-").concat(l.id)]={vx:h,vy:d,vl2:v,vl:p},o["".concat(l.id,"-").concat(u.id)]={vl2:v,vl:p,vx:-h,vy:-d}}})}),n.updateComboSizes(i),n.calRepulsive(t,o),n.calAttractive(t,o);var s=n.preventComboOverlap;s&&n.comboNonOverlapping(t,i)},e.prototype.updateComboSizes=function(t){var n=this,i=n.comboTrees,a=n.nodeMap,o=n.nodeSize,s=n.comboSpacing,u=n.comboPadding;(i||[]).forEach(function(f){var l=[];(0,Yt.traverseTreeUp)(f,function(c){if(c.itemType==="node")return!0;var h=t[c.id];if(!h)return!1;var d=c.children;d&&d.forEach(function(g){!t[g.id]&&!a[g.id]||l.push(g)}),h.minX=1/0,h.minY=1/0,h.maxX=-1/0,h.maxY=-1/0,l.forEach(function(g){if(g.itemType!=="node")return!0;var y=a[g.id];if(!y)return!0;var m=o(y),b=y.x-m,x=y.y-m,w=y.x+m,E=y.y+m;h.minX>b&&(h.minX=b),h.minY>x&&(h.minY=x),h.maxX<w&&(h.maxX=w),h.maxY<E&&(h.maxY=E)});var v=n.oriComboMap[c.id].size||10;(0,Yt.isArray)(v)&&(v=v[0]);var p=Math.max(h.maxX-h.minX,h.maxY-h.minY,v);return h.r=p/2+s(h)/2+u(h),!0})})},e.prototype.comboNonOverlapping=function(t,n){var i=this,a=i.comboTree,o=i.comboCollideStrength,s=i.indexMap,u=i.nodeMap;(0,Yt.traverseTreeUp)(a,function(f){if(!n[f.id]&&!u[f.id]&&f.id!=="comboTreeRoot")return!1;var l=f.children;return l&&l.length>1&&l.forEach(function(c,h){if(c.itemType==="node")return!1;var d=n[c.id];d&&l.forEach(function(v,p){if(h<=p||v.itemType==="node")return!1;var g=n[v.id];if(!g)return!1;var y=d.cx-g.cx||.005,m=d.cy-g.cy||.005,b=y*y+m*m,x=d.r||1,w=g.r||1,E=x+w,_=w*w,M=x*x;if(b<E*E){var C=c.children;if(!C||C.length===0)return!1;var S=v.children;if(!S||S.length===0)return!1;var A=Math.sqrt(b),T=(E-A)/A*o,k=y*T,O=m*T,G=_/(M+_),D=1-G;C.forEach(function($){if($.itemType!=="node")return!1;if(u[$.id]){var Y=s[$.id];S.forEach(function(N){if(N.itemType!=="node"||!u[N.id])return!1;var P=s[N.id];t[Y].x+=k*G,t[Y].y+=O*G,t[P].x-=k*D,t[P].y-=O*D})}})}})}),!0})},e.prototype.calRepulsive=function(t,n){var i=this,a=i.nodes,o=i.width*i.optimizeRangeFactor,s=i.nodeStrength,u=i.alpha,f=i.nodeCollideStrength,l=i.preventNodeOverlap,c=i.nodeSize,h=i.nodeSpacing,d=i.depthRepulsiveForceScale,v=i.center;a.forEach(function(p,g){if(!(!p.x||!p.y)){if(v){var y=i.gravity,m=p.x-v[0]||.005,b=p.y-v[1]||.005,x=Math.sqrt(m*m+b*b);t[g].x-=m*y*u/x,t[g].y-=b*y*u/x}a.forEach(function(w,E){if(g!==E&&!(!w.x||!w.y)){var _=n["".concat(p.id,"-").concat(w.id)],M=_.vl2,C=_.vl;if(!(C>o)){var S=n["".concat(p.id,"-").concat(w.id)],A=S.vx,T=S.vy,k=Math.log(Math.abs(w.depth-p.depth)/10)+1||1;k=k<1?1:k,w.comboId!==p.comboId&&(k+=1);var O=k?Math.pow(d,k):1,G=s(w)*u/M*O;if(t[g].x+=A*G,t[g].y+=T*G,g<E&&l){var D=c(p)+h(p)||1,$=c(w)+h(w)||1,Y=D+$;if(M<Y*Y){var N=(Y-C)/C*f,P=$*$,W=P/(D*D+P),J=A*N,te=T*N;t[g].x+=J*W,t[g].y+=te*W,W=1-W,t[E].x-=J*W,t[E].y-=te*W}}}}})}})},e.prototype.calAttractive=function(t,n){var i=this,a=i.edges,o=i.linkDistance,s=i.alpha,u=i.edgeStrength,f=i.bias,l=i.depthAttractiveForceScale;a.forEach(function(c,h){var d=(0,Yt.getEdgeTerminal)(c,"source"),v=(0,Yt.getEdgeTerminal)(c,"target");if(!(!d||!v||d===v)){var p=i.indexMap[d],g=i.indexMap[v],y=i.nodeMap[d],m=i.nodeMap[v];if(!(!y||!m)){var b=y.depth===m.depth?0:Math.log(Math.abs(y.depth-m.depth)/10);y.comboId===m.comboId&&(b=b/2);var x=b?Math.pow(l,b):1;if(y.comboId!==m.comboId&&x===1?x=l/2:y.comboId===m.comboId&&(x=2),!(!(0,Yt.isNumber)(m.x)||!(0,Yt.isNumber)(y.x)||!(0,Yt.isNumber)(m.y)||!(0,Yt.isNumber)(y.y))){var w=n["".concat(v,"-").concat(d)],E=w.vl,_=w.vx,M=w.vy,C=(E-o(c))/E*s*u(c)*x,S=_*C,A=M*C,T=f[h];t[g].x-=S*T,t[g].y-=A*T,t[p].x+=S*(1-T),t[p].y+=A*(1-T)}}}})},e.prototype.getType=function(){return"comboForce"},e}(hae.Base);Ol.ComboForceLayout=dae;var Dl={},Yk;function Wk(){if(Yk)return Dl;Yk=1;var r=xe&&xe.__extends||function(){var s=function(u,f){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,c){l.__proto__=c}||function(l,c){for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(l[h]=c[h])},s(u,f)};return function(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");s(u,f);function l(){this.constructor=u}u.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}(),e=xe&&xe.__assign||function(){return e=Object.assign||function(s){for(var u,f=1,l=arguments.length;f<l;f++){u=arguments[f];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(s[c]=u[c])}return s},e.apply(this,arguments)};Object.defineProperty(Dl,"__esModule",{value:!0}),Dl.ComboCombinedLayout=void 0;var t=ka,n=Pr,i=Ir(),a=iL(),o=function(s){r(u,s);function u(f){var l=s.call(this)||this;return l.center=[0,0],l.nodes=[],l.edges=[],l.combos=[],l.comboEdges=[],l.comboPadding=10,l.comboTrees=[],l.updateCfg(f),l}return u.prototype.getDefaultCfg=function(){return{}},u.prototype.execute=function(){var f=this,l=f.nodes,c=f.center;if(!l||l.length===0){f.onLayoutEnd&&f.onLayoutEnd();return}if(l.length===1){l[0].x=c[0],l[0].y=c[1],f.onLayoutEnd&&f.onLayoutEnd();return}f.initVals(),f.run(),f.onLayoutEnd&&f.onLayoutEnd()},u.prototype.run=function(){var f,l=this,c=l.nodes,h=l.edges,d=l.combos,v=l.comboEdges,p=l.center,g={};c.forEach(function(G){g[G.id]=G});var y={};d.forEach(function(G){y[G.id]=G});var m=l.getInnerGraphs(g),b=[],x=[],w={},E=!0;this.comboTrees.forEach(function(G){var D=m[G.id];if(D){var $=e(e({},G),{x:D.x||y[G.id].x,y:D.y||y[G.id].y,fx:D.fx||y[G.id].fx,fy:D.fy||y[G.id].fy,mass:D.mass||y[G.id].mass,size:D.size});x.push($),!isNaN($.x)&&$.x!==0&&!isNaN($.y)&&$.y!==0?E=!1:($.x=Math.random()*100,$.y=Math.random()*100),b.push(G.id),(0,i.traverseTreeUp)(G,function(Y){return Y.id!==G.id&&(w[Y.id]=G.id),!0})}}),c.forEach(function(G){if(!(G.comboId&&y[G.comboId])){var D=e({},G);x.push(D),!isNaN(D.x)&&D.x!==0&&!isNaN(D.y)&&D.y!==0?E=!1:(D.x=Math.random()*100,D.y=Math.random()*100),b.push(G.id)}});var _=[];if(h.concat(v).forEach(function(G){var D=w[G.source]||G.source,$=w[G.target]||G.target;D!==$&&b.includes(D)&&b.includes($)&&_.push({source:D,target:$})}),x!=null&&x.length){if(x.length===1)x[0].x=p[0],x[0].y=p[1];else{var M={nodes:x,edges:_},C=this.outerLayout||new a.GForceLayout({gravity:1,factor:4,linkDistance:function(G,D,$){var Y,N,P=((((Y=D.size)===null||Y===void 0?void 0:Y[0])||30)+(((N=$.size)===null||N===void 0?void 0:N[0])||30))/2;return Math.min(P*1.5,700)}}),S=(f=C.getType)===null||f===void 0?void 0:f.call(C);if(C.updateCfg({center:p,kg:5,preventOverlap:!0,animate:!1}),E&&t.FORCE_LAYOUT_TYPE_MAP[S]){var A=x.length<100?new a.MDSLayout:new a.GridLayout;A.layout(M)}C.layout(M)}x.forEach(function(G){var D=m[G.id];if(!D){var $=g[G.id];$&&($.x=G.x,$.y=G.y);return}D.visited=!0,D.x=G.x,D.y=G.y,D.nodes.forEach(function(Y){Y.x+=G.x,Y.y+=G.y})})}for(var T=Object.keys(m),k=function(G){var D=T[G],$=m[D];if(!$)return"continue";$.nodes.forEach(function(Y){$.visited||(Y.x+=$.x||0,Y.y+=$.y||0),g[Y.id]&&(g[Y.id].x=Y.x,g[Y.id].y=Y.y)}),y[D]&&(y[D].x=$.x,y[D].y=$.y)},O=T.length-1;O>=0;O--)k(O);return{nodes:c,edges:h,combos:d,comboEdges:v}},u.prototype.getInnerGraphs=function(f){var l=this,c=l.comboTrees,h=l.nodeSize,d=l.edges,v=l.comboPadding,p=l.spacing,g={},y=this.innerLayout||new a.ConcentricLayout({type:"concentric",sortBy:"id"});return y.center=[0,0],y.preventOverlap=!0,y.nodeSpacing=p,(c||[]).forEach(function(m){(0,i.traverseTreeUp)(m,function(b){var x,w=(v==null?void 0:v(b))||10;if((0,i.isArray)(w)&&(w=Math.max.apply(Math,w)),!((x=b.children)===null||x===void 0)&&x.length){var _=b.children.map(function(N){if(N.itemType==="combo")return g[N.id];var P=f[N.id]||{};return e(e({},P),N)}),M=_.map(function(N){return N.id}),C={nodes:_,edges:d.filter(function(N){return M.includes(N.source)&&M.includes(N.target)})},S=1/0;_.forEach(function(N){var P;N.size||(N.size=((P=g[N.id])===null||P===void 0?void 0:P.size)||(h==null?void 0:h(N))||[30,30]),(0,i.isNumber)(N.size)&&(N.size=[N.size,N.size]),S>N.size[0]&&(S=N.size[0]),S>N.size[1]&&(S=N.size[1])}),y.layout(C);var A=(0,i.getLayoutBBox)(_),T=A.minX,k=A.minY,O=A.maxX,G=A.maxY,D={x:(O+T)/2,y:(G+k)/2};C.nodes.forEach(function(N){N.x-=D.x,N.y-=D.y});var $=Math.max(O-T,S)+w*2,Y=Math.max(G-k,S)+w*2;g[b.id]={id:b.id,nodes:_,size:[$,Y]}}else if(b.itemType==="combo"){var E=w?[w*2,w*2]:[30,30];g[b.id]={id:b.id,nodes:[],size:E}}return!0})}),g},u.prototype.initVals=function(){var f=this,l=f.nodeSize,c=f.spacing,h,d;if((0,i.isNumber)(c)?d=function(){return c}:(0,i.isFunction)(c)?d=c:d=function(){return 0},this.spacing=d,!l)h=function(b){var x=d(b);if(b.size){if((0,i.isArray)(b.size)){var w=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(w+x)/2}if((0,i.isObject)(b.size)){var w=b.size.width>b.size.height?b.size.width:b.size.height;return(w+x)/2}return(b.size+x)/2}return 10+x/2};else if((0,i.isFunction)(l))h=function(b){var x=l(b),w=d(b);if((0,i.isArray)(b.size)){var E=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(E+w)/2}return((x||10)+w)/2};else if((0,i.isArray)(l)){var v=l[0]>l[1]?l[0]:l[1],p=v/2;h=function(b){return p+d(b)/2}}else{var g=l/2;h=function(b){return g+d(b)/2}}this.nodeSize=h;var y=f.comboPadding,m;(0,i.isNumber)(y)?m=function(){return y}:(0,i.isArray)(y)?m=function(){return Math.max.apply(null,y)}:(0,i.isFunction)(y)?m=y:m=function(){return 0},this.comboPadding=m},u.prototype.getType=function(){return"comboCombined"},u}(n.Base);return Dl.ComboCombinedLayout=o,Dl}var Pl={},Vm={};Object.defineProperty(Vm,"__esModule",{value:!0});var vae=function(){function r(e){this.id=e.id||0,this.rx=e.rx,this.ry=e.ry,this.fx=0,this.fy=0,this.mass=e.mass,this.degree=e.degree,this.g=e.g||0}return r.prototype.distanceTo=function(e){var t=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(t,n)},r.prototype.setPos=function(e,t){this.rx=e,this.ry=t},r.prototype.resetForce=function(){this.fx=0,this.fy=0},r.prototype.addForce=function(e){var t=e.rx-this.rx,n=e.ry-this.ry,i=Math.hypot(t,n);i=i<1e-4?1e-4:i;var a=this.g*(this.degree+1)*(e.degree+1)/i;this.fx+=a*t/i,this.fy+=a*n/i},r.prototype.in=function(e){return e.contains(this.rx,this.ry)},r.prototype.add=function(e){var t=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/t,i=(this.ry*this.mass+e.ry*e.mass)/t,a=this.degree+e.degree,o={rx:n,ry:i,mass:t,degree:a};return new r(o)},r}();Vm.default=vae;var Hm={};Object.defineProperty(Hm,"__esModule",{value:!0});var pae=function(){function r(e){this.xmid=e.xmid,this.ymid=e.ymid,this.length=e.length,this.massCenter=e.massCenter||[0,0],this.mass=e.mass||1}return r.prototype.getLength=function(){return this.length},r.prototype.contains=function(e,t){var n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&t<=this.ymid+n&&t>=this.ymid-n},r.prototype.NW=function(){var e=this.xmid-this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.NE=function(){var e=this.xmid+this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.SW=function(){var e=this.xmid-this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.SE=function(){var e=this.xmid+this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r}();Hm.default=pae;var qm={};Object.defineProperty(qm,"__esModule",{value:!0});var gae=function(){function r(e){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,e!=null&&(this.quad=e)}return r.prototype.insert=function(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new r(this.quad.NW()),this.NE=new r(this.quad.NE()),this.SW=new r(this.quad.SW()),this.SE=new r(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e))},r.prototype._putBody=function(e){this.quad&&(e.in(this.quad.NW())&&this.NW?this.NW.insert(e):e.in(this.quad.NE())&&this.NE?this.NE.insert(e):e.in(this.quad.SW())&&this.SW?this.SW.insert(e):e.in(this.quad.SE())&&this.SE&&this.SE.insert(e))},r.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},r.prototype.updateForce=function(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{var t=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);t/n<this.theta?e.addForce(this.body):(this.NW&&this.NW.updateForce(e),this.NE&&this.NE.updateForce(e),this.SW&&this.SW.updateForce(e),this.SE&&this.SE.updateForce(e))}},r}();qm.default=gae;var yae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Zm=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pl,"__esModule",{value:!0}),Pl.ForceAtlas2Layout=void 0;var mae=Pr,ja=Ir(),bae=Zm(Vm),xae=Zm(Hm),wae=Zm(qm),Eae=function(r){yae(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.kr=5,n.kg=1,n.mode="normal",n.preventOverlap=!1,n.dissuadeHubs=!1,n.barnesHut=void 0,n.maxIteration=0,n.ks=.1,n.ksmax=10,n.tao=.1,n.onLayoutEnd=function(){},n.prune=void 0,n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.onLayoutEnd,a=t.prune,o=t.maxIteration;!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight);for(var s=[],u=n.length,f=0;f<u;f+=1){var l=n[f],c=10,h=10;(0,ja.isNumber)(l.size)&&(c=l.size,h=l.size),(0,ja.isArray)(l.size)?(isNaN(l.size[0])||(c=l.size[0]),isNaN(l.size[1])||(h=l.size[1])):(0,ja.isObject)(l.size)&&(c=l.size.width,h=l.size.height),t.getWidth&&!isNaN(t.getWidth(l))&&(h=t.getWidth(l)),t.getHeight&&!isNaN(t.getHeight(l))&&(c=t.getHeight(l));var d=Math.max(c,h);s.push(d)}t.barnesHut===void 0&&u>250&&(t.barnesHut=!0),t.prune===void 0&&u>100&&(t.prune=!0),this.maxIteration===0&&!t.prune?(o=250,u<=200&&u>100?o=1e3:u>200&&(o=1200),this.maxIteration=o):this.maxIteration===0&&a&&(o=100,u<=200&&u>100?o=500:u>200&&(o=950),this.maxIteration=o),t.kr||(t.kr=50,u>100&&u<=500?t.kr=20:u>500&&(t.kr=1)),t.kg||(t.kg=20,u>100&&u<=500?t.kg=10:u>500&&(t.kg=1)),this.nodes=t.updateNodesByForces(s),i()},e.prototype.updateNodesByForces=function(t){for(var n=this,i=n.edges,a=n.maxIteration,o=n.nodes,s=i.filter(function(_){var M=(0,ja.getEdgeTerminal)(_,"source"),C=(0,ja.getEdgeTerminal)(_,"target");return M!==C}),u=o.length,f=s.length,l=[],c={},h={},d=[],v=0;v<u;v+=1)c[o[v].id]=v,l[v]=0,(o[v].x===void 0||isNaN(o[v].x))&&(o[v].x=Math.random()*1e3),(o[v].y===void 0||isNaN(o[v].y))&&(o[v].y=Math.random()*1e3),d.push({x:o[v].x,y:o[v].y});for(var v=0;v<f;v+=1){for(var p=void 0,g=void 0,y=0,m=0,b=0;b<u;b+=1){var x=(0,ja.getEdgeTerminal)(s[v],"source"),w=(0,ja.getEdgeTerminal)(s[v],"target");o[b].id===x?(p=o[b],y=b):o[b].id===w&&(g=o[b],m=b),h[v]={sourceIdx:y,targetIdx:m}}p&&(l[c[p.id]]+=1),g&&(l[c[g.id]]+=1)}var E=a;if(o=this.iterate(E,c,h,f,l,t),n.prune){for(var b=0;b<f;b+=1)l[h[b].sourceIdx]<=1?(o[h[b].sourceIdx].x=o[h[b].targetIdx].x,o[h[b].sourceIdx].y=o[h[b].targetIdx].y):l[h[b].targetIdx]<=1&&(o[h[b].targetIdx].x=o[h[b].sourceIdx].x,o[h[b].targetIdx].y=o[h[b].sourceIdx].y);n.prune=!1,n.barnesHut=!1,E=100,o=this.iterate(E,c,h,f,l,t)}return o},e.prototype.iterate=function(t,n,i,a,o,s){for(var u=this,f=u.nodes,l=u.kr,c=u.preventOverlap,h=u.barnesHut,d=f.length,v=0,p=100,g=t,y=50,m=[],b=[],x=[],w=0;w<d;w+=1)if(m[2*w]=0,m[2*w+1]=0,h){var E={id:w,rx:f[w].x,ry:f[w].y,mass:1,g:l,degree:o[w]};x[w]=new bae.default(E)}for(;g>0;){for(var w=0;w<d;w+=1)b[2*w]=m[2*w],b[2*w+1]=m[2*w+1],m[2*w]=0,m[2*w+1]=0;m=this.getAttrForces(g,y,a,n,i,o,s,m),h&&(c&&g>y||!c)?m=this.getOptRepGraForces(m,x,o):m=this.getRepGraForces(g,y,m,p,s,o);var _=this.updatePos(m,b,v,o);f=_.nodes,v=_.sg,g--,u.tick&&u.tick()}return f},e.prototype.getAttrForces=function(t,n,i,a,o,s,u,f){for(var l=this,c=l.nodes,h=l.preventOverlap,d=l.dissuadeHubs,v=l.mode,p=l.prune,g=0;g<i;g+=1){var y=c[o[g].sourceIdx],m=o[g].sourceIdx,b=c[o[g].targetIdx],x=o[g].targetIdx;if(!(p&&(s[m]<=1||s[x]<=1))){var w=[b.x-y.x,b.y-y.y],E=Math.hypot(w[0],w[1]);E=E<1e-4?1e-4:E,w[0]=w[0]/E,w[1]=w[1]/E,h&&t<n&&(E=E-u[m]-u[x]);var _=E,M=_;v==="linlog"&&(_=Math.log(1+E),M=_),d&&(_=E/s[m],M=E/s[x]),h&&t<n&&E<=0?(_=0,M=0):h&&t<n&&E>0&&(_=E,M=E),f[2*a[y.id]]+=_*w[0],f[2*a[b.id]]-=M*w[0],f[2*a[y.id]+1]+=_*w[1],f[2*a[b.id]+1]-=M*w[1]}}return f},e.prototype.getRepGraForces=function(t,n,i,a,o,s){for(var u=this,f=u.nodes,l=u.preventOverlap,c=u.kr,h=u.kg,d=u.center,v=u.prune,p=f.length,g=0;g<p;g+=1){for(var y=g+1;y<p;y+=1)if(!(v&&(s[g]<=1||s[y]<=1))){var m=[f[y].x-f[g].x,f[y].y-f[g].y],b=Math.hypot(m[0],m[1]);b=b<1e-4?1e-4:b,m[0]=m[0]/b,m[1]=m[1]/b,l&&t<n&&(b=b-o[g]-o[y]);var x=c*(s[g]+1)*(s[y]+1)/b;l&&t<n&&b<0?x=a*(s[g]+1)*(s[y]+1):l&&t<n&&b===0?x=0:l&&t<n&&b>0&&(x=c*(s[g]+1)*(s[y]+1)/b),i[2*g]-=x*m[0],i[2*y]+=x*m[0],i[2*g+1]-=x*m[1],i[2*y+1]+=x*m[1]}var w=[f[g].x-d[0],f[g].y-d[1]],E=Math.hypot(w[0],w[1]);w[0]=w[0]/E,w[1]=w[1]/E;var _=h*(s[g]+1);i[2*g]-=_*w[0],i[2*g+1]-=_*w[1]}return i},e.prototype.getOptRepGraForces=function(t,n,i){for(var a=this,o=a.nodes,s=a.kg,u=a.center,f=a.prune,l=o.length,c=9e10,h=-9e10,d=9e10,v=-9e10,p=0;p<l;p+=1)f&&i[p]<=1||(n[p].setPos(o[p].x,o[p].y),o[p].x>=h&&(h=o[p].x),o[p].x<=c&&(c=o[p].x),o[p].y>=v&&(v=o[p].y),o[p].y<=d&&(d=o[p].y));for(var g=Math.max(h-c,v-d),y={xmid:(h+c)/2,ymid:(v+d)/2,length:g,massCenter:u,mass:l},m=new xae.default(y),b=new wae.default(m),p=0;p<l;p+=1)f&&i[p]<=1||n[p].in(m)&&b.insert(n[p]);for(var p=0;p<l;p+=1)if(!(f&&i[p]<=1)){n[p].resetForce(),b.updateForce(n[p]),t[2*p]-=n[p].fx,t[2*p+1]-=n[p].fy;var x=[o[p].x-u[0],o[p].y-u[1]],w=Math.hypot(x[0],x[1]);w=w<1e-4?1e-4:w,x[0]=x[0]/w,x[1]=x[1]/w;var E=s*(i[p]+1);t[2*p]-=E*x[0],t[2*p+1]-=E*x[1]}return t},e.prototype.updatePos=function(t,n,i,a){for(var o=this,s=o.nodes,u=o.ks,f=o.tao,l=o.prune,c=o.ksmax,h=s.length,d=[],v=[],p=0,g=0,y=0;y<h;y+=1)if(!(l&&a[y]<=1)){var m=[t[2*y]-n[2*y],t[2*y+1]-n[2*y+1]],b=Math.hypot(m[0],m[1]),x=[t[2*y]+n[2*y],t[2*y+1]+n[2*y+1]],w=Math.hypot(x[0],x[1]);d[y]=b,v[y]=w/2,p+=(a[y]+1)*d[y],g+=(a[y]+1)*v[y]}var E=i;i=f*g/p,E!==0&&(i=i>1.5*E?1.5*E:i);for(var y=0;y<h;y+=1)if(!(l&&a[y]<=1)&&!((0,ja.isNumber)(s[y].fx)&&(0,ja.isNumber)(s[y].fy))){var _=u*i/(1+i*Math.sqrt(d[y])),M=Math.hypot(t[2*y],t[2*y+1]);M=M<1e-4?1e-4:M;var C=c/M;_=_>C?C:_;var S=_*t[2*y],A=_*t[2*y+1];s[y].x+=S,s[y].y+=A}return{nodes:s,sg:i}},e}(mae.Base);Pl.ForceAtlas2Layout=Eae;var Rl={},Km={},Qm={},Jm={},Fu=xe&&xe.__assign||function(){return Fu=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Fu.apply(this,arguments)};Object.defineProperty(Jm,"__esModule",{value:!0});var _ae=function(){function r(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return r.prototype.init=function(e,t,n){this.cells=[],this.CELL_W=n.CELL_W||r.DEFAULT_CELL_W,this.CELL_H=n.CELL_H||r.DEFAULT_CELL_H,this.columnNum=Math.ceil(e/this.CELL_W),this.rowNum=Math.ceil(t/this.CELL_H),r.MIN_DIST=Math.pow(e,2)+Math.pow(t,2);for(var i=0;i<this.columnNum;i++){for(var a=[],o=0;o<this.rowNum;o++){var s={dx:i,dy:o,x:i*this.CELL_W,y:o*this.CELL_H,occupied:!1};a.push(s)}this.cells.push(a)}},r.prototype.findGridByNodeId=function(e){for(var t,n,i=0;i<this.columnNum;i++)for(var a=0;a<this.rowNum;a++)if(this.cells[i][a].node&&((n=(t=this.cells[i][a])===null||t===void 0?void 0:t.node)===null||n===void 0?void 0:n.id)===e)return{column:i,row:a};return null},r.prototype.sqdist=function(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)},r.prototype.occupyNearest=function(e){for(var t=r.MIN_DIST,n,i=null,a=0;a<this.columnNum;a++)for(var o=0;o<this.rowNum;o++)!this.cells[a][o].occupied&&(n=this.sqdist(e,this.cells[a][o]))<t&&(t=n,i=this.cells[a][o]);return i&&(i.occupied=!0),i},r.prototype.insertColumn=function(e,t){if(!(t<=0)){for(var n=0;n<t;n++){this.cells[n+this.columnNum]=[];for(var i=0;i<this.rowNum;i++)this.cells[n+this.columnNum][i]={dx:n,dy:i,x:n*this.CELL_W,y:i*this.CELL_H,occupied:!1,node:null}}for(var n=this.columnNum-1;n>e;n--)for(var i=0;i<this.rowNum;i++)this.cells[n+t][i]=Fu(Fu({},this.cells[n][i]),{x:(n+t)*this.CELL_W,y:i*this.CELL_H}),this.cells[n][i]={x:n*this.CELL_W,y:i*this.CELL_H,occupied:!0,node:null};for(var i=0;i<this.additionColumn.length;i++)this.additionColumn[i]>=e&&(this.additionColumn[i]+=t);for(var n=0;n<t;n++)this.additionColumn.push(e+n+1);this.columnNum+=t}},r.prototype.insertRow=function(e,t){if(!(t<=0)){for(var n=0;n<t;n++)for(var i=0;i<this.columnNum;i++)this.cells[i][n+this.rowNum]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var i=0;i<this.columnNum;i++)for(var n=this.rowNum-1;n>e;n--)this.cells[i][n+t]=Fu(Fu({},this.cells[i][n]),{dx:i,dy:n+t,x:i*this.CELL_W,y:(n+t)*this.CELL_H}),this.cells[i][n]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var n=0;n<this.additionRow.length;n++)this.additionRow[n]>=e&&(this.additionRow[n]+=t);for(var i=0;i<t;i++)this.additionRow.push(e+i+1);this.rowNum+=t}},r.prototype.getNodes=function(){for(var e=[],t=0;t<this.columnNum;t++)for(var n=0;n<this.rowNum;n++)this.cells[t][n].node&&e.push(this.cells[t][n]);return e},r.MIN_DIST=50,r.DEFAULT_CELL_W=80,r.DEFAULT_CELL_H=80,r}();Jm.default=_ae;var Sae=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qm,"__esModule",{value:!0});var Mae=Sae(Jm);function Cae(r,e){if(!r.nodes||r.nodes.length===0)return r;var t=e.width,n=e.height,i=e.nodeMinGap,a=1e4,o=1e4;r.nodes.forEach(function(m){var b=m.size[0]||50,x=m.size[1]||50;a=Math.min(b,a),o=Math.min(x,o)});var s=new Mae.default;s.init(t,n,{CELL_H:o,CELL_W:a}),r.nodes.forEach(function(m){var b=s.occupyNearest(m);b&&(b.node={id:m.id,size:m.size},m.x=b.x,m.y=b.y,m.dx=b.dx,m.dy=b.dy)});for(var u=0;u<r.nodes.length;u++){var f=r.nodes[u],l=s.findGridByNodeId(f.id);if(!l)throw new Error("can not find node cell");var c=l.column,h=l.row;if(f.size[0]+i>a){for(var d=Math.ceil((f.size[0]+i)/a)-1,v=d,p=0;p<d;p++){var g=s.additionColumn.indexOf(c+p+1)>-1;if(g&&!s.cells[c+p+1][h].node)v--;else break}s.insertColumn(c,v)}if(f.size[1]+i>o){for(var d=Math.ceil((f.size[1]+i)/o)-1,v=d,p=0;p<d;p++){var g=s.additionRow.indexOf(h+p+1)>-1;if(g&&!s.cells[c][h+p+1].node)v--;else break}s.insertRow(h,v)}}for(var u=0;u<s.columnNum;u++)for(var y=function(b){var x=s.cells[u][b];if(x.node){var w=r.nodes.find(function(E){var _;return E.id===((_=x==null?void 0:x.node)===null||_===void 0?void 0:_.id)});w&&(w.x=x.x+w.size[0]/2,w.y=x.y+w.size[1]/2)}},p=0;p<s.rowNum;p++)y(p)}Qm.default=Cae;var e1={};Object.defineProperty(e1,"__esModule",{value:!0});var Vk=1200,Hk=800,xv=1e7,Bl=10,qk=3.141592653589793,t1=1.5707963267948966,Aae=qk*.375,Tae=qk*.625,wv=new Map,Iae=10,kae=10,r1=.8,Zk=.1,Lae=.5;function Nae(r,e,t){var n=r.x-r.size[0]/2,i=r.y-r.size[1]/2,a=r.x+r.size[0]/2,o=r.y+r.size[1]/2,s=e.x-e.size[0]/2,u=e.y-e.size[1]/2,f=e.x+e.size[0]/2,l=e.y+e.size[1]/2,c=r.x,h=r.y,d=e.x,v=e.y,p=d-c,g=Math.atan2(p,v-h),y=0,m=0,b=0,x=0;g>t1?(m=i-l,y=s-a,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):0<g&&g<=t1?(m=u-o,y=s-a,m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):g<-t1?(m=i-l,y=-(f-n),m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):(m=u-o,Math.abs(p)>(a-n)/2?y=n-f:y=p,m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y&&g!==0?(y/Math.sin(g)).toFixed(2):m.toFixed(2)));var w=parseFloat(g.toFixed(2)),E=t;return t&&(E=Aae<w&&w<Tae),{distance:Math.abs(b<x?b:x),isHoriz:E}}function Kk(r,e){var t=wv.get(r.id)||[],n=t.find(function(D){return D.source===e.id||D.target===e.id}),i=r.size[0]*r.size[1],a=e.size[0]*e.size[1],o=i>a?e:r,s=i>a?r:e,u=o.x-o.size[0]/2,f=o.y-o.size[1]/2,l=o.x+o.size[0]/2,c=o.y+o.size[1]/2,h=s.x-s.size[0]/2,d=s.y-s.size[1]/2,v=s.x+s.size[0]/2,p=s.y+s.size[1]/2,g=o.x,y=o.y,m=s.x,b=s.y,x=l>=h&&v>=u&&c>=d&&p>=f,w=0,E=0;if(x){E=Math.sqrt(Math.pow(m-g,2)+Math.pow(b-y,2));var _=u>h?u:h,M=f>d?f:d,C=l<v?l:v,S=c<p?c:p,A=C-_,T=S-M,k=A*T;E===0&&(E=1e-7),w=Bl*1/E*100+k,w*=xv}else{var O=!1,G=Nae(o,s,O);E=G.distance,O=G.isHoriz,E<=Bl?E!==0?n?w+=Bl+xv*1/E:w+=Bl+xv*Bl/E:w+=xv:(w+=E,n&&(w+=E*E))}return w}function Qk(r){for(var e=0,t=0;t<r.length;t++){var n=r[t];(n.x<0||n.y<0||n.x>Vk||n.y>Hk)&&(e+=1e12);for(var i=t+1;i<r.length;i++)e+=Kk(n,r[i])}return e}function Oae(r,e,t,n){var i=new Map;t.forEach(function(g,y){i.set(g.id,g)});var a=n.filter(function(g){return g.source===r.id||g.target===r.id})||[],o=[];a.forEach(function(g){var y=g.source===r.id?g.target:g.source,m=i.get(y);m&&o.push(m)});for(var s=!0,u=0;u<o.length;u++){var f=o[u],l=Math.atan((r.y-f.y)/(f.x-r.y))*180,c=Math.atan((e.y-f.y)/(f.x-e.y))*180,h=l<30||l>150,d=c<30||c>150,v=l>70&&l<110,p=c>70&&c<110;if(h&&!d||l*c<0){s=!1;break}else if(v&&!p||l*c<0){s=!1;break}else if((f.x-r.x)*(f.x-e.x)<0){s=!1;break}else if((f.y-r.y)*(f.y-e.y)<0){s=!1;break}}return s}function Dae(r,e){for(var t=!1,n=1,i=Iae*n,a=kae*n,o=[i,-i,0,0],s=[0,0,a,-a],u=0;u<r.length;++u)for(var f=r[u],l=Jk(f,r),c=0;c<o.length;c++){var h=Oae(f,{x:f.x+o[c],y:f.y+s[c]},r,e);if(h){f.x+=o[c],f.y+=s[c];var d=Jk(f,r),v=Math.random();d<l||v<r1&&v>Zk?(l=d,t=!0):(f.x-=o[c],f.y-=s[c])}}return r1>Zk&&(r1*=Lae),t?Qk(r):0}function Jk(r,e){var t=0;(r.x<0||r.y<0||r.x+r.size[0]+20>Vk||r.y+r.size[1]+20>Hk)&&(t+=1e12);for(var n=0;n<e.length;++n)r.id!==e[n].id&&(t+=Kk(r,e[n]));return t}function Pae(r,e){if(r.length===0)return{nodes:r,edges:e};r.forEach(function(f){var l=e.filter(function(c){return c.source===f.id||c.target===f.id});wv.set(f,l)}),r.sort(function(f,l){var c,h;return((c=wv.get(f.id))===null||c===void 0?void 0:c.length)-((h=wv.get(l.id))===null||h===void 0?void 0:h.length)});for(var t=Qk(r),n=20,i=1,a=0,o=50,s=0;n>0&&(s++,!(s>=o));){var u=Dae(r,e);u!==0&&(a=u),i=a-t,t=a,i===0?--n:n=20}return r.forEach(function(f){f.x=f.x-f.size[0]/2,f.y=f.y-f.size[1]/2}),{nodes:r,edges:e}}e1.default=Pae;var n1=xe&&xe.__assign||function(){return n1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},n1.apply(this,arguments)},Rae=xe&&xe.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Bae=xe&&xe.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Fae=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Rae(e,r,t);return Bae(e,r),e},eL=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Km,"__esModule",{value:!0});var Gu=Fae(H0),Gae=eL(Qm),zae=eL(e1),$ae=fu;function jae(r,e){var t=r.nodes,n=r.edges,i=e.width,a=e.height;if(!(t!=null&&t.length))return Promise.resolve();var o=[];t.forEach(function(v){var p=n.filter(function(y){return y.source===v.id||y.target===v.id});if(p.length>1){var g=n1({},v);delete g.size,o.push(g)}});var s=[];n.forEach(function(v){var p=o.find(function(y){return y.id===v.source}),g=o.find(function(y){return y.id===v.target});p&&g&&s.push(v)});var u=new $ae.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}),f=u.layout({nodes:o,edges:s}).nodes;t.forEach(function(v){var p=(f||[]).find(function(g){return g.id===v.id});v.x=(p==null?void 0:p.x)||i/2,v.y=(p==null?void 0:p.y)||a/2});var l=JSON.parse(JSON.stringify(t)),c=JSON.parse(JSON.stringify(n)),h=Gu.forceSimulation().nodes(l).force("link",Gu.forceLink(c).id(function(v){return v.id}).distance(function(v){var p=s.find(function(g){return g.source===v.source&&g.target===v.target});return p?30:20})).force("charge",Gu.forceManyBody()).force("center",Gu.forceCenter(i/2,a/2)).force("x",Gu.forceX(i/2)).force("y",Gu.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise(function(v){h.on("end",function(){t.forEach(function(w){var E=l.find(function(_){return _.id===w.id});E&&(w.x=E.x,w.y=E.y)});var p=Math.min.apply(Math,t.map(function(w){return w.x})),g=Math.max.apply(Math,t.map(function(w){return w.x})),y=Math.min.apply(Math,t.map(function(w){return w.y})),m=Math.max.apply(Math,t.map(function(w){return w.y})),b=i/(g-p),x=a/(m-y);t.forEach(function(w){w.x!==void 0&&b<1&&(w.x=(w.x-p)*b),w.y!==void 0&&x<1&&(w.y=(w.y-y)*x)}),t.forEach(function(w){w.sizeTemp=w.size,w.size=[10,10]}),(0,zae.default)(t,n),t.forEach(function(w){w.size=w.sizeTemp||[],delete w.sizeTemp}),(0,Gae.default)({nodes:t,edges:n},e),v()})});return d}Km.default=jae;var Uae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Xae=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.ERLayout=void 0;var Yae=Pr,Wae=Xae(Km),Vae=function(r){Uae(e,r);function e(t){var n=r.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},t&&n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges;return n==null||n.forEach(function(a){a.size||(a.size=[50,50])}),(0,Wae.default)({nodes:n,edges:i},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){t.onLayoutEnd&&t.onLayoutEnd()})},e.prototype.getType=function(){return"er"},e}(Yae.Base);Rl.ERLayout=Vae;var ys={},tL;function Hae(){if(tL)return ys;tL=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.Layouts=ys.Layout=void 0;var r=Ia,e=qf,t=Zf,n=Qf,i=Kf,a=Y0,o=nl,s=fu,u=Om,f=wl,l=El,c=Sl,h=Ml,d=Nl,v=Ol,p=Wk(),g=Pl,y=Rl,m=ll,b=Ir(),x=function(){function w(E){var _=(0,r.getLayoutByName)(E.type);this.layoutInstance=new _(E)}return w.prototype.layout=function(E){return this.layoutInstance.layout(E)},w.prototype.updateCfg=function(E){this.layoutInstance.updateCfg(E)},w.prototype.init=function(E){this.correctLayers(E.nodes),this.layoutInstance.init(E)},w.prototype.correctLayers=function(E){if(E!=null&&E.length){var _=1/0,M=[];if(E.forEach(function(S){(0,b.isString)(S.layer)&&(S.layer=parseInt(S.layer,10)),!(S.layer===void 0||isNaN(S.layer))&&(M.push(S),S.layer<_&&(_=S.layer))}),_<=0){var C=Math.abs(_)+1;M.forEach(function(S){return S.layer+=C})}}},w.prototype.execute=function(){this.layoutInstance.execute()},w.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},w.prototype.destroy=function(){return this.layoutInstance.destroy()},w}();return ys.Layout=x,ys.Layouts={force:a.ForceLayout,fruchterman:c.FruchtermanLayout,forceAtlas2:g.ForceAtlas2Layout,gForce:i.GForceLayout,force2:n.Force2Layout,dagre:s.DagreLayout,dagreCompound:m.DagreCompoundLayout,circular:o.CircularLayout,radial:u.RadialLayout,concentric:f.ConcentricLayout,grid:e.GridLayout,mds:l.MDSLayout,comboForce:v.ComboForceLayout,comboCombined:p.ComboCombinedLayout,random:t.RandomLayout,"gForce-gpu":d.GForceGPULayout,"fruchterman-gpu":h.FruchtermanGPULayout,er:y.ERLayout},ys}var rL={};Object.defineProperty(rL,"__esModule",{value:!0});var nL;function iL(){return nL||(nL=1,function(r){var e=xe&&xe.__createBinding||(Object.create?function(E,_,M,C){C===void 0&&(C=M);var S=Object.getOwnPropertyDescriptor(_,M);(!S||("get"in S?!_.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return _[M]}}),Object.defineProperty(E,C,S)}:function(E,_,M,C){C===void 0&&(C=M),E[C]=_[M]}),t=xe&&xe.__exportStar||function(E,_){for(var M in E)M!=="default"&&!Object.prototype.hasOwnProperty.call(_,M)&&e(_,E,M)};Object.defineProperty(r,"__esModule",{value:!0}),r.ERLayout=r.ForceAtlas2Layout=r.ComboCombinedLayout=r.ComboForceLayout=r.GForceGPULayout=r.FruchtermanGPULayout=r.FruchtermanLayout=r.MDSLayout=r.ConcentricLayout=r.RadialLayout=r.DagreCompoundLayout=r.DagreLayout=r.CircularLayout=r.ForceLayout=r.Force2Layout=r.GForceLayout=r.RandomLayout=r.GridLayout=r.Layouts=r.Layout=void 0;var n=qf;Object.defineProperty(r,"GridLayout",{enumerable:!0,get:function(){return n.GridLayout}});var i=Zf;Object.defineProperty(r,"RandomLayout",{enumerable:!0,get:function(){return i.RandomLayout}});var a=Kf;Object.defineProperty(r,"GForceLayout",{enumerable:!0,get:function(){return a.GForceLayout}});var o=Qf;Object.defineProperty(r,"Force2Layout",{enumerable:!0,get:function(){return o.Force2Layout}});var s=Y0;Object.defineProperty(r,"ForceLayout",{enumerable:!0,get:function(){return s.ForceLayout}});var u=nl;Object.defineProperty(r,"CircularLayout",{enumerable:!0,get:function(){return u.CircularLayout}});var f=fu;Object.defineProperty(r,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var l=ll;Object.defineProperty(r,"DagreCompoundLayout",{enumerable:!0,get:function(){return l.DagreCompoundLayout}});var c=Om;Object.defineProperty(r,"RadialLayout",{enumerable:!0,get:function(){return c.RadialLayout}});var h=wl;Object.defineProperty(r,"ConcentricLayout",{enumerable:!0,get:function(){return h.ConcentricLayout}});var d=El;Object.defineProperty(r,"MDSLayout",{enumerable:!0,get:function(){return d.MDSLayout}});var v=Sl;Object.defineProperty(r,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var p=Ml;Object.defineProperty(r,"FruchtermanGPULayout",{enumerable:!0,get:function(){return p.FruchtermanGPULayout}});var g=Nl;Object.defineProperty(r,"GForceGPULayout",{enumerable:!0,get:function(){return g.GForceGPULayout}});var y=Ol;Object.defineProperty(r,"ComboForceLayout",{enumerable:!0,get:function(){return y.ComboForceLayout}});var m=Wk();Object.defineProperty(r,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var b=Pl;Object.defineProperty(r,"ForceAtlas2Layout",{enumerable:!0,get:function(){return b.ForceAtlas2Layout}});var x=Rl;Object.defineProperty(r,"ERLayout",{enumerable:!0,get:function(){return x.ERLayout}});var w=Hae();Object.defineProperty(r,"Layout",{enumerable:!0,get:function(){return w.Layout}}),Object.defineProperty(r,"Layouts",{enumerable:!0,get:function(){return w.Layouts}}),t(rL,r)}($0)),$0}(function(r){var e=xe&&xe.__createBinding||(Object.create?function(i,a,o,s){s===void 0&&(s=o);var u=Object.getOwnPropertyDescriptor(a,o);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,s,u)}:function(i,a,o,s){s===void 0&&(s=o),i[s]=a[o]}),t=xe&&xe.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&e(a,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),r.getLayoutByName=r.unRegisterLayout=r.registerLayout=void 0;var n=Ia;Object.defineProperty(r,"registerLayout",{enumerable:!0,get:function(){return n.registerLayout}}),Object.defineProperty(r,"unRegisterLayout",{enumerable:!0,get:function(){return n.unRegisterLayout}}),Object.defineProperty(r,"getLayoutByName",{enumerable:!0,get:function(){return n.getLayoutByName}}),t(iL(),r)})(Ht);function qae(r,e,t,n){return n===void 0&&(n="height"),t==="center"?(r[n]+e[n])/2:r.height}var Mo={assign:Object.assign,getHeight:qae},aL=Mo,i1=18,Zae=i1*2,oL=i1,Kae={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||oL},getVGap:function(e){return e.vgap||oL},getChildren:function(e){return e.children},getHeight:function(e){return e.height||Zae},getWidth:function(e){var t=e.label||" ";return e.width||t.split("").length*i1}};function Ev(r,e){var t=this;if(t.vgap=t.hgap=0,r instanceof Ev)return r;t.data=r;var n=e.getHGap(r),i=e.getVGap(r);return t.preH=e.getPreH(r),t.preV=e.getPreV(r),t.width=e.getWidth(r),t.height=e.getHeight(r),t.width+=t.preH,t.height+=t.preV,t.id=e.getId(r),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(n,i),t}aL.assign(Ev.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(e,t){var n=this;n.hgap+=e,n.vgap+=t,n.width+=2*e,n.height+=2*t},eachNode:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=i.children.concat(n)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=n.concat(i.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(t){e.left=Math.min(e.left,t.x),e.top=Math.min(e.top,t.y),e.width=Math.max(e.width,t.x+t.width),e.height=Math.max(e.height,t.y+t.height)}),e},translate:function(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.eachNode(function(n){n.x+=e,n.y+=t,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.x=n.x-(n.x-t.left)*2-n.width}),e.translate(t.width,0)},bottom2top:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.y=n.y-(n.y-t.top)*2-n.height}),e.translate(0,t.height)}});function Qae(r,e,t){e===void 0&&(e={}),e=aL.assign({},Kae,e);var n=new Ev(r,e),i=[n],a;if(!t&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){var o=e.getChildren(a.data),s=o?o.length:0;if(a.children=new Array(s),o&&s)for(var u=0;u<s;u++){var f=new Ev(o[u],e);a.children[u]=f,i.push(f),f.parent=a,f.depth=a.depth+1}}}return n}var sL=Qae,Jae=sL,eoe=function(){function r(t,n){n===void 0&&(n={});var i=this;i.options=n,i.rootNode=Jae(t,n)}var e=r.prototype;return e.execute=function(){throw new Error("please override this method")},r}(),_v=eoe;function Fl(r,e,t,n){n===void 0&&(n=[]);var i=this;i.w=r||0,i.h=e||0,i.y=t||0,i.x=0,i.c=n||[],i.cs=n.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}Fl.fromNode=function(r,e){if(!r)return null;var t=[];return r.children.forEach(function(n){t.push(Fl.fromNode(n,e))}),e?new Fl(r.height,r.width,r.x,t):new Fl(r.width,r.height,r.y,t)};function uL(r,e,t){t?r.y+=e:r.x+=e,r.children.forEach(function(n){uL(n,e,t)})}function fL(r,e){var t=e?r.y:r.x;return r.children.forEach(function(n){t=Math.min(fL(n,e),t)}),t}function toe(r,e){var t=fL(r,e);uL(r,-t,e)}function lL(r,e,t){t?e.y=r.x:e.x=r.x,r.c.forEach(function(n,i){lL(n,e.children[i],t)})}function cL(r,e,t){t===void 0&&(t=0),e?(r.x=t,t+=r.width):(r.y=t,t+=r.height),r.children.forEach(function(n){cL(n,e,t)})}var roe=function(r,e){e===void 0&&(e={});var t=e.isHorizontal;function n(m){if(m.cs===0){i(m);return}n(m.c[0]);for(var b=g(f(m.c[0].el),0,null),x=1;x<m.cs;++x){n(m.c[x]);var w=f(m.c[x].er);a(m,x,b),b=g(w,x,b)}h(m),i(m)}function i(m){m.cs===0?(m.el=m,m.er=m,m.msel=m.mser=0):(m.el=m.c[0].el,m.msel=m.c[0].msel,m.er=m.c[m.cs-1].er,m.mser=m.c[m.cs-1].mser)}function a(m,b,x){for(var w=m.c[b-1],E=w.mod,_=m.c[b],M=_.mod;w!==null&&_!==null;){f(w)>x.low&&(x=x.nxt);var C=E+w.prelim+w.w-(M+_.prelim);C>0&&(M+=C,o(m,b,x.index,C));var S=f(w),A=f(_);S<=A&&(w=u(w),w!==null&&(E+=w.mod)),S>=A&&(_=s(_),_!==null&&(M+=_.mod))}!w&&_?l(m,b,_,M):w&&!_&&c(m,b,w,E)}function o(m,b,x,w){m.c[b].mod+=w,m.c[b].msel+=w,m.c[b].mser+=w,v(m,b,x,w)}function s(m){return m.cs===0?m.tl:m.c[0]}function u(m){return m.cs===0?m.tr:m.c[m.cs-1]}function f(m){return m.y+m.h}function l(m,b,x,w){var E=m.c[0].el;E.tl=x;var _=w-x.mod-m.c[0].msel;E.mod+=_,E.prelim-=_,m.c[0].el=m.c[b].el,m.c[0].msel=m.c[b].msel}function c(m,b,x,w){var E=m.c[b].er;E.tr=x;var _=w-x.mod-m.c[b].mser;E.mod+=_,E.prelim-=_,m.c[b].er=m.c[b-1].er,m.c[b].mser=m.c[b-1].mser}function h(m){m.prelim=(m.c[0].prelim+m.c[0].mod+m.c[m.cs-1].mod+m.c[m.cs-1].prelim+m.c[m.cs-1].w)/2-m.w/2}function d(m,b){b+=m.mod,m.x=m.prelim+b,p(m);for(var x=0;x<m.cs;x++)d(m.c[x],b)}function v(m,b,x,w){if(x!==b-1){var E=b-x;m.c[x+1].shift+=w/E,m.c[b].shift-=w/E,m.c[b].change-=w-w/E}}function p(m){for(var b=0,x=0,w=0;w<m.cs;w++)b+=m.c[w].shift,x+=b+m.c[w].change,m.c[w].mod+=x}function g(m,b,x){for(;x!==null&&m>=x.low;)x=x.nxt;return{low:m,index:b,nxt:x}}cL(r,t);var y=Fl.fromNode(r,t);return n(y),d(y,0),lL(y,r,t),toe(r,t),r},hL=sL,dL=function(r,e){for(var t=hL(r.data,e,!0),n=hL(r.data,e,!0),i=r.children.length,a=Math.round(i/2),o=e.getSide||function(l,c){return c<a?"right":"left"},s=0;s<i;s++){var u=r.children[s],f=o(u,s);f==="right"?n.children.push(u):t.children.push(u)}return t.eachNode(function(l){l.isRoot()||(l.side="left")}),n.eachNode(function(l){l.isRoot()||(l.side="right")}),{left:t,right:n}},noe=dL,Co=["LR","RL","TB","BT","H","V"],ioe=["LR","RL","H"],aoe=function(e){return ioe.indexOf(e)>-1},ooe=Co[0],a1=function(r,e,t){var n=e.direction||ooe;if(e.isHorizontal=aoe(n),n&&Co.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===Co[0])t(r,e);else if(n===Co[1])t(r,e),r.right2left();else if(n===Co[2])t(r,e);else if(n===Co[3])t(r,e),r.bottom2top();else if(n===Co[4]||n===Co[5]){var i=noe(r,e),a=i.left,o=i.right;t(a,e),t(o,e),e.isHorizontal?a.right2left():a.bottom2top(),o.translate(a.x-o.x,a.y-o.y),r.x=a.x,r.y=o.y;var s=r.getBoundingBox();e.isHorizontal?s.top<0&&r.translate(0,-s.top):s.left<0&&r.translate(-s.left,0)}var u=e.fixedRoot;return u===void 0&&(u=!0),u&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),soe(r,e),r};function soe(r,e){if(e.radial){var t=e.isHorizontal?["x","y"]:["y","x"],n=t[0],i=t[1],a={x:1/0,y:1/0},o={x:-1/0,y:-1/0},s=0;r.DFTraverse(function(l){s++;var c=l.x,h=l.y;a.x=Math.min(a.x,c),a.y=Math.min(a.y,h),o.x=Math.max(o.x,c),o.y=Math.max(o.y,h)});var u=o[i]-a[i];if(u===0)return;var f=Math.PI*2/s;r.DFTraverse(function(l){var c=(l[i]-a[i])/u*(Math.PI*2-f)+f,h=l[n]-r[n];l.x=Math.cos(c)*h,l.y=Math.sin(c)*h})}}function uoe(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,o1(r,e)}function o1(r,e){return o1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},o1(r,e)}var foe=_v,loe=roe,coe=a1,hoe=Mo,doe=function(r){function e(){return r.apply(this,arguments)||this}uoe(e,r);var t=e.prototype;return t.execute=function(){var i=this;return coe(i.rootNode,i.options,loe)},e}(foe),voe={};function poe(r,e){return e=hoe.assign({},voe,e),new doe(r,e).execute()}var goe=poe,yoe=Mo;function moe(r,e){e===void 0&&(e=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=e}var boe={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function vL(r,e,t){t?(e.x=r.x,e.y=r.y):(e.x=r.y,e.y=r.x),r.children.forEach(function(n,i){vL(n,e.children[i],t)})}var xoe=function(r,e){e===void 0&&(e={}),e=yoe.assign({},boe,e);var t=0;function n(u){if(!u)return null;u.width=0,u.depth&&u.depth>t&&(t=u.depth);var f=u.children,l=f.length,c=new moe(u.height,[]);return f.forEach(function(h,d){var v=n(h);c.children.push(v),d===0&&(c.leftChild=v),d===l-1&&(c.rightChild=v)}),c.originNode=u,c.isLeaf=u.isLeaf(),c}function i(u){if(u.isLeaf||u.children.length===0)u.drawingDepth=t;else{var f=u.children.map(function(c){return i(c)}),l=Math.min.apply(null,f);u.drawingDepth=l-1}return u.drawingDepth}var a;function o(u){u.x=u.drawingDepth*e.rankSep,u.isLeaf?(u.y=0,a&&(u.y=a.y+a.height+e.nodeSep,u.originNode.parent!==a.originNode.parent&&(u.y+=e.subTreeSep)),a=u):(u.children.forEach(function(f){o(f)}),u.y=(u.leftChild.y+u.rightChild.y)/2)}var s=n(r);return i(s),o(s),vL(s,r,e.isHorizontal),r};function woe(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,s1(r,e)}function s1(r,e){return s1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},s1(r,e)}var Eoe=_v,_oe=xoe,Soe=a1,Moe=Mo,Coe=function(r){function e(){return r.apply(this,arguments)||this}woe(e,r);var t=e.prototype;return t.execute=function(){var i=this;return i.rootNode.width=0,Soe(i.rootNode,i.options,_oe)},e}(Eoe),Aoe={};function Toe(r,e){return e=Moe.assign({},Aoe,e),new Coe(r,e).execute()}var Ioe=Toe,pL=Mo;function koe(r,e,t,n,i){var a=(typeof t=="function"?t(r):t)*r.depth;if(!n)try{if(r.id===r.parent.children[0].id){r.x+=a,r.y=e?e.y:0;return}}catch{}if(r.x+=a,e){if(r.y=e.y+pL.getHeight(e,r,i),e.parent&&r.parent.id!==e.parent.id){var o=e.parent,s=o.y+pL.getHeight(o,r,i);r.y=s>r.y?s:r.y}}else r.y=0}var Loe=function(r,e,t,n){var i=null;r.eachNode(function(a){koe(a,i,e,t,n),i=a})};function Noe(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,u1(r,e)}function u1(r,e){return u1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},u1(r,e)}var Ooe=_v,Sv=Loe,Doe=dL,Poe=Mo,Gl=["LR","RL","H"],Roe=Gl[0],Boe=function(r){function e(){return r.apply(this,arguments)||this}Noe(e,r);var t=e.prototype;return t.execute=function(){var i=this,a=i.options,o=i.rootNode;a.isHorizontal=!0;var s=a.indent,u=s===void 0?20:s,f=a.dropCap,l=f===void 0?!0:f,c=a.direction,h=c===void 0?Roe:c,d=a.align;if(h&&Gl.indexOf(h)===-1)throw new TypeError("Invalid direction: "+h);if(h===Gl[0])Sv(o,u,l,d);else if(h===Gl[1])Sv(o,u,l,d),o.right2left();else if(h===Gl[2]){var v=Doe(o,a),p=v.left,g=v.right;Sv(p,u,l,d),p.right2left(),Sv(g,u,l,d);var y=p.getBoundingBox();g.translate(y.width,0),o.x=g.x-o.width/2}return o},e}(Ooe),Foe={};function Goe(r,e){return e=Poe.assign({},Foe,e),new Boe(r,e).execute()}var zoe=Goe,$oe=Mo;function gL(r,e){var t=0;return r.children.length?r.children.forEach(function(n){t+=gL(n,e)}):t=r.height,r._subTreeSep=e.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,t)+2*r._subTreeSep,r.totalHeight}function yL(r){var e=r.children,t=e.length;if(t){e.forEach(function(u){yL(u)});var n=e[0],i=e[t-1],a=i.y-n.y+i.height,o=0;if(e.forEach(function(u){o+=u.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(e.length!==1||r.height>o){var s=r.y+(r.height-a)/2-n.y;e.forEach(function(u){u.translate(0,s)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}var joe={getSubTreeSep:function(){return 0}},Uoe=function(r,e){e===void 0&&(e={}),e=$oe.assign({},joe,e),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(function(t){t.x=t.parent.x+t.parent.width}),r.parent=null,gL(r,e),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(function(t){var n=t.children,i=n.length;if(i){var a=n[0];if(a.startY=t.startY+t._subTreeSep,i===1)a.y=t.y+t.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(var o=1;o<i;o++){var s=n[o];s.startY=n[o-1].startY+n[o-1].totalHeight,s.y=s.startY+s.totalHeight/2-s.height/2}}}}),yL(r)};function Xoe(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,f1(r,e)}function f1(r,e){return f1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},f1(r,e)}var Yoe=_v,Woe=Uoe,Voe=a1,Hoe=Mo,qoe=function(r){function e(){return r.apply(this,arguments)||this}Xoe(e,r);var t=e.prototype;return t.execute=function(){var i=this;return Voe(i.rootNode,i.options,Woe)},e}(Yoe),Zoe={};function Koe(r,e){return e=Hoe.assign({},Zoe,e),new qoe(r,e).execute()}var Qoe=Koe,Joe={compactBox:goe,dendrogram:Ioe,indented:zoe,mindmap:Qoe},ese=Joe;const Mv=Ji(ese);var mL=bn.traverseTree,tse=function(e,t){var n;return e?ht(e)?n=function(a){return e}:n=e:n=function(a){return t||1},n},rse=function(e,t){var n=[],i=[],a={},o=0;for(o=0;o<e.length;o++){var s=e[o];a[s.id]=o,n.push(s.x),n.push(s.y),n.push(0),n.push(0),i.push([])}for(o=0;o<t.length;o++){var u=t[o];i[a[u.source]].push(a[u.target]),i[a[u.target]].push(a[u.source])}var f=0;for(o=0;o<e.length;o++){var l=n.length,c=i[o],h=c.length;n[o*4+2]=l,n[o*4+3]=c.length,f=Math.max(f,c.length);for(var d=0;d<h;++d){var v=c[d];n.push(+v)}}for(;n.length%4!==0;)n.push(0);return{array:new Float32Array(n),maxEdgePerVetex:f}},nse=function(e,t,n){var i=[],a=[],o={},s=0;for(s=0;s<e.length;s++){var u=e[s];o[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),a.push([])}for(s=0;s<t.length;s++){var f=t[s];a[o[f.source]].push(o[f.target]),a[o[f.source]].push(n(f)),a[o[f.target]].push(o[f.source]),a[o[f.target]].push(n(f))}var l=0;for(s=0;s<e.length;s++){var c=i.length,h=a[s],d=h.length;i[s*4+2]=c,i[s*4+3]=d/2,l=Math.max(l,d/2);for(var v=0;v<d;++v){var p=h[v];i.push(+p)}}for(;i.length%4!==0;)i.push(0);return{array:new Float32Array(i),maxEdgePerVetex:l}},ise=function(e,t,n,i){var a=[],o=[],s={},u=0;for(u=0;u<e.length;u++){var f=e[u];s[f.id]=u,a.push(f.x),a.push(f.y),a.push(0),a.push(0),o.push([])}for(u=0;u<t.length;u++){var l=t[u];o[s[l.source]].push(s[l.target]),o[s[l.source]].push(n(l)),o[s[l.source]].push(i(l)),o[s[l.source]].push(0),o[s[l.target]].push(s[l.source]),o[s[l.target]].push(n(l)),o[s[l.target]].push(i(l)),o[s[l.target]].push(0)}var c=0;for(u=0;u<e.length;u++){var h=a.length,d=o[u],v=d.length;a[u*4+2]=h+1048576*v/4,a[u*4+3]=0,c=Math.max(c,v/4);for(var p=0;p<v;++p){var g=d[p];a.push(+g)}}for(;a.length%4!==0;)a.push(0);return{array:new Float32Array(a),maxEdgePerVetex:c}},ase=function(e,t){var n=[],i=e.length,a={};return t.forEach(function(o){e.forEach(function(s,u){if(a[o[s]]===void 0&&(a[o[s]]=Object.keys(a).length),n.push(a[o[s]]),u===i-1)for(;n.length%4!==0;)n.push(0)})}),{array:new Float32Array(n),count:Object.keys(a).length}},ose=function(e){for(var t=[],n=e.length,i=e[0].length,a=function(u){e.forEach(function(f,l){if(t.push(f[u]),l===n-1)for(;t.length%4!==0;)t.push(0)})},o=0;o<i;o++)a(o);return new Float32Array(t)},sse=function(e,t){var n=["V","TB","BT"],i={x:1/0,y:1/0},a={x:-1/0,y:-1/0},o="x",s="y";t&&n.indexOf(t)>=0&&(s="x",o="y");var u=0;mL(e,function(c){return u++,c.x>a.x&&(a.x=c.x),c.x<i.x&&(i.x=c.x),c.y>a.y&&(a.y=c.y),c.y<i.y&&(i.y=c.y),!0});var f=Math.PI*2/u,l=a[s]-i[s];return l===0||mL(e,function(c){var h=(c[s]-i[s])/l*(Math.PI*2-f)+f,d=Math.abs(o==="x"?c.x-e.x:c.y-e.y);return c.x=d*Math.cos(h),c.y=d*Math.sin(h),!0}),e};const use=Object.freeze(Object.defineProperty({__proto__:null,arrayToTextureData:ose,attributesToTextureData:ase,buildTextureData:rse,buildTextureDataWithOneEdgeAttr:nse,buildTextureDataWithTwoEdgeAttr:ise,proccessToFunc:tse,radialLayout:sse},Symbol.toStringTag,{value:"Module"}));var bL=function r(){return typeof window>"u"||typeof document>"u"?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join(`
`):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join(`
`)),t},addGetWebGLMessage:function(t){t=t||{};var n=t.parent!==void 0?t.parent:document.body,i=t.id!==void 0?t.id:"oldie",a=r().getWebGLErrorMessage();a.id=i,n.appendChild(a)}}};const fse=Object.freeze(Object.defineProperty({__proto__:null,gpuDetector:bL},Symbol.toStringTag,{value:"Module"}));var xL=function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("firefox")>-1?"firefox":e.indexOf("safari")>-1?"safari":e.indexOf("opr")>-1?"opera":e.indexOf("chrome")>-1?"chrome":e.indexOf("trident")>-1?"ie 11":e.indexOf("ie")>-1?"ie":"unknown"};const lse=Object.freeze(Object.defineProperty({__proto__:null,getBrowserName:xL},Symbol.toStringTag,{value:"Module"}));var Ua=B(B(B(B(B({},bn),Y9),use),fse),lse),cse=Ua.radialLayout,hse=function(){function r(e){this.type=e.type,this.radial=e.radial,this.config=e}return r.prototype.init=function(e){var t=this;if(this.data=e,this.radial){this.layoutMethod=function(n){var i=Mv[t.type](n,t.config);return cse(i),i};return}this.layoutMethod=function(n){return Mv[t.type](n,t.config)}},r.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},r.prototype.layout=function(e){return this.init(e),this.execute()},r}();Ht.registerLayout("grid",Ht.GridLayout),Ht.registerLayout("random",Ht.RandomLayout),Ht.registerLayout("force",Ht.ForceLayout),Ht.registerLayout("circular",Ht.CircularLayout),Ht.registerLayout("dagre",Ht.DagreLayout),Ht.registerLayout("dagreCompound",Ht.DagreCompoundLayout),Ht.registerLayout("radial",Ht.RadialLayout),Ht.registerLayout("concentric",Ht.ConcentricLayout),Ht.registerLayout("mds",Ht.MDSLayout),Ht.registerLayout("fruchterman",Ht.FruchtermanLayout),Ht.registerLayout("fruchterman-gpu",Ht.FruchtermanGPULayout),Ht.registerLayout("gForce",Ht.GForceLayout),Ht.registerLayout("force2",Ht.Force2Layout),Ht.registerLayout("gForce-gpu",Ht.GForceGPULayout),Ht.registerLayout("comboForce",Ht.ComboForceLayout),Ht.registerLayout("comboCombined",Ht.ComboCombinedLayout),Ht.registerLayout("forceAtlas2",Ht.ForceAtlas2Layout);var dse=function(e,t){t.isCustomLayout=!0,Ht.Layouts[e]=Ht.registerLayout(e,t)},vse=function(){function r(e,t){var n=e.toString(),i=new Blob(["importScripts('".concat(t,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(i))}return r}(),pse=function(e){e===void 0&&(e="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");function t(){var i={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout);function a(s){var u=s.data.type;return u===i.RUN||u===i.GPURUN}function o(s){var u=this,f=s.data.type;switch(f){case i.RUN:{var l=s.data,c=l.nodes,h=l.edges,d=l.layoutCfg,v=d===void 0?{}:d,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:i.ERROR,message:"layout ".concat(p," not found")});break}var y;v.onLayoutEnd=function(){u.postMessage({type:i.END,nodes:c}),y==null||y.destroy()},y=new g(v),y.init({nodes:c,edges:h}),y.execute();break}case i.GPURUN:{var m=s.data,b=m.nodes,h=m.edges,x=m.layoutCfg,v=x===void 0?{}:x,w=m.canvas,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:i.ERROR,message:"layout ".concat(p," not found")});break}if(p.split("-")[1]!=="gpu"){this.postMessage({type:i.ERROR,message:"layout ".concat(p," does not support GPU")});break}var E=new g(v);E.init({nodes:b,edges:h}),E.executeWithWorker(w,this);break}}}onmessage=function(u){a(u)&&o(u)}}var n=new vse(t,e);return n},zu={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function l1(r){"@babel/helpers - typeof";return l1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l1(r)}var wL=function(e){return setTimeout(e,16)},EL=function(e){return clearTimeout(e)},Cv={requestAnimationFrame:function(e){var t=typeof window<"u"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||wL;return t(e)},cancelAnimationFrame:function(e){var t=typeof window<"u"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||EL;return t(e)}},gse=["fruchterman","gForce"],yse=["force","grid","circular"],mse=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;return n.graph=t,n.layoutCfg=t.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker?this.worker:(typeof Worker>"u"?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=pse(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(Cv.cancelAnimationFrame(t.requestId),t.requestId=null),t.requestId2&&(Cv.cancelAnimationFrame(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Un(i,void 0,void 0,function(){var s,u,f,l,c,p,h,d,v,p,g;return Xn(this,function(y){switch(y.label){case 0:if(s=this.graph,!s||s.get("destroyed"))return[2];u=t.type,t.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},u&&this.isGPU&&(_L(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),bn.isForce(u)?(f=t.onTick,l=t.animate,c=l===void 0&&(u==="force"||u==="force2"),p=function(){f&&f(),(l||c)&&s.refreshPositions()},t.tick=p):(u==="comboForce"||u==="comboCombined")&&(t.comboTrees=s.get("comboTrees")),h=!1;try{d=new Ht.Layouts[u](t),this.layoutMethods[n]&&this.layoutMethods[n].destroy(),this.layoutMethods[n]=d}catch{console.warn("The layout method: '".concat(u,"' does not exist! Please specify it first.")),o()}return h=d.enableTick,h&&(v=t.onTick,p=function(){v&&v(),s.refreshPositions()},d.tick=p),g=this.filterLayoutData(this.data,t),wse(g,n),d.init(g),s.emit("beforesublayout",{type:u}),[4,d.execute()];case 1:return y.sent(),d.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),[2]}})})})},e.prototype.updateLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Un(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Xn(this,function(v){switch(v.label){case 0:return s=this.graph,u=n==null?void 0:n.type,n.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},bn.isForce(u)&&(f=n.onTick,l=n.animate,c=l===void 0&&(u==="force"||u==="force2"),h=function(){f==null||f(),(l||c)&&s.refreshPositions()},n.tick=h),d=this.filterLayoutData(this.data,n),t.init(d),t.updateCfg(n),s.emit("beforesublayout",{type:u}),[4,t.execute()];case 1:return v.sent(),t.isCustomLayout&&n.onLayoutEnd&&n.onLayoutEnd(),[2]}})})})},e.prototype.layout=function(t){var n=this,i,a=this.graph;if(!(!a||a.get("destroyed"))){this.data=this.setDataFromGraph();var o=this.data,s=o.nodes,u=o.hiddenNodes;if(!s)return!1;var f=a.get("width"),l=a.get("height"),c={};Object.assign(c,{width:f,height:l,center:[f/2,l/2]},this.layoutCfg),this.layoutCfg=c;var h=c.type,d=!1;(i=this.layoutMethods)===null||i===void 0||i.forEach(function(w){var E;return d=!!(!((E=w.nodes)===null||E===void 0)&&E.length)||d});var v=this.destoryLayoutMethods();a.emit("beforelayout");var p=Promise.resolve();d&&h&&(v==null?void 0:v.length)===1&&v[0]===h?this.tweakInit():p=this.initPositions(c.center,s);var g=this.initPositions(c.center,u);g.then(),this.isGPU=SL(c,h);var y=c.onLayoutEnd,m=c.layoutEndFormatted,b=c.adjust;if(m||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Un(n,void 0,void 0,function(){return Xn(this,function(w){switch(w.label){case 0:return y&&y(s),this.refreshLayout(),b&&c.pipes?[4,this.adjustPipesBox(this.data,b)]:[3,2];case 1:w.sent(),this.refreshLayout(),w.label=2;case 2:return a.emit("afterlayout"),[2]}})})}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,t))return!0;var x=!1;return c.type?(x=!0,p=p.then(function(){return Un(n,void 0,void 0,function(){return Xn(this,function(w){switch(w.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,w.sent()]}})})})):c.pipes&&(x=!0,c.pipes.forEach(function(w,E){p=p.then(function(){return Un(n,void 0,void 0,function(){return Xn(this,function(_){switch(_.label){case 0:return[4,this.execLayoutMethod(w,E)];case 1:return[2,_.sent()]}})})})})),x?p.then(function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),t&&t()}).catch(function(w){console.warn("graph layout failed,",w)}):(a.refreshPositions(),t==null||t()),!1}},e.prototype.tweakInit=function(){var t=this,n=t.data,i=t.graph,a=n.nodes,o=n.edges;if(a!=null&&a.length){var s={};a.forEach(function(l){var c=l.x,h=l.y;!isNaN(c)&&!isNaN(h)&&(s[l.id]={x:c,y:h},l.mass=l.mass||2)}),o.forEach(function(l){var c=l.source,h=l.target,d=s[c],v=s[h];!d&&v?s[c]={x:v.x+(Math.random()-.5)*80,y:v.y+(Math.random()-.5)*80}:!v&&d&&(s[h]={x:d.x+(Math.random()-.5)*80,y:d.y+(Math.random()-.5)*80})});var u=i.get("width"),f=i.get("height");a.forEach(function(l){var c=s[l.id]||{x:u/2+(Math.random()-.5)*20,y:f/2+(Math.random()-.5)*20};l.x=c.x,l.y=c.y})}},e.prototype.initWithPreset=function(t,n){var i=this;return new Promise(function(a,o){return Un(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Xn(this,function(v){switch(v.label){case 0:return s=this,u=s.layoutCfg,f=s.data,l=u.preset,!(l!=null&&l.type)||!Ht.Layouts[l==null?void 0:l.type]?(n==null||n(),a(),[2,!1]):(c=SL(l,l.type),h=c?"".concat(l.type,"-gpu"):l.type,d=new Ht.Layouts[h](l),delete u.preset,d.init(f),[4,d.execute()]);case 1:return v.sent(),t==null||t(),a(),[2,!0]}})})})},e.prototype.layoutWithWorker=function(t,n){var i=this,a=this,o=a.layoutCfg,s=a.graph,u=this.getWorker(),f=this.workerData;if(!u)return!1;f.requestId=null,f.requestId2=null,f.currentTick=null,f.currentTickData=null,s.emit("beforelayout");var l=Promise.resolve(),c=!1;if(o.type)c=!0,l=l.then(function(){return i.runWebworker(u,t,o)});else if(o.pipes){c=!0;for(var h=function(y){l=l.then(function(){return i.runWebworker(u,t,y)})},d=0,v=o.pipes;d<v.length;d++){var p=v[d];h(p)}}return c&&l.then(function(){o.onAllLayoutEnd&&o.onAllLayoutEnd(),n==null||n()}).catch(function(g){console.error("layout failed",g)}),!0},e.prototype.runWebworker=function(t,n,i){var a=this,o=this.isGPU,s=this.filterLayoutData(n,i),u=s.nodes,f=s.edges,l=document.createElement("canvas"),c=o&&typeof window<"u"&&window.navigator&&!navigator.gpu&&"OffscreenCanvas"in window&&"transferControlToOffscreen"in l,h=bse(i,function(v){return typeof v!="function"});if(!c)t.postMessage({type:zu.RUN,nodes:u,edges:f,layoutCfg:h});else{var d=l.transferControlToOffscreen();h.type="".concat(h.type,"-gpu"),t.postMessage({type:zu.GPURUN,nodes:u,edges:f,layoutCfg:h,canvas:d},[d])}return new Promise(function(v,p){t.onmessage=function(g){a.handleWorkerMessage(v,p,g,s,i)}})},e.prototype.handleWorkerMessage=function(t,n,i,a,o){var s=this,u=s.graph,f=s.workerData,l=i.data,c=l.type,h=function(){o.onTick&&o.onTick()};switch(c){case zu.TICK:f.currentTick=l.currentTick,f.currentTickData=l,f.requestId||(f.requestId=Cv.requestAnimationFrame(function(){c1(a,l),u.refreshPositions(),h(),l.currentTick===l.totalTicks?t():f.currentTick===l.totalTicks&&(f.requestId2=Cv.requestAnimationFrame(function(){c1(a,f.currentTickData),u.refreshPositions(),f.requestId2=null,h(),t()})),f.requestId=null}));break;case zu.END:f.currentTick==null&&(c1(a,l),t());break;case zu.GPUEND:f.currentTick==null&&(xse(a,l),t());break;case zu.ERROR:console.warn("Web-Worker layout error!",l.message),n();break;default:n();break}},e.prototype.updateLayoutCfg=function(t){var n=this,i=this,a=i.graph,o=i.layoutMethods;if(!(!a||a.get("destroyed"))){var s=t.disableTriggerLayout,u=Jr(t,["disableTriggerLayout"]),f=gt({},this.layoutCfg,u);if(this.layoutCfg=f,!s){if(!(o!=null&&o.length)){this.layout();return}if(this.data=this.setDataFromGraph(),this.stopWorker(),!(u.workerEnabled&&this.layoutWithWorker(this.data,null))){a.emit("beforelayout");var l=Promise.resolve(),c=!1;(o==null?void 0:o.length)===1?(c=!0,l=l.then(function(){return Un(n,void 0,void 0,function(){return Xn(this,function(h){switch(h.label){case 0:return[4,this.updateLayoutMethod(o[0],f)];case 1:return[2,h.sent()]}})})})):o!=null&&o.length&&(c=!0,o.forEach(function(h,d){var v=f.pipes[d];l=l.then(function(){return Un(n,void 0,void 0,function(){return Xn(this,function(p){switch(p.label){case 0:return[4,this.updateLayoutMethod(h,v)];case 1:return[2,p.sent()]}})})})})),c&&l.then(function(){f.onAllLayoutEnd&&f.onAllLayoutEnd()}).catch(function(h){console.warn("layout failed",h)})}}}},e.prototype.adjustPipesBox=function(t,n){var i=this;return new Promise(function(a){var o=t.nodes;o!=null&&o.length||a(),yse.includes(n)||(console.warn("The adjust type ".concat(n," is not supported yet, please assign it with 'force', 'grid', or 'circular'.")),a());var s={center:i.layoutCfg.center,nodeSize:function(v){return Math.max(v.height,v.width)},preventOverlap:!0,onLayoutEnd:function(){}},u=i.getLayoutBBox(o),f=u.groupNodes,l=u.layoutNodes,c=Vt(l);s.onLayoutEnd=function(){l==null||l.forEach(function(d,v){var p,g,y,m=d.x-((p=c[v])===null||p===void 0?void 0:p.x),b=d.y-((g=c[v])===null||g===void 0?void 0:g.y);(y=f[v])===null||y===void 0||y.forEach(function(x){x.x+=m,x.y+=b})}),a()};var h=new Ht.Layouts[n](s);h.layout({nodes:l})})},e.prototype.destroy=function(){this.destoryLayoutMethods();var t=this.worker;t&&(t.terminate(),this.worker=null),this.destroyed=!0,this.graph.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0,this.graph=null},e}(Q_);function c1(r,e){for(var t=r.nodes,n=e.nodes,i=t.length,a=0;a<i;a++){var o=t[a];o.x=n[a].x,o.y=n[a].y}}function bse(r,e){var t={};return r&&l1(r)==="object"?(Object.keys(r).forEach(function(n){r.hasOwnProperty(n)&&e(r[n])&&(t[n]=r[n])}),t):r}function xse(r,e){for(var t=r.nodes,n=e.vertexEdgeData,i=t.length,a=0;a<i;a++){var o=t[a],s=n[4*a],u=n[4*a+1];o.x=s,o.y=u}}function wse(r,e){var t;if(!((t=r==null?void 0:r.nodes)===null||t===void 0)&&t.length){var n=r.nodes;n.forEach(function(i){i.layoutOrder=e})}}function _L(r){return gse.includes(r)}function SL(r,e){var t=e;e&&e.split("-")[1]==="gpu"&&(t=e.split("-")[0],r.gpuEnabled=!0);var n=!1;return r.gpuEnabled&&(n=!0,bL().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),n=!1)),n&&!_L(t)&&(console.warn("The '".concat(t,"' layout does not support GPU calculation for now, it will run in CPU.")),n=!1),n}var Ese=function(e){var t=e.clone();return _se(e,t),t},_se=function r(e,t){var n;e.isGroup()&&t.isGroup()&&((n=e.get("children"))===null||n===void 0||n.forEach(function(s,u){var f=t.get("children")[u];r(s,f)}));var i=e.get("type"),a=t.get("type");if(!(i!=="image"||a!=="image")){var o=e.get("clipShape");o&&t.setClip({type:o.get("type"),attrs:o.attr()})}},ML=ni,Sse="svg",CL=function(r){It(e,r);function e(t){var n=r.call(this,t)||this,i=n.get("defaultNode");return i||n.set("defaultNode",{type:"circle"}),i.type||(i.type="circle",n.set("defaultNode",i)),n.destroyed=!1,n}return e.prototype.initLayoutController=function(){var t=new mse(this);this.set({layoutController:t})},e.prototype.initEventController=function(){var t=new K9(this);this.set({eventController:t})},e.prototype.initCanvas=function(){var t=this.get("container");if(typeof t=="string"&&(t=document.getElementById(t),this.set("container",t)),!t)throw new Error("invalid container");var n=t.clientWidth,i=t.clientHeight,a=this.get("width")||n,o=this.get("height")||i;!this.get("width")&&!this.get("height")&&(this.set("width",n),this.set("height",i));var s=this.get("renderer"),u;if(s===Sse)u=new $f({container:t,width:a,height:o});else{var f={container:t,width:a,height:o},l=this.get("pixelRatio");l&&(f.pixelRatio=l,window.devicePixelRatio=l),u=new Aa(f)}this.set("canvas",u)},e.prototype.initPlugins=function(){var t=this;ye(t.get("plugins"),function(n){!n.destroyed&&n.initPlugin&&n.initPlugin(t)})},e.prototype.downloadImageWatermark=function(t,n,i,a){return Un(this,void 0,void 0,function(){var o,s,u;return Xn(this,function(f){switch(f.label){case 0:return o=t.style.backgroundImage,s=o.slice(5,o.length-2),u=new Image,u.src=s,[4,new Promise(function(l){u.onload=function(){var c=n.createPattern(u,"repeat");n.rect(0,0,i,a),n.fillStyle=c,n.fill(),l("")}})];case 1:return f.sent(),[2]}})})},e.prototype.asyncToDataUrl=function(t,n,i,a,o,s){var u=this,f=document.querySelector(".g6-graph-watermarker"),l=this.get("canvas"),c=l.getRenderer(),h=s||l.get("el"),d="";t||(t="image/png"),setTimeout(function(){return Un(u,void 0,void 0,function(){var v,p,g,y,m,b,x,w,E,_;return Xn(this,function(M){switch(M.label){case 0:return c!=="svg"?[3,1]:(v=h.cloneNode(!0),p=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),g=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",p),g.replaceChild(v,g.documentElement),y=new XMLSerializer().serializeToString(g),d="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(y)),[3,4]);case 1:return m=void 0,b=h.getContext("2d"),x=a||this.get("width"),w=o||this.get("height"),E=void 0,f?[4,this.downloadImageWatermark(f,b,x,w)]:[3,3];case 2:M.sent(),M.label=3;case 3:if(n){_=typeof window<"u"?window.devicePixelRatio:1;try{m=b.getImageData(0,0,x*_,w*_),E=b.globalCompositeOperation,b.globalCompositeOperation="destination-over",b.fillStyle=n,b.fillRect(0,0,x,w)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}d=h.toDataURL(t),n&&(b.clearRect(0,0,x,w),b.putImageData(m,0,0),b.globalCompositeOperation=E),M.label=4;case 4:return i&&i(d),[2]}})})},16)},e.prototype.toDataURL=function(t,n){var i=this.get("canvas"),a=i.getRenderer(),o=i.get("el");t||(t="image/png");var s="";if(a==="svg"){var u=o.cloneNode(!0),f=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),l=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",f);l.replaceChild(u,l.documentElement);var c=new XMLSerializer().serializeToString(l);s="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(c))}else{var h=void 0,d=o.getContext("2d"),v=Math.max(this.get("width"),500),p=Math.max(this.get("height"),500),g=void 0;if(n){var y=typeof window<"u"&&window.devicePixelRatio||1;try{h=d.getImageData(0,0,v*y,p*y),g=d.globalCompositeOperation,d.globalCompositeOperation="destination-over",d.fillStyle=n,d.fillRect(0,0,v,p)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}s=o.toDataURL(t),n&&(d.clearRect(0,0,v,p),d.putImageData(h,0,0),d.globalCompositeOperation=g)}return s},e.prototype.toFullDataURL=function(t,n,i){var a=this.get("group").getCanvasBBox(),o=a.height,s=a.width,u=this.get("renderer"),f=wr('<div id="virtual-image"></div>'),l=i?i.backgroundColor:void 0,c=i?i.padding:void 0;c?ht(c)&&(c=[c,c,c,c]):c=[0,0,0,0];var h=o+c[0]+c[2],d=s+c[1]+c[3],v={container:f,height:h,width:d,quickHit:!0},p=u==="svg"?new $f(v):new Aa(v),g=this.get("group"),y=g.clone(),m=Vt(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var b=(a.maxX+a.minX)/2,x=(a.maxY+a.minY)/2;m=ML(m,[["t",-b,-x],["t",s/2+c[3],o/2+c[0]]]),y.resetMatrix(),y.setMatrix(m),p.add(y);var w=p.get("el"),E="";n||(n="image/png"),setTimeout(function(){if(u==="svg"){var _=w.cloneNode(!0),M=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),C=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",M);C.replaceChild(_,C.documentElement);var S=new XMLSerializer().serializeToString(C);E="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(S))}else{var A=void 0,T=w.getContext("2d"),k=void 0;if(l){var O=typeof window<"u"?window.devicePixelRatio:1;try{A=T.getImageData(0,0,d*O,h*O),k=T.globalCompositeOperation,T.globalCompositeOperation="destination-over",T.fillStyle=l,T.fillRect(0,0,d,h)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}E=w.toDataURL(n),l&&(T.clearRect(0,0,d,h),T.putImageData(A,0,0),T.globalCompositeOperation=k)}t&&t(E)},16)},e.prototype.downloadFullImage=function(t,n,i){var a=this,o=this.get("group").getCanvasBBox(),s=o.height,u=o.width,f=this.get("renderer"),l=wr('<div id="virtual-image"></div>'),c=document.querySelector(".g6-graph-watermarker"),h=i?i.backgroundColor:void 0,d=i?i.padding:void 0;d?ht(d)&&(d=[d,d,d,d]):d=[0,0,0,0];var v=s+d[0]+d[2],p=u+d[1]+d[3];if(c){var g=this.get("graphWaterMarker").cfg||{},y=g.width,m=g.height;v=Math.ceil(v/m)*m,p=Math.ceil(p/y)*y}var b={container:l,height:v,width:p},x=f==="svg"?new $f(b):new Aa(b),w=this.get("group"),E=Ese(w),_=Vt(E.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var M=(o.maxX+o.minX)/2,C=(o.maxY+o.minY)/2;_=ML(_,[["t",-M,-C],["t",u/2+d[3],s/2+d[0]]]),E.resetMatrix(),E.setMatrix(_),x.add(E);var S=x.get("el");n||(n="image/png"),this.asyncToDataUrl(n,h,function(A){var T=document.createElement("a"),k=(t||"graph")+(f==="svg"?".svg":".".concat(n.split("/")[1]));a.dataURLToImage(A,f,T,k);var O=document.createEvent("MouseEvents");O.initEvent("click",!1,!1),T.dispatchEvent(O)},p,v,S)},e.prototype.downloadImage=function(t,n,i){var a=this,o=this;o.stopAnimate();var s=o.get("canvas"),u=s.getRenderer();n||(n="image/png");var f=(t||"graph")+(u==="svg"?".svg":n.split("/")[1]),l=document.createElement("a");o.asyncToDataUrl(n,i,function(c){a.dataURLToImage(c,u,l,f);var h=document.createEvent("MouseEvents");h.initEvent("click",!1,!1),l.dispatchEvent(h)})},e.prototype.dataURLToImage=function(t,n,i,a){if(!t||t==="data:"){console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items");return}if(typeof window<"u")if(window.Blob&&window.URL&&n!=="svg"){var o=t.split(","),s="";if(o&&o.length>0){var u=o[0].match(/:(.*?);/);u&&u.length>=2&&(s=u[1])}for(var f=atob(o[1]),l=f.length,c=new Uint8Array(l);l--;)c[l]=f.charCodeAt(l);var h=new Blob([c],{type:s});window.navigator.msSaveBlob?window.navigator.msSaveBlob(h,a):i.addEventListener("click",function(){i.download=a,i.href=window.URL.createObjectURL(h)})}else i.addEventListener("click",function(){i.download=a,i.href=t})},e.prototype.addPlugin=function(t){var n=this;t.destroyed||(n.get("plugins").push(t),t.initPlugin(n))},e.prototype.removePlugin=function(t){var n=this.get("plugins"),i=n.indexOf(t);i>=0&&(t.destroyPlugin(),n.splice(i,1))},e.prototype.setImageWaterMarker=function(t,n){t===void 0&&(t=Jo.waterMarkerImage);var i=this.get("container");Pe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=gr({},Jo.imageWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.image;if(!t){var c=f?i:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var h={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),a=new Aa(h),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var v=a.get("context"),p=l.rotate,g=l.x,y=l.y;v.rotate(-p*Math.PI/180);var m=new Image;m.crossOrigin="anonymous",m.src=t,m.onload=function(){if(v.drawImage(m,g,y,l.width,l.height),v.rotate(p*Math.PI/180),f)i.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var b=document.querySelector(".g6-graph-watermarker");b||(b=document.createElement("div"),b.className="g6-graph-watermarker"),b.className="g6-graph-watermarker",a.destroyed||(b.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),i.appendChild(b))}}},e.prototype.setTextWaterMarker=function(t,n){var i=this.get("container");Pe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=gr({},Jo.textWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.text;if(!(t!=null&&t.length)){var c=f?i:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var h={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),a=new Aa(h),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var v=a.get("context"),p=l.rotate,g=l.fill,y=l.fontFamily,m=l.fontSize,b=l.baseline,x=l.x,w=l.y,E=l.lineHeight;v.rotate(-p*Math.PI/180),v.font="".concat(m,"px ").concat(y),v.fillStyle=g,v.textBaseline=b;for(var _=Pe(t)?[t]:t,M=_.length-1;M>=0;M--)v.fillText(_[M],x,w+M*E);if(v.rotate(p*Math.PI/180),f)i.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var C=document.querySelector(".g6-graph-watermarker");C||(C=document.createElement("div"),C.className="g6-graph-watermarker"),C.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),i.appendChild(C)}},e.prototype.destroy=function(){var t,n,i,a;ye(this.get("plugins"),function(l){l.destroyPlugin()});var o=this.get("tooltips");if(o)for(var s=0;s<o.length;s++){var u=o[s];if(u){var f=u.parentElement;f&&f.removeChild(u)}}(t=this.get("eventController"))===null||t===void 0||t.destroy(),(n=this.get("layoutController"))===null||n===void 0||n.destroy(),(i=this.get("graphWaterMarker"))===null||i===void 0||i.destroy(),(a=document.querySelector(".g6-graph-watermarker"))===null||a===void 0||a.remove(),r.prototype.destroy.call(this)},e}(W_),Mse=Ua.radialLayout,h1=Ua.traverseTree,Cse=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;return n.layoutAnimating=!1,n.set("removeList",[]),n.set("layoutMethod",n.getLayout()),n}return e.prototype.getLayout=function(){var t=this.get("layout");return t?typeof t=="function"?t:(t.type||(t.type="dendrogram"),t.direction||(t.direction=t.type==="indented"?"LR":"TB"),t.radial?function(n){var i=Mv[t.type](n,t);return Mse(i),i}:function(n){return Mv[t.type](n,t)}):null},e.indexOfChild=function(t,n){var i=-1;return ye(t,function(a,o){if(n===a.id)return i=o,!1}),i},e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.animate=!0,t},e.prototype.innerAddChild=function(t,n,i){var a=this,o=t.data;o&&(o.x=t.x,o.y=t.y,o.depth=t.depth);var s=a.addItem("node",o,!1);if(n){if(s.set("parent",n),i){var u=n.get("originAttrs");if(u)s.set("originAttrs",u);else{var f=n.getModel();s.set("originAttrs",{x:f.x,y:f.y})}}var l=n.get("children");l?l.push(s):n.set("children",[s]),a.addItem("edge",{source:n.get("id"),target:s.get("id"),id:"".concat(n.get("id"),":").concat(s.get("id"))},!1)}return ye(t.children||[],function(c){a.innerAddChild(c,s,i)}),a.emit("afteraddchild",{item:s,parent:n}),s},e.prototype.innerUpdateChild=function(t,n,i){var a=this,o=a.findById(t.id);if(!o){a.innerAddChild(t,n,i);return}ye(t.children||[],function(v){a.innerUpdateChild(v,o,i)});var s=o.get("children");if(s){var u=s.length;if(u>0)for(var f=s.length-1;f>=0;f--){var l=s[f].getModel();e.indexOfChild(t.children||[],l.id)===-1&&(a.innerRemoveChild(l.id,{x:t.x,y:t.y},i),s.splice(f,1))}}var c,h;o.get("originAttrs")&&(c=o.get("originAttrs").x,h=o.get("originAttrs").y);var d=o.getModel();i&&o.set("originAttrs",{x:d.x,y:d.y}),o.set("model",Object.assign(d,t.data)),(c!==t.x||h!==t.y)&&o.updatePosition({x:t.x,y:t.y})},e.prototype.innerRemoveChild=function(t,n,i){var a=this,o=a.findById(t);if(o)if(ye(o.get("children"),function(u){a.innerRemoveChild(u.getModel().id,n,i)}),i){var s=o.getModel();o.set("to",n),o.set("originAttrs",{x:s.x,y:s.y}),a.get("removeList").push(o)}else a.removeItem(o,!1)},e.prototype.changeData=function(t,n){n===void 0&&(n=!0);var i=this;this.getNodes().map(function(a){return i.clearItemStates(a)}),this.getEdges().map(function(a){return i.clearItemStates(a)}),n&&this.get("enabledStack")&&this.pushStack("changedata",{before:i.get("originData"),after:t||i.get("data")}),t?(i.data(t),i.render(!1)):i.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var n=this;n.updateLayout(t)},e.prototype.updateLayout=function(t,n,i,a){a===void 0&&(a=!0);var o=this;if(!t){console.warn("layout cannot be null");return}if(a&&this.get("enabledStack")&&this.pushStack("layout",{before:o.get("layout"),after:t}),o.set("layout",t),o.set("layoutMethod",o.getLayout()),o.layout(),n){var s=i;s||(n==="begin"?s={x:0,y:0}:s={x:this.getWidth()/2,y:this.getHeight()/2}),s=this.getPointByCanvas(s.x,s.y);var u=this.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];s.x=s.x*u[0]+u[6],s.y=s.y*u[0]+u[7];var f=this.getGroup().getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY,v={x:(l+c)/2,y:(h+d)/2};n==="begin"&&(v.x=l,v.y=h),this.translate(s.x-v.x,s.y-v.y)}},e.prototype.refreshLayout=function(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var n=this;n.layout(t)},e.prototype.layout=function(t){var n=this,i=this,a=i.get("data"),o=i.get("layoutMethod"),s=i.get("layout"),u=a;if(s!=null&&s.excludeInvisibles){a=Vt(i.get("data"));var f={};h1(a,function(h){var d=h.children;if(!(d!=null&&d.length))return!0;for(var v=d.length-1;v>=0;v--){var p=n.findById(d[v].id),g=p?!p.isVisible():d[v].visible===!1;g&&(f[h.id]=f[h.id]||[],f[h.id].push({idx:v,child:d.splice(v,1)[0]}))}}),u=o?o(a,i.get("layout")):a,h1(u,function(h){var d=f[h.id];if(d!=null&&d.length)for(var v=d.length-1;v>=0;v--){var p=d[v],g=p.idx,y=p.child;h.children.splice(g,0,y)}})}else u=o?o(a,i.get("layout")):a;var l=i.get("animate");if(i.emit("beforerefreshlayout",{data:a,layoutData:u}),i.emit("beforelayout"),i.innerUpdateChild(u,void 0,l),t){var c=i.get("viewController");c.fitView()}l?i.layoutAnimate(u):(i.refresh(),i.paint()),i.emit("afterrefreshlayout",{data:a,layoutData:u}),i.emit("afterlayout")},e.prototype.addChild=function(t,n,i){i===void 0&&(i=!0);var a=this;a.emit("beforeaddchild",{model:t,parent:n}),Pe(n)||(n=n.get("id"));var o=a.findDataById(n);if(o){o.children||(o.children=[]),o.children.push(t);var s=a.findById(n);s.refresh(),a.changeData(void 0,i)}},e.prototype.updateChildren=function(t,n,i){i===void 0&&(i=!0);var a=this,o=a.findById(n);if(!n||!o){console.warn("Update children failed! There is no node with id '".concat(n,"'"));return}var s=a.findDataById(n);s.children=t,o.refresh(),a.changeData(void 0,i)},e.prototype.updateChild=function(t,n,i){i===void 0&&(i=!0);var a=this;if(!n||!a.findById(n)){a.changeData(t,i);return}var o=a.findDataById(n),s=a.findById(t.id);if(o.children||(o.children=[]),!s)o.children.push(t);else{var u=e.indexOfChild(o.children,t.id);u>-1&&(o.children[u]=t)}var f=a.findById(n);f==null||f.refresh(),a.changeData(void 0,i)},e.prototype.removeChild=function(t,n){n===void 0&&(n=!0);var i=this,a=i.findById(t),o;if(a?o=a==null?void 0:a.get("parent"):o=i.getNodes().find(function(c){var h=c.getModel().children||[];return!!h.find(function(d){return d.id===t})}),o&&!o.destroyed){var s=o.get("id"),u=i.findDataById(s),f=u&&u.children||[],l=e.indexOfChild(f,t);f.splice(l,1),o.refresh()}i.changeData(void 0,n)},e.prototype.findDataById=function(t,n){var i=this;if(n||(n=i.get("data")),t===n.id)return n;var a=null;return ye(n.children||[],function(o){if(o.id===t)return a=o,!1;if(a=i.findDataById(t,o),a)return!1}),a},e.prototype.layoutAnimate=function(t,n){var i=this,a=this.get("animateCfg");i.emit("beforeanimate",{data:t}),i.getEdges().forEach(function(o){var s=o.get("model");s.sourceAnchor||(s.sourceAnchor=o.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(o){h1(t,function(s){var u=i.findById(s.id);if(u){var f=u.get("originAttrs"),l=u.get("model");if(f||(f={x:l.x,y:l.y},u.set("originAttrs",f)),n){var c=n(u,o,f,t);u.set("model",Object.assign(l,c))}else l.x=f.x+(s.x-f.x)*o,l.y=f.y+(s.y-f.y)*o}return!0}),ye(i.get("removeList"),function(s){var u=s.getModel(),f=s.get("originAttrs"),l=s.get("to");u.x=f.x+(l.x-f.x)*o,u.y=f.y+(l.y-f.y)*o}),i.refreshPositions()},{duration:a.duration,easing:a.ease,callback:function(){ye(i.getNodes(),function(s){s.set("originAttrs",null)}),ye(i.get("removeList"),function(s){i.removeItem(s,!1)}),i.set("removeList",[]),a.callback&&a.callback(),i.emit("afteranimate",{data:t})},delay:a.delay})},e.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},e.prototype.isLayoutAnimating=function(){return this.layoutAnimating},e.prototype.render=function(t){t===void 0&&(t=!0);var n=this,i=n.get("data");if(!i||!un(i)||!Object.keys(i).length)throw new Error("data must be defined first");n.clear(),t&&this.get("enabledStack")&&this.clearStack(),n.emit("beforerender"),n.layout(this.get("fitView")),n.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e.prototype.data=function(t){r.prototype.data.call(this,t),this.set("originData",JSON.parse(JSON.stringify(t)))},e}(CL),zn=function(){function r(e){this._cfgs=gr(this.getDefaultCfgs(),e),this._events={},this.destroyed=!1}return r.prototype.getDefaultCfgs=function(){return{}},r.prototype.initPlugin=function(e){var t=this;t.set("graph",e);var n=t.getEvents(),i={};ye(n,function(a,o){var s=Go(t,a);i[o]=s,e.on(o,s)}),this._events=i,this.init()},r.prototype.getEvents=function(){return{}},r.prototype.get=function(e){var t;return(t=this._cfgs)===null||t===void 0?void 0:t[e]},r.prototype.set=function(e,t){this._cfgs[e]=t},r.prototype.destroy=function(){},r.prototype.destroyPlugin=function(){this.destroy();var e=this.get("graph"),t=this._events;ye(t,function(n,i){e.off(i,n)}),this._events=null,this._cfgs=null,this.destroyed=!0},r}(),Ase=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),AL="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Tse=function(r){Ase(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{img:AL,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),n=t.get("container"),i=t.get("canvas").get("el"),a=this.get("img")||AL;a.includes("url(")||(a='url("'.concat(a,'")'));var o=wr(`<div class='g6-grid-container' style="position:absolute;overflow:hidden;z-index: -1;"></div>`),s=wr(`<div
        class='g6-grid'
        style='position:absolute;
        background-image: `.concat(a,`;
        user-select: none
        '></div>`));this.set("container",o),this.set("gridContainer",s),this.positionInit(),o.appendChild(s),n.insertBefore(o,i)},e.prototype.positionInit=function(){var t=this.get("graph"),n=t.get("minZoom"),i=t.get("width"),a=t.get("height");jt(this.get("container"),{width:"".concat(i,"px"),height:"".concat(a,"px")});var o=i*80/n,s=a*80/n;jt(this.get("gridContainer"),{width:"".concat(o,"px"),height:"".concat(s,"px"),left:"-".concat(o/2,"px"),top:"-".concat(s/2,"px")})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var n=this.get("gridContainer"),i=t.matrix;i||(i=[1,0,0,0,1,0,0,0,1]);var a=this.get("follow"),o="matrix(".concat(i[0],", ").concat(i[1],", ").concat(i[3],", ").concat(i[4],", ").concat(a?i[6]:"0",", ").concat(a?i[7]:"0",")");jt(n,{transform:o})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph"),n=t.get("container"),i=this.get("container");n.removeChild(i)},e}(zn),d1={exports:{}},TL=[],zl=[],Ise="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function IL(r,e){if(e=e||{},r===void 0)throw new Error(Ise);var t=e.prepend===!0?"prepend":"append",n=e.container!==void 0?e.container:document.querySelector("head"),i=TL.indexOf(n);i===-1&&(i=TL.push(n)-1,zl[i]={});var a;return zl[i]!==void 0&&zl[i][t]!==void 0?a=zl[i][t]:(a=zl[i][t]=kse(),t==="prepend"?n.insertBefore(a,n.childNodes[0]):n.appendChild(a)),r.charCodeAt(0)===65279&&(r=r.substr(1,r.length)),a.styleSheet?a.styleSheet.cssText+=r:a.textContent+=r,a}function kse(){var r=document.createElement("style");return r.setAttribute("type","text/css"),r}d1.exports=IL,d1.exports.insertCss=IL;var Lse=d1.exports;const Av=Ji(Lse);var Nse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();typeof document<"u"&&Av(`
  .g6-component-contextmenu {
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    font-size: 12px;
    color: #545454;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 8px;
    box-shadow: rgb(174, 174, 174) 0px 0px 10px;
  }
  .g6-contextmenu-ul {
    padding: 0;
    margin: 0;
    list-style: none;
  }

`);var Ose=function(r){Nse(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(n){return`
          <ul class='g6-contextmenu-ul'>
            <li>菜单项1</li>
            <li>菜单项2</li>
          </ul>
        `},shouldBegin:function(n){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),n=wr("<div class=".concat(t||"g6-component-contextmenu","></div>"));jt(n,{top:"0px",position:"absolute",visibility:"hidden"});var i=this.get("container");i||(i=this.get("graph").get("container")),Pe(i)&&(i=document.getElementById(i)),i.appendChild(n),this.set("menu",n)},e.prototype.onMenuShow=function(t){var n=this;t.preventDefault();var i=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&i.indexOf(t.item.getType())===-1){n.onMenuHide();return}}else if(i.indexOf("canvas")===-1){n.onMenuHide();return}var a=this.get("shouldBegin");if(a(t)){var o=this.get("menu"),s=this.get("getContent"),u=this.get("graph"),f=s(t,u);Pe(f)?o.innerHTML=f:o.innerHTML=f.outerHTML,this.removeMenuEventListener();var l=this.get("handleMenuClick");if(l){var c=function(M){l(M.target,t.item,u)};this.set("handleMenuClickWrapper",c),o.addEventListener("click",c)}var h=u.get("width"),d=u.get("height"),v=o.getBoundingClientRect(),p=this.get("offsetX")||0,g=this.get("offsetY")||0,y=u.getContainer().offsetTop,m=u.getContainer().offsetLeft,b=t.canvasX+m+p,x=t.canvasY+y+g;b+v.width>h&&(b=t.canvasX-v.width-p+m),x+v.height>d&&(x=t.canvasY-v.height-g+y),jt(o,{top:"".concat(x,"px"),left:"".concat(b,"px"),visibility:"visible"});var w=this.get("trigger")==="click",E=function(M){if(w){w=!1;return}n.onMenuHide()};document.body.addEventListener("click",E),this.set("handler",E)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),n=this.get("handler");if(t){var i=this.get("menu");i.removeEventListener("click",t),this.set("handleMenuClickWrapper",null)}n&&document.body.removeEventListener("click",n)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&jt(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(zn),Dse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),v1=function(){return v1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},v1.apply(this,arguments)},kL=Math.max,Pse=ni,Rse="default",Bse="keyShape",Fse="delegate",LL="svg",Gse=function(r){Dse(e,r);function e(t){var n=r.call(this,t)||this;return n.handleUpdateCanvas=sf(function(i){var a=n;a.destroyed||a.updateCanvas()},100,!1),n}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",type:"default",padding:50,size:[200,120],delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0,hideEdge:!1}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,n=this._cfgs,i=n.size,a=n.graph;if(!this.destroyed){var o=this.get("canvas"),s=o.get("container"),u=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,f=navigator.userAgent.toLowerCase().indexOf("safari")>-1,l=wr(`
      <div
        class=`.concat(n.viewportClassName,`
        style='position:absolute;
          left:0;
          top:0;
          box-sizing:border-box;
          outline: 2px solid #1980ff;
          cursor:move'
        draggable=`).concat(!(f||u),`
      </div>`)),c=0,h=0,d=!1,v=0,p=0,g=0,y=0,m=0,b=0,x=f||u?"mousedown":"dragstart";l.addEventListener(x,function(M){var C,S;if(M.dataTransfer){var A=new Image;A.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(S=(C=M.dataTransfer).setDragImage)===null||S===void 0||S.call(C,A,0,0);try{M.dataTransfer.setData("text/html","view-port-minimap")}catch{M.dataTransfer.setData("text","view-port-minimap")}}if(n.refresh=!1,M.target===l){var T=l.style;v=parseInt(T.left,10),p=parseInt(T.top,10),g=parseInt(T.width,10),y=parseInt(T.height,10),!(g>i[0]||y>i[1])&&(b=a.getZoom(),m=t.get("ratio"),d=!0,c=M.clientX,h=M.clientY)}},!1);var w=function(C){if(!(!d||ct(C.clientX)||ct(C.clientY))){var S=c-C.clientX,A=h-C.clientY;(v-S<0||v-S+g>=i[0])&&(S=0),(p-A<0||p-A+y>=i[1])&&(A=0),v-=S,p-=A,jt(l,{left:"".concat(v,"px"),top:"".concat(p,"px")}),a.translate(S*b/m,A*b/m),c=C.clientX,h=C.clientY}};!f&&!u&&l.addEventListener("drag",w,!1);var E=function(){d=!1,n.refresh=!0},_=f||u?"mouseup":"dragend";l.addEventListener(_,E,!1),s.addEventListener("mouseleave",E),s.addEventListener("mouseup",E),(f||u)&&s.addEventListener("mousemove",w,!1),this.set("viewport",l),s.appendChild(l)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),n=this.get("totaldx"),i=this.get("totaldy"),a=this.get("graph"),o=this.get("size"),s=a.get("canvas").get("el"),u=a.get("width")||s.scrollWidth||500,f=a.get("height")||s.scrollHeight||500,l=a.getPointByCanvas(0,0),c=a.getPointByCanvas(u,f),h=this.get("viewport");h||this.initViewport();var d=(c.x-l.x)*t,v=(c.y-l.y)*t,p=l.x*t+n,g=l.y*t+i,y=p+d,m=g+v;p<0&&(d+=p,p=0),y>o[0]&&(d=d-(y-o[0])),g<0&&(v+=g,g=0),m>o[1]&&(v=v-(m-o[1])),this.set("ratio",t);var b="".concat(p,"px"),x="".concat(g,"px");jt(h,{left:b,top:x,width:"".concat(d,"px"),height:"".concat(v,"px")})}},e.prototype.updateGraphShapes=function(){var t=this._cfgs.graph,n=this.get("canvas"),i=t.get("group");if(!i.destroyed){n.clear();var a;this.get("hideEdge")?(a=n.addGroup(),i.get("children").forEach(function(s){s.get("id").includes("-edge")||a.add(s.clone())})):(a=i.clone(),a.resetMatrix(),n.add(a));var o=t.get("renderer");o===LL&&this.updateVisible(a)}},e.prototype.updateVisible=function(t){var n=this;if(!t.isGroup()&&!t.get("visible"))t.hide();else{var i=t.get("children");if(!i||!i.length)return;i.forEach(function(a){a.get("visible")||a.hide(),n.updateVisible(a)})}},e.prototype.updateKeyShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||ye(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),ye(n.getNodes(),function(u){t.updateOneNodeKeyShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(ye(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,n){if(!this.destroyed){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),f={x:o.centerX,y:o.centerY};a?f=Object.assign(u,f):(a=s,n.add(a));var l=a.get("type");(l==="rect"||l==="image")&&(f.x=o.minX,f.y=o.minY),a.attr(f),t.isVisible()?a.show():a.hide(),a.exist=!0;var c=t.getModel().depth;isNaN(c)||a.set("zIndex",c),i[t.get("id")]=a,this.set("itemMap",i)}},e.prototype.updateOneNodeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),f={x:o.centerX,y:o.centerY};a?(f=Object.assign(u,f),a.toFront()):(a=s,n.add(a));var l=a.get("type");(l==="rect"||l==="image")&&(f.x=o.minX,f.y=o.minY),a.attr(f),t.isVisible()?a.show():a.hide(),a.exist=!0;var c=t.getModel().depth;isNaN(c)||a.set("zIndex",c),i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateDelegateShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||ye(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),ye(n.getNodes(),function(u){t.updateOneNodeDelegateShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(ye(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},n=Object.keys(t);if(!(!n||n.length===0))for(var i=n.length-1;i>=0;i--){var a=t[n[i]],o=a.exist;a.exist=!1,o||(a.remove(),delete t[n[i]])}},e.prototype.updateOneEdgeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")];if(a){var o=t.get("keyShape").attr("path");a.attr("path",o)}else a=t.get("keyShape").clone(),n.add(a);t.isVisible()?a.show():a.hide(),a.exist=!0,i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateOneNodeDelegateShape=function(t,n){var i=this.get("delegateStyle"),a=this.get("itemMap")||{},o=a[t.get("id")],s=t.getBBox();if(o){var u={x:s.minX,y:s.minY,width:s.width,height:s.height};o.attr(u),o.toFront()}else o=n.addShape("rect",{attrs:v1({x:s.minX,y:s.minY,width:s.width,height:s.height},i),name:"minimap-node-shape"});t.isVisible()?o.show():o.hide(),o.exist=!0,a[t.get("id")]=o,this.set("itemMap",a)},e.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},e.prototype.initContainer=function(){var t=this,n=t.get("graph"),i=t.get("size"),a=t.get("className"),o=t.get("container"),s=wr("<div class='".concat(a,"' style='width: ").concat(i[0],"px; height: ").concat(i[1],"px; overflow: hidden'></div>"));Pe(o)&&(o=document.getElementById(o)),o?o.appendChild(s):n.get("container").appendChild(s),t.set("container",s);var u=wr('<div class="g6-minimap-container" style="position: relative;"></div>');s.appendChild(u),u.addEventListener("dragenter",function(c){c.preventDefault()}),u.addEventListener("dragover",function(c){c.preventDefault()});var f,l=n.get("renderer");l===LL?f=new $f({container:u,width:i[0],height:i[1]}):f=new Aa({container:u,width:i[0],height:i[1]}),t.set("canvas",f),t.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed){var t=this.get("refresh");if(t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("size"),a=this.get("canvas"),o=this.get("type"),s=this.get("padding");if(!a.destroyed){switch(o){case Rse:this.updateGraphShapes();break;case Bse:this.updateKeyShapes();break;case Fse:this.updateDelegateShapes();break}var u=a.get("children")[0];if(u){u.resetMatrix();var f=u.getCanvasBBox(),l=n.get("canvas").getCanvasBBox(),c=n.getZoom()||1,h=l.width/c,d=l.height/c;Number.isFinite(f.width)&&(h=kL(f.width,h),d=kL(f.height,d)),h+=2*s,d+=2*s;var v=Math.min(i[0]/h,i[1]/d),p=[1,0,0,0,1,0,0,0,1],g=0,y=0;Number.isFinite(f.minX)&&(g=-f.minX),Number.isFinite(f.minY)&&(y=-f.minY);var m=(i[0]-(h-2*s)*v)/2,b=(i[1]-(d-2*s)*v)/2;p=Pse(p,[["t",g,y],["s",v,v],["t",m,b]]),u.setMatrix(p),this.set("ratio",v),this.set("totaldx",m+g*v),this.set("totaldy",b+y*v),this.set("dx",m),this.set("dy",b),this.updateViewport()}}}}}},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t;(t=this.get("canvas"))===null||t===void 0||t.destroy();var n=this.get("container");n!=null&&n.parentNode&&n.parentNode.removeChild(n)},e}(zn),zse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();function va(r,e,t){var n=r.x-e.x,i=r.y-e.y;return Math.sqrt(n*n+i*i)}function $se(r,e){return r.x*e.x+r.y*e.y}function NL(r,e){var t=(e.source.y-e.target.y)/(e.source.x-e.target.x),n=(t*t*e.source.x+t*(r.y-e.source.y)+r.x)/(t*t+1),i=t*(n-e.source.x)+e.source.y;return{x:n,y:i}}var jse=function(r){zse(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},e.prototype.init=function(){var t=this.get("graph"),n=this.get("onTick"),i=function(){n&&n(),t.refreshPositions()};this.set("tick",i)},e.prototype.bundling=function(t){var n=this;if(n.set("data",t),!n.isTicking()){var i=t.edges||[],a=t.nodes||[],o={},s=!1;if(a.forEach(function(x){(x.x===null||!x.y===null||x.x===void 0||!x.y===void 0)&&(s=!0),o[x.id]=x}),s)throw new Error("please layout the graph or assign x and y for nodes first");n.set("nodeIdMap",o);var u=n.get("divisions"),f=n.get("divRate"),l=n.divideEdges(u);n.set("edgePoints",l);var c=n.getEdgeBundles();n.set("edgeBundles",c);for(var h=n.get("cycles"),d=n.get("iterations"),v=n.get("iterRate"),p=n.get("lambda"),g=0;g<h;g++){for(var y=function(w){var E=[];i.forEach(function(_,M){if(_.source!==_.target){var C=o[_.source],S=o[_.target];E[M]=n.getEdgeForces({source:C,target:S},M,u,p);for(var A=0;A<u+1;A++)l[M][A].x+=E[M][A].x,l[M][A].y+=E[M][A].y}})},m=0;m<d;m++)y(m);p=p/2,u*=f,d*=v,l=n.divideEdges(u),n.set("edgePoints",l)}i.forEach(function(x,w){x.source!==x.target&&(x.type="polyline",x.controlPoints=l[w].slice(1,l[w].length-1))});var b=n.get("graph");b.refresh()}},e.prototype.updateBundling=function(t){var n=this,i=t.data;if(i&&n.set("data",i),n.get("ticking")&&n.set("ticking",!1),Object.keys(t).forEach(function(o){n.set(o,t[o])}),t.onTick){var a=this.get("graph");n.set("tick",function(){t.onTick(),a.refresh()})}n.bundling(i)},e.prototype.divideEdges=function(t){var n=this,i=n.get("data").edges,a=n.get("nodeIdMap"),o=n.get("edgePoints");return(!o||o===void 0)&&(o=[]),i.forEach(function(s,u){var f;(!o[u]||o[u]===void 0)&&(o[u]=[]);var l=a[s.source],c=a[s.target];if(t===1)o[u].push({x:l.x,y:l.y}),o[u].push({x:.5*(l.x+c.x),y:.5*(l.y+c.y)}),o[u].push({x:c.x,y:c.y});else{var h=0;!((f=o[u])===null||f===void 0)&&f.length?h=n.getEdgeLength(o[u]):h=va({x:l.x,y:l.y},{x:c.x,y:c.y});var d=h/(t+1),v=d,p=[{x:l.x,y:l.y}];o[u].forEach(function(g,y){if(y!==0){for(var m=va(g,o[u][y-1]);m>v;){var b=v/m,x={x:o[u][y-1].x,y:o[u][y-1].y};x.x+=b*(g.x-o[u][y-1].x),x.y+=b*(g.y-o[u][y-1].y),p.push(x),m-=v,v=d}v-=m}}),p.push({x:c.x,y:c.y}),o[u]=p}}),o},e.prototype.getEdgeLength=function(t){var n=0;return t.forEach(function(i,a){a!==0&&(n+=va(i,t[a-1]))}),n},e.prototype.getEdgeBundles=function(){var t=this,n=t.get("data"),i=n.edges||[],a=t.get("bundleThreshold"),o=t.get("nodeIdMap"),s=t.get("edgeBundles");return s||(s=[]),i.forEach(function(u,f){(!s[f]||s[f]===void 0)&&(s[f]=[])}),i.forEach(function(u,f){var l=o[u.source],c=o[u.target];i.forEach(function(h,d){if(!(d<=f)){var v=o[h.source],p=o[h.target],g=t.getBundleScore({source:l,target:c},{source:v,target:p});g>=a&&(s[f].push(d),s[d].push(f))}})}),s},e.prototype.getBundleScore=function(t,n){var i=this;t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,n.vx=n.target.x-n.source.x,n.vy=n.target.y-n.source.y,t.length=va({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),n.length=va({x:n.source.x,y:n.source.y},{x:n.target.x,y:n.target.y});var a=i.getAngleScore(t,n),o=i.getScaleScore(t,n),s=i.getPositionScore(t,n),u=i.getVisibilityScore(t,n);return a*o*s*u},e.prototype.getAngleScore=function(t,n){var i=$se({x:t.vx,y:t.vy},{x:n.vx,y:n.vy});return i/(t.length*n.length)},e.prototype.getScaleScore=function(t,n){var i=(t.length+n.length)/2,a=2/(i/Math.min(t.length,n.length)+Math.max(t.length,n.length)/i);return a},e.prototype.getPositionScore=function(t,n){var i=(t.length+n.length)/2,a={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},o={x:(n.source.x+n.target.x)/2,y:(n.source.y+n.target.y)/2},s=va(a,o);return i/(i+s)},e.prototype.getVisibilityScore=function(t,n){var i=this.getEdgeVisibility(t,n),a=this.getEdgeVisibility(n,t);return i<a?i:a},e.prototype.getEdgeVisibility=function(t,n){var i=NL(n.source,t),a=NL(n.target,t),o={x:(i.x+a.x)/2,y:(i.y+a.y)/2},s={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2};return Math.max(0,1-2*va(o,s)/va(i,a))},e.prototype.getEdgeForces=function(t,n,i,a){for(var o=this,s=o.get("edgePoints"),u=o.get("K"),f=u/(va(t.source,t.target)*(i+1)),l=[{x:0,y:0}],c=1;c<i;c++){var h={x:0,y:0},d=o.getSpringForce({pre:s[n][c-1],cur:s[n][c],next:s[n][c+1]},f),v=o.getElectrostaticForce(c,n);h.x=a*(d.x+v.x),h.y=a*(d.y+v.y),l.push(h)}return l.push({x:0,y:0}),l},e.prototype.getSpringForce=function(t,n){var i=t.pre.x+t.next.x-2*t.cur.x,a=t.pre.y+t.next.y-2*t.cur.y;return i*=n,a*=n,{x:i,y:a}},e.prototype.getElectrostaticForce=function(t,n){var i=this,a=i.get("eps"),o=i.get("edgeBundles"),s=i.get("edgePoints"),u=o[n],f={x:0,y:0};return u.forEach(function(l){var c={x:s[l][t].x-s[n][t].x,y:s[l][t].y-s[n][t].y};if(Math.abs(c.x)>a||Math.abs(c.y)>a){var h=va(s[l][t],s[n][t]),d=1/h;f.x+=c.x*d,f.y+=c.y*d}}),f},e.prototype.isTicking=function(){return this.get("ticking")},e.prototype.getSimulation=function(){return this.get("forceSimulation")},e.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),r.prototype.destroy.call(this)},e}(zn),Use=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),p1=function(){return p1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},p1.apply(this,arguments)},Tv=.05,OL={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},Xse=function(r){Use(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{trigger:"mousemove",d:1.5,r:300,delegateStyle:Vt(OL),showLabel:!1,maxD:5,minD:0,scaleRBy:"unset",scaleDBy:"unset",showDPercent:!0}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"magnify"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"magnify"};break}return t},e.prototype.init=function(){var t=this,n=t.get("r");t.set("cachedMagnifiedModels",[]),t.set("cachedOriginPositions",{}),t.set("r2",n*n);var i=t.get("d");t.set("molecularParam",(i+1)*n)},e.prototype.createDelegate=function(t){var n=this,i=this,a=i.get("delegate");(!a||a.destroyed)&&(i.magnify(t),a=i.get("delegate"),a.on("dragstart",function(o){i.set("delegateCenterDiff",{x:a.attr("x")-o.x,y:a.attr("y")-o.y})}),a.on("drag",function(o){i.magnify(o)}),this.get("scaleDBy")==="wheel"&&a.on("mousewheel",function(o){n.scaleDByWheel(o)}),this.get("scaleRBy")==="wheel"&&a.on("mousewheel",function(o){i.scaleRByWheel(o)}))},e.prototype.scaleRByWheel=function(t){var n=this;if(!(!t||!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=n.get("graph"),a,o=n.get("delegate"),s=o?{x:o.attr("x"),y:o.attr("y")}:void 0,u=s||i.getPointByClient(t.clientX,t.clientY);t.originalEvent.wheelDelta<0?a=1-Tv:a=1/(1-Tv);var f=n.get("maxR"),l=n.get("minR"),c=n.get("r");(c>(f||i.get("height"))&&a>1||c<(l||i.get("height")*.05)&&a<1)&&(a=1),c*=a,n.set("r",c),n.set("r2",c*c);var h=n.get("d");n.set("molecularParam",(h+1)*c),n.set("delegateCenterDiff",void 0),n.magnify(t,u)}},e.prototype.scaleRByDrag=function(t){var n=this;if(t){var i=n.get("dragPrePos"),a=n.get("graph"),o,s=a.getPointByClient(t.clientX,t.clientY);t.x-i.x<0?o=1-Tv:o=1/(1-Tv);var u=n.get("maxR"),f=n.get("minR"),l=n.get("r");(l>(u||a.get("height"))&&o>1||l<(f||a.get("height")*.05)&&o<1)&&(o=1),l*=o,n.set("r",l),n.set("r2",l*l);var c=n.get("d");n.set("molecularParam",(c+1)*l),n.magnify(t,s),n.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){var n=this;if(!(!t&&!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=0;t.originalEvent.wheelDelta<0?i=-.1:i=.1;var a=n.get("d"),o=a+i,s=n.get("maxD"),u=n.get("minD");if(o<s&&o>u){n.set("d",o);var f=n.get("r");n.set("molecularParam",(o+1)*f);var l=n.get("delegate"),c=l?{x:l.attr("x"),y:l.attr("y")}:void 0;n.set("delegateCenterDiff",void 0),n.magnify(t,c)}}},e.prototype.scaleDByDrag=function(t){var n=this,i=n.get("dragPrePos"),a=t.x-i.x>0?.1:-.1,o=n.get("d"),s=o+a,u=n.get("maxD"),f=n.get("minD");if(s<u&&s>f){n.set("d",s);var l=n.get("r");n.set("molecularParam",(s+1)*l),n.magnify(t)}n.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,n){var i=this;i.restoreCache();var a=i.get("graph"),o=i.get("cachedMagnifiedModels"),s=i.get("cachedOriginPositions"),u=i.get("showLabel"),f=i.get("r"),l=i.get("r2"),c=i.get("d"),h=i.get("molecularParam"),d=a.getNodes(),v=d.length,p=n?{x:n.x,y:n.y}:{x:t.x,y:t.y};i.get("dragging")&&(i.get("trigger")==="mousemove"||i.get("trigger")==="click")&&(p=i.get("cacheCenter"));var g=i.get("delegateCenterDiff");g&&(p.x+=g.x,p.y+=g.y),i.updateDelegate(p,f);for(var y=0;y<v;y++){var m=d[y].getModel(),b=m.x,x=m.y;if(!(isNaN(b)||isNaN(x))){var w=(b-p.x)*(b-p.x)+(x-p.y)*(x-p.y);if(!isNaN(w)&&w<l&&w!==0){var E=Math.sqrt(w),_=h*E/(c*E+f),M=(b-p.x)/E,C=(x-p.y)/E;if(m.x=M*_+p.x,m.y=C*_+p.y,s[m.id]||(s[m.id]={x:b,y:x,texts:[]}),o.push(m),u&&2*E<f)for(var S=d[y],A=S.getContainer(),T=A.getChildren(),k=T.length,O=0;O<k;O++){var G=T[O];G.get("type")==="text"&&(s[m.id].texts.push({visible:G.get("visible"),shape:G}),G.set("visible",!0))}}}}a.refreshPositions()},e.prototype.restoreCache=function(){for(var t=this,n=t.get("cachedMagnifiedModels"),i=t.get("cachedOriginPositions"),a=n.length,o=0;o<a;o++){var s=n[o],u=s.id,f=i[u];s.x=f.x,s.y=f.y;for(var l=f.texts.length,c=0;c<l;c++){var h=f.texts[c];h.shape.set("visible",h.visible)}}t.set("cachedMagnifiedModels",[]),t.set("cachedOriginPositions",{})},e.prototype.updateParams=function(t){var n=this,i=t.r,a=t.d,o=t.trigger,s=t.minD,u=t.maxD,f=t.minR,l=t.maxR,c=t.scaleDBy,h=t.scaleRBy;isNaN(t.r)||(n.set("r",i),n.set("r2",i*i)),isNaN(a)||n.set("d",a),isNaN(u)||n.set("maxD",u),isNaN(s)||n.set("minD",s),isNaN(l)||n.set("maxR",l),isNaN(f)||n.set("minR",f);var d=n.get("d"),v=n.get("r");if(n.set("molecularParam",(d+1)*v),(o==="mousemove"||o==="click"||o==="drag")&&n.set("trigger",o),c==="drag"||c==="wheel"||c==="unset"){n.set("scaleDBy",c),n.get("delegate").remove(),n.get("delegate").destroy();var p=n.get("dPercentText");p&&(p.remove(),p.destroy())}if(h==="drag"||h==="wheel"||h==="unset"){n.set("scaleRBy",h),n.get("delegate").remove(),n.get("delegate").destroy();var p=n.get("dPercentText");p&&(p.remove(),p.destroy())}},e.prototype.updateDelegate=function(t,n){var i=this,a=this,o=a.get("graph"),s=a.get("delegate");if(!s||s.destroyed){var u=o.get("group"),f=a.get("delegateStyle")||OL;s=u.addShape("circle",{attrs:p1({r:n/1.5,x:t.x,y:t.y},f),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&(this.get("scaleRBy")==="wheel"?s.on("mousewheel",function(v){a.scaleRByWheel(v)}):this.get("scaleRBy")==="drag"&&(s.on("dragstart",function(v){a.set("dragging",!0),a.set("cacheCenter",{x:v.x,y:v.y}),a.set("dragPrePos",{x:v.x,y:v.y})}),s.on("drag",function(v){a.scaleRByDrag(v)}),s.on("dragend",function(v){a.set("dragging",!1)})),this.get("scaleDBy")==="wheel"?s.on("mousewheel",function(v){i.scaleDByWheel(v)}):this.get("scaleDBy")==="drag"&&(s.on("dragstart",function(v){a.set("dragging",!0),a.set("cacheCenter",{x:v.x,y:v.y}),a.set("dragPrePos",{x:v.x,y:v.y})}),s.on("drag",function(v){i.scaleDByDrag(v)}),s.on("dragend",function(v){a.set("dragging",!1)})))}else s.attr({x:t.x,y:t.y,r:n/1.5});if(a.get("showDPercent")){var l=Math.round((a.get("d")-a.get("minD"))/(a.get("maxD")-a.get("minD"))*100),c=a.get("dPercentText"),h=t.y+n/1.5+16;if(!c||c.destroyed){var d=o.get("group");c=d.addShape("text",{attrs:{text:"".concat(l,"%"),x:t.x,y:h,fill:"#aaa",stroke:"#fff",lineWidth:1,fontSize:12}}),a.set("dPercentText",c)}else c.attr({text:"".concat(l,"%"),x:t.x,y:h})}a.set("delegate",s)},e.prototype.clear=function(){var t=this.get("graph");this.restoreCache(),t.refreshPositions();var n=this.get("delegate");n&&!n.destroyed&&(n.remove(),n.destroy());var i=this.get("dPercentText");i&&!i.destroyed&&(i.remove(),i.destroy())},e.prototype.destroy=function(){this.clear()},e}(zn),Yse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),DL=.05;typeof document<"u"&&Av(`
  .g6-component-toolbar {
    position: absolute;
    list-style-type: none;
    padding: 6px;
    left: 0px;
    top: 0px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    font-size: 12px;
    color: #545454;
    margin: 0;
  }
  .g6-component-toolbar li {
    float: left;
    text-align: center;
    width: 35px;
    height: 24px;
    cursor: pointer;
		list-style-type:none;
    list-style: none;
    margin-left: 0px;
  }
  .g6-component-toolbar li .icon {
    opacity: 0.7;
  }
  .g6-component-toolbar li .icon:hover {
    opacity: 1;
  }
`);var Wse=function(e){if(!e)return[];if(e.composedPath)return e.composedPath();for(var t=[],n=e.target;n;){if(t.push(n),n.tagName==="HTML")return t.push(document,window),t;n=n.parentElement}return t},Vse=function(r){Yse(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{handleClick:void 0,getContent:function(n){return`
          <ul class='g6-component-toolbar'>
            <li code='redo'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M256 682.666667c0-102.741333 66.730667-213.333333 213.333333-213.333334 107.008 0 190.762667 56.576 230.570667 125.354667L611.968 682.666667H853.333333v-241.365334l-91.562666 91.562667C704.768 448.469333 601.130667 384 469.333333 384c-196.096 0-298.666667 150.229333-298.666666 298.666667h85.333333z" fill="" p-id="2041"></path>
              </svg>
            </li>
            <li code='undo'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M170.666667 682.666667h241.365333l-87.936-87.978667C363.904 525.909333 447.658667 469.333333 554.666667 469.333333c146.602667 0 213.333333 110.592 213.333333 213.333334h85.333333c0-148.437333-102.570667-298.666667-298.666666-298.666667-131.797333 0-235.392 64.469333-292.48 148.821333L170.666667 441.301333V682.666667z" fill="" p-id="2764"></path>
              </svg>
            </li>
            <li  code='zoomOut'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M658.432 428.736a33.216 33.216 0 0 1-33.152 33.152H525.824v99.456a33.216 33.216 0 0 1-66.304 0V461.888H360.064a33.152 33.152 0 0 1 0-66.304H459.52V296.128a33.152 33.152 0 0 1 66.304 0V395.52H625.28c18.24 0 33.152 14.848 33.152 33.152z m299.776 521.792a43.328 43.328 0 0 1-60.864-6.912l-189.248-220.992a362.368 362.368 0 0 1-215.36 70.848 364.8 364.8 0 1 1 364.8-364.736 363.072 363.072 0 0 1-86.912 235.968l192.384 224.64a43.392 43.392 0 0 1-4.8 61.184z m-465.536-223.36a298.816 298.816 0 0 0 298.432-298.432 298.816 298.816 0 0 0-298.432-298.432A298.816 298.816 0 0 0 194.24 428.8a298.816 298.816 0 0 0 298.432 298.432z"></path>
              </svg>
            </li>
            <li code='zoomIn'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
                <path d="M639.936 416a32 32 0 0 1-32 32h-256a32 32 0 0 1 0-64h256a32 32 0 0 1 32 32z m289.28 503.552a41.792 41.792 0 0 1-58.752-6.656l-182.656-213.248A349.76 349.76 0 0 1 480 768 352 352 0 1 1 832 416a350.4 350.4 0 0 1-83.84 227.712l185.664 216.768a41.856 41.856 0 0 1-4.608 59.072zM479.936 704c158.784 0 288-129.216 288-288S638.72 128 479.936 128a288.32 288.32 0 0 0-288 288c0 158.784 129.216 288 288 288z" p-id="3853"></path>
              </svg>
            </li>
            <li code='realZoom'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
                <path d="M384 320v384H320V320h64z m256 0v384H576V320h64zM512 576v64H448V576h64z m0-192v64H448V384h64z m355.968 576H92.032A28.16 28.16 0 0 1 64 931.968V28.032C64 12.608 76.608 0 95.168 0h610.368L896 192v739.968a28.16 28.16 0 0 1-28.032 28.032zM704 64v128h128l-128-128z m128 192h-190.464V64H128v832h704V256z"></path>
              </svg>
            </li>
            <li code='autoZoom'>
              <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
                <path d="M684.288 305.28l0.128-0.64-0.128-0.64V99.712c0-19.84 15.552-35.904 34.496-35.712a35.072 35.072 0 0 1 34.56 35.776v171.008h170.944c19.648 0 35.84 15.488 35.712 34.432a35.072 35.072 0 0 1-35.84 34.496h-204.16l-0.64-0.128a32.768 32.768 0 0 1-20.864-7.552c-1.344-1.024-2.816-1.664-3.968-2.816-0.384-0.32-0.512-0.768-0.832-1.088a33.472 33.472 0 0 1-9.408-22.848zM305.28 64a35.072 35.072 0 0 0-34.56 35.776v171.008H99.776A35.072 35.072 0 0 0 64 305.216c0 18.944 15.872 34.496 35.84 34.496h204.16l0.64-0.128a32.896 32.896 0 0 0 20.864-7.552c1.344-1.024 2.816-1.664 3.904-2.816 0.384-0.32 0.512-0.768 0.768-1.088a33.024 33.024 0 0 0 9.536-22.848l-0.128-0.64 0.128-0.704V99.712A35.008 35.008 0 0 0 305.216 64z m618.944 620.288h-204.16l-0.64 0.128-0.512-0.128c-7.808 0-14.72 3.2-20.48 7.68-1.28 1.024-2.752 1.664-3.84 2.752-0.384 0.32-0.512 0.768-0.832 1.088a33.664 33.664 0 0 0-9.408 22.912l0.128 0.64-0.128 0.704v204.288c0 19.712 15.552 35.904 34.496 35.712a35.072 35.072 0 0 0 34.56-35.776V753.28h170.944c19.648 0 35.84-15.488 35.712-34.432a35.072 35.072 0 0 0-35.84-34.496z m-593.92 11.52c-0.256-0.32-0.384-0.768-0.768-1.088-1.088-1.088-2.56-1.728-3.84-2.688a33.088 33.088 0 0 0-20.48-7.68l-0.512 0.064-0.64-0.128H99.84a35.072 35.072 0 0 0-35.84 34.496 35.072 35.072 0 0 0 35.712 34.432H270.72v171.008c0 19.84 15.552 35.84 34.56 35.776a35.008 35.008 0 0 0 34.432-35.712V720l-0.128-0.64 0.128-0.704a33.344 33.344 0 0 0-9.472-22.848zM512 374.144a137.92 137.92 0 1 0 0.128 275.84A137.92 137.92 0 0 0 512 374.08z"></path>
              </svg>
            </li>
          </ul>
        `},zoomSensitivity:2}},e.prototype.init=function(){var t=this,n=this.get("graph"),i=this.get("getContent"),a=i(n),o=a;Pe(a)&&(o=wr(a));var s=this.get("className");o.setAttribute("class",s||"g6-component-toolbar");var u=this.get("container");u||(u=this.get("graph").get("container")),Pe(u)&&(u=document.getElementById(u)),u.appendChild(o),this.set("toolBar",o);var f=this.get("handleClick");o.addEventListener("click",function(c){var h=Wse(c).filter(function(v){return v.nodeName==="LI"});if(h.length!==0){var d=h[0].getAttribute("code");d&&(f?f(d,n):t.handleDefaultOperator(d))}});var l=this.get("position");l&&jt(o,{top:"".concat(l.y,"px"),left:"".concat(l.x,"px")}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),n=document.querySelector('.g6-component-toolbar li[code="undo"]'),i=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),a=document.querySelector('.g6-component-toolbar li[code="redo"]'),o=document.querySelector('.g6-component-toolbar li[code="redo"] svg');!n||!i||!a||!o||(n.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4"),a.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4"),t.on("stackchange",function(s){var u=s.undoStack,f=s.redoStack,l=u.length,c=f.length;l===0?(n.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(n.removeAttribute("style"),i.removeAttribute("style")),c===0?(a.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4")):(a.removeAttribute("style"),o.removeAttribute("style"))}))},e.prototype.undo=function(){var t=this.get("graph"),n=t.getUndoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action;t.pushStack(a,Vt(i.data),"redo");var o=i.data.before;if(a==="add"&&(o=i.data.after),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=t.findById(d.id);d.visible?t.showItem(v,!1):t.hideItem(v,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=t.findById(d.id);delete d.id,t.updateItem(v,d,!1),v.getType()==="combo"&&t.updateCombo(v)})});break;case"changedata":t.changeData(o,!1);break;case"delete":{Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=d.itemType;delete d.itemType,t.addItem(v,d,!1)})});break}case"add":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.removeItem(d.id,!1)})});break;case"updateComboTree":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.updateComboTree(d.id,d.parentId,!1)})});break;case"createCombo":var s=i.data.after.combos,u=s[s.length-1];Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.updateComboTree(d.id,d.parentId,!1)})}),t.removeItem(u.id,!1);break;case"uncombo":var f=o.combos[o.combos.length-1],l=o.nodes.concat(o.combos).map(function(c){return c.id}).filter(function(c){return c!==f.id});t.createCombo(f,l,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1);break}}}},e.prototype.redo=function(){var t=this.get("graph"),n=t.getRedoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action,o=i.data.after;if(t.pushStack(a,Vt(i.data)),a==="delete"&&(o=i.data.before),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=t.findById(h.id);h.visible?t.showItem(d,!1):t.hideItem(d,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=t.findById(h.id);delete h.id,t.updateItem(d,h,!1),d.getType()==="combo"&&t.updateCombo(d)})});break;case"changedata":t.changeData(o,!1);break;case"delete":o.edges&&o.edges.forEach(function(l){t.removeItem(l.id,!1)}),o.nodes&&o.nodes.forEach(function(l){t.removeItem(l.id,!1)}),o.combos&&o.combos.forEach(function(l){t.removeItem(l.id,!1)});break;case"add":{Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=h.itemType;delete h.itemType,t.addItem(d,h,!1)})});break}case"updateComboTree":Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){t.updateComboTree(h.id,h.parentId,!1)})});break;case"createCombo":var s=o.combos[o.combos.length-1];t.createCombo(s,s.children.map(function(l){return l.id}),!1);break;case"uncombo":var u=i.data.before.combos,f=u[u.length-1];t.uncombo(f.id,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1);break}}}},e.prototype.zoomOut=function(){var t=this.get("graph"),n=t.getZoom(),i=1/(1-DL*this.get("zoomSensitivity")),a=this.get("maxZoom")||t.get("maxZoom");i*n>a||t.zoomTo(n*i)},e.prototype.zoomIn=function(){var t=this.get("graph"),n=t.getZoom(),i=1-DL*this.get("zoomSensitivity"),a=this.get("minZoom")||t.get("minZoom");i*n<a||t.zoomTo(n*i)},e.prototype.realZoom=function(){var t=this.get("graph");t.zoomTo(1)},e.prototype.autoZoom=function(){var t=this.get("graph");t.fitView([20,20])},e.prototype.handleDefaultOperator=function(t){switch(t){case"redo":this.redo();break;case"undo":this.undo();break;case"zoomOut":this.zoomOut();break;case"zoomIn":this.zoomIn();break;case"realZoom":this.realZoom();break;case"autoZoom":this.autoZoom();break}},e.prototype.destroy=function(){var t=this.get("toolBar");if(t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}var i=this.get("handleClick");i&&t.removeEventListener("click",i)},e}(zn),Hse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();typeof document<"u"&&Av(`
  .g6-component-tooltip {
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    font-size: 12px;
    color: #545454;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 8px;
    box-shadow: rgb(174, 174, 174) 0px 0px 10px;
  }
  .tooltip-type {
    padding: 0;
    margin: 0;
  }
  .tooltip-id {
    color: #531dab;
  }
`);var qse=function(r){Hse(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(n){return`
          <h4 class='tooltip-type'>类型：`.concat(n.item.getType(),`</h4>
          <span class='tooltip-id'>ID：`).concat(n.item.getID(),`</span>
        `)},shouldBegin:function(n){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},e.prototype.init=function(){var t=this,n=t.get("className")||"g6-component-tooltip",i=wr("<div class='".concat(n,"'></div>")),a=t.get("container");a||(a=t.get("graph").get("container")),Pe(a)&&(a=document.getElementById(a)),jt(i,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(i),t.get("trigger")!=="click"&&(i.addEventListener("mouseenter",function(o){jt(i,{visibility:"visible",display:"unset"})}),i.addEventListener("mouseleave",function(o){t.hideTooltip()})),t.set("tooltip",i)},e.prototype.onClick=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget===i?(this.currentTarget=null,this.hideTooltip(),a.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var n=this.get("itemTypes");t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1||!this.currentTarget||t.item!==this.currentTarget||this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip();var t=this.get("graph");t.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},e.prototype.clearContainer=function(){var t=this.get("tooltip");t&&(t.innerHTML="")},e.prototype.showTooltip=function(t){if(t.item){var n=this.get("itemTypes");if(!(t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=this.get("tooltip"),a=this.get("getContent"),o=a(t);Pe(o)?i.innerHTML=o:(this.clearContainer(),i.appendChild(o)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&jt(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var n=this.get("shouldBegin"),i=this.get("tooltip");if(!n(t)){jt(i,{visibility:"hidden",display:"none"});return}var a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=this.get("offsetX")||0,f=this.get("offsetY")||0,l=a.getPointByClient(t.clientX,t.clientY),c=this.get("fixToNode"),h=t.item;if(h.getType&&h.getType()==="node"&&c&&vt(c)&&c.length>=2){var d=h.getBBox();l={x:d.minX+d.width*c[0],y:d.minY+d.height*c[1]}}var v=a.getCanvasByPoint(l.x,l.y),p=v.x,g=v.y,y=a.getContainer(),m={x:p+y.offsetLeft+u,y:g+y.offsetTop+f};jt(i,{visibility:"visible",display:"unset"});var b=i.getBoundingClientRect();p+b.width+u>o&&(m.x-=b.width+u),g+b.height+f>s&&(m.y-=b.height+f,m.y<0&&(m.y=0)),jt(i,{left:"".concat(m.x,"px"),top:"".concat(m.y,"px")})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(zn),PL="timebarstartplay",RL="timebarendplay",pa="valuechange",ms="timebarConfigChanged",Ao="playPauseBtn",$l="nextStepBtn",jl="preStepBtn",Zse=function(){function r(e){var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.container,s=e.text,u=e.padding,f=u===void 0?[4,4,4,4]:u,l=e.className,c=l===void 0?"g6-component-timebar-tooltip":l,h=e.backgroundColor,d=h===void 0?"#000":h,v=e.textColor,p=v===void 0?"#fff":v,g=e.opacity,y=g===void 0?.8:g,m=e.fontSize,b=m===void 0?12:m;this.container=o,this.className=c,this.backgroundColor=d,this.textColor=p,this.x=n,this.y=a,this.text=s,this.padding=f,this.opacity=y,this.fontSize=b,this.render()}return r.prototype.render=function(){var e=this,t=e.className;e.x,e.y;var n=e.backgroundColor,i=e.textColor,a=e.text,o=e.padding,s=e.opacity,u=e.fontSize,f=e.container,l=wr("<div class='".concat(t,`' style="position: absolute; width: fit-content; height: fit-content; opacity: `).concat(s,'"></div>'));Pe(f)&&(f=document.getElementById(f)),f.appendChild(l),e.parentHeight=f.offsetHeight,e.parentWidth=f.offsetWidth,jt(l,{visibility:"hidden",top:0,left:0});var c=wr(`
      <div style='position: absolute; white-space:nowrap; background-color: `.concat(n,"; font-size: ").concat(u,"px; border-radius: 4px; width: fit-content; height: fit-content; color: ").concat(i,"; padding: ").concat(o[0],"px ").concat(o[1],"px ").concat(o[2],"px ").concat(o[3],"px'></div>"));c.innerHTML=a,l.appendChild(c),e.backgroundDOM=c;var h=wr("<div style='position: absolute; width: 0px; height: 0px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 10px solid ".concat(n,"'></div>"));l.appendChild(h),e.arrowDOM=h,e.container=l},r.prototype.show=function(e){var t=this,n=e.text,i=e.x;e.y,e.clientX,e.clientY,t.backgroundDOM.innerHTML=n;var a=t.backgroundDOM.offsetWidth,o=t.backgroundDOM.offsetHeight,s=t.arrowDOM.offsetWidth,u=t.arrowDOM.offsetHeight;jt(t.container,{top:"".concat(-o-u,"px"),left:"".concat(i,"px"),visibility:"visible"}),jt(t.backgroundDOM,{marginLeft:"".concat(-a/2,"px")}),jt(t.arrowDOM,{marginLeft:"".concat(-s/2,"px"),top:"".concat(o,"px")});var f=i-a/2,l=i+a/2;f<0?jt(t.backgroundDOM,{marginLeft:"".concat(-a/2-f,"px")}):l>t.parentWidth&&jt(t.backgroundDOM,{marginLeft:"".concat(-a/2-l+t.parentWidth+12,"px")})},r.prototype.hide=function(){jt(this.container,{top:0,left:0,visibility:"hidden"})},r}(),g1=function(){return g1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},g1.apply(this,arguments)},Kse=function(){function r(e){this.config=gr({},e),this.init()}return r.prototype.update=function(e){this.config=gr({},this.config,e),this.updateElement(),this.renderMarker()},r.prototype.init=function(){this.initElement(),this.renderMarker()},r.prototype.initElement=function(){var e=this.config,t=e.group,n=e.style,i=n.scale,a=i===void 0?1:i,o=n.offsetX,s=o===void 0?0:o,u=n.offsetY,f=u===void 0?0:u,l=this.config.x+s,c=this.config.y+f,h=t.addGroup({name:Ao});this.startMarkerGroup=h.addGroup({name:Ao}),this.circle=t.addShape("circle",{attrs:g1({x:l,y:c,r:this.config.r*a},n),name:Ao}),this.startMarker=this.startMarkerGroup.addShape("path",{attrs:{path:this.getStartMarkerPath(l,c,a),fill:n.stroke||"#aaa"},name:"start-marker"}),this.pauseMarkerGroup=h.addGroup({name:Ao});var d=.25*this.config.r*a,v=.5*this.config.r*Math.sqrt(3)*a;this.pauseLeftMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:l-.375*this.config.r*a,y:c-v/2,width:d,height:v,fill:n.stroke||"#aaa",lineWidth:0}}),this.pauseRightMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:l+1/8*this.config.r*a,y:c-v/2,width:d,height:v,fill:n.stroke||"#aaa",lineWidth:0}})},r.prototype.updateElement=function(){var e=this.config.style,t=e.scale,n=t===void 0?1:t,i=e.offsetX,a=i===void 0?0:i,o=e.offsetY,s=o===void 0?0:o,u=this.config.x+a,f=this.config.y+s;this.circle.attr("x",u),this.circle.attr("y",f),this.circle.attr("r",this.config.r*n),this.startMarker.attr("path",this.getStartMarkerPath(u,f,n));var l=.25*this.config.r*n,c=.5*this.config.r*Math.sqrt(3)*n;this.pauseLeftMarker.attr("x",u-(1/4+1/8)*this.config.r*n),this.pauseLeftMarker.attr("y",f-c/2),this.pauseLeftMarker.attr("width",l),this.pauseLeftMarker.attr("height",c),this.pauseRightMarker.attr("x",u+1/8*this.config.r*n),this.pauseRightMarker.attr("y",f-c/2),this.pauseRightMarker.attr("width",l),this.pauseRightMarker.attr("height",c)},r.prototype.renderMarker=function(){this.config.isPlay?(this.startMarkerGroup.hide(),this.pauseMarkerGroup.show()):(this.startMarkerGroup.show(),this.pauseMarkerGroup.hide())},r.prototype.getStartMarkerPath=function(e,t,n){var i=.5*this.config.r*Math.sqrt(3)*n;return[["M",e-i/Math.sqrt(3)/2,t-i/2],["L",e+i/Math.sqrt(3),t],["L",e-i/Math.sqrt(3)/2,t+i/2]]},r}(),$r=function(){return $r=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},$r.apply(this,arguments)},Ul=ni,Qse="#aaa",Jse="green",eue={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},tue={fill:"#fff"},rue={fill:"green"},BL={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},FL={check:{stroke:"green",lineWidth:3},box:{fill:"#fff",stroke:"#aaa",lineWidth:2,radius:3,width:12,height:12},text:{fill:"#aaa",fontSize:12,textBaseline:"top"}},nue={speed:1,loop:!1,fill:"#fff",stroke:"#fff",hideTimeTypeController:!1,preBtnStyle:{fill:"#aaa",stroke:"#aaa"},nextBtnStyle:{fill:"#aaa",stroke:"#aaa"},playBtnStyle:{fill:"#aaa",stroke:"#aaa",fillOpacity:.05},speedControllerStyle:BL,timeTypeControllerStyle:FL},y1=110,To=50,ga={SINGLE:"single",RANGE:"range"},GL=function(){function r(e){this.controllerCfg=gr({},nue,e),this.group=e.group,this.controllerGroup=this.group.addGroup({name:"controller-group"}),this.speedAxisY=[],this.currentSpeed=this.controllerCfg.speed,this.currentType=this.controllerCfg.defaultTimeType||ga.RANGE,this.fontFamily=e.fontFamily||"Arial, sans-serif",this.init()}return r.prototype.init=function(){this.renderPlayButton()},r.prototype.getNextMarkerPath=function(e,t,n){return[["M",e,t-n],["L",e+n,t],["L",e,t+n],["Z",e,t-n],["M",e,t],["L",e-n,t-n],["L",e-n,t+n],["Z"]]},r.prototype.getPreMarkerPath=function(e,t,n){return[["M",e,t-n],["L",e-n,t],["L",e,t+n],["L",e,t-n],["M",e,t],["L",e+n,t-n],["L",e+n,t+n],["Z"]]},r.prototype.renderPlayButton=function(){var e=this.controllerCfg,t=e.width,n=e.height,i=e.x,a=e.y,o=e.hideTimeTypeController,s=e.fill,u=s===void 0?Qse:s,f=e.stroke,l=f===void 0?Jse:f,c=e.containerStyle,h=c===void 0?{}:c,d=$r($r({},eue),e.playBtnStyle||{}),v=$r($r({},tue),e.preBtnStyle||{}),p=$r($r({},rue),e.nextBtnStyle||{}),g=n/2-5,y=a+10,m=this.controllerGroup.addShape("rect",{attrs:$r({x:i,y,width:t,height:n,stroke:l,fill:u},h),name:"container-rect"});this.playButton?this.playButton.update({x:t/2,y,r:g}):this.playButton=new Kse({group:this.controllerGroup,x:t/2,y:y+g+5,r:g,isPlay:this.isPlay,style:d});var b=v.offsetX||0,x=v.offsetY||0,w=(v.scale||1)*g;this.controllerGroup.addShape("path",{attrs:$r({path:this.getPreMarkerPath(t/2-5*g+b,y+g+5+x,w*.5)},v),name:jl});var E=p.offsetX||0,_=p.offsetY||0,M=(p.scale||1)*g;this.controllerGroup.addShape("path",{attrs:$r({path:this.getNextMarkerPath(t/2+5*g+E,y+g+5+_,M*.5)},p),name:$l}),m.toBack(),this.renderSpeedBtn(),o||this.renderToggleTime(),this.bindEvent();var C=this.controllerCfg.scale,S=C===void 0?1:C,A=this.controllerGroup.getCanvasBBox(),T=(A.maxX+A.minX)/2,k=(A.maxY+A.minY)/2,O=Ul([1,0,0,0,1,0,0,0,1],[["t",-T,-k],["s",S,S],["t",T,k]]);this.controllerGroup.setMatrix(O)},r.prototype.renderSpeedBtn=function(){var e=this.controllerCfg,t=e.y,n=e.width,i=e.hideTimeTypeController,a=$r($r({},BL),this.controllerCfg.speedControllerStyle||{}),o=a.scroller,s=o===void 0?{}:o,u=a.text,f=u===void 0?{}:u,l=a.pointer,c=l===void 0?{}:l,h=a.scale,d=h===void 0?1:h,v=a.offsetX,p=v===void 0?0:v,g=a.offsetY,y=g===void 0?0:g,m=this.controllerGroup.addGroup({name:"speed-group"});this.speedGroup=m;var b=5;this.speedAxisY=[19,22,26,32,39];for(var x=0;x<5;x++){var w=t+this.speedAxisY[x],E=n-(i?To:y1);m.addShape("line",{attrs:$r({x1:E,x2:E+15,y1:w,y2:w},s),speed:b,name:"speed-rect"}),this.speedAxisY[x]=w,b=b-1}this.speedText=m.addShape("text",{attrs:$r({x:n-(i?To:y1)+20,y:this.speedAxisY[0]+4,text:"1.0X",fontFamily:this.fontFamily||"Arial, sans-serif"},f),name:"speed-text"}),this.speedPoint=m.addShape("path",{attrs:$r({path:this.getPointerPath(n-(i?To:y1),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},c),name:"speed-pointer"});var _=this.speedGroup.getCanvasBBox(),M=(_.maxX+_.minX)/2,C=(_.maxY+_.minY)/2,S=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];S=Ul(S,[["t",-M,-C],["s",d,d],["t",M+p*d,C+y*d]]),this.speedGroup.setMatrix(S)},r.prototype.getPointerPath=function(e,t){return[["M",e,t],["L",e-10,t-4],["L",e-10,t+4],["Z"]]},r.prototype.renderToggleTime=function(){var e,t,n=this.controllerCfg,i=n.width,a=n.defaultTimeType,o=$r($r({},FL),this.controllerCfg.timeTypeControllerStyle||{}),s=o.scale,u=s===void 0?1:s,f=o.offsetX,l=f===void 0?0:f,c=o.offsetY,h=c===void 0?0:c,d=o.box,v=d===void 0?{}:d,p=o.check,g=p===void 0?{}:p,y=o.text,m=y===void 0?{}:y;this.toggleGroup=this.controllerGroup.addGroup({name:"toggle-group"});var b=a===ga.SINGLE;this.toggleGroup.addShape("rect",{attrs:$r({x:i-To,y:this.speedAxisY[0]+3.5},v),isChecked:b,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:$r({path:[["M",i-To+3,this.speedAxisY[1]+6],["L",i-To+7,this.speedAxisY[1]+10],["L",i-To+12,this.speedAxisY[1]+4]]},g),capture:!1,name:"check-icon"}),b||this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:$r({text:b?((e=this.controllerCfg)===null||e===void 0?void 0:e.timeRangeControllerText)||"时间范围":((t=this.controllerCfg)===null||t===void 0?void 0:t.timePointControllerText)||"单一时间",x:i-To+15,y:this.speedAxisY[0]+4,fontFamily:typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},m),name:"checked-text"});var x=this.toggleGroup.getCanvasBBox(),w=(x.maxX+x.minX)/2,E=(x.maxY+x.minY)/2,_=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];_=Ul(_,[["t",-w,-E],["s",u,u],["t",w+l*u,E+h*u]]),this.toggleGroup.setMatrix(_)},r.prototype.bindEvent=function(){var e=this;this.speedGroup.on("speed-rect:click",function(t){var n=t.target.attr("y1"),i=e.speedPoint.attr("matrix"),a=e.speedAxisY.indexOf(i[7]||0),o=e.speedAxisY.indexOf(n),s=e.speedAxisY[o]-e.speedAxisY[a];i=Ul(i,[["t",0,s]]),e.speedPoint.setMatrix(i),e.currentSpeed=e.speedAxisY.length-o,e.speedText.attr("text","".concat(e.currentSpeed,".0X")),e.group.emit(ms,{speed:e.currentSpeed,type:e.currentType})}),this.speedGroup.on("mousewheel",function(t){t.preventDefault();var n=e.speedPoint.attr("matrix")||[1,0,0,0,1,0,0,0,1],i=n[7],a=e.speedAxisY.indexOf(i);if(a===-1){var o=1/0;e.speedAxisY.forEach(function(u,f){var l=Math.abs(u-i);o>l&&(o=l,a=f)})}t.originalEvent.deltaY>0?a=Math.max(0,a-1):a=Math.min(e.speedAxisY.length-1,a+1);var s=e.speedAxisY[a]-i;n=Ul(n,[["t",0,s]]),e.speedPoint.setMatrix(n),e.currentSpeed=e.speedAxisY.length-a,e.speedText.attr("text","".concat(e.currentSpeed,".0X")),e.group.emit(ms,{speed:e.currentSpeed,type:e.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(t){var n,i,a=t.target.get("isChecked");a?(e.checkedIcon.hide(),e.checkedText.attr("text",((i=e.controllerCfg)===null||i===void 0?void 0:i.timePointControllerText)||"单一时间"),e.currentType=ga.RANGE):(e.checkedIcon.show(),e.checkedText.attr("text",((n=e.controllerCfg)===null||n===void 0?void 0:n.timeRangeControllerText)||"时间范围"),e.currentType=ga.SINGLE),t.target.set("isChecked",!a),e.group.emit(ms,{type:e.currentType,speed:e.currentSpeed})})},r.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},r}(),Xl=function(){return Xl=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Xl.apply(this,arguments)},iue=ni,aue={fill:"#5B8FF9"},oue={fill:"#e6e8e9"},sue=function(){function r(e){this.frameCount=0,this.fontFamily="Arial, sans-serif";var t=e.graph,n=e.canvas,i=e.group,a=e.width,o=e.height,s=e.padding,u=e.data,f=e.start,l=e.end,c=e.x,h=c===void 0?0:c,d=e.y,v=d===void 0?0:d,p=e.tickLabelFormatter,g=e.selectedTickStyle,y=g===void 0?aue:g,m=e.unselectedTickStyle,b=m===void 0?oue:m,x=e.tooltipBackgroundColor,w=e.tooltipFomatter,E=e.tickLabelStyle,_=e.controllerCfg,M=_===void 0?{speed:1}:_;this.graph=t,this.group=i,this.sliceGroup=i.addGroup({name:"slice-group"}),this.canvas=n,this.width=a,this.height=o,this.padding=s,this.data=u,this.start=f,this.end=l,this.tickLabelFormatter=p,this.tickLabelStyle=E||{},this.selectedTickStyle=y,this.unselectedTickStyle=b,this.controllerCfg=M,this.currentSpeed=M.speed||1,this.x=h,this.y=v,this.tooltipBackgroundColor=x,this.tooltipFomatter=w,this.fontFamily=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlices(),this.initEvent()}return r.prototype.renderSlices=function(){var e=this,t=this,n=t.width,i=t.height,a=t.padding,o=t.data,s=t.start,u=t.end,f=t.tickLabelFormatter,l=t.selectedTickStyle,c=t.unselectedTickStyle,h=t.tickLabelStyle,d=n-2*a,v=10,p=4,g=3*a+p+v,y=i-g-2*a,m=2,b=o.length,x=(d-m*(b-1))/b;this.tickWidth=x;var w=this.sliceGroup,E=[],_=[],M=Math.round(b*s),C=Math.round(b*u);this.startTickRectId=M,this.endTickRectId=C;var S=h.rotate;delete h.rotate,o.forEach(function(T,k){var O=k>=M&&k<=C,G=O?l:c,D=w.addShape("rect",{attrs:Xl({x:a+k*(x+m),y:a,width:x,height:y},G),draggable:!0,name:"tick-rect-".concat(k)}),$=w.addShape("rect",{attrs:{x:a+k*x+m*(2*k-1)/2,y:a,width:k===0||k===b-1?x+m/2:x+m,height:y,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(k)});$.toFront();var Y=D.getBBox(),N=(Y.minX+Y.maxX)/2;E.push({rect:D,pickRect:$,value:T.date,x:N,y:Y.minY});var P;if(f?(P=f(T),!Pe(P)&&P&&(P=T.date)):k%Math.round(b/10)===0&&(P=T.date),P){_.push(P);var W=Y.maxY+a*2;w.addShape("line",{attrs:{stroke:"#BFBFBF",x1:N,y1:W,x2:N,y2:W+p},name:"tick-line"});var J=W+p+a,te=w.addShape("text",{attrs:Xl({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:N,y:J,textAlign:"center",text:P,textBaseline:"top",fontSize:10,fontFamily:e.fontFamily||"Arial, sans-serif"},h),capture:!1,name:"tick-label"}),H=te.getBBox();if(H.maxX>n?te.attr("textAlign","right"):H.minX<0&&te.attr("textAlign","left"),ht(S)&&_.length!==10){var pe=iue([1,0,0,0,1,0,0,0,1],[["t",-N,-J],["r",S],["t",N-5,J+2]]);te.attr({textAlign:"left",matrix:pe})}_.length===1?te.attr({textAlign:"left"}):_.length===10&&te.attr({textAlign:"right"})}}),this.tickRects=E;var A=this.group;this.currentSpeed=1,this.controllerBtnGroup=new GL(Xl({group:A,x:this.x,y:this.y+i+5,width:n,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"},this.controllerCfg))},r.prototype.initEvent=function(){var e=this,t=this.sliceGroup;t.on("click",function(l){var c=l.target;if(!(c.get("type")!=="rect"||!c.get("name"))){var h=parseInt(c.get("name").split("-")[2],10);if(!isNaN(h)){var d=e.tickRects,v=e.unselectedTickStyle;d.forEach(function(m){m.rect.attr(v)});var p=e.selectedTickStyle;d[h].rect.attr(p),e.startTickRectId=h,e.endTickRectId=h;var g=d.length,y=h/g;e.graph.emit(pa,{value:[y,y]})}}}),t.on("dragstart",function(l){var c=e.tickRects,h=e.unselectedTickStyle;c.forEach(function(m){m.rect.attr(h)});var d=l.target,v=parseInt(d.get("name").split("-")[2],10),p=e.selectedTickStyle;c[v].rect.attr(p),e.startTickRectId=v;var g=c.length,y=v/g;e.graph.emit(pa,{value:[y,y]}),e.dragging=!0}),t.on("dragover",function(l){if(e.dragging&&l.target.get("type")==="rect"){for(var c=parseInt(l.target.get("name").split("-")[2],10),h=e.startTickRectId,d=e.tickRects,v=e.selectedTickStyle,p=e.unselectedTickStyle,g=0;g<d.length;g++){var y=g>=h&&g<=c?v:p;d[g].rect.attr(y)}var m=d.length;e.endTickRectId=c;var b=h/m,x=c/m;e.graph.emit(pa,{value:[b,x]})}}),t.on("drop",function(l){if(e.dragging&&(e.dragging=!1,l.target.get("type")==="rect")){var c=e.startTickRectId,h=parseInt(l.target.get("name").split("-")[2],10);if(!(h<c)){var d=e.selectedTickStyle,v=e.tickRects;v[h].rect.attr(d),e.endTickRectId=h;var p=v.length,g=c/p,y=h/p;e.graph.emit(pa,{value:[g,y]})}}});var n=this,i=n.tooltipBackgroundColor,a=n.tooltipFomatter,o=n.canvas,s=new Zse({container:o.get("container"),backgroundColor:i}),u=this.tickRects;u.forEach(function(l){var c=l.pickRect;c.on("mouseenter",function(h){var d=h.target;if(d.get("type")==="rect"){var v=parseInt(d.get("name").split("-")[2],10),p=o.getClientByPoint(u[v].x,u[v].y);s.show({x:u[v].x,y:u[v].y,clientX:p.x,clientY:p.y,text:a?a(u[v].value):u[v].value})}}),c.on("mouseleave",function(h){s.hide()})});var f=this.group;f.on("".concat(Ao,":click"),function(){e.isPlay=!e.isPlay,e.changePlayStatus()}),f.on("".concat($l,":click"),function(){e.updateStartEnd(1)}),f.on("".concat(jl,":click"),function(){e.updateStartEnd(-1)}),f.on(ms,function(l){l.type;var c=l.speed;e.currentSpeed=c})},r.prototype.changePlayStatus=function(e){e===void 0&&(e=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(PL,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(RL,null))},r.prototype.startPlay=function(){var e=this;return typeof window<"u"?window.requestAnimationFrame(function(){var t=e.currentSpeed;e.frameCount%(60/t)===0&&(e.frameCount=0,e.updateStartEnd(1)),e.frameCount++,e.isPlay&&(e.playHandler=e.startPlay())}):void 0},r.prototype.updateStartEnd=function(e){var t=this,n=this.tickRects,i=n.length,a=this.unselectedTickStyle,o=this.selectedTickStyle,s=t.endTickRectId;if(e>0?t.endTickRectId++:(n[t.endTickRectId].rect.attr(a),t.endTickRectId--),s!==t.startTickRectId)t.endTickRectId<t.startTickRectId&&(t.startTickRectId=t.endTickRectId);else{for(var u=t.startTickRectId;u<=t.endTickRectId-1;u++)n[u].rect.attr(a);t.startTickRectId=t.endTickRectId}if(n[t.endTickRectId]){n[t.endTickRectId].rect.attr(o);var f=t.startTickRectId/i,l=t.endTickRectId/i;this.graph.emit(pa,{value:[f,l]})}},r.prototype.destory=function(){var e=this.sliceGroup;e.off("click"),e.off("dragstart"),e.off("dragover"),e.off("drop"),this.tickRects.forEach(function(t){var n=t.pickRect;n.off("mouseenter"),n.off("mouseleave")}),this.tickRects.length=0,e.off("".concat(Ao,":click")),e.off("".concat($l,":click")),e.off("".concat(jl,":click")),e.off(ms),this.sliceGroup.destroy()},r}(),zL={};function uue(r){return zL[r]}function ya(r,e){zL[r]=e}var m1=function(){function r(e){this.type="base",this.isCategory=!1,this.isLinear=!1,this.isContinuous=!1,this.isIdentity=!1,this.values=[],this.range=[0,1],this.ticks=[],this.__cfg__=e,this.initCfg(),this.init()}return r.prototype.translate=function(e){return e},r.prototype.change=function(e){gt(this.__cfg__,e),this.init()},r.prototype.clone=function(){return this.constructor(this.__cfg__)},r.prototype.getTicks=function(){var e=this;return zo(this.ticks,function(t,n){return un(t)?t:{text:e.getText(t,n),tickValue:t,value:e.scale(t)}})},r.prototype.getText=function(e,t){var n=this.formatter,i=n?n(e,t):e;return ct(i)||!_r(i.toString)?"":i.toString()},r.prototype.getConfig=function(e){return this.__cfg__[e]},r.prototype.init=function(){gt(this,this.__cfg__),this.setDomain(),dx(this.getConfig("ticks"))&&(this.ticks=this.calculateTicks())},r.prototype.initCfg=function(){},r.prototype.setDomain=function(){},r.prototype.calculateTicks=function(){var e=this.tickMethod,t=[];if(Pe(e)){var n=uue(e);if(!n)throw new Error("There is no method to to calculate ticks!");t=n(this)}else _r(e)&&(t=e(this));return t},r.prototype.rangeMin=function(){return this.range[0]},r.prototype.rangeMax=function(){return this.range[1]},r.prototype.calcPercent=function(e,t,n){return ht(e)?(e-t)/(n-t):NaN},r.prototype.calcValue=function(e,t,n){return t+e*(n-t)},r}(),Yl=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cat",t.isCategory=!0,t}return e.prototype.buildIndexMap=function(){if(!this.translateIndexMap){this.translateIndexMap=new Map;for(var t=0;t<this.values.length;t++)this.translateIndexMap.set(this.values[t],t)}},e.prototype.translate=function(t){this.buildIndexMap();var n=this.translateIndexMap.get(t);return n===void 0&&(n=ht(t)?t:NaN),n},e.prototype.scale=function(t){var n=this.translate(t),i=this.calcPercent(n,this.min,this.max);return this.calcValue(i,this.rangeMin(),this.rangeMax())},e.prototype.invert=function(t){var n=this.max-this.min,i=this.calcPercent(t,this.rangeMin(),this.rangeMax()),a=Math.round(n*i)+this.min;return a<this.min||a>this.max?NaN:this.values[a]},e.prototype.getText=function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=t;return ht(t)&&!this.values.includes(t)&&(a=this.values[a]),r.prototype.getText.apply(this,_c([a],n))},e.prototype.initCfg=function(){this.tickMethod="cat"},e.prototype.setDomain=function(){if(ct(this.getConfig("min"))&&(this.min=0),ct(this.getConfig("max"))){var t=this.values.length;this.max=t>1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(m1),$L=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Io="\\d\\d?",ko="\\d\\d",fue="\\d{3}",lue="\\d{4}",Wl="[^\\s]+",jL=/\[([^]*?)\]/gm;function UL(r,e){for(var t=[],n=0,i=r.length;n<i;n++)t.push(r[n].substr(0,e));return t}var XL=function(r){return function(e,t){var n=t[r].map(function(a){return a.toLowerCase()}),i=n.indexOf(e.toLowerCase());return i>-1?i:null}};function Lo(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0,i=e;n<i.length;n++){var a=i[n];for(var o in a)r[o]=a[o]}return r}var YL=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],WL=["January","February","March","April","May","June","July","August","September","October","November","December"],cue=UL(WL,3),hue=UL(YL,3),b1={dayNamesShort:hue,dayNames:YL,monthNamesShort:cue,monthNames:WL,amPm:["am","pm"],DoFn:function(r){return r+["th","st","nd","rd"][r%10>3?0:(r-r%10!==10?1:0)*r%10]}},Iv=Lo({},b1),VL=function(r){return Iv=Lo(Iv,r)},HL=function(r){return r.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},$n=function(r,e){for(e===void 0&&(e=2),r=String(r);r.length<e;)r="0"+r;return r},due={D:function(r){return String(r.getDate())},DD:function(r){return $n(r.getDate())},Do:function(r,e){return e.DoFn(r.getDate())},d:function(r){return String(r.getDay())},dd:function(r){return $n(r.getDay())},ddd:function(r,e){return e.dayNamesShort[r.getDay()]},dddd:function(r,e){return e.dayNames[r.getDay()]},M:function(r){return String(r.getMonth()+1)},MM:function(r){return $n(r.getMonth()+1)},MMM:function(r,e){return e.monthNamesShort[r.getMonth()]},MMMM:function(r,e){return e.monthNames[r.getMonth()]},YY:function(r){return $n(String(r.getFullYear()),4).substr(2)},YYYY:function(r){return $n(r.getFullYear(),4)},h:function(r){return String(r.getHours()%12||12)},hh:function(r){return $n(r.getHours()%12||12)},H:function(r){return String(r.getHours())},HH:function(r){return $n(r.getHours())},m:function(r){return String(r.getMinutes())},mm:function(r){return $n(r.getMinutes())},s:function(r){return String(r.getSeconds())},ss:function(r){return $n(r.getSeconds())},S:function(r){return String(Math.round(r.getMilliseconds()/100))},SS:function(r){return $n(Math.round(r.getMilliseconds()/10),2)},SSS:function(r){return $n(r.getMilliseconds(),3)},a:function(r,e){return r.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(r,e){return r.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+$n(Math.floor(Math.abs(e)/60)*100+Math.abs(e)%60,4)},Z:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+$n(Math.floor(Math.abs(e)/60),2)+":"+$n(Math.abs(e)%60,2)}},qL=function(r){return+r-1},ZL=[null,Io],KL=[null,Wl],QL=["isPm",Wl,function(r,e){var t=r.toLowerCase();return t===e.amPm[0]?0:t===e.amPm[1]?1:null}],JL=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(r){var e=(r+"").match(/([+-]|\d\d)/gi);if(e){var t=+e[1]*60+parseInt(e[2],10);return e[0]==="+"?t:-t}return 0}],vue={D:["day",Io],DD:["day",ko],Do:["day",Io+Wl,function(r){return parseInt(r,10)}],M:["month",Io,qL],MM:["month",ko,qL],YY:["year",ko,function(r){var e=new Date,t=+(""+e.getFullYear()).substr(0,2);return+(""+(+r>68?t-1:t)+r)}],h:["hour",Io,void 0,"isPm"],hh:["hour",ko,void 0,"isPm"],H:["hour",Io],HH:["hour",ko],m:["minute",Io],mm:["minute",ko],s:["second",Io],ss:["second",ko],YYYY:["year",lue],S:["millisecond","\\d",function(r){return+r*100}],SS:["millisecond",ko,function(r){return+r*10}],SSS:["millisecond",fue],d:ZL,dd:ZL,ddd:KL,dddd:KL,MMM:["month",Wl,XL("monthNamesShort")],MMMM:["month",Wl,XL("monthNames")],a:QL,A:QL,ZZ:JL,Z:JL},kv={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},eN=function(r){return Lo(kv,r)},tN=function(r,e,t){if(e===void 0&&(e=kv.default),t===void 0&&(t={}),typeof r=="number"&&(r=new Date(r)),Object.prototype.toString.call(r)!=="[object Date]"||isNaN(r.getTime()))throw new Error("Invalid Date pass to format");e=kv[e]||e;var n=[];e=e.replace(jL,function(a,o){return n.push(o),"@@@"});var i=Lo(Lo({},Iv),t);return e=e.replace($L,function(a){return due[a](r,i)}),e.replace(/@@@/g,function(){return n.shift()})};function rN(r,e,t){if(t===void 0&&(t={}),typeof e!="string")throw new Error("Invalid format in fecha parse");if(e=kv[e]||e,r.length>1e3)return null;var n=new Date,i={year:n.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},a=[],o=[],s=e.replace(jL,function(x,w){return o.push(HL(w)),"@@@"}),u={},f={};s=HL(s).replace($L,function(x){var w=vue[x],E=w[0],_=w[1],M=w[3];if(u[E])throw new Error("Invalid format. "+E+" specified twice in format");return u[E]=!0,M&&(f[M]=!0),a.push(w),"("+_+")"}),Object.keys(f).forEach(function(x){if(!u[x])throw new Error("Invalid format. "+x+" is required in specified format")}),s=s.replace(/@@@/g,function(){return o.shift()});var l=r.match(new RegExp(s,"i"));if(!l)return null;for(var c=Lo(Lo({},Iv),t),h=1;h<l.length;h++){var d=a[h-1],v=d[0],p=d[2],g=p?p(l[h],c):+l[h];if(g==null)return null;i[v]=g}i.isPm===1&&i.hour!=null&&+i.hour!=12?i.hour=+i.hour+12:i.isPm===0&&+i.hour==12&&(i.hour=0);var y;if(i.timezoneOffset==null){y=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);for(var m=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],h=0,b=m.length;h<b;h++)if(u[m[h][0]]&&i[m[h][0]]!==y[m[h][1]]())return null}else if(y=new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond)),i.month>11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return y}var nN={format:tN,parse:rN,defaultI18n:b1,setGlobalDateI18n:VL,setGlobalDateMasks:eN};const pue=Object.freeze(Object.defineProperty({__proto__:null,assign:Lo,default:nN,defaultI18n:b1,format:tN,parse:rN,setGlobalDateI18n:VL,setGlobalDateMasks:eN},Symbol.toStringTag,{value:"Module"}));function gue(r){return function(e,t,n,i){for(var a=ct(n)?0:n,o=ct(i)?e.length:i;a<o;){var s=a+o>>>1;r(e[s])>t?o=s:a=s+1}return a}}var iN="format";function aN(r,e){var t=pue[iN]||nN[iN];return t(r,e)}function Lv(r){return Pe(r)&&(r.indexOf("T")>0?r=new Date(r).getTime():r=new Date(r.replace(/-/gi,"/")).getTime()),wp(r)&&(r=r.getTime()),r}var Pi=1e3,bs=60*Pi,xs=60*bs,Xa=24*xs,Vl=Xa*31,oN=Xa*365,Hl=[["HH:mm:ss",Pi],["HH:mm:ss",Pi*10],["HH:mm:ss",Pi*30],["HH:mm",bs],["HH:mm",bs*10],["HH:mm",bs*30],["HH",xs],["HH",xs*6],["HH",xs*12],["YYYY-MM-DD",Xa],["YYYY-MM-DD",Xa*4],["YYYY-WW",Xa*7],["YYYY-MM",Vl],["YYYY-MM",Vl*4],["YYYY-MM",Vl*6],["YYYY",Xa*380]];function yue(r,e,t){var n=(e-r)/t,i=gue(function(o){return o[1]})(Hl,n)-1,a=Hl[i];return i<0?a=Hl[0]:i>=Hl.length&&(a=ri(Hl)),a}var mue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="timeCat",t}return e.prototype.translate=function(t){t=Lv(t);var n=this.values.indexOf(t);return n===-1&&(ht(t)&&t<this.values.length?n=t:n=NaN),n},e.prototype.getText=function(t,n){var i=this.translate(t);if(i>-1){var a=this.values[i],o=this.formatter;return a=o?o(a,n):aN(a,this.mask),a}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var t=this.values;ye(t,function(n,i){t[i]=Lv(n)}),t.sort(function(n,i){return n-i}),r.prototype.setDomain.call(this)},e}(Yl),Nv=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.isContinuous=!0,t}return e.prototype.scale=function(t){if(ct(t))return NaN;var n=this.rangeMin(),i=this.rangeMax(),a=this.max,o=this.min;if(a===o)return n;var s=this.getScalePercent(t);return n+s*(i-n)},e.prototype.init=function(){r.prototype.init.call(this);var t=this.ticks,n=Xi(t),i=ri(t);n<this.min&&(this.min=n),i>this.max&&(this.max=i),ct(this.minLimit)||(this.min=n),ct(this.maxLimit)||(this.max=i)},e.prototype.setDomain=function(){var t=Jb(this.values),n=t.min,i=t.max;ct(this.min)&&(this.min=n),ct(this.max)&&(this.max=i),this.min>this.max&&(this.min=n,this.max=i)},e.prototype.calculateTicks=function(){var t=this,n=r.prototype.calculateTicks.call(this);return this.nice||(n=Mc(n,function(i){return i>=t.min&&i<=t.max})),n},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;return(t-i)/(n-i)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(m1),ql=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="linear",t.isLinear=!0,t}return e.prototype.invert=function(t){var n=this.getInvertPercent(t);return this.min+n*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(Nv);function No(r,e){var t=Math.E,n;return e>=0?n=Math.pow(t,Math.log(e)/r):n=Math.pow(t,Math.log(-e)/r)*-1,n}function pi(r,e){return r===1?1:Math.log(e)/Math.log(r)}function sN(r,e,t){ct(t)&&(t=Math.max.apply(null,r));var n=t;return ye(r,function(i){i>0&&i<n&&(n=i)}),n===t&&(n=t/e),n>1&&(n=1),n}var bue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="log",t}return e.prototype.invert=function(t){var n=this.base,i=pi(n,this.max),a=this.rangeMin(),o=this.rangeMax()-a,s,u=this.positiveMin;if(u){if(t===0)return 0;s=pi(n,u/n);var f=1/(i-s)*o;if(t<f)return t/f*u}else s=pi(n,this.min);var l=(t-a)/o,c=l*(i-s)+s;return Math.pow(n,c)},e.prototype.initCfg=function(){this.tickMethod="log",this.base=10,this.tickCount=6,this.nice=!0},e.prototype.setDomain=function(){r.prototype.setDomain.call(this);var t=this.min;if(t<0)throw new Error("When you use log scale, the minimum value must be greater than zero!");t===0&&(this.positiveMin=sN(this.values,this.base,this.max))},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;if(n===i||t<=0)return 0;var a=this.base,o=this.positiveMin;o&&(i=o*1/a);var s;return t<o?s=t/o/(pi(a,n)-pi(a,i)):s=(pi(a,t)-pi(a,i))/(pi(a,n)-pi(a,i)),s},e}(Nv),xue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="pow",t}return e.prototype.invert=function(t){var n=this.getInvertPercent(t),i=this.exponent,a=No(i,this.max),o=No(i,this.min),s=n*(a-o)+o,u=s>=0?1:-1;return Math.pow(s,i)*u},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;if(n===i)return 0;var a=this.exponent,o=(No(a,t)-No(a,i))/(No(a,n)-No(a,i));return o},e}(Nv),wue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="time",t}return e.prototype.getText=function(t,n){var i=this.translate(t),a=this.formatter;return a?a(i,n):aN(i,this.mask)},e.prototype.scale=function(t){var n=t;return(Pe(n)||wp(n))&&(n=this.translate(n)),r.prototype.scale.call(this,n)},e.prototype.translate=function(t){return Lv(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,n=this.getConfig("min"),i=this.getConfig("max");if((!ct(n)||!ht(n))&&(this.min=this.translate(this.min)),(!ct(i)||!ht(i))&&(this.max=this.translate(this.max)),t&&t.length){var a=[],o=1/0,s=o,u=0;ye(t,function(f){var l=Lv(f);if(isNaN(l))throw new TypeError("Invalid Time: "+f+" in time scale!");o>l?(s=o,o=l):s>l&&(s=l),u<l&&(u=l),a.push(l)}),t.length>1&&(this.minTickInterval=s-o),ct(n)&&(this.min=o),ct(i)&&(this.max=u)}},e}(ql),uN=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantize",t}return e.prototype.invert=function(t){var n=this.ticks,i=n.length,a=this.getInvertPercent(t),o=Math.floor(a*(i-1));if(o>=i-1)return ri(n);if(o<0)return Xi(n);var s=n[o],u=n[o+1],f=o/(i-1),l=(o+1)/(i-1);return s+(a-f)/(l-f)*(u-s)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var t=r.prototype.calculateTicks.call(this);return this.nice||(ri(t)!==this.max&&t.push(this.max),Xi(t)!==this.min&&t.unshift(this.min)),t},e.prototype.getScalePercent=function(t){var n=this.ticks;if(t<Xi(n))return 0;if(t>ri(n))return 1;var i=0;return ye(n,function(a,o){if(t>=a)i=o;else return!1}),i/(n.length-1)},e}(Nv),Eue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantile",t}return e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(uN),fN={};function _ue(r){return fN[r]}function ma(r,e){if(_ue(r))throw new Error("type '"+r+"' existed.");fN[r]=e}var Sue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="identity",t.isIdentity=!0,t}return e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&ht(t)?t:this.range[0]},e.prototype.invert=function(t){var n=this.range;return t<n[0]||t>n[1]?NaN:this.values[0]},e}(m1);function lN(r){var e=r.values,t=r.tickInterval,n=r.tickCount,i=r.showLast;if(ht(t)){var a=Mc(e,function(v,p){return p%t===0}),o=ri(e);return i&&ri(a)!==o&&a.push(o),a}var s=e.length,u=r.min,f=r.max;if(ct(u)&&(u=0),ct(f)&&(f=e.length-1),!ht(n)||n>=s)return e.slice(u,f+1);if(n<=0||f<=0)return[];for(var l=n===1?s:Math.floor(s/(n-1)),c=[],h=u,d=0;d<n&&!(h>=f);d++)h=Math.min(u+d*l,f),d===n-1&&i?c.push(e[f]):c.push(e[h]);return c}function Mue(r){var e=r.min,t=r.max,n=r.nice,i=r.tickCount,a=new Cue;return a.domain([e,t]),n&&a.nice(i),a.ticks(i)}var x1=5,cN=Math.sqrt(50),hN=Math.sqrt(10),dN=Math.sqrt(2),Cue=function(){function r(){this._domain=[0,1]}return r.prototype.domain=function(e){return e?(this._domain=Array.from(e,Number),this):this._domain.slice()},r.prototype.nice=function(e){var t,n;e===void 0&&(e=x1);var i=this._domain.slice(),a=0,o=this._domain.length-1,s=this._domain[a],u=this._domain[o],f;return u<s&&(t=[u,s],s=t[0],u=t[1],n=[o,a],a=n[0],o=n[1]),f=Ov(s,u,e),f>0?(s=Math.floor(s/f)*f,u=Math.ceil(u/f)*f,f=Ov(s,u,e)):f<0&&(s=Math.ceil(s*f)/f,u=Math.floor(u*f)/f,f=Ov(s,u,e)),f>0?(i[a]=Math.floor(s/f)*f,i[o]=Math.ceil(u/f)*f,this.domain(i)):f<0&&(i[a]=Math.ceil(s*f)/f,i[o]=Math.floor(u*f)/f,this.domain(i)),this},r.prototype.ticks=function(e){return e===void 0&&(e=x1),Aue(this._domain[0],this._domain[this._domain.length-1],e||x1)},r}();function Aue(r,e,t){var n,i=-1,a,o,s;if(e=+e,r=+r,t=+t,r===e&&t>0)return[r];if((n=e<r)&&(a=r,r=e,e=a),(s=Ov(r,e,t))===0||!isFinite(s))return[];if(s>0)for(r=Math.ceil(r/s),e=Math.floor(e/s),o=new Array(a=Math.ceil(e-r+1));++i<a;)o[i]=(r+i)*s;else for(r=Math.floor(r*s),e=Math.ceil(e*s),o=new Array(a=Math.ceil(r-e+1));++i<a;)o[i]=(r-i)/s;return n&&o.reverse(),o}function Ov(r,e,t){var n=(e-r)/Math.max(0,t),i=Math.floor(Math.log(n)/Math.LN10),a=n/Math.pow(10,i);return i>=0?(a>=cN?10:a>=hN?5:a>=dN?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=cN?10:a>=hN?5:a>=dN?2:1)}function vN(r,e,t){var n;return t==="ceil"?n=Math.ceil(r/e):t==="floor"?n=Math.floor(r/e):n=Math.round(r/e),n*e}function w1(r,e,t){var n=vN(r,t,"floor"),i=vN(e,t,"ceil");n=Tc(n,t),i=Tc(i,t);for(var a=[],o=Math.max((i-n)/(Math.pow(2,12)-1),t),s=n;s<=i;s=s+o){var u=Tc(s,o);a.push(u)}return{min:n,max:i,ticks:a}}function E1(r,e,t){var n,i=r.minLimit,a=r.maxLimit,o=r.min,s=r.max,u=r.tickCount,f=u===void 0?5:u,l=ct(i)?ct(e)?o:e:i,c=ct(a)?ct(t)?s:t:a;if(l>c&&(n=[l,c],c=n[0],l=n[1]),f<=2)return[l,c];for(var h=(c-l)/(f-1),d=[],v=0;v<f;v++)d.push(l+h*v);return d}function Tue(r){var e=r.min,t=r.max,n=r.tickInterval,i=r.minLimit,a=r.maxLimit,o=Mue(r);return!ct(i)||!ct(a)?E1(r,Xi(o),ri(o)):n?w1(e,t,n).ticks:o}function ws(r){return Math.abs(r)<1e-15?r:parseFloat(r.toFixed(15))}var Iue=[1,5,2,2.5,4,3],pN=Number.EPSILON*100;function kue(r,e){return(r%e+e)%e}function Lue(r){return Math.round(r*1e12)/1e12}function Nue(r,e,t,n,i,a){var o=Nc(e),s=_p(e,r),u=0,f=kue(n,a);return(f<pN||a-f<pN)&&n<=0&&i>=0&&(u=1),1-s/(o-1)-t+u}function Oue(r,e,t){var n=Nc(e),i=_p(e,r),a=1;return 1-i/(n-1)-t+a}function Due(r,e,t,n,i,a){var o=(r-1)/(a-i),s=(e-1)/(Math.max(a,n)-Math.min(t,i));return 2-Math.max(o/s,s/o)}function Pue(r,e){return r>=e?2-(r-1)/(e-1):1}function Rue(r,e,t,n){var i=e-r;return 1-.5*(Math.pow(e-n,2)+Math.pow(r-t,2))/Math.pow(.1*i,2)}function Bue(r,e,t){var n=e-r;if(t>n){var i=(t-n)/2;return 1-Math.pow(i,2)/Math.pow(.1*n,2)}return 1}function Fue(){return 1}function Gue(r,e,t,n,i,a){t===void 0&&(t=5),n===void 0&&(n=!0),i===void 0&&(i=Iue),a===void 0&&(a=[.25,.2,.5,.05]);var o=t<0?0:Math.round(t);if(Number.isNaN(r)||Number.isNaN(e)||typeof r!="number"||typeof e!="number"||!o)return{min:0,max:0,ticks:[]};if(e-r<1e-15||o===1)return{min:r,max:e,ticks:[r]};if(e-r>1e148){var s=t||5,u=(e-r)/s;return{min:r,max:e,ticks:Array(s).fill(null).map(function(W,J){return ws(r+u*J)})}}for(var f={score:-2,lmin:0,lmax:0,lstep:0},l=1;l<1/0;){for(var c=0;c<i.length;c+=1){var h=i[c],d=Oue(h,i,l);if(a[0]*d+a[1]+a[2]+a[3]<f.score){l=1/0;break}for(var v=2;v<1/0;){var p=Pue(v,o);if(a[0]*d+a[1]+a[2]*p+a[3]<f.score)break;for(var g=(e-r)/(v+1)/l/h,y=Math.ceil(Math.log10(g));y<1/0;){var m=l*h*Math.pow(10,y),b=Bue(r,e,m*(v-1));if(a[0]*d+a[1]*b+a[2]*p+a[3]<f.score)break;var x=Math.floor(e/m)*l-(v-1)*l,w=Math.ceil(r/m)*l;if(x<=w)for(var s=w-x,E=0;E<=s;E+=1){var _=x+E,M=_*(m/l),C=M+m*(v-1),S=m,A=Nue(h,i,l,M,C,S),T=Rue(r,e,M,C),k=Due(v,o,r,e,M,C),O=Fue(),G=a[0]*A+a[1]*T+a[2]*k+a[3]*O;G>f.score&&(!n||M<=r&&C>=e)&&(f.lmin=M,f.lmax=C,f.lstep=S,f.score=G)}y+=1}v+=1}}l+=1}var D=ws(f.lmax),$=ws(f.lmin),Y=ws(f.lstep),N=Math.floor(Lue((D-$)/Y))+1,P=new Array(N);P[0]=ws($);for(var c=1;c<N;c++)P[c]=ws(P[c-1]+Y);return{min:Math.min(r,Xi(P)),max:Math.max(e,ri(P)),ticks:P}}function zue(r){var e=r.min,t=r.max,n=r.tickCount,i=r.nice,a=r.tickInterval,o=r.minLimit,s=r.maxLimit,u=Gue(e,t,n,i).ticks;return!ct(o)||!ct(s)?E1(r,Xi(u),ri(u)):a?w1(e,t,a).ticks:u}function $ue(r){var e=r.base,t=r.tickCount,n=r.min,i=r.max,a=r.values,o,s=pi(e,i);if(n>0)o=Math.floor(pi(e,n));else{var u=sN(a,e,i);o=Math.floor(pi(e,u))}for(var f=s-o,l=Math.ceil(f/t),c=[],h=o;h<s+l;h=h+l)c.push(Math.pow(e,h));return n<=0&&c.unshift(0),c}function gN(r,e,t){if(t===void 0&&(t=5),r===e)return{max:e,min:r,ticks:[r]};var n=t<0?0:Math.round(t);if(n===0)return{max:e,min:r,ticks:[]};var i=1.5,a=.5+1.5*i,o=e-r,s=o/n,u=Math.pow(10,Math.floor(Math.log10(s))),f=u;2*u-s<i*(s-f)&&(f=2*u,5*u-s<a*(s-f)&&(f=5*u,10*u-s<i*(s-f)&&(f=10*u)));for(var l=Math.ceil(e/f),c=Math.floor(r/f),h=Math.max(l*f,e),d=Math.min(c*f,r),v=Math.floor((h-d)/f)+1,p=new Array(v),g=0;g<v;g++)p[g]=ws(d+g*f);return{min:d,max:h,ticks:p}}function jue(r){var e=r.exponent,t=r.tickCount,n=Math.ceil(No(e,r.max)),i=Math.floor(No(e,r.min)),a=gN(i,n,t).ticks;return a.map(function(o){var s=o>=0?1:-1;return Math.pow(o,e)*s})}function Uue(r,e){var t=r.length*e;return e===1?r[r.length-1]:e===0?r[0]:t%1!==0?r[Math.ceil(t)-1]:r.length%2===0?(r[t-1]+r[t])/2:r[t]}function Xue(r){var e=r.tickCount,t=r.values;if(!t||!t.length)return[];for(var n=t.slice().sort(function(s,u){return s-u}),i=[],a=0;a<e;a++){var o=a/(e-1);i.push(Uue(n,o))}return i}function Yue(r){var e=r.min,t=r.max,n=r.tickCount,i=r.tickInterval,a=r.minLimit,o=r.maxLimit,s=gN(e,t,n).ticks;return!ct(a)||!ct(o)?E1(r,Xi(s),ri(s)):i?w1(e,t,i).ticks:s}function Wue(r){var e=r.min,t=r.max,n=r.minTickInterval,i=r.tickInterval,a=r.tickCount;if(i)a=Math.ceil((t-e)/i);else{i=yue(e,t,a)[1];var o=(t-e)/i,s=o/a;s>1&&(i=i*Math.ceil(s)),n&&i<n&&(i=n)}i=Math.max(Math.floor((t-e)/(Math.pow(2,12)-1)),i);for(var u=[],f=e;f<t+i;f+=i)u.push(f);return u}function Vue(r){var e=lN(B({showLast:!0},r));return e}function Dv(r){return new Date(r).getFullYear()}function Hue(r){return new Date(r,0,1).getTime()}function _1(r){return new Date(r).getMonth()}function que(r,e){var t=Dv(r),n=Dv(e),i=_1(r),a=_1(e);return(n-t)*12+(a-i)%12}function Zue(r,e){return new Date(r,e,1).getTime()}function Kue(r,e){return Math.ceil((e-r)/Xa)}function Que(r,e){return Math.ceil((e-r)/xs)}function Jue(r,e){return Math.ceil((e-r)/(60*1e3))}function efe(r){var e=r.min,t=r.max,n=r.minTickInterval,i=r.tickCount,a=r.tickInterval,o=[];a||(a=(t-e)/i,n&&a<n&&(a=n)),a=Math.max(Math.floor((t-e)/(Math.pow(2,12)-1)),a);var s=Dv(e);if(a>oN)for(var u=Dv(t),f=Math.ceil(a/oN),l=s;l<=u+f;l=l+f)o.push(Hue(l));else if(a>Vl)for(var c=Math.ceil(a/Vl),h=_1(e),d=que(e,t),l=0;l<=d+c;l=l+c)o.push(Zue(s,l+h));else if(a>Xa)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),y=v.getDate(),m=Math.ceil(a/Xa),b=Kue(e,t),l=0;l<b+m;l=l+m)o.push(new Date(p,g,y+l).getTime());else if(a>xs)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),m=v.getDate(),x=v.getHours(),w=Math.ceil(a/xs),E=Que(e,t),l=0;l<=E+w;l=l+w)o.push(new Date(p,g,m,x+l).getTime());else if(a>bs)for(var _=Jue(e,t),M=Math.ceil(a/bs),l=0;l<=_+M;l=l+M)o.push(e+l*bs);else{var C=a;C<Pi&&(C=Pi);for(var S=Math.floor(e/Pi)*Pi,A=Math.ceil((t-e)/Pi),T=Math.ceil(C/Pi),l=0;l<A+T;l=l+T)o.push(S+l*Pi)}return o.length>=512&&console.warn("Notice: current ticks length("+o.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+a+") is too small, increase the value to solve the problem!"),o}ya("cat",lN),ya("time-cat",Vue),ya("wilkinson-extended",zue),ya("r-pretty",Yue),ya("time",Wue),ya("time-pretty",efe),ya("log",$ue),ya("pow",jue),ya("quantile",Xue),ya("d3-linear",Tue),ma("cat",Yl),ma("category",Yl),ma("identity",Sue),ma("linear",ql),ma("log",bue),ma("pow",xue),ma("time",wue),ma("timeCat",mue),ma("quantize",uN),ma("quantile",Eue);var tfe=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))};function rfe(r){return zo(r,function(e,t){var n=t===0?"M":"L",i=e[0],a=e[1];return[n,i,a]})}function yN(r){return rfe(r)}function nfe(r){if(r.length<=2)return yN(r);var e=[];ye(r,function(o){Qa(o,e.slice(e.length-2))||e.push(o[0],o[1])});var t=l_(e,!1),n=Xi(r),i=n[0],a=n[1];return t.unshift(["M",i,a]),t}function ife(r,e,t,n){n===void 0&&(n=!0);var i=new ql({values:r}),a=new Yl({values:zo(r,function(s,u){return u})}),o=zo(r,function(s,u){return[a.scale(u)*e,t-i.scale(s)*t]});return n?nfe(o):yN(o)}function afe(r,e,t,n){n===void 0&&(n=5);for(var i=new ql({values:r}),a=new Yl({values:zo(r,function(h,d){return d})}),o=zo(r,function(h,d){return[a.scale(d)*e,t-i.scale(h)*t]}),s=[],u=0;u<o.length;u++){var f=o[u],l={x:f[0],y:f[1],y0:t,size:n},c=ufe(l);s.push.apply(s,c)}return ffe(s)}function ofe(r,e){var t=new ql({values:r}),n=Math.max(0,t.min);return e-t.scale(n)*e}function sfe(r,e,t,n){var i=tfe([],r,!0),a=ofe(n,t);return i.push(["L",e,a]),i.push(["L",0,a]),i.push(["Z"]),i}function ufe(r){var e=r.x,t=r.y,n=r.y0,i=r.size,a,o;vt(t)?(a=t[0],o=t[1]):(a=n,o=t);var s,u;vt(e)?(s=e[0],u=e[1]):(s=e-i/2,u=e+i/2);var f=[{x:s,y:a},{x:s,y:o}];return f.push({x:u,y:o},{x:u,y:a}),f}function ffe(r,e){e===void 0&&(e=!0);var t=[],n=r[0];t.push(["M",n.x,n.y]);for(var i=1,a=r.length;i<a;i++)t.push(["L",r[i].x,r[i].y]);return e&&(t.push(["L",n.x,n.y]),t.push(["z"])),t}var Zl=function(){return Zl=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Zl.apply(this,arguments)},lfe={stroke:"#C5C5C5",strokeOpacity:.85},cfe={fill:"#CACED4",opacity:.85},hfe=function(){function r(e){var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.width,s=o===void 0?200:o,u=e.height,f=u===void 0?26:u,l=e.smooth,c=l===void 0?!0:l,h=e.isArea,d=h===void 0?!1:h,v=e.data,p=v===void 0?[]:v,g=e.lineStyle,y=e.areaStyle,m=e.group,b=e.interval,x=b===void 0?null:b;this.group=m,this.x=n,this.y=a,this.width=s,this.height=f,this.data=p,this.smooth=c,this.isArea=d,this.lineStyle=Object.assign({},lfe,g),this.areaStyle=Object.assign({},cfe,y),this.intervalConfig=x,this.renderLine()}return r.prototype.renderLine=function(){var e=this,t=e.x,n=e.y,i=e.width,a=e.height;e.barWidth;var o=e.data,s=e.smooth,u=e.isArea,f=e.lineStyle,l=e.areaStyle,c=this.group.addGroup({name:"trend-group"});if(o){var h=ife(o,i,a,s);if(c.addShape("path",{attrs:Zl({path:h},f),name:"trend-line"}),u){var d=sfe(h,i,a,o);c.addShape("path",{attrs:Zl({path:d},l),name:"trend-area"})}}this.intervalConfig&&c.addShape("path",{attrs:Zl({path:afe(this.intervalConfig.data,i,a,this.intervalConfig.style.barWidth)},this.intervalConfig.style),name:"trend-interval"}),c.move(t,n)},r.prototype.destory=function(){this.group.destroy()},r}(),$u=function(){return $u=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},$u.apply(this,arguments)},dfe={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},vfe={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize"},mN=function(){function r(e){var t=e.group,n=e.name,i=e.type,a=e.x,o=a===void 0?0:a,s=e.y,u=s===void 0?0:s,f=e.width,l=f===void 0?2:f,c=e.height,h=c===void 0?24:c,d=e.style,v=d===void 0?{}:d;this.group=t,this.name=n,this.handleType=i,this.x=o,this.y=u,this.width=l,this.height=h,i==="trend"?this.style=$u($u({},dfe),v):i==="simple"&&(this.style=$u($u({},vfe),v)),this.renderHandle()}return r.prototype.setX=function(e){this.setXY(e,void 0)},r.prototype.setY=function(e){this.setXY(void 0,e)},r.prototype.setXY=function(e,t){ht(e)&&(this.x=e),ht(t)&&(this.y=t),this.updateXY()},r.prototype.renderHandle=function(){var e=this,t=e.width,n=e.height,i=e.style,a=e.name,o=i.fill,s=i.stroke,u=i.radius,f=i.opacity,l=i.cursor;this.handleGroup=this.group.addGroup(),this.handleType==="trend"?(this.verticalLine=this.handleGroup.addShape("rect",{attrs:{x:0,y:0,width:t,height:n,fill:o,stroke:s,radius:u,opacity:f,cursor:l},name:"".concat(a,"-handler")}),this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:0,r:2*t,fill:o,stroke:s,radius:u,opacity:f,cursor:l,lineAppendWidth:12},name:"".concat(a,"-handler")}),this.bottomCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:n,r:2*t,fill:o,stroke:s,radius:u,opacity:f,cursor:l},name:"".concat(a,"-handler")})):this.handleType==="simple"&&(this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:n/2,r:2*t,fill:o,stroke:s,radius:u,opacity:f,cursor:l,lineWidth:2},name:"".concat(a,"-handler")})),this.updateXY(),this.handleType==="trend"?this.bindTrendEvents():this.handleType==="simple"&&this.bindSimpleEvents()},r.prototype.bindSimpleEvents=function(){var e=this,t=this.name;this.handleGroup.on("".concat(t,"-handler:mouseenter"),function(){var n=e.style.highLightFill;e.topCircle.attr("fill",n)}),this.handleGroup.on("".concat(t,"-handler:mouseleave"),function(){var n=e.style.fill;e.topCircle.attr("fill",n)})},r.prototype.bindTrendEvents=function(){var e=this,t=this.name;this.handleGroup.on("".concat(t,"-handler:mouseenter"),function(){var n=e.style.highLightFill;e.verticalLine.attr("fill",n),e.topCircle.attr("fill",n),e.bottomCircle.attr("fill",n)}),this.handleGroup.on("".concat(t,"-handler:mouseleave"),function(){var n=e.style.fill;e.verticalLine.attr("fill",n),e.topCircle.attr("fill",n),e.bottomCircle.attr("fill",n)})},r.prototype.show=function(){this.handleGroup.show()},r.prototype.hide=function(){this.handleGroup.hide()},r.prototype.updateXY=function(){this.handleGroup.setMatrix([1,0,0,0,1,0,this.x,this.y,1])},r}(),br=function(){return br=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},br.apply(this,arguments)},pfe=ni,gfe={fill:"#416180",opacity:.05},yfe={fill:"#416180",opacity:.15,radius:5},mfe={fill:"#5B8FF9",opacity:.3,cursor:"grab"},S1=2,bfe={width:S1,height:24},xfe={textBaseline:"middle",fill:"#000",opacity:.45},wfe={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},Efe={lineWidth:1,stroke:"#ccc"},_fe=function(){function r(e){var t=this;this.prevX=0,this.onMouseDown=function(W){return function(J){t.currentHandler=W;var te=J.originalEvent;te.stopPropagation(),te.preventDefault(),t.prevX=Ea(te,"touches.0.pageX",te.pageX);var H=t.canvas.get("container");H.addEventListener("mousemove",t.onMouseMove),H.addEventListener("mouseup",t.onMouseUp),H.addEventListener("mouseleave",t.onMouseUp),H.addEventListener("touchmove",t.onMouseMove),H.addEventListener("touchend",t.onMouseUp),H.addEventListener("touchcancel",t.onMouseUp)}},this.onMouseMove=function(W){W.stopPropagation(),W.preventDefault();var J=Ea(W,"touches.0.pageX",W.pageX),te=J-t.prevX,H=t.adjustOffsetRange(te/t.width);t.updateStartEnd(H),t.updateUI(),t.prevX=J},this.onMouseUp=function(){t.currentHandler&&(t.currentHandler=void 0);var W=t.canvas.get("container");W&&(W.removeEventListener("mousemove",t.onMouseMove),W.removeEventListener("mouseup",t.onMouseUp),W.removeEventListener("mouseleave",t.onMouseUp),W.removeEventListener("touchmove",t.onMouseMove),W.removeEventListener("touchend",t.onMouseUp),W.removeEventListener("touchcancel",t.onMouseUp))};var n=e.x,i=n===void 0?0:n,a=e.y,o=a===void 0?0:a,s=e.width,u=s===void 0?100:s,f=e.height,l=e.padding,c=l===void 0?10:l,h=e.trendCfg,d=e.controllerCfg,v=d===void 0?{speed:1}:d,p=e.backgroundStyle,g=p===void 0?{}:p,y=e.foregroundStyle,m=y===void 0?{}:y,b=e.handlerStyle,x=b===void 0?{}:b,w=e.textStyle,E=w===void 0?{}:w,_=e.start,M=_===void 0?0:_,C=e.end,S=C===void 0?1:C,A=e.minText,T=A===void 0?"":A,k=e.maxText,O=k===void 0?"":k,G=e.group,D=e.graph,$=e.canvas,Y=e.tick,N=Y===void 0?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(J){return J},ticks:[]}:Y,P=e.type;this.graph=D,this.canvas=$,this.group=G,this.timeBarType=P,this.x=i,this.y=o,this.width=u,this.height=f,this.padding=c,this.ticks=N.ticks,this.trendCfg=h,this.controllerCfg=v,this.currentSpeed=v.speed||1,this.tickLabelFormatter=N.tickLabelFormatter,P==="trend"?this.backgroundStyle=br(br({},gfe),g):P==="simple"&&(this.backgroundStyle=br(br({},yfe),g)),this.foregroundStyle=br(br({},mfe),m),this.handlerStyle=br(br({},bfe),x),this.textStyle=br(br({},xfe),E),this.tickLabelStyle=br(br({},wfe),N.tickLabelStyle),this.tickLineStyle=br(br({},Efe),N.tickLineStyle),this.currentMode=v.defaultTimeType||ga.RANGE,this.start=M,this.end=S,this.minText=T,this.maxText=O,this.fontFamily=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlider()}return r.prototype.update=function(e){var t=e.x,n=e.y,i=e.width,a=e.height,o=e.minText,s=e.maxText,u=e.start,f=e.end;this.start=Math.min(1,Math.max(u,0)),this.end=Math.min(1,Math.max(f,0)),gt(this,{x:t,y:n,width:i,height:a,minText:o,maxText:s}),this.updateUI()},r.prototype.setText=function(e,t){this.minTextShape.attr("text",e),this.maxTextShape.attr("text",t)},r.prototype.renderSlider=function(){var e=this,t=this,n=t.width,i=t.height,a=t.timeBarType;if(a==="trend"&&Nc(Ea(this.trendCfg,"data"))){var o=new hfe(br(br({x:this.x,y:this.y,width:n,height:i},this.trendCfg),{group:this.group}));this.trendComponent=o}var s=this.group.addGroup({name:"slider-group"});s.addShape("rect",{attrs:br({x:0,y:0,width:n,height:i},this.backgroundStyle),name:"background"});var u=this.group.addGroup();a==="trend"?(this.minTextShape=u.addShape("text",{attrs:br({x:0,y:i/2+this.y,textAlign:"right",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=u.addShape("text",{attrs:br({y:i/2+this.y,textAlign:"left",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})):(this.minTextShape=u.addShape("text",{attrs:br({x:0,y:this.y-10,textAlign:"center",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=u.addShape("text",{attrs:br({y:this.y-10,textAlign:"center",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})),this.foregroundShape=this.group.addGroup().addShape("rect",{attrs:br({x:0,y:this.y,height:i},this.foregroundStyle),name:"foreground-shape"}),this.foregroundShape.on("mousedown",function(y){y.target.attr("cursor","grabbing")}),this.foregroundShape.on("mouseup",function(y){y.target.attr("cursor",e.foregroundStyle.cursor||"grab")});var f=Ea(this.handlerStyle,"width",2),l=Ea(this.handlerStyle,"height",24),c=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new mN({name:"minHandlerShape",group:c,type:a,x:this.x,y:this.y,width:f,height:l,style:this.handlerStyle});var h=this.group.addGroup({name:"maxHandlerShape"});this.maxHandlerShape=new mN({name:"maxHandlerShape",group:h,type:a,x:this.x,y:this.y,width:f,height:l,style:this.handlerStyle});var d=this.ticks,v=n/(d.length-1);this.tickPosList=[],this.textList&&this.textList.length&&this.textList.forEach(function(y){y.destroy()});var p=-1/0,g=this.tickLabelStyle.rotate;delete this.tickLabelStyle.rotate,this.textList=d.map(function(y,m){e.tickPosList.push(e.x+m*v);var b;e.tickLabelFormatter?(b=e.tickLabelFormatter(y),!Pe(b)&&b&&(b=y.date)):b=y.date;var x=e.x+m*v,w=e.y+i+5,E=e.group.addShape("text",{attrs:br({x,y:w,text:b,fontFamily:e.fontFamily||"Arial, sans-serif"},e.tickLabelStyle),name:"tick-label"});if(ht(g)&&m!==d.length-1){var _=pfe([1,0,0,0,1,0,0,0,1],[["t",-x,-w],["r",g],["t",x-5,w+2]]);E.attr({textAlign:"left",matrix:_})}m===0?E.attr({textAlign:"left"}):m!==d.length-1&&E.attr({textAlign:"right"});var M=e.group.addShape("line",{attrs:br({x1:e.x+m*v,y1:e.y+i+2,x2:e.x+m*v,y2:e.y+i+6},e.tickLineStyle),name:"tick-line"});M.toBack();var C=E.getBBox();return C.minX>p?(E.show(),M.show(),p=C.minX+C.width+10):(E.hide(),M.hide()),E}),this.controllerBtnGroup=new GL(br({group:this.group,x:this.x,y:this.y+i+25,width:n,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),s.move(this.x,this.y),this.bindEvents(),this.currentMode===ga.SINGLE&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},r.prototype.bindEvents=function(){var e=this,t=this.group.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),t.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),n.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat(Ao,":click"),function(){e.isPlay=!e.isPlay,e.currentHandler=e.maxHandlerShape,e.changePlayStatus()}),this.group.on("".concat($l,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(.01),e.updateUI()}),this.group.on("".concat(jl,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(-.01),e.updateUI()}),this.group.on(ms,function(i){var a=i.type,o=i.speed;e.currentSpeed=o,e.currentMode=a,a===ga.SINGLE?(e.minHandlerShape.hide(),e.foregroundShape.hide(),e.minTextShape.hide()):a===ga.RANGE&&(e.minHandlerShape.show(),e.foregroundShape.show(),e.minTextShape.show())})},r.prototype.adjustTickIndex=function(e){for(var t=0;t<this.tickPosList.length-1;t++)if(this.tickPosList[t]<=e&&e<=this.tickPosList[t+1])return Math.abs(this.tickPosList[t]-e)<Math.abs(e-this.tickPosList[t+1])?t:t+1;return 0},r.prototype.adjustOffsetRange=function(e){switch(this.currentHandler){case this.minHandlerShape:{var t=0-this.start,n=1-this.start;return Math.min(n,Math.max(t,e))}case this.maxHandlerShape:{var t=0-this.end,n=1-this.end;return Math.min(n,Math.max(t,e))}case this.foregroundShape:{var t=0-this.start,n=1-this.end;return Math.min(n,Math.max(t,e))}default:return 0}},r.prototype.updateStartEnd=function(e){var t=this.ticks[this.adjustTickIndex(this.start*this.width)],n=this.ticks[this.adjustTickIndex(this.end*this.width)];if(!this.currentHandler){this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t==null?void 0:t.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n==null?void 0:n.date;return}switch(this.currentHandler){case this.minHandlerShape:this.maxText=this.maxTextShape.attr("text"),this.start+=e,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t.date;break;case this.maxHandlerShape:this.minText=this.minTextShape.attr("text"),this.end+=e,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break;case this.foregroundShape:this.start+=e,this.end+=e,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break}},r.prototype.updateUI=function(){var e=this;this.start<0&&(this.start=0),this.start>1&&(this.start=1),this.end>1&&(this.end=1),this.end<0&&(this.end=0);var t=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",t),this.foregroundShape.attr("width",n-t);var i=Ea(this.handlerStyle,"width",S1);this.setText(this.minText,this.maxText);var a=this.dodgeText([t,n]),o=a[0],s=a[1];this.minHandlerShape.setX(t-i/2),ye(o,function(u,f){return e.minTextShape.attr(f,u)}),this.maxHandlerShape.setX(n-i/2),ye(s,function(u,f){return e.maxTextShape.attr(f,u)}),this.currentMode===ga.RANGE?this.graph.emit(pa,{value:[this.start,this.end].sort()}):this.currentMode===ga.SINGLE&&this.graph.emit(pa,{value:[this.end,this.end]})},r.prototype.dodgeText=function(e){var t,n,i=2,a=Ea(this.handlerStyle,"width",S1),o=this.minTextShape,s=this.maxTextShape,u=e[0],f=e[1],l=!1;u>f&&(t=[f,u],u=t[0],f=t[1],n=[s,o],o=n[0],s=n[1],l=!0);var c=o.getBBox(),h=s.getBBox(),d=null,v=null;return this.timeBarType==="trend"?(d=u-c.width<this.x+i?{x:u+a/2+i,textAlign:"left"}:{x:u-a/2-i,textAlign:"right"},v=f+h.width>this.x+this.width?{x:f-a/2-i,textAlign:"right"}:{x:f+a/2+i,textAlign:"left"}):this.timeBarType==="simple"&&(d=o.attr("x")>c.width?{x:u,textAlign:"center"}:{x:u,textAlign:"left"},v=s.attr("x")>this.width-h.width?{x:f,textAlign:"right"}:{x:f,textAlign:"center"}),l?[v,d]:[d,v]},r.prototype.startPlay=function(){var e=this;return typeof window<"u"?window.requestAnimationFrame(function(){var t=e,n=t.ticks,i=t.width,a=e.currentSpeed,o=i/n.length,s=o/((10-a)*1e3/60),u=e.adjustOffsetRange(s/e.width);e.updateStartEnd(u),e.updateUI(),e.isPlay&&(e.playHandler=e.startPlay())}):void 0},r.prototype.changePlayStatus=function(e){e===void 0&&(e=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(PL,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(RL,null))},r.prototype.destory=function(){this.graph.off(pa,function(){});var e=this.group,t=e.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.off("minHandlerShape-handler:mousedown"),t.off("minHandlerShape-handler:touchstart"),t.destroy());var n=e.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.off("maxHandlerShape-handler:mousedown"),n.off("maxHandlerShape-handler:touchstart"),n.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),e.off("".concat(Ao,":click")),e.off("".concat($l,":click")),e.off("".concat(jl,":click")),e.off(ms),e.destroy(),this.trendComponent&&this.trendComponent.destory()},r}(),Sfe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ya=function(){return Ya=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ya.apply(this,arguments)},Mfe=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},Cfe=4,Afe=26,Tfe=function(r){Sfe(e,r);function e(t){var n=r.call(this,t)||this;return n.afterrenderListener=function(i){return n.filterData({})},n.valueChangeListener=uf(function(i){return n.filterData(i)},200,{trailing:!0,leading:!0}),n.changeData=function(i){var a=n.get("graph");n.cacheGraphData=a.get("data"),n.filterData({})},n}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-component-timebar",padding:10,type:"trend",trend:{data:[],isArea:!1,smooth:!0},controllerCfg:{speed:1,loop:!1},slider:{start:.1,end:.9,minText:"min",maxText:"max"},tick:{start:.1,end:.9,data:[]},textStyle:{},filterEdge:!1,filterItemTypes:["node"],containerCSS:{},putInGraphContainer:!0}},e.prototype.initContainer=function(){var t=this.get("graph"),n=this._cfgs,i=n.width,a=n.height,o=n.putInGraphContainer,s=this.get("className")||"g6-component-timebar",u=this.get("container"),f;if(u?(Pe(u)&&(u=document.getElementById(u)),f=u):(f=wr("<div class='".concat(s,"'></div>")),jt(f,{position:"relative"})),o){var l=this.get("graph").get("container");l.appendChild(f)}this.set("timeBarContainer",f);var c,h=t.get("renderer");h==="SVG"?c=new $f({container:f,width:i,height:a}):c=new Aa({container:f,width:i,height:a}),this.get("containerCSS")&&jt(f,this.get("containerCSS")),this.set("canvas",c)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas"),n=t.addGroup({name:"timebar-group"});this.set("timeBarGroup",n),this.renderTrend(),this.initEvent();var i=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",i)},e.prototype.play=function(){this.togglePlay(!0)},e.prototype.pause=function(){this.togglePlay(!1)},e.prototype.togglePlay=function(t){var n=this.get("timebar");n&&(n.isPlay=!!t,n.changePlayStatus())},e.prototype.renderTrend=function(){var t=this,n=this._cfgs,i=n.width,a=n.x,o=n.y,s=n.padding,u=n.type,f=n.trend,l=n.slider,c=n.controllerCfg,h=n.textStyle,d=n.tick,v=n.backgroundStyle,p=n.foregroundStyle,g=f.data,y=Mfe(f,["data"]),m=i-2*s,b=u==="trend"?Afe:Cfe,x=this.get("graph"),w=this.get("timeBarGroup"),E=this.get("canvas"),_=null;if(u==="trend"||u==="simple"){var M=this.get("getValue");_=new _fe(Ya(Ya({graph:x,canvas:E,group:w,type:u,x:a+s,y:u==="trend"?o+s:o+s+15,width:m,height:b,padding:s,backgroundStyle:v,foregroundStyle:p,trendCfg:Ya(Ya({},y),{data:g.map(function(S){return(M==null?void 0:M(S))||S.value})})},l),{tick:{ticks:g,tickLabelFormatter:d.tickLabelFormatter,tickLabelStyle:d.tickLabelStyle,tickLineStyle:d.tickLineStyle},handlerStyle:Ya(Ya({},l.handlerStyle),{height:l.height||b}),controllerCfg:c,textStyle:h}))}else u==="tick"&&(_=new sue(Ya({graph:x,canvas:E,group:w,x:a+s,y:o+s,width:i,height:42,padding:2,controllerCfg:c},d)));var C=function S(){var A=t.get("timebar");A.draggingHandler=!1,A.isPlay&&(A.isPlay=!1,A.currentHandler=A.maxHandlerShape,A.changePlayStatus()),document.removeEventListener("mouseup",S)};E.on("mousedown",function(S){(S.target.get("name")==="maxHandlerShape-handler"||S.target.get("name")==="minHandlerShape-handler"||S.target===_.foregroundShape)&&document.addEventListener("mouseup",C)}),this.set("timebar",_)},e.prototype.filterData=function(t){var n,i=t.value;if(!i){i=[];var a=this._cfgs.type;!a||a==="trend"||a==="simple"?(i[0]=this._cfgs.slider.start,i[1]=this._cfgs.slider.end):a==="tick"&&(i[0]=this._cfgs.tick.start,i[1]=this._cfgs.tick.end)}var o=null,s=this._cfgs.type;if(s==="trend"||s==="simple"?o=this._cfgs.trend.data:s==="tick"&&(o=this._cfgs.tick.data),!o||o.length===0){console.warn("请配置 TimeBar 组件的数据");return}var u=this.get("rangeChange"),f=this.get("graph"),l=Math.round(o.length*i[0]),c=Math.round(o.length*i[1]);c=c>=o.length?o.length-1:c,l=l>=o.length?o.length-1:l;var h=(n=this._cfgs.tick)===null||n===void 0?void 0:n.tickLabelFormatter,d=h?h(o[l]):o[l].date,v=h?h(o[c]):o[c].date;if(s!=="tick"){var p=this.get("timebar");p.setText(d,v)}if(u)u(f,d,v);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=f.get("data"));var g=this.get("filterItemTypes"),y=this.get("changeData"),m=this.get("getDate"),b=this.get("shouldIgnore"),x=o[l].date,w=o[c].date;if(y||y===void 0){var E=this.cacheGraphData.nodes,_=this.cacheGraphData.edges,M={},C={};f.getNodes().forEach(function(S){return M[S.getID()]=!0}),f.getEdges().forEach(function(S){return C[S.getID()]=!0}),g.includes("node")&&(E==null||E.forEach(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=w||(b==null?void 0:b("node",S,{min:x,max:w})),k=M[S.id];k&&!T?(f.removeItem(S.id),M[S.id]=!1):!k&&T&&(f.addItem("node",S),M[S.id]=!0)}),_==null||_.forEach(function(S){var A=M[S.source]&&M[S.target]||(b==null?void 0:b("edge",S,{min:x,max:w})),T=!!f.findById(S.id);T&&!A?(f.removeItem(S.id),C[S.id]=!1):!T&&A?(f.addItem("edge",S),C[S.id]=!0):T||(C[S.id]=!1)})),(this.get("filterEdge")||g.includes("edge"))&&(_==null||_.filter(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=w||(b==null?void 0:b("edge",S,{min:x,max:w})),k=M[S.source]&&M[S.target],O=T&&k,G=C[S.id];G&&!O?(C[S.id]=!1,f.removeItem(S.id)):!G&&O&&(C[S.id]=!0,f.addItem("edge",S))}))}else g.includes("node")&&f.getNodes().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("node",A,{min:x,max:w}))){var T=+((m==null?void 0:m(A))||A.date);T<x||T>w?f.hideItem(S):f.showItem(S)}}),(this.get("filterEdge")||g.includes("edge"))&&f.getEdges().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("edge",A,{min:o[l].date,max:o[c].date}))){var T=+((m==null?void 0:m(A))||A.date);if(T<o[l].date||T>o[c].date)f.hideItem(S);else{var k=S.getSource().isVisible(),O=S.getTarget().isVisible();k&&O&&f.showItem(S)}}})}},e.prototype.initEvent=function(){var t=this.get("graph");t.on("afterchangedata",this.changeData),t.on("afterrender",this.afterrenderListener),t.on(pa,this.valueChangeListener)},e.prototype.destroy=function(){var t=this.get("graph");t.off("afterchangedata",this.changeData),t.off("afterrender",this.afterrenderListener),t.off(pa,this.valueChangeListener);var n=this.get("timebar");n&&n.destory&&n.destory(),r.prototype.destroy.call(this);var i=this.get("timeBarContainer");if(i){var a=this.get("container");a||(a=this.get("graph").get("container")),Pe(a)&&(a=document.getElementById(a)),a===i&&(a=a.parentElement),a.removeChild(i)}},e}(zn),Ife=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kfe=bn.applyMatrix;function Lfe(r,e){var t,n;if(r.naturalWidth)t=r.naturalWidth,n=r.naturalHeight;else{var i=new Image;i.src=r.src,i.onload=function(){}}return[t,n]}var Nfe=function(r){Ife(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,n=this._cfgs,i=n.graph;if(!this.destroyed){var a=this.get("container");Pe(a)&&(a=document.getElementById(a));var o=wr("<div class=".concat(n.viewportClassName,`
      style='position:absolute;
        left:0;
        top:0;
        box-sizing:border-box;
        border: 2px solid #1980ff;
        cursor:move'
      </div>`)),s=0,u=0,f=!1,l=0,c=0,h=0,d=0,v=0,p=0;a.addEventListener("mousedown",function(g){if(n.refresh=!1,g.target===o){var y=o.style;h=parseInt(y.width,10),d=parseInt(y.height,10);var m=t.get("width"),b=t.get("height");h>m||d>b||(p=i.getZoom(),v=t.get("ratio"),f=!0,s=g.clientX,u=g.clientY)}},!1),a.addEventListener("mousemove",function(g){if(!(!f||ct(g.clientX)||ct(g.clientY))){var y=t.get("width"),m=t.get("height"),b=o.style;l=parseInt(b.left,10),c=parseInt(b.top,10),h=parseInt(b.width,10),d=parseInt(b.height,10);var x=s-g.clientX,w=u-g.clientY;l-x<0?x=l:l-x+h>=y&&(x=0),c-w<0?w=c:c-w+d>=m&&(w=0),l-=x,c-=w,jt(o,{left:"".concat(l,"px"),top:"".concat(c,"px")}),i.translate(x*p/v,w*p/v),s=g.clientX,u=g.clientY}},!1),a.addEventListener("mouseleave",function(){f=!1,n.refresh=!0},!1),a.addEventListener("mouseup",function(){f=!1,n.refresh=!0},!1),this.set("viewport",o),a.appendChild(o)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),n=this.get("width"),i=this.get("height"),a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=o/s,f=a.getGroup(),l=f.getCanvasBBox(),c=[(l.minX+l.maxX)/2,(l.minY+l.maxY)/2],h=[l.maxX-l.minX,l.maxY-l.minY],d={centerX:c[0],centerY:c[1],width:0,height:0,minX:0,minY:0};l[0]/l[1]>u?(d.width=h[0],d.height=d.width/u):(d.height=h[1],d.width=d.height*u),d.minX=c[0]-d.width/2,d.minY=c[1]-d.height/2;var v=f.getMatrix();v||(v=[1,0,0,0,1,0,0,0,1]);var p=Mp([1,0,0,0,1,0,0,0,1],v),g=kfe({x:d.minX,y:d.minY},p),y=a.getCanvasByPoint(g.x,g.y),m=this.get("viewport");m||this.initViewport();var b=o/d.width,x=b*n,w=b*i,E=n*-y.x/d.width,_=i*-y.y/d.height,M=E+x,C=_+w;E<0&&(x+=E,E=0),M>n&&(x=x-(M-n)),_<0&&(w+=_,_=0),C>i&&(w=w-(C-i)),this.set("ratio",t);var S="".concat(E,"px"),A="".concat(_,"px");jt(m,{left:S,top:A,width:"".concat(x,"px"),height:"".concat(w,"px")})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this,n=t.get("graph"),i=n.get("width"),a=n.get("height"),o=a/i,s=t.get("className"),u=t.get("container"),f=t.get("width"),l=t.get("height");!f&&!l&&(f=200),f?(l=o*f,t.set("height",l)):(f=1/o*l,t.set("width",f));var c=wr("<div class='".concat(s,"' style='width: ").concat(f,"px; height: ").concat(l,"px; overflow: hidden; position: relative;'></div>"));Pe(u)&&(u=document.getElementById(u)),u?u.appendChild(c):n.get("container").appendChild(c),t.set("container",c);var h=wr('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');c.appendChild(h);var d=wr('<span style="display: table-cell; vertical-align: middle; "></span>');h.appendChild(d),t.set("containerDOM",h),t.set("containerSpan",d);var v=wr('<img alt="" src="'.concat(this.get("graphImg"),'" style="display: inline-block; user-select: none;" draggable="false" />'));t.set("imgDOM",v),t.updateImgSize(),d.appendChild(v),t.updateCanvas()},e.prototype.updateImgSize=function(){var t=this,n=t.get("imgDOM"),i=t.get("width"),a=t.get("height");n.onload=function(){var o=Lfe(n);o[0]>o[1]?n.width=i:n.height=a}},e.prototype.updateCanvas=function(){var t=this.get("refresh");if(t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("width"),a=n.get("canvas").getCanvasBBox(),o=a.width,s=i/o;this.set("ratio",s),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){var n=this,i=n.get("imgDOM");i.remove(),n.set("graphImg",t);var a=wr('<img alt="" src="'.concat(t,'" style="display: inline-block;" ondragstart="return false;" onselectstart="return false;"/>'));n.set("imgDOM",a),a.src=t,n.updateImgSize();var o=n.get("containerSpan");o.appendChild(a),n.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(zn),Ofe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),M1=function(){return M1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},M1.apply(this,arguments)},Dfe=bn.distance,bN=.05,xN={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},Pfe=function(r){Ofe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:Vt(xN),showLabel:"edge",scaleRBy:"wheel"}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"filter"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"filter"};break}return t},e.prototype.init=function(){var t=this,n=t.get("showLabel"),i=n==="node"||n==="both",a=n==="edge"||n==="both";t.set("showNodeLabel",i),t.set("showEdgeLabel",a);var o=t.get("shouldShow");o||t.set("shouldShow",function(){return!0})},e.prototype.createDelegate=function(t){var n=this,i=n.get("delegate");(!i||i.destroyed)&&(n.filter(t),i=n.get("delegate"),i.on("dragstart",function(a){}),i.on("drag",function(a){n.filter(a)}),this.get("scaleRBy")==="wheel"&&i.on("mousewheel",function(a){n.scaleRByWheel(a)}))},e.prototype.scaleRByWheel=function(t){var n=this;if(!(!t||!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=n.get("graph"),a,o=n.get("delegate"),s=o?{x:o.attr("x"),y:o.attr("y")}:void 0;s||i.getPointByClient(t.clientX,t.clientY),t.originalEvent.wheelDelta<0?a=1-bN:a=1/(1-bN);var u=n.get("maxR"),f=n.get("minR"),l=n.get("r");(l>(u||i.get("height"))&&a>1||l<(f||i.get("height")*.05)&&a<1)&&(a=1),l*=a,n.set("r",l),n.filter(t)}},e.prototype.filter=function(t){var n=this,i=n.get("graph"),a=i.getNodes(),o={},s=n.get("r"),u=n.get("type"),f={x:t.x,y:t.y};n.updateDelegate(f,s);var l=n.get("shouldShow"),c=n.get("vShapes");c&&c.forEach(function(y){y.remove(),y.destroy()}),c=[],a.forEach(function(y){var m=y.getModel(),b=m.x,x=m.y;Dfe({x:b,y:x},f)<s&&(o[m.id]=y)});var h=i.getEdges(),d=[];h.forEach(function(y){var m=y.getModel(),b=m.source,x=m.target;l(m)&&(u==="only-source"||u==="one"?o[b]&&!o[x]&&d.push(y):u==="only-target"||u==="one"?o[x]&&!o[b]&&d.push(y):u==="both"&&o[b]&&o[x]&&d.push(y))});var v=n.get("showNodeLabel"),p=n.get("showEdgelabel"),g=i.get("group");d.forEach(function(y){var m=y.get("group").get("children");m.forEach(function(b){var x=b.get("type"),w=g.addShape(x,{attrs:b.attr()});c.push(w),v&&x==="text"&&w.set("visible",!0)})}),Object.keys(o).forEach(function(y){var m=o[y],b=m.get("group").clone();if(g.add(b),c.push(b),p)for(var x=b.get("children"),w=0;w<x.length;w++){var E=x[w];E.get("type")==="text"&&E.set("visible",!0)}}),n.set("vShapes",c)},e.prototype.updateParams=function(t){var n=this,i=t.r,a=t.trigger,o=t.minR,s=t.maxR,u=t.scaleRBy,f=t.showLabel,l=t.shouldShow;if(isNaN(t.r)||n.set("r",i),isNaN(s)||n.set("maxR",s),isNaN(o)||n.set("minR",o),(a==="mousemove"||a==="click")&&n.set("trigger",a),u==="wheel"||u==="unset"){n.set("scaleRBy",u),n.get("delegate").remove(),n.get("delegate").destroy();var c=n.get("dPercentText");c&&(c.remove(),c.destroy())}(f==="node"||f==="both")&&n.set("showNodeLabel",!0),(f==="edge"||f==="both")&&n.set("showEdgeLabel",!0),l&&n.set("shouldShow",l)},e.prototype.updateDelegate=function(t,n){var i=this,a=i.get("graph"),o=i.get("delegate");if(!o||o.destroyed){var s=a.get("group"),u=i.get("delegateStyle")||xN;o=s.addShape("circle",{attrs:M1({r:n,x:t.x,y:t.y},u),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&this.get("scaleRBy")==="wheel"&&o.on("mousewheel",function(f){i.scaleRByWheel(f)})}else o.attr({x:t.x,y:t.y,r:n});i.set("delegate",o)},e.prototype.clear=function(){var t=this,n=t.get("vShapes");n&&n.forEach(function(a){a.remove(),a.destroy()}),n=[],t.set("vShapes",n);var i=t.get("delegate");i&&!i.destroyed&&(i.remove(),i.destroy())},e.prototype.destroy=function(){this.clear()},e}(zn),Rfe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Bfe=bn.pointLineDistance,Ffe={stroke:"#FA8C16",lineWidth:1},Gfe=function(r){Rfe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{line:Ffe,itemAlignType:"center",tolerance:5,horizontalLines:{},verticalLines:{},alignLines:[]}},e.prototype.init=function(){},e.prototype.getEvents=function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd"}},e.prototype.onDragStart=function(){this.initBoxLine()},e.prototype.onDrag=function(t){var n=t.item,i=n.get("delegateShape")||n,a=i.getBBox(),o=n.getModel(),s=o.x-a.x,u=o.y-a.y;this.show({x:a.minX+s,y:a.minY+u},{width:a.width,height:a.height})},e.prototype.onDragEnd=function(){this.destory()},e.prototype.initBoxLine=function(){var t=this._cfgs,n=t.horizontalLines,i=t.verticalLines,a=t.itemAlignType,o=this.get("graph"),s=o.getNodes();s.forEach(function(u){var f=u.getBBox(),l=u.get("id");a===!0||a==="horizontal"?(n["".concat(l,"tltr")]=[f.minX,f.minY,f.maxX,f.minY,u],n["".concat(l,"lcrc")]=[f.minX,f.centerY,f.maxX,f.centerY,u],n["".concat(l,"blbr")]=[f.minX,f.maxY,f.maxX,f.maxY,u]):a==="center"&&(n["".concat(l,"lcrc")]=[f.minX,f.centerY,f.maxX,f.centerY,u]),a===!0||a==="vertical"?(i["".concat(l,"tlbl")]=[f.minX,f.minY,f.minX,f.maxY,u],i["".concat(l,"tcbc")]=[f.centerX,f.minY,f.centerX,f.maxY,u],i["".concat(l,"trbr")]=[f.maxX,f.minY,f.maxX,f.maxY,u]):a==="center"&&(i["".concat(l,"tcbc")]=[f.centerX,f.minY,f.centerX,f.maxY,u])})},e.prototype.show=function(t,n){var i=gt({},t);return this.itemAlign(t,n,i),t},e.prototype.itemAlign=function(t,n,i){var a=this,o=this._cfgs,s=o.horizontalLines,u=o.verticalLines,f=o.tolerance,l={x:i.x+n.width/2,y:i.y},c={x:i.x+n.width/2,y:i.y+n.height/2},h={x:i.x+n.width/2,y:i.y+n.height},d={x:i.x,y:i.y+n.height/2},v={x:i.x+n.width,y:i.y+n.height/2},p=[],g=[],y=null;if(this.clearAlignLine(),ye(s,function(b){b[4].isVisible&&(p.push(a.getLineDisObject(b,l)),p.push(a.getLineDisObject(b,c)),p.push(a.getLineDisObject(b,h)))}),ye(u,function(b){b[4].isVisible&&(g.push(a.getLineDisObject(b,d)),g.push(a.getLineDisObject(b,c)),g.push(a.getLineDisObject(b,v)))}),p.sort(function(b,x){return b.dis-x.dis}),g.sort(function(b,x){return b.dis-x.dis}),p.length!==0&&p[0].dis<f){t.y=p[0].line[1]-p[0].point.y+i.y,y={type:"item",horizontals:[p[0]]};for(var m=1;m<3;m++)p[0].dis===p[m].dis&&y.horizontals.push(p[m])}if(g.length!==0&&g[0].dis<f){t.x=g[0].line[0]-g[0].point.x+i.x,y?y.verticals=[g[0]]:y={type:"item",verticals:[g[0]]};for(var m=1;m<3;m++)g[0].dis===g[m].dis&&y.verticals.push(g[m])}y&&(y.bbox=n,this.addAlignLine(y))},e.prototype.addAlignLine=function(t){var n=t.bbox,i=t.type,a=t.horizontals,o=t.verticals,s=this._cfgs,u=s.line,f=s.alignLines,l=this.get("graph"),c=l.get("group");i==="item"&&(a&&ye(a,function(h){var d=h.line,v=h.point,p=(d[0]+d[2])/2,g,y;v.x<p?(g=v.x-n.width/2,y=Math.max(d[0],d[2])):(g=v.x+n.width/2,y=Math.min(d[0],d[2]));var m=gt({x1:g,y1:d[1],x2:y,y2:d[1]},u),b=c.addShape("line",{attrs:m,capture:!1});f.push(b)}),o&&ye(o,function(h){var d=h.line,v=h.point,p=(d[1]+d[3])/2,g,y;v.y<p?(g=v.y-n.height/2,y=Math.max(d[1],d[3])):(g=v.y+n.height/2,y=Math.min(d[1],d[3]));var m=gt({x1:d[0],y1:g,x2:d[0],y2:y},u),b=c.addShape("line",{attrs:m,capture:!1});f.push(b)}))},e.prototype.getLineDisObject=function(t,n){return{line:t,point:n,dis:Bfe(t,n)}},e.prototype.getContainer=function(){return this.get("container")},e.prototype.clearAlignLine=function(){var t=this._cfgs.alignLines;ye(t,function(n){n.remove()}),t.length=0},e.prototype.destory=function(){var t=this._cfgs,n=t.horizontalLines,i=t.verticalLines,a=this.get("graph"),o=a.getNodes();o.forEach(function(s){var u=s.get("id");delete n["".concat(u,"tltr")],delete n["".concat(u,"lcrc")],delete n["".concat(u,"blbr")],delete i["".concat(u,"tlbl")],delete i["".concat(u,"tcbc")],delete i["".concat(u,"trbr")]}),this.clearAlignLine()},e}(zn),zfe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ar=function(){return Ar=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ar.apply(this,arguments)},$fe=["click","mouseenter"],jfe=function(r){zfe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{data:{},position:"top",padding:8,margin:8,offsetX:0,offsetY:0,layout:"horizontal",flipPage:!1,containerStyle:{},align:void 0,horiSep:8,vertiSep:8,filter:{enable:!1,trigger:"click"}}},e.prototype.init=function(){this.formatArray("padding"),this.formatArray("margin");var t=this.get("filter")||{},n=t.multiple;n&&t.trigger==="mouseenter"&&this.set("multiple",!1);var i=this.get("align");if(!i){var a=this.get("position").split("-");a.includes("left")&&(i="left"),a.includes("right")?i="right":i="center",this.set("align",i)}var o=this.get("graph"),s=o.get("container"),u=wr(`<div class='g6-legend-container' style="position: absolute;"></div>`);s.appendChild(u),this.set("container",u);var f=this.render();jt(u,this.getContainerPos(f)),this.bindEvents()},e.prototype.getContainerPos=function(t){t===void 0&&(t=[0,0]);var n=this,i=n.get("graph"),a=this.get("offsetX"),o=this.get("offsetY"),s=this.get("margin"),u=this.get("position").split("-"),f={top:0,right:1,bottom:2,left:3},l=0,c=0,h={left:(i.getWidth()-t[0])/2+l,top:(i.getHeight()-t[1])/2+c};return u.forEach(function(d){var v=s[f[d]],p=d;switch(d){case"top":v+=c;break;case"left":v+=l;break;case"bottom":v=i.getHeight()-t[1]-v+c,p="top";break;default:v=i.getWidth()-t[0]-v+l,p="left";break}h[p]=v}),h.top+=o+i.getContainer().offsetTop,h.left+=a+i.getContainer().offsetLeft,Object.keys(h).forEach(function(d){h[d]="".concat(h[d],"px")}),h},e.prototype.bindEvents=function(){var t=this,n=t.get("filter");if(!(!n||!n.enable)){var i=n.trigger||"click";$fe.includes(i)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),i="click");var a=t.get("legendCanvas");i==="mouseenter"?(a.on("node-container:mouseenter",function(o){return t.filterData(o)}),a.on("node-container:mouseleave",function(o){t.clearFilter(),t.clearActiveLegend()})):(a.on("node-container:click",function(o){return t.filterData(o)}),a.on("click",function(o){o.target&&o.target.isCanvas&&o.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())}))}},e.prototype.changeData=function(t){this.set("data",t);var n=this.render();jt(this.get("container"),this.getContainerPos(n))},e.prototype.activateLegend=function(t){var n=this.get("filter"),i=n==null?void 0:n.multiple;i||this.clearActiveLegend();var a=t.get("parent");a.get("active")?(a.set("active",!1),this.findLegendItemsByState("active").length&&a.set("inactive",!0)):(a.set("inactive",!1),a.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(c){c.set("inactive",!0)}):this.clearActiveLegend();var o=(n==null?void 0:n.legendStateStyles)||{},s=(o==null?void 0:o.inactive)||{opacity:.5,"text-shape":{opacity:.5}},u=s["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(c){var h=c.get("children"),d=h[0],v=h[1];d.attr(Ar(Ar({},d.get("oriAttrs")),s)),v.attr(Ar(Ar({},v.get("oriAttrs")),u))});var f=(o==null?void 0:o.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},l=f["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(c){var h=c.get("children"),d=h[0],v=h[1];d.attr(Ar(Ar({},d.get("oriAttrs")),f)),v.attr(Ar(Ar({},v.get("oriAttrs")),l))})},e.prototype.findLegendItemsByState=function(t,n,i){n===void 0&&(n="all"),i===void 0&&(i=!0);var a=this.get("legendCanvas").find(function(u){return u.get("name")==="root"}),o=a.find(function(u){return u.get("name")==="node-group"}),s=a.find(function(u){return u.get("name")==="edge-group"});return n==="node"?o.get("children").filter(function(u){return!!u.get(t)===i}):n==="edge"?s.get("children").filter(function(u){return!!u.get(t)===i}):o.get("children").filter(function(u){return!!u.get(t)===i}).concat(s.get("children").filter(function(u){return!!u.get(t)===i}))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas"),n=t.find(function(a){return a.get("name")==="root"}),i=[n.find(function(a){return a.get("name")==="node-group"}),n.find(function(a){return a.get("name")==="edge-group"})];i.forEach(function(a){a.get("children").forEach(function(o){o.set("active",!1),o.set("inactive",!1);var s=o.get("children"),u=s[0],f=s[1];u.attr(u.get("oriAttrs")),f.attr(f.get("oriAttrs"))})})},e.prototype.filterData=function(t){var n=this.get("filter"),i=n==null?void 0:n.filterFunctions;if(!(!n||!i)){var a=this.get("legendCanvas"),o=this.get("graph"),s=n.graphActiveState||"active",u=n.graphInactiveState||"inactive",f=n.multiple;this.clearFilter(),f||this.clearActiveLegend(),this.activateLegend(t.target);var l=a.find(function(y){return y.get("name")==="root"}),c=l.find(function(y){return y.get("name")==="node-group"}),h=l.find(function(y){return y.get("name")==="edge-group"}),d=c.get("children").filter(function(y){return y.get("active")}),v=h.get("children").filter(function(y){return y.get("active")}),p=0,g=["getNodes","getEdges"];g.forEach(function(y){o[y]().forEach(function(m){var b=!1,x=y==="getNodes"?d:v;x.forEach(function(w){var E=i[w.get("id")];b=b||E(m.getModel())}),b?(o.setItemState(m,u,!1),o.setItemState(m,s,!0),p++):(o.setItemState(m,s,!1),o.setItemState(m,u,!0))})}),p||g.forEach(function(y){o[y]().forEach(function(m){o.clearItemStates(m,[u])})})}},e.prototype.clearFilter=function(){var t=this.get("graph"),n=this.get("filter");if(n){var i=n.graphActiveState||"active",a=n.graphInactiveState||"inactive";t.getNodes().forEach(function(o){t.clearItemStates(o,[i,a])}),t.getEdges().forEach(function(o){t.clearItemStates(o,[i,a])})}},e.prototype.render=function(){var t=this;this.processData();var n=this.get("legendCanvas");n?n.clear():n=new Aa({container:this.get("container"),width:200,height:200});var i=n.addGroup({name:"root"}),a=i.addGroup({name:"node-group"}),o=i.addGroup({name:"edge-group"});this.set("legendCanvas",n);var s=this.get("itemsData"),u=["nodes","edges"],f=[a,o];u.forEach(function(D,$){s[D].forEach(function(Y){var N,P=f[$].addGroup({id:Y.id,name:"node-container"}),W,J=Y.type,te=t.getShapeSize(Y),H=te.width,pe=te.height,Te=te.r,Ne=t.getStyle(D.substr(0,4),Y);switch(Y.type){case"circle":W={r:Te,x:0,y:0};break;case"rect":W={width:H,height:pe,x:-H/2,y:-pe/2};break;case"ellipse":W={rx:H,ry:pe,x:0,y:0},J="ellipse";break;case"line":W={x1:-H/2,y1:0,x2:H/2,y2:0},J="line";break;case"quadratic":W={path:[["M",-H/2,0],["Q",0,H/2,H/2,0]]},J="path";break;case"cubic":W={path:[["M",-H/2,0],["C",-H/6,H/2,H/6,-H/2,H/2,0]]},J="path";break;case"diamond":W={path:[["M",0,-pe],["L",H,0],["L",0,pe],["L",-H,0],["Z"]]},J="path";break;case"triangle":W={path:[["M",-H,pe],["L",0,-pe],["L",H,pe],["Z"]]},J="path";break;case"star":W={path:bn.getStarPath(Te*3,Te*1.2)},J="path";break;default:W={r:Te,x:0,y:0};break}var Ze=P.addShape(J,{attrs:Ar(Ar({},W),Ne),name:"".concat(Y.type,"-node-keyShape"),oriAttrs:Ar({opacity:1},Ne)});if(Y.label){var at=Ze.getBBox(),nt=((N=Y.labelCfg)===null||N===void 0?void 0:N.style)||{},St=Ar({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},nt);P.addShape("text",{attrs:Ar({x:at.maxX+4,y:0,text:Y.label},St),className:"legend-label",name:"".concat(Y.type,"-node-text"),oriAttrs:St})}})});var l=this.get("padding"),c,h=i.find(function(D){return D.get("name")==="title-container"}),d={height:0,maxY:0,width:0};if(this.get("title")){h||(h=i.addGroup({name:"title-container"}));var v={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:l[0]},p=this.get("titleConfig")||{},g=Object.assign(v,p.style||{});c=h.addShape("text",{attrs:Ar({text:this.get("title")},g)}),d=h.getCanvasBBox(),h.setMatrix([1,0,0,0,1,0,p.offsetX,p.offsetY,1])}this.layoutItems();var y=i.getCanvasBBox(),m=a.getCanvasBBox(),b=m.minX<0?Math.abs(m.minX)+l[3]:l[3],x=d.maxY<m.minY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],w=[1,0,0,0,1,0,b,x,1];a.setMatrix(w),y=i.getCanvasBBox();var E=[y.minX+y.width+l[1],y.minY+y.height+l[2]];if(c){var p=Ar({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));d=h.getCanvasBBox();var _=h.getMatrix()||[1,0,0,0,1,0,0,0,1];p.position==="center"?_[6]=E[0]/2+p.offsetX:p.position==="right"?(_[6]=E[0]-l[3]+p.offsetX,c.attr({textAlign:"right"})):(_[6]=l[3]+p.offsetX,c.attr({textAlign:"left"})),h.setMatrix(_),d=h.getCanvasBBox(),b=m.minX<0?Math.abs(m.minX)+l[3]:l[3],x=m.minY<d.maxY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],w=[1,0,0,0,1,0,b,x,1],a.setMatrix(w);var M=[1,0,0,0,1,0,b,x,1];this.get("layout")==="vertical"?M[6]+=m.maxX+this.get("horiSep"):M[7]+=m.maxY+this.get("vertiSep"),o.setMatrix(M)}else{m=a.getCanvasBBox();var C=[1,0,0,0,1,0,0,0,1];this.get("layout")==="vertical"?C[6]+=w[6]+m.maxX+this.get("horiSep"):C[7]+=w[7]+m.maxY+this.get("vertiSep"),o.setMatrix(C)}y=i.getCanvasBBox(),m=a.getCanvasBBox(),w=a.getMatrix()||[1,0,0,0,1,0,0,0,1];var S=o.getMatrix()||[1,0,0,0,1,0,0,0,1],A=o.getCanvasBBox();E=[Math.max(m.width+w[6],A.width+S[6])+l[1],Math.max(m.height+w[7],A.height+S[7])+l[2]],n.changeSize(E[0],E[1]);var T=this.get("containerStyle"),k=i.getMatrix()||[1,0,0,0,1,0,0,0,1],O=bn.invertMatrix({x:0,y:0},k),G=i.addShape("rect",{attrs:Ar({x:O.x+(T.lineWidth||1),y:O.y+(T.lineWidth||1),width:E[0]-2*(T.lineWidth||1),height:E[1]-2*(T.lineWidth||1),fill:"#f00",stroke:"#000",lineWidth:1,opacity:.5},T),name:"legend-back-rect",capture:!1});return G.toBack(),E},e.prototype.layoutItems=function(){var t=this.get("legendCanvas"),n=this.get("horiSep"),i=this.get("vertiSep"),a=this.get("layout"),o=this.get("align"),s=[0,0],u=t.find(function(b){return b.get("name")==="root"}),f=u.find(function(b){return b.get("name")==="node-group"}),l=u.find(function(b){return b.get("name")==="edge-group"}),c={min:0,max:-1/0};f.get("children").forEach(function(b,x){x===0&&(c.min=s[0]);var w=b.get("children")[0],E=b.getCanvasBBox(),_=w.getBBox(),M=_.width,C=_.height,S=0,A=0;a==="vertical"?(S=s[1],A=s[0]+M/2,s[0]=A+E.height+i,E.maxX+S+M/2):(S=s[0]+M/2,A=s[1],s[0]=S+E.width+n,E.maxY+A+C/2),s[0]>c.max&&(c.max=s[0]),b.setMatrix([1,0,0,0,1,0,S,A,1])});var h=c.max-c.min,d={min:0,max:-1/0},v=f.getCanvasBBox();s[0]=0,s[1]=a==="vertical"?v.maxX+n:v.maxY+i,l.get("children").forEach(function(b,x){x===0&&(d.min=s[0]);var w=b.get("children")[0],E=b.getCanvasBBox(),_=w.getBBox(),M=_.width,C=_.height,S=0,A=0;a==="vertical"?(S=s[1],A=s[0],s[0]=A+E.height+i,b.setMatrix([1,0,0,0,1,0,0,A+C/2,1])):(S=s[0],A=s[1],s[0]=S+E.width+n,b.setMatrix([1,0,0,0,1,0,S+M/2,0,1])),s[0]>d.max&&(d.max=s[0])});var p=d.max-d.min;if(o&&o!==""&&o!=="left"){var g=h-p,y=o==="center"?Math.abs(g)/2:Math.abs(g),m=g<0?f:l;m.get("children").forEach(function(b){var x=b.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?x[7]+=y:x[6]+=y,b.setMatrix(x)})}},e.prototype.processData=function(){var t=this.get("data"),n={nodes:[],edges:[]};t.nodes&&(t.nodes.sort(function(i,a){return i.order-a.order}),t.nodes.forEach(function(i){var a,o,s,u,f,l=i.size||[((a=i.style)===null||a===void 0?void 0:a.width)||((o=i.style)===null||o===void 0?void 0:o.r)||8,((s=i.style)===null||s===void 0?void 0:s.height)||((u=i.style)===null||u===void 0?void 0:u.r)||8],c=((f=i.labelCfg)===null||f===void 0?void 0:f.style)||{};n.nodes.push({id:i.id||Yi(),type:i.type||"circle",style:Ar({},i.style),order:i.order,label:i.label,itemType:"node",size:l,labelCfg:{position:"right",style:Ar({fontFamily:"Arial"},c)}})})),t.edges&&(t.edges.sort(function(i,a){return i.order-a.order}),t.edges.forEach(function(i){var a,o,s=i.type||"line";i.type==="cubic-horizontal"&&(s="cubic");var u=((a=i.labelCfg)===null||a===void 0?void 0:a.style)||{},f=i.size||[((o=i.style)===null||o===void 0?void 0:o.width)||8,1];n.edges.push({id:i.id||Yi(),type:s,size:f,style:Ar({lineWidth:vt(f)?f[1]:1},i.style),order:i.order,label:i.label,itemType:"edge",labelCfg:{position:"right",style:Ar({fontFamily:"Arial"},u)}})})),this.set("itemsData",n)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var n=this.get(t);if(ht(n))this.set(t,[n,n,n,n]);else if(vt(n))switch(n.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[n[0],n[0],n[0],n[0]]);break;case 2:this.set(t,[n[0],n[1],n[0],n[1]]);break;case 3:this.set(t,[n[0],n[1],n[2],n[1]]);break}return this.get(t)},e.prototype.getShapeSize=function(t){var n,i,a;return t.size&&(vt(t.size)?(n=t.size[0],i=t.size[1]||t.size[0],a=t.size[0]/2):ht(t.size)&&(n=t.size,i=t.size,a=t.size/2)),t.style&&(t.style.width&&(n=t.style.width),t.style.height&&(i=t.style.height),t.style.r&&(a=t.style.r)),a||(a=5),n||(n=a),i||(i=a),{width:n,height:i,r:a}},e.prototype.getStyle=function(t,n){var i=t==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return Ar(Ar({},i),n.style||{})},e.prototype.destroy=function(){var t=this.get("legendCanvas");t==null||t.destroy();var n=this.get("graph"),i=n.get("container"),a=this.get("container");i.removeChild(a)},e}(zn),Ufe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),gi=function(){return gi=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},gi.apply(this,arguments)},wN=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};typeof document<"u"&&Av(`
  .g6-annotation-container {
    background-color: rgba(255, 255, 255, 0.3);
    padding: 8px;
  }
  .g6-annotation-wrapper {
    background-color: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.85);
  }
  .g6-annotation-header-wapper {
    height: fit-content;
    width: 100%;
    background-color: #5B8FF9;
    display: inline-flex;
    cursor: move;
  }
  .g6-annotation-title {
    margin: 4px 40px 4px 8px;
    cursor: text;
    min-width: 32px;
  }
  .g6-annotation-collapse {
    margin: 4px;
    cursor: pointer;
  }
  .g6-annotation-expand {
    margin: 4px;
    cursor: pointer;
  }
  .g6-annotation-close {
    margin: 4px 8px 4px 0;
    cursor: pointer;
  }
  .g6-annotation-content {
    padding: 8px;
    width: fit-content;
    cursor: text;
    word-break: break-all;
    min-width: 32px;
  }
  .g6-annotation-title-input-wrapper {
    margin: 4px 40px 4px 8px;
  }
  .g6-annotation-content-input {
    height: 100%;
    word-break: break-all;
  }
  .g6-annotation-content-input-wrapper {
    margin: 8px;
    height: 100%;
  }
`);var EN="canvas-annotation",Xfe=function(r){Ufe(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{trigger:"click",editable:!0,itemHighlightState:"highlight",linkHighlightStyle:{shadowColor:"#5B8FF9",shadowBlur:10},cardCfg:{minHeight:60,width:"fit-content",height:"fit-content",collapseType:"minimize",closeType:"hide",borderRadius:5,maxTitleLength:20}}},e.prototype.getEvents=function(){var t={viewportchange:"updateLinks",afterlayout:"updateLinks",aftergraphrefreshposition:"updateLinks",afterupdateitem:"updateLink",afterchangedata:"onGraphDataChange",afteritemvisibilitychange:"onGraphItemVisibilityChange"};switch(this.get("trigger")){case"click":t=gi(gi({},t),{"node:click":"showAnnotation","edge:click":"showAnnotation"})}return t},e.prototype.getDOMContent=function(t){if(!this.destroyed){var n=t.collapsed,i=t.maxWidth,a=t.title,o=a===void 0?"":a,s=t.content,u=s===void 0?"":s,f=t.borderRadius,l=f===void 0?5:f,c=n?"<p class='g6-annotation-expand'>+</p>":"<p class='g6-annotation-collapse'>-</p>",h=n?"":" <p class='g6-annotation-content'>".concat(u,"</p>"),d="<p class='g6-annotation-close'>x</p>",v=n?"".concat(l,"px"):"".concat(l,"px ").concat(l,"px 0 0");return'<div class="g6-annotation-wrapper" style="border-radius: '.concat(l,"px; max-width: ").concat(i,`px">
        <div
          class="g6-annotation-header-wapper"
          style="border-radius: `).concat(v,`;"
        >
          <h4 class='g6-annotation-title'>`).concat(o,`</h4>
          `).concat(c,`
          `).concat(d,`
        </div>
        `).concat(h,`
      </div>`)}},e.prototype.init=function(){var t=this;if(!t.destroyed){var n=t.get("graph"),i=n.getContainer(),a=t.get("container"),o=this.get("containerCfg");o?(a=this.createContainer(),i.appendChild(a)):a=i,this.set("container",a);var s=i.getBoundingClientRect(),u=new Aa({container:i,width:s.right-s.left,height:s.bottom-s.top});jt(u.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",sf(function(){return t.resizeCanvas(t)},100));var f=u.addGroup({id:"annotation-link-group"});t.set("linkGroup",f),t.set("canvas",u),t.get("getTitle")||t.set("getTitle",function(c){var h,d=((h=c==null?void 0:c.getModel)===null||h===void 0?void 0:h.call(c))||{},v=d.label,p=d.id;return v||p||"-"}),t.get("getContent")||t.set("getContent",function(c){var h,d;if(!c)return"-";var v=((h=c.getModel)===null||h===void 0?void 0:h.call(c))||{},p=v.label,g=v.id,y=(d=c.getType)===null||d===void 0?void 0:d.call(c),m=y?"".concat(y,": "):"";return"".concat(m).concat(p||g||"")});var l=t.get("defaultData");l&&this.readData(l)}},e.prototype.createContainer=function(){var t=this;if(!this.destroyed){var n=this.get("containerCfg"),i=this.get("graph"),a=i.getContainer(),o=a.getBoundingClientRect(),s=o.left,u=o.right,f=o.top,l=o.bottom,c=l-f,h=u-s,d=n.position,v=d===void 0?"top":d,p=n.offsetX,g=p===void 0?0:p,y=n.offsetY,m=y===void 0?0:y,b=wN(n,["position","offsetX","offsetY"]),x=n.height,w=x===void 0?"fit-content":x,E=n.width,_=E===void 0?i.getWidth():E;w==="100%"&&(w=c),_==="100%"&&(_=h);var M="unset",C="unset",S={};switch(v){case"right":M="".concat(c,"px"),S={top:0,right:0},S.right+=s+g,S.top+=f+m;break;case"bottom":C="".concat(h,"px"),S={bottom:0,left:0},S.left+=s+g,S.bottom+=f+m;break;case"top":C="".concat(h,"px");case"left":M="".concat(c,"px");default:S={top:0,left:0},S.left+=s+g,S.top+=f+m;break}Object.keys(S).forEach(function(T){S[T]="".concat(S[T],"px")});var A=wr("<div class='".concat(n.className," g6-annotation-container'></div>"));return jt(A,gi(gi({position:"absolute",display:v==="top"||v==="bottom"?"inline-flex":"unset",width:ht(_)?"".concat(_,"px"):_,height:ht(w)?"".concat(w,"px"):w,maxHeight:M,maxWidth:C,overflow:"scroll"},S),b)),a.appendChild(A),A.addEventListener("scroll",function(T){t.updateLinks()}),A}},e.prototype.resizeCanvas=function(t){clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){if(!(!t||t.destroyed)){var n=t.get("container").getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top;t.get("canvas").changeSize(i,a),t.updateOutsideCards(t)}},250)},e.prototype.updateOutsideCards=function(t){var n=t||this,i=n.get("cardInfoMap")||{},a=n.get("graph"),o=a.getPointByCanvas(0,0),s=a.getPointByCanvas(a.getWidth(),a.getHeight()),u=a.getClientByPoint(o.x,o.y),f=u.x,l=u.y,c=a.getClientByPoint(s.x,s.y),h=c.x,d=c.y;Object.values(i).forEach(function(v){var p=v.card;if(p){var g=p.style,y=Es(g.left),m=Es(g.top),b=p.getBoundingClientRect(),x=b.width,w=b.height,E=y,_=m;y+x>h-f&&(E=h-f-x),y<0&&(E=0),m+w>d-l&&(_=d-l-w),m<0&&(_=0),jt(p,{left:"".concat(E,"px"),top:"".concat(_,"px")})}}),n.updateLinks()},e.prototype.showAnnotation=function(t){if(!this.destroyed){var n=t.item;this.toggleAnnotation(n)}},e.prototype.hideCards=function(){var t=this;if(!t.destroyed){var n=t.get("cardInfoMap")||{};Object.keys(n).forEach(function(i){t.hideCard(i)})}},e.prototype.toggleAnnotation=function(t,n){var i,a;n===void 0&&(n={});var o=this;if(!o.destroyed){var s=o.get("cardInfoMap")||{},u=o.get("graph"),f=o.get("container"),l=o.get("containerCfg"),c=Object.assign({},o.get("cardCfg")||{},n),h=c.minHeight,d=c.minWidth,v=c.width,p=c.height,g=c.collapsed,y=g===void 0?!1:g,m=c.x,b=c.y,x=c.title,w=c.content,E=c.maxTitleLength,_=c.defaultBegin,M=wN(c,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),C=o.get("linkGroup"),S=this.get("rows")||[[]],A=(i=t.isCanvas)===null||i===void 0?void 0:i.call(t),T=A?EN:t.getID(),k=s[T]||{},O=k.card,G=k.link,D=k.x,$=k.y,Y=k.title,N=k.content,P=this.get("getTitle"),W=this.get("getContent"),J=this.get("getContentPlaceholder")||function(){return""},te=this.get("getTitlePlaceHolder")||function(){return""},H=J(t),pe=te(t),Te=wr(this.getDOMContent(gi({itemId:T,collapsed:y,title:((a=Y||x||(P==null?void 0:P(t)))===null||a===void 0?void 0:a.substr(0,E))||pe,content:N||w||(W==null?void 0:W(t))||H},M))),Ne=ht(h)?"".concat(h,"px"):h;jt(Te,{minHeight:y?"unset":Ne,minWidth:ht(d)?"".concat(d,"px"):d,height:p,width:v});var Ze=!!O;Ze?(G==null||G.remove(!0),f.replaceChild(Te,O)):f.appendChild(Te);var at;if(!l){if(at=f.getBoundingClientRect()||{},m!==void 0&&b!==void 0)D=m,$=b;else if(!Ze&&!A){var nt=at.top,St=_||{},Mt=St.left,fr=St.right,Ft=fr===void 0?16:fr,Wt=St.top,dr=Wt===void 0?8:Wt,lr=St.bottom,Ut=Ft,ar=dr;isNaN(Mt)||(Ut=f.scrollWidth-Mt),isNaN(lr)||(ar=f.scrollHeight-lr);var Zr=ht(d)?d:100;D=f.scrollWidth-Te.scrollWidth-(S.length-1)*Zr-Ut;var tt=S[S.length-1],ae=(tt[tt.length-1]||{}).bbox;$=(ae==null?void 0:ae.bottom)-nt||ar}jt(Te,{position:"absolute",left:"".concat(D,"px"),top:"".concat($,"px"),cusor:l?"unset":"move"})}this.bindListener(Te,T);var L=Te.getBoundingClientRect();if(!A){var Se=C1(t,L,u,this.get("canvas")),Ge=this.get("linkStyle");G=C.addShape("path",{attrs:gi({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:Se},Ge)})}if(s[T]=gi(gi({},s[T]||{}),{id:T,collapsed:y,card:Te,link:G,x:D,y:$,cardBBox:L,content:N||w,title:Y||x,contentPlaceholder:H,titlePlaceholder:pe,isCanvas:A}),o.set("cardInfoMap",s),l)this.updateCardPositionsInConatainer(),this.updateLinks();else{var me=!isNaN(m)&&!isNaN(b);if(!Ze&&!A&&!me){var Ye=at.bottom,We=Ye===void 0?0:Ye,nt=at.top;S[S.length-1].push({id:T,bbox:L}),L.top>We-nt-L.height-16&&S.push([]),this.set("rows",S)}}this.updateCardSize(T);var qe=this.get("onAnnotationChange");qe==null||qe(s[T],Ze?"update":"create")}},e.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var t=this.get("cardInfoMap");if(t){var n=this.get("container"),i=this.get("containerCfg").position,a=n.getBoundingClientRect().width,o=getComputedStyle(n),s=Es(o.paddingLeft)+Es(o.paddingRight);a-=s,Object.values(t).forEach(function(u){var f=u.card,l=f.getBoundingClientRect().width;switch(i){case"right":jt(f,{marginLeft:a?"".concat(a-l,"px"):"0px"});break;case"top":case"bottom":jt(f,{marginLeft:"8px"})}})}}},e.prototype.handleExpandCollapseCard=function(t){if(!this.destroyed){var n=this.get("graph"),i=this.get("cardInfoMap");if(i){var a=i[t].collapsed,o=n.findById(t);if(o){var s=this.get("cardCfg").collapseType;s==="hide"&&!a?this.hideCard(t):this.toggleAnnotation(o,{collapsed:!a}),i[t]=gi(gi({},i[t]),{collapsed:!a})}}}},e.prototype.hideCard=function(t){if(!this.destroyed){var n=this.get("cardInfoMap");if(!(!n||!n[t])){var i=n[t],a=i.card,o=i.link;jt(a,{display:"none"}),o==null||o.hide();var s=this.get("onAnnotationChange");s(n[t],"hide")}}},e.prototype.removeCard=function(t){if(!this.destroyed){var n=this.get("cardInfoMap");if(n){var i=n[t],a=i.card,o=i.link,s=this.get("container");s.removeChild(a),o==null||o.remove(!0),delete n[t];var u=this.get("onAnnotationChange");u(i,"remove")}}},e.prototype.bindListener=function(t,n){var i=this;if(!this.destroyed){t.addEventListener("mousemove",function(u){var f;if(u.target.className==="g6-annotation-collapse"?f="collapse":u.target.className==="g6-annotation-expand"?f="expand":u.target.className==="g6-annotation-close"&&(f="close"),f){var l=i.get("cardCfg").onMouseEnterIcon,c=l===void 0?function(){}:l;c(u,n,f)}}),t.addEventListener("mouseout",function(u){var f;if(u.target.className==="g6-annotation-collapse"?f="collapse":u.target.className==="g6-annotation-expand"?f="expand":u.target.className==="g6-annotation-close"&&(f="close"),f){var l=i.get("cardCfg").onMouseLeaveIcon,c=l===void 0?function(){}:l;c(u,n,f)}}),t.addEventListener("mouseenter",function(u){var f=i.get("cardInfoMap");if(f){var l=i.get("graph"),c=l.findById(n);if(c){var h=i.get("itemHighlightState");l.setItemState(c,h,!0)}var d=f[n].link;if(d){var v=i.get("linkHighlightStyle")||{};d.attr(v)}}}),t.addEventListener("mouseleave",function(u){var f=i.get("cardInfoMap");if(f){var l=i.get("graph"),c=l.findById(n);if(c){var h=i.get("itemHighlightState");l.setItemState(c,h,!1)}var d=f[n].link;if(d){var v=i.get("linkHighlightStyle")||{};Object.keys(v).forEach(function(g){d.attr(g,void 0),d.attr(g,void 0)});var p=i.get("linkStyle");d.attr(p)}}}),t.addEventListener("click",function(u){var f=(i.get("cardCfg")||{}).onClickIcon;if(u.target.className==="g6-annotation-collapse"||u.target.className==="g6-annotation-expand"){var l=i.get("cardCfg").collapseType;l==="hide"?i.hideCard(n):i.handleExpandCollapseCard(n),f==null||f(u,n,u.target.className==="g6-annotation-collapse"?"collapse":"expand")}else if(u.target.className==="g6-annotation-close"){var c=i.get("cardCfg").closeType;c==="remove"?i.removeCard(n):i.hideCard(n),f==null||f(u,n,"close")}});var a=this.get("editable");a&&t.addEventListener("dblclick",function(u){var f=i.get("cardInfoMap"),l=(i.get("cardCfg")||{}).maxTitleLength,c=l===void 0?20:l;if(f){var h=u.target,d=h.className;if(!(d!=="g6-annotation-title"&&d!=="g6-annotation-content")){var v=d==="g6-annotation-title"?h.getBoundingClientRect():h.parentNode.getBoundingClientRect(),p=v.width,g=v.height,y=getComputedStyle(h),m=d==="g6-annotation-title"?"input":"textarea",b=wr("<".concat(m,' class="').concat(d,'-input" type="textarea" style="width:').concat(p,"px; height: ").concat(g,'px; min-width: 16px;"/>')),x=wr('<div class="'.concat(d,'-input-wrapper" style="width: ').concat(p,"px; height: ").concat(g,"px; min-width: 16px; margin-right: ").concat(y.marginRight,'" />'));x.appendChild(b),h.parentNode.replaceChild(x,h);var w=f[n],E=w.contentPlaceholder,_=w.titlePlaceholder,M=w.content,C=w.title,S=M;d==="g6-annotation-title"?(b.name="title",b.maxLength=c,S=C):b.name="content",S?(b.innerHTML=h.innerHTML,b.value=h.innerHTML):b.placeholder=d==="g6-annotation-title"?_:E,b.focus(),b.addEventListener("blur",function(A){b.value&&(h.innerHTML=b.value,w[b.name||"title"]=b.value),x.parentNode.replaceChild(h,x),i.updateCardSize(n);var T=i.get("onAnnotationChange");T==null||T(w,"update")})}}});var o=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];t.draggable=!0,t.addEventListener("dragstart",function(u){var f=u.target.className;if(!o.includes(f)){var l=t.style;i.set("dragging",{card:t,x:u.clientX,y:u.clientY,left:Es(l.left),top:Es(l.top)})}}),t.addEventListener("drag",function(u){u.preventDefault();var f=i.get("cardInfoMap");if(f){var l=u.clientX,c=u.clientY,h=i.get("dragging");if(!(isNaN(l)||isNaN(c)||!h)){var d=h.x,v=h.y,p=h.left,g=h.top,y=h.card,m=l-d,b=c-v;p+=m,g+=b;var x=i.get("graph"),w=x.getPointByCanvas(0,0),E=x.getPointByCanvas(x.getWidth(),x.getHeight()),_=x.getClientByPoint(w.x,w.y),M=_.x,C=_.y,S=x.getClientByPoint(E.x,E.y),A=S.x,T=S.y,k=y.getBoundingClientRect(),O=k.right-k.left,G=k.bottom-k.top;(p>A-M-O&&m>0||p<0&&m<0)&&(p-=m),(g>T-C-G&&b>0||g<0&&b<0)&&(g-=b),jt(y,{left:"".concat(p,"px"),top:"".concat(g,"px"),visibility:"hidden"}),d=l,v=c;var D=(f[n]||{}).link;if(D){var $=x.findById(n);D.attr("path",C1($,k,x,i.get("canvas")))}i.set("dragging",{x:d,y:v,left:p,top:g,card:y})}}});var s=function(f){var l=i.get("cardInfoMap");if(l){var c=i.get("dragging");if(c){var h=c.left,d=c.top,v=c.card;l[n].x=h,l[n].y=d,jt(v,{visibility:"visible"}),i.set("dragging",!1);var p=i.get("rows");p==null||p.forEach(function(y){for(var m=y.length-1;m>=0;m--)y[m].id===n&&y.splice(m,1)});var g=i.get("onAnnotationChange");g==null||g(l[n],"update")}}};t.addEventListener("dragend",s)}},e.prototype.updateCardSize=function(t){var n=this.get("cardInfoMap");if(n){var i=n[t].card,a=i.getBoundingClientRect().width,o=i.getElementsByClassName("g6-annotation-title")[0];if(o){var s=getComputedStyle(o),u=Es(s.marginLeft),f=o.getBoundingClientRect().width;jt(o,{marginRight:"".concat(a-u-24-16-f,"px")})}}},e.prototype.updateLink=function(t){var n=t.item;if(n){var i=this.get("cardInfoMap");if(i){var a=this.get("canvas"),o=this.get("graph"),s=n.getID(),u=i[s]||{},f=u.link,l=u.card;if(f){var c=C1(n,l.getBoundingClientRect(),o,a);f.attr("path",c)}}}},e.prototype.updateLinks=function(){var t=this;if(!this.destroyed){var n=this.get("cardInfoMap");if(n){var i=this.get("graph");Object.values(n).forEach(function(a){var o=a.id,s=i.findById(o);t.updateLink({item:s})})}}},e.prototype.onGraphDataChange=function(){var t=this,n=this.get("cardInfoMap");if(n){var i=this.get("graph");Object.values(n).forEach(function(a){var o=a.id,s=a.card,u=a.isCanvas;if(!(!s||u||s.style.display==="none")){var f=i.findById(o);f&&f.isVisible()?t.toggleAnnotation(f):t.hideCard(o)}})}},e.prototype.onGraphItemVisibilityChange=function(t){var n=t.item,i=t.visible;if(!(!n||n.destroyed)){var a=this.get("cardInfoMap");if(a){var o=n.getID();a[o]&&(i||this.hideCard(o))}}},e.prototype.saveData=function(t){t===void 0&&(t=!1);var n=this.get("cardInfoMap");if(n){var i=this.get("graph"),a=this.get("getTitle"),o=this.get("getContent"),s=[];return Object.values(n).forEach(function(u){var f=u.title,l=u.content,c=u.x,h=u.y,d=u.id,v=u.collapsed,p=u.card;if(!(p&&p.style.display==="none"&&!t)){var g=i.findById(d)||i.get("canvas");s.push({id:d,x:c,y:h,collapsed:v,title:f||(a==null?void 0:a(g)),content:l||(o==null?void 0:o(g)),visible:p&&p.style.display!=="none"})}}),s}},e.prototype.readData=function(t){var n=this,i=this.get("graph");t.forEach(function(a){var o=a.id,s=a.x,u=a.y,f=a.title,l=a.content,c=a.collapsed,h=a.visible,d=i.findById(o);if(!d&&o===EN&&(d=i.get("canvas")),!d){var v=n.get("cardInfoMap")||{};v[o]=a,n.set("cardInfoMap",v);return}n.toggleAnnotation(d,{x:s,y:u,title:f,content:l,collapsed:c}),h||n.hideCard(o)})},e.prototype.clear=function(){var t=this.get("cardInfoMap");if(t){var n=this.get("container");Object.values(t).forEach(function(i){var a=i.card,o=i.link;n.removeChild(a),o==null||o.remove(!0)}),this.set("cardInfoMap",{})}},e.prototype.destroy=function(){var t;this.clear(),(t=this.get("canvas"))===null||t===void 0||t.destroy();var n=this.get("graph");!n||n.destroyed||(this.get("containerCfg")&&n.getContainer().removeChild(this.get("container")),this.destroyed=!0)},e}(zn),Yfe=function(e,t){var n,i,a=1/0;Object.keys(e).forEach(function(u){var f=e[u];Object.keys(t).forEach(function(l){var c=t[l],h=f.x-c.x,d=f.y-c.y,v=h*h+d*d;a>v&&(a=v,n=f,i=c)})});var o=20,s=bn.getControlPoint(n,i,.5,o);return[["M",n.x,n.y],["Q",s.x,s.y,i.x,i.y]]},C1=function(e,t,n,i){var a,o,s=e.getType();if(s==="edge")o=[e.getKeyShape().getPoint(.5)];else{var u=(a=e.getKeyShape)===null||a===void 0?void 0:a.call(e).getBBox(),f=u.minX,l=u.minY,c=u.maxX,h=u.maxY,d=e.getModel(),v=d.x,p=d.y;f+=v,l+=p,c+=v,h+=p,o={left:{x:f,y:(l+h)/2},right:{x:c,y:(l+h)/2},top:{x:(f+c)/2,y:l},bottom:{x:(f+c)/2,y:h}}}Object.keys(o).forEach(function(C){var S=o[C],A=S.x,T=S.y,k=n.getClientByPoint(A,T);o[C]=i.getPointByClient(k.x,k.y)});var g=t.top,y=g===void 0?0:g,m=t.left,b=m===void 0?0:m,x=t.right,w=x===void 0?0:x,E=t.bottom,_=E===void 0?0:E,M={left:i.getPointByClient(b,(y+_)/2),right:i.getPointByClient(w,(y+_)/2),top:i.getPointByClient((b+w)/2,y),bottom:i.getPointByClient((b+w)/2,_)};return Yfe(o,M)},Es=function(e){return Number(e.replace(/\s+|px/gi,""))||0},ei={PluginBase:zn,Menu:Ose,Grid:Tse,Minimap:Gse,Bundling:jse,ToolBar:Vse,Tooltip:qse,Fisheye:Xse,TimeBar:Tfe,ImageMinimap:Nfe,EdgeFilterLens:Pfe,SnapLine:Gfe,Legend:jfe,Annotation:Xfe};Ma("circle",{options:{size:Qe.defaultNode.size,style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:B({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=gr({},i,e.icon),s="".concat(this.type,"-keyShape"),u=t.addShape("circle",{attrs:a,className:s,name:s,draggable:!0});t.shapeMap[s]=u;var f=o.width,l=o.height,c=o.show,h=o.text;if(c){var d="".concat(this.type,"-icon");h?t.shapeMap[d]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:d,name:d,draggable:!0}):t.shapeMap[d]=t.addShape("image",{attrs:B({x:-f/2,y:-l/2},o),className:d,name:d,draggable:!0})}return this.drawLinkPoints(e,t),u},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints;if(n){var i=n||{},a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2;if(o){var v="link-point-left";t.shapeMap[v]=t.addShape("circle",{attrs:B(B({},c),{x:-d,y:0,r:f/2||l||5}),className:v,name:v,isAnchorPoint:!0})}if(s){var p="link-point-right";t.shapeMap[p]=t.addShape("circle",{attrs:B(B({},c),{x:d,y:0,r:f/2||l||5}),className:p,name:p,isAnchorPoint:!0})}if(a){var g="link-point-top";t.shapeMap[g]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-d,r:f/2||l||5}),className:g,name:g,isAnchorPoint:!0})}if(u){var y="link-point-bottom";t.shapeMap[y]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:d,r:f/2||l||5}),className:y,name:y,isAnchorPoint:!0})}}},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gr({},t,n),a=this.getSize(e),o=a[0]/2,s=B({x:0,y:0,r:o},i);return s},update:function(e,t,n){var i=t.getContainer(),a=this.getSize(e),o=B({},e.style);e.style.stroke===void 0&&e.color&&(o.stroke=e.color),e.style.r===void 0&&!isNaN(a[0])&&(o.r=a[0]/2),this.updateShape(e,t,o,!0,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("rect",{options:{size:[100,30],style:{radius:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},anchorPoints:[[0,.5],[1,.5]],stateStyles:B({},Qe.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return t.shapeMap["".concat(this.type,"-keyShape")]=i,this.drawLinkPoints(e,t),i},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getSize(e),s=t.get("keyShape");e.size||(o[0]=s.attr("width")||a.width,o[1]=s.attr("height")||a.height);var u={stroke:e.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},f=gt({},a,s.attr(),u);f=gt(f,e.style),this.updateShape(e,t,f,!1,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:B({},Qe.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("ellipse",{attrs:a,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});t.shapeMap["ellipse-keyShape"]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2,v=h[1]/2;o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getSize(e),o=a[0]/2,s=a[1]/2,u=B({x:0,y:0,rx:o,ry:s},i);return u},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getSize(e),s={stroke:e.color,rx:o[0]/2,ry:o[1]/2},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("diamond",{options:{size:[80,80],style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:B({},Qe.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(e){var t=this.getSize(e),n=t[0],i=t[1],a=[["M",0,-i/2],["L",n/2,0],["L",0,i/2],["L",-n/2,0],["Z"]];return a},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("triangle",{options:{size:40,direction:"up",style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20,offset:6},stateStyles:B({},Qe.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.icon,a=i===void 0?{}:i,o=n.direction,s=this.getShapeStyle(e),u=e.direction||o,f=t.addShape("path",{attrs:s,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=f;var l=a.width,c=a.height,h=a.show,d=a.offset,v=a.text;if(h)if(v)t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var p=-l/2,g=-c/2;(u==="up"||u==="down")&&(g+=d),(u==="left"||u==="right")&&(p+=d),t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:p,y:g},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(e,t),f},drawLinkPoints:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.linkPoints,a=i===void 0?{}:i,o=n.direction,s=e.direction||o,u=a.top,f=a.left,l=a.right,c=a.bottom,h=a.size,d=a.r,v=Jr(a,["top","left","right","bottom","size","r"]),p=this.getSize(e),g=p[0];if(f){var y=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?y=[-b,m]:s==="down"?y=[-b,-m]:s==="left"&&(y=[-b,b-m]),y&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},v),{x:y[0],y:y[1],r:h/2||d||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var x=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?x=[b,m]:s==="down"?x=[b,-m]:s==="right"&&(x=[b,b-m]),x&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},v),{x:x[0],y:x[1],r:h/2||d||5}),className:"link-point-right",name:"link-point-right"}))}if(u){var w=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?w=[b-m,-m]:s==="left"?w=[b,-m]:s==="right"&&(w=[-b,-m]),w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},v),{x:w[0],y:w[1],r:h/2||d||5}),className:"link-point-top",name:"link-point-top"}))}if(c){var E=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="down"?E=[-b+m,m]:s==="left"?E=[b,m]:s==="right"&&(E=[-b,m]),E&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},v),{x:E[0],y:E[1],r:h/2||d||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(e){var t=(this.mergeStyle||this.getOptions(e)).direction,n=e.direction||t,i=this.getSize(e),a=i[0],o=a*Math.sin(1/3*Math.PI),s=a*Math.sin(1/3*Math.PI),u=[["M",-s,o],["L",0,-o],["L",s,o],["Z"]];return n==="down"?u=[["M",-s,-o],["L",s,-o],["L",0,o],["Z"]]:n==="left"?u=[["M",-s,s-o],["L",s,-s],["L",s,s],["Z"]]:n==="right"&&(u=[["M",s,s-o],["L",-s,s],["L",-s,-s],["Z"]]),u},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)},updateLinkPoints:function(e,t){var n=this.getOptions({}),i=n.linkPoints,a=n.direction,o=e.direction||a,s=t.shapeMap["link-point-left"]||t.find(function(D){return D.get("className")==="link-point-left"}),u=t.shapeMap["link-point-right"]||t.find(function(D){return D.get("className")==="link-point-right"}),f=t.shapeMap["link-point-top"]||t.find(function(D){return D.get("className")==="link-point-top"}),l=t.shapeMap["link-point-bottom"]||t.find(function(D){return D.get("className")==="link-point-bottom"}),c=i,h=s||u||f||l;h&&(c=h.attr());var d=gt({},c,e.linkPoints),v=d.fill,p=d.stroke,g=d.lineWidth,y=d.size/2;y||(y=d.r);var m=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},b=m.left,x=m.right,w=m.top,E=m.bottom,_=this.getSize(e),M=_[0],C={r:y,fill:v,stroke:p,lineWidth:g},S=null,A=M*Math.sin(1/3*Math.PI),T=M*Math.sin(1/3*Math.PI);o==="up"?S=[-T,A]:o==="down"?S=[-T,-A]:o==="left"&&(S=[-T,T-A]),S&&(s?!b&&b!==void 0?(s.remove(),delete t.shapeMap["link-point-left"]):s.attr(B(B({},C),{x:S[0],y:S[1]})):b&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},C),{x:S[0],y:S[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var k=null;o==="up"?k=[T,A]:o==="down"?k=[T,-A]:o==="right"&&(k=[T,T-A]),k&&(u?!x&&x!==void 0?(u.remove(),delete t.shapeMap["link-point-right"]):u.attr(B(B({},C),{x:k[0],y:k[1]})):x&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},C),{x:k[0],y:k[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var O=null;o==="up"?O=[T-A,-A]:o==="left"?O=[T,-A]:o==="right"&&(O=[-T,-A]),O&&(f?!w&&w!==void 0?(f.remove(),delete t.shapeMap["link-point-top"]):f.attr(B(B({},C),{x:O[0],y:O[1]})):w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},C),{x:O[0],y:O[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var G=null;o==="down"?G=[-T+A,A]:o==="left"?G=[T,A]:o==="right"&&(G=[-T,A]),G&&(l?!E&&E!==void 0?(l.remove(),delete t.shapeMap["link-point-bottom"]):l.attr(B(B({},C),{x:G[0],y:G[1]})):E&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},C),{x:G[0],y:G[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),Ma("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:Qe.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:Qe.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:Qe.windowFontFamily},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).preRect,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=this.getSize(e),s=o[0],u=o[1],f=t.addShape("rect",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=f;var l=i.show,c=Jr(i,["show"]);return l&&(t.shapeMap["pre-rect"]=t.addShape("rect",{attrs:B({x:-s/2,y:-u/2,height:u},c),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(e,t),this.drawStateIcon(e,t),this.drawLinkPoints(e,t),f},drawLogoIcon:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).logoIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,f=i.x,l=i.y,c=i.offset,h=i.text,d=Jr(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-logo-icon"]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},d),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):t.shapeMap["rect-logo-icon"]=t.addShape("image",{attrs:B(B({},d),{x:f||-o/2+s+c,y:l||-u/2,width:s,height:u}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).stateIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,f=i.x,l=i.y,c=i.offset,h=i.text,d=Jr(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-state-icon"]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},d),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):t.shapeMap["rect-state-icon"]=t.addShape("image",{attrs:B(B({},d),{x:f||o/2-s+c,y:l||-u/2,width:s,height:u}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(e,t){var n=this.getOptions(e),i=n.labelCfg,a=i===void 0?{}:i,o=n.logoIcon,s=o===void 0?{}:o,u=n.descriptionCfg,f=u===void 0?{}:u,l=this.getSize(e),c=l[0],h=null,d=s.show,v=s.width,p=-c/2+a.offset;d&&(p=-c/2+v+a.offset);var g=a.style,y=f.style,m=f.paddingTop;return Pe(e.description)?(h=t.addShape("text",{attrs:B(B({},g),{x:p,y:-5,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),t.shapeMap["text-shape"]=h,t.shapeMap["rect-description"]=t.addShape("text",{attrs:B(B({},y),{x:p,y:17+(m||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(h=t.addShape("text",{attrs:B(B({},g),{x:p,y:7,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),t.shapeMap["text-shape"]=h),h},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.style,a=i===void 0?{}:i,o=n.labelCfg,s=o===void 0?{}:o,u=n.descriptionCfg,f=u===void 0?{}:u,l=this.getSize(e),c=l[0],h=l[1],d=t.get("keyShape");d.attr(B(B({},a),{x:-c/2,y:-h/2,width:c,height:h}));var v=t.getContainer(),p=v.shapeMap["rect-logo-icon"]||v.find(function(Te){return Te.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=gt({},g,e.logoIcon),m=y.width;m===void 0&&(m=this.options.logoIcon.width);var b=e.logoIcon?e.logoIcon.show:void 0,x=s.offset,w=-c/2+m+x;!b&&b!==void 0&&(w=-c/2+x);var E=v.shapeMap["node-label"]||v.find(function(Te){return Te.get("className")==="node-label"}),_=v.shapeMap["rect-description"]||v.find(function(Te){return Te.get("className")==="rect-description"});if(e.label)if(!E)v.shapeMap["node-label"]=v.addShape("text",{attrs:B(B({},s.style),{x:w,y:e.description?-5:7,text:e.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var M=e.labelCfg?e.labelCfg.style:{},C=gt({},E.attr(),M);e.label&&(C.text=e.label),C.x=w,Pe(e.description)&&(C.y=-5),_&&(_.resetMatrix(),_.attr({x:w})),E.resetMatrix(),E.attr(C)}if(Pe(e.description)){var S=f.paddingTop;if(!_)v.shapeMap["rect-description"]=v.addShape("text",{attrs:B(B({},f.style),{x:w,y:17+(S||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var M=e.descriptionCfg?e.descriptionCfg.style:{},A=gt({},_.attr(),M);Pe(e.description)&&(A.text=e.description),A.x=w,_.resetMatrix(),_.attr(B(B({},A),{y:17+(S||0)}))}}var T=v.shapeMap["pre-rect"]||v.find(function(Te){return Te.get("className")==="pre-rect"});if(T&&!T.destroyed){var k=gt({},T.attr(),e.preRect);T.attr(B(B({},k),{x:-c/2,y:-h/2,height:h}))}if(p&&!p.destroyed)if(!b&&b!==void 0)p.remove(),delete v.shapeMap["pre-rect"];else{var O=y.width,G=y.height,D=y.x,$=y.y,Y=y.offset,N=Jr(y,["width","height","x","y","offset"]);p.attr(B(B({},N),{x:D||-c/2+O+Y,y:$||-G/2,width:O,height:G}))}else b&&this.drawLogoIcon(e,v);var P=v.shapeMap["rect-state-icon"]||v.find(function(Te){return Te.get("className")==="rect-state-icon"}),W=P?P.attr():{},J=gt({},W,e.stateIcon);if(P){!J.show&&J.show!==void 0&&(P.remove(),delete v.shapeMap["rect-state-icon"]);var te=J.width,G=J.height,D=J.x,$=J.y,H=J.offset,pe=Jr(J,["width","height","x","y","offset"]);P.attr(B(B({},pe),{x:D||c/2-te+H,y:$||-G/2,width:te,height:G}))}else J.show&&this.drawStateIcon(e,v);this.updateLinkPoints(e,v)},getOptions:function(e,t){return t==="move"?e:gr({},this.options,this.getCustomConfig(e)||{},e)}},"single-node"),Ma("star",{options:{size:60,style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:B({},Qe.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.leftBottom,f=i.rightBottom,l=i.size,c=i.r,h=Jr(i,["top","left","right","leftBottom","rightBottom","size","r"]),d=this.getSize(e),v=d[0];if(s){var p=Math.cos(.1*Math.PI)*v,g=Math.sin((18+72*0)/180*Math.PI)*v;t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right",name:"link-point-right"})}if(a){var p=Math.cos(.5*Math.PI)*v,g=Math.sin((18+72*1)/180*Math.PI)*v;t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-top",name:"link-point-top"})}if(o){var p=Math.cos(.9*Math.PI)*v,g=Math.sin((18+72*2)/180*Math.PI)*v;t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-left",name:"link-point-left"})}if(u){var p=Math.cos(1.3*Math.PI)*v,g=Math.sin((18+72*3)/180*Math.PI)*v;t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(f){var p=Math.cos(1.7*Math.PI)*v,g=Math.sin((18+72*4)/180*Math.PI)*v;t.shapeMap["link-point-right-bottom"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(e){var t=this.getSize(e),n=t[0],i=n*3/8,a=e.innerR||i;return bn.getStarPath(n,a)},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)},updateLinkPoints:function(e,t){var n=this.getOptions({}).linkPoints,i=t.shapeMap["link-point-left"]||t.find(function(A){return A.get("className")==="link-point-left"}),a=t.shapeMap["link-point-right"]||t.find(function(A){return A.get("className")==="link-point-right"}),o=t.shapeMap["link-point-top"]||t.find(function(A){return A.get("className")==="link-point-top"}),s=t.shapeMap["link-point-left-bottom"]||t.find(function(A){return A.get("className")==="link-point-left-bottom"}),u=t.shapeMap["link-point-left-bottom"]||t.find(function(A){return A.get("className")==="link-point-right-bottom"}),f=n,l=i||a||o||s||u;l&&(f=l.attr());var c=gt({},f,e.linkPoints),h=c.fill,d=c.stroke,v=c.lineWidth,p=c.size/2;p||(p=c.r);var g=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},y=g.left,m=g.right,b=g.top,x=g.leftBottom,w=g.rightBottom,E=this.getSize(e),_=E[0],M={r:p,fill:h,stroke:d,lineWidth:v},C=Math.cos((18+72*0)/180*Math.PI)*_,S=Math.sin((18+72*0)/180*Math.PI)*_;a?!m&&m!==void 0?(a.remove(),delete t.shapeMap["link-point-right"]):a.attr(B(B({},M),{x:C,y:-S})):m&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),C=Math.cos((18+72*1)/180*Math.PI)*_,S=Math.sin((18+72*1)/180*Math.PI)*_,o?!b&&b!==void 0?(o.remove(),delete t.shapeMap["link-point-top"]):o.attr(B(B({},M),{x:C,y:-S})):b&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),C=Math.cos((18+72*2)/180*Math.PI)*_,S=Math.sin((18+72*2)/180*Math.PI)*_,i?!y&&y!==void 0?(i.remove(),delete t.shapeMap["link-point-left"]):i.attr(B(B({},M),{x:C,y:-S})):y&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),C=Math.cos((18+72*3)/180*Math.PI)*_,S=Math.sin((18+72*3)/180*Math.PI)*_,s?!x&&x!==void 0?(s.remove(),delete t.shapeMap["link-point-left-bottom"]):s.attr(B(B({},M),{x:C,y:-S})):x&&(t.shapeMap["link-point-left-bottom"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),C=Math.cos((18+72*4)/180*Math.PI)*_,S=Math.sin((18+72*4)/180*Math.PI)*_,u?!w&&w!==void 0?(u.remove(),delete t.shapeMap["link-point-right-bottom"]):u.attr(B(B({},M),{x:C,y:-S})):w&&(t.shapeMap["link-point-right-bottom"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var _N=bn.defaultSubjectColors,Kl="fan-shape-";Ma("donut",{options:{size:Qe.defaultNode.size,style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:B({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=gr({},i,e.icon),s=t.addShape("circle",{attrs:a,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});t.shapeMap["".concat(this.type,"-keyShape")]=s;var u=o.width,f=o.height,l=o.show,c=o.text;return l&&(c?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-u/2,y:-f/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Wfe(e,t,s),this.drawLinkPoints(e,t),s},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(B({},n)),Vfe(e,t,o),this.updateLabel(e,t,a),i&&this.updateIcon(e,t)}},"circle");var Wfe=function(e,t,n){var i=e.donutAttrs,a=i===void 0?{}:i,o=e.donutColorMap,s=o===void 0?{}:o,u=Object.keys(a).length;if(a&&u>1){var f=SN(a,s),l=f.configs,c=f.totalValue;if(c){var h=MN(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0;if(u===1){A1(t,{arcR:v,arcBegin:p,beginAngle:g,config:l[0],fanIndex:0,lineWidth:d,totalValue:c,drawWhole:!0});return}for(var y=0;y<l.length;y++){var m=A1(t,{arcR:v,arcBegin:p,beginAngle:g,config:l[y],fanIndex:y,lineWidth:d,totalValue:c});if(m.shouldEnd)return;p=m.arcBegin,g=m.beginAngle}}}},A1=function(e,t){var n=t.arcR,i=t.arcBegin,a=t.beginAngle,o=t.config,s=t.fanIndex,u=t.lineWidth,f=t.totalValue,l=t.drawWhole,c=l===void 0?!1:l,h=t.updateShape,d=h===void 0?void 0:h,v=o.value/f;if(v<.001)return{beginAngle:a,arcBegin:i,shape:void 0,shouldEnd:!1};var p,g,y;if(c||v>.999)p=[n,1e-4],y=1;else{var m=v*Math.PI*2;g=a+m,p=[n*Math.cos(g),-n*Math.sin(g)],y=m>Math.PI?1:0}var b={path:[["M",i[0],i[1]],["A",n,n,0,y,0,p[0],p[1]]],stroke:o.color||(d==null?void 0:d.attr("stroke"))||_N[s%_N.length],lineWidth:u};return d?d.attr(b):e.shapeMap["".concat(Kl).concat(s)]=e.addShape("path",{attrs:b,name:"".concat(Kl).concat(s),draggable:!0}),{beginAngle:g,arcBegin:p,shape:e.shapeMap["".concat(Kl).concat(s)],shouldEnd:c||v>.999}},Vfe=function(e,t,n){var i=e.donutAttrs,a=e.donutColorMap,o=a===void 0?{}:a,s={},u=t.getContainer();if(i){var f=SN(i,o),l=f.configs,c=f.totalValue;if(c)for(var h=MN(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0,y=0;y<l.length;y++){var m="".concat(Kl).concat(y),b=A1(u,{arcR:v,arcBegin:p,beginAngle:g,config:l[y],fanIndex:y,lineWidth:d,totalValue:c,drawWhole:l.length===1,updateShape:u.shapeMap[m]});if(b.shape&&(s[m]=!0),b.shouldEnd)break;p=b.arcBegin,g=b.beginAngle}}var x=Object.keys(u.shapeMap).filter(function(w){return w.includes(Kl)});x.forEach(function(w){s[w]||(u.shapeMap[w].remove(!0),delete u.shapeMap[w])})},SN=function(e,t){var n=0,i=[];return Object.keys(e).forEach(function(a){var o=+e[a];isNaN(o)||(i.push({key:a,value:o,color:t[a]}),n+=o)}),{totalValue:n,configs:i}},MN=function(e){var t=e.attr("r"),n=.6*t,i=(t+n)/2,a=t-n;return{lineWidth:a,arcR:i}},Pv=function(e){var t=e.x,n=e.y;return{x:t,y:n,centerX:t,centerY:n,minX:t,minY:n,maxX:t,maxY:n,height:0,width:0}},Hfe=function(e){e===void 0&&(e=[]);var t=[],n=[];e.forEach(function(u){t.push(u.x),n.push(u.y)});var i=Math.min.apply(Math,t),a=Math.max.apply(Math,t),o=Math.min.apply(Math,n),s=Math.max.apply(Math,n);return{centerX:(i+a)/2,centerY:(o+s)/2,maxX:a,maxY:s,minX:i,minY:o,height:s-o,width:a-i}},T1=function(e){for(var t=[],n={},i=e.length,a=i-1;a>=0;a--){var o=e[a];o.id="".concat(o.x,"|||").concat(o.y),n[o.id]||(n[o.id]=o,t.push(o))}return t},CN=function(e){return T1(e)},Rv=function(e,t){return e.width||e.height?{centerX:e.centerX,centerY:e.centerY,minX:e.minX-t,minY:e.minY-t,maxX:e.maxX+t,maxY:e.maxY+t,height:e.height+2*t,width:e.width+2*t}:e},qfe=function(e,t){var n=Math.abs(e.x-t.centerX),i=Math.abs(e.y-t.centerY);return n===0&&i===0?0:n/t.width>i/t.height},I1=function(e,t,n){var i=qfe(t,e);if(i===0){var a=e.centerX,o=e.centerY;return n.y<t.y?o=e.minY:n.x>t.x?a=e.maxX:n.x<t.x?a=e.minX:n.x===t.x&&(o=e.maxY),{x:a,y:o}}return i?{x:t.x>e.centerX?e.maxX:e.minX,y:t.y}:{x:t.x,y:t.y>e.centerY?e.maxY:e.minY}},AN=function(e,t){var n=Math.min(e.minX,t.minX),i=Math.min(e.minY,t.minY),a=Math.max(e.maxX,t.maxX),o=Math.max(e.maxY,t.maxY);return{centerX:(n+a)/2,centerY:(i+o)/2,minX:n,minY:i,maxX:a,maxY:o,height:o-i,width:a-n}},k1=function(e){return[{x:e.minX,y:e.minY},{x:e.maxX,y:e.minY},{x:e.maxX,y:e.maxY},{x:e.minX,y:e.maxY}]},Bv=function(e,t){var n=e.x,i=e.y;return n<t.minX||n>t.maxX||i<t.minY||i>t.maxY},Zfe=function(e,t){return t<e.minX||t>e.maxX?[]:[{x:t,y:e.minY},{x:t,y:e.maxY}]},Kfe=function(e,t){return t<e.minY||t>e.maxY?[]:[{x:e.minX,y:t},{x:e.maxX,y:t}]},Qfe=function(e,t){return Zfe(e,t.x).concat(Kfe(e,t.y))},Ql=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},Jfe=function(e,t){var n=-2,i=0;return t.forEach(function(a){a&&(e.x===a.x&&(i+=n),e.y===a.y&&(i+=n))}),i},TN=function(e,t,n,i,a){return Ql(e,t)+Ql(e,n)+Jfe(e,[t,n,i,a])},ele=function r(e,t,n,i,a){a===void 0&&(a=0),e.unshift(t[i]),n[i]&&n[i]!==i&&a<=100&&r(e,t,n,n[i],a+1)},Fv=function(e,t,n,i){var a=n.x-e.x,o=n.y-e.y,s=i.x-e.x,u=i.y-e.y,f=n.x-t.x,l=n.y-t.y,c=i.x-t.x,h=i.y-t.y,d=a*u-o*s,v=f*h-l*c,p=a*l-o*f,g=s*h-u*c;return d*v<=0&&p*g<=0},L1=function(e,t,n){if(n.width||n.height){var i=k1(n),a=i[0],o=i[1],s=i[2],u=i[3];return Fv(e,t,a,o)||Fv(e,t,a,u)||Fv(e,t,o,s)||Fv(e,t,s,u)}return!1},tle=function(e,t,n,i){var a=[];return e.forEach(function(o){if(o!==t&&(o.x===t.x||o.y===t.y)){if(L1(o,t,n)||L1(o,t,i))return;a.push(o)}}),T1(a)},rle=function(e,t,n,i,a,o,s){var u,f=[],l=(u={},u[t.id]=t,u),c={},h={},d={};h[t.id]=0,d[t.id]=TN(t,n,t);var v=new LN;v.add({id:t.id,value:d[t.id]});var p={};e.forEach(function(w){p[w.id]=w});for(var g;Object.keys(l).length;){var y=v.minId(!1);if(y)g=l[y];else break;if(g===n){var m=[];return ele(m,p,c,n.id),m}delete l[g.id],v.remove(g.id),f.push(g);var b=tle(e,g,i,a),x=function(E){E.forEach(function(_){if(f.indexOf(_)===-1){var M=_.id;l[M]||(l[M]=_);var C=d[g.id]+Ql(g,_);if(h[M]&&C>=h[M]){v.add({id:M,value:d[M]});return}c[M]=g.id,h[M]=C,d[M]=h[M]+TN(_,n,t,o,s),v.add({id:M,value:d[M]})}})};x(b)}return[t,n]},nle=function(e,t,n){return!(e.x===t.x&&t.x===n.x||e.y===t.y&&t.y===n.y)},ile=function(e,t,n,i){var a=Ql(e,t),o=Ql(n,t);a<i&&(i=a),o<i&&(i=o);var s={x:t.x-i/a*(t.x-e.x),y:t.y-i/a*(t.y-e.y)},u={x:t.x-i/o*(t.x-n.x),y:t.y-i/o*(t.y-n.y)};return[s,u]},IN=function(e,t){var n=[],i=e[0];return n.push("M".concat(i.x," ").concat(i.y)),e.forEach(function(a,o){var s=e[o+1],u=e[o+2];if(s&&u)if(nle(a,s,u)){var f=ile(a,s,u,t),l=f[0],c=f[1];n.push("L".concat(l.x," ").concat(l.y)),n.push("Q".concat(s.x," ").concat(s.y," ").concat(c.x," ").concat(c.y)),n.push("L".concat(c.x," ").concat(c.y))}else n.push("L".concat(s.x," ").concat(s.y));else s&&n.push("L".concat(s.x," ").concat(s.y))}),n.join("")},kN=function(e,t,n,i,a){var o,s;if(!n||!n.getType())o=Pv(e);else if(n.getType()==="combo"){var u=n.getKeyShape().getBBox();if(u){var f=n.getModel(),l=f.x,c=f.y;o={x:l,y:c,width:u.width,height:u.height,minX:u.minX+l,maxX:u.maxX+l,minY:u.minY+c,maxY:u.maxY+c},o.centerX=(o.minX+o.maxX)/2,o.centerY=(o.minY+o.maxY)/2}else o=Pv(e)}else o=n&&n.getBBox();if(!i||!i.getType())s=Pv(t);else if(i.getType()==="combo"){var h=i.getKeyShape().getBBox();if(h){var d=i.getModel(),v=d.x,p=d.y;s={x:v,y:p,width:h.width,height:h.height,minX:h.minX+v,maxX:h.maxX+v,minY:h.minY+p,maxY:h.maxY+p},s.centerX=(s.minX+s.maxX)/2,s.centerY=(s.minY+s.maxY)/2}else s=Pv(t)}else s=i&&i.getBBox();var g=Rv(o,a),y=Rv(s,a),m=I1(g,e,t),b=I1(y,t,e),x=Hfe([m,b]),w=AN(g,x),E=AN(y,x),_=[];_=_.concat(k1(w)).concat(k1(E));var M={x:(e.x+t.x)/2,y:(e.y+t.y)/2};[x,w,E].forEach(function(S){_=_.concat(Qfe(S,M).filter(function(A){return Bv(A,g)&&Bv(A,y)}))}),[{x:m.x,y:b.y},{x:b.x,y:m.y}].forEach(function(S){Bv(S,g)&&Bv(S,y)&&_.push(S)}),_.unshift(m),_.push(b),_=T1(_);var C=rle(_,m,b,o,s,e,t);return C.unshift(e),C.push(t),CN(C)},ale=function(e){if(!(e!=null&&e.length))return e;for(var t=e[e.length-1],n={x:t.x,y:t.y},i=[t],a=[t],o=e.length-2;o>=0;o--){var s=e[o];if(s.x===n.x?i.push(s):(i=[s],n.x=s.x),s.y===n.y?a.push(s):(a=[s],n.y=s.y),i.length>2){var u=e.indexOf(i[1]);u>-1&&e.splice(u,1);continue}if(a.length>2){var u=e.indexOf(a[1]);u>-1&&e.splice(u,1)}}return e},LN=function(){function r(){this.arr=[],this.map={},this.arr=[],this.map={}}return r.prototype._innerAdd=function(e,t){for(var n=[0,t-1];n[1]-n[0]>1;){var i=Math.floor((n[0]+n[1])/2);if(this.arr[i].value>e.value)n[1]=i;else if(this.arr[i].value<e.value)n[0]=i;else{this.arr.splice(i,0,e),this.map[e.id]=!0;return}}this.arr.splice(n[1],0,e),this.map[e.id]=!0},r.prototype.add=function(e){delete this.map[e.id];var t=this.arr.length;if(!t){this.arr.push(e),this.map[e.id]=!0;return}if(this.arr[t-1].value<e.value){this.arr.push(e),this.map[e.id]=!0;return}this._innerAdd(e,t)},r.prototype.remove=function(e){this.map[e]&&delete this.map[e]},r.prototype._clearAndGetMinId=function(){for(var e,t=this.arr.length-1;t>=0;t--)this.map[this.arr[t].id]?e=this.arr[t].id:this.arr.splice(t,1);return e},r.prototype._findFirstId=function(){for(;this.arr.length;){var e=this.arr.shift();if(this.map[e.id])return e.id}},r.prototype.minId=function(e){return e?this._clearAndGetMinId():this._findFirstId()},r}(),ole=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},sle=function(e,t,n,i,a){return CN(kN(e,t,n,i,a.offset))},ule={offset:20,maxAllowedDirectionChange:Math.PI/2,maximumLoops:2e3,gridSize:10,directions:[{stepX:1,stepY:0},{stepX:-1,stepY:0},{stepX:0,stepY:1},{stepX:0,stepY:-1}],get penalties(){return{0:0,45:this.gridSize/2,90:this.gridSize/2}},distFunc:ole,fallbackRoute:sle},Wa=function(e,t){var n=Math.round(Math.abs(e/t)),i=e<0?-1:1;return n<0?0:i*n},fle=function(e,t,n){var i={};return e.forEach(function(a){if(a)for(var o=Rv(a.getBBox(),n),s=Wa(o.minX,t);s<=Wa(o.maxX,t);s+=1)for(var u=Wa(o.minY,t);u<=Wa(o.maxY,t);u+=1)i["".concat(s,"|||").concat(u)]=!0}),i},N1=function(e,t){var n=t.x-e.x,i=t.y-e.y;return n||i?Math.atan2(i,n):0},NN=function(e,t){var n=Math.abs(e-t);return n>Math.PI?2*Math.PI-n:n},ON=function(e,t,n){for(var i=1/0,a=0,o=t.length;a<o;a++){var s=n(e,t[a]);s<i&&(i=s)}return i},DN=function(e,t,n,i,a){var o=[];if(!n)return[e];var s=a.directions,u=a.offset,f=n.getBBox(),l=t.x>f.minX&&t.x<f.maxX&&t.y>f.minY&&t.y<f.maxY,c=Rv(f,u);for(var h in c)c[h]=Wa(c[h],a.gridSize);if(l){for(var d=0,v=s;d<v.length;d++)for(var p=v[d],g=[[{x:c.minX,y:c.minY},{x:c.maxX,y:c.minY}],[{x:c.minX,y:c.minY},{x:c.minX,y:c.maxY}],[{x:c.maxX,y:c.minY},{x:c.maxX,y:c.maxY}],[{x:c.minX,y:c.maxY},{x:c.maxX,y:c.maxY}]],h=0;h<4;h++){var y=g[h],m=bn.getLineIntersect(e,{x:e.x+p.stepX*c.width,y:e.y+p.stepY*c.height},y[0],y[1]);m&&!L1(e,m,f)&&(m.id="".concat(m.x,"|||").concat(m.y),o.push(m))}return o}var b=I1(c,e,i);return b.id="".concat(b.x,"|||").concat(b.y),[b]},O1=function(e,t,n,i){var a=N1(e,t),o=n[e.id];if(!o){var s=N1(i,e);return NN(s,a)}var u=N1({x:o.x,y:o.y},e);return NN(u,a)},lle=function(e,t,n,i,a,o,s){var u=[i],f=i,l=e.id,c=e.x,h=e.y,d={x:c,y:h,id:l};O1(d,o,t,n)&&(f={x:o.x===i.x?i.x:d.x*s,y:o.y===i.y?i.y:d.y*s},u.unshift(f));for(var v=t[l];v&&v.id!==l;){var p={x:c,y:h,id:l},g={x:v.x,y:v.y,id:v.id},y=O1(g,p,t,n);y&&(f={x:g.x===p.x?f.x:g.x*s,y:g.y===p.y?f.y:g.y*s},u.unshift(f)),l=g.id,c=g.x,h=g.y,v=t[l]}return u[0].x=c===n.x?a.x:f.x,u[0].y=h===n.y?a.y:f.y,u.unshift(a),u},cle=function(e,t,n,i,a){if(isNaN(e.x)||isNaN(t.x))return[];var o=gr(ule,a);o.obstacles=o.obstacles||[];var s=o.penalties,u=o.gridSize,f=fle(o.obstacles.concat([n,i]),u,o.offset),l={x:Wa(e.x,u),y:Wa(e.y,u)},c={x:Wa(t.x,u),y:Wa(t.y,u)};e.id="".concat(l.x,"|||").concat(l.y),t.id="".concat(c.x,"|||").concat(c.y);var h=DN(l,e,n,c,o),d=DN(c,t,i,l,o);h.forEach(function(N){delete f[N.id]}),d.forEach(function(N){delete f[N.id]});for(var v={},p={},g={},y={},m={},b=new LN,x=0;x<h.length;x++){var w=h[x];v[w.id]=w,y[w.id]=0,m[w.id]=ON(w,d,o.distFunc),b.add({id:w.id,value:m[w.id]})}var E=o.maximumLoops,_,M,C,S,A,T,k=1/0,O={};for(d.forEach(function(N){O["".concat(N.x,"|||").concat(N.y)]=!0}),Object.keys(v).forEach(function(N){var P=v[N].id;m[P]<=k&&(k=m[P],_=v[P])});Object.keys(v).length>0&&E>0;){var G=b.minId((E+1)%30===0);if(G)_=v[G];else break;if(O["".concat(_.x,"|||").concat(_.y)])return lle(_,g,l,t,e,c,u);delete v[_.id],b.remove(_.id),p[_.id]=!0;for(var x=0;x<o.directions.length;x++){M=o.directions[x];var D="".concat(Math.round(_.x)+M.stepX,"|||").concat(Math.round(_.y)+M.stepY);if(C={x:_.x+M.stepX,y:_.y+M.stepY,id:D},!p[D]&&(T=O1(_,C,g,l),!(T>o.maxAllowedDirectionChange)&&!f[D])){v[D]||(v[D]=C);var $=s[T];S=o.distFunc(_,C)+(isNaN($)?u:$),A=y[_.id]+S;var Y=y[D];Y&&A>=Y||(g[D]=_,y[D]=A,m[D]=A+ON(C,d,o.distFunc),b.add({id:D,value:m[D]}))}}E-=1}return o.fallbackRoute(e,t,n,i,o)};eS("polyline",{options:{color:Qe.defaultEdge.color,size:Qe.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:Qe.defaultEdge.style.stroke,lineAppendWidth:Qe.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Qe.edgeLabel.style.fill,fontSize:Qe.edgeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:B({},Qe.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e);n.radius===0&&delete n.radius;var i=t.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return t.shapeMap["edge-shape"]=i,i},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=gt({},t,n,e.style);e=this.getPathPoints(e),this.radius=i.radius,this.offset=i.offset;var a=e.startPoint,o=e.endPoint,s=this.getControlPoints(e),u=[a];s&&(u=u.concat(s)),u.push(o);var f=e.sourceNode,l=e.targetNode,c=i.radius,h=this.options.routeCfg,d=gt({},h,e.routeCfg);d.offset=i.offset;var v=this.getPath(u,f,l,c,d,!s);(vt(v)&&v.length<=1||Pe(v)&&v.indexOf("L")===-1)&&(v="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(o.x)||isNaN(o.y))&&(v="M0 0, L0 0");var p=gt({},Qe.defaultEdge.style,i,{lineWidth:e.size,path:v});return p},updateShapeStyle:function(e,t){var n=t.getContainer();if(t.isVisible()){var i={stroke:e.color},a=n.shapeMap["edge-shape"]||n.find(function(x){return x.get("className")==="edge-shape"})||t.getKeyShape(),o=e.size;e=this.getPathPoints(e);var s=e.startPoint,u=e.endPoint,f=this.getControlPoints(e),l=[s];f&&(l=l.concat(f)),l.push(u);var c=a.attr(),h=gt({},i,c,e.style),d=e.sourceNode,v=e.targetNode,p=h.radius,g=this.options.routeCfg,y=gt({},g,e.routeCfg);y.offset=h.offset;var m=this.getPath(l,d,v,p,y,!f);(vt(m)&&m.length<=1||Pe(m)&&m.indexOf("L")===-1)&&(m="M0 0, L0 0"),(isNaN(s.x)||isNaN(s.y)||isNaN(u.x)||isNaN(u.y))&&(m="M0 0, L0 0"),c.endArrow&&h.endArrow===!1&&(e.style.endArrow={path:""}),c.startArrow&&h.startArrow===!1&&(e.style.startArrow={path:""});var b=gt(i,a.attr(),{lineWidth:o,path:m},e.style);a&&a.attr(b)}},getPath:function(e,t,n,i,a,o){var s=a.offset,u=a.obstacles,f=a.simple;if(!s||e.length>2||o===!1){if(i)return IN(e,i);var l=[];return ye(e,function(v,p){p===0?l.push(["M",v.x,v.y]):l.push(["L",v.x,v.y])}),l}f!==!1&&!(u!=null&&u.length)&&(f=!0);var c=f?kN(e[e.length-1],e[0],n,t,s):cle(e[0],e[e.length-1],t,n,a);if(!c||!c.length)return"M0 0, L0 0";if(i){var h=IN(c,i);return h}c=ale(c);var d=bn.pointsToPolygon(c);return d}},"single-edge");var PN=Ua.cloneEvent,RN=Ua.isNaN,BN=Math.abs,hle=10,dle=["shift","ctrl","alt","control"];const vle={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{mousedown:"onMouseDown",drag:"onDragMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(e){var t=this.origin,n=+e.clientX,i=+e.clientY;if(!(RN(n)||RN(i))){var a=n-t.x,o=i-t.y;this.get("direction")==="x"?o=0:this.get("direction")==="y"&&(a=0),this.origin={x:n,y:i};var s=this.graph.get("width"),u=this.graph.get("height"),f=this.graph.get("canvas").getCanvasBBox(),l=this.scalableRange,c=this.scalableRange;l<1&&l>-1&&(l=s*l,c=u*c),(f.minX<=s+l&&f.minX+a>s+l||f.maxX+l>=0&&f.maxX+l+a<0)&&(a=0),(f.minY<=u+c&&f.minY+o>u+c||f.maxY+c>=0&&f.maxY+c+o<0)&&(o=0),this.graph.translate(a,o)}},onTouchStart:function(e){var t=this,n=e.originalEvent.touches,i=n[0],a=n[1];i&&a||(e.preventDefault(),this.mousedown=!0,t.onDragStart(e))},onMouseDown:function(e){this.mousedown=!0},onDragMove:function(e){this.mousedown&&(this.dragstart?this.onDrag(e):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var t=this,n=e.originalEvent;if(!(n&&e.name!=="touchstart"&&n.button!==0)&&!(e.name!=="touchstart"&&typeof window<"u"&&window.event&&!window.event.buttons&&!window.event.button)&&this.shouldBegin(e,this)&&!t.keydown&&this.allowDrag(e)){if(t.origin={x:e.clientX,y:e.clientY},t.dragging=!1,this.enableOptimize){for(var i=this.graph,a=i.getEdges(),o=0,s=a.length;o<s;o++){var u=a[o].get("group").get("children");u&&u.forEach(function(b){b.set("ori-visibility",b.get("ori-visibility")||b.get("visible")),b.hide()})}for(var f=i.getNodes(),l=0,c=f.length;l<c;l++)for(var h=f[l].getContainer(),d=h.get("children"),v=0,p=d;v<p.length;v++){var g=p[v],y=g.get("isKeyShape");y||(g.set("ori-visibility",g.get("ori-visibility")||g.get("visible")),g.hide())}}if(typeof window<"u"){var m=this;this.handleDOMContextMenu=function(b){return m.onMouseUp(b)},document.body.addEventListener("contextmenu",this.handleDOMContextMenu)}}},onTouchMove:function(e){var t=this,n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a){this.onMouseUp(e);return}e.preventDefault(),t.onDrag(e)},onDrag:function(e){if(this.mousedown){var t=this.graph;if(!this.keydown&&this.allowDrag(e)&&(e=PN(e),!!this.origin)){if(this.dragging)e.type="drag",t.emit("canvas:drag",e);else{if(BN(this.origin.x-e.clientX)+BN(this.origin.y-e.clientY)<hle)return;this.shouldBegin(e,this)&&(e.type="dragstart",t.emit("canvas:dragstart",e),this.originPosition={x:e.clientX,y:e.clientY},this.dragging=!0)}this.shouldUpdate(e,this)&&this.updateViewport(e)}}},onMouseUp:function(e){var t,n;this.mousedown=!1,this.dragstart=!1;var i=this.graph;if(!this.keydown){var a=i.getZoom(),o=i.get("modeController"),s=(n=(t=o==null?void 0:o.modes[o.mode])===null||t===void 0?void 0:t.filter(function(_){return _.type==="zoom-canvas"}))===null||n===void 0?void 0:n[0],u=s?s.optimizeZoom||.1:0;if(this.enableOptimize){for(var f=i.getEdges(),l=0,c=f.length;l<c;l++){var h=f[l].get("group").get("children");h&&h.forEach(function(_){var M=_.get("ori-visibility");_.set("ori-visibility",void 0),M&&_.show()})}if(a>u)for(var d=i.getNodes(),v=0,p=d.length;v<p;v++)for(var g=d[v].getContainer(),y=g.get("children"),m=0,b=y;m<b.length;m++){var x=b[m],w=x.get("isKeyShape");if(!w){var E=x.get("ori-visibility");x.set("ori-visibility",void 0),E&&x.show()}}}if(!this.dragging){this.origin=null;return}e=PN(e),this.shouldEnd(e,this)&&this.updateViewport(e),e.type="dragend",e.dx=e.clientX-this.originPosition.x,e.dy=e.clientY-this.originPosition.y,i.emit("canvas:dragend",e),this.endDrag(),typeof window<"u"&&document.body.removeEventListener("contextmenu",this.handleDOMContextMenu)}},endDrag:function(){this.origin=null,this.dragging=!1,this.dragbegin=!1,this.mousedown=!1,this.dragstart=!1},onKeyDown:function(e){var t=this,n=e.key;n&&(dle.indexOf(n.toLowerCase())>-1?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(e){var t,n,i=e.target,a=i&&i.isCanvas&&i.isCanvas();if(of(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(un(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}},ple={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:mousedown":"onMouseDown",drag:"onDragMove",dragend:"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd",afterchangedata:"onDragEnd"}},validationCombo:function(e){if(!this.origin||!e||e.destroyed)return!1;var t=e.getType();return t==="combo"},onTouchStart:function(e){if(e.item){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}this.mousedown={item:e.item,target:e.target,origin:{x:e.x,y:e.y}},this.dragstart=!0,t.onDragStart(e)}},onTouchMove:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a){t.onDragEnd(e);return}e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.onDrag(e)},onMouseDown:function(e){this.mousedown={item:e.item,target:e.target,origin:{x:e.x,y:e.y}},typeof window<"u"&&!this.windowEventBinded&&(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(e){var t,n;if(((n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t))!=="node"){this.onDragEnd();return}this.mousedown&&(this.dragstart?this.onDrag(B(B({},e),this.mousedown)):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var t=this;if(this.currentShouldEnd=!0,!!this.shouldBegin(B(B({},e),this.mousedown),this)){var n=this.mousedown,i=n.item,a=n.target;if(!(!i||i.destroyed||i.hasLocked())){var o=i.getContainer();if(o.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(i),a){var s=a.get("isAnchorPoint");if(s)return}var u=this.graph;this.targets=[],this.targetCombo=null;var f=u.findAllByState("node",this.selectedState),l=i.get("id"),c=f.filter(function(d){var v=d.get("id");return l===v});if(c.length===0?this.targets.push(i):f.length>1?f.forEach(function(d){var v=d.hasLocked();v||t.targets.push(d)}):this.targets.push(i),this.graph.get("enabledStack")&&this.enableStack){var h=[];this.targets.forEach(function(d){var v=d.getModel(),p=v.x,g=v.y,y=v.id;h.push({x:p,y:g,id:y})}),this.set("beforeDragNodes",h)}this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(d){var v=d.getEdges();v.forEach(function(p){p.isVisible()&&(t.hidenEdge[p.getID()]=!0,p.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(e){var t=this;if(!(!this.mousedown||!this.origin)&&this.shouldUpdate(e,this))if(this.get("enableDelegate"))this.updateDelegate(e);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:e,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var n={};this.targets.map(function(i){t.update(i,e);var a=i.getModel().comboId;a&&(n[a]=t.graph.findById(a))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(e){var t=this,n;if(this.mousedown=!1,this.dragstart=!1,typeof window<"u"&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),!!this.origin){(n=this.cachedCaptureItems)===null||n===void 0||n.forEach(function(o){var s=o.getContainer();s.set("capture",!0)}),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(o){var s=o.getEdges();s.forEach(function(u){t.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var i=this.graph;if(i.get("enabledStack")&&this.enableStack){var a={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(o){a.before.nodes.push(o)}),this.targets.forEach(function(o){var s=o.getModel(),u=s.x,f=s.y,l=s.id;a.after.nodes.push({x:u,y:f,id:l})}),i.pushStack("update",Vt(a))}i.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(e){var t=e.item;if(this.currentShouldEnd=this.shouldEnd(e,t,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(t))){var n=this.graph;if(this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1),this.targetCombo=t,this.onlyChangeComboSize)n.updateCombos();else{var i=t.getModel();this.targets.map(function(a){var o=a.getModel();o.comboId!==i.id&&n.updateComboTree(a,i.id)}),n.updateCombo(t)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(e){var t=this.graph;this.currentShouldEnd=this.shouldEnd(e,void 0,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.targets||this.targets.length===0||!this.currentShouldEnd)&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map(function(n){var i=n.getModel();i.comboId&&t.updateComboTree(n)}))},onDropNode:function(e){if(!(!this.targets||this.targets.length===0)){var t=this,n=e.item,i=t.graph,a=n.getModel().comboId,o=a?i.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(a){var s=i.findById(a);t.comboActiveState&&i.setItemState(s,t.comboActiveState,!1),this.targets.map(function(u){var f=u.getModel();a!==f.comboId&&i.updateComboTree(u,a)}),i.updateCombo(s)}else this.targets.map(function(u){var f=u.getModel();f.comboId&&i.updateComboTree(u)});i.emit("dragnodeend",{items:this.targets,targetItem:n})}}},onDragEnter:function(e){var t=e.item;if(this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!0)}},onDragLeave:function(e){var t=e.item;if(this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1)}},updatePositions:function(e,t){var n=this;!this.targets||this.targets.length===0||(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:e,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):t||this.targets.map(function(i){return n.update(i,e)}):this.targets.map(function(i){return n.update(i,e,t)}))},update:function(e,t,n){var i=this.origin,a=e.get("model"),o=e.get("id");this.point[o]||(this.point[o]={x:a.x||0,y:a.y||0});var s=t.x-i.x+this.point[o].x,u=t.y-i.y+this.point[o].y;n&&(s+=i.x-t.x,u+=i.y-t.y);var f={x:s,y:u};this.get("updateEdge")?this.graph.updateItem(e,f,!1):e.updatePosition(f)},debounceUpdate:sf(function(r){var e=r.targets,t=r.graph,n=r.point,i=r.origin,a=r.evt,o=r.updateEdge,s=r.onlyChangeComboSize,u=r.updateParentCombos;e.map(function(f){var l=f.get("model"),c=f.get("id");n[c]||(n[c]={x:l.x||0,y:l.y||0});var h=a.x-i.x+n[c].x,d=a.y-i.y+n[c].y,v={x:h,y:d};o?t.updateItem(f,v,!1):f.updatePosition(v)}),s&&u(t,e)},50,!0),updateDelegate:function(e){var t=this.graph;if(this.delegateRect){var h=e.x-this.origin.x+this.originPoint.minX,d=e.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:h,y:d})}else{var n=t.get("group"),i=gr({},Jo.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(e),o=a.x,s=a.y,u=a.width,f=a.height,l=a.minX,c=a.minY;this.originPoint={x:o,y:s,width:u,height:f,minX:l,minY:c},this.delegateRect=n.addShape("rect",{attrs:B({width:u,height:f,x:o,y:s},i),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(e){var t=this.targets;t.length===0&&t.push(e.item);for(var n=1/0,i=-1/0,a=1/0,o=-1/0,s=0;s<t.length;s++){var u=t[s],f=u.getBBox(),l=f.minX,c=f.minY,h=f.maxX,d=f.maxY;l<n&&(n=l),c<a&&(a=c),h>i&&(i=h),d>o&&(o=d)}var v=Math.floor(n),p=Math.floor(a),g=Math.ceil(i)-Math.floor(n),y=Math.ceil(o)-Math.floor(a);return{x:v,y:p,width:g,height:y,minX:n,minY:a}},updateParentCombos:function(e,t){var n=e||this.graph,i=t||this.targets,a={};i==null||i.forEach(function(o){var s=o.getModel().comboId;s&&(a[s]=n.findById(s))}),Object.values(a).forEach(function(o){o&&n.updateCombo(o)})}},gle={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return this.get("trigger")==="mouseenter"?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.setAllItemStates(e)},clearOnTouchStart:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.clearActiveState(e)},setAllItemStates:function(e){clearTimeout(this.timer),this.throttleSetAllItemStates(e,this)},clearActiveState:function(e){var t=this;this.timer=setTimeout(function(){t.throttleClearActiveState(e,t)},50)},throttleSetAllItemStates:uf(function(r,e){var t=r.item,n=e.graph;if(!(!n||n.destroyed)&&(e.item=t,!!e.shouldUpdate(r.item,{event:r,action:"activate"},e))){for(var i=e.activeState,a=e.inactiveState,o=n.getNodes(),s=n.getCombos(),u=n.getEdges(),f=n.get("vedges"),l=o.length,c=s.length,h=u.length,d=f.length,v=e.inactiveItems||{},p=e.activeItems||{},g=0;g<l;g++){var y=o[g],m=y.getID(),b=y.hasState("selected");e.resetSelected&&b&&n.setItemState(y,"selected",!1),p[m]&&(n.setItemState(y,i,!1),delete p[m]),a&&!v[m]&&(n.setItemState(y,a,!0),v[m]=y)}for(var g=0;g<c;g++){var x=s[g],w=x.getID(),b=x.hasState("selected");e.resetSelected&&b&&n.setItemState(x,"selected",!1),p[w]&&(n.setItemState(x,i,!1),delete p[w]),a&&!v[w]&&(n.setItemState(x,a,!0),v[w]=x)}for(var g=0;g<h;g++){var E=u[g],_=E.getID();p[_]&&(n.setItemState(E,i,!1),delete p[_]),a&&!v[_]&&(n.setItemState(E,a,!0),v[_]=E)}for(var g=0;g<d;g++){var M=f[g],C=M.getID();p[C]&&(n.setItemState(M,i,!1),delete p[C]),a&&!v[C]&&(n.setItemState(M,a,!0),v[C]=M)}if(t&&!t.destroyed){a&&(n.setItemState(t,a,!1),delete v[t.getID()]),p[t.getID()]||(n.setItemState(t,i,!0),p[t.getID()]=t);for(var S=t.getEdges(),A=S.length,g=0;g<A;g++){var E=S[g],_=E.getID(),T=void 0;E.getSource()===t?T=E.getTarget():T=E.getSource();var k=T.getID();a&&v[k]&&(n.setItemState(T,a,!1),delete v[k]),p[k]||(n.setItemState(T,i,!0),p[k]=T),v[_]&&(n.setItemState(E,a,!1),delete v[_]),p[_]||(n.setItemState(E,i,!0),p[_]=E),E.toFront()}}e.activeItems=p,e.inactiveItems=v,n.emit("afteractivaterelations",{item:r.item,action:"activate"})}},50,{trailing:!0,leading:!0}),throttleClearActiveState:uf(function(r,e){var t=e.get("graph");if(!(!t||t.destroyed)&&e.shouldUpdate(r.item,{event:r,action:"deactivate"},e)){var n=e.activeState,i=e.inactiveState,a=e.activeItems||{},o=e.inactiveItems||{};Object.values(a).filter(function(s){return!s.destroyed}).forEach(function(s){t.clearItemStates(s,n)}),Object.values(o).filter(function(s){return!s.destroyed}).forEach(function(s){t.clearItemStates(s,i)}),e.activeItems={},e.inactiveItems={},t.emit("afteractivaterelations",{item:r.item||e.get("item"),action:"deactivate"})}},50,{trailing:!0,leading:!0})};var Gv=Math.min,FN=Math.max,GN=Math.abs,zN="shift",yle=["drag","shift","ctrl","alt","control"];const mle={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:zN,includeEdges:!0,includeCombos:!1,selectedEdges:[],selectedNodes:[],selectedCombos:[]}},getEvents:function(){return yle.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=zN,console.warn("Behavior brush-select 的 trigger 参数不合法，请输入 'drag'、'shift'、'ctrl' 或 'alt'")),this.trigger==="drag"?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(e){var t=e.item,n=this.brush;t||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:e.canvasX,y:e.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(e){this.dragging&&(this.trigger!=="drag"&&!this.keydown||this.updateBrush(e))},onMouseUp:function(e){this.graph,!(!this.brush&&!this.dragging)&&(this.trigger!=="drag"&&!this.keydown||(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(e),this.dragging=!1))},clearStates:function(){var e=this,t=e.graph,n=e.selectedState,i=t.findAllByState("node",n),a=t.findAllByState("edge",n),o=t.findAllByState("combo",n);i.forEach(function(s){return t.setItemState(s,n,!1)}),a.forEach(function(s){return t.setItemState(s,n,!1)}),o.forEach(function(s){return t.setItemState(s,n,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(e,t,n,i,a){var o=e.getBBox();return o.centerX>=t&&o.centerX<=n&&o.centerY>=i&&o.centerY<=a},getSelectedNodes:function(e){var t=this,n=this,i=n.graph,a=n.originPoint,o=n.shouldUpdate,s=n.isBBoxCenterInRect,u=this.selectedState,f={x:e.x,y:e.y},l=i.getPointByCanvas(a.x,a.y),c=Gv(f.x,l.x),h=FN(f.x,l.x),d=Gv(f.y,l.y),v=FN(f.y,l.y),p=[],g=[];i.getNodes().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",t)){p.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}});var y=[];this.includeEdges&&p.forEach(function(b){var x=b.getOutEdges();x.forEach(function(w){if(w.isVisible()){var E=w.getModel(),_=E.source,M=E.target;g.includes(_)&&g.includes(M)&&o(w,"select",t)&&(y.push(w),i.setItemState(w,t.selectedState,!0))}})});var m=[];this.includeCombos&&i.getCombos().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",t)){m.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}}),this.selectedEdges=y,this.selectedNodes=p,this.selectedCombos=m,this.onSelect&&this.onSelect(p,y,m),i.emit("nodeselectchange",{selectedItems:{nodes:p,edges:y,combos:m},select:!0})},createBrush:function(){var e=this,t=e.graph.get("canvas").addShape("rect",{attrs:e.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(e){var t=this.originPoint;this.brush.attr({width:GN(e.canvasX-t.x),height:GN(e.canvasY-t.y),x:Gv(e.canvasX,t.x),y:Gv(e.canvasY,t.y)})},onKeyDown:function(e){var t=e.key;if(t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();i===n||i==="control"&&n==="ctrl"||i==="ctrl"&&n==="control"?this.keydown=!0:this.keydown=!1}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}};var $N="shift",ble=["shift","ctrl","alt","control"];const xle={getDefaultCfg:function(){return{multiple:!0,trigger:$N,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var e=this;return ble.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=$N,console.warn("Behavior click-select 的 trigger 参数不合法，请输入 'drag'、'shift'、'ctrl' 或 'alt'")),e.multiple?{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(e){var t=this,n=e.item;if(!(!n||n.destroyed)){var i=n.getType(),a=t.graph,o=t.keydown,s=t.multiple,u=t.shouldUpdate,f=t.shouldBegin;if(f(e,t)){if(!o||!s){var l=a.findAllByState("node",t.selectedState).concat(a.findAllByState("edge",t.selectedState)).concat(a.findAllByState("combo",t.selectedState));ye(l,function(p){p!==n&&a.setItemState(p,t.selectedState,!1)})}var c=function(){switch(i){case"node":return t.selectNode;case"edge":return t.selectEdge;case"combo":return t.selectCombo;default:return!1}}();if(!c){var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{selectedItems:{nodes:h,edges:d,combos:v},select:!1});return}if(n.hasState(t.selectedState)){u(e,t)&&a.setItemState(n,t.selectedState,!1);var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!1})}else{u(e,t)&&a.setItemState(n,t.selectedState,!0);var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!0})}}}},onCanvasClick:function(e){var t=this,n=this,i=n.graph,a=n.shouldBegin;if(a(e,this)){var o=i.findAllByState("node",this.selectedState);ye(o,function(f){i.setItemState(f,t.selectedState,!1)});var s=i.findAllByState("edge",this.selectedState);ye(s,function(f){i.setItemState(f,t.selectedState,!1)});var u=i.findAllByState("combo",this.selectedState);ye(u,function(f){i.setItemState(f,t.selectedState,!1)}),i.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(e){var t=this,n=e.key;n&&(n.toLowerCase()===this.trigger.toLowerCase()||n.toLowerCase()==="control"?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){var e=this;e.keydown=!1}};var wle=ni,zv=.05;const Ele={getDefaultCfg:function(){return this.isFireFox=xL()==="firefox",{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"},animate:!1,animateCfg:{duration:500}}},getEvents:function(){var e=this.fixSelectedItems;return e.fixState||(e.fixState="selected"),e.fixAll&&(e.fixLineWidth=!0,e.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(e){var t=e.originalEvent.touches,n=t[0],i=t[1];e.preventDefault(),i&&(this.shouldBegin&&!this.shouldBegin(e,this)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,i&&(this.endPoint={pageX:i.pageX,pageY:i.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(e){if(this.moveable){e.preventDefault();var t=e.originalEvent.touches,n=t[0],i=t[1];if(i){this.endPoint||(this.endPoint={pageX:i.pageX,pageY:i.pageY});var a=function(p,g){return Math.hypot(g.x-p.x,g.y-p.y)},o=a({x:n.pageX,y:n.pageY},{x:i.pageX,y:i.pageY})/a({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),s=this.originScale*o;this.currentScale=s;var u=this.get("minZoom")||this.graph.get("minZoom"),f=this.get("maxZoom")||this.graph.get("maxZoom");if(!(s>f||s<u)){var l=this.get("animate"),c=this.get("animateCfg"),h=this.graph.get("canvas"),d=h.getPointByClient(e.clientX,e.clientY);this.graph.zoomTo(s,{x:d.x,y:d.y},l,c),this.graph.emit("wheelzoom",e)}}}},onTouchEnd:function(){this.moveable=!1,this.endPoint=null},onWheel:function(e){var t=this,n=this,i=n.graph,a=n.fixSelectedItems;if(!(this.shouldBegin&&!this.shouldBegin(e,this))&&this.shouldUpdate(e,this)){e.preventDefault();var o=i.get("canvas"),s=o.getPointByClient(e.clientX,e.clientY),u=this.get("sensitivity"),f=i.getZoom(),l=f,c=f;this.isFireFox?e.deltaY>0||e.wheelDelta<0?l=1-zv*u:l=1/(1-zv*u):e.wheelDelta<0?l=1-zv*u:l=1/(1-zv*u),c=f*l;var h=this.get("minZoom")||i.get("minZoom"),d=this.get("maxZoom")||i.get("maxZoom");c>d?c=d:c<h&&(c=h);var v=this.get("enableOptimize");if(v){var p=this.get("optimizeZoom"),g=this.get("optimized"),y=i.getNodes(),m=i.getEdges(),b=y.length,x=m.length;if(!g){for(var w=0;w<b;w++){var E=y[w];if(!E.destroyed)for(var _=E.get("group").get("children"),M=_.length,C=0;C<M;C++){var S=_[C];!S.destoryed&&!S.get("isKeyShape")&&(S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide())}}for(var A=0;A<x;A++)for(var T=m[A],_=T.get("group").get("children"),M=_.length,C=0;C<M;C++){var S=_[C];S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var k=setTimeout(function(){var tt=i.getZoom(),ae=t.get("optimized");if(ae){t.set("optimized",!1);for(var L=0;L<b;L++){var Se=y[L],Ge=Se.get("group").get("children"),me=Ge.length;if(tt<p){var Ye=Se.getKeyShape(),We=Ye.get("ori-visibility");Ye.set("ori-visibility",void 0),We&&Ye.show()}else for(var qe=0;qe<me;qe++){var et=Ge[qe],We=et.get("ori-visibility");et.set("ori-visibility",void 0),!et.get("visible")&&We&&We&&et.show()}}for(var yt=0;yt<x;yt++){var Pt=m[yt],Ge=Pt.get("group").get("children"),me=Ge.length;if(tt<p){var Ye=Pt.getKeyShape(),We=Ye.get("ori-visibility");Ye.set("ori-visibility",void 0),We&&Ye.show()}else for(var qe=0;qe<me;qe++){var et=Ge[qe];if(!et.get("visible")){var We=et.get("ori-visibility");et.set("ori-visibility",void 0),We&&et.show()}}}}},100);this.set("timeout",k)}if(f<=1){var O=void 0,G=void 0;if(a.fixAll||a.fixLineWidth||a.fixLabel){O=i.findAllByState("node",a.fixState),G=i.findAllByState("edge",a.fixState);for(var D=f/c,$=O.length,Y=0;Y<$;Y++){var E=O[Y],N=E.getContainer(),P=E.getModel(),W=E.getOriginStyle(),J=E.getStateStyle(a.fixState),te=E.get("shapeFactory").getShape(P.type).getStateStyle(a.fixState,E)[a.fixState];if(a.fixAll){if(c<=1){var H=Vt(N.getMatrix());H||(H=[1,0,0,0,1,0,0,0,1]);var pe=E.getModel(),Te=pe.x,Ne=pe.y;H=wle(H,[["t",-Te,-Ne],["s",D,D],["t",Te,Ne]]),N.setMatrix(H)}}else for(var _=N.get("children"),M=_.length,C=0;C<M;C++){var S=_[C],Ze=void 0,at=void 0;if(a.fixLabel){var nt=S.get("type");if(nt==="text"){Ze=S.attr("fontSize")||12;var St=J[S.get("name")],Mt=te[S.get("name")],fr=St?St.fontSize:12,Ft=Mt?Mt.fontSize:12,Wt=fr||Ft||12;if(c<=1&&S.attr("fontSize",Wt/c),at)break}}if(a.fixLineWidth&&S.get("isKeyShape")){at=S.attr("lineWidth")||0;var dr=J.lineWidth||te.lineWidth||W.lineWidth||0;if(c<=1&&S.attr("lineWidth",dr/c),Ze)break}}}for(var lr=G.length,Ut=0;Ut<lr;Ut++)for(var T=G[Ut],N=T.getContainer(),_=N.get("children"),P=T.getModel(),J=T.getStateStyle(a.fixState),te=T.get("shapeFactory").getShape(P.type).getStateStyle(a.fixState,T)[a.fixState],M=_.length,C=0;C<M;C++){var S=_[C],Ze=void 0,at=void 0;if(a.fixLabel||a.fixAll){var nt=S.get("type");if(nt==="text"){Ze=S.attr("fontSize")||12;var St=J[S.get("name")],Mt=te[S.get("name")],fr=St?St.fontSize:12,Ft=Mt?Mt.fontSize:12,Wt=fr||Ft||12;if(c<=1&&S.attr("fontSize",Wt/c),at)break}}if((a.fixLineWidth||a.fixAll)&&S.get("isKeyShape")){at=S.attr("lineWidth")||0;var dr=J.lineWidth||te.lineWidth||1;if(c<=1&&S.attr("lineWidth",dr/c),Ze)break}}}}var ar=this.get("animate"),Zr=this.get("animateCfg");i.zoomTo(c,{x:s.x,y:s.y},ar,Zr),i.emit("wheelzoom",e)}}},jN={onMouseEnter:function(e){var t=e.item;this.currentTarget=t,this.showTooltip(e),this.graph.emit("tooltipchange",{item:e.item,action:"show"})},onMouseMove:function(e){if(!this.shouldUpdate(e,this)){this.hideTooltip();return}!this.currentTarget||e.item!==this.currentTarget||this.updatePosition(e)},onMouseLeave:function(e){this.shouldEnd(e,this)&&(this.hideTooltip(),this.graph.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null)},showTooltip:function(e){var t=this.container;if(!(!e.item||e.item.destroyed)){t||(t=this.createTooltip(this.graph.get("canvas")),this.container=t);var n=this.formatText(e.item.get("model"),e);t.innerHTML=n,jt(this.container,{visibility:"visible"}),this.updatePosition(e)}},hideTooltip:function(){jt(this.container,{visibility:"hidden"})},updatePosition:function(e){var t=this.get("shouldBegin"),n=this,i=n.width,a=n.height,o=n.container,s=n.graph;if(!t(e,this)){jt(o,{visibility:"hidden"});return}var u=s.getPointByClient(e.clientX,e.clientY),f=s.getCanvasByPoint(u.x,u.y),l=f.x,c=f.y,h=o.getBoundingClientRect();l>i/2?l-=h.width:l+=this.offset,c>a/2?c-=h.height:c+=this.offset;var d="".concat(l,"px"),v="".concat(c,"px");jt(this.container,{left:d,top:v,visibility:"visible"})},createTooltip:function(e){var t=e.get("el");t.style.position="relative";var n=wr('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return t.parentNode.appendChild(n),jt(n,{position:"absolute",visibility:"visible"}),this.width=e.get("width"),this.height=e.get("height"),this.container=n,this.graph.get("tooltips").push(n),n}},_le=B({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(t){return t.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},jN),Sle=B({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(t){return"source: ".concat(t.source," target: ").concat(t.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},jN);var UN="click",Mle=["click","dblclick"];const Cle={getDefaultCfg:function(){return{trigger:UN,onChange:function(){}}},getEvents:function(){var e,t;return Mle.includes(this.trigger)?t=this.trigger:(t=UN,console.warn("Behavior collapse-expand 的 trigger 参数不合法，请输入 'click' 或 'dblclick'")),e={},e["node:".concat(t)]="onNodeClick",e.touchstart="onNodeClick",e},onNodeClick:function(e){var t=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){t.toggle(e),clearTimeout(t.timer),t.timer=0},200)}else this.toggle(e)},toggle:function(e){var t=e.item;if(t){var n=this.graph.findDataById(t.get("id"));if(n){var i=n.children;if(!(!i||i.length===0)){var a=!n.collapsed;this.shouldBegin(e,a,this)&&(n.collapsed=a,t.getModel().collapsed=a,this.graph.emit("itemcollapsed",{item:e.item,collapsed:a}),this.shouldUpdate(e,a,this)&&(this.onChange(t,a,this),this.graph.layout()))}}}}};var Ale=Ua.calculationItemsBBox,Tle=function r(e,t){if(t(e)!==!1&&e){var n=e.get("combos");if(n.length===0)return!1;ye(n,function(i){r(i,t)})}};const Ile={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"combo:mousedown":"onMouseDown","combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(e){var t=e.item;if(!t||t.destroyed||!this.shouldUpdate(e,this))return!1;var n=t.getType();return n==="combo"},onMouseDown:function(e){this.origin={x:e.x,y:e.y}},onDragStart:function(e){var t=this,n=this.graph,i=e.item;if(this.currentShouldEnd=!0,!!this.validationCombo(e)){this.targets=[];var a=n.findAllByState("combo",this.selectedState),o=i.get("id"),s=a.filter(function(f){var l=f.get("id");return o===l});s.length===0?this.targets.push(i):this.targets=a;var u=[];this.targets.forEach(function(f){var l=f.getModel(),c=l.x,h=l.y,d=l.id;u.push({x:c,y:h,id:d})}),this.set("beforeDragItems",u),this.activeState&&this.targets.map(function(f){var l=f.getModel();if(l.parentId){var c=n.findById(l.parentId);c&&n.setItemState(c,t.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],Tle(i,function(f){if(f.destroyed)return!1;var l=f.getModel();return t.currentItemChildCombos.push(l.id),!0})}},onDrag:function(e){var t=this;if(this.origin&&this.validationCombo(e))if(this.enableDelegate)this.updateDelegate(e);else{if(this.activeState){var n=this.graph,i=e.item,a=i.getModel(),o=n.getCombos(),s=i.getBBox(),u=s.centerX,f=s.centerY,l=s.width,c=o.filter(function(h){var d=h.getModel();return a.parentId,d.id!==a.id&&!t.currentItemChildCombos.includes(d.id)});c.map(function(h){var d=h.getBBox(),v=d.centerX,p=d.centerY,g=d.width,y=u-v,m=f-p,b=2*Math.sqrt(y*y+m*m);l+g-b>.8*l?n.setItemState(h,t.activeState,!0):n.setItemState(h,t.activeState,!1)})}ye(this.targets,function(h){t.updateCombo(h,e)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(e,t){var n=this;(this.enableDelegate||t)&&ye(this.targets,function(i){n.updateCombo(i,e,t)})},onDrop:function(e){var t=this,n=e.item;if(this.currentShouldEnd=this.shouldEnd(e,n,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!n||!this.targets||n.destroyed)){var i=this.graph,a=n.getModel();this.targets.map(function(o){var s=o.getModel();s.parentId!==a.id?(t.activeState&&i.setItemState(n,t.activeState,!1),t.onlyChangeComboSize?i.updateCombo(o):i.updateComboTree(o,a.id,!1)):i.updateCombo(n)}),this.end(n,e),this.endComparison=!0}},onNodeDrop:function(e){var t=this;if(!(!this.targets||this.targets.length===0)){var n=this.graph,i=e.item,a=i.getModel().comboId,o=a?n.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){var s;if(a){if(this.activeState){var u=n.findById(a);n.setItemState(u,this.activeState,!1)}this.targets.map(function(f){t.onlyChangeComboSize?n.updateCombo(f):a!==f.getID()&&(s=n.findById(a),a!==f.getModel().parentId&&n.updateComboTree(f,a,!1))})}else this.targets.map(function(f){if(t.onlyChangeComboSize)n.updateCombo(f);else{var l=f.getModel();l.comboId&&n.updateComboTree(f,void 0,!1)}});this.endComparison=!0,this.end(s,e)}}},onDragEnter:function(e){if(this.origin&&this.validationCombo(e)){var t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!0)}},onDragLeave:function(e){if(this.origin&&this.validationCombo(e)){var t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!1)}},onDragEnd:function(e){if(!(!this.targets||this.targets.length===0)){var t=e.item;this.currentShouldEnd&&this.updatePositions(e);var n=this.getParentCombo(t.getModel().parentId),i=this.graph;n&&this.activeState&&i.setItemState(n,this.activeState,!1),this.end(void 0,e)}},end:function(e,t){var n=this;if(this.origin){var i=this.graph;if(this.delegateShape){var a=i.get("delegateGroup");a.clear(),this.delegateShape=null}if(e&&this.activeState&&i.setItemState(e,this.activeState,!1),!e){var o=i.get("enabledStack")&&this.enableStack,s={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map(function(u){if(!n.onlyChangeComboSize)i.updateComboTree(u,void 0,o);else{i.updateCombo(u);var f=u.getModel(),l=f.x,c=f.y,h=f.id;s.after.combos.push({x:l,y:c,id:h}),i.pushStack("update",s)}})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(e,t,n){var i=this;if(n===void 0&&(n={}),t(e,n)!==!1&&e){var a=e.get("combos");ye(a,function(s){i.traverse(s,t,n)});var o=e.get("nodes");ye(o,function(s){i.traverse(s,t,n)})}},updateCombo:function(e,t,n){this.updateSingleItem(e,t,n);var i={};this.traverse(e,function(a,o){return a.destroyed?!1:(a.getEdges().forEach(function(s){return o[s.getID()]=s}),!0)},i),Object.values(i).forEach(function(a){return a.refresh()})},updateSingleItem:function(e,t,n){var i=this.origin,a=this.graph,o=e.getModel(),s=e.get("id");this.point[s]||(this.point[s]={x:o.x,y:o.y});var u=t.x-i.x+this.point[s].x,f=t.y-i.y+this.point[s].y;n&&(u+=i.x-t.x,f+=i.y-t.y),a.updateItem(e,{x:u,y:f},!1)},getParentCombo:function(e){var t=this.graph;if(e){var n=t.findById(e);if(n)return n}},updateDelegate:function(e){var t=this.graph;if(this.delegateShape){var h=e.x-this.origin.x+this.originPoint.minX,d=e.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:h,y:d})}else{var n=t.get("delegateGroup"),i=null;this.targets.length>1?i=Ale(this.targets):i=this.targets[0].getBBox();var a=i.x,o=i.y,s=i.width,u=i.height,f=i.minX,l=i.minY;this.originPoint={x:a,y:o,width:s,height:u,minX:f,minY:l};var c=B(B({},Jo.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:B({width:i.width,height:i.height,x:i.x,y:i.y},c),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var e=this,t=e.graph,n=e.targets,i={};n==null||n.forEach(function(a){var o=a.getModel().parentId;o&&(i[o]=t.findById(o))}),Object.values(i).forEach(function(a){a&&t.updateCombo(a)})}};var XN="dblclick",kle=["click","dblclick"];const Lle={getDefaultCfg:function(){return{trigger:XN,relayout:!0}},getEvents:function(){var e,t;return kle.includes(this.trigger)?t=this.trigger:(t=XN,console.warn("Behavior collapse-expand-group 的 trigger 参数不合法，请输入 'click' 或 'dblclick'")),e={},e["combo:".concat(t)]="onComboClick",e},onComboClick:function(e){var t=e.item,n=this,i=n.graph,a=n.relayout;if(!(!t||t.destroyed||t.getType()!=="combo")){var o=t.getModel(),s=o.id;s&&(i.collapseExpandCombo(s),a&&i.get("layout")?i.layout():i.refreshPositions())}}};var Nle=Ua.isPolygonsIntersect,Ole=Ua.pathToPoints,YN="shift",Dle=["drag","shift","ctrl","alt","control"],Ple=function(e,t){var n,i=e.getKeyShape();if(e.get("type")==="path")n=Ole(i.attr("path"));else{var a=i.getCanvasBBox();n=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]]}return Nle(t,n)};const Rle={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:YN,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Dle.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=YN,console.warn("Behavior lasso-select 的 trigger 参数不合法，请输入 'drag'、'shift'、'ctrl' 或 'alt'")),this.trigger==="drag"?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(e){var t=this.lasso,n=e.item;n||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),t||(t=this.createLasso()),this.dragging=!0,this.originPoint={x:e.x,y:e.y},this.points.push(this.originPoint),t.show())},onDragMove:function(e){this.dragging&&(this.trigger!=="drag"&&!this.keydown||(this.points.push({x:e.x,y:e.y}),this.updateLasso(e)))},onDragEnd:function(e){!this.lasso&&!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var e=this.points,t=[];return e.length&&(e.forEach(function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t.push(["L",e[0].x,e[0].y])),t},clearStates:function(e){e===void 0&&(e="canvas:click");var t=this,n=t.graph,i=t.selectedState,a=t.shouldDeselect,o=n.findAllByState("node",i),s=n.findAllByState("edge",i);(!a||a({action:e,nodes:o,edges:s}))&&(o.forEach(function(u){return n.setItemState(u,i,!1)}),s.forEach(function(u){return n.setItemState(u,i,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var e=this,t=this,n=t.graph,i=t.shouldUpdate,a=this.points.map(function(l){return[n.getCanvasByPoint(l.x,l.y).x,n.getCanvasByPoint(l.x,l.y).y]}),o=this.selectedState,s=[],u=[];n.getNodes().forEach(function(l){if(l.isVisible()&&Ple(l,a)&&i(l,"select",e)){s.push(l);var c=l.getModel();u.push(c.id),n.setItemState(l,o,!0)}});var f=[];this.includeEdges&&s.forEach(function(l){var c=l.getOutEdges();c.forEach(function(h){if(h.isVisible()){var d=h.getModel(),v=d.source,p=d.target;u.includes(v)&&u.includes(p)&&i(h,"select",e)&&(f.push(h),n.setItemState(h,e.selectedState,!0))}})}),this.selectedEdges=f,this.selectedNodes=s,this.onSelect&&this.onSelect(s,f),n.emit("nodeselectchange",{selectedItems:{nodes:s,edges:f},select:!0})},createLasso:function(){var e=this,t=e.graph.get("delegateGroup").addShape("path",{attrs:B({path:[]},e.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(e){var t=this;this.lasso.attr({path:t.getLassoPath()})},onKeyDown:function(e){var t=e.key;t&&(t.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}};var WN="click",Ble=["click","drag"],VN=void 0,Fle=["shift","ctrl","control","alt","meta",void 0];const Gle={getDefaultCfg:function(){return{trigger:WN,key:VN,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var e=this;Ble.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=WN,console.warn("Behavior create-edge 的 trigger 参数不合法，请输入 'click'，'drag'")),e.key&&Fle.indexOf(e.key.toLowerCase())===-1&&(e.trigger=VN,console.warn("Behavior create-edge 的 key 参数不合法，请输入 'shift'，'ctrl'，'alt'，'control'，或 undefined"));var t;return e.trigger==="drag"?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:e.trigger==="click"&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),e.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item;(!n||n.getID()===t.source||n.getType()!=="node")&&t.cancelCreating({item:t.edge,x:e.x,y:e.y})}},onClick:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item,i=t.graph,a=n.getModel(),o=t.getEdgeConfig;if(t.addingEdge&&t.edge){if(!t.shouldEnd(e,t))return;var s=void 0;o&&_r(o)?s=o({source:t.source,target:a.id},t):s=t.edgeConfig;var u=B({target:a.id},s);if(t.source===a.id&&(u.type="loop"),i.emit("beforecreateedge",{}),i.updateItem(t.edge,u,!1),i.get("enabledStack")){var f=B(B({},t.edge.getModel()),{itemType:"edge"}),l={};l.edges=[f],i.pushStack("add",{before:{},after:l})}i.emit("aftercreateedge",{edge:t.edge}),t.edge.getKeyShape().set("capture",!0),t.edge=null,t.addingEdge=!1}else{if(!t.shouldBegin(e,t))return;var s=void 0;o&&_r(o)?s=o({source:a.id,target:a.id},t):s=t.edgeConfig,t.edge=i.addItem("edge",B({source:a.id,target:a.id},s),!1),t.source=a.id,t.addingEdge=!0,t.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(e){var t=this;if(!(t.key&&!t.keydown)){t.edge&&t.edge.destroyed&&t.cancelCreating({item:t.edge});var n={x:e.x,y:e.y};if(!t.graph.findById(t.source)){t.addingEdge=!1;return}t.addingEdge&&t.edge&&t.graph.updateItem(t.edge,{target:n},!1)}},cancelCreating:function(e){var t,n,i=this;if(!(i.key&&!i.keydown)){var a=i.graph,o=e.item;if(i.addingEdge&&(i.edge===o||!((n=(t=e.target)===null||t===void 0?void 0:t.isCanvas)===null||n===void 0)&&n.call(t))){i.edge&&!i.edge.destroyed&&a.removeItem(i.edge,!1),i.edge=null,i.addingEdge=!1;return}}},onKeyDown:function(e){var t=this,n=e.key;n&&(n.toLowerCase()===t.key.toLowerCase()?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){var e=this;e.addingEdge&&e.edge&&(e.graph.removeItem(e.edge,!1),e.addingEdge=!1,e.edge=null),this.keydown=!1}};var HN="ctrl",zle=["shift","ctrl","alt","control"],$le="1";const jle={getDefaultCfg:function(){return{trigger:HN,combinedKey:$le,functionName:"fitView",functionParams:[]}},getEvents:function(){return zle.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=HN,console.warn("Behavior shortcuts-fit-view 的 trigger 参数 '".concat(this.trigger,"' 不合法，请输入 'drag'、'shift'、'ctrl' 或 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(e){var t=e.key;if(t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();this.triggerKeydown||(i===n||i==="control"&&n==="ctrl"||i==="ctrl"&&n==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var a=this.graph;if(!a[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法，它不是 Graph 的一个函数名")),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]();return}var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(i===o||i==="control"&&o==="ctrl"||i==="ctrl"&&o==="control")&&(this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}};var Ule=["shift","ctrl","alt","control","meta"],Xle={"drag-canvas":vle,"zoom-canvas":Ele,"drag-node":ple,"activate-relations":gle,"brush-select":mle,"click-select":xle,"lasso-select":Rle,tooltip:_le,"edge-tooltip":Sle,"collapse-expand":Cle,"drag-combo":Ile,"collapse-expand-combo":Lle,"create-edge":Gle,"shortcuts-call":jle,"scroll-canvas":{getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||Ule.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(e){var t=this;if(this.allowDrag(e)){var n=this.graph,i=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];i.includes("control")&&i.push("ctrl");var a=i.some(function(P){return e["".concat(P,"Key")]});if(a){var o=n.get("canvas"),s=o.getPointByClient(e.clientX,e.clientY),u=n.getZoom();e.wheelDelta>0?u=u+u*.05:u=u-u*.05,n.zoomTo(u,{x:s.x,y:s.y})}else{var f=e.deltaX||e.movementX,l=e.deltaY||e.movementY;!l&&navigator.userAgent.indexOf("Firefox")>-1&&(l=-e.wheelDelta*125/3);var c=this.graph.get("width"),h=this.graph.get("height"),d=this.graph.get("canvas").getCanvasBBox(),v=this.scalableRange,p=this.scalableRange;v<1&&v>-1&&(v=c*v,p=h*p);var g=d.minX,y=d.maxX,m=d.minY,b=d.maxY;f>0?y<-v?f=0:y-f<-v&&(f=y+v):f<0&&(g>c+v?f=0:g-f>c+v&&(f=g-(c+v))),l>0?b<-p?l=0:b-l<-p&&(l=b+p):l<0&&(m>h+p?l=0:m-l>h+p&&(l=m-(h+p))),this.get("direction")==="x"?l=0:this.get("direction")==="y"&&(f=0),n.translate(-f,-l)}e.preventDefault();var x=this.get("enableOptimize");if(x){var w=this.get("optimizeZoom"),E=this.get("optimized"),_=n.getNodes(),M=n.getEdges(),C=_.length,S=M.length;if(!E){for(var A=0;A<C;A++){var T=_[A];if(!T.destroyed)for(var k=T.get("group").get("children"),O=k.length,G=0;G<O;G++){var D=k[G];!D.destoryed&&!D.get("isKeyShape")&&(D.set("ori-visibility",D.get("ori-visibility")||D.get("visible")),D.hide())}}for(var $=0;$<S;$++)for(var Y=M[$],k=Y.get("group").get("children"),O=k.length,G=0;G<O;G++){var D=k[G];D.set("ori-visibility",D.get("ori-visibility")||D.get("visible")),D.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var N=setTimeout(function(){var P=n.getZoom(),W=t.get("optimized");if(W){t.set("optimized",!1);for(var J=0;J<C;J++){var te=_[J],H=te.get("group").get("children"),pe=H.length;if(P<w){var Te=te.getKeyShape(),Ne=Te.get("ori-visibility");Ne&&Te.show()}else for(var Ze=0;Ze<pe;Ze++){var at=H[Ze],Ne=at.get("ori-visibility");!at.get("visible")&&Ne&&Ne&&at.show()}}for(var nt=0;nt<S;nt++){var St=M[nt],H=St.get("group").get("children"),pe=H.length;if(P<w){var Te=St.getKeyShape(),Ne=Te.get("ori-visibility");Ne&&Te.show()}else for(var Ze=0;Ze<pe;Ze++){var at=H[Ze];if(!at.get("visible")){var Ne=at.get("ori-visibility");Ne&&at.show()}}}}},100);this.set("timeout",N)}}},allowDrag:function(e){var t,n,i=e.target,a=i&&i.isCanvas&&i.isCanvas();if(of(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(un(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}}};ye(Xle,function(r,e){tS(e,r)});var Yle=B(B({},C4),Nj),Wle=ei.Fisheye,Vle=ei.TimeBar,Hle=ei.ImageMinimap,qle=ei.EdgeFilterLens,Zle=ei.SnapLine,Kle=ei.Annotation;const qN={version:Jo.version,Graph:CL,TreeGraph:Cse,Util:Ua,Layout:Ht.Layouts,TreeLayout:hse,registerLayout:dse,Global:Jo,registerBehavior:tS,registerCombo:p8,registerEdge:eS,registerNode:Ma,Minimap:ei.Minimap,Grid:ei.Grid,Bundling:ei.Bundling,Menu:ei.Menu,ToolBar:ei.ToolBar,Tooltip:ei.Tooltip,Legend:ei.Legend,TimeBar:Vle,SnapLine:Zle,Fisheye:Wle,ImageMinimap:Hle,EdgeFilterLens:qle,Annotation:Kle,Algorithm:Yle,Arrow:q_,Marker:Z_,Shape:yr};qN.version="4.8.20";const Qle={id:"test"},Jle=Ka.defineComponent({__name:"AboutPage",setup(r){return Ka.onMounted(()=>{const e={nodes:[{id:"node1",label:"node1"},{id:"node2",label:"node2"}],edges:[{source:"node1",target:"node2"}]},t=new qN.Graph({container:"test",width:800,height:500,modes:{default:["drag-node","zoom-canvas","click-select"]}});t.data(e),t.render()}),(e,t)=>(Ka.openBlock(),Ka.createElementBlock("div",Qle))}}),ece=(r,e)=>r+e,tce=(r,e)=>r-e,rce=(r,e)=>r*e,nce=(r,e)=>r/e,ice=[Jle],ace=function(r,e){ice.forEach(t=>{r.component(t.name,t)})};bi.divide=nce,bi.install=ace,bi.multiply=rce,bi.subtract=tce,bi.sum=ece,Object.defineProperty(bi,Symbol.toStringTag,{value:"Module"})});
