@gkd-kit/inspect 0.0.1734189305428 → 0.0.1734266056335
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-C4GDiKVM.js +25 -0
- package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-CM5cE5rV.js.map → ActionCard.vue_vue_type_script_setup_true_lang-C4GDiKVM.js.map} +1 -1
- package/dist/assets/{DevicePage-EWfGT1kp.js → DevicePage-BIwpMgjL.js} +3 -3
- package/dist/assets/{DevicePage-EWfGT1kp.js.map → DevicePage-BIwpMgjL.js.map} +1 -1
- package/dist/assets/{HomePage-CJhlhWMX.js → HomePage-6pbbXVox.js} +3 -3
- package/dist/assets/{HomePage-CJhlhWMX.js.map → HomePage-6pbbXVox.js.map} +1 -1
- package/dist/assets/ImportPage-pprILn6B.js +2 -0
- package/dist/assets/{ImportPage-hXu1sfKO.js.map → ImportPage-pprILn6B.js.map} +1 -1
- package/dist/assets/{SelectorPage-DizDVK-x.js → SelectorPage-ftaQbixd.js} +2 -2
- package/dist/assets/{SelectorPage-DizDVK-x.js.map → SelectorPage-ftaQbixd.js.map} +1 -1
- package/dist/assets/{SnapshotPage-DdTOX0zO.js → SnapshotPage-BpCWU2Lq.js} +20 -20
- package/dist/assets/SnapshotPage-BpCWU2Lq.js.map +1 -0
- package/dist/assets/TrackGraph-pCILQKep.js +670 -0
- package/dist/assets/{TrackGraph-CHQGeAwF.js.map → TrackGraph-pCILQKep.js.map} +1 -1
- package/dist/assets/_404Page-CtIlnfyk.js +2 -0
- package/dist/assets/{_404Page-CgdnymuX.js.map → _404Page-CtIlnfyk.js.map} +1 -1
- package/dist/assets/chunk-B7h9CrOT.js +3 -0
- package/dist/assets/chunk-B7h9CrOT.js.map +1 -0
- package/dist/assets/dayjs.min-NDdrP0U0.js +629 -0
- package/dist/assets/dayjs.min-NDdrP0U0.js.map +1 -0
- package/dist/assets/{error-BUItto_r.js → error-BuWiIPq5.js} +2 -2
- package/dist/assets/{error-BUItto_r.js.map → error-BuWiIPq5.js.map} +1 -1
- package/dist/assets/{import-CiBARhVx.js → import-iYDGuobE.js} +2 -2
- package/dist/assets/{import-CiBARhVx.js.map → import-iYDGuobE.js.map} +1 -1
- package/dist/assets/index-D3bLDlEa.js +904 -0
- package/dist/assets/index-D3bLDlEa.js.map +1 -0
- package/dist/assets/{jszip.min-CDJCxf14.js → jszip.min-5Im3j6i9.js} +4 -4
- package/dist/assets/{jszip.min-CDJCxf14.js.map → jszip.min-5Im3j6i9.js.map} +1 -1
- package/dist/assets/polyfills-CKx2Tz-c.js +2 -0
- package/dist/assets/polyfills-CKx2Tz-c.js.map +1 -0
- package/dist/assets/{snapshot-ilkMqbq4.js → snapshot-B6z6pf3s.js} +2 -2
- package/dist/assets/snapshot-B6z6pf3s.js.map +1 -0
- package/dist/assets/{table-BoCQ8rWS.js → table-CileF2fI.js} +19 -17
- package/dist/assets/table-CileF2fI.js.map +1 -0
- package/dist/index.html +3 -3
- package/package.json +28 -28
- package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-CM5cE5rV.js +0 -25
- package/dist/assets/ImportPage-hXu1sfKO.js +0 -2
- package/dist/assets/SnapshotPage-DdTOX0zO.js.map +0 -1
- package/dist/assets/TrackGraph-CHQGeAwF.js +0 -670
- package/dist/assets/_404Page-CgdnymuX.js +0 -2
- package/dist/assets/chunk-Dqls0lD5.js +0 -3
- package/dist/assets/chunk-Dqls0lD5.js.map +0 -1
- package/dist/assets/dayjs.min-DDHGa4q3.js +0 -628
- package/dist/assets/dayjs.min-DDHGa4q3.js.map +0 -1
- package/dist/assets/index-ANDCUUtG.js +0 -904
- package/dist/assets/index-ANDCUUtG.js.map +0 -1
- package/dist/assets/polyfills-CO2Y5WYh.js +0 -1
- package/dist/assets/snapshot-ilkMqbq4.js.map +0 -1
- package/dist/assets/table-BoCQ8rWS.js.map +0 -1
- /package/dist/assets/{index-CC48p5w9.css → index-Bkz03J5r.css} +0 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import{cs as da,cm as va,b0 as $c,h as d3,m as v3,A as p3,D as g3,ax as Nx,H as y3,I as m3}from"./index-D3bLDlEa.js";import{a0 as Ox}from"./dayjs.min-NDdrP0U0.js";function b3(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 sm=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return zi},get Circle(){return G9},get Ellipse(){return z9},get Image(){return j9},get Line(){return U9},get Marker(){return X9},get Path(){return n1},get Polygon(){return K9},get Polyline(){return Q9},get Rect(){return t$},get Text(){return r$}},Symbol.toStringTag,{value:"Module"})),um=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return pi},get Circle(){return o$},get Dom(){return s$},get Ellipse(){return u$},get Image(){return f$},get Line(){return l$},get Marker(){return c$},get Path(){return h$},get Polygon(){return d$},get Polyline(){return v$},get Rect(){return g$},get Text(){return x$}},Symbol.toStringTag,{value:"Module"}));var R0=function(r,e){return R0=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])},R0(r,e)};function Rt(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");R0(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var z=function(){return z=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},z.apply(this,arguments)};function un(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 QC(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 JC(r,e){return function(t,n){e(t,n,r)}}function x3(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 w3(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 E3(r){return typeof r=="symbol"?r:"".concat(r)}function _3(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 eA(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Vn(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 Hn(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}}}var vv=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 tA(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&vv(e,r,t)}function Sd(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 fm(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 rA(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(fm(arguments[e]));return r}function pv(){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 Qn(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 Gu(r){return this instanceof Gu?(this.v=r,this):new Gu(r)}function nA(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},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 Gu?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 iA(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:Gu(r[i](o)),done:!1}:a?a(o):o}:a}}function aA(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 Sd=="function"?Sd(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 oA(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}var S3=Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e};function sA(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)&&vv(e,r,t);return S3(e,r),e}function uA(r){return r&&r.__esModule?r:{default:r}}function fA(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 lA(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 cA(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 hA(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 M3=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 dA(r){function e(n){r.error=r.hasError?new M3(n,r.error,"An error was suppressed during disposal."):n,r.hasError=!0}function t(){for(;r.stack.length;){var n=r.stack.pop();try{var i=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(i).then(t,function(a){return e(a),t()})}catch(a){e(a)}}if(r.hasError)throw r.error}return t()}const C3={__extends:Rt,__assign:z,__rest:un,__decorate:QC,__param:JC,__metadata:eA,__awaiter:Vn,__generator:Hn,__createBinding:vv,__exportStar:tA,__values:Sd,__read:fm,__spread:rA,__spreadArrays:pv,__spreadArray:Qn,__await:Gu,__asyncGenerator:nA,__asyncDelegator:iA,__asyncValues:aA,__makeTemplateObject:oA,__importStar:sA,__importDefault:uA,__classPrivateFieldGet:fA,__classPrivateFieldSet:lA,__classPrivateFieldIn:cA,__addDisposableResource:hA,__disposeResources:dA},A3=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:hA,get __assign(){return z},__asyncDelegator:iA,__asyncGenerator:nA,__asyncValues:aA,__await:Gu,__awaiter:Vn,__classPrivateFieldGet:fA,__classPrivateFieldIn:cA,__classPrivateFieldSet:lA,__createBinding:vv,__decorate:QC,__disposeResources:dA,__esDecorate:x3,__exportStar:tA,__extends:Rt,__generator:Hn,__importDefault:uA,__importStar:sA,__makeTemplateObject:oA,__metadata:eA,__param:JC,__propKey:E3,__read:fm,__rest:un,__runInitializers:w3,__setFunctionName:_3,__spread:rA,__spreadArray:Qn,__spreadArrays:pv,__values:Sd,default:C3},Symbol.toStringTag,{value:"Module"}));var zn=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},Md=function(r,e){return zn(r)?r.indexOf(e)>-1:!1},gv=function(r,e){if(!zn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},T3=function(r,e){return e===void 0&&(e=[]),gv(r,function(t){return!Md(e,t)})},I3={}.toString,Fi=function(r,e){return I3.call(r)==="[object "+e+"]"};const Pr=function(r){return Fi(r,"Function")};var ht=function(r){return r==null};const mt=function(r){return Array.isArray?Array.isArray(r):Fi(r,"Array")},wn=function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"};function _e(r,e){if(r){var t;if(mt(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(wn(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var vA=Object.keys?function(r){return Object.keys(r)}:function(r){var e=[];return _e(r,function(t,n){Pr(r)&&n==="prototype"||e.push(n)}),e};function pA(r,e){var t=vA(e),n=t.length;if(ht(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 Cd=function(r){return typeof r=="object"&&r!==null},bn=function(r){if(!Cd(r)||!Fi(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 k3(r,e){if(!mt(r))return null;var t;if(Pr(e)&&(t=e),bn(e)&&(t=function(i){return pA(i,e)}),t){for(var n=0;n<r.length;n+=1)if(t(r[n]))return r[n]}return null}function L3(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 N3=function(r,e){for(var t=null,n=0;n<r.length;n++){var i=r[n],a=i[e];if(!ht(a)){mt(a)?t=a[0]:t=a;break}}return t},O3=function(r){if(!mt(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e},gA=function(r,e){if(e===void 0&&(e=[]),!mt(r))e.push(r);else for(var t=0;t<r.length;t+=1)gA(r[t],e);return e};const la=function(r){if(mt(r))return r.reduce(function(e,t){return Math.max(e,t)},r[0])},ca=function(r){if(mt(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])};var yA=function(r){var e=r.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(mt(r[0])){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);e=t}var i=la(e),a=ca(e);return{min:a,max:i}},mA=Array.prototype,D3=mA.splice,P3=mA.indexOf,R3=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=P3.call(r,i))>-1;)D3.call(r,a,1);return r},B3=Array.prototype.splice,bA=function(e,t){if(!zn(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,B3.call(e,o,1))}return e},xA=function(r,e,t){if(!mt(r)&&!bn(r))return r;var n=t;return _e(r,function(i,a){n=e(n,i,a)}),n},F3=function(r,e){var t=[];if(!zn(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 bA(r,i),t};const Fe=function(r){return Fi(r,"String")};function G3(r,e){var t;if(Pr(e))t=function(i,a){return e(i)-e(a)};else{var n=[];Fe(e)?n.push(e):mt(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 Al(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 z3=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Al([].concat.apply([],r))};const j3=function(r,e){for(var t=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[e];if(!ht(o)){mt(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 ua(r){if(zn(r))return r[0]}function ci(r){if(zn(r)){var e=r;return e[e.length-1]}}function U3(r,e){return mt(r)||Fe(r)?r[0]===e:!1}function $3(r,e){return mt(r)||Fe(r)?r[r.length-1]===e:!1}var X3=function(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0},Y3=function(r,e){for(var t=0;t<r.length;t++)if(e(r[t],t))return!0;return!1},W3=Object.prototype.hasOwnProperty;function Ad(r,e){if(!e||!mt(r))return{};for(var t={},n=Pr(e)?e:function(s){return s[e]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),W3.call(t,i)?t[i].push(o):t[i]=[o]}return t}function wA(r,e){if(!e)return{0:r};if(!Pr(e)){var t=mt(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 Ad(r,e)}const q3=function(r,e){if(!e)return[r];var t=wA(r,e),n=[];for(var i in t)n.push(t[i]);return n};function V3(r,e){return r["_wrap_"+e]}function gs(r,e){if(r["_wrap_"+e])return r["_wrap_"+e];var t=function(n){r[e](n)};return r["_wrap_"+e]=t,t}var Dx={};function H3(r){var e=Dx[r];if(!e){for(var t=r.toString(16),n=t.length;n<6;n++)t="0"+t;e="#"+t,Dx[r]=e}return e}function Z3(r){var e=0,t=0,n=0,i=0;return mt(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 K3=function(r,e,t){return r<e?e:r>t?t:r},rd=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))},dt=function(r){return Fi(r,"Number")},Q3=function(r){return dt(r)&&r%1!==0},J3=function(r){return dt(r)&&r%2===0},e5=Number.isInteger?Number.isInteger:function(r){return dt(r)&&r%1===0},t5=function(r){return dt(r)&&r<0},r5=1e-5;function EA(r,e,t){return t===void 0&&(t=r5),Math.abs(r-e)<t}var n5=function(r){return dt(r)&&r%2!==0},i5=function(r){return dt(r)&&r>0};const a5=function(r,e){if(mt(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=Pr(e)?e(a):a[e];o>n&&(t=a,n=o)}return t}},o5=function(r,e){if(mt(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],o=Pr(e)?e(a):a[e];o<n&&(t=a,n=o)}return t}};var yv=function(r,e){return(r%e+e)%e},s5=180/Math.PI,u5=function(r){return s5*r};const f5=parseInt;var l5=Math.PI/180,mv=function(r){return l5*r};const Px=function(r,e){return r.hasOwnProperty(e)};var lm=Object.values?function(r){return Object.values(r)}:function(r){var e=[];return _e(r,function(t,n){Pr(r)&&n==="prototype"||e.push(t)}),e};const c5=function(r,e){return Md(lm(r),e)},ef=function(r){return ht(r)?"":r.toString()};var h5=function(r){return ef(r).toLowerCase()},d5=function(r){var e=ef(r);return e.charAt(0).toLowerCase()+e.substring(1)};function v5(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 p5=function(r){return ef(r).toUpperCase()},zu=function(r){var e=ef(r);return e.charAt(0).toUpperCase()+e.substring(1)},g5={}.toString,_A=function(r){return g5.call(r).replace(/^\[object /,"").replace(/]$/,"")},y5=function(r){return Fi(r,"Arguments")},Zl=function(r){return Fi(r,"Boolean")},cm=function(r){return Fi(r,"Date")},m5=function(r){return Fi(r,"Error")};function b5(r){return dt(r)&&isFinite(r)}var x5=function(r){return r===null},w5=Object.prototype,SA=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||w5;return r===t},E5=function(r){return Fi(r,"RegExp")},_5=function(r){return r===void 0},S5=function(r){return r instanceof Element||r instanceof HTMLDocument};function MA(r){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)};return e(r)}function CA(r){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(r)}function Jp(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function bt(r,e,t,n){return e&&Jp(r,e),t&&Jp(r,t),n&&Jp(r,n),r}var M5=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];Pr(i)&&(i=i.prototype),bt(t.prototype,i)}},Jt=function(r){if(typeof r!="object"||r===null)return r;var e;if(mt(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=Jt(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=Jt(r[i]):e[i]=r[i]}return e};function Kl(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 AA=function(r,e){if(!Pr(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 C5=5;function TA(r,e,t,n){t=t||0,n=n||C5;for(var i in e)if(e.hasOwnProperty(i)){var a=e[i];a!==null&&bn(a)?(bn(r[i])||(r[i]={}),t<n?TA(r[i],a,t+1,n):r[i]=e[i]):mt(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var Tr=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)TA(r,e[n]);return r},A5=function(r,e,t,n){Pr(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=bt(a,r.prototype),r.superclass=i(e.prototype,e),bt(a,t),bt(r,n),r},hm=function(r,e){if(!zn(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},T5=Object.prototype.hasOwnProperty;function IA(r){if(ht(r))return!0;if(zn(r))return!r.length;var e=_A(r);if(e==="Map"||e==="Set")return!r.size;if(SA(r))return!Object.keys(r).length;for(var t in r)if(T5.call(r,t))return!1;return!0}var So=function(r,e){if(r===e)return!0;if(!r||!e||Fe(r)||Fe(e))return!1;if(zn(r)||zn(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=So(r[n],e[n]),!!t);n++);return t}if(Cd(r)||Cd(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=So(r[i[n]],e[i[n]]),!!t);n++);return t}return!1};const I5=function(r,e,t){return Pr(t)?!!t(r,e):So(r,e)};var As=function(r,e){if(!zn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];t.push(e(i,n))}return t},k5=function(r){return r};const L5=function(r,e){e===void 0&&(e=k5);var t={};return wn(r)&&!ht(r)&&Object.keys(r).forEach(function(n){t[n]=e(r[n],n)}),t},Pa=function(r,e,t){for(var n=0,i=Fe(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r},N5=function(r,e,t){var n=r,i=Fe(e)?e.split("."):e;return i.forEach(function(a,o){o<i.length-1?(wn(n[a])||(n[a]=dt(i[o+1])?[]:{}),n=n[a]):n[a]=t}),r};var O5=Object.prototype.hasOwnProperty;const D5=function(r,e){if(r===null||!bn(r))return{};var t={};return _e(e,function(n){O5.call(r,n)&&(t[n]=r[n])}),t},P5=function(r,e){return xA(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})},Tl=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},kA=function(r){return zn(r)?Array.prototype.slice.call(r):[]};var Xc={};const ha=function(r){return r=r||"g",Xc[r]?Xc[r]+=1:Xc[r]=1,r+Xc[r]},nl=function(){},R5=function(r){return r};function bv(r){return ht(r)?0:zn(r)?r.length:Object.keys(r).length}var Yc;const il=AA(function(r,e){e===void 0&&(e={});var t=e.fontSize,n=e.fontFamily,i=e.fontWeight,a=e.fontStyle,o=e.fontVariant;return Yc||(Yc=document.createElement("canvas").getContext("2d")),Yc.font=[a,o,i,t+"px",n].join(" "),Yc.measureText(Fe(r)?r:"").width},function(r,e){return e===void 0&&(e={}),pv([r],lm(e)).join("")}),B5=function(r,e,t,n){n===void 0&&(n="...");var i=16,a=il(n,t),o=Fe(r)?r:ef(r),s=e,u=[],f,l;if(il(r,t)<=e)return r;for(;f=o.substr(0,i),l=il(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=il(f,t),!(l+a>s);)if(u.push(f),s-=l,o=o.substr(1),!o)return u.join("");return""+u.join("")+n};var F5=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 G5=Object.freeze(Object.defineProperty({__proto__:null,Cache:F5,assign:bt,augment:M5,clamp:K3,clearAnimationFrame:CA,clone:Jt,contains:Md,debounce:Kl,deepMix:Tr,difference:T3,each:_e,endsWith:$3,every:X3,extend:A5,filter:gv,find:k3,findIndex:L3,firstValue:N3,fixedBase:rd,flatten:O3,flattenDeep:gA,forIn:_e,get:Pa,getEllipsisText:B5,getRange:yA,getType:_A,getWrapBehavior:V3,group:q3,groupBy:Ad,groupToMap:wA,has:Px,hasKey:Px,hasValue:c5,head:ua,identity:R5,includes:Md,indexOf:hm,isArguments:y5,isArray:mt,isArrayLike:zn,isBoolean:Zl,isDate:cm,isDecimal:Q3,isElement:S5,isEmpty:IA,isEqual:So,isEqualWith:I5,isError:m5,isEven:J3,isFinite:b5,isFunction:Pr,isInteger:e5,isMatch:pA,isNegative:t5,isNil:ht,isNull:x5,isNumber:dt,isNumberEqual:EA,isObject:wn,isObjectLike:Cd,isOdd:n5,isPlainObject:bn,isPositive:i5,isPrototype:SA,isRegExp:E5,isString:Fe,isType:Fi,isUndefined:_5,keys:vA,last:ci,lowerCase:h5,lowerFirst:d5,map:As,mapValues:L5,max:la,maxBy:a5,measureTextWidth:il,memoize:AA,min:ca,minBy:o5,mix:bt,mod:yv,noop:nl,number2color:H3,omit:P5,parseRadius:Z3,pick:D5,pull:R3,pullAt:bA,reduce:xA,remove:F3,requestAnimationFrame:MA,set:N5,size:bv,some:Y3,sortBy:G3,startsWith:U3,substitute:v5,throttle:Tl,toArray:kA,toDegree:u5,toInteger:f5,toRadian:mv,toString:ef,union:z3,uniq:Al,uniqueId:ha,upperCase:p5,upperFirst:zu,values:lm,valuesOfKey:j3,wrapBehavior:gs},Symbol.toStringTag,{value:"Module"})),z5={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),_e(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),_e(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 dm=function(){function r(){}return r.registerBehavior=function(e,t){if(!t)throw new Error("please specify handler for this behavior: ".concat(e));var n=Jt(z5);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&&(_e(u,function(l,c){f[c]=gs(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}(),j5="*",LA=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[j5]||[],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}(),Mt=1e-6,or=typeof Float32Array<"u"?Float32Array:Array,Pi=Math.random;function U5(r){or=r}var $5=Math.PI/180;function X5(r){return r*$5}function Y5(r,e){return Math.abs(r-e)<=Mt*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 W5=Object.freeze(Object.defineProperty({__proto__:null,get ARRAY_TYPE(){return or},EPSILON:Mt,RANDOM:Pi,equals:Y5,setMatrixArrayType:U5,toRadian:X5},Symbol.toStringTag,{value:"Module"}));function q5(){var r=new or(4);return or!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}function V5(r){var e=new or(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function H5(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function Z5(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}function K5(r,e,t,n){var i=new or(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function Q5(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function J5(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 eB(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 tB(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}function rB(r){return r[0]*r[3]-r[2]*r[1]}function NA(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 nB(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 iB(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 aB(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 oB(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}function sB(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function uB(r){return Math.hypot(r[0],r[1],r[2],r[3])}function fB(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 lB(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 OA(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 cB(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function hB(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)<=Mt*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-s)<=Mt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=Mt*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=Mt*Math.max(1,Math.abs(a),Math.abs(f))}function dB(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 vB(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 pB=NA,gB=OA;const yB=Object.freeze(Object.defineProperty({__proto__:null,LDU:fB,add:lB,adjoint:tB,clone:V5,copy:H5,create:q5,determinant:rB,equals:hB,exactEquals:cB,frob:uB,fromRotation:aB,fromScaling:oB,fromValues:K5,identity:Z5,invert:eB,mul:pB,multiply:NA,multiplyScalar:dB,multiplyScalarAndAdd:vB,rotate:nB,scale:iB,set:Q5,str:sB,sub:gB,subtract:OA,transpose:J5},Symbol.toStringTag,{value:"Module"}));function mB(){var r=new or(6);return or!=Float32Array&&(r[1]=0,r[2]=0,r[4]=0,r[5]=0),r[0]=1,r[3]=1,r}function bB(r){var e=new or(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 xB(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 wB(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function EB(r,e,t,n,i,a){var o=new or(6);return o[0]=r,o[1]=e,o[2]=t,o[3]=n,o[4]=i,o[5]=a,o}function _B(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 SB(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 MB(r){return r[0]*r[3]-r[1]*r[2]}function DA(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 CB(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 AB(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 TB(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 IB(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 kB(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 LB(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 NB(r){return"mat2d("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+")"}function OB(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],1)}function DB(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 PA(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 PB(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 RB(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 BB(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 FB(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)<=Mt*Math.max(1,Math.abs(t),Math.abs(u))&&Math.abs(n-f)<=Mt*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=Mt*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-c)<=Mt*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-h)<=Mt*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=Mt*Math.max(1,Math.abs(s),Math.abs(d))}var GB=DA,zB=PA;const jB=Object.freeze(Object.defineProperty({__proto__:null,add:DB,clone:bB,copy:xB,create:mB,determinant:MB,equals:FB,exactEquals:BB,frob:OB,fromRotation:IB,fromScaling:kB,fromTranslation:LB,fromValues:EB,identity:wB,invert:SB,mul:GB,multiply:DA,multiplyScalar:PB,multiplyScalarAndAdd:RB,rotate:CB,scale:AB,set:_B,str:NB,sub:zB,subtract:PA,translate:TB},Symbol.toStringTag,{value:"Module"}));function RA(){var r=new or(9);return or!=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 UB(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 $B(r){var e=new or(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 XB(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 YB(r,e,t,n,i,a,o,s,u){var f=new or(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 WB(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 qB(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 VB(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 vm(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 HB(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 ZB(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 pa(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],x=t[7],b=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+x*o+b*f,r[7]=m*i+x*s+b*l,r[8]=m*a+x*u+b*c,r}function KB(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 QB(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 JB(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 pm(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 gm(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 ym(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 eF(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 tF(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 rF(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,x=t*u-i*o,b=t*f-a*o,w=n*u-i*s,E=n*f-a*s,S=i*f-a*u,_=l*p-c*v,C=l*g-h*v,M=l*y-d*v,A=c*g-h*p,T=c*y-d*p,I=h*y-d*g,L=m*I-x*T+b*A+w*M-E*C+S*_;return L?(L=1/L,r[0]=(s*I-u*T+f*A)*L,r[1]=(u*M-o*I-f*C)*L,r[2]=(o*T-s*M+f*_)*L,r[3]=(i*T-n*I-a*A)*L,r[4]=(t*I-i*M+a*C)*L,r[5]=(n*M-t*T-a*_)*L,r[6]=(p*S-g*E+y*w)*L,r[7]=(g*b-v*S-y*x)*L,r[8]=(v*E-p*b+y*m)*L,r):null}function nF(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 iF(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function aF(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function oF(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 BA(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 sF(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 uF(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 fF(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 lF(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],x=e[8];return Math.abs(t-c)<=Mt*Math.max(1,Math.abs(t),Math.abs(c))&&Math.abs(n-h)<=Mt*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-d)<=Mt*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-v)<=Mt*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(o-p)<=Mt*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-g)<=Mt*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(u-y)<=Mt*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(f-m)<=Mt*Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(l-x)<=Mt*Math.max(1,Math.abs(l),Math.abs(x))}var cF=pa,hF=BA;const FA=Object.freeze(Object.defineProperty({__proto__:null,add:oF,adjoint:HB,clone:$B,copy:XB,create:RA,determinant:ZB,equals:lF,exactEquals:fF,frob:aF,fromMat2d:eF,fromMat4:UB,fromQuat:tF,fromRotation:gm,fromScaling:ym,fromTranslation:pm,fromValues:YB,identity:qB,invert:vm,mul:cF,multiply:pa,multiplyScalar:sF,multiplyScalarAndAdd:uF,normalFromMat4:rF,projection:nF,rotate:QB,scale:JB,set:WB,str:iF,sub:hF,subtract:BA,translate:KB,transpose:VB},Symbol.toStringTag,{value:"Module"}));function dF(){var r=new or(16);return or!=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 vF(r){var e=new or(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 pF(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 gF(r,e,t,n,i,a,o,s,u,f,l,c,h,d,v,p){var g=new or(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 yF(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 GA(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 mF(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 bF(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,x=t*u-i*o,b=t*f-a*o,w=n*u-i*s,E=n*f-a*s,S=i*f-a*u,_=l*p-c*v,C=l*g-h*v,M=l*y-d*v,A=c*g-h*p,T=c*y-d*p,I=h*y-d*g,L=m*I-x*T+b*A+w*M-E*C+S*_;return L?(L=1/L,r[0]=(s*I-u*T+f*A)*L,r[1]=(i*T-n*I-a*A)*L,r[2]=(p*S-g*E+y*w)*L,r[3]=(h*E-c*S-d*w)*L,r[4]=(u*M-o*I-f*C)*L,r[5]=(t*I-i*M+a*C)*L,r[6]=(g*b-v*S-y*x)*L,r[7]=(l*S-h*b+d*x)*L,r[8]=(o*T-s*M+f*_)*L,r[9]=(n*M-t*T-a*_)*L,r[10]=(v*E-p*b+y*m)*L,r[11]=(c*b-l*E-d*m)*L,r[12]=(s*C-o*A-u*_)*L,r[13]=(t*A-n*C+i*_)*L,r[14]=(p*x-v*w-g*m)*L,r[15]=(l*w-c*x+h*m)*L,r):null}function xF(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 wF(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,x=e*u-i*a,b=t*s-n*o,w=t*u-i*o,E=n*u-i*s,S=f*v-l*d,_=f*p-c*d,C=f*g-h*d,M=l*p-c*v,A=l*g-h*v,T=c*g-h*p;return y*T-m*A+x*M+b*C-w*_+E*S}function zA(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],x=t[0],b=t[1],w=t[2],E=t[3];return r[0]=x*n+b*s+w*c+E*p,r[1]=x*i+b*u+w*h+E*g,r[2]=x*a+b*f+w*d+E*y,r[3]=x*o+b*l+w*v+E*m,x=t[4],b=t[5],w=t[6],E=t[7],r[4]=x*n+b*s+w*c+E*p,r[5]=x*i+b*u+w*h+E*g,r[6]=x*a+b*f+w*d+E*y,r[7]=x*o+b*l+w*v+E*m,x=t[8],b=t[9],w=t[10],E=t[11],r[8]=x*n+b*s+w*c+E*p,r[9]=x*i+b*u+w*h+E*g,r[10]=x*a+b*f+w*d+E*y,r[11]=x*o+b*l+w*v+E*m,x=t[12],b=t[13],w=t[14],E=t[15],r[12]=x*n+b*s+w*c+E*p,r[13]=x*i+b*u+w*h+E*g,r[14]=x*a+b*f+w*d+E*y,r[15]=x*o+b*l+w*v+E*m,r}function EF(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 _F(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 SF(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,x,b,w,E,S,_,C,M,A,T,I,L,N;return s<Mt?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],x=e[8],b=e[9],w=e[10],E=e[11],S=i*i*l+f,_=a*i*l+o*u,C=o*i*l-a*u,M=i*a*l-o*u,A=a*a*l+f,T=o*a*l+i*u,I=i*o*l+a*u,L=a*o*l-i*u,N=o*o*l+f,r[0]=c*S+p*_+x*C,r[1]=h*S+g*_+b*C,r[2]=d*S+y*_+w*C,r[3]=v*S+m*_+E*C,r[4]=c*M+p*A+x*T,r[5]=h*M+g*A+b*T,r[6]=d*M+y*A+w*T,r[7]=v*M+m*A+E*T,r[8]=c*I+p*L+x*N,r[9]=h*I+g*L+b*N,r[10]=d*I+y*L+w*N,r[11]=v*I+m*L+E*N,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function MF(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 CF(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 AF(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 TF(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 IF(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 kF(r,e,t){var n=t[0],i=t[1],a=t[2],o=Math.hypot(n,i,a),s,u,f;return o<Mt?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 LF(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 NF(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 OF(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 jA(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 DF(r,e){var t=new or(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),jA(r,e,t),r}function UA(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function $A(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 XA(r,e){var t=new or(3);$A(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 PF(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,x=s*l,b=n[0],w=n[1],E=n[2];return r[0]=(1-(v+g))*b,r[1]=(h+x)*b,r[2]=(d-m)*b,r[3]=0,r[4]=(h-x)*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 RF(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,x=u*l,b=u*c,w=n[0],E=n[1],S=n[2],_=i[0],C=i[1],M=i[2],A=(1-(p+y))*w,T=(d+b)*w,I=(v-x)*w,L=(d-b)*E,N=(1-(h+y))*E,O=(g+m)*E,B=(v+x)*S,W=(g-m)*S,D=(1-(h+p))*S;return r[0]=A,r[1]=T,r[2]=I,r[3]=0,r[4]=L,r[5]=N,r[6]=O,r[7]=0,r[8]=B,r[9]=W,r[10]=D,r[11]=0,r[12]=t[0]+_-(A*_+L*C+B*M),r[13]=t[1]+C-(T*_+N*C+W*M),r[14]=t[2]+M-(I*_+O*C+D*M),r[15]=1,r}function BF(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 FF(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 YA(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 GF=YA;function zF(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 jF(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 WA(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 UF=WA;function $F(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 XF(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],x=n[2],b=t[0],w=t[1],E=t[2];return Math.abs(v-b)<Mt&&Math.abs(p-w)<Mt&&Math.abs(g-E)<Mt?GA(r):(l=v-b,c=p-w,h=g-E,d=1/Math.hypot(l,c,h),l*=d,c*=d,h*=d,i=m*h-x*c,a=x*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 YF(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 WF(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 qF(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 VF(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 qA(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 HF(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 ZF(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 KF(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 QF(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],x=e[1],b=e[2],w=e[3],E=e[4],S=e[5],_=e[6],C=e[7],M=e[8],A=e[9],T=e[10],I=e[11],L=e[12],N=e[13],O=e[14],B=e[15];return Math.abs(t-m)<=Mt*Math.max(1,Math.abs(t),Math.abs(m))&&Math.abs(n-x)<=Mt*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-b)<=Mt*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(a-w)<=Mt*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(o-E)<=Mt*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(s-S)<=Mt*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(u-_)<=Mt*Math.max(1,Math.abs(u),Math.abs(_))&&Math.abs(f-C)<=Mt*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(l-M)<=Mt*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-A)<=Mt*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(h-T)<=Mt*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(d-I)<=Mt*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(v-L)<=Mt*Math.max(1,Math.abs(v),Math.abs(L))&&Math.abs(p-N)<=Mt*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(g-O)<=Mt*Math.max(1,Math.abs(g),Math.abs(O))&&Math.abs(y-B)<=Mt*Math.max(1,Math.abs(y),Math.abs(B))}var JF=zA,e4=qA;const t4=Object.freeze(Object.defineProperty({__proto__:null,add:VF,adjoint:xF,clone:vF,copy:pF,create:dF,determinant:wF,equals:QF,exactEquals:KF,frob:qF,fromQuat:BF,fromQuat2:DF,fromRotation:kF,fromRotationTranslation:jA,fromRotationTranslationScale:PF,fromRotationTranslationScaleOrigin:RF,fromScaling:IF,fromTranslation:TF,fromValues:gF,fromXRotation:LF,fromYRotation:NF,fromZRotation:OF,frustum:FF,getRotation:XA,getScaling:$A,getTranslation:UA,identity:GA,invert:bF,lookAt:XF,mul:JF,multiply:zA,multiplyScalar:HF,multiplyScalarAndAdd:ZF,ortho:UF,orthoNO:WA,orthoZO:$F,perspective:GF,perspectiveFromFieldOfView:jF,perspectiveNO:YA,perspectiveZO:zF,rotate:SF,rotateX:MF,rotateY:CF,rotateZ:AF,scale:_F,set:yF,str:WF,sub:e4,subtract:qA,targetTo:YF,translate:EF,transpose:mF},Symbol.toStringTag,{value:"Module"}));function mm(){var r=new or(3);return or!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function r4(r){var e=new or(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function VA(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}function B0(r,e,t){var n=new or(3);return n[0]=r,n[1]=e,n[2]=t,n}function n4(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function i4(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function a4(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function HA(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function ZA(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function KA(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function o4(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function s4(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function u4(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 f4(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 l4(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}function c4(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function h4(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 QA(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 JA(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 eT(r){var e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function d4(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function v4(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function tT(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 bm(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function nd(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 p4(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 g4(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 y4(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 m4(r,e){e=e||1;var t=Pi()*2*Math.PI,n=Pi()*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 b4(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 xv(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 x4(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 w4(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 E4(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 _4(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 S4(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&&bm(r,e)/l;return Math.acos(Math.min(Math.max(c,-1),1))}function M4(r){return r[0]=0,r[1]=0,r[2]=0,r}function C4(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function A4(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function T4(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)<=Mt*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-o)<=Mt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=Mt*Math.max(1,Math.abs(i),Math.abs(s))}var I4=HA,k4=ZA,L4=KA,N4=QA,O4=JA,rT=VA,D4=eT,P4=function(){var r=mm();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 R4=Object.freeze(Object.defineProperty({__proto__:null,add:a4,angle:S4,bezier:y4,ceil:o4,clone:r4,copy:n4,create:mm,cross:nd,dist:N4,distance:QA,div:L4,divide:KA,dot:bm,equals:T4,exactEquals:A4,floor:s4,forEach:P4,fromValues:B0,hermite:g4,inverse:v4,len:rT,length:VA,lerp:p4,max:f4,min:u4,mul:k4,multiply:ZA,negate:d4,normalize:tT,random:m4,rotateX:w4,rotateY:E4,rotateZ:_4,round:l4,scale:c4,scaleAndAdd:h4,set:i4,sqrDist:O4,sqrLen:D4,squaredDistance:JA,squaredLength:eT,str:C4,sub:I4,subtract:HA,transformMat3:xv,transformMat4:b4,transformQuat:x4,zero:M4},Symbol.toStringTag,{value:"Module"}));function nT(){var r=new or(4);return or!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function iT(r){var e=new or(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function aT(r,e,t,n){var i=new or(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function oT(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function sT(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function uT(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 fT(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 lT(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 cT(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 B4(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 F4(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 G4(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 z4(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 j4(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 hT(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 U4(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 dT(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 vT(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 xm(r){var e=r[0],t=r[1],n=r[2],i=r[3];return Math.hypot(e,t,n,i)}function wm(r){var e=r[0],t=r[1],n=r[2],i=r[3];return e*e+t*t+n*n+i*i}function $4(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}function X4(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 pT(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 gT(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function Y4(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 yT(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 W4(r,e){e=e||1;var t,n,i,a,o,s;do t=Pi()*2-1,n=Pi()*2-1,o=t*t+n*n;while(o>=1);do i=Pi()*2-1,a=Pi()*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 q4(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 V4(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 H4(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function Z4(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function mT(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function bT(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)<=Mt*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-s)<=Mt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=Mt*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=Mt*Math.max(1,Math.abs(a),Math.abs(f))}var K4=fT,Q4=lT,J4=cT,eG=dT,tG=vT,rG=xm,nG=wm,iG=function(){var r=nT();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 aG=Object.freeze(Object.defineProperty({__proto__:null,add:uT,ceil:B4,clone:iT,copy:oT,create:nT,cross:Y4,dist:eG,distance:dT,div:J4,divide:cT,dot:gT,equals:bT,exactEquals:mT,floor:F4,forEach:iG,fromValues:aT,inverse:X4,len:rG,length:xm,lerp:yT,max:z4,min:G4,mul:Q4,multiply:lT,negate:$4,normalize:pT,random:W4,round:j4,scale:hT,scaleAndAdd:U4,set:sT,sqrDist:tG,sqrLen:nG,squaredDistance:vT,squaredLength:wm,str:Z4,sub:K4,subtract:fT,transformMat4:q4,transformQuat:V4,zero:H4},Symbol.toStringTag,{value:"Module"}));function Td(){var r=new or(4);return or!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function oG(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function xT(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 sG(r,e){var t=Math.acos(e[3])*2,n=Math.sin(t/2);return n>Mt?(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 uG(r,e){var t=_m(r,e);return Math.acos(2*t*t-1)}function wT(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 ET(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 _T(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 ST(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 fG(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 MT(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 CT(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 lG(r,e,t){return CT(r,e),TT(r,r,t),MT(r,r),r}function id(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>Mt?(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 cG(r){var e=Pi(),t=Pi(),n=Pi(),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 hG(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 dG(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function AT(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 vG(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 pG(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var gG=iT,yG=aT,Em=oT,mG=sT,bG=uT,xG=wT,TT=hT,_m=gT,wG=yT,Sm=xm,EG=Sm,Mm=wm,_G=Mm,Cm=pT,SG=mT,MG=bT,CG=function(){var r=mm(),e=B0(1,0,0),t=B0(0,1,0);return function(n,i,a){var o=bm(i,a);return o<-.999999?(nd(r,e,i),rT(r)<1e-6&&nd(r,t,i),tT(r,r),xT(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(nd(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,Cm(n,n))}}(),AG=function(){var r=Td(),e=Td();return function(t,n,i,a,o,s){return id(r,n,o,s),id(e,i,a,s),id(t,r,e,2*s*(1-s)),t}}(),TG=function(){var r=RA();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],Cm(e,AT(e,r))}}();const IG=Object.freeze(Object.defineProperty({__proto__:null,add:bG,calculateW:fG,clone:gG,conjugate:dG,copy:Em,create:Td,dot:_m,equals:MG,exactEquals:SG,exp:MT,fromEuler:vG,fromMat3:AT,fromValues:yG,getAngle:uG,getAxisAngle:sG,identity:oG,invert:hG,len:EG,length:Sm,lerp:wG,ln:CT,mul:xG,multiply:wT,normalize:Cm,pow:lG,random:cG,rotateX:ET,rotateY:_T,rotateZ:ST,rotationTo:CG,scale:TT,set:mG,setAxes:TG,setAxisAngle:xT,slerp:id,sqlerp:AG,sqrLen:_G,squaredLength:Mm,str:pG},Symbol.toStringTag,{value:"Module"}));function kG(){var r=new or(8);return or!=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 LG(r){var e=new or(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 NG(r,e,t,n,i,a,o,s){var u=new or(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 OG(r,e,t,n,i,a,o){var s=new or(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 IT(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 DG(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 PG(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 RG(r,e){var t=Td();XA(t,e);var n=new or(3);return UA(n,e),IT(r,t,n),r}function kT(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 BG(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 FG(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 GG=Em;function zG(r,e){return r[0]=e[4],r[1]=e[5],r[2]=e[6],r[3]=e[7],r}var jG=Em;function UG(r,e){return r[4]=e[0],r[5]=e[1],r[6]=e[2],r[7]=e[3],r}function $G(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 XG(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 YG(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 ET(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 WG(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 _T(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 qG(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 ST(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 VG(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 HG(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 ZG(r,e,t,n){if(Math.abs(n)<Mt)return kT(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 KG(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 LT(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 QG=LT;function JG(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 NT=_m;function e6(r,e,t,n){var i=1-n;return NT(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 t6(r,e){var t=wv(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 r6(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 OT=Sm,n6=OT,wv=Mm,i6=wv;function a6(r,e){var t=wv(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 o6(r){return"quat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+")"}function s6(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 u6(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)<=Mt*Math.max(1,Math.abs(t),Math.abs(l))&&Math.abs(n-c)<=Mt*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=Mt*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-d)<=Mt*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-v)<=Mt*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(s-p)<=Mt*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-g)<=Mt*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(f-y)<=Mt*Math.max(1,Math.abs(f),Math.abs(y))}const f6=Object.freeze(Object.defineProperty({__proto__:null,add:KG,clone:LG,conjugate:r6,copy:kT,create:kG,dot:NT,equals:u6,exactEquals:s6,fromMat4:RG,fromRotation:PG,fromRotationTranslation:IT,fromRotationTranslationValues:OG,fromTranslation:DG,fromValues:NG,getDual:zG,getReal:GG,getTranslation:$G,identity:BG,invert:t6,len:n6,length:OT,lerp:e6,mul:QG,multiply:LT,normalize:a6,rotateAroundAxis:ZG,rotateByQuatAppend:VG,rotateByQuatPrepend:HG,rotateX:YG,rotateY:WG,rotateZ:qG,scale:JG,set:FG,setDual:UG,setReal:jG,sqrLen:i6,squaredLength:wv,str:o6,translate:XG},Symbol.toStringTag,{value:"Module"}));function DT(){var r=new or(2);return or!=Float32Array&&(r[0]=0,r[1]=0),r}function l6(r){var e=new or(2);return e[0]=r[0],e[1]=r[1],e}function c6(r,e){var t=new or(2);return t[0]=r,t[1]=e,t}function h6(r,e){return r[0]=e[0],r[1]=e[1],r}function d6(r,e,t){return r[0]=e,r[1]=t,r}function mn(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function PT(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function RT(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}function BT(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}function v6(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}function p6(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}function co(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function ho(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function g6(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}function An(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function y6(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r}function Id(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.hypot(t,n)}function FT(r,e){var t=e[0]-r[0],n=e[1]-r[1];return t*t+n*n}function GT(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function zT(r){var e=r[0],t=r[1];return e*e+t*t}function m6(r,e){return r[0]=-e[0],r[1]=-e[1],r}function b6(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}function _o(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 Am(r,e){return r[0]*e[0]+r[1]*e[1]}function x6(r,e,t){var n=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=n,r}function w6(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 E6(r,e){e=e||1;var t=Pi()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}function _6(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 S6(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 M6(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 C6(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 A6(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 jT(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 T6(r){return r[0]=0,r[1]=0,r}function I6(r){return"vec2("+r[0]+", "+r[1]+")"}function Tm(r,e){return r[0]===e[0]&&r[1]===e[1]}function k6(r,e){var t=r[0],n=r[1],i=e[0],a=e[1];return Math.abs(t-i)<=Mt*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(n-a)<=Mt*Math.max(1,Math.abs(n),Math.abs(a))}var L6=GT,ad=PT,N6=RT,O6=BT,D6=Id,P6=FT,R6=zT,B6=function(){var r=DT();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 F6=Object.freeze(Object.defineProperty({__proto__:null,add:mn,angle:jT,ceil:v6,clone:l6,copy:h6,create:DT,cross:x6,dist:D6,distance:Id,div:O6,divide:BT,dot:Am,equals:k6,exactEquals:Tm,floor:p6,forEach:B6,fromValues:c6,inverse:b6,len:L6,length:GT,lerp:w6,max:ho,min:co,mul:N6,multiply:RT,negate:m6,normalize:_o,random:E6,rotate:A6,round:g6,scale:An,scaleAndAdd:y6,set:d6,sqrDist:P6,sqrLen:R6,squaredDistance:FT,squaredLength:zT,str:I6,sub:ad,subtract:PT,transformMat2:_6,transformMat2d:S6,transformMat3:M6,transformMat4:C6,zero:T6},Symbol.toStringTag,{value:"Module"})),G6=Object.freeze(Object.defineProperty({__proto__:null,glMatrix:W5,mat2:yB,mat2d:jB,mat3:FA,mat4:t4,quat:IG,quat2:f6,vec2:F6,vec3:R4,vec4:aG},Symbol.toStringTag,{value:"Module"}));function z6(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return pm(n,t),pa(r,n,e)}function j6(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return gm(n,t),pa(r,n,e)}function U6(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return ym(n,t),pa(r,n,e)}function $6(r,e,t){return pa(r,t,e)}function vi(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":z6(t,t,[a[1],a[2]]);break;case"s":U6(t,t,[a[1],a[2]]);break;case"r":j6(t,t,a[1]);break;case"m":$6(t,t,a[1]);break}}return t}var Ts=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},X6=function(e,t){return e===t},Rx=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}(),UT=function(){function r(e){e===void 0&&(e=X6),this.head=null,this.tail=null,this.compare=e}return r.prototype.prepend=function(e){var t=new Rx(e,this.head);return this.head=t,this.tail||(this.tail=t),this},r.prototype.append=function(e){var t=new Rx(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}(),Y6=function(){function r(){this.linkedList=new UT}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}(),Kn=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)},W6=function(e,t){return t.filter(function(n){return n.source===e})},od=function(e,t){return t.filter(function(n){return n.source===e||n.target===e})},$T=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 q6(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 XT=function(e,t,n,i){i===void 0&&(i=!0);var a=q6(n),o=new Y6,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}),Kn(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()},V6=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=Kn(v.id,a),g=function(x){var b=p[x];if(!s[b]){var w=n.filter(function(E){return E.id===b});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},YT=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=Kn(y.id,a,"target").filter(function(S){return n.map(function(_){return _.id}).indexOf(S)>-1}),x=function(_){var C=m[_];if(!u[C]&&u[C]!==0){var M=n.filter(function(A){return A.id===C});M.length>0&&g(M[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},b=0;b<m.length;b++)x(b);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 Im(r,e){return e?YT(r):V6(r)}var Ua=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},WT=function(e,t){var n=Ua(e);return n[t]?Ua(e)[t].inDegree:0},qT=function(e,t){var n=Ua(e);return n[t]?Ua(e)[t].outDegree:0};function H6(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 VT(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;Kn(e,o,i?"target":void 0).forEach(function(s){n.allowTraversal({previous:t,current:e,next:s})&&VT(r,s,e,n,i)}),n.leave({current:e,previous:t})}function km(r,e,t,n){n===void 0&&(n=!0),VT(r,e,"",H6(t),n)}var Lm=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];km(e,l,f)}return t},Nm=function(e,t,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=Im(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=Kn(y,e.edges),x=function(E){var S,_=m[E],C=e.nodes.find(function(N){return N.id===_});if(_===y)o.push((S={},S[_]=g,S));else if(!(_ in p))v[_]=g,d.push(C),p[_]=new Set([g]);else if(!p[y].has(C)){for(var M=!0,A=[C,g],T=v[y];p[_].size&&!p[_].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),t&&n?(M=!1,A.findIndex(function(N){return t.indexOf(N.id)>-1})>-1&&(M=!0)):t&&!n&&A.findIndex(function(N){return t.indexOf(N.id)>-1})>-1&&(M=!1),M){for(var I={},L=1;L<A.length;L+=1)I[A[L-1].id]=A[L];A.length&&(I[A[A.length-1].id]=A[0]),o.push(I)}p[_].add(g)}},b=0;b<m.length;b+=1)x(b)}return o},Om=function(e,t,n){n===void 0&&(n=!0);for(var i=[],a=new Set,o=[],s=[],u={},f={},l=function(T){for(var I=[T];I.length>0;){var L=I.pop();a.has(L)&&(a.delete(L),o[L.id].forEach(function(N){I.push(N)}),o[L.id].clear())}},c=function A(T,I,L){var N=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return N;i.push(T),a.add(T);for(var O=L[T.id],B=0;B<O.length;B+=1){var W=u[O[B]];if(W===I){for(var D={},P=1;P<i.length;P+=1)D[i[P-1].id]=i[P];i.length&&(D[i[i.length-1].id]=i[0]),s.push(D),N=!0}else a.has(W)||A(W,I,L)&&(N=!0)}if(N)l(T);else for(var B=0;B<O.length;B+=1){var W=u[O[B]];o[W.id].has(T)||o[W.id].add(T)}return i.pop(),N},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 I=t[T];f[d[T].id]=f[I],f[I]=0,u[0]=d.find(function(L){return L.id===I}),u[f[d[T].id]]=d[T]},v=0;v<t.length;v++)y(v);for(var m=function(T){for(var I,L,N=1/0,O=0;O<T.length;O+=1)for(var B=T[O],W=0;W<B.length;W++){var D=f[B[W].id];D<N&&(N=D,L=O)}for(var P=T[L],R=[],O=0;O<P.length;O+=1){var X=P[O];R[X.id]=[];for(var Y=0,ee=Kn(X.id,e.edges,"target").filter(function(K){return P.map(function(se){return se.id}).indexOf(K)>-1});Y<ee.length;Y++){var U=ee[Y];U===X.id&&!(n===!1&&t.indexOf(X.id)>-1)?s.push((I={},I[X.id]=X,I)):R[X.id].push(f[U])}}return{component:P,adjList:R,minIdx:N}},x=0;x<d.length;){var b=d.filter(function(A){return f[A.id]>=x}),w=YT({nodes:b,edges:e.edges}).filter(function(A){return A.length>1});if(w.length===0)break;var E=m(w),S=E.minIdx,_=E.adjList,C=E.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var M=u[S];if(t&&n&&t.indexOf(M.id)===-1)return s;c(M,M,_),x=S+1}else break}return s},HT=function(e,t,n,i){return i===void 0&&(i=!0),t?Om(e,n,i):Nm(e,n,i)},Z6=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},Il=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,x){var b=m.id;l[b]=1/0,b===t&&(l[b]=0)});for(var h=o.length,d=function(x){var b=Z6(l,o,f),w=b.id;if(f[w]=!0,l[w]===1/0)return"continue";var E=[];n?E=W6(w,u):E=od(w,u),E.forEach(function(S){var _=S.target,C=S.source,M=_===w?C:_,A=i&&S[i]?S[i]:1;l[M]>l[b.id]+A?(l[M]=l[b.id]+A,c[M]=[b.id]):l[M]===l[b.id]+A&&c[M].push(b.id)})},v=0;v<h;v++)d();c[t]=[t];var p={};for(var g in l)l[g]!==1/0&&ZT(t,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}};function ZT(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=ZT(r,s,t,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];mt(c)?i.push(Qn(Qn([],c,!0),[e],!1)):i.push([c,e])}}return n[e]=i,n[e]}var KT=function(e,t,n,i,a){var o=Il(e,t,i,a),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}},QT=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?Kn(t,s,"target"):Kn(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?Kn(v,s,"target"):Kn(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},kl=function(e,t){for(var n=Ts(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},JT=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(x,b){var w=$T();x.clusterId=w,f[w]={id:w,nodes:[x]},l[x.id]={node:x,idx:b}});var c=Ts(e,t),h={};c.forEach(function(x,b){var w=o[b].id;h[w]={},x.forEach(function(E,S){if(E){var _=o[S].id;h[w][_]=E}})});for(var d=0,v=function(){var b=!1;if(o.forEach(function(w){var E={};Object.keys(h[w.id]).forEach(function(L){var N=h[w.id][L],O=l[L].node,B=O.clusterId;E[B]||(E[B]=0),E[B]+=N});var S=-1/0,_=[];if(Object.keys(E).forEach(function(L){S<E[L]?(S=E[L],_=[L]):S===E[L]&&_.push(L)}),!(_.length===1&&_[0]===w.clusterId)){var C=_.indexOf(w.clusterId);if(C>=0&&_.splice(C,1),_&&_.length){b=!0;var M=f[w.clusterId],A=M.nodes.indexOf(w);M.nodes.splice(A,1);var T=Math.floor(Math.random()*_.length),I=f[_[T]];I.nodes.push(w),w.clusterId=I.id}}}),!b)return"break";d++};d<i;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(x){var b=f[x];(!b.nodes||!b.nodes.length)&&delete f[x]});var g=[],y={};u.forEach(function(x){var b=x.source,w=x.target,E=x[n]||1,S=l[b].node.clusterId,_=l[w].node.clusterId,C="".concat(S,"---").concat(_);if(y[C])y[C].weight+=E,y[C].count++;else{var M={source:S,target:_,weight:E,count:1};y[C]=M,g.push(M)}});var m=[];return Object.keys(f).forEach(function(x){m.push(f[x])}),{clusters:m,clusterEdges:g}},li=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=Jt(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}(),Dm=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},Oi;(function(r){r.EuclideanDistance="euclideanDistance"})(Oi||(Oi={}));var K6=function(e,t,n){var i=[];t!=null&&t.length?i=t:(e.forEach(function(o){i=i.concat(Object.keys(o))}),i=Al(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]=Al(s))}),a},Pm=function(e,t,n){var i=K6(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},Bx=function(e,t,n,i){n===void 0&&(n=Oi.EuclideanDistance);var a=0;switch(n){case Oi.EuclideanDistance:a=new li(e).euclideanDistance(new li(t));break}return a},Fx=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},eg=function(e,t){e===void 0&&(e=[]);for(var n=e.length,i=new li([]),a=0;a<n;a++)i=i.add(new li(t[a]));var o=i.avg(n);o.normalize();for(var s=0,a=0;a<n;a++){var u=new li(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 li(t[a]);e[a].clusterInertial=0;for(var c=0;c<n;c++){if(a===c){l[a][c]=0;continue}var h=new li(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))},Rm=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(D,P){D.properties=D.properties||{},D.originIndex=P});var p=[];c.every(function(D){return D.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(D){return D.nodeType}))),c.forEach(function(D){D.properties.nodeType=p.findIndex(function(P){return P===D.nodeType})}));var g=Dm(c,o);v=Pm(g,s,u)}var y=1,m={},x={};c.forEach(function(D,P){var R=String(y++);D.clusterId=R,m[R]={id:R,nodes:[D]},x[D.id]={node:D,idx:P}});var b=Ts(e,t),w=[],E={},S=0;b.forEach(function(D,P){var R=0,X=c[P].id;E[X]={},D.forEach(function(Y,ee){if(Y){R+=Y;var U=c[ee].id;E[X][U]=Y,S+=Y}}),w.push(R)}),S/=2;for(var _=1/0,C=1/0,M=0,A=[],T={};;){a&&c.every(function(D){return D.hasOwnProperty("properties")})?_=Fx(c,b,w,S)+eg(c,v)*f:_=Fx(c,b,w,S),M===0&&(C=_,A=c,T=m);var I=_>0&&_>C&&_-C<i;if(_>C&&(A=c.map(function(D){return{node:D,clusterId:D.clusterId}}),T=Jt(m),C=_),I||M>100)break;M++,Object.keys(m).forEach(function(D){var P=0;d.forEach(function(R){var X=R.source,Y=R.target,ee=x[X].node.clusterId,U=x[Y].node.clusterId;(ee===D&&U!==D||U===D&&ee!==D)&&(P=P+(R[n]||1))}),m[D].sumTot=P}),c.forEach(function(D,P){var R=m[D.clusterId],X=0,Y,ee=w[P]/(2*S),U=0,Z=R.nodes;Z.forEach(function(Ke){var xt=x[Ke.id].idx;U+=b[P][xt]||0});var K=U-R.sumTot*ee,se=Z.filter(function(Ke){return Ke.id!==D.id});se.forEach(function(Ke,xt){v[Ke.originIndex]});var re=eg(se,v)*f,J=E[D.id];if(Object.keys(J).forEach(function(Ke){var xt=x[Ke].node,kt=xt.clusterId;if(kt!==D.clusterId){var Lt=m[kt],vr=Lt.nodes;if(!(!vr||!vr.length)){var xr=0;vr.forEach(function(Ot){var ut=x[Ot.id].idx;xr+=b[P][ut]||0});var pt=xr-Lt.sumTot*ee,Nt=vr.concat([D]);Nt.forEach(function(Ot,ut){v[Ot.originIndex]});var F=eg(Nt,v)*f,zt=pt-K;a&&(zt=pt+F-(K+re)),zt>X&&(X=zt,Y=Lt)}}}),X>0){Y.nodes.push(D);var me=D.clusterId;D.clusterId=Y.id;var Ae=R.nodes.indexOf(D);R.nodes.splice(Ae,1);var Ye=0,Ve=0;d.forEach(function(Ke){var xt=Ke.source,kt=Ke.target,Lt=x[xt].node.clusterId,vr=x[kt].node.clusterId;(Lt===Y.id&&vr!==Y.id||vr===Y.id&&Lt!==Y.id)&&(Ye=Ye+(Ke[n]||1)),(Lt===me&&vr!==me||vr===me&&Lt!==me)&&(Ve=Ve+(Ke[n]||1))}),Y.sumTot=Ye,R.sumTot=Ve}})}var L={},N=0;Object.keys(T).forEach(function(D){var P=T[D];if(!P.nodes||!P.nodes.length){delete T[D];return}var R=String(N+1);R!==D&&(P.id=R,P.nodes=P.nodes.map(function(X){return{id:X.id,clusterId:R}}),T[R]=P,L[D]=R,delete T[D],N++)}),A.forEach(function(D){var P=D.node,R=D.clusterId;P&&(P.clusterId=R,P.clusterId&&L[P.clusterId]&&(P.clusterId=L[P.clusterId]))});var O=[],B={};d.forEach(function(D){var P=D.source,R=D.target,X=D[n]||1,Y=x[P].node.clusterId,ee=x[R].node.clusterId;if(!(!Y||!ee)){var U="".concat(Y,"---").concat(ee);if(B[U])B[U].weight+=X,B[U].count++;else{var Z={source:Y,target:ee,weight:X,count:1};B[U]=Z,O.push(Z)}}});var W=[];return Object.keys(T).forEach(function(D){W.push(T[D])}),{clusters:W,clusterEdges:O}},eI=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),Rm(e,t,n,i,!0,a,o,s,u)},tI=function(e,t){var n;t===void 0&&(t=1);for(var i=Jt(e),a=i.nodes,o=a===void 0?[]:a,s=i.edges,u=s===void 0?[]:s,f=function(){var h=Ua({nodes:o,edges:u}),d=Object.keys(h);d.sort(function(g,y){var m,x;return((m=h[g])===null||m===void 0?void 0:m.degree)-((x=h[y])===null||x===void 0?void 0:x.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}},Gx=function(e,t,n){var i=[];switch(e){case Oi.EuclideanDistance:i=t[n];break;default:i=[];break}return i},rI=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=Oi.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===Oi.EuclideanDistance&&!u.every(function(R){return R.hasOwnProperty(n)}))return c;var h=[],d=[];if(o===Oi.EuclideanDistance&&(h=Dm(u,n),d=Pm(h,i,a)),!d.length)return c;for(var v=Al(d.map(function(R){return R.join("")})),p=Math.min(t,u.length,v.length),g=0;g<u.length;g++)u[g].originIndex=g;for(var y=[],m=[],x=[],g=0;g<p;g++)if(g===0){var b=Math.floor(Math.random()*u.length);switch(o){case Oi.EuclideanDistance:y[g]=d[b];break;default:y[g]=[];break}m.push(b),x[g]=[u[b]],u[b].clusterId=String(g)}else{for(var w=-1/0,E=0,S=function(Y){if(!m.includes(Y)){for(var ee=0,U=0;U<y.length;U++){var Z=0;switch(o){case Oi.EuclideanDistance:Z=Bx(d[u[Y].originIndex],y[U],o);break}ee+=Z}var K=ee/y.length;K>w&&!y.find(function(se){return So(se,Gx(o,d,u[Y].originIndex))})&&(w=K,E=Y)}},_=0;_<u.length;_++)S(_);y[g]=Gx(o,d,E),m.push(E),x[g]=[u[E]],u[E].clusterId=String(g)}for(var C=0;;){for(var g=0;g<u.length;g++){var M=0,A=1/0;if(!(C===0&&m.includes(g))){for(var T=0;T<y.length;T++){var I=0;switch(o){case Oi.EuclideanDistance:I=Bx(d[g],y[T],o);break}I<A&&(A=I,M=T)}if(u[g].clusterId!==void 0)for(var L=x[Number(u[g].clusterId)].length-1;L>=0;L--)x[Number(u[g].clusterId)][L].id===u[g].id&&x[Number(u[g].clusterId)].splice(L,1);u[g].clusterId=String(M),x[M].push(u[g])}}for(var N=!1,g=0;g<x.length;g++){for(var O=x[g],B=new li([]),T=0;T<O.length;T++)B=B.add(new li(d[O[T].originIndex]));var W=B.avg(O.length);W.equal(new li(y[g]))||(N=!0,y[g]=W.getArr())}if(C++,u.every(function(R){return R.clusterId!==void 0})&&N||C>=1e3)break}var D=[],P={};return l.forEach(function(R){var X,Y,ee=R.source,U=R.target,Z=(X=u.find(function(J){return J.id===ee}))===null||X===void 0?void 0:X.clusterId,K=(Y=u.find(function(J){return J.id===U}))===null||Y===void 0?void 0:Y.clusterId,se="".concat(Z,"---").concat(K);if(P[se])P[se].count++;else{var re={source:Z,target:K,count:1};P[se]=re,D.push(re)}}),{clusters:x,clusterEdges:D}},Bm=function(e,t){var n=new li(t),i=n.norm2(),a=new li(e),o=a.norm2(),s=n.dot(a),u=i*o,f=u?s/u:0;return f},nI=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=Jt(e.filter(function(h){return h.id!==t.id})),s=e.findIndex(function(h){return h.id===t.id}),u=Dm(e,n),f=Pm(u,i,a),l=f[s],c=[];return o.forEach(function(h,d){if(h.id!==t.id){var v=f[d],p=Bm(v,l);c.push(p),h.cosineSimilarity=p}}),o.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:o}},Q6=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}(),J6=function(e,t){return e-t},ez=function(){function r(e){e===void 0&&(e=J6),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}(),tz=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 ez(l);for(od(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),od(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),od(v,s).forEach(function(p){c.insert(p)})))}return n},zx=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 Q6(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},iI=function(e,t,n){var i={prim:tz,kruskal:zx};return n?i[n](e,t):zx(e,t)},aI=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=Ua(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 x=Kn(y,l,"source"),b=0;b<x.length;++b){var w=x[b],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},rz=-1,kd=-1,oI="-1",sa="-1",sI=-1,jx=function(){function r(e,t,n,i){e===void 0&&(e=rz),t===void 0&&(t=kd),n===void 0&&(n=kd),i===void 0&&(i=oI),this.id=e,this.from=t,this.to=n,this.label=i}return r}(),nz=function(){function r(e,t){e===void 0&&(e=kd),t===void 0&&(t=sa),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}(),uI=function(){function r(e,t,n){e===void 0&&(e=kd),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 nz(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 jx(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 jx(e,n,t,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}(),hs=function(){function r(e,t,n,i,a){this.fromNode=e,this.toNode=t,this.nodeEdgeNodeLabel={nodeLabel1:n||sa,edgeLabel:i||oI,nodeLabel2:a||sa}}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}(),Ux=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 hs(e,t,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(e,t){e===void 0&&(e=sI),t===void 0&&(t=!1);var n=new uI(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!==sa&&n.addNode(a,u),l!==sa&&n.addNode(o,l),u!==sa&&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}(),Wc=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}(),iz=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 Ux,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(sI,n),a=i.nodeMap,o=new Ux,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 hs(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,x=n?-1:0,b=function(B){if(y)return"break";h.forEach(function(W){var D=new Wc(W),P=e.findBackwardEdge(i,D.edges[d[B]],D.edges[d[0]],D);P&&(g[P.label]||(g[P.label]={projected:[],edgeLabel:P.label}),g[P.label].projected.push({graphId:i.id,edge:g,preNode:W}),m=o.dfsEdgeList[d[B]].fromNode,y=!0)})},w=d.length-1;w>x;w--){var E=b(w);if(E==="break")break}if(y){var S=e.findMinLabel(g);o.dfsEdgeList.push(new hs(p,m,sa,S.edgeLabel,sa));var _=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[_]!==o.dfsEdgeList[_]?!1:c(g[S.edgeLabel].projected)}var C={};y=!1;var M=0;h.forEach(function(O){var B=new Wc(O),W=e.findForwardPureEdges(i,B.edges[d[0]],v,B);W.length>0&&(y=!0,M=p,W.forEach(function(D){var P="".concat(D.label,"-").concat(a[D.to].label);C[P]||(C[P]={projected:[],edgeLabel:D.label,nodeLabel2:a[D.to].label}),C[P].projected.push({graphId:i.id,edge:D,preNode:O})}))});for(var A=d.length,T=function(B){if(y)return"break";var W=d[B];h.forEach(function(D){var P=new Wc(D),R=e.findForwardRmpathEdges(i,P.edges[W],v,P);R.length>0&&(y=!0,M=o.dfsEdgeList[W].fromNode,R.forEach(function(X){var Y="".concat(X.label,"-").concat(a[X.to].label);C[Y]||(C[Y]={projected:[],edgeLabel:X.label,nodeLabel2:a[X.to].label}),C[Y].projected.push({graphId:i.id,edge:X,preNode:D})}))})},w=0;w<A;w++){var I=T(w);if(I==="break")break}if(!y)return!0;var L=e.findMinLabel(C);o.dfsEdgeList.push(new hs(M,p+1,sa,L.edgeLabel,L.nodeLabel2));var N=o.dfsEdgeList.length-1;return t.dfsEdgeList[N]!==o.dfsEdgeList[N]?!1:c(C["".concat(L.edgeLabel,"-").concat(L.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(Jt(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 Wc(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(x){var b="".concat(o,"-").concat(x.label,"-").concat(h[x.to].label);u[b]||(u[b]={projected:[],fromNodeId:o,edgeLabel:x.label,nodeLabel2:h[x.to].label}),u[b].projected.push({graphId:l.graphId,edge:x,preNode:l})});for(var m=function(b){var w=t.findForwardRmpathEdges(c,d.edges[a[b]],s,d);w.forEach(function(E){var S="".concat(t.dfsCode.dfsEdgeList[a[b]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[S]||(u[S]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[b]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[S].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 hs(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 hs(h,o+1,sa,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 x=m;m=y,y=x}var b=g.label,w="".concat(y,"-").concat(b,"-").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 hs(0,1,s,u,f)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},r}(),az=function(e,t,n,i){var a={};return Object.keys(e).forEach(function(o,s){var u=e[o],f=new uI(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},oz=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},$x="cluster",sz=function(e){var t=e.graphs,n=e.directed,i=n===void 0?!1:n,a=e.nodeLabelProp,o=a===void 0?$x:a,s=e.edgeLabelProp,u=s===void 0?$x:s,f=az(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 iz(p);g.run();var y=oz(g.frequentSubgraphs,o,u);return y},Xx=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(fI(o,s,u,n,i))}),a},fI=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}},uz=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},sd=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},ud=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)},fz=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,x){return l[m]-l[x]}),h=10,d=[];c.forEach(function(m,x){d[x%h]||(d[x%h]={graphs:[],totalCount:0,aveCount:0}),d[x%h].graphs.push(m),d[x%h].totalCount+=l[m]});var v=0,p=[];d.forEach(function(m){var x=m.totalCount/m.graphs.length;m.aveCount=x,p.push(x);var b=0,w=m.length;m.graphs.forEach(function(E,S){var _=l[E];m.graphs.forEach(function(C,M){S!==M&&(b+=Math.abs(_-l[C]))})}),b/=w*(w-1)/2,v+=b}),v/=d.length;var g=0;p.forEach(function(m,x){p.forEach(function(b,w){x!==w&&(g+=Math.abs(m-b))}),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]}},Yx=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}},Wx=function(e,t,n){var i={},a={};return e.forEach(function(o,s){i["".concat($T)]={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}},qx=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},lz=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=sd(p,o,e,c),v=c[d]}return ud(v,s,u,f)},Vx=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}},lI=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=kl(e,n),c=kl(t,n),h=qx(e.nodes,l,n),d=qx(t.nodes,c,n),v=Yx(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=Yx(t.nodes,o),m=y.nodeMap,x=y.nodeLabelMap;Wx(e.edges,s,p);var b=Wx(t.edges,s,m).edgeLabelMap,w=[];c==null||c.forEach(function(pt){w=w.concat(pt)}),a||(a=Math.max.apply(Math,Qn(Qn([],w,!1),[2],!1))),i||(i=a);var E=Xx(e,l,o,i),S=Xx(t,c,o,i),_=Math.min(100,f*(f-1)/2),C=uz(i,f,_,E,l),M=sd(C,E,e),A=10,T=1,I=1,L=4,N={graphs:M,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:I,maxNodeNum:L,directed:n},O=sz(N).slice(0,A),B=O.length,W=[];O.forEach(function(pt,Nt){W[Nt]={},Object.keys(M).forEach(function(F){var zt=M[F],Ot=ud(zt,pt,o,s);W[Nt][F]=Ot})});var D=fz(W,B,O),P=D.structure,R=D.structureCountMap,X=t.nodes[0],Y=[],ee=(u=t.nodes[0])===null||u===void 0?void 0:u[o],U=-1/0;t.nodes.forEach(function(pt){var Nt=pt[o],F=g[Nt];(F==null?void 0:F.length)>U&&(U=F.length,Y=F,ee=Nt,X=pt)});var Z={},K={},se={},re={},J={},me={};Object.keys(x).forEach(function(pt,Nt){J[pt]=[],n&&(me[pt]=[]);var F=x[pt],zt={};F.forEach(function(ct){var ve=d["".concat(X.id,"-").concat(ct.id)];if(ve&&J[pt].push(ve),zt["".concat(X.id,"-").concat(ct.id)]={start:0,end:m[ct.id].idx,distance:ve},n){var Te=d["".concat(ct.id,"-").concat(X.id)];Te&&me[pt].push(Te)}}),J[pt]=J[pt].sort(function(ct,ve){return ct-ve}),n&&(me[pt]=me[pt].sort(function(ct,ve){return ct-ve})),K=sd(zt,S,t,K);var Ot=[];if(Object.keys(zt).forEach(function(ct){if(se[ct]){Ot.push(se[ct]);return}var ve=K[ct];se[ct]=ud(ve,P,o,s),Ot.push(se[ct])}),Ot=Ot.sort(function(ct,ve){return ve-ct}),re["".concat(X.id,"-").concat(pt)]=Ot,pt!==ee)for(var ut=(Y==null?void 0:Y.length)||0,Gt=function(ve){var Te=Y[ve],nt=E[p[Te.id].idx],st=nt.nodeLabelCountMap[pt],gt=x[pt].length;if(!st||st.count<gt)return Y.splice(ve,1),"continue";for(var Ct=!1,Bt=0;Bt<gt;Bt++)if(st.dists[Bt]>J[pt][Bt]){Ct=!0;break}if(Ct)return Y.splice(ve,1),"continue";var Sr={};nt.neighbors.forEach(function(wt){var er=h["".concat(Te.id,"-").concat(wt.id)];Sr["".concat(Te.id,"-").concat(wt.id)]={start:p[Te.id].idx,end:p[wt.id].idx,distance:er}}),M=sd(Sr,E,e,M);var yr=[];Object.keys(Sr).forEach(function(wt){if(R[wt]){yr.push(R[wt]);return}var er=M[wt];R[wt]=ud(er,P,o,s),yr.push(R[wt])}),yr=yr.sort(function(wt,er){return er-wt});for(var Rr=!1,Bt=0;Bt<gt;Bt++)if(yr[Bt]<Ot[Bt]){Rr=!0;break}if(Rr)return Y.splice(ve,1),"continue"},_t=ut-1;_t>=0;_t--)Gt(_t)});var Ae=[];Y==null||Y.forEach(function(pt){for(var Nt=p[pt.id].idx,F=fI(e.nodes,l[Nt],Nt,o,a),zt=F.neighbors,Ot=zt.length,ut=!1,Gt=Ot-1;Gt>=0;Gt--){if(zt.length+1<t.nodes.length){ut=!0;return}var _t=zt[Gt],ct=_t[o];if(!x[ct]||!x[ct].length){zt.splice(Gt,1);continue}if(!J[ct]||!J[ct].length){zt.splice(Gt,1);continue}var ve="".concat(pt.id,"-").concat(_t.id),Te=h[ve],nt=J[ct].length-1,st=J[ct][nt];if(Te>st){zt.splice(Gt,1);continue}if(n){var gt="".concat(_t.id,"-").concat(pt.id),Ct=h[gt];nt=me[ct].length-1;var Bt=me[ct][nt];if(Ct>Bt){zt.splice(Gt,1);continue}}var Sr=R[ve]?R[ve]:lz(e,pt,_t,p,Te,E,P,o,s,R,M),yr="".concat(X.id,"-").concat(ct),Rr=re[yr][re[yr].length-1];if(Sr<Rr){zt.splice(Gt,1);continue}var wt=Vx(Z,ct,m,x),er=wt.minPatternNodeLabelDegree;if(wt.minPatternNodeLabelInDegree,wt.minPatternNodeLabelOutDegree,p[_t.id].degree<er){zt.splice(Gt,1);continue}}ut||Ae.push({nodes:[pt].concat(zt)})});var Ye=Il(t,X.id,!1).length,Ve={};n?(Object.keys(Ye).forEach(function(pt){var Nt=m[pt].node[o];Ve[Nt]?Ve[Nt].push(Ye[pt]):Ve[Nt]=[Ye[pt]]}),Object.keys(Ve).forEach(function(pt){Ve[pt].sort(function(Nt,F){return Nt-F})})):Ve=J;for(var Ke=Ae.length,xt=function(Nt){var F=Ae[Nt],zt=F.nodes[0],Ot={},ut={};F.nodes.forEach(function(sr,Er){ut[sr.id]={idx:Er,node:sr,degree:0,inDegree:0,outDegree:0};var jt=sr[o];Ot[jt]?Ot[jt]++:Ot[jt]=1});var Gt=[],_t={};e.edges.forEach(function(sr){ut[sr.source]&&ut[sr.target]&&(Gt.push(sr),_t[sr[s]]?_t[sr[s]]++:_t[sr[s]]=1,ut[sr.source].degree++,ut[sr.target].degree++,ut[sr.source].outDegree++,ut[sr.target].inDegree++)});for(var ct=Object.keys(b).length,ve=!1,Te=0;Te<ct;Te++){var nt=Object.keys(b)[Te];if(!_t[nt]||_t[nt]<b[nt].length){ve=!0;break}}if(ve)return Ae.splice(Nt,1),"continue";var st=Gt.length;if(st<t.edges.length)return Ae.splice(Nt,1),"break";for(var gt=!1,Ct=function(Er){var jt=Gt[Er],_r=jt[s],an=b[_r];if(!an||!an.length)return _t[_r]--,an&&_t[_r]<an.length?(gt=!0,"break"):(Gt.splice(Er,1),ut[jt.source].degree--,ut[jt.target].degree--,ut[jt.source].outDegree--,ut[jt.target].inDegree--,"continue");var xa=ut[jt.source].node[o],Xn=ut[jt.target].node[o],Ha=!1;if(an.forEach(function(js){var Us=m[js.source].node,$s=m[js.target].node;Us[o]===xa&&$s[o]===Xn&&(Ha=!0),!n&&Us[o]===Xn&&$s[o]===xa&&(Ha=!0)}),!Ha)return _t[_r]--,an&&_t[_r]<an.length?(gt=!0,"break"):(Gt.splice(Er,1),ut[jt.source].degree--,ut[jt.target].degree--,ut[jt.source].outDegree--,ut[jt.target].inDegree--,"continue")},Te=st-1;Te>=0;Te--){var Bt=Ct(Te);if(Bt==="break")break}if(gt)return Ae.splice(Nt,1),"continue";F.edges=Gt;var Sr=Il(F,F.nodes[0].id,!1).length;if(Object.keys(Sr).reverse().forEach(function(sr){if(!(sr===F.nodes[0].id||gt)){if(Sr[sr]===1/0){var Er=ut[sr].node[o];if(Ot[Er]--,Ot[Er]<x[Er].length){gt=!0;return}var jt=F.nodes.indexOf(ut[sr].node);F.nodes.splice(jt,1),ut[sr]=void 0;return}var _r=p[sr].node[o];if(!Ve[_r]||!Ve[_r].length||Sr[sr]>Ve[_r][Ve[_r].length-1]){var Er=ut[sr].node[o];if(Ot[Er]--,Ot[Er]<x[Er].length){gt=!0;return}var jt=F.nodes.indexOf(ut[sr].node);F.nodes.splice(jt,1),ut[sr]=void 0}}}),gt)return Ae.splice(Nt,1),"continue";for(var yr=!0,Rr=0;yr&&!gt;){yr=!1;var wt=n?ut[zt.id].degree<m[X.id].degree||ut[zt.id].inDegree<m[X.id].inDegree||ut[zt.id].outDegree<m[X.id].outDegree:ut[zt.id].degree<m[X.id].degree;if(wt){gt=!0;break}if(Ot[zt[o]]<x[zt[o]].length){gt=!0;break}for(var er=F.nodes.length,ir=er-1;ir>=0;ir--){var Yt=F.nodes[ir],br=ut[Yt.id].degree,It=ut[Yt.id].inDegree,wr=ut[Yt.id].outDegree,Ht=Yt[o],fr=Vx(Z,Ht,m,x),mr=fr.minPatternNodeLabelDegree,Lr=fr.minPatternNodeLabelInDegree,Vr=fr.minPatternNodeLabelOutDegree,cn=n?br<mr||It<Lr||wr<Vr:br<mr;if(cn){if(Ot[Yt[o]]--,Ot[Yt[o]]<x[Yt[o]].length){gt=!0;break}F.nodes.splice(ir,1),ut[Yt.id]=void 0,yr=!0}}if(gt||!yr&&Rr!==0)break;st=Gt.length;for(var Mr=st-1;Mr>=0;Mr--){var hn=Gt[Mr];if(!ut[hn.source]||!ut[hn.target]){Gt.splice(Mr,1);var rn=hn[s];if(_t[rn]--,ut[hn.source]&&(ut[hn.source].degree--,ut[hn.source].outDegree--),ut[hn.target]&&(ut[hn.target].degree--,ut[hn.target].inDegree--),b[rn]&&_t[rn]<b[rn].length){gt=!0;break}yr=!0}}Rr++}if(gt||gt||F.nodes.length<t.nodes.length||Gt.length<t.edges.length)return Ae.splice(Nt,1),"continue"},kt=Ke-1;kt>=0;kt--){var Lt=xt(kt);if(Lt==="break")break}for(var vr=Ae.length,xr=function(Nt){var F=Ae[Nt],zt={};F.edges.forEach(function(Gt){var _t="".concat(Gt.source,"-").concat(Gt.target,"-").concat(Gt.label);zt[_t]?zt[_t]++:zt[_t]=1});for(var Ot=function(_t){var ct=Ae[_t],ve={};ct.edges.forEach(function(nt){var st="".concat(nt.source,"-").concat(nt.target,"-").concat(nt.label);ve[st]?ve[st]++:ve[st]=1});var Te=!0;Object.keys(ve).length!==Object.keys(zt).length?Te=!1:Object.keys(zt).forEach(function(nt){ve[nt]!==zt[nt]&&(Te=!1)}),Te&&Ae.splice(_t,1)},ut=vr-1;ut>Nt;ut--)Ot(ut);vr=Ae.length},kt=0;kt<=vr-1;kt++)xr(kt);return Ae}}},Iu=function(){function r(e){e===void 0&&(e=10),this.linkedList=new UT,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}(),cI=Lm;const cz={getAdjMatrix:Ts,breadthFirstSearch:XT,connectedComponent:Im,getDegree:Ua,getInDegree:WT,getOutDegree:qT,detectCycle:Lm,detectDirectedCycle:cI,detectAllCycles:HT,detectAllDirectedCycle:Om,detectAllUndirectedCycle:Nm,depthFirstSearch:km,dijkstra:Il,findAllPath:QT,findShortestPath:KT,floydWarshall:kl,labelPropagation:JT,louvain:Rm,iLouvain:eI,kCore:tI,kMeans:rI,cosineSimilarity:Bm,nodesCosineSimilarity:nI,minimumSpanningTree:iI,pageRank:aI,getNeighbors:Kn,Stack:Iu,GADDI:lI},hz=Object.freeze(Object.defineProperty({__proto__:null,GADDI:lI,Stack:Iu,breadthFirstSearch:XT,connectedComponent:Im,cosineSimilarity:Bm,default:cz,depthFirstSearch:km,detectAllCycles:HT,detectAllDirectedCycle:Om,detectAllUndirectedCycle:Nm,detectCycle:Lm,detectDirectedCycle:cI,dijkstra:Il,findAllPath:QT,findShortestPath:KT,floydWarshall:kl,getAdjMatrix:Ts,getDegree:Ua,getInDegree:WT,getNeighbors:Kn,getOutDegree:qT,iLouvain:eI,kCore:tI,kMeans:rI,labelPropagation:JT,louvain:Rm,minimumSpanningTree:iI,nodesCosineSimilarity:nI,pageRank:aI},Symbol.toStringTag,{value:"Module"}));var Ld=vi,dz=function(e){return function(t,n){return t[e]-n[e]}},Hx=function(e,t,n){return e>=t&&e<=n},Ev=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!Hx(v,0,1)||!Hx(p,0,1)?null:{x:e.x+v*s.x,y:e.y+v*s.y}}return null},hI=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=Ev(f[h-1],f[h],l,t),!c);h++);return c},dI=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)}},vI=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)}},Nu=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]),xv(i,i,t),{x:i[0],y:i[1]}},pI=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=vm([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 xv(a,a,i),{x:a[0],y:a[1]}},F0=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}},Nd=function(e,t){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)},vz=function(e,t){var n=[];return e.forEach(function(i){var a=[];i.forEach(function(o){a.push(o*t)}),n.push(a)}),n},pz=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},gz=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},gI=function(e,t){e.translate(t.x,t.y)},G0=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=Ld(a,[["t",d-c,v-h]]),c=d,h=v,{matrix:a}},i)}else{var p=Ld(a,[["t",s,u]]);e.setMatrix(p)}},yz=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=t;mt(t)||(i=[t,t]),mt(t)&&t.length===1&&(i=[t[0],t[0]]),n=Ld(n,[["s",i[0],i[1]]]),e.setMatrix(n)},mz=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Ld(n,[["r",t]]),e.setMatrix(n)},bz=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 xz(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 Ll=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(xz(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},yI=function(e,t){return!(t.minX>e.maxX||t.maxX<e.minX||t.minY>e.maxY||t.maxY<e.minY)},wz=function(e,t){var n=!1;return _e(e,function(i){if(Ev(i.from,i.to,t.from,t.to))return n=!0,!1}),n},mI=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],x=h[v-1];d.push({from:{x:x[0],y:x[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(!yI(a,o))return!1;var s=!1;if(_e(t,function(c){if(Ll(e,c[0],c[1]))return s=!0,!1}),s||(_e(e,function(c){if(Ll(t,c[0],c[1]))return s=!0,!1}),s))return!0;var u=i(e),f=i(t),l=!1;return _e(f,function(c){if(wz(u,c))return l=!0,!1}),l},Is=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}(),Fm=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]},Ez=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},bI=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=0,o=[],s=0;s<4;s++){var u=Fm(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3];o[s]=Ev({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]},Gm=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=Fm(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3],d=Ez(t,new Is(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},xI=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}},Od=function(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)},wI=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},z0=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)},EI=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},_z=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(Tm(f,[0,0]))return NaN;var l=[-f[1],f[0]];_o(l,l);var c=[s-n,u-i];return Math.abs(Am(c,l))},zm=function(e,t,n){return e+(t-e)*n},j0=function(e,t,n){for(var i=Math.min(e.length,t.length),a=new Array(i),o=0;o<i;o++)a[o]=zm(e[o],t[o],n);return a};const Sz=Object.freeze(Object.defineProperty({__proto__:null,Line:Is,applyMatrix:Nu,compare:dz,distance:Nd,floydWarshall:pz,fractionToLine:Gm,getAdjMatrix:gz,getBBoxBoundLine:Fm,getCircleCenterByPoints:F0,getCircleIntersectByPoint:dI,getDegree:bz,getEllipseIntersectByPoint:vI,getLineIntersect:Ev,getPointsCenter:xI,getRectIntersectByPoint:hI,intersectBBox:yI,invertMatrix:pI,isPointInPolygon:Ll,isPointsOverlap:z0,isPolygonsIntersect:mI,itemIntersectByLine:bI,lerp:zm,lerpArray:j0,move:G0,pointLineDistance:_z,pointLineSquareDist:wI,pointRectSquareDist:EI,rotate:mz,scale:yz,scaleMatrix:vz,squareDist:Od,translate:gI},Symbol.toStringTag,{value:"Module"}));var to="rgb(95, 149, 255)",Mz="rgb(255, 255, 255)",Zx="rgb(0, 0, 0)",tg="rgb(247, 250, 255)",_I="rgb(239, 244, 255)",qc="rgb(253, 253, 253)",Kx="rgb(250, 250, 250)",Vc="rgb(224, 224, 224)",Qx="rgb(234, 234, 234)",Cz="rgb(245, 245, 245)",Az="rgb(191, 213, 255)",Jx="#4572d9",Tz="rgb(223, 234, 255)",hr={mainStroke:to,mainFill:_I,activeStroke:to,activeFill:tg,inactiveStroke:Az,inactiveFill:tg,selectedStroke:to,selectedFill:Mz,highlightStroke:Jx,highlightFill:Tz,disableStroke:Vc,disableFill:Kx,edgeMainStroke:Vc,edgeActiveStroke:to,edgeInactiveStroke:Qx,edgeSelectedStroke:to,edgeHighlightStroke:to,edgeDisableStroke:Cz,comboMainStroke:Vc,comboMainFill:qc,comboActiveStroke:to,comboActiveFill:tg,comboInactiveStroke:Vc,comboInactiveFill:qc,comboSelectedStroke:to,comboSelectedFill:qc,comboHighlightStroke:Jx,comboHighlightFill:qc,comboDisableStroke:Qx,comboDisableFill:Kx};const lt={version:"0.8.23",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:hr.mainStroke,fill:_I},size:20,color:hr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:hr.activeFill,stroke:hr.activeStroke}},nodeStateStyles:{active:{fill:hr.activeFill,stroke:hr.activeStroke,lineWidth:2,shadowColor:hr.mainStroke,shadowBlur:10},selected:{fill:hr.selectedFill,stroke:hr.selectedStroke,lineWidth:4,shadowColor:hr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:hr.highlightFill,stroke:hr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:hr.inactiveFill,stroke:hr.inactiveStroke,lineWidth:1},disable:{fill:hr.disableFill,stroke:hr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:Zx,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:hr.edgeMainStroke,lineAppendWidth:2},color:hr.edgeMainStroke},edgeStateStyles:{active:{stroke:hr.edgeActiveStroke,lineWidth:1},selected:{stroke:hr.edgeSelectedStroke,lineWidth:2,shadowColor:hr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:hr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:hr.edgeInactiveStroke,lineWidth:1},disable:{stroke:hr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:Zx,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:hr.comboMainFill,lineWidth:1,stroke:hr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:hr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:hr.comboActiveStroke,lineWidth:1,fill:hr.comboActiveFill},selected:{stroke:hr.comboSelectedStroke,lineWidth:2,fill:hr.comboSelectedFill,shadowColor:hr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:hr.comboHighlightStroke,lineWidth:2,fill:hr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:hr.comboInactiveStroke,fill:hr.comboInactiveFill,lineWidth:1},disable:{stroke:hr.comboDisableStroke,fill:hr.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"},Iz={" ":.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 ra=Math.PI,U0=Math.sin,$0=Math.cos,gn=U0(ra/8),yn=$0(ra/8),Dd=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=Nu(i,o),a=Nu(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}},SI=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||lt.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*gn,m=p*yn,x=g*gn,b=g*yn,w=a.get("type"),E=Math.min(d/2,v/2),S=Math.min(d,v),_=s!=null&&s.pointPadding?Math.min(S,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]+x,l[1]-b]):(c=[l[0]-_,l[1]-d],h=[l[0]+_,l[1]-d]);break;case"top-right":p=d,g=v,w==="circle"?(y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]+y,l[1]-m],h=[l[0]+b,l[1]-x]):(c=[l[0]+v-_,l[1]-d],h=[l[0]+v,l[1]-d+_]);break;case"right":p=v,g=v,w==="circle"?(y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]+m,l[1]-y],h=[l[0]+b,l[1]+x]):(c=[l[0]+v,l[1]-_],h=[l[0]+v,l[1]+_]);break;case"bottom-right":p=v,g=d,w==="circle"?(y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]+m,l[1]+y],h=[l[0]+x,l[1]+b]):(c=[l[0]+v,l[1]+d-_],h=[l[0]+v-_,l[1]+d]);break;case"bottom":p=d,g=d,w==="circle"?(y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]+y,l[1]+m],h=[l[0]-x,l[1]+b]):(c=[l[0]-_,l[1]+d],h=[l[0]+_,l[1]+d]);break;case"bottom-left":p=d,g=v,w==="circle"?(y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]-y,l[1]+m],h=[l[0]-b,l[1]+x]):(c=[l[0]-v,l[1]+d-_],h=[l[0]-v+_,l[1]+d]);break;case"left":p=v,g=v,w==="circle"?(y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]-m,l[1]+y],h=[l[0]-b,l[1]-x]):(c=[l[0]-v,l[1]-_],h=[l[0]-v,l[1]+_]);break;case"top-left":p=v,g=d,w==="circle"?(y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]-m,l[1]-y],h=[l[0]-x,l[1]-b]):(c=[l[0]-v+_,l[1]-d],h=[l[0]-v,l[1]-d+_]);break;default:p=v,g=v,y=p*gn,m=p*yn,x=g*gn,b=g*yn,c=[l[0]-y,l[1]-m],h=[l[0]+x,l[1]-b]}if(s.clockwise===!1){var C=[c[0],c[1]];c=[h[0],h[1]],h=[C[0],C[1]]}}var M=[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 I=An([0,0],M,A),L=[l[0]+I[0],l[1]+I[1]],N=[h[0]-l[0],h[1]-l[1]],O=An([0,0],N,T),B=[l[0]+O[0],l[1]+O[1]];return e.startPoint={x:c[0],y:c[1]},e.endPoint={x:h[0],y:h[1]},e.controlPoints=[{x:L[0],y:L[1]},{x:B[0],y:B[1]}],e},MI=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+=ra*2),n&&(u.x+=$0(l)*n,u.y+=U0(l)*n),i){var c=l-ra/2;l>1/2*ra&&l<3*1/2*ra&&(c-=ra),u.x+=$0(c)*i,u.y+=U0(c)*i}var h={x:u.x,y:u.y,angle:l};return a?(l>.5*ra&&l<1.5*ra&&(l-=ra),z({rotate:l},h)):h},kz=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},Lz=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},Cn=function(e,t){typeof t=="function"&&kz(e,null,-1,t)},na=function(e,t){typeof t=="function"&&Lz(e,null,-1,t)},CI=function(e,t){return t*(Iz[e]||1)},AI=function(e,t){var n=0,i=new RegExp("[一-龥]+");return e.split("").forEach(function(a){i.test(a)?n+=t:n+=CI(a,t)}),[n,t]},TI=function(e,t){return typeof t!="number"||t<=0||t>=e.length?e:e.substring(0,t)+"..."},X0=function(e,t){var n=[],i={},a={};e.forEach(function(u){a[u.id]=u}),e.forEach(function(u,f){var l=Jt(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(Fe(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,Cn(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},Y0=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}Cn(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||Cn(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;Cn(o,function(v){return v.itemType==="node"?d+=2:d+=1,v.depth=d,!0})}return e},fd=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=mt(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 x=m.getCanvasBBox();x.x&&i.minX>x.minX&&(i.minX=x.minX),x.y&&i.minY>x.minY&&(i.minY=x.minY),x.x&&i.maxX<x.maxX&&(i.maxX=x.maxX),x.y&&i.maxY<x.maxY&&(i.maxY=x.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},Nz=function(e){var t=dt(e.x)||dt(e.y)||e.type||e.anchorPoints||e.size;return e.style&&(t=t||dt(e.style.r)||dt(e.style.width)||dt(e.style.height)||dt(e.style.rx)||dt(e.style.ry)),t},ld=function(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];if(!(n==="img"&&!Fe(i)))if(wn(i)&&!mt(i)){var a={};Object.keys(i).forEach(function(o){var s=i[o];o==="img"&&!Fe(s)||(a[o]=Jt(s))}),t[n]=a}else t[n]=Jt(i)}),t},Nl=function(e){var t=e.animateCfg,n=e.callback,i;if(!t)i={duration:500,callback:n};else if(i=Jt(t),t.callback){var a=t.callback;i.callback=function(){n(),a()}}else i.callback=n;return i};const Oz=Object.freeze(Object.defineProperty({__proto__:null,cloneBesidesImg:ld,getAnimateCfgWithCallback:Nl,getBBox:Dd,getComboBBox:fd,getLabelPosition:MI,getLetterWidth:CI,getLoopCfgs:SI,getTextSize:AI,plainCombosToTrees:X0,reconstructTree:Y0,shouldRefreshEdge:Nz,traverseTree:Cn,traverseTreeUp:na,truncateLabelByLength:TI},Symbol.toStringTag,{value:"Module"}));var ew=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 Cn(e,function(h){return Fe(h.id)?!0:(o=!1,!1)}),o}var s=(t||[]).find(function(h){return!Fe(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=Qn(Qn([],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},Dz=function(e,t){if(e==="node"||e==="combo"){if(t.id&&!Fe(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},Pz=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;_e(e,function(t){_e(t,function(n,i){Fe(n)&&(t[i]={type:n})})})},r.prototype.setBehaviors=function(e){var t=this.graph,n=this.modes[e],i=[],a;_e(n||[],function(o){var s=dm.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 _e(t,function(n){e.indexOf(n)<0&&(Fe(n)&&(n={type:n}),e.push(n))}),e},r.filterBehaviors=function(e,t){var n=[];return e.forEach(function(i){var a="";Fe(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}),_e(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(mt(e)?a=e:a=[e],mt(t))return _e(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){Fe(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}(),vl=`
|
|
2
|
+
\v\f\r \u2028\u2029`,Rz=new RegExp("([a-z])["+vl+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+vl+"]*,?["+vl+"]*)+)","ig"),Bz=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+vl+"]*,?["+vl+"]*","ig"),ku=function(r){if(!r)return null;if(mt(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(Rz,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(Bz,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},W0=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},Hc=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},q0=function(r){if(r=ku(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(W0(u,f));break;case"O":e.pop(),u=Hc(t,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);break;case"U":e.pop(),e=e.concat(Hc(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(W0(u,f)),l=["R"].concat(c.slice(-2));else if(s==="O")e.pop(),u=Hc(t,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);else if(s==="U")e.pop(),e=e.concat(Hc(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},Zc=function(r,e,t,n){return[r,e,t,n,t,n]},tw=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]},II=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(K,se,re){var J=K*Math.cos(re)-se*Math.sin(re),me=K*Math.sin(re)+se*Math.cos(re);return{x:J,y:me}};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 x=(r-s)/2,b=(e-u)/2,w=x*x/(t*t)+b*b/(n*n);w>1&&(w=Math.sqrt(w),t=w*t,n=w*n);var E=t*t,S=n*n,_=(a===o?-1:1)*Math.sqrt(Math.abs((E*S-E*b*b-S*x*x)/(E*b*b+S*x*x)));g=_*t*b/n+(r+s)/2,y=_*-n*x/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 M=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=II(s,u,t,n,i,0,o,A,T,[p,M,g,y])}C=p-v;var I=Math.cos(v),L=Math.sin(v),N=Math.cos(p),O=Math.sin(p),B=Math.tan(C/4),W=4/3*t*B,D=4/3*n*B,P=[r,e],R=[r+W*L,e-D*I],X=[s+W*O,u-D*N],Y=[s,u];if(R[0]=2*P[0]-R[0],R[1]=2*P[1]-R[1],f)return[R,X,Y].concat(h);h=[R,X,Y].concat(h).join().split(",");for(var ee=[],U=0,Z=h.length;U<Z;U++)ee[U]=U%2?m(h[U-1],h[U],c).y:m(h[U],h[U+1],c).x;return ee},V0=function(r,e){var t=q0(r),n=e&&q0(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(x,b,w){var E,S;if(!x)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(!(x[0]in{T:1,Q:1})&&(b.qx=b.qy=null),x[0]){case"M":b.X=x[1],b.Y=x[2];break;case"A":x=["C"].concat(II.apply(0,[b.x,b.y].concat(x.slice(1))));break;case"S":w==="C"||w==="S"?(E=b.x*2-b.bx,S=b.y*2-b.by):(E=b.x,S=b.y),x=["C",E,S].concat(x.slice(1));break;case"T":w==="Q"||w==="T"?(b.qx=b.x*2-b.qx,b.qy=b.y*2-b.qy):(b.qx=b.x,b.qy=b.y),x=["C"].concat(tw(b.x,b.y,b.qx,b.qy,x[1],x[2]));break;case"Q":b.qx=x[1],b.qy=x[2],x=["C"].concat(tw(b.x,b.y,x[1],x[2],x[3],x[4]));break;case"L":x=["C"].concat(Zc(b.x,b.y,x[1],x[2]));break;case"H":x=["C"].concat(Zc(b.x,b.y,x[1],b.y));break;case"V":x=["C"].concat(Zc(b.x,b.y,b.x,x[1]));break;case"Z":x=["C"].concat(Zc(b.x,b.y,b.X,b.Y));break}return x},h=function(x,b){if(x[b].length>7){x[b].shift();for(var w=x[b];w.length;)o[b]="A",n&&(s[b]="A"),x.splice(b++,0,["C"].concat(w.splice(0,6)));x.splice(b,1),l=Math.max(t.length,n&&n.length||0)}},d=function(x,b,w,E,S){x&&b&&x[S][0]==="M"&&b[S][0]!=="M"&&(b.splice(S,0,["M",E.x,E.y]),w.bx=0,w.by=0,w.x=x[S][1],w.y=x[S][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},Fz=/,?([a-z]),?/gi,kI=function(r){return r.join(",").replace(Fz,"$1")},rw=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},nw=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=rw(p,r,t,i,o),y=rw(p,e,n,a,s),m=g*g+y*y;d+=h[v]*Math.sqrt(m)}return f*d},Gz=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 x=u.length,b=x,w;x--;)d=u[x],w=1-d,f[0][x]=w*w*w*r+3*w*w*d*t+3*w*d*d*i+d*d*d*o,f[1][x]=w*w*w*e+3*w*w*d*n+3*w*d*d*a+d*d*d*s;return f[0][b]=r,f[1][b]=e,f[0][b+1]=o,f[1][b+1]=s,f[0].length=f[1].length=b+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])}}},zz=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}}}},ro=function(r,e,t){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},LI=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=kI,a},H0=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:LI(r,e,t,n),vb:[r,e,t,n].join(" ")}},jz=function(r,e){return r=H0(r),e=H0(e),ro(e,r.x,r.y)||ro(e,r.x2,r.y)||ro(e,r.x,r.y2)||ro(e,r.x2,r.y2)||ro(r,e.x,e.y)||ro(r,e.x2,e.y)||ro(r,e.x,e.y2)||ro(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)},iw=function(r,e,t,n,i,a,o,s){mt(r)||(r=[r,e,t,n,i,a,o,s]);var u=Gz.apply(null,r);return H0(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},aw=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),x=n+2*u*(a-n)+h*(s-2*a+n),b=f*r+u*t,w=f*e+u*n,E=f*i+u*o,S=f*a+u*s,_=90-Math.atan2(g-m,y-x)*180/Math.PI;return{x:v,y:p,m:{x:g,y},n:{x:m,y:x},start:{x:b,y:w},end:{x:E,y:S},alpha:_}},Uz=function(r,e,t){var n=iw(r),i=iw(e);if(!jz(n,i))return t?0:[];for(var a=nw.apply(0,r),o=nw.apply(0,e),s=~~(a/8),u=~~(o/8),f=[],l=[],c={},h=t?0:[],d=0;d<s+1;d++){var v=aw.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=aw.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],x=l[p+1],b=Math.abs(y.x-g.x)<.001?"y":"x",w=Math.abs(x.x-m.x)<.001?"y":"x",E=zz(g.x,g.y,y.x,y.y,m.x,m.y,x.x,x.y);if(E){if(c[E.x.toFixed(4)]===E.y.toFixed(4))continue;c[E.x.toFixed(4)]=E.y.toFixed(4);var S=g.t+Math.abs((E[b]-g[b])/(y[b]-g[b]))*(y.t-g.t),_=m.t+Math.abs((E[w]-m[w])/(x[w]-m[w]))*(x.t-m.t);S>=0&&S<=1&&_>=0&&_<=1&&(t?h+=1:h.push({x:E.x,y:E.y,t1:S,t2:_}))}}return h},$z=function(r,e,t){r=V0(r),e=V0(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 x=e[y];if(x[0]==="M")a=f=x[1],o=l=x[2];else{x[0]==="C"?(h=[a,o].concat(x.slice(1)),a=h[6],o=h[7]):(h=[a,o,a,o,f,l,f,l],a=f,o=l);var b=Uz(c,h,t);if(t)d+=b;else{for(var w=0,E=b.length;w<E;w++)b[w].segment1=v,b[w].segment2=y,b[w].bez1=c,b[w].bez2=h;d=d.concat(b)}}}}}return d},Xz=function(r,e){return $z(r,e)};function Yz(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 Wz(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=Yz(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 qz=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(Wz(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},Vz=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(qz(r[c],r[c+1],l))},[]);return u.unshift(r[0]),(e[n]==="Z"||e[n]==="z")&&u.push("Z"),u},Hz=function(r,e){if(r.length!==e.length)return!1;var t=!0;return _e(r,function(n,i){if(n!==e[i])return t=!1,!1}),t};function Zz(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 Kz=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],Hz(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]=Zz(l,c,h)}}return s},NI=function(r,e){var t=Kz(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 rg(r,e,t){for(var n=[].concat(r),i,a=1/(t+1),o=OI(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 OI(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 Z0=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=OI(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=rg(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=rg(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=rg(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 Qz=Object.freeze(Object.defineProperty({__proto__:null,catmullRomToBezier:W0,fillPath:Vz,fillPathByDiff:NI,formatPath:Z0,intersection:Xz,parsePathArray:kI,parsePathString:ku,pathToAbsolute:q0,pathToCurve:V0,rectPath:LI},Symbol.toStringTag,{value:"Module"}));var DI=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 PI(r,e){var t=r.indexOf(e);t!==-1&&r.splice(t,1)}var ow=typeof window<"u"&&typeof window.document<"u";function RI(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 K0(r){return r.cfg.visible&&r.cfg.capture}var Jz=function(r){Rt(e,r);function e(t){var n=r.call(this)||this;n.destroyed=!1;var i=n.getDefaultCfg();return n.cfg=bt(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}(LA),sw=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))},e8=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),t8=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),r8=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}(),n8=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),i8=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),a8=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,o8=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,uw=3,s8=[["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",a8]],fw=[["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 BI(r){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new i8:typeof navigator<"u"?f8(navigator.userAgent):c8()}function u8(r){return r!==""&&s8.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 f8(r){var e=u8(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new n8;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<uw&&(i=sw(sw([],i,!0),h8(uw-i.length),!0)):i=[];var a=i.join("."),o=l8(r),s=o8.exec(r);return s&&s[1]?new r8(t,a,o,s[1]):new e8(t,a,o)}function l8(r){for(var e=0,t=fw.length;e<t;e++){var n=fw[e],i=n[0],a=n[1],o=a.exec(r);if(o)return i}return null}function c8(){var r=typeof process<"u"&&process.version;return r?new t8(process.version.slice(1)):null}function h8(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}function lw(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],x=e[7],b=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+x*o+b*f,t[7]=m*i+x*s+b*l,t[8]=m*a+x*u+b*c,t}function ys(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 FI(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 Mf=vi,ng="matrix",d8=["zIndex","capture","visible","type"],v8=["repeat"],p8=":",g8="*";function y8(r){for(var e=[],t=0;t<r.length;t++)mt(r[t])?e.push([].concat(r[t])):e.push(r[t]);return e}function m8(r,e){var t={},n=e.attrs;for(var i in r)t[i]=n[i];return t}function b8(r,e){var t={},n=e.attr();return _e(r,function(i,a){v8.indexOf(a)===-1&&!So(n[a],i)&&(t[a]=i)}),t}function x8(r,e){if(e.onFrame)return r;var t=e.startTime,n=e.delay,i=e.duration,a=Object.prototype.hasOwnProperty;return _e(r,function(o){t+n<o.startTime+o.delay+o.duration&&i>o.delay&&_e(e.toAttrs,function(s,u){a.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),r}var GI=function(r){Rt(e,r);function e(t){var n=r.call(this,t)||this;n.attrs={};var i=n.getDefaultAttrs();return bt(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(wn(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?(PI(n.getChildren(),this),n.get("clearing")||this.onCanvasChange("remove")):this.onCanvasChange("remove"),t&&this.destroy()},e.prototype.resetMatrix=function(){this.attr(ng,this.getDefaultMatrix()),this.onCanvasChange("matrix")},e.prototype.getMatrix=function(){return this.attr(ng)},e.prototype.setMatrix=function(t){this.attr(ng,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=lw(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=lw(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?ys(n,t):t},e.prototype.invertFromMatrix=function(t){var n=this.attr("matrix");if(n){var i=FI(n);if(i)return ys(i,t)}return t},e.prototype.setClip=function(t){var n=this.getCanvas(),i=null;if(t){var a=this.getShapeBase(),o=zu(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={};_e(n,function(s,u){mt(n[u])?i[u]=y8(n[u]):i[u]=n[u]});var a=this.constructor,o=new a({attrs:i});return _e(d8,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?nl:l,h=t[4],d=h===void 0?0:h,v,p,g,y,m;Pr(o)?(v=o,o={}):wn(o)&&o.onFrame&&(v=o.onFrame,p=o.repeat),wn(s)?(m=s,s=m.duration,f=m.easing||"easeLinear",d=m.delay||0,p=m.repeat||p||!1,c=m.callback||nl,g=m.pauseCallback||nl,y=m.resumeCallback||nl):(dt(c)&&(d=c,c=null),Pr(f)?(c=f,f="easeLinear"):f=f||"easeLinear");var x=b8(o,this),b={fromAttrs:m8(x,this),toAttrs:x,duration:s,easing:f,repeat:p,callback:c,pauseCallback:g,resumeCallback:y,delay:d,startTime:i.getTime(),id:ha(),onFrame:v,pathFormatted:!1};a.length>0?a=x8(a,b):i.addAnimator(this),a.push(b),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");_e(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 _e(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 _e(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&&RI(h,o))return"break";mt(d)?_e(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+p8+i.type;(a[o]||a[g8])&&(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=Mf(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=Mf(i,[["s",t,n||t]]);return this.setMatrix(a),this},e.prototype.rotate=function(t){var n=this.getMatrix(),i=Mf(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=Mf(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=Mf(a,[["t",-t,-n],["r",i],["t",t,n]]);return this.setMatrix(o),this},e}(Jz),cw={},Q0="_INDEX";function zI(r,e){if(r.set("canvas",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){zI(n,e)})}}function jI(r,e){if(r.set("timeline",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){jI(n,e)})}}function w8(r,e,t){e.set("parent",null),e.set("canvas",null),PI(r.getChildren(),e)}function E8(r){return function(e,t){var n=r(e,t);return n===0?e[Q0]-t[Q0]:n}}var UI=function(r){Rt(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?_e(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?_e(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();_e(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];wn(i)?a=i:a.type=i;var o=cw[a.type];o||(o=zu(a.type),cw[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(Pr(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(!K0(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(K0(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&&w8(o,t),t.set("parent",this),n&&zI(t,n),a&&jI(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();_e(t,function(n,i){return n[Q0]=i,n}),t.sort(E8(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 _e(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 _e(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}(GI),ju=0,al=0,Cf=0,$I=1e3,Pd,ol,Rd=0,ks=0,_v=0,Ol=typeof performance=="object"&&performance.now?performance:Date,XI=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function YI(){return ks||(XI(_8),ks=Ol.now()+_v)}function _8(){ks=0}function J0(){this._call=this._time=this._next=null}J0.prototype=WI.prototype={constructor:J0,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?YI():+t)+(e==null?0:+e),!this._next&&ol!==this&&(ol?ol._next=this:Pd=this,ol=this),this._call=r,this._time=t,ey()},stop:function(){this._call&&(this._call=null,this._time=1/0,ey())}};function WI(r,e,t){var n=new J0;return n.restart(r,e,t),n}function S8(){YI(),++ju;for(var r=Pd,e;r;)(e=ks-r._time)>=0&&r._call.call(null,e),r=r._next;--ju}function hw(){ks=(Rd=Ol.now())+_v,ju=al=0;try{S8()}finally{ju=0,C8(),ks=0}}function M8(){var r=Ol.now(),e=r-Rd;e>$I&&(_v-=e,Rd=r)}function C8(){for(var r,e=Pd,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:Pd=t);ol=r,ey(n)}function ey(r){if(!ju){al&&(al=clearTimeout(al));var e=r-ks;e>24?(r<1/0&&(al=setTimeout(hw,r-Ol.now()-_v)),Cf&&(Cf=clearInterval(Cf))):(Cf||(Rd=Ol.now(),Cf=setInterval(M8,$I)),ju=1,XI(hw))}}function jm(r,e,t){r.prototype=e.prototype=t,t.constructor=r}function qI(r,e){var t=Object.create(r.prototype);for(var n in e)t[n]=e[n];return t}function Ql(){}var Dl=.7,Bd=1/Dl,Ou="\\s*([+-]?\\d+)\\s*",Pl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",A8=/^#([0-9a-f]{3,8})$/,T8=new RegExp(`^rgb\\(${Ou},${Ou},${Ou}\\)$`),I8=new RegExp(`^rgb\\(${fa},${fa},${fa}\\)$`),k8=new RegExp(`^rgba\\(${Ou},${Ou},${Ou},${Pl}\\)$`),L8=new RegExp(`^rgba\\(${fa},${fa},${fa},${Pl}\\)$`),N8=new RegExp(`^hsl\\(${Pl},${fa},${fa}\\)$`),O8=new RegExp(`^hsla\\(${Pl},${fa},${fa},${Pl}\\)$`),dw={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};jm(Ql,Rl,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:vw,formatHex:vw,formatHex8:D8,formatHsl:P8,formatRgb:pw,toString:pw});function vw(){return this.rgb().formatHex()}function D8(){return this.rgb().formatHex8()}function P8(){return VI(this).formatHsl()}function pw(){return this.rgb().formatRgb()}function Rl(r){var e,t;return r=(r+"").trim().toLowerCase(),(e=A8.exec(r))?(t=e[1].length,e=parseInt(e[1],16),t===6?gw(e):t===3?new Gn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?Kc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?Kc(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=T8.exec(r))?new Gn(e[1],e[2],e[3],1):(e=I8.exec(r))?new Gn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=k8.exec(r))?Kc(e[1],e[2],e[3],e[4]):(e=L8.exec(r))?Kc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=N8.exec(r))?bw(e[1],e[2]/100,e[3]/100,1):(e=O8.exec(r))?bw(e[1],e[2]/100,e[3]/100,e[4]):dw.hasOwnProperty(r)?gw(dw[r]):r==="transparent"?new Gn(NaN,NaN,NaN,0):null}function gw(r){return new Gn(r>>16&255,r>>8&255,r&255,1)}function Kc(r,e,t,n){return n<=0&&(r=e=t=NaN),new Gn(r,e,t,n)}function R8(r){return r instanceof Ql||(r=Rl(r)),r?(r=r.rgb(),new Gn(r.r,r.g,r.b,r.opacity)):new Gn}function ty(r,e,t,n){return arguments.length===1?R8(r):new Gn(r,e,t,n==null?1:n)}function Gn(r,e,t,n){this.r=+r,this.g=+e,this.b=+t,this.opacity=+n}jm(Gn,ty,qI(Ql,{brighter(r){return r=r==null?Bd:Math.pow(Bd,r),new Gn(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Dl:Math.pow(Dl,r),new Gn(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Gn(ws(this.r),ws(this.g),ws(this.b),Fd(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:yw,formatHex:yw,formatHex8:B8,formatRgb:mw,toString:mw}));function yw(){return`#${ms(this.r)}${ms(this.g)}${ms(this.b)}`}function B8(){return`#${ms(this.r)}${ms(this.g)}${ms(this.b)}${ms((isNaN(this.opacity)?1:this.opacity)*255)}`}function mw(){const r=Fd(this.opacity);return`${r===1?"rgb(":"rgba("}${ws(this.r)}, ${ws(this.g)}, ${ws(this.b)}${r===1?")":`, ${r})`}`}function Fd(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function ws(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function ms(r){return r=ws(r),(r<16?"0":"")+r.toString(16)}function bw(r,e,t,n){return n<=0?r=e=t=NaN:t<=0||t>=1?r=e=NaN:e<=0&&(r=NaN),new Di(r,e,t,n)}function VI(r){if(r instanceof Di)return new Di(r.h,r.s,r.l,r.opacity);if(r instanceof Ql||(r=Rl(r)),!r)return new Di;if(r instanceof Di)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 Di(o,s,u,r.opacity)}function F8(r,e,t,n){return arguments.length===1?VI(r):new Di(r,e,t,n==null?1:n)}function Di(r,e,t,n){this.h=+r,this.s=+e,this.l=+t,this.opacity=+n}jm(Di,F8,qI(Ql,{brighter(r){return r=r==null?Bd:Math.pow(Bd,r),new Di(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Dl:Math.pow(Dl,r),new Di(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 Gn(ig(r>=240?r-240:r+120,i,n),ig(r,i,n),ig(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new Di(xw(this.h),Qc(this.s),Qc(this.l),Fd(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=Fd(this.opacity);return`${r===1?"hsl(":"hsla("}${xw(this.h)}, ${Qc(this.s)*100}%, ${Qc(this.l)*100}%${r===1?")":`, ${r})`}`}}));function xw(r){return r=(r||0)%360,r<0?r+360:r}function Qc(r){return Math.max(0,Math.min(1,r||0))}function ig(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 Um=r=>()=>r;function G8(r,e){return function(t){return r+t*e}}function z8(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 j8(r){return(r=+r)==1?HI:function(e,t){return t-e?z8(e,t,r):Um(isNaN(e)?t:e)}}function HI(r,e){var t=e-r;return t?G8(r,t):Um(isNaN(r)?e:r)}const ww=function r(e){var t=j8(e);function n(i,a){var o=t((i=ty(i)).r,(a=ty(a)).r),s=t(i.g,a.g),u=t(i.b,a.b),f=HI(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 ZI(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 KI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function U8(r,e){return(KI(e)?ZI:QI)(r,e)}function QI(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]=Gd(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 $8(r,e){var t=new Date;return r=+r,e=+e,function(n){return t.setTime(r*(1-n)+e*n),t}}function ry(r,e){return r=+r,e=+e,function(t){return r*(1-t)+e*t}}function X8(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]=Gd(r[i],e[i]):n[i]=e[i];return function(a){for(i in t)n[i]=t[i](a);return n}}var ny=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ag=new RegExp(ny.source,"g");function Y8(r){return function(){return r}}function W8(r){return function(e){return r(e)+""}}function q8(r,e){var t=ny.lastIndex=ag.lastIndex=0,n,i,a,o=-1,s=[],u=[];for(r=r+"",e=e+"";(n=ny.exec(r))&&(i=ag.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:ry(n,i)})),t=ag.lastIndex;return t<e.length&&(a=e.slice(t),s[o]?s[o]+=a:s[++o]=a),s.length<2?u[0]?W8(u[0].x):Y8(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 Gd(r,e){var t=typeof e,n;return e==null||t==="boolean"?Um(e):(t==="number"?ry:t==="string"?(n=Rl(e))?(e=n,ww):q8:e instanceof Rl?ww:e instanceof Date?$8:KI(e)?ZI:Array.isArray(e)?QI:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?X8:ry)(r,e)}function V8(r){return+r}function H8(r){return r*r}function Z8(r){return r*(2-r)}function Ew(r){return((r*=2)<=1?r*r:--r*(2-r)+1)/2}function K8(r){return r*r*r}function Q8(r){return--r*r*r+1}function _w(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var $m=3,J8=function r(e){e=+e;function t(n){return Math.pow(n,e)}return t.exponent=r,t}($m),ej=function r(e){e=+e;function t(n){return 1-Math.pow(1-n,e)}return t.exponent=r,t}($m),Sw=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}($m),JI=Math.PI,ek=JI/2;function tj(r){return+r==1?1:1-Math.cos(r*ek)}function rj(r){return Math.sin(r*ek)}function Mw(r){return(1-Math.cos(JI*r))/2}function Mo(r){return(Math.pow(2,-10*r)-.0009765625)*1.0009775171065494}function nj(r){return Mo(1-+r)}function ij(r){return 1-Mo(r)}function Cw(r){return((r*=2)<=1?Mo(1-r):2-Mo(r-1))/2}function aj(r){return 1-Math.sqrt(1-r*r)}function oj(r){return Math.sqrt(1- --r*r)}function Aw(r){return((r*=2)<=1?1-Math.sqrt(1-r*r):Math.sqrt(1-(r-=2)*r)+1)/2}var iy=4/11,sj=6/11,uj=8/11,fj=3/4,lj=9/11,cj=10/11,hj=15/16,dj=21/22,vj=63/64,Jc=1/iy/iy;function pj(r){return 1-Bl(1-r)}function Bl(r){return(r=+r)<iy?Jc*r*r:r<uj?Jc*(r-=sj)*r+fj:r<cj?Jc*(r-=lj)*r+hj:Jc*(r-=dj)*r+vj}function gj(r){return((r*=2)<=1?1-Bl(1-r):Bl(r-1)+1)/2}var Xm=1.70158,yj=function r(e){e=+e;function t(n){return(n=+n)*n*(e*(n-1)+n)}return t.overshoot=r,t}(Xm),mj=function r(e){e=+e;function t(n){return--n*n*((n+1)*e+n)+1}return t.overshoot=r,t}(Xm),Tw=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}(Xm),Uu=2*Math.PI,Ym=1,Wm=.3,bj=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Uu);function i(a){return e*Mo(- --a)*Math.sin((n-a)/t)}return i.amplitude=function(a){return r(a,t*Uu)},i.period=function(a){return r(e,a)},i}(Ym,Wm),Iw=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Uu);function i(a){return 1-e*Mo(a=+a)*Math.sin((a+n)/t)}return i.amplitude=function(a){return r(a,t*Uu)},i.period=function(a){return r(e,a)},i}(Ym,Wm),xj=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Uu);function i(a){return((a=a*2-1)<0?e*Mo(-a)*Math.sin((n-a)/t):2-e*Mo(a)*Math.sin((n+a)/t))/2}return i.amplitude=function(a){return r(a,t*Uu)},i.period=function(a){return r(e,a)},i}(Ym,Wm);const wj=Object.freeze(Object.defineProperty({__proto__:null,easeBack:Tw,easeBackIn:yj,easeBackInOut:Tw,easeBackOut:mj,easeBounce:Bl,easeBounceIn:pj,easeBounceInOut:gj,easeBounceOut:Bl,easeCircle:Aw,easeCircleIn:aj,easeCircleInOut:Aw,easeCircleOut:oj,easeCubic:_w,easeCubicIn:K8,easeCubicInOut:_w,easeCubicOut:Q8,easeElastic:Iw,easeElasticIn:bj,easeElasticInOut:xj,easeElasticOut:Iw,easeExp:Cw,easeExpIn:nj,easeExpInOut:Cw,easeExpOut:ij,easeLinear:V8,easePoly:Sw,easePolyIn:J8,easePolyInOut:Sw,easePolyOut:ej,easeQuad:Ew,easeQuadIn:H8,easeQuadInOut:Ew,easeQuadOut:Z8,easeSin:Mw,easeSinIn:tj,easeSinInOut:Mw,easeSinOut:rj},Symbol.toStringTag,{value:"Module"}));var Ej={};function _j(r){return Ej[r.toLowerCase()]||wj[r]}var Sj=function(r){return["fill","stroke","fillStyle","strokeStyle"].includes(r)},Mj=function(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)},kw=[1,0,0,0,1,0,0,0,1];function Cj(r,e,t){var n={},i=e.fromAttrs,a=e.toAttrs;if(!r.destroyed){var o;for(var s in a)if(!So(i[s],a[s]))if(s==="path"){var u=a[s],f=i[s];u.length>f.length?(u=ku(a[s]),f=ku(i[s]),f=NI(f,u),f=Z0(f,u),e.fromAttrs.path=f,e.toAttrs.path=u):e.pathFormatted||(u=ku(a[s]),f=ku(i[s]),f=Z0(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++)dt(c[v])&&h&&dt(h[v])?(o=Gd(h[v],c[v]),d.push(o(t))):d.push(c[v]);n[s].push(d)}}else if(s==="matrix"){var p=U8(i[s]||kw,a[s]||kw),g=p(t);n[s]=g}else Sj(s)&&Mj(a[s])?n[s]=a[s]:Pr(a[s])||(o=Gd(i[s],a[s]),n[s]=o(t));r.attr(n)}}function Aj(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=_j(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 Cj(r,e,a);return!1}var Tj=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=WI(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=Aj(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}(),Ij=40,Lw=0,Nw=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function Ow(r,e,t){t.name=e,t.target=r,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}function kj(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&&RI(r,n)){t.bubbles=!1;return}t.name=e,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}}var Lj=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");_e(Nw,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");_e(Nw,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 DI(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===Lw&&(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===Lw){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>Ij?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,Ow(i,e,s);for(var u=i.getParent();u;)u.emitDelegation(e,s),s.propagationStopped||kj(u,e,s),s.propagationPath.push(u),u=u.getParent()}else{var f=this.canvas;Ow(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}(),Dw="px",Pw=BI(),Nj=Pw&&Pw.name==="firefox",tk=function(r){Rt(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");Fe(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 Lj({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new Tj(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,n){var i=this.get("el");ow&&(i.style.width=t+Dw,i.style.height=n+Dw)},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");ow&&n&&(n.style.cursor=t)},e.prototype.getPointByEvent=function(t){var n=this.get("supportCSSTransform");if(n){if(Nj&&!ht(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!ht(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}(UI),rk=function(r){Rt(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}(UI),nk=function(r){Rt(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=ys(n,[t.minX,t.minY]),f=ys(n,[t.maxX,t.minY]),l=ys(n,[t.minX,t.maxY]),c=ys(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,x=i-v+g,b=o+v+g,w=a-v+m,E=s+v+m;i=Math.min(i,x),o=Math.max(o,b),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}(GI),ik=new Map;function ga(r,e){ik.set(r,e)}function ak(r){return ik.get(r)}function ok(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 sk(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 Tn(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function cd(r,e){return Math.abs(r-e)<.001}function tf(r,e){var t=ca(r),n=ca(e),i=la(r),a=la(e);return{x:t,y:n,width:i-t,height:a-n}}function Sv(r){return(r+Math.PI*2)%(Math.PI*2)}const xn={box:function(r,e,t,n){return tf([r,t],[e,n])},length:function(r,e,t,n){return Tn(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 Tn(r,e,i,a);var s=(t-r)*(t-r)+(n-e)*(n-e);return o>s?Tn(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(Tm(o,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-e)*(a-e));var s=[-o[1],o[0]];_o(s,s);var u=[i-r,a-e];return Math.abs(Am(u,s))},tangentAngle:function(r,e,t,n){return Math.atan2(n-e,t-r)}};var Oj=1e-4;function uk(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=Tn(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<Oj);h++){var y=o-c,m=o+c,v=[i.apply(null,r.concat([y])),i.apply(null,e.concat([y]))],p=Tn(u[0],u[1],v[0],v[1]);if(y>=0&&p<s)o=y,s=p;else{var x=[i.apply(null,r.concat([m])),i.apply(null,e.concat([m]))],b=Tn(u[0],u[1],x[0],x[1]);m<=1&&b<s?(o=m,s=b):c*=.5}}return{x:i.apply(null,r.concat([o])),y:i.apply(null,e.concat([o]))}}function Dj(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+=Tn(a,o,s,u)}return t/2}function po(r,e,t,n){var i=1-n;return i*i*r+2*n*i*e+n*n*t}function Rw(r,e,t){var n=r+t-2*e;if(cd(n,0))return[.5];var i=(r-e)/n;return i<=1&&i>=0?[i]:[]}function Bw(r,e,t,n){return 2*(1-n)*(e-r)+2*n*(t-e)}function fk(r,e,t,n,i,a,o){var s=po(r,t,i,o),u=po(e,n,a,o),f=xn.pointAt(r,e,t,n,o),l=xn.pointAt(t,n,i,a,o);return[[r,e,f.x,f.y,s,u],[s,u,l.x,l.y,i,a]]}function ay(r,e,t,n,i,a,o){if(o===0)return(Tn(r,e,t,n)+Tn(t,n,i,a)+Tn(r,e,i,a))/2;var s=fk(r,e,t,n,i,a,.5),u=s[0],f=s[1];return u.push(o-1),f.push(o-1),ay.apply(null,u)+ay.apply(null,f)}const lk={box:function(r,e,t,n,i,a){var o=Rw(r,t,i)[0],s=Rw(e,n,a)[0],u=[r,i],f=[e,a];return o!==void 0&&u.push(po(r,t,i,o)),s!==void 0&&f.push(po(e,n,a,s)),tf(u,f)},length:function(r,e,t,n,i,a){return ay(r,e,t,n,i,a,3)},nearestPoint:function(r,e,t,n,i,a,o,s){return uk([r,t,i],[e,n,a],o,s,po)},pointDistance:function(r,e,t,n,i,a,o,s){var u=this.nearestPoint(r,e,t,n,i,a,o,s);return Tn(u.x,u.y,o,s)},interpolationAt:po,pointAt:function(r,e,t,n,i,a,o){return{x:po(r,t,i,o),y:po(e,n,a,o)}},divide:function(r,e,t,n,i,a,o){return fk(r,e,t,n,i,a,o)},tangentAngle:function(r,e,t,n,i,a,o){var s=Bw(r,t,i,o),u=Bw(e,n,a,o),f=Math.atan2(u,s);return Sv(f)}};function go(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 Fw(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(cd(i,0))cd(a,0)||(u=-o/a,u>=0&&u<=1&&s.push(u));else{var c=a*a-4*i*o;cd(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 ck(r,e,t,n,i,a,o,s,u){var f=go(r,t,i,o,u),l=go(e,n,a,s,u),c=xn.pointAt(r,e,t,n,u),h=xn.pointAt(t,n,i,a,u),d=xn.pointAt(i,a,o,s,u),v=xn.pointAt(c.x,c.y,h.x,h.y,u),p=xn.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 oy(r,e,t,n,i,a,o,s,u){if(u===0)return Dj([r,t,i,o],[e,n,a,s]);var f=ck(r,e,t,n,i,a,o,s,.5),l=f[0],c=f[1];return l.push(u-1),c.push(u-1),oy.apply(null,l)+oy.apply(null,c)}const pl={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(go(r,t,i,o,l[h]));for(var h=0;h<c.length;h++)f.push(go(e,n,a,s,c[h]));return tf(u,f)},length:function(r,e,t,n,i,a,o,s){return oy(r,e,t,n,i,a,o,s,3)},nearestPoint:function(r,e,t,n,i,a,o,s,u,f,l){return uk([r,t,i,o],[e,n,a,s],u,f,go,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 Tn(c.x,c.y,u,f)},interpolationAt:go,pointAt:function(r,e,t,n,i,a,o,s,u){return{x:go(r,t,i,o,u),y:go(e,n,a,s,u)}},divide:function(r,e,t,n,i,a,o,s,u){return ck(r,e,t,n,i,a,o,s,u)},tangentAngle:function(r,e,t,n,i,a,o,s,u){var f=Fw(r,t,i,o,u),l=Fw(e,n,a,s,u);return Sv(Math.atan2(l,f))}};function Gw(r,e){var t=Math.abs(r);return e>0?t:t*-1}const Pj={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,x=(d-h)*Math.pow(Math.sin(v),3)/s,b=p-m,w=g-x,E=l-m,S=c-x,_=Math.hypot(w,b),C=Math.hypot(S,E),M=_*Math.asin((b*S-w*E)/(_*C)),A=M/Math.sqrt(h+d-p*p-g*g);v+=A,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:r+Gw(p,u),y:e+Gw(g,f)}},pointDistance:function(r,e,t,n,i,a){var o=this.nearestPoint(r,e,t,n,i,a);return Tn(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 Sv(o)}};function Rj(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 Bj(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 Fj(r,e,t){return Math.atan(-e/r*Math.tan(t))}function Gj(r,e,t){return Math.atan(e/(r*Math.tan(t)))}function zw(r,e,t,n,i,a){return t*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function jw(r,e,t,n,i,a){return t*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function zj(r,e,t,n){var i=Math.atan2(n*r,t*e);return(i+Math.PI*2)%(Math.PI*2)}function Uw(r,e,t){return{x:r*Math.cos(t),y:e*Math.sin(t)}}function $w(r,e,t){var n=Math.cos(t),i=Math.sin(t);return[r*n-e*i,r*i+e*n]}const jj={box:function(r,e,t,n,i,a,o){for(var s=Fj(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=zw(r,e,t,n,i,l[c]);d<u&&(u=d),d>f&&(f=d)}for(var v=Gj(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 x=jw(r,e,t,n,i,y[c]);x<p&&(p=x),x>g&&(g=x)}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=$w(s-r,u-e,-i),l=f[0],c=f[1],h=Pj.nearestPoint(0,0,t,n,l,c),d=zj(t,n,h.x,h.y);d<a?h=Uw(t,n,a):d>o&&(h=Uw(t,n,o));var v=$w(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 Tn(f.x,f.y,s,u)},pointAt:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a;return{x:zw(r,e,t,n,i,u),y:jw(r,e,t,n,i,u)}},tangentAngle:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a,f=Rj(r,e,t,n,i,a,o,u),l=Bj(r,e,t,n,i,a,o,u);return Sv(Math.atan2(l,f))}};function hk(r){for(var e=0,t=[],n=0;n<r.length-1;n++){var i=r[n],a=r[n+1],o=Tn(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 Uj(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+=Tn(n[0],n[1],i[0],i[1])}return e}function $j(r,e){if(e>1||e<0||r.length<2)return null;var t=hk(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=xn.pointAt(f[0],f[1],l[0],l[1],h);break}a+=c}return o}function Xj(r,e){if(e>1||e<0||r.length<2)return 0;for(var t=hk(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 Yj(r,e,t){for(var n=1/0,i=0;i<r.length-1;i++){var a=r[i],o=r[i+1],s=xn.pointDistance(a[0],a[1],o[0],o[1],e,t);s<n&&(n=s)}return n}const dk={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 tf(e,t)},length:function(r){return Uj(r)},pointAt:function(r,e){return $j(r,e)},pointDistance:function(r,e,t){return Yj(r,e,t)},tangentAngle:function(r,e){return Xj(r,e)}};function Xw(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 qm(r,e){var t=r.get("startArrowShape"),n=r.get("endArrowShape"),i=null,a=null;return t&&(i=t.getCanvasBBox(),e=Xw(e,i)),n&&(a=n.getCanvasBBox(),e=Xw(e,a)),e}function Wj(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=tf(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=qm(r,h),{x:h.minX,y:h.minY,width:h.maxX-h.minX,height:h.maxY-h.minY}}function qj(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 tf(n,i)}var sg=null;function vk(){if(!sg){var r=document.createElement("canvas");r.width=1,r.height=1,sg=r.getContext("2d")}return sg}function pk(r,e,t){var n=1;if(Fe(r)&&(n=r.split(`
|
|
3
|
+
`).length),n>1){var i=Vj(e,t);return e*n+i*(n-1)}return e}function Vj(r,e){return e?e-r:r*.14}function Hj(r,e){var t=vk(),n=0;if(ht(r)||r==="")return n;if(t.save(),t.font=e,Fe(r)&&r.includes(`
|
|
4
|
+
`)){var i=r.split(`
|
|
5
|
+
`);_e(i,function(a){var o=t.measureText(a).width;n<o&&(n=o)})}else n=t.measureText(r).width;return t.restore(),n}function gk(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 Zj(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=gk(e));var u=Hj(i,s),f;if(!u)f={x:t,y:n,width:0,height:0};else{var l=e.textAlign,c=e.textBaseline,h=pk(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 Kj=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig,Qj=/[^\s\,]+/ig;function Jj(r){var e=r||[];if(mt(e))return e;if(Fe(e))return e=e.match(Kj),_e(e,function(t,n){if(t=t.match(Qj),t[0].length>1){var i=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=i}_e(t,function(a,o){isNaN(a)||(t[o]=+a)}),e[n]=t}),e}function eU(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=co([0,0],u,p),f=ho([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=ad(m,s,o),m=An(m,m,e);var x=Id(p,o),b=Id(p,s),w=x+b;w!==0&&(x/=w,b/=w);var E=An([0,0],m,-x),S=An([0,0],m,b);c=mn([0,0],p,E),l=mn([0,0],p,S),l=co([0,0],l,ho([0,0],s,p)),l=ho([0,0],l,co([0,0],s,p)),E=ad([0,0],l,p),E=An([0,0],E,-x/b),c=mn([0,0],p,E),c=co([0,0],c,ho([0,0],o,p)),c=ho([0,0],c,co([0,0],o,p)),S=ad([0,0],p,c),S=An([0,0],S,b/x),l=mn([0,0],p,S),a&&(c=ho([0,0],c,u),c=co([0,0],c,f),l=ho([0,0],l,u),l=co([0,0],l,f)),i.push(h),i.push(c),h=l}}return t&&i.push(i.shift()),i}function yk(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=eU(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 gl=`
|
|
6
|
+
\v\f\r \u2028\u2029`,tU=new RegExp("([a-z])["+gl+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+gl+"]*,?["+gl+"]*)+)","ig"),rU=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+gl+"]*,?["+gl+"]*","ig");function sy(r){if(!r)return null;if(mt(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(tU,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(rU,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 nU=/[a-z]/;function Yw(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function mk(r){var e=sy(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(nU.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 x=Yw([v[1],v[2]],[v[3],v[4]]);p=["Q",x[0],x[1],o,s];break;case"S":o=p[p.length-2],s=p[p.length-1];var b=v.length,w=Yw([v[b-4],v[b-3]],[v[b-2],v[b-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 eh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function uy(r,e){return eh(r)*eh(e)?(r[0]*e[0]+r[1]*e[1])/(eh(r)*eh(e)):1}function Ww(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(uy(r,e))}function fy(r,e){return r[0]===e[0]&&r[1]===e[1]}function iU(r,e){var t=e[1],n=e[2],i=yv(mv(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,x=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,b=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=Ww([1,0],b),S=Ww(b,w);return uy(b,w)<=-1&&(S=Math.PI),uy(b,w)>=1&&(S=0),o===0&&S>0&&(S=S-2*Math.PI),o===1&&S<0&&(S=S+2*Math.PI),{cx:m,cy:x,rx:fy(r,[f,l])?0:t,ry:fy(r,[f,l])?0:n,startAngle:E,endAngle:E+S,xRotation:i,arcFlag:a,sweepFlag:o}}function qw(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function bk(r){r=Jj(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=iU(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]&&fy(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=qw(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=qw(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 x=.001,b=l.arcParams||{},w=b.cx,E=w===void 0?0:w,S=b.cy,_=S===void 0?0:S,C=b.rx,M=C===void 0?0:C,A=b.ry,T=A===void 0?0:A,I=b.sweepFlag,L=I===void 0?0:I,N=b.startAngle,O=N===void 0?0:N,B=b.endAngle,W=B===void 0?0:B;L===0&&(x*=-1);var D=M*Math.cos(O-x)+E,P=T*Math.sin(O-x)+_;l.startTangent=[D-i[0],P-i[1]];var R=M*Math.cos(O+W+x)+E,X=T*Math.sin(O+W-x)+_;l.endTangent=[v[0]-R,v[1]-X]}e.push(l)}return e}function aU(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=lk.box(f[0],f[1],u[1],u[2],u[3],u[4]);break;case"C":l=pl.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=jj.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=ca(t),d=ca(n),v=la(t),p=la(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=th(o,e),h=h-g.xExtra):s[0]===v&&(g=th(o,e),v=v+g.xExtra),s[1]===d?(g=th(o,e),d=d-g.yExtra):s[1]===p&&(g=th(o,e),p=p+g.yExtra)}return{x:h,y:d,width:v-h,height:p-d}}function th(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||EA(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 oU(r){var e=r.attr(),t=e.path,n=e.stroke,i=n?e.lineWidth:0,a=r.get("segments")||bk(t),o=aU(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=qm(r,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function sU(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=qm(r,l),{x:l.minX,y:l.minY,width:l.maxX-l.minX,height:l.maxY-l.minY}}function uU(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}}ga("rect",ok);ga("image",ok);ga("circle",sk);ga("marker",sk);ga("polyline",Wj);ga("polygon",qj);ga("text",Zj);ga("path",oU);ga("line",sU);ga("ellipse",uU);var fU=function(r){Rt(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}(DI),ly=function(e){return"".concat(e,"-").concat(Math.random()).concat(Date.now())},Vm=function(e){if(mt(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(dt(e))return[e,e,e,e];if(Fe(e)){var t=parseInt(e,10);return[t,t,t,t]}return[0,0,0,0]},lU=function(e){var t=new fU(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},cU=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},aa=function(e){return Number.isNaN(Number(e))},xk=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}},hU=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],x=m.source,b=m.target;l[y]||(v===b&&p===x?(f[g].push(m),l[y]=!0,c["".concat(x,"|").concat(b,"|").concat(f[g].length-1)]=!0):v===x&&p===b&&(f[g].push(m),l[y]=!0))}}}for(var w in f)for(var E=f[w],S=E.length,_=0;_<S;_++){var C=E[_];if(C.source===C.target){a&&(C.type=a),C.loopCfg={position:u[_%8],dist:Math.floor(_/8)*20+50};continue}if(S===1&&i&&C.source!==C.target){C.type=i;continue}C.type=n;var M=(_%2===0?1:-1)*(c["".concat(C.source,"|").concat(C.target,"|").concat(_)]?-1:1);S%2===1?C.curveOffset=M*Math.ceil(_/2)*s:C.curveOffset=M*(Math.floor(_/2)*s+t)}return e};const dU=Object.freeze(Object.defineProperty({__proto__:null,calculationItemsBBox:xk,cloneEvent:lU,formatPadding:Vm,isNaN:aa,isViewportChanged:cU,processParallelEdges:hU,uniqueId:ly},Symbol.toStringTag,{value:"Module"}));var Vi={};const vU=da(G6);var Vw;function pU(){if(Vw)return Vi;Vw=1,Object.defineProperty(Vi,"__esModule",{value:!0});var r=vU;function e(f,l,c){var h=[0,0,0,0,0,0,0,0,0];return r.mat3.fromTranslation(h,c),r.mat3.multiply(f,h,l)}Vi.leftTranslate=e;function t(f,l,c){var h=[0,0,0,0,0,0,0,0,0];return r.mat3.fromRotation(h,c),r.mat3.multiply(f,h,l)}Vi.leftRotate=t;function n(f,l,c){var h=[0,0,0,0,0,0,0,0,0];return r.mat3.fromScaling(h,c),r.mat3.multiply(f,h,l)}Vi.leftScale=n;function i(f,l,c){return r.mat3.multiply(f,c,l)}function a(f,l){for(var c=f?[].concat(f):[1,0,0,0,1,0,0,0,1],h=0,d=l.length;h<d;h++){var v=l[h];switch(v[0]){case"t":e(c,c,[v[1],v[2]]);break;case"s":n(c,c,[v[1],v[2]]);break;case"r":t(c,c,v[1]);break;case"m":i(c,c,v[1]);break}}return c}Vi.transform=a;function o(f,l){return f[0]*l[1]-l[0]*f[1]}Vi.direction=o;function s(f,l,c){var h=r.vec2.angle(f,l),d=o(f,l)>=0;return c?d?Math.PI*2-h:h:d?h:Math.PI*2-h}Vi.angleTo=s;function u(f,l,c){return c?(f[0]=l[1],f[1]=-1*l[0]):(f[0]=-1*l[1],f[1]=l[0]),f}return Vi.vertical=u,Vi}var Hw=pU(),gU=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(b){var w=b.getModel(),E=w.x,S=w.y;s>E&&(s=E),u>S&&(u=S),f<E&&(f=E),l<S&&(l=S)});var c=i.getMatrix()||[1,0,0,0,1,0,0,0,1],h=Nu({x:s,y:u},c),d=h.x,v=h.y,p=Nu({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(),x={x:a.x+a.width/2,y:a.y+a.height/2};n.translate(m.x-x.x,m.y-x.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(!(aa(c)||aa(h))){var d=Hw.transform(l,[["t",c,h]]);if(!u){var v=Nl({animateCfg:n,callback:function(){f.emit("viewportchange",{action:"translate",matrix:d})}});e.animate(function(b){return{matrix:j0(t,d,b)}},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=Hw.transform(d,[["t",-a.x,-a.y],["s",y,y],["t",a.x,a.y]]),x=Nl({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(b){return{matrix:j0(t,m,b)}},x)}},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 S=E.getModel(),_=S.x,C=S.y;c>_&&(c=_),h>C&&(h=C),d<_&&(d=_),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,x=y;if(y>m&&(x=m),e)this.animatedFitView(s,u,t,f,p,g,x,!0);else{var b=p.x-g.x,w=p.y-g.y;if(aa(b)||aa(w))return;n.translate(b,w),n.zoom(x,p)||console.warn("zoom failed, ratio out of range, ratio: %f",x)}}},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,x=1/0,b=-1/0,w=-1/0;y.forEach(function(L){var N=L.getModel(),O=N.x,B=N.y;m>O&&(m=O),x>B&&(x=B),b<O&&(b=O),w<B&&(w=B)}),g={minX:m,maxX:b,minY:x,maxY:w,width:b-m,height:w-x,x:m,y:x}}else g=v.getCanvasBBox();if(!(g.width===0||g.height===0)){var E=this.getViewCenter(),S={x:g.x+g.width/2,y:g.y+g.height/2},_=(h-c[1]-c[3])/g.width,C=(d-c[0]-c[2])/g.height,M;if(s==="x"?M=_:s==="y"?M=C:M=f==="max"?Math.max(_,C):Math.min(_,C),a&&(M=M<1?M:1),t)this.animatedFitView(v,p,n,g,E,S,M,!0);else{var A=l.getZoom(),T=A*M,I=l.get("minZoom");T<I&&(T=I,console.warn("fitview failed, ratio out of range, ratio: %f",M,"graph minzoom has been used instead")),l.translate(E.x-S.x,E.y-S.y),l.zoomTo(T,E)}}},r.prototype.getFormatPadding=function(){var e=this.graph.get("fitViewPadding");return Vm(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},z({},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=pI({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]),Nu({x:e,y:t},n)},r.prototype.focus=function(e,t,n){if(Fe(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,x=(u-o[0]-o[2])/c.height,b=m;m>x&&(b=x),n?this.animatedFitView(f,l,i,c,g,y,b,t):(a.translate(g.x-y.x,g.y-y.y),t&&!a.zoom(b,g)&&console.warn("zoom failed, ratio out of range, ratio: %f",b))}}},r.prototype.changeSize=function(e,t){var n=this.graph;if(!dt(e)||!dt(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 cy(r){"@babel/helpers - typeof";return cy=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},cy(r)}function Zw(r){if(typeof r!="string")return r;var e=function(S){if(typeof S!="string")return S;try{return JSON.parse(S.trim())}catch{return S.trim()}},t=e(r);if(typeof t!="string")return t;for(var n=function(S){return S[S.length-1]},i=r.trim(),a=[],o=[],s=function(){for(var S=[],_=0;_<arguments.length;_++)S[_]=arguments[_];return S.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 x=e(c);m.push(x),f=x,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 b={},w=1;w<m.length;w+=2)b[m[w-1]]=m[w];a.pop(),a.length&&n(a).push(b),o.pop(),f=b}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 yU=function(e){return e.split("-").reduce(function(t,n){return t+n.charAt(0).toUpperCase()+n.slice(1)})},mU=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=Pa(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 wk(r,e){var t={},n=r.getAttributeNames&&r.getAttributeNames()||[],i=r.children&&Array.from(r.children).map(function(s){return wk(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=yU(s),f=r.getAttribute(s);try{if(u==="style"||u==="attrs"){var l=Zw(f);t=z(z({},t),l)}else a[u]=Zw(f)}catch(c){if(u==="style")throw c;a[u]=f}}),a.attrs=t,e&&e.style&&a.name&&cy(e.style[a.name])==="object"&&(a.attrs=z(z({},a.attrs),e.style[a.name])),e&&e.style&&a.keyshape&&(a.attrs=z(z({},a.attrs),e.style)),i.length&&(a.children=i),a}function bU(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=AI(i.text,i.fontSize||12)[0],o=16,a.y+=o,a.height=o,a.width=s,r.attrs=z({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 Ek(r,e){var t;e===void 0&&(e={x:0,y:0});var n=z({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=z({},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=Ek(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=bU(r,e,n),r.attrs=z(z({},r.attrs),r.bbox),r}function _k(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(_k(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 Kw(r){var e={},t=function(i){var a=typeof r=="function"?r(i):r,o=mU(a)(i),s=document.createElement("div");s.innerHTML=o;var u=s.children[0],f=Ek(wk(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=un(l,["attrs","bbox","type","children"]);if(l.type!=="group"){var y=a.addShape(l.type,z({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=_k(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(x){return x.attrs.key===g});switch(p.action){case"change":if(y){var m=p.val.keyshape?a.getOriginStyle():{};y.attr(z(z({},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(x){return v(x)})};d(l),e[i.id].push(u)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var ug={};function Qw(r){return ug[r]||(ug[r]=zu(r)),ug[r]}var xU={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)}},fg={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}},Ir=function(){function r(){}return r.registerFactory=function(e,t){var n=Qw(e),i=xU,a=z(z({},i),t);return r[n]=a,a.className=n,a},r.getFactory=function(e){var t=Qw(e);return r[t]},r.registerNode=function(e,t,n){var i=r.Node,a;if(typeof t=="string"||typeof t=="function"){var o=Kw(t);a=z(z({},i.getShape("single-node")),o)}else if(t.jsx){var s=t.jsx,o=Kw(s);a=z(z(z({},i.getShape("single-node")),o),t)}else{i.getShape(n);var u=n?i.getShape(n):fg;a=z(z({},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):fg,o=z(z({},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):fg,o=z(z({},a),t);return o.type=e,o.itemType="combo",i[e]=o,o},r}();Ir.registerFactory("node",{defaultShapeType:"circle"});Ir.registerFactory("edge",{defaultShapeType:"line"});Ir.registerFactory("combo",{defaultShapeType:"circle"});var lg="bboxCache",cg="bboxCanvasCache",Sk=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=ly(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=Tr({},f.stateStyles,l),this.set("styles",l)}}}return r.prototype.calculateBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Dd(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=Dd(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],x=m.get("name"),b=m.attr();if(x&&x!==a){var w=v[x];d[x]||(d[x]={}),w?Object.keys(b).forEach(function(_){var C=b[_];C!==w[_]&&(d[x][_]=C)}):d[x]=m.get("type")!=="image"?Jt(b):i.getShapeStyleByName(x)}else{var E=m.attr(),S={};Object.keys(v).forEach(function(_){var C=v[_];(_===a||!bn(C))&&(S[_]=C)}),Object.keys(E).forEach(function(_){var C=E[_];S[_]!==C&&(a?d[a][_]=C:d[_]=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"?Jt(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=ly("shape");u.set("name",h),e.shapeMap[h]=u,o[h]=f!=="image"?Jt(u.attr()):i.getShapeStyleByName(l)}}}i.set("originStyle",o)}},r.prototype.restoreStates=function(e,t){var n=this,i=n.get("states");_e(i,function(a){e.setState(t,a,!0,n)})},r.prototype.init=function(){var e=Ir.getFactory(this.get("type"));this.set("shapeFactory",e)},r.prototype.get=function(e){return this._cfg[e]},r.prototype.set=function(e,t){bn(e)?this._cfg=z(z({},this._cfg),e):this._cfg[e]=t},r.prototype.getDefaultCfg=function(){return{}},r.prototype.clearCache=function(){this.set(lg,null),this.set(cg,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 _e(n.attr(),function(a,o){(o!=="img"||Fe(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=z(z({},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"):(_e(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;Fe(t)&&(a="".concat(e,":").concat(t),o="".concat(e,":"));var s=n;if(Zl(t)){var u=n.indexOf(o);if(t){if(u>-1)return;n.push(a)}else u>-1&&n.splice(u,1)}else if(Fe(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),Fe(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;bt(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(),gI(a,{x:n,y:i}),this.clearCache(),!0)},r.prototype.getBBox=function(){var e=this.get(lg);return e||(e=this.calculateBBox(),this.set(lg,e)),e},r.prototype.getCanvasBBox=function(){var e=this.get(cg);return e||(e=this.calculateCanvasBBox(),this.set(cg,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}(),rh={source:"start",target:"end"},Hi="Node",uu="Point",wU="Anchor",Mk=function(r){Rt(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=rh[t]+uu,a=t+Hi,o=this.get(a);o&&!o.destroyed&&o.removeEdge(this),bn(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=rh[t]+uu,o=t+Hi,s=this.get(a);if(!s){var u=this.get(o),f=t+wU,l=this.getPrePoint(t,i),c=n[f];ht(c)||(s=u.getLinkPointByAnchor(c)),s=s||u.getLinkPoint(l),ht(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+Hi,i=rh[t]+uu,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+Hi,i=rh[t]+uu,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(Hi)),i=this.get("target".concat(Hi));return n?delete t["source".concat(Hi)]:t.source=this.get("start".concat(uu)),i?delete t["target".concat(Hi)]:t.target=this.get("end".concat(uu)),!Fe(t.source)&&!bn(t.source)&&(t.source=t.source.getID()),!Fe(t.target)&&!bn(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;bt(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(Hi)),n=this.get("target".concat(Hi));t&&!t.destroyed&&t.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),r.prototype.destroy.call(this)},e}(Sk),hg="anchorPointsCache",EU="bboxCache",Hm=function(r){Rt(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=Nd(t[0],n),s=0;s<t.length;s++){var u=t[s],f=Nd(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=dI({x:o,y:s,r:u.width/2},t);break;case"ellipse":l=vI({x:o,y:s,rx:u.width/2,ry:u.height/2},t);break;default:l=hI(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(hg);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)||[];_e(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(hg,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(EU,null),this.set(hg,null)},e.prototype.getUpdateType=function(t){var n,i,a,o,s;if(t){var u=!ht(t.x),f=!ht(t.y),l=Object.keys(t);if(l.length===1&&(u||f)||l.length===2&&u&&f)return"move";if(dt(t.x)||dt(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}(Sk),Jw="bboxCache",eE="bboxCanvasCache",nh="sizeCache",tE="anchorPointsCache",Ck=function(r){Rt(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=dt(t.size)?[t.size,t.size]:t.size,s=dt(t.fixSize)?[t.fixSize,t.fixSize]:t.fixSize,u=o||s||lt.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=z(z(z({},n),t.style),f);var l=t.padding||lt.defaultCombo.padding;return dt(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(nh,f),a}return t},e.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var t=this.get("keyShape"),n=this.get("group"),i=this.get(Jw)||{},a=i.x,o=i.x,s=this.get(nh),u=Dd(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(nh,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(tE,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(eE,null);var t=this.calculateCanvasBBox();return t},e.prototype.clearCache=function(){this.set(Jw,null),this.set(eE,null),this.set(tE,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(nh,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},e}(Hm),ih="node",ah="edge",rE="vedge",Af="combo",_U="default",nE="Mapper",Sa="stateStyles",SU=function(){function r(e){var t=this;this.edgeToBeUpdateMap={},this.throttleRefresh=Tl(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===rE?ah:e,a=n.get("".concat(i,"Group"))||n.get("group"),o=zu(i),s=null,u=n.get(i+zu(Sa))||{},f=n.get(_U+o);t[Sa]&&(u=t[Sa]),f&&_e(f,function(E,S){wn(E)&&!mt(E)?t[S]=Tr({},E,t[S]):mt(E)?t[S]=t[S]||Jt(f[S]):t[S]=t[S]||f[S]});var l=n.get(i+nE);if(l){var c=l(t);c[Sa]&&(u=c[Sa],delete c[Sa]),_e(c,function(E,S){wn(E)&&!mt(E)?t[S]=Tr({},t[S],E):t[S]=c[S]||t[S]})}if(n.emit("beforeadditem",{type:e,model:t}),e===ah||e===rE){var h=void 0,d=void 0;if(h=t.source,d=t.target,h&&Fe(h)&&(h=n.findById(h)),d&&Fe(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 Mk({model:t,source:h,target:d,styles:u,linkCenter:n.get("linkCenter"),group:a.addGroup()})}else if(e===ih)s=new Hm({model:t,styles:u,group:a.addGroup()});else if(e===Af){var v=t.children,p=fd(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,x=t.y-y;this.updateComboSucceeds(t.id,m,x,v)}var b=a.addGroup();b.setZIndex(t.depth),s=new Ck({model:t,styles:u,animate:n.get("animate"),bbox:t.collapsed?fd([],n):p,group:b}),!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 S=n.findById(E.id);s.addChild(S),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(Fe(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s="";e.getType&&(s=e.getType());var u=o.get(s+nE),f=e.getModel(),l=f.x,c=f.y,h=e.getUpdateType(t);if(u){var d=Tr({},f,t),v=u(d),p=Tr({},f,v,t);v[Sa]&&(e.set("styles",p[Sa]),delete p[Sa]),_e(p,function(M,A){t[A]=M})}else _e(t,function(M,A){f[A]&&wn(M)&&!mt(M)&&(t[A]=z(z({},f[A]),t[A]))});if(o.emit("beforeupdateitem",{item:e,cfg:t}),s===ah){if(t.source){var g=t.source;Fe(g)&&(g=o.findById(g)),e.setSource(g)}if(t.target){var y=t.target;Fe(y)&&(y=o.findById(y)),e.setTarget(y)}e.update(t)}else if(s===ih){e.update(t,h);var m=e.getEdges();h==="move"?_e(m,function(M){n.edgeToBeUpdateMap[M.getID()]={edge:M,updateType:h},n.throttleRefresh()}):h!=null&&h.includes("bbox")&&_e(m,function(M){M.refresh(h)})}else if(s===Af){if(e.update(t,h),!isNaN(t.x)||!isNaN(t.y)){var x=t.x-l||0,b=t.y-c||0;this.updateComboSucceeds(f.id,x,b)}var w=e.getEdges(),E=(h==null?void 0:h.includes("bbox"))||h==="move";if(E&&s===Af){var S=e.get("shapeFactory"),_=f.type||"circle",C=f.animate===void 0||t.animate===void 0?(a=(i=S[_])===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 M=e.getKeyShape();!M||M.destroyed||_e(w,function(A){A&&!A.destroyed&&A.refresh()})}},201):_e(w,function(M){M.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(Fe(e)&&(e=s.findById(e)),!(!e||e.destroyed)){var u=e.getModel(),f=fd(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;Fe(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){Cn(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;Fe(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(Fe(e)&&(e=n.findById(e)),!(!e||e.destroyed)){var i=Jt(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===ah){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===ih){var v=e.getModel().comboId;if(h&&v){var p=h,g=!1;h.forEach(function(E){g||Cn(E,function(S){if(S.id===d&&p){var _=p.indexOf(S);return p.splice(_,1),g=!0,!1}return p=S.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===Af){var x=e.getModel().parentId,b,w=!1;(h||[]).forEach(function(S){w||Cn(S,function(_){return _.id===d?(b=_,w=!0,!1):!0})}),b.removed=!0,b&&b.children&&b.children.forEach(function(S){t.removeItem(S.id)});for(var y=e.getEdges(),m=y.length;m>=0;m--)n.removeItem(y[m],!1);x&&n.updateCombo(x)}e.destroy(),n.emit("afterremoveitem",{item:i,type:a})}},r.prototype.setItemState=function(e,t,n){var i=this.graph,a=t;Fe(n)&&(a="".concat(t,":").concat(n)),!(e.hasState(a)===n&&n||Fe(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;Fe(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;Fe(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;Fe(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){na(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(Fe(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()===ih){var a=e.getEdges();_e(a,function(l){t&&!(l.get("source").isVisible()&&l.get("target").isVisible())||n.changeItemVisibility(l,t)})}else if(e.getType&&e.getType()===Af){var o=i.get("comboTrees"),s=e.get("id"),u=[],f=!1;(o||[]).forEach(function(c){f||!c.children||c.children.length===0||Cn(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();_e(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}(),MU=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;Fe(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=Fe(t)?[t]:t;a.forEach(function(o){var s=o;i[s]||(i[s]=[]),Fe(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}(),CU=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||""})},Ak=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=yk(t);return u.unshift(["M",e[0].x,e[0].y]),u},zd=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];_o(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},AU=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+=CU(a,s)}return t&&(i+="Z"),i},hy=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},dy=function(e){if(e.length<2)throw new Error("point length must larger 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,x=d-(p-c)/6;o.push(["C",g,y,m,x,h,d])}return o.unshift(["M",i.x,i.y]),o},iE=function(e,t){return An([0,0],_o([0,0],e),t)},aE=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]},oE=function(e,t){return[t[0]-e[0],t[1]-e[1]]};function vy(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=An([0,0],aE(c[0],c[1]),e),d=An([0,0],h,-1),v=mn([0,0],c[0],h),p=mn([0,0],c[1],h),g=mn([0,0],c[1],d),y=mn([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=An([0,0],aE(o,s),e);i[a]=[mn([0,0],o,u),mn([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 Tk(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=oE(l[0],l[1]),h=iE(c,e),d=mn([0,0],l[0],An([0,0],h,-1)),v=mn([0,0],l[1],h),p=1.2*e,g=iE(_o([0,0],c),p),y=An([0,0],g,-1),m=mn([0,0],d,y),x=mn([0,0],v,y),b=mn([0,0],d,g);return"M ".concat(d," C ").concat([m,x,v].join(",")," S ").concat([b,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:_o([0,0],oE(f,c))}}),o=0;o<a.length;++o){var s=o>0?o-1:t-1,u=_o([0,0],mn([0,0],a[s].v,An([0,0],a[o].v,-1)));a[o].p=mn([0,0],a[o].p,An([0,0],u,e))}return a.map(function(f){var l=f.p;return{x:l[0],y:l[1]}})}var TU=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 IU=Object.freeze(Object.defineProperty({__proto__:null,getClosedSpline:dy,getControlPoint:zd,getSpline:Ak,getStarPath:TU,paddedHull:Tk,pathToPoints:hy,pointsToPolygon:AU,roundedHull:vy},Symbol.toStringTag,{value:"Module"}));var sE=function(e,t,n){return(e.y-n.y)*(t.x-n.x)-(e.x-n.x)*(t.y-n.y)},uE=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&&sE(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&&sE(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},kU={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 LU(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 NU=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}},OU=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=Od(s,u),l=new Is(s.x,s.y,u.x,u.y),c=n.reduce(function(h,d){return Gm(d,l)>0?h+1:h},0);f*Math.pow(c+1,2)<a&&(i=o,a=f*Math.pow(c+1,2))}),i},Ik=function(e,t){var n=Number.POSITIVE_INFINITY,i=null;return e.forEach(function(a){var o=Gm(a,t);o>=0&&o<n&&(i=a,n=o)}),i},DU=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||(z0(d,{x:g.x1,y:g.y1})||z0(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(),x=[[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(Ll(x,d.x,d.y))return!0}return!1};s&&u<n;){s=!1;for(var c=function(){var d=o.pop(),v=Ik(t,d);if(v){var p=bI(v,d),g=p[0],y=p[1];if(y===2){var m=function(b){for(var w=i,E=fE(v,w,g,b),S=f(E,o)||f(E,a),_=l(E,t);!S&&_&&w>=1;)w/=1.5,E=fE(v,w,g,b),S=f(E,o)||f(E,a),_=l(E,t);E&&!S&&(!b||!_)&&(o.push(new Is(d.x1,d.y1,E.x,E.y)),o.push(new Is(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 PU(r,e,t,n,i){var a=OU(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 Is(d.x1,d.y1,v.x2,v.y2),g=Ik(e,p);g?(h.push(d),c.push(v)):c.push(p)}return h},s=new Is(r.getModel().x,r.getModel().y,a.getModel().x,a.getModel().y),u=DU(s,e,n,i),f=o(u);return f}var RU=function(e,t,n){var i=Object.assign(kU,n),a=xI(e.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));e=e.sort(function(m,x){return Od({x:m.getModel().x,y:m.getModel().y},a)-Od({x:x.getModel().x,y:x.getModel().y},a)});var o=[],s=[];e.forEach(function(m){var x=PU(m,t,o,i.maxRoutingIterations,i.morphBuffer);x.forEach(function(b){s.push(b)}),o.push(m)});for(var u=BU(e,s,i.nodeR0),f=NU(u.width,u.height,i.pixelGroupSize),l=[],c=[],h=0;h<i.maxMarchingIterations;h++)if(FU(e,t,s,u,f,i),l=[],c=[],!!new LU(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 x=0,b=e;x<b.length;x++){var w=b[x],E=c.map(function(S){return[S.x,S.y]});if(!Ll(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 BU(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 FU(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),x=Math.min(o(v.maxY,-p+n.minY),i.height);return[g,y,m,x]},c=function(v,p){for(var g=v.getBBox(),y=l(g,a.nodeR1),m=y[0],x=y[1],b=y[2],w=y[3],E=x;E<w;E+=1)for(var S=m;S<b;S+=1)if(!(p<0&&i[S+E*i.width]<=0)){var _=s(S,n.minX),C=s(E,n.minY),M=EI({x:_,y:C},{x:g.minX,y:g.minY,width:g.width,height:g.height});if(M<Math.pow(a.nodeR1,2)){var A=Math.sqrt(M)-a.nodeR1;i.cells[S+E*i.width]+=p*A*A}}},h=function(v,p){for(var g=v.getBBox(),y=l(g,a.edgeR1),m=y[0],x=y[1],b=y[2],w=y[3],E=x;E<w;E+=1)for(var S=m;S<b;S+=1)if(!(p<0&&i.cells[S+E*i.width]<=0)){var _=s(S,n.minX),C=s(E,n.minY),M=wI({x:_,y:C},v);if(M<Math.pow(a.edgeR1,2)){var A=Math.sqrt(M)-a.edgeR1;i.cells[S+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 fE(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 kk=function(){function r(e,t){this.cfg=Tr(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 Fe(n)?e.findById(n):n}),this.nonMembers=this.cfg.nonMembers.map(function(n){return Fe(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=uE(e),a=vy(n.map(function(o){return[o.x,o.y]}),this.padding),i=sy(a);break;case"smooth-convex":n=uE(e),n.length===2?(a=vy(n.map(function(o){return[o.x,o.y]}),this.padding),i=sy(a)):n.length>2&&(a=Tk(n.map(function(o){return[o.x,o.y]}),this.padding),i=dy(a));break;case"bubble":n=RU(e,t,this.cfg.bubbleCfg),i=n.length>=2&&dy(n);break}return i},r.prototype.render=function(){this.group.addShape("path",{attrs:z({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){Fe(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){Fe(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){Fe(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){Fe(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 Fe(i)?n.graph.findById(i):i})),t&&(this.nonMembers=t.map(function(i){return Fe(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(z({},e))},r.prototype.updateCfg=function(e){var t=this;this.cfg=Tr(this.cfg,e),this.id=this.cfg.id,this.group=this.cfg.group,e.members&&(this.members=this.cfg.members.map(function(n){return Fe(n)?t.graph.findById(n):n})),e.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return Fe(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;Fe(e)?n=this.graph.findById(e):n=e;var i,a=n.getKeyShape();if(n.get("type")==="path")i=hy(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]}),mI(i,hy(this.path))},r.prototype.destroy=function(){this.group.remove(),this.cfg=null},r}(),Tf=vi,GU="node",Lk=function(r){Rt(e,r);function e(t){var n=r.call(this)||this;return n.sortCombos=Kl(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){Cn(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=Tr(n.getDefaultCfg(),t),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new Iu(n.cfg.maxStep),n.redoStack=new Iu(n.cfg.maxStep)),n}return e.prototype.init=function(){this.initCanvas();var t=new gU(this),n=new Pz(this),i=new SU(this),a=new MU(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:lt.rootContainerClassName});if(this.get("groupByTypes")){var s=o.addGroup({id:"".concat(a,"-edge"),className:lt.edgeContainerClassName}),u=o.addGroup({id:"".concat(a,"-node"),className:lt.nodeContainerClassName}),f=o.addGroup({id:"".concat(a,"-combo"),className:lt.comboContainerClassName});f.toBack(),this.set({nodeGroup:u,edgeGroup:s,comboGroup:f})}var l=o.addGroup({id:"".concat(a,"-delegate"),className:lt.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 bn(t)?this.cfg=z(z({},this.cfg),t):this.cfg[t]=n,t==="enabledStack"&&n&&!this.undoStack&&!this.redoStack&&(this.undoStack=new Iu(this.cfg.maxStep),this.redoStack=new Iu(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){Fe(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 _e(a,function(o,s){if(n(o,s))return i=o,i}),i},e.prototype.findAll=function(t,n){var i=[];return _e(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=Jt(s.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),i){var f=Nl({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:s.getMatrix()})}});G0(s,{x:s.getCanvasBBox().x+t,y:s.getCanvasBBox().y+n},i,f||{duration:500,easing:"easeCubic"})}else u=Tf(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");G0(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=Jt(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=Tf(u,[["t",-n.x,-n.y],["s",d,d],["t",n.x,n.y]]):u=Tf(u,[["s",d,d]]),i){var p=Jt(s.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var g=p[0],y=g*d,m=Nl({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:s.getMatrix()})}});s.animate(function(x){if(x===1)p=u;else{var b=zm(g,y,x)/p[0];n?p=Tf(p,[["t",-n.x,-n.y],["s",b,b],["t",n.x,n.y]]):p=Tf(p,[["s",b,b]])}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(Fe(t)&&(i=this.findById(t)),!i&&Fe(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=z(z({},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(z(z({},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=Y0(this.get("comboTrees"));this.set("comboTrees",h)}}},e.prototype.innerAddItem=function(t,n,i){if(!Dz(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||na(v,function(p){if(n.parentId===p.id){u=!0;var g=z({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=z({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"&&Fe(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||na(v,function(p){if(p.id===n.id)return d=!0,!1;if(n.comboId===p.id&&!d){h=!0;var g=Jt(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=z(z({},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=z(z({},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;Fe(t)?s=this.findById(t):s=t;var u=i&&this.get("enabledStack"),f;u&&(f=Jt(s.getModel()));var l="";s.getType&&(l=s.getType());var c=Qn([],s.getStates(),!0);if(l==="combo"&&_e(c,function(p){return a.setItemState(s,p,!1)}),o.updateItem(s,n),l==="combo"&&_e(c,function(p){return a.setItemState(s,p,!0)}),u){var h={nodes:[],edges:[],combos:[]},d={nodes:[],edges:[],combos:[]},v=z({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){Fe(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){ew(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=X0(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){na(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");_e(i,function(u){if(o=s[u.id],o){if(a.get("animate")&&t===GU){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(!ew(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(b){return o.clearItemStates(b)}),this.getEdges().map(function(b){return o.clearItemStates(b)});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=X0(h,s.nodes);this.set("comboTrees",d)}else this.set("comboTrees",[]);this.diffItems("node",c,s.nodes),_e(l,function(b,w){l[w].getModel().depth=0,!(b.getType&&b.getType()==="edge")&&(b.getType&&b.getType()==="combo"?(delete l[w],b.destroy()):c.nodes.indexOf(b)<0&&(delete l[w],o.remove(b,!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),_e(l,function(b,w){b.getType&&(b.getType()==="node"||b.getType()==="combo")||c.edges.indexOf(b)<0&&(delete l[w],o.remove(b,!1))}),(this.get("comboTrees")||[]).forEach(function(b){na(b,function(w){var E=i.findById(w.id);return E.getType()==="combo"&&w.collapsed&&i.collapseCombo(w.id,!1),!0})}),this.set({nodes:c.nodes,edges:c.edges});var y=(this.get("layout")||{}).relayoutAtChangeData,m=y===void 0?!0:y,x=this.get("layoutController");return m&&x&&(x.changeData(function(){setTimeout(function(){var b;(b=o.getCombos())===null||b===void 0||b.forEach(function(w){w.set("animate",!0)})},0)}),o.get("animate")&&!x.getLayoutType()?(o.positionsAnimate(),(a=o.getCombos())===null||a===void 0||a.forEach(function(b){return b.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(Fe(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),x=m.getType();if(!(x!=="node"&&x!=="combo")){var b=m.getModel();l["".concat(x,"s")].push({id:y,parentId:x==="node"?b.comboId:b.parentId})}});var c=this.get("comboTrees"),h=new Set(n),d=new Map;c&&(c.forEach(function(y){na(y,function(m,x,b){if(h.has(m.id)){if(x){var w=a.findById(x.id),E=a.findById(m.id);x.children.splice(b,1),w.removeChild(E),o.updateCombo(w,x.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),x=m.getModel(),b="";m.getType&&(b=m.getType());var w=d.get(y)||{id:m.getID(),itemType:b};return b==="combo"?(w.parentId=s,x.parentId=s):b==="node"&&(w.comboId=s,x.comboId=s),f&&v["".concat(b,"s")].push({id:x.id,parentId:s}),w});u.children=p,this.addItem("combo",u,!1),this.set("comboSorted",!1),c&&(c.forEach(function(y){Cn(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(Fe(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"),x={};if(m&&(x=Jt(f),x.children=[]),c.forEach(function(S){v||na(S,function(_){var C;if(_.id===d){v=_;var M=u.getEdges().map(function(I){return I.getID()});M.forEach(function(I){i.removeItem(I,!1)});var A=g.indexOf(u);g.splice(A,1),delete h[d];var T=Jt(u.getModel());u.destroy(),i.emit("afterremoveitem",{item:T,type:"combo"})}if(l&&v&&_.id===l){y.removeCombo(u),p=_.children;var A=p.indexOf(v);return A!==-1&&p.splice(A,1),(C=v.children)===null||C===void 0||C.forEach(function(L){var N=i.findById(L.id),O=N.getModel();N.getType&&N.getType()==="combo"?(L.parentId=l,delete L.comboId,O.parentId=l,delete O.comboId):N.getType&&N.getType()==="node"&&(L.comboId=l,O.comboId=l),y.addChild(N),p.push(L)}),i.updateCombo(y),!1}return!0})}),!l&&v){var b=c.indexOf(v);c.splice(b,1),(a=v.children)===null||a===void 0||a.forEach(function(S){S.parentId=void 0;var _=i.findById(S.id).getModel();delete _.parentId,delete _.comboId,S.itemType!=="node"&&c.push(S)})}if(m){var w={nodes:[],combos:[]},E={nodes:[],combos:[]};(o=v.children)===null||o===void 0||o.forEach(function(S){var _=i.findById(S.id),C=_.getType();C!=="node"&&C!=="combo"||(w["".concat(C,"s")].push({id:S.id,parentId:d}),E["".concat(C,"s")].push({id:S.id,parentId:l}))}),w.combos.push(x),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){na(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=Qn([],c.getStates(),!0);_e(h,function(d){return n.setItemState(c,d,!1)}),o.updateCombo(c,f.children,t),_e(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(Fe(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){na(l,function(c){if(!c)return!0;var h=f[c.id];if(o===c.id&&h&&h.getType&&h.getType()==="combo"){var d=Qn([],h.getStates(),!0);_e(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!1)}),u.updateCombo(h,c.children),_e(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;Fe(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||Cn(m,function(x){if(!h)return x.id===o.getID()&&(h=x),!0})}),Cn(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=Y0(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},e.prototype.save=function(){var t=[],n=[],i=[];return _e(this.get("nodes"),function(a){t.push(a.getModel())}),_e(this.get("edges"),function(a){n.push(a.getModel())}),_e(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");_e(n,function(o){o.refresh()}),_e(i,function(o){o.refresh()}),_e(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(Fe(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){_e(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(){_e(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){_e(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()),_e(a,function(c){var h=c.getSource().getModel(),d=c.getTarget();if(!bn(d)){var v=d.getModel();(f[h.id]||f[v.id]||c.getModel().isComboEdge)&&c.refresh()}}),_e(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(Fe(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,x={x:(p+g)/2,y:(y+m)/2};n==="begin"&&(x.x=p,x.y=y),o.translate(u.x-x.x,u.y-x.y)})}var l=z({},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(Fe(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||Cn(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(),x=null,b;if(y.getModel().id===a.id||u.includes(y)&&!u.includes(m)?(x=m,b=!1):(m.getModel().id===a.id||!u.includes(y)&&u.includes(m))&&(x=y,b=!0),x){if(v){i.removeItem(h,!1);return}for(var w=x.getModel();!x.isVisible();){var E=w.parentId,S=w.comboId,_=E||S;if(x=i.findById(_),!x||!_)return;w=x.getModel()}var C=w.id,M=b?{source:C,target:a.id,size:g,isVEdge:!0}:{source:a.id,target:C,size:g,isVEdge:!0},A="".concat(M.source,"-").concat(M.target);if(c[A]){c[A].size+=g;return}c[A]=M}}}),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),Fe(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||Cn(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 x=h.getModel(),b=x.isVEdge,w=x.size,E=w===void 0?1:w;if(b){i.removeItem(h,!1);return}for(var S=y.getModel();!y.isVisible();){var _=S.parentId,C=S.comboId,M=_||C;if(y=i.findById(M),!y||!M)return;S=y.getModel()}for(var A=S.id,T=m?v:d,I=T.getModel();!T.isVisible();){var L=I.parentId,N=I.comboId,O=L||N;if(T=i.findById(O),!T||!O)return;if(I.comboId===a.id||I.parentId===a.id)break;I=T.getModel()}var B=I.id;if(A){var W=m?{source:A,target:B,isVEdge:!0,size:E}:{source:B,target:A,isVEdge:!0,size:E},D="".concat(W.source,"-").concat(W.target);if(c[D]){c[D].size+=E;return}c[D]=W}}}}),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),Fe(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 Fe(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;Fe(t)&&(a=this.findById(t));var o=this.get("degrees");(!o||i)&&(o=Ua(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?Jt(n):{before:{},after:Jt(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=Ts(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=Ts(this.save(),n),this.set("adjMatrix",i)),(!a||!t)&&(a=kl(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 kk(this,z(z({},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;Fe(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}(LA);function py(r){"@babel/helpers - typeof";return py=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},py(r)}var fu=vi,lE="-shape",dg="-label",oh=["startArrow","endArrow"],cE={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},zU={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},sh={edge:zU,node:cE,combo:cE},gy="-label-bg",Zm={options:{labelCfg:{style:{fontFamily:lt.windowFontFamily}},descriptionCfg:{style:{fontFamily:lt.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(e){return{}},getOptions:function(e,t){return t==="move"||t!=null&&t.includes("bbox")?e:Tr({},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+lE),t.shapeMap[this.itemType+lE]=n,e.label){var i=this.drawLabel(e,t);i.set("className",this.itemType+dg),t.shapeMap[this.itemType+dg]=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=fu(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":f=fu(f,[["t",-a.x,-a.y],["r",o],["t",a.x,a.y]]);break;case"leftcenter":f=fu(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);break;default:f=fu(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else f=fu(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+gy;l.set("classname",c),t.shapeMap[c]=l,s.toFront()}return s},drawLabelBg:function(e,t,n){var i=this.options.labelCfg,a=bt({},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=lt[a]?lt[a].style:null;return z(z(z({},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=bt({},o.attr(),e.style),u=function(c){var h,d=s[c];if(bn(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+dg,l=o.shapeMap[f]||o.find(function(b){return b.get("className")===f}),c=this.itemType+gy,h=o.shapeMap[c]||o.find(function(b){return b.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=Tr(u,e.labelCfg));var v=this.getLabelStyleByPosition(e,u,o),p=(i=e.labelCfg)===null||i===void 0?void 0:i.style,g=z(z({},v),p),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=fu(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 x=this.getLabelBgStyleByPosition(l,u);h.attr(x)}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=Zl(t)?e:"".concat(e,":").concat(t),l=this.getStateStyle(f,n),c=n.getStateStyle(f);if(!(!c&&!l)){var h=bt({},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(O){var B,W=h[O];if(bn(W)&&!oh.includes(O)){var D=((o=d.shapeMap)===null||o===void 0?void 0:o[O])||d.find(function(P){return P.get("name")===O});D==null||D.attr(W)}else s.attr((B={},B[O]=W,B))};for(var g in h)p(g)}else{var y=ld(n.getCurrentStatesStyle()),m=n.getModel(),x=bt({},m.style,ld(n.getOriginStyle())),b=s.get("name"),w=s.attr(),E={};Object.keys(w).forEach(function(N){if(N!=="img"){var O=w[N];O&&py(O)==="object"?E[N]=Jt(O):E[N]=O}});var S={},_=function(O){var B=h[O];if(bn(B)&&!oh.includes(O)){var W=d.shapeMap[O]||d.find(function(R){return R.get("name")===O});if(W){var D=ld(W.attr());_e(B,function(R,X){if(O===b&&E[X]&&!v[X]){delete E[X];var Y=x[O][X]||sh[u][X];s.attr(X,Y)}else if(D[X]||D[X]===0){delete D[X];var ee=x[O][X]||sh[u][X];W.attr(X,ee)}}),S[O]=D}}else if(E[O]&&!v[O]){delete E[O];var P=x[O]||(x[b]?x[b][O]:void 0)||sh[u][O];s.attr(O,P)}};for(var C in h)_(C);b?S[b]=E:bt(S,E);for(var g in y)if(!v[g]){var M=y[g];(!bn(M)||oh.includes(g))&&(b?(bt(x[b],(a={},a[g]=M,a)),delete x[g]):bt(x,(i={},i[g]=M,i)),delete y[g])}var A={};Tr(A,x,S,y);var T=!1,I=function(O){var B,W,D=A[O];if(bn(D)&&!oh.includes(O)){var P=d.shapeMap[O]||d.find(function(X){return X.get("name")===O});P&&((P.get("type")==="text"||P.get("labelRelated"))&&(delete D.x,delete D.y,delete D.matrix),O===b&&(u==="combo"&&(delete D.r,delete D.width,delete D.height),T=!0),P.attr(D))}else if(!T){var R=D||sh[u][O];u==="combo"?b||s.attr((B={},B[O]=R,B)):s.attr((W={},W[O]=R,W))}};for(var L in A)I(L)}}}},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"?Jt(f):bt({},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}},jU={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:lt.nodeLabel.offset,getSize:function(e){var t,n=((t=this.mergeStyle)===null||t===void 0?void 0:t.size)||e.size||this.getOptions({}).size||lt.defaultNode.size;return mt(n)&&n.length===1&&(n=[n[0],n[0]]),mt(n)||(n=[n,n]),n},getLabelStyleByPosition:function(e,t){var n=t.maxLength,i=e.label;n&&(i=TI(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;ht(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=Vm(i.padding),s=a.width+o[1]+o[3],u=a.height+o[0]+o[2];return z(z({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=bt({},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,x=this.getSize(e),b=x[0],w=x[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(z(z({},E),{x:-b/2,y:0}));else if(p){var S="link-point-left";t.shapeMap[S]=t.addShape("circle",{attrs:z(z({},E),{x:-b/2,y:0}),className:S,name:S,isAnchorPoint:!0})}if(a)!g&&g!==void 0&&(a.remove(),delete t.shapeMap["link-point-right"]),a.attr(z(z({},E),{x:b/2,y:0}));else if(g){var _="link-point-right";t.shapeMap[_]=t.addShape("circle",{attrs:z(z({},E),{x:b/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(o)!y&&y!==void 0&&(o.remove(),delete t.shapeMap["link-point-top"]),o.attr(z(z({},E),{x:0,y:-w/2}));else if(y){var C="link-point-top";t.shapeMap[C]=t.addShape("circle",{attrs:z(z({},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(z(z({},E),{x:0,y:w/2}));else if(m){var M="link-point-bottom";t.shapeMap[M]=t.addShape("circle",{attrs:z(z({},E),{x:0,y:w/2}),className:M,name:M,isAnchorPoint:!0})}},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(z({},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=bt({},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(z(z({},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:z({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:z(z({},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()}}},UU=z(z({},Zm),jU);Ir.registerNode("single-node",UU);var uh="edge-shape";function $U(r){var e=r;return r==="start"?e="end":r==="end"&&(e="start"),e}var XU={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:lt.defaultEdge.size,style:{x:0,y:0,stroke:lt.defaultEdge.style.stroke,lineAppendWidth:lt.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:lt.edgeLabel.style.fill,fontSize:lt.edgeLabel.style.fontSize,fontFamily:lt.windowFontFamily}},stateStyles:z({},lt.edgeStateStyles)},getPath:function(e){var t=[];return _e(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=bt({},t,n,e.style),a=e.size||lt.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=bt({},lt.defaultEdge.style,{stroke:lt.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=z({},e.style),m.lineWidth===void 0&&(m.lineWidth=(dt(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[uh],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;ht(t.autoRotate)?l=this.labelAutoRotate:l=t.autoRotate;var c=MI(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=z(z({},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 ht(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=$U(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:uh,name:uh,attrs:n});return t.shapeMap[uh]=i,i},drawLabel:function(e,t){var n=this.options.labelCfg,i=Tr({},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+gy;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=Tr({},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}},YU=z(z({},Zm),XU);Ir.registerEdge("single-edge",YU);Ir.registerEdge("line",{getControlPoints:function(){}},"single-edge");Ir.registerEdge("spline",{getPath:function(e){var t=Ak(e);return t}},"single-edge");Ir.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=F0(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),mt(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=F0(t,o,n)}var f=Nd(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");Ir.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),mt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),mt(e.curvePosition)&&(e.curvePosition=e.curveOffset[0]);var a=zd(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");Ir.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),dt(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),dt(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]),!t||!t.length||t.length<2){var n=e.startPoint,i=e.endPoint,a=zd(n,i,e.curvePosition[0],e.curveOffset[0]),o=zd(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");Ir.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),dt(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),dt(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),dt(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");Ir.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),dt(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),dt(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),dt(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");Ir.registerEdge("loop",{getPathPoints:function(e){return SI(e)},getControlPoints:function(e){return e.controlPoints},afterDraw:function(e){e.controlPoints=void 0},afterUpdate:function(e){e.controlPoints=void 0}},"cubic");var WU={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:lt.comboLabel.refX,refY:lt.comboLabel.refY,options:{style:{stroke:lt.defaultCombo.style.stroke,fill:lt.defaultCombo.style.fill,lineWidth:lt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:lt.comboLabel.style.fill,fontSize:lt.comboLabel.style.fontSize,fontFamily:lt.windowFontFamily}},stateStyles:z({},lt.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},getSize:function(e){var t=Jt(e.size||this.options.size||lt.defaultCombo.size);return mt(t)&&t.length===1&&(t=[t[0],t[0]]),mt(t)||(t=[t,t]),t},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition,i=e.style,a=e.padding||this.options.padding;mt(a)&&(a=Math.max.apply(Math,a));var o=t.refX,s=t.refY;ht(o)&&(o=this.refX),ht(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:z({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(z({},n)),this.updateCollapsedIcon(e,t,n)),this.updateLabel(e,t)}},qU=z(z({},Zm),WU);Ir.registerCombo("single-combo",qU);Ir.registerCombo("circle",{options:{size:[lt.defaultCombo.size[0],lt.defaultCombo.size[0]],padding:Math.max.apply(Math,lt.defaultCombo.padding),animate:!0,style:{stroke:lt.defaultCombo.style.stroke,fill:lt.defaultCombo.style.fill,lineWidth:lt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:lt.comboLabel.style.fill,fontSize:lt.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:z({},lt.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;mt(n)&&(n=Math.max.apply(Math,n));var i={stroke:e.color},a=bt({},t,i,e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;if(o)s=dt(o)?o/2:o[0]/2;else{var u=this.getSize(e);!dt(a.r)||isNaN(a.r)?s=u[0]/2||lt.defaultCombo.style.r:s=Math.max(a.r,u[0]/2)||u[0]/2}a.r=s+n;var f=z({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;mt(i)&&(i=Math.max.apply(Math,i));var a=Jt(e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;o?s=dt(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=bt({},l.attr(),f,a);e.style?e.style.r=s:e.style={r:s},this.updateShape(e,t,c,!0)}},"single-combo");Ir.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:lt.defaultCombo.style.stroke,fill:lt.defaultCombo.style.fill,lineWidth:lt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:lt.comboLabel.style.fill,fontSize:lt.comboLabel.style.fontSize,fontFamily:lt.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:z({},lt.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;dt(a)&&(a=[a,a,a,a]);var o=t.refX,s=t.refY;ht(o)&&(o=this.refX),ht(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;dt(n)&&(n=[n,n,n,n]);var i={stroke:e.color},a=bt({},t,i,e.style),o=this.getSize(e),s,u,f=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;f?dt(f)?(s=f,u=f):(s=f[0],u=f[1]):(!dt(a.width)||isNaN(a.width)?s=o[0]||lt.defaultCombo.style.width:s=Math.max(a.width,o[0])||o[0],!dt(a.height)||isNaN(a.height)?u=o[1]||lt.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=z({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;dt(i)&&(i=[i,i,i,i]);var a=Jt(e.style),o,s,u=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;u?dt(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=bt({},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");Ir.registerNode("simple-circle",{options:{size:lt.defaultNode.size,style:{x:0,y:0,stroke:lt.defaultNode.style.stroke,fill:lt.defaultNode.style.fill,lineWidth:lt.defaultNode.style.lineWidth},labelCfg:{style:{fill:lt.nodeLabel.style.fill,fontSize:lt.nodeLabel.style.fontSize,fontFamily:lt.windowFontFamily}},stateStyles:z({},lt.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=Tr({},t,n),a=this.getSize(e),o=a[0]/2,s=z({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=Tr({},o.attr(),a,e.style);this.updateShape(e,t,s,!0,n)}},"single-node");Ir.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:lt.defaultNode.style.stroke,fill:lt.defaultNode.style.fill,lineWidth:lt.defaultNode.style.lineWidth},labelCfg:{style:{fill:lt.nodeLabel.style.fill,fontSize:lt.nodeLabel.style.fontSize,fontFamily:lt.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:z({},lt.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=bt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=z({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=bt({},i,o.attr(),s);u=bt(u,e.style),this.updateShape(e,t,u,!1,n)}},"single-node");Ir.registerNode("image",{options:{img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",size:200,labelCfg:{style:{fontFamily:lt.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:z({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:z({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:z({x:a,y:o,rx:d,ry:v},s)})}else if(i==="polygon"){var p=n.points;t.setClip({type:"polygon",attrs:z({points:p},s)})}else if(i==="path"){var g=n.path;t.setClip({type:"path",attrs:z({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=z({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 Nk={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,`
|
|
7
|
+
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
|
|
8
|
+
a `).concat(e,",").concat(e," 0 1,0 ").concat(e*2,`,0
|
|
9
|
+
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,`
|
|
10
|
+
L `).concat(i+t,",").concat(-e/2,`
|
|
11
|
+
L `).concat(i+t,",").concat(e/2,`
|
|
12
|
+
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
|
|
13
|
+
L `).concat(i+t/2,",").concat(-e/2,`
|
|
14
|
+
L `).concat(i+t,`,0
|
|
15
|
+
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
|
|
16
|
+
M `).concat(u,", -").concat(n/2,`
|
|
17
|
+
L `).concat(u+i," -").concat(n/2,`
|
|
18
|
+
L `).concat(u+i," ").concat(n/2,`
|
|
19
|
+
L `).concat(u," ").concat(n/2,`
|
|
20
|
+
Z`);return f}},Ok={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 VU=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"];const HU=Object.freeze(Object.defineProperty({__proto__:null,defaultSubjectColors:VU},Symbol.toStringTag,{value:"Module"}));var Dk=function(e){return e==="force"||e==="g6force"||e==="gForce"||e==="force2"};const ZU=Object.freeze(Object.defineProperty({__proto__:null,isForce:Dk},Symbol.toStringTag,{value:"Module"}));var KU=vi,Sn=z(z(z(z(z(z(z({},dU),Oz),IU),Sz),HU),ZU),{transform:KU,mat3:FA}),Pk=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=Dk(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=un(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 x=c[d];if(!x.destroyed){var p=x.getModel();if(!x.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(b){return b.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=un(e,["nodes","edges"]);if(!n)return e;var o,s;Pr(t==null?void 0:t.nodesFilter)?o=t.nodesFilter:o=function(){return!0};var u=n.filter(o);if(Pr(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 z({nodes:u,edges:i.filter(s)},a)},r.prototype.getLayoutBBox=function(e){var t=this.graph,n=Ad(t.getNodes(),function(o){return o.getModel().layoutOrder}),i=Object.values(n).map(function(o){var s=xk(o);return s.size=[s.width,s.height],s}),a=Object.values(Ad(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||aa(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 Vn(this,void 0,void 0,function(){var i,a,o;return Hn(this,function(s){return i=this.graph,t!=null&&t.length?(a=t.filter(function(u){return aa(u.x)||aa(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];aa(+y.x)&&(y.x=g%l*h+v),aa(+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}(),Rk=function(){function r(e){this.graph=e,this.destroyed=!1,this.initEvents()}return r}(),$a=Ir.registerNode,Bk=Ir.registerEdge,QU=Ir.registerCombo,Fk=dm.registerBehavior,Je=lt;lt.version,Ir.registerNode,Ir.registerEdge,Ir.registerCombo,dm.registerBehavior;var vg={},tr={},If={},$o={},hE;function Km(){if(hE)return $o;hE=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.MESSAGE=$o.ALGORITHM=void 0;var r={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"};$o.ALGORITHM=r;var e={SUCCESS:"SUCCESS",FAILURE:"FAILURE"};return $o.MESSAGE=e,$o}var kf={},pg={},Lf={},dE;function Mv(){if(dE)return Lf;dE=1,Object.defineProperty(Lf,"__esModule",{value:!0}),Lf.default=void 0;var r=function(n,i){var a=n.nodes,o=n.edges,s=[],u={};if(!a)throw new Error("invalid nodes data!");return a&&a.forEach(function(f,l){u[f.id]=l;var c=[];s.push(c)}),o&&o.forEach(function(f){var l=f.source,c=f.target,h=u[l],d=u[c];!h&&h!==0||!d&&d!==0||(s[h][d]=1,i||(s[d][h]=1))}),s},e=r;return Lf.default=e,Lf}var Nf={},Of={},Xo={},vE;function JU(){if(vE)return Xo;vE=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=Xo.LinkedListNode=void 0;var r=function(a,o){return a===o},e=function(){function i(a,o){o===void 0&&(o=null),this.value=a,this.next=o}return i.prototype.toString=function(a){return a?a(this.value):"".concat(this.value)},i}();Xo.LinkedListNode=e;var t=function(){function i(a){a===void 0&&(a=r),this.head=null,this.tail=null,this.compare=a}return i.prototype.prepend=function(a){var o=new e(a,this.head);return this.head=o,this.tail||(this.tail=o),this},i.prototype.append=function(a){var o=new e(a);return this.head?(this.tail.next=o,this.tail=o,this):(this.head=o,this.tail=o,this)},i.prototype.delete=function(a){if(!this.head)return null;for(var o=null;this.head&&this.compare(this.head.value,a);)o=this.head,this.head=this.head.next;var s=this.head;if(s!==null)for(;s.next;)this.compare(s.next.value,a)?(o=s.next,s.next=s.next.next):s=s.next;return this.compare(this.tail.value,a)&&(this.tail=s),o},i.prototype.find=function(a){var o=a.value,s=o===void 0?void 0:o,u=a.callback,f=u===void 0?void 0:u;if(!this.head)return null;for(var l=this.head;l;){if(f&&f(l.value)||s!==void 0&&this.compare(l.value,s))return l;l=l.next}return null},i.prototype.deleteTail=function(){var a=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,a;for(var o=this.head;o.next;)o.next.next?o=o.next:o.next=null;return this.tail=o,a},i.prototype.deleteHead=function(){if(!this.head)return null;var a=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),a},i.prototype.fromArray=function(a){var o=this;return a.forEach(function(s){return o.append(s)}),this},i.prototype.toArray=function(){for(var a=[],o=this.head;o;)a.push(o),o=o.next;return a},i.prototype.reverse=function(){for(var a=this.head,o=null,s=null;a;)s=a.next,a.next=o,o=a,a=s;this.tail=this.head,this.head=o},i.prototype.toString=function(a){return a===void 0&&(a=void 0),this.toArray().map(function(o){return o.toString(a)}).toString()},i}(),n=t;return Xo.default=n,Xo}var pE;function e9(){if(pE)return Of;pE=1,Object.defineProperty(Of,"__esModule",{value:!0}),Of.default=void 0;var r=e(JU());function e(i){return i&&i.__esModule?i:{default:i}}var t=function(){function i(){this.linkedList=new r.default}return i.prototype.isEmpty=function(){return!this.linkedList.head},i.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},i.prototype.enqueue=function(a){this.linkedList.append(a)},i.prototype.dequeue=function(){var a=this.linkedList.deleteHead();return a?a.value:null},i.prototype.toString=function(a){return this.linkedList.toString(a)},i}(),n=t;return Of.default=n,Of}var wi={},gE;function Gi(){if(gE)return wi;gE=1,Object.defineProperty(wi,"__esModule",{value:!0}),wi.uniqueId=wi.getOutEdgesNodeId=wi.getNeighbors=wi.getEdgesByNodeId=void 0;var r=function(a,o,s){o===void 0&&(o=[]);var u=o.filter(function(h){return h.source===a||h.target===a});if(s==="target"){var f=function(d){return d.source===a};return u.filter(f).map(function(h){return h.target})}if(s==="source"){var l=function(d){return d.target===a};return u.filter(l).map(function(h){return h.source})}var c=function(d){return d.source===a?d.target:d.source};return u.map(c)};wi.getNeighbors=r;var e=function(a,o){return o.filter(function(s){return s.source===a})};wi.getOutEdgesNodeId=e;var t=function(a,o){return o.filter(function(s){return s.source===a||s.target===a})};wi.getEdgesByNodeId=t;var n=function(a){a===void 0&&(a=0);var o="".concat(Math.random()).split(".")[1].substr(0,5),s="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(a,"-").concat(o).concat(s)};return wi.uniqueId=n,wi}var yE;function t9(){if(yE)return Nf;yE=1,Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.default=void 0;var r=t(e9()),e=Gi();function t(o){return o&&o.__esModule?o:{default:o}}function n(o){o===void 0&&(o={});var s=o,u=function(){},f=function(){var l={};return function(c){var h=c.next,d=h;return l[d]?!1:(l[d]=!0,!0)}}();return s.allowTraversal=o.allowTraversal||f,s.enter=o.enter||u,s.leave=o.leave||u,s}var i=function(s,u,f,l){l===void 0&&(l=!0);var c=n(f),h=new r.default,d=s.edges,v=d===void 0?[]:d;h.enqueue(u);for(var p="",g=function(){var m=h.dequeue();c.enter({current:m,previous:p}),(0,e.getNeighbors)(m,v,l?"target":void 0).forEach(function(x){c.allowTraversal({previous:p,current:m,next:x})&&h.enqueue(x)}),c.leave({current:m,previous:p}),p=m};!h.isEmpty();)g()},a=i;return Nf.default=a,Nf}var no={},mE;function Gk(){if(mE)return no;mE=1,Object.defineProperty(no,"__esModule",{value:!0}),no.default=n,no.detectStrongConnectComponents=no.detectConnectedComponents=void 0;var r=Gi(),e=function(a){for(var o=a.nodes,s=o===void 0?[]:o,u=a.edges,f=u===void 0?[]:u,l=[],c={},h=[],d=function y(m){h.push(m),c[m.id]=!0;for(var x=(0,r.getNeighbors)(m.id,f),b=function(S){var _=x[S];if(!c[_]){var C=s.filter(function(M){return M.id===_});C.length>0&&y(C[0])}},w=0;w<x.length;++w)b(w)},v=0;v<s.length;v++){var p=s[v];if(!c[p.id]){d(p);for(var g=[];h.length>0;)g.push(h.pop());l.push(g)}}return l};no.detectConnectedComponents=e;var t=function(a){for(var o=a.nodes,s=o===void 0?[]:o,u=a.edges,f=u===void 0?[]:u,l=[],c={},h={},d={},v=[],p=0,g=function b(w){h[w.id]=p,d[w.id]=p,p+=1,l.push(w),c[w.id]=!0;for(var E=(0,r.getNeighbors)(w.id,f,"target").filter(function(A){return s.map(function(T){return T.id}).indexOf(A)>-1}),S=function(T){var I=E[T];if(!h[I]&&h[I]!==0){var L=s.filter(function(N){return N.id===I});L.length>0&&b(L[0]),d[w.id]=Math.min(d[w.id],d[I])}else c[I]&&(d[w.id]=Math.min(d[w.id],h[I]))},_=0;_<E.length;_++)S(_);if(d[w.id]===h[w.id]){for(var C=[];l.length>0;){var M=l.pop();if(c[M.id]=!1,C.push(M),M===w)break}C.length>0&&v.push(C)}},y=0,m=s;y<m.length;y++){var x=m[y];!h[x.id]&&h[x.id]!==0&&g(x)}return v};no.detectStrongConnectComponents=t;function n(i,a){return a?t(i):e(i)}return no}var Ma={},bE;function zk(){if(bE)return Ma;bE=1,Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.getOutDegree=Ma.getInDegree=Ma.default=void 0;var r=function(a){var o={},s=a.nodes,u=s===void 0?[]:s,f=a.edges,l=f===void 0?[]:f;return u.forEach(function(c){o[c.id]={degree:0,inDegree:0,outDegree:0}}),l.forEach(function(c){o[c.source].degree++,o[c.source].outDegree++,o[c.target].degree++,o[c.target].inDegree++}),o},e=r;Ma.default=e;var t=function(a,o){var s=r(a);return s[o]?r(a)[o].inDegree:0};Ma.getInDegree=t;var n=function(a,o){var s=r(a);return s[o]?r(a)[o].outDegree:0};return Ma.getOutDegree=n,Ma}var Ei={},fh={},xE;function jk(){if(xE)return fh;xE=1,Object.defineProperty(fh,"__esModule",{value:!0}),fh.default=n;var r=Gi();function e(i){i===void 0&&(i={});var a=i,o=function(){},s=function(){var u={};return function(f){var l=f.next;return u[l]?!1:(u[l]=!0,!0)}}();return a.allowTraversal=i.allowTraversal||s,a.enter=i.enter||o,a.leave=i.leave||o,a}function t(i,a,o,s,u){u===void 0&&(u=!0),s.enter({current:a,previous:o});var f=i.edges,l=f===void 0?[]:f;(0,r.getNeighbors)(a,l,u?"target":void 0).forEach(function(c){s.allowTraversal({previous:o,current:a,next:c})&&t(i,c,a,s,u)}),s.leave({current:a,previous:o})}function n(i,a,o,s){s===void 0&&(s=!0),t(i,a,"",e(o),s)}return fh}var wE;function r9(){if(wE)return Ei;wE=1;function r(h){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},r(h)}Object.defineProperty(Ei,"__esModule",{value:!0}),Ei.detectAllUndirectedCycle=Ei.detectAllDirectedCycle=Ei.detectAllCycles=Ei.default=void 0;var e=o(jk()),t=a(Gk()),n=Gi();function i(h){if(typeof WeakMap!="function")return null;var d=new WeakMap,v=new WeakMap;return(i=function(g){return g?v:d})(h)}function a(h,d){if(h&&h.__esModule)return h;if(h===null||r(h)!=="object"&&typeof h!="function")return{default:h};var v=i(d);if(v&&v.has(h))return v.get(h);var p={},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var y in h)if(y!=="default"&&Object.prototype.hasOwnProperty.call(h,y)){var m=g?Object.getOwnPropertyDescriptor(h,y):null;m&&(m.get||m.set)?Object.defineProperty(p,y,m):p[y]=h[y]}return p.default=h,v&&v.set(h,p),p}function o(h){return h&&h.__esModule?h:{default:h}}var s=function(d){var v=null,p=d.nodes,g=p===void 0?[]:p,y={},m={},x={},b={};g.forEach(function(S){m[S.id]=S});for(var w={enter:function(_){var C=_.current,M=_.previous;if(x[C]){v={};for(var A=C,T=M;T!==C;)v[A]=T,A=T,T=y[T];v[A]=T}else x[C]=C,delete m[C],y[C]=M},leave:function(_){var C=_.current;b[C]=C,delete x[C]},allowTraversal:function(_){var C=_.next;return v?!1:!b[C]}};Object.keys(m).length;){var E=Object.keys(m)[0];(0,e.default)(d,E,w)}return v},u=function(d,v,p){var g,y;p===void 0&&(p=!0);for(var m=[],x=(0,t.default)(d,!1),b=0,w=x;b<w.length;b++){var E=w[b];if(E.length)for(var S=E[0],_=S.id,C=[S],M=(g={},g[_]=S,g),A=(y={},y[_]=new Set,y);C.length>0;)for(var T=C.pop(),I=T.id,L=(0,n.getNeighbors)(I,d.edges),N=function(W){var D,P=L[W],R=d.nodes.find(function(K){return K.id===P});if(P===I)m.push((D={},D[P]=T,D));else if(!(P in A))M[P]=T,C.push(R),A[P]=new Set([T]);else if(!A[I].has(R)){for(var X=!0,Y=[R,T],ee=M[I];A[P].size&&!A[P].has(ee)&&(Y.push(ee),ee!==M[ee.id]);)ee=M[ee.id];if(Y.push(ee),v&&p?(X=!1,Y.findIndex(function(K){return v.indexOf(K.id)>-1})>-1&&(X=!0)):v&&!p&&Y.findIndex(function(K){return v.indexOf(K.id)>-1})>-1&&(X=!1),X){for(var U={},Z=1;Z<Y.length;Z+=1)U[Y[Z-1].id]=Y[Z];Y.length&&(U[Y[Y.length-1].id]=Y[0]),m.push(U)}A[P].add(T)}},O=0;O<L.length;O+=1)N(O)}return m};Ei.detectAllUndirectedCycle=u;var f=function(d,v,p){p===void 0&&(p=!0);for(var g=[],y=new Set,m=[],x=[],b={},w={},E=function(ee){for(var U=[ee];U.length>0;){var Z=U.pop();y.has(Z)&&(y.delete(Z),m[Z.id].forEach(function(K){U.push(K)}),m[Z.id].clear())}},S=function Y(ee,U,Z){var K=!1;if(v&&p===!1&&v.indexOf(ee.id)>-1)return K;g.push(ee),y.add(ee);for(var se=Z[ee.id],re=0;re<se.length;re+=1){var J=b[se[re]];if(J===U){for(var me={},Ae=1;Ae<g.length;Ae+=1)me[g[Ae-1].id]=g[Ae];g.length&&(me[g[g.length-1].id]=g[0]),x.push(me),K=!0}else y.has(J)||Y(J,U,Z)&&(K=!0)}if(K)E(ee);else for(var re=0;re<se.length;re+=1){var J=b[se[re]];m[J.id].has(ee)||m[J.id].add(ee)}return g.pop(),K},_=d.nodes,C=_===void 0?[]:_,M=0;M<C.length;M+=1){var A=C[M],T=A.id;w[T]=M,b[M]=A}if(v&&p)for(var I=function(ee){var U=v[ee];w[C[ee].id]=w[U],w[U]=0,b[0]=C.find(function(Z){return Z.id===U}),b[w[C[ee].id]]=C[ee]},M=0;M<v.length;M++)I(M);for(var L=function(ee){for(var U,Z,K=1/0,se=0;se<ee.length;se+=1)for(var re=ee[se],J=0;J<re.length;J++){var me=w[re[J].id];me<K&&(K=me,Z=se)}for(var Ae=ee[Z],Ye=[],se=0;se<Ae.length;se+=1){var Ve=Ae[se];Ye[Ve.id]=[];for(var Ke=0,xt=(0,n.getNeighbors)(Ve.id,d.edges,"target").filter(function(vr){return Ae.map(function(xr){return xr.id}).indexOf(vr)>-1});Ke<xt.length;Ke++){var kt=xt[Ke];kt===Ve.id&&!(p===!1&&v.indexOf(Ve.id)>-1)?x.push((U={},U[Ve.id]=Ve,U)):Ye[Ve.id].push(w[kt])}}return{component:Ae,adjList:Ye,minIdx:K}},N=0;N<C.length;){var O=C.filter(function(Y){return w[Y.id]>=N}),B=(0,t.detectStrongConnectComponents)({nodes:O,edges:d.edges}).filter(function(Y){return Y.length>1});if(B.length===0)break;var W=L(B),D=W.minIdx,P=W.adjList,R=W.component;if(R.length>1){R.forEach(function(Y){m[Y.id]=new Set});var X=b[D];if(v&&p&&v.indexOf(X.id)===-1)return x;S(X,X,P),N=D+1}else break}return x};Ei.detectAllDirectedCycle=f;var l=function(d,v,p,g){return g===void 0&&(g=!0),v?f(d,p,g):u(d,p,g)};Ei.detectAllCycles=l;var c=s;return Ei.default=c,Ei}var Df={};const Uk=da(A3),Jl=da(G5);var EE;function Qm(){if(EE)return Df;EE=1,Object.defineProperty(Df,"__esModule",{value:!0}),Df.default=void 0;var r=Uk,e=Jl,t=Gi(),n=function(u,f,l){for(var c=1/0,h,d=0;d<f.length;d++){var v=f[d].id;!l[v]&&u[v]<=c&&(c=u[v],h=f[d])}return h},i=function(u,f,l,c){var h=u.nodes,d=h===void 0?[]:h,v=u.edges,p=v===void 0?[]:v,g={},y={},m={};d.forEach(function(C,M){var A=C.id;y[A]=1/0,A===f&&(y[A]=0)});for(var x=d.length,b=function(M){var A=n(y,d,g),T=A.id;if(g[T]=!0,y[T]===1/0)return"continue";var I=[];l?I=(0,t.getOutEdgesNodeId)(T,p):I=(0,t.getEdgesByNodeId)(T,p),I.forEach(function(L){var N=L.target,O=L.source,B=N===T?O:N,W=c&&L[c]?L[c]:1;y[B]>y[A.id]+W?(y[B]=y[A.id]+W,m[B]=[A.id]):y[B]===y[A.id]+W&&m[B].push(A.id)})},w=0;w<x;w++)b();m[f]=[f];var E={};for(var S in y)y[S]!==1/0&&o(f,S,m,E);var _={};for(var S in E)_[S]=E[S][0];return{length:y,path:_,allPath:E}},a=i;Df.default=a;function o(s,u,f,l){if(s===u)return[s];if(l[u])return l[u];for(var c=[],h=0,d=f[u];h<d.length;h++){var v=d[h],p=o(s,v,f,l);if(!p)return;for(var g=0,y=p;g<y.length;g++){var m=y[g];(0,e.isArray)(m)?c.push((0,r.__spreadArray)((0,r.__spreadArray)([],m,!0),[u],!1)):c.push([m,u])}}return l[u]=c,l[u]}return Df}var Yo={},_E;function n9(){if(_E)return Yo;_E=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.findShortestPath=Yo.findAllPath=void 0;var r=t(Qm()),e=Gi();function t(a){return a&&a.__esModule?a:{default:a}}var n=function(o,s,u,f,l){var c=(0,r.default)(o,s,f,l),h=c.length,d=c.path,v=c.allPath;return{length:h[u],path:d[u],allPath:v[u]}};Yo.findShortestPath=n;var i=function(o,s,u,f){var l;if(s===u)return[[s]];var c=o.edges,h=c===void 0?[]:c,d=[s],v=(l={},l[s]=!0,l),p=[],g=[],y=f?(0,e.getNeighbors)(s,h,"target"):(0,e.getNeighbors)(s,h);for(p.push(y);d.length>0&&p.length>0;){var m=p[p.length-1];if(m.length){var x=m.shift();x&&(d.push(x),v[x]=!0,y=f?(0,e.getNeighbors)(x,h,"target"):(0,e.getNeighbors)(x,h),p.push(y.filter(function(E){return!v[E]})))}else{var b=d.pop();v[b]=!1,p.pop();continue}if(d[d.length-1]===u){var w=d.map(function(S){return S});g.push(w);var b=d.pop();v[b]=!1,p.pop()}}return g};return Yo.findAllPath=i,Yo}var Pf={},SE;function $k(){if(SE)return Pf;SE=1,Object.defineProperty(Pf,"__esModule",{value:!0}),Pf.default=void 0;var r=e(Mv());function e(i){return i&&i.__esModule?i:{default:i}}var t=function(a,o){for(var s=(0,r.default)(a,o),u=[],f=s.length,l=0;l<f;l+=1){u[l]=[];for(var c=0;c<f;c+=1)l===c?u[l][c]=0:s[l][c]===0||!s[l][c]?u[l][c]=1/0:u[l][c]=s[l][c]}for(var h=0;h<f;h+=1)for(var l=0;l<f;l+=1)for(var c=0;c<f;c+=1)u[l][c]>u[l][h]+u[h][c]&&(u[l][c]=u[l][h]+u[h][c]);return u},n=t;return Pf.default=n,Pf}var Rf={},ME;function i9(){if(ME)return Rf;ME=1,Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.default=void 0;var r=t(Mv()),e=Gi();function t(a){return a&&a.__esModule?a:{default:a}}var n=function(o,s,u,f){s===void 0&&(s=!1),u===void 0&&(u="weight"),f===void 0&&(f=1e3);var l=o.nodes,c=l===void 0?[]:l,h=o.edges,d=h===void 0?[]:h,v={},p={};c.forEach(function(_,C){var M=(0,e.uniqueId)();_.clusterId=M,v[M]={id:M,nodes:[_]},p[_.id]={node:_,idx:C}});var g=(0,r.default)(o,s),y={};g.forEach(function(_,C){var M=c[C].id;y[M]={},_.forEach(function(A,T){if(A){var I=c[T].id;y[M][I]=A}})});for(var m=0,x=function(){var C=!1;if(c.forEach(function(M){var A={};Object.keys(y[M.id]).forEach(function(D){var P=y[M.id][D],R=p[D].node,X=R.clusterId;A[X]||(A[X]=0),A[X]+=P});var T=-1/0,I=[];if(Object.keys(A).forEach(function(D){T<A[D]?(T=A[D],I=[D]):T===A[D]&&I.push(D)}),!(I.length===1&&I[0]===M.clusterId)){var L=I.indexOf(M.clusterId);if(L>=0&&I.splice(L,1),I&&I.length){C=!0;var N=v[M.clusterId],O=N.nodes.indexOf(M);N.nodes.splice(O,1);var B=Math.floor(Math.random()*I.length),W=v[I[B]];W.nodes.push(M),M.clusterId=W.id}}}),!C)return"break";m++};m<f;){var b=x();if(b==="break")break}Object.keys(v).forEach(function(_){var C=v[_];(!C.nodes||!C.nodes.length)&&delete v[_]});var w=[],E={};d.forEach(function(_){var C=_.source,M=_.target,A=_[u]||1,T=p[C].node.clusterId,I=p[M].node.clusterId,L="".concat(T,"---").concat(I);if(E[L])E[L].weight+=A,E[L].count++;else{var N={source:T,target:I,weight:A,count:1};E[L]=N,w.push(N)}});var S=[];return Object.keys(v).forEach(function(_){S.push(v[_])}),{clusters:S,clusterEdges:w}},i=n;return Rf.default=i,Rf}var Bf={},Ff={},CE;function Xk(){if(CE)return Ff;CE=1,Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.default=void 0;var r=Jl,e=function(){function n(i){this.arr=i}return n.prototype.getArr=function(){return this.arr||[]},n.prototype.add=function(i){var a,o=i.arr;if(!(!((a=this.arr)===null||a===void 0)&&a.length))return new n(o);if(!(o!=null&&o.length))return new n(this.arr);if(this.arr.length===o.length){var s=[];for(var u in this.arr)s[u]=this.arr[u]+o[u];return new n(s)}},n.prototype.subtract=function(i){var a,o=i.arr;if(!(!((a=this.arr)===null||a===void 0)&&a.length))return new n(o);if(!(o!=null&&o.length))return new n(this.arr);if(this.arr.length===o.length){var s=[];for(var u in this.arr)s[u]=this.arr[u]-o[u];return new n(s)}},n.prototype.avg=function(i){var a=[];if(i!==0)for(var o in this.arr)a[o]=this.arr[o]/i;return new n(a)},n.prototype.negate=function(){var i=[];for(var a in this.arr)i[a]=-this.arr[a];return new n(i)},n.prototype.squareEuclideanDistance=function(i){var a,o=i.arr;if(!(!((a=this.arr)===null||a===void 0)&&a.length)||!(o!=null&&o.length))return 0;if(this.arr.length===o.length){var s=0;for(var u in this.arr)s+=Math.pow(this.arr[u]-i.arr[u],2);return s}},n.prototype.euclideanDistance=function(i){var a,o=i.arr;if(!(!((a=this.arr)===null||a===void 0)&&a.length)||!(o!=null&&o.length))return 0;if(this.arr.length===o.length){var s=0;for(var u in this.arr)s+=Math.pow(this.arr[u]-i.arr[u],2);return Math.sqrt(s)}else console.error("The two vectors are unequal in length.")},n.prototype.normalize=function(){var i=[],a=(0,r.clone)(this.arr);a.sort(function(f,l){return f-l});var o=a[a.length-1],s=a[0];for(var u in this.arr)i[u]=(this.arr[u]-s)/(o-s);return new n(i)},n.prototype.norm2=function(){var i;if(!(!((i=this.arr)===null||i===void 0)&&i.length))return 0;var a=0;for(var o in this.arr)a+=Math.pow(this.arr[o],2);return Math.sqrt(a)},n.prototype.dot=function(i){var a,o=i.arr;if(!(!((a=this.arr)===null||a===void 0)&&a.length)||!(o!=null&&o.length))return 0;if(this.arr.length===o.length){var s=0;for(var u in this.arr)s+=this.arr[u]*i.arr[u];return s}else console.error("The two vectors are unequal in length.")},n.prototype.equal=function(i){var a,o=i.arr;if(((a=this.arr)===null||a===void 0?void 0:a.length)!==(o==null?void 0:o.length))return!1;for(var s in this.arr)if(this.arr[s]!==o[s])return!1;return!0},n}(),t=e;return Ff.default=t,Ff}var _i={},Wo={},AE;function a9(){if(AE)return Wo;AE=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.secondReg=Wo.dateReg=void 0;var r=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;Wo.secondReg=r;var e=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;return Wo.dateReg=e,Wo}var TE;function o9(){if(TE)return _i;TE=1,Object.defineProperty(_i,"__esModule",{value:!0}),_i.getPropertyWeight=_i.getAllSortProperties=_i.getAllProperties=_i.default=void 0;var r=a9(),e=function(s,u){s===void 0&&(s=[]),u===void 0&&(u=100);var f={};s.forEach(function(c){c.properties&&Object.keys(c.properties).forEach(function(h){if(h==="id"||!"".concat(c.properties[h]).match(r.secondReg)&&!"".concat(c.properties[h]).match(r.dateReg)&&isNaN(Number(c.properties[h]))){f.hasOwnProperty(h)&&delete f[h];return}f.hasOwnProperty(h)?f[h]+=1:f[h]=1})});var l=Object.keys(f).sort(function(c,h){return f[h]-f[c]});return l.length<u?l:l.slice(0,u)};_i.getAllSortProperties=e;var t=function(s,u){return u.map(function(f){return s.hasOwnProperty(f)?s[f]:0})},n=function(s){for(var u=e(s),f=[],l=0;l<s.length;l++)f[l]=t(s[l].properties,u);return f};_i.getPropertyWeight=n;var i=function(s,u){u===void 0&&(u=void 0);var f=[];return s.forEach(function(l){u===void 0&&f.push(l),l[u]!==void 0&&f.push(l[u])}),f};_i.getAllProperties=i;var a={getAllSortProperties:e,getPropertyWeight:n,getAllProperties:i};return _i.default=a,_i}var Si={},lu={},IE;function s9(){if(IE)return lu;IE=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.DistanceType=void 0;var r;return lu.DistanceType=r,function(e){e.EuclideanDistance="euclideanDistance"}(r||(lu.DistanceType=r={})),lu}var kE;function u9(){if(kE)return Si;kE=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.oneHot=Si.getDistance=Si.getAllKeyValueMap=Si.default=void 0;var r=Jl,e=s9(),t=n(Xk());function n(u){return u&&u.__esModule?u:{default:u}}var i=function(f,l,c){var h=[];l!=null&&l.length?h=l:(f.forEach(function(v){h=h.concat(Object.keys(v))}),h=(0,r.uniq)(h));var d={};return h.forEach(function(v){var p=[];f.forEach(function(g){g[v]!==void 0&&g[v]!==""&&p.push(g[v])}),p.length&&!(c!=null&&c.includes(v))&&(d[v]=(0,r.uniq)(p))}),d};Si.getAllKeyValueMap=i;var a=function(f,l,c){var h=i(f,l,c),d=[];if(!Object.keys(h).length)return d;var v=Object.values(h),p=v.every(function(g){return g.every(function(y){return typeof y=="number"})});return f.forEach(function(g,y){var m=[];Object.keys(h).forEach(function(x){var b=g[x],w=h[x],E=w.findIndex(function(C){return b===C}),S=[];if(p)S.push(b);else for(var _=0;_<w.length;_++)_===E?S.push(1):S.push(0);m=m.concat(S)}),d[y]=m}),d};Si.oneHot=a;var o=function(f,l,c,h){c===void 0&&(c=e.DistanceType.EuclideanDistance);var d=0;switch(c){case e.DistanceType.EuclideanDistance:d=new t.default(f).euclideanDistance(new t.default(l));break}return d};Si.getDistance=o;var s={getAllKeyValueMap:i,oneHot:a,getDistance:o};return Si.default=s,Si}var LE;function f9(){if(LE)return Bf;LE=1,Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.default=void 0;var r=Jl,e=a(Mv()),t=a(Xk()),n=o9(),i=u9();function a(l){return l&&l.__esModule?l:{default:l}}var o=function(c,h,d,v){for(var p=h.length,g=2*v,y=0,m=0;m<p;m++)for(var x=c[m].clusterId,b=0;b<p;b++){var w=c[b].clusterId;if(x===w){var E=h[m][b]||0,S=d[m]||0,_=d[b]||0;y+=E-S*_/g}}return y*=1/g,y},s=function(c,h){c===void 0&&(c=[]);for(var d=c.length,v=new t.default([]),p=0;p<d;p++)v=v.add(new t.default(h[p]));var g=v.avg(d);g.normalize();for(var y=0,p=0;p<d;p++){var m=new t.default(h[p]),x=m.squareEuclideanDistance(g);y+=x}var b=[];c.forEach(function(){b.push([])});for(var p=0;p<d;p++){var m=new t.default(h[p]);c[p].clusterInertial=0;for(var w=0;w<d;w++){if(p===w){b[p][w]=0;continue}var E=new t.default(h[w]);b[p][w]=m.squareEuclideanDistance(E),c[p].clusterInertial+=b[p][w]}}for(var S=0,_=2*d*y,p=0;p<d;p++)for(var C=c[p].clusterId,w=0;w<d;w++){var M=c[w].clusterId;if(!(p===w||C!==M)){var A=c[p].clusterInertial*c[w].clusterInertial/Math.pow(_,2)-b[p][w]/_;S+=A}}return Number(S.toFixed(4))},u=function(c,h,d,v,p,g,y,m,x){h===void 0&&(h=!1),d===void 0&&(d="weight"),v===void 0&&(v=1e-4),p===void 0&&(p=!1),g===void 0&&(g=void 0),y===void 0&&(y=[]),m===void 0&&(m=["id"]),x===void 0&&(x=1);var b=c.nodes,w=b===void 0?[]:b,E=c.edges,S=E===void 0?[]:E,_=[];if(p){w.forEach(function(re,J){re.properties=re.properties||{},re.originIndex=J});var C=[];w.every(function(re){return re.hasOwnProperty("nodeType")})&&(C=Array.from(new Set(w.map(function(re){return re.nodeType}))),w.forEach(function(re){re.properties.nodeType=C.findIndex(function(J){return J===re.nodeType})}));var M=(0,n.getAllProperties)(w,g);_=(0,i.oneHot)(M,y,m)}var A=1,T={},I={};w.forEach(function(re,J){var me=String(A++);re.clusterId=me,T[me]={id:me,nodes:[re]},I[re.id]={node:re,idx:J}});var L=(0,e.default)(c,h),N=[],O={},B=0;L.forEach(function(re,J){var me=0,Ae=w[J].id;O[Ae]={},re.forEach(function(Ye,Ve){if(Ye){me+=Ye;var Ke=w[Ve].id;O[Ae][Ke]=Ye,B+=Ye}}),N.push(me)}),B/=2;for(var W=1/0,D=1/0,P=0,R=[],X={};;){p&&w.every(function(re){return re.hasOwnProperty("properties")})?W=o(w,L,N,B)+s(w,_)*x:W=o(w,L,N,B),P===0&&(D=W,R=w,X=T);var Y=W>0&&W>D&&W-D<v;if(W>D&&(R=w.map(function(re){return{node:re,clusterId:re.clusterId}}),X=(0,r.clone)(T),D=W),Y||P>100)break;P++,Object.keys(T).forEach(function(re){var J=0;S.forEach(function(me){var Ae=me.source,Ye=me.target,Ve=I[Ae].node.clusterId,Ke=I[Ye].node.clusterId;(Ve===re&&Ke!==re||Ke===re&&Ve!==re)&&(J=J+(me[d]||1))}),T[re].sumTot=J}),w.forEach(function(re,J){var me=T[re.clusterId],Ae=0,Ye,Ve=N[J]/(2*B),Ke=0,xt=me.nodes;xt.forEach(function(Ot){var ut=I[Ot.id].idx;Ke+=L[J][ut]||0});var kt=Ke-me.sumTot*Ve,Lt=xt.filter(function(Ot){return Ot.id!==re.id});Lt.forEach(function(Ot,ut){_[Ot.originIndex]});var vr=s(Lt,_)*x,xr=O[re.id];if(Object.keys(xr).forEach(function(Ot){var ut=I[Ot].node,Gt=ut.clusterId;if(Gt!==re.clusterId){var _t=T[Gt],ct=_t.nodes;if(!(!ct||!ct.length)){var ve=0;ct.forEach(function(Ct){var Bt=I[Ct.id].idx;ve+=L[J][Bt]||0});var Te=ve-_t.sumTot*Ve,nt=ct.concat([re]);nt.forEach(function(Ct,Bt){_[Ct.originIndex]});var st=s(nt,_)*x,gt=Te-kt;p&&(gt=Te+st-(kt+vr)),gt>Ae&&(Ae=gt,Ye=_t)}}}),Ae>0){Ye.nodes.push(re);var pt=re.clusterId;re.clusterId=Ye.id;var Nt=me.nodes.indexOf(re);me.nodes.splice(Nt,1);var F=0,zt=0;S.forEach(function(Ot){var ut=Ot.source,Gt=Ot.target,_t=I[ut].node.clusterId,ct=I[Gt].node.clusterId;(_t===Ye.id&&ct!==Ye.id||ct===Ye.id&&_t!==Ye.id)&&(F=F+(Ot[d]||1)),(_t===pt&&ct!==pt||ct===pt&&_t!==pt)&&(zt=zt+(Ot[d]||1))}),Ye.sumTot=F,me.sumTot=zt}})}var ee={},U=0;Object.keys(X).forEach(function(re){var J=X[re];if(!J.nodes||!J.nodes.length){delete X[re];return}var me=String(U+1);me!==re&&(J.id=me,J.nodes=J.nodes.map(function(Ae){return{id:Ae.id,clusterId:me}}),X[me]=J,ee[re]=me,delete X[re],U++)}),R.forEach(function(re){var J=re.node,me=re.clusterId;J&&(J.clusterId=me,J.clusterId&&ee[J.clusterId]&&(J.clusterId=ee[J.clusterId]))});var Z=[],K={};S.forEach(function(re){var J=re.source,me=re.target,Ae=re[d]||1,Ye=I[J].node.clusterId,Ve=I[me].node.clusterId;if(!(!Ye||!Ve)){var Ke="".concat(Ye,"---").concat(Ve);if(K[Ke])K[Ke].weight+=Ae,K[Ke].count++;else{var xt={source:Ye,target:Ve,weight:Ae,count:1};K[Ke]=xt,Z.push(xt)}}});var se=[];return Object.keys(X).forEach(function(re){se.push(X[re])}),{clusters:se,clusterEdges:Z}},f=u;return Bf.default=f,Bf}var Gf={},zf={},NE;function l9(){if(NE)return zf;NE=1,Object.defineProperty(zf,"__esModule",{value:!0}),zf.default=void 0;var r=function(){function t(n){this.count=n.length,this.parent={};for(var i=0,a=n;i<a.length;i++){var o=a[i];this.parent[o]=o}}return t.prototype.find=function(n){for(;this.parent[n]!==n;)n=this.parent[n];return n},t.prototype.union=function(n,i){var a=this.find(n),o=this.find(i);a!==o&&(a<o?(this.parent[i]!==i&&this.union(this.parent[i],n),this.parent[i]=this.parent[n]):(this.parent[n]!==n&&this.union(this.parent[n],i),this.parent[n]=this.parent[i]))},t.prototype.connected=function(n,i){return this.find(n)===this.find(i)},t}(),e=r;return zf.default=e,zf}var jf={},OE;function c9(){if(OE)return jf;OE=1,Object.defineProperty(jf,"__esModule",{value:!0}),jf.default=void 0;var r=function(i,a){return i-a},e=function(){function n(i){i===void 0&&(i=r),this.compareFn=i,this.list=[]}return n.prototype.getLeft=function(i){return 2*i+1},n.prototype.getRight=function(i){return 2*i+2},n.prototype.getParent=function(i){return i===0?null:Math.floor((i-1)/2)},n.prototype.isEmpty=function(){return this.list.length<=0},n.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},n.prototype.delMin=function(){var i=this.top(),a=this.list.pop();return this.list.length>0&&(this.list[0]=a,this.moveDown(0)),i},n.prototype.insert=function(i){if(i!==null){this.list.push(i);var a=this.list.length-1;return this.moveUp(a),!0}return!1},n.prototype.moveUp=function(i){for(var a=this.getParent(i);i&&i>0&&this.compareFn(this.list[a],this.list[i])>0;){var o=this.list[a];this.list[a]=this.list[i],this.list[i]=o,i=a,a=this.getParent(i)}},n.prototype.moveDown=function(i){var a,o=i,s=this.getLeft(i),u=this.getRight(i),f=this.list.length;s!==null&&s<f&&this.compareFn(this.list[o],this.list[s])>0?o=s:u!==null&&u<f&&this.compareFn(this.list[o],this.list[u])>0&&(o=u),i!==o&&(a=[this.list[o],this.list[i]],this.list[i]=a[0],this.list[o]=a[1],this.moveDown(o))},n}(),t=e;return jf.default=t,jf}var DE;function h9(){if(DE)return Gf;DE=1,Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.default=void 0;var r=n(l9()),e=n(c9()),t=Gi();function n(u){return u&&u.__esModule?u:{default:u}}var i=function(f,l){var c=[],h=f.nodes,d=h===void 0?[]:h,v=f.edges,p=v===void 0?[]:v;if(d.length===0)return c;var g=d[0],y=new Set;y.add(g);var m=function(_,C){return l?_.weight-C.weight:0},x=new e.default(m);for((0,t.getEdgesByNodeId)(g.id,p).forEach(function(S){x.insert(S)});!x.isEmpty();){var b=x.delMin(),w=b.source,E=b.target;y.has(w)&&y.has(E)||(c.push(b),y.has(w)||(y.add(w),(0,t.getEdgesByNodeId)(w,p).forEach(function(S){x.insert(S)})),y.has(E)||(y.add(E),(0,t.getEdgesByNodeId)(E,p).forEach(function(S){x.insert(S)})))}return c},a=function(f,l){var c=[],h=f.nodes,d=h===void 0?[]:h,v=f.edges,p=v===void 0?[]:v;if(d.length===0)return c;var g=p.map(function(w){return w});l&&g.sort(function(w,E){return w.weight-E.weight});for(var y=new r.default(d.map(function(w){return w.id}));g.length>0;){var m=g.shift(),x=m.source,b=m.target;y.connected(x,b)||(c.push(m),y.union(x,b))}return c},o=function(f,l,c){var h={prim:i,kruskal:a};return c?h[c](f,l):a(f,l)},s=o;return Gf.default=s,Gf}var Uf={},PE;function d9(){if(PE)return Uf;PE=1,Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.default=void 0;var r=t(zk()),e=Gi();function t(a){return a&&a.__esModule?a:{default:a}}var n=function(o,s,u){typeof s!="number"&&(s=1e-6),typeof u!="number"&&(u=.85);for(var f=1,l=0,c=1e3,h=o.nodes,d=h===void 0?[]:h,v=o.edges,p=v===void 0?[]:v,g=d.length,y,m={},x={},b=0;b<g;++b){var w=d[b],E=w.id;m[E]=1/g,x[E]=1/g}for(var S=(0,r.default)(o);c>0&&f>s;){l=0;for(var b=0;b<g;++b){var w=d[b],E=w.id;if(y=0,S[w.id].inDegree===0)m[E]=0;else{for(var _=(0,e.getNeighbors)(E,p,"source"),C=0;C<_.length;++C){var M=_[C],A=S[M].outDegree;A>0&&(y+=x[M]/A)}m[E]=u*y,l+=m[E]}}l=(1-l)/g,f=0;for(var b=0;b<g;++b){var w=d[b],E=w.id;y=m[E]+l,f+=Math.abs(y-x[E]),x[E]=y}c-=1}return x},i=n;return Uf.default=i,Uf}var $f={},Xf={},Jr={},RE;function v9(){if(RE)return Jr;RE=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.VACANT_NODE_LABEL=Jr.VACANT_NODE_ID=Jr.VACANT_GRAPH_ID=Jr.VACANT_EDGE_LABEL=Jr.VACANT_EDGE_ID=Jr.Node=Jr.Graph=Jr.Edge=Jr.AUTO_EDGE_ID=void 0;var r=-1;Jr.VACANT_EDGE_ID=r;var e=-1;Jr.VACANT_NODE_ID=e;var t="-1";Jr.VACANT_EDGE_LABEL=t;var n="-1";Jr.VACANT_NODE_LABEL=n;var i=-1;Jr.VACANT_GRAPH_ID=i;var a="-1";Jr.AUTO_EDGE_ID=a;var o=function(){function f(l,c,h,d){l===void 0&&(l=r),c===void 0&&(c=e),h===void 0&&(h=e),d===void 0&&(d=t),this.id=l,this.from=c,this.to=h,this.label=d}return f}();Jr.Edge=o;var s=function(){function f(l,c){l===void 0&&(l=e),c===void 0&&(c=n),this.id=l,this.label=c,this.edges=[],this.edgeMap={}}return f.prototype.addEdge=function(l){this.edges.push(l),this.edgeMap[l.id]=l},f}();Jr.Node=s;var u=function(){function f(l,c,h){l===void 0&&(l=e),c===void 0&&(c=!0),h===void 0&&(h=!1),this.id=l,this.edgeIdAutoIncrease=c,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=h}return f.prototype.getNodeNum=function(){return this.nodes.length},f.prototype.addNode=function(l,c){if(!this.nodeMap[l]){var h=new s(l,c);this.nodes.push(h),this.nodeMap[l]=h,this.nodeLabelMap[c]||(this.nodeLabelMap[c]=[]),this.nodeLabelMap[c].push(l)}},f.prototype.addEdge=function(l,c,h,d){if((this.edgeIdAutoIncrease||l===void 0)&&(l=this.counter++),!(this.nodeMap[c]&&this.nodeMap[h]&&this.nodeMap[h].edgeMap[l])){var v=new o(l,c,h,d);if(this.edges.push(v),this.edgeMap[l]=v,this.nodeMap[c].addEdge(v),this.edgeLabelMap[d]||(this.edgeLabelMap[d]=[]),this.edgeLabelMap[d].push(v),!this.directed){var p=new o(l,h,c,d);this.nodeMap[h].addEdge(p),this.edgeLabelMap[d].push(p)}}},f}();return Jr.Graph=u,Jr}var BE;function p9(){if(BE)return Xf;BE=1,Object.defineProperty(Xf,"__esModule",{value:!0}),Xf.default=void 0;var r=Jl,e=v9(),t=function(){function c(h,d,v,p,g){this.fromNode=h,this.toNode=d,this.nodeEdgeNodeLabel={nodeLabel1:v||e.VACANT_NODE_LABEL,edgeLabel:p||e.VACANT_EDGE_LABEL,nodeLabel2:g||e.VACANT_NODE_LABEL}}return c.prototype.equalTo=function(h){return this.fromNode===h.formNode&&this.toNode===h.toNode&&this.nodeEdgeNodeLabel===h.nodeEdgeNodeLabel},c.prototype.notEqualTo=function(h){return!this.equalTo(h)},c}(),n=function(){function c(){this.rmpath=[],this.dfsEdgeList=[]}return c.prototype.equalTo=function(h){var d=this.dfsEdgeList.length,v=h.length;if(d!==v)return!1;for(var p=0;p<d;p++)if(this.dfsEdgeList[p]!==h[p])return!1;return!0},c.prototype.notEqualTo=function(h){return!this.equalTo(h)},c.prototype.pushBack=function(h,d,v,p,g){return this.dfsEdgeList.push(new t(h,d,v,p,g)),this.dfsEdgeList},c.prototype.toGraph=function(h,d){h===void 0&&(h=e.VACANT_GRAPH_ID),d===void 0&&(d=!1);var v=new e.Graph(h,!0,d);return this.dfsEdgeList.forEach(function(p){var g=p.fromNode,y=p.toNode,m=p.nodeEdgeNodeLabel,x=m.nodeLabel1,b=m.edgeLabel,w=m.nodeLabel2;x!==e.VACANT_NODE_LABEL&&v.addNode(g,x),w!==e.VACANT_NODE_LABEL&&v.addNode(y,w),x!==e.VACANT_NODE_LABEL&&w!==x&&v.addEdge(void 0,g,y,b)}),v},c.prototype.buildRmpath=function(){this.rmpath=[];for(var h=void 0,d=this.dfsEdgeList.length,v=d-1;v>=0;v--){var p=this.dfsEdgeList[v],g=p.fromNode,y=p.toNode;g<y&&(h===void 0||y===h)&&(this.rmpath.push(v),h=g)}return this.rmpath},c.prototype.getNodeNum=function(){var h={};return this.dfsEdgeList.forEach(function(d){h[d.fromNode]||(h[d.fromNode]=!0),h[d.toNode]||(h[d.toNode]=!0)}),Object.keys(h).length},c}(),i=function(){function c(h){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!h){for(;h;){var d=h.edge;this.edges.push(d),this.nodesUsed[d.from]=1,this.nodesUsed[d.to]=1,this.edgesUsed[d.id]=1,h=h.preNode}this.edges=this.edges.reverse()}}return c.prototype.hasNode=function(h){return this.nodesUsed[h.id]===1},c.prototype.hasEdge=function(h){return this.edgesUsed[h.id]===1},c}(),a=function(){function c(h){var d=h.graphs,v=h.minSupport,p=v===void 0?2:v,g=h.minNodeNum,y=g===void 0?1:g,m=h.maxNodeNum,x=m===void 0?4:m,b=h.top,w=b===void 0?10:b,E=h.directed,S=E===void 0?!1:E,_=h.verbose,C=_===void 0?!1:_;this.graphs=d,this.dfsCode=new n,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=p,this.top=w,this.directed=S,this.counter=0,this.maxNodeNum=x,this.minNodeNum=y,this.verbose=C,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return c.prototype.findForwardRootEdges=function(h,d){var v=this,p=[],g=h.nodeMap;return d.edges.forEach(function(y){(v.directed||d.label<=g[y.to].label)&&p.push(y)}),p},c.prototype.findBackwardEdge=function(h,d,v,p){if(!this.directed&&d===v)return null;for(var g=h.nodeMap,y=g[v.to],m=y.edges,x=m.length,b=0;b<x;b++){var w=m[b];if(!(p.hasEdge(w)||w.to!==d.from)){if(this.directed){if(g[d.from].label<g[v.to].label||g[d.from].label===g[v.to].label&&d.label<=w.label)return w}else if(d.label<w.label||d.label===w.label&&g[d.to].label<=g[v.to].label)return w}}return null},c.prototype.findForwardPureEdges=function(h,d,v,p){for(var g=[],y=d.to,m=h.nodeMap[y].edges,x=m.length,b=0;b<x;b++){var w=m[b],E=h.nodeMap[w.to];v<=E.label&&!p.hasNode(E)&&g.push(w)}return g},c.prototype.findForwardRmpathEdges=function(h,d,v,p){for(var g=[],y=h.nodeMap,m=y[d.to].label,x=y[d.from],b=x.edges,w=b.length,E=0;E<w;E++){var S=b[E],_=y[S.to].label;d.to===S.to||v>_||p.hasNode(y[S.to])||(d.label<S.label||d.label===S.label&&m<=_)&&g.push(S)}return g},c.prototype.getSupport=function(h){var d={};return h.forEach(function(v){d[v.graphId]||(d[v.graphId]=!0)}),Object.keys(d).length},c.prototype.findMinLabel=function(h){var d=void 0;return Object.keys(h).forEach(function(v){var p=h[v],g=p.nodeLabel1,y=p.edgeLabel,m=p.nodeLabel2;if(!d){d={nodeLabel1:g,edgeLabel:y,nodeLabel2:m};return}(g<d.nodeLabel1||g===d.nodeLabel1&&y<d.edgeLabel||g===d.nodeLabel1&&y===d.edgeLabel&&m<d.nodeLabel2)&&(d={nodeLabel1:g,edgeLabel:y,nodeLabel2:m})}),d},c.prototype.isMin=function(){var h=this,d=this.dfsCode;if(this.verbose&&console.log("isMin checking",d),d.dfsEdgeList.length===1)return!0;var v=this.directed,p=d.toGraph(e.VACANT_GRAPH_ID,v),g=p.nodeMap,y=new n,m={};p.nodes.forEach(function(E){var S=h.findForwardRootEdges(p,E);S.forEach(function(_){var C=g[_.to],M="".concat(E.label,"-").concat(_.label,"-").concat(C.label);m[M]||(m[M]={projected:[],nodeLabel1:E.label,edgeLabel:_.label,nodeLabel2:C.label});var A={graphId:p.id,edge:_,preNode:null};m[M].projected.push(A)})});var x=this.findMinLabel(m);if(x){y.dfsEdgeList.push(new t(0,1,x.nodeLabel1,x.edgeLabel,x.nodeLabel2));var b=function E(S){for(var _=y.buildRmpath(),C=y.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,M=y.dfsEdgeList[_[0]].toNode,A={},T=!1,I=0,L=v?-1:0,N=function(se){if(T)return"break";S.forEach(function(re){var J=new i(re),me=h.findBackwardEdge(p,J.edges[_[se]],J.edges[_[0]],J);me&&(A[me.label]||(A[me.label]={projected:[],edgeLabel:me.label}),A[me.label].projected.push({graphId:p.id,edge:A,preNode:re}),I=y.dfsEdgeList[_[se]].fromNode,T=!0)})},O=_.length-1;O>L;O--){var B=N(O);if(B==="break")break}if(T){var W=h.findMinLabel(A);y.dfsEdgeList.push(new t(M,I,e.VACANT_NODE_LABEL,W.edgeLabel,e.VACANT_NODE_LABEL));var D=y.dfsEdgeList.length-1;return h.dfsCode.dfsEdgeList[D]!==y.dfsEdgeList[D]?!1:E(A[W.edgeLabel].projected)}var P={};T=!1;var R=0;S.forEach(function(K){var se=new i(K),re=h.findForwardPureEdges(p,se.edges[_[0]],C,se);re.length>0&&(T=!0,R=M,re.forEach(function(J){var me="".concat(J.label,"-").concat(g[J.to].label);P[me]||(P[me]={projected:[],edgeLabel:J.label,nodeLabel2:g[J.to].label}),P[me].projected.push({graphId:p.id,edge:J,preNode:K})}))});for(var X=_.length,Y=function(se){if(T)return"break";var re=_[se];S.forEach(function(J){var me=new i(J),Ae=h.findForwardRmpathEdges(p,me.edges[re],C,me);Ae.length>0&&(T=!0,R=y.dfsEdgeList[re].fromNode,Ae.forEach(function(Ye){var Ve="".concat(Ye.label,"-").concat(g[Ye.to].label);P[Ve]||(P[Ve]={projected:[],edgeLabel:Ye.label,nodeLabel2:g[Ye.to].label}),P[Ve].projected.push({graphId:p.id,edge:Ye,preNode:J})}))})},O=0;O<X;O++){var ee=Y(O);if(ee==="break")break}if(!T)return!0;var U=h.findMinLabel(P);y.dfsEdgeList.push(new t(R,M+1,e.VACANT_NODE_LABEL,U.edgeLabel,U.nodeLabel2));var Z=y.dfsEdgeList.length-1;return d.dfsEdgeList[Z]!==y.dfsEdgeList[Z]?!1:E(P["".concat(U.edgeLabel,"-").concat(U.nodeLabel2)].projected)},w="".concat(x.nodeLabel1,"-").concat(x.edgeLabel,"-").concat(x.nodeLabel2);return b(m[w].projected)}},c.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var h=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,r.clone)(h))}},c.prototype.subGraphMining=function(h){var d=this,v=this.getSupport(h);if(!(v<this.minSupport)&&this.isMin()){this.report();var p=this.dfsCode.getNodeNum(),g=this.dfsCode.buildRmpath(),y=this.dfsCode.dfsEdgeList[g[0]].toNode,m=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,x={},b={};h.forEach(function(w){for(var E=d.graphs[w.graphId],S=E.nodeMap,_=new i(w),C=g.length-1;C>=0;C--){var M=d.findBackwardEdge(E,_.edges[g[C]],_.edges[g[0]],_);if(M){var A="".concat(d.dfsCode.dfsEdgeList[g[C]].fromNode,"-").concat(M.label);b[A]||(b[A]={projected:[],toNodeId:d.dfsCode.dfsEdgeList[g[C]].fromNode,edgeLabel:M.label}),b[A].projected.push({graphId:w.graphId,edge:M,preNode:w})}}if(!(p>=d.maxNodeNum)){var T=d.findForwardPureEdges(E,_.edges[g[0]],m,_);T.forEach(function(L){var N="".concat(y,"-").concat(L.label,"-").concat(S[L.to].label);x[N]||(x[N]={projected:[],fromNodeId:y,edgeLabel:L.label,nodeLabel2:S[L.to].label}),x[N].projected.push({graphId:w.graphId,edge:L,preNode:w})});for(var I=function(N){var O=d.findForwardRmpathEdges(E,_.edges[g[N]],m,_);O.forEach(function(B){var W="".concat(d.dfsCode.dfsEdgeList[g[N]].fromNode,"-").concat(B.label,"-").concat(S[B.to].label);x[W]||(x[W]={projected:[],fromNodeId:d.dfsCode.dfsEdgeList[g[N]].fromNode,edgeLabel:B.label,nodeLabel2:S[B.to].label}),x[W].projected.push({graphId:w.graphId,edge:B,preNode:w})})},C=0;C<g.length;C++)I(C)}}),Object.keys(b).forEach(function(w){var E=b[w],S=E.toNodeId,_=E.edgeLabel;d.dfsCode.dfsEdgeList.push(new t(y,S,"-1",_,"-1")),d.subGraphMining(b[w].projected),d.dfsCode.dfsEdgeList.pop()}),Object.keys(x).forEach(function(w){var E=x[w],S=E.fromNodeId,_=E.edgeLabel,C=E.nodeLabel2;d.dfsCode.dfsEdgeList.push(new t(S,y+1,e.VACANT_NODE_LABEL,_,C)),d.subGraphMining(x[w].projected),d.dfsCode.dfsEdgeList.pop()})}},c.prototype.generate1EdgeFrequentSubGraphs=function(){var h=this.graphs,d=this.directed,v=this.minSupport,p=this.frequentSize1Subgraphs,g={},y={},m={};return Object.keys(h).forEach(function(x){var b=h[x],w=b.nodeMap;b.nodes.forEach(function(E,S){var _=E.label,C="".concat(x,"-").concat(_);if(!m[C]){var M=g[_]||0;M++,g[_]=M}m[C]={graphKey:x,label:_},E.edges.forEach(function(A){var T=_,I=w[A.to].label;if(!d&&T>I){var L=I;I=T,T=L}var N=A.label,O="".concat(T,"-").concat(N,"-").concat(I);if(!y[O]){var B=y[O]||0;B++,y[O]=B}})})}),Object.keys(g).forEach(function(x){var b=g[x];if(!(b<v)){var w={nodes:[],edges:[]};w.nodes.push({id:"0",label:x}),p.push(w)}}),p},c.prototype.run=function(){var h=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var d=this.graphs;this.directed;var v={};Object.keys(d).forEach(function(p){var g=d[p],y=g.nodeMap;g.nodes.forEach(function(m){var x=h.findForwardRootEdges(g,m);x.forEach(function(b){var w=y[b.to],E="".concat(m.label,"-").concat(b.label,"-").concat(w.label);v[E]||(v[E]={projected:[],nodeLabel1:m.label,edgeLabel:b.label,nodeLabel2:w.label});var S={graphId:p,edge:b,preNode:null};v[E].projected.push(S)})})}),Object.keys(v).forEach(function(p){var g=v[p],y=g.projected,m=g.nodeLabel1,x=g.edgeLabel,b=g.nodeLabel2;h.dfsCode.dfsEdgeList.push(new t(0,1,m,x,b)),h.subGraphMining(y),h.dfsCode.dfsEdgeList.pop()})}},c}(),o=function(h,d,v,p){var g={};return Object.keys(h).forEach(function(y,m){var x=h[y],b=new e.Graph(m,!0,d),w={};x.nodes.forEach(function(E,S){b.addNode(S,E[v]),w[E.id]=S}),x.edges.forEach(function(E,S){var _=w[E.source],C=w[E.target];b.addEdge(-1,_,C,E[p])}),b&&b.getNodeNum()&&(g[b.id]=b)}),g},s=function(h,d,v){var p=[];return h.forEach(function(g){var y={nodes:[],edges:[]};g.nodes.forEach(function(m){var x;y.nodes.push((x={id:"".concat(m.id)},x[d]=m.label,x))}),g.edges.forEach(function(m){var x;y.edges.push((x={source:"".concat(m.from),target:"".concat(m.to)},x[v]=m.label,x))}),p.push(y)}),p},u="cluster",f=function(h){var d=h.graphs,v=h.directed,p=v===void 0?!1:v,g=h.nodeLabelProp,y=g===void 0?u:g,m=h.edgeLabelProp,x=m===void 0?u:m,b=o(d,p,y,x),w=h.minSupport,E=h.maxNodeNum,S=h.minNodeNum,_=h.verbose,C=h.top,M={graphs:b,minSupport:w,maxNodeNum:E,minNodeNum:S,top:C,verbose:_,directed:p},A=new a(M);A.run();var T=s(A.frequentSubgraphs,y,x);return T},l=f;return Xf.default=l,Xf}var FE;function g9(){if(FE)return $f;FE=1,Object.defineProperty($f,"__esModule",{value:!0}),$f.default=void 0;var r=Uk,e=a($k()),t=a(p9()),n=a(Qm()),i=Gi();function a(x){return x&&x.__esModule?x:{default:x}}var o=function(b,w,E,S){E===void 0&&(E="cluster"),S===void 0&&(S=2);var _=[],C=b.nodes;return w.forEach(function(M,A){_.push(s(C,M,A,E,S))}),_},s=function(b,w,E,S,_){var C=[E],M=[],A={};return w.forEach(function(T,I){if(T<=_&&E!==I){C.push(I),M.push(b[I]);var L=b[I][S];A[L]?(A[L].count++,A[L].dists.push(T)):A[L]={count:1,dists:[T]}}}),Object.keys(A).forEach(function(T){A[T].dists=A[T].dists.sort(function(I,L){return I-L})}),{nodeIdx:E,nodeId:b[E].id,nodeIdxs:C,neighbors:M,neighborNum:C.length-1,nodeLabelCountMap:A}},u=function(b,w,E,S,_){var C=Math.ceil(E/w),M={},A=0;return S.forEach(function(T,I){for(var L=0,N=0,O=T.nodeIdxs,B=T.neighborNum-1;L<C;){for(var W=O[1+Math.floor(Math.random()*B)],D=0;(M["".concat(I,"-").concat(W)]||M["".concat(W,"-").concat(I)])&&(W=Math.floor(Math.random()*w),D++,!(D>2*w)););if(D<2*w&&(M["".concat(I,"-").concat(W)]={start:I,end:W,distance:_[I][W]},L++,A++,A>=E))return M;if(N++,N>2*w)break}if(L<C){var P=C-L;C=(C+P)/(w-I-1)}}),M},f=function(b,w,E,S){var _=E.nodes;return S||(S={}),Object.keys(b).forEach(function(C){var M,A;if(!(S&&S[C])){S[C]={nodes:[],edges:[]};var T=b[C],I=(M=w[T.start])===null||M===void 0?void 0:M.nodeIdxs,L=(A=w[T.end])===null||A===void 0?void 0:A.nodeIdxs;if(!(!I||!L)){var N=new Set(L),O=I.filter(function(R){return N.has(R)});if(!(!O||!O.length)){for(var B={},W=O.length,D=0;D<W;D++){var P=_[O[D]];S[C].nodes.push(P),B[P.id]=!0}E.edges.forEach(function(R){B[R.source]&&B[R.target]&&S[C].edges.push(R)})}}}}),S},l=function(b,w,E,S){var _,C,M={};b.nodes.forEach(function(T){M[T.id]=T});var A=0;return!(!((_=w==null?void 0:w.edges)===null||_===void 0)&&_.length)||((C=w==null?void 0:w.nodes)===null||C===void 0?void 0:C.length)<2?0:(b.edges.forEach(function(T){var I=M[T.source][E],L=M[T.target][E],N=w==null?void 0:w.nodes[0][E],O=w==null?void 0:w.nodes[1][E],B=w==null?void 0:w.edges[0][S];T[S]===B&&(I===N&&L===O||I===O&&L===N)&&A++}),A)},c=function(b,w,E){for(var S=1/0,_=0,C=function(T){var I=b[T],L=Object.keys(I).sort(function(R,X){return I[R]-I[X]}),N=10,O=[];L.forEach(function(R,X){O[X%N]||(O[X%N]={graphs:[],totalCount:0,aveCount:0}),O[X%N].graphs.push(R),O[X%N].totalCount+=I[R]});var B=0,W=[];O.forEach(function(R){var X=R.totalCount/R.graphs.length;R.aveCount=X,W.push(X);var Y=0,ee=R.length;R.graphs.forEach(function(U,Z){var K=I[U];R.graphs.forEach(function(se,re){Z!==re&&(Y+=Math.abs(K-I[se]))})}),Y/=ee*(ee-1)/2,B+=Y}),B/=O.length;var D=0;W.forEach(function(R,X){W.forEach(function(Y,ee){X!==ee&&(D+=Math.abs(R-Y))}),D/=W.length*(W.length-1)/2});var P=D-B;S<P&&(S=P,_=T)},M=0;M<w;M++)C(M);return{structure:E[_],structureCountMap:b[_]}},h=function(b,w){var E={},S={};return b.forEach(function(_,C){E[_.id]={idx:C,node:_,degree:0,inDegree:0,outDegree:0};var M=_[w];S[M]||(S[M]=[]),S[M].push(_)}),{nodeMap:E,nodeLabelMap:S}},d=function(b,w,E){var S={},_={};return b.forEach(function(C,M){S["".concat(i.uniqueId)]={idx:M,edge:C};var A=C[w];_[A]||(_[A]=[]),_[A].push(C);var T=E[C.source];T&&(T.degree++,T.outDegree++);var I=E[C.target];I&&(I.degree++,I.inDegree++)}),{edgeMap:S,edgeLabelMap:_}},v=function(b,w,E){var S=w.length,_={};return w.forEach(function(C,M){for(var A=E?0:M+1,T=b[M].id,I=A;I<S;I++)if(M!==I){var L=b[I].id,N=C[I];_["".concat(T,"-").concat(L)]=N,E||(_["".concat(L,"-").concat(T)]=N)}}),_},p=function(b,w,E,S,_,C,M,A,T,I,L){var N,O="".concat(w.id,"-").concat(E.id);if(I&&I[O])return I[O];var B=L?L[O]:void 0;if(!B){var W=(N={},N[O]={start:S[w.id].idx,end:S[E.id].idx,distance:_},N);L=f(W,C,b,L),B=L[O]}return l(B,M,A,T)},g=function(b,w,E,S){var _,C,M,A=(_=b[w])===null||_===void 0?void 0:_.degree,T=(C=b[w])===null||C===void 0?void 0:C.inDegree,I=(M=b[w])===null||M===void 0?void 0:M.outDegree;return b[w]===void 0&&(A=1/0,T=1/0,I=1/0,S[w].forEach(function(L){var N=E[L.id].degree;A>N&&(A=N);var O=E[L.id].inDegree;T>O&&(T=O);var B=E[L.id].outDegree;I>B&&(I=B)}),b[w]={degree:A,inDegree:T,outDegree:I}),{minPatternNodeLabelDegree:A,minPatternNodeLabelInDegree:T,minPatternNodeLabelOutDegree:I}},y=function(b,w,E,S,_,C,M){var A;if(E===void 0&&(E=!1),C===void 0&&(C="cluster"),M===void 0&&(M="cluster"),!(!b||!b.nodes)){var T=b.nodes.length;if(T){var I=(0,e.default)(b,E),L=(0,e.default)(w,E),N=v(b.nodes,I,E),O=v(w.nodes,L,E),B=h(b.nodes,C),W=B.nodeMap,D=B.nodeLabelMap,P=h(w.nodes,C),R=P.nodeMap,X=P.nodeLabelMap;d(b.edges,M,W);var Y=d(w.edges,M,R).edgeLabelMap,ee=[];L==null||L.forEach(function(wt){ee=ee.concat(wt)}),_||(_=Math.max.apply(Math,(0,r.__spreadArray)((0,r.__spreadArray)([],ee,!1),[2],!1))),S||(S=_);var U=o(b,I,C,S),Z=o(w,L,C,S),K=Math.min(100,T*(T-1)/2),se=u(S,T,K,U,I),re=f(se,U,b),J=10,me=1,Ae=1,Ye=4,Ve={graphs:re,nodeLabelProp:C,edgeLabelProp:M,minSupport:me,minNodeNum:Ae,maxNodeNum:Ye,directed:E},Ke=(0,t.default)(Ve).slice(0,J),xt=Ke.length,kt=[];Ke.forEach(function(wt,er){kt[er]={},Object.keys(re).forEach(function(ir){var Yt=re[ir],br=l(Yt,wt,C,M);kt[er][ir]=br})});var Lt=c(kt,xt,Ke),vr=Lt.structure,xr=Lt.structureCountMap,pt=w.nodes[0],Nt=[],F=(A=w.nodes[0])===null||A===void 0?void 0:A[C],zt=-1/0;w.nodes.forEach(function(wt){var er=wt[C],ir=D[er];(ir==null?void 0:ir.length)>zt&&(zt=ir.length,Nt=ir,F=er,pt=wt)});var Ot={},ut={},Gt={},_t={},ct={},ve={};Object.keys(X).forEach(function(wt,er){ct[wt]=[],E&&(ve[wt]=[]);var ir=X[wt],Yt={};ir.forEach(function(fr){var mr=O["".concat(pt.id,"-").concat(fr.id)];if(mr&&ct[wt].push(mr),Yt["".concat(pt.id,"-").concat(fr.id)]={start:0,end:R[fr.id].idx,distance:mr},E){var Lr=O["".concat(fr.id,"-").concat(pt.id)];Lr&&ve[wt].push(Lr)}}),ct[wt]=ct[wt].sort(function(fr,mr){return fr-mr}),E&&(ve[wt]=ve[wt].sort(function(fr,mr){return fr-mr})),ut=f(Yt,Z,w,ut);var br=[];if(Object.keys(Yt).forEach(function(fr){if(Gt[fr]){br.push(Gt[fr]);return}var mr=ut[fr];Gt[fr]=l(mr,vr,C,M),br.push(Gt[fr])}),br=br.sort(function(fr,mr){return mr-fr}),_t["".concat(pt.id,"-").concat(wt)]=br,wt!==F)for(var It=(Nt==null?void 0:Nt.length)||0,wr=function(mr){var Lr=Nt[mr],Vr=U[W[Lr.id].idx],cn=Vr.nodeLabelCountMap[wt],Mr=X[wt].length;if(!cn||cn.count<Mr)return Nt.splice(mr,1),"continue";for(var hn=!1,rn=0;rn<Mr;rn++)if(cn.dists[rn]>ct[wt][rn]){hn=!0;break}if(hn)return Nt.splice(mr,1),"continue";var sr={};Vr.neighbors.forEach(function(_r){var an=N["".concat(Lr.id,"-").concat(_r.id)];sr["".concat(Lr.id,"-").concat(_r.id)]={start:W[Lr.id].idx,end:W[_r.id].idx,distance:an}}),re=f(sr,U,b,re);var Er=[];Object.keys(sr).forEach(function(_r){if(xr[_r]){Er.push(xr[_r]);return}var an=re[_r];xr[_r]=l(an,vr,C,M),Er.push(xr[_r])}),Er=Er.sort(function(_r,an){return an-_r});for(var jt=!1,rn=0;rn<Mr;rn++)if(Er[rn]<br[rn]){jt=!0;break}if(jt)return Nt.splice(mr,1),"continue"},Ht=It-1;Ht>=0;Ht--)wr(Ht)});var Te=[];Nt==null||Nt.forEach(function(wt){for(var er=W[wt.id].idx,ir=s(b.nodes,I[er],er,C,_),Yt=ir.neighbors,br=Yt.length,It=!1,wr=br-1;wr>=0;wr--){if(Yt.length+1<w.nodes.length){It=!0;return}var Ht=Yt[wr],fr=Ht[C];if(!X[fr]||!X[fr].length){Yt.splice(wr,1);continue}if(!ct[fr]||!ct[fr].length){Yt.splice(wr,1);continue}var mr="".concat(wt.id,"-").concat(Ht.id),Lr=N[mr],Vr=ct[fr].length-1,cn=ct[fr][Vr];if(Lr>cn){Yt.splice(wr,1);continue}if(E){var Mr="".concat(Ht.id,"-").concat(wt.id),hn=N[Mr];Vr=ve[fr].length-1;var rn=ve[fr][Vr];if(hn>rn){Yt.splice(wr,1);continue}}var sr=xr[mr]?xr[mr]:p(b,wt,Ht,W,Lr,U,vr,C,M,xr,re),Er="".concat(pt.id,"-").concat(fr),jt=_t[Er][_t[Er].length-1];if(sr<jt){Yt.splice(wr,1);continue}var _r=g(Ot,fr,R,X),an=_r.minPatternNodeLabelDegree;if(_r.minPatternNodeLabelInDegree,_r.minPatternNodeLabelOutDegree,W[Ht.id].degree<an){Yt.splice(wr,1);continue}}It||Te.push({nodes:[wt].concat(Yt)})});var nt=(0,n.default)(w,pt.id,!1).length,st={};E?(Object.keys(nt).forEach(function(wt){var er=R[wt].node[C];st[er]?st[er].push(nt[wt]):st[er]=[nt[wt]]}),Object.keys(st).forEach(function(wt){st[wt].sort(function(er,ir){return er-ir})})):st=ct;for(var gt=Te.length,Ct=function(er){var ir=Te[er],Yt=ir.nodes[0],br={},It={};ir.nodes.forEach(function(Cr,In){It[Cr.id]={idx:In,node:Cr,degree:0,inDegree:0,outDegree:0};var Hr=Cr[C];br[Hr]?br[Hr]++:br[Hr]=1});var wr=[],Ht={};b.edges.forEach(function(Cr){It[Cr.source]&&It[Cr.target]&&(wr.push(Cr),Ht[Cr[M]]?Ht[Cr[M]]++:Ht[Cr[M]]=1,It[Cr.source].degree++,It[Cr.target].degree++,It[Cr.source].outDegree++,It[Cr.target].inDegree++)});for(var fr=Object.keys(Y).length,mr=!1,Lr=0;Lr<fr;Lr++){var Vr=Object.keys(Y)[Lr];if(!Ht[Vr]||Ht[Vr]<Y[Vr].length){mr=!0;break}}if(mr)return Te.splice(er,1),"continue";var cn=wr.length;if(cn<w.edges.length)return Te.splice(er,1),"break";for(var Mr=!1,hn=function(In){var Hr=wr[In],ti=Hr[M],wa=Y[ti];if(!wa||!wa.length)return Ht[ti]--,wa&&Ht[ti]<wa.length?(Mr=!0,"break"):(wr.splice(In,1),It[Hr.source].degree--,It[Hr.target].degree--,It[Hr.source].outDegree--,It[Hr.target].inDegree--,"continue");var fc=It[Hr.source].node[C],lc=It[Hr.target].node[C],sf=!1;if(wa.forEach(function(cc){var hc=R[cc.source].node,dc=R[cc.target].node;hc[C]===fc&&dc[C]===lc&&(sf=!0),!E&&hc[C]===lc&&dc[C]===fc&&(sf=!0)}),!sf)return Ht[ti]--,wa&&Ht[ti]<wa.length?(Mr=!0,"break"):(wr.splice(In,1),It[Hr.source].degree--,It[Hr.target].degree--,It[Hr.source].outDegree--,It[Hr.target].inDegree--,"continue")},Lr=cn-1;Lr>=0;Lr--){var rn=hn(Lr);if(rn==="break")break}if(Mr)return Te.splice(er,1),"continue";ir.edges=wr;var sr=(0,n.default)(ir,ir.nodes[0].id,!1).length;if(Object.keys(sr).reverse().forEach(function(Cr){if(!(Cr===ir.nodes[0].id||Mr)){if(sr[Cr]===1/0){var In=It[Cr].node[C];if(br[In]--,br[In]<X[In].length){Mr=!0;return}var Hr=ir.nodes.indexOf(It[Cr].node);ir.nodes.splice(Hr,1),It[Cr]=void 0;return}var ti=W[Cr].node[C];if(!st[ti]||!st[ti].length||sr[Cr]>st[ti][st[ti].length-1]){var In=It[Cr].node[C];if(br[In]--,br[In]<X[In].length){Mr=!0;return}var Hr=ir.nodes.indexOf(It[Cr].node);ir.nodes.splice(Hr,1),It[Cr]=void 0}}}),Mr)return Te.splice(er,1),"continue";for(var Er=!0,jt=0;Er&&!Mr;){Er=!1;var _r=E?It[Yt.id].degree<R[pt.id].degree||It[Yt.id].inDegree<R[pt.id].inDegree||It[Yt.id].outDegree<R[pt.id].outDegree:It[Yt.id].degree<R[pt.id].degree;if(_r){Mr=!0;break}if(br[Yt[C]]<X[Yt[C]].length){Mr=!0;break}for(var an=ir.nodes.length,xa=an-1;xa>=0;xa--){var Xn=ir.nodes[xa],Ha=It[Xn.id].degree,js=It[Xn.id].inDegree,Us=It[Xn.id].outDegree,$s=Xn[C],of=g(Ot,$s,R,X),uc=of.minPatternNodeLabelDegree,tp=of.minPatternNodeLabelInDegree,rp=of.minPatternNodeLabelOutDegree,np=E?Ha<uc||js<tp||Us<rp:Ha<uc;if(np){if(br[Xn[C]]--,br[Xn[C]]<X[Xn[C]].length){Mr=!0;break}ir.nodes.splice(xa,1),It[Xn.id]=void 0,Er=!0}}if(Mr||!Er&&jt!==0)break;cn=wr.length;for(var Xs=cn-1;Xs>=0;Xs--){var yi=wr[Xs];if(!It[yi.source]||!It[yi.target]){wr.splice(Xs,1);var Ys=yi[M];if(Ht[Ys]--,It[yi.source]&&(It[yi.source].degree--,It[yi.source].outDegree--),It[yi.target]&&(It[yi.target].degree--,It[yi.target].inDegree--),Y[Ys]&&Ht[Ys]<Y[Ys].length){Mr=!0;break}Er=!0}}jt++}if(Mr||Mr||ir.nodes.length<w.nodes.length||wr.length<w.edges.length)return Te.splice(er,1),"continue"},Bt=gt-1;Bt>=0;Bt--){var Sr=Ct(Bt);if(Sr==="break")break}for(var yr=Te.length,Rr=function(er){var ir=Te[er],Yt={};ir.edges.forEach(function(wr){var Ht="".concat(wr.source,"-").concat(wr.target,"-").concat(wr.label);Yt[Ht]?Yt[Ht]++:Yt[Ht]=1});for(var br=function(Ht){var fr=Te[Ht],mr={};fr.edges.forEach(function(Vr){var cn="".concat(Vr.source,"-").concat(Vr.target,"-").concat(Vr.label);mr[cn]?mr[cn]++:mr[cn]=1});var Lr=!0;Object.keys(mr).length!==Object.keys(Yt).length?Lr=!1:Object.keys(Yt).forEach(function(Vr){mr[Vr]!==Yt[Vr]&&(Lr=!1)}),Lr&&Te.splice(Ht,1)},It=yr-1;It>er;It--)br(It);yr=Te.length},Bt=0;Bt<=yr-1;Bt++)Rr(Bt);return Te}}},m=y;return $f.default=m,$f}var GE;function y9(){return GE||(GE=1,function(r){function e(b){"@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(b)}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=x(Mv()),n=x(t9()),i=x(Gk()),a=m(zk()),o=x(r9()),s=x(jk()),u=x(Qm()),f=n9(),l=x($k()),c=x(i9()),h=x(f9()),d=x(h9()),v=x(d9()),p=x(g9()),g=Gi();function y(b){if(typeof WeakMap!="function")return null;var w=new WeakMap,E=new WeakMap;return(y=function(_){return _?E:w})(b)}function m(b,w){if(b&&b.__esModule)return b;if(b===null||e(b)!=="object"&&typeof b!="function")return{default:b};var E=y(w);if(E&&E.has(b))return E.get(b);var S={},_=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in b)if(C!=="default"&&Object.prototype.hasOwnProperty.call(b,C)){var M=_?Object.getOwnPropertyDescriptor(b,C):null;M&&(M.get||M.set)?Object.defineProperty(S,C,M):S[C]=b[C]}return S.default=b,E&&E.set(b,S),S}function x(b){return b&&b.__esModule?b:{default:b}}}(pg)),pg}var zE;function m9(){if(zE)return kf;zE=1;function r(s){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},r(s)}Object.defineProperty(kf,"__esModule",{value:!0}),kf.default=void 0;var e=i(y9()),t=Km();function n(s){if(typeof WeakMap!="function")return null;var u=new WeakMap,f=new WeakMap;return(n=function(c){return c?f:u})(s)}function i(s,u){if(s&&s.__esModule)return s;if(s===null||r(s)!=="object"&&typeof s!="function")return{default:s};var f=n(u);if(f&&f.has(s))return f.get(s);var l={},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in s)if(h!=="default"&&Object.prototype.hasOwnProperty.call(s,h)){var d=c?Object.getOwnPropertyDescriptor(s,h):null;d&&(d.get||d.set)?Object.defineProperty(l,h,d):l[h]=s[h]}return l.default=s,f&&f.set(s,l),l}var a=typeof self<"u"?self:{};a.onmessage=function(s){var u=s.data,f=u._algorithmType,l=u.data;if(f){if(typeof e[f]=="function"){var c=e[f].apply(e,l);a.postMessage({_algorithmType:t.MESSAGE.SUCCESS,data:c});return}a.postMessage({_algorithmType:t.MESSAGE.FAILURE})}};var o=null;return kf.default=o,kf}var jE;function b9(){if(jE)return If;jE=1,Object.defineProperty(If,"__esModule",{value:!0}),If.default=void 0;var r=Km(),e=t(m9());function t(a){return a&&a.__esModule?a:{default:a}}var n=function(o){return function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return new Promise(function(f,l){var c=new e.default;c.postMessage({_algorithmType:o,data:s}),c.onmessage=function(h){var d=h.data,v=d.data,p=d._algorithmType;r.MESSAGE.SUCCESS===p?f(v):l(),c.terminate()}})}},i=n;return If.default=i,If}var UE;function x9(){if(UE)return tr;UE=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.pageRankAsync=tr.minimumSpanningTreeAsync=tr.louvainAsync=tr.labelPropagationAsync=tr.getOutDegreeAsync=tr.getNeighborsAsync=tr.getInDegreeAsync=tr.getDegreeAsync=tr.getAdjMatrixAsync=tr.floydWarshallAsync=tr.findShortestPathAsync=tr.findAllPathAsync=tr.dijkstraAsync=tr.detectCycleAsync=tr.detectAllUndirectedCycleAsync=tr.detectAllDirectedCycleAsync=tr.detectAllCyclesAsync=tr.connectedComponentAsync=tr.GADDIAsync=void 0;var r=t(b9()),e=Km();function t(E){return E&&E.__esModule?E:{default:E}}var n=function(S,_){return(0,r.default)(e.ALGORITHM.getAdjMatrix).apply(void 0,[S,_])};tr.getAdjMatrixAsync=n;var i=function(S,_){return(0,r.default)(e.ALGORITHM.connectedComponent).apply(void 0,[S,_])};tr.connectedComponentAsync=i;var a=function(S){return(0,r.default)(e.ALGORITHM.getDegree)(S)};tr.getDegreeAsync=a;var o=function(S,_){return(0,r.default)(e.ALGORITHM.getInDegree)(S,_)};tr.getInDegreeAsync=o;var s=function(S,_){return(0,r.default)(e.ALGORITHM.getOutDegree)(S,_)};tr.getOutDegreeAsync=s;var u=function(S){return(0,r.default)(e.ALGORITHM.detectCycle)(S)};tr.detectCycleAsync=u;var f=function(S){return(0,r.default)(e.ALGORITHM.detectAllCycles)(S)};tr.detectAllCyclesAsync=f;var l=function(S){return(0,r.default)(e.ALGORITHM.detectAllDirectedCycle)(S)};tr.detectAllDirectedCycleAsync=l;var c=function(S){return(0,r.default)(e.ALGORITHM.detectAllUndirectedCycle)(S)};tr.detectAllUndirectedCycleAsync=c;var h=function(S,_,C,M){return(0,r.default)(e.ALGORITHM.dijkstra).apply(void 0,[S,_,C,M])};tr.dijkstraAsync=h;var d=function(S,_,C,M){return(0,r.default)(e.ALGORITHM.findAllPath).apply(void 0,[S,_,C,M])};tr.findAllPathAsync=d;var v=function(S,_,C,M,A){return(0,r.default)(e.ALGORITHM.findShortestPath).apply(void 0,[S,_,C,M,A])};tr.findShortestPathAsync=v;var p=function(S,_){return(0,r.default)(e.ALGORITHM.floydWarshall).apply(void 0,[S,_])};tr.floydWarshallAsync=p;var g=function(S,_,C,M){return M===void 0&&(M=1e3),(0,r.default)(e.ALGORITHM.labelPropagation)(S,_,C,M)};tr.labelPropagationAsync=g;var y=function(S,_,C,M){return(0,r.default)(e.ALGORITHM.louvain)(S,_,C,M)};tr.louvainAsync=y;var m=function(S,_,C){return(0,r.default)(e.ALGORITHM.minimumSpanningTree).apply(void 0,[S,_,C])};tr.minimumSpanningTreeAsync=m;var x=function(S,_,C){return(0,r.default)(e.ALGORITHM.pageRank).apply(void 0,[S,_,C])};tr.pageRankAsync=x;var b=function(S,_,C){return(0,r.default)(e.ALGORITHM.getNeighbors).apply(void 0,[S,_,C])};tr.getNeighborsAsync=b;var w=function(S,_,C,M,A,T,I){return C===void 0&&(C=!1),T===void 0&&(T="cluster"),I===void 0&&(I="cluster"),(0,r.default)(e.ALGORITHM.GADDI).apply(void 0,[S,_,C,M,A,T,I])};return tr.GADDIAsync=w,tr}var $E;function w9(){return $E||($E=1,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=x9(),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}(vg)),vg}var Yk=w9();const E9=va(Yk),_9=b3({__proto__:null,default:E9},[Yk]);function S9(){return window?window.devicePixelRatio:1}function Wk(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function bs(r,e,t,n,i,a){return i>=r&&i<=r+t&&a>=e&&a<=e+n}function Fl(r,e){return!(e.minX>r.maxX||e.maxX<r.minX||e.minY>r.maxY||e.maxY<r.minY)}function M9(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 XE(r,e){return r[0]===e[0]&&r[1]===e[1]}var C9=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,A9=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,T9=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,qk=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function Vk(r,e){var t=r.match(qk);_e(t,function(n){var i=n.split(":");e.addColorStop(i[0],i[1])})}function I9(r,e,t){var n=C9.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 Vk(a,d),d}function k9(r,e,t){var n=A9.exec(t),i=parseFloat(n[1]),a=parseFloat(n[2]),o=parseFloat(n[3]),s=n[4];if(o===0){var u=s.match(qk);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 Vk(s,d),d}function L9(r,e,t){if(e.get("patternSource")&&e.get("patternSource")===t)return e.get("pattern");var n,i,a=T9.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 N9(r,e,t){var n=e.getBBox();if(isNaN(n.x)||isNaN(n.y)||isNaN(n.width)||isNaN(n.height))return t;if(Fe(t)){if(t[1]==="("||t[2]==="("){if(t[0]==="l")return I9(r,e,t);if(t[0]==="r")return k9(r,e,t);if(t[0]==="p")return L9(r,e,t)}return t}if(t instanceof CanvasPattern)return t}function O9(r){var e=0,t=0,n=0,i=0;return mt(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 lh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function yy(r,e){return lh(r)*lh(e)?(r[0]*e[0]+r[1]*e[1])/(lh(r)*lh(e)):1}function YE(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(yy(r,e))}function WE(r,e){var t=e[1],n=e[2],i=yv(mv(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,x=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,b=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=YE([1,0],b),S=YE(b,w);return yy(b,w)<=-1&&(S=Math.PI),yy(b,w)>=1&&(S=0),o===0&&S>0&&(S=S-2*Math.PI),o===1&&S<0&&(S=S+2*Math.PI),{cx:m,cy:x,rx:XE(r,[f,l])?0:t,ry:XE(r,[f,l])?0:n,startAngle:E,endAngle:E+S,xRotation:i,arcFlag:a,sweepFlag:o}}var jd=Math.sin,Ud=Math.cos,Jm=Math.atan2,ch=Math.PI;function Hk(r,e,t,n,i,a,o){var s=e.stroke,u=e.lineWidth,f=t-i,l=n-a,c=Jm(l,f),h=new n1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*Ud(ch/6)+","+10*jd(ch/6)+" L0,0 L"+10*Ud(ch/6)+",-"+10*jd(ch/6),stroke:s,lineWidth:u}});h.translate(i,a),h.rotateAtPoint(i,a,c),r.set(o?"startArrowShape":"endArrowShape",h)}function Zk(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=un(c,["d","fill","stroke","lineWidth"]),y=t-i,m=n-a,x=Jm(m,y);h&&(i=i-Ud(x)*h,a=a-jd(x)*h);var b=new n1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:z(z({},g),{stroke:v||f,lineWidth:p||l,fill:d})});b.translate(i,a),b.rotateAtPoint(i,a,x),r.set(o?"startArrowShape":"endArrowShape",b)}function Es(r,e,t,n,i){var a=Jm(n-e,t-r);return{dx:Ud(a)*i,dy:jd(a)*i}}function e1(r,e,t,n,i,a){typeof e.startArrow=="object"?Zk(r,e,t,n,i,a,!0):e.startArrow?Hk(r,e,t,n,i,a,!0):r.set("startArrowShape",null)}function t1(r,e,t,n,i,a){typeof e.endArrow=="object"?Zk(r,e,t,n,i,a,!1):e.endArrow?Hk(r,e,t,n,i,a,!1):r.set("startArrowShape",null)}var qE={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function $u(r,e){var t=e.attr();for(var n in t){var i=t[n],a=qE[n]?qE[n]:n;a==="matrix"&&i?r.transform(i[0],i[1],i[3],i[4],i[6],i[7]):a==="lineDash"&&r.setLineDash?mt(i)&&r.setLineDash(i):(a==="strokeStyle"||a==="fillStyle"?i=N9(r,e,i):a==="globalAlpha"&&(i=i*r.globalAlpha),r[a]=i)}}function my(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 D9(r,e,t){var n=r.get("refreshElements");_e(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?r1(e):by(e,t)}function by(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()&&r1(n.cfg.children);else if(n.cfg.refresh)n.isGroup()&&by(n.cfg.children,e);else{var i=P9(n,e);n.cfg.refresh=i,i&&n.isGroup()&&by(n.cfg.children,e)}}}function Kk(r){for(var e=0;e<r.length;e++){var t=r[e];t.cfg.hasChanged=!1,t.isGroup()&&!t.destroyed&&Kk(t.cfg.children)}}function r1(r,e){for(var t=0;t<r.length;t++){var n=r[t];n.cfg.visible&&(n.cfg.refresh=!0,n.isGroup()&&r1(n.get("children")))}}function P9(r,e){var t=r.cfg.cacheCanvasBBox,n=r.cfg.isInView&&t&&Fl(t,e);return n}function Qk(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=Es(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=Es(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=Es(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=WE(s,c),n[l]=y)):y=WE(s,c);var m=y.cx,x=y.cy,b=y.rx,w=y.ry,E=y.startAngle,S=y.endAngle,_=y.xRotation,C=y.sweepFlag;if(e.ellipse)e.ellipse(m,x,b,w,_,E,S,1-C);else{var M=b>w?b:w,A=b>w?1:b/w,T=b>w?w/b:1;e.translate(m,x),e.rotate(_),e.scale(A,T),e.arc(0,0,M,E,S,1-C),e.scale(1/A,1/T),e.rotate(-_),e.translate(-m,-x)}break}case"Z":e.closePath();break}if(h==="Z")s=u;else{var I=c.length;s=[c[I-2],c[I-1]]}}}}function Jk(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 R9(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=M9(t,i):n?e=t:a&&(e=i)}return e}function B9(r){if(!r.length)return null;var e=[],t=[],n=[],i=[];return _e(r,function(a){var o=R9(a);o&&(e.push(o.minX),t.push(o.minY),n.push(o.maxX),i.push(o.maxY))}),{minX:ca(e),minY:ca(t),maxX:la(n),maxY:la(i)}}function F9(r,e){return!r||!e||!Fl(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 eL=function(r){Rt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onCanvasChange=function(t){Jk(this,t)},e.prototype.getShapeBase=function(){return sm},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(t,n){n&&(t.save(),$u(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.cacheCanvasBBox=function(){var t=this.cfg.children,n=[],i=[];_e(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=ca(n),s=la(n),u=ca(i),f=la(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",Fl(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(),$u(t,this),this._applyClip(t,this.getClip()),my(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}(rk),zi=function(r){Rt(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 z(z({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return sm},e.prototype.getGroupBase=function(){return eL},e.prototype.onCanvasChange=function(t){Jk(this,t)},e.prototype.calculateBBox=function(){var t=this.get("type"),n=this.getHitLineWidth(),i=ak(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(),$u(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(!Fl(n,a)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}t.save(),$u(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=Fl(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()&&(!ht(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.isStroke()&&i>0&&(!ht(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}(nk),G9=function(r){Rt(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 z(z({},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=Wk(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}(zi);function hh(r,e,t,n){return r/(t*t)+e/(n*n)}var z9=function(r){Rt(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 z(z({},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?hh(d,v,c+u,h+u)<=1:a?hh(d,v,c,h)<=1:i?hh(d,v,c-u,h-u)>=1&&hh(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}(zi);function VE(r){return r instanceof HTMLElement&&Fe(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS"}var j9=function(r){Rt(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 z(z({},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(Fe(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)):VE(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||VE(h))&&(!ht(u)&&!ht(f)&&!ht(l)&&!ht(c)?t.drawImage(h,u,f,l,c,i,a,o,s):t.drawImage(h,i,a,o,s))},e}(zi);function bo(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?xn.pointToLine(r,e,t,n,a,o)<=i/2:!1}var U9=function(r){Rt(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 z(z({},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&&e1(this,t,a,o,n,i),u&&t1(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 bo(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=Es(i,a,o,s,n.startArrow.d)),f&&f.d&&(c=Es(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 xn.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 xn.pointAt(i,a,o,s,t)},e}(zi),$9={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"]]}},X9=function(r){Rt(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 ht(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(Pr(a))s=a,u=s(n,i,o),u=mk(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");Qk(this,t,{path:n},i)},e.Symbols=$9,e}(zi);function tL(r,e,t){var n=vk();return r.createPath(n),n.isPointInPath(e,t)}var Y9=1e-6;function gg(r){return Math.abs(r)<Y9?0:r<0?-1:1}function W9(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 rL(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(W9(o,s,[e,t]))return!0;gg(o[1]-t)>0!=gg(s[1]-t)>0&&gg(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function sl(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 Wk(f.x,f.y,o,s)<=a/2}var q9=vi;function V9(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 H9(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&&!bs(h.x-o,h.y-o,h.width+e,h.height+e,t,n))){switch(u.command){case"L":case"Z":a=bo(c[0],c[1],f[0],f[1],e,t,n);break;case"Q":var d=lk.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],t,n);a=d<=e/2;break;case"C":var v=pl.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,x=p.ry,b=p.startAngle,w=p.endAngle,E=p.xRotation,S=[t,n,1],_=m>x?m:x,C=m>x?1:m/x,M=m>x?x/m:1,A=q9(null,[["t",-g,-y],["r",-E],["s",1/C,1/M]]);xv(S,S,A),a=sl(0,0,_,b,w,e,S[0],S[1]);break}if(a)break}}return a}function Z9(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 dh=z({hasArc:V9,extractPolygons:Z9,isPointInStroke:H9},Qz);function HE(r,e,t){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=rL(a,e,t),n)break}return n}var n1=function(r){Rt(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 z(z({},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=mk(t);var n=dh.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=bk(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();e1(this,t,a[0][0],a[0][1],a[1][0],a[1][1])}if(i){var a=this.getEndTangent();t1(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=dh.isPointInStroke(s,o,t,n,l)}if(!f&&a)if(u)f=tL(this,t,n);else{var c=this.attr("path"),h=dh.extractPolygons(c);f=HE(h.polygons,t,n)||HE(h.polylines,t,n)}return f},e.prototype.createPath=function(t){var n=this.attr(),i=this.get("paramsCache");Qk(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 ht(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;_e(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(ht(s)||ht(a))return null;var u=s.length,f=o[a+1];return pl.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",dh.pathToCurve(t))},e.prototype._setTcache=function(){var t=0,n=0,i=[],a,o,s,u,f=this.get("curve");if(f){if(_e(f,function(l,c){s=f[c+1],u=l.length,s&&(t+=pl.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}_e(f,function(l,c){s=f[c+1],u=l.length,s&&(a=[],a[0]=n/t,o=pl.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}(zi);function nL(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(bo(s,u,f,l,e,t,n))return!0}if(i){var c=r[0],h=r[a-1];if(bo(c[0],c[1],h[0],h[1],e,t,n))return!0}return!1}var K9=function(r){Rt(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=nL(s,o,t,n,!0)),!u&&a&&(u=rL(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}(zi),Q9=function(r){Rt(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 z(z({},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&&e1(this,t,i[1][0],i[1][1],u,f),o&&t1(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 nL(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=Es(u,f,i[1][0],i[1][1],a.d);u+=h.dx,f+=h.dy}if(o&&o.d){var h=Es(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 ht(n)?(this.set("totalLength",dk.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 _e(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),xn.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;_e(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=xn.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}(zi);function J9(r,e,t,n,i,a,o){var s=i/2;return bs(r-s,e-s,t,i,a,o)||bs(r+t-s,e-s,i,n,a,o)||bs(r+s,e+n-s,t,i,a,o)||bs(r-s,e+s,i,n,a,o)}function e$(r,e,t,n,i,a,o,s){return bo(r+i,e,r+t-i,e,a,o,s)||bo(r+t,e+i,r+t,e+n-i,a,o,s)||bo(r+t-i,e+n,r+i,e+n,a,o,s)||bo(r,e+n-i,r,e+i,a,o,s)||sl(r+t-i,e+i,i,1.5*Math.PI,2*Math.PI,a,o,s)||sl(r+t-i,e+n-i,i,0,.5*Math.PI,a,o,s)||sl(r+i,e+n-i,i,.5*Math.PI,Math.PI,a,o,s)||sl(r+i,e+i,i,Math.PI,1.5*Math.PI,a,o,s)}var t$=function(r){Rt(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 z(z({},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=e$(u,f,l,c,h,o,t,n)),!v&&a&&(v=tL(this,t,n)),v}else{var d=o/2;if(a&&i)return bs(u-d,f-d,l+d,c+d,t,n);if(a)return bs(u,f,l,c,t,n);if(i)return J9(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=O9(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}(zi),r$=function(r){Rt(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 z(z({},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=gk(t)},e.prototype._setText=function(t){var n=null;Fe(t)&&t.indexOf(`
|
|
21
|
+
`)!==-1&&(n=t.split(`
|
|
22
|
+
`)),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=pk(a.text,a.fontSize,a.lineHeight),h;_e(n,function(d,v){h=u+v*(l+f)-c+f,o==="middle"&&(h+=c-f-(c-f)/2),o==="top"&&(h+=c-f),ht(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;ht(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&&(!ht(o)&&o!==1&&(t.globalAlpha=a),this.stroke(t)),this.isFill()&&(!ht(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}(zi);function n$(r,e){if(e){var t=FI(e);return ys(t,r)}return r}function iL(r,e,t){var n=r.getTotalMatrix();if(n){var i=n$([e,t,1],n),a=i[0],o=i[1];return[a,o]}return[e,t]}function ZE(r,e,t){if(r.isCanvas&&r.isCanvas())return!0;if(!K0(r)||r.cfg.isInView===!1)return!1;if(r.cfg.clipShape){var n=iL(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 aL(r,e,t){if(!ZE(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=aL(s,e,t);else if(ZE(s,e,t)){var u=s,f=iL(s,e,t),l=f[0],c=f[1];u.isInShape(l,c)&&(n=s)}if(n)break}return n}var Fa=function(r){Rt(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 sm},e.prototype.getGroupBase=function(){return eL},e.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||S9();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=aL(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=B9(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=F9(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&&(CA(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),$u(t,this),my(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(),$u(t,this),D9(this,i,a),my(t,i,a),t.restore()):n.length&&Kk(n),_e(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=MA(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}(tk),xy={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},pr={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 hi(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function oL(r){var e=xy[r.type],t=r.getParent();if(!e)throw new Error("the type "+r.type+" is not supported by svg");var n=hi(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 sL(r,e){var t=r.get("el"),n=kA(t.children).sort(e),i=document.createDocumentFragment();n.forEach(function(a){i.appendChild(a)}),t.appendChild(i)}function i$(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 a$(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 ec(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 Gl(r,e){var t=r.getClip(),n=r.get("el");if(!t)n.removeAttribute("clip-path");else if(t&&!n.hasAttribute("clip-path")){oL(t),t.createPath(e);var i=e.addClip(t);n.setAttribute("clip-path","url(#"+i+")")}}function uL(r,e){e.forEach(function(t){t.draw(r)})}function fL(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")i$(o,a.indexOf(r));else if(e==="sort"){var l=r.get("children");l&&l.length&&sL(r,function(c,h){return l.indexOf(c)-l.indexOf(h)?1:0})}else e==="clear"?o&&(o.innerHTML=""):e==="matrix"?ec(r):e==="clip"?Gl(r,n):e==="attr"||e==="add"&&r.draw(n)}}var lL=function(r){Rt(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=hi("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){fL(this,t)},e.prototype.getShapeBase=function(){return um},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(),Gl(this,t),this.createPath(t),n.length&&uL(t,n))},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");_e(n||i,function(o,s){pr[s]&&a.setAttribute(pr[s],o)}),ec(this)},e}(rk),pi=function(r){Rt(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 z(z({},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 um},e.prototype.getGroupBase=function(){return lL},e.prototype.onCanvasChange=function(t){fL(this,t)},e.prototype.calculateBBox=function(){var t=this.get("el"),n=null;if(t)n=t.getBBox();else{var i=ak(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||oL(this),Gl(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(pr.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(pr.strokeOpacity,l),c&&h.setAttribute(pr.lineWidth,c))},e.prototype._setColor=function(t,n,i){var a=this.get("el");if(!i){a.setAttribute(pr[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(pr[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(i)){var o=t.find("pattern",i);o||(o=t.addPattern(i)),a.setAttribute(pr[n],"url(#"+o+")")}else a.setAttribute(pr[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)&&a$(this,t)},e.prototype.transform=function(t){var n=this.attr(),i=(t||n).matrix;i&&ec(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}(nk),o$=function(r){Rt(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 z(z({},t),{x:0,y:0,r:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");_e(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):pr[s]&&a.setAttribute(pr[s],o)})},e}(pi),s$=function(r){Rt(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(_e(n||i,function(f,l){pr[l]&&a.setAttribute(pr[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}(pi),u$=function(r){Rt(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 z(z({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");_e(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):pr[s]&&a.setAttribute(pr[s],o)})},e}(pi),f$=function(r){Rt(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 z(z({},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");_e(n||a,function(s,u){u==="img"?i._setImage(a.img):pr[u]&&o.setAttribute(pr[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(Fe(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&&Fe(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}(pi),l$=function(r){Rt(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 z(z({},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");_e(n||i,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=wn(o)?t.addArrow(i,pr[s]):t.getDefaultArrow(i,pr[s]);a.setAttribute(pr[s],"url(#"+u+")")}else a.removeAttribute(pr[s]);else pr[s]&&a.setAttribute(pr[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return xn.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 xn.pointAt(i,a,o,s,t)},e}(pi),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 KE={get:function(r){return vh[r]},register:function(r,e){vh[r]=e},remove:function(r){delete vh[r]},getAll:function(){return vh}};var c$=function(r){Rt(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 mt(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 Pr(o)?s=o:s=KE.get(o),s?s(n,i,a):(console.warn(s+" symbol is not exist."),null)},e.symbolsFactory=KE,e}(pi),h$=function(r){Rt(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 z(z({},t),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");_e(n||a,function(s,u){if(u==="path"&&mt(s))o.setAttribute("d",i._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var f=wn(s)?t.addArrow(a,pr[u]):t.getDefaultArrow(a,pr[u]);o.setAttribute(pr[u],"url(#"+f+")")}else o.removeAttribute(pr[u]);else pr[u]&&o.setAttribute(pr[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}(pi),d$=function(r){Rt(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");_e(n||i,function(o,s){s==="points"&&mt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):pr[s]&&a.setAttribute(pr[s],o)})},e}(pi),v$=function(r){Rt(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 z(z({},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");_e(n||i,function(o,s){s==="points"&&mt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):pr[s]&&a.setAttribute(pr[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return ht(n)?(this.set("totalLength",dk.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 _e(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),xn.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;_e(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=xn.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}(pi);function p$(r){var e=0,t=0,n=0,i=0;return mt(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 g$=function(r){Rt(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 z(z({},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"];_e(n||a,function(f,l){u.indexOf(l)!==-1&&!s?(o.setAttribute("d",i._assembleRect(a)),s=!0):u.indexOf(l)===-1&&pr[l]&&o.setAttribute(pr[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=p$(s);mt(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}(pi),QE=.3,y$={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},m$={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},b$={left:"left",start:"left",center:"middle",right:"end",end:"end"},x$=function(r){Rt(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 z(z({},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(),_e(n||a,function(s,u){u==="text"?i._setText(""+s):u==="matrix"&&s?ec(i):pr[u]&&o.setAttribute(pr[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=BI();o&&o.name==="firefox"?t.setAttribute("dominant-baseline",m$[i]||"alphabetic"):t.setAttribute("alignment-baseline",y$[i]||"baseline"),t.setAttribute("text-anchor",b$[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(`
|
|
23
|
+
`)){var u=t.split(`
|
|
24
|
+
`),f=u.length-1,l="";_e(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+QE)+'em">'+c+"</tspan>":s==="hanging"&&(l+='<tspan x="'+a+'" dy="'+(-(f-1)-QE)+'em">'+c+"</tspan>"):l+='<tspan x="'+a+'" dy="1em">'+c+"</tspan>"}),n.innerHTML=l}else n.innerHTML=t},e}(pi),w$=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,E$=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,_$=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function cL(r){var e=r.match(_$);if(!e)return"";var t="";return e.sort(function(n,i){return n=n.split(":"),i=i.split(":"),Number(n[0])-Number(i[0])}),_e(e,function(n){n=n.split(":"),t+='<stop offset="'+n[0]+'" stop-color="'+n[1]+'"></stop>'}),t}function S$(r,e){var t=w$.exec(r),n=yv(mv(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=cL(i)}function M$(r,e){var t=E$.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=cL(o)}var C$=function(){function r(e){this.cfg={};var t=null,n=ha("gradient_");return e.toLowerCase()[0]==="l"?(t=hi("linearGradient"),S$(e,t)):(t=hi("radialGradient"),M$(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}(),A$={shadowColor:"color",shadowOpacity:"opacity",shadowBlur:"blur",shadowOffsetX:"dx",shadowOffsetY:"dy"},T$={x:"-40%",y:"-40%",width:"200%",height:"200%"},I$=function(){function r(e){this.type="filter",this.cfg={},this.type="filter";var t=hi("filter");return _e(T$,function(n,i){t.setAttribute(i,n)}),this.el=t,this.id=ha("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 _e(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[A$[e]]=t,this._parseShadow(n,this.el),this},r.prototype._parseShadow=function(e,t){var n=`<feDropShadow
|
|
25
|
+
dx="`+(e.dx||0)+`"
|
|
26
|
+
dy="`+(e.dy||0)+`"
|
|
27
|
+
stdDeviation="`+(e.blur?e.blur/10:0)+`"
|
|
28
|
+
flood-color="`+(e.color?e.color:"#000")+`"
|
|
29
|
+
flood-opacity="`+(e.opacity?e.opacity:1)+`"
|
|
30
|
+
/>`;t.innerHTML=n},r}(),JE=function(){function r(e,t){this.cfg={};var n=hi("marker"),i=ha("marker_");n.setAttribute("id",i);var a=hi("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;mt(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}(),k$=function(){function r(e){this.type="clip",this.cfg={};var t=hi("clipPath");this.el=t,this.id=ha("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}(),L$=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,N$=function(){function r(e){this.cfg={};var t=hi("pattern");t.setAttribute("patternUnits","userSpaceOnUse");var n=hi("image");t.appendChild(n);var i=ha("pattern_");t.id=i,this.el=t,this.id=i,this.cfg=e;var a=L$.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}(),O$=function(){function r(e){var t=hi("defs"),n=ha("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 JE(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 C$(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addArrow=function(e,t){var n=new JE(e,t);return this.el.appendChild(n.el),this.add(n),n.id},r.prototype.addShadow=function(e){var t=new I$(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addPattern=function(e){var t=new N$(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addClip=function(e){var t=new k$(e);return this.el.appendChild(t.el),this.add(t),t.id},r}(),yl=function(r){Rt(e,r);function e(t){return r.call(this,z(z({},t),{autoDraw:!0,renderer:"svg"}))||this}return e.prototype.getShapeBase=function(){return um},e.prototype.getGroupBase=function(){return lL},e.prototype.getShape=function(t,n,i){var a=i.target||i.srcElement;if(!xy[a.tagName]){for(var o=a.parentNode;o&&!xy[o.tagName];)o=o.parentNode;a=o}return this.find(function(s){return s.get("el")===a})},e.prototype.createDom=function(){var t=hi("svg"),n=new O$(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&&sL(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"?ec(this):t==="clip"?Gl(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();Gl(this,t),n.length&&uL(t,n)},e}(tk);function ph(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 ul,yg,hL,wy;function D$(){ul=document.createElement("table"),yg=document.createElement("tr"),hL=/^\s*<(\w+|!)[^>]*>/,wy={tr:document.createElement("tbody"),tbody:ul,thead:ul,tfoot:ul,td:yg,th:yg,"*":document.createElement("div")}}function Or(r){ul||D$();var e=hL.test(r)&&RegExp.$1;(!e||!(e in wy))&&(e="*");var t=wy[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 Qt(r,e){if(r)for(var t in e)e.hasOwnProperty(t)&&(r.style[t]=e[t]);return r}var mg={exports:{}},bg,e2;function P$(){return e2||(e2=1,bg={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]}),bg}var xg={exports:{}},wg,t2;function R$(){return t2||(t2=1,wg=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")}),wg}var r2;function B$(){if(r2)return xg.exports;r2=1;var r=R$(),e=Array.prototype.concat,t=Array.prototype.slice,n=xg.exports=function(a){for(var o=[],s=0,u=a.length;s<u;s++){var f=a[s];r(f)?o=e.call(o,t.call(f)):o.push(f)}return o};return n.wrap=function(i){return function(){return i(n(arguments))}},xg.exports}var n2;function F$(){if(n2)return mg.exports;n2=1;var r=P$(),e=B$(),t=Object.hasOwnProperty,n=Object.create(null);for(var i in r)t.call(r,i)&&(n[r[i]]=i);var a=mg.exports={to:{},get:{}};a.get=function(u){var f=u.substring(0,3).toLowerCase(),l,c;switch(f){case"hsl":l=a.get.hsl(u),c="hsl";break;case"hwb":l=a.get.hwb(u),c="hwb";break;default:l=a.get.rgb(u),c="rgb";break}return l?{model:c,value:l}:null},a.get.rgb=function(u){if(!u)return null;var f=/^#([a-f0-9]{3,4})$/i,l=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,c=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,h=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,d=/^(\w+)$/,v=[0,0,0,1],p,g,y;if(p=u.match(l)){for(y=p[2],p=p[1],g=0;g<3;g++){var m=g*2;v[g]=parseInt(p.slice(m,m+2),16)}y&&(v[3]=parseInt(y,16)/255)}else if(p=u.match(f)){for(p=p[1],y=p[3],g=0;g<3;g++)v[g]=parseInt(p[g]+p[g],16);y&&(v[3]=parseInt(y+y,16)/255)}else if(p=u.match(c)){for(g=0;g<3;g++)v[g]=parseInt(p[g+1],0);p[4]&&(p[5]?v[3]=parseFloat(p[4])*.01:v[3]=parseFloat(p[4]))}else if(p=u.match(h)){for(g=0;g<3;g++)v[g]=Math.round(parseFloat(p[g+1])*2.55);p[4]&&(p[5]?v[3]=parseFloat(p[4])*.01:v[3]=parseFloat(p[4]))}else return(p=u.match(d))?p[1]==="transparent"?[0,0,0,0]:t.call(r,p[1])?(v=r[p[1]],v[3]=1,v):null:null;for(g=0;g<3;g++)v[g]=o(v[g],0,255);return v[3]=o(v[3],0,1),v},a.get.hsl=function(u){if(!u)return null;var f=/^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*)?\)$/,l=u.match(f);if(l){var c=parseFloat(l[4]),h=(parseFloat(l[1])%360+360)%360,d=o(parseFloat(l[2]),0,100),v=o(parseFloat(l[3]),0,100),p=o(isNaN(c)?1:c,0,1);return[h,d,v,p]}return null},a.get.hwb=function(u){if(!u)return null;var f=/^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*)?\)$/,l=u.match(f);if(l){var c=parseFloat(l[4]),h=(parseFloat(l[1])%360+360)%360,d=o(parseFloat(l[2]),0,100),v=o(parseFloat(l[3]),0,100),p=o(isNaN(c)?1:c,0,1);return[h,d,v,p]}return null},a.to.hex=function(){var u=e(arguments);return"#"+s(u[0])+s(u[1])+s(u[2])+(u[3]<1?s(Math.round(u[3]*255)):"")},a.to.rgb=function(){var u=e(arguments);return u.length<4||u[3]===1?"rgb("+Math.round(u[0])+", "+Math.round(u[1])+", "+Math.round(u[2])+")":"rgba("+Math.round(u[0])+", "+Math.round(u[1])+", "+Math.round(u[2])+", "+u[3]+")"},a.to.rgb.percent=function(){var u=e(arguments),f=Math.round(u[0]/255*100),l=Math.round(u[1]/255*100),c=Math.round(u[2]/255*100);return u.length<4||u[3]===1?"rgb("+f+"%, "+l+"%, "+c+"%)":"rgba("+f+"%, "+l+"%, "+c+"%, "+u[3]+")"},a.to.hsl=function(){var u=e(arguments);return u.length<4||u[3]===1?"hsl("+u[0]+", "+u[1]+"%, "+u[2]+"%)":"hsla("+u[0]+", "+u[1]+"%, "+u[2]+"%, "+u[3]+")"},a.to.hwb=function(){var u=e(arguments),f="";return u.length>=4&&u[3]!==1&&(f=", "+u[3]),"hwb("+u[0]+", "+u[1]+"%, "+u[2]+"%"+f+")"},a.to.keyword=function(u){return n[u.slice(0,3)]};function o(u,f,l){return Math.min(Math.max(f,u),l)}function s(u){var f=Math.round(u).toString(16).toUpperCase();return f.length<2?"0"+f:f}return mg.exports}var Eg={exports:{}},_g,i2;function G$(){return i2||(i2=1,_g={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]}),_g}var a2;function dL(){if(a2)return Eg.exports;a2=1;var r=G$(),e={};for(var t in r)r.hasOwnProperty(t)&&(e[r[t]]=t);var n=Eg.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 i in n)if(n.hasOwnProperty(i)){if(!("channels"in n[i]))throw new Error("missing channels property: "+i);if(!("labels"in n[i]))throw new Error("missing channel labels property: "+i);if(n[i].labels.length!==n[i].channels)throw new Error("channel and label counts mismatch: "+i);var a=n[i].channels,o=n[i].labels;delete n[i].channels,delete n[i].labels,Object.defineProperty(n[i],"channels",{value:a}),Object.defineProperty(n[i],"labels",{value:o})}n.rgb.hsl=function(u){var f=u[0]/255,l=u[1]/255,c=u[2]/255,h=Math.min(f,l,c),d=Math.max(f,l,c),v=d-h,p,g,y;return d===h?p=0:f===d?p=(l-c)/v:l===d?p=2+(c-f)/v:c===d&&(p=4+(f-l)/v),p=Math.min(p*60,360),p<0&&(p+=360),y=(h+d)/2,d===h?g=0:y<=.5?g=v/(d+h):g=v/(2-d-h),[p,g*100,y*100]},n.rgb.hsv=function(u){var f,l,c,h,d,v=u[0]/255,p=u[1]/255,g=u[2]/255,y=Math.max(v,p,g),m=y-Math.min(v,p,g),x=function(b){return(y-b)/6/m+1/2};return m===0?h=d=0:(d=m/y,f=x(v),l=x(p),c=x(g),v===y?h=c-l:p===y?h=1/3+f-c:g===y&&(h=2/3+l-f),h<0?h+=1:h>1&&(h-=1)),[h*360,d*100,y*100]},n.rgb.hwb=function(u){var f=u[0],l=u[1],c=u[2],h=n.rgb.hsl(u)[0],d=1/255*Math.min(f,Math.min(l,c));return c=1-1/255*Math.max(f,Math.max(l,c)),[h,d*100,c*100]},n.rgb.cmyk=function(u){var f=u[0]/255,l=u[1]/255,c=u[2]/255,h,d,v,p;return p=Math.min(1-f,1-l,1-c),h=(1-f-p)/(1-p)||0,d=(1-l-p)/(1-p)||0,v=(1-c-p)/(1-p)||0,[h*100,d*100,v*100,p*100]};function s(u,f){return Math.pow(u[0]-f[0],2)+Math.pow(u[1]-f[1],2)+Math.pow(u[2]-f[2],2)}return n.rgb.keyword=function(u){var f=e[u];if(f)return f;var l=1/0,c;for(var h in r)if(r.hasOwnProperty(h)){var d=r[h],v=s(u,d);v<l&&(l=v,c=h)}return c},n.keyword.rgb=function(u){return r[u]},n.rgb.xyz=function(u){var f=u[0]/255,l=u[1]/255,c=u[2]/255;f=f>.04045?Math.pow((f+.055)/1.055,2.4):f/12.92,l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92,c=c>.04045?Math.pow((c+.055)/1.055,2.4):c/12.92;var h=f*.4124+l*.3576+c*.1805,d=f*.2126+l*.7152+c*.0722,v=f*.0193+l*.1192+c*.9505;return[h*100,d*100,v*100]},n.rgb.lab=function(u){var f=n.rgb.xyz(u),l=f[0],c=f[1],h=f[2],d,v,p;return l/=95.047,c/=100,h/=108.883,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,c=c>.008856?Math.pow(c,1/3):7.787*c+16/116,h=h>.008856?Math.pow(h,1/3):7.787*h+16/116,d=116*c-16,v=500*(l-c),p=200*(c-h),[d,v,p]},n.hsl.rgb=function(u){var f=u[0]/360,l=u[1]/100,c=u[2]/100,h,d,v,p,g;if(l===0)return g=c*255,[g,g,g];c<.5?d=c*(1+l):d=c+l-c*l,h=2*c-d,p=[0,0,0];for(var y=0;y<3;y++)v=f+1/3*-(y-1),v<0&&v++,v>1&&v--,6*v<1?g=h+(d-h)*6*v:2*v<1?g=d:3*v<2?g=h+(d-h)*(2/3-v)*6:g=h,p[y]=g*255;return p},n.hsl.hsv=function(u){var f=u[0],l=u[1]/100,c=u[2]/100,h=l,d=Math.max(c,.01),v,p;return c*=2,l*=c<=1?c:2-c,h*=d<=1?d:2-d,p=(c+l)/2,v=c===0?2*h/(d+h):2*l/(c+l),[f,v*100,p*100]},n.hsv.rgb=function(u){var f=u[0]/60,l=u[1]/100,c=u[2]/100,h=Math.floor(f)%6,d=f-Math.floor(f),v=255*c*(1-l),p=255*c*(1-l*d),g=255*c*(1-l*(1-d));switch(c*=255,h){case 0:return[c,g,v];case 1:return[p,c,v];case 2:return[v,c,g];case 3:return[v,p,c];case 4:return[g,v,c];case 5:return[c,v,p]}},n.hsv.hsl=function(u){var f=u[0],l=u[1]/100,c=u[2]/100,h=Math.max(c,.01),d,v,p;return p=(2-l)*c,d=(2-l)*h,v=l*h,v/=d<=1?d:2-d,v=v||0,p/=2,[f,v*100,p*100]},n.hwb.rgb=function(u){var f=u[0]/360,l=u[1]/100,c=u[2]/100,h=l+c,d,v,p,g;h>1&&(l/=h,c/=h),d=Math.floor(6*f),v=1-c,p=6*f-d,d&1&&(p=1-p),g=l+p*(v-l);var y,m,x;switch(d){default:case 6:case 0:y=v,m=g,x=l;break;case 1:y=g,m=v,x=l;break;case 2:y=l,m=v,x=g;break;case 3:y=l,m=g,x=v;break;case 4:y=g,m=l,x=v;break;case 5:y=v,m=l,x=g;break}return[y*255,m*255,x*255]},n.cmyk.rgb=function(u){var f=u[0]/100,l=u[1]/100,c=u[2]/100,h=u[3]/100,d,v,p;return d=1-Math.min(1,f*(1-h)+h),v=1-Math.min(1,l*(1-h)+h),p=1-Math.min(1,c*(1-h)+h),[d*255,v*255,p*255]},n.xyz.rgb=function(u){var f=u[0]/100,l=u[1]/100,c=u[2]/100,h,d,v;return h=f*3.2406+l*-1.5372+c*-.4986,d=f*-.9689+l*1.8758+c*.0415,v=f*.0557+l*-.204+c*1.057,h=h>.0031308?1.055*Math.pow(h,1/2.4)-.055:h*12.92,d=d>.0031308?1.055*Math.pow(d,1/2.4)-.055:d*12.92,v=v>.0031308?1.055*Math.pow(v,1/2.4)-.055:v*12.92,h=Math.min(Math.max(0,h),1),d=Math.min(Math.max(0,d),1),v=Math.min(Math.max(0,v),1),[h*255,d*255,v*255]},n.xyz.lab=function(u){var f=u[0],l=u[1],c=u[2],h,d,v;return f/=95.047,l/=100,c/=108.883,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,c=c>.008856?Math.pow(c,1/3):7.787*c+16/116,h=116*l-16,d=500*(f-l),v=200*(l-c),[h,d,v]},n.lab.xyz=function(u){var f=u[0],l=u[1],c=u[2],h,d,v;d=(f+16)/116,h=l/500+d,v=d-c/200;var p=Math.pow(d,3),g=Math.pow(h,3),y=Math.pow(v,3);return d=p>.008856?p:(d-16/116)/7.787,h=g>.008856?g:(h-16/116)/7.787,v=y>.008856?y:(v-16/116)/7.787,h*=95.047,d*=100,v*=108.883,[h,d,v]},n.lab.lch=function(u){var f=u[0],l=u[1],c=u[2],h,d,v;return h=Math.atan2(c,l),d=h*360/2/Math.PI,d<0&&(d+=360),v=Math.sqrt(l*l+c*c),[f,v,d]},n.lch.lab=function(u){var f=u[0],l=u[1],c=u[2],h,d,v;return v=c/360*2*Math.PI,h=l*Math.cos(v),d=l*Math.sin(v),[f,h,d]},n.rgb.ansi16=function(u){var f=u[0],l=u[1],c=u[2],h=1 in arguments?arguments[1]:n.rgb.hsv(u)[2];if(h=Math.round(h/50),h===0)return 30;var d=30+(Math.round(c/255)<<2|Math.round(l/255)<<1|Math.round(f/255));return h===2&&(d+=60),d},n.hsv.ansi16=function(u){return n.rgb.ansi16(n.hsv.rgb(u),u[2])},n.rgb.ansi256=function(u){var f=u[0],l=u[1],c=u[2];if(f===l&&l===c)return f<8?16:f>248?231:Math.round((f-8)/247*24)+232;var h=16+36*Math.round(f/255*5)+6*Math.round(l/255*5)+Math.round(c/255*5);return h},n.ansi16.rgb=function(u){var f=u%10;if(f===0||f===7)return u>50&&(f+=3.5),f=f/10.5*255,[f,f,f];var l=(~~(u>50)+1)*.5,c=(f&1)*l*255,h=(f>>1&1)*l*255,d=(f>>2&1)*l*255;return[c,h,d]},n.ansi256.rgb=function(u){if(u>=232){var f=(u-232)*10+8;return[f,f,f]}u-=16;var l,c=Math.floor(u/36)/5*255,h=Math.floor((l=u%36)/6)/5*255,d=l%6/5*255;return[c,h,d]},n.rgb.hex=function(u){var f=((Math.round(u[0])&255)<<16)+((Math.round(u[1])&255)<<8)+(Math.round(u[2])&255),l=f.toString(16).toUpperCase();return"000000".substring(l.length)+l},n.hex.rgb=function(u){var f=u.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!f)return[0,0,0];var l=f[0];f[0].length===3&&(l=l.split("").map(function(p){return p+p}).join(""));var c=parseInt(l,16),h=c>>16&255,d=c>>8&255,v=c&255;return[h,d,v]},n.rgb.hcg=function(u){var f=u[0]/255,l=u[1]/255,c=u[2]/255,h=Math.max(Math.max(f,l),c),d=Math.min(Math.min(f,l),c),v=h-d,p,g;return v<1?p=d/(1-v):p=0,v<=0?g=0:h===f?g=(l-c)/v%6:h===l?g=2+(c-f)/v:g=4+(f-l)/v+4,g/=6,g%=1,[g*360,v*100,p*100]},n.hsl.hcg=function(u){var f=u[1]/100,l=u[2]/100,c=1,h=0;return l<.5?c=2*f*l:c=2*f*(1-l),c<1&&(h=(l-.5*c)/(1-c)),[u[0],c*100,h*100]},n.hsv.hcg=function(u){var f=u[1]/100,l=u[2]/100,c=f*l,h=0;return c<1&&(h=(l-c)/(1-c)),[u[0],c*100,h*100]},n.hcg.rgb=function(u){var f=u[0]/360,l=u[1]/100,c=u[2]/100;if(l===0)return[c*255,c*255,c*255];var h=[0,0,0],d=f%1*6,v=d%1,p=1-v,g=0;switch(Math.floor(d)){case 0:h[0]=1,h[1]=v,h[2]=0;break;case 1:h[0]=p,h[1]=1,h[2]=0;break;case 2:h[0]=0,h[1]=1,h[2]=v;break;case 3:h[0]=0,h[1]=p,h[2]=1;break;case 4:h[0]=v,h[1]=0,h[2]=1;break;default:h[0]=1,h[1]=0,h[2]=p}return g=(1-l)*c,[(l*h[0]+g)*255,(l*h[1]+g)*255,(l*h[2]+g)*255]},n.hcg.hsv=function(u){var f=u[1]/100,l=u[2]/100,c=f+l*(1-f),h=0;return c>0&&(h=f/c),[u[0],h*100,c*100]},n.hcg.hsl=function(u){var f=u[1]/100,l=u[2]/100,c=l*(1-f)+.5*f,h=0;return c>0&&c<.5?h=f/(2*c):c>=.5&&c<1&&(h=f/(2*(1-c))),[u[0],h*100,c*100]},n.hcg.hwb=function(u){var f=u[1]/100,l=u[2]/100,c=f+l*(1-f);return[u[0],(c-f)*100,(1-c)*100]},n.hwb.hcg=function(u){var f=u[1]/100,l=u[2]/100,c=1-l,h=c-f,d=0;return h<1&&(d=(c-h)/(1-h)),[u[0],h*100,d*100]},n.apple.rgb=function(u){return[u[0]/65535*255,u[1]/65535*255,u[2]/65535*255]},n.rgb.apple=function(u){return[u[0]/255*65535,u[1]/255*65535,u[2]/255*65535]},n.gray.rgb=function(u){return[u[0]/100*255,u[0]/100*255,u[0]/100*255]},n.gray.hsl=n.gray.hsv=function(u){return[0,0,u[0]]},n.gray.hwb=function(u){return[0,100,u[0]]},n.gray.cmyk=function(u){return[0,0,0,u[0]]},n.gray.lab=function(u){return[u[0],0,0]},n.gray.hex=function(u){var f=Math.round(u[0]/100*255)&255,l=(f<<16)+(f<<8)+f,c=l.toString(16).toUpperCase();return"000000".substring(c.length)+c},n.rgb.gray=function(u){var f=(u[0]+u[1]+u[2])/3;return[f/255*100]},Eg.exports}var Sg,o2;function z$(){if(o2)return Sg;o2=1;var r=dL();function e(){for(var a={},o=Object.keys(r),s=o.length,u=0;u<s;u++)a[o[u]]={distance:-1,parent:null};return a}function t(a){var o=e(),s=[a];for(o[a].distance=0;s.length;)for(var u=s.pop(),f=Object.keys(r[u]),l=f.length,c=0;c<l;c++){var h=f[c],d=o[h];d.distance===-1&&(d.distance=o[u].distance+1,d.parent=u,s.unshift(h))}return o}function n(a,o){return function(s){return o(a(s))}}function i(a,o){for(var s=[o[a].parent,a],u=r[o[a].parent][a],f=o[a].parent;o[f].parent;)s.unshift(o[f].parent),u=n(r[o[f].parent][f],u),f=o[f].parent;return u.conversion=s,u}return Sg=function(a){for(var o=t(a),s={},u=Object.keys(o),f=u.length,l=0;l<f;l++){var c=u[l],h=o[c];h.parent!==null&&(s[c]=i(c,o))}return s},Sg}var Mg,s2;function j$(){if(s2)return Mg;s2=1;var r=dL(),e=z$(),t={},n=Object.keys(r);function i(o){var s=function(u){return u==null?u:(arguments.length>1&&(u=Array.prototype.slice.call(arguments)),o(u))};return"conversion"in o&&(s.conversion=o.conversion),s}function a(o){var s=function(u){if(u==null)return u;arguments.length>1&&(u=Array.prototype.slice.call(arguments));var f=o(u);if(typeof f=="object")for(var l=f.length,c=0;c<l;c++)f[c]=Math.round(f[c]);return f};return"conversion"in o&&(s.conversion=o.conversion),s}return n.forEach(function(o){t[o]={},Object.defineProperty(t[o],"channels",{value:r[o].channels}),Object.defineProperty(t[o],"labels",{value:r[o].labels});var s=e(o),u=Object.keys(s);u.forEach(function(f){var l=s[f];t[o][f]=a(l),t[o][f].raw=i(l)})}),Mg=t,Mg}var Cg,u2;function U$(){if(u2)return Cg;u2=1;var r=F$(),e=j$(),t=[].slice,n=["keyword","gray","hex"],i={};Object.keys(e).forEach(function(d){i[t.call(e[d].labels).sort().join("")]=d});var a={};function o(d,v){if(!(this instanceof o))return new o(d,v);if(v&&v in n&&(v=null),v&&!(v in e))throw new Error("Unknown model: "+v);var p,g;if(d==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(d instanceof o)this.model=d.model,this.color=d.color.slice(),this.valpha=d.valpha;else if(typeof d=="string"){var y=r.get(d);if(y===null)throw new Error("Unable to parse color from string: "+d);this.model=y.model,g=e[this.model].channels,this.color=y.value.slice(0,g),this.valpha=typeof y.value[g]=="number"?y.value[g]:1}else if(d.length){this.model=v||"rgb",g=e[this.model].channels;var m=t.call(d,0,g);this.color=h(m,g),this.valpha=typeof d[g]=="number"?d[g]:1}else if(typeof d=="number")d&=16777215,this.model="rgb",this.color=[d>>16&255,d>>8&255,d&255],this.valpha=1;else{this.valpha=1;var x=Object.keys(d);"alpha"in d&&(x.splice(x.indexOf("alpha"),1),this.valpha=typeof d.alpha=="number"?d.alpha:0);var b=x.sort().join("");if(!(b in i))throw new Error("Unable to parse color from object: "+JSON.stringify(d));this.model=i[b];var w=e[this.model].labels,E=[];for(p=0;p<w.length;p++)E.push(d[w[p]]);this.color=h(E)}if(a[this.model])for(g=e[this.model].channels,p=0;p<g;p++){var S=a[this.model][p];S&&(this.color[p]=S(this.color[p]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}o.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(d){var v=this.model in r.to?this:this.rgb();v=v.round(typeof d=="number"?d:1);var p=v.valpha===1?v.color:v.color.concat(this.valpha);return r.to[v.model](p)},percentString:function(d){var v=this.rgb().round(typeof d=="number"?d:1),p=v.valpha===1?v.color:v.color.concat(this.valpha);return r.to.rgb.percent(p)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var d={},v=e[this.model].channels,p=e[this.model].labels,g=0;g<v;g++)d[p[g]]=this.color[g];return this.valpha!==1&&(d.alpha=this.valpha),d},unitArray:function(){var d=this.rgb().color;return d[0]/=255,d[1]/=255,d[2]/=255,this.valpha!==1&&d.push(this.valpha),d},unitObject:function(){var d=this.rgb().object();return d.r/=255,d.g/=255,d.b/=255,this.valpha!==1&&(d.alpha=this.valpha),d},round:function(d){return d=Math.max(d||0,0),new o(this.color.map(u(d)).concat(this.valpha),this.model)},alpha:function(d){return arguments.length?new o(this.color.concat(Math.max(0,Math.min(1,d))),this.model):this.valpha},red:f("rgb",0,l(255)),green:f("rgb",1,l(255)),blue:f("rgb",2,l(255)),hue:f(["hsl","hsv","hsl","hwb","hcg"],0,function(d){return(d%360+360)%360}),saturationl:f("hsl",1,l(100)),lightness:f("hsl",2,l(100)),saturationv:f("hsv",1,l(100)),value:f("hsv",2,l(100)),chroma:f("hcg",1,l(100)),gray:f("hcg",2,l(100)),white:f("hwb",1,l(100)),wblack:f("hwb",2,l(100)),cyan:f("cmyk",0,l(100)),magenta:f("cmyk",1,l(100)),yellow:f("cmyk",2,l(100)),black:f("cmyk",3,l(100)),x:f("xyz",0,l(100)),y:f("xyz",1,l(100)),z:f("xyz",2,l(100)),l:f("lab",0,l(100)),a:f("lab",1),b:f("lab",2),keyword:function(d){return arguments.length?new o(d):e[this.model].keyword(this.color)},hex:function(d){return arguments.length?new o(d):r.to.hex(this.rgb().round().color)},rgbNumber:function(){var d=this.rgb().color;return(d[0]&255)<<16|(d[1]&255)<<8|d[2]&255},luminosity:function(){for(var d=this.rgb().color,v=[],p=0;p<d.length;p++){var g=d[p]/255;v[p]=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4)}return .2126*v[0]+.7152*v[1]+.0722*v[2]},contrast:function(d){var v=this.luminosity(),p=d.luminosity();return v>p?(v+.05)/(p+.05):(p+.05)/(v+.05)},level:function(d){var v=this.contrast(d);return v>=7.1?"AAA":v>=4.5?"AA":""},isDark:function(){var d=this.rgb().color,v=(d[0]*299+d[1]*587+d[2]*114)/1e3;return v<128},isLight:function(){return!this.isDark()},negate:function(){for(var d=this.rgb(),v=0;v<3;v++)d.color[v]=255-d.color[v];return d},lighten:function(d){var v=this.hsl();return v.color[2]+=v.color[2]*d,v},darken:function(d){var v=this.hsl();return v.color[2]-=v.color[2]*d,v},saturate:function(d){var v=this.hsl();return v.color[1]+=v.color[1]*d,v},desaturate:function(d){var v=this.hsl();return v.color[1]-=v.color[1]*d,v},whiten:function(d){var v=this.hwb();return v.color[1]+=v.color[1]*d,v},blacken:function(d){var v=this.hwb();return v.color[2]+=v.color[2]*d,v},grayscale:function(){var d=this.rgb().color,v=d[0]*.3+d[1]*.59+d[2]*.11;return o.rgb(v,v,v)},fade:function(d){return this.alpha(this.valpha-this.valpha*d)},opaquer:function(d){return this.alpha(this.valpha+this.valpha*d)},rotate:function(d){var v=this.hsl(),p=v.color[0];return p=(p+d)%360,p=p<0?360+p:p,v.color[0]=p,v},mix:function(d,v){if(!d||!d.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof d);var p=d.rgb(),g=this.rgb(),y=v===void 0?.5:v,m=2*y-1,x=p.alpha()-g.alpha(),b=((m*x===-1?m:(m+x)/(1+m*x))+1)/2,w=1-b;return o.rgb(b*p.red()+w*g.red(),b*p.green()+w*g.green(),b*p.blue()+w*g.blue(),p.alpha()*y+g.alpha()*(1-y))}},Object.keys(e).forEach(function(d){if(n.indexOf(d)===-1){var v=e[d].channels;o.prototype[d]=function(){if(this.model===d)return new o(this);if(arguments.length)return new o(arguments,d);var p=typeof arguments[v]=="number"?v:this.valpha;return new o(c(e[this.model][d].raw(this.color)).concat(p),d)},o[d]=function(p){return typeof p=="number"&&(p=h(t.call(arguments),v)),new o(p,d)}}});function s(d,v){return Number(d.toFixed(v))}function u(d){return function(v){return s(v,d)}}function f(d,v,p){return d=Array.isArray(d)?d:[d],d.forEach(function(g){(a[g]||(a[g]=[]))[v]=p}),d=d[0],function(g){var y;return arguments.length?(p&&(g=p(g)),y=this[d](),y.color[v]=g,y):(y=this[d]().color[v],p&&(y=p(y)),y)}}function l(d){return function(v){return Math.max(0,Math.min(d,v))}}function c(d){return Array.isArray(d)?d:[d]}function h(d,v){for(var p=0;p<v;p++)typeof d[p]!="number"&&(d[p]=0);return d}return Cg=o,Cg}var $$=U$();const ml=va($$);function $d(r){"@babel/helpers - typeof";return $d=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},$d(r)}var X$=/^\s+/,Y$=/\s+$/;function At(r,e){if(r=r||"",e=e||{},r instanceof At)return r;if(!(this instanceof At))return new At(r,e);var t=W$(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}At.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=vL(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=l2(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=l2(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=f2(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=f2(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 c2(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return Z$(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(Gr(this._r,255)*100)+"%",g:Math.round(Gr(this._g,255)*100)+"%",b:Math.round(Gr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Gr(this._r,255)*100)+"%, "+Math.round(Gr(this._g,255)*100)+"%, "+Math.round(Gr(this._b,255)*100)+"%)":"rgba("+Math.round(Gr(this._r,255)*100)+"%, "+Math.round(Gr(this._g,255)*100)+"%, "+Math.round(Gr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:u7[c2(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+h2(this._r,this._g,this._b,this._a),n=t,i=this._gradientType?"GradientType = 1, ":"";if(e){var a=At(e);n="#"+h2(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 At(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(e7,arguments)},brighten:function(){return this._applyModification(t7,arguments)},darken:function(){return this._applyModification(r7,arguments)},desaturate:function(){return this._applyModification(K$,arguments)},saturate:function(){return this._applyModification(Q$,arguments)},greyscale:function(){return this._applyModification(J$,arguments)},spin:function(){return this._applyModification(n7,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(o7,arguments)},complement:function(){return this._applyCombination(i7,arguments)},monochromatic:function(){return this._applyCombination(s7,arguments)},splitcomplement:function(){return this._applyCombination(a7,arguments)},triad:function(){return this._applyCombination(d2,[3])},tetrad:function(){return this._applyCombination(d2,[4])}};At.fromRatio=function(r,e){if($d(r)=="object"){var t={};for(var n in r)r.hasOwnProperty(n)&&(n==="a"?t[n]=r[n]:t[n]=fl(r[n]));r=t}return At(r,e)};function W$(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=h7(r)),$d(r)=="object"&&(Ca(r.r)&&Ca(r.g)&&Ca(r.b)?(e=q$(r.r,r.g,r.b),o=!0,s=String(r.r).substr(-1)==="%"?"prgb":"rgb"):Ca(r.h)&&Ca(r.s)&&Ca(r.v)?(n=fl(r.s),i=fl(r.v),e=H$(r.h,n,i),o=!0,s="hsv"):Ca(r.h)&&Ca(r.s)&&Ca(r.l)&&(n=fl(r.s),a=fl(r.l),e=V$(r.h,n,a),o=!0,s="hsl"),r.hasOwnProperty("a")&&(t=r.a)),t=vL(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 q$(r,e,t){return{r:Gr(r,255)*255,g:Gr(e,255)*255,b:Gr(t,255)*255}}function f2(r,e,t){r=Gr(r,255),e=Gr(e,255),t=Gr(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 V$(r,e,t){var n,i,a;r=Gr(r,360),e=Gr(e,100),t=Gr(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 l2(r,e,t){r=Gr(r,255),e=Gr(e,255),t=Gr(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 H$(r,e,t){r=Gr(r,360)*6,e=Gr(e,100),t=Gr(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 c2(r,e,t,n){var i=[Ri(Math.round(r).toString(16)),Ri(Math.round(e).toString(16)),Ri(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 Z$(r,e,t,n,i){var a=[Ri(Math.round(r).toString(16)),Ri(Math.round(e).toString(16)),Ri(Math.round(t).toString(16)),Ri(pL(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 h2(r,e,t,n){var i=[Ri(pL(n)),Ri(Math.round(r).toString(16)),Ri(Math.round(e).toString(16)),Ri(Math.round(t).toString(16))];return i.join("")}At.equals=function(r,e){return!r||!e?!1:At(r).toRgbString()==At(e).toRgbString()};At.random=function(){return At.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function K$(r,e){e=e===0?0:e||10;var t=At(r).toHsl();return t.s-=e/100,t.s=Cv(t.s),At(t)}function Q$(r,e){e=e===0?0:e||10;var t=At(r).toHsl();return t.s+=e/100,t.s=Cv(t.s),At(t)}function J$(r){return At(r).desaturate(100)}function e7(r,e){e=e===0?0:e||10;var t=At(r).toHsl();return t.l+=e/100,t.l=Cv(t.l),At(t)}function t7(r,e){e=e===0?0:e||10;var t=At(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)))),At(t)}function r7(r,e){e=e===0?0:e||10;var t=At(r).toHsl();return t.l-=e/100,t.l=Cv(t.l),At(t)}function n7(r,e){var t=At(r).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,At(t)}function i7(r){var e=At(r).toHsl();return e.h=(e.h+180)%360,At(e)}function d2(r,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=At(r).toHsl(),n=[At(r)],i=360/e,a=1;a<e;a++)n.push(At({h:(t.h+a*i)%360,s:t.s,l:t.l}));return n}function a7(r){var e=At(r).toHsl(),t=e.h;return[At(r),At({h:(t+72)%360,s:e.s,l:e.l}),At({h:(t+216)%360,s:e.s,l:e.l})]}function o7(r,e,t){e=e||6,t=t||30;var n=At(r).toHsl(),i=360/t,a=[At(r)];for(n.h=(n.h-(i*e>>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(At(n));return a}function s7(r,e){e=e||6;for(var t=At(r).toHsv(),n=t.h,i=t.s,a=t.v,o=[],s=1/e;e--;)o.push(At({h:n,s:i,v:a})),a=(a+s)%1;return o}At.mix=function(r,e,t){t=t===0?0:t||50;var n=At(r).toRgb(),i=At(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 At(o)};At.readability=function(r,e){var t=At(r),n=At(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};At.isReadable=function(r,e,t){var n=At.readability(r,e),i,a;switch(a=!1,i=d7(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};At.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=At.readability(r,e[f]),a>i&&(i=a,n=At(e[f]));return At.isReadable(r,n,{level:s,size:u})||!o?n:(t.includeFallbackColors=!1,At.mostReadable(r,["#fff","#000"],t))};var Ey=At.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"},u7=At.hexNames=f7(Ey);function f7(r){var e={};for(var t in r)r.hasOwnProperty(t)&&(e[r[t]]=t);return e}function vL(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}function Gr(r,e){l7(r)&&(r="100%");var t=c7(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 Cv(r){return Math.min(1,Math.max(0,r))}function qn(r){return parseInt(r,16)}function l7(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}function c7(r){return typeof r=="string"&&r.indexOf("%")!=-1}function Ri(r){return r.length==1?"0"+r:""+r}function fl(r){return r<=1&&(r=r*100+"%"),r}function pL(r){return Math.round(parseFloat(r)*255).toString(16)}function v2(r){return qn(r)/255}var Li=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 Ca(r){return!!Li.CSS_UNIT.exec(r)}function h7(r){r=r.replace(X$,"").replace(Y$,"").toLowerCase();var e=!1;if(Ey[r])r=Ey[r],e=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Li.rgb.exec(r))?{r:t[1],g:t[2],b:t[3]}:(t=Li.rgba.exec(r))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Li.hsl.exec(r))?{h:t[1],s:t[2],l:t[3]}:(t=Li.hsla.exec(r))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Li.hsv.exec(r))?{h:t[1],s:t[2],v:t[3]}:(t=Li.hsva.exec(r))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Li.hex8.exec(r))?{r:qn(t[1]),g:qn(t[2]),b:qn(t[3]),a:v2(t[4]),format:e?"name":"hex8"}:(t=Li.hex6.exec(r))?{r:qn(t[1]),g:qn(t[2]),b:qn(t[3]),format:e?"name":"hex"}:(t=Li.hex4.exec(r))?{r:qn(t[1]+""+t[1]),g:qn(t[2]+""+t[2]),b:qn(t[3]+""+t[3]),a:v2(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Li.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 d7(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 gh=2,p2=.16,v7=.05,p7=.05,g7=.15,gL=5,yL=4,y7=[{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 g2(r,e,t){var n;return Math.round(r.h)>=60&&Math.round(r.h)<=240?n=t?Math.round(r.h)-gh*e:Math.round(r.h)+gh*e:n=t?Math.round(r.h)+gh*e:Math.round(r.h)-gh*e,n<0?n+=360:n>=360&&(n-=360),n}function y2(r,e,t){if(r.h===0&&r.s===0)return r.s;var n;return t?n=r.s-p2*e:e===yL?n=r.s+p2:n=r.s+v7*e,n>1&&(n=1),t&&e===gL&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function m2(r,e,t){var n;return t?n=r.v+p7*e:n=r.v-g7*e,n>1&&(n=1),Number(n.toFixed(2))}function Xd(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=[],n=At(r),i=gL;i>0;i-=1){var a=n.toHsv(),o=At({h:g2(a,i,!0),s:y2(a,i,!0),v:m2(a,i,!0)}).toHexString();t.push(o)}t.push(n.toHexString());for(var s=1;s<=yL;s+=1){var u=n.toHsv(),f=At({h:g2(u,s),s:y2(u,s),v:m2(u,s)}).toHexString();t.push(f)}return e.theme==="dark"?y7.map(function(l){var c=l.index,h=l.opacity,d=At.mix(e.backgroundColor||"#141414",t[c],h*100).toHexString();return d}):t}var Ag={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"},Tg={},Ig={};Object.keys(Ag).forEach(function(r){Tg[r]=Xd(Ag[r]),Tg[r].primary=Tg[r][5],Ig[r]=Xd(Ag[r],{theme:"dark",backgroundColor:"#141414"}),Ig[r].primary=Ig[r][5]});var sn=function(e,t,n){var i=ml(e),a=ml(t);return ml([(1-n)*i.red()+n*a.red(),(1-n)*i.green()+n*a.green(),(1-n)*i.blue()+n*a.blue()]).rgb()},m7=function(e,t,n){t===void 0&&(t="#fff");var i=sn(t,e,.05).rgb().toString(),a=sn(t,e,.1).rgb().toString(),o=sn(t,e,.2).rgb().toString(),s=sn(t,e,.4).rgb().toString(),u=sn(t,n,.02).rgb().toString(),f=sn(t,n,.05).rgb().toString(),l=sn(t,n,.1).rgb().toString(),c=sn(t,n,.2).rgb().toString(),h=sn(t,n,.3).rgb().toString(),d=Xd(e,{theme:"default",backgroundColor:t}),v=ml(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}},b7=function(e,t,n){t===void 0&&(t="#fff");var i=sn(t,e,.2).rgb().toString(),a=sn(t,e,.3).rgb().toString(),o=sn(t,e,.6).rgb().toString(),s=sn(t,e,.8).rgb().toString(),u=sn(t,n,.2).rgb().toString(),f=sn(t,n,.25).rgb().toString(),l=sn(t,n,.3).rgb().toString(),c=sn(t,n,.4).rgb().toString(),h=sn(t,n,.5).rgb().toString(),d=Xd(e,{theme:"dark",backgroundColor:t}),v=ml(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}},i1=function(e,t,n,i){return t===void 0&&(t="#fff"),n===void 0&&(n="default"),n==="default"?m7(e,t,"rgb(150, 150, 150)"):b7(e,t,"#777")},x7=function(e,t,n,i){t===void 0&&(t="#fff"),n===void 0&&(n="default");var a=[];return e.forEach(function(o){a.push(i1(o,t,n))}),a};const w7=Object.freeze(Object.defineProperty({__proto__:null,getColorSetsBySubjectColors:x7,getColorsWithSubjectColor:i1,mixColor:sn},Symbol.toStringTag,{value:"Module"}));var E7="rgb(95, 149, 255)",_7="rgb(255, 255, 255)",b2="rgb(0, 0, 0)",ur=i1(E7,_7);const _s={version:"0.8.23",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:ur.mainStroke,fill:ur.mainFill},size:20,color:ur.mainStroke,linkPoints:{size:8,lineWidth:1,fill:ur.activeFill,stroke:ur.activeStroke}},nodeStateStyles:{active:{fill:ur.activeFill,stroke:ur.activeStroke,lineWidth:2,shadowColor:ur.mainStroke,shadowBlur:10},selected:{fill:ur.selectedFill,stroke:ur.selectedStroke,lineWidth:4,shadowColor:ur.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:ur.highlightFill,stroke:ur.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:ur.inactiveFill,stroke:ur.inactiveStroke,lineWidth:1},disable:{fill:ur.disableFill,stroke:ur.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:b2,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:ur.edgeMainStroke,lineAppendWidth:2},color:ur.edgeMainStroke},edgeStateStyles:{active:{stroke:ur.edgeActiveStroke,lineWidth:1},selected:{stroke:ur.edgeSelectedStroke,lineWidth:2,shadowColor:ur.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ur.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:ur.edgeInactiveStroke,lineWidth:1},disable:{stroke:ur.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:b2,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:ur.comboMainFill,lineWidth:1,stroke:ur.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:ur.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:ur.comboActiveStroke,lineWidth:1,fill:ur.comboActiveFill},selected:{stroke:ur.comboSelectedStroke,lineWidth:2,fill:ur.comboSelectedFill,shadowColor:ur.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ur.comboHighlightStroke,lineWidth:2,fill:ur.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:ur.comboInactiveStroke,fill:ur.comboInactiveFill,lineWidth:1},disable:{stroke:ur.comboDisableStroke,fill:ur.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"};var S7=function(e){var t=e.clone();return M7(e,t),t},M7=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()})}},C7=Sn.cloneEvent,A7=Sn.isViewportChanged,T7=function(r){Rt(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=gs(this,"onCanvasEvents"),f=gs(this,"onExtendEvents"),l=gs(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,a.push(ph(s,"wheel",l)),typeof window<"u"&&(a.push(ph(window,"keydown",f)),a.push(ph(window,"keyup",f)),a.push(ph(window,"focus",f))),this.resetHandler&&n.off("afterchangedata",this.resetHandler),this.resetHandler=gs(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"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]),A7(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){ht(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=C7(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),_e(a,function(s){s.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(Rk),qo={},Mi={},Yf={},x2;function ln(){if(x2)return Yf;x2=1,Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.Base=void 0;var r=function(){function e(){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 e.prototype.layout=function(t){return this.init(t),this.execute(!0)},e.prototype.init=function(t){this.nodes=t.nodes||[],this.edges=t.edges||[],this.combos=t.combos||[],this.comboEdges=t.comboEdges||[],this.hiddenNodes=t.hiddenNodes||[],this.hiddenEdges=t.hiddenEdges||[],this.hiddenCombos=t.hiddenCombos||[],this.vedges=t.vedges||[]},e.prototype.execute=function(t){},e.prototype.executeWithWorker=function(){},e.prototype.getDefaultCfg=function(){return{}},e.prototype.updateCfg=function(t){t&&Object.assign(this,t)},e.prototype.getType=function(){return"base"},e.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},e}();return Yf.Base=r,Yf}var Vo={},Ho={},w2;function I7(){if(w2)return Ho;w2=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.camelize=Ho.isString=void 0;var r=function(n){return typeof n=="string"};Ho.isString=r;var e=function(n){var i=Object.create(null);return function(a){var o=i[a];return o||(i[a]=n(a))}},t=/-(\w)/g;return Ho.camelize=e(function(n){return n.replace(t,function(i,a){return a?a.toUpperCase():""})}),Ho}var Wf={},E2;function mL(){return E2||(E2=1,Object.defineProperty(Wf,"__esModule",{value:!0}),Wf.isArray=void 0,Wf.isArray=Array.isArray),Wf}var kg={},_2;function a1(){return _2||(_2=1,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}(kg)),kg}var Lg={},qf={},S2;function bL(){return S2||(S2=1,function(r){var e=qf&&qf.__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}(qf)),qf}var M2;function o1(){return M2||(M2=1,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=mL(),t=a1(),n=bL(),i=function(m,x){var b=m[x];return(0,n.isObject)(b)?b.cell:b};r.getEdgeTerminal=i;var a=function(m,x,b){for(var w=[],E=0;E<m;E++)w[E]={in:0,out:0,all:0};return b&&b.forEach(function(S){var _=(0,r.getEdgeTerminal)(S,"source"),C=(0,r.getEdgeTerminal)(S,"target");_&&w[x[_]]&&(w[x[_]].out+=1,w[x[_]].all+=1),C&&w[x[C]]&&(w[x[C]].in+=1,w[x[C]].all+=1)}),w};r.getDegree=a;var o=function(m,x){var b={};return m.forEach(function(w){b[w.id]={in:0,out:0,all:0}}),x&&x.forEach(function(w){var E=(0,r.getEdgeTerminal)(w,"source"),S=(0,r.getEdgeTerminal)(w,"target");E&&(b[E].out+=1,b[E].all+=1),S&&(b[S].in+=1,b[S].all+=1)}),b};r.getDegreeMap=o;var s=function(m){for(var x=[],b=m.length,w=0;w<b;w+=1){x[w]=[];for(var E=0;E<b;E+=1)w===E?x[w][E]=0:m[w][E]===0||!m[w][E]?x[w][E]=1/0:x[w][E]=m[w][E]}for(var S=0;S<b;S+=1)for(var w=0;w<b;w+=1)for(var E=0;E<b;E+=1)x[w][E]>x[w][S]+x[S][E]&&(x[w][E]=x[w][S]+x[S][E]);return x};r.floydWarshall=s;var u=function(m,x){var b=m.nodes,w=m.edges,E=[],S={};if(!b)throw new Error("invalid nodes data!");return b&&b.forEach(function(_,C){S[_.id]=C;var M=[];E.push(M)}),w==null||w.forEach(function(_){var C=(0,r.getEdgeTerminal)(_,"source"),M=(0,r.getEdgeTerminal)(_,"target"),A=S[C],T=S[M];A===void 0||T===void 0||(E[A][T]=1,x||(E[T][A]=1))}),E};r.getAdjMatrix=u;var f=function(m,x){var b=[];return m.forEach(function(w){var E=[];w.forEach(function(S){E.push(S*x)}),b.push(E)}),b};r.scaleMatrix=f;var l=function(m,x){if(m&&m.children){for(var b=m.children.length-1;b>=0;b--)if(!l(m.children[b],x))return}return!!x(m)},c=function(m,x){typeof x=="function"&&l(m,x)};r.traverseTreeUp=c;var h=function(m){var x=1/0,b=1/0,w=-1/0,E=-1/0;return m.forEach(function(S){var _=S.size;(0,e.isArray)(_)?_.length===1&&(_=[_[0],_[0]]):(0,t.isNumber)(_)?_=[_,_]:(_===void 0||isNaN(_))&&(_=[30,30]);var C=[_[0]/2,_[1]/2],M=S.x-C[0],A=S.x+C[0],T=S.y-C[1],I=S.y+C[1];x>M&&(x=M),b>T&&(b=T),w<A&&(w=A),E<I&&(E=I)}),{minX:x,minY:b,maxX:w,maxY:E}};r.getLayoutBBox=h;var d=function(m){var x={x:0,y:0};m.forEach(function(w){x.x+=w.x||0,x.y+=w.y||0});var b=m.length||1;return{x:x.x/b,y:x.y/b}};r.getAvgNodePosition=d;var v=function(m,x,b){var w,E;return m==="source"?((w=b==null?void 0:b.find(function(S){return S.target===x.id}))===null||w===void 0?void 0:w.source)||{}:((E=b==null?void 0:b.find(function(S){return S.source===x.id}))===null||E===void 0?void 0:E.target)||{}},p=function(m,x,b){var w=[];switch(m){case"source":w=b==null?void 0:b.filter(function(S){return S.source===x.id}).map(function(S){return S.target});break;case"target":w=b==null?void 0:b.filter(function(S){return S.target===x.id}).map(function(S){return S.source});break;case"both":w=b==null?void 0:b.filter(function(S){return S.source===x.id}).map(function(S){return S.target}).concat(b==null?void 0:b.filter(function(S){return S.target===x.id}).map(function(S){return S.source}));break}var E=new Set(w);return Array.from(E)},g=function(m,x,b,w,E){var S=b[x]||"",_=(w==null?void 0:w.filter(function(C){return C[x]===S}))||[];return m==="leaf"&&(_=_.filter(function(C){var M,A;return((M=E[C.id])===null||M===void 0?void 0:M.in)===0||((A=E[C.id])===null||A===void 0?void 0:A.out)===0})),_},y=function(m,x,b,w,E,S){var _=E[x.id],C=_.in,M=_.out,A=x,T=[];C===0?(A=v("source",x,b),T=p("both",A,b).map(function(L){return S[L]})):M===0&&(A=v("target",x,b),T=p("both",A,b).map(function(L){return S[L]})),T=T.filter(function(L){return E[L.id]&&(E[L.id].in===0||E[L.id].out===0)});var I=g(m,w,x,T,E);return{coreNode:A,relativeLeafNodes:T,sameTypeLeafNodes:I}};r.getCoreNodeAndRelativeLeafNodes=y}(Lg)),Lg}var Ng={},C2;function k7(){return C2||(C2=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.getFuncByUnknownType=r.getFunc=r.isFunction=void 0;var e=$r(),t=a1(),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}(Ng)),Ng}var A2;function $r(){return A2||(A2=1,function(r){var e=Vo&&Vo.__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=Vo&&Vo.__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(I7(),r),t(mL(),r),t(a1(),r),t(o1(),r),t(bL(),r),t(k7(),r)}(Vo)),Vo}var T2;function xL(){if(T2)return Mi;T2=1;var r=Mi&&Mi.__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)}}();Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.getLayoutByName=Mi.unRegisterLayout=Mi.registerLayout=void 0;var e=ln(),t=$r(),n=new Map,i=function(s,u){if(n.get(s)&&console.warn("The layout with the name ".concat(s," exists already, it will be overridden")),(0,t.isObject)(u)){var f=function(l){r(c,l);function c(h){var d=this,v;d=l.call(this)||this;var p=d,g={},y=Object.assign({},p.getDefaultCfg(),((v=u.getDefaultCfg)===null||v===void 0?void 0:v.call(u))||{});return Object.assign(g,y,u,h),Object.keys(g).forEach(function(m){var x=g[m];p[m]=x}),d}return c}(e.Base);n.set(s,f)}else n.set(s,u);return n.get(s)};Mi.registerLayout=i;var a=function(s){n.has(s)&&n.delete(s)};Mi.unRegisterLayout=a;var o=function(s){return n.has(s)?n.get(s):null};return Mi.getLayoutByName=o,Mi}var Zo={},Ko={},I2;function wL(){if(I2)return Ko;I2=1;var r=Ko&&Ko.__extends||function(){var i=function(a,o){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(s[f]=u[f])},i(a,o)};return function(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");i(a,o);function s(){this.constructor=a}a.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}}();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.GridLayout=void 0;var e=$r(),t=ln(),n=function(i){r(a,i);function a(o){var s=i.call(this)||this;return s.begin=[0,0],s.preventOverlap=!0,s.preventOverlapPadding=10,s.condense=!1,s.sortBy="degree",s.nodes=[],s.edges=[],s.width=300,s.height=300,s.row=0,s.col=0,s.cellWidth=0,s.cellHeight=0,s.cellUsed={},s.id2manPos={},s.onLayoutEnd=function(){},s.updateCfg(o),s}return a.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}},a.prototype.execute=function(){var o=this,s=o.nodes,u=o.edges,f=o.begin,l=s.length;if(l===0)return o.onLayoutEnd&&o.onLayoutEnd(),{nodes:s,edges:u};if(l===1)return s[0].x=f[0],s[0].y=f[1],o.onLayoutEnd&&o.onLayoutEnd(),{nodes:s,edges:u};var c=o.sortBy,h=o.width,d=o.height,v=o.condense,p=o.preventOverlapPadding,g=o.preventOverlap,y=o.nodeSpacing,m=o.nodeSize,x=[];s.forEach(function(O){x.push(O)});var b={};if(x.forEach(function(O,B){b[O.id]=B}),(c==="degree"||!(0,e.isString)(c)||x[0][c]===void 0)&&(c="degree",(0,e.isNaN)(s[0].degree))){var w=(0,e.getDegree)(x.length,b,u);x.forEach(function(O,B){O.degree=w[B].all})}x.sort(function(O,B){return B[c]-O[c]}),!h&&typeof window<"u"&&(h=window.innerWidth),!d&&typeof window<"u"&&(d=window.innerHeight);var E=o.rows,S=o.cols!=null?o.cols:o.columns;if(o.cells=l,E!=null&&S!=null?(o.rows=E,o.cols=S):E!=null&&S==null?(o.rows=E,o.cols=Math.ceil(o.cells/o.rows)):E==null&&S!=null?(o.cols=S,o.rows=Math.ceil(o.cells/o.cols)):(o.splits=Math.sqrt(o.cells*o.height/o.width),o.rows=Math.round(o.splits),o.cols=Math.round(o.width/o.height*o.splits)),o.rows=Math.max(o.rows,1),o.cols=Math.max(o.cols,1),o.cols*o.rows>o.cells){var _=o.small(),C=o.large();(_-1)*C>=o.cells?o.small(_-1):(C-1)*_>=o.cells&&o.large(C-1)}else for(;o.cols*o.rows<o.cells;){var _=o.small(),C=o.large();(C+1)*_>=o.cells?o.large(C+1):o.small(_+1)}if(o.cellWidth=h/o.cols,o.cellHeight=d/o.rows,v&&(o.cellWidth=0,o.cellHeight=0),g||y){var M=(0,e.getFuncByUnknownType)(10,y),A=(0,e.getFuncByUnknownType)(30,m,!1);x.forEach(function(O){(!O.x||!O.y)&&(O.x=0,O.y=0);var B=A(O)||30,W,D;(0,e.isArray)(B)?(W=B[0],D=B[1]):(W=B,D=B);var P=M!==void 0?M(O):p,R=W+P,X=D+P;o.cellWidth=Math.max(o.cellWidth,R),o.cellHeight=Math.max(o.cellHeight,X)})}o.cellUsed={},o.row=0,o.col=0,o.id2manPos={};for(var T=0;T<x.length;T++){var I=x[T],L=void 0;if(o.position&&(L=o.position(I)),L&&(L.row!==void 0||L.col!==void 0)){var N={row:L.row,col:L.col};if(N.col===void 0)for(N.col=0;o.used(N.row,N.col);)N.col++;else if(N.row===void 0)for(N.row=0;o.used(N.row,N.col);)N.row++;o.id2manPos[I.id]=N,o.use(N.row,N.col)}o.getPos(I)}return o.onLayoutEnd&&o.onLayoutEnd(),{edges:u,nodes:x}},a.prototype.small=function(o){var s=this,u,f=s.rows||5,l=s.cols||5;if(o==null)u=Math.min(f,l);else{var c=Math.min(f,l);c===s.rows?s.rows=o:s.cols=o}return u},a.prototype.large=function(o){var s=this,u,f=s.rows||5,l=s.cols||5;if(o==null)u=Math.max(f,l);else{var c=Math.max(f,l);c===s.rows?s.rows=o:s.cols=o}return u},a.prototype.used=function(o,s){var u=this;return u.cellUsed["c-".concat(o,"-").concat(s)]||!1},a.prototype.use=function(o,s){var u=this;u.cellUsed["c-".concat(o,"-").concat(s)]=!0},a.prototype.moveToNextCell=function(){var o=this,s=o.cols||5;o.col++,o.col>=s&&(o.col=0,o.row++)},a.prototype.getPos=function(o){var s=this,u=s.begin,f=s.cellWidth,l=s.cellHeight,c,h,d=s.id2manPos[o.id];if(d)c=d.col*f+f/2+u[0],h=d.row*l+l/2+u[1];else{for(;s.used(s.row,s.col);)s.moveToNextCell();c=s.col*f+f/2+u[0],h=s.row*l+l/2+u[1],s.use(s.row,s.col),s.moveToNextCell()}o.x=c,o.y=h},a.prototype.getType=function(){return"grid"},a}(t.Base);return Ko.GridLayout=n,Ko}var Qo={},k2;function EL(){if(k2)return Qo;k2=1;var r=Qo&&Qo.__extends||function(){var n=function(i,a){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,s){o.__proto__=s}||function(o,s){for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(o[u]=s[u])},n(i,a)};return function(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");n(i,a);function o(){this.constructor=i}i.prototype=a===null?Object.create(a):(o.prototype=a.prototype,new o)}}();Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.RandomLayout=void 0;var e=ln(),t=function(n){r(i,n);function i(a){var o=n.call(this)||this;return o.center=[0,0],o.width=300,o.height=300,o.nodes=[],o.edges=[],o.onLayoutEnd=function(){},o.updateCfg(a),o}return i.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},i.prototype.execute=function(){var a=this,o=a.nodes,s=.9,u=a.center;return!a.width&&typeof window<"u"&&(a.width=window.innerWidth),!a.height&&typeof window<"u"&&(a.height=window.innerHeight),o&&o.forEach(function(f){f.x=(Math.random()-.5)*s*a.width+u[0],f.y=(Math.random()-.5)*s*a.height+u[1]}),a.onLayoutEnd&&a.onLayoutEnd(),{nodes:o,edges:this.edges}},i.prototype.getType=function(){return"random"},i}(e.Base);return Qo.RandomLayout=t,Qo}var Jo={},L2;function _L(){if(L2)return Jo;L2=1;var r=Jo&&Jo.__extends||function(){var a=function(o,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(u[l]=f[l])},a(o,s)};return function(o,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");a(o,s);function u(){this.constructor=o}o.prototype=s===null?Object.create(s):(u.prototype=s.prototype,new u)}}();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.GForceLayout=void 0;var e=ln(),t=$r(),n=function(a,o){var s;return a?(0,t.isNumber)(a)?s=function(u){return a}:s=a:s=function(u){return o},s},i=function(a){r(o,a);function o(s){var u=a.call(this)||this;return u.maxIteration=500,u.workerEnabled=!1,u.edgeStrength=200,u.nodeStrength=1e3,u.coulombDisScale=.005,u.damping=.9,u.maxSpeed=1e3,u.minMovement=.5,u.interval=.02,u.factor=1,u.linkDistance=1,u.gravity=10,u.preventOverlap=!0,u.collideStrength=1,u.tick=function(){},u.nodes=[],u.edges=[],u.width=300,u.height=300,u.nodeMap={},u.nodeIdxMap={},u.animate=!0,u.updateCfg(s),u}return o.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},o.prototype.execute=function(){var s,u,f=this,l=f.nodes;if(f.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(f.timeInterval),!l||l.length===0){(s=f.onLayoutEnd)===null||s===void 0||s.call(f);return}!f.width&&typeof window<"u"&&(f.width=window.innerWidth),!f.height&&typeof window<"u"&&(f.height=window.innerHeight),f.center||(f.center=[f.width/2,f.height/2]);var c=f.center;if(l.length===1){l[0].x=c[0],l[0].y=c[1],(u=f.onLayoutEnd)===null||u===void 0||u.call(f);return}var h={},d={};l.forEach(function(x,b){(0,t.isNumber)(x.x)||(x.x=Math.random()*f.width),(0,t.isNumber)(x.y)||(x.y=Math.random()*f.height),h[x.id]=x,d[x.id]=b}),f.nodeMap=h,f.nodeIdxMap=d,f.linkDistance=n(f.linkDistance,1),f.nodeStrength=n(f.nodeStrength,1),f.edgeStrength=n(f.edgeStrength,1);var v=f.nodeSize,p;if(f.preventOverlap){var g=f.nodeSpacing,y;(0,t.isNumber)(g)?y=function(){return g}:(0,t.isFunction)(g)?y=g:y=function(){return 0},v?(0,t.isArray)(v)?p=function(x){return Math.max(v[0],v[1])+y(x)}:p=function(x){return v+y(x)}:p=function(x){return x.size?(0,t.isArray)(x.size)?Math.max(x.size[0],x.size[1])+y(x):(0,t.isObject)(x.size)?Math.max(x.size.width,x.size.height)+y(x):x.size+y(x):10+y(x)}}f.nodeSize=p;var m=f.edges;f.degrees=(0,t.getDegree)(l.length,f.nodeIdxMap,m),f.getMass||(f.getMass=function(x){var b=x.mass||f.degrees[f.nodeIdxMap[x.id]].all||1;return b}),f.run()},o.prototype.run=function(){var s,u=this,f=u.maxIteration,l=u.nodes,c=u.workerEnabled,h=u.minMovement,d=u.animate;if(l)if(c||!d){for(var v=0;v<f;v++){var p=u.runOneStep(v);if(u.reachMoveThreshold(l,p,h))break}(s=u.onLayoutEnd)===null||s===void 0||s.call(u)}else{if(typeof window>"u")return;var g=0;this.timeInterval=window.setInterval(function(){var y,m;if(l){var x=u.runOneStep(g)||[];u.reachMoveThreshold(l,x,h)&&((y=u.onLayoutEnd)===null||y===void 0||y.call(u),window.clearInterval(u.timeInterval)),g++,g>=f&&((m=u.onLayoutEnd)===null||m===void 0||m.call(u),window.clearInterval(u.timeInterval))}},0)}},o.prototype.reachMoveThreshold=function(s,u,f){var l=0;return s.forEach(function(c,h){var d=c.x-u[h].x,v=c.y-u[h].y;l+=Math.sqrt(d*d+v*v)}),l/=s.length,l<f},o.prototype.runOneStep=function(s){var u,f=this,l=f.nodes,c=f.edges,h=[],d=[];if(l){l.forEach(function(g,y){h[2*y]=0,h[2*y+1]=0,d[2*y]=0,d[2*y+1]=0}),f.calRepulsive(h,l),c&&f.calAttractive(h,c),f.calGravity(h,l);var v=Math.max(.02,f.interval-s*.002);f.updateVelocity(h,d,v,l);var p=[];return l.forEach(function(g){p.push({x:g.x,y:g.y})}),f.updatePosition(d,v,l),(u=f.tick)===null||u===void 0||u.call(f),p}},o.prototype.calRepulsive=function(s,u){var f=this,l=f.getMass,c=f.factor,h=f.coulombDisScale,d=f.preventOverlap,v=f.collideStrength,p=v===void 0?1:v,g=f.nodeStrength,y=f.nodeSize;u.forEach(function(m,x){var b=l?l(m):1;u.forEach(function(w,E){if(!(x>=E)){var S=m.x-w.x,_=m.y-w.y;S===0&&_===0&&(S=Math.random()*.01,_=Math.random()*.01);var C=S*S+_*_,M=Math.sqrt(C),A=(M+.1)*h,T=S/M,I=_/M,L=(g(m)+g(w))*.5*c/(A*A),N=l?l(w):1;if(s[2*x]+=T*L,s[2*x+1]+=I*L,s[2*E]-=T*L,s[2*E+1]-=I*L,d&&(y(m)+y(w))/2>M){var O=p*(g(m)+g(w))*.5/C;s[2*x]+=T*O/b,s[2*x+1]+=I*O/b,s[2*E]-=T*O/N,s[2*E+1]-=I*O/N}}})})},o.prototype.calAttractive=function(s,u){var f=this,l=f.nodeMap,c=f.nodeIdxMap,h=f.linkDistance,d=f.edgeStrength,v=f.nodeSize,p=f.getMass;u.forEach(function(g,y){var m=(0,t.getEdgeTerminal)(g,"source"),x=(0,t.getEdgeTerminal)(g,"target"),b=l[m],w=l[x],E=w.x-b.x,S=w.y-b.y;E===0&&S===0&&(E=Math.random()*.01,S=Math.random()*.01);var _=Math.sqrt(E*E+S*S),C=E/_,M=S/_,A=h(g,b,w)||1+(v(b)+v(w)||0)/2,T=A-_,I=T*d(g),L=c[m],N=c[x],O=p?p(b):1,B=p?p(w):1;s[2*L]-=C*I/O,s[2*L+1]-=M*I/O,s[2*N]+=C*I/B,s[2*N+1]+=M*I/B})},o.prototype.calGravity=function(s,u){for(var f=this,l=f.center,c=f.gravity,h=f.degrees,d=u.length,v=0;v<d;v++){var p=u[v],g=p.x-l[0],y=p.y-l[1],m=c;if(f.getCenter){var x=f.getCenter(p,h[v].all);x&&(0,t.isNumber)(x[0])&&(0,t.isNumber)(x[1])&&(0,t.isNumber)(x[2])&&(g=p.x-x[0],y=p.y-x[1],m=x[2])}m&&(s[2*v]-=m*g,s[2*v+1]-=m*y)}},o.prototype.updateVelocity=function(s,u,f,l){var c=this,h=f*c.damping;l.forEach(function(d,v){var p=s[2*v]*h||.01,g=s[2*v+1]*h||.01,y=Math.sqrt(p*p+g*g);if(y>c.maxSpeed){var m=c.maxSpeed/y;p=m*p,g=m*g}u[2*v]=p,u[2*v+1]=g})},o.prototype.updatePosition=function(s,u,f){f.forEach(function(l,c){if((0,t.isNumber)(l.fx)&&(0,t.isNumber)(l.fy)){l.x=l.fx,l.y=l.fy;return}var h=s[2*c]*u,d=s[2*c+1]*u;l.x+=h,l.y+=d})},o.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},o.prototype.destroy=function(){var s=this;s.stop(),s.tick=null,s.nodes=null,s.edges=null,s.destroyed=!0},o.prototype.getType=function(){return"gForce"},o}(e.Base);return Jo.GForceLayout=i,Jo}var Aa={},Vf={};function L7(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return SL(this.cover(e,t),e,t,r)}function SL(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 N7(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)SL(this,o[t],s[t],r[t]);return this}function O7(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 D7(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function P7(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 On(r,e,t,n,i){this.node=r,this.x0=e,this.y0=t,this.x1=n,this.y1=i}function R7(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 On(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 On(d[3],g,y,u,f),new On(d[2],o,y,g,f),new On(d[1],g,s,u,y),new On(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),x=e-+this._y.call(null,d.data),b=m*m+x*x;if(b<t){var w=Math.sqrt(t=b);i=r-w,a=e-w,l=r+w,c=e+w,n=d.data}}return n}function B7(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 F7(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function G7(){return this._root}function z7(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function j7(r){var e=[],t,n=this._root,i,a,o,s,u;for(n&&e.push(new On(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 On(i,f,l,s,u)),(i=n[2])&&e.push(new On(i,a,l,f,u)),(i=n[1])&&e.push(new On(i,f,o,s,l)),(i=n[0])&&e.push(new On(i,a,o,f,l))}return this}function U7(r){var e=[],t=[],n;for(this._root&&e.push(new On(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 On(a,o,s,l,c)),(a=i[1])&&e.push(new On(a,l,s,u,c)),(a=i[2])&&e.push(new On(a,o,c,l,f)),(a=i[3])&&e.push(new On(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 $7(r){return r[0]}function X7(r){return arguments.length?(this._x=r,this):this._x}function Y7(r){return r[1]}function W7(r){return arguments.length?(this._y=r,this):this._y}function Av(r,e,t){var n=new s1(e==null?$7:e,t==null?Y7:t,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function s1(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 N2(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var Dn=Av.prototype=s1.prototype;Dn.copy=function(){var r=new s1(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=N2(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]=N2(n));return r};Dn.add=L7;Dn.addAll=N7;Dn.cover=O7;Dn.data=D7;Dn.extent=P7;Dn.find=R7;Dn.remove=B7;Dn.removeAll=F7;Dn.root=G7;Dn.size=z7;Dn.visit=j7;Dn.visitAfter=U7;Dn.x=X7;Dn.y=W7;const q7=Object.freeze(Object.defineProperty({__proto__:null,quadtree:Av},Symbol.toStringTag,{value:"Module"})),V7=da(q7);var O2;function H7(){if(O2)return Vf;O2=1,Object.defineProperty(Vf,"__esModule",{value:!0}),Vf.forceNBody=void 0;var r=V7,e=.81,t=.1;function n(s,u,f,l,c){var h=f/l,d=s.map(function(p,g){var y=u[p.id],m=y.data,x=y.x,b=y.y,w=y.size,E=m.layout.force.nodeStrength;return{x,y:b,size:w,index:g,vx:0,vy:0,weight:h*E}}),v=(0,r.quadtree)(d,function(p){return p.x},function(p){return p.y}).visitAfter(i);return d.forEach(function(p){o(p,v)}),d.map(function(p,g){var y=u[s[g].id],m=y.data.layout.force.mass,x=m===void 0?1:m;c[2*g]=p.vx/x,c[2*g+1]=p.vy/x}),c}Vf.forceNBody=n;function i(s){var u=0,f=0,l=0;if(s.length){for(var c=0;c<4;c++){var h=s[c];h&&h.weight&&(u+=h.weight,f+=h.x*h.weight,l+=h.y*h.weight)}s.x=f/u,s.y=l/u,s.weight=u}else{var h=s;s.x=h.data.x,s.y=h.data.y,s.weight=h.data.weight}}var a=function(s,u,f,l,c,h){var d=h.x-s.x||t,v=h.y-s.y||t,p=l-u,g=d*d+v*v,y=Math.sqrt(g)*g;if(p*p*e<g){var m=s.weight/y;return h.vx+=d*m,h.vy+=v*m,!0}if(s.length)return!1;if(s.data!==h){var m=s.data.weight/y;h.vx+=d*m,h.vy+=v*m}};function o(s,u){u.visit(function(f,l,c,h,d){return a(f,l,c,h,d,s)})}return Vf}var D2;function ML(){if(D2)return Aa;D2=1;var r=Aa&&Aa.__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=Aa&&Aa.__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(Aa,"__esModule",{value:!0}),Aa.Force2Layout=void 0;var t=ln(),n=$r(),i=H7(),a=function(s,u){var f;return s?(0,n.isNumber)(s)?f=function(l){return s}:f=s:f=function(l){return u},f},o=function(s){r(u,s);function u(f){var l=s.call(this)||this;l.maxIteration=1e3,l.workerEnabled=!1,l.edgeStrength=200,l.nodeStrength=1e3,l.coulombDisScale=.005,l.damping=.9,l.maxSpeed=500,l.minMovement=.4,l.interval=.02,l.factor=1,l.linkDistance=200,l.gravity=0,l.clusterNodeStrength=20,l.preventOverlap=!0,l.distanceThresholdMode="mean",l.tick=function(){},l.nodes=[],l.edges=[],l.width=300,l.height=300,l.nodeMap={},l.nodeIdxMap={},l.judgingDistance=0,l.centripetalOptions={leaf:2,single:2,others:1,center:function(h){return{x:l.width/2,y:l.height/2}}};var c=f.getMass;return l.propsGetMass=c,l.updateCfg(f),l}return u.prototype.getCentripetalOptions=function(){var f=this,l=f.leafCluster,c=f.clustering,h=f.nodeClusterBy,d=f.nodes,v=f.nodeMap,p=f.clusterNodeStrength,g=function(M){return typeof p=="function"?p(M):p},y={},m;if(l){m=this.getSameTypeLeafMap()||{};var x=Array.from(new Set(d==null?void 0:d.map(function(M){return M[h]})))||[];y={single:100,leaf:function(M,A,T){var I=m[M.id]||{},L=I.relativeLeafNodes,N=I.sameTypeLeafNodes;return(N==null?void 0:N.length)===(L==null?void 0:L.length)||(x==null?void 0:x.length)===1?1:g(M)},others:1,center:function(M,A,T){var I,L=(((I=M.data)===null||I===void 0?void 0:I.layout)||{}).degree;if(!L)return{x:100,y:100};var N;if(L===1){var O=(m[M.id]||{}).sameTypeLeafNodes,B=O===void 0?[]:O;B.length===1?N=void 0:B.length>1&&(N=(0,n.getAvgNodePosition)(B))}else N=void 0;return{x:N==null?void 0:N.x,y:N==null?void 0:N.y}}}}if(c){m||(m=this.getSameTypeLeafMap());var b=Array.from(new Set(d.map(function(M,A){return M[h]}))).filter(function(M){return M!==void 0}),w={};b.forEach(function(M){var A=d.filter(function(T){return T[h]===M}).map(function(T){return v[T.id]});w[M]=(0,n.getAvgNodePosition)(A)}),y={single:function(M){return g(M)},leaf:function(M){return g(M)},others:function(M){return g(M)},center:function(M,A,T){var I=w[M[h]];return{x:I==null?void 0:I.x,y:I==null?void 0:I.y}}}}this.centripetalOptions=e(e({},this.centripetalOptions),y);var E=this.centripetalOptions,S=E.leaf,_=E.single,C=E.others;S&&typeof S!="function"&&(this.centripetalOptions.leaf=function(){return S}),_&&typeof _!="function"&&(this.centripetalOptions.single=function(){return _}),C&&typeof C!="function"&&(this.centripetalOptions.others=function(){return C})},u.prototype.updateCfg=function(f){f&&Object.assign(this,f)},u.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},u.prototype.execute=function(){var f=this;f.stop();var l=f.nodes,c=f.edges,h=f.defSpringLen;if(f.judgingDistance=0,!l||l.length===0){f.onLayoutEnd([]);return}!f.width&&typeof window<"u"&&(f.width=window.innerWidth),!f.height&&typeof window<"u"&&(f.height=window.innerHeight),f.center||(f.center=[f.width/2,f.height/2]);var d=f.center;if(l.length===1){l[0].x=d[0],l[0].y=d[1],f.onLayoutEnd([e({},l[0])]);return}f.degreesMap=(0,n.getDegreeMap)(l,c),f.propsGetMass?f.getMass=f.propsGetMass:f.getMass=function(b){var w=1;(0,n.isNumber)(b.mass)&&(w=b.mass);var E=f.degreesMap[b.id].all;return!E||E<5?w:E*5*w};var v=f.nodeSize,p;if(f.preventOverlap){var g=f.nodeSpacing,y;(0,n.isNumber)(g)?y=function(){return g}:(0,n.isFunction)(g)?y=g:y=function(){return 0},v?(0,n.isArray)(v)?p=function(b){return Math.max(v[0],v[1])+y(b)}:p=function(b){return v+y(b)}:p=function(b){return b.size?(0,n.isArray)(b.size)?Math.max(b.size[0],b.size[1])+y(b):(0,n.isObject)(b.size)?Math.max(b.size.width,b.size.height)+y(b):b.size+y(b):10+y(b)}}f.nodeSize=p,f.linkDistance=a(f.linkDistance,1),f.nodeStrength=a(f.nodeStrength,1),f.edgeStrength=a(f.edgeStrength,1);var m={},x={};l.forEach(function(b,w){(0,n.isNumber)(b.x)||(b.x=Math.random()*f.width),(0,n.isNumber)(b.y)||(b.y=Math.random()*f.height);var E=f.degreesMap[b.id];m[b.id]=e(e({},b),{data:e(e({},b.data),{size:f.nodeSize(b)||30,layout:{inDegree:E.in,outDegree:E.out,degree:E.all,tDegree:E.in,sDegree:E.out,force:{mass:f.getMass(b),nodeStrength:f.nodeStrength(b,c)}}})}),x[b.id]=w}),f.nodeMap=m,f.nodeIdxMap=x,f.edgeInfos=[],c==null||c.forEach(function(b){var w=m[b.source],E=m[b.target];!w||!E?elf.edgeInfos.push({}):f.edgeInfos.push({edgeStrength:f.edgeStrength(b),linkDistance:h?h(e(e({},b),{source:w,target:E}),w,E):f.linkDistance(b,w,E)||1+(v(w)+v(w)||0)/2})}),this.getCentripetalOptions(),f.onLayoutEnd=f.onLayoutEnd||function(){},f.run()},u.prototype.run=function(){var f=this,l=f.maxIteration,c=f.nodes,h=f.edges,d=f.workerEnabled,v=f.minMovement,p=f.animate,g=f.nodeMap,y=f.height;if(f.currentMinY=0,f.currentMaxY=y,!!c){var m=[];if(c.forEach(function(_,C){m[2*C]=0,m[2*C+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var x={};h.forEach(function(_){var C=_.source,M=_.target;x[C]=x[C]||[],x[C].push(_),x[M]=x[M]||[],x[M].push(_)}),this.relatedEdges=x}var b=l,w=!p;if(d||w){for(var E=0;(f.judgingDistance>v||E<1)&&E<b;E++)f.runOneStep(E,m);f.onLayoutEnd(Object.values(g))}else{if(typeof window>"u")return;var S=0;this.timeInterval=window.setInterval(function(){c&&(f.runOneStep(S,m),S++,(S>=b||f.judgingDistance<v)&&(f.onLayoutEnd(Object.values(g)),window.clearInterval(f.timeInterval)))},0)}}},u.prototype.runOneStep=function(f,l){var c,h=this,d=h.nodes,v=h.edges;h.nodeMap;var p=h.monitor,g=[];if(d!=null&&d.length){h.calRepulsive(g),v&&h.calAttractive(g),h.calGravity(g),h.attractToSide(g);var y=h.interval;if(h.updateVelocity(g,l,y),h.updatePosition(l,y),(c=h.tick)===null||c===void 0||c.call(h),p){var m=this.calTotalEnergy(g);p({energy:m,nodes:d,edges:v,iterations:f})}}},u.prototype.calTotalEnergy=function(f){var l=this,c=l.nodes,h=l.nodeMap;if(!(c!=null&&c.length))return 0;var d=0;return c.forEach(function(v,p){var g=f[2*p],y=f[2*p+1],m=g*g+y*y,x=h[v.id].data.layout.force.mass,b=x===void 0?1:x;d+=b*m*.5}),d},u.prototype.calRepulsive=function(f){var l=this,c=l.nodes,h=l.nodeMap,d=l.factor,v=l.coulombDisScale;l.nodeSize,(0,i.forceNBody)(c,h,d,v*v,f)},u.prototype.calAttractive=function(f){var l=this,c=l.edges,h=l.nodeMap,d=l.nodeIdxMap,v=l.edgeInfos;l.nodeSize,c.forEach(function(p,g){var y=(0,n.getEdgeTerminal)(p,"source"),m=(0,n.getEdgeTerminal)(p,"target"),x=h[y],b=h[m];if(!(!x||!b)){var w=b.x-x.x,E=b.y-x.y;!w&&!E&&(w=Math.random()*.01,E=Math.random()*.01);var S=Math.sqrt(w*w+E*E),_=w/S,C=E/S,M=v[g]||{},A=M.linkDistance,T=A===void 0?200:A,I=M.edgeStrength,L=I===void 0?200:I,N=T-S,O=N*L,B=x.data.layout.force.mass||1,W=b.data.layout.force.mass||1,D=1/B,P=1/W,R=_*O,X=C*O,Y=2*d[y],ee=2*d[m];f[Y]-=R*D,f[Y+1]-=X*D,f[ee]+=R*P,f[ee+1]+=X*P}})},u.prototype.calGravity=function(f){var l,c=this,h=c.nodes,d=c.edges,v=d===void 0?[]:d,p=c.nodeMap,g=c.width,y=c.height,m=c.center,x=c.gravity,b=c.degreesMap,w=c.centripetalOptions;if(h)for(var E=h.length,S=0;S<E;S++){var _=2*S,C=p[h[S].id],M=C.data.layout.force.mass,A=M===void 0?1:M,T=0,I=0,L=x,N=b[C.id],O=N.in,B=N.out,W=N.all,D=(l=c.getCenter)===null||l===void 0?void 0:l.call(c,C,W);if(D){var P=D[0],R=D[1],X=D[2];T=C.x-P,I=C.y-R,L=X}else T=C.x-m[0],I=C.y-m[1];if(L&&(f[_]-=L*T/A,f[_+1]-=L*I/A),w){var Y=w.leaf,ee=w.single,U=w.others,Z=w.center,K=(Z==null?void 0:Z(C,h,v,g,y))||{x:0,y:0,centerStrength:0},se=K.x,re=K.y,J=K.centerStrength;if(!(0,n.isNumber)(se)||!(0,n.isNumber)(re))continue;var me=(C.x-se)/A,Ae=(C.y-re)/A;if(J&&(f[_]-=J*me,f[_+1]-=J*Ae),W===0){var Ye=ee(C);if(!Ye)continue;f[_]-=Ye*me,f[_+1]-=Ye*Ae;continue}if(O===0||B===0){var Ve=Y(C,h,v);if(!Ve)continue;f[_]-=Ve*me,f[_+1]-=Ve*Ae;continue}var Ke=U(C);if(!Ke)continue;f[_]-=Ke*me,f[_+1]-=Ke*Ae}}},u.prototype.attractToSide=function(f){var l=this,c=l.defSideCoe;l.height;var h=l.nodes,d=l.relatedEdges,v=l.currentMinY,p=v===void 0?0:v,g=l.currentMaxY,y=g===void 0?this.height:g;!c||typeof c!="function"||!(h!=null&&h.length)||h.forEach(function(m,x){var b=c(m,d[m.id]||[]);if(b!==0){var w=b<0?p:y,E=Math.abs(b);f[2*x+1]-=E*(m.y-w)}})},u.prototype.updateVelocity=function(f,l,c){var h=this,d=h.nodes,v=h.damping,p=h.maxSpeed;d!=null&&d.length&&d.forEach(function(g,y){var m=(l[2*y]+f[2*y]*c)*v||.01,x=(l[2*y+1]+f[2*y+1]*c)*v||.01,b=Math.sqrt(m*m+x*x);if(b>p){var w=p/b;m=w*m,x=w*x}l[2*y]=m,l[2*y+1]=x})},u.prototype.updatePosition=function(f,l){var c=this,h=c.nodes,d=c.distanceThresholdMode,v=c.nodeMap;if(!(h!=null&&h.length)){this.judgingDistance=0;return}var p=0;d==="max"?c.judgingDistance=-1/0:d==="min"&&(c.judgingDistance=1/0);var g=1/0,y=-1/0;h.forEach(function(m,x){var b=v[m.id];if((0,n.isNumber)(m.fx)&&(0,n.isNumber)(m.fy)){m.x=m.fx,m.y=m.fy,b.x=m.x,b.y=m.y;return}var w=f[2*x]*l,E=f[2*x+1]*l;m.x+=w,m.y+=E,b.x=m.x,b.y=m.y,m.y<g&&(g=m.y),m.y>y&&(y=m.y);var S=Math.sqrt(w*w+E*E);switch(d){case"max":c.judgingDistance<S&&(c.judgingDistance=S);break;case"min":c.judgingDistance>S&&(c.judgingDistance=S);break;default:p=p+S;break}}),this.currentMinY=g,this.currentMaxY=y,(!d||d==="mean")&&(c.judgingDistance=p/h.length)},u.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},u.prototype.destroy=function(){var f=this;f.stop(),f.tick=null,f.nodes=null,f.edges=null,f.destroyed=!0},u.prototype.getType=function(){return"force2"},u.prototype.getSameTypeLeafMap=function(){var f=this,l=f.nodeClusterBy,c=f.nodes,h=f.edges,d=f.nodeMap,v=f.degreesMap;if(c!=null&&c.length){var p={};return c.forEach(function(g,y){var m=v[g.id].all;m===1&&(p[g.id]=(0,n.getCoreNodeAndRelativeLeafNodes)("leaf",g,h,l,v,d))}),p}},u}(t.Base);return Aa.Force2Layout=o,Aa}var es={},Nn={};function Z7(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 fn(r){return function(){return r}}function xo(r){return(r()-.5)*1e-6}function K7(r){return r.x+r.vx}function Q7(r){return r.y+r.vy}function J7(r){var e,t,n,i=1,a=1;typeof r!="function"&&(r=fn(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=Av(e,K7,Q7).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(x,b,w,E,S){var _=x.data,C=x.r,M=p+C;if(_){if(_.index>h.index){var A=d-_.x-_.vx,T=v-_.y-_.vy,I=A*A+T*T;I<M*M&&(A===0&&(A=xo(n),I+=A*A),T===0&&(T=xo(n),I+=T*T),I=(M-(I=Math.sqrt(I)))/I*i,h.vx+=(A*=I)*(M=(C*=C)/(g+C)),h.vy+=(T*=I)*M,_.vx-=A*(M=1-M),_.vy-=T*M)}return}return b>d+M||E<d-M||w>v+M||S<v-M}}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:fn(+f),u(),o):r},o}function eX(r){return r.index}function P2(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function tX(r){var e=eX,t=c,n,i=fn(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 x=0,b,w,E,S,_,C,M;x<m;++x)b=r[x],w=b.source,E=b.target,S=E.x+E.vx-w.x-w.vx||xo(f),_=E.y+E.vy-w.y-w.vy||xo(f),C=Math.sqrt(S*S+_*_),C=(C-a[x])/C*g*n[x],S*=C,_*=C,E.vx-=S*(M=u[x]),E.vy-=_*M,w.vx+=S*(M=1-M),w.vy+=_*M}function d(){if(o){var g,y=o.length,m=r.length,x=new Map(o.map((w,E)=>[e(w,E,o),w])),b;for(g=0,s=new Array(y);g<m;++g)b=r[g],b.index=g,typeof b.source!="object"&&(b.source=P2(x,b.source)),typeof b.target!="object"&&(b.target=P2(x,b.target)),s[b.source.index]=(s[b.source.index]||0)+1,s[b.target.index]=(s[b.target.index]||0)+1;for(g=0,u=new Array(m);g<m;++g)b=r[g],u[g]=s[b.source.index]/(s[b.source.index]+s[b.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:fn(+g),v(),h):t},h.distance=function(g){return arguments.length?(i=typeof g=="function"?g:fn(+g),p(),h):i},h}var rX={value:()=>{}};function CL(){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 hd(t)}function hd(r){this._=r}function nX(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}})}hd.prototype=CL.prototype={constructor:hd,on:function(r,e){var t=this._,n=nX(r+"",t),i,a=-1,o=n.length;if(arguments.length<2){for(;++a<o;)if((i=(r=n[a]).type)&&(i=iX(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]=R2(t[i],r.name,e);else if(e==null)for(i in t)t[i]=R2(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 hd(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 iX(r,e){for(var t=0,n=r.length,i;t<n;++t)if((i=r[t]).name===e)return i.value}function R2(r,e,t){for(var n=0,i=r.length;n<i;++n)if(r[n].name===e){r[n]=rX,r=r.slice(0,n).concat(r.slice(n+1));break}return t!=null&&r.push({name:e,value:t}),r}var Xu=0,ll=0,Hf=0,AL=1e3,Yd,cl,Wd=0,Ls=0,Tv=0,zl=typeof performance=="object"&&performance.now?performance:Date,TL=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function IL(){return Ls||(TL(aX),Ls=zl.now()+Tv)}function aX(){Ls=0}function _y(){this._call=this._time=this._next=null}_y.prototype=kL.prototype={constructor:_y,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?IL():+t)+(e==null?0:+e),!this._next&&cl!==this&&(cl?cl._next=this:Yd=this,cl=this),this._call=r,this._time=t,Sy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sy())}};function kL(r,e,t){var n=new _y;return n.restart(r,e,t),n}function oX(){IL(),++Xu;for(var r=Yd,e;r;)(e=Ls-r._time)>=0&&r._call.call(null,e),r=r._next;--Xu}function B2(){Ls=(Wd=zl.now())+Tv,Xu=ll=0;try{oX()}finally{Xu=0,uX(),Ls=0}}function sX(){var r=zl.now(),e=r-Wd;e>AL&&(Tv-=e,Wd=r)}function uX(){for(var r,e=Yd,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:Yd=t);cl=r,Sy(n)}function Sy(r){if(!Xu){ll&&(ll=clearTimeout(ll));var e=r-Ls;e>24?(r<1/0&&(ll=setTimeout(B2,r-zl.now()-Tv)),Hf&&(Hf=clearInterval(Hf))):(Hf||(Wd=zl.now(),Hf=setInterval(sX,AL)),Xu=1,TL(B2))}}const fX=1664525,lX=1013904223,F2=4294967296;function cX(){let r=1;return()=>(r=(fX*r+lX)%F2)/F2}function hX(r){return r.x}function dX(r){return r.y}var vX=10,pX=Math.PI*(3-Math.sqrt(5));function gX(r){var e,t=1,n=.001,i=1-Math.pow(n,1/300),a=0,o=.6,s=new Map,u=kL(c),f=CL("tick","end"),l=cX();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 x=0;x<p;++x)for(t+=(a-t)*i,s.forEach(function(b){b(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=vX*Math.sqrt(.5+p),x=p*pX;y.x=m*Math.cos(x),y.y=m*Math.sin(x)}(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,x=r.length,b,w,E,S,_;for(y==null?y=1/0:y*=y,m=0;m<x;++m)S=r[m],b=p-S.x,w=g-S.y,E=b*b+w*w,E<y&&(_=S,y=E);return _},on:function(p,g){return arguments.length>1?(f.on(p,g),e):f.on(p)}}}function yX(){var r,e,t,n,i=fn(-30),a,o=1,s=1/0,u=.81;function f(d){var v,p=r.length,g=Av(r,hX,dX).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,x,b;if(d.length){for(m=x=b=0;b<4;++b)(p=d[b])&&(g=Math.abs(p.value))&&(v+=p.value,y+=g,m+=g*p.x,x+=g*p.y);d.x=m/y,d.y=x/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,x=g-v,b=y*y+m*m;if(x*x/u<b)return b<s&&(y===0&&(y=xo(t),b+=y*y),m===0&&(m=xo(t),b+=m*m),b<o&&(b=Math.sqrt(o*b)),e.vx+=y*d.value*n/b,e.vy+=m*d.value*n/b),!0;if(d.length||b>=s)return;(d.data!==e||d.next)&&(y===0&&(y=xo(t),b+=y*y),m===0&&(m=xo(t),b+=m*m),b<o&&(b=Math.sqrt(o*b)));do d.data!==e&&(x=a[d.data.index]*n/b,e.vx+=y*x,e.vy+=m*x);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:fn(+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 mX(r,e,t){var n,i=fn(.1),a,o;typeof r!="function"&&(r=fn(+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:fn(+f),u(),s):i},s.radius=function(f){return arguments.length?(r=typeof f=="function"?f:fn(+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 bX(r){var e=fn(.1),t,n,i;typeof r!="function"&&(r=fn(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:fn(+s),o(),a):e},a.x=function(s){return arguments.length?(r=typeof s=="function"?s:fn(+s),o(),a):r},a}function xX(r){var e=fn(.1),t,n,i;typeof r!="function"&&(r=fn(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:fn(+s),o(),a):e},a.y=function(s){return arguments.length?(r=typeof s=="function"?s:fn(+s),o(),a):r},a}const wX=Object.freeze(Object.defineProperty({__proto__:null,forceCenter:Z7,forceCollide:J7,forceLink:tX,forceManyBody:yX,forceRadial:mX,forceSimulation:gX,forceX:bX,forceY:xX},Symbol.toStringTag,{value:"Module"})),u1=da(wX);var Zi={},G2;function EX(){if(G2)return Zi;G2=1;var r=Zi&&Zi.__createBinding||(Object.create?function(o,s,u,f){f===void 0&&(f=u);var l=Object.getOwnPropertyDescriptor(s,u);(!l||("get"in l?!s.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return s[u]}}),Object.defineProperty(o,f,l)}:function(o,s,u,f){f===void 0&&(f=u),o[f]=s[u]}),e=Zi&&Zi.__setModuleDefault||(Object.create?function(o,s){Object.defineProperty(o,"default",{enumerable:!0,value:s})}:function(o,s){o.default=s}),t=Zi&&Zi.__importStar||function(o){if(o&&o.__esModule)return o;var s={};if(o!=null)for(var u in o)u!=="default"&&Object.prototype.hasOwnProperty.call(o,u)&&r(s,o,u);return e(s,o),s};Object.defineProperty(Zi,"__esModule",{value:!0});var n=t(u1),i=$r();function a(){function o(J){return function(){return J}}var s=function(J){return J.cluster},u=o(1),f=o(-1),l=o(100),c=o(.1),h=[0,0],d=[],v={},p=[],g=100,y=100,m={none:{x:0,y:0}},x=[],b,w="force",E=!0,S=.1;function _(J){if(!E)return _;b.tick(),L();for(var me=0,Ae=d.length,Ye=void 0,Ve=J*S;me<Ae;++me)Ye=d[me],Ye.vx+=(m[s(Ye)].x-Ye.x)*Ve,Ye.vy+=(m[s(Ye)].y-Ye.y)*Ve}function C(){d&&M()}function M(){if(!(!d||!d.length)){if(s(d[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 J=A();b=n.forceSimulation(J.nodes).force("x",n.forceX(g).strength(.1)).force("y",n.forceY(y).strength(.1)).force("collide",n.forceCollide(function(me){return me.r}).iterations(4)).force("charge",n.forceManyBody().strength(f)).force("links",n.forceLink(J.nodes.length?J.links:[]).distance(l).strength(c)),x=b.nodes(),L()}}function A(){var J=[],me=[],Ae={},Ye=[],Ve={},Ke=[];return Ve=T(d),Ke=I(p),Ye=Object.keys(Ve),Ye.forEach(function(xt,kt){var Lt=Ve[xt];J.push({id:xt,size:Lt.count,r:Math.sqrt(Lt.sumforceNodeSize/Math.PI)}),Ae[xt]=kt}),Ke.forEach(function(xt){var kt=(0,i.getEdgeTerminal)(xt,"source"),Lt=(0,i.getEdgeTerminal)(xt,"target"),vr=Ae[kt],xr=Ae[Lt];vr!==void 0&&xr!==void 0&&me.push({source:vr,target:xr,count:xt.count})}),{nodes:J,links:me}}function T(J){var me={};return J.forEach(function(Ae){var Ye=s(Ae);me[Ye]||(me[Ye]={count:0,sumforceNodeSize:0})}),J.forEach(function(Ae){var Ye=s(Ae),Ve=u(Ae),Ke=me[Ye];Ke.count=Ke.count+1,Ke.sumforceNodeSize=Ke.sumforceNodeSize+Math.PI*(Ve*Ve)*1.3,me[Ye]=Ke}),me}function I(J){var me={},Ae=[];J.forEach(function(Ve){var Ke=N(Ve),xt=0;me[Ke]!==void 0&&(xt=me[Ke]),xt+=1,me[Ke]=xt});var Ye=Object.entries(me);return Ye.forEach(function(Ve){var Ke=Ve[0],xt=Ve[1],kt=Ke.split("~")[0],Lt=Ke.split("~")[1];kt!==void 0&&Lt!==void 0&&Ae.push({source:kt,target:Lt,count:xt})}),Ae}function L(){return m={none:{x:0,y:0}},x.forEach(function(J){m[J.id]={x:J.x-h[0],y:J.y-h[1]}}),m}function N(J){var me=(0,i.getEdgeTerminal)(J,"source"),Ae=(0,i.getEdgeTerminal)(J,"target"),Ye=s(v[me]),Ve=s(v[Ae]);return Ye<=Ve?"".concat(Ye,"~").concat(Ve):"".concat(Ve,"~").concat(Ye)}function O(J){v={},J.forEach(function(me){v[me.id]=me})}function B(J){return arguments.length?(w=J,C(),_):w}function W(J){return arguments.length?typeof J=="string"?(s=function(me){return me[J]},_):(s=J,_):s}function D(J){return arguments.length?(E=J,_):E}function P(J){return arguments.length?(S=J,_):S}function R(J){return arguments.length?(g=J,_):g}function X(J){return arguments.length?(y=J,_):y}function Y(J){return arguments.length?(O(J||[]),d=J||[],_):d}function ee(J){return arguments.length?(p=J||[],C(),_):p}function U(J){return arguments.length?(typeof J=="function"?u=J:u=o(+J),C(),_):u}function Z(J){return arguments.length?(typeof J=="function"?f=J:f=o(+J),C(),_):f}function K(J){return arguments.length?(typeof J=="function"?l=J:l=o(+J),C(),_):l}function se(J){return arguments.length?(typeof J=="function"?c=J:c=o(+J),C(),_):c}function re(J){return arguments.length?(h=J,_):h}return _.initialize=function(J){d=J,C()},_.template=B,_.groupBy=W,_.enableGrouping=D,_.strength=P,_.centerX=R,_.centerY=X,_.nodes=Y,_.links=ee,_.forceNodeSize=U,_.nodeSize=_.forceNodeSize,_.forceCharge=Z,_.forceLinkDistance=K,_.forceLinkStrength=se,_.offset=re,_.getFocis=L,_}return Zi.default=a,Zi}var ts={},z2;function Iv(){return z2||(z2=1,Object.defineProperty(ts,"__esModule",{value:!0}),ts.FORCE_LAYOUT_TYPE_MAP=ts.LAYOUT_MESSAGE=void 0,ts.LAYOUT_MESSAGE={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"},ts.FORCE_LAYOUT_TYPE_MAP={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0}),ts}var j2;function _X(){if(j2)return Nn;j2=1;var r=Nn&&Nn.__extends||function(){var d=function(v,p){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(g[m]=y[m])},d(v,p)};return function(v,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");d(v,p);function g(){this.constructor=v}v.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}}(),e=Nn&&Nn.__createBinding||(Object.create?function(d,v,p,g){g===void 0&&(g=p);var y=Object.getOwnPropertyDescriptor(v,p);(!y||("get"in y?!v.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return v[p]}}),Object.defineProperty(d,g,y)}:function(d,v,p,g){g===void 0&&(g=p),d[g]=v[p]}),t=Nn&&Nn.__setModuleDefault||(Object.create?function(d,v){Object.defineProperty(d,"default",{enumerable:!0,value:v})}:function(d,v){d.default=v}),n=Nn&&Nn.__importStar||function(d){if(d&&d.__esModule)return d;var v={};if(d!=null)for(var p in d)p!=="default"&&Object.prototype.hasOwnProperty.call(d,p)&&e(v,d,p);return t(v,d),v},i=Nn&&Nn.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(Nn,"__esModule",{value:!0}),Nn.ForceLayout=void 0;var a=n(u1),o=i(EX()),s=$r(),u=ln(),f=Iv(),l=function(d){r(v,d);function v(p){var g=d.call(this)||this;return g.center=[0,0],g.nodeStrength=null,g.edgeStrength=null,g.preventOverlap=!1,g.clusterNodeStrength=null,g.clusterEdgeStrength=null,g.clusterEdgeDistance=null,g.clusterNodeSize=null,g.clusterFociStrength=null,g.linkDistance=50,g.alphaDecay=.028,g.alphaMin=.001,g.alpha=.3,g.collideStrength=1,g.workerEnabled=!1,g.tick=function(){},g.onLayoutEnd=function(){},g.ticking=void 0,p&&g.updateCfg(p),g}return v.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}},v.prototype.init=function(p){var g=this;g.nodes=p.nodes||[];var y=p.edges||[];g.edges=y.map(function(m){var x={},b=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(m).forEach(function(w){b.indexOf(w)>-1||(x[w]=m[w])}),x}),g.ticking=!1},v.prototype.execute=function(p){var g=this,y=g.nodes,m=g.edges;if(!g.ticking){var x=g.forceSimulation,b=g.alphaMin,w=g.alphaDecay,E=g.alpha;if(x){if(p){if(g.clustering&&g.clusterForce&&(g.clusterForce.nodes(y),g.clusterForce.links(m)),x.nodes(y),m&&g.edgeForce)g.edgeForce.links(m);else if(m&&!g.edgeForce){var C=a.forceLink().id(function(I){return I.id}).links(m);g.edgeStrength&&C.strength(g.edgeStrength),g.linkDistance&&C.distance(g.linkDistance),g.edgeForce=C,x.force("link",C)}}g.preventOverlap&&g.overlapProcess(x),x.alpha(E).restart(),this.ticking=!0}else try{var S=a.forceManyBody();if(g.nodeStrength&&S.strength(g.nodeStrength),x=a.forceSimulation().nodes(y),g.clustering){var _=(0,o.default)();_.centerX(g.center[0]).centerY(g.center[1]).template("force").strength(g.clusterFociStrength),m&&_.links(m),y&&_.nodes(y),_.forceLinkDistance(g.clusterEdgeDistance).forceLinkStrength(g.clusterEdgeStrength).forceCharge(g.clusterNodeStrength).forceNodeSize(g.clusterNodeSize),g.clusterForce=_,x.force("group",_)}if(x.force("center",a.forceCenter(g.center[0],g.center[1])).force("charge",S).alpha(E).alphaDecay(w).alphaMin(b),g.preventOverlap&&g.overlapProcess(x),m){var C=a.forceLink().id(function(T){return T.id}).links(m);g.edgeStrength&&C.strength(g.edgeStrength),g.linkDistance&&C.distance(g.linkDistance),g.edgeForce=C,x.force("link",C)}if(g.workerEnabled&&!h()&&(g.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!g.workerEnabled)x.on("tick",function(){g.tick()}).on("end",function(){g.ticking=!1,g.onLayoutEnd&&g.onLayoutEnd()}),g.ticking=!0;else{x.stop();for(var M=c(x),A=1;A<=M;A++)x.tick(),postMessage({nodes:y,currentTick:A,totalTicks:M,type:f.LAYOUT_MESSAGE.TICK},void 0);g.ticking=!1}g.forceSimulation=x,g.ticking=!0}catch(T){g.ticking=!1,console.warn(T)}}},v.prototype.overlapProcess=function(p){var g=this,y=g.nodeSize,m=g.nodeSpacing,x,b,w=g.collideStrength;if((0,s.isNumber)(m)?b=function(){return m}:(0,s.isFunction)(m)?b=m:b=function(){return 0},!y)x=function(C){if(C.size){if((0,s.isArray)(C.size)){var M=C.size[0]>C.size[1]?C.size[0]:C.size[1];return M/2+b(C)}if((0,s.isObject)(C.size)){var M=C.size.width>C.size.height?C.size.width:C.size.height;return M/2+b(C)}return C.size/2+b(C)}return 10+b(C)};else if((0,s.isFunction)(y))x=function(C){var M=y(C);return M+b(C)};else if((0,s.isArray)(y)){var E=y[0]>y[1]?y[0]:y[1],S=E/2;x=function(C){return S+b(C)}}else if((0,s.isNumber)(y)){var _=y/2;x=function(C){return _+b(C)}}else x=function(){return 10};p.force("collisionForce",a.forceCollide(x).strength(w))},v.prototype.updateCfg=function(p){var g=this;g.ticking&&(g.forceSimulation.stop(),g.ticking=!1),g.forceSimulation=null,Object.assign(g,p)},v.prototype.destroy=function(){var p=this;p.ticking&&(p.forceSimulation.stop(),p.ticking=!1),p.nodes=null,p.edges=null,p.destroyed=!0},v}(u.Base);Nn.ForceLayout=l;function c(d){var v=d.alphaMin(),p=d.alphaTarget(),g=d.alpha(),y=Math.log((v-p)/(g-p))/Math.log(1-d.alphaDecay()),m=Math.ceil(y);return m}function h(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}return Nn}var U2;function LL(){return U2||(U2=1,function(r){var e=es&&es.__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=es&&es.__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(_X(),r)}(es)),es}var rs={},$2;function NL(){if($2)return rs;$2=1;var r=rs&&rs.__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)}}();Object.defineProperty(rs,"__esModule",{value:!0}),rs.CircularLayout=void 0;var e=ln(),t=$r();function n(s,u,f,l){s.forEach(function(c,h){s[h].children=[],s[h].parent=[]}),l?u.forEach(function(c){var h=(0,t.getEdgeTerminal)(c,"source"),d=(0,t.getEdgeTerminal)(c,"target"),v=0;h&&(v=f[h]);var p=0;d&&(p=f[d]);var g=s[v].children,y=s[p].parent;g.push(s[p].id),y.push(s[v].id)}):u.forEach(function(c){var h=(0,t.getEdgeTerminal)(c,"source"),d=(0,t.getEdgeTerminal)(c,"target"),v=0;h&&(v=f[h]);var p=0;d&&(p=f[d]);var g=s[v].children,y=s[p].children;g.push(s[p].id),y.push(s[v].id)})}function i(s,u,f){for(var l=f.length,c=0;c<l;c++){var h=(0,t.getEdgeTerminal)(f[c],"source"),d=(0,t.getEdgeTerminal)(f[c],"target");if(s.id===h&&u.id===d||u.id===h&&s.id===d)return!0}return!1}function a(s,u){var f=s.degree,l=u.degree;return f<l?-1:f>l?1:0}var o=function(s){r(u,s);function u(f){var l=s.call(this)||this;return l.radius=null,l.nodeSize=void 0,l.startRadius=null,l.endRadius=null,l.startAngle=0,l.endAngle=2*Math.PI,l.clockwise=!0,l.divisions=1,l.ordering=null,l.angleRatio=1,l.nodes=[],l.edges=[],l.nodeMap={},l.degrees=[],l.width=300,l.height=300,l.updateCfg(f),l}return u.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},u.prototype.execute=function(){var f,l=this,c=l.nodes,h=l.edges,d=c.length;if(d===0){l.onLayoutEnd&&l.onLayoutEnd();return}!l.width&&typeof window<"u"&&(l.width=window.innerWidth),!l.height&&typeof window<"u"&&(l.height=window.innerHeight),l.center||(l.center=[l.width/2,l.height/2]);var v=l.center;if(d===1){c[0].x=v[0],c[0].y=v[1],l.onLayoutEnd&&l.onLayoutEnd();return}var p=l.radius,g=l.startRadius,y=l.endRadius,m=l.divisions,x=l.startAngle,b=l.endAngle,w=l.angleRatio,E=l.ordering,S=l.clockwise,_=l.nodeSpacing,C=l.nodeSize,M=(b-x)/d,A={};c.forEach(function(Y,ee){A[Y.id]=ee}),l.nodeMap=A;var T=(0,t.getDegree)(c.length,A,h);if(l.degrees=T,_){var I=(0,t.getFuncByUnknownType)(10,_),L=(0,t.getFuncByUnknownType)(10,C),N=-1/0;c.forEach(function(Y){var ee=L(Y);N<ee&&(N=ee)});var O=0;c.forEach(function(Y,ee){ee===0?O+=N||10:O+=(I(Y)||0)+(N||10)}),p=O/(2*Math.PI)}else!p&&!g&&!y?p=l.height>l.width?l.width/2:l.height/2:!g&&y?g=y:g&&!y&&(y=g);var B=M*w,W=[];E==="topology"?W=l.topologyOrdering():E==="topology-directed"?W=l.topologyOrdering(!0):E==="degree"?W=l.degreeOrdering():W=c;for(var D=Math.ceil(d/m),P=0;P<d;++P){var R=p;!R&&g!==null&&y!==null&&(R=g+P*(y-g)/(d-1)),R||(R=10+P*100/(d-1));var X=x+P%D*B+2*Math.PI/m*Math.floor(P/D);S||(X=b-P%D*B-2*Math.PI/m*Math.floor(P/D)),W[P].x=v[0]+Math.cos(X)*R,W[P].y=v[1]+Math.sin(X)*R,W[P].weight=T[P].all}return(f=l.onLayoutEnd)===null||f===void 0||f.call(l),{nodes:W,edges:this.edges}},u.prototype.topologyOrdering=function(f){f===void 0&&(f=!1);var l=this,c=l.degrees,h=l.edges,d=l.nodes,v=(0,t.clone)(d),p=l.nodeMap,g=[v[0]],y=[d[0]],m=[],x=d.length;m[0]=!0,n(v,h,p,f);var b=0;return v.forEach(function(w,E){if(E!==0)if((E===x-1||c[E].all!==c[E+1].all||i(g[b],w,h))&&!m[E])g.push(w),y.push(d[p[w.id]]),m[E]=!0,b++;else{for(var S=g[b].children,_=!1,C=0;C<S.length;C++){var M=p[S[C]];if(c[M].all===c[E].all&&!m[M]){g.push(v[M]),y.push(d[p[v[M].id]]),m[M]=!0,_=!0;break}}for(var A=0;!_&&(m[A]||(g.push(v[A]),y.push(d[p[v[A].id]]),m[A]=!0,_=!0),A++,A!==x););}}),y},u.prototype.degreeOrdering=function(){var f=this,l=f.nodes,c=[],h=f.degrees;return l.forEach(function(d,v){d.degree=h[v].all,c.push(d)}),c.sort(a),c},u.prototype.getType=function(){return"circular"},u}(e.Base);return rs.CircularLayout=o,rs}var Ta={},cu={},io={},hu={},ao={},yh={},X2;function SX(){if(X2)return yh;X2=1,Object.defineProperty(yh,"__esModule",{value:!0});var r=function(n,i){if(n!=="next"&&n!=="prev")return i},e=function(n){n.prev.next=n.next,n.next.prev=n.prev,delete n.next,delete n.prev},t=function(){function n(){var i={};i.prev=i,i.next=i.prev,this.shortcut=i}return n.prototype.dequeue=function(){var i=this.shortcut,a=i.prev;if(a&&a!==i)return e(a),a},n.prototype.enqueue=function(i){var a=this.shortcut;i.prev&&i.next&&e(i),i.next=a.next,a.next.prev=i,a.next=i,i.prev=a},n.prototype.toString=function(){for(var i=[],a=this.shortcut,o=a.prev;o!==a;)i.push(JSON.stringify(o,r)),o=o==null?void 0:o.prev;return"[".concat(i.join(", "),"]")},n}();return yh.default=t,yh}var Du;(function(r){r.DEFAULT_EDGE_NAME="\0",r.GRAPH_NODE="\0",r.EDGE_KEY_DELIM=""})(Du||(Du={}));function Y2(r,e){var t=r.get(e)||0;r.set(e,t+1)}function W2(r,e){var t=r.get(e);t!==void 0&&(t=t-1,t>0?r.set(e,t):r.delete(e))}function OL(r,e,t,n){var i=String(e),a=String(t);if(!r&&i>a){var o=i;i=a,a=o}return i+Du.EDGE_KEY_DELIM+a+Du.EDGE_KEY_DELIM+(n===void 0?Du.DEFAULT_EDGE_NAME:n)}function q2(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 Og(r,e){return OL(r,e.v,e.w,e.name)}function V2(r){return typeof r=="function"}var MX=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})},CX=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})},AX=function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:MX(e),edges:CX(e),value:e.graph()};return t.value===void 0&&delete t.value,t},TX=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 H2(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 Z2(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?H2(Object(t),!0).forEach(function(n){IX(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):H2(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function IX(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kX(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function LX(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 NX(r,e,t){return e&&LX(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}var OX={compound:!1,multigraph:!1,directed:!0},Rs=function(){function r(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kX(this,r),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=Du.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 V2(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 V2(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(Og(e.isDirected(),i))},this.hasEdge=function(i,a,o){return e.edgesLabelsMap.has(Og(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 AX(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=Z2(Z2({},OX),t);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return NX(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=q2(this.isDirected(),t,n,a),f=Og(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 Y2(h,l),Y2(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=OL(this.isDirected(),t,n,i),o=this.edgesMap.get(a);if(o){var s=q2(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);W2(l,u),W2(c,f),this.inEdgesMap.get(f).delete(a),this.outEdgesMap.get(u).delete(a),this.edgeCountNum-=1}return this}}]),r}();Rs.fromJSON=TX;function My(r){"@babel/helpers - typeof";return My=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},My(r)}function DX(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function PX(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 RX(r,e,t){return e&&PX(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function xs(){return typeof Reflect<"u"&&Reflect.get?xs=Reflect.get:xs=function(e,t,n){var i=BX(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},xs.apply(this,arguments)}function BX(r,e){for(;!Object.prototype.hasOwnProperty.call(r,e)&&(r=Ga(r),r!==null););return r}function FX(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&&Cy(r,e)}function Cy(r,e){return Cy=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Cy(r,e)}function GX(r){var e=UX();return function(){var n=Ga(r),i;if(e){var a=Ga(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return zX(this,i)}}function zX(r,e){if(e&&(My(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jX(r)}function jX(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function UX(){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 Ga(r){return Ga=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ga(r)}var $X=function(r){FX(t,r);var e=GX(t);function t(){var n;DX(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 RX(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 xs(Ga(t.prototype),"setNode",this).call(this,i,a),this.emitEvent("nodeAdd",i,a),this}},{key:"removeNode",value:function(i){return xs(Ga(t.prototype),"removeNode",this).call(this,i),this.emitEvent("nodeRemove",i),this}},{key:"setEdge",value:function(i,a,o,s){return xs(Ga(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 xs(Ga(t.prototype),"removeEdge",this).call(this,i,a,o),this.emitEvent("edgeRemove",i,a,o),this}}]),t}(Rs);function XX(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function YX(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var DL=XX(function r(){var e=this;YX(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)}}),WX=function(e,t){var n=new Rs,i=new Map,a=new DL,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},qX=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},VX=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))},f1=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))VX(e,u,n==="post",s,a,o);else throw new Error("Graph does not have node: "+u)}),o};function HX(r,e){return JX(r)||QX(r,e)||KX(r,e)||ZX()}function ZX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
31
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KX(r,e){if(r){if(typeof r=="string")return K2(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 K2(r,e)}}function K2(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 QX(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 JX(r){if(Array.isArray(r))return r}var eY=function(){return 1},PL=function(e,t,n,i){return tY(e,t,n||eY,i||function(a){return e.outEdges(a)})},tY=function(e,t,n,i){var a=new Map,o=new DL,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=HX(c,2),d=h[0],v=h[1];return l[String(d)]=v,l}),l},rY=function(e,t,n){var i={};return e.nodes().forEach(function(a){return i[String(a)]=PL(e,a,t,n),i}),i},RL=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},nY=function(e){return RL(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 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")}function oY(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&&jl(r,e)}function sY(r){var e=BL();return function(){var n=Ul(r),i;if(e){var a=Ul(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return uY(this,i)}}function uY(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 fY(r)}function fY(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Ty(r){var e=typeof Map=="function"?new Map:void 0;return Ty=function(n){if(n===null||!lY(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 dd(n,arguments,Ul(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),jl(i,n)},Ty(r)}function dd(r,e,t){return BL()?dd=Reflect.construct:dd=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),f=new u;return o&&jl(f,o.prototype),f},dd.apply(null,arguments)}function BL(){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 lY(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function jl(r,e){return jl=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},jl(r,e)}function Ul(r){return Ul=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ul(r)}var Iy=function(r){oY(t,r);var e=sY(t);function t(){return aY(this,t),e.apply(this,arguments)}return iY(t)}(Ty(Error));function FL(r){var e=new Set,t=new Set,n=[];function i(a){if(t.has(a))throw new Iy;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 Iy;return n}var cY=function(e){try{FL(e)}catch(t){if(t instanceof Iy)return!1;throw t}return!0},hY=function(e,t){return f1(e,t,"post")},dY=function(e,t){return f1(e,t,"pre")},vY=function(){return 1};function pY(r,e,t){return gY(r,e||vY,t||function(n){return r.outEdges(n)})}function gY(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 yY=Object.freeze(Object.defineProperty({__proto__:null,components:qX,dfs:f1,dijkstra:PL,dijkstraAll:rY,findCycles:nY,floydWarshall:pY,isAcyclic:cY,postorder:hY,preorder:dY,prim:WX,tarjan:RL,topsort:FL},Symbol.toStringTag,{value:"Module"}));var mY=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},GL=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},zL=function(e,t){var n=e.nodes(),i=n.filter(function(a){return t.hasNode(a)});return i},jL=function(e,t){var n=e.edges(),i=n.filter(function(a){return t.hasEdge(a.v,a.w,a.name)});return i},UL=function(e,t){return e.isCompound()===t.isCompound()&&e.isDirected()===t.isDirected()&&e.isMultigraph()===t.isMultigraph()},kv=function(e,t){var n=zL(e,t);return n.length===e.nodes().length},l1=function(e,t){var n=jL(e,t);return n.length===e.edges().length},bY=function(e,t){return UL(e,t)&&e.nodeCount()===t.nodeCount()&&kv(e,t)&&e.edgeCount()===t.edgeCount()&&l1(e,t)},xY=function(e,t){return kv(e,t)&&l1(e,t)};function wY(r,e){return MY(r)||SY(r,e)||_Y(r,e)||EY()}function EY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
32
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Y(r,e){if(r){if(typeof r=="string")return Q2(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 Q2(r,e)}}function Q2(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 SY(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 MY(r){if(Array.isArray(r))return r}function CY(r){return r instanceof Rs}function qd(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=wY(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 AY(r){return r.nodes().length===0}function TY(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 IY=Object.freeze(Object.defineProperty({__proto__:null,hasSelfLoop:TY,isGraph:CY,isNullGraph:AY,isSimpleGraph:qd},Symbol.toStringTag,{value:"Module"}));var kY=function(e,t){if(!qd(e)||!qd(t)||!kv(e,t)||GL(e,t))return!1;var n=e.nodeCount();return e.edgeCount()+t.edgeCount()===n*(n-1)/2};const LY=Object.freeze(Object.defineProperty({__proto__:null,containAllSameEdges:l1,containAllSameNodes:kv,containSameEdges:GL,containSameNodes:mY,getSameEdges:jL,getSameNodes:zL,isGraphComplement:kY,isGraphContainsAnother:xY,isGraphOptionSame:UL,isGraphSame:bY},Symbol.toStringTag,{value:"Module"}));var NY=function(e){if(!qd(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 OY=Object.freeze(Object.defineProperty({__proto__:null,getGraphComplement:NY},Symbol.toStringTag,{value:"Module"})),DY=Object.freeze(Object.defineProperty({__proto__:null,Graph:Rs,GraphWithEvent:$X,algorithm:yY,comparision:LY,essence:IY,generate:OY},Symbol.toStringTag,{value:"Module"})),Lv=da(DY);var J2;function PY(){if(J2)return ao;J2=1;var r=ao&&ao.__extends||function(){var h=function(d,v){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,g){p.__proto__=g}||function(p,g){for(var y in g)Object.prototype.hasOwnProperty.call(g,y)&&(p[y]=g[y])},h(d,v)};return function(d,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");h(d,v);function p(){this.constructor=d}d.prototype=v===null?Object.create(v):(p.prototype=v.prototype,new p)}}(),e=ao&&ao.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ao,"__esModule",{value:!0});var t=e(SX()),n=Lv,i=function(h){r(d,h);function d(){return h!==null&&h.apply(this,arguments)||this}return d}(t.default),a=function(h){r(d,h);function d(){return h!==null&&h.apply(this,arguments)||this}return d}(n.Graph),o=function(){return 1},s=function(h,d){var v;if(h.nodeCount()<=1)return[];var p=l(h,d||o),g=u(p.graph,p.buckets,p.zeroIdx);return(v=g.map(function(y){return h.outEdges(y.v,y.w)}))===null||v===void 0?void 0:v.flat()},u=function(h,d,v){for(var p=[],g=d[d.length-1],y=d[0],m;h.nodeCount();){for(;m=y.dequeue();)f(h,d,v,m);for(;m=g.dequeue();)f(h,d,v,m);if(h.nodeCount()){for(var x=d.length-2;x>0;--x)if(m=d[x].dequeue(),m){p=p.concat(f(h,d,v,m,!0));break}}}return p},f=function(h,d,v,p,g){var y,m,x=[];return(y=h.inEdges(p.v))===null||y===void 0||y.forEach(function(b){var w=h.edge(b),E=h.node(b.v);g&&x.push({v:b.v,w:b.w,in:0,out:0}),E.out===void 0&&(E.out=0),E.out-=w,c(d,v,E)}),(m=h.outEdges(p.v))===null||m===void 0||m.forEach(function(b){var w=h.edge(b),E=b.w,S=h.node(E);S.in===void 0&&(S.in=0),S.in-=w,c(d,v,S)}),h.removeNode(p.v),g?x:void 0},l=function(h,d){var v=new a,p=0,g=0;h.nodes().forEach(function(w){v.setNode(w,{v:w,in:0,out:0})}),h.edges().forEach(function(w){var E=v.edge(w)||0,S=(d==null?void 0:d(w))||1,_=E+S;v.setEdge(w.v,w.w,_),g=Math.max(g,v.node(w.v).out+=S),p=Math.max(p,v.node(w.w).in+=S)});for(var y=[],m=g+p+3,x=0;x<m;x++)y.push(new i);var b=p+1;return v.nodes().forEach(function(w){c(y,b,v.node(w))}),{buckets:y,zeroIdx:b,graph:v}},c=function(h,d,v){v.out?v.in?h[v.out-v.in+d].enqueue(v):h[h.length-1].enqueue(v):h[0].enqueue(v)};return ao.default=s,ao}var e_;function RY(){if(e_)return hu;e_=1;var r=hu&&hu.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(hu,"__esModule",{value:!0});var e=r(PY()),t=function(a){var o=function(u){return function(f){var l;return((l=u.edge(f))===null||l===void 0?void 0:l.weight)||1}},s=a.graph().acyclicer==="greedy"?(0,e.default)(a,o(a)):n(a);s==null||s.forEach(function(u){var f=a.edge(u);a.removeEdgeObj(u),f.forwardName=u.name,f.reversed=!0,a.setEdge(u.w,u.v,f,"rev-".concat(Math.random()))})},n=function(a){var o=[],s={},u={},f=function(l){var c;u[l]||(u[l]=!0,s[l]=!0,(c=a.outEdges(l))===null||c===void 0||c.forEach(function(h){s[h.w]?o.push(h):f(h.w)}),delete s[l])};return a.nodes().forEach(f),o},i=function(a){a.edges().forEach(function(o){var s=a.edge(o);if(s.reversed){a.removeEdgeObj(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,a.setEdge(o.w,o.v,s,u)}})};return hu.default={run:t,undo:i},hu}var mh={},Dg={},ns={},t_;function rf(){if(t_)return ns;t_=1;var r=ns&&ns.__extends||function(){var n=function(i,a){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,s){o.__proto__=s}||function(o,s){for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(o[u]=s[u])},n(i,a)};return function(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");n(i,a);function o(){this.constructor=i}i.prototype=a===null?Object.create(a):(o.prototype=a.prototype,new o)}}();Object.defineProperty(ns,"__esModule",{value:!0}),ns.Graph=void 0;var e=Lv,t=function(n){r(i,n);function i(){return n!==null&&n.apply(this,arguments)||this}return i}(e.Graph);return ns.Graph=t,ns}var r_;function gi(){return r_||(r_=1,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=$r(),t=rf(),n=function(b,w){return Number(b)-Number(w)},i=function(b,w,E,S){var _;do _="".concat(S).concat(Math.random());while(b.hasNode(_));return E.dummy=w,b.setNode(_,E),_};r.addDummyNode=i;var a=function(b){var w=new t.Graph().setGraph(b.graph());return b.nodes().forEach(function(E){w.setNode(E,b.node(E))}),b.edges().forEach(function(E){var S=w.edgeFromArgs(E.v,E.w)||{weight:0,minlen:1},_=b.edge(E);w.setEdge(E.v,E.w,{weight:S.weight+_.weight,minlen:Math.max(S.minlen,_.minlen)})}),w};r.simplify=a;var o=function(b){var w=new t.Graph({multigraph:b.isMultigraph()}).setGraph(b.graph());return b.nodes().forEach(function(E){var S;!((S=b.children(E))===null||S===void 0)&&S.length||w.setNode(E,b.node(E))}),b.edges().forEach(function(E){w.setEdgeObj(E,b.edge(E))}),w};r.asNonCompoundGraph=o;var s=function(b,w){return b==null?void 0:b.reduce(function(E,S,_){return E[S]=w[_],E},{})};r.zipObject=s;var u=function(b){var w={};return b.nodes().forEach(function(E){var S,_={};(S=b.outEdges(E))===null||S===void 0||S.forEach(function(C){var M;_[C.w]=(_[C.w]||0)+(((M=b.edge(C))===null||M===void 0?void 0:M.weight)||0)}),w[E]=_}),w};r.successorWeights=u;var f=function(b){var w=b.nodes(),E=w.map(function(S){var _,C={};return(_=b.inEdges(S))===null||_===void 0||_.forEach(function(M){C[M.v]=(C[M.v]||0)+b.edge(M).weight}),C});return(0,r.zipObject)(w,E)};r.predecessorWeights=f;var l=function(b,w){var E=Number(b.x),S=Number(b.y),_=Number(w.x)-E,C=Number(w.y)-S,M=Number(b.width)/2,A=Number(b.height)/2;if(!_&&!C)return{x:0,y:0};var T,I;return Math.abs(C)*M>Math.abs(_)*A?(C<0&&(A=-A),T=A*_/C,I=A):(_<0&&(M=-M),T=M,I=M*C/_),{x:E+T,y:S+I}};r.intersectRect=l;var c=function(b){for(var w=[],E=(0,r.maxRank)(b)+1,S=0;S<E;S++)w.push([]);b.nodes().forEach(function(_){var C=b.node(_);if(C){var M=C.rank;M!==void 0&&w[M]&&w[M].push(_)}});for(var S=0;S<E;S++)w[S]=w[S].sort(function(C,M){var A,T;return n((A=b.node(C))===null||A===void 0?void 0:A.order,(T=b.node(M))===null||T===void 0?void 0:T.order)});return w};r.buildLayerMatrix=c;var h=function(b){var w=b.nodes().filter(function(S){var _;return((_=b.node(S))===null||_===void 0?void 0:_.rank)!==void 0}).map(function(S){return b.node(S).rank}),E=Math.min.apply(Math,w);b.nodes().forEach(function(S){var _=b.node(S);_.hasOwnProperty("rank")&&E!==1/0&&(_.rank-=E)})};r.normalizeRanks=h;var d=function(b){var w=b.nodes(),E=w.filter(function(I){var L;return((L=b.node(I))===null||L===void 0?void 0:L.rank)!==void 0}).map(function(I){return b.node(I).rank}),S=Math.min.apply(Math,E),_=[];w.forEach(function(I){var L,N=(((L=b.node(I))===null||L===void 0?void 0:L.rank)||0)-S;_[N]||(_[N]=[]),_[N].push(I)});for(var C=0,M=b.graph().nodeRankFactor||0,A=0;A<_.length;A++){var T=_[A];T===void 0?A%M!==0&&(C-=1):C&&(T==null||T.forEach(function(I){var L=b.node(I);L&&(L.rank=L.rank||0,L.rank+=C)}))}};r.removeEmptyRanks=d;var v=function(b,w,E,S){var _={width:0,height:0};return(0,e.isNumber)(E)&&(0,e.isNumber)(S)&&(_.rank=E,_.order=S),(0,r.addDummyNode)(b,"border",_,w)};r.addBorderNode=v;var p=function(b){var w;return b.nodes().forEach(function(E){var S,_=(S=b.node(E))===null||S===void 0?void 0:S.rank;_!==void 0&&(w===void 0||_>w)&&(w=_)}),w||(w=0),w};r.maxRank=p;var g=function(b,w){var E={lhs:[],rhs:[]};return b==null||b.forEach(function(S){w(S)?E.lhs.push(S):E.rhs.push(S)}),E};r.partition=g;var y=function(b,w){var E=Date.now();try{return w()}finally{console.log("".concat(b," time: ").concat(Date.now()-E,"ms"))}};r.time=y;var m=function(b,w){return w()};r.notime=m;var x=function(b,w){return b.reduce(function(E,S){var _=w(E),C=w(S);return _>C?S:E})};r.minBy=x}(Dg)),Dg}var n_;function BY(){if(n_)return mh;n_=1,Object.defineProperty(mh,"__esModule",{value:!0});var r=gi(),e=function(i){i.graph().dummyChains=[],i.edges().forEach(function(a){return t(i,a)})},t=function(i,a){var o=a.v,s=i.node(o).rank,u=a.w,f=i.node(u).rank,l=a.name,c=i.edge(a),h=c.labelRank;if(f!==s+1){i.removeEdgeObj(a);var d=i.graph(),v,p,g;for(g=0,++s;s<f;++g,++s)c.points=[],p={edgeLabel:c,width:0,height:0,edgeObj:a,rank:s},v=(0,r.addDummyNode)(i,"edge",p,"_d"),s===h&&(p.width=c.width,p.height=c.height,p.dummy="edge-label",p.labelpos=c.labelpos),i.setEdge(o,v,{weight:c.weight},l),g===0&&(d.dummyChains||(d.dummyChains=[]),d.dummyChains.push(v)),o=v;i.setEdge(o,u,{weight:c.weight},l)}},n=function(i){var a;(a=i.graph().dummyChains)===null||a===void 0||a.forEach(function(o){var s=i.node(o),u=s.edgeLabel,f;s.edgeObj&&i.setEdgeObj(s.edgeObj,u);for(var l=o;s.dummy;)f=i.successors(l)[0],i.removeNode(l),u.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(u.x=s.x,u.y=s.y,u.width=s.width,u.height=s.height),l=f,s=i.node(l)})};return mh.default={run:e,undo:n},mh}var du={},Ki={},i_;function c1(){if(i_)return Ki;i_=1,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.slack=Ki.longestPathWithLayer=Ki.longestPath=void 0;var r=function(n){var i,a={},o=function(s){var u,f=n.node(s);if(!f)return 0;if(a[s])return f.rank;a[s]=!0;var l;return(u=n.outEdges(s))===null||u===void 0||u.forEach(function(c){var h=o(c.w),d=n.edge(c).minlen,v=h-d;v&&(l===void 0||v<l)&&(l=v)}),l||(l=0),f.rank=l,l};(i=n.sources())===null||i===void 0||i.forEach(function(s){return o(s)})};Ki.longestPath=r;var e=function(n){var i,a={},o,s=function(l){var c,h=n.node(l);if(!h)return 0;if(a[l])return h.rank;a[l]=!0;var d;return(c=n.outEdges(l))===null||c===void 0||c.forEach(function(v){var p=s(v.w),g=n.edge(v).minlen,y=p-g;y&&(d===void 0||y<d)&&(d=y)}),d||(d=0),(o===void 0||d<o)&&(o=d),h.rank=d,d};(i=n.sources())===null||i===void 0||i.forEach(function(l){n.node(l)&&s(l)}),o===void 0&&(o=0);var u={},f=function(l,c){var h,d=n.node(l),v=isNaN(d.layer)?c:d.layer;(d.rank===void 0||d.rank<v)&&(d.rank=v),!u[l]&&(u[l]=!0,(h=n.outEdges(l))===null||h===void 0||h.map(function(p){f(p.w,v+n.edge(p).minlen)}))};n.nodes().forEach(function(l){var c=n.node(l);c&&(isNaN(c.layer)?c.rank-=o:f(l,c.layer))})};Ki.longestPathWithLayer=e;var t=function(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen};return Ki.slack=t,Ki.default={longestPath:r,longestPathWithLayer:e,slack:t},Ki}var oo={},a_;function $L(){if(a_)return oo;a_=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.feasibleTreeWithLayer=oo.feasibleTree=void 0;var r=c1(),e=gi(),t=rf(),n=function(f){var l=new t.Graph({directed:!1}),c=f.nodes()[0],h=f.nodeCount();l.setNode(c,{});for(var d,v;i(l,f)<h;)d=s(l,f),v=l.hasNode(d.v)?(0,r.slack)(f,d):-(0,r.slack)(f,d),u(l,f,v);return l};oo.feasibleTree=n;var i=function(f,l){var c=function(h){l.nodeEdges(h).forEach(function(d){var v=d.v,p=h===v?d.w:v;!f.hasNode(p)&&!(0,r.slack)(l,d)&&(f.setNode(p,{}),f.setEdge(h,p,{}),c(p))})};return f.nodes().forEach(c),f.nodeCount()},a=function(f){var l=new t.Graph({directed:!1}),c=f.nodes()[0],h=f.nodes().filter(function(p){return!!f.node(p)}).length;l.setNode(c,{});for(var d,v;o(l,f)<h;)d=s(l,f),v=l.hasNode(d.v)?(0,r.slack)(f,d):-(0,r.slack)(f,d),u(l,f,v);return l};oo.feasibleTreeWithLayer=a;var o=function(f,l){var c=function(h){var d;(d=l.nodeEdges(h))===null||d===void 0||d.forEach(function(v){var p=v.v,g=h===p?v.w:p;!f.hasNode(g)&&(l.node(g).layer!==void 0||!(0,r.slack)(l,v))&&(f.setNode(g,{}),f.setEdge(h,g,{}),c(g))})};return f.nodes().forEach(c),f.nodeCount()},s=function(f,l){return(0,e.minBy)(l.edges(),function(c){return f.hasNode(c.v)!==f.hasNode(c.w)?(0,r.slack)(l,c):1/0})},u=function(f,l,c){f.nodes().forEach(function(h){l.node(h).rank||(l.node(h).rank=0),l.node(h).rank+=c})};return oo.default={feasibleTree:n,feasibleTreeWithLayer:a},oo}var Pg={},o_;function FY(){return o_||(o_=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.exchangeEdges=r.enterEdge=r.leaveEdge=r.initLowLimValues=r.calcCutValue=r.initCutValues=void 0;var e=$L(),t=c1(),n=gi(),i=Lv,a=i.algorithm.preorder,o=i.algorithm.postorder,s=function(x){var b=(0,n.simplify)(x);(0,t.longestPath)(b);var w=(0,e.feasibleTree)(b);(0,r.initLowLimValues)(w),(0,r.initCutValues)(w,b);for(var E,S;E=(0,r.leaveEdge)(w);)S=(0,r.enterEdge)(w,b,E),(0,r.exchangeEdges)(w,b,E,S)},u=function(x,b){var w=o(x,x.nodes());w=w==null?void 0:w.slice(0,(w==null?void 0:w.length)-1),w==null||w.forEach(function(E){f(x,b,E)})};r.initCutValues=u;var f=function(x,b,w){var E=x.node(w),S=E.parent;x.edgeFromArgs(w,S).cutvalue=(0,r.calcCutValue)(x,b,w)},l=function(x,b,w){var E,S=x.node(w),_=S.parent,C=!0,M=b.edgeFromArgs(w,_),A=0;return M||(C=!1,M=b.edgeFromArgs(_,w)),A=M.weight,(E=b.nodeEdges(w))===null||E===void 0||E.forEach(function(T){var I=T.v===w,L=I?T.w:T.v;if(L!==_){var N=I===C,O=b.edge(T).weight;if(A+=N?O:-O,y(x,w,L)){var B=x.edgeFromArgs(w,L).cutvalue;A+=N?-B:B}}}),A};r.calcCutValue=l;var c=function(x,b){b===void 0&&(b=x.nodes()[0]),h(x,{},1,b)};r.initLowLimValues=c;var h=function(x,b,w,E,S){var _,C=w,M=w,A=x.node(E);return b[E]=!0,(_=x.neighbors(E))===null||_===void 0||_.forEach(function(T){b[T]||(M=h(x,b,M,T,E))}),A.low=C,A.lim=M++,S?A.parent=S:delete A.parent,M},d=function(x){return x.edges().find(function(b){return x.edge(b).cutvalue<0})};r.leaveEdge=d;var v=function(x,b,w){var E=w.v,S=w.w;b.hasEdge(E,S)||(E=w.w,S=w.v);var _=x.node(E),C=x.node(S),M=_,A=!1;_.lim>C.lim&&(M=C,A=!0);var T=b.edges().filter(function(I){return A===m(x,x.node(I.v),M)&&A!==m(x,x.node(I.w),M)});return(0,n.minBy)(T,function(I){return(0,t.slack)(b,I)})};r.enterEdge=v;var p=function(x,b,w,E){var S=w.v,_=w.w;x.removeEdge(S,_),x.setEdge(E.v,E.w,{}),(0,r.initLowLimValues)(x),(0,r.initCutValues)(x,b),g(x,b)};r.exchangeEdges=p;var g=function(x,b){var w=x.nodes().find(function(S){var _;return!(!((_=b.node(S))===null||_===void 0)&&_.parent)}),E=a(x,w);E=E==null?void 0:E.slice(1),E==null||E.forEach(function(S){var _=x.node(S).parent,C=b.edgeFromArgs(S,_),M=!1;C||(C=b.edgeFromArgs(_,S),M=!0),b.node(S).rank=b.node(_).rank+(M?C.minlen:-C.minlen)})},y=function(x,b,w){return x.hasEdge(b,w)},m=function(x,b,w){return w.low<=b.lim&&b.lim<=w.lim};r.default=s}(Pg)),Pg}var s_;function GY(){if(s_)return du;s_=1;var r=du&&du.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(du,"__esModule",{value:!0});var e=c1(),t=$L(),n=r(FY()),i=function(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":a(u);break;default:o(u)}},a=e.longestPath,o=function(u){(0,e.longestPathWithLayer)(u),(0,t.feasibleTreeWithLayer)(u)},s=function(u){(0,n.default)(u)};return du.default=i,du}var bh={},u_;function zY(){if(u_)return bh;u_=1,Object.defineProperty(bh,"__esModule",{value:!0});var r=function(n){var i,a={},o=0,s=function(u){var f,l=o;(f=n.children(u))===null||f===void 0||f.forEach(s),a[u]={low:l,lim:o++}};return(i=n.children())===null||i===void 0||i.forEach(s),a},e=function(n,i,a,o){var s=[],u=[],f=Math.min(i[a].low,i[o].low),l=Math.max(i[a].lim,i[o].lim),c,h;c=a;do c=n.parent(c),s.push(c);while(c&&(i[c].low>f||l>i[c].lim));for(h=c,c=o;c&&c!==h;)u.push(c),c=n.parent(c);return{lca:h,path:s.concat(u.reverse())}},t=function(n){var i,a=r(n);(i=n.graph().dummyChains)===null||i===void 0||i.forEach(function(o){var s,u,f=o,l=n.node(f),c=l.edgeObj;if(c)for(var h=e(n,a,c.v,c.w),d=h.path,v=h.lca,p=0,g=d[p],y=!0;f!==c.w;){if(l=n.node(f),y){for(;g!==v&&((s=n.node(g))===null||s===void 0?void 0:s.maxRank)<l.rank;)p++,g=d[p];g===v&&(y=!1)}if(!y){for(;p<d.length-1&&((u=n.node(d[p+1]))===null||u===void 0?void 0:u.minRank)<=l.rank;)p++;g=d[p]}n.setParent(f,g),f=n.successors(f)[0]}})};return bh.default=t,bh}var xh={},f_;function jY(){if(f_)return xh;f_=1,Object.defineProperty(xh,"__esModule",{value:!0});var r=gi(),e=function(o){var s,u=(0,r.addDummyNode)(o,"root",{},"_root"),f=n(o),l=Math.max.apply(Math,Object.values(f));Math.abs(l)===1/0&&(l=1);var c=l-1,h=2*c+1;o.graph().nestingRoot=u,o.edges().forEach(function(v){o.edge(v).minlen*=h});var d=i(o)+1;(s=o.children())===null||s===void 0||s.forEach(function(v){t(o,u,h,d,c,f,v)}),o.graph().nodeRankFactor=h},t=function(o,s,u,f,l,c,h){var d=o.children(h);if(!(d!=null&&d.length)){h!==s&&o.setEdge(s,h,{weight:0,minlen:u});return}var v=(0,r.addBorderNode)(o,"_bt"),p=(0,r.addBorderNode)(o,"_bb"),g=o.node(h);o.setParent(v,h),g.borderTop=v,o.setParent(p,h),g.borderBottom=p,d==null||d.forEach(function(y){t(o,s,u,f,l,c,y);var m=o.node(y),x=m.borderTop?m.borderTop:y,b=m.borderBottom?m.borderBottom:y,w=m.borderTop?f:2*f,E=x!==b?1:l-c[h]+1;o.setEdge(v,x,{minlen:E,weight:w,nestingEdge:!0}),o.setEdge(b,p,{minlen:E,weight:w,nestingEdge:!0})}),o.parent(h)||o.setEdge(s,v,{weight:0,minlen:l+c[h]})},n=function(o){var s,u={},f=function(l,c){var h=o.children(l);h==null||h.forEach(function(d){return f(d,c+1)}),u[l]=c};return(s=o.children())===null||s===void 0||s.forEach(function(l){return f(l,1)}),u},i=function(o){var s=0;return o.edges().forEach(function(u){s+=o.edge(u).weight}),s},a=function(o){var s=o.graph();s.nestingRoot&&o.removeNode(s.nestingRoot),delete s.nestingRoot,o.edges().forEach(function(u){var f=o.edge(u);f.nestingEdge&&o.removeEdgeObj(u)})};return xh.default={run:e,cleanup:a},xh}var wh={},l_;function UY(){if(l_)return wh;l_=1,Object.defineProperty(wh,"__esModule",{value:!0});var r=gi(),e=function(n){var i,a=function(o){var s=n.children(o),u=n.node(o);if(s!=null&&s.length&&s.forEach(function(c){return a(c)}),u.hasOwnProperty("minRank")){u.borderLeft=[],u.borderRight=[];for(var f=u.minRank,l=u.maxRank+1;f<l;f+=1)t(n,"borderLeft","_bl",o,u,f),t(n,"borderRight","_br",o,u,f)}};(i=n.children())===null||i===void 0||i.forEach(function(o){return a(o)})},t=function(n,i,a,o,s,u){var f={rank:u,borderType:i,width:0,height:0},l=s[i][u-1],c=(0,r.addDummyNode)(n,"border",f,a);s[i][u]=c,n.setParent(c,o),l&&n.setEdge(l,c,{weight:1})};return wh.default=e,wh}var Eh={},c_;function $Y(){if(c_)return Eh;c_=1,Object.defineProperty(Eh,"__esModule",{value:!0});var r=function(u){var f,l=(f=u.graph().rankdir)===null||f===void 0?void 0:f.toLowerCase();(l==="lr"||l==="rl")&&t(u)},e=function(u){var f,l=(f=u.graph().rankdir)===null||f===void 0?void 0:f.toLowerCase();(l==="bt"||l==="rl")&&i(u),(l==="lr"||l==="rl")&&(o(u),t(u))},t=function(u){u.nodes().forEach(function(f){n(u.node(f))}),u.edges().forEach(function(f){n(u.edge(f))})},n=function(u){var f=u.width;u.width=u.height,u.height=f},i=function(u){u.nodes().forEach(function(f){a(u.node(f))}),u.edges().forEach(function(f){var l,c=u.edge(f);(l=c.points)===null||l===void 0||l.forEach(function(h){return a(h)}),c.hasOwnProperty("y")&&a(c)})},a=function(u){u!=null&&u.y&&(u.y=-u.y)},o=function(u){u.nodes().forEach(function(f){s(u.node(f))}),u.edges().forEach(function(f){var l,c=u.edge(f);(l=c.points)===null||l===void 0||l.forEach(function(h){return s(h)}),c.hasOwnProperty("x")&&s(c)})},s=function(u){var f=u.x;u.x=u.y,u.y=f};return Eh.default={adjust:r,undo:e},Eh}var vu={},_h={};function XL(r){return[parseInt(r.substr(1,2),16),parseInt(r.substr(3,2),16),parseInt(r.substr(5,2),16)]}function Rg(r){var e=Math.round(r).toString(16);return e.length===1?"0"+e:e}function YL(r){return"#"+Rg(r[0])+Rg(r[1])+Rg(r[2])}var jn=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},Vd=function(r,e){return jn(r)?r.indexOf(e)>-1:!1},WL=function(r,e){if(!jn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},XY=function(r,e){return e===void 0&&(e=[]),WL(r,function(t){return!Vd(e,t)})};const ei=function(r){return typeof r=="function"};var To=function(r){return r==null},YY={}.toString,ya=function(r,e){return YY.call(r)==="[object "+e+"]"};const tn=function(r){return Array.isArray?Array.isArray(r):ya(r,"Array")},Nv=function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"};function Yu(r,e){if(r){var t;if(tn(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(Nv(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var qL=Object.keys?function(r){return Object.keys(r)}:function(r){var e=[];return Yu(r,function(t,n){ei(r)&&n==="prototype"||e.push(n)}),e};function VL(r,e){var t=qL(e),n=t.length;if(To(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 Hd=function(r){return typeof r=="object"&&r!==null},Wu=function(r){if(!Hd(r)||!ya(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 WY(r,e){if(!tn(r))return null;var t;if(ei(e)&&(t=e),Wu(e)&&(t=function(i){return VL(i,e)}),t){for(var n=0;n<r.length;n+=1)if(t(r[n]))return r[n]}return null}function qY(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 VY=function(r,e){for(var t=null,n=0;n<r.length;n++){var i=r[n],a=i[e];if(!To(a)){tn(a)?t=a[0]:t=a;break}}return t},HY=function(r){if(!tn(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e},HL=function(r,e){if(e===void 0&&(e=[]),!tn(r))e.push(r);else for(var t=0;t<r.length;t+=1)HL(r[t],e);return e};const ZL=function(r){if(tn(r))return r.reduce(function(e,t){return Math.max(e,t)},r[0])},KL=function(r){if(tn(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])};var ZY=function(r){var e=r.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(tn(r[0])){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);e=t}var i=ZL(e),a=KL(e);return{min:a,max:i}},QL=Array.prototype,KY=QL.splice,QY=QL.indexOf,JY=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=QY.call(r,i))>-1;)KY.call(r,a,1);return r},eW=Array.prototype.splice,JL=function(e,t){if(!jn(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,eW.call(e,o,1))}return e},eN=function(r,e,t){if(!tn(r)&&!Wu(r))return r;var n=t;return Yu(r,function(i,a){n=e(n,i,a)}),n},tW=function(r,e){var t=[];if(!jn(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 JL(r,i),t};const Co=function(r){return ya(r,"String")};function rW(r,e){var t;if(ei(e))t=function(i,a){return e(i)-e(a)};else{var n=[];Co(e)?n.push(e):tn(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 tN(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 nW=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return tN([].concat.apply([],r))};const iW=function(r,e){for(var t=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[e];if(!To(o)){tn(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 aW(r){if(jn(r))return r[0]}function oW(r){if(jn(r)){var e=r;return e[e.length-1]}}function sW(r,e){return tn(r)||Co(r)?r[0]===e:!1}function uW(r,e){return tn(r)||Co(r)?r[r.length-1]===e:!1}var fW=function(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0},lW=function(r,e){for(var t=0;t<r.length;t++)if(e(r[t],t))return!0;return!1},cW=Object.prototype.hasOwnProperty;function rN(r,e){if(!e||!tn(r))return{};for(var t={},n=ei(e)?e:function(s){return s[e]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),cW.call(t,i)?t[i].push(o):t[i]=[o]}return t}function nN(r,e){if(!e)return{0:r};if(!ei(e)){var t=tn(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 rN(r,e)}const hW=function(r,e){if(!e)return[r];var t=nN(r,e),n=[];for(var i in t)n.push(t[i]);return n};function dW(r,e){return r["_wrap_"+e]}function vW(r,e){if(r["_wrap_"+e])return r["_wrap_"+e];var t=function(n){r[e](n)};return r["_wrap_"+e]=t,t}var h_={};function pW(r){var e=h_[r];if(!e){for(var t=r.toString(16),n=t.length;n<6;n++)t="0"+t;e="#"+t,h_[r]=e}return e}function gW(r){var e=0,t=0,n=0,i=0;return tn(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 yW=function(r,e,t){return r<e?e:r>t?t:r},mW=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))},Xa=function(r){return ya(r,"Number")},bW=function(r){return Xa(r)&&r%1!==0},xW=function(r){return Xa(r)&&r%2===0},wW=Number.isInteger?Number.isInteger:function(r){return Xa(r)&&r%1===0},EW=function(r){return Xa(r)&&r<0},_W=1e-5;function SW(r,e,t){return t===void 0&&(t=_W),Math.abs(r-e)<t}var MW=function(r){return Xa(r)&&r%2!==0},CW=function(r){return Xa(r)&&r>0};const AW=function(r,e){if(tn(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=ei(e)?e(a):a[e];o>n&&(t=a,n=o)}return t}},TW=function(r,e){if(tn(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],o=ei(e)?e(a):a[e];o<n&&(t=a,n=o)}return t}};var IW=function(r,e){return(r%e+e)%e},kW=180/Math.PI,LW=function(r){return kW*r};const NW=parseInt;var OW=Math.PI/180,DW=function(r){return OW*r};const d_=function(r,e){return r.hasOwnProperty(e)};var iN=Object.values?function(r){return Object.values(r)}:function(r){var e=[];return Yu(r,function(t,n){ei(r)&&n==="prototype"||e.push(t)}),e};const PW=function(r,e){return Vd(iN(r),e)},tc=function(r){return To(r)?"":r.toString()};var RW=function(r){return tc(r).toLowerCase()},BW=function(r){var e=tc(r);return e.charAt(0).toLowerCase()+e.substring(1)};function FW(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 GW=function(r){return tc(r).toUpperCase()},zW=function(r){var e=tc(r);return e.charAt(0).toUpperCase()+e.substring(1)},jW={}.toString,aN=function(r){return jW.call(r).replace(/^\[object /,"").replace(/]$/,"")},UW=function(r){return ya(r,"Arguments")},$W=function(r){return ya(r,"Boolean")},XW=function(r){return ya(r,"Date")},YW=function(r){return ya(r,"Error")};function WW(r){return Xa(r)&&isFinite(r)}var qW=function(r){return r===null},VW=Object.prototype,oN=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||VW;return r===t},HW=function(r){return ya(r,"RegExp")},ZW=function(r){return r===void 0},KW=function(r){return r instanceof Element||r instanceof Document};function QW(r){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)};return e(r)}function JW(r){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(r)}function Bg(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function Pu(r,e,t,n){return e&&Bg(r,e),t&&Bg(r,t),n&&Bg(r,n),r}var eq=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];ei(i)&&(i=i.prototype),Pu(t.prototype,i)}},ky=function(r){if(typeof r!="object"||r===null)return r;var e;if(tn(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=ky(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=ky(r[i]):e[i]=r[i]}return e};function tq(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 rq(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)}}}const sN=function(r,e,t){if(t===void 0&&(t=128),!ei(r))throw new TypeError("Expected a function");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],s=n.cache;if(s.has(o))return s.get(o);var u=r.apply(this,i);return s.set(o,u),u};return n.cache=rq(t),n};var nq=5;function iq(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 uN(r,e,t,n){t=t||0,n=n||nq;for(var i in e)if(iq(e,i)){var a=e[i];a!==null&&Wu(a)?(Wu(r[i])||(r[i]={}),t<n?uN(r[i],a,t+1,n):r[i]=e[i]):tn(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var aq=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)uN(r,e[n]);return r},oq=function(r,e,t,n){ei(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=Pu(a,r.prototype),r.superclass=i(e.prototype,e),Pu(a,t),Pu(r,n),r},sq=function(r,e){if(!jn(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},uq=Object.prototype.hasOwnProperty;function fq(r){if(To(r))return!0;if(jn(r))return!r.length;var e=aN(r);if(e==="Map"||e==="Set")return!r.size;if(oN(r))return!Object.keys(r).length;for(var t in r)if(uq.call(r,t))return!1;return!0}var Zd=function(r,e){if(r===e)return!0;if(!r||!e||Co(r)||Co(e))return!1;if(jn(r)||jn(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=Zd(r[n],e[n]),!!t);n++);return t}if(Hd(r)||Hd(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=Zd(r[i[n]],e[i[n]]),!!t);n++);return t}return!1};const lq=function(r,e,t){return ei(t)?!!t(r,e):Zd(r,e)};var cq=function(r,e){if(!jn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];t.push(e(i,n))}return t},hq=function(r){return r};const dq=function(r,e){e===void 0&&(e=hq);var t={};return Nv(r)&&!To(r)&&Object.keys(r).forEach(function(n){t[n]=e(r[n],n)}),t},vq=function(r,e,t){for(var n=0,i=Co(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r},pq=function(r,e,t){var n=r,i=Co(e)?e.split("."):e;return i.forEach(function(a,o){o<i.length-1?(Nv(n[a])||(n[a]=Xa(i[o+1])?[]:{}),n=n[a]):n[a]=t}),r};var gq=Object.prototype.hasOwnProperty;const yq=function(r,e){if(r===null||!Wu(r))return{};var t={};return Yu(e,function(n){gq.call(r,n)&&(t[n]=r[n])}),t},mq=function(r,e){return eN(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})},bq=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},xq=function(r){return jn(r)?Array.prototype.slice.call(r):[]};var Sh={};const wq=function(r){return r=r||"g",Sh[r]?Sh[r]+=1:Sh[r]=1,r+Sh[r]},Eq=function(){},_q=function(r){return r};function Sq(r){return To(r)?0:jn(r)?r.length:Object.keys(r).length}var Mq=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}(),Cq=/rgba?\(([\s.,0-9]+)\)/;function Aq(){var r=document.createElement("i");return r.title="Web Colour Picker",r.style.display="none",document.body.appendChild(r),r}var Mh;function Tq(r){if(r[0]==="#"&&r.length===7)return r;Mh||(Mh=Aq()),Mh.style.color=r;var e=document.defaultView.getComputedStyle(Mh,"").getPropertyValue("color"),t=Cq.exec(e),n=t[1].split(/\s*,\s*/).map(function(i){return Number(i)});return e=YL(n),e}var fN=sN(Tq,function(r){return r},256);function Fg(r,e,t,n){return r[n]+(e[n]-r[n])*t}function Iq(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 YL([Fg(o,s,a,0),Fg(o,s,a,1),Fg(o,s,a,2)])}function kq(r){var e=typeof r=="string"?r.split("-"):r,t=e.map(function(n){return XL(n.indexOf("#")===-1?fN(n):n)});return function(n){return Iq(t,n)}}var Lq=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,Nq=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,Oq=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function Dq(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)}function Pq(r){if(Dq(r)){var e,t=void 0;if(r[0]==="l"){var n=Lq.exec(r),i=+n[1]+90;t=n[2],e="linear-gradient("+i+"deg, "}else if(r[0]==="r"){e="radial-gradient(";var n=Nq.exec(r);t=n[4]}var a=t.match(Oq);return a.forEach(function(o,s){var u=o.split(":");e+=u[1]+" "+Number(u[0])*100+"%",s!==a.length-1&&(e+=", ")}),e+=")",e}return r}function Rq(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return pm(n,t),pa(r,n,e)}function Bq(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return gm(n,t),pa(r,n,e)}function Fq(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return ym(n,t),pa(r,n,e)}function Gq(r,e,t){return pa(r,t,e)}function zq(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":Rq(t,t,[a[1],a[2]]);break;case"s":Fq(t,t,[a[1],a[2]]);break;case"r":Bq(t,t,a[1]);break;case"m":Gq(t,t,a[1]);break}}return t}function lN(r,e){return r[0]*e[1]-e[0]*r[1]}function jq(r,e,t){var n=jT(r,e),i=lN(r,e)>=0;return t?i?Math.PI*2-n:n:i?n:Math.PI*2-n}function Uq(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 $q(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 Xq(r,e){return e===void 0&&(e="off"),$q(r,e).map(function(t){return t[0]+t.slice(1).join(" ")}).join("")}var cN={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function Yq(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 bl={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function hN(r){return Array.isArray(r)&&r.every(function(e){var t=e[0].toLowerCase();return bl[t]===e.length-1&&"achlmqstvz".includes(t)})}function dN(r){return hN(r)&&r.every(function(e){var t=e[0];return t===t.toUpperCase()})}function vN(r){return dN(r)&&r.every(function(e){var t=e[0];return"ACLMQZ".includes(t)})}function v_(r){for(var e=r.pathValue[r.segmentStart],t=e.toLowerCase(),n=r.data;n.length>=bl[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,bl[t]))),!!bl[t]););}function Wq(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 "'+t[e]+'", expecting 0 or 1 at index '+e}function qq(r){return r>=48&&r<=57||r===43||r===45||r===46}function pu(r){return r>=48&&r<=57}function Vq(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 "+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 "+i+', "'+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 "+n+', "'+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 "+i+', "'+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 "+i+', "'+t[i]+'" invalid integer exponent';return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function Hq(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 vd(r){for(var e=r.pathValue,t=r.max;r.index<t&&Hq(e.charCodeAt(r.index));)r.index+=1}function Zq(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 Kq(r){return(r|32)===97}function Qq(r){var e=r.max,t=r.pathValue,n=r.index,i=t.charCodeAt(n),a=bl[t[n].toLowerCase()];if(r.segmentStart=n,!Zq(i)){r.err='[path-util]: Invalid path value "'+t[n]+'" is not a path command';return}if(r.index+=1,vd(r),r.data=[],!a){v_(r);return}for(;;){for(var o=a;o>0;o-=1){if(Kq(i)&&(o===3||o===4)?Wq(r):Vq(r),r.err.length)return;r.data.push(r.param),vd(r),r.index<e&&t.charCodeAt(r.index)===44&&(r.index+=1,vd(r))}if(r.index>=r.max||!qq(t.charCodeAt(r.index)))break}v_(r)}var Jq=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 Ov(r){if(hN(r))return[].concat(r);var e=new Jq(r);for(vd(e);e.index<e.max&&!e.err.length;)Qq(e);return e.err?e.err:e.segments}function pN(r){if(dN(r))return[].concat(r);var e=Ov(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 eV(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 Dv(r){if(vN(r))return[].concat(r);for(var e=pN(r),t=z({},cN),n=0;n<e.length;n+=1){e[n]=eV(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 tV(r){return vN(r)&&r.every(function(e){var t=e[0];return"MC".includes(t)})}function Ch(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 h1(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=[],x,b,w,E,S;if(f)b=f[0],w=f[1],E=f[2],S=f[3];else{x=Ch(l,c,-y),l=x.x,c=x.y,x=Ch(v,p,-y),v=x.x,p=x.y;var _=(l-v)/2,C=(c-p)/2,M=_*_/(h*h)+C*C/(d*d);M>1&&(M=Math.sqrt(M),h*=M,d*=M);var A=h*h,T=d*d,I=(a===o?-1:1)*Math.sqrt(Math.abs((A*T-A*C*C-T*_*_)/(A*C*C+T*_*_)));E=I*h*C/d+(l+v)/2,S=I*-d*_/h+(c+p)/2,b=Math.asin(((c-S)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),w=Math.asin(((p-S)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),b=l<E?Math.PI-b:b,w=v<E?Math.PI-w:w,b<0&&(b=Math.PI*2+b),w<0&&(w=Math.PI*2+w),o&&b>w&&(b-=Math.PI*2),!o&&w>b&&(w-=Math.PI*2)}var L=w-b;if(Math.abs(L)>g){var N=w,O=v,B=p;w=b+g*(o&&w>b?1:-1),v=E+h*Math.cos(w),p=S+d*Math.sin(w),m=h1(v,p,h,d,i,0,o,O,B,[w,N,E,S])}L=w-b;var W=Math.cos(b),D=Math.sin(b),P=Math.cos(w),R=Math.sin(w),X=Math.tan(L/4),Y=4/3*h*X,ee=4/3*d*X,U=[l,c],Z=[l+Y*D,c-ee*W],K=[v+Y*R,p-ee*P],se=[v,p];if(Z[0]=2*U[0]-Z[0],Z[1]=2*U[1]-Z[1],f)return Z.concat(K,se,m);m=Z.concat(K,se,m);for(var re=[],J=0,me=m.length;J<me;J+=1)re[J]=J%2?Ch(m[J-1],m[J],y).y:Ch(m[J],m[J+1],y).x;return re}function rV(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 yo(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 p_=function(r,e,t,n){var i=.5,a=yo([r,e],[t,n],i);return Qn(Qn([],a,!0),[t,n,t,n],!1)};function nV(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(h1(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(rV(o[0],o[1],o[2],o[3],o[4],o[5]));case"L":return["C"].concat(p_(s,u,i,a));case"Z":return s===f&&u===l?["C",s,u,f,l,f,l]:["C"].concat(p_(s,u,f,l))}return r}function gN(r,e){if(e===void 0&&(e=!1),tV(r)){var t=[].concat(r);return e?[t,[]]:t}for(var n=Dv(r),i=z({},cN),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=nV(n[c],i);n[c]=h,Yq(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 iV(r){return Ov(r)}function aV(r){return r.map(function(e){return Array.isArray(e)?[].concat(e):e})}function oV(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 nf(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}function Ly(r,e,t,n,i){var a=nf([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=yo([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 g_(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 sV(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 Ly(r,e,s,u,f).point;var x=(r-s)/2,b=(e-u)/2,w={x:h(m)*x+c(m)*b,y:-c(m)*x+h(m)*b},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 S=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),_=Math.pow(p,2)*Math.pow(w.y,2)+Math.pow(g,2)*Math.pow(w.x,2),C=S/_;C=C<0?0:C;var M=(a!==o?1:-1)*d(C),A={x:M*(p*w.y/g),y:M*(-(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},I={x:(w.x-A.x)/p,y:(w.y-A.y)/g},L=g_({x:1,y:0},I),N={x:(-w.x-A.x)/p,y:(-w.y-A.y)/g},O=g_(I,N);!o&&O>0?O-=2*v:o&&O<0&&(O+=2*v),O%=2*v;var B=L+O*f,W=p*h(B),D=g*c(B),P={x:h(m)*W-c(m)*D+T.x,y:c(m)*W+h(m)*D+T.y};return P}function uV(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",x=r,b=e,w=0,E=[x,b,w],S=[x,b],_=0,C={x:0,y:0},M=[{x,y:b}];m&&f<=0&&(C={x,y:b});for(var A=0;A<=y;A+=1){if(_=A/y,c=sV(r,e,t,n,i,a,o,s,u,_),x=c.x,b=c.y,d&&M.push({x,y:b}),p&&(w+=nf(S,[x,b])),S=[x,b],m&&w>=f&&f>E[2]){var T=(w-f)/(w-E[2]);C={x:S[0]*(1-T)+E[0]*T,y:S[1]*(1-T)+E[1]*T}}E=[x,b,w]}return m&&f>=w&&(C={x:s,y:u}),{length:w,point:C,min:{x:Math.min.apply(null,M.map(function(I){return I.x})),y:Math.min.apply(null,M.map(function(I){return I.y}))},max:{x:Math.max.apply(null,M.map(function(I){return I.x})),y:Math.max.apply(null,M.map(function(I){return I.y}))}}}function fV(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 yN(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,x=e,b=0,w=[m,x,b],E=[m,x],S=0,_={x:0,y:0},C=[{x:m,y:x}];y&&u<=0&&(_={x:m,y:x});for(var M=0;M<=g;M+=1){if(S=M/g,l=fV(r,e,t,n,i,a,o,s,S),m=l.x,x=l.y,h&&C.push({x:m,y:x}),v&&(b+=nf(E,[m,x])),E=[m,x],y&&b>=u&&u>w[2]){var A=(b-u)/(b-w[2]);_={x:E[0]*(1-A)+w[0]*A,y:E[1]*(1-A)+w[1]*A}}w=[m,x,b]}return y&&u>=b&&(_={x:o,y:s}),{length:b,point:_,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 lV(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 cV(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,x=[g,y,m],b=[g,y],w=0,E={x:0,y:0},S=[{x:g,y}];p&&o<=0&&(E={x:g,y});for(var _=0;_<=v;_+=1){if(w=_/v,u=lV(r,e,t,n,i,a,w),g=u.x,y=u.y,l&&S.push({x:g,y}),h&&(m+=nf(b,[g,y])),b=[g,y],p&&m>=o&&o>x[2]){var C=(m-o)/(m-x[2]);E={x:b[0]*(1-C)+x[0]*C,y:b[1]*(1-C)+x[1]*C}}x=[g,y,m]}return p&&o>=m&&(E={x:i,y:a}),{length:m,point:E,min:{x:Math.min.apply(null,S.map(function(M){return M.x})),y:Math.min.apply(null,S.map(function(M){return M.y}))},max:{x:Math.max.apply(null,S.map(function(M){return M.x})),y:Math.max.apply(null,S.map(function(M){return M.y}))}}}function Pv(r,e,t){for(var n,i,a,o,s,u,f=Dv(r),l=typeof e=="number",c,h=[],d,v=0,p=0,g=0,y=0,m,x=[],b=[],w=0,E={x:0,y:0},S=E,_=E,C=E,M=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},S=E,w=0,l&&e<.001&&(C=E)):d==="L"?(n=Ly(h[0],h[1],h[2],h[3],(e||0)-M),w=n.length,E=n.min,S=n.max,_=n.point):d==="A"?(i=uV(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],(e||0)-M,t||{}),w=i.length,E=i.min,S=i.max,_=i.point):d==="C"?(a=yN(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],(e||0)-M,t||{}),w=a.length,E=a.min,S=a.max,_=a.point):d==="Q"?(o=cV(h[0],h[1],h[2],h[3],h[4],h[5],(e||0)-M,t||{}),w=o.length,E=o.min,S=o.max,_=o.point):d==="Z"&&(h=[v,p,g,y],s=Ly(h[0],h[1],h[2],h[3],(e||0)-M),w=s.length,E=s.min,S=s.max,_=s.point),l&&M<e&&M+w>=e&&(C=_),b.push(S),x.push(E),M+=w,u=d!=="Z"?m.slice(-2):[g,y],v=u[0],p=u[1];return l&&e>=M&&(C={x:v,y:p}),{length:M,point:C,min:{x:Math.min.apply(null,x.map(function(I){return I.x})),y:Math.min.apply(null,x.map(function(I){return I.y}))},max:{x:Math.max.apply(null,b.map(function(I){return I.x})),y:Math.max.apply(null,b.map(function(I){return I.y}))}}}function hV(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=Pv(r,void 0,z(z({},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 xl(r,e){return Pv(r,void 0,z(z({},e),{bbox:!1,length:!0})).length}function dV(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=Pv(r,void 0,z(z({},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 vV(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 pV(r,e){var t=r.length-1,n=[],i=0,a=0,o=vV(r);return o.forEach(function(s,u){r.slice(1).forEach(function(f,l){a+=nf(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 gV(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 mN(r){var e=0,t=0,n=0;return gN(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=gV(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 yV(r){return mN(r)>=0}function pd(r,e,t){return Pv(r,e,z(z({},t),{bbox:!1,length:!0})).point}function mV(r,e){var t=Ov(r);if(typeof t=="string")throw TypeError(t);var n=t.slice(),i=xl(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=xl(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=xl(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 bV(r,e){for(var t=Ov(r),n=Dv(t),i=xl(t),a=function(w){var E=w.x-e.x,S=w.y-e.y;return E*E+S*S},o=8,s,u=0,f,l=0,c=1/0,h=0;h<=i;h+=o)s=pd(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=pd(n,p),y=a(d),g=l+o,v=pd(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 x=mV(t,l),b=Math.sqrt(c);return{closest:f,distance:b,segment:x}}function xV(r,e){var t=bV(r,e).distance;return Math.abs(t)<.001}function wV(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=yo(t,n,e),s=yo(n,i,e),u=yo(i,a,e),f=yo(o,s,e),l=yo(s,u,e),c=yo(f,l,e);return[["C"].concat(o,f,c),["C"].concat(l,u,a)]}function y_(r){return r.map(function(e,t,n){var i=t&&n[t-1].slice(-2).concat(e.slice(1)),a=t?yN(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?wV(i):[e,e]:o=[e],{s:e,ss:o,l:a}})}function bN(r,e,t){var n=y_(r),i=y_(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,x){return v=x&&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:bN(p[0],p[1],c)}var EV=1e-6;function Gg(r){return Math.abs(r)<EV?0:r<0?-1:1}function _V(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 Ny(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(_V(o,s,[e,t]))return!0;Gg(o[1]-t)>0!=Gg(s[1]-t)>0&&Gg(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}var m_=function(r,e,t){return r>=e&&r<=t};function SV(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;m_(d,0,1)&&m_(v,0,1)&&(h={x:r.x+d*o.x,y:r.y+d*o.y})}return h}function b_(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 MV(r,e){var t=!1;return r.forEach(function(n){if(SV(n.from,n.to,e.from,e.to))return t=!0,!1}),t}function x_(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 CV(r,e){return!(e.minX>r.maxX||e.maxX<r.minX||e.minY>r.maxY||e.maxY<r.minY)}function AV(r,e){if(r.length<2||e.length<2)return!1;var t=x_(r),n=x_(e);if(!CV(t,n))return!1;var i=!1;if(e.forEach(function(u){if(Ny(r,u[0],u[1]))return i=!0,!1}),i||(r.forEach(function(u){if(Ny(e,u[0],u[1]))return i=!0,!1}),i))return!0;var a=b_(r),o=b_(e),s=!1;return o.forEach(function(u){if(MV(a,u))return s=!0,!1}),s}function TV(r){var e=document.createElement("div");e.innerHTML=r;var t=e.childNodes[0];return t&&e.contains(t)&&e.removeChild(t),t}function IV(r,e){if(r)return Object.keys(e).forEach(function(t){r.style[t]=e[t]}),r}const kV=Object.freeze(Object.defineProperty({__proto__:null,Cache:Mq,angleTo:jq,arcToCubic:h1,assign:Pu,augment:eq,clamp:yW,clearAnimationFrame:JW,clone:ky,clonePath:aV,contains:Vd,createDOM:TV,debounce:tq,deepMix:aq,difference:XY,direction:lN,distanceSquareRoot:nf,each:Yu,endsWith:uW,equalizeSegments:bN,every:fW,extend:oq,filter:WL,find:WY,findIndex:qY,firstValue:VY,fixedBase:mW,flatten:HY,flattenDeep:HL,forIn:Yu,get:vq,getDrawDirection:yV,getPathArea:mN,getPathBBox:hV,getPathBBoxTotalLength:dV,getPointAtLength:pd,getRange:ZY,getRotatedCurve:pV,getTotalLength:xl,getType:aN,getWrapBehavior:dW,gradient:kq,group:hW,groupBy:rN,groupToMap:nN,has:d_,hasKey:d_,hasValue:PW,head:aW,identity:_q,includes:Vd,indexOf:sq,isArguments:UW,isArray:tn,isArrayLike:jn,isBoolean:$W,isDate:XW,isDecimal:bW,isElement:KW,isEmpty:fq,isEqual:Zd,isEqualWith:lq,isError:YW,isEven:xW,isFinite:WW,isFunction:ei,isInteger:wW,isMatch:VL,isNegative:EW,isNil:To,isNull:qW,isNumber:Xa,isNumberEqual:SW,isObject:Nv,isObjectLike:Hd,isOdd:MW,isPlainObject:Wu,isPointInPolygon:Ny,isPointInStroke:xV,isPolygonsIntersect:AV,isPositive:CW,isPrototype:oN,isRegExp:HW,isString:Co,isType:ya,isUndefined:ZW,keys:qL,last:oW,lowerCase:RW,lowerFirst:BW,map:cq,mapValues:dq,max:ZL,maxBy:AW,memoize:sN,min:KL,minBy:TW,mix:Pu,mod:IW,modifyCSS:IV,noop:Eq,normalizePath:Dv,number2color:pW,omit:mq,parseRadius:gW,path2Absolute:pN,path2Array:iV,path2Curve:gN,path2String:Xq,pick:yq,pull:JY,pullAt:JL,reduce:eN,remove:tW,requestAnimationFrame:QW,reverseCurve:oV,rgb2arr:XL,set:pq,size:Sq,some:lW,sortBy:rW,startsWith:sW,substitute:FW,throttle:bq,toArray:xq,toCSSGradient:Pq,toDegree:LW,toInteger:NW,toRGB:fN,toRadian:DW,toString:tc,transform:zq,union:nW,uniq:tN,uniqueId:wq,upperCase:GW,upperFirst:zW,values:iN,valuesOfKey:iW,vertical:Uq,wrapBehavior:vW},Symbol.toStringTag,{value:"Module"})),xN=da(kV);var w_;function LV(){if(w_)return _h;w_=1,Object.defineProperty(_h,"__esModule",{value:!0});var r=xN,e=function(t){for(var n={},i=t.nodes().filter(function(d){var v;return!(!((v=t.children(d))===null||v===void 0)&&v.length)}),a=i.map(function(d){return t.node(d).rank}),o=(0,r.max)(a),s=[],u=0;u<o+1;u++)s.push([]);var f=function(d){var v;if(!n.hasOwnProperty(d)){n[d]=!0;var p=t.node(d);isNaN(p.rank)||s[p.rank].push(d),(v=t.successors(d))===null||v===void 0||v.forEach(function(g){return f(g)})}},l=i.sort(function(d,v){return t.node(d).rank-t.node(v).rank}),c=l.filter(function(d){return t.node(d).fixorder!==void 0}),h=c.sort(function(d,v){return t.node(d).fixorder-t.node(v).fixorder});return h==null||h.forEach(function(d){isNaN(t.node(d).rank)||s[t.node(d).rank].push(d),n[d]=!0}),l==null||l.forEach(f),s};return _h.default=e,_h}var Ah={},E_;function NV(){if(E_)return Ah;E_=1,Object.defineProperty(Ah,"__esModule",{value:!0});var r=gi(),e=function(n,i,a){for(var o=(0,r.zipObject)(a,a.map(function(d,v){return v})),s=i.map(function(d){var v,p=(v=n.outEdges(d))===null||v===void 0?void 0:v.map(function(g){return{pos:o[g.w]||0,weight:n.edge(g).weight}});return p==null?void 0:p.sort(function(g,y){return g.pos-y.pos})}),u=s.flat().filter(function(d){return d!==void 0}),f=1;f<a.length;)f<<=1;var l=2*f-1;f-=1;var c=Array(l).fill(0,0,l),h=0;return u==null||u.forEach(function(d){if(d){var v=d.pos+f;c[v]+=d.weight;for(var p=0;v>0;)v%2&&(p+=c[v+1]),v=v-1>>1,c[v]+=d.weight;h+=d.weight*p}}),h},t=function(n,i){for(var a=0,o=1;o<(i==null?void 0:i.length);o+=1)a+=e(n,i[o-1],i[o]);return a};return Ah.default=t,Ah}var Th={},__;function OV(){if(__)return Th;__=1,Object.defineProperty(Th,"__esModule",{value:!0});var r=rf(),e=function(n,i,a){var o=t(n),s=new r.Graph({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(u){return n.node(u)});return n.nodes().forEach(function(u){var f,l=n.node(u),c=n.parent(u);(l.rank===i||l.minRank<=i&&i<=l.maxRank)&&(s.setNode(u),s.setParent(u,c||o),(f=n[a](u))===null||f===void 0||f.forEach(function(h){var d=h.v===u?h.w:h.v,v=s.edgeFromArgs(d,u),p=v!==void 0?v.weight:0;s.setEdge(d,u,{weight:n.edge(h).weight+p})}),l.hasOwnProperty("minRank")&&s.setNode(u,{borderLeft:l.borderLeft[i],borderRight:l.borderRight[i]}))}),s},t=function(n){for(var i;n.hasNode(i="_root".concat(Math.random())););return i};return Th.default=e,Th}var Ih={},S_;function DV(){if(S_)return Ih;S_=1,Object.defineProperty(Ih,"__esModule",{value:!0});var r=function(e,t,n){var i={},a;n==null||n.forEach(function(o){for(var s=e.parent(o),u,f;s;){if(u=e.parent(s),u?(f=i[u],i[u]=s):(f=a,a=s),f&&f!==s){t.setEdge(f,s);return}s=u}})};return Ih.default=r,Ih}var gu={},kh={},M_;function PV(){if(M_)return kh;M_=1,Object.defineProperty(kh,"__esModule",{value:!0});var r=function(e,t){return t.map(function(n){var i=e.inEdges(n);if(!(i!=null&&i.length))return{v:n};{var a={sum:0,weight:0};return i==null||i.forEach(function(o){var s=e.edge(o),u=e.node(o.v);a.sum+=s.weight*u.order,a.weight+=s.weight}),{v:n,barycenter:a.sum/a.weight,weight:a.weight}}})};return kh.default=r,kh}var Lh={},C_;function RV(){if(C_)return Lh;C_=1,Object.defineProperty(Lh,"__esModule",{value:!0});var r=function(n,i){var a,o,s,u={};n==null||n.forEach(function(l,c){u[l.v]={i:c,indegree:0,in:[],out:[],vs:[l.v]};var h=u[l.v];l.barycenter!==void 0&&(h.barycenter=l.barycenter,h.weight=l.weight)}),(a=i.edges())===null||a===void 0||a.forEach(function(l){var c=u[l.v],h=u[l.w];c!==void 0&&h!==void 0&&(h.indegree++,c.out.push(u[l.w]))});var f=(s=(o=Object.values(u)).filter)===null||s===void 0?void 0:s.call(o,function(l){return!l.indegree});return e(f)},e=function(n){for(var i,a,o=[],s=function(h){return function(d){d.merged||(d.barycenter===void 0||h.barycenter===void 0||d.barycenter>=h.barycenter)&&t(h,d)}},u=function(h){return function(d){d.in.push(h),--d.indegree===0&&n.push(d)}},f=function(){var h=n.pop();o.push(h),(i=h.in.reverse())===null||i===void 0||i.forEach(function(d){return s(h)(d)}),(a=h.out)===null||a===void 0||a.forEach(function(d){return u(h)(d)})};n!=null&&n.length;)f();var l=o.filter(function(h){return!h.merged}),c=["vs","i","barycenter","weight"];return l.map(function(h){var d={};return c==null||c.forEach(function(v){h[v]!==void 0&&(d[v]=h[v])}),d})},t=function(n,i){var a,o=0,s=0;n.weight&&(o+=n.barycenter*n.weight,s+=n.weight),i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),n.vs=(a=i.vs)===null||a===void 0?void 0:a.concat(n.vs),n.barycenter=o/s,n.weight=s,n.i=Math.min(i.i,n.i),i.merged=!0};return Lh.default=r,Lh}var Nh={},A_;function BV(){if(A_)return Nh;A_=1,Object.defineProperty(Nh,"__esModule",{value:!0});var r=gi(),e=function(i,a,o,s){var u=(0,r.partition)(i,function(g){var y=g.hasOwnProperty("fixorder")&&!isNaN(g.fixorder);return s?!y&&g.hasOwnProperty("barycenter"):y||g.hasOwnProperty("barycenter")}),f=u.lhs,l=u.rhs.sort(function(g,y){return-g.i- -y.i}),c=[],h=0,d=0,v=0;f==null||f.sort(n(!!a,!!o)),v=t(c,l,v),f==null||f.forEach(function(g){var y;v+=(y=g.vs)===null||y===void 0?void 0:y.length,c.push(g.vs),h+=g.barycenter*g.weight,d+=g.weight,v=t(c,l,v)});var p={vs:c.flat()};return d&&(p.barycenter=h/d,p.weight=d),p},t=function(i,a,o){for(var s=o,u;a.length&&(u=a[a.length-1]).i<=s;)a.pop(),i==null||i.push(u.vs),s++;return s},n=function(i,a){return function(o,s){if(o.fixorder!==void 0&&s.fixorder!==void 0)return o.fixorder-s.fixorder;if(o.barycenter<s.barycenter)return-1;if(o.barycenter>s.barycenter)return 1;if(a&&o.order!==void 0&&s.order!==void 0){if(o.order<s.order)return-1;if(o.order>s.order)return 1}return i?s.i-o.i:o.i-s.i}};return Nh.default=e,Nh}var T_;function FV(){if(T_)return gu;T_=1;var r=gu&&gu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(gu,"__esModule",{value:!0});var e=r(PV()),t=r(RV()),n=r(BV()),i=function(s,u,f,l,c,h){var d,v,p,g,y=s.children(u),m=s.node(u),x=m?m.borderLeft:void 0,b=m?m.borderRight:void 0,w={};x&&(y=y==null?void 0:y.filter(function(A){return A!==x&&A!==b}));var E=(0,e.default)(s,y||[]);E==null||E.forEach(function(A){var T;if(!((T=s.children(A.v))===null||T===void 0)&&T.length){var I=i(s,A.v,f,l,h);w[A.v]=I,I.hasOwnProperty("barycenter")&&o(A,I)}});var S=(0,t.default)(E,f);a(S,w),(d=S.filter(function(A){return A.vs.length>0}))===null||d===void 0||d.forEach(function(A){var T=s.node(A.vs[0]);T&&(A.fixorder=T.fixorder,A.order=T.order)});var _=(0,n.default)(S,l,c,h);if(x&&(_.vs=[x,_.vs,b].flat(),!((v=s.predecessors(x))===null||v===void 0)&&v.length)){var C=s.node(((p=s.predecessors(x))===null||p===void 0?void 0:p[0])||""),M=s.node(((g=s.predecessors(b))===null||g===void 0?void 0:g[0])||"");_.hasOwnProperty("barycenter")||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+C.order+M.order)/(_.weight+2),_.weight+=2}return _},a=function(s,u){s==null||s.forEach(function(f){var l,c=(l=f.vs)===null||l===void 0?void 0:l.map(function(h){return u[h]?u[h].vs:h});f.vs=c.flat()})},o=function(s,u){s.barycenter!==void 0?(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight):(s.barycenter=u.barycenter,s.weight=u.weight)};return gu.default=i,gu}var I_;function GV(){if(I_)return vu;I_=1;var r=vu&&vu.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(vu,"__esModule",{value:!0});var e=r(LV()),t=r(NV()),n=r(OV()),i=r(DV()),a=r(FV()),o=$r(),s=rf(),u=gi(),f=function(d,v){for(var p=(0,u.maxRank)(d),g=[],y=[],m=1;m<p+1;m++)g.push(m);for(var m=p-1;m>-1;m--)y.push(m);var x=l(d,g,"inEdges"),b=l(d,y,"outEdges"),w=(0,e.default)(d);h(d,w);for(var E=Number.POSITIVE_INFINITY,S,m=0,_=0;_<4;++m,++_){c(m%2?x:b,m%4>=2,!1,v),w=(0,u.buildLayerMatrix)(d);var C=(0,t.default)(d,w);C<E&&(_=0,S=(0,o.clone)(w),E=C)}w=(0,e.default)(d),h(d,w);for(var m=0,_=0;_<4;++m,++_){c(m%2?x:b,m%4>=2,!0,v),w=(0,u.buildLayerMatrix)(d);var C=(0,t.default)(d,w);C<E&&(_=0,S=(0,o.clone)(w),E=C)}h(d,S)},l=function(d,v,p){return v.map(function(g){return(0,n.default)(d,g,p)})},c=function(d,v,p,g){var y=new s.Graph;d==null||d.forEach(function(m){for(var x,b=m.graph().root,w=(0,a.default)(m,b,y,v,p,g),E=0;E<((x=w.vs)===null||x===void 0?void 0:x.length);E++){var S=m.node(w.vs[E]);S&&(S.order=E)}(0,i.default)(m,y,w.vs)})},h=function(d,v){v==null||v.forEach(function(p){p==null||p.forEach(function(g,y){d.node(g).order=y})})};return vu.default=f,vu}var yu={},Zf={},k_;function zV(){return k_||(k_=1,function(r){var e=Zf&&Zf.__extends||function(){var b=function(w,E){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,_){S.__proto__=_}||function(S,_){for(var C in _)Object.prototype.hasOwnProperty.call(_,C)&&(S[C]=_[C])},b(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");b(w,E);function S(){this.constructor=w}w.prototype=E===null?Object.create(E):(S.prototype=E.prototype,new S)}}();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=Lv,n=xN,i=gi(),a=function(b){e(w,b);function w(){return b!==null&&b.apply(this,arguments)||this}return w}(t.Graph),o=function(b,w){var E={},S=function(_,C){var M=0,A=0,T=_.length,I=C==null?void 0:C[(C==null?void 0:C.length)-1];return C==null||C.forEach(function(L,N){var O,B=(0,r.findOtherInnerSegmentNode)(b,L),W=B?b.node(B).order:T;(B||L===I)&&((O=C.slice(A,N+1))===null||O===void 0||O.forEach(function(D){var P;(P=b.predecessors(D))===null||P===void 0||P.forEach(function(R){var X,Y=b.node(R),ee=Y.order;(ee<M||W<ee)&&!(Y.dummy&&(!((X=b.node(D))===null||X===void 0)&&X.dummy))&&(0,r.addConflict)(E,R,D)})}),A=N+1,M=W)}),C};return w!=null&&w.length&&w.reduce(S),E};r.findType1Conflicts=o;var s=function(b,w){var E={};function S(A,T,I,L,N){for(var O,B,W,D=T;D<I;D++)W=A[D],!((O=b.node(W))===null||O===void 0)&&O.dummy&&((B=b.predecessors(W))===null||B===void 0||B.forEach(function(P){var R=b.node(P);R.dummy&&(R.order<L||R.order>N)&&(0,r.addConflict)(E,P,W)}))}function _(A){return JSON.stringify(A.slice(1))}function C(A,T){var I=_(A);T.get(I)||(S.apply(void 0,A),T.set(I,!0))}var M=function(A,T){var I=-1,L,N=0,O=new Map;return T==null||T.forEach(function(B,W){var D;if(((D=b.node(B))===null||D===void 0?void 0:D.dummy)==="border"){var P=b.predecessors(B)||[];P.length&&(L=b.node(P[0]).order,C([T,N,W,I,L],O),N=W,I=L)}C([T,N,T.length,L,A.length],O)}),T};return w!=null&&w.length&&w.reduce(M),E};r.findType2Conflicts=s;var u=function(b,w){var E,S;if(!((E=b.node(w))===null||E===void 0)&&E.dummy)return(S=b.predecessors(w))===null||S===void 0?void 0:S.find(function(_){return b.node(_).dummy})};r.findOtherInnerSegmentNode=u;var f=function(b,w,E){var S=w,_=E;if(S>_){var C=S;S=_,_=C}var M=b[S];M||(b[S]=M={}),M[_]=!0};r.addConflict=f;var l=function(b,w,E){var S=w,_=E;if(S>_){var C=w;S=_,_=C}return!!b[S]};r.hasConflict=l;var c=function(b,w,E,S){var _={},C={},M={};return w==null||w.forEach(function(A){A==null||A.forEach(function(T,I){_[T]=T,C[T]=T,M[T]=I})}),w==null||w.forEach(function(A){var T=-1;A==null||A.forEach(function(I){var L=S(I);if(L.length){L=L.sort(function(D,P){return M[D]-M[P]});for(var N=(L.length-1)/2,O=Math.floor(N),B=Math.ceil(N);O<=B;++O){var W=L[O];C[I]===I&&T<M[W]&&!(0,r.hasConflict)(E,I,W)&&(C[W]=I,C[I]=_[I]=_[W],T=M[W])}}})}),{root:_,align:C}};r.verticalAlignment=c;var h=function(b,w,E,S,_){var C,M={},A=(0,r.buildBlockGraph)(b,w,E,_),T=_?"borderLeft":"borderRight",I=function(O,B){for(var W=A.nodes(),D=W.pop(),P={};D;)P[D]?O(D):(P[D]=!0,W.push(D),W=W.concat(B(D))),D=W.pop()},L=function(O){M[O]=(A.inEdges(O)||[]).reduce(function(B,W){return Math.max(B,(M[W.v]||0)+A.edge(W))},0)},N=function(O){var B=(A.outEdges(O)||[]).reduce(function(D,P){return Math.min(D,(M[P.w]||0)-A.edge(P))},Number.POSITIVE_INFINITY),W=b.node(O);B!==Number.POSITIVE_INFINITY&&W.borderType!==T&&(M[O]=Math.max(M[O],B))};return I(L,A.predecessors.bind(A)),I(N,A.successors.bind(A)),(C=Object.values(S))===null||C===void 0||C.forEach(function(O){M[O]=M[E[O]]}),M};r.horizontalCompaction=h;var d=function(b,w,E,S){var _=new a,C=b.graph(),M=(0,r.sep)(C.nodesep,C.edgesep,S);return w==null||w.forEach(function(A){var T;A==null||A.forEach(function(I){var L=E[I];if(_.setNode(L),T){var N=E[T],O=_.edgeFromArgs(N,L);_.setEdge(N,L,Math.max(M(b,I,T),O||0))}T=I})}),_};r.buildBlockGraph=d;var v=function(b,w){return(0,i.minBy)(Object.values(w),function(E){var S,_=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return(S=Object.keys(E))===null||S===void 0||S.forEach(function(M){var A=E[M],T=(0,r.width)(b,M)/2;_=Math.max(A+T,_),C=Math.min(A-T,C)}),_-C})};r.findSmallestWidthAlignment=v;function p(b,w){var E=Object.values(w),S=(0,n.min)(E),_=(0,n.max)(E);["u","d"].forEach(function(C){["l","r"].forEach(function(M){var A=C+M,T=b[A],I;if(T!==w){var L=Object.values(T);I=M==="l"?S-(0,n.min)(L):_-(0,n.max)(L),I&&(b[A]={},Object.keys(T).forEach(function(N){b[A][N]=T[N]+I}))}})})}r.alignCoordinates=p;var g=function(b,w){var E={};return Object.keys(b.ul).forEach(function(S){if(w)E[S]=b[w.toLowerCase()][S];else{var _=Object.values(b).map(function(C){return C[S]});E[S]=(_[0]+_[1])/2}}),E};r.balance=g;var y=function(b){var w=(0,i.buildLayerMatrix)(b),E=Object.assign((0,r.findType1Conflicts)(b,w),(0,r.findType2Conflicts)(b,w)),S={},_;["u","d"].forEach(function(M){_=M==="u"?w:Object.values(w).reverse(),["l","r"].forEach(function(A){A==="r"&&(_=_.map(function(N){return Object.values(N).reverse()}));var T=(M==="u"?b.predecessors:b.successors).bind(b),I=(0,r.verticalAlignment)(b,_,E,T),L=(0,r.horizontalCompaction)(b,_,I.root,I.align,A==="r");A==="r"&&Object.keys(L).forEach(function(N){L[N]=-L[N]}),S[M+A]=L})});var C=(0,r.findSmallestWidthAlignment)(b,S);return p(S,C),(0,r.balance)(S,b.graph().align)};r.positionX=y;var m=function(b,w,E){return function(S,_,C){var M=S.node(_),A=S.node(C),T=0,I;if(T+=M.width/2,M.hasOwnProperty("labelpos"))switch((M.labelpos||"").toLowerCase()){case"l":I=-M.width/2;break;case"r":I=M.width/2;break}if(I&&(T+=E?I:-I),I=0,T+=(M.dummy?w:b)/2,T+=(A.dummy?w:b)/2,T+=A.width/2,A.labelpos)switch((A.labelpos||"").toLowerCase()){case"l":I=A.width/2;break;case"r":I=-A.width/2;break}return I&&(T+=E?I:-I),I=0,T}};r.sep=m;var x=function(b,w){return b.node(w).width||0};r.width=x}(Zf)),Zf}var L_;function jV(){if(L_)return yu;L_=1;var r=yu&&yu.__spreadArray||function(o,s,u){if(u||arguments.length===2)for(var f=0,l=s.length,c;f<l;f++)(c||!(f in s))&&(c||(c=Array.prototype.slice.call(s,0,f)),c[f]=s[f]);return o.concat(c||Array.prototype.slice.call(s))};Object.defineProperty(yu,"__esModule",{value:!0});var e=gi(),t=zV(),n=function(o){var s=(0,e.buildLayerMatrix)(o),u=o.graph().ranksep,f=0;s==null||s.forEach(function(l){var c=l.map(function(d){return o.node(d).height}),h=Math.max.apply(Math,r(r([],c,!1),[0],!1));l==null||l.forEach(function(d){o.node(d).y=f+h/2}),f+=h+u})},i=function(o){var s=(0,e.buildLayerMatrix)(o),u=Object.assign((0,t.findType1Conflicts)(o,s),(0,t.findType2Conflicts)(o,s)),f={},l=[];["u","d"].forEach(function(h){l=h==="u"?s:Object.values(s).reverse(),["l","r"].forEach(function(d){d==="r"&&(l=l.map(function(y){return Object.values(y).reverse()}));var v=(h==="u"?o.predecessors:o.successors).bind(o),p=(0,t.verticalAlignment)(o,l,u,v),g=(0,t.horizontalCompaction)(o,l,p.root,p.align,d==="r");d==="r"&&Object.keys(g).forEach(function(y){return g[y]=-g[y]}),f[h+d]=g})});var c=(0,t.findSmallestWidthAlignment)(o,f);return c&&(0,t.alignCoordinates)(f,c),(0,t.balance)(f,o.graph().align)},a=function(o){var s,u=(0,e.asNonCompoundGraph)(o);n(u);var f=i(u);(s=Object.keys(f))===null||s===void 0||s.forEach(function(l){u.node(l).x=f[l]})};return yu.default=a,yu}var Oh={},N_;function UV(){if(N_)return Oh;N_=1,Object.defineProperty(Oh,"__esModule",{value:!0});var r=function(e,t){for(var n=e.nodes().filter(function(u){var f;return!(!((f=e.children(u))===null||f===void 0)&&f.length)}),i=n.map(function(u){return e.node(u).rank}),a=Math.max.apply(Math,i),o=[],s=0;s<a+1;s++)o[s]=[];t==null||t.forEach(function(u){var f=e.node(u);!f||f!=null&&f.dummy||isNaN(f.rank)||(f.fixorder=o[f.rank].length,o[f.rank].push(u))})};return Oh.default=r,Oh}var O_;function $V(){if(O_)return io;O_=1;var r=io&&io.__assign||function(){return r=Object.assign||function(U){for(var Z,K=1,se=arguments.length;K<se;K++){Z=arguments[K];for(var re in Z)Object.prototype.hasOwnProperty.call(Z,re)&&(U[re]=Z[re])}return U},r.apply(this,arguments)},e=io&&io.__importDefault||function(U){return U&&U.__esModule?U:{default:U}};Object.defineProperty(io,"__esModule",{value:!0});var t=e(RY()),n=e(BY()),i=e(GY()),a=gi(),o=e(zY()),s=e(jY()),u=e(UY()),f=e($Y()),l=e(GV()),c=e(jV()),h=e(UV()),d=rf(),v=function(U,Z){var K=Z&&Z.debugTiming?a.time:a.notime;K("layout",function(){Z&&!Z.keepNodeOrder&&Z.prevGraph&&K(" inheritOrder",function(){g(U,Z.prevGraph)});var se=K(" buildLayoutGraph",function(){return M(U)});Z&&Z.edgeLabelSpace===!1||K(" makeSpaceForEdgeLabels",function(){A(se)});try{K(" runLayout",function(){p(se,K,Z)})}catch(re){if(re.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:
|
|
33
|
+
`,re);return}throw re}K(" updateInputGraph",function(){y(U,se)})})},p=function(U,Z,K){Z(" removeSelfEdges",function(){P(U)}),Z(" acyclic",function(){t.default.run(U)}),Z(" nestingGraph.run",function(){s.default.run(U)}),Z(" rank",function(){(0,i.default)((0,a.asNonCompoundGraph)(U))}),Z(" injectEdgeLabelProxies",function(){T(U)}),Z(" removeEmptyRanks",function(){(0,a.removeEmptyRanks)(U)}),Z(" nestingGraph.cleanup",function(){s.default.cleanup(U)}),Z(" normalizeRanks",function(){(0,a.normalizeRanks)(U)}),Z(" assignRankMinMax",function(){I(U)}),Z(" removeEdgeLabelProxies",function(){L(U)}),Z(" normalize.run",function(){n.default.run(U)}),Z(" parentDummyChains",function(){(0,o.default)(U)}),Z(" addBorderSegments",function(){(0,u.default)(U)}),K&&K.keepNodeOrder&&Z(" initDataOrder",function(){(0,h.default)(U,K.nodeOrder)}),Z(" order",function(){(0,l.default)(U,K==null?void 0:K.keepNodeOrder)}),Z(" insertSelfEdges",function(){R(U)}),Z(" adjustCoordinateSystem",function(){f.default.adjust(U)}),Z(" position",function(){(0,c.default)(U)}),Z(" positionSelfEdges",function(){X(U)}),Z(" removeBorderNodes",function(){D(U)}),Z(" normalize.undo",function(){n.default.undo(U)}),Z(" fixupEdgeLabelCoords",function(){B(U)}),Z(" undoCoordinateSystem",function(){f.default.undo(U)}),Z(" translateGraph",function(){N(U)}),Z(" assignNodeIntersects",function(){O(U)}),Z(" reversePoints",function(){W(U)}),Z(" acyclic.undo",function(){t.default.undo(U)})},g=function(U,Z){U.nodes().forEach(function(K){var se=U.node(K),re=Z.node(K);re!==void 0?(se.fixorder=re._order,delete re._order):delete se.fixorder})},y=function(U,Z){U.nodes().forEach(function(K){var se,re=U.node(K);if(re){var J=Z.node(K);re.x=J.x,re.y=J.y,re._order=J.order,re._rank=J.rank,!((se=Z.children(K))===null||se===void 0)&&se.length&&(re.width=J.width,re.height=J.height)}}),U.edges().forEach(function(K){var se=U.edge(K),re=Z.edge(K);se.points=re?re.points:[],re&&re.hasOwnProperty("x")&&(se.x=re.x,se.y=re.y)}),U.graph().width=Z.graph().width,U.graph().height=Z.graph().height},m=["nodesep","edgesep","ranksep","marginx","marginy"],x={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],w=["width","height","layer","fixorder"],E={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],_={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},C=["labelpos"],M=function(U){var Z=new d.Graph({multigraph:!0,compound:!0}),K=ee(U.graph()),se={};return b==null||b.forEach(function(re){K[re]!==void 0&&(se[re]=K[re])}),Z.setGraph(Object.assign({},x,Y(K,m),se)),U.nodes().forEach(function(re){var J=ee(U.node(re)),me=r(r({},E),J),Ae=Y(me,w);Z.setNode(re,Ae),Z.setParent(re,U.parent(re))}),U.edges().forEach(function(re){var J=ee(U.edge(re)),me={};C==null||C.forEach(function(Ae){J[Ae]!==void 0&&(me[Ae]=J[Ae])}),Z.setEdgeObj(re,Object.assign({},_,Y(J,S),me))}),Z},A=function(U){var Z=U.graph();Z.ranksep||(Z.ranksep=0),Z.ranksep/=2,U.nodes().forEach(function(K){var se=U.node(K);isNaN(se.layer)||se.layer||(se.layer=0)}),U.edges().forEach(function(K){var se,re=U.edge(K);re.minlen*=2,((se=re.labelpos)===null||se===void 0?void 0:se.toLowerCase())!=="c"&&(Z.rankdir==="TB"||Z.rankdir==="BT"?re.width+=re.labeloffset:re.height+=re.labeloffset)})},T=function(U){U.edges().forEach(function(Z){var K=U.edge(Z);if(K.width&&K.height){var se=U.node(Z.v),re=U.node(Z.w),J={e:Z,rank:(re.rank-se.rank)/2+se.rank};(0,a.addDummyNode)(U,"edge-proxy",J,"_ep")}})},I=function(U){var Z=0;U.nodes().forEach(function(K){var se,re,J=U.node(K);J.borderTop&&(J.minRank=(se=U.node(J.borderTop))===null||se===void 0?void 0:se.rank,J.maxRank=(re=U.node(J.borderBottom))===null||re===void 0?void 0:re.rank,Z=Math.max(Z,J.maxRank||-1/0))}),U.graph().maxRank=Z},L=function(U){U.nodes().forEach(function(Z){var K=U.node(Z);K.dummy==="edge-proxy"&&(U.edge(K.e).labelRank=K.rank,U.removeNode(Z))})},N=function(U){var Z,K=0,se,re=0,J=U.graph(),me=J.marginx||0,Ae=J.marginy||0,Ye=function(Ve){if(Ve){var Ke=Ve.x,xt=Ve.y,kt=Ve.width,Lt=Ve.height;!isNaN(Ke)&&!isNaN(kt)&&(Z===void 0&&(Z=Ke-kt/2),Z=Math.min(Z,Ke-kt/2),K=Math.max(K,Ke+kt/2)),!isNaN(xt)&&!isNaN(Lt)&&(se===void 0&&(se=xt-Lt/2),se=Math.min(se,xt-Lt/2),re=Math.max(re,xt+Lt/2))}};U.nodes().forEach(function(Ve){Ye(U.node(Ve))}),U.edges().forEach(function(Ve){var Ke=U.edge(Ve);Ke!=null&&Ke.hasOwnProperty("x")&&Ye(Ke)}),Z-=me,se-=Ae,U.nodes().forEach(function(Ve){var Ke=U.node(Ve);Ke&&(Ke.x-=Z,Ke.y-=se)}),U.edges().forEach(function(Ve){var Ke,xt=U.edge(Ve);(Ke=xt.points)===null||Ke===void 0||Ke.forEach(function(kt){kt.x-=Z,kt.y-=se}),xt.hasOwnProperty("x")&&(xt.x-=Z),xt.hasOwnProperty("y")&&(xt.y-=se)}),J.width=K-Z+me,J.height=re-se+Ae},O=function(U){U.edges().forEach(function(Z){var K=U.edge(Z),se=U.node(Z.v),re=U.node(Z.w),J,me;K.points?(J=K.points[0],me=K.points[K.points.length-1]):(K.points=[],J=re,me=se),K.points.unshift((0,a.intersectRect)(se,J)),K.points.push((0,a.intersectRect)(re,me))})},B=function(U){U.edges().forEach(function(Z){var K=U.edge(Z);if(K!=null&&K.hasOwnProperty("x"))switch((K.labelpos==="l"||K.labelpos==="r")&&(K.width-=K.labeloffset),K.labelpos){case"l":K.x-=K.width/2+K.labeloffset;break;case"r":K.x+=K.width/2+K.labeloffset;break}})},W=function(U){U.edges().forEach(function(Z){var K,se=U.edge(Z);se.reversed&&((K=se.points)===null||K===void 0||K.reverse())})},D=function(U){U.nodes().forEach(function(Z){var K,se,re;if(!((K=U.children(Z))===null||K===void 0)&&K.length){var J=U.node(Z),me=U.node(J.borderTop),Ae=U.node(J.borderBottom),Ye=U.node(J.borderLeft[((se=J.borderLeft)===null||se===void 0?void 0:se.length)-1]),Ve=U.node(J.borderRight[((re=J.borderRight)===null||re===void 0?void 0:re.length)-1]);J.width=Math.abs((Ve==null?void 0:Ve.x)-(Ye==null?void 0:Ye.x))||10,J.height=Math.abs((Ae==null?void 0:Ae.y)-(me==null?void 0:me.y))||10,J.x=((Ye==null?void 0:Ye.x)||0)+J.width/2,J.y=((me==null?void 0:me.y)||0)+J.height/2}}),U.nodes().forEach(function(Z){var K;((K=U.node(Z))===null||K===void 0?void 0:K.dummy)==="border"&&U.removeNode(Z)})},P=function(U){U.edges().forEach(function(Z){if(Z.v===Z.w){var K=U.node(Z.v);K.selfEdges||(K.selfEdges=[]),K.selfEdges.push({e:Z,label:U.edge(Z)}),U.removeEdgeObj(Z)}})},R=function(U){var Z=(0,a.buildLayerMatrix)(U);Z==null||Z.forEach(function(K){var se=0;K==null||K.forEach(function(re,J){var me,Ae=U.node(re);Ae.order=J+se,(me=Ae.selfEdges)===null||me===void 0||me.forEach(function(Ye){(0,a.addDummyNode)(U,"selfedge",{width:Ye.label.width,height:Ye.label.height,rank:Ae.rank,order:J+ ++se,e:Ye.e,label:Ye.label},"_se")}),delete Ae.selfEdges})})},X=function(U){U.nodes().forEach(function(Z){var K=U.node(Z);if(K.dummy==="selfedge"){var se=U.node(K.e.v),re=se.x+se.width/2,J=se.y,me=K.x-re,Ae=se.height/2;U.setEdgeObj(K.e,K.label),U.removeNode(Z),K.label.points=[{x:re+2*me/3,y:J-Ae},{x:re+5*me/6,y:J-Ae},{y:J,x:re+me},{x:re+5*me/6,y:J+Ae},{x:re+2*me/3,y:J+Ae}],K.label.x=K.x,K.label.y=K.y}})},Y=function(U,Z){var K={};return Z==null||Z.forEach(function(se){U[se]!==void 0&&(K[se]=+U[se])}),K},ee=function(U){U===void 0&&(U={});var Z={};return Object.keys(U).forEach(function(K){Z[K.toLowerCase()]=U[K]}),Z};return io.default=v,io}var D_;function XV(){if(D_)return cu;D_=1;var r=cu&&cu.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(cu,"__esModule",{value:!0});var e=r($V()),t=gi();return cu.default={layout:e.default,util:{time:t.time,notime:t.notime}},cu}var P_;function d1(){if(P_)return Ta;P_=1;var r=Ta&&Ta.__extends||function(){var u=function(f,l){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,h){c.__proto__=h}||function(c,h){for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(c[d]=h[d])},u(f,l)};return function(f,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");u(f,l);function c(){this.constructor=f}f.prototype=l===null?Object.create(l):(c.prototype=l.prototype,new c)}}(),e=Ta&&Ta.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.DagreLayout=void 0;var t=e(XV()),n=$r(),i=ln(),a=rf(),o=function(u){r(f,u);function f(l){var c=u.call(this)||this;return c.rankdir="TB",c.nodesep=50,c.ranksep=50,c.controlPoints=!1,c.sortByCombo=!1,c.edgeLabelSpace=!0,c.radial=!1,c.nodes=[],c.edges=[],c.onLayoutEnd=function(){},c.layoutNode=function(h){var d=c,v=d.nodes,p=v.find(function(y){return y.id===h});if(p){var g=p.layout!==!1;return g}return!0},c.updateCfg(l),c}return f.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}},f.prototype.execute=function(){var l=this,c,h,d,v,p=this,g=p.nodes,y=p.nodeSize,m=p.rankdir,x=p.combos,b=p.begin,w=p.radial,E=p.comboEdges,S=E===void 0?[]:E,_=p.vedges,C=_===void 0?[]:_;if(g){var M=p.edges||[],A=new a.Graph({multigraph:!0,compound:!0});p.nodeMap={};var T={};g.forEach(function(ve){p.nodeMap[ve.id]=ve,ve.comboId&&(T[ve.comboId]=T[ve.comboId]||[],T[ve.comboId].push(ve.id))});var I=[],L={};!((c=p.nodeOrder)===null||c===void 0)&&c.length?(p.nodeOrder.forEach(function(ve){L[ve]=!0,I.push(p.nodeMap[ve])}),g.forEach(function(ve){L[ve.id]||I.push(ve)})):I=g;var N;y?(0,n.isArray)(y)?N=function(){return y}:N=function(){return[y,y]}:N=function(ve){return ve.size?(0,n.isArray)(ve.size)?ve.size:(0,n.isObject)(ve.size)?[ve.size.width||40,ve.size.height||40]:[ve.size,ve.size]:[40,40]};var O=(0,n.getFunc)(p.ranksep,50,p.ranksepFunc),B=(0,n.getFunc)(p.nodesep,50,p.nodesepFunc),W=B,D=O;(m==="LR"||m==="RL")&&(W=O,D=B),A.setDefaultEdgeLabel(function(){return{}}),A.setGraph(p);var P={};this.sortByCombo&&x&&x.forEach(function(ve){if(P[ve.id]=ve,ve.collapsed){var Te=N(ve),nt=D(ve),st=W(ve),gt=Te[0]+2*st,Ct=Te[1]+2*nt;A.setNode(ve.id,{width:gt,height:Ct})}ve.parentId&&(P[ve.parentId]||A.setNode(ve.parentId,{}),A.setParent(ve.id,ve.parentId))}),I.filter(function(ve){return ve.layout!==!1}).forEach(function(ve){var Te=N(ve),nt=D(ve),st=W(ve),gt=Te[0]+2*st,Ct=Te[1]+2*nt,Bt=ve.layer;(0,n.isNumber)(Bt)?A.setNode(ve.id,{width:gt,height:Ct,layer:Bt}):A.setNode(ve.id,{width:gt,height:Ct}),l.sortByCombo&&ve.comboId&&(P[ve.comboId]||(P[ve.comboId]={id:ve.comboId},A.setNode(ve.comboId,{})),A.setParent(ve.id,ve.comboId))}),M.forEach(function(ve){var Te=(0,n.getEdgeTerminal)(ve,"source"),nt=(0,n.getEdgeTerminal)(ve,"target");l.layoutNode(Te)&&l.layoutNode(nt)&&A.setEdge(Te,nt,{weight:ve.weight||1})}),(h=S==null?void 0:S.concat(C||[]))===null||h===void 0||h.forEach(function(ve){var Te,nt,st=ve.source,gt=ve.target,Ct=!((Te=P[st])===null||Te===void 0)&&Te.collapsed?[st]:T[st]||[st],Bt=!((nt=P[gt])===null||nt===void 0)&&nt.collapsed?[gt]:T[gt]||[gt];Ct.forEach(function(Sr){Bt.forEach(function(yr){A.setEdge(Sr,yr,{weight:ve.weight||1})})})});var R=void 0;!((d=p.preset)===null||d===void 0)&&d.nodes&&(R=new a.Graph({multigraph:!0,compound:!0}),p.preset.nodes.forEach(function(ve){R==null||R.setNode(ve.id,ve)})),t.default.layout(A,{prevGraph:R,edgeLabelSpace:p.edgeLabelSpace,keepNodeOrder:!!p.nodeOrder,nodeOrder:p.nodeOrder});var X=[0,0];if(b){var Y=1/0,ee=1/0;A.nodes().forEach(function(ve){var Te=A.node(ve);Y>Te.x&&(Y=Te.x),ee>Te.y&&(ee=Te.y)}),A.edges().forEach(function(ve){var Te,nt=A.edge(ve);(Te=nt.points)===null||Te===void 0||Te.forEach(function(st){Y>st.x&&(Y=st.x),ee>st.y&&(ee=st.y)})}),X[0]=b[0]-Y,X[1]=b[1]-ee}var U=m==="LR"||m==="RL";if(w){var Z=this,K=Z.focusNode,se=Z.ranksep,re=Z.getRadialPos,J=(0,n.isString)(K)?K:K==null?void 0:K.id,me=J?(v=A.node(J))===null||v===void 0?void 0:v._rank:0,Ae=[],Ye=U?"y":"x",Ve=U?"height":"width",Ke=1/0,xt=-1/0;A.nodes().forEach(function(ve){var Te=A.node(ve);if(p.nodeMap[ve]){var nt=B(p.nodeMap[ve]);if(me===0)Ae[Te._rank]||(Ae[Te._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),Ae[Te._rank].nodes.push(ve),Ae[Te._rank].totalWidth+=nt*2+Te[Ve],Ae[Te._rank].maxSize<Math.max(Te.width,Te.height)&&(Ae[Te._rank].maxSize=Math.max(Te.width,Te.height));else{var st=Te._rank-me;if(st===0)Ae[st]||(Ae[st]={nodes:[],totalWidth:0,maxSize:-1/0}),Ae[st].nodes.push(ve),Ae[st].totalWidth+=nt*2+Te[Ve],Ae[st].maxSize<Math.max(Te.width,Te.height)&&(Ae[st].maxSize=Math.max(Te.width,Te.height));else{var gt=Math.abs(st);Ae[gt]||(Ae[gt]={left:[],right:[],totalWidth:0,maxSize:-1/0}),Ae[gt].totalWidth+=nt*2+Te[Ve],Ae[gt].maxSize<Math.max(Te.width,Te.height)&&(Ae[gt].maxSize=Math.max(Te.width,Te.height)),st<0?Ae[gt].left.push(ve):Ae[gt].right.push(ve)}}var Ct=Te[Ye]-Te[Ve]/2-nt,Bt=Te[Ye]+Te[Ve]/2+nt;Ct<Ke&&(Ke=Ct),Bt>xt&&(xt=Bt)}});var kt=se||50,Lt={},vr=(xt-Ke)/.9,xr=[(Ke+xt-vr)*.5,(Ke+xt+vr)*.5],pt=function(ve,Te,nt,st){nt===void 0&&(nt=-1/0),st===void 0&&(st=[0,1]);var gt=nt;return ve.forEach(function(Ct){var Bt=A.node(Ct);Lt[Ct]=Te;var Sr=re(Bt[Ye],xr,vr,Te,st),yr=Sr.x,Rr=Sr.y;if(p.nodeMap[Ct]){p.nodeMap[Ct].x=yr+X[0],p.nodeMap[Ct].y=Rr+X[1],p.nodeMap[Ct]._order=Bt._order;var wt=O(p.nodeMap[Ct]);gt<wt&&(gt=wt)}}),gt},Nt=!0,F=0;Ae.forEach(function(ve){var Te,nt,st,gt,Ct,Bt,Sr;if(!(!(!((Te=ve==null?void 0:ve.nodes)===null||Te===void 0)&&Te.length)&&!(!((nt=ve==null?void 0:ve.left)===null||nt===void 0)&&nt.length)&&!(!((st=ve==null?void 0:ve.right)===null||st===void 0)&&st.length))){if(Nt&&ve.nodes.length===1){var yr=ve.nodes[0];if(!p.nodeMap[yr])return;p.nodeMap[yr].x=X[0],p.nodeMap[yr].y=X[1],Lt[ve.nodes[0]]=0,kt=O(p.nodeMap[yr]),Nt=!1;return}kt=Math.max(kt,ve.totalWidth/(2*Math.PI));var Rr=-1/0;if(me===0||!((gt=ve.nodes)===null||gt===void 0)&>.length)Rr=pt(ve.nodes,kt,Rr,[0,1]);else{var wt=((Ct=ve.left)===null||Ct===void 0?void 0:Ct.length)/(((Bt=ve.left)===null||Bt===void 0?void 0:Bt.length)+((Sr=ve.right)===null||Sr===void 0?void 0:Sr.length));Rr=pt(ve.left,kt,Rr,[0,wt]),Rr=pt(ve.right,kt,Rr,[wt+.05,1])}kt+=Rr,Nt=!1,F-ve.maxSize}}),A.edges().forEach(function(ve){var Te,nt,st,gt=A.edge(ve),Ct=M.findIndex(function(Yt){var br=(0,n.getEdgeTerminal)(Yt,"source"),It=(0,n.getEdgeTerminal)(Yt,"target");return br===ve.v&&It===ve.w});if(!(Ct<=-1)&&p.edgeLabelSpace&&p.controlPoints&&M[Ct].type!=="loop"){var Bt=Ye==="x"?"y":"x",Sr=(Te=gt==null?void 0:gt.points)===null||Te===void 0?void 0:Te.slice(1,gt.points.length-1),yr=[],Rr=(nt=A.node(ve.v))===null||nt===void 0?void 0:nt[Bt],wt=Rr-((st=A.node(ve.w))===null||st===void 0?void 0:st[Bt]),er=Lt[ve.v],ir=er-Lt[ve.w];Sr==null||Sr.forEach(function(Yt){var br=(Yt[Bt]-Rr)/wt*ir+er,It=re(Yt[Ye],xr,vr,br);yr.push({x:It.x+X[0],y:It.y+X[1]})}),M[Ct].controlPoints=yr}})}else{var zt=new Set,Ot=m==="BT"||m==="RL",ut=Ot?function(ve,Te){return Te-ve}:function(ve,Te){return ve-Te};A.nodes().forEach(function(ve){var Te=A.node(ve);if(Te){var nt=l.nodeMap[ve];nt||(nt=x==null?void 0:x.find(function(st){return st.id===ve})),nt&&(nt.x=Te.x+X[0],nt.y=Te.y+X[1],nt._order=Te._order,zt.add(U?nt.x:nt.y))}});var Gt=Array.from(zt).sort(ut),_t=U?function(ve,Te){return ve.x!==Te.x}:function(ve,Te){return ve.y!==Te.y},ct=U?function(ve,Te,nt){var st=Math.max(Te.y,nt.y),gt=Math.min(Te.y,nt.y);return ve.filter(function(Ct){return Ct.y<=st&&Ct.y>=gt})}:function(ve,Te,nt){var st=Math.max(Te.x,nt.x),gt=Math.min(Te.x,nt.x);return ve.filter(function(Ct){return Ct.x<=st&&Ct.x>=gt})};A.edges().forEach(function(ve){var Te,nt=A.edge(ve),st=M.findIndex(function(Bt){var Sr=(0,n.getEdgeTerminal)(Bt,"source"),yr=(0,n.getEdgeTerminal)(Bt,"target");return Sr===ve.v&&yr===ve.w});if(!(st<=-1)&&p.edgeLabelSpace&&p.controlPoints&&M[st].type!=="loop"){(Te=nt==null?void 0:nt.points)===null||Te===void 0||Te.forEach(function(Bt){Bt.x+=X[0],Bt.y+=X[1]});var gt=p.nodeMap[ve.v],Ct=p.nodeMap[ve.w];M[st].controlPoints=s(nt==null?void 0:nt.points,gt,Ct,Gt,U,_t,ct)}})}return p.onLayoutEnd&&p.onLayoutEnd(),{nodes:g,edges:M}}},f.prototype.getRadialPos=function(l,c,h,d,v){v===void 0&&(v=[0,1]);var p=(l-c[0])/h;p=p*(v[1]-v[0])+v[0];var g=p*2*Math.PI;return{x:Math.cos(g)*d,y:Math.sin(g)*d}},f.prototype.getType=function(){return"dagre"},f}(i.Base);Ta.DagreLayout=o;var s=function(u,f,l,c,h,d,v){var p=(u==null?void 0:u.slice(1,u.length-1))||[];if(f&&l){var g=f.x,y=f.y,m=l.x,x=l.y;if(h&&(g=f.y,y=f.x,m=l.y,x=l.x),x!==y&&g!==m){var b=c.indexOf(y),w=c[b+1];if(w){var E=p[0],S=h?{x:(y+w)/2,y:(E==null?void 0:E.y)||m}:{x:(E==null?void 0:E.x)||m,y:(y+w)/2};(!E||d(E,S))&&p.unshift(S)}var _=c.indexOf(x),C=Math.abs(_-b);if(C===1)p=v(p,f,l),p.length||p.push(h?{x:(y+x)/2,y:g}:{x:g,y:(y+x)/2});else if(C>1){var M=c[_-1];if(M){var A=p[p.length-1],T=h?{x:(x+M)/2,y:(A==null?void 0:A.y)||m}:{x:(A==null?void 0:A.x)||g,y:(x+M)/2};(!A||d(A,T))&&p.push(T)}}}}return p};return Ta}var Ci={};const Kd={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 Oy(r={},e=Kd){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 wN(r){return`◬${r}◬`}const qu=wN("ROOT"),EN=wN("BRIDGE_GRAPH");var Fn,Ns,Vu,Dy;(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"}(Ns||(Ns={})),function(r){r[r.META=0]="META",r[r.CORE=1]="CORE",r[r.BRIDGE=2]="BRIDGE"}(Vu||(Vu={})),function(r){r[r.META=0]="META",r[r.OP=1]="OP",r[r.SERIES=2]="SERIES"}(Dy||(Dy={}));var Dh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function v1(r,e){return r(e={exports:{}},e.exports),e.exports}var YV=function(){this.__data__=[],this.size=0},af=function(r,e){return r===e||r!=r&&e!=e},Rv=function(r,e){for(var t=r.length;t--;)if(af(r[t][0],e))return t;return-1},WV=Array.prototype.splice,qV=function(r){var e=this.__data__,t=Rv(e,r);return!(t<0)&&(t==e.length-1?e.pop():WV.call(e,t,1),--this.size,!0)},VV=function(r){var e=this.__data__,t=Rv(e,r);return t<0?void 0:e[t][1]},HV=function(r){return Rv(this.__data__,r)>-1},ZV=function(r,e){var t=this.__data__,n=Rv(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this};function _u(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])}}_u.prototype.clear=YV,_u.prototype.delete=qV,_u.prototype.get=VV,_u.prototype.has=HV,_u.prototype.set=ZV;var Bv=_u,KV=function(){this.__data__=new Bv,this.size=0},QV=function(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t},JV=function(r){return this.__data__.get(r)},eH=function(r){return this.__data__.has(r)},_N=typeof Dh=="object"&&Dh&&Dh.Object===Object&&Dh,tH=typeof self=="object"&&self&&self.Object===Object&&self,ji=_N||tH||Function("return this")(),di=ji.Symbol,SN=Object.prototype,rH=SN.hasOwnProperty,nH=SN.toString,Kf=di?di.toStringTag:void 0,iH=function(r){var e=rH.call(r,Kf),t=r[Kf];try{r[Kf]=void 0;var n=!0}catch{}var i=nH.call(r);return n&&(e?r[Kf]=t:delete r[Kf]),i},aH=Object.prototype.toString,oH=function(r){return aH.call(r)},R_=di?di.toStringTag:void 0,Io=function(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":R_&&R_ in Object(r)?iH(r):oH(r)},Un=function(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")},B_,rc=function(r){if(!Un(r))return!1;var e=Io(r);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"},zg=ji["__core-js_shared__"],F_=(B_=/[^.]+$/.exec(zg&&zg.keys&&zg.keys.IE_PROTO||""))?"Symbol(src)_1."+B_:"",sH=function(r){return!!F_&&F_ in r},uH=Function.prototype.toString,Bs=function(r){if(r!=null){try{return uH.call(r)}catch{}try{return r+""}catch{}}return""},fH=/^\[object .+?Constructor\]$/,lH=Function.prototype,cH=Object.prototype,hH=lH.toString,dH=cH.hasOwnProperty,vH=RegExp("^"+hH.call(dH).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pH=function(r){return!(!Un(r)||sH(r))&&(rc(r)?vH:fH).test(Bs(r))},gH=function(r,e){return r==null?void 0:r[e]},Fs=function(r,e){var t=gH(r,e);return pH(t)?t:void 0},$l=Fs(ji,"Map"),Xl=Fs(Object,"create"),yH=function(){this.__data__=Xl?Xl(null):{},this.size=0},mH=function(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e},bH=Object.prototype.hasOwnProperty,xH=function(r){var e=this.__data__;if(Xl){var t=e[r];return t==="__lodash_hash_undefined__"?void 0:t}return bH.call(e,r)?e[r]:void 0},wH=Object.prototype.hasOwnProperty,EH=function(r){var e=this.__data__;return Xl?e[r]!==void 0:wH.call(e,r)},_H=function(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Xl&&e===void 0?"__lodash_hash_undefined__":e,this};function Su(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])}}Su.prototype.clear=yH,Su.prototype.delete=mH,Su.prototype.get=xH,Su.prototype.has=EH,Su.prototype.set=_H;var G_=Su,SH=function(){this.size=0,this.__data__={hash:new G_,map:new($l||Bv),string:new G_}},MH=function(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null},Fv=function(r,e){var t=r.__data__;return MH(e)?t[typeof e=="string"?"string":"hash"]:t.map},CH=function(r){var e=Fv(this,r).delete(r);return this.size-=e?1:0,e},AH=function(r){return Fv(this,r).get(r)},TH=function(r){return Fv(this,r).has(r)},IH=function(r,e){var t=Fv(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this};function Mu(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])}}Mu.prototype.clear=SH,Mu.prototype.delete=CH,Mu.prototype.get=AH,Mu.prototype.has=TH,Mu.prototype.set=IH;var Gv=Mu,kH=function(r,e){var t=this.__data__;if(t instanceof Bv){var n=t.__data__;if(!$l||n.length<199)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Gv(n)}return t.set(r,e),this.size=t.size,this};function Cu(r){var e=this.__data__=new Bv(r);this.size=e.size}Cu.prototype.clear=KV,Cu.prototype.delete=QV,Cu.prototype.get=JV,Cu.prototype.has=eH,Cu.prototype.set=kH;var Ru=Cu,p1=function(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r},Qd=function(){try{var r=Fs(Object,"defineProperty");return r({},"",{}),r}catch{}}(),zv=function(r,e,t){e=="__proto__"&&Qd?Qd(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t},LH=Object.prototype.hasOwnProperty,jv=function(r,e,t){var n=r[e];LH.call(r,e)&&af(n,t)&&(t!==void 0||e in r)||zv(r,e,t)},nc=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?zv(t,s,u):jv(t,s,u)}return t},NH=function(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n},Bi=function(r){return r!=null&&typeof r=="object"},z_=function(r){return Bi(r)&&Io(r)=="[object Arguments]"},MN=Object.prototype,OH=MN.hasOwnProperty,DH=MN.propertyIsEnumerable,Hu=z_(function(){return arguments}())?z_:function(r){return Bi(r)&&OH.call(r,"callee")&&!DH.call(r,"callee")},qr=Array.isArray,PH=function(){return!1},Os=v1(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t?ji.Buffer:void 0,a=(i?i.isBuffer:void 0)||PH;r.exports=a}),RH=/^(?:0|[1-9]\d*)$/,Uv=function(r,e){var t=typeof r;return!!(e=e==null?9007199254740991:e)&&(t=="number"||t!="symbol"&&RH.test(r))&&r>-1&&r%1==0&&r<e},g1=function(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=9007199254740991},Dr={};Dr["[object Float32Array]"]=Dr["[object Float64Array]"]=Dr["[object Int8Array]"]=Dr["[object Int16Array]"]=Dr["[object Int32Array]"]=Dr["[object Uint8Array]"]=Dr["[object Uint8ClampedArray]"]=Dr["[object Uint16Array]"]=Dr["[object Uint32Array]"]=!0,Dr["[object Arguments]"]=Dr["[object Array]"]=Dr["[object ArrayBuffer]"]=Dr["[object Boolean]"]=Dr["[object DataView]"]=Dr["[object Date]"]=Dr["[object Error]"]=Dr["[object Function]"]=Dr["[object Map]"]=Dr["[object Number]"]=Dr["[object Object]"]=Dr["[object RegExp]"]=Dr["[object Set]"]=Dr["[object String]"]=Dr["[object WeakMap]"]=!1;var BH=function(r){return Bi(r)&&g1(r.length)&&!!Dr[Io(r)]},$v=function(r){return function(e){return r(e)}},Zu=v1(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t&&_N.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}),j_=Zu&&Zu.isTypedArray,ic=j_?$v(j_):BH,FH=Object.prototype.hasOwnProperty,CN=function(r,e){var t=qr(r),n=!t&&Hu(r),i=!t&&!n&&Os(r),a=!t&&!n&&!i&&ic(r),o=t||n||i||a,s=o?NH(r.length,String):[],u=s.length;for(var f in r)!e&&!FH.call(r,f)||o&&(f=="length"||i&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Uv(f,u))||s.push(f);return s},GH=Object.prototype,Xv=function(r){var e=r&&r.constructor;return r===(typeof e=="function"&&e.prototype||GH)},AN=function(r,e){return function(t){return r(e(t))}},zH=AN(Object.keys,Object),jH=Object.prototype.hasOwnProperty,y1=function(r){if(!Xv(r))return zH(r);var e=[];for(var t in Object(r))jH.call(r,t)&&t!="constructor"&&e.push(t);return e},Ya=function(r){return r!=null&&g1(r.length)&&!rc(r)},ko=function(r){return Ya(r)?CN(r):y1(r)},UH=function(r,e){return r&&nc(e,ko(e),r)},$H=function(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e},XH=Object.prototype.hasOwnProperty,YH=function(r){if(!Un(r))return $H(r);var e=Xv(r),t=[];for(var n in r)(n!="constructor"||!e&&XH.call(r,n))&&t.push(n);return t},Gs=function(r){return Ya(r)?CN(r,!0):YH(r)},WH=function(r,e){return r&&nc(e,Gs(e),r)},TN=v1(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t?ji.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}}),IN=function(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e},kN=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},LN=function(){return[]},qH=Object.prototype.propertyIsEnumerable,U_=Object.getOwnPropertySymbols,m1=U_?function(r){return r==null?[]:(r=Object(r),kN(U_(r),function(e){return qH.call(r,e)}))}:LN,VH=function(r,e){return nc(r,m1(r),e)},b1=function(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r},Yv=AN(Object.getPrototypeOf,Object),NN=Object.getOwnPropertySymbols?function(r){for(var e=[];r;)b1(e,m1(r)),r=Yv(r);return e}:LN,HH=function(r,e){return nc(r,NN(r),e)},ON=function(r,e,t){var n=e(r);return qr(r)?n:b1(n,t(r))},Py=function(r){return ON(r,ko,m1)},ZH=function(r){return ON(r,Gs,NN)},Ry=Fs(ji,"DataView"),By=Fs(ji,"Promise"),Bu=Fs(ji,"Set"),Fy=Fs(ji,"WeakMap"),KH=Bs(Ry),QH=Bs($l),JH=Bs(By),eZ=Bs(Bu),tZ=Bs(Fy),ds=Io;(Ry&&ds(new Ry(new ArrayBuffer(1)))!="[object DataView]"||$l&&ds(new $l)!="[object Map]"||By&&ds(By.resolve())!="[object Promise]"||Bu&&ds(new Bu)!="[object Set]"||Fy&&ds(new Fy)!="[object WeakMap]")&&(ds=function(r){var e=Io(r),t=e=="[object Object]"?r.constructor:void 0,n=t?Bs(t):"";if(n)switch(n){case KH:return"[object DataView]";case QH:return"[object Map]";case JH:return"[object Promise]";case eZ:return"[object Set]";case tZ:return"[object WeakMap]"}return e});var Ds=ds,rZ=Object.prototype.hasOwnProperty,nZ=function(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&rZ.call(r,"index")&&(t.index=r.index,t.input=r.input),t},Jd=ji.Uint8Array,x1=function(r){var e=new r.constructor(r.byteLength);return new Jd(e).set(new Jd(r)),e},iZ=function(r,e){var t=e?x1(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)},aZ=/\w*$/,oZ=function(r){var e=new r.constructor(r.source,aZ.exec(r));return e.lastIndex=r.lastIndex,e},$_=di?di.prototype:void 0,X_=$_?$_.valueOf:void 0,sZ=function(r){return X_?Object(X_.call(r)):{}},DN=function(r,e){var t=e?x1(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)},uZ=function(r,e,t){var n=r.constructor;switch(e){case"[object ArrayBuffer]":return x1(r);case"[object Boolean]":case"[object Date]":return new n(+r);case"[object DataView]":return iZ(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 DN(r,t);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(r);case"[object RegExp]":return oZ(r);case"[object Set]":return new n;case"[object Symbol]":return sZ(r)}},Y_=Object.create,PN=function(){function r(){}return function(e){if(!Un(e))return{};if(Y_)return Y_(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),RN=function(r){return typeof r.constructor!="function"||Xv(r)?{}:PN(Yv(r))},fZ=function(r){return Bi(r)&&Ds(r)=="[object Map]"},W_=Zu&&Zu.isMap,lZ=W_?$v(W_):fZ,cZ=function(r){return Bi(r)&&Ds(r)=="[object Set]"},q_=Zu&&Zu.isSet,hZ=q_?$v(q_):cZ,Nr={};Nr["[object Arguments]"]=Nr["[object Array]"]=Nr["[object ArrayBuffer]"]=Nr["[object DataView]"]=Nr["[object Boolean]"]=Nr["[object Date]"]=Nr["[object Float32Array]"]=Nr["[object Float64Array]"]=Nr["[object Int8Array]"]=Nr["[object Int16Array]"]=Nr["[object Int32Array]"]=Nr["[object Map]"]=Nr["[object Number]"]=Nr["[object Object]"]=Nr["[object RegExp]"]=Nr["[object Set]"]=Nr["[object String]"]=Nr["[object Symbol]"]=Nr["[object Uint8Array]"]=Nr["[object Uint8ClampedArray]"]=Nr["[object Uint16Array]"]=Nr["[object Uint32Array]"]=!0,Nr["[object Error]"]=Nr["[object Function]"]=Nr["[object WeakMap]"]=!1;var BN=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(!Un(e))return e;var c=qr(e);if(c){if(s=nZ(e),!u)return IN(e,s)}else{var h=Ds(e),d=h=="[object Function]"||h=="[object GeneratorFunction]";if(Os(e))return TN(e,u);if(h=="[object Object]"||h=="[object Arguments]"||d&&!a){if(s=f||d?{}:RN(e),!u)return f?HH(e,WH(s,e)):VH(e,UH(s,e))}else{if(!Nr[h])return a?e:{};s=uZ(e,h,u)}}o||(o=new Ru);var v=o.get(e);if(v)return v;o.set(e,s),hZ(e)?e.forEach(function(g){s.add(r(g,t,n,g,e,o))}):lZ(e)&&e.forEach(function(g,y){s.set(y,r(g,t,n,y,e,o))});var p=c?void 0:(l?f?ZH:Py:f?Gs:ko)(e);return p1(p||e,function(g,y){p&&(g=e[y=g]),jv(s,y,r(g,t,n,y,e,o))}),s},dZ=function(r){return BN(r,4)},w1=function(r){return function(){return r}},E1=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}}(),_1=function(r,e){return r&&E1(r,e,ko)},Wv=function(r,e){return function(t,n){if(t==null)return t;if(!Ya(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}}(_1),zs=function(r){return r},FN=function(r){return typeof r=="function"?r:zs},GN=function(r,e){return(qr(r)?p1:Wv)(r,FN(e))},zN=GN,vZ=function(r,e){var t=[];return Wv(r,function(n,i,a){e(n,i,a)&&t.push(n)}),t},pZ=function(r){return this.__data__.set(r,"__lodash_hash_undefined__"),this},gZ=function(r){return this.__data__.has(r)};function gd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Gv;++e<t;)this.add(r[e])}gd.prototype.add=gd.prototype.push=pZ,gd.prototype.has=gZ;var jN=gd,yZ=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},UN=function(r,e){return r.has(e)},$N=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 jN: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(!yZ(e,function(y,m){if(!UN(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},mZ=function(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t},S1=function(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t},V_=di?di.prototype:void 0,jg=V_?V_.valueOf:void 0,bZ=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 Jd(r),new Jd(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return af(+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=mZ;case"[object Set]":var u=1&n;if(s||(s=S1),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=$N(s(r),s(e),n,i,a,o);return o.delete(r),l;case"[object Symbol]":if(jg)return jg.call(r)==jg.call(e)}return!1},xZ=Object.prototype.hasOwnProperty,wZ=function(r,e,t,n,i,a){var o=1&t,s=Py(r),u=s.length;if(u!=Py(e).length&&!o)return!1;for(var f=u;f--;){var l=s[f];if(!(o?l in e:xZ.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,x=e.constructor;m==x||!("constructor"in r)||!("constructor"in e)||typeof m=="function"&&m instanceof m&&typeof x=="function"&&x instanceof x||(d=!1)}return a.delete(r),a.delete(e),d},H_=Object.prototype.hasOwnProperty,EZ=function(r,e,t,n,i,a){var o=qr(r),s=qr(e),u=o?"[object Array]":Ds(r),f=s?"[object Array]":Ds(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&&Os(r)){if(!Os(e))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new Ru),o||ic(r)?$N(r,e,t,n,i,a):bZ(r,e,u,t,n,i,a);if(!(1&t)){var d=l&&H_.call(r,"__wrapped__"),v=c&&H_.call(e,"__wrapped__");if(d||v){var p=d?r.value():r,g=v?e.value():e;return a||(a=new Ru),i(p,g,t,n,a)}}return!!h&&(a||(a=new Ru),wZ(r,e,t,n,i,a))},XN=function r(e,t,n,i,a){return e===t||(e==null||t==null||!Bi(e)&&!Bi(t)?e!=e&&t!=t:EZ(e,t,n,i,r,a))},_Z=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 Ru,c;if(!(c===void 0?XN(f,u,3,n,l):c))return!1}}return!0},YN=function(r){return r==r&&!Un(r)},SZ=function(r){for(var e=ko(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,YN(i)]}return e},WN=function(r,e){return function(t){return t!=null&&t[r]===e&&(e!==void 0||r in Object(t))}},MZ=function(r){var e=SZ(r);return e.length==1&&e[0][2]?WN(e[0][0],e[0][1]):function(t){return t===r||_Z(t,r,e)}},Ps=function(r){return typeof r=="symbol"||Bi(r)&&Io(r)=="[object Symbol]"},CZ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,AZ=/^\w*$/,M1=function(r,e){if(qr(r))return!1;var t=typeof r;return!(t!="number"&&t!="symbol"&&t!="boolean"&&r!=null&&!Ps(r))||AZ.test(r)||!CZ.test(r)||e!=null&&r in Object(e)};function C1(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(C1.Cache||Gv),t}C1.Cache=Gv;var TZ=C1,IZ=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,kZ=/\\(\\)?/g,LZ=function(r){var e=TZ(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(IZ,function(t,n,i,a){e.push(i?a.replace(kZ,"$1"):n||t)}),e}),Fu=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},Z_=di?di.prototype:void 0,K_=Z_?Z_.toString:void 0,NZ=function r(e){if(typeof e=="string")return e;if(qr(e))return Fu(e,r)+"";if(Ps(e))return K_?K_.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t},qN=function(r){return r==null?"":NZ(r)},qv=function(r,e){return qr(r)?r:M1(r,e)?[r]:LZ(qN(r))},ac=function(r){if(typeof r=="string"||Ps(r))return r;var e=r+"";return e=="0"&&1/r==-1/0?"-0":e},Vv=function(r,e){for(var t=0,n=(e=qv(e,r)).length;r!=null&&t<n;)r=r[ac(e[t++])];return t&&t==n?r:void 0},OZ=function(r,e,t){var n=r==null?void 0:Vv(r,e);return n===void 0?t:n},DZ=function(r,e){return r!=null&&e in Object(r)},VN=function(r,e,t){for(var n=-1,i=(e=qv(e,r)).length,a=!1;++n<i;){var o=ac(e[n]);if(!(a=r!=null&&t(r,o)))break;r=r[o]}return a||++n!=i?a:!!(i=r==null?0:r.length)&&g1(i)&&Uv(o,i)&&(qr(r)||Hu(r))},HN=function(r,e){return r!=null&&VN(r,e,DZ)},PZ=function(r,e){return M1(r)&&YN(e)?WN(ac(r),e):function(t){var n=OZ(t,r);return n===void 0&&n===e?HN(t,r):XN(e,n,3)}},ZN=function(r){return function(e){return e==null?void 0:e[r]}},RZ=function(r){return function(e){return Vv(e,r)}},BZ=function(r){return M1(r)?ZN(ac(r)):RZ(r)},Wa=function(r){return typeof r=="function"?r:r==null?zs:typeof r=="object"?qr(r)?PZ(r[0],r[1]):MZ(r):BZ(r)},KN=function(r,e){return(qr(r)?kN:vZ)(r,Wa(e))},FZ=Object.prototype.hasOwnProperty,GZ=function(r,e){return r!=null&&FZ.call(r,e)},QN=function(r,e){return r!=null&&VN(r,e,GZ)},zZ=Object.prototype.hasOwnProperty,jZ=function(r){if(r==null)return!0;if(Ya(r)&&(qr(r)||typeof r=="string"||typeof r.splice=="function"||Os(r)||ic(r)||Hu(r)))return!r.length;var e=Ds(r);if(e=="[object Map]"||e=="[object Set]")return!r.size;if(Xv(r))return!y1(r).length;for(var t in r)if(zZ.call(r,t))return!1;return!0},JN=function(r){return r===void 0},eO=function(r,e){var t=-1,n=Ya(r)?Array(r.length):[];return Wv(r,function(i,a,o){n[++t]=e(i,a,o)}),n},tO=function(r,e){return(qr(r)?Fu:eO)(r,Wa(e))},UZ=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},$Z=function(r,e,t,n,i){return i(r,function(a,o,s){t=n?(n=!1,a):e(t,a,o,s)}),t},rO=function(r,e,t){var n=qr(r)?UZ:$Z,i=arguments.length<3;return n(r,Wa(e),t,i,Wv)},XZ=function(r){return typeof r=="string"||!qr(r)&&Bi(r)&&Io(r)=="[object String]"},YZ=ZN("length"),WZ=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),qZ=function(r){return WZ.test(r)},VZ="[\\ud800-\\udfff]",Gy="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",zy="\\ud83c[\\udffb-\\udfff]",nO="[^\\ud800-\\udfff]",iO="(?:\\ud83c[\\udde6-\\uddff]){2}",aO="[\\ud800-\\udbff][\\udc00-\\udfff]",Q_="(?:"+Gy+"|"+zy+")?",HZ="[\\ufe0e\\ufe0f]?"+Q_+("(?:\\u200d(?:"+[nO,iO,aO].join("|")+")[\\ufe0e\\ufe0f]?"+Q_+")*"),ZZ="(?:"+[nO+Gy+"?",Gy,iO,aO,VZ].join("|")+")",J_=RegExp(zy+"(?="+zy+")|"+ZZ+HZ,"g"),KZ=function(r){for(var e=J_.lastIndex=0;J_.test(r);)++e;return e},QZ=function(r){return qZ(r)?KZ(r):YZ(r)},JZ=function(r){if(r==null)return 0;if(Ya(r))return XZ(r)?QZ(r):r.length;var e=Ds(r);return e=="[object Map]"||e=="[object Set]"?r.size:y1(r).length},eK=function(r,e,t){var n=qr(r),i=n||Os(r)||ic(r);if(e=Wa(e),t==null){var a=r&&r.constructor;t=i?n?new a:[]:Un(r)&&rc(a)?PN(Yv(r)):{}}return(i?p1:_1)(r,function(o,s,u){return e(t,o,s,u)}),t},eS=di?di.isConcatSpreadable:void 0,tK=function(r){return qr(r)||Hu(r)||!!(eS&&r&&r[eS])},A1=function(e,t,n,i,a){var o=-1,s=e.length;for(n||(n=tK),a||(a=[]);++o<s;){var u=e[o];n(u)?b1(a,u):i||(a[a.length]=u)}return a},rK=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)},tS=Math.max,oO=function(r,e,t){return e=tS(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=tS(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),rK(r,this,s)}},nK=Qd?function(r,e){return Qd(r,"toString",{configurable:!0,enumerable:!1,value:w1(e),writable:!0})}:zs,iK=Date.now,sO=function(r){var e=0,t=0;return function(){var n=iK(),i=16-(n-t);if(t=n,i>0){if(++e>=800)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}(nK),Hv=function(r,e){return sO(oO(r,e,zs),r+"")},uO=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},aK=function(r){return r!=r},oK=function(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1},sK=function(r,e,t){return e==e?oK(r,e,t):uO(r,aK,t)},uK=function(r,e){return!!(r!=null&&r.length)&&sK(r,e,0)>-1},fK=function(){},lK=Bu&&1/S1(new Bu([,-0]))[1]==1/0?function(r){return new Bu(r)}:fK,cK=function(r,e,t){var n=-1,i=uK,a=r.length,o=!0,s=[],u=s;if(a>=200){var f=lK(r);if(f)return S1(f);o=!1,i=UN,u=new jN}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},fO=function(r){return Bi(r)&&Ya(r)},hK=Hv(function(r){return cK(A1(r,1,fO,!0))}),dK=function(r,e){return Fu(e,function(t){return r[t]})},ev,lO=function(r){return r==null?[]:dK(r,ko(r))};try{ev={clone:dZ,constant:w1,each:zN,filter:KN,has:QN,isArray:qr,isEmpty:jZ,isFunction:rc,isUndefined:JN,keys:ko,map:tO,reduce:rO,size:JZ,transform:eK,union:hK,values:lO}}catch{}ev||(ev=window._);var ot=ev,T1=dr;function dr(r){this._isDirected=!ot.has(r,"directed")||r.directed,this._isMultigraph=!!ot.has(r,"multigraph")&&r.multigraph,this._isCompound=!!ot.has(r,"compound")&&r.compound,this._label=void 0,this._defaultNodeLabelFn=ot.constant(void 0),this._defaultEdgeLabelFn=ot.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 rS(r,e){r[e]?r[e]++:r[e]=1}function nS(r,e){--r[e]||delete r[e]}function hl(r,e,t,n){var i=""+e,a=""+t;if(!r&&i>a){var o=i;i=a,a=o}return i+""+a+""+(ot.isUndefined(n)?"\0":n)}function vK(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 Ug(r,e){return hl(r,e.v,e.w,e.name)}dr.prototype._nodeCount=0,dr.prototype._edgeCount=0,dr.prototype.isDirected=function(){return this._isDirected},dr.prototype.isMultigraph=function(){return this._isMultigraph},dr.prototype.isCompound=function(){return this._isCompound},dr.prototype.setGraph=function(r){return this._label=r,this},dr.prototype.graph=function(){return this._label},dr.prototype.setDefaultNodeLabel=function(r){return ot.isFunction(r)||(r=ot.constant(r)),this._defaultNodeLabelFn=r,this},dr.prototype.nodeCount=function(){return this._nodeCount},dr.prototype.nodes=function(){return ot.keys(this._nodes)},dr.prototype.sources=function(){var r=this;return ot.filter(this.nodes(),function(e){return ot.isEmpty(r._in[e])})},dr.prototype.sinks=function(){var r=this;return ot.filter(this.nodes(),function(e){return ot.isEmpty(r._out[e])})},dr.prototype.setNodes=function(r,e){var t=arguments,n=this;return ot.each(r,function(i){t.length>1?n.setNode(i,e):n.setNode(i)}),this},dr.prototype.setNode=function(r,e){return ot.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)},dr.prototype.node=function(r){return this._nodes[r]},dr.prototype.hasNode=function(r){return ot.has(this._nodes,r)},dr.prototype.removeNode=function(r){var e=this;if(ot.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],ot.each(this.children(r),function(n){e.setParent(n)}),delete this._children[r]),ot.each(ot.keys(this._in[r]),t),delete this._in[r],delete this._preds[r],ot.each(ot.keys(this._out[r]),t),delete this._out[r],delete this._sucs[r],--this._nodeCount}return this},dr.prototype.setParent=function(r,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ot.isUndefined(e))e="\0";else{for(var t=e+="";!ot.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},dr.prototype._removeFromParentsChildList=function(r){delete this._children[this._parent[r]][r]},dr.prototype.parent=function(r){if(this._isCompound){var e=this._parent[r];if(e!=="\0")return e}},dr.prototype.children=function(r){if(ot.isUndefined(r)&&(r="\0"),this._isCompound){var e=this._children[r];if(e)return ot.keys(e)}else{if(r==="\0")return this.nodes();if(this.hasNode(r))return[]}},dr.prototype.predecessors=function(r){var e=this._preds[r];if(e)return ot.keys(e)},dr.prototype.successors=function(r){var e=this._sucs[r];if(e)return ot.keys(e)},dr.prototype.neighbors=function(r){var e=this.predecessors(r);if(e)return ot.union(e,this.successors(r))},dr.prototype.isLeaf=function(r){return(this.isDirected()?this.successors(r):this.neighbors(r)).length===0},dr.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;ot.each(this._nodes,function(a,o){r(o)&&e.setNode(o,a)}),ot.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&&ot.each(e.nodes(),function(a){e.setParent(a,i(a))}),e},dr.prototype.setDefaultEdgeLabel=function(r){return ot.isFunction(r)||(r=ot.constant(r)),this._defaultEdgeLabelFn=r,this},dr.prototype.edgeCount=function(){return this._edgeCount},dr.prototype.edges=function(){return ot.values(this._edgeObjs)},dr.prototype.setPath=function(r,e){var t=this,n=arguments;return ot.reduce(r,function(i,a){return n.length>1?t.setEdge(i,a,e):t.setEdge(i,a),a}),this},dr.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,ot.isUndefined(t)||(t=""+t);var o=hl(this._isDirected,r,e,t);if(ot.has(this._edgeLabels,o))return i&&(this._edgeLabels[o]=n),this;if(!ot.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=vK(this._isDirected,r,e,t);return r=s.v,e=s.w,Object.freeze(s),this._edgeObjs[o]=s,rS(this._preds[e],r),rS(this._sucs[r],e),this._in[e][o]=s,this._out[r][o]=s,this._edgeCount++,this},dr.prototype.edge=function(r,e,t){var n=arguments.length===1?Ug(this._isDirected,arguments[0]):hl(this._isDirected,r,e,t);return this._edgeLabels[n]},dr.prototype.hasEdge=function(r,e,t){var n=arguments.length===1?Ug(this._isDirected,arguments[0]):hl(this._isDirected,r,e,t);return ot.has(this._edgeLabels,n)},dr.prototype.removeEdge=function(r,e,t){var n=arguments.length===1?Ug(this._isDirected,arguments[0]):hl(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],nS(this._preds[e],r),nS(this._sucs[r],e),delete this._in[e][n],delete this._out[r][n],this._edgeCount--),this},dr.prototype.inEdges=function(r,e){var t=this._in[r];if(t){var n=ot.values(t);return e?ot.filter(n,function(i){return i.v===e}):n}},dr.prototype.outEdges=function(r,e){var t=this._out[r];if(t){var n=ot.values(t);return e?ot.filter(n,function(i){return i.w===e}):n}},dr.prototype.nodeEdges=function(r,e){var t=this.inEdges(r,e);if(t)return t.concat(this.outEdges(r,e))};var iS={Graph:T1,version:"2.1.8"},pK={write:function(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:gK(r),edges:yK(r)};return ot.isUndefined(r.graph())||(e.value=ot.clone(r.graph())),e},read:function(r){var e=new T1(r.options).setGraph(r.value);return ot.each(r.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),ot.each(r.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function gK(r){return ot.map(r.nodes(),function(e){var t=r.node(e),n=r.parent(e),i={v:e};return ot.isUndefined(t)||(i.value=t),ot.isUndefined(n)||(i.parent=n),i})}function yK(r){return ot.map(r.edges(),function(e){var t=r.edge(e),n={v:e.v,w:e.w};return ot.isUndefined(e.name)||(n.name=e.name),ot.isUndefined(t)||(n.value=t),n})}var mK=function(r){var e,t={},n=[];function i(a){ot.has(t,a)||(t[a]=!0,e.push(a),ot.each(r.successors(a),i),ot.each(r.predecessors(a),i))}return ot.each(r.nodes(),function(a){e=[],i(a),e.length&&n.push(e)}),n},cO=ai;function ai(){this._arr=[],this._keyIndices={}}ai.prototype.size=function(){return this._arr.length},ai.prototype.keys=function(){return this._arr.map(function(r){return r.key})},ai.prototype.has=function(r){return ot.has(this._keyIndices,r)},ai.prototype.priority=function(r){var e=this._keyIndices[r];if(e!==void 0)return this._arr[e].priority},ai.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},ai.prototype.add=function(r,e){var t=this._keyIndices;if(r=String(r),!ot.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},ai.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},ai.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)},ai.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)))},ai.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},ai.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 hO=function(r,e,t,n){return function(i,a,o,s){var u,f,l={},c=new cO,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||bK,n||function(i){return r.outEdges(i)})},bK=ot.constant(1),xK=function(r,e,t){return ot.transform(r.nodes(),function(n,i){n[i]=hO(r,i,e,t)},{})},dO=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){ot.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){ot.has(n,o)||a(o)}),i},wK=function(r){return ot.filter(dO(r),function(e){return e.length>1||e.length===1&&r.hasEdge(e[0],e[0])})},EK=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||_K,t||function(n){return r.outEdges(n)})},_K=ot.constant(1),$g=vO;function vO(r){var e={},t={},n=[];if(ot.each(r.sinks(),function i(a){if(ot.has(t,a))throw new tv;ot.has(e,a)||(t[a]=!0,e[a]=!0,ot.each(r.predecessors(a),i),delete t[a],n.push(a))}),ot.size(e)!==r.nodeCount())throw new tv;return n}function tv(){}vO.CycleException=tv,tv.prototype=new Error;var aS=function(r,e,t){ot.isArray(e)||(e=[e]);var n=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return ot.each(e,function(o){if(!r.hasNode(o))throw new Error("Graph does not have node: "+o);pO(r,o,t==="post",a,n,i)}),i};function pO(r,e,t,n,i,a){ot.has(n,e)||(n[e]=!0,t||a.push(e),ot.each(i(e),function(o){pO(r,o,t,n,i,a)}),t&&a.push(e))}var rv,SK={Graph:iS.Graph,json:pK,alg:{components:mK,dijkstra:hO,dijkstraAll:xK,findCycles:wK,floydWarshall:EK,isAcyclic:function(r){try{$g(r)}catch(e){if(e instanceof $g.CycleException)return!1;throw e}return!0},postorder:function(r,e){return aS(r,e,"post")},preorder:function(r,e){return aS(r,e,"pre")},prim:function(r,e){var t,n=new T1,i={},a=new cO;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;ot.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(),ot.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:dO,topsort:$g},version:iS.version};try{rv=SK}catch{}rv||(rv=window.graphlib);var Ui=rv,MK=function(r){return BN(r,5)},Yl=function(r,e,t){if(!Un(t))return!1;var n=typeof e;return!!(n=="number"?Ya(t)&&Uv(e,t.length):n=="string"&&e in t)&&af(t[e],r)},gO=Object.prototype,CK=gO.hasOwnProperty,AK=Hv(function(r,e){r=Object(r);var t=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&Yl(e[0],e[1],i)&&(n=1);++t<n;)for(var a=e[t],o=Gs(a),s=-1,u=o.length;++s<u;){var f=o[s],l=r[f];(l===void 0||af(l,gO[f])&&!CK.call(r,f))&&(r[f]=a[f])}return r}),TK=function(r){return function(e,t,n){var i=Object(e);if(!Ya(e)){var a=Wa(t);e=ko(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}},IK=/^\s+|\s+$/g,kK=/^[-+]0x[0-9a-f]+$/i,LK=/^0b[01]+$/i,NK=/^0o[0-7]+$/i,OK=parseInt,DK=function(r){if(typeof r=="number")return r;if(Ps(r))return NaN;if(Un(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Un(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(IK,"");var t=LK.test(r);return t||NK.test(r)?OK(r.slice(2),t?2:8):kK.test(r)?NaN:+r},yd=function(r){return r?(r=DK(r))===1/0||r===-1/0?17976931348623157e292*(r<0?-1:1):r==r?r:0:r===0?r:0},PK=function(r){var e=yd(r),t=e%1;return e==e?t?e-t:e:0},RK=Math.max,BK=TK(function(r,e,t){var n=r==null?0:r.length;if(!n)return-1;var i=t==null?0:PK(t);return i<0&&(i=RK(n+i,0)),uO(r,Wa(e),i)}),yO=function(r){return r!=null&&r.length?A1(r):[]},FK=function(r,e){return r==null?r:E1(r,FN(e),Gs)},GK=function(r){var e=r==null?0:r.length;return e?r[e-1]:void 0},zK=function(r,e){var t={};return e=Wa(e),_1(r,function(n,i,a){zv(t,i,e(n,i,a))}),t},I1=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&&!Ps(o):t(o,s)))var s=o,u=a}return u},jK=function(r,e){return r>e},UK=function(r){return r&&r.length?I1(r,zs,jK):void 0},jy=function(r,e,t){(t!==void 0&&!af(r[e],t)||t===void 0&&!(e in r))&&zv(r,e,t)},$K=Function.prototype,XK=Object.prototype,mO=$K.toString,YK=XK.hasOwnProperty,WK=mO.call(Object),qK=function(r){if(!Bi(r)||Io(r)!="[object Object]")return!1;var e=Yv(r);if(e===null)return!0;var t=YK.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&mO.call(t)==WK},oS=function(r,e){if((e!=="constructor"||typeof r[e]!="function")&&e!="__proto__")return r[e]},VK=function(r){return nc(r,Gs(r))},HK=function(r,e,t,n,i,a,o){var s=oS(r,t),u=oS(e,t),f=o.get(u);if(f)jy(r,t,f);else{var l=void 0,c=l===void 0;if(c){var h=qr(u),d=!h&&Os(u),v=!h&&!d&&ic(u);l=u,h||d||v?qr(s)?l=s:fO(s)?l=IN(s):d?(c=!1,l=TN(u,!0)):v?(c=!1,l=DN(u,!0)):l=[]:qK(u)||Hu(u)?(l=s,Hu(s)?l=VK(s):Un(s)&&!rc(s)||(l=RN(u))):c=!1}c&&(o.set(u,l),i(l,u,n,a,o),o.delete(u)),jy(r,t,l)}},ZK=function r(e,t,n,i,a){e!==t&&E1(t,function(o,s){if(a||(a=new Ru),Un(o))HK(e,t,s,n,r,i,a);else{var u=void 0;u===void 0&&(u=o),jy(e,s,u)}},Gs)},KK=function(r){return Hv(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&&Yl(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){ZK(r,e,t)}),bO=function(r,e){return r<e},QK=function(r){return r&&r.length?I1(r,zs,bO):void 0},JK=function(r,e){return r&&r.length?I1(r,Wa(e),bO):void 0},eQ=function(){return ji.Date.now()},tQ=function(r,e,t,n){if(!Un(r))return r;for(var i=-1,a=(e=qv(e,r)).length,o=a-1,s=r;s!=null&&++i<a;){var u=ac(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=Un(l)?l:Uv(e[i+1])?[]:{})}jv(s,u,f),s=s[u]}return r},rQ=function(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],s=Vv(r,o);t(s,o)&&tQ(a,qv(o,r),s)}return a},nQ=function(r,e){return rQ(r,e,function(t,n){return HN(r,n)})},iQ=function(r){return sO(oO(r,void 0,yO),r+"")}(function(r,e){return r==null?{}:nQ(r,e)}),aQ=Math.ceil,oQ=Math.max,sQ=function(r,e,t,n){for(var i=-1,a=oQ(aQ((e-r)/(t||1)),0),o=Array(a);a--;)o[++i]=r,r+=t;return o},uQ=function(r){return function(e,t,n){return n&&typeof n!="number"&&Yl(e,t,n)&&(t=n=void 0),e=yd(e),t===void 0?(t=e,e=0):t=yd(t),n=n===void 0?e<t?1:-1:yd(n),sQ(e,t,n)}}(),fQ=function(r,e){var t=r.length;for(r.sort(e);t--;)r[t]=r[t].value;return r},lQ=function(r,e){if(r!==e){var t=r!==void 0,n=r===null,i=r==r,a=Ps(r),o=e!==void 0,s=e===null,u=e==e,f=Ps(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},cQ=function(r,e,t){for(var n=-1,i=r.criteria,a=e.criteria,o=i.length,s=t.length;++n<o;){var u=lQ(i[n],a[n]);if(u)return n>=s?u:u*(t[n]=="desc"?-1:1)}return r.index-e.index},hQ=function(r,e,t){e=e.length?Fu(e,function(a){return qr(a)?function(o){return Vv(o,a.length===1?a[0]:a)}:a}):[zs];var n=-1;e=Fu(e,$v(Wa));var i=eO(r,function(a,o,s){return{criteria:Fu(e,function(u){return u(a)}),index:++n,value:a}});return fQ(i,function(a,o){return cQ(a,o,t)})},dQ=Hv(function(r,e){if(r==null)return[];var t=e.length;return t>1&&Yl(r,e[0],e[1])?e=[]:t>2&&Yl(e[0],e[1],e[2])&&(e=[e[0]]),hQ(r,A1(e),[])}),vQ=0,pQ=function(r){var e=++vQ;return qN(r)+e},gQ=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},nv,yQ=function(r,e){return gQ(r||[],e||[],jv)};try{nv={cloneDeep:MK,constant:w1,defaults:AK,each:zN,filter:KN,find:BK,flatten:yO,forEach:GN,forIn:FK,has:QN,isUndefined:JN,last:GK,map:tO,mapValues:zK,max:UK,merge:KK,min:QK,minBy:JK,now:eQ,pick:iQ,range:uQ,reduce:rO,sortBy:dQ,uniqueId:pQ,values:lO,zipObject:yQ}}catch{}nv||(nv=window._);var ie=nv,mQ=md;function md(){var r={};r._next=r._prev=r,this._sentinel=r}function sS(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function bQ(r,e){if(r!=="_next"&&r!=="_prev")return e}md.prototype.dequeue=function(){var r=this._sentinel,e=r._prev;if(e!==r)return sS(e),e},md.prototype.enqueue=function(r){var e=this._sentinel;r._prev&&r._next&&sS(r),r._next=e._next,e._next._prev=r,e._next=r,r._prev=e},md.prototype.toString=function(){for(var r=[],e=this._sentinel,t=e._prev;t!==e;)r.push(JSON.stringify(t,bQ)),t=t._prev;return"["+r.join(", ")+"]"};var xQ=Ui.Graph,wQ=function(r,e){if(r.nodeCount()<=1)return[];var t=function(i,a){var o=new xQ,s=0,u=0;ie.forEach(i.nodes(),function(c){o.setNode(c,{v:c,in:0,out:0})}),ie.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=ie.range(u+s+3).map(function(){return new mQ}),l=s+1;return ie.forEach(o.nodes(),function(c){Uy(f,l,o.node(c))}),{graph:o,buckets:f,zeroIdx:l}}(r,e||EQ),n=function(i,a,o){for(var s,u=[],f=a[a.length-1],l=a[0];i.nodeCount();){for(;s=l.dequeue();)Xg(i,a,o,s);for(;s=f.dequeue();)Xg(i,a,o,s);if(i.nodeCount()){for(var c=a.length-2;c>0;--c)if(s=a[c].dequeue()){u=u.concat(Xg(i,a,o,s,!0));break}}}return u}(t.graph,t.buckets,t.zeroIdx);return ie.flatten(ie.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)},EQ=ie.constant(1);function Xg(r,e,t,n,i){var a=i?[]:void 0;return ie.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,Uy(e,t,u)}),ie.forEach(r.outEdges(n.v),function(o){var s=r.edge(o),u=o.w,f=r.node(u);f.in-=s,Uy(e,t,f)}),r.removeNode(n.v),a}function Uy(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 uS={run:function(r){var e=r.graph().acyclicer==="greedy"?wQ(r,function(t){return function(n){return t.edge(n).weight}}(r)):function(t){var n=[],i={},a={};function o(s){ie.has(a,s)||(a[s]=!0,i[s]=!0,ie.forEach(t.outEdges(s),function(u){ie.has(i,u.w)?n.push(u):o(u.w)}),delete i[s])}return ie.forEach(t.nodes(),o),n}(r);ie.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,ie.uniqueId("rev"))})},undo:function(r){ie.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)}})}},fS=Ui.Graph,En={addDummyNode:lS,simplify:function(r){var e=new fS().setGraph(r.graph());return ie.forEach(r.nodes(),function(t){e.setNode(t,r.node(t))}),ie.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 fS({multigraph:r.isMultigraph()}).setGraph(r.graph());return ie.forEach(r.nodes(),function(t){r.children(t).length||e.setNode(t,r.node(t))}),ie.forEach(r.edges(),function(t){e.setEdge(t,r.edge(t))}),e},successorWeights:function(r){var e=ie.map(r.nodes(),function(t){var n={};return ie.forEach(r.outEdges(t),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return ie.zipObject(r.nodes(),e)},predecessorWeights:function(r){var e=ie.map(r.nodes(),function(t){var n={};return ie.forEach(r.inEdges(t),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return ie.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=ie.map(ie.range(cS(r)+1),function(){return[]});return ie.forEach(r.nodes(),function(t){var n=r.node(t),i=n.rank;ie.isUndefined(i)||(e[i][n.order]=t)}),e},normalizeRanks:function(r){var e=ie.min(ie.map(r.nodes(),function(t){return r.node(t).rank}));ie.forEach(r.nodes(),function(t){var n=r.node(t);ie.has(n,"rank")&&(n.rank-=e)})},removeEmptyRanks:function(r){var e=ie.min(ie.map(r.nodes(),function(a){return r.node(a).rank})),t=[];ie.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;ie.forEach(t,function(a,o){ie.isUndefined(a)&&o%i!=0?--n:n&&ie.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),lS(r,"border",i,e)},maxRank:cS,partition:function(r,e){var t={lhs:[],rhs:[]};return ie.forEach(r,function(n){e(n)?t.lhs.push(n):t.rhs.push(n)}),t},time:function(r,e){var t=ie.now();try{return e()}finally{console.log(r+" time: "+(ie.now()-t)+"ms")}},notime:function(r,e){return e()}};function lS(r,e,t,n){var i;do i=ie.uniqueId(n);while(r.hasNode(i));return t.dummy=e,r.setNode(i,t),i}function cS(r){return ie.max(ie.map(r.nodes(),function(e){var t=r.node(e).rank;if(!ie.isUndefined(t))return t}))}var hS={run:function(r){r.graph().dummyChains=[],ie.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=En.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){ie.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)})}},xO=function(r){var e={};ie.forEach(r.sources(),function t(n){var i=r.node(n);if(ie.has(e,n))return i.rank;e[n]=!0;var a=ie.min(ie.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})},wO=function(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen},_Q=Ui.Graph,iv=wO,EO=function(r){var e,t,n=new _Q({directed:!1}),i=r.nodes()[0],a=r.nodeCount();for(n.setNode(i,{});SQ(n,r)<a;)e=MQ(n,r),t=n.hasNode(e.v)?iv(r,e):-iv(r,e),CQ(n,r,t);return n};function SQ(r,e){return ie.forEach(r.nodes(),function t(n){ie.forEach(e.nodeEdges(n),function(i){var a=i.v,o=n===a?i.w:a;r.hasNode(o)||iv(e,i)||(r.setNode(o,{}),r.setEdge(n,o,{}),t(o))})}),r.nodeCount()}function MQ(r,e){return ie.minBy(e.edges(),function(t){if(r.hasNode(t.v)!==r.hasNode(t.w))return iv(e,t)})}function CQ(r,e,t){ie.forEach(r.nodes(),function(n){e.node(n).rank+=t})}var AQ=wO,TQ=xO,IQ=Ui.alg.preorder,kQ=Ui.alg.postorder,LQ=En.simplify,NQ=vs;function vs(r){r=LQ(r),TQ(r);var e,t=EO(r);for(L1(t),k1(t,r);e=MO(t);)AO(t,r,e,CO(t,r,e))}function k1(r,e){var t=kQ(r,r.nodes());t=t.slice(0,t.length-1),ie.forEach(t,function(n){(function(i,a,o){var s=i.node(o).parent;i.edge(o,s).cutvalue=_O(i,a,o)})(r,e,n)})}function _O(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,ie.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 L1(r,e){arguments.length<2&&(e=r.nodes()[0]),SO(r,{},1,e)}function SO(r,e,t,n,i){var a=t,o=r.node(n);return e[n]=!0,ie.forEach(r.neighbors(n),function(s){ie.has(e,s)||(t=SO(r,e,t,s,n))}),o.low=a,o.lim=t++,i?o.parent=i:delete o.parent,t}function MO(r){return ie.find(r.edges(),function(e){return r.edge(e).cutvalue<0})}function CO(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=ie.filter(e.edges(),function(l){return u===dS(r,r.node(l.v),s)&&u!==dS(r,r.node(l.w),s)});return ie.minBy(f,function(l){return AQ(e,l)})}function AO(r,e,t,n){var i=t.v,a=t.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),L1(r),k1(r,e),function(o,s){var u=ie.find(o.nodes(),function(l){return!s.node(l).parent}),f=IQ(o,u);f=f.slice(1),ie.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 dS(r,e,t){return t.low<=e.lim&&e.lim<=t.lim}vs.initLowLimValues=L1,vs.initCutValues=k1,vs.calcCutValue=_O,vs.leaveEdge=MO,vs.enterEdge=CO,vs.exchangeEdges=AO;var TO=xO,OQ=function(r){switch(r.graph().ranker){case"network-simplex":vS(r);break;case"tight-tree":(function(e){TO(e),EO(e)})(r);break;case"longest-path":DQ(r);break;default:vS(r)}},DQ=TO;function vS(r){NQ(r)}var PQ=function(r){var e=function(t){var n={},i=0;function a(o){var s=i;ie.forEach(t.children(o),a),n[o]={low:s,lim:i++}}return ie.forEach(t.children(),a),n}(r);ie.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=[],x=Math.min(h[d].low,h[v].low),b=Math.max(h[d].lim,h[v].lim);p=d;do p=c.parent(p),y.push(p);while(p&&(h[p].low>x||b>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]}})},pS={run:function(r){var e=En.addDummyNode(r,"root",{},"_root"),t=function(o){var s={};function u(f,l){var c=o.children(f);c&&c.length&&ie.forEach(c,function(h){u(h,l+1)}),s[f]=l}return ie.forEach(o.children(),function(f){u(f,1)}),s}(r),n=ie.max(ie.values(t))-1,i=2*n+1;r.graph().nestingRoot=e,ie.forEach(r.edges(),function(o){r.edge(o).minlen*=i});var a=function(o){return ie.reduce(o.edges(),function(s,u){return s+o.edge(u).weight},0)}(r)+1;ie.forEach(r.children(),function(o){IO(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,ie.forEach(r.edges(),function(t){r.edge(t).nestingEdge&&r.removeEdge(t)})}};function IO(r,e,t,n,i,a,o){var s=r.children(o);if(s.length){var u=En.addBorderNode(r,"_bt"),f=En.addBorderNode(r,"_bb"),l=r.node(o);r.setParent(u,o),l.borderTop=u,r.setParent(f,o),l.borderBottom=f,ie.forEach(s,function(c){IO(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 RQ=function(r){ie.forEach(r.children(),function e(t){var n=r.children(t),i=r.node(t);if(n.length&&ie.forEach(n,e),ie.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)gS(r,"borderLeft","_bl",t,i,a),gS(r,"borderRight","_br",t,i,a)}})};function gS(r,e,t,n,i,a){var o={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=En.addDummyNode(r,"border",o,t);i[e][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})}var yS={adjust:function(r){var e=r.graph().rankdir.toLowerCase();e!=="lr"&&e!=="rl"||mS(r)},undo:function(r){var e=r.graph().rankdir.toLowerCase();e!=="bt"&&e!=="rl"||function(t){ie.forEach(t.nodes(),function(n){Yg(t.node(n))}),ie.forEach(t.edges(),function(n){var i=t.edge(n);ie.forEach(i.points,Yg),ie.has(i,"y")&&Yg(i)})}(r),e!=="lr"&&e!=="rl"||(function(t){ie.forEach(t.nodes(),function(n){Wg(t.node(n))}),ie.forEach(t.edges(),function(n){var i=t.edge(n);ie.forEach(i.points,Wg),ie.has(i,"x")&&Wg(i)})}(r),mS(r))}};function mS(r){ie.forEach(r.nodes(),function(e){bS(r.node(e))}),ie.forEach(r.edges(),function(e){bS(r.edge(e))})}function bS(r){var e=r.width;r.width=r.height,r.height=e}function Yg(r){r.y=-r.y}function Wg(r){var e=r.x;r.x=r.y,r.y=e}var BQ=function(r){var e={},t=ie.filter(r.nodes(),function(s){return!r.children(s).length}),n=ie.max(ie.map(t,function(s){return r.node(s).rank})),i=ie.map(ie.range(n+1),function(){return[]});function a(s){if(!ie.has(e,s)){e[s]=!0;var u=r.node(s);i[u.rank].push(s),ie.forEach(r.successors(s),a)}}var o=ie.sortBy(t,function(s){return r.node(s).rank});return ie.forEach(o,a),i},FQ=function(r,e){for(var t=0,n=1;n<e.length;++n)t+=GQ(r,e[n-1],e[n]);return t};function GQ(r,e,t){for(var n=ie.zipObject(t,ie.map(t,function(f,l){return l})),i=ie.flatten(ie.map(e,function(f){return ie.sortBy(ie.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=ie.map(new Array(o),function(){return 0}),u=0;return ie.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 zQ=function(r,e){return ie.map(e,function(t){var n=r.inEdges(t);if(n.length){var i=ie.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}})},jQ=function(r,e){var t={};return ie.forEach(r,function(n,i){var a=t[n.v]={indegree:0,in:[],out:[],vs:[n.v],i};ie.isUndefined(n.barycenter)||(a.barycenter=n.barycenter,a.weight=n.weight)}),ie.forEach(e.edges(),function(n){var i=t[n.v],a=t[n.w];ie.isUndefined(i)||ie.isUndefined(a)||(a.indegree++,i.out.push(t[n.w]))}),function(n){var i=[];function a(u){return function(f){f.merged||(ie.isUndefined(f.barycenter)||ie.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),ie.forEach(s.in.reverse(),a(s)),ie.forEach(s.out,o(s))}return ie.map(ie.filter(i,function(u){return!u.merged}),function(u){return ie.pick(u,["vs","i","barycenter","weight"])})}(ie.filter(t,function(n){return!n.indegree}))},UQ=function(r,e){var t=En.partition(r,function(c){return ie.has(c,"barycenter")}),n=t.lhs,i=ie.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=xS(a,i,u),ie.forEach(n,function(c){u+=c.vs.length,a.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=xS(a,i,u)});var f,l={vs:ie.flatten(a,!0)};return s&&(l.barycenter=o/s,l.weight=s),l};function xS(r,e,t){for(var n;e.length&&(n=ie.last(e)).i<=t;)e.pop(),r.push(n.vs),t++;return t}var $Q=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=ie.filter(a,function(p){return p!==s&&p!==u}));var l=zQ(e,a);ie.forEach(l,function(p){if(e.children(p.v).length){var g=r(e,p.v,n,i);f[p.v]=g,ie.has(g,"barycenter")&&(y=p,m=g,ie.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=jQ(l,n);(function(p,g){ie.forEach(p,function(y){y.vs=ie.flatten(y.vs.map(function(m){return g[m]?g[m].vs:m}),!0)})})(c,f);var h=UQ(c,i);if(s&&(h.vs=ie.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]);ie.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},XQ=Ui.Graph,YQ=function(r,e,t){var n=function(a){for(var o;a.hasNode(o=ie.uniqueId("_root")););return o}(r),i=new XQ({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return ie.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),ie.forEach(r[t](a),function(u){var f=u.v===a?u.w:u.v,l=i.edge(f,a),c=ie.isUndefined(l)?0:l.weight;i.setEdge(f,a,{weight:r.edge(u).weight+c})}),ie.has(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),i},WQ=function(r,e,t){var n,i={};ie.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}})},qQ=Ui.Graph,VQ=function(r){var e=En.maxRank(r),t=wS(r,ie.range(1,e+1),"inEdges"),n=wS(r,ie.range(e-1,-1,-1),"outEdges"),i=BQ(r);ES(r,i);for(var a,o=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){HQ(s%2?t:n,s%4>=2),i=En.buildLayerMatrix(r);var f=FQ(r,i);f<o&&(u=0,a=ie.cloneDeep(i),o=f)}ES(r,a)};function wS(r,e,t){return ie.map(e,function(n){return YQ(r,n,t)})}function HQ(r,e){var t=new qQ;ie.forEach(r,function(n){var i=n.graph().root,a=$Q(n,i,t,e);ie.forEach(a.vs,function(o,s){n.node(o).order=s}),WQ(n,t,a.vs)})}function ES(r,e){ie.forEach(e,function(t){ie.forEach(t,function(n,i){r.node(n).order=i})})}var ZQ=Ui.Graph,KQ=function(r){var e,t=En.buildLayerMatrix(r),n=ie.merge(QQ(r,t),JQ(r,t)),i={};ie.forEach(["u","d"],function(o){e=o==="u"?t:ie.values(t).reverse(),ie.forEach(["l","r"],function(s){s==="r"&&(e=ie.map(e,function(c){return ie.values(c).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),f=tJ(r,e,n,u),l=rJ(r,e,f.root,f.align,s==="r");s==="r"&&(l=ie.mapValues(l,function(c){return-c})),i[o+s]=l})});var a=nJ(r,i);return iJ(i,a),aJ(i,r.graph().align)};function QQ(r,e){var t={};return ie.reduce(e,function(n,i){var a=0,o=0,s=n.length,u=ie.last(i);return ie.forEach(i,function(f,l){var c=function(d,v){if(d.node(v).dummy)return ie.find(d.predecessors(v),function(p){return d.node(p).dummy})}(r,f),h=c?r.node(c).order:s;(c||f===u)&&(ie.forEach(i.slice(o,l+1),function(d){ie.forEach(r.predecessors(d),function(v){var p=r.node(v),g=p.order;!(g<a||h<g)||p.dummy&&r.node(d).dummy||kO(t,v,d)})}),o=l+1,a=h)}),i}),t}function JQ(r,e){var t={};function n(i,a,o,s,u){var f;ie.forEach(ie.range(a,o),function(l){f=i[l],r.node(f).dummy&&ie.forEach(r.predecessors(f),function(c){var h=r.node(c);h.dummy&&(h.order<s||h.order>u)&&kO(t,c,f)})})}return ie.reduce(e,function(i,a){var o,s=-1,u=0;return ie.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 kO(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 eJ(r,e,t){if(e>t){var n=e;e=t,t=n}return ie.has(r[e],t)}function tJ(r,e,t,n){var i={},a={},o={};return ie.forEach(e,function(s){ie.forEach(s,function(u,f){i[u]=u,a[u]=u,o[u]=f})}),ie.forEach(e,function(s){var u=-1;ie.forEach(s,function(f){var l=n(f);if(l.length)for(var c=((l=ie.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]&&!eJ(t,f,v)&&(a[v]=f,a[f]=i[f]=i[v],u=o[v])}})}),{root:i,align:a}}function rJ(r,e,t,n,i){var a={},o=function(f,l,c,h){var d=new ZQ,v=f.graph(),p=function(g,y,m){return function(x,b,w){var E,S=x.node(b),_=x.node(w),C=0;if(C+=S.width/2,ie.has(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":E=-S.width/2;break;case"r":E=S.width/2}if(E&&(C+=m?E:-E),E=0,C+=(S.dummy?y:g)/2,C+=(_.dummy?y:g)/2,C+=_.width/2,ie.has(_,"labelpos"))switch(_.labelpos.toLowerCase()){case"l":E=_.width/2;break;case"r":E=-_.width/2}return E&&(C+=m?E:-E),E=0,C}}(v.nodesep,v.edgesep,h);return ie.forEach(l,function(g){var y;ie.forEach(g,function(m){var x=c[m];if(d.setNode(x),y){var b=c[y],w=d.edge(b,x);d.setEdge(b,x,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)),ie.forEach(n,function(f){a[f]=a[t[f]]}),a}function nJ(r,e){return ie.minBy(ie.values(e),function(t){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return ie.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 iJ(r,e){var t=ie.values(e),n=ie.min(t),i=ie.max(t);ie.forEach(["u","d"],function(a){ie.forEach(["l","r"],function(o){var s,u=a+o,f=r[u];if(f!==e){var l=ie.values(f);(s=o==="l"?n-ie.min(l):i-ie.max(l))&&(r[u]=ie.mapValues(f,function(c){return c+s}))}})})}function aJ(r,e){return ie.mapValues(r.ul,function(t,n){if(e)return r[e.toLowerCase()][n];var i=ie.sortBy(ie.map(r,n));return(i[1]+i[2])/2})}var oJ=KQ,sJ=function(r){(function(e){var t=En.buildLayerMatrix(e),n=e.graph().ranksep,i=0;ie.forEach(t,function(a){var o=ie.max(ie.map(a,function(s){return e.node(s).height}));ie.forEach(a,function(s){e.node(s).y=i+o/2}),i+=o+n})})(r=En.asNonCompoundGraph(r)),ie.forEach(oJ(r),function(e,t){r.node(t).x=e})},uJ=En.normalizeRanks,fJ=En.removeEmptyRanks,so=En,lJ=Ui.Graph,cJ=function(r,e){var t=e&&e.debugTiming?so.time:so.notime;t("layout",function(){var n=t(" buildLayoutGraph",function(){return function(i){var a=new lJ({multigraph:!0,compound:!0}),o=Vg(i.graph());return a.setGraph(ie.merge({},dJ,qg(o,hJ),ie.pick(o,vJ))),ie.forEach(i.nodes(),function(s){var u=Vg(i.node(s));a.setNode(s,ie.defaults(qg(u,pJ),gJ)),a.setParent(s,i.parent(s))}),ie.forEach(i.edges(),function(s){var u=Vg(i.edge(s));a.setEdge(s,ie.merge({},mJ,qg(u,yJ),ie.pick(u,bJ)))}),a}(r)});t(" runLayout",function(){(function(i,a){a(" makeSpaceForEdgeLabels",function(){(function(o){var s=o.graph();s.ranksep/=2,ie.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){ie.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(){uS.run(i)}),a(" nestingGraph.run",function(){pS.run(i)}),a(" rank",function(){OQ(so.asNonCompoundGraph(i))}),a(" injectEdgeLabelProxies",function(){(function(o){ie.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};so.addDummyNode(o,"edge-proxy",l,"_ep")}})})(i)}),a(" removeEmptyRanks",function(){fJ(i)}),a(" nestingGraph.cleanup",function(){pS.cleanup(i)}),a(" normalizeRanks",function(){uJ(i)}),a(" assignRankMinMax",function(){(function(o){var s=0;ie.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=ie.max(s,f.maxRank))}),o.graph().maxRank=s})(i)}),a(" removeEdgeLabelProxies",function(){(function(o){ie.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(){hS.run(i)}),a(" parentDummyChains",function(){PQ(i)}),a(" addBorderSegments",function(){RQ(i)}),a(" order",function(){VQ(i)}),a(" insertSelfEdges",function(){(function(o){var s=so.buildLayerMatrix(o);ie.forEach(s,function(u){var f=0;ie.forEach(u,function(l,c){var h=o.node(l);h.order=c+f,ie.forEach(h.selfEdges,function(d){so.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(){yS.adjust(i)}),a(" position",function(){sJ(i)}),a(" positionSelfEdges",function(){(function(o){ie.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){ie.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(ie.last(u.borderLeft)),h=o.node(ie.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}}),ie.forEach(o.nodes(),function(s){o.node(s).dummy==="border"&&o.removeNode(s)})})(i)}),a(" normalize.undo",function(){hS.undo(i)}),a(" fixupEdgeLabelCoords",function(){(function(o){ie.forEach(o.edges(),function(s){var u=o.edge(s);if(ie.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(){yS.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,x=p.height;s=Math.min(s,g-m/2),u=Math.max(u,g+m/2),f=Math.min(f,y-x/2),l=Math.max(l,y+x/2)}ie.forEach(o.nodes(),function(p){v(o.node(p))}),ie.forEach(o.edges(),function(p){var g=o.edge(p);ie.has(g,"x")&&v(g)}),s-=h,f-=d,ie.forEach(o.nodes(),function(p){var g=o.node(p);g.x-=s,g.y-=f}),ie.forEach(o.edges(),function(p){var g=o.edge(p);ie.forEach(g.points,function(y){y.x-=s,y.y-=f}),ie.has(g,"x")&&(g.x-=s),ie.has(g,"y")&&(g.y-=f)}),c.width=u-s+h,c.height=l-f+d})(i)}),a(" assignNodeIntersects",function(){(function(o){ie.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(so.intersectRect(c,u)),l.points.push(so.intersectRect(h,f))})})(i)}),a(" reversePoints",function(){(function(o){ie.forEach(o.edges(),function(s){var u=o.edge(s);u.reversed&&u.points.reverse()})})(i)}),a(" acyclic.undo",function(){uS.undo(i)})})(n,t)}),t(" updateInputGraph",function(){(function(i,a){ie.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))}),ie.forEach(i.edges(),function(o){var s=i.edge(o),u=a.edge(o);s.points=u.points,ie.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)})})},hJ=["nodesep","edgesep","ranksep","marginx","marginy"],dJ={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},vJ=["acyclicer","ranker","rankdir","align"],pJ=["width","height"],gJ={width:0,height:0},yJ=["minlen","weight","width","height","labeloffset"],mJ={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},bJ=["labelpos"];function qg(r,e){return ie.mapValues(ie.pick(r,e),Number)}function Vg(r){var e={};return ie.forEach(r,function(t,n){e[n.toLowerCase()]=t}),e}var xJ=Ui.Graph,LO={graphlib:Ui,layout:cJ,debug:{debugOrdering:function(r){var e=En.buildLayerMatrix(r),t=new xJ({compound:!0,multigraph:!0}).setGraph({});return ie.forEach(r.nodes(),function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+r.node(n).rank)}),ie.forEach(r.edges(),function(n){t.setEdge(n.v,n.w,{},n.name)}),ie.forEach(e,function(n,i){var a="layer"+i;t.setNode(a,{rank:"same"}),ie.reduce(n,function(o,s){return t.setEdge(o,s,{style:"invis"}),s})}),t}},util:{time:En.time,notime:En.notime},version:"0.8.5"},wJ=LO.graphlib,EJ=LO.layout;class _J{constructor(e){this.cardinality=1,this.include=Ns.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 SJ{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}function MJ(r){const e=new SJ;return r.nodes.map(t=>new _J(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 CJ{constructor(e,t={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=Ns.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=Fn.META,this.path=[],this.name=e,this.metaGraph=N1(e,Vu.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 AJ{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 NO(r,e={}){return new CJ(r,e)}function OO(r,e){return new AJ(r,e)}function N1(r,e,t){const n=t||{},i=new wJ.Graph(n);return i.setGraph({name:r,rankdir:n.rankdir,type:e,align:n.align}),i}class TJ{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=NO(qu,this.graphOptions),this.index[qu]=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=N1(EN,Vu.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=OO(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 _S(a,e,t,n),_S(o,e,t,n),n}}function IJ(r,e){const{rankDirection:t,align:n}=e,i=new TJ({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=NO(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=OO(p,g),v.metaGraph.setEdge(p,g,y)),y.addBaseEdge(c,a)})}(i,r),i}function _S(r,e,t,n){(t?r.inEdges(e.name):r.outEdges(e.name)).forEach(i=>{const a=r.edge(i);n.push(a)})}class kJ{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new MS(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 SS(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 x=a.node(m);if(!x){let w=a.node(y);if(!w){const S={name:y,type:Fn.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:Ns.UNSPECIFIED,inbound:h,attr:{}};w=new bd(S),this.index[y]=w,a.setNode(y,w)}const E={name:m,type:Fn.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:Ns.UNSPECIFIED,inbound:h,attr:{}};x=new bd(E),this.index[m]=x,a.setNode(m,x),a.setParent(m,y),w.node.cardinality++}const b=new SS(c);b.adjoiningMetaEdge=g,h?a.setEdge(m,d,b):a.setEdge(d,m,b)})}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 MS(t,this.hierarchy.graphOptions):new bd(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class bd{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 SS{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class MS extends bd{constructor(e,t){super(e);const n=e.metaGraph.graph();t.compound=!0,this.coreGraph=N1(n.name,Vu.CORE,t)}}function DO(r,e){r.node.isGroupNode&&function(t,n){const i=Oy(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?DO(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=Oy(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 x=[];if(d.nodes().forEach(_=>{d.node(_).node.type!==Fn.BRIDGE&&x.push(_)}),!x.length)return{width:0,height:0};EJ(d);let b=1/0,w=1/0,E=-1/0,S=-1/0;return x.forEach(_=>{const C=d.node(_),M=.5*C.width,A=C.x-M,T=C.x+M;b=A<b?A:b,E=T>E?T:E;const I=.5*C.height,L=C.y-I,N=C.y+I;w=L<w?L:w,S=N>S?N:S}),d.edges().forEach(_=>{const C=d.edge(_),M=d.node(C.metaEdge.v),A=d.node(C.metaEdge.w);if(C.points.length===3&&function(L){let N=CS(L[0],L[1]);for(let O=1;O<L.length-1;O++){const B=CS(L[O],L[O+1]);if(Math.abs(B-N)>1)return!1;N=B}return!0}(C.points)){if(M!=null){const L=M.expanded?M.x:$y(M);C.points[0].x=L}if(A!=null){const L=A.expanded?A.x:$y(A);C.points[2].x=L}C.points=[C.points[0],C.points[1]]}const T=C.points[C.points.length-2];A!=null&&(C.points[C.points.length-1]=AS(T,A));const I=C.points[1];M!=null&&(C.points[0]=AS(I,M)),C.points.forEach(L=>{b=L.x<b?L.x:b,E=L.x>E?L.x:E,w=L.y<w?L.y:w,S=L.y>S?L.y:S})}),d.nodes().forEach(_=>{const C=d.node(_);C.x-=b,C.y-=w}),d.edges().forEach(_=>{d.edge(_).points.forEach(C=>{C.x-=b,C.y-=w})}),{width:E-b,height:S-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 CS(r,e){const t=e.x-r.x,n=e.y-r.y;return 180*Math.atan(n/t)/Math.PI}function $y(r){return r.expanded?r.x:r.x-r.width/2+0+r.coreBox.width/2}function AS(r,e){const t=e.expanded?e.x:$y(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 LJ(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,x=[])=>{if(p.has(m))return p.get(m);for(let b=0;b<v.length;b++){let w=v[b];if(d&&d[w].indexOf(m)!==-1)return x.unshift(w),g(w,x)}return x.length===0&&p.set(m,x),x},y=m=>c.edges.filter(x=>x.w===m).map(x=>({name:x.v}));return c.nodes.forEach(m=>{const x=m.id,b=[...g(x),x];let w=y(x);h.nodes.push({name:x,path:b,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(x=>[x,p[x]])),m={};for(let[x,b]of y)d(x,y)?m[x]=b:g=g.concat(x,b);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 kJ(d)}(IJ(MJ(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)||Kd.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)||Kd.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),DO(l.root,t),PO(l.root)}function NJ(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!==qu&&(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 OJ(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=[qu,...s].slice(0,s.length).reverse(),l=[qu,...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 PO(r){const e=r.coreGraph.nodes().map(n=>r.coreGraph.node(n));return Object.assign(Object.assign({},TS(r)),{expanded:r.expanded,nodes:r.expanded?(t=e,t.map(n=>n.node.type===Fn.META?PO(n):TS(n))):[],edges:r.expanded?DJ(r):[]});var t}function TS(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 DJ(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 PJ=Object.freeze(Object.defineProperty({__proto__:null,BRIDGE_GRAPH_NAME:EN,get GraphType(){return Vu},get HierarchyNodeType(){return Dy},get InclusionType(){return Ns},LAYOUT_CONFIG:Kd,get NodeType(){return Fn},ROOT_NAME:qu,buildGraph:LJ,flatGraph:NJ,getEdges:OJ,mergeConfig:Oy},Symbol.toStringTag,{value:"Module"})),RJ=da(PJ);var IS;function RO(){if(IS)return Ci;IS=1;var r=Ci&&Ci.__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=Ci&&Ci.__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)},t=Ci&&Ci.__spreadArray||function(s,u,f){if(f||arguments.length===2)for(var l=0,c=u.length,h;l<c;l++)(h||!(l in u))&&(h||(h=Array.prototype.slice.call(u,0,l)),h[l]=u[l]);return s.concat(h||Array.prototype.slice.call(u))};Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.DagreCompoundLayout=void 0;var n=ln(),i=RJ,a=$r(),o=function(s){r(u,s);function u(f){var l=s.call(this)||this;return l.rankdir="TB",l.nodesep=50,l.edgesep=5,l.ranksep=50,l.controlPoints=!0,l.anchorPoint=!0,l.nodes=[],l.edges=[],l.combos=[],l.onLayoutEnd=function(){},l.updateCfg(f),l}return u.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,begin:void 0,nodeSize:void 0,nodesep:50,ranksep:50,controlPoints:!0,anchorPoint:!0}},u.prototype.init=function(f){var l=f.hiddenNodes||[],c=f.hiddenEdges||[],h=f.hiddenCombos||[];this.nodes=this.getDataByOrder((f.nodes||[]).concat(l)),this.edges=this.getDataByOrder((f.edges||[]).concat(c)),this.combos=(f.combos||[]).concat(h.map(function(d){return e(e({},d),{collapsed:!0})}))},u.prototype.execute=function(){var f=this,l=f.nodes,c=f.edges;if(l){var h=f.getLayoutConfig(),d=h.graphDef,v=h.graphOption,p=h.graphSettings,g=(0,i.buildGraph)(d,v,p),y=(0,i.flatGraph)(g,!0);return this.updatePosition(y),f.onLayoutEnd&&f.onLayoutEnd(),{nodes:l,edges:c}}},u.prototype.getNodePath=function(f){var l=this,c=l.nodes,h=l.combos,d=c.find(function(p){return p.id===f}),v=function(p,g){g===void 0&&(g=[]);var y=h.find(function(m){return m.id===p});return y?(g.unshift(p),y.parentId?v(y.parentId,g):g):g};return d&&d.comboId?v(d.comboId,[f]):[f]},u.prototype.getLayoutConfig=function(){var f,l,c,h=this,d=h.nodes,v=h.edges,p=h.combos,g=h.nodeSize,y=h.rankdir,m=h.align,x=h.edgesep,b=h.nodesep,w=h.ranksep,E=h.settings,S=(p||[]).reduce(function(Y,ee){var U=d.filter(function(K){return K.comboId===ee.id}).map(function(K){return K.id}),Z=(p||[]).filter(function(K){return K.parentId===ee.id}).map(function(K){return K.id});return(U.length||Z.length)&&(Y[ee.id]=t(t([],U,!0),Z,!0)),Y},{}),_;g?(0,a.isArray)(g)?_=function(){return g}:_=function(){return[g,g]}:_=function(Y){return Y&&Y.size?(0,a.isArray)(Y.size)?Y.size:(0,a.isObject)(Y.size)?[Y.size.width||40,Y.size.height||40]:[Y.size,Y.size]:[40,40]};var C=function(Y){return Y&&Y.size?(0,a.isArray)(Y.size)?Y.size:[Y.size,Y.size]:[80,40]},M=C(p==null?void 0:p[0]),A=M[0],T=M[1],I=(l=(f=h.graphSettings)===null||f===void 0?void 0:f.subScene)===null||l===void 0?void 0:l.meta,L=((c=p.find(function(Y){return!Y.collapsed}))===null||c===void 0?void 0:c.padding)||[20,20,20,20],N=L[0],O=L[1],B=L[2],W=L[3],D={compound:S,nodes:t([],(d||[]).map(function(Y){var ee=_(Y),U=ee[0],Z=ee[1];return e(e({},Y),{width:U,height:Z})}),!0),edges:t([],(v||[]).map(function(Y){return e(e({},Y),{v:Y.source,w:Y.target})}),!0)},P={expanded:(p||[]).filter(function(Y){return!Y.collapsed}).map(function(Y){return Y.id})},R={graph:{meta:{align:m,rankDir:y,nodeSep:b,edgeSep:x,rankSep:w}},subScene:{meta:{paddingTop:N||(I==null?void 0:I.paddingTop)||20,paddingRight:O||(I==null?void 0:I.paddingRight)||20,paddingBottom:B||(I==null?void 0:I.paddingBottom)||20,paddingLeft:W||(I==null?void 0:I.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:A,height:T}}},X=(0,i.mergeConfig)(E,e({},(0,i.mergeConfig)(R,i.LAYOUT_CONFIG)));return h.graphSettings=X,{graphDef:D,graphOption:P,graphSettings:X}},u.prototype.updatePosition=function(f){var l=f.nodes,c=f.edges;this.updateNodePosition(l,c),this.updateEdgePosition(l,c)},u.prototype.getBegin=function(f,l){var c=this,h=c.begin,d=[0,0];if(h){var v=1/0,p=1/0;f.forEach(function(g){v>g.x&&(v=g.x),p>g.y&&(p=g.y)}),l.forEach(function(g){g.points.forEach(function(y){v>y.x&&(v=y.x),p>y.y&&(p=y.y)})}),d[0]=h[0]-v,d[1]=h[1]-p}return d},u.prototype.updateNodePosition=function(f,l){var c=this,h=c.combos,d=c.nodes,v=c.edges,p=c.anchorPoint,g=c.graphSettings,y=this.getBegin(f,l);f.forEach(function(m){var x,b=m.x,w=m.y,E=m.id,S=m.type,_=m.coreBox;if(S===i.HierarchyNodeType.META&&E!==i.ROOT_NAME){var C=h.findIndex(function(L){return L.id===E}),M=(x=g==null?void 0:g.subScene)===null||x===void 0?void 0:x.meta;h[C].offsetX=b+y[0],h[C].offsetY=w+y[1],h[C].fixSize=[_.width,_.height],h[C].fixCollapseSize=[_.width,_.height],m.expanded?h[C].padding=[M==null?void 0:M.paddingTop,M==null?void 0:M.paddingRight,M==null?void 0:M.paddingBottom,M==null?void 0:M.paddingLeft]:h[C].padding=[0,0,0,0]}else if(S===i.HierarchyNodeType.OP){var C=d.findIndex(function(N){return N.id===E});if(d[C].x=b+y[0],d[C].y=w+y[1],p){var A=[],T=l.filter(function(N){return N.v===E}),I=l.filter(function(N){return N.w===E});T.length>0&&T.forEach(function(N){var O=N.points[0],B=(O.x-b)/m.width+.5,W=(O.y-w)/m.height+.5;A.push([B,W]),N.baseEdgeList.forEach(function(D){var P=v.find(function(R){return R.source===D.v&&R.target===D.w});P&&(P.sourceAnchor=A.length-1)})}),I.length>0&&I.forEach(function(N){var O=N.points[N.points.length-1],B=(O.x-b)/m.width+.5,W=(O.y-w)/m.height+.5;A.push([B,W]),N.baseEdgeList.forEach(function(D){var P=v.find(function(R){return R.source===D.v&&R.target===D.w});P&&(P.targetAnchor=A.length-1)})}),d[C].anchorPoints=A.length>0?A:d[C].anchorPoints||[]}}})},u.prototype.updateEdgePosition=function(f,l){var c=this,h=c.combos,d=c.edges,v=c.controlPoints,p=this.getBegin(f,l);v&&(h.forEach(function(g){g.inEdges=[],g.outEdges=[]}),d.forEach(function(g){var y,m,x,b,w=f.find(function(L){return L.id===g.source}),E=f.find(function(L){return L.id===g.target}),S=[],_=[];if(w&&E)_=(0,i.getEdges)(w==null?void 0:w.id,E==null?void 0:E.id,f);else if(!w||!E){var C=c.getNodePath(g.source),M=c.getNodePath(g.target),A=C.reverse().slice(w?0:1).find(function(L){return f.find(function(N){return N.id===L})}),T=M.reverse().slice(E?0:1).find(function(L){return f.find(function(N){return N.id===L})});w=f.find(function(L){return L.id===A}),E=f.find(function(L){return L.id===T}),_=(0,i.getEdges)(w==null?void 0:w.id,E==null?void 0:E.id,f,{v:g.source,w:g.target})}if(S=_.reduce(function(L,N){return t(t([],L,!0),N.points.map(function(O){return e(e({},O),{x:O.x+p[0],y:O.y+p[1]})}),!0)},[]),S=S.slice(1,-1),g.controlPoints=S,(E==null?void 0:E.type)===i.NodeType.META){var I=h.findIndex(function(L){return L.id===(E==null?void 0:E.id)});if(!h[I]||!((y=h[I].inEdges)===null||y===void 0)&&y.some(function(L){return L.source===w.id&&L.target===E.id}))return;(m=h[I].inEdges)===null||m===void 0||m.push({source:w.id,target:E.id,controlPoints:S})}if((w==null?void 0:w.type)===i.NodeType.META){var I=h.findIndex(function(N){return N.id===(w==null?void 0:w.id)});if(!h[I]||!((x=h[I].outEdges)===null||x===void 0)&&x.some(function(N){return N.source===w.id&&N.target===E.id}))return;(b=h[I].outEdges)===null||b===void 0||b.push({source:w.id,target:E.id,controlPoints:S})}}))},u.prototype.getType=function(){return"dagreCompound"},u.prototype.getDataByOrder=function(f){return f.every(function(l){return l.layoutOrder!==void 0})||f.forEach(function(l,c){l.layoutOrder=c}),f.sort(function(l,c){return l.layoutOrder-c.layoutOrder})},u}(n.Base);return Ci.DagreCompoundLayout=o,Ci}var is={},Ia={},Ph={};const BJ=Object.prototype.toString;function av(r){const e=BJ.call(r);return e.endsWith("Array]")&&!e.includes("Big")}function FJ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!av(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 GJ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!av(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 kS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(av(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(!av(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(r.length);var n=GJ(r),i=FJ(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 Rh=" ".repeat(2),BO=" ".repeat(4);function zJ(){return FO(this)}function FO(r,e={}){const{maxRows:t=15,maxColumns:n=10,maxNumSize:i=8}=e;return`${r.constructor.name} {
|
|
34
|
+
${Rh}[
|
|
35
|
+
${BO}${jJ(r,t,n,i)}
|
|
36
|
+
${Rh}]
|
|
37
|
+
${Rh}rows: ${r.rows}
|
|
38
|
+
${Rh}columns: ${r.columns}
|
|
39
|
+
}`}function jJ(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(UJ(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(`
|
|
40
|
+
${BO}`)}function UJ(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 $J(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 si(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 ui(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 Au(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 Tu(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 GO(r,e,t){return{row:zO(r,e),column:jO(r,t)}}function zO(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 jO(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 Xy(r,e,t,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Bh("startRow",e),Bh("endRow",t),Bh("startColumn",n),Bh("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 Zv(r,e=0){let t=[];for(let n=0;n<r;n++)t.push(e);return t}function Bh(r,e){if(typeof e!="number")throw new TypeError(`${r} must be a number`)}function XJ(r){let e=Zv(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 YJ(r){let e=Zv(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 WJ(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 qJ(r){let e=Zv(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 VJ(r){let e=Zv(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 HJ(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 ZJ(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 KJ(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 QJ(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 JJ(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 eee(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 tee(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 ree(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 nee(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 iee(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 aee(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 oee(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 see(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 rr{static from1DArray(e,t,n){if(e*t!==n.length)throw new RangeError("data length does not match given dimensions");let a=new vt(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 vt(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 vt(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 vt(e,t)}static ones(e,t){return new vt(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 vt(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 vt(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 vt(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 rr.isMatrix(e)?e:new vt(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 vt(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){si(this,e);let t=[];for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}getRowVector(e){return vt.rowVector(this.getRow(e))}setRow(e,t){si(this,e),t=Au(this,t);for(let n=0;n<this.columns;n++)this.set(e,n,t[n]);return this}swapRows(e,t){si(this,e),si(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){ui(this,e);let t=[];for(let n=0;n<this.rows;n++)t.push(this.get(n,e));return t}getColumnVector(e){return vt.columnVector(this.getColumn(e))}setColumn(e,t){ui(this,e),t=Tu(this,t);for(let n=0;n<this.rows;n++)this.set(n,e,t[n]);return this}swapColumns(e,t){ui(this,e),ui(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=Au(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=Au(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=Au(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=Au(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=Tu(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=Tu(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=Tu(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=Tu(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){si(this,e);for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this}mulColumn(e,t){ui(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){si(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){si(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){si(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){si(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){ui(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){ui(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){ui(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){ui(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){rr.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=vt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.columns,a=new vt(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=vt.checkMatrix(e);let t=new vt(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,x=d+p,b=h+v,w=c-h+d+g;return t.set(0,0,m),t.set(0,1,x),t.set(1,0,b),t.set(1,1,w),t}strassen3x3(e){e=vt.checkMatrix(e);let t=new vt(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),x=e.get(2,1),b=e.get(2,2),w=(n+i+a-o-s-l-c)*g,E=(n-o)*(-d+g),S=s*(-h+d+p-g-y-m+b),_=(-n+o+s)*(h-d+g),C=(o+s)*(-h+d),M=n*h,A=(-n+f+l)*(h-v+y),T=(-n+f)*(v-y),I=(f+l)*(-h+v),L=(n+i+a-s-u-f-l)*y,N=l*(-h+v+p-g-y-m+x),O=(-a+l+c)*(g+m-x),B=(a-c)*(g-x),W=a*m,D=(l+c)*(-m+x),P=(-a+s+u)*(y+m-b),R=(a-u)*(y-b),X=(s+u)*(-m+b),Y=i*p,ee=u*x,U=o*v,Z=f*d,K=c*b,se=M+W+Y,re=w+_+C+M+O+W+D,J=M+A+I+L+W+P+X,me=E+S+_+M+W+P+R,Ae=E+_+C+M+ee,Ye=W+P+R+X+U,Ve=M+A+T+N+O+B+W,Ke=O+B+W+D+Z,xt=M+A+T+I+K;return t.set(0,0,se),t.set(0,1,re),t.set(0,2,J),t.set(1,0,me),t.set(1,1,Ae),t.set(1,2,Ye),t.set(2,0,Ve),t.set(2,1,Ke),t.set(2,2,xt),t}mmulStrassen(e){e=vt.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=rr.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),x=c.subMatrix(0,p-1,g,c.columns-1),b=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),S=c.subMatrix(p,c.rows-1,g,c.columns-1),_=h.subMatrix(p,h.rows-1,g,h.columns-1),C=l(rr.add(y,S),rr.add(m,_),p,g),M=l(rr.add(w,S),m,p,g),A=l(y,rr.sub(b,_),p,g),T=l(S,rr.sub(E,m),p,g),I=l(rr.add(y,x),_,p,g),L=l(rr.sub(w,y),rr.add(m,b),p,g),N=l(rr.sub(x,S),rr.add(E,_),p,g),O=rr.add(C,T);O.sub(I),O.add(N);let B=rr.add(A,I),W=rr.add(M,T),D=rr.sub(C,M);D.add(A),D.add(L);let P=rr.zeros(2*O.rows,2*O.columns);return P=P.setSubMatrix(O,0,0),P=P.setSubMatrix(B,O.rows,0),P=P.setSubMatrix(W,0,O.columns),P=P.setSubMatrix(D,O.rows,O.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 vt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const o=this.getRow(a);kS(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 vt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const o=this.getColumn(a);kS(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=vt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.rows,a=e.columns,o=new vt(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 vt(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=LS){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=LS){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,n,i){Xy(this,e,t,n,i);let a=new vt(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 vt(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 vt(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=vt.checkMatrix(e);let i=t+e.rows-1,a=n+e.columns-1;Xy(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=GO(this,e,t),i=new vt(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 vt(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 XJ(this);case"column":return YJ(this);case void 0:return WJ(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return qJ(this);case"column":return VJ(this);case void 0:return HJ(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 ZJ(this,n,i)}case"column":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return KJ(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return QJ(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 JJ(this,n),this}case"column":{if(!Array.isArray(n))throw new TypeError("center must be an array");return eee(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return tee(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=ree(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return nee(this,n),this}case"column":{if(n===void 0)n=iee(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return aee(this,n),this}case void 0:{if(n===void 0)n=oee(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return see(this,n),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return FO(this,e)}}rr.prototype.klass="Matrix";typeof Symbol<"u"&&(rr.prototype[Symbol.for("nodejs.util.inspect.custom")]=zJ);function LS(r,e){return r-e}rr.random=rr.rand;rr.randomInt=rr.randInt;rr.diagonal=rr.diag;rr.prototype.diagonal=rr.prototype.diag;rr.identity=rr.eye;rr.prototype.negate=rr.prototype.neg;rr.prototype.tensorProduct=rr.prototype.kroneckerProduct;class vt extends rr{constructor(e,t){if(super(),vt.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(si(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),si(this,e,!0),t=Float64Array.from(Au(this,t)),this.data.splice(e,0,t),this.rows+=1,this}removeColumn(e){if(ui(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),ui(this,e,!0),t=Tu(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}}$J(rr,vt);class qa extends rr{constructor(e,t,n){super(),this.matrix=e,this.rows=t,this.columns=n}}class uee extends qa{constructor(e,t){ui(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 fee extends qa{constructor(e,t){t=jO(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 lee extends qa{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 cee extends qa{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 hee extends qa{constructor(e,t){si(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 dee extends qa{constructor(e,t){t=zO(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 xd extends qa{constructor(e,t,n){let i=GO(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 vee extends qa{constructor(e,t,n,i,a){Xy(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 pee extends qa{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 UO extends rr{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 Jn extends rr{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 gee(r,e){if(Array.isArray(r))return r[0]&&Array.isArray(r[0])?new Jn(r):new UO(r,e);throw new Error("the argument is not an array")}class ov{constructor(e){e=Jn.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=vt.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 vt(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 vt(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 Yy{constructor(e){e=Jn.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=vt.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 vt(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 vt(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 Ku{constructor(e,t={}){e=Jn.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 M=u;u=f,f=M}else c=e.clone();let h=Math.min(n,i),d=Math.min(n+1,i),v=new Float64Array(d),p=new vt(n,h),g=new vt(i,i),y=new Float64Array(i),m=new Float64Array(n),x=new Float64Array(d);for(let M=0;M<d;M++)x[M]=M;let b=Math.min(n-1,i),w=Math.max(0,Math.min(i-2,n)),E=Math.max(b,w);for(let M=0;M<E;M++){if(M<b){v[M]=0;for(let A=M;A<n;A++)v[M]=Ba(v[M],c.get(A,M));if(v[M]!==0){c.get(M,M)<0&&(v[M]=-v[M]);for(let A=M;A<n;A++)c.set(A,M,c.get(A,M)/v[M]);c.set(M,M,c.get(M,M)+1)}v[M]=-v[M]}for(let A=M+1;A<i;A++){if(M<b&&v[M]!==0){let T=0;for(let I=M;I<n;I++)T+=c.get(I,M)*c.get(I,A);T=-T/c.get(M,M);for(let I=M;I<n;I++)c.set(I,A,c.get(I,A)+T*c.get(I,M))}y[A]=c.get(M,A)}if(u&&M<b)for(let A=M;A<n;A++)p.set(A,M,c.get(A,M));if(M<w){y[M]=0;for(let A=M+1;A<i;A++)y[M]=Ba(y[M],y[A]);if(y[M]!==0){y[M+1]<0&&(y[M]=0-y[M]);for(let A=M+1;A<i;A++)y[A]/=y[M];y[M+1]+=1}if(y[M]=-y[M],M+1<n&&y[M]!==0){for(let A=M+1;A<n;A++)m[A]=0;for(let A=M+1;A<n;A++)for(let T=M+1;T<i;T++)m[A]+=y[T]*c.get(A,T);for(let A=M+1;A<i;A++){let T=-y[A]/y[M+1];for(let I=M+1;I<n;I++)c.set(I,A,c.get(I,A)+T*m[I])}}if(f)for(let A=M+1;A<i;A++)g.set(A,M,y[A])}}let S=Math.min(i,n+1);if(b<i&&(v[b]=c.get(b,b)),n<S&&(v[S-1]=0),w+1<S&&(y[w]=c.get(w,S-1)),y[S-1]=0,u){for(let M=b;M<h;M++){for(let A=0;A<n;A++)p.set(A,M,0);p.set(M,M,1)}for(let M=b-1;M>=0;M--)if(v[M]!==0){for(let A=M+1;A<h;A++){let T=0;for(let I=M;I<n;I++)T+=p.get(I,M)*p.get(I,A);T=-T/p.get(M,M);for(let I=M;I<n;I++)p.set(I,A,p.get(I,A)+T*p.get(I,M))}for(let A=M;A<n;A++)p.set(A,M,-p.get(A,M));p.set(M,M,1+p.get(M,M));for(let A=0;A<M-1;A++)p.set(A,M,0)}else{for(let A=0;A<n;A++)p.set(A,M,0);p.set(M,M,1)}}if(f)for(let M=i-1;M>=0;M--){if(M<w&&y[M]!==0)for(let A=M+1;A<i;A++){let T=0;for(let I=M+1;I<i;I++)T+=g.get(I,M)*g.get(I,A);T=-T/g.get(M+1,M);for(let I=M+1;I<i;I++)g.set(I,A,g.get(I,A)+T*g.get(I,M))}for(let A=0;A<i;A++)g.set(A,M,0);g.set(M,M,1)}let _=S-1,C=Number.EPSILON;for(;S>0;){let M,A;for(M=S-2;M>=-1&&M!==-1;M--){const T=Number.MIN_VALUE+C*Math.abs(v[M]+Math.abs(v[M+1]));if(Math.abs(y[M])<=T||Number.isNaN(y[M])){y[M]=0;break}}if(M===S-2)A=4;else{let T;for(T=S-1;T>=M&&T!==M;T--){let I=(T!==S?Math.abs(y[T]):0)+(T!==M+1?Math.abs(y[T-1]):0);if(Math.abs(v[T])<=C*I){v[T]=0;break}}T===M?A=3:T===S-1?A=1:(A=2,M=T)}switch(M++,A){case 1:{let T=y[S-2];y[S-2]=0;for(let I=S-2;I>=M;I--){let L=Ba(v[I],T),N=v[I]/L,O=T/L;if(v[I]=L,I!==M&&(T=-O*y[I-1],y[I-1]=N*y[I-1]),f)for(let B=0;B<i;B++)L=N*g.get(B,I)+O*g.get(B,S-1),g.set(B,S-1,-O*g.get(B,I)+N*g.get(B,S-1)),g.set(B,I,L)}break}case 2:{let T=y[M-1];y[M-1]=0;for(let I=M;I<S;I++){let L=Ba(v[I],T),N=v[I]/L,O=T/L;if(v[I]=L,T=-O*y[I],y[I]=N*y[I],u)for(let B=0;B<n;B++)L=N*p.get(B,I)+O*p.get(B,M-1),p.set(B,M-1,-O*p.get(B,I)+N*p.get(B,M-1)),p.set(B,I,L)}break}case 3:{const T=Math.max(Math.abs(v[S-1]),Math.abs(v[S-2]),Math.abs(y[S-2]),Math.abs(v[M]),Math.abs(y[M])),I=v[S-1]/T,L=v[S-2]/T,N=y[S-2]/T,O=v[M]/T,B=y[M]/T,W=((L+I)*(L-I)+N*N)/2,D=I*N*(I*N);let P=0;(W!==0||D!==0)&&(W<0?P=0-Math.sqrt(W*W+D):P=Math.sqrt(W*W+D),P=D/(W+P));let R=(O+I)*(O-I)+P,X=O*B;for(let Y=M;Y<S-1;Y++){let ee=Ba(R,X);ee===0&&(ee=Number.MIN_VALUE);let U=R/ee,Z=X/ee;if(Y!==M&&(y[Y-1]=ee),R=U*v[Y]+Z*y[Y],y[Y]=U*y[Y]-Z*v[Y],X=Z*v[Y+1],v[Y+1]=U*v[Y+1],f)for(let K=0;K<i;K++)ee=U*g.get(K,Y)+Z*g.get(K,Y+1),g.set(K,Y+1,-Z*g.get(K,Y)+U*g.get(K,Y+1)),g.set(K,Y,ee);if(ee=Ba(R,X),ee===0&&(ee=Number.MIN_VALUE),U=R/ee,Z=X/ee,v[Y]=ee,R=U*y[Y]+Z*v[Y+1],v[Y+1]=-Z*y[Y]+U*v[Y+1],X=Z*y[Y+1],y[Y+1]=U*y[Y+1],u&&Y<n-1)for(let K=0;K<n;K++)ee=U*p.get(K,Y)+Z*p.get(K,Y+1),p.set(K,Y+1,-Z*p.get(K,Y)+U*p.get(K,Y+1)),p.set(K,Y,ee)}y[S-2]=R;break}case 4:{if(v[M]<=0&&(v[M]=v[M]<0?-v[M]:0,f))for(let T=0;T<=_;T++)g.set(T,M,-g.get(T,M));for(;M<_&&!(v[M]>=v[M+1]);){let T=v[M];if(v[M]=v[M+1],v[M+1]=T,f&&M<i-1)for(let I=0;I<i;I++)T=g.get(I,M+1),g.set(I,M+1,g.get(I,M)),g.set(I,M,T);if(u&&M<n-1)for(let I=0;I<n;I++)T=p.get(I,M+1),p.set(I,M+1,p.get(I,M)),p.set(I,M,T);M++}S--;break}}}if(l){let M=g;g=p,p=M}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=vt.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=vt.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(vt.diag(e))}inverse(){let e=this.V,t=this.threshold,n=e.rows,i=e.columns,a=new vt(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 vt(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 vt.diag(this.s)}}function yee(r,e=!1){return r=Jn.checkMatrix(r),e?new Ku(r).inverse():$O(r,vt.eye(r.rows))}function $O(r,e,t=!1){return r=Jn.checkMatrix(r),e=Jn.checkMatrix(e),t?new Ku(r).solve(e):r.isSquare()?new ov(r).solve(e):new Yy(r).solve(e)}function wd(r){if(r=vt.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 xd(r,[1,2],[1,2]),o=new xd(r,[1,2],[0,2]),s=new xd(r,[1,2],[0,1]),e=r.get(0,0),t=r.get(0,1),n=r.get(0,2),e*wd(a)-t*wd(o)+n*wd(s)}else return new ov(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function mee(r,e){let t=[];for(let n=0;n<r;n++)n!==e&&t.push(n);return t}function bee(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 xee(r,e={}){const{thresholdValue:t=1e-9,thresholdError:n=1e-9}=e;r=vt.checkMatrix(r);let i=r.rows,a=new vt(i,i);for(let o=0;o<i;o++){let s=vt.columnVector(r.getRow(o)),u=r.subMatrixRow(mee(i,o)).transpose(),l=new Ku(u).solve(s),c=vt.sub(s,u.mmul(l)).abs().max();a.setRow(o,bee(c,l,o,t,n))}return a}function wee(r,e=Number.EPSILON){r=vt.checkMatrix(r);let t=new Ku(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(vt.diag(a).mmul(n.transpose()))}function Eee(r,e=r,t={}){r=new vt(r);let n=!1;if(typeof e=="object"&&!vt.isMatrix(e)&&!Array.isArray(e)?(t=e,e=r,n=!0):e=new vt(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 _ee(r,e=r,t={}){r=new vt(r);let n=!1;if(typeof e=="object"&&!vt.isMatrix(e)&&!Array.isArray(e)?(t=e,e=r,n=!0):e=new vt(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 NS{constructor(e,t={}){const{assumeSymmetric:n=!1}=t;if(e=Jn.checkMatrix(e),!e.isSquare())throw new Error("Matrix is not a square matrix");let i=e.columns,a=new vt(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));See(i,s,o,a),Mee(i,s,o,a)}else{let h=new vt(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));Cee(i,h,d,a),Aee(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 vt(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 See(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 Mee(r,e,t,n){let i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,x;for(o=1;o<r;o++)e[o-1]=e[o];e[r-1]=0;let b=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(b=b+a,c=t[l],v=1,p=v,g=v,y=e[f+1],m=0,x=0,o=l-1;o>=f;o--)for(g=p,p=v,x=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*x*g*y*e[f]/d,e[f]=m*c,t[f]=v*c}while(Math.abs(e[f])>E*w);t[f]=t[f]+b,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 Cee(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 Aee(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,x,b,w,E,S,_,C,M,A,T,I,L,N;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(b=a;b>o&&(v=Math.abs(i.get(b-1,b-1))+Math.abs(i.get(b,b)),v===0&&(v=l),!(Math.abs(i.get(b,b-1))<u*v));)b--;if(b===a)i.set(a,a,i.get(a,a)+f),t[a]=i.get(a,a),e[a]=0,a--,g=0;else if(b===a-1){if(S=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+S,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),_=i.get(a,a),h>=0){for(p=c>=0?c+p:c-p,t[a-1]=_+p,t[a]=t[a-1],p!==0&&(t[a]=_-S/p),e[a-1]=0,e[a]=0,_=i.get(a,a-1),v=Math.abs(_)+Math.abs(p),c=_/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]=_+c,t[a]=_+c,e[a-1]=p,e[a]=-p;a=a-2,g=0}else{if(_=i.get(a,a),C=0,S=0,b<a&&(C=i.get(a-1,a-1),S=i.get(a,a-1)*i.get(a-1,a)),g===10){for(f+=_,y=o;y<=a;y++)i.set(y,y,i.get(y,y)-_);v=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),_=C=.75*v,S=-.4375*v*v}if(g===30&&(v=(C-_)/2,v=v*v+S,v>0)){for(v=Math.sqrt(v),C<_&&(v=-v),v=_-S/((C-_)/2+v),y=o;y<=a;y++)i.set(y,y,i.get(y,y)-v);f+=v,_=C=S=.964}for(g=g+1,w=a-2;w>=b&&(p=i.get(w,w),d=_-p,v=C-p,c=(d*v-S)/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===b||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(x=w;x<=a-1&&(L=x!==a-1,x!==w&&(c=i.get(x,x-1),h=i.get(x+1,x-1),d=L?i.get(x+2,x-1):0,_=Math.abs(c)+Math.abs(h)+Math.abs(d),_!==0&&(c=c/_,h=h/_,d=d/_)),_!==0);x++)if(v=Math.sqrt(c*c+h*h+d*d),c<0&&(v=-v),v!==0){for(x!==w?i.set(x,x-1,-v*_):b!==w&&i.set(x,x-1,-i.get(x,x-1)),c=c+v,_=c/v,C=h/v,p=d/v,h=h/c,d=d/c,m=x;m<r;m++)c=i.get(x,m)+h*i.get(x+1,m),L&&(c=c+d*i.get(x+2,m),i.set(x+2,m,i.get(x+2,m)-c*p)),i.set(x,m,i.get(x,m)-c*_),i.set(x+1,m,i.get(x+1,m)-c*C);for(y=0;y<=Math.min(a,x+3);y++)c=_*i.get(y,x)+C*i.get(y,x+1),L&&(c=c+p*i.get(y,x+2),i.set(y,x+2,i.get(y,x+2)-c*d)),i.set(y,x,i.get(y,x)-c),i.set(y,x+1,i.get(y,x+1)-c*h);for(y=o;y<=s;y++)c=_*n.get(y,x)+C*n.get(y,x+1),L&&(c=c+p*n.get(y,x+2),n.set(y,x+2,n.get(y,x+2)-c*d)),n.set(y,x,n.get(y,x)-c),n.set(y,x+1,n.get(y,x+1)-c*h)}}}if(l!==0){for(a=r-1;a>=0;a--)if(c=t[a],h=e[a],h===0)for(b=a,i.set(a,a,1),y=a-1;y>=0;y--){for(S=i.get(y,y)-c,d=0,m=b;m<=a;m++)d=d+i.get(y,m)*i.get(m,a);if(e[y]<0)p=S,v=d;else if(b=y,e[y]===0?i.set(y,a,S!==0?-d/S:-d/(u*l)):(_=i.get(y,y+1),C=i.get(y+1,y),h=(t[y]-c)*(t[y]-c)+e[y]*e[y],E=(_*v-p*d)/h,i.set(y,a,E),i.set(y+1,a,Math.abs(_)>Math.abs(p)?(-d-S*E)/_:(-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(b=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))):(N=Fh(0,-i.get(a-1,a),i.get(a-1,a-1)-c,h),i.set(a-1,a-1,N[0]),i.set(a-1,a,N[1])),i.set(a,a-1,0),i.set(a,a,1),y=a-2;y>=0;y--){for(M=0,A=0,m=b;m<=a;m++)M=M+i.get(y,m)*i.get(m,a-1),A=A+i.get(y,m)*i.get(m,a);if(S=i.get(y,y)-c,e[y]<0)p=S,d=M,v=A;else if(b=y,e[y]===0?(N=Fh(-M,-A,S,h),i.set(y,a-1,N[0]),i.set(y,a,N[1])):(_=i.get(y,y+1),C=i.get(y+1,y),T=(t[y]-c)*(t[y]-c)+e[y]*e[y]-h*h,I=(t[y]-c)*2*h,T===0&&I===0&&(T=u*l*(Math.abs(S)+Math.abs(h)+Math.abs(_)+Math.abs(C)+Math.abs(p))),N=Fh(_*d-p*M+h*A,_*v-p*A-h*M,T,I),i.set(y,a-1,N[0]),i.set(y,a,N[1]),Math.abs(_)>Math.abs(p)+Math.abs(h)?(i.set(y+1,a-1,(-M-S*i.get(y,a-1)+h*i.get(y,a))/_),i.set(y+1,a,(-A-S*i.get(y,a)-h*i.get(y,a-1))/_)):(N=Fh(-d-C*i.get(y,a-1),-v-C*i.get(y,a),p,h),i.set(y+1,a-1,N[0]),i.set(y+1,a,N[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,x=o;x<=Math.min(m,s);x++)p=p+n.get(y,x)*i.get(x,m);n.set(y,m,p)}}}function Fh(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 OS{constructor(e){if(e=Jn.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,n=t.rows,i=new vt(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=Jn.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 DS{constructor(e,t={}){e=Jn.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=vt.columnVector(n):n=Jn.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 Tee=Object.freeze(Object.defineProperty({__proto__:null,AbstractMatrix:rr,CHO:OS,CholeskyDecomposition:OS,EVD:NS,EigenvalueDecomposition:NS,LU:ov,LuDecomposition:ov,Matrix:vt,MatrixColumnSelectionView:fee,MatrixColumnView:uee,MatrixFlipColumnView:lee,MatrixFlipRowView:cee,MatrixRowSelectionView:dee,MatrixRowView:hee,MatrixSelectionView:xd,MatrixSubView:vee,MatrixTransposeView:pee,NIPALS:DS,Nipals:DS,QR:Yy,QrDecomposition:Yy,SVD:Ku,SingularValueDecomposition:Ku,WrapperMatrix1D:UO,WrapperMatrix2D:Jn,correlation:_ee,covariance:Eee,default:vt,determinant:wd,inverse:yee,linearDependencies:xee,pseudoInverse:wee,solve:$O,wrap:gee},Symbol.toStringTag,{value:"Module"})),XO=da(Tee);var PS;function Iee(){if(PS)return Ph;PS=1,Object.defineProperty(Ph,"__esModule",{value:!0});var r=XO,e=function(){function t(n){this.distances=n.distances,this.dimension=n.dimension||2,this.linkDistance=n.linkDistance}return t.prototype.layout=function(){var n=this,i=n.dimension,a=n.distances,o=n.linkDistance;try{var s=r.Matrix.mul(r.Matrix.pow(a,2),-.5),u=s.mean("row"),f=s.mean("column"),l=s.mean();s.add(l).subRowVector(u).subColumnVector(f);var c=new r.SingularValueDecomposition(s),h=r.Matrix.sqrt(c.diagonalMatrix).diagonal();return c.leftSingularVectors.toJSON().map(function(y){return r.Matrix.mul([y],[h]).toJSON()[0].splice(0,i)})}catch{for(var d=[],v=0;v<a.length;v++){var p=Math.random()*o,g=Math.random()*o;d.push([p,g])}return d}},t}();return Ph.default=e,Ph}var Gh={},RS;function kee(){if(RS)return Gh;RS=1,Object.defineProperty(Gh,"__esModule",{value:!0});var r=800,e=function(){function t(n){this.disp=[],this.positions=n.positions,this.adjMatrix=n.adjMatrix,this.focusID=n.focusID,this.radii=n.radii,this.iterations=n.iterations||10,this.height=n.height||10,this.width=n.width||10,this.speed=n.speed||100,this.gravity=n.gravity||10,this.nodeSizeFunc=n.nodeSizeFunc,this.k=n.k||5,this.strictRadial=n.strictRadial,this.nodes=n.nodes}return t.prototype.layout=function(){var n=this,i=n.positions,a=[],o=n.iterations,s=n.width/10;n.maxDisplace=s,n.disp=a;for(var u=0;u<o;u++)i.forEach(function(f,l){a[l]={x:0,y:0}}),n.getRepulsion(),n.updatePositions();return i},t.prototype.getRepulsion=function(){var n=this,i=n.positions,a=n.nodes,o=n.disp,s=n.k,u=n.radii||[];i.forEach(function(f,l){o[l]={x:0,y:0},i.forEach(function(c,h){if(l!==h&&u[l]===u[h]){var d=f[0]-c[0],v=f[1]-c[1],p=Math.sqrt(d*d+v*v);if(p===0){p=1;var g=l>h?1:-1;d=.01*g,v=.01*g}if(p<n.nodeSizeFunc(a[l])/2+n.nodeSizeFunc(a[h])/2){var y=s*s/p;o[l].x+=d/p*y,o[l].y+=v/p*y}}})})},t.prototype.updatePositions=function(){var n=this,i=n.positions,a=n.disp,o=n.speed,s=n.strictRadial,u=n.focusID,f=n.maxDisplace||n.width/10;s&&a.forEach(function(c,h){var d=i[h][0]-i[u][0],v=i[h][1]-i[u][1],p=Math.sqrt(d*d+v*v),g=v/p,y=-d/p,m=Math.sqrt(c.x*c.x+c.y*c.y),x=Math.acos((g*c.x+y*c.y)/m);x>Math.PI/2&&(x-=Math.PI/2,g*=-1,y*=-1);var b=Math.cos(x)*m;c.x=g*b,c.y=y*b});var l=n.radii;i.forEach(function(c,h){if(h!==u){var d=Math.sqrt(a[h].x*a[h].x+a[h].y*a[h].y);if(d>0&&h!==u){var v=Math.min(f*(o/r),d);if(c[0]+=a[h].x/d*v,c[1]+=a[h].y/d*v,s){var p=c[0]-i[u][0],g=c[1]-i[u][1],y=Math.sqrt(p*p+g*g);p=p/y*l[h],g=g/y*l[h],c[0]=i[u][0]+p,c[1]=i[u][1]+g}}}})},t}();return Gh.default=e,Gh}var BS;function Lee(){if(BS)return Ia;BS=1;var r=Ia&&Ia.__extends||function(){var l=function(c,h){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,v){d.__proto__=v}||function(d,v){for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(d[p]=v[p])},l(c,h)};return function(c,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");l(c,h);function d(){this.constructor=c}c.prototype=h===null?Object.create(h):(d.prototype=h.prototype,new d)}}(),e=Ia&&Ia.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.RadialLayout=void 0;var t=$r(),n=ln(),i=e(Iee()),a=e(kee());function o(l){for(var c=l.length,h=l[0].length,d=[],v=0;v<c;v++){for(var p=[],g=0;g<h;g++)l[v][g]!==0?p.push(1/(l[v][g]*l[v][g])):p.push(0);d.push(p)}return d}function s(l,c){var h=-1;return l.forEach(function(d,v){d.id===c&&(h=v)}),h}function u(l,c){return Math.sqrt((l[0]-c[0])*(l[0]-c[0])+(l[1]-c[1])*(l[1]-c[1]))}var f=function(l){r(c,l);function c(h){var d=l.call(this)||this;return d.maxIteration=1e3,d.focusNode=null,d.unitRadius=null,d.linkDistance=50,d.preventOverlap=!1,d.strictRadial=!0,d.maxPreventOverlapIteration=200,d.sortStrength=10,d.nodes=[],d.edges=[],d.updateCfg(h),d}return c.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}},c.prototype.execute=function(){var h=this,d=h.nodes,v=h.edges||[];if(!d||d.length===0){h.onLayoutEnd&&h.onLayoutEnd();return}!h.width&&typeof window<"u"&&(h.width=window.innerWidth),!h.height&&typeof window<"u"&&(h.height=window.innerHeight),h.center||(h.center=[h.width/2,h.height/2]);var p=h.center;if(d.length===1){d[0].x=p[0],d[0].y=p[1],h.onLayoutEnd&&h.onLayoutEnd();return}var g=h.linkDistance,y=null;if((0,t.isString)(h.focusNode)){for(var m=!1,x=0;x<d.length;x++)d[x].id===h.focusNode&&(y=d[x],h.focusNode=y,m=!0,x=d.length);m||(y=null)}else y=h.focusNode;y||(y=d[0],h.focusNode=y);var b=s(d,y.id);b<0&&(b=0),h.focusIndex=b;var w=(0,t.getAdjMatrix)({nodes:d,edges:v},!1),E=(0,t.floydWarshall)(w),S=h.maxToFocus(E,b);h.handleInfinity(E,b,S+1),h.distances=E;var _=E[b],C=h.width||500,M=h.height||500,A=C-p[0]>p[0]?p[0]:C-p[0],T=M-p[1]>p[1]?p[1]:M-p[1];A===0&&(A=C/2),T===0&&(T=M/2);var I=T>A?A:T,L=Math.max.apply(Math,_),N=[];_.forEach(function(se,re){h.unitRadius||(h.unitRadius=I/L),N[re]=se*h.unitRadius}),h.radii=N;var O=h.eIdealDisMatrix();h.eIdealDistances=O;var B=o(O);h.weights=B;var W=new i.default({linkDistance:g,distances:O}),D=W.layout();D.forEach(function(se){(0,t.isNaN)(se[0])&&(se[0]=Math.random()*g),(0,t.isNaN)(se[1])&&(se[1]=Math.random()*g)}),h.positions=D,D.forEach(function(se,re){d[re].x=se[0]+p[0],d[re].y=se[1]+p[1]}),D.forEach(function(se){se[0]-=D[b][0],se[1]-=D[b][1]}),h.run();var P=h.preventOverlap,R=h.nodeSize,X,Y=h.strictRadial;if(P){var ee=h.nodeSpacing,U;(0,t.isNumber)(ee)?U=function(){return ee}:(0,t.isFunction)(ee)?U=ee:U=function(){return 0},R?(0,t.isArray)(R)?X=function(se){var re=R[0]>R[1]?R[0]:R[1];return re+U(se)}:X=function(se){return R+U(se)}:X=function(se){if(se.size){if((0,t.isArray)(se.size)){var re=se.size[0]>se.size[1]?se.size[0]:se.size[1];return re+U(se)}if((0,t.isObject)(se.size)){var re=se.size.width>se.size.height?se.size.width:se.size.height;return re+U(se)}return se.size+U(se)}return 10+U(se)};var Z={nodes:d,nodeSizeFunc:X,adjMatrix:w,positions:D,radii:N,height:M,width:C,strictRadial:Y,focusID:b,iterations:h.maxPreventOverlapIteration||200,k:D.length/4.5},K=new a.default(Z);D=K.layout()}return D.forEach(function(se,re){d[re].x=se[0]+p[0],d[re].y=se[1]+p[1]}),h.onLayoutEnd&&h.onLayoutEnd(),{nodes:d,edges:v}},c.prototype.run=function(){for(var h=this,d=h.maxIteration,v=h.positions||[],p=h.weights||[],g=h.eIdealDistances||[],y=h.radii||[],m=0;m<=d;m++){var x=m/d;h.oneIteration(x,v,y,g,p)}},c.prototype.oneIteration=function(h,d,v,p,g){var y=this,m=1-h,x=y.focusIndex;d.forEach(function(b,w){var E=u(b,[0,0]),S=E===0?0:1/E;if(w!==x){var _=0,C=0,M=0;d.forEach(function(T,I){if(w!==I){var L=u(b,T),N=L===0?0:1/L,O=p[I][w];M+=g[w][I],_+=g[w][I]*(T[0]+O*(b[0]-T[0])*N),C+=g[w][I]*(T[1]+O*(b[1]-T[1])*N)}});var A=v[w]===0?0:1/v[w];M*=m,M+=h*A*A,_*=m,_+=h*A*b[0]*S,b[0]=_/M,C*=m,C+=h*A*b[1]*S,b[1]=C/M}})},c.prototype.eIdealDisMatrix=function(){var h=this,d=h.nodes;if(!d)return[];var v=h.distances,p=h.linkDistance,g=h.radii||[],y=h.unitRadius||50,m=[];return v&&v.forEach(function(x,b){var w=[];x.forEach(function(E,S){if(b===S)w.push(0);else if(g[b]===g[S])if(h.sortBy==="data")w.push(E*(Math.abs(b-S)*h.sortStrength)/(g[b]/y));else if(h.sortBy){var _=d[b][h.sortBy]||0,C=d[S][h.sortBy]||0;(0,t.isString)(_)&&(_=_.charCodeAt(0)),(0,t.isString)(C)&&(C=C.charCodeAt(0)),w.push(E*(Math.abs(_-C)*h.sortStrength)/(g[b]/y))}else w.push(E*p/(g[b]/y));else{var M=(p+y)/2;w.push(E*M)}}),m.push(w)}),m},c.prototype.handleInfinity=function(h,d,v){for(var p=h.length,g=0;g<p;g++)if(h[d][g]===1/0){h[d][g]=v,h[g][d]=v;for(var y=0;y<p;y++)h[g][y]!==1/0&&h[d][y]===1/0&&(h[d][y]=v+h[g][y],h[y][d]=v+h[g][y])}for(var g=0;g<p;g++)if(g!==d){for(var y=0;y<p;y++)if(h[g][y]===1/0){var m=Math.abs(h[d][g]-h[d][y]);m=m===0?1:m,h[g][y]=m}}},c.prototype.maxToFocus=function(h,d){for(var v=0,p=0;p<h[d].length;p++)h[d][p]!==1/0&&(v=h[d][p]>v?h[d][p]:v);return v},c.prototype.getType=function(){return"radial"},c}(n.Base);return Ia.RadialLayout=f,Ia}var FS;function YO(){return FS||(FS=1,function(r){var e=is&&is.__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=is&&is.__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(Lee(),r)}(is)),is}var as={},GS;function WO(){if(GS)return as;GS=1;var r=as&&as.__extends||function(){var i=function(a,o){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(s[f]=u[f])},i(a,o)};return function(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");i(a,o);function s(){this.constructor=a}a.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}}();Object.defineProperty(as,"__esModule",{value:!0}),as.ConcentricLayout=void 0;var e=$r(),t=ln(),n=function(i){r(a,i);function a(o){var s=i.call(this)||this;return s.nodeSize=30,s.minNodeSpacing=10,s.nodeSpacing=10,s.preventOverlap=!1,s.equidistant=!1,s.startAngle=3/2*Math.PI,s.clockwise=!0,s.sortBy="degree",s.nodes=[],s.edges=[],s.width=300,s.height=300,s.onLayoutEnd=function(){},s.updateCfg(o),s}return a.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"}},a.prototype.execute=function(){var o,s,u=this,f=u.nodes,l=u.edges,c=f.length;if(c===0){(o=u.onLayoutEnd)===null||o===void 0||o.call(u);return}!u.width&&typeof window<"u"&&(u.width=window.innerWidth),!u.height&&typeof window<"u"&&(u.height=window.innerHeight),u.center||(u.center=[u.width/2,u.height/2]);var h=u.center;if(c===1){f[0].x=h[0],f[0].y=h[1],(s=u.onLayoutEnd)===null||s===void 0||s.call(u);return}var d=u.nodeSize,v=u.nodeSpacing,p=[],g,y=0;(0,e.isArray)(d)?g=Math.max(d[0],d[1]):g=d,(0,e.isArray)(v)?y=Math.max(v[0],v[1]):(0,e.isNumber)(v)&&(y=v),f.forEach(function(B){p.push(B);var W=g;(0,e.isArray)(B.size)?W=Math.max(B.size[0],B.size[1]):(0,e.isNumber)(B.size)?W=B.size:(0,e.isObject)(B.size)&&(W=Math.max(B.size.width,B.size.height)),g=Math.max(g,W),(0,e.isFunction)(v)&&(y=Math.max(v(B),y))}),u.clockwise=u.counterclockwise!==void 0?!u.counterclockwise:u.clockwise;var m={},x={};if(p.forEach(function(B,W){m[B.id]=B,x[B.id]=W}),(u.sortBy==="degree"||!(0,e.isString)(u.sortBy)||p[0][u.sortBy]===void 0)&&(u.sortBy="degree",!(0,e.isNumber)(f[0].degree))){var b=(0,e.getDegree)(f.length,x,l);p.forEach(function(B,W){B.degree=b[W].all})}p.sort(function(B,W){return W[u.sortBy]-B[u.sortBy]}),u.maxValueNode=p[0],u.maxLevelDiff=u.maxLevelDiff||u.maxValueNode[u.sortBy]/4;var w=[[]],E=w[0];p.forEach(function(B){if(E.length>0){var W=Math.abs(E[0][u.sortBy]-B[u.sortBy]);u.maxLevelDiff&&W>=u.maxLevelDiff&&(E=[],w.push(E))}E.push(B)});var S=g+(y||u.minNodeSpacing);if(!u.preventOverlap){var _=w.length>0&&w[0].length>1,C=Math.min(u.width,u.height)/2-S,M=C/(w.length+(_?1:0));S=Math.min(S,M)}var A=0;if(w.forEach(function(B){var W=u.sweep;W===void 0&&(W=2*Math.PI-2*Math.PI/B.length);var D=B.dTheta=W/Math.max(1,B.length-1);if(B.length>1&&u.preventOverlap){var P=Math.cos(D)-Math.cos(0),R=Math.sin(D)-Math.sin(0),X=Math.sqrt(S*S/(P*P+R*R));A=Math.max(X,A)}B.r=A,A+=S}),u.equidistant){for(var T=0,I=0,L=0;L<w.length;L++){var N=w[L],O=N.r-I;T=Math.max(T,O)}I=0,w.forEach(function(B,W){W===0&&(I=B.r),B.r=I,I+=T})}return w.forEach(function(B){var W=B.dTheta,D=B.r;B.forEach(function(P,R){var X=u.startAngle+(u.clockwise?1:-1)*W*R;P.x=h[0]+D*Math.cos(X),P.y=h[1]+D*Math.sin(X)})}),u.onLayoutEnd&&u.onLayoutEnd(),{nodes:f,edges:l}},a.prototype.getType=function(){return"concentric"},a}(t.Base);return as.ConcentricLayout=n,as}var os={},zS;function qO(){if(zS)return os;zS=1;var r=os&&os.__extends||function(){var a=function(o,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(u[l]=f[l])},a(o,s)};return function(o,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");a(o,s);function u(){this.constructor=o}o.prototype=s===null?Object.create(s):(u.prototype=s.prototype,new u)}}();Object.defineProperty(os,"__esModule",{value:!0}),os.MDSLayout=void 0;var e=XO,t=$r(),n=ln(),i=function(a){r(o,a);function o(s){var u=a.call(this)||this;return u.center=[0,0],u.linkDistance=50,u.nodes=[],u.edges=[],u.onLayoutEnd=function(){},u.updateCfg(s),u}return o.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},o.prototype.execute=function(){var s=this,u=s.nodes,f=s.edges,l=f===void 0?[]:f,c=s.center;if(!u||u.length===0){s.onLayoutEnd&&s.onLayoutEnd();return}if(u.length===1){u[0].x=c[0],u[0].y=c[1],s.onLayoutEnd&&s.onLayoutEnd();return}var h=s.linkDistance,d=(0,t.getAdjMatrix)({nodes:u,edges:l},!1),v=(0,t.floydWarshall)(d);s.handleInfinity(v);var p=(0,t.scaleMatrix)(v,h);s.scaledDistances=p;var g=s.runMDS();return s.positions=g,g.forEach(function(y,m){u[m].x=y[0]+c[0],u[m].y=y[1]+c[1]}),s.onLayoutEnd&&s.onLayoutEnd(),{nodes:u,edges:l}},o.prototype.runMDS=function(){var s=this,u=2,f=s.scaledDistances,l=e.Matrix.mul(e.Matrix.pow(f,2),-.5),c=l.mean("row"),h=l.mean("column"),d=l.mean();l.add(d).subRowVector(c).subColumnVector(h);var v=new e.SingularValueDecomposition(l),p=e.Matrix.sqrt(v.diagonalMatrix).diagonal();return v.leftSingularVectors.toJSON().map(function(g){return e.Matrix.mul([g],[p]).toJSON()[0].splice(0,u)})},o.prototype.handleInfinity=function(s){var u=-999999;s.forEach(function(f){f.forEach(function(l){l!==1/0&&u<l&&(u=l)})}),s.forEach(function(f,l){f.forEach(function(c,h){c===1/0&&(s[l][h]=u)})})},o.prototype.getType=function(){return"mds"},o}(n.Base);return os.MDSLayout=i,os}var ss={},jS;function VO(){if(jS)return ss;jS=1;var r=ss&&ss.__extends||function(){var a=function(o,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(u[l]=f[l])},a(o,s)};return function(o,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");a(o,s);function u(){this.constructor=o}o.prototype=s===null?Object.create(s):(u.prototype=s.prototype,new u)}}();Object.defineProperty(ss,"__esModule",{value:!0}),ss.FruchtermanLayout=void 0;var e=ln(),t=$r(),n=800,i=function(a){r(o,a);function o(s){var u=a.call(this)||this;return u.maxIteration=1e3,u.workerEnabled=!1,u.gravity=10,u.speed=5,u.clustering=!1,u.clusterGravity=10,u.nodes=[],u.edges=[],u.width=300,u.height=300,u.nodeMap={},u.nodeIdxMap={},u.onLayoutEnd=function(){},u.tick=function(){},u.animate=!0,u.updateCfg(s),u}return o.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},o.prototype.execute=function(){var s=this,u,f,l=this,c=l.nodes;if(l.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(l.timeInterval),!c||c.length===0){(u=l.onLayoutEnd)===null||u===void 0||u.call(l);return}!l.width&&typeof window<"u"&&(l.width=window.innerWidth),!l.height&&typeof window<"u"&&(l.height=window.innerHeight),l.center||(l.center=[l.width/2,l.height/2]);var h=l.center;if(c.length===1){c[0].x=h[0],c[0].y=h[1],(f=l.onLayoutEnd)===null||f===void 0||f.call(l);return}var d={},v={};return c.forEach(function(p,g){(0,t.isNumber)(p.x)||(p.x=Math.random()*s.width),(0,t.isNumber)(p.y)||(p.y=Math.random()*s.height),d[p.id]=p,v[p.id]=g}),l.nodeMap=d,l.nodeIdxMap=v,l.run()},o.prototype.run=function(){var s,u=this,f=u.nodes;if(f){var l=u.edges,c=u.maxIteration,h=u.workerEnabled,d=u.clustering,v=u.animate,p={};if(d&&f.forEach(function(m){p[m.cluster]===void 0&&(p[m.cluster]={name:m.cluster,cx:0,cy:0,count:0})}),h||!v){for(var g=0;g<c;g++)u.runOneStep(p);(s=u.onLayoutEnd)===null||s===void 0||s.call(u)}else{if(typeof window>"u")return;var y=0;this.timeInterval=window.setInterval(function(){var m;u.runOneStep(p),y++,y>=c&&((m=u.onLayoutEnd)===null||m===void 0||m.call(u),window.clearInterval(u.timeInterval))},0)}return{nodes:f,edges:l}}},o.prototype.runOneStep=function(s){var u,f=this,l=f.nodes;if(l){var c=f.edges,h=f.center,d=f.gravity,v=f.speed,p=f.clustering,g=f.height*f.width,y=Math.sqrt(g)/10,m=g/(l.length+1),x=Math.sqrt(m),b=[];if(l.forEach(function(S,_){b[_]={x:0,y:0}}),f.applyCalculate(l,c,b,x,m),p){for(var w in s)s[w].cx=0,s[w].cy=0,s[w].count=0;l.forEach(function(S){var _=s[S.cluster];(0,t.isNumber)(S.x)&&(_.cx+=S.x),(0,t.isNumber)(S.y)&&(_.cy+=S.y),_.count++});for(var w in s)s[w].cx/=s[w].count,s[w].cy/=s[w].count;var E=f.clusterGravity||d;l.forEach(function(S,_){if(!(!(0,t.isNumber)(S.x)||!(0,t.isNumber)(S.y))){var C=s[S.cluster],M=Math.sqrt((S.x-C.cx)*(S.x-C.cx)+(S.y-C.cy)*(S.y-C.cy)),A=x*E;b[_].x-=A*(S.x-C.cx)/M,b[_].y-=A*(S.y-C.cy)/M}})}l.forEach(function(S,_){if(!(!(0,t.isNumber)(S.x)||!(0,t.isNumber)(S.y))){var C=.01*x*d;b[_].x-=C*(S.x-h[0]),b[_].y-=C*(S.y-h[1])}}),l.forEach(function(S,_){if((0,t.isNumber)(S.fx)&&(0,t.isNumber)(S.fy)){S.x=S.fx,S.y=S.fy;return}if(!(!(0,t.isNumber)(S.x)||!(0,t.isNumber)(S.y))){var C=Math.sqrt(b[_].x*b[_].x+b[_].y*b[_].y);if(C>0){var M=Math.min(y*(v/n),C);S.x+=b[_].x/C*M,S.y+=b[_].y/C*M}}}),(u=f.tick)===null||u===void 0||u.call(f)}},o.prototype.applyCalculate=function(s,u,f,l,c){var h=this;h.calRepulsive(s,f,c),u&&h.calAttractive(u,f,l)},o.prototype.calRepulsive=function(s,u,f){s.forEach(function(l,c){u[c]={x:0,y:0},s.forEach(function(h,d){if(c!==d&&!(!(0,t.isNumber)(l.x)||!(0,t.isNumber)(h.x)||!(0,t.isNumber)(l.y)||!(0,t.isNumber)(h.y))){var v=l.x-h.x,p=l.y-h.y,g=v*v+p*p;if(g===0){g=1;var y=c>d?1:-1;v=.01*y,p=.01*y}var m=f/g;u[c].x+=v*m,u[c].y+=p*m}})})},o.prototype.calAttractive=function(s,u,f){var l=this;s.forEach(function(c){var h=(0,t.getEdgeTerminal)(c,"source"),d=(0,t.getEdgeTerminal)(c,"target");if(!(!h||!d)){var v=l.nodeIdxMap[h],p=l.nodeIdxMap[d];if(v!==p){var g=l.nodeMap[h],y=l.nodeMap[d];if(!(!(0,t.isNumber)(y.x)||!(0,t.isNumber)(g.x)||!(0,t.isNumber)(y.y)||!(0,t.isNumber)(g.y))){var m=y.x-g.x,x=y.y-g.y,b=Math.sqrt(m*m+x*x),w=b*b/f;u[p].x-=m/b*w,u[p].y-=x/b*w,u[v].x+=m/b*w,u[v].y+=x/b*w}}}})},o.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},o.prototype.destroy=function(){var s=this;s.stop(),s.tick=null,s.nodes=null,s.edges=null,s.destroyed=!0},o.prototype.getType=function(){return"fruchterman"},o}(e.Base);return ss.FruchtermanLayout=i,ss}var Ai={};function US(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 wo(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(u){US(a,n,i,o,s,"next",u)}function s(u){US(a,n,i,o,s,"throw",u)}o(void 0)})}}function Qu(r){"@babel/helpers - typeof";return Qu=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},Qu(r)}function Nee(r,e){if(Qu(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Qu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function HO(r){var e=Nee(r,"string");return Qu(e)=="symbol"?e:e+""}function et(r,e,t){return(e=HO(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $i(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function $S(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,HO(n.key),n)}}function Xi(r,e,t){return e&&$S(r.prototype,e),t&&$S(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Hg,XS;function ZO(){if(XS)return Hg;XS=1;var r=typeof $c=="object"&&$c&&$c.Object===Object&&$c;return Hg=r,Hg}var Zg,YS;function Oee(){if(YS)return Zg;YS=1;var r=ZO(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Zg=t,Zg}var Kg,WS;function KO(){if(WS)return Kg;WS=1;var r=Oee(),e=r.Symbol;return Kg=e,Kg}var Qg,qS;function Dee(){if(qS)return Qg;qS=1;var r=KO(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function a(o){var s=t.call(o,i),u=o[i];try{o[i]=void 0;var f=!0}catch{}var l=n.call(o);return f&&(s?o[i]=u:delete o[i]),l}return Qg=a,Qg}var Jg,VS;function Pee(){if(VS)return Jg;VS=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Jg=t,Jg}var e0,HS;function O1(){if(HS)return e0;HS=1;var r=KO(),e=Dee(),t=Pee(),n="[object Null]",i="[object Undefined]",a=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?e(s):t(s)}return e0=o,e0}var t0,ZS;function Ree(){if(ZS)return t0;ZS=1;var r=9007199254740991;function e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=r}return t0=e,t0}var r0,KS;function D1(){if(KS)return r0;KS=1;function r(e){return e!=null&&typeof e=="object"}return r0=r,r0}var n0,QS;function Bee(){if(QS)return n0;QS=1;var r=O1(),e=Ree(),t=D1(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",f="[object Map]",l="[object Number]",c="[object Object]",h="[object RegExp]",d="[object Set]",v="[object String]",p="[object WeakMap]",g="[object ArrayBuffer]",y="[object DataView]",m="[object Float32Array]",x="[object Float64Array]",b="[object Int8Array]",w="[object Int16Array]",E="[object Int32Array]",S="[object Uint8Array]",_="[object Uint8ClampedArray]",C="[object Uint16Array]",M="[object Uint32Array]",A={};A[m]=A[x]=A[b]=A[w]=A[E]=A[S]=A[_]=A[C]=A[M]=!0,A[n]=A[i]=A[g]=A[a]=A[y]=A[o]=A[s]=A[u]=A[f]=A[l]=A[c]=A[h]=A[d]=A[v]=A[p]=!1;function T(I){return t(I)&&e(I.length)&&!!A[r(I)]}return n0=T,n0}var i0,JS;function Fee(){if(JS)return i0;JS=1;function r(e){return function(t){return e(t)}}return i0=r,i0}var dl={exports:{}};dl.exports;var eM;function Gee(){return eM||(eM=1,function(r,e){var t=ZO(),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}(dl,dl.exports)),dl.exports}var a0,tM;function zee(){if(tM)return a0;tM=1;var r=Bee(),e=Fee(),t=Gee(),n=t&&t.isTypedArray,i=n?e(n):r;return a0=i,a0}var jee=zee();const sv=va(jee);var o0,rM;function Uee(){if(rM)return o0;rM=1;var r=O1(),e=D1(),t="[object Number]";function n(i){return typeof i=="number"||e(i)&&r(i)==t}return o0=n,o0}var $ee=Uee();const Xee=va($ee);var s0,nM;function Yee(){if(nM)return s0;nM=1;var r=Array.isArray;return s0=r,s0}var Wee=Yee();const qee=va(Wee);var u0={exports:{}},f0={exports:{}},iM;function Vee(){return iM||(iM=1,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}(f0)),f0.exports}var aM;function Hee(){return aM||(aM=1,function(r){var e=Vee().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(D,P,R){D[P]=R.value},u=typeof Symbol=="function"?Symbol:{},f=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function h(D,P,R){return Object.defineProperty(D,P,{value:R,enumerable:!0,configurable:!0,writable:!0}),D[P]}try{h({},"")}catch{h=function(R,X,Y){return R[X]=Y}}function d(D,P,R,X){var Y=P&&P.prototype instanceof b?P:b,ee=Object.create(Y.prototype),U=new B(X||[]);return s(ee,"_invoke",{value:I(D,R,U)}),ee}function v(D,P,R){try{return{type:"normal",arg:D.call(P,R)}}catch(X){return{type:"throw",arg:X}}}i.wrap=d;var p="suspendedStart",g="suspendedYield",y="executing",m="completed",x={};function b(){}function w(){}function E(){}var S={};h(S,f,function(){return this});var _=Object.getPrototypeOf,C=_&&_(_(W([])));C&&C!==a&&o.call(C,f)&&(S=C);var M=E.prototype=b.prototype=Object.create(S);function A(D){["next","throw","return"].forEach(function(P){h(D,P,function(R){return this._invoke(P,R)})})}function T(D,P){function R(Y,ee,U,Z){var K=v(D[Y],D,ee);if(K.type!=="throw"){var se=K.arg,re=se.value;return re&&e(re)=="object"&&o.call(re,"__await")?P.resolve(re.__await).then(function(J){R("next",J,U,Z)},function(J){R("throw",J,U,Z)}):P.resolve(re).then(function(J){se.value=J,U(se)},function(J){return R("throw",J,U,Z)})}Z(K.arg)}var X;s(this,"_invoke",{value:function(ee,U){function Z(){return new P(function(K,se){R(ee,U,K,se)})}return X=X?X.then(Z,Z):Z()}})}function I(D,P,R){var X=p;return function(Y,ee){if(X===y)throw Error("Generator is already running");if(X===m){if(Y==="throw")throw ee;return{value:n,done:!0}}for(R.method=Y,R.arg=ee;;){var U=R.delegate;if(U){var Z=L(U,R);if(Z){if(Z===x)continue;return Z}}if(R.method==="next")R.sent=R._sent=R.arg;else if(R.method==="throw"){if(X===p)throw X=m,R.arg;R.dispatchException(R.arg)}else R.method==="return"&&R.abrupt("return",R.arg);X=y;var K=v(D,P,R);if(K.type==="normal"){if(X=R.done?m:g,K.arg===x)continue;return{value:K.arg,done:R.done}}K.type==="throw"&&(X=m,R.method="throw",R.arg=K.arg)}}}function L(D,P){var R=P.method,X=D.iterator[R];if(X===n)return P.delegate=null,R==="throw"&&D.iterator.return&&(P.method="return",P.arg=n,L(D,P),P.method==="throw")||R!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+R+"' method")),x;var Y=v(X,D.iterator,P.arg);if(Y.type==="throw")return P.method="throw",P.arg=Y.arg,P.delegate=null,x;var ee=Y.arg;return ee?ee.done?(P[D.resultName]=ee.value,P.next=D.nextLoc,P.method!=="return"&&(P.method="next",P.arg=n),P.delegate=null,x):ee:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,x)}function N(D){var P={tryLoc:D[0]};1 in D&&(P.catchLoc=D[1]),2 in D&&(P.finallyLoc=D[2],P.afterLoc=D[3]),this.tryEntries.push(P)}function O(D){var P=D.completion||{};P.type="normal",delete P.arg,D.completion=P}function B(D){this.tryEntries=[{tryLoc:"root"}],D.forEach(N,this),this.reset(!0)}function W(D){if(D||D===""){var P=D[f];if(P)return P.call(D);if(typeof D.next=="function")return D;if(!isNaN(D.length)){var R=-1,X=function Y(){for(;++R<D.length;)if(o.call(D,R))return Y.value=D[R],Y.done=!1,Y;return Y.value=n,Y.done=!0,Y};return X.next=X}}throw new TypeError(e(D)+" is not iterable")}return w.prototype=E,s(M,"constructor",{value:E,configurable:!0}),s(E,"constructor",{value:w,configurable:!0}),w.displayName=h(E,c,"GeneratorFunction"),i.isGeneratorFunction=function(D){var P=typeof D=="function"&&D.constructor;return!!P&&(P===w||(P.displayName||P.name)==="GeneratorFunction")},i.mark=function(D){return Object.setPrototypeOf?Object.setPrototypeOf(D,E):(D.__proto__=E,h(D,c,"GeneratorFunction")),D.prototype=Object.create(M),D},i.awrap=function(D){return{__await:D}},A(T.prototype),h(T.prototype,l,function(){return this}),i.AsyncIterator=T,i.async=function(D,P,R,X,Y){Y===void 0&&(Y=Promise);var ee=new T(d(D,P,R,X),Y);return i.isGeneratorFunction(P)?ee:ee.next().then(function(U){return U.done?U.value:ee.next()})},A(M),h(M,c,"Generator"),h(M,f,function(){return this}),h(M,"toString",function(){return"[object Generator]"}),i.keys=function(D){var P=Object(D),R=[];for(var X in P)R.push(X);return R.reverse(),function Y(){for(;R.length;){var ee=R.pop();if(ee in P)return Y.value=ee,Y.done=!1,Y}return Y.done=!0,Y}},i.values=W,B.prototype={constructor:B,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(O),!P)for(var R in this)R.charAt(0)==="t"&&o.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=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 R=this;function X(se,re){return U.type="throw",U.arg=P,R.next=se,re&&(R.method="next",R.arg=n),!!re}for(var Y=this.tryEntries.length-1;Y>=0;--Y){var ee=this.tryEntries[Y],U=ee.completion;if(ee.tryLoc==="root")return X("end");if(ee.tryLoc<=this.prev){var Z=o.call(ee,"catchLoc"),K=o.call(ee,"finallyLoc");if(Z&&K){if(this.prev<ee.catchLoc)return X(ee.catchLoc,!0);if(this.prev<ee.finallyLoc)return X(ee.finallyLoc)}else if(Z){if(this.prev<ee.catchLoc)return X(ee.catchLoc,!0)}else{if(!K)throw Error("try statement without catch or finally");if(this.prev<ee.finallyLoc)return X(ee.finallyLoc)}}}},abrupt:function(P,R){for(var X=this.tryEntries.length-1;X>=0;--X){var Y=this.tryEntries[X];if(Y.tryLoc<=this.prev&&o.call(Y,"finallyLoc")&&this.prev<Y.finallyLoc){var ee=Y;break}}ee&&(P==="break"||P==="continue")&&ee.tryLoc<=R&&R<=ee.finallyLoc&&(ee=null);var U=ee?ee.completion:{};return U.type=P,U.arg=R,ee?(this.method="next",this.next=ee.finallyLoc,x):this.complete(U)},complete:function(P,R){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"&&R&&(this.next=R),x},finish:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var X=this.tryEntries[R];if(X.finallyLoc===P)return this.complete(X.completion,X.afterLoc),O(X),x}},catch:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var X=this.tryEntries[R];if(X.tryLoc===P){var Y=X.completion;if(Y.type==="throw"){var ee=Y.arg;O(X)}return ee}}throw Error("illegal catch attempt")},delegateYield:function(P,R,X){return this.delegate={iterator:W(P),resultName:R,nextLoc:X},this.method==="next"&&(this.arg=n),x}},i}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports}(u0)),u0.exports}var l0,oM;function Zee(){if(oM)return l0;oM=1;var r=Hee()();l0=r;try{regeneratorRuntime=r}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}return l0}var Kee=Zee();const Mn=va(Kee);var Qee=1;function QO(){return Qee++}var Pe;(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"})(Pe||(Pe={}));var Jee=function(){function r(){$i(this,r),this.config=void 0}return Xi(r,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),r}(),Wl;(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>[]"})(Wl||(Wl={}));var sM;(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"})(sM||(sM={}));var Ju;(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"})(Ju||(Ju={}));var wl;(function(r){r.GLSL100="GLSL100",r.GLSL450="GLSL450",r.WGSL="WGSL"})(wl||(wl={}));var ete="__DefineValuePlaceholder__";function tte(){if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function uM(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 fM(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uM(Object(t),!0).forEach(function(n){et(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):uM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var JO=function(){function r(e,t){$i(this,r),this.engine=e,this.configService=t,this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}return Xi(r,[{key:"init",value:function(){var t=this.configService.get(),n=t.canvas,i=t.engineOptions;this.initPromise=this.engine.init(fM({canvas:n||tte(),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=Xee(n)||sv(n)||qee(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===Ju.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=wo(Mn.mark(function n(){var i=this,a,o,s=arguments;return Mn.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=wo(Mn.mark(function n(){return Mn.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=wo(Mn.mark(function n(){var i,a,o;return Mn.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.initPromise;case 2:return i=fM({},this.compiledBundle.context),a=this.engine.supportWebGPU?this.engine.useWGSL?wl.WGSL:wl.GLSL450:wl.GLSL100,o=this.compiledBundle.shaders[a],i.defines.filter(function(f){return f.runtime}).forEach(function(f){var l="".concat(ete).concat(f.name);o=o.replace(l,"".concat(f.value))}),i.shader=o,i.uniforms.forEach(function(f){if(!f.data&&f.storageClass===Ju.StorageBuffer){var l=1;f.type===Wl.FloatArray?l=1:f.type===Wl.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}(),Ed={exports:{}},rte=Ed.exports,lM;function nte(){return lM||(lM=1,function(r,e){(function(t,n){r.exports=n()})(rte,function(){var t=function(k){return k instanceof Uint8Array||k instanceof Uint16Array||k instanceof Uint32Array||k instanceof Int8Array||k instanceof Int16Array||k instanceof Int32Array||k instanceof Float32Array||k instanceof Float64Array||k instanceof Uint8ClampedArray},n=function(k,j){for(var Q=Object.keys(j),ye=0;ye<Q.length;++ye)k[Q[ye]]=j[Q[ye]];return k},i=`
|
|
41
|
+
`;function a(k){return typeof atob<"u"?atob(k):"base64:"+k}function o(k){var j=new Error("(regl) "+k);throw console.error(j),j}function s(k,j){k||o(j)}function u(k){return k?": "+k:""}function f(k,j,Q){k in j||o("unknown parameter ("+k+")"+u(Q)+". possible values: "+Object.keys(j).join())}function l(k,j){t(k)||o("invalid parameter type"+u(j)+". must be a typed array")}function c(k,j){switch(j){case"number":return typeof k=="number";case"object":return typeof k=="object";case"string":return typeof k=="string";case"boolean":return typeof k=="boolean";case"function":return typeof k=="function";case"undefined":return typeof k>"u";case"symbol":return typeof k=="symbol"}}function h(k,j,Q){c(k,j)||o("invalid parameter type"+u(Q)+". expected "+j+", got "+typeof k)}function d(k,j){k>=0&&(k|0)===k||o("invalid parameter type, ("+k+")"+u(j)+". must be a nonnegative integer")}function v(k,j,Q){j.indexOf(k)<0&&o("invalid value"+u(Q)+". must be one of: "+j)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(k){Object.keys(k).forEach(function(j){p.indexOf(j)<0&&o('invalid regl constructor argument "'+j+'". must be one of '+p)})}function y(k,j){for(k=k+"";k.length<j;)k=" "+k;return k}function m(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function x(k,j){this.number=k,this.line=j,this.errors=[]}function b(k,j,Q){this.file=k,this.line=j,this.message=Q}function w(){var k=new Error,j=(k.stack||k).toString(),Q=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(j);if(Q)return Q[1];var ye=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(j);return ye?ye[1]:"unknown"}function E(){var k=new Error,j=(k.stack||k).toString(),Q=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(j);if(Q)return Q[1];var ye=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(j);return ye?ye[1]:"unknown"}function S(k,j){var Q=k.split(`
|
|
42
|
+
`),ye=1,Me=0,ge={unknown:new m,0:new m};ge.unknown.name=ge[0].name=j||w(),ge.unknown.lines.push(new x(0,""));for(var xe=0;xe<Q.length;++xe){var Oe=Q[xe],Re=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Oe);if(Re)switch(Re[1]){case"line":var je=/(\d+)(\s+\d+)?/.exec(Re[2]);je&&(ye=je[1]|0,je[2]&&(Me=je[2]|0,Me in ge||(ge[Me]=new m)));break;case"define":var Be=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Re[2]);Be&&(ge[Me].name=Be[1]?a(Be[2]):Be[2]);break}ge[Me].lines.push(new x(ye++,Oe))}return Object.keys(ge).forEach(function($e){var He=ge[$e];He.lines.forEach(function(De){He.index[De.number]=De})}),ge}function _(k){var j=[];return k.split(`
|
|
43
|
+
`).forEach(function(Q){if(!(Q.length<5)){var ye=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(Q);ye?j.push(new b(ye[1]|0,ye[2]|0,ye[3].trim())):Q.length>0&&j.push(new b("unknown",0,Q))}}),j}function C(k,j){j.forEach(function(Q){var ye=k[Q.file];if(ye){var Me=ye.index[Q.line];if(Me){Me.errors.push(Q),ye.hasErrors=!0;return}}k.unknown.hasErrors=!0,k.unknown.lines[0].errors.push(Q)})}function M(k,j,Q,ye,Me){if(!k.getShaderParameter(j,k.COMPILE_STATUS)){var ge=k.getShaderInfoLog(j),xe=ye===k.FRAGMENT_SHADER?"fragment":"vertex";B(Q,"string",xe+" shader source must be a string",Me);var Oe=S(Q,Me),Re=_(ge);C(Oe,Re),Object.keys(Oe).forEach(function(je){var Be=Oe[je];if(!Be.hasErrors)return;var $e=[""],He=[""];function De(Xe,ce){$e.push(Xe),He.push(ce||"")}De("file number "+je+": "+Be.name+`
|
|
44
|
+
`,"color:red;text-decoration:underline;font-weight:bold"),Be.lines.forEach(function(Xe){if(Xe.errors.length>0){De(y(Xe.number,4)+"| ","background-color:yellow; font-weight:bold"),De(Xe.line+i,"color:red; background-color:yellow; font-weight:bold");var ce=0;Xe.errors.forEach(function(we){var ze=we.message,Qe=/^\s*'(.*)'\s*:\s*(.*)$/.exec(ze);if(Qe){var ke=Qe[1];switch(ze=Qe[2],ke){case"assign":ke="=";break}ce=Math.max(Xe.line.indexOf(ke,ce),0)}else ce=0;De(y("| ",6)),De(y("^^^",ce+3)+i,"font-weight:bold"),De(y("| ",6)),De(ze+i,"font-weight:bold")}),De(y("| ",6)+i)}else De(y(Xe.number,4)+"| "),De(Xe.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(He[0]=$e.join("%c"),console.log.apply(console,He)):console.log($e.join(""))}),s.raise("Error compiling "+xe+" shader, "+Oe[0].name)}}function A(k,j,Q,ye,Me){if(!k.getProgramParameter(j,k.LINK_STATUS)){var ge=k.getProgramInfoLog(j),xe=S(Q,Me),Oe=S(ye,Me),Re='Error linking program with vertex shader, "'+Oe[0].name+'", and fragment shader "'+xe[0].name+'"';typeof document<"u"?console.log("%c"+Re+i+"%c"+ge,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Re+i+ge),s.raise(Re)}}function T(k){k._commandRef=w()}function I(k,j,Q,ye){T(k);function Me(Re){return Re?ye.id(Re):0}k._fragId=Me(k.static.frag),k._vertId=Me(k.static.vert);function ge(Re,je){Object.keys(je).forEach(function(Be){Re[ye.id(Be)]=!0})}var xe=k._uniformSet={};ge(xe,j.static),ge(xe,j.dynamic);var Oe=k._attributeSet={};ge(Oe,Q.static),ge(Oe,Q.dynamic),k._hasCount="count"in k.static||"count"in k.dynamic||"elements"in k.static||"elements"in k.dynamic}function L(k,j){var Q=E();o(k+" in command "+(j||w())+(Q==="unknown"?"":" called from "+Q))}function N(k,j,Q){k||L(j,Q||w())}function O(k,j,Q,ye){k in j||L("unknown parameter ("+k+")"+u(Q)+". possible values: "+Object.keys(j).join(),ye||w())}function B(k,j,Q,ye){c(k,j)||L("invalid parameter type"+u(Q)+". expected "+j+", got "+typeof k,ye||w())}function W(k){k()}function D(k,j,Q){k.texture?v(k.texture._texture.internalformat,j,"unsupported texture format for attachment"):v(k.renderbuffer._renderbuffer.format,Q,"unsupported renderbuffer format for attachment")}var P=33071,R=9728,X=9984,Y=9985,ee=9986,U=9987,Z=5120,K=5121,se=5122,re=5123,J=5124,me=5125,Ae=5126,Ye=32819,Ve=32820,Ke=33635,xt=34042,kt=36193,Lt={};Lt[Z]=Lt[K]=1,Lt[se]=Lt[re]=Lt[kt]=Lt[Ke]=Lt[Ye]=Lt[Ve]=2,Lt[J]=Lt[me]=Lt[Ae]=Lt[xt]=4;function vr(k,j){return k===Ve||k===Ye||k===Ke?2:k===xt?4:Lt[k]*j}function xr(k){return!(k&k-1)&&!!k}function pt(k,j,Q){var ye,Me=j.width,ge=j.height,xe=j.channels;s(Me>0&&Me<=Q.maxTextureSize&&ge>0&&ge<=Q.maxTextureSize,"invalid texture shape"),(k.wrapS!==P||k.wrapT!==P)&&s(xr(Me)&&xr(ge),"incompatible wrap mode for texture, both width and height must be power of 2"),j.mipmask===1?Me!==1&&ge!==1&&s(k.minFilter!==X&&k.minFilter!==ee&&k.minFilter!==Y&&k.minFilter!==U,"min filter requires mipmap"):(s(xr(Me)&&xr(ge),"texture must be a square power of 2 to support mipmapping"),s(j.mipmask===(Me<<1)-1,"missing or incomplete mipmap data")),j.type===Ae&&(Q.extensions.indexOf("oes_texture_float_linear")<0&&s(k.minFilter===R&&k.magFilter===R,"filter not supported, must enable oes_texture_float_linear"),s(!k.genMipmaps,"mipmap generation not supported with float textures"));var Oe=j.images;for(ye=0;ye<16;++ye)if(Oe[ye]){var Re=Me>>ye,je=ge>>ye;s(j.mipmask&1<<ye,"missing mipmap data");var Be=Oe[ye];if(s(Be.width===Re&&Be.height===je,"invalid shape for mip images"),s(Be.format===j.format&&Be.internalformat===j.internalformat&&Be.type===j.type,"incompatible type for mip image"),!Be.compressed)if(Be.data){var $e=Math.ceil(vr(Be.type,xe)*Re/Be.unpackAlignment)*Be.unpackAlignment;s(Be.data.byteLength===$e*je,"invalid data for image, buffer size is inconsistent with image format")}else Be.element||Be.copy}else k.genMipmaps||s((j.mipmask&1<<ye)===0,"extra mipmap data");j.compressed&&s(!k.genMipmaps,"mipmap generation for compressed images not supported")}function Nt(k,j,Q,ye){var Me=k.width,ge=k.height,xe=k.channels;s(Me>0&&Me<=ye.maxTextureSize&&ge>0&&ge<=ye.maxTextureSize,"invalid texture shape"),s(Me===ge,"cube map must be square"),s(j.wrapS===P&&j.wrapT===P,"wrap mode not supported by cube map");for(var Oe=0;Oe<Q.length;++Oe){var Re=Q[Oe];s(Re.width===Me&&Re.height===ge,"inconsistent cube map face shape"),j.genMipmaps&&(s(!Re.compressed,"can not generate mipmap for compressed textures"),s(Re.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var je=Re.images,Be=0;Be<16;++Be){var $e=je[Be];if($e){var He=Me>>Be,De=ge>>Be;s(Re.mipmask&1<<Be,"missing mipmap data"),s($e.width===He&&$e.height===De,"invalid shape for mip images"),s($e.format===k.format&&$e.internalformat===k.internalformat&&$e.type===k.type,"incompatible type for mip image"),$e.compressed||($e.data?s($e.data.byteLength===He*De*Math.max(vr($e.type,xe),$e.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):$e.element||$e.copy)}}}}var F=n(s,{optional:W,raise:o,commandRaise:L,command:N,parameter:f,commandParameter:O,constructor:g,type:h,commandType:B,isTypedArray:l,nni:d,oneOf:v,shaderError:M,linkError:A,callSite:E,saveCommandRef:T,saveDrawInfo:I,framebufferFormat:D,guessCommand:w,texture2D:pt,textureCube:Nt}),zt=0,Ot=0,ut=5,Gt=6;function _t(k,j){this.id=zt++,this.type=k,this.data=j}function ct(k){return k.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function ve(k){if(k.length===0)return[];var j=k.charAt(0),Q=k.charAt(k.length-1);if(k.length>1&&j===Q&&(j==='"'||j==="'"))return['"'+ct(k.substr(1,k.length-2))+'"'];var ye=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(k);if(ye)return ve(k.substr(0,ye.index)).concat(ve(ye[1])).concat(ve(k.substr(ye.index+ye[0].length)));var Me=k.split(".");if(Me.length===1)return['"'+ct(k)+'"'];for(var ge=[],xe=0;xe<Me.length;++xe)ge=ge.concat(ve(Me[xe]));return ge}function Te(k){return"["+ve(k).join("][")+"]"}function nt(k,j){return new _t(k,Te(j+""))}function st(k){return typeof k=="function"&&!k._reglType||k instanceof _t}function gt(k,j){if(typeof k=="function")return new _t(Ot,k);if(typeof k=="number"||typeof k=="boolean")return new _t(ut,k);if(Array.isArray(k))return new _t(Gt,k.map((Q,ye)=>gt(Q,j+"["+ye+"]")));if(k instanceof _t)return k;F(!1,"invalid option type in uniform "+j)}var Ct={DynamicVariable:_t,define:nt,isDynamic:st,unbox:gt,accessor:Te},Bt={next:typeof requestAnimationFrame=="function"?function(k){return requestAnimationFrame(k)}:function(k){return setTimeout(k,16)},cancel:typeof cancelAnimationFrame=="function"?function(k){return cancelAnimationFrame(k)}:clearTimeout},Sr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function yr(){var k={"":0},j=[""];return{id:function(Q){var ye=k[Q];return ye||(ye=k[Q]=j.length,j.push(Q),ye)},str:function(Q){return j[Q]}}}function Rr(k,j,Q){var ye=document.createElement("canvas");n(ye.style,{border:0,margin:0,padding:0,top:0,left:0}),k.appendChild(ye),k===document.body&&(ye.style.position="absolute",n(k.style,{margin:0,padding:0}));function Me(){var Oe=window.innerWidth,Re=window.innerHeight;if(k!==document.body){var je=k.getBoundingClientRect();Oe=je.right-je.left,Re=je.bottom-je.top}ye.width=Q*Oe,ye.height=Q*Re,n(ye.style,{width:Oe+"px",height:Re+"px"})}var ge;k!==document.body&&typeof ResizeObserver=="function"?(ge=new ResizeObserver(function(){setTimeout(Me)}),ge.observe(k)):window.addEventListener("resize",Me,!1);function xe(){ge?ge.disconnect():window.removeEventListener("resize",Me),k.removeChild(ye)}return Me(),{canvas:ye,onDestroy:xe}}function wt(k,j){function Q(ye){try{return k.getContext(ye,j)}catch{return null}}return Q("webgl")||Q("experimental-webgl")||Q("webgl-experimental")}function er(k){return typeof k.nodeName=="string"&&typeof k.appendChild=="function"&&typeof k.getBoundingClientRect=="function"}function ir(k){return typeof k.drawArrays=="function"||typeof k.drawElements=="function"}function Yt(k){return typeof k=="string"?k.split():(F(Array.isArray(k),"invalid extension array"),k)}function br(k){return typeof k=="string"?(F(typeof document<"u","not supported outside of DOM"),document.querySelector(k)):k}function It(k){var j=k||{},Q,ye,Me,ge,xe={},Oe=[],Re=[],je=typeof window>"u"?1:window.devicePixelRatio,Be=!1,$e=function(Xe){Xe&&F.raise(Xe)},He=function(){};if(typeof j=="string"?(F(typeof document<"u","selector queries only supported in DOM enviroments"),Q=document.querySelector(j),F(Q,"invalid query string for element")):typeof j=="object"?er(j)?Q=j:ir(j)?(ge=j,Me=ge.canvas):(F.constructor(j),"gl"in j?ge=j.gl:"canvas"in j?Me=br(j.canvas):"container"in j&&(ye=br(j.container)),"attributes"in j&&(xe=j.attributes,F.type(xe,"object","invalid context attributes")),"extensions"in j&&(Oe=Yt(j.extensions)),"optionalExtensions"in j&&(Re=Yt(j.optionalExtensions)),"onDone"in j&&(F.type(j.onDone,"function","invalid or missing onDone callback"),$e=j.onDone),"profile"in j&&(Be=!!j.profile),"pixelRatio"in j&&(je=+j.pixelRatio,F(je>0,"invalid pixel ratio"))):F.raise("invalid arguments to regl"),Q&&(Q.nodeName.toLowerCase()==="canvas"?Me=Q:ye=Q),!ge){if(!Me){F(typeof document<"u","must manually specify webgl context outside of DOM environments");var De=Rr(ye||document.body,$e,je);if(!De)return null;Me=De.canvas,He=De.onDestroy}xe.premultipliedAlpha===void 0&&(xe.premultipliedAlpha=!0),ge=wt(Me,xe)}return ge?{gl:ge,canvas:Me,container:ye,extensions:Oe,optionalExtensions:Re,pixelRatio:je,profile:Be,onDone:$e,onDestroy:He}:(He(),$e("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function wr(k,j){var Q={};function ye(xe){F.type(xe,"string","extension name must be string");var Oe=xe.toLowerCase(),Re;try{Re=Q[Oe]=k.getExtension(Oe)}catch{}return!!Re}for(var Me=0;Me<j.extensions.length;++Me){var ge=j.extensions[Me];if(!ye(ge))return j.onDestroy(),j.onDone('"'+ge+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return j.optionalExtensions.forEach(ye),{extensions:Q,restore:function(){Object.keys(Q).forEach(function(xe){if(Q[xe]&&!ye(xe))throw new Error("(regl): error restoring extension "+xe)})}}}function Ht(k,j){for(var Q=Array(k),ye=0;ye<k;++ye)Q[ye]=j(ye);return Q}var fr=5120,mr=5121,Lr=5122,Vr=5123,cn=5124,Mr=5125,hn=5126;function rn(k){for(var j=16;j<=1<<28;j*=16)if(k<=j)return j;return 0}function sr(k){var j,Q;return j=(k>65535)<<4,k>>>=j,Q=(k>255)<<3,k>>>=Q,j|=Q,Q=(k>15)<<2,k>>>=Q,j|=Q,Q=(k>3)<<1,k>>>=Q,j|=Q,j|k>>1}function Er(){var k=Ht(8,function(){return[]});function j(ge){var xe=rn(ge),Oe=k[sr(xe)>>2];return Oe.length>0?Oe.pop():new ArrayBuffer(xe)}function Q(ge){k[sr(ge.byteLength)>>2].push(ge)}function ye(ge,xe){var Oe=null;switch(ge){case fr:Oe=new Int8Array(j(xe),0,xe);break;case mr:Oe=new Uint8Array(j(xe),0,xe);break;case Lr:Oe=new Int16Array(j(2*xe),0,xe);break;case Vr:Oe=new Uint16Array(j(2*xe),0,xe);break;case cn:Oe=new Int32Array(j(4*xe),0,xe);break;case Mr:Oe=new Uint32Array(j(4*xe),0,xe);break;case hn:Oe=new Float32Array(j(4*xe),0,xe);break;default:return null}return Oe.length!==xe?Oe.subarray(0,xe):Oe}function Me(ge){Q(ge.buffer)}return{alloc:j,free:Q,allocType:ye,freeType:Me}}var jt=Er();jt.zero=Er();var _r=3408,an=3410,xa=3411,Xn=3412,Ha=3413,js=3414,Us=3415,$s=33901,of=33902,uc=3379,tp=3386,rp=34921,np=36347,Xs=36348,yi=35661,Ys=35660,Cr=34930,In=36349,Hr=34076,ti=34024,wa=7936,fc=7937,lc=7938,sf=35724,cc=34047,hc=36063,dc=34852,vc=3553,U1=34067,WD=34069,qD=33984,uf=6408,ip=5126,$1=5121,ap=36160,VD=36053,HD=36064,ZD=16384,KD=function(k,j){var Q=1;j.ext_texture_filter_anisotropic&&(Q=k.getParameter(cc));var ye=1,Me=1;j.webgl_draw_buffers&&(ye=k.getParameter(dc),Me=k.getParameter(hc));var ge=!!j.oes_texture_float;if(ge){var xe=k.createTexture();k.bindTexture(vc,xe),k.texImage2D(vc,0,uf,1,1,0,uf,ip,null);var Oe=k.createFramebuffer();if(k.bindFramebuffer(ap,Oe),k.framebufferTexture2D(ap,HD,vc,xe,0),k.bindTexture(vc,null),k.checkFramebufferStatus(ap)!==VD)ge=!1;else{k.viewport(0,0,1,1),k.clearColor(1,0,0,1),k.clear(ZD);var Re=jt.allocType(ip,4);k.readPixels(0,0,1,1,uf,ip,Re),k.getError()?ge=!1:(k.deleteFramebuffer(Oe),k.deleteTexture(xe),ge=Re[0]===1),jt.freeType(Re)}}var je=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Be=!0;if(!je){var $e=k.createTexture(),He=jt.allocType($1,36);k.activeTexture(qD),k.bindTexture(U1,$e),k.texImage2D(WD,0,uf,3,3,0,uf,$1,He),jt.freeType(He),k.bindTexture(U1,null),k.deleteTexture($e),Be=!k.getError()}return{colorBits:[k.getParameter(an),k.getParameter(xa),k.getParameter(Xn),k.getParameter(Ha)],depthBits:k.getParameter(js),stencilBits:k.getParameter(Us),subpixelBits:k.getParameter(_r),extensions:Object.keys(j).filter(function(De){return!!j[De]}),maxAnisotropic:Q,maxDrawbuffers:ye,maxColorAttachments:Me,pointSizeDims:k.getParameter($s),lineWidthDims:k.getParameter(of),maxViewportDims:k.getParameter(tp),maxCombinedTextureUnits:k.getParameter(yi),maxCubeMapSize:k.getParameter(Hr),maxRenderbufferSize:k.getParameter(ti),maxTextureUnits:k.getParameter(Cr),maxTextureSize:k.getParameter(uc),maxAttributes:k.getParameter(rp),maxVertexUniforms:k.getParameter(np),maxVertexTextureUnits:k.getParameter(Ys),maxVaryingVectors:k.getParameter(Xs),maxFragmentUniforms:k.getParameter(In),glsl:k.getParameter(sf),renderer:k.getParameter(fc),vendor:k.getParameter(wa),version:k.getParameter(lc),readFloat:ge,npotTextureCube:Be}};function mi(k){return!!k&&typeof k=="object"&&Array.isArray(k.shape)&&Array.isArray(k.stride)&&typeof k.offset=="number"&&k.shape.length===k.stride.length&&(Array.isArray(k.data)||t(k.data))}var Yn=function(k){return Object.keys(k).map(function(j){return k[j]})},pc={shape:tP,flatten:eP};function QD(k,j,Q){for(var ye=0;ye<j;++ye)Q[ye]=k[ye]}function JD(k,j,Q,ye){for(var Me=0,ge=0;ge<j;++ge)for(var xe=k[ge],Oe=0;Oe<Q;++Oe)ye[Me++]=xe[Oe]}function X1(k,j,Q,ye,Me,ge){for(var xe=ge,Oe=0;Oe<j;++Oe)for(var Re=k[Oe],je=0;je<Q;++je)for(var Be=Re[je],$e=0;$e<ye;++$e)Me[xe++]=Be[$e]}function Y1(k,j,Q,ye,Me){for(var ge=1,xe=Q+1;xe<j.length;++xe)ge*=j[xe];var Oe=j[Q];if(j.length-Q===4){var Re=j[Q+1],je=j[Q+2],Be=j[Q+3];for(xe=0;xe<Oe;++xe)X1(k[xe],Re,je,Be,ye,Me),Me+=ge}else for(xe=0;xe<Oe;++xe)Y1(k[xe],j,Q+1,ye,Me),Me+=ge}function eP(k,j,Q,ye){var Me=1;if(j.length)for(var ge=0;ge<j.length;++ge)Me*=j[ge];else Me=0;var xe=ye||jt.allocType(Q,Me);switch(j.length){case 0:break;case 1:QD(k,j[0],xe);break;case 2:JD(k,j[0],j[1],xe);break;case 3:X1(k,j[0],j[1],j[2],xe,0);break;default:Y1(k,j,0,xe,0)}return xe}function tP(k){for(var j=[],Q=k;Q.length;Q=Q[0])j.push(Q.length);return j}var op={"[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},rP=5120,nP=5122,iP=5124,aP=5121,oP=5123,sP=5125,uP=5126,fP=5126,No={int8:rP,int16:nP,int32:iP,uint8:aP,uint16:oP,uint32:sP,float:uP,float32:fP},lP=35048,cP=35040,gc={dynamic:lP,stream:cP,static:35044},sp=pc.flatten,W1=pc.shape,q1=35044,hP=35040,up=5121,fp=5126,Za=[];Za[5120]=1,Za[5122]=2,Za[5124]=4,Za[5121]=1,Za[5123]=2,Za[5125]=4,Za[5126]=4;function yc(k){return op[Object.prototype.toString.call(k)]|0}function V1(k,j){for(var Q=0;Q<j.length;++Q)k[Q]=j[Q]}function H1(k,j,Q,ye,Me,ge,xe){for(var Oe=0,Re=0;Re<Q;++Re)for(var je=0;je<ye;++je)k[Oe++]=j[Me*Re+ge*je+xe]}function dP(k,j,Q,ye){var Me=0,ge={};function xe(ce){this.id=Me++,this.buffer=k.createBuffer(),this.type=ce,this.usage=q1,this.byteLength=0,this.dimension=1,this.dtype=up,this.persistentData=null,Q.profile&&(this.stats={size:0})}xe.prototype.bind=function(){k.bindBuffer(this.type,this.buffer)},xe.prototype.destroy=function(){He(this)};var Oe=[];function Re(ce,we){var ze=Oe.pop();return ze||(ze=new xe(ce)),ze.bind(),$e(ze,we,hP,0,1,!1),ze}function je(ce){Oe.push(ce)}function Be(ce,we,ze){ce.byteLength=we.byteLength,k.bufferData(ce.type,we,ze)}function $e(ce,we,ze,Qe,ke,tt){var Ne;if(ce.usage=ze,Array.isArray(we)){if(ce.dtype=Qe||fp,we.length>0){var We;if(Array.isArray(we[0])){Ne=W1(we);for(var Le=1,qe=1;qe<Ne.length;++qe)Le*=Ne[qe];ce.dimension=Le,We=sp(we,Ne,ce.dtype),Be(ce,We,ze),tt?ce.persistentData=We:jt.freeType(We)}else if(typeof we[0]=="number"){ce.dimension=ke;var yt=jt.allocType(ce.dtype,we.length);V1(yt,we),Be(ce,yt,ze),tt?ce.persistentData=yt:jt.freeType(yt)}else t(we[0])?(ce.dimension=we[0].length,ce.dtype=Qe||yc(we[0])||fp,We=sp(we,[we.length,we[0].length],ce.dtype),Be(ce,We,ze),tt?ce.persistentData=We:jt.freeType(We)):F.raise("invalid buffer data")}}else if(t(we))ce.dtype=Qe||yc(we),ce.dimension=ke,Be(ce,we,ze),tt&&(ce.persistentData=new Uint8Array(new Uint8Array(we.buffer)));else if(mi(we)){Ne=we.shape;var Dt=we.stride,Ze=we.offset,Ue=0,Ie=0,Tt=0,Ut=0;Ne.length===1?(Ue=Ne[0],Ie=1,Tt=Dt[0],Ut=0):Ne.length===2?(Ue=Ne[0],Ie=Ne[1],Tt=Dt[0],Ut=Dt[1]):F.raise("invalid shape"),ce.dtype=Qe||yc(we.data)||fp,ce.dimension=Ie;var it=jt.allocType(ce.dtype,Ue*Ie);H1(it,we.data,Ue,Ie,Tt,Ut,Ze),Be(ce,it,ze),tt?ce.persistentData=it:jt.freeType(it)}else we instanceof ArrayBuffer?(ce.dtype=up,ce.dimension=ke,Be(ce,we,ze),tt&&(ce.persistentData=new Uint8Array(new Uint8Array(we)))):F.raise("invalid buffer data")}function He(ce){j.bufferCount--,ye(ce);var we=ce.buffer;F(we,"buffer must not be deleted already"),k.deleteBuffer(we),ce.buffer=null,delete ge[ce.id]}function De(ce,we,ze,Qe){j.bufferCount++;var ke=new xe(we);ge[ke.id]=ke;function tt(Le){var qe=q1,yt=null,Dt=0,Ze=0,Ue=1;return Array.isArray(Le)||t(Le)||mi(Le)||Le instanceof ArrayBuffer?yt=Le:typeof Le=="number"?Dt=Le|0:Le&&(F.type(Le,"object","buffer arguments must be an object, a number or an array"),"data"in Le&&(F(yt===null||Array.isArray(yt)||t(yt)||mi(yt),"invalid data for buffer"),yt=Le.data),"usage"in Le&&(F.parameter(Le.usage,gc,"invalid buffer usage"),qe=gc[Le.usage]),"type"in Le&&(F.parameter(Le.type,No,"invalid buffer type"),Ze=No[Le.type]),"dimension"in Le&&(F.type(Le.dimension,"number","invalid dimension"),Ue=Le.dimension|0),"length"in Le&&(F.nni(Dt,"buffer length must be a nonnegative integer"),Dt=Le.length|0)),ke.bind(),yt?$e(ke,yt,qe,Ze,Ue,Qe):(Dt&&k.bufferData(ke.type,Dt,qe),ke.dtype=Ze||up,ke.usage=qe,ke.dimension=Ue,ke.byteLength=Dt),Q.profile&&(ke.stats.size=ke.byteLength*Za[ke.dtype]),tt}function Ne(Le,qe){F(qe+Le.byteLength<=ke.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+Le.byteLength+" starting from offset "+qe+" to a buffer of size "+ke.byteLength),k.bufferSubData(ke.type,qe,Le)}function We(Le,qe){var yt=(qe||0)|0,Dt;if(ke.bind(),t(Le)||Le instanceof ArrayBuffer)Ne(Le,yt);else if(Array.isArray(Le)){if(Le.length>0)if(typeof Le[0]=="number"){var Ze=jt.allocType(ke.dtype,Le.length);V1(Ze,Le),Ne(Ze,yt),jt.freeType(Ze)}else if(Array.isArray(Le[0])||t(Le[0])){Dt=W1(Le);var Ue=sp(Le,Dt,ke.dtype);Ne(Ue,yt),jt.freeType(Ue)}else F.raise("invalid buffer data")}else if(mi(Le)){Dt=Le.shape;var Ie=Le.stride,Tt=0,Ut=0,it=0,qt=0;Dt.length===1?(Tt=Dt[0],Ut=1,it=Ie[0],qt=0):Dt.length===2?(Tt=Dt[0],Ut=Dt[1],it=Ie[0],qt=Ie[1]):F.raise("invalid shape");var Pt=Array.isArray(Le.data)?ke.dtype:yc(Le.data),Wt=jt.allocType(Pt,Tt*Ut);H1(Wt,Le.data,Tt,Ut,it,qt,Le.offset),Ne(Wt,yt),jt.freeType(Wt)}else F.raise("invalid data for buffer subdata");return tt}return ze||tt(ce),tt._reglType="buffer",tt._buffer=ke,tt.subdata=We,Q.profile&&(tt.stats=ke.stats),tt.destroy=function(){He(ke)},tt}function Xe(){Yn(ge).forEach(function(ce){ce.buffer=k.createBuffer(),k.bindBuffer(ce.type,ce.buffer),k.bufferData(ce.type,ce.persistentData||ce.byteLength,ce.usage)})}return Q.profile&&(j.getTotalBufferSize=function(){var ce=0;return Object.keys(ge).forEach(function(we){ce+=ge[we].stats.size}),ce}),{create:De,createStream:Re,destroyStream:je,clear:function(){Yn(ge).forEach(He),Oe.forEach(He)},getBuffer:function(ce){return ce&&ce._buffer instanceof xe?ce._buffer:null},restore:Xe,_initBuffer:$e}}var vP=0,pP=0,gP=1,yP=1,mP=4,bP=4,Ws={points:vP,point:pP,lines:gP,line:yP,triangles:mP,triangle:bP,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},xP=0,wP=1,ff=4,EP=5120,qs=5121,Z1=5122,Vs=5123,K1=5124,Oo=5125,lp=34963,_P=35040,SP=35044;function MP(k,j,Q,ye){var Me={},ge=0,xe={uint8:qs,uint16:Vs};j.oes_element_index_uint&&(xe.uint32=Oo);function Oe(Xe){this.id=ge++,Me[this.id]=this,this.buffer=Xe,this.primType=ff,this.vertCount=0,this.type=0}Oe.prototype.bind=function(){this.buffer.bind()};var Re=[];function je(Xe){var ce=Re.pop();return ce||(ce=new Oe(Q.create(null,lp,!0,!1)._buffer)),$e(ce,Xe,_P,-1,-1,0,0),ce}function Be(Xe){Re.push(Xe)}function $e(Xe,ce,we,ze,Qe,ke,tt){Xe.buffer.bind();var Ne;if(ce){var We=tt;!tt&&(!t(ce)||mi(ce)&&!t(ce.data))&&(We=j.oes_element_index_uint?Oo:Vs),Q._initBuffer(Xe.buffer,ce,we,We,3)}else k.bufferData(lp,ke,we),Xe.buffer.dtype=Ne||qs,Xe.buffer.usage=we,Xe.buffer.dimension=3,Xe.buffer.byteLength=ke;if(Ne=tt,!tt){switch(Xe.buffer.dtype){case qs:case EP:Ne=qs;break;case Vs:case Z1:Ne=Vs;break;case Oo:case K1:Ne=Oo;break;default:F.raise("unsupported type for element array")}Xe.buffer.dtype=Ne}Xe.type=Ne,F(Ne!==Oo||!!j.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Le=Qe;Le<0&&(Le=Xe.buffer.byteLength,Ne===Vs?Le>>=1:Ne===Oo&&(Le>>=2)),Xe.vertCount=Le;var qe=ze;if(ze<0){qe=ff;var yt=Xe.buffer.dimension;yt===1&&(qe=xP),yt===2&&(qe=wP),yt===3&&(qe=ff)}Xe.primType=qe}function He(Xe){ye.elementsCount--,F(Xe.buffer!==null,"must not double destroy elements"),delete Me[Xe.id],Xe.buffer.destroy(),Xe.buffer=null}function De(Xe,ce){var we=Q.create(null,lp,!0),ze=new Oe(we._buffer);ye.elementsCount++;function Qe(ke){if(!ke)we(),ze.primType=ff,ze.vertCount=0,ze.type=qs;else if(typeof ke=="number")we(ke),ze.primType=ff,ze.vertCount=ke|0,ze.type=qs;else{var tt=null,Ne=SP,We=-1,Le=-1,qe=0,yt=0;Array.isArray(ke)||t(ke)||mi(ke)?tt=ke:(F.type(ke,"object","invalid arguments for elements"),"data"in ke&&(tt=ke.data,F(Array.isArray(tt)||t(tt)||mi(tt),"invalid data for element buffer")),"usage"in ke&&(F.parameter(ke.usage,gc,"invalid element buffer usage"),Ne=gc[ke.usage]),"primitive"in ke&&(F.parameter(ke.primitive,Ws,"invalid element buffer primitive"),We=Ws[ke.primitive]),"count"in ke&&(F(typeof ke.count=="number"&&ke.count>=0,"invalid vertex count for elements"),Le=ke.count|0),"type"in ke&&(F.parameter(ke.type,xe,"invalid buffer type"),yt=xe[ke.type]),"length"in ke?qe=ke.length|0:(qe=Le,yt===Vs||yt===Z1?qe*=2:(yt===Oo||yt===K1)&&(qe*=4))),$e(ze,tt,Ne,We,Le,qe,yt)}return Qe}return Qe(Xe),Qe._reglType="elements",Qe._elements=ze,Qe.subdata=function(ke,tt){return we.subdata(ke,tt),Qe},Qe.destroy=function(){He(ze)},Qe}return{create:De,createStream:je,destroyStream:Be,getElements:function(Xe){return typeof Xe=="function"&&Xe._elements instanceof Oe?Xe._elements:null},clear:function(){Yn(Me).forEach(He)}}}var Q1=new Float32Array(1),CP=new Uint32Array(Q1.buffer),AP=5123;function J1(k){for(var j=jt.allocType(AP,k.length),Q=0;Q<k.length;++Q)if(isNaN(k[Q]))j[Q]=65535;else if(k[Q]===1/0)j[Q]=31744;else if(k[Q]===-1/0)j[Q]=64512;else{Q1[0]=k[Q];var ye=CP[0],Me=ye>>>31<<15,ge=(ye<<1>>>24)-127,xe=ye>>13&1023;if(ge<-24)j[Q]=Me;else if(ge<-14){var Oe=-14-ge;j[Q]=Me+(xe+1024>>Oe)}else ge>15?j[Q]=Me+31744:j[Q]=Me+(ge+15<<10)+xe}return j}function zr(k){return Array.isArray(k)||t(k)}var eb=function(k){return!(k&k-1)&&!!k},TP=34467,Yi=3553,cp=34067,mc=34069,Do=6408,hp=6406,bc=6407,lf=6409,xc=6410,tb=32854,dp=32855,rb=36194,IP=32819,kP=32820,LP=33635,NP=34042,vp=6402,wc=34041,pp=35904,gp=35906,Hs=36193,yp=33776,mp=33777,bp=33778,xp=33779,nb=35986,ib=35987,ab=34798,ob=35840,sb=35841,ub=35842,fb=35843,lb=36196,Zs=5121,wp=5123,Ep=5125,cf=5126,OP=10242,DP=10243,PP=10497,_p=33071,RP=33648,BP=10240,FP=10241,Sp=9728,GP=9729,Mp=9984,cb=9985,hb=9986,Cp=9987,zP=33170,Ec=4352,jP=4353,UP=4354,$P=34046,XP=3317,YP=37440,WP=37441,qP=37443,db=37444,hf=33984,VP=[Mp,hb,cb,Cp],_c=[0,lf,xc,bc,Do],ri={};ri[lf]=ri[hp]=ri[vp]=1,ri[wc]=ri[xc]=2,ri[bc]=ri[pp]=3,ri[Do]=ri[gp]=4;function Ks(k){return"[object "+k+"]"}var vb=Ks("HTMLCanvasElement"),pb=Ks("OffscreenCanvas"),gb=Ks("CanvasRenderingContext2D"),yb=Ks("ImageBitmap"),mb=Ks("HTMLImageElement"),bb=Ks("HTMLVideoElement"),HP=Object.keys(op).concat([vb,pb,gb,yb,mb,bb]),Qs=[];Qs[Zs]=1,Qs[cf]=4,Qs[Hs]=2,Qs[wp]=2,Qs[Ep]=4;var dn=[];dn[tb]=2,dn[dp]=2,dn[rb]=2,dn[wc]=4,dn[yp]=.5,dn[mp]=.5,dn[bp]=1,dn[xp]=1,dn[nb]=.5,dn[ib]=1,dn[ab]=1,dn[ob]=.5,dn[sb]=.25,dn[ub]=.5,dn[fb]=.25,dn[lb]=.5;function xb(k){return Array.isArray(k)&&(k.length===0||typeof k[0]=="number")}function wb(k){if(!Array.isArray(k))return!1;var j=k.length;return!(j===0||!zr(k[0]))}function Po(k){return Object.prototype.toString.call(k)}function Eb(k){return Po(k)===vb}function _b(k){return Po(k)===pb}function ZP(k){return Po(k)===gb}function KP(k){return Po(k)===yb}function QP(k){return Po(k)===mb}function JP(k){return Po(k)===bb}function Ap(k){if(!k)return!1;var j=Po(k);return HP.indexOf(j)>=0?!0:xb(k)||wb(k)||mi(k)}function Sb(k){return op[Object.prototype.toString.call(k)]|0}function eR(k,j){var Q=j.length;switch(k.type){case Zs:case wp:case Ep:case cf:var ye=jt.allocType(k.type,Q);ye.set(j),k.data=ye;break;case Hs:k.data=J1(j);break;default:F.raise("unsupported texture type, must specify a typed array")}}function Mb(k,j){return jt.allocType(k.type===Hs?cf:k.type,j)}function Cb(k,j){k.type===Hs?(k.data=J1(j),jt.freeType(j)):k.data=j}function tR(k,j,Q,ye,Me,ge){for(var xe=k.width,Oe=k.height,Re=k.channels,je=xe*Oe*Re,Be=Mb(k,je),$e=0,He=0;He<Oe;++He)for(var De=0;De<xe;++De)for(var Xe=0;Xe<Re;++Xe)Be[$e++]=j[Q*De+ye*He+Me*Xe+ge];Cb(k,Be)}function Sc(k,j,Q,ye,Me,ge){var xe;if(typeof dn[k]<"u"?xe=dn[k]:xe=ri[k]*Qs[j],ge&&(xe*=6),Me){for(var Oe=0,Re=Q;Re>=1;)Oe+=xe*Re*Re,Re/=2;return Oe}else return xe*Q*ye}function rR(k,j,Q,ye,Me,ge,xe){var Oe={"don't care":Ec,"dont care":Ec,nice:UP,fast:jP},Re={repeat:PP,clamp:_p,mirror:RP},je={nearest:Sp,linear:GP},Be=n({mipmap:Cp,"nearest mipmap nearest":Mp,"linear mipmap nearest":cb,"nearest mipmap linear":hb,"linear mipmap linear":Cp},je),$e={none:0,browser:db},He={uint8:Zs,rgba4:IP,rgb565:LP,"rgb5 a1":kP},De={alpha:hp,luminance:lf,"luminance alpha":xc,rgb:bc,rgba:Do,rgba4:tb,"rgb5 a1":dp,rgb565:rb},Xe={};j.ext_srgb&&(De.srgb=pp,De.srgba=gp),j.oes_texture_float&&(He.float32=He.float=cf),j.oes_texture_half_float&&(He.float16=He["half float"]=Hs),j.webgl_depth_texture&&(n(De,{depth:vp,"depth stencil":wc}),n(He,{uint16:wp,uint32:Ep,"depth stencil":NP})),j.webgl_compressed_texture_s3tc&&n(Xe,{"rgb s3tc dxt1":yp,"rgba s3tc dxt1":mp,"rgba s3tc dxt3":bp,"rgba s3tc dxt5":xp}),j.webgl_compressed_texture_atc&&n(Xe,{"rgb atc":nb,"rgba atc explicit alpha":ib,"rgba atc interpolated alpha":ab}),j.webgl_compressed_texture_pvrtc&&n(Xe,{"rgb pvrtc 4bppv1":ob,"rgb pvrtc 2bppv1":sb,"rgba pvrtc 4bppv1":ub,"rgba pvrtc 2bppv1":fb}),j.webgl_compressed_texture_etc1&&(Xe["rgb etc1"]=lb);var ce=Array.prototype.slice.call(k.getParameter(TP));Object.keys(Xe).forEach(function(H){var be=Xe[H];ce.indexOf(be)>=0&&(De[H]=be)});var we=Object.keys(De);Q.textureFormats=we;var ze=[];Object.keys(De).forEach(function(H){var be=De[H];ze[be]=H});var Qe=[];Object.keys(He).forEach(function(H){var be=He[H];Qe[be]=H});var ke=[];Object.keys(je).forEach(function(H){var be=je[H];ke[be]=H});var tt=[];Object.keys(Be).forEach(function(H){var be=Be[H];tt[be]=H});var Ne=[];Object.keys(Re).forEach(function(H){var be=Re[H];Ne[be]=H});var We=we.reduce(function(H,be){var pe=De[be];return pe===lf||pe===hp||pe===lf||pe===xc||pe===vp||pe===wc||j.ext_srgb&&(pe===pp||pe===gp)?H[pe]=pe:pe===dp||be.indexOf("rgba")>=0?H[pe]=Do:H[pe]=bc,H},{});function Le(){this.internalformat=Do,this.format=Do,this.type=Zs,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=db,this.width=0,this.height=0,this.channels=0}function qe(H,be){H.internalformat=be.internalformat,H.format=be.format,H.type=be.type,H.compressed=be.compressed,H.premultiplyAlpha=be.premultiplyAlpha,H.flipY=be.flipY,H.unpackAlignment=be.unpackAlignment,H.colorSpace=be.colorSpace,H.width=be.width,H.height=be.height,H.channels=be.channels}function yt(H,be){if(!(typeof be!="object"||!be)){if("premultiplyAlpha"in be&&(F.type(be.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),H.premultiplyAlpha=be.premultiplyAlpha),"flipY"in be&&(F.type(be.flipY,"boolean","invalid texture flip"),H.flipY=be.flipY),"alignment"in be&&(F.oneOf(be.alignment,[1,2,4,8],"invalid texture unpack alignment"),H.unpackAlignment=be.alignment),"colorSpace"in be&&(F.parameter(be.colorSpace,$e,"invalid colorSpace"),H.colorSpace=$e[be.colorSpace]),"type"in be){var pe=be.type;F(j.oes_texture_float||!(pe==="float"||pe==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),F(j.oes_texture_half_float||!(pe==="half float"||pe==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),F(j.webgl_depth_texture||!(pe==="uint16"||pe==="uint32"||pe==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),F.parameter(pe,He,"invalid texture type"),H.type=He[pe]}var rt=H.width,Vt=H.height,q=H.channels,G=!1;"shape"in be?(F(Array.isArray(be.shape)&&be.shape.length>=2,"shape must be an array"),rt=be.shape[0],Vt=be.shape[1],be.shape.length===3&&(q=be.shape[2],F(q>0&&q<=4,"invalid number of channels"),G=!0),F(rt>=0&&rt<=Q.maxTextureSize,"invalid width"),F(Vt>=0&&Vt<=Q.maxTextureSize,"invalid height")):("radius"in be&&(rt=Vt=be.radius,F(rt>=0&&rt<=Q.maxTextureSize,"invalid radius")),"width"in be&&(rt=be.width,F(rt>=0&&rt<=Q.maxTextureSize,"invalid width")),"height"in be&&(Vt=be.height,F(Vt>=0&&Vt<=Q.maxTextureSize,"invalid height")),"channels"in be&&(q=be.channels,F(q>0&&q<=4,"invalid number of channels"),G=!0)),H.width=rt|0,H.height=Vt|0,H.channels=q|0;var ne=!1;if("format"in be){var le=be.format;F(j.webgl_depth_texture||!(le==="depth"||le==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),F.parameter(le,De,"invalid texture format");var he=H.internalformat=De[le];H.format=We[he],le in He&&("type"in be||(H.type=He[le])),le in Xe&&(H.compressed=!0),ne=!0}!G&&ne?H.channels=ri[H.format]:G&&!ne?H.channels!==_c[H.format]&&(H.format=H.internalformat=_c[H.channels]):ne&&G&&F(H.channels===ri[H.format],"number of channels inconsistent with specified format")}}function Dt(H){k.pixelStorei(YP,H.flipY),k.pixelStorei(WP,H.premultiplyAlpha),k.pixelStorei(qP,H.colorSpace),k.pixelStorei(XP,H.unpackAlignment)}function Ze(){Le.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function Ue(H,be){var pe=null;if(Ap(be)?pe=be:be&&(F.type(be,"object","invalid pixel data type"),yt(H,be),"x"in be&&(H.xOffset=be.x|0),"y"in be&&(H.yOffset=be.y|0),Ap(be.data)&&(pe=be.data)),F(!H.compressed||pe instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),be.copy){F(!pe,"can not specify copy and data field for the same texture");var rt=Me.viewportWidth,Vt=Me.viewportHeight;H.width=H.width||rt-H.xOffset,H.height=H.height||Vt-H.yOffset,H.needsCopy=!0,F(H.xOffset>=0&&H.xOffset<rt&&H.yOffset>=0&&H.yOffset<Vt&&H.width>0&&H.width<=rt&&H.height>0&&H.height<=Vt,"copy texture read out of bounds")}else if(!pe)H.width=H.width||1,H.height=H.height||1,H.channels=H.channels||4;else if(t(pe))H.channels=H.channels||4,H.data=pe,!("type"in be)&&H.type===Zs&&(H.type=Sb(pe));else if(xb(pe))H.channels=H.channels||4,eR(H,pe),H.alignment=1,H.needsFree=!0;else if(mi(pe)){var q=pe.data;!Array.isArray(q)&&H.type===Zs&&(H.type=Sb(q));var G=pe.shape,ne=pe.stride,le,he,oe,ae,ue,V;G.length===3?(oe=G[2],V=ne[2]):(F(G.length===2,"invalid ndarray pixel data, must be 2 or 3D"),oe=1,V=1),le=G[0],he=G[1],ae=ne[0],ue=ne[1],H.alignment=1,H.width=le,H.height=he,H.channels=oe,H.format=H.internalformat=_c[oe],H.needsFree=!0,tR(H,q,ae,ue,V,pe.offset)}else if(Eb(pe)||_b(pe)||ZP(pe))Eb(pe)||_b(pe)?H.element=pe:H.element=pe.canvas,H.width=H.element.width,H.height=H.element.height,H.channels=4;else if(KP(pe))H.element=pe,H.width=pe.width,H.height=pe.height,H.channels=4;else if(QP(pe))H.element=pe,H.width=pe.naturalWidth,H.height=pe.naturalHeight,H.channels=4;else if(JP(pe))H.element=pe,H.width=pe.videoWidth,H.height=pe.videoHeight,H.channels=4;else if(wb(pe)){var te=H.width||pe[0].length,$=H.height||pe.length,fe=H.channels;zr(pe[0][0])?fe=fe||pe[0][0].length:fe=fe||1;for(var de=pc.shape(pe),Se=1,Ce=0;Ce<de.length;++Ce)Se*=de[Ce];var Ee=Mb(H,Se);pc.flatten(pe,de,"",Ee),Cb(H,Ee),H.alignment=1,H.width=te,H.height=$,H.channels=fe,H.format=H.internalformat=_c[fe],H.needsFree=!0}H.type===cf?F(Q.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):H.type===Hs&&F(Q.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function Ie(H,be,pe){var rt=H.element,Vt=H.data,q=H.internalformat,G=H.format,ne=H.type,le=H.width,he=H.height;Dt(H),rt?k.texImage2D(be,pe,G,G,ne,rt):H.compressed?k.compressedTexImage2D(be,pe,q,le,he,0,Vt):H.needsCopy?(ye(),k.copyTexImage2D(be,pe,G,H.xOffset,H.yOffset,le,he,0)):k.texImage2D(be,pe,G,le,he,0,G,ne,Vt||null)}function Tt(H,be,pe,rt,Vt){var q=H.element,G=H.data,ne=H.internalformat,le=H.format,he=H.type,oe=H.width,ae=H.height;Dt(H),q?k.texSubImage2D(be,Vt,pe,rt,le,he,q):H.compressed?k.compressedTexSubImage2D(be,Vt,pe,rt,ne,oe,ae,G):H.needsCopy?(ye(),k.copyTexSubImage2D(be,Vt,pe,rt,H.xOffset,H.yOffset,oe,ae)):k.texSubImage2D(be,Vt,pe,rt,oe,ae,le,he,G)}var Ut=[];function it(){return Ut.pop()||new Ze}function qt(H){H.needsFree&&jt.freeType(H.data),Ze.call(H),Ut.push(H)}function Pt(){Le.call(this),this.genMipmaps=!1,this.mipmapHint=Ec,this.mipmask=0,this.images=Array(16)}function Wt(H,be,pe){var rt=H.images[0]=it();H.mipmask=1,rt.width=H.width=be,rt.height=H.height=pe,rt.channels=H.channels=4}function lr(H,be){var pe=null;if(Ap(be))pe=H.images[0]=it(),qe(pe,H),Ue(pe,be),H.mipmask=1;else if(yt(H,be),Array.isArray(be.mipmap))for(var rt=be.mipmap,Vt=0;Vt<rt.length;++Vt)pe=H.images[Vt]=it(),qe(pe,H),pe.width>>=Vt,pe.height>>=Vt,Ue(pe,rt[Vt]),H.mipmask|=1<<Vt;else pe=H.images[0]=it(),qe(pe,H),Ue(pe,be),H.mipmask=1;qe(H,H.images[0]),H.compressed&&(H.internalformat===yp||H.internalformat===mp||H.internalformat===bp||H.internalformat===xp)&&F(H.width%4===0&&H.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function Yr(H,be){for(var pe=H.images,rt=0;rt<pe.length;++rt){if(!pe[rt])return;Ie(pe[rt],be,rt)}}var nn=[];function Kt(){var H=nn.pop()||new Pt;Le.call(H),H.mipmask=0;for(var be=0;be<16;++be)H.images[be]=null;return H}function Zr(H){for(var be=H.images,pe=0;pe<be.length;++pe)be[pe]&&qt(be[pe]),be[pe]=null;nn.push(H)}function Ar(){this.minFilter=Sp,this.magFilter=Sp,this.wrapS=_p,this.wrapT=_p,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Ec}function Wr(H,be){if("min"in be){var pe=be.min;F.parameter(pe,Be),H.minFilter=Be[pe],VP.indexOf(H.minFilter)>=0&&!("faces"in be)&&(H.genMipmaps=!0)}if("mag"in be){var rt=be.mag;F.parameter(rt,je),H.magFilter=je[rt]}var Vt=H.wrapS,q=H.wrapT;if("wrap"in be){var G=be.wrap;typeof G=="string"?(F.parameter(G,Re),Vt=q=Re[G]):Array.isArray(G)&&(F.parameter(G[0],Re),F.parameter(G[1],Re),Vt=Re[G[0]],q=Re[G[1]])}else{if("wrapS"in be){var ne=be.wrapS;F.parameter(ne,Re),Vt=Re[ne]}if("wrapT"in be){var le=be.wrapT;F.parameter(le,Re),q=Re[le]}}if(H.wrapS=Vt,H.wrapT=q,"anisotropic"in be){var he=be.anisotropic;F(typeof he=="number"&&he>=1&&he<=Q.maxAnisotropic,"aniso samples must be between 1 and "),H.anisotropic=be.anisotropic}if("mipmap"in be){var oe=!1;switch(typeof be.mipmap){case"string":F.parameter(be.mipmap,Oe,"invalid mipmap hint"),H.mipmapHint=Oe[be.mipmap],H.genMipmaps=!0,oe=!0;break;case"boolean":oe=H.genMipmaps=be.mipmap;break;case"object":F(Array.isArray(be.mipmap),"invalid mipmap type"),H.genMipmaps=!1,oe=!0;break;default:F.raise("invalid mipmap type")}oe&&!("min"in be)&&(H.minFilter=Mp)}}function Kr(H,be){k.texParameteri(be,FP,H.minFilter),k.texParameteri(be,BP,H.magFilter),k.texParameteri(be,OP,H.wrapS),k.texParameteri(be,DP,H.wrapT),j.ext_texture_filter_anisotropic&&k.texParameteri(be,$P,H.anisotropic),H.genMipmaps&&(k.hint(zP,H.mipmapHint),k.generateMipmap(be))}var Qr=0,on={},vn=Q.maxTextureUnits,jr=Array(vn).map(function(){return null});function $t(H){Le.call(this),this.mipmask=0,this.internalformat=Do,this.id=Qr++,this.refCount=1,this.target=H,this.texture=k.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Ar,xe.profile&&(this.stats={size:0})}function pn(H){k.activeTexture(hf),k.bindTexture(H.target,H.texture)}function gr(){var H=jr[0];H?k.bindTexture(H.target,H.texture):k.bindTexture(Yi,null)}function Et(H){var be=H.texture;F(be,"must not double destroy texture");var pe=H.unit,rt=H.target;pe>=0&&(k.activeTexture(hf+pe),k.bindTexture(rt,null),jr[pe]=null),k.deleteTexture(be),H.texture=null,H.params=null,H.pixels=null,H.refCount=0,delete on[H.id],ge.textureCount--}n($t.prototype,{bind:function(){var H=this;H.bindCount+=1;var be=H.unit;if(be<0){for(var pe=0;pe<vn;++pe){var rt=jr[pe];if(rt){if(rt.bindCount>0)continue;rt.unit=-1}jr[pe]=H,be=pe;break}be>=vn&&F.raise("insufficient number of texture units"),xe.profile&&ge.maxTextureUnits<be+1&&(ge.maxTextureUnits=be+1),H.unit=be,k.activeTexture(hf+be),k.bindTexture(H.target,H.texture)}return be},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Et(this)}});function Zt(H,be){var pe=new $t(Yi);on[pe.id]=pe,ge.textureCount++;function rt(G,ne){var le=pe.texInfo;Ar.call(le);var he=Kt();return typeof G=="number"?typeof ne=="number"?Wt(he,G|0,ne|0):Wt(he,G|0,G|0):G?(F.type(G,"object","invalid arguments to regl.texture"),Wr(le,G),lr(he,G)):Wt(he,1,1),le.genMipmaps&&(he.mipmask=(he.width<<1)-1),pe.mipmask=he.mipmask,qe(pe,he),F.texture2D(le,he,Q),pe.internalformat=he.internalformat,rt.width=he.width,rt.height=he.height,pn(pe),Yr(he,Yi),Kr(le,Yi),gr(),Zr(he),xe.profile&&(pe.stats.size=Sc(pe.internalformat,pe.type,he.width,he.height,le.genMipmaps,!1)),rt.format=ze[pe.internalformat],rt.type=Qe[pe.type],rt.mag=ke[le.magFilter],rt.min=tt[le.minFilter],rt.wrapS=Ne[le.wrapS],rt.wrapT=Ne[le.wrapT],rt}function Vt(G,ne,le,he){F(!!G,"must specify image data");var oe=ne|0,ae=le|0,ue=he|0,V=it();return qe(V,pe),V.width=0,V.height=0,Ue(V,G),V.width=V.width||(pe.width>>ue)-oe,V.height=V.height||(pe.height>>ue)-ae,F(pe.type===V.type&&pe.format===V.format&&pe.internalformat===V.internalformat,"incompatible format for texture.subimage"),F(oe>=0&&ae>=0&&oe+V.width<=pe.width&&ae+V.height<=pe.height,"texture.subimage write out of bounds"),F(pe.mipmask&1<<ue,"missing mipmap data"),F(V.data||V.element||V.needsCopy,"missing image data"),pn(pe),Tt(V,Yi,oe,ae,ue),gr(),qt(V),rt}function q(G,ne){var le=G|0,he=ne|0||le;if(le===pe.width&&he===pe.height)return rt;rt.width=pe.width=le,rt.height=pe.height=he,pn(pe);for(var oe=0;pe.mipmask>>oe;++oe){var ae=le>>oe,ue=he>>oe;if(!ae||!ue)break;k.texImage2D(Yi,oe,pe.format,ae,ue,0,pe.format,pe.type,null)}return gr(),xe.profile&&(pe.stats.size=Sc(pe.internalformat,pe.type,le,he,!1,!1)),rt}return rt(H,be),rt.subimage=Vt,rt.resize=q,rt._reglType="texture2d",rt._texture=pe,xe.profile&&(rt.stats=pe.stats),rt.destroy=function(){pe.decRef()},rt}function ar(H,be,pe,rt,Vt,q){var G=new $t(cp);on[G.id]=G,ge.cubeCount++;var ne=new Array(6);function le(ae,ue,V,te,$,fe){var de,Se=G.texInfo;for(Ar.call(Se),de=0;de<6;++de)ne[de]=Kt();if(typeof ae=="number"||!ae){var Ce=ae|0||1;for(de=0;de<6;++de)Wt(ne[de],Ce,Ce)}else if(typeof ae=="object")if(ue)lr(ne[0],ae),lr(ne[1],ue),lr(ne[2],V),lr(ne[3],te),lr(ne[4],$),lr(ne[5],fe);else if(Wr(Se,ae),yt(G,ae),"faces"in ae){var Ee=ae.faces;for(F(Array.isArray(Ee)&&Ee.length===6,"cube faces must be a length 6 array"),de=0;de<6;++de)F(typeof Ee[de]=="object"&&!!Ee[de],"invalid input for cube map face"),qe(ne[de],G),lr(ne[de],Ee[de])}else for(de=0;de<6;++de)lr(ne[de],ae);else F.raise("invalid arguments to cube map");for(qe(G,ne[0]),Q.npotTextureCube||F(eb(G.width)&&eb(G.height),"your browser does not support non power or two texture dimensions"),Se.genMipmaps?G.mipmask=(ne[0].width<<1)-1:G.mipmask=ne[0].mipmask,F.textureCube(G,Se,ne,Q),G.internalformat=ne[0].internalformat,le.width=ne[0].width,le.height=ne[0].height,pn(G),de=0;de<6;++de)Yr(ne[de],mc+de);for(Kr(Se,cp),gr(),xe.profile&&(G.stats.size=Sc(G.internalformat,G.type,le.width,le.height,Se.genMipmaps,!0)),le.format=ze[G.internalformat],le.type=Qe[G.type],le.mag=ke[Se.magFilter],le.min=tt[Se.minFilter],le.wrapS=Ne[Se.wrapS],le.wrapT=Ne[Se.wrapT],de=0;de<6;++de)Zr(ne[de]);return le}function he(ae,ue,V,te,$){F(!!ue,"must specify image data"),F(typeof ae=="number"&&ae===(ae|0)&&ae>=0&&ae<6,"invalid face");var fe=V|0,de=te|0,Se=$|0,Ce=it();return qe(Ce,G),Ce.width=0,Ce.height=0,Ue(Ce,ue),Ce.width=Ce.width||(G.width>>Se)-fe,Ce.height=Ce.height||(G.height>>Se)-de,F(G.type===Ce.type&&G.format===Ce.format&&G.internalformat===Ce.internalformat,"incompatible format for texture.subimage"),F(fe>=0&&de>=0&&fe+Ce.width<=G.width&&de+Ce.height<=G.height,"texture.subimage write out of bounds"),F(G.mipmask&1<<Se,"missing mipmap data"),F(Ce.data||Ce.element||Ce.needsCopy,"missing image data"),pn(G),Tt(Ce,mc+ae,fe,de,Se),gr(),qt(Ce),le}function oe(ae){var ue=ae|0;if(ue!==G.width){le.width=G.width=ue,le.height=G.height=ue,pn(G);for(var V=0;V<6;++V)for(var te=0;G.mipmask>>te;++te)k.texImage2D(mc+V,te,G.format,ue>>te,ue>>te,0,G.format,G.type,null);return gr(),xe.profile&&(G.stats.size=Sc(G.internalformat,G.type,le.width,le.height,!1,!0)),le}}return le(H,be,pe,rt,Vt,q),le.subimage=he,le.resize=oe,le._reglType="textureCube",le._texture=G,xe.profile&&(le.stats=G.stats),le.destroy=function(){G.decRef()},le}function Ur(){for(var H=0;H<vn;++H)k.activeTexture(hf+H),k.bindTexture(Yi,null),jr[H]=null;Yn(on).forEach(Et),ge.cubeCount=0,ge.textureCount=0}xe.profile&&(ge.getTotalTextureSize=function(){var H=0;return Object.keys(on).forEach(function(be){H+=on[be].stats.size}),H});function qi(){for(var H=0;H<vn;++H){var be=jr[H];be&&(be.bindCount=0,be.unit=-1,jr[H]=null)}Yn(on).forEach(function(pe){pe.texture=k.createTexture(),k.bindTexture(pe.target,pe.texture);for(var rt=0;rt<32;++rt)if(pe.mipmask&1<<rt)if(pe.target===Yi)k.texImage2D(Yi,rt,pe.internalformat,pe.width>>rt,pe.height>>rt,0,pe.internalformat,pe.type,null);else for(var Vt=0;Vt<6;++Vt)k.texImage2D(mc+Vt,rt,pe.internalformat,pe.width>>rt,pe.height>>rt,0,pe.internalformat,pe.type,null);Kr(pe.texInfo,pe.target)})}function Uo(){for(var H=0;H<vn;++H){var be=jr[H];be&&(be.bindCount=0,be.unit=-1,jr[H]=null),k.activeTexture(hf+H),k.bindTexture(Yi,null),k.bindTexture(cp,null)}}return{create2D:Zt,createCube:ar,clear:Ur,getTexture:function(H){return null},restore:qi,refresh:Uo}}var Ka=36161,Mc=32854,Ab=32855,Tb=36194,Ib=33189,kb=36168,Lb=34041,Nb=35907,Ob=34836,Db=34842,Pb=34843,bi=[];bi[Mc]=2,bi[Ab]=2,bi[Tb]=2,bi[Ib]=2,bi[kb]=1,bi[Lb]=4,bi[Nb]=4,bi[Ob]=16,bi[Db]=8,bi[Pb]=6;function Rb(k,j,Q){return bi[k]*j*Q}var nR=function(k,j,Q,ye,Me){var ge={rgba4:Mc,rgb565:Tb,"rgb5 a1":Ab,depth:Ib,stencil:kb,"depth stencil":Lb};j.ext_srgb&&(ge.srgba=Nb),j.ext_color_buffer_half_float&&(ge.rgba16f=Db,ge.rgb16f=Pb),j.webgl_color_buffer_float&&(ge.rgba32f=Ob);var xe=[];Object.keys(ge).forEach(function(De){var Xe=ge[De];xe[Xe]=De});var Oe=0,Re={};function je(De){this.id=Oe++,this.refCount=1,this.renderbuffer=De,this.format=Mc,this.width=0,this.height=0,Me.profile&&(this.stats={size:0})}je.prototype.decRef=function(){--this.refCount<=0&&Be(this)};function Be(De){var Xe=De.renderbuffer;F(Xe,"must not double destroy renderbuffer"),k.bindRenderbuffer(Ka,null),k.deleteRenderbuffer(Xe),De.renderbuffer=null,De.refCount=0,delete Re[De.id],ye.renderbufferCount--}function $e(De,Xe){var ce=new je(k.createRenderbuffer());Re[ce.id]=ce,ye.renderbufferCount++;function we(Qe,ke){var tt=0,Ne=0,We=Mc;if(typeof Qe=="object"&&Qe){var Le=Qe;if("shape"in Le){var qe=Le.shape;F(Array.isArray(qe)&&qe.length>=2,"invalid renderbuffer shape"),tt=qe[0]|0,Ne=qe[1]|0}else"radius"in Le&&(tt=Ne=Le.radius|0),"width"in Le&&(tt=Le.width|0),"height"in Le&&(Ne=Le.height|0);"format"in Le&&(F.parameter(Le.format,ge,"invalid renderbuffer format"),We=ge[Le.format])}else typeof Qe=="number"?(tt=Qe|0,typeof ke=="number"?Ne=ke|0:Ne=tt):Qe?F.raise("invalid arguments to renderbuffer constructor"):tt=Ne=1;if(F(tt>0&&Ne>0&&tt<=Q.maxRenderbufferSize&&Ne<=Q.maxRenderbufferSize,"invalid renderbuffer size"),!(tt===ce.width&&Ne===ce.height&&We===ce.format))return we.width=ce.width=tt,we.height=ce.height=Ne,ce.format=We,k.bindRenderbuffer(Ka,ce.renderbuffer),k.renderbufferStorage(Ka,We,tt,Ne),F(k.getError()===0,"invalid render buffer format"),Me.profile&&(ce.stats.size=Rb(ce.format,ce.width,ce.height)),we.format=xe[ce.format],we}function ze(Qe,ke){var tt=Qe|0,Ne=ke|0||tt;return tt===ce.width&&Ne===ce.height||(F(tt>0&&Ne>0&&tt<=Q.maxRenderbufferSize&&Ne<=Q.maxRenderbufferSize,"invalid renderbuffer size"),we.width=ce.width=tt,we.height=ce.height=Ne,k.bindRenderbuffer(Ka,ce.renderbuffer),k.renderbufferStorage(Ka,ce.format,tt,Ne),F(k.getError()===0,"invalid render buffer format"),Me.profile&&(ce.stats.size=Rb(ce.format,ce.width,ce.height))),we}return we(De,Xe),we.resize=ze,we._reglType="renderbuffer",we._renderbuffer=ce,Me.profile&&(we.stats=ce.stats),we.destroy=function(){ce.decRef()},we}Me.profile&&(ye.getTotalRenderbufferSize=function(){var De=0;return Object.keys(Re).forEach(function(Xe){De+=Re[Xe].stats.size}),De});function He(){Yn(Re).forEach(function(De){De.renderbuffer=k.createRenderbuffer(),k.bindRenderbuffer(Ka,De.renderbuffer),k.renderbufferStorage(Ka,De.format,De.width,De.height)}),k.bindRenderbuffer(Ka,null)}return{create:$e,clear:function(){Yn(Re).forEach(Be)},restore:He}},Ea=36160,Tp=36161,Ro=3553,Cc=34069,Bb=36064,Fb=36096,Gb=36128,zb=33306,jb=36053,iR=36054,aR=36055,oR=36057,sR=36061,uR=36193,fR=5121,lR=5126,Ub=6407,$b=6408,cR=6402,hR=[Ub,$b],Ip=[];Ip[$b]=4,Ip[Ub]=3;var Ac=[];Ac[fR]=1,Ac[lR]=4,Ac[uR]=2;var dR=32854,vR=32855,pR=36194,gR=33189,yR=36168,Xb=34041,mR=35907,bR=34836,xR=34842,wR=34843,ER=[dR,vR,pR,mR,xR,wR,bR],Js={};Js[jb]="complete",Js[iR]="incomplete attachment",Js[oR]="incomplete dimensions",Js[aR]="incomplete, missing attachment",Js[sR]="unsupported";function _R(k,j,Q,ye,Me,ge){var xe={cur:null,next:null,dirty:!1,setFBO:null},Oe=["rgba"],Re=["rgba4","rgb565","rgb5 a1"];j.ext_srgb&&Re.push("srgba"),j.ext_color_buffer_half_float&&Re.push("rgba16f","rgb16f"),j.webgl_color_buffer_float&&Re.push("rgba32f");var je=["uint8"];j.oes_texture_half_float&&je.push("half float","float16"),j.oes_texture_float&&je.push("float","float32");function Be(Ze,Ue,Ie){this.target=Ze,this.texture=Ue,this.renderbuffer=Ie;var Tt=0,Ut=0;Ue?(Tt=Ue.width,Ut=Ue.height):Ie&&(Tt=Ie.width,Ut=Ie.height),this.width=Tt,this.height=Ut}function $e(Ze){Ze&&(Ze.texture&&Ze.texture._texture.decRef(),Ze.renderbuffer&&Ze.renderbuffer._renderbuffer.decRef())}function He(Ze,Ue,Ie){if(Ze)if(Ze.texture){var Tt=Ze.texture._texture,Ut=Math.max(1,Tt.width),it=Math.max(1,Tt.height);F(Ut===Ue&&it===Ie,"inconsistent width/height for supplied texture"),Tt.refCount+=1}else{var qt=Ze.renderbuffer._renderbuffer;F(qt.width===Ue&&qt.height===Ie,"inconsistent width/height for renderbuffer"),qt.refCount+=1}}function De(Ze,Ue){Ue&&(Ue.texture?k.framebufferTexture2D(Ea,Ze,Ue.target,Ue.texture._texture.texture,0):k.framebufferRenderbuffer(Ea,Ze,Tp,Ue.renderbuffer._renderbuffer.renderbuffer))}function Xe(Ze){var Ue=Ro,Ie=null,Tt=null,Ut=Ze;typeof Ze=="object"&&(Ut=Ze.data,"target"in Ze&&(Ue=Ze.target|0)),F.type(Ut,"function","invalid attachment data");var it=Ut._reglType;return it==="texture2d"?(Ie=Ut,F(Ue===Ro)):it==="textureCube"?(Ie=Ut,F(Ue>=Cc&&Ue<Cc+6,"invalid cube map target")):it==="renderbuffer"?(Tt=Ut,Ue=Tp):F.raise("invalid regl object for attachment"),new Be(Ue,Ie,Tt)}function ce(Ze,Ue,Ie,Tt,Ut){if(Ie){var it=ye.create2D({width:Ze,height:Ue,format:Tt,type:Ut});return it._texture.refCount=0,new Be(Ro,it,null)}else{var qt=Me.create({width:Ze,height:Ue,format:Tt});return qt._renderbuffer.refCount=0,new Be(Tp,null,qt)}}function we(Ze){return Ze&&(Ze.texture||Ze.renderbuffer)}function ze(Ze,Ue,Ie){Ze&&(Ze.texture?Ze.texture.resize(Ue,Ie):Ze.renderbuffer&&Ze.renderbuffer.resize(Ue,Ie),Ze.width=Ue,Ze.height=Ie)}var Qe=0,ke={};function tt(){this.id=Qe++,ke[this.id]=this,this.framebuffer=k.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Ne(Ze){Ze.colorAttachments.forEach($e),$e(Ze.depthAttachment),$e(Ze.stencilAttachment),$e(Ze.depthStencilAttachment)}function We(Ze){var Ue=Ze.framebuffer;F(Ue,"must not double destroy framebuffer"),k.deleteFramebuffer(Ue),Ze.framebuffer=null,ge.framebufferCount--,delete ke[Ze.id]}function Le(Ze){var Ue;k.bindFramebuffer(Ea,Ze.framebuffer);var Ie=Ze.colorAttachments;for(Ue=0;Ue<Ie.length;++Ue)De(Bb+Ue,Ie[Ue]);for(Ue=Ie.length;Ue<Q.maxColorAttachments;++Ue)k.framebufferTexture2D(Ea,Bb+Ue,Ro,null,0);k.framebufferTexture2D(Ea,zb,Ro,null,0),k.framebufferTexture2D(Ea,Fb,Ro,null,0),k.framebufferTexture2D(Ea,Gb,Ro,null,0),De(Fb,Ze.depthAttachment),De(Gb,Ze.stencilAttachment),De(zb,Ze.depthStencilAttachment);var Tt=k.checkFramebufferStatus(Ea);!k.isContextLost()&&Tt!==jb&&F.raise("framebuffer configuration not supported, status = "+Js[Tt]),k.bindFramebuffer(Ea,xe.next?xe.next.framebuffer:null),xe.cur=xe.next,k.getError()}function qe(Ze,Ue){var Ie=new tt;ge.framebufferCount++;function Tt(it,qt){var Pt;F(xe.next!==Ie,"can not update framebuffer which is currently in use");var Wt=0,lr=0,Yr=!0,nn=!0,Kt=null,Zr=!0,Ar="rgba",Wr="uint8",Kr=1,Qr=null,on=null,vn=null,jr=!1;if(typeof it=="number")Wt=it|0,lr=qt|0||Wt;else if(!it)Wt=lr=1;else{F.type(it,"object","invalid arguments for framebuffer");var $t=it;if("shape"in $t){var pn=$t.shape;F(Array.isArray(pn)&&pn.length>=2,"invalid shape for framebuffer"),Wt=pn[0],lr=pn[1]}else"radius"in $t&&(Wt=lr=$t.radius),"width"in $t&&(Wt=$t.width),"height"in $t&&(lr=$t.height);("color"in $t||"colors"in $t)&&(Kt=$t.color||$t.colors,Array.isArray(Kt)&&F(Kt.length===1||j.webgl_draw_buffers,"multiple render targets not supported")),Kt||("colorCount"in $t&&(Kr=$t.colorCount|0,F(Kr>0,"invalid color buffer count")),"colorTexture"in $t&&(Zr=!!$t.colorTexture,Ar="rgba4"),"colorType"in $t&&(Wr=$t.colorType,Zr?(F(j.oes_texture_float||!(Wr==="float"||Wr==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),F(j.oes_texture_half_float||!(Wr==="half float"||Wr==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Wr==="half float"||Wr==="float16"?(F(j.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),Ar="rgba16f"):(Wr==="float"||Wr==="float32")&&(F(j.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),Ar="rgba32f"),F.oneOf(Wr,je,"invalid color type")),"colorFormat"in $t&&(Ar=$t.colorFormat,Oe.indexOf(Ar)>=0?Zr=!0:Re.indexOf(Ar)>=0?Zr=!1:Zr?F.oneOf($t.colorFormat,Oe,"invalid color format for texture"):F.oneOf($t.colorFormat,Re,"invalid color format for renderbuffer"))),("depthTexture"in $t||"depthStencilTexture"in $t)&&(jr=!!($t.depthTexture||$t.depthStencilTexture),F(!jr||j.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in $t&&(typeof $t.depth=="boolean"?Yr=$t.depth:(Qr=$t.depth,nn=!1)),"stencil"in $t&&(typeof $t.stencil=="boolean"?nn=$t.stencil:(on=$t.stencil,Yr=!1)),"depthStencil"in $t&&(typeof $t.depthStencil=="boolean"?Yr=nn=$t.depthStencil:(vn=$t.depthStencil,Yr=!1,nn=!1))}var gr=null,Et=null,Zt=null,ar=null;if(Array.isArray(Kt))gr=Kt.map(Xe);else if(Kt)gr=[Xe(Kt)];else for(gr=new Array(Kr),Pt=0;Pt<Kr;++Pt)gr[Pt]=ce(Wt,lr,Zr,Ar,Wr);F(j.webgl_draw_buffers||gr.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),F(gr.length<=Q.maxColorAttachments,"too many color attachments, not supported"),Wt=Wt||gr[0].width,lr=lr||gr[0].height,Qr?Et=Xe(Qr):Yr&&!nn&&(Et=ce(Wt,lr,jr,"depth","uint32")),on?Zt=Xe(on):nn&&!Yr&&(Zt=ce(Wt,lr,!1,"stencil","uint8")),vn?ar=Xe(vn):!Qr&&!on&&nn&&Yr&&(ar=ce(Wt,lr,jr,"depth stencil","depth stencil")),F(!!Qr+!!on+!!vn<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var Ur=null;for(Pt=0;Pt<gr.length;++Pt)if(He(gr[Pt],Wt,lr),F(!gr[Pt]||gr[Pt].texture&&hR.indexOf(gr[Pt].texture._texture.format)>=0||gr[Pt].renderbuffer&&ER.indexOf(gr[Pt].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+Pt+" is invalid"),gr[Pt]&&gr[Pt].texture){var qi=Ip[gr[Pt].texture._texture.format]*Ac[gr[Pt].texture._texture.type];Ur===null?Ur=qi:F(Ur===qi,"all color attachments much have the same number of bits per pixel.")}return He(Et,Wt,lr),F(!Et||Et.texture&&Et.texture._texture.format===cR||Et.renderbuffer&&Et.renderbuffer._renderbuffer.format===gR,"invalid depth attachment for framebuffer object"),He(Zt,Wt,lr),F(!Zt||Zt.renderbuffer&&Zt.renderbuffer._renderbuffer.format===yR,"invalid stencil attachment for framebuffer object"),He(ar,Wt,lr),F(!ar||ar.texture&&ar.texture._texture.format===Xb||ar.renderbuffer&&ar.renderbuffer._renderbuffer.format===Xb,"invalid depth-stencil attachment for framebuffer object"),Ne(Ie),Ie.width=Wt,Ie.height=lr,Ie.colorAttachments=gr,Ie.depthAttachment=Et,Ie.stencilAttachment=Zt,Ie.depthStencilAttachment=ar,Tt.color=gr.map(we),Tt.depth=we(Et),Tt.stencil=we(Zt),Tt.depthStencil=we(ar),Tt.width=Ie.width,Tt.height=Ie.height,Le(Ie),Tt}function Ut(it,qt){F(xe.next!==Ie,"can not resize a framebuffer which is currently in use");var Pt=Math.max(it|0,1),Wt=Math.max(qt|0||Pt,1);if(Pt===Ie.width&&Wt===Ie.height)return Tt;for(var lr=Ie.colorAttachments,Yr=0;Yr<lr.length;++Yr)ze(lr[Yr],Pt,Wt);return ze(Ie.depthAttachment,Pt,Wt),ze(Ie.stencilAttachment,Pt,Wt),ze(Ie.depthStencilAttachment,Pt,Wt),Ie.width=Tt.width=Pt,Ie.height=Tt.height=Wt,Le(Ie),Tt}return Tt(Ze,Ue),n(Tt,{resize:Ut,_reglType:"framebuffer",_framebuffer:Ie,destroy:function(){We(Ie),Ne(Ie)},use:function(it){xe.setFBO({framebuffer:Tt},it)}})}function yt(Ze){var Ue=Array(6);function Ie(Ut){var it;F(Ue.indexOf(xe.next)<0,"can not update framebuffer which is currently in use");var qt={color:null},Pt=0,Wt=null,lr="rgba",Yr="uint8",nn=1;if(typeof Ut=="number")Pt=Ut|0;else if(!Ut)Pt=1;else{F.type(Ut,"object","invalid arguments for framebuffer");var Kt=Ut;if("shape"in Kt){var Zr=Kt.shape;F(Array.isArray(Zr)&&Zr.length>=2,"invalid shape for framebuffer"),F(Zr[0]===Zr[1],"cube framebuffer must be square"),Pt=Zr[0]}else"radius"in Kt&&(Pt=Kt.radius|0),"width"in Kt?(Pt=Kt.width|0,"height"in Kt&&F(Kt.height===Pt,"must be square")):"height"in Kt&&(Pt=Kt.height|0);("color"in Kt||"colors"in Kt)&&(Wt=Kt.color||Kt.colors,Array.isArray(Wt)&&F(Wt.length===1||j.webgl_draw_buffers,"multiple render targets not supported")),Wt||("colorCount"in Kt&&(nn=Kt.colorCount|0,F(nn>0,"invalid color buffer count")),"colorType"in Kt&&(F.oneOf(Kt.colorType,je,"invalid color type"),Yr=Kt.colorType),"colorFormat"in Kt&&(lr=Kt.colorFormat,F.oneOf(Kt.colorFormat,Oe,"invalid color format for texture"))),"depth"in Kt&&(qt.depth=Kt.depth),"stencil"in Kt&&(qt.stencil=Kt.stencil),"depthStencil"in Kt&&(qt.depthStencil=Kt.depthStencil)}var Ar;if(Wt)if(Array.isArray(Wt))for(Ar=[],it=0;it<Wt.length;++it)Ar[it]=Wt[it];else Ar=[Wt];else{Ar=Array(nn);var Wr={radius:Pt,format:lr,type:Yr};for(it=0;it<nn;++it)Ar[it]=ye.createCube(Wr)}for(qt.color=Array(Ar.length),it=0;it<Ar.length;++it){var Kr=Ar[it];F(typeof Kr=="function"&&Kr._reglType==="textureCube","invalid cube map"),Pt=Pt||Kr.width,F(Kr.width===Pt&&Kr.height===Pt,"invalid cube map shape"),qt.color[it]={target:Cc,data:Ar[it]}}for(it=0;it<6;++it){for(var Qr=0;Qr<Ar.length;++Qr)qt.color[Qr].target=Cc+it;it>0&&(qt.depth=Ue[0].depth,qt.stencil=Ue[0].stencil,qt.depthStencil=Ue[0].depthStencil),Ue[it]?Ue[it](qt):Ue[it]=qe(qt)}return n(Ie,{width:Pt,height:Pt,color:Ar})}function Tt(Ut){var it,qt=Ut|0;if(F(qt>0&&qt<=Q.maxCubeMapSize,"invalid radius for cube fbo"),qt===Ie.width)return Ie;var Pt=Ie.color;for(it=0;it<Pt.length;++it)Pt[it].resize(qt);for(it=0;it<6;++it)Ue[it].resize(qt);return Ie.width=Ie.height=qt,Ie}return Ie(Ze),n(Ie,{faces:Ue,resize:Tt,_reglType:"framebufferCube",destroy:function(){Ue.forEach(function(Ut){Ut.destroy()})}})}function Dt(){xe.cur=null,xe.next=null,xe.dirty=!0,Yn(ke).forEach(function(Ze){Ze.framebuffer=k.createFramebuffer(),Le(Ze)})}return n(xe,{getFramebuffer:function(Ze){if(typeof Ze=="function"&&Ze._reglType==="framebuffer"){var Ue=Ze._framebuffer;if(Ue instanceof tt)return Ue}return null},create:qe,createCube:yt,clear:function(){Yn(ke).forEach(We)},restore:Dt})}var SR=5126,Yb=34962;function kp(){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=SR,this.offset=0,this.stride=0,this.divisor=0}function MR(k,j,Q,ye,Me){for(var ge=Q.maxAttributes,xe=new Array(ge),Oe=0;Oe<ge;++Oe)xe[Oe]=new kp;var Re=0,je={},Be={Record:kp,scope:{},state:xe,currentVAO:null,targetVAO:null,restore:He()?ke:function(){},createVAO:tt,getVAO:Xe,destroyBuffer:$e,setVAO:He()?ce:we,clear:He()?ze:function(){}};function $e(Ne){for(var We=0;We<xe.length;++We){var Le=xe[We];Le.buffer===Ne&&(k.disableVertexAttribArray(We),Le.buffer=null)}}function He(){return j.oes_vertex_array_object}function De(){return j.angle_instanced_arrays}function Xe(Ne){return typeof Ne=="function"&&Ne._vao?Ne._vao:null}function ce(Ne){if(Ne!==Be.currentVAO){var We=He();Ne?We.bindVertexArrayOES(Ne.vao):We.bindVertexArrayOES(null),Be.currentVAO=Ne}}function we(Ne){if(Ne!==Be.currentVAO){if(Ne)Ne.bindAttrs();else for(var We=De(),Le=0;Le<xe.length;++Le){var qe=xe[Le];qe.buffer?(k.enableVertexAttribArray(Le),k.vertexAttribPointer(Le,qe.size,qe.type,qe.normalized,qe.stride,qe.offfset),We&&qe.divisor&&We.vertexAttribDivisorANGLE(Le,qe.divisor)):(k.disableVertexAttribArray(Le),k.vertexAttrib4f(Le,qe.x,qe.y,qe.z,qe.w))}Be.currentVAO=Ne}}function ze(){Yn(je).forEach(function(Ne){Ne.destroy()})}function Qe(){this.id=++Re,this.attributes=[];var Ne=He();Ne?this.vao=Ne.createVertexArrayOES():this.vao=null,je[this.id]=this,this.buffers=[]}Qe.prototype.bindAttrs=function(){for(var Ne=De(),We=this.attributes,Le=0;Le<We.length;++Le){var qe=We[Le];qe.buffer?(k.enableVertexAttribArray(Le),k.bindBuffer(Yb,qe.buffer.buffer),k.vertexAttribPointer(Le,qe.size,qe.type,qe.normalized,qe.stride,qe.offset),Ne&&qe.divisor&&Ne.vertexAttribDivisorANGLE(Le,qe.divisor)):(k.disableVertexAttribArray(Le),k.vertexAttrib4f(Le,qe.x,qe.y,qe.z,qe.w))}for(var yt=We.length;yt<ge;++yt)k.disableVertexAttribArray(yt)},Qe.prototype.refresh=function(){var Ne=He();Ne&&(Ne.bindVertexArrayOES(this.vao),this.bindAttrs(),Be.currentVAO=this)},Qe.prototype.destroy=function(){if(this.vao){var Ne=He();this===Be.currentVAO&&(Be.currentVAO=null,Ne.bindVertexArrayOES(null)),Ne.deleteVertexArrayOES(this.vao),this.vao=null}je[this.id]&&(delete je[this.id],ye.vaoCount-=1)};function ke(){var Ne=He();Ne&&Yn(je).forEach(function(We){We.refresh()})}function tt(Ne){var We=new Qe;ye.vaoCount+=1;function Le(qe){F(Array.isArray(qe),"arguments to vertex array constructor must be an array"),F(qe.length<ge,"too many attributes"),F(qe.length>0,"must specify at least one attribute");var yt={},Dt=We.attributes;Dt.length=qe.length;for(var Ze=0;Ze<qe.length;++Ze){var Ue=qe[Ze],Ie=Dt[Ze]=new kp,Tt=Ue.data||Ue;if(Array.isArray(Tt)||t(Tt)||mi(Tt)){var Ut;We.buffers[Ze]&&(Ut=We.buffers[Ze],t(Tt)&&Ut._buffer.byteLength>=Tt.byteLength?Ut.subdata(Tt):(Ut.destroy(),We.buffers[Ze]=null)),We.buffers[Ze]||(Ut=We.buffers[Ze]=Me.create(Ue,Yb,!1,!0)),Ie.buffer=Me.getBuffer(Ut),Ie.size=Ie.buffer.dimension|0,Ie.normalized=!1,Ie.type=Ie.buffer.dtype,Ie.offset=0,Ie.stride=0,Ie.divisor=0,Ie.state=1,yt[Ze]=1}else Me.getBuffer(Ue)?(Ie.buffer=Me.getBuffer(Ue),Ie.size=Ie.buffer.dimension|0,Ie.normalized=!1,Ie.type=Ie.buffer.dtype,Ie.offset=0,Ie.stride=0,Ie.divisor=0,Ie.state=1):Me.getBuffer(Ue.buffer)?(Ie.buffer=Me.getBuffer(Ue.buffer),Ie.size=(+Ue.size||Ie.buffer.dimension)|0,Ie.normalized=!!Ue.normalized||!1,"type"in Ue?(F.parameter(Ue.type,No,"invalid buffer type"),Ie.type=No[Ue.type]):Ie.type=Ie.buffer.dtype,Ie.offset=(Ue.offset||0)|0,Ie.stride=(Ue.stride||0)|0,Ie.divisor=(Ue.divisor||0)|0,Ie.state=1,F(Ie.size>=1&&Ie.size<=4,"size must be between 1 and 4"),F(Ie.offset>=0,"invalid offset"),F(Ie.stride>=0&&Ie.stride<=255,"stride must be between 0 and 255"),F(Ie.divisor>=0,"divisor must be positive"),F(!Ie.divisor||!!j.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in Ue?(F(Ze>0,"first attribute must not be a constant"),Ie.x=+Ue.x||0,Ie.y=+Ue.y||0,Ie.z=+Ue.z||0,Ie.w=+Ue.w||0,Ie.state=2):F(!1,"invalid attribute spec for location "+Ze)}for(var it=0;it<We.buffers.length;++it)!yt[it]&&We.buffers[it]&&(We.buffers[it].destroy(),We.buffers[it]=null);return We.refresh(),Le}return Le.destroy=function(){for(var qe=0;qe<We.buffers.length;++qe)We.buffers[qe]&&We.buffers[qe].destroy();We.buffers.length=0,We.destroy()},Le._vao=We,Le._reglType="vao",Le(Ne)}return Be}var Wb=35632,CR=35633,AR=35718,TR=35721;function IR(k,j,Q,ye){var Me={},ge={};function xe(ce,we,ze,Qe){this.name=ce,this.id=we,this.location=ze,this.info=Qe}function Oe(ce,we){for(var ze=0;ze<ce.length;++ze)if(ce[ze].id===we.id){ce[ze].location=we.location;return}ce.push(we)}function Re(ce,we,ze){var Qe=ce===Wb?Me:ge,ke=Qe[we];if(!ke){var tt=j.str(we);ke=k.createShader(ce),k.shaderSource(ke,tt),k.compileShader(ke),F.shaderError(k,ke,tt,ce,ze),Qe[we]=ke}return ke}var je={},Be=[],$e=0;function He(ce,we){this.id=$e++,this.fragId=ce,this.vertId=we,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,ye.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function De(ce,we,ze){var Qe,ke,tt=Re(Wb,ce.fragId),Ne=Re(CR,ce.vertId),We=ce.program=k.createProgram();if(k.attachShader(We,tt),k.attachShader(We,Ne),ze)for(Qe=0;Qe<ze.length;++Qe){var Le=ze[Qe];k.bindAttribLocation(We,Le[0],Le[1])}k.linkProgram(We),F.linkError(k,We,j.str(ce.fragId),j.str(ce.vertId),we);var qe=k.getProgramParameter(We,AR);ye.profile&&(ce.stats.uniformsCount=qe);var yt=ce.uniforms;for(Qe=0;Qe<qe;++Qe)if(ke=k.getActiveUniform(We,Qe),ke)if(ke.size>1)for(var Dt=0;Dt<ke.size;++Dt){var Ze=ke.name.replace("[0]","["+Dt+"]");Oe(yt,new xe(Ze,j.id(Ze),k.getUniformLocation(We,Ze),ke))}else Oe(yt,new xe(ke.name,j.id(ke.name),k.getUniformLocation(We,ke.name),ke));var Ue=k.getProgramParameter(We,TR);ye.profile&&(ce.stats.attributesCount=Ue);var Ie=ce.attributes;for(Qe=0;Qe<Ue;++Qe)ke=k.getActiveAttrib(We,Qe),ke&&Oe(Ie,new xe(ke.name,j.id(ke.name),k.getAttribLocation(We,ke.name),ke))}ye.profile&&(Q.getMaxUniformsCount=function(){var ce=0;return Be.forEach(function(we){we.stats.uniformsCount>ce&&(ce=we.stats.uniformsCount)}),ce},Q.getMaxAttributesCount=function(){var ce=0;return Be.forEach(function(we){we.stats.attributesCount>ce&&(ce=we.stats.attributesCount)}),ce});function Xe(){Me={},ge={};for(var ce=0;ce<Be.length;++ce)De(Be[ce],null,Be[ce].attributes.map(function(we){return[we.location,we.name]}))}return{clear:function(){var ce=k.deleteShader.bind(k);Yn(Me).forEach(ce),Me={},Yn(ge).forEach(ce),ge={},Be.forEach(function(we){k.deleteProgram(we.program)}),Be.length=0,je={},Q.shaderCount=0},program:function(ce,we,ze,Qe){F.command(ce>=0,"missing vertex shader",ze),F.command(we>=0,"missing fragment shader",ze);var ke=je[we];ke||(ke=je[we]={});var tt=ke[ce];if(tt&&(tt.refCount++,!Qe))return tt;var Ne=new He(we,ce);return Q.shaderCount++,De(Ne,ze,Qe),tt||(ke[ce]=Ne),Be.push(Ne),n(Ne,{destroy:function(){if(Ne.refCount--,Ne.refCount<=0){k.deleteProgram(Ne.program);var We=Be.indexOf(Ne);Be.splice(We,1),Q.shaderCount--}ke[Ne.vertId].refCount<=0&&(k.deleteShader(ge[Ne.vertId]),delete ge[Ne.vertId],delete je[Ne.fragId][Ne.vertId]),Object.keys(je[Ne.fragId]).length||(k.deleteShader(Me[Ne.fragId]),delete Me[Ne.fragId],delete je[Ne.fragId])}})},restore:Xe,shader:Re,frag:-1,vert:-1}}var kR=6408,df=5121,LR=3333,Tc=5126;function NR(k,j,Q,ye,Me,ge,xe){function Oe(Be){var $e;j.next===null?(F(Me.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),$e=df):(F(j.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),$e=j.next.colorAttachments[0].texture._texture.type,ge.oes_texture_float?(F($e===df||$e===Tc,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),$e===Tc&&F(xe.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):F($e===df,"Reading from a framebuffer is only allowed for the type 'uint8'"));var He=0,De=0,Xe=ye.framebufferWidth,ce=ye.framebufferHeight,we=null;t(Be)?we=Be:Be&&(F.type(Be,"object","invalid arguments to regl.read()"),He=Be.x|0,De=Be.y|0,F(He>=0&&He<ye.framebufferWidth,"invalid x offset for regl.read"),F(De>=0&&De<ye.framebufferHeight,"invalid y offset for regl.read"),Xe=(Be.width||ye.framebufferWidth-He)|0,ce=(Be.height||ye.framebufferHeight-De)|0,we=Be.data||null),we&&($e===df?F(we instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):$e===Tc&&F(we instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),F(Xe>0&&Xe+He<=ye.framebufferWidth,"invalid width for read pixels"),F(ce>0&&ce+De<=ye.framebufferHeight,"invalid height for read pixels"),Q();var ze=Xe*ce*4;return we||($e===df?we=new Uint8Array(ze):$e===Tc&&(we=we||new Float32Array(ze))),F.isTypedArray(we,"data buffer for regl.read() must be a typedarray"),F(we.byteLength>=ze,"data buffer for regl.read() too small"),k.pixelStorei(LR,4),k.readPixels(He,De,Xe,ce,kR,$e,we),we}function Re(Be){var $e;return j.setFBO({framebuffer:Be.framebuffer},function(){$e=Oe(Be)}),$e}function je(Be){return!Be||!("framebuffer"in Be)?Oe(Be):Re(Be)}return je}function eu(k){return Array.prototype.slice.call(k)}function tu(k){return eu(k).join("")}function OR(){var k=0,j=[],Q=[];function ye($e){for(var He=0;He<Q.length;++He)if(Q[He]===$e)return j[He];var De="g"+k++;return j.push(De),Q.push($e),De}function Me(){var $e=[];function He(){$e.push.apply($e,eu(arguments))}var De=[];function Xe(){var ce="v"+k++;return De.push(ce),arguments.length>0&&($e.push(ce,"="),$e.push.apply($e,eu(arguments)),$e.push(";")),ce}return n(He,{def:Xe,toString:function(){return tu([De.length>0?"var "+De.join(",")+";":"",tu($e)])}})}function ge(){var $e=Me(),He=Me(),De=$e.toString,Xe=He.toString;function ce(we,ze){He(we,ze,"=",$e.def(we,ze),";")}return n(function(){$e.apply($e,eu(arguments))},{def:$e.def,entry:$e,exit:He,save:ce,set:function(we,ze,Qe){ce(we,ze),$e(we,ze,"=",Qe,";")},toString:function(){return De()+Xe()}})}function xe(){var $e=tu(arguments),He=ge(),De=ge(),Xe=He.toString,ce=De.toString;return n(He,{then:function(){return He.apply(He,eu(arguments)),this},else:function(){return De.apply(De,eu(arguments)),this},toString:function(){var we=ce();return we&&(we="else{"+we+"}"),tu(["if(",$e,"){",Xe(),"}",we])}})}var Oe=Me(),Re={};function je($e,He){var De=[];function Xe(){var ke="a"+De.length;return De.push(ke),ke}He=He||0;for(var ce=0;ce<He;++ce)Xe();var we=ge(),ze=we.toString,Qe=Re[$e]=n(we,{arg:Xe,toString:function(){return tu(["function(",De.join(),"){",ze(),"}"])}});return Qe}function Be(){var $e=['"use strict";',Oe,"return {"];Object.keys(Re).forEach(function(Xe){$e.push('"',Xe,'":',Re[Xe].toString(),",")}),$e.push("}");var He=tu($e).replace(/;/g,`;
|
|
45
|
+
`).replace(/}/g,`}
|
|
46
|
+
`).replace(/{/g,`{
|
|
47
|
+
`),De=Function.apply(null,j.concat(He));return De.apply(null,Q)}return{global:Oe,link:ye,block:Me,proc:je,scope:ge,cond:xe,compile:Be}}var ru="xyzw".split(""),qb=5121,nu=1,Lp=2,Np=0,Op=1,Dp=2,Pp=3,Ic=4,Vb=5,Hb=6,Zb="dither",Kb="blend.enable",Qb="blend.color",Rp="blend.equation",Bp="blend.func",Jb="depth.enable",ex="depth.func",tx="depth.range",rx="depth.mask",Fp="colorMask",nx="cull.enable",ix="cull.face",Gp="frontFace",zp="lineWidth",ax="polygonOffset.enable",jp="polygonOffset.offset",ox="sample.alpha",sx="sample.enable",Up="sample.coverage",ux="stencil.enable",fx="stencil.mask",$p="stencil.func",Xp="stencil.opFront",vf="stencil.opBack",lx="scissor.enable",kc="scissor.box",_a="viewport",pf="profile",Bo="framebuffer",gf="vert",yf="frag",Fo="elements",Go="primitive",zo="count",Lc="offset",Nc="instances",mf="vao",Yp="Width",Wp="Height",iu=Bo+Yp,au=Bo+Wp,DR=_a+Yp,PR=_a+Wp,cx="drawingBuffer",hx=cx+Yp,dx=cx+Wp,RR=[Bp,Rp,$p,Xp,vf,Up,_a,kc,jp],ou=34962,BR=34963,FR=35632,GR=35633,vx=3553,zR=34067,jR=2884,UR=3042,$R=3024,XR=2960,YR=2929,WR=3089,qR=32823,VR=32926,HR=32928,qp=5126,Oc=35664,Dc=35665,Pc=35666,Vp=5124,Rc=35667,Bc=35668,Fc=35669,Hp=35670,Gc=35671,zc=35672,jc=35673,bf=35674,xf=35675,wf=35676,Ef=35678,_f=35680,px=4,Sf=1028,jo=1029,gx=2304,Zp=2305,ZR=32775,KR=32776,QR=519,Qa=7680,yx=0,mx=1,bx=32774,JR=513,xx=36160,e3=36064,Wi={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},wx=["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"],su={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},Ja={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Ex={frag:FR,vert:GR},Kp={cw:gx,ccw:Zp};function Uc(k){return Array.isArray(k)||t(k)||mi(k)}function _x(k){return k.sort(function(j,Q){return j===_a?-1:Q===_a?1:j<Q?-1:1})}function kn(k,j,Q,ye){this.thisDep=k,this.contextDep=j,this.propDep=Q,this.append=ye}function eo(k){return k&&!(k.thisDep||k.contextDep||k.propDep)}function Xr(k){return new kn(!1,!1,!1,k)}function Pn(k,j){var Q=k.type;if(Q===Np){var ye=k.data.length;return new kn(!0,ye>=1,ye>=2,j)}else if(Q===Ic){var Me=k.data;return new kn(Me.thisDep,Me.contextDep,Me.propDep,j)}else{if(Q===Vb)return new kn(!1,!1,!1,j);if(Q===Hb){for(var ge=!1,xe=!1,Oe=!1,Re=0;Re<k.data.length;++Re){var je=k.data[Re];if(je.type===Op)Oe=!0;else if(je.type===Dp)xe=!0;else if(je.type===Pp)ge=!0;else if(je.type===Np){ge=!0;var Be=je.data;Be>=1&&(xe=!0),Be>=2&&(Oe=!0)}else je.type===Ic&&(ge=ge||je.data.thisDep,xe=xe||je.data.contextDep,Oe=Oe||je.data.propDep)}return new kn(ge,xe,Oe,j)}else return new kn(Q===Pp,Q===Dp,Q===Op,j)}}var Sx=new kn(!1,!1,!1,function(){});function t3(k,j,Q,ye,Me,ge,xe,Oe,Re,je,Be,$e,He,De,Xe){var ce=je.Record,we={add:32774,subtract:32778,"reverse subtract":32779};Q.ext_blend_minmax&&(we.min=ZR,we.max=KR);var ze=Q.angle_instanced_arrays,Qe=Q.webgl_draw_buffers,ke={dirty:!0,profile:Xe.profile},tt={},Ne=[],We={},Le={};function qe(q){return q.replace(".","_")}function yt(q,G,ne){var le=qe(q);Ne.push(q),tt[le]=ke[le]=!!ne,We[le]=G}function Dt(q,G,ne){var le=qe(q);Ne.push(q),Array.isArray(ne)?(ke[le]=ne.slice(),tt[le]=ne.slice()):ke[le]=tt[le]=ne,Le[le]=G}yt(Zb,$R),yt(Kb,UR),Dt(Qb,"blendColor",[0,0,0,0]),Dt(Rp,"blendEquationSeparate",[bx,bx]),Dt(Bp,"blendFuncSeparate",[mx,yx,mx,yx]),yt(Jb,YR,!0),Dt(ex,"depthFunc",JR),Dt(tx,"depthRange",[0,1]),Dt(rx,"depthMask",!0),Dt(Fp,Fp,[!0,!0,!0,!0]),yt(nx,jR),Dt(ix,"cullFace",jo),Dt(Gp,Gp,Zp),Dt(zp,zp,1),yt(ax,qR),Dt(jp,"polygonOffset",[0,0]),yt(ox,VR),yt(sx,HR),Dt(Up,"sampleCoverage",[1,!1]),yt(ux,XR),Dt(fx,"stencilMask",-1),Dt($p,"stencilFunc",[QR,0,-1]),Dt(Xp,"stencilOpSeparate",[Sf,Qa,Qa,Qa]),Dt(vf,"stencilOpSeparate",[jo,Qa,Qa,Qa]),yt(lx,WR),Dt(kc,"scissor",[0,0,k.drawingBufferWidth,k.drawingBufferHeight]),Dt(_a,_a,[0,0,k.drawingBufferWidth,k.drawingBufferHeight]);var Ze={gl:k,context:He,strings:j,next:tt,current:ke,draw:$e,elements:ge,buffer:Me,shader:Be,attributes:je.state,vao:je,uniforms:Re,framebuffer:Oe,extensions:Q,timer:De,isBufferArgs:Uc},Ue={primTypes:Ws,compareFuncs:su,blendFuncs:Wi,blendEquations:we,stencilOps:Ja,glTypes:No,orientationType:Kp};F.optional(function(){Ze.isArrayLike=zr}),Qe&&(Ue.backBuffer=[jo],Ue.drawBuffer=Ht(ye.maxDrawbuffers,function(q){return q===0?[0]:Ht(q,function(G){return e3+G})}));var Ie=0;function Tt(){var q=OR(),G=q.link,ne=q.global;q.id=Ie++,q.batchId="0";var le=G(Ze),he=q.shared={props:"a0"};Object.keys(Ze).forEach(function(te){he[te]=ne.def(le,".",te)}),F.optional(function(){q.CHECK=G(F),q.commandStr=F.guessCommand(),q.command=G(q.commandStr),q.assert=function(te,$,fe){te("if(!(",$,"))",this.CHECK,".commandRaise(",G(fe),",",this.command,");")},Ue.invalidBlendCombinations=wx});var oe=q.next={},ae=q.current={};Object.keys(Le).forEach(function(te){Array.isArray(ke[te])&&(oe[te]=ne.def(he.next,".",te),ae[te]=ne.def(he.current,".",te))});var ue=q.constants={};Object.keys(Ue).forEach(function(te){ue[te]=ne.def(JSON.stringify(Ue[te]))}),q.invoke=function(te,$){switch($.type){case Np:var fe=["this",he.context,he.props,q.batchId];return te.def(G($.data),".call(",fe.slice(0,Math.max($.data.length+1,4)),")");case Op:return te.def(he.props,$.data);case Dp:return te.def(he.context,$.data);case Pp:return te.def("this",$.data);case Ic:return $.data.append(q,te),$.data.ref;case Vb:return $.data.toString();case Hb:return $.data.map(function(de){return q.invoke(te,de)})}},q.attribCache={};var V={};return q.scopeAttrib=function(te){var $=j.id(te);if($ in V)return V[$];var fe=je.scope[$];fe||(fe=je.scope[$]=new ce);var de=V[$]=G(fe);return de},q}function Ut(q){var G=q.static,ne=q.dynamic,le;if(pf in G){var he=!!G[pf];le=Xr(function(ae,ue){return he}),le.enable=he}else if(pf in ne){var oe=ne[pf];le=Pn(oe,function(ae,ue){return ae.invoke(ue,oe)})}return le}function it(q,G){var ne=q.static,le=q.dynamic;if(Bo in ne){var he=ne[Bo];return he?(he=Oe.getFramebuffer(he),F.command(he,"invalid framebuffer object"),Xr(function(ae,ue){var V=ae.link(he),te=ae.shared;ue.set(te.framebuffer,".next",V);var $=te.context;return ue.set($,"."+iu,V+".width"),ue.set($,"."+au,V+".height"),V})):Xr(function(ae,ue){var V=ae.shared;ue.set(V.framebuffer,".next","null");var te=V.context;return ue.set(te,"."+iu,te+"."+hx),ue.set(te,"."+au,te+"."+dx),"null"})}else if(Bo in le){var oe=le[Bo];return Pn(oe,function(ae,ue){var V=ae.invoke(ue,oe),te=ae.shared,$=te.framebuffer,fe=ue.def($,".getFramebuffer(",V,")");F.optional(function(){ae.assert(ue,"!"+V+"||"+fe,"invalid framebuffer object")}),ue.set($,".next",fe);var de=te.context;return ue.set(de,"."+iu,fe+"?"+fe+".width:"+de+"."+hx),ue.set(de,"."+au,fe+"?"+fe+".height:"+de+"."+dx),fe})}else return null}function qt(q,G,ne){var le=q.static,he=q.dynamic;function oe(V){if(V in le){var te=le[V];F.commandType(te,"object","invalid "+V,ne.commandStr);var $=!0,fe=te.x|0,de=te.y|0,Se,Ce;return"width"in te?(Se=te.width|0,F.command(Se>=0,"invalid "+V,ne.commandStr)):$=!1,"height"in te?(Ce=te.height|0,F.command(Ce>=0,"invalid "+V,ne.commandStr)):$=!1,new kn(!$&&G&&G.thisDep,!$&&G&&G.contextDep,!$&&G&&G.propDep,function(ft,Xt){var at=ft.shared.context,St=Se;"width"in te||(St=Xt.def(at,".",iu,"-",fe));var Ft=Ce;return"height"in te||(Ft=Xt.def(at,".",au,"-",de)),[fe,de,St,Ft]})}else if(V in he){var Ee=he[V],Ge=Pn(Ee,function(ft,Xt){var at=ft.invoke(Xt,Ee);F.optional(function(){ft.assert(Xt,at+"&&typeof "+at+'==="object"',"invalid "+V)});var St=ft.shared.context,Ft=Xt.def(at,".x|0"),cr=Xt.def(at,".y|0"),Br=Xt.def('"width" in ',at,"?",at,".width|0:","(",St,".",iu,"-",Ft,")"),Ln=Xt.def('"height" in ',at,"?",at,".height|0:","(",St,".",au,"-",cr,")");return F.optional(function(){ft.assert(Xt,Br+">=0&&"+Ln+">=0","invalid "+V)}),[Ft,cr,Br,Ln]});return G&&(Ge.thisDep=Ge.thisDep||G.thisDep,Ge.contextDep=Ge.contextDep||G.contextDep,Ge.propDep=Ge.propDep||G.propDep),Ge}else return G?new kn(G.thisDep,G.contextDep,G.propDep,function(ft,Xt){var at=ft.shared.context;return[0,0,Xt.def(at,".",iu),Xt.def(at,".",au)]}):null}var ae=oe(_a);if(ae){var ue=ae;ae=new kn(ae.thisDep,ae.contextDep,ae.propDep,function(V,te){var $=ue.append(V,te),fe=V.shared.context;return te.set(fe,"."+DR,$[2]),te.set(fe,"."+PR,$[3]),$})}return{viewport:ae,scissor_box:oe(kc)}}function Pt(q,G){var ne=q.static,le=typeof ne[yf]=="string"&&typeof ne[gf]=="string";if(le){if(Object.keys(G.dynamic).length>0)return null;var he=G.static,oe=Object.keys(he);if(oe.length>0&&typeof he[oe[0]]=="number"){for(var ae=[],ue=0;ue<oe.length;++ue)F(typeof he[oe[ue]]=="number","must specify all vertex attribute locations when using vaos"),ae.push([he[oe[ue]]|0,oe[ue]]);return ae}}return null}function Wt(q,G,ne){var le=q.static,he=q.dynamic;function oe($){if($ in le){var fe=j.id(le[$]);F.optional(function(){Be.shader(Ex[$],fe,F.guessCommand())});var de=Xr(function(){return fe});return de.id=fe,de}else if($ in he){var Se=he[$];return Pn(Se,function(Ce,Ee){var Ge=Ce.invoke(Ee,Se),ft=Ee.def(Ce.shared.strings,".id(",Ge,")");return F.optional(function(){Ee(Ce.shared.shader,".shader(",Ex[$],",",ft,",",Ce.command,");")}),ft})}return null}var ae=oe(yf),ue=oe(gf),V=null,te;return eo(ae)&&eo(ue)?(V=Be.program(ue.id,ae.id,null,ne),te=Xr(function($,fe){return $.link(V)})):te=new kn(ae&&ae.thisDep||ue&&ue.thisDep,ae&&ae.contextDep||ue&&ue.contextDep,ae&&ae.propDep||ue&&ue.propDep,function($,fe){var de=$.shared.shader,Se;ae?Se=ae.append($,fe):Se=fe.def(de,".",yf);var Ce;ue?Ce=ue.append($,fe):Ce=fe.def(de,".",gf);var Ee=de+".program("+Ce+","+Se;return F.optional(function(){Ee+=","+$.command}),fe.def(Ee+")")}),{frag:ae,vert:ue,progVar:te,program:V}}function lr(q,G){var ne=q.static,le=q.dynamic;function he(){if(Fo in ne){var $=ne[Fo];Uc($)?$=ge.getElements(ge.create($,!0)):$&&($=ge.getElements($),F.command($,"invalid elements",G.commandStr));var fe=Xr(function(Se,Ce){if($){var Ee=Se.link($);return Se.ELEMENTS=Ee,Ee}return Se.ELEMENTS=null,null});return fe.value=$,fe}else if(Fo in le){var de=le[Fo];return Pn(de,function(Se,Ce){var Ee=Se.shared,Ge=Ee.isBufferArgs,ft=Ee.elements,Xt=Se.invoke(Ce,de),at=Ce.def("null"),St=Ce.def(Ge,"(",Xt,")"),Ft=Se.cond(St).then(at,"=",ft,".createStream(",Xt,");").else(at,"=",ft,".getElements(",Xt,");");return F.optional(function(){Se.assert(Ft.else,"!"+Xt+"||"+at,"invalid elements")}),Ce.entry(Ft),Ce.exit(Se.cond(St).then(ft,".destroyStream(",at,");")),Se.ELEMENTS=at,at})}return null}var oe=he();function ae(){if(Go in ne){var $=ne[Go];return F.commandParameter($,Ws,"invalid primitve",G.commandStr),Xr(function(de,Se){return Ws[$]})}else if(Go in le){var fe=le[Go];return Pn(fe,function(de,Se){var Ce=de.constants.primTypes,Ee=de.invoke(Se,fe);return F.optional(function(){de.assert(Se,Ee+" in "+Ce,"invalid primitive, must be one of "+Object.keys(Ws))}),Se.def(Ce,"[",Ee,"]")})}else if(oe)return eo(oe)?oe.value?Xr(function(de,Se){return Se.def(de.ELEMENTS,".primType")}):Xr(function(){return px}):new kn(oe.thisDep,oe.contextDep,oe.propDep,function(de,Se){var Ce=de.ELEMENTS;return Se.def(Ce,"?",Ce,".primType:",px)});return null}function ue($,fe){if($ in ne){var de=ne[$]|0;return F.command(!fe||de>=0,"invalid "+$,G.commandStr),Xr(function(Ce,Ee){return fe&&(Ce.OFFSET=de),de})}else if($ in le){var Se=le[$];return Pn(Se,function(Ce,Ee){var Ge=Ce.invoke(Ee,Se);return fe&&(Ce.OFFSET=Ge,F.optional(function(){Ce.assert(Ee,Ge+">=0","invalid "+$)})),Ge})}else if(fe&&oe)return Xr(function(Ce,Ee){return Ce.OFFSET="0",0});return null}var V=ue(Lc,!0);function te(){if(zo in ne){var $=ne[zo]|0;return F.command(typeof $=="number"&&$>=0,"invalid vertex count",G.commandStr),Xr(function(){return $})}else if(zo in le){var fe=le[zo];return Pn(fe,function(Ce,Ee){var Ge=Ce.invoke(Ee,fe);return F.optional(function(){Ce.assert(Ee,"typeof "+Ge+'==="number"&&'+Ge+">=0&&"+Ge+"===("+Ge+"|0)","invalid vertex count")}),Ge})}else if(oe)if(eo(oe)){if(oe)return V?new kn(V.thisDep,V.contextDep,V.propDep,function(Ce,Ee){var Ge=Ee.def(Ce.ELEMENTS,".vertCount-",Ce.OFFSET);return F.optional(function(){Ce.assert(Ee,Ge+">=0","invalid vertex offset/element buffer too small")}),Ge}):Xr(function(Ce,Ee){return Ee.def(Ce.ELEMENTS,".vertCount")});var de=Xr(function(){return-1});return F.optional(function(){de.MISSING=!0}),de}else{var Se=new kn(oe.thisDep||V.thisDep,oe.contextDep||V.contextDep,oe.propDep||V.propDep,function(Ce,Ee){var Ge=Ce.ELEMENTS;return Ce.OFFSET?Ee.def(Ge,"?",Ge,".vertCount-",Ce.OFFSET,":-1"):Ee.def(Ge,"?",Ge,".vertCount:-1")});return F.optional(function(){Se.DYNAMIC=!0}),Se}return null}return{elements:oe,primitive:ae(),count:te(),instances:ue(Nc,!1),offset:V}}function Yr(q,G){var ne=q.static,le=q.dynamic,he={};return Ne.forEach(function(oe){var ae=qe(oe);function ue(V,te){if(oe in ne){var $=V(ne[oe]);he[ae]=Xr(function(){return $})}else if(oe in le){var fe=le[oe];he[ae]=Pn(fe,function(de,Se){return te(de,Se,de.invoke(Se,fe))})}}switch(oe){case nx:case Kb:case Zb:case ux:case Jb:case lx:case ax:case ox:case sx:case rx:return ue(function(V){return F.commandType(V,"boolean",oe,G.commandStr),V},function(V,te,$){return F.optional(function(){V.assert(te,"typeof "+$+'==="boolean"',"invalid flag "+oe,V.commandStr)}),$});case ex:return ue(function(V){return F.commandParameter(V,su,"invalid "+oe,G.commandStr),su[V]},function(V,te,$){var fe=V.constants.compareFuncs;return F.optional(function(){V.assert(te,$+" in "+fe,"invalid "+oe+", must be one of "+Object.keys(su))}),te.def(fe,"[",$,"]")});case tx:return ue(function(V){return F.command(zr(V)&&V.length===2&&typeof V[0]=="number"&&typeof V[1]=="number"&&V[0]<=V[1],"depth range is 2d array",G.commandStr),V},function(V,te,$){F.optional(function(){V.assert(te,V.shared.isArrayLike+"("+$+")&&"+$+".length===2&&typeof "+$+'[0]==="number"&&typeof '+$+'[1]==="number"&&'+$+"[0]<="+$+"[1]","depth range must be a 2d array")});var fe=te.def("+",$,"[0]"),de=te.def("+",$,"[1]");return[fe,de]});case Bp:return ue(function(V){F.commandType(V,"object","blend.func",G.commandStr);var te="srcRGB"in V?V.srcRGB:V.src,$="srcAlpha"in V?V.srcAlpha:V.src,fe="dstRGB"in V?V.dstRGB:V.dst,de="dstAlpha"in V?V.dstAlpha:V.dst;return F.commandParameter(te,Wi,ae+".srcRGB",G.commandStr),F.commandParameter($,Wi,ae+".srcAlpha",G.commandStr),F.commandParameter(fe,Wi,ae+".dstRGB",G.commandStr),F.commandParameter(de,Wi,ae+".dstAlpha",G.commandStr),F.command(wx.indexOf(te+", "+fe)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+te+", "+fe+")",G.commandStr),[Wi[te],Wi[fe],Wi[$],Wi[de]]},function(V,te,$){var fe=V.constants.blendFuncs;F.optional(function(){V.assert(te,$+"&&typeof "+$+'==="object"',"invalid blend func, must be an object")});function de(at,St){var Ft=te.def('"',at,St,'" in ',$,"?",$,".",at,St,":",$,".",at);return F.optional(function(){V.assert(te,Ft+" in "+fe,"invalid "+oe+"."+at+St+", must be one of "+Object.keys(Wi))}),Ft}var Se=de("src","RGB"),Ce=de("dst","RGB");F.optional(function(){var at=V.constants.invalidBlendCombinations;V.assert(te,at+".indexOf("+Se+'+", "+'+Ce+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var Ee=te.def(fe,"[",Se,"]"),Ge=te.def(fe,"[",de("src","Alpha"),"]"),ft=te.def(fe,"[",Ce,"]"),Xt=te.def(fe,"[",de("dst","Alpha"),"]");return[Ee,ft,Ge,Xt]});case Rp:return ue(function(V){if(typeof V=="string")return F.commandParameter(V,we,"invalid "+oe,G.commandStr),[we[V],we[V]];if(typeof V=="object")return F.commandParameter(V.rgb,we,oe+".rgb",G.commandStr),F.commandParameter(V.alpha,we,oe+".alpha",G.commandStr),[we[V.rgb],we[V.alpha]];F.commandRaise("invalid blend.equation",G.commandStr)},function(V,te,$){var fe=V.constants.blendEquations,de=te.def(),Se=te.def(),Ce=V.cond("typeof ",$,'==="string"');return F.optional(function(){function Ee(Ge,ft,Xt){V.assert(Ge,Xt+" in "+fe,"invalid "+ft+", must be one of "+Object.keys(we))}Ee(Ce.then,oe,$),V.assert(Ce.else,$+"&&typeof "+$+'==="object"',"invalid "+oe),Ee(Ce.else,oe+".rgb",$+".rgb"),Ee(Ce.else,oe+".alpha",$+".alpha")}),Ce.then(de,"=",Se,"=",fe,"[",$,"];"),Ce.else(de,"=",fe,"[",$,".rgb];",Se,"=",fe,"[",$,".alpha];"),te(Ce),[de,Se]});case Qb:return ue(function(V){return F.command(zr(V)&&V.length===4,"blend.color must be a 4d array",G.commandStr),Ht(4,function(te){return+V[te]})},function(V,te,$){return F.optional(function(){V.assert(te,V.shared.isArrayLike+"("+$+")&&"+$+".length===4","blend.color must be a 4d array")}),Ht(4,function(fe){return te.def("+",$,"[",fe,"]")})});case fx:return ue(function(V){return F.commandType(V,"number",ae,G.commandStr),V|0},function(V,te,$){return F.optional(function(){V.assert(te,"typeof "+$+'==="number"',"invalid stencil.mask")}),te.def($,"|0")});case $p:return ue(function(V){F.commandType(V,"object",ae,G.commandStr);var te=V.cmp||"keep",$=V.ref||0,fe="mask"in V?V.mask:-1;return F.commandParameter(te,su,oe+".cmp",G.commandStr),F.commandType($,"number",oe+".ref",G.commandStr),F.commandType(fe,"number",oe+".mask",G.commandStr),[su[te],$,fe]},function(V,te,$){var fe=V.constants.compareFuncs;F.optional(function(){function Ee(){V.assert(te,Array.prototype.join.call(arguments,""),"invalid stencil.func")}Ee($+"&&typeof ",$,'==="object"'),Ee('!("cmp" in ',$,")||(",$,".cmp in ",fe,")")});var de=te.def('"cmp" in ',$,"?",fe,"[",$,".cmp]",":",Qa),Se=te.def($,".ref|0"),Ce=te.def('"mask" in ',$,"?",$,".mask|0:-1");return[de,Se,Ce]});case Xp:case vf:return ue(function(V){F.commandType(V,"object",ae,G.commandStr);var te=V.fail||"keep",$=V.zfail||"keep",fe=V.zpass||"keep";return F.commandParameter(te,Ja,oe+".fail",G.commandStr),F.commandParameter($,Ja,oe+".zfail",G.commandStr),F.commandParameter(fe,Ja,oe+".zpass",G.commandStr),[oe===vf?jo:Sf,Ja[te],Ja[$],Ja[fe]]},function(V,te,$){var fe=V.constants.stencilOps;F.optional(function(){V.assert(te,$+"&&typeof "+$+'==="object"',"invalid "+oe)});function de(Se){return F.optional(function(){V.assert(te,'!("'+Se+'" in '+$+")||("+$+"."+Se+" in "+fe+")","invalid "+oe+"."+Se+", must be one of "+Object.keys(Ja))}),te.def('"',Se,'" in ',$,"?",fe,"[",$,".",Se,"]:",Qa)}return[oe===vf?jo:Sf,de("fail"),de("zfail"),de("zpass")]});case jp:return ue(function(V){F.commandType(V,"object",ae,G.commandStr);var te=V.factor|0,$=V.units|0;return F.commandType(te,"number",ae+".factor",G.commandStr),F.commandType($,"number",ae+".units",G.commandStr),[te,$]},function(V,te,$){F.optional(function(){V.assert(te,$+"&&typeof "+$+'==="object"',"invalid "+oe)});var fe=te.def($,".factor|0"),de=te.def($,".units|0");return[fe,de]});case ix:return ue(function(V){var te=0;return V==="front"?te=Sf:V==="back"&&(te=jo),F.command(!!te,ae,G.commandStr),te},function(V,te,$){return F.optional(function(){V.assert(te,$+'==="front"||'+$+'==="back"',"invalid cull.face")}),te.def($,'==="front"?',Sf,":",jo)});case zp:return ue(function(V){return F.command(typeof V=="number"&&V>=ye.lineWidthDims[0]&&V<=ye.lineWidthDims[1],"invalid line width, must be a positive number between "+ye.lineWidthDims[0]+" and "+ye.lineWidthDims[1],G.commandStr),V},function(V,te,$){return F.optional(function(){V.assert(te,"typeof "+$+'==="number"&&'+$+">="+ye.lineWidthDims[0]+"&&"+$+"<="+ye.lineWidthDims[1],"invalid line width")}),$});case Gp:return ue(function(V){return F.commandParameter(V,Kp,ae,G.commandStr),Kp[V]},function(V,te,$){return F.optional(function(){V.assert(te,$+'==="cw"||'+$+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),te.def($+'==="cw"?'+gx+":"+Zp)});case Fp:return ue(function(V){return F.command(zr(V)&&V.length===4,"color.mask must be length 4 array",G.commandStr),V.map(function(te){return!!te})},function(V,te,$){return F.optional(function(){V.assert(te,V.shared.isArrayLike+"("+$+")&&"+$+".length===4","invalid color.mask")}),Ht(4,function(fe){return"!!"+$+"["+fe+"]"})});case Up:return ue(function(V){F.command(typeof V=="object"&&V,ae,G.commandStr);var te="value"in V?V.value:1,$=!!V.invert;return F.command(typeof te=="number"&&te>=0&&te<=1,"sample.coverage.value must be a number between 0 and 1",G.commandStr),[te,$]},function(V,te,$){F.optional(function(){V.assert(te,$+"&&typeof "+$+'==="object"',"invalid sample.coverage")});var fe=te.def('"value" in ',$,"?+",$,".value:1"),de=te.def("!!",$,".invert");return[fe,de]})}}),he}function nn(q,G){var ne=q.static,le=q.dynamic,he={};return Object.keys(ne).forEach(function(oe){var ae=ne[oe],ue;if(typeof ae=="number"||typeof ae=="boolean")ue=Xr(function(){return ae});else if(typeof ae=="function"){var V=ae._reglType;V==="texture2d"||V==="textureCube"?ue=Xr(function(te){return te.link(ae)}):V==="framebuffer"||V==="framebufferCube"?(F.command(ae.color.length>0,'missing color attachment for framebuffer sent to uniform "'+oe+'"',G.commandStr),ue=Xr(function(te){return te.link(ae.color[0])})):F.commandRaise('invalid data for uniform "'+oe+'"',G.commandStr)}else zr(ae)?ue=Xr(function(te){var $=te.global.def("[",Ht(ae.length,function(fe){return F.command(typeof ae[fe]=="number"||typeof ae[fe]=="boolean","invalid uniform "+oe,te.commandStr),ae[fe]}),"]");return $}):F.commandRaise('invalid or missing data for uniform "'+oe+'"',G.commandStr);ue.value=ae,he[oe]=ue}),Object.keys(le).forEach(function(oe){var ae=le[oe];he[oe]=Pn(ae,function(ue,V){return ue.invoke(V,ae)})}),he}function Kt(q,G){var ne=q.static,le=q.dynamic,he={};return Object.keys(ne).forEach(function(oe){var ae=ne[oe],ue=j.id(oe),V=new ce;if(Uc(ae))V.state=nu,V.buffer=Me.getBuffer(Me.create(ae,ou,!1,!0)),V.type=0;else{var te=Me.getBuffer(ae);if(te)V.state=nu,V.buffer=te,V.type=0;else if(F.command(typeof ae=="object"&&ae,"invalid data for attribute "+oe,G.commandStr),"constant"in ae){var $=ae.constant;V.buffer="null",V.state=Lp,typeof $=="number"?V.x=$:(F.command(zr($)&&$.length>0&&$.length<=4,"invalid constant for attribute "+oe,G.commandStr),ru.forEach(function(ft,Xt){Xt<$.length&&(V[ft]=$[Xt])}))}else{Uc(ae.buffer)?te=Me.getBuffer(Me.create(ae.buffer,ou,!1,!0)):te=Me.getBuffer(ae.buffer),F.command(!!te,'missing buffer for attribute "'+oe+'"',G.commandStr);var fe=ae.offset|0;F.command(fe>=0,'invalid offset for attribute "'+oe+'"',G.commandStr);var de=ae.stride|0;F.command(de>=0&&de<256,'invalid stride for attribute "'+oe+'", must be integer betweeen [0, 255]',G.commandStr);var Se=ae.size|0;F.command(!("size"in ae)||Se>0&&Se<=4,'invalid size for attribute "'+oe+'", must be 1,2,3,4',G.commandStr);var Ce=!!ae.normalized,Ee=0;"type"in ae&&(F.commandParameter(ae.type,No,"invalid type for attribute "+oe,G.commandStr),Ee=No[ae.type]);var Ge=ae.divisor|0;"divisor"in ae&&(F.command(Ge===0||ze,'cannot specify divisor for attribute "'+oe+'", instancing not supported',G.commandStr),F.command(Ge>=0,'invalid divisor for attribute "'+oe+'"',G.commandStr)),F.optional(function(){var ft=G.commandStr,Xt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(ae).forEach(function(at){F.command(Xt.indexOf(at)>=0,'unknown parameter "'+at+'" for attribute pointer "'+oe+'" (valid parameters are '+Xt+")",ft)})}),V.buffer=te,V.state=nu,V.size=Se,V.normalized=Ce,V.type=Ee||te.dtype,V.offset=fe,V.stride=de,V.divisor=Ge}}he[oe]=Xr(function(ft,Xt){var at=ft.attribCache;if(ue in at)return at[ue];var St={isStream:!1};return Object.keys(V).forEach(function(Ft){St[Ft]=V[Ft]}),V.buffer&&(St.buffer=ft.link(V.buffer),St.type=St.type||St.buffer+".dtype"),at[ue]=St,St})}),Object.keys(le).forEach(function(oe){var ae=le[oe];function ue(V,te){var $=V.invoke(te,ae),fe=V.shared,de=V.constants,Se=fe.isBufferArgs,Ce=fe.buffer;F.optional(function(){V.assert(te,$+"&&(typeof "+$+'==="object"||typeof '+$+'==="function")&&('+Se+"("+$+")||"+Ce+".getBuffer("+$+")||"+Ce+".getBuffer("+$+".buffer)||"+Se+"("+$+'.buffer)||("constant" in '+$+"&&(typeof "+$+'.constant==="number"||'+fe.isArrayLike+"("+$+".constant))))",'invalid dynamic attribute "'+oe+'"')});var Ee={isStream:te.def(!1)},Ge=new ce;Ge.state=nu,Object.keys(Ge).forEach(function(St){Ee[St]=te.def(""+Ge[St])});var ft=Ee.buffer,Xt=Ee.type;te("if(",Se,"(",$,")){",Ee.isStream,"=true;",ft,"=",Ce,".createStream(",ou,",",$,");",Xt,"=",ft,".dtype;","}else{",ft,"=",Ce,".getBuffer(",$,");","if(",ft,"){",Xt,"=",ft,".dtype;",'}else if("constant" in ',$,"){",Ee.state,"=",Lp,";","if(typeof "+$+'.constant === "number"){',Ee[ru[0]],"=",$,".constant;",ru.slice(1).map(function(St){return Ee[St]}).join("="),"=0;","}else{",ru.map(function(St,Ft){return Ee[St]+"="+$+".constant.length>"+Ft+"?"+$+".constant["+Ft+"]:0;"}).join(""),"}}else{","if(",Se,"(",$,".buffer)){",ft,"=",Ce,".createStream(",ou,",",$,".buffer);","}else{",ft,"=",Ce,".getBuffer(",$,".buffer);","}",Xt,'="type" in ',$,"?",de.glTypes,"[",$,".type]:",ft,".dtype;",Ee.normalized,"=!!",$,".normalized;");function at(St){te(Ee[St],"=",$,".",St,"|0;")}return at("size"),at("offset"),at("stride"),at("divisor"),te("}}"),te.exit("if(",Ee.isStream,"){",Ce,".destroyStream(",ft,");","}"),Ee}he[oe]=Pn(ae,ue)}),he}function Zr(q,G){var ne=q.static,le=q.dynamic;if(mf in ne){var he=ne[mf];return he!==null&&je.getVAO(he)===null&&(he=je.createVAO(he)),Xr(function(ae){return ae.link(je.getVAO(he))})}else if(mf in le){var oe=le[mf];return Pn(oe,function(ae,ue){var V=ae.invoke(ue,oe);return ue.def(ae.shared.vao+".getVAO("+V+")")})}return null}function Ar(q){var G=q.static,ne=q.dynamic,le={};return Object.keys(G).forEach(function(he){var oe=G[he];le[he]=Xr(function(ae,ue){return typeof oe=="number"||typeof oe=="boolean"?""+oe:ae.link(oe)})}),Object.keys(ne).forEach(function(he){var oe=ne[he];le[he]=Pn(oe,function(ae,ue){return ae.invoke(ue,oe)})}),le}function Wr(q,G,ne,le,he){var oe=q.static,ae=q.dynamic;F.optional(function(){var at=[Bo,gf,yf,Fo,Go,Lc,zo,Nc,pf,mf].concat(Ne);function St(Ft){Object.keys(Ft).forEach(function(cr){F.command(at.indexOf(cr)>=0,'unknown parameter "'+cr+'"',he.commandStr)})}St(oe),St(ae)});var ue=Pt(q,G),V=it(q),te=qt(q,V,he),$=lr(q,he),fe=Yr(q,he),de=Wt(q,he,ue);function Se(at){var St=te[at];St&&(fe[at]=St)}Se(_a),Se(qe(kc));var Ce=Object.keys(fe).length>0,Ee={framebuffer:V,draw:$,shader:de,state:fe,dirty:Ce,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(Ee.profile=Ut(q),Ee.uniforms=nn(ne,he),Ee.drawVAO=Ee.scopeVAO=Zr(q),!Ee.drawVAO&&de.program&&!ue&&Q.angle_instanced_arrays){var Ge=!0,ft=de.program.attributes.map(function(at){var St=G.static[at];return Ge=Ge&&!!St,St});if(Ge&&ft.length>0){var Xt=je.getVAO(je.createVAO(ft));Ee.drawVAO=new kn(null,null,null,function(at,St){return at.link(Xt)}),Ee.useVAO=!0}}return ue?Ee.useVAO=!0:Ee.attributes=Kt(G,he),Ee.context=Ar(le),Ee}function Kr(q,G,ne){var le=q.shared,he=le.context,oe=q.scope();Object.keys(ne).forEach(function(ae){G.save(he,"."+ae);var ue=ne[ae],V=ue.append(q,G);Array.isArray(V)?oe(he,".",ae,"=[",V.join(),"];"):oe(he,".",ae,"=",V,";")}),G(oe)}function Qr(q,G,ne,le){var he=q.shared,oe=he.gl,ae=he.framebuffer,ue;Qe&&(ue=G.def(he.extensions,".webgl_draw_buffers"));var V=q.constants,te=V.drawBuffer,$=V.backBuffer,fe;ne?fe=ne.append(q,G):fe=G.def(ae,".next"),le||G("if(",fe,"!==",ae,".cur){"),G("if(",fe,"){",oe,".bindFramebuffer(",xx,",",fe,".framebuffer);"),Qe&&G(ue,".drawBuffersWEBGL(",te,"[",fe,".colorAttachments.length]);"),G("}else{",oe,".bindFramebuffer(",xx,",null);"),Qe&&G(ue,".drawBuffersWEBGL(",$,");"),G("}",ae,".cur=",fe,";"),le||G("}")}function on(q,G,ne){var le=q.shared,he=le.gl,oe=q.current,ae=q.next,ue=le.current,V=le.next,te=q.cond(ue,".dirty");Ne.forEach(function($){var fe=qe($);if(!(fe in ne.state)){var de,Se;if(fe in ae){de=ae[fe],Se=oe[fe];var Ce=Ht(ke[fe].length,function(Ge){return te.def(de,"[",Ge,"]")});te(q.cond(Ce.map(function(Ge,ft){return Ge+"!=="+Se+"["+ft+"]"}).join("||")).then(he,".",Le[fe],"(",Ce,");",Ce.map(function(Ge,ft){return Se+"["+ft+"]="+Ge}).join(";"),";"))}else{de=te.def(V,".",fe);var Ee=q.cond(de,"!==",ue,".",fe);te(Ee),fe in We?Ee(q.cond(de).then(he,".enable(",We[fe],");").else(he,".disable(",We[fe],");"),ue,".",fe,"=",de,";"):Ee(he,".",Le[fe],"(",de,");",ue,".",fe,"=",de,";")}}}),Object.keys(ne.state).length===0&&te(ue,".dirty=false;"),G(te)}function vn(q,G,ne,le){var he=q.shared,oe=q.current,ae=he.current,ue=he.gl;_x(Object.keys(ne)).forEach(function(V){var te=ne[V];if(!(le&&!le(te))){var $=te.append(q,G);if(We[V]){var fe=We[V];eo(te)?$?G(ue,".enable(",fe,");"):G(ue,".disable(",fe,");"):G(q.cond($).then(ue,".enable(",fe,");").else(ue,".disable(",fe,");")),G(ae,".",V,"=",$,";")}else if(zr($)){var de=oe[V];G(ue,".",Le[V],"(",$,");",$.map(function(Se,Ce){return de+"["+Ce+"]="+Se}).join(";"),";")}else G(ue,".",Le[V],"(",$,");",ae,".",V,"=",$,";")}})}function jr(q,G){ze&&(q.instancing=G.def(q.shared.extensions,".angle_instanced_arrays"))}function $t(q,G,ne,le,he){var oe=q.shared,ae=q.stats,ue=oe.current,V=oe.timer,te=ne.profile;function $(){return typeof performance>"u"?"Date.now()":"performance.now()"}var fe,de;function Se(at){fe=G.def(),at(fe,"=",$(),";"),typeof he=="string"?at(ae,".count+=",he,";"):at(ae,".count++;"),De&&(le?(de=G.def(),at(de,"=",V,".getNumPendingQueries();")):at(V,".beginQuery(",ae,");"))}function Ce(at){at(ae,".cpuTime+=",$(),"-",fe,";"),De&&(le?at(V,".pushScopeStats(",de,",",V,".getNumPendingQueries(),",ae,");"):at(V,".endQuery();"))}function Ee(at){var St=G.def(ue,".profile");G(ue,".profile=",at,";"),G.exit(ue,".profile=",St,";")}var Ge;if(te){if(eo(te)){te.enable?(Se(G),Ce(G.exit),Ee("true")):Ee("false");return}Ge=te.append(q,G),Ee(Ge)}else Ge=G.def(ue,".profile");var ft=q.block();Se(ft),G("if(",Ge,"){",ft,"}");var Xt=q.block();Ce(Xt),G.exit("if(",Ge,"){",Xt,"}")}function pn(q,G,ne,le,he){var oe=q.shared;function ae(V){switch(V){case Oc:case Rc:case Gc:return 2;case Dc:case Bc:case zc:return 3;case Pc:case Fc:case jc:return 4;default:return 1}}function ue(V,te,$){var fe=oe.gl,de=G.def(V,".location"),Se=G.def(oe.attributes,"[",de,"]"),Ce=$.state,Ee=$.buffer,Ge=[$.x,$.y,$.z,$.w],ft=["buffer","normalized","offset","stride"];function Xt(){G("if(!",Se,".buffer){",fe,".enableVertexAttribArray(",de,");}");var St=$.type,Ft;if($.size?Ft=G.def($.size,"||",te):Ft=te,G("if(",Se,".type!==",St,"||",Se,".size!==",Ft,"||",ft.map(function(Br){return Se+"."+Br+"!=="+$[Br]}).join("||"),"){",fe,".bindBuffer(",ou,",",Ee,".buffer);",fe,".vertexAttribPointer(",[de,Ft,St,$.normalized,$.stride,$.offset],");",Se,".type=",St,";",Se,".size=",Ft,";",ft.map(function(Br){return Se+"."+Br+"="+$[Br]+";"}).join(""),"}"),ze){var cr=$.divisor;G("if(",Se,".divisor!==",cr,"){",q.instancing,".vertexAttribDivisorANGLE(",[de,cr],");",Se,".divisor=",cr,";}")}}function at(){G("if(",Se,".buffer){",fe,".disableVertexAttribArray(",de,");",Se,".buffer=null;","}if(",ru.map(function(St,Ft){return Se+"."+St+"!=="+Ge[Ft]}).join("||"),"){",fe,".vertexAttrib4f(",de,",",Ge,");",ru.map(function(St,Ft){return Se+"."+St+"="+Ge[Ft]+";"}).join(""),"}")}Ce===nu?Xt():Ce===Lp?at():(G("if(",Ce,"===",nu,"){"),Xt(),G("}else{"),at(),G("}"))}le.forEach(function(V){var te=V.name,$=ne.attributes[te],fe;if($){if(!he($))return;fe=$.append(q,G)}else{if(!he(Sx))return;var de=q.scopeAttrib(te);F.optional(function(){q.assert(G,de+".state","missing attribute "+te)}),fe={},Object.keys(new ce).forEach(function(Se){fe[Se]=G.def(de,".",Se)})}ue(q.link(V),ae(V.info.type),fe)})}function gr(q,G,ne,le,he){for(var oe=q.shared,ae=oe.gl,ue,V=0;V<le.length;++V){var te=le[V],$=te.name,fe=te.info.type,de=ne.uniforms[$],Se=q.link(te),Ce=Se+".location",Ee;if(de){if(!he(de))continue;if(eo(de)){var Ge=de.value;if(F.command(Ge!==null&&typeof Ge<"u",'missing uniform "'+$+'"',q.commandStr),fe===Ef||fe===_f){F.command(typeof Ge=="function"&&(fe===Ef&&(Ge._reglType==="texture2d"||Ge._reglType==="framebuffer")||fe===_f&&(Ge._reglType==="textureCube"||Ge._reglType==="framebufferCube")),"invalid texture for uniform "+$,q.commandStr);var ft=q.link(Ge._texture||Ge.color[0]._texture);G(ae,".uniform1i(",Ce,",",ft+".bind());"),G.exit(ft,".unbind();")}else if(fe===bf||fe===xf||fe===wf){F.optional(function(){F.command(zr(Ge),"invalid matrix for uniform "+$,q.commandStr),F.command(fe===bf&&Ge.length===4||fe===xf&&Ge.length===9||fe===wf&&Ge.length===16,"invalid length for matrix uniform "+$,q.commandStr)});var Xt=q.global.def("new Float32Array(["+Array.prototype.slice.call(Ge)+"])"),at=2;fe===xf?at=3:fe===wf&&(at=4),G(ae,".uniformMatrix",at,"fv(",Ce,",false,",Xt,");")}else{switch(fe){case qp:F.commandType(Ge,"number","uniform "+$,q.commandStr),ue="1f";break;case Oc:F.command(zr(Ge)&&Ge.length===2,"uniform "+$,q.commandStr),ue="2f";break;case Dc:F.command(zr(Ge)&&Ge.length===3,"uniform "+$,q.commandStr),ue="3f";break;case Pc:F.command(zr(Ge)&&Ge.length===4,"uniform "+$,q.commandStr),ue="4f";break;case Hp:F.commandType(Ge,"boolean","uniform "+$,q.commandStr),ue="1i";break;case Vp:F.commandType(Ge,"number","uniform "+$,q.commandStr),ue="1i";break;case Gc:F.command(zr(Ge)&&Ge.length===2,"uniform "+$,q.commandStr),ue="2i";break;case Rc:F.command(zr(Ge)&&Ge.length===2,"uniform "+$,q.commandStr),ue="2i";break;case zc:F.command(zr(Ge)&&Ge.length===3,"uniform "+$,q.commandStr),ue="3i";break;case Bc:F.command(zr(Ge)&&Ge.length===3,"uniform "+$,q.commandStr),ue="3i";break;case jc:F.command(zr(Ge)&&Ge.length===4,"uniform "+$,q.commandStr),ue="4i";break;case Fc:F.command(zr(Ge)&&Ge.length===4,"uniform "+$,q.commandStr),ue="4i";break}G(ae,".uniform",ue,"(",Ce,",",zr(Ge)?Array.prototype.slice.call(Ge):Ge,");")}continue}else Ee=de.append(q,G)}else{if(!he(Sx))continue;Ee=G.def(oe.uniforms,"[",j.id($),"]")}fe===Ef?(F(!Array.isArray(Ee),"must specify a scalar prop for textures"),G("if(",Ee,"&&",Ee,'._reglType==="framebuffer"){',Ee,"=",Ee,".color[0];","}")):fe===_f&&(F(!Array.isArray(Ee),"must specify a scalar prop for cube maps"),G("if(",Ee,"&&",Ee,'._reglType==="framebufferCube"){',Ee,"=",Ee,".color[0];","}")),F.optional(function(){function Ln(xi,Lx){q.assert(G,xi,'bad data or missing for uniform "'+$+'". '+Lx)}function Qp(xi){F(!Array.isArray(Ee),"must not specify an array type for uniform"),Ln("typeof "+Ee+'==="'+xi+'"',"invalid type, expected "+xi)}function ni(xi,Lx){Array.isArray(Ee)?F(Ee.length===xi,"must have length "+xi):Ln(oe.isArrayLike+"("+Ee+")&&"+Ee+".length==="+xi,"invalid vector, should have length "+xi,q.commandStr)}function kx(xi){F(!Array.isArray(Ee),"must not specify a value type"),Ln("typeof "+Ee+'==="function"&&'+Ee+'._reglType==="texture'+(xi===vx?"2d":"Cube")+'"',"invalid texture type",q.commandStr)}switch(fe){case Vp:Qp("number");break;case Rc:ni(2);break;case Bc:ni(3);break;case Fc:ni(4);break;case qp:Qp("number");break;case Oc:ni(2);break;case Dc:ni(3);break;case Pc:ni(4);break;case Hp:Qp("boolean");break;case Gc:ni(2);break;case zc:ni(3);break;case jc:ni(4);break;case bf:ni(4);break;case xf:ni(9);break;case wf:ni(16);break;case Ef:kx(vx);break;case _f:kx(zR);break}});var St=1;switch(fe){case Ef:case _f:var Ft=G.def(Ee,"._texture");G(ae,".uniform1i(",Ce,",",Ft,".bind());"),G.exit(Ft,".unbind();");continue;case Vp:case Hp:ue="1i";break;case Rc:case Gc:ue="2i",St=2;break;case Bc:case zc:ue="3i",St=3;break;case Fc:case jc:ue="4i",St=4;break;case qp:ue="1f";break;case Oc:ue="2f",St=2;break;case Dc:ue="3f",St=3;break;case Pc:ue="4f",St=4;break;case bf:ue="Matrix2fv";break;case xf:ue="Matrix3fv";break;case wf:ue="Matrix4fv";break}if(G(ae,".uniform",ue,"(",Ce,","),ue.charAt(0)==="M"){var cr=Math.pow(fe-bf+2,2),Br=q.global.def("new Float32Array(",cr,")");Array.isArray(Ee)?G("false,(",Ht(cr,function(Ln){return Br+"["+Ln+"]="+Ee[Ln]}),",",Br,")"):G("false,(Array.isArray(",Ee,")||",Ee," instanceof Float32Array)?",Ee,":(",Ht(cr,function(Ln){return Br+"["+Ln+"]="+Ee+"["+Ln+"]"}),",",Br,")")}else St>1?G(Ht(St,function(Ln){return Array.isArray(Ee)?Ee[Ln]:Ee+"["+Ln+"]"})):(F(!Array.isArray(Ee),"uniform value must not be an array"),G(Ee));G(");")}}function Et(q,G,ne,le){var he=q.shared,oe=he.gl,ae=he.draw,ue=le.draw;function V(){var Ft=ue.elements,cr,Br=G;return Ft?((Ft.contextDep&&le.contextDynamic||Ft.propDep)&&(Br=ne),cr=Ft.append(q,Br)):cr=Br.def(ae,".",Fo),cr&&Br("if("+cr+")"+oe+".bindBuffer("+BR+","+cr+".buffer.buffer);"),cr}function te(){var Ft=ue.count,cr,Br=G;return Ft?((Ft.contextDep&&le.contextDynamic||Ft.propDep)&&(Br=ne),cr=Ft.append(q,Br),F.optional(function(){Ft.MISSING&&q.assert(G,"false","missing vertex count"),Ft.DYNAMIC&&q.assert(Br,cr+">=0","missing vertex count")})):(cr=Br.def(ae,".",zo),F.optional(function(){q.assert(Br,cr+">=0","missing vertex count")})),cr}var $=V();function fe(Ft){var cr=ue[Ft];return cr?cr.contextDep&&le.contextDynamic||cr.propDep?cr.append(q,ne):cr.append(q,G):G.def(ae,".",Ft)}var de=fe(Go),Se=fe(Lc),Ce=te();if(typeof Ce=="number"){if(Ce===0)return}else ne("if(",Ce,"){"),ne.exit("}");var Ee,Ge;ze&&(Ee=fe(Nc),Ge=q.instancing);var ft=$+".type",Xt=ue.elements&&eo(ue.elements);function at(){function Ft(){ne(Ge,".drawElementsInstancedANGLE(",[de,Ce,ft,Se+"<<(("+ft+"-"+qb+")>>1)",Ee],");")}function cr(){ne(Ge,".drawArraysInstancedANGLE(",[de,Se,Ce,Ee],");")}$?Xt?Ft():(ne("if(",$,"){"),Ft(),ne("}else{"),cr(),ne("}")):cr()}function St(){function Ft(){ne(oe+".drawElements("+[de,Ce,ft,Se+"<<(("+ft+"-"+qb+")>>1)"]+");")}function cr(){ne(oe+".drawArrays("+[de,Se,Ce]+");")}$?Xt?Ft():(ne("if(",$,"){"),Ft(),ne("}else{"),cr(),ne("}")):cr()}ze&&(typeof Ee!="number"||Ee>=0)?typeof Ee=="string"?(ne("if(",Ee,">0){"),at(),ne("}else if(",Ee,"<0){"),St(),ne("}")):at():St()}function Zt(q,G,ne,le,he){var oe=Tt(),ae=oe.proc("body",he);return F.optional(function(){oe.commandStr=G.commandStr,oe.command=oe.link(G.commandStr)}),ze&&(oe.instancing=ae.def(oe.shared.extensions,".angle_instanced_arrays")),q(oe,ae,ne,le),oe.compile().body}function ar(q,G,ne,le){jr(q,G),ne.useVAO?ne.drawVAO?G(q.shared.vao,".setVAO(",ne.drawVAO.append(q,G),");"):G(q.shared.vao,".setVAO(",q.shared.vao,".targetVAO);"):(G(q.shared.vao,".setVAO(null);"),pn(q,G,ne,le.attributes,function(){return!0})),gr(q,G,ne,le.uniforms,function(){return!0}),Et(q,G,G,ne)}function Ur(q,G){var ne=q.proc("draw",1);jr(q,ne),Kr(q,ne,G.context),Qr(q,ne,G.framebuffer),on(q,ne,G),vn(q,ne,G.state),$t(q,ne,G,!1,!0);var le=G.shader.progVar.append(q,ne);if(ne(q.shared.gl,".useProgram(",le,".program);"),G.shader.program)ar(q,ne,G,G.shader.program);else{ne(q.shared.vao,".setVAO(null);");var he=q.global.def("{}"),oe=ne.def(le,".id"),ae=ne.def(he,"[",oe,"]");ne(q.cond(ae).then(ae,".call(this,a0);").else(ae,"=",he,"[",oe,"]=",q.link(function(ue){return Zt(ar,q,G,ue,1)}),"(",le,");",ae,".call(this,a0);"))}Object.keys(G.state).length>0&&ne(q.shared.current,".dirty=true;")}function qi(q,G,ne,le){q.batchId="a1",jr(q,G);function he(){return!0}pn(q,G,ne,le.attributes,he),gr(q,G,ne,le.uniforms,he),Et(q,G,G,ne)}function Uo(q,G,ne,le){jr(q,G);var he=ne.contextDep,oe=G.def(),ae="a0",ue="a1",V=G.def();q.shared.props=V,q.batchId=oe;var te=q.scope(),$=q.scope();G(te.entry,"for(",oe,"=0;",oe,"<",ue,";++",oe,"){",V,"=",ae,"[",oe,"];",$,"}",te.exit);function fe(ft){return ft.contextDep&&he||ft.propDep}function de(ft){return!fe(ft)}if(ne.needsContext&&Kr(q,$,ne.context),ne.needsFramebuffer&&Qr(q,$,ne.framebuffer),vn(q,$,ne.state,fe),ne.profile&&fe(ne.profile)&&$t(q,$,ne,!1,!0),le)ne.useVAO?ne.drawVAO?fe(ne.drawVAO)?$(q.shared.vao,".setVAO(",ne.drawVAO.append(q,$),");"):te(q.shared.vao,".setVAO(",ne.drawVAO.append(q,te),");"):te(q.shared.vao,".setVAO(",q.shared.vao,".targetVAO);"):(te(q.shared.vao,".setVAO(null);"),pn(q,te,ne,le.attributes,de),pn(q,$,ne,le.attributes,fe)),gr(q,te,ne,le.uniforms,de),gr(q,$,ne,le.uniforms,fe),Et(q,te,$,ne);else{var Se=q.global.def("{}"),Ce=ne.shader.progVar.append(q,$),Ee=$.def(Ce,".id"),Ge=$.def(Se,"[",Ee,"]");$(q.shared.gl,".useProgram(",Ce,".program);","if(!",Ge,"){",Ge,"=",Se,"[",Ee,"]=",q.link(function(ft){return Zt(qi,q,ne,ft,2)}),"(",Ce,");}",Ge,".call(this,a0[",oe,"],",oe,");")}}function H(q,G){var ne=q.proc("batch",2);q.batchId="0",jr(q,ne);var le=!1,he=!0;Object.keys(G.context).forEach(function(Se){le=le||G.context[Se].propDep}),le||(Kr(q,ne,G.context),he=!1);var oe=G.framebuffer,ae=!1;oe?(oe.propDep?le=ae=!0:oe.contextDep&&le&&(ae=!0),ae||Qr(q,ne,oe)):Qr(q,ne,null),G.state.viewport&&G.state.viewport.propDep&&(le=!0);function ue(Se){return Se.contextDep&&le||Se.propDep}on(q,ne,G),vn(q,ne,G.state,function(Se){return!ue(Se)}),(!G.profile||!ue(G.profile))&&$t(q,ne,G,!1,"a1"),G.contextDep=le,G.needsContext=he,G.needsFramebuffer=ae;var V=G.shader.progVar;if(V.contextDep&&le||V.propDep)Uo(q,ne,G,null);else{var te=V.append(q,ne);if(ne(q.shared.gl,".useProgram(",te,".program);"),G.shader.program)Uo(q,ne,G,G.shader.program);else{ne(q.shared.vao,".setVAO(null);");var $=q.global.def("{}"),fe=ne.def(te,".id"),de=ne.def($,"[",fe,"]");ne(q.cond(de).then(de,".call(this,a0,a1);").else(de,"=",$,"[",fe,"]=",q.link(function(Se){return Zt(Uo,q,G,Se,2)}),"(",te,");",de,".call(this,a0,a1);"))}}Object.keys(G.state).length>0&&ne(q.shared.current,".dirty=true;")}function be(q,G){var ne=q.proc("scope",3);q.batchId="a2";var le=q.shared,he=le.current;Kr(q,ne,G.context),G.framebuffer&&G.framebuffer.append(q,ne),_x(Object.keys(G.state)).forEach(function(ae){var ue=G.state[ae],V=ue.append(q,ne);zr(V)?V.forEach(function(te,$){ne.set(q.next[ae],"["+$+"]",te)}):ne.set(le.next,"."+ae,V)}),$t(q,ne,G,!0,!0),[Fo,Lc,zo,Nc,Go].forEach(function(ae){var ue=G.draw[ae];ue&&ne.set(le.draw,"."+ae,""+ue.append(q,ne))}),Object.keys(G.uniforms).forEach(function(ae){var ue=G.uniforms[ae].append(q,ne);Array.isArray(ue)&&(ue="["+ue.join()+"]"),ne.set(le.uniforms,"["+j.id(ae)+"]",ue)}),Object.keys(G.attributes).forEach(function(ae){var ue=G.attributes[ae].append(q,ne),V=q.scopeAttrib(ae);Object.keys(new ce).forEach(function(te){ne.set(V,"."+te,ue[te])})}),G.scopeVAO&&ne.set(le.vao,".targetVAO",G.scopeVAO.append(q,ne));function oe(ae){var ue=G.shader[ae];ue&&ne.set(le.shader,"."+ae,ue.append(q,ne))}oe(gf),oe(yf),Object.keys(G.state).length>0&&(ne(he,".dirty=true;"),ne.exit(he,".dirty=true;")),ne("a1(",q.shared.context,",a0,",q.batchId,");")}function pe(q){if(!(typeof q!="object"||zr(q))){for(var G=Object.keys(q),ne=0;ne<G.length;++ne)if(Ct.isDynamic(q[G[ne]]))return!0;return!1}}function rt(q,G,ne){var le=G.static[ne];if(!le||!pe(le))return;var he=q.global,oe=Object.keys(le),ae=!1,ue=!1,V=!1,te=q.global.def("{}");oe.forEach(function(fe){var de=le[fe];if(Ct.isDynamic(de)){typeof de=="function"&&(de=le[fe]=Ct.unbox(de));var Se=Pn(de,null);ae=ae||Se.thisDep,V=V||Se.propDep,ue=ue||Se.contextDep}else{switch(he(te,".",fe,"="),typeof de){case"number":he(de);break;case"string":he('"',de,'"');break;case"object":Array.isArray(de)&&he("[",de.join(),"]");break;default:he(q.link(de));break}he(";")}});function $(fe,de){oe.forEach(function(Se){var Ce=le[Se];if(Ct.isDynamic(Ce)){var Ee=fe.invoke(de,Ce);de(te,".",Se,"=",Ee,";")}})}G.dynamic[ne]=new Ct.DynamicVariable(Ic,{thisDep:ae,contextDep:ue,propDep:V,ref:te,append:$}),delete G.static[ne]}function Vt(q,G,ne,le,he){var oe=Tt();oe.stats=oe.link(he),Object.keys(G.static).forEach(function(ue){rt(oe,G,ue)}),RR.forEach(function(ue){rt(oe,q,ue)});var ae=Wr(q,G,ne,le,oe);return Ur(oe,ae),be(oe,ae),H(oe,ae),n(oe.compile(),{destroy:function(){ae.shader.program.destroy()}})}return{next:tt,current:ke,procs:function(){var q=Tt(),G=q.proc("poll"),ne=q.proc("refresh"),le=q.block();G(le),ne(le);var he=q.shared,oe=he.gl,ae=he.next,ue=he.current;le(ue,".dirty=false;"),Qr(q,G),Qr(q,ne,null,!0);var V;ze&&(V=q.link(ze)),Q.oes_vertex_array_object&&ne(q.link(Q.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var te=0;te<ye.maxAttributes;++te){var $=ne.def(he.attributes,"[",te,"]"),fe=q.cond($,".buffer");fe.then(oe,".enableVertexAttribArray(",te,");",oe,".bindBuffer(",ou,",",$,".buffer.buffer);",oe,".vertexAttribPointer(",te,",",$,".size,",$,".type,",$,".normalized,",$,".stride,",$,".offset);").else(oe,".disableVertexAttribArray(",te,");",oe,".vertexAttrib4f(",te,",",$,".x,",$,".y,",$,".z,",$,".w);",$,".buffer=null;"),ne(fe),ze&&ne(V,".vertexAttribDivisorANGLE(",te,",",$,".divisor);")}return ne(q.shared.vao,".currentVAO=null;",q.shared.vao,".setVAO(",q.shared.vao,".targetVAO);"),Object.keys(We).forEach(function(de){var Se=We[de],Ce=le.def(ae,".",de),Ee=q.block();Ee("if(",Ce,"){",oe,".enable(",Se,")}else{",oe,".disable(",Se,")}",ue,".",de,"=",Ce,";"),ne(Ee),G("if(",Ce,"!==",ue,".",de,"){",Ee,"}")}),Object.keys(Le).forEach(function(de){var Se=Le[de],Ce=ke[de],Ee,Ge,ft=q.block();if(ft(oe,".",Se,"("),zr(Ce)){var Xt=Ce.length;Ee=q.global.def(ae,".",de),Ge=q.global.def(ue,".",de),ft(Ht(Xt,function(at){return Ee+"["+at+"]"}),");",Ht(Xt,function(at){return Ge+"["+at+"]="+Ee+"["+at+"];"}).join("")),G("if(",Ht(Xt,function(at){return Ee+"["+at+"]!=="+Ge+"["+at+"]"}).join("||"),"){",ft,"}")}else Ee=le.def(ae,".",de),Ge=le.def(ue,".",de),ft(Ee,");",ue,".",de,"=",Ee,";"),G("if(",Ee,"!==",Ge,"){",ft,"}");ne(ft)}),q.compile()}(),compile:Vt}}function r3(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var n3=34918,i3=34919,Mx=35007,a3=function(k,j){if(!j.ext_disjoint_timer_query)return null;var Q=[];function ye(){return Q.pop()||j.ext_disjoint_timer_query.createQueryEXT()}function Me(ze){Q.push(ze)}var ge=[];function xe(ze){var Qe=ye();j.ext_disjoint_timer_query.beginQueryEXT(Mx,Qe),ge.push(Qe),De(ge.length-1,ge.length,ze)}function Oe(){j.ext_disjoint_timer_query.endQueryEXT(Mx)}function Re(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var je=[];function Be(){return je.pop()||new Re}function $e(ze){je.push(ze)}var He=[];function De(ze,Qe,ke){var tt=Be();tt.startQueryIndex=ze,tt.endQueryIndex=Qe,tt.sum=0,tt.stats=ke,He.push(tt)}var Xe=[],ce=[];function we(){var ze,Qe,ke=ge.length;if(ke!==0){ce.length=Math.max(ce.length,ke+1),Xe.length=Math.max(Xe.length,ke+1),Xe[0]=0,ce[0]=0;var tt=0;for(ze=0,Qe=0;Qe<ge.length;++Qe){var Ne=ge[Qe];j.ext_disjoint_timer_query.getQueryObjectEXT(Ne,i3)?(tt+=j.ext_disjoint_timer_query.getQueryObjectEXT(Ne,n3),Me(Ne)):ge[ze++]=Ne,Xe[Qe+1]=tt,ce[Qe+1]=ze}for(ge.length=ze,ze=0,Qe=0;Qe<He.length;++Qe){var We=He[Qe],Le=We.startQueryIndex,qe=We.endQueryIndex;We.sum+=Xe[qe]-Xe[Le];var yt=ce[Le],Dt=ce[qe];Dt===yt?(We.stats.gpuTime+=We.sum/1e6,$e(We)):(We.startQueryIndex=yt,We.endQueryIndex=Dt,He[ze++]=We)}He.length=ze}}return{beginQuery:xe,endQuery:Oe,pushScopeStats:De,update:we,getNumPendingQueries:function(){return ge.length},clear:function(){Q.push.apply(Q,ge);for(var ze=0;ze<Q.length;ze++)j.ext_disjoint_timer_query.deleteQueryEXT(Q[ze]);ge.length=0,Q.length=0},restore:function(){ge.length=0,Q.length=0}}},o3=16384,s3=256,u3=1024,f3=34962,Cx="webglcontextlost",Ax="webglcontextrestored",Tx=1,l3=2,c3=3;function Ix(k,j){for(var Q=0;Q<k.length;++Q)if(k[Q]===j)return Q;return-1}function h3(k){var j=It(k);if(!j)return null;var Q=j.gl,ye=Q.getContextAttributes(),Me=Q.isContextLost(),ge=wr(Q,j);if(!ge)return null;var xe=yr(),Oe=r3(),Re=ge.extensions,je=a3(Q,Re),Be=Sr(),$e=Q.drawingBufferWidth,He=Q.drawingBufferHeight,De={tick:0,time:0,viewportWidth:$e,viewportHeight:He,framebufferWidth:$e,framebufferHeight:He,drawingBufferWidth:$e,drawingBufferHeight:He,pixelRatio:j.pixelRatio},Xe={},ce={elements:null,primitive:4,count:-1,offset:0,instances:-1},we=KD(Q,Re),ze=dP(Q,Oe,j,ke),Qe=MR(Q,Re,we,Oe,ze);function ke(Et){return Qe.destroyBuffer(Et)}var tt=MP(Q,Re,ze,Oe),Ne=IR(Q,xe,Oe,j),We=rR(Q,Re,we,function(){yt.procs.poll()},De,Oe,j),Le=nR(Q,Re,we,Oe,j),qe=_R(Q,Re,we,We,Le,Oe),yt=t3(Q,xe,Re,we,ze,tt,We,qe,Xe,Qe,Ne,ce,De,je,j),Dt=NR(Q,qe,yt.procs.poll,De,ye,Re,we),Ze=yt.next,Ue=Q.canvas,Ie=[],Tt=[],Ut=[],it=[j.onDestroy],qt=null;function Pt(){if(Ie.length===0){je&&je.update(),qt=null;return}qt=Bt.next(Pt),vn();for(var Et=Ie.length-1;Et>=0;--Et){var Zt=Ie[Et];Zt&&Zt(De,null,0)}Q.flush(),je&&je.update()}function Wt(){!qt&&Ie.length>0&&(qt=Bt.next(Pt))}function lr(){qt&&(Bt.cancel(Pt),qt=null)}function Yr(Et){Et.preventDefault(),Me=!0,lr(),Tt.forEach(function(Zt){Zt()})}function nn(Et){Q.getError(),Me=!1,ge.restore(),Ne.restore(),ze.restore(),We.restore(),Le.restore(),qe.restore(),Qe.restore(),je&&je.restore(),yt.procs.refresh(),Wt(),Ut.forEach(function(Zt){Zt()})}Ue&&(Ue.addEventListener(Cx,Yr,!1),Ue.addEventListener(Ax,nn,!1));function Kt(){Ie.length=0,lr(),Ue&&(Ue.removeEventListener(Cx,Yr),Ue.removeEventListener(Ax,nn)),Ne.clear(),qe.clear(),Le.clear(),We.clear(),tt.clear(),ze.clear(),Qe.clear(),je&&je.clear(),it.forEach(function(Et){Et()})}function Zr(Et){F(!!Et,"invalid args to regl({...})"),F.type(Et,"object","invalid args to regl({...})");function Zt(he){var oe=n({},he);delete oe.uniforms,delete oe.attributes,delete oe.context,delete oe.vao,"stencil"in oe&&oe.stencil.op&&(oe.stencil.opBack=oe.stencil.opFront=oe.stencil.op,delete oe.stencil.op);function ae(ue){if(ue in oe){var V=oe[ue];delete oe[ue],Object.keys(V).forEach(function(te){oe[ue+"."+te]=V[te]})}}return ae("blend"),ae("depth"),ae("cull"),ae("stencil"),ae("polygonOffset"),ae("scissor"),ae("sample"),"vao"in he&&(oe.vao=he.vao),oe}function ar(he,oe){var ae={},ue={};return Object.keys(he).forEach(function(V){var te=he[V];if(Ct.isDynamic(te)){ue[V]=Ct.unbox(te,V);return}else if(oe&&Array.isArray(te)){for(var $=0;$<te.length;++$)if(Ct.isDynamic(te[$])){ue[V]=Ct.unbox(te,V);return}}ae[V]=te}),{dynamic:ue,static:ae}}var Ur=ar(Et.context||{},!0),qi=ar(Et.uniforms||{},!0),Uo=ar(Et.attributes||{},!1),H=ar(Zt(Et),!1),be={gpuTime:0,cpuTime:0,count:0},pe=yt.compile(H,Uo,qi,Ur,be),rt=pe.draw,Vt=pe.batch,q=pe.scope,G=[];function ne(he){for(;G.length<he;)G.push(null);return G}function le(he,oe){var ae;if(Me&&F.raise("context lost"),typeof he=="function")return q.call(this,null,he,0);if(typeof oe=="function")if(typeof he=="number")for(ae=0;ae<he;++ae)q.call(this,null,oe,ae);else if(Array.isArray(he))for(ae=0;ae<he.length;++ae)q.call(this,he[ae],oe,ae);else return q.call(this,he,oe,0);else if(typeof he=="number"){if(he>0)return Vt.call(this,ne(he|0),he|0)}else if(Array.isArray(he)){if(he.length)return Vt.call(this,he,he.length)}else return rt.call(this,he)}return n(le,{stats:be,destroy:function(){pe.destroy()}})}var Ar=qe.setFBO=Zr({framebuffer:Ct.define.call(null,Tx,"framebuffer")});function Wr(Et,Zt){var ar=0;yt.procs.poll();var Ur=Zt.color;Ur&&(Q.clearColor(+Ur[0]||0,+Ur[1]||0,+Ur[2]||0,+Ur[3]||0),ar|=o3),"depth"in Zt&&(Q.clearDepth(+Zt.depth),ar|=s3),"stencil"in Zt&&(Q.clearStencil(Zt.stencil|0),ar|=u3),F(!!ar,"called regl.clear with no buffer specified"),Q.clear(ar)}function Kr(Et){if(F(typeof Et=="object"&&Et,"regl.clear() takes an object as input"),"framebuffer"in Et)if(Et.framebuffer&&Et.framebuffer_reglType==="framebufferCube")for(var Zt=0;Zt<6;++Zt)Ar(n({framebuffer:Et.framebuffer.faces[Zt]},Et),Wr);else Ar(Et,Wr);else Wr(null,Et)}function Qr(Et){F.type(Et,"function","regl.frame() callback must be a function"),Ie.push(Et);function Zt(){var ar=Ix(Ie,Et);F(ar>=0,"cannot cancel a frame twice");function Ur(){var qi=Ix(Ie,Ur);Ie[qi]=Ie[Ie.length-1],Ie.length-=1,Ie.length<=0&&lr()}Ie[ar]=Ur}return Wt(),{cancel:Zt}}function on(){var Et=Ze.viewport,Zt=Ze.scissor_box;Et[0]=Et[1]=Zt[0]=Zt[1]=0,De.viewportWidth=De.framebufferWidth=De.drawingBufferWidth=Et[2]=Zt[2]=Q.drawingBufferWidth,De.viewportHeight=De.framebufferHeight=De.drawingBufferHeight=Et[3]=Zt[3]=Q.drawingBufferHeight}function vn(){De.tick+=1,De.time=$t(),on(),yt.procs.poll()}function jr(){We.refresh(),on(),yt.procs.refresh(),je&&je.update()}function $t(){return(Sr()-Be)/1e3}jr();function pn(Et,Zt){F.type(Zt,"function","listener callback must be a function");var ar;switch(Et){case"frame":return Qr(Zt);case"lost":ar=Tt;break;case"restore":ar=Ut;break;case"destroy":ar=it;break;default:F.raise("invalid event, must be one of frame,lost,restore,destroy")}return ar.push(Zt),{cancel:function(){for(var Ur=0;Ur<ar.length;++Ur)if(ar[Ur]===Zt){ar[Ur]=ar[ar.length-1],ar.pop();return}}}}var gr=n(Zr,{clear:Kr,prop:Ct.define.bind(null,Tx),context:Ct.define.bind(null,l3),this:Ct.define.bind(null,c3),draw:Zr({}),buffer:function(Et){return ze.create(Et,f3,!1,!1)},elements:function(Et){return tt.create(Et,!1)},texture:We.create2D,cube:We.createCube,renderbuffer:Le.create,framebuffer:qe.create,framebufferCube:qe.createCube,vao:Qe.createVAO,attributes:ye,frame:Qr,on:pn,limits:we,hasExtension:function(Et){return we.extensions.indexOf(Et.toLowerCase())>=0},read:Dt,destroy:Kt,_gl:Q,_refresh:jr,poll:function(){vn(),je&&je.update()},now:$t,stats:Oe});return j.onDone(null,gr),gr}return h3})}(Ed)),Ed.exports}var ite=nte();const ate=va(ite);var ote=function(){function r(e,t){$i(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 Xi(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}(),ka,Qf,La,ii,Jf,uo,el,zh,Qi,us,_n,Ji,ea,jh,ste=(ka={},et(ka,Pe.POINTS,"points"),et(ka,Pe.LINES,"lines"),et(ka,Pe.LINE_LOOP,"line loop"),et(ka,Pe.LINE_STRIP,"line strip"),et(ka,Pe.TRIANGLES,"triangles"),et(ka,Pe.TRIANGLE_FAN,"triangle fan"),et(ka,Pe.TRIANGLE_STRIP,"triangle strip"),ka),eD=(Qf={},et(Qf,Pe.STATIC_DRAW,"static"),et(Qf,Pe.DYNAMIC_DRAW,"dynamic"),et(Qf,Pe.STREAM_DRAW,"stream"),Qf),P1=(La={},et(La,Pe.BYTE,"int8"),et(La,Pe.UNSIGNED_INT,"int16"),et(La,Pe.INT,"int32"),et(La,Pe.UNSIGNED_BYTE,"uint8"),et(La,Pe.UNSIGNED_SHORT,"uint16"),et(La,Pe.UNSIGNED_INT,"uint32"),et(La,Pe.FLOAT,"float"),La),ute=(ii={},et(ii,Pe.ALPHA,"alpha"),et(ii,Pe.LUMINANCE,"luminance"),et(ii,Pe.LUMINANCE_ALPHA,"luminance alpha"),et(ii,Pe.RGB,"rgb"),et(ii,Pe.RGBA,"rgba"),et(ii,Pe.RGBA4,"rgba4"),et(ii,Pe.RGB5_A1,"rgb5 a1"),et(ii,Pe.RGB565,"rgb565"),et(ii,Pe.DEPTH_COMPONENT,"depth"),et(ii,Pe.DEPTH_STENCIL,"depth stencil"),ii),fte=(Jf={},et(Jf,Pe.DONT_CARE,"dont care"),et(Jf,Pe.NICEST,"nice"),et(Jf,Pe.FASTEST,"fast"),Jf),cM=(uo={},et(uo,Pe.NEAREST,"nearest"),et(uo,Pe.LINEAR,"linear"),et(uo,Pe.LINEAR_MIPMAP_LINEAR,"mipmap"),et(uo,Pe.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),et(uo,Pe.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),et(uo,Pe.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),uo),hM=(el={},et(el,Pe.REPEAT,"repeat"),et(el,Pe.CLAMP_TO_EDGE,"clamp"),et(el,Pe.MIRRORED_REPEAT,"mirror"),el),lte=(zh={},et(zh,Pe.NONE,"none"),et(zh,Pe.BROWSER_DEFAULT_WEBGL,"browser"),zh),cte=(Qi={},et(Qi,Pe.NEVER,"never"),et(Qi,Pe.ALWAYS,"always"),et(Qi,Pe.LESS,"less"),et(Qi,Pe.LEQUAL,"lequal"),et(Qi,Pe.GREATER,"greater"),et(Qi,Pe.GEQUAL,"gequal"),et(Qi,Pe.EQUAL,"equal"),et(Qi,Pe.NOTEQUAL,"notequal"),Qi),dM=(us={},et(us,Pe.FUNC_ADD,"add"),et(us,Pe.MIN_EXT,"min"),et(us,Pe.MAX_EXT,"max"),et(us,Pe.FUNC_SUBTRACT,"subtract"),et(us,Pe.FUNC_REVERSE_SUBTRACT,"reverse subtract"),us),Uh=(_n={},et(_n,Pe.ZERO,"zero"),et(_n,Pe.ONE,"one"),et(_n,Pe.SRC_COLOR,"src color"),et(_n,Pe.ONE_MINUS_SRC_COLOR,"one minus src color"),et(_n,Pe.SRC_ALPHA,"src alpha"),et(_n,Pe.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),et(_n,Pe.DST_COLOR,"dst color"),et(_n,Pe.ONE_MINUS_DST_COLOR,"one minus dst color"),et(_n,Pe.DST_ALPHA,"dst alpha"),et(_n,Pe.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),et(_n,Pe.CONSTANT_COLOR,"constant color"),et(_n,Pe.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),et(_n,Pe.CONSTANT_ALPHA,"constant alpha"),et(_n,Pe.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),et(_n,Pe.SRC_ALPHA_SATURATE,"src alpha saturate"),_n),hte=(Ji={},et(Ji,Pe.NEVER,"never"),et(Ji,Pe.ALWAYS,"always"),et(Ji,Pe.LESS,"less"),et(Ji,Pe.LEQUAL,"lequal"),et(Ji,Pe.GREATER,"greater"),et(Ji,Pe.GEQUAL,"gequal"),et(Ji,Pe.EQUAL,"equal"),et(Ji,Pe.NOTEQUAL,"notequal"),Ji),mu=(ea={},et(ea,Pe.ZERO,"zero"),et(ea,Pe.KEEP,"keep"),et(ea,Pe.REPLACE,"replace"),et(ea,Pe.INVERT,"invert"),et(ea,Pe.INCR,"increment"),et(ea,Pe.DECR,"decrement"),et(ea,Pe.INCR_WRAP,"increment wrap"),et(ea,Pe.DECR_WRAP,"decrement wrap"),ea),dte=(jh={},et(jh,Pe.FRONT,"front"),et(jh,Pe.BACK,"back"),jh),vte=function(){function r(e,t){$i(this,r),this.buffer=void 0;var n=t.data,i=t.usage,a=t.type;this.buffer=e.buffer({data:n,usage:eD[i||Pe.STATIC_DRAW],type:P1[a||Pe.UNSIGNED_BYTE]})}return Xi(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 Wy(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 pte(r){if(Array.isArray(r))return Wy(r)}function gte(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function yte(r,e){if(r){if(typeof r=="string")return Wy(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)?Wy(r,e):void 0}}function mte(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
48
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bte(r){return pte(r)||gte(r)||yte(r)||mte()}function vM(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 pM(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vM(Object(t),!0).forEach(function(n){et(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var xte=`attribute vec3 a_Position;
|
|
49
|
+
attribute vec2 a_TexCoord;
|
|
50
|
+
|
|
51
|
+
varying vec2 v_TexCoord;
|
|
52
|
+
|
|
53
|
+
void main() {
|
|
54
|
+
gl_Position = vec4(a_Position, 1.0);
|
|
55
|
+
v_TexCoord = a_TexCoord;
|
|
56
|
+
}`,gM=0,wte=function(){function r(e,t){var n=this;$i(this,r),this.reGl=e,this.context=t,this.entity=QO(),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===Ju.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===Ju.Uniform){if(h&&(Array.isArray(h)||sv(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
|
|
57
|
+
precision highp float;
|
|
58
|
+
#else
|
|
59
|
+
precision mediump float;
|
|
60
|
+
#endif
|
|
61
|
+
`.concat(this.context.shader),uniforms:i,vert:xte,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return Xi(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=wo(Mn.mark(function n(){var i=this,a,o,s,u,f,l,c,h;return Mn.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 pM(pM({},t),{},{id:gM++,texture:this.reGl.texture({width:i,height:i,data:n,type:"float"})})}},{key:"calcDataTexture",value:function(t,n,i){var a=1;n===Wl.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,bte(new Array((c-f)*4).fill(0)));var h=this.reGl.texture({width:l,height:l,data:o,type:"float"});return{id:gM++,data:o,originalDataLength:u,typedArrayConstructor:sv(i)?i.constructor:void 0,textureWidth:l,texture:h,texelCount:f,elementsPerTexel:a,isOutput:t===this.context.output.name}}}]),r}(),Ete=function(){function r(e,t){$i(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:eD[i||Pe.STATIC_DRAW],type:P1[a||Pe.UNSIGNED_BYTE],count:o})}return Xi(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}(),_te=function(){function r(e,t){$i(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 Xi(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}(),c0,yM;function Ste(){if(yM)return c0;yM=1;function r(e,t){return function(n){return e(t(n))}}return c0=r,c0}var h0,mM;function Mte(){if(mM)return h0;mM=1;var r=Ste(),e=r(Object.getPrototypeOf,Object);return h0=e,h0}var d0,bM;function Cte(){if(bM)return d0;bM=1;var r=O1(),e=Mte(),t=D1(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,u=o.call(Object);function f(l){if(!t(l)||r(l)!=n)return!1;var c=e(l);if(c===null)return!0;var h=s.call(c,"constructor")&&c.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==u}return d0=f,d0}var Ate=Cte();const Tte=va(Ate);function v0(r){var e={};return Object.keys(r).forEach(function(t){qy(t,r[t],e,"")}),e}function qy(r,e,t,n){if(e===null||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)&&typeof e[0]=="number"||sv(e)||e===""||e.resize!==void 0){t["".concat(n&&n+".").concat(r)]=e;return}Tte(e)&&Object.keys(e).forEach(function(i){qy(i,e[i],t,"".concat(n&&n+".").concat(r))}),Array.isArray(e)&&e.forEach(function(i,a){Object.keys(i).forEach(function(o){qy(o,i[o],t,"".concat(n&&n+".").concat(r,"[").concat(a,"]"))})})}function xM(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 bu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xM(Object(t),!0).forEach(function(n){et(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Ite=function(){function r(e,t){$i(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=v0(s),Object.keys(s).forEach(function(E){m[E]=e.prop(E)}));var x={};Object.keys(o).forEach(function(E){x[E]=o[E].get()});var b=a&&this.generateDefines(a)||"",w={attributes:x,frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
62
|
+
precision highp float;
|
|
63
|
+
#else
|
|
64
|
+
precision mediump float;
|
|
65
|
+
#endif
|
|
66
|
+
`.concat(b,`
|
|
67
|
+
`).concat(i),uniforms:m,vert:`
|
|
68
|
+
`.concat(b,`
|
|
69
|
+
`).concat(n),primitive:ste[u===void 0?Pe.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 Xi(r,[{key:"addUniforms",value:function(t){this.uniforms=bu(bu({},this.uniforms),v0(t))}},{key:"draw",value:function(t){var n=bu(bu({},this.uniforms),v0(t.uniforms||{})),i={};Object.keys(n).forEach(function(a){var o=Qu(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:cte[i.func||Pe.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:Uh[o&&o.srcRGB||Pe.SRC_ALPHA],srcAlpha:Uh[o&&o.srcAlpha||Pe.SRC_ALPHA],dstRGB:Uh[o&&o.dstRGB||Pe.ONE_MINUS_SRC_ALPHA],dstAlpha:Uh[o&&o.dstAlpha||Pe.ONE_MINUS_SRC_ALPHA]},equation:{rgb:dM[s&&s.rgb||Pe.FUNC_ADD],alpha:dM[s&&s.alpha||Pe.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:Pe.ALWAYS,ref:0,mask:-1}:u,l=i.opFront,c=l===void 0?{fail:Pe.KEEP,zfail:Pe.KEEP,zpass:Pe.KEEP}:l,h=i.opBack,d=h===void 0?{fail:Pe.KEEP,zfail:Pe.KEEP,zpass:Pe.KEEP}:h;n.stencil={enable:!!a,mask:s,func:bu(bu({},f),{},{cmp:hte[f.cmp]}),opFront:{fail:mu[c.fail],zfail:mu[c.zfail],zpass:mu[c.zpass]},opBack:{fail:mu[d.fail],zfail:mu[d.zfail],zpass:mu[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?Pe.BACK:o;n.cull={enable:!!a,face:dte[s]}}}},{key:"generateDefines",value:function(t){return Object.keys(t).map(function(n){return"#define ".concat(n," ").concat(Number(t[n]))}).join(`
|
|
70
|
+
`)}}]),r}(),kte=function(){function r(e,t){$i(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?Pe.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?Pe.RGBA:l,h=t.mipmap,d=h===void 0?!1:h,v=t.wrapS,p=v===void 0?Pe.CLAMP_TO_EDGE:v,g=t.wrapT,y=g===void 0?Pe.CLAMP_TO_EDGE:g,m=t.aniso,x=m===void 0?0:m,b=t.alignment,w=b===void 0?1:b,E=t.premultiplyAlpha,S=E===void 0?!1:E,_=t.mag,C=_===void 0?Pe.NEAREST:_,M=t.min,A=M===void 0?Pe.NEAREST:M,T=t.colorSpace,I=T===void 0?Pe.BROWSER_DEFAULT_WEBGL:T;this.width=o,this.height=s;var L={width:o,height:s,type:P1[a],format:ute[c],wrapS:hM[p],wrapT:hM[y],mag:cM[C],min:cM[A],alignment:w,flipY:f,colorSpace:lte[I],premultiplyAlpha:S,aniso:x};n&&(L.data=n),typeof d=="number"?L.mipmap=fte[d]:typeof d=="boolean"&&(L.mipmap=d),this.texture=e.texture(L)}return Xi(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}(),Lte=function(){function r(){var e=this;$i(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=wo(Mn.mark(function n(i){return Mn.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=wo(Mn.mark(function u(f){var l;return Mn.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 Ite(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 ote(e.gl,t)},this.createBuffer=function(t){return new vte(e.gl,t)},this.createElements=function(t){return new Ete(e.gl,t)},this.createTexture2D=function(t){return new kte(e.gl,t)},this.createFramebuffer=function(t){return new _te(e.gl,t)},this.useFramebuffer=function(t,n){e.gl({framebuffer:t?t.get():null})(n)},this.createComputeModel=function(){var t=wo(Mn.mark(function n(i){return Mn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new wte(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(Pe.SCISSOR_TEST),e.gl._gl.scissor(t.box.x,t.box.y,t.box.width,t.box.height)):e.gl._gl.disable(Pe.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 Xi(r,[{key:"init",value:function(){var e=wo(Mn.mark(function n(i){return Mn.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){ate({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}(),Nte=function(){function r(){$i(this,r),this.engine=void 0,this.configService=new Jee}return Xi(r,[{key:"setConfig",value:function(t){this.configService.set(t)}},{key:"setEngine",value:function(t){this.engine=t}},{key:"createEntity",value:function(){return QO()}},{key:"createKernel",value:function(t){var n=new JO(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 Lte),n}}]),r}();const Ote=Object.freeze(Object.defineProperty({__proto__:null,Kernel:JO,World:Nte},Symbol.toStringTag,{value:"Module"})),tD=da(Ote);var Wn={},wM;function rD(){if(wM)return Wn;wM=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.arrayToTextureData=Wn.attributesToTextureData=Wn.buildTextureDataWithTwoEdgeAttr=Wn.buildTextureData=Wn.proccessToFunc=void 0;var r=$r(),e=o1(),t=function(s,u){var f;return s?(0,r.isNumber)(s)?f=function(){return s}:f=s:f=function(){return u||1},f};Wn.proccessToFunc=t;var n=function(s,u){var f=[],l=[],c={},h=0;for(h=0;h<s.length;h++){var d=s[h];c[d.id]=h,f.push(d.x),f.push(d.y),f.push(0),f.push(0),l.push([])}for(h=0;h<u.length;h++){var v=u[h],p=(0,e.getEdgeTerminal)(v,"source"),g=(0,e.getEdgeTerminal)(v,"target");!isNaN(c[p])&&!isNaN(c[g])&&(l[c[p]].push(c[g]),l[c[g]].push(c[p]))}var y=0;for(h=0;h<s.length;h++){var m=f.length,x=l[h],b=x.length;f[h*4+2]=m,f[h*4+3]=b,y=Math.max(y,b);for(var w=0;w<b;++w){var E=x[w];f.push(+E)}}for(;f.length%4!==0;)f.push(0);return{maxEdgePerVetex:y,array:new Float32Array(f)}};Wn.buildTextureData=n;var i=function(s,u,f,l){var c=[],h=[],d={},v=0;for(v=0;v<s.length;v++){var p=s[v];d[p.id]=v,c.push(p.x),c.push(p.y),c.push(0),c.push(0),h.push([])}for(v=0;v<u.length;v++){var g=u[v],y=(0,e.getEdgeTerminal)(g,"source"),m=(0,e.getEdgeTerminal)(g,"target");h[d[y]].push(d[m]),h[d[y]].push(f(g)),h[d[y]].push(l(g)),h[d[y]].push(0),h[d[m]].push(d[y]),h[d[m]].push(f(g)),h[d[m]].push(l(g)),h[d[m]].push(0)}var x=0;for(v=0;v<s.length;v++){var b=c.length,w=h[v],E=w.length;c[v*4+2]=b+1048576*E/4,c[v*4+3]=0,x=Math.max(x,E/4);for(var S=0;S<E;++S){var _=w[S];c.push(+_)}}for(;c.length%4!==0;)c.push(0);return{maxEdgePerVetex:x,array:new Float32Array(c)}};Wn.buildTextureDataWithTwoEdgeAttr=i;var a=function(s,u){var f=[],l=s.length,c={};return u.forEach(function(h){s.forEach(function(d,v){if(c[h[d]]===void 0&&(c[h[d]]=Object.keys(c).length),f.push(c[h[d]]),v===l-1)for(;f.length%4!==0;)f.push(0)})}),{array:new Float32Array(f),count:Object.keys(c).length}};Wn.attributesToTextureData=a;var o=function(s){for(var u=[],f=s.length,l=s[0].length,c=function(d){s.forEach(function(v,p){if(u.push(v[d]),p===f-1)for(;u.length%4!==0;)u.push(0)})},h=0;h<l;h++)c(h);return new Float32Array(u)};return Wn.arrayToTextureData=o,Wn}var Ti={},EM;function Dte(){return EM||(EM=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.clusterBundle=Ti.clusterCode=Ti.fruchtermanBundle=Ti.fruchtermanCode=void 0,Ti.fruchtermanCode=`
|
|
71
|
+
import { globalInvocationID } from 'g-webgpu';
|
|
72
|
+
const MAX_EDGE_PER_VERTEX;
|
|
73
|
+
const VERTEX_COUNT;
|
|
74
|
+
@numthreads(1, 1, 1)
|
|
75
|
+
class Fruchterman {
|
|
76
|
+
@in @out
|
|
77
|
+
u_Data: vec4[];
|
|
78
|
+
@in
|
|
79
|
+
u_K: float;
|
|
80
|
+
@in
|
|
81
|
+
u_K2: float;
|
|
82
|
+
|
|
83
|
+
@in
|
|
84
|
+
u_Center: vec2;
|
|
85
|
+
@in
|
|
86
|
+
u_Gravity: float;
|
|
87
|
+
@in
|
|
88
|
+
u_ClusterGravity: float;
|
|
89
|
+
@in
|
|
90
|
+
u_Speed: float;
|
|
91
|
+
@in
|
|
92
|
+
u_MaxDisplace: float;
|
|
93
|
+
@in
|
|
94
|
+
u_Clustering: float;
|
|
95
|
+
@in
|
|
96
|
+
u_AttributeArray: vec4[];
|
|
97
|
+
@in
|
|
98
|
+
u_ClusterCenters: vec4[];
|
|
99
|
+
calcRepulsive(i: int, currentNode: vec4): vec2 {
|
|
100
|
+
let dx = 0, dy = 0;
|
|
101
|
+
for (let j = 0; j < VERTEX_COUNT; j++) {
|
|
102
|
+
if (i != j) {
|
|
103
|
+
const nextNode = this.u_Data[j];
|
|
104
|
+
const xDist = currentNode[0] - nextNode[0];
|
|
105
|
+
const yDist = currentNode[1] - nextNode[1];
|
|
106
|
+
const dist = (xDist * xDist + yDist * yDist) + 0.01;
|
|
107
|
+
let param = this.u_K2 / dist;
|
|
108
|
+
|
|
109
|
+
if (dist > 0.0) {
|
|
110
|
+
dx += param * xDist;
|
|
111
|
+
dy += param * yDist;
|
|
112
|
+
if (xDist == 0 && yDist == 0) {
|
|
113
|
+
const sign = i < j ? 1 : -1;
|
|
114
|
+
dx += param * sign;
|
|
115
|
+
dy += param * sign;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return [dx, dy];
|
|
121
|
+
}
|
|
122
|
+
calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { //
|
|
123
|
+
let dx = 0, dy = 0;
|
|
124
|
+
const vx = currentNode[0] - this.u_Center[0];
|
|
125
|
+
const vy = currentNode[1] - this.u_Center[1];
|
|
126
|
+
const gf = 0.01 * this.u_K * this.u_Gravity;
|
|
127
|
+
dx = gf * vx;
|
|
128
|
+
dy = gf * vy;
|
|
129
|
+
if (this.u_Clustering == 1) {
|
|
130
|
+
const clusterIdx = int(nodeAttributes[0]);
|
|
131
|
+
const center = this.u_ClusterCenters[clusterIdx];
|
|
132
|
+
const cvx = currentNode[0] - center[0];
|
|
133
|
+
const cvy = currentNode[1] - center[1];
|
|
134
|
+
const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;
|
|
135
|
+
const parma = this.u_K * this.u_ClusterGravity / dist;
|
|
136
|
+
dx += parma * cvx;
|
|
137
|
+
dy += parma * cvy;
|
|
138
|
+
}
|
|
139
|
+
return [dx, dy];
|
|
140
|
+
}
|
|
141
|
+
calcAttractive(i: int, currentNode: vec4): vec2 {
|
|
142
|
+
let dx = 0, dy = 0;
|
|
143
|
+
const arr_offset = int(floor(currentNode[2] + 0.5));
|
|
144
|
+
const length = int(floor(currentNode[3] + 0.5));
|
|
145
|
+
const node_buffer: vec4;
|
|
146
|
+
for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {
|
|
147
|
+
if (p >= length) break;
|
|
148
|
+
const arr_idx = arr_offset + p;
|
|
149
|
+
// when arr_idx % 4 == 0 update currentNodedx_buffer
|
|
150
|
+
const buf_offset = arr_idx - arr_idx / 4 * 4;
|
|
151
|
+
if (p == 0 || buf_offset == 0) {
|
|
152
|
+
node_buffer = this.u_Data[int(arr_idx / 4)];
|
|
153
|
+
}
|
|
154
|
+
const float_j = buf_offset == 0 ? node_buffer[0] :
|
|
155
|
+
buf_offset == 1 ? node_buffer[1] :
|
|
156
|
+
buf_offset == 2 ? node_buffer[2] :
|
|
157
|
+
node_buffer[3];
|
|
158
|
+
const nextNode = this.u_Data[int(float_j)];
|
|
159
|
+
const xDist = currentNode[0] - nextNode[0];
|
|
160
|
+
const yDist = currentNode[1] - nextNode[1];
|
|
161
|
+
const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;
|
|
162
|
+
let attractiveF = dist / this.u_K;
|
|
163
|
+
|
|
164
|
+
if (dist > 0.0) {
|
|
165
|
+
dx -= xDist * attractiveF;
|
|
166
|
+
dy -= yDist * attractiveF;
|
|
167
|
+
if (xDist == 0 && yDist == 0) {
|
|
168
|
+
const sign = i < int(float_j) ? 1 : -1;
|
|
169
|
+
dx -= sign * attractiveF;
|
|
170
|
+
dy -= sign * attractiveF;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return [dx, dy];
|
|
175
|
+
}
|
|
176
|
+
@main
|
|
177
|
+
compute() {
|
|
178
|
+
const i = globalInvocationID.x;
|
|
179
|
+
const currentNode = this.u_Data[i];
|
|
180
|
+
let dx = 0, dy = 0;
|
|
181
|
+
if (i >= VERTEX_COUNT) {
|
|
182
|
+
this.u_Data[i] = currentNode;
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// [gravity, fx, fy, 0]
|
|
187
|
+
const nodeAttributes = this.u_AttributeArray[i];
|
|
188
|
+
|
|
189
|
+
if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {
|
|
190
|
+
// the node is fixed
|
|
191
|
+
this.u_Data[i] = [
|
|
192
|
+
nodeAttributes[1],
|
|
193
|
+
nodeAttributes[2],
|
|
194
|
+
currentNode[2],
|
|
195
|
+
currentNode[3]
|
|
196
|
+
];
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// repulsive
|
|
201
|
+
const repulsive = this.calcRepulsive(i, currentNode);
|
|
202
|
+
dx += repulsive[0];
|
|
203
|
+
dy += repulsive[1];
|
|
204
|
+
// attractive
|
|
205
|
+
const attractive = this.calcAttractive(i, currentNode);
|
|
206
|
+
dx += attractive[0];
|
|
207
|
+
dy += attractive[1];
|
|
208
|
+
// gravity
|
|
209
|
+
const gravity = this.calcGravity(currentNode, nodeAttributes);
|
|
210
|
+
dx -= gravity[0];
|
|
211
|
+
dy -= gravity[1];
|
|
212
|
+
// speed
|
|
213
|
+
dx *= this.u_Speed;
|
|
214
|
+
dy *= this.u_Speed;
|
|
215
|
+
|
|
216
|
+
// move
|
|
217
|
+
const distLength = sqrt(dx * dx + dy * dy);
|
|
218
|
+
if (distLength > 0.0) {
|
|
219
|
+
const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);
|
|
220
|
+
this.u_Data[i] = [
|
|
221
|
+
currentNode[0] + dx / distLength * limitedDist,
|
|
222
|
+
currentNode[1] + dy / distLength * limitedDist,
|
|
223
|
+
currentNode[2],
|
|
224
|
+
currentNode[3]
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
`,Ti.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}}',Ti.clusterCode=`
|
|
230
|
+
import { globalInvocationID } from 'g-webgpu';
|
|
231
|
+
const VERTEX_COUNT;
|
|
232
|
+
const CLUSTER_COUNT;
|
|
233
|
+
@numthreads(1, 1, 1)
|
|
234
|
+
class CalcCenter {
|
|
235
|
+
@in
|
|
236
|
+
u_Data: vec4[];
|
|
237
|
+
@in
|
|
238
|
+
u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]
|
|
239
|
+
@in @out
|
|
240
|
+
u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]
|
|
241
|
+
@main
|
|
242
|
+
compute() {
|
|
243
|
+
const i = globalInvocationID.x;
|
|
244
|
+
const center = this.u_ClusterCenters[i];
|
|
245
|
+
let sumx = 0;
|
|
246
|
+
let sumy = 0;
|
|
247
|
+
let count = 0;
|
|
248
|
+
for (let j = 0; j < VERTEX_COUNT; j++) {
|
|
249
|
+
const attributes = this.u_NodeAttributes[j];
|
|
250
|
+
const clusterIdx = int(attributes[0]);
|
|
251
|
+
const vertex = this.u_Data[j];
|
|
252
|
+
if (clusterIdx == i) {
|
|
253
|
+
sumx += vertex.x;
|
|
254
|
+
sumy += vertex.y;
|
|
255
|
+
count += 1;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
this.u_ClusterCenters[i] = [
|
|
259
|
+
sumx / count,
|
|
260
|
+
sumy / count,
|
|
261
|
+
count,
|
|
262
|
+
i
|
|
263
|
+
];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
`,Ti.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}}'),Ti}var _M;function nD(){if(_M)return Ai;_M=1;var r=Ai&&Ai.__extends||function(){var l=function(c,h){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,v){d.__proto__=v}||function(d,v){for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(d[p]=v[p])},l(c,h)};return function(c,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");l(c,h);function d(){this.constructor=c}c.prototype=h===null?Object.create(h):(d.prototype=h.prototype,new d)}}(),e=Ai&&Ai.__awaiter||function(l,c,h,d){function v(p){return p instanceof h?p:new h(function(g){g(p)})}return new(h||(h=Promise))(function(p,g){function y(b){try{x(d.next(b))}catch(w){g(w)}}function m(b){try{x(d.throw(b))}catch(w){g(w)}}function x(b){b.done?p(b.value):v(b.value).then(y,m)}x((d=d.apply(l,c||[])).next())})},t=Ai&&Ai.__generator||function(l,c){var h={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},d,v,p,g;return g={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function y(x){return function(b){return m([x,b])}}function m(x){if(d)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(h=0)),h;)try{if(d=1,v&&(p=x[0]&2?v.return:x[0]?v.throw||((p=v.return)&&p.call(v),0):v.next)&&!(p=p.call(v,x[1])).done)return p;switch(v=0,p&&(x=[x[0]&2,p.value]),x[0]){case 0:case 1:p=x;break;case 4:return h.label++,{value:x[1],done:!1};case 5:h.label++,v=x[1],x=[0];continue;case 7:x=h.ops.pop(),h.trys.pop();continue;default:if(p=h.trys,!(p=p.length>0&&p[p.length-1])&&(x[0]===6||x[0]===2)){h=0;continue}if(x[0]===3&&(!p||x[1]>p[0]&&x[1]<p[3])){h.label=x[1];break}if(x[0]===6&&h.label<p[1]){h.label=p[1],p=x;break}if(p&&h.label<p[2]){h.label=p[2],h.ops.push(x);break}p[2]&&h.ops.pop(),h.trys.pop();continue}x=c.call(l,h)}catch(b){x=[6,b],v=0}finally{d=p=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}};Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.FruchtermanGPULayout=void 0;var n=ln(),i=$r(),a=tD,o=rD(),s=Dte(),u=Iv(),f=function(l){r(c,l);function c(h){var d=l.call(this)||this;return d.maxIteration=1e3,d.gravity=10,d.speed=1,d.clustering=!1,d.clusterField="cluster",d.clusterGravity=10,d.workerEnabled=!1,d.nodes=[],d.edges=[],d.width=300,d.height=300,d.nodeMap={},d.nodeIdxMap={},d.updateCfg(h),d}return c.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},c.prototype.execute=function(){return e(this,void 0,void 0,function(){var h,d,v,p,g,y=this;return t(this,function(m){switch(m.label){case 0:return h=this,d=h.nodes,!d||d.length===0?(h.onLayoutEnd&&h.onLayoutEnd(),[2]):(!h.width&&typeof window<"u"&&(h.width=window.innerWidth),!h.height&&typeof window<"u"&&(h.height=window.innerHeight),h.center||(h.center=[h.width/2,h.height/2]),v=h.center,d.length===1?(d[0].x=v[0],d[0].y=v[1],h.onLayoutEnd&&h.onLayoutEnd(),[2]):(p={},g={},d.forEach(function(x,b){(0,i.isNumber)(x.x)||(x.x=Math.random()*y.width),(0,i.isNumber)(x.y)||(x.y=Math.random()*y.height),p[x.id]=x,g[x.id]=b}),h.nodeMap=p,h.nodeIdxMap=g,[4,h.run()]));case 1:return m.sent(),[2]}})})},c.prototype.executeWithWorker=function(h,d){return e(this,void 0,void 0,function(){var v,p,g,y,m,x=this;return t(this,function(b){switch(b.label){case 0:return v=this,p=v.nodes,g=v.center,!p||p.length===0?[2]:p.length===1?(p[0].x=g[0],p[0].y=g[1],[2]):(y={},m={},p.forEach(function(w,E){(0,i.isNumber)(w.x)||(w.x=Math.random()*x.width),(0,i.isNumber)(w.y)||(w.y=Math.random()*x.height),y[w.id]=w,m[w.id]=E}),v.nodeMap=y,v.nodeIdxMap=m,[4,v.run(h,d)]);case 1:return b.sent(),[2]}})})},c.prototype.run=function(h,d){return e(this,void 0,void 0,function(){var v,p,g,y,m,x,b,w,E,S,_,C,M,A,T,I,L,N,O,B,W,D,P,R,X,Y,ee=this;return t(this,function(U){switch(U.label){case 0:for(v=this,p=v.nodes,g=v.edges,y=v.maxIteration,m=v.center,x=v.height*v.width,b=Math.sqrt(x)/10,w=x/(p.length+1),E=Math.sqrt(w),S=v.speed,_=v.clustering,C=(0,o.attributesToTextureData)([v.clusterField],p),M=C.array,A=C.count,p.forEach(function(Z,K){var se=0,re=0;(0,i.isNumber)(Z.fx)&&(0,i.isNumber)(Z.fy)&&(se=Z.fx||.001,re=Z.fy||.001),M[4*K+1]=se,M[4*K+2]=re}),T=p.length,I=(0,o.buildTextureData)(p,g),L=I.maxEdgePerVetex,N=I.array,O=v.workerEnabled,O?B=a.World.create({canvas:h,engineOptions:{supportCompute:!0}}):B=a.World.create({engineOptions:{supportCompute:!0}}),W=v.onLayoutEnd,D=[],P=0;P<A;P++)D.push(0,0,0,0);return R=B.createKernel(s.fruchtermanBundle).setDispatch([T,1,1]).setBinding({u_Data:N,u_K:E,u_K2:w,u_Gravity:v.gravity,u_ClusterGravity:v.clusterGravity||v.gravity||1,u_Speed:S,u_MaxDisplace:b,u_Clustering:_?1:0,u_Center:m,u_AttributeArray:M,u_ClusterCenters:D,MAX_EDGE_PER_VERTEX:L,VERTEX_COUNT:T}),_&&(X=B.createKernel(s.clusterBundle).setDispatch([A,1,1]).setBinding({u_Data:N,u_NodeAttributes:M,u_ClusterCenters:D,VERTEX_COUNT:T,CLUSTER_COUNT:A})),Y=function(){return e(ee,void 0,void 0,function(){var Z,K;return t(this,function(se){switch(se.label){case 0:Z=0,se.label=1;case 1:return Z<y?[4,R.execute()]:[3,6];case 2:return se.sent(),_?(X.setBinding({u_Data:R}),[4,X.execute()]):[3,4];case 3:se.sent(),R.setBinding({u_ClusterCenters:X}),se.label=4;case 4:R.setBinding({u_MaxDisplace:b*=.99}),se.label=5;case 5:return Z++,[3,1];case 6:return[4,R.getOutput()];case 7:return K=se.sent(),h?d.postMessage({type:u.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:K}):p.forEach(function(re,J){var me=K[4*J],Ae=K[4*J+1];re.x=me,re.y=Ae}),W&&W(),[2]}})})},[4,Y()];case 1:return U.sent(),[2]}})})},c.prototype.getType=function(){return"fruchterman-gpu"},c}(n.Base);return Ai.FruchtermanGPULayout=f,Ai}var Ii={},ki={},SM;function Pte(){return SM||(SM=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.aveMovementBundle=ki.aveMovementCode=ki.gForceBundle=ki.gForceCode=void 0,ki.gForceCode=`
|
|
267
|
+
import { globalInvocationID } from 'g-webgpu';
|
|
268
|
+
|
|
269
|
+
const MAX_EDGE_PER_VERTEX;
|
|
270
|
+
const VERTEX_COUNT;
|
|
271
|
+
const SHIFT_20 = 1048576;
|
|
272
|
+
|
|
273
|
+
@numthreads(1, 1, 1)
|
|
274
|
+
class GGForce {
|
|
275
|
+
@in @out
|
|
276
|
+
u_Data: vec4[];
|
|
277
|
+
|
|
278
|
+
@in
|
|
279
|
+
u_damping: float;
|
|
280
|
+
|
|
281
|
+
@in
|
|
282
|
+
u_maxSpeed: float;
|
|
283
|
+
|
|
284
|
+
@in
|
|
285
|
+
u_minMovement: float;
|
|
286
|
+
|
|
287
|
+
@in
|
|
288
|
+
u_AveMovement: vec4[];
|
|
289
|
+
|
|
290
|
+
@in
|
|
291
|
+
u_coulombDisScale: float;
|
|
292
|
+
|
|
293
|
+
@in
|
|
294
|
+
u_factor: float;
|
|
295
|
+
|
|
296
|
+
@in
|
|
297
|
+
u_NodeAttributeArray1: vec4[];
|
|
298
|
+
|
|
299
|
+
@in
|
|
300
|
+
u_NodeAttributeArray2: vec4[];
|
|
301
|
+
|
|
302
|
+
@in
|
|
303
|
+
u_interval: float;
|
|
304
|
+
|
|
305
|
+
unpack_float(packedValue: float): ivec2 {
|
|
306
|
+
const packedIntValue = int(packedValue);
|
|
307
|
+
const v0 = packedIntValue / SHIFT_20;
|
|
308
|
+
return [v0, packedIntValue - v0 * SHIFT_20];
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
calcRepulsive(i: int, currentNode: vec4): vec2 {
|
|
312
|
+
let ax = 0, ay = 0;
|
|
313
|
+
for (let j: int = 0; j < VERTEX_COUNT; j++) {
|
|
314
|
+
if (i != j) {
|
|
315
|
+
const nextNode = this.u_Data[j];
|
|
316
|
+
const vx = currentNode[0] - nextNode[0];
|
|
317
|
+
const vy = currentNode[1] - nextNode[1];
|
|
318
|
+
const dist = sqrt(vx * vx + vy * vy) + 0.01;
|
|
319
|
+
const n_dist = (dist + 0.1) * this.u_coulombDisScale;
|
|
320
|
+
const direx = vx / dist;
|
|
321
|
+
const direy = vy / dist;
|
|
322
|
+
const attributesi = this.u_NodeAttributeArray1[i];
|
|
323
|
+
const attributesj = this.u_NodeAttributeArray1[j];
|
|
324
|
+
const massi = attributesi[0];
|
|
325
|
+
const nodeStrengthi = attributesi[2];
|
|
326
|
+
const nodeStrengthj = attributesj[2];
|
|
327
|
+
const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;
|
|
328
|
+
// const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);
|
|
329
|
+
const param = nodeStrength * this.u_factor / (n_dist * n_dist);
|
|
330
|
+
ax += direx * param;
|
|
331
|
+
ay += direy * param;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return [ax, ay];
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {
|
|
338
|
+
// note: attributes2 = [centerX, centerY, gravity, 0]
|
|
339
|
+
|
|
340
|
+
const vx = currentNode[0] - attributes2[0];
|
|
341
|
+
const vy = currentNode[1] - attributes2[1];
|
|
342
|
+
|
|
343
|
+
const ax = vx * attributes2[2];
|
|
344
|
+
const ay = vy * attributes2[2];
|
|
345
|
+
|
|
346
|
+
return [ax, ay];
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {
|
|
350
|
+
// note: attributes1 = [mass, degree, nodeSterngth, 0]
|
|
351
|
+
|
|
352
|
+
const mass = attributes1[0];
|
|
353
|
+
let ax = 0, ay = 0;
|
|
354
|
+
// const arr_offset = int(floor(currentNode[2] + 0.5));
|
|
355
|
+
// const length = int(floor(currentNode[3] + 0.5));
|
|
356
|
+
|
|
357
|
+
const compressed = this.unpack_float(currentNode[2]);
|
|
358
|
+
const length = compressed[0];
|
|
359
|
+
const arr_offset = compressed[1];
|
|
360
|
+
|
|
361
|
+
const node_buffer: vec4;
|
|
362
|
+
for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {
|
|
363
|
+
if (p >= length) break;
|
|
364
|
+
const arr_idx = arr_offset + 4 * p; // i 节点的第 p 条边开始的小格子位置
|
|
365
|
+
const buf_offset = arr_idx - arr_idx / 4 * 4;
|
|
366
|
+
if (p == 0 || buf_offset == 0) {
|
|
367
|
+
node_buffer = this.u_Data[int(arr_idx / 4)]; // 大格子,大格子位置=小个子位置 / 4,
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
let float_j: float = node_buffer[0];
|
|
371
|
+
|
|
372
|
+
const nextNode = this.u_Data[int(float_j)];
|
|
373
|
+
const vx = nextNode[0] - currentNode[0];
|
|
374
|
+
const vy = nextNode[1] - currentNode[1];
|
|
375
|
+
const dist = sqrt(vx * vx + vy * vy) + 0.01;
|
|
376
|
+
const direx = vx / dist;
|
|
377
|
+
const direy = vy / dist;
|
|
378
|
+
const edgeLength = node_buffer[1];
|
|
379
|
+
const edgeStrength = node_buffer[2];
|
|
380
|
+
const diff: float = edgeLength - dist;//edgeLength
|
|
381
|
+
// const param = diff * this.u_stiffness / mass; //
|
|
382
|
+
const param = diff * edgeStrength / mass; //
|
|
383
|
+
ax -= direx * param;
|
|
384
|
+
ay -= direy * param;
|
|
385
|
+
}
|
|
386
|
+
return [ax, ay];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
@main
|
|
390
|
+
compute() {
|
|
391
|
+
const i = globalInvocationID.x;
|
|
392
|
+
const currentNode = this.u_Data[i];
|
|
393
|
+
const movement = u_AveMovement[0];
|
|
394
|
+
let ax = 0, ay = 0;
|
|
395
|
+
|
|
396
|
+
if (i >= VERTEX_COUNT || movement.x < u_minMovement) {
|
|
397
|
+
this.u_Data[i] = currentNode;
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// 每个节点属性占两个数组中各一格
|
|
402
|
+
// [mass, degree, nodeStrength, fx]
|
|
403
|
+
const nodeAttributes1 = this.u_NodeAttributeArray1[i];
|
|
404
|
+
// [centerX, centerY, centerGravity, fy]
|
|
405
|
+
const nodeAttributes2 = this.u_NodeAttributeArray2[i];
|
|
406
|
+
|
|
407
|
+
// repulsive
|
|
408
|
+
const repulsive = this.calcRepulsive(i, currentNode);
|
|
409
|
+
ax += repulsive[0];
|
|
410
|
+
ay += repulsive[1];
|
|
411
|
+
|
|
412
|
+
// attractive
|
|
413
|
+
const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);
|
|
414
|
+
ax += attractive[0];
|
|
415
|
+
ay += attractive[1];
|
|
416
|
+
|
|
417
|
+
// gravity
|
|
418
|
+
const gravity = this.calcGravity(i, currentNode, nodeAttributes2);
|
|
419
|
+
ax -= gravity[0];
|
|
420
|
+
ay -= gravity[1];
|
|
421
|
+
|
|
422
|
+
// speed
|
|
423
|
+
const param = this.u_interval * this.u_damping;
|
|
424
|
+
let vx = ax * param;
|
|
425
|
+
let vy = ay * param;
|
|
426
|
+
const vlength = sqrt(vx * vx + vy * vy) + 0.0001;
|
|
427
|
+
if (vlength > this.u_maxSpeed) {
|
|
428
|
+
const param2 = this.u_maxSpeed / vlength;
|
|
429
|
+
vx = param2 * vx;
|
|
430
|
+
vy = param2 * vy;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// move
|
|
434
|
+
if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {
|
|
435
|
+
this.u_Data[i] = [
|
|
436
|
+
nodeAttributes1[3],
|
|
437
|
+
nodeAttributes2[3],
|
|
438
|
+
currentNode[2],
|
|
439
|
+
0
|
|
440
|
+
];
|
|
441
|
+
} else {
|
|
442
|
+
const distx = vx * this.u_interval;
|
|
443
|
+
const disty = vy * this.u_interval;
|
|
444
|
+
const distLength = sqrt(distx * distx + disty * disty);
|
|
445
|
+
this.u_Data[i] = [
|
|
446
|
+
currentNode[0] + distx,
|
|
447
|
+
currentNode[1] + disty,
|
|
448
|
+
currentNode[2],
|
|
449
|
+
distLength
|
|
450
|
+
];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// the avarage move distance
|
|
454
|
+
// need to share memory
|
|
455
|
+
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
`,ki.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}}',ki.aveMovementCode=`
|
|
459
|
+
const VERTEX_COUNT;
|
|
460
|
+
@numthreads(1, 1, 1)
|
|
461
|
+
class CalcAveMovement {
|
|
462
|
+
@in
|
|
463
|
+
u_Data: vec4[];
|
|
464
|
+
@in
|
|
465
|
+
u_iter: float;
|
|
466
|
+
@in @out
|
|
467
|
+
u_AveMovement: vec4[];
|
|
468
|
+
@main
|
|
469
|
+
compute() {
|
|
470
|
+
let movement = 0;
|
|
471
|
+
for (let j: int = 0; j < VERTEX_COUNT; j++) {
|
|
472
|
+
const vertex = this.u_Data[j];
|
|
473
|
+
movement += vertex[3];
|
|
474
|
+
}
|
|
475
|
+
movement = movement / float(VERTEX_COUNT);
|
|
476
|
+
this.u_AveMovement[0] = [movement, 0, 0, 0];
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
`,ki.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}}'),ki}var MM;function iD(){if(MM)return Ii;MM=1;var r=Ii&&Ii.__extends||function(){var c=function(h,d){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,p){v.__proto__=p}||function(v,p){for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&(v[g]=p[g])},c(h,d)};return function(h,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");c(h,d);function v(){this.constructor=h}h.prototype=d===null?Object.create(d):(v.prototype=d.prototype,new v)}}(),e=Ii&&Ii.__awaiter||function(c,h,d,v){function p(g){return g instanceof d?g:new d(function(y){y(g)})}return new(d||(d=Promise))(function(g,y){function m(w){try{b(v.next(w))}catch(E){y(E)}}function x(w){try{b(v.throw(w))}catch(E){y(E)}}function b(w){w.done?g(w.value):p(w.value).then(m,x)}b((v=v.apply(c,h||[])).next())})},t=Ii&&Ii.__generator||function(c,h){var d={label:0,sent:function(){if(g[0]&1)throw g[1];return g[1]},trys:[],ops:[]},v,p,g,y;return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(b){return function(w){return x([b,w])}}function x(b){if(v)throw new TypeError("Generator is already executing.");for(;y&&(y=0,b[0]&&(d=0)),d;)try{if(v=1,p&&(g=b[0]&2?p.return:b[0]?p.throw||((g=p.return)&&g.call(p),0):p.next)&&!(g=g.call(p,b[1])).done)return g;switch(p=0,g&&(b=[b[0]&2,g.value]),b[0]){case 0:case 1:g=b;break;case 4:return d.label++,{value:b[1],done:!1};case 5:d.label++,p=b[1],b=[0];continue;case 7:b=d.ops.pop(),d.trys.pop();continue;default:if(g=d.trys,!(g=g.length>0&&g[g.length-1])&&(b[0]===6||b[0]===2)){d=0;continue}if(b[0]===3&&(!g||b[1]>g[0]&&b[1]<g[3])){d.label=b[1];break}if(b[0]===6&&d.label<g[1]){d.label=g[1],g=b;break}if(g&&d.label<g[2]){d.label=g[2],d.ops.push(b);break}g[2]&&d.ops.pop(),d.trys.pop();continue}b=h.call(c,d)}catch(w){b=[6,w],p=0}finally{v=g=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.GForceGPULayout=void 0;var n=ln(),i=$r(),a=tD,o=rD(),s=o1(),u=Pte(),f=Iv(),l=function(c){r(h,c);function h(d){var v=c.call(this)||this;return v.maxIteration=1e3,v.edgeStrength=200,v.nodeStrength=1e3,v.coulombDisScale=.005,v.damping=.9,v.maxSpeed=1e3,v.minMovement=.5,v.interval=.02,v.factor=1,v.linkDistance=1,v.gravity=10,v.workerEnabled=!1,v.nodes=[],v.edges=[],v.width=300,v.height=300,v.nodeMap={},v.nodeIdxMap={},v.updateCfg(d),v}return h.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},h.prototype.execute=function(){return e(this,void 0,void 0,function(){var d,v,p,g,y;return t(this,function(m){switch(m.label){case 0:return d=this,v=d.nodes,!v||v.length===0?(d.onLayoutEnd&&d.onLayoutEnd(),[2]):(!d.width&&typeof window<"u"&&(d.width=window.innerWidth),!d.height&&typeof window<"u"&&(d.height=window.innerHeight),d.center||(d.center=[d.width/2,d.height/2]),p=d.center,v.length===1?(v[0].x=p[0],v[0].y=p[1],d.onLayoutEnd&&d.onLayoutEnd(),[2]):(g={},y={},v.forEach(function(x,b){(0,i.isNumber)(x.x)||(x.x=Math.random()*d.width),(0,i.isNumber)(x.y)||(x.y=Math.random()*d.height),g[x.id]=x,y[x.id]=b}),d.nodeMap=g,d.nodeIdxMap=y,d.nodeStrength=(0,o.proccessToFunc)(d.nodeStrength,1),d.edgeStrength=(0,o.proccessToFunc)(d.edgeStrength,1),[4,d.run()]));case 1:return m.sent(),[2]}})})},h.prototype.executeWithWorker=function(d,v){var p=this,g=p.nodes,y=p.center;if(!(!g||g.length===0)){if(g.length===1){g[0].x=y[0],g[0].y=y[1];return}var m={},x={};g.forEach(function(b,w){(0,i.isNumber)(b.x)||(b.x=Math.random()*p.width),(0,i.isNumber)(b.y)||(b.y=Math.random()*p.height),m[b.id]=b,x[b.id]=w}),p.nodeMap=m,p.nodeIdxMap=x,p.nodeStrength=(0,o.proccessToFunc)(p.nodeStrength,1),p.edgeStrength=(0,o.proccessToFunc)(p.edgeStrength,1),p.run(d,v)}},h.prototype.run=function(d,v){return e(this,void 0,void 0,function(){var p,g,y,m,x,b,w,E,S,_,C,M,A,T,I,L,N,O,B,W,D,P,R,X,Y,ee,U,Z=this;return t(this,function(K){switch(K.label){case 0:for(p=this,g=p.nodes,y=p.edges,m=p.maxIteration,!p.width&&typeof window<"u"&&(p.width=window.innerWidth),!p.height&&typeof window<"u"&&(p.height=window.innerHeight),x=g.length,p.linkDistance=(0,o.proccessToFunc)(p.linkDistance),p.edgeStrength=(0,o.proccessToFunc)(p.edgeStrength),b=(0,o.buildTextureDataWithTwoEdgeAttr)(g,y,p.linkDistance,p.edgeStrength),w=b.maxEdgePerVetex,E=b.array,p.degrees=(0,s.getDegree)(g.length,p.nodeIdxMap,y).map(function(se){return se.all}),S=[],_=[],C=[],M=[],A=[],T=[],I=[],p.getMass||(p.getMass=function(se){return p.degrees[p.nodeIdxMap[se.id]]||1}),L=p.gravity,N=p.center,g.forEach(function(se,re){S.push(p.getMass(se)),_.push(p.nodeStrength(se)),p.degrees[re]||(p.degrees[re]=0);var J=[N[0],N[1],L];if(p.getCenter){var me=p.getCenter(se,p.degrees[re]);me&&(0,i.isNumber)(me[0])&&(0,i.isNumber)(me[1])&&(0,i.isNumber)(me[2])&&(J=me)}C.push(J[0]),M.push(J[1]),A.push(J[2]),(0,i.isNumber)(se.fx)&&(0,i.isNumber)(se.fy)?(T.push(se.fx||.001),I.push(se.fy||.001)):(T.push(0),I.push(0))}),O=(0,o.arrayToTextureData)([S,p.degrees,_,T]),B=(0,o.arrayToTextureData)([C,M,A,I]),W=p.workerEnabled,W?D=a.World.create({canvas:d,engineOptions:{supportCompute:!0}}):D=a.World.create({engineOptions:{supportCompute:!0}}),P=p.onLayoutEnd,R=[],E.forEach(function(se){R.push(se)}),X=0;X<4;X++)R.push(0);return Y=D.createKernel(u.gForceBundle).setDispatch([x,1,1]).setBinding({u_Data:E,u_damping:p.damping,u_maxSpeed:p.maxSpeed,u_minMovement:p.minMovement,u_coulombDisScale:p.coulombDisScale,u_factor:p.factor,u_NodeAttributeArray1:O,u_NodeAttributeArray2:B,MAX_EDGE_PER_VERTEX:w,VERTEX_COUNT:x,u_AveMovement:R,u_interval:p.interval}),ee=D.createKernel(u.aveMovementBundle).setDispatch([1,1,1]).setBinding({u_Data:E,VERTEX_COUNT:x,u_AveMovement:[0,0,0,0]}),U=function(){return e(Z,void 0,void 0,function(){var se,re,J;return t(this,function(me){switch(me.label){case 0:se=0,me.label=1;case 1:return se<m?[4,Y.execute()]:[3,5];case 2:return me.sent(),ee.setBinding({u_Data:Y}),[4,ee.execute()];case 3:me.sent(),re=Math.max(.02,p.interval-se*.002),Y.setBinding({u_interval:re,u_AveMovement:ee}),me.label=4;case 4:return se++,[3,1];case 5:return[4,Y.getOutput()];case 6:return J=me.sent(),d?v.postMessage({type:f.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:J}):g.forEach(function(Ae,Ye){var Ve=J[4*Ye],Ke=J[4*Ye+1];Ae.x=Ve,Ae.y=Ke}),P&&P(),[2]}})})},[4,U()];case 1:return K.sent(),[2]}})})},h.prototype.getType=function(){return"gForce-gpu"},h}(n.Base);return Ii.GForceGPULayout=l,Ii}var fs={},CM;function aD(){if(CM)return fs;CM=1;var r=fs&&fs.__extends||function(){var i=function(a,o){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(s[f]=u[f])},i(a,o)};return function(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");i(a,o);function s(){this.constructor=a}a.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}}();Object.defineProperty(fs,"__esModule",{value:!0}),fs.ComboForceLayout=void 0;var e=ln(),t=$r(),n=function(i){r(a,i);function a(o){var s=i.call(this)||this;return s.center=[0,0],s.maxIteration=100,s.gravity=10,s.comboGravity=10,s.linkDistance=10,s.alpha=1,s.alphaMin=.001,s.alphaDecay=1-Math.pow(s.alphaMin,1/300),s.alphaTarget=0,s.velocityDecay=.6,s.edgeStrength=.6,s.nodeStrength=30,s.preventOverlap=!1,s.preventNodeOverlap=!1,s.preventComboOverlap=!1,s.collideStrength=void 0,s.nodeCollideStrength=.5,s.comboCollideStrength=.5,s.comboSpacing=20,s.comboPadding=10,s.optimizeRangeFactor=1,s.onTick=function(){},s.onLayoutEnd=function(){},s.depthAttractiveForceScale=1,s.depthRepulsiveForceScale=2,s.nodes=[],s.edges=[],s.combos=[],s.comboTrees=[],s.width=300,s.height=300,s.bias=[],s.nodeMap={},s.oriComboMap={},s.indexMap={},s.comboMap={},s.previousLayouted=!1,s.updateCfg(o),s}return a.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}},a.prototype.execute=function(){var o=this,s=o.nodes,u=o.center;if(o.comboTree={id:"comboTreeRoot",depth:-1,children:o.comboTrees},!s||s.length===0){o.onLayoutEnd&&o.onLayoutEnd();return}if(s.length===1){s[0].x=u[0],s[0].y=u[1],o.onLayoutEnd&&o.onLayoutEnd();return}o.initVals(),o.run(),o.onLayoutEnd&&o.onLayoutEnd()},a.prototype.run=function(){var o=this,s=o.nodes,u=o.previousLayouted?o.maxIteration/5:o.maxIteration;!o.width&&typeof window<"u"&&(o.width=window.innerWidth),!o.height&&typeof window<"u"&&(o.height=window.innerHeight);var f=o.center,l=o.velocityDecay,c=o.comboMap;o.previousLayouted||o.initPos(c);for(var h=function(g){var y=[];s.forEach(function(m,x){y[x]={x:0,y:0}}),o.applyCalculate(y),o.applyComboCenterForce(y),s.forEach(function(m,x){!(0,t.isNumber)(m.x)||!(0,t.isNumber)(m.y)||(m.x+=y[x].x*l,m.y+=y[x].y*l)}),o.alpha+=(o.alphaTarget-o.alpha)*o.alphaDecay,o.onTick()},d=0;d<u;d++)h();var v=[0,0];s.forEach(function(g){!(0,t.isNumber)(g.x)||!(0,t.isNumber)(g.y)||(v[0]+=g.x,v[1]+=g.y)}),v[0]/=s.length,v[1]/=s.length;var p=[f[0]-v[0],f[1]-v[1]];s.forEach(function(g,y){!(0,t.isNumber)(g.x)||!(0,t.isNumber)(g.y)||(g.x+=p[0],g.y+=p[1])}),o.combos.forEach(function(g){var y=c[g.id];y&&y.empty&&(g.x=y.cx||g.x,g.y=y.cy||g.y)}),o.previousLayouted=!0},a.prototype.initVals=function(){var o=this,s=o.edges,u=o.nodes,f=o.combos,l={},c={},h={};u.forEach(function(R,X){c[R.id]=R,h[R.id]=X}),o.nodeMap=c,o.indexMap=h;var d={};f.forEach(function(R){d[R.id]=R}),o.oriComboMap=d,o.comboMap=o.getComboMap();var v=o.preventOverlap;o.preventComboOverlap=o.preventComboOverlap||v,o.preventNodeOverlap=o.preventNodeOverlap||v;var p=o.collideStrength;p&&(o.comboCollideStrength=p,o.nodeCollideStrength=p),o.comboCollideStrength=o.comboCollideStrength?o.comboCollideStrength:0,o.nodeCollideStrength=o.nodeCollideStrength?o.nodeCollideStrength:0;for(var g=0;g<s.length;++g){var y=(0,t.getEdgeTerminal)(s[g],"source"),m=(0,t.getEdgeTerminal)(s[g],"target");l[y]?l[y]++:l[y]=1,l[m]?l[m]++:l[m]=1}for(var x=[],g=0;g<s.length;++g){var y=(0,t.getEdgeTerminal)(s[g],"source"),m=(0,t.getEdgeTerminal)(s[g],"target");x[g]=l[y]/(l[y]+l[m])}this.bias=x;var b=o.nodeSize,w=o.nodeSpacing,E,S;if((0,t.isNumber)(w)?S=function(){return w}:(0,t.isFunction)(w)?S=w:S=function(){return 0},this.nodeSpacing=S,!b)E=function(R){if(R.size){if((0,t.isArray)(R.size)){var X=R.size[0]>R.size[1]?R.size[0]:R.size[1];return X/2}if((0,t.isObject)(R.size)){var X=R.size.width>R.size.height?R.size.width:R.size.height;return X/2}return R.size/2}return 10};else if((0,t.isFunction)(b))E=function(R){return b(R)};else if((0,t.isArray)(b)){var _=b[0]>b[1]?b[0]:b[1],C=_/2;E=function(R){return C}}else{var M=b/2;E=function(R){return M}}this.nodeSize=E;var A=o.comboSpacing,T;(0,t.isNumber)(A)?T=function(){return A}:(0,t.isFunction)(A)?T=A:T=function(){return 0},this.comboSpacing=T;var I=o.comboPadding,L;(0,t.isNumber)(I)?L=function(){return I}:(0,t.isArray)(I)?L=function(){return Math.max.apply(null,I)}:(0,t.isFunction)(I)?L=I:L=function(){return 0},this.comboPadding=L;var N=this.linkDistance,O;N||(N=10),(0,t.isNumber)(N)?O=function(R){return N}:O=N,this.linkDistance=O;var B=this.edgeStrength,W;B||(B=1),(0,t.isNumber)(B)?W=function(R){return B}:W=B,this.edgeStrength=W;var D=this.nodeStrength,P;D||(D=30),(0,t.isNumber)(D)?P=function(R){return D}:P=D,this.nodeStrength=P},a.prototype.initPos=function(o){var s=this,u=s.nodes;u.forEach(function(f,l){var c=f.comboId,h=o[c];c&&h?(f.x=h.cx+100/(l+1),f.y=h.cy+100/(l+1)):(f.x=100/(l+1),f.y=100/(l+1))})},a.prototype.getComboMap=function(){var o=this,s=o.nodeMap,u=o.comboTrees,f=o.oriComboMap,l={};return(u||[]).forEach(function(c){var h=[];(0,t.traverseTreeUp)(c,function(d){if(d.itemType==="node"||!f[d.id])return!0;if(l[d.id]===void 0){var v={id:d.id,name:d.id,cx:0,cy:0,count:0,depth:o.oriComboMap[d.id].depth||0,children:[]};l[d.id]=v}var p=d.children;p&&p.forEach(function(m){if(!l[m.id]&&!s[m.id])return!0;h.push(m)});var g=l[d.id];if(g.cx=0,g.cy=0,h.length===0){g.empty=!0;var y=f[d.id];g.cx=y.x,g.cy=y.y}return h.forEach(function(m){if(g.count++,m.itemType!=="node"){var x=l[m.id];(0,t.isNumber)(x.cx)&&(g.cx+=x.cx),(0,t.isNumber)(x.cy)&&(g.cy+=x.cy);return}var b=s[m.id];b&&((0,t.isNumber)(b.x)&&(g.cx+=b.x),(0,t.isNumber)(b.y)&&(g.cy+=b.y))}),g.cx/=g.count||1,g.cy/=g.count||1,g.children=h,!0})}),l},a.prototype.applyComboCenterForce=function(o){var s=this,u=s.gravity,f=s.comboGravity||u,l=this.alpha,c=s.comboTrees,h=s.indexMap,d=s.nodeMap,v=s.comboMap;(c||[]).forEach(function(p){(0,t.traverseTreeUp)(p,function(g){if(g.itemType==="node")return!0;var y=v[g.id];if(!y)return!0;var m=v[g.id],x=(m.depth+1)/10*.5,b=m.cx,w=m.cy;return m.cx=0,m.cy=0,m.children.forEach(function(E){if(E.itemType!=="node"){var S=v[E.id];S&&(0,t.isNumber)(S.cx)&&(m.cx+=S.cx),S&&(0,t.isNumber)(S.cy)&&(m.cy+=S.cy);return}var _=d[E.id],C=_.x-b||.005,M=_.y-w||.005,A=Math.sqrt(C*C+M*M),T=h[_.id],I=f*l/A*x;o[T].x-=C*I,o[T].y-=M*I,(0,t.isNumber)(_.x)&&(m.cx+=_.x),(0,t.isNumber)(_.y)&&(m.cy+=_.y)}),m.cx/=m.count||1,m.cy/=m.count||1,!0})})},a.prototype.applyCalculate=function(o){var s=this,u=s.comboMap,f=s.nodes,l={};f.forEach(function(h,d){f.forEach(function(v,p){if(!(d<p)){var g=h.x-v.x||.005,y=h.y-v.y||.005,m=g*g+y*y,x=Math.sqrt(m);m<1&&(m=x),l["".concat(h.id,"-").concat(v.id)]={vx:g,vy:y,vl2:m,vl:x},l["".concat(v.id,"-").concat(h.id)]={vl2:m,vl:x,vx:-g,vy:-y}}})}),s.updateComboSizes(u),s.calRepulsive(o,l),s.calAttractive(o,l);var c=s.preventComboOverlap;c&&s.comboNonOverlapping(o,u)},a.prototype.updateComboSizes=function(o){var s=this,u=s.comboTrees,f=s.nodeMap,l=s.nodeSize,c=s.comboSpacing,h=s.comboPadding;(u||[]).forEach(function(d){var v=[];(0,t.traverseTreeUp)(d,function(p){if(p.itemType==="node")return!0;var g=o[p.id];if(!g)return!1;var y=p.children;y&&y.forEach(function(b){!o[b.id]&&!f[b.id]||v.push(b)}),g.minX=1/0,g.minY=1/0,g.maxX=-1/0,g.maxY=-1/0,v.forEach(function(b){if(b.itemType!=="node")return!0;var w=f[b.id];if(!w)return!0;var E=l(w),S=w.x-E,_=w.y-E,C=w.x+E,M=w.y+E;g.minX>S&&(g.minX=S),g.minY>_&&(g.minY=_),g.maxX<C&&(g.maxX=C),g.maxY<M&&(g.maxY=M)});var m=s.oriComboMap[p.id].size||10;(0,t.isArray)(m)&&(m=m[0]);var x=Math.max(g.maxX-g.minX,g.maxY-g.minY,m);return g.r=x/2+c(g)/2+h(g),!0})})},a.prototype.comboNonOverlapping=function(o,s){var u=this,f=u.comboTree,l=u.comboCollideStrength,c=u.indexMap,h=u.nodeMap;(0,t.traverseTreeUp)(f,function(d){if(!s[d.id]&&!h[d.id]&&d.id!=="comboTreeRoot")return!1;var v=d.children;return v&&v.length>1&&v.forEach(function(p,g){if(p.itemType==="node")return!1;var y=s[p.id];y&&v.forEach(function(m,x){if(g<=x||m.itemType==="node")return!1;var b=s[m.id];if(!b)return!1;var w=y.cx-b.cx||.005,E=y.cy-b.cy||.005,S=w*w+E*E,_=y.r||1,C=b.r||1,M=_+C,A=C*C,T=_*_;if(S<M*M){var I=p.children;if(!I||I.length===0)return!1;var L=m.children;if(!L||L.length===0)return!1;var N=Math.sqrt(S),O=(M-N)/N*l,B=w*O,W=E*O,D=A/(T+A),P=1-D;I.forEach(function(R){if(R.itemType!=="node")return!1;if(h[R.id]){var X=c[R.id];L.forEach(function(Y){if(Y.itemType!=="node"||!h[Y.id])return!1;var ee=c[Y.id];o[X].x+=B*D,o[X].y+=W*D,o[ee].x-=B*P,o[ee].y-=W*P})}})}})}),!0})},a.prototype.calRepulsive=function(o,s){var u=this,f=u.nodes,l=u.width*u.optimizeRangeFactor,c=u.nodeStrength,h=u.alpha,d=u.nodeCollideStrength,v=u.preventNodeOverlap,p=u.nodeSize,g=u.nodeSpacing,y=u.depthRepulsiveForceScale,m=u.center;f.forEach(function(x,b){if(!(!x.x||!x.y)){if(m){var w=u.gravity,E=x.x-m[0]||.005,S=x.y-m[1]||.005,_=Math.sqrt(E*E+S*S);o[b].x-=E*w*h/_,o[b].y-=S*w*h/_}f.forEach(function(C,M){if(b!==M&&!(!C.x||!C.y)){var A=s["".concat(x.id,"-").concat(C.id)],T=A.vl2,I=A.vl;if(!(I>l)){var L=s["".concat(x.id,"-").concat(C.id)],N=L.vx,O=L.vy,B=Math.log(Math.abs(C.depth-x.depth)/10)+1||1;B=B<1?1:B,C.comboId!==x.comboId&&(B+=1);var W=B?Math.pow(y,B):1,D=c(C)*h/T*W;if(o[b].x+=N*D,o[b].y+=O*D,b<M&&v){var P=p(x)+g(x)||1,R=p(C)+g(C)||1,X=P+R;if(T<X*X){var Y=(X-I)/I*d,ee=R*R,U=ee/(P*P+ee),Z=N*Y,K=O*Y;o[b].x+=Z*U,o[b].y+=K*U,U=1-U,o[M].x-=Z*U,o[M].y-=K*U}}}}})}})},a.prototype.calAttractive=function(o,s){var u=this,f=u.edges,l=u.linkDistance,c=u.alpha,h=u.edgeStrength,d=u.bias,v=u.depthAttractiveForceScale;f.forEach(function(p,g){var y=(0,t.getEdgeTerminal)(p,"source"),m=(0,t.getEdgeTerminal)(p,"target");if(!(!y||!m||y===m)){var x=u.indexMap[y],b=u.indexMap[m],w=u.nodeMap[y],E=u.nodeMap[m];if(!(!w||!E)){var S=w.depth===E.depth?0:Math.log(Math.abs(w.depth-E.depth)/10);w.comboId===E.comboId&&(S=S/2);var _=S?Math.pow(v,S):1;if(w.comboId!==E.comboId&&_===1?_=v/2:w.comboId===E.comboId&&(_=2),!(!(0,t.isNumber)(E.x)||!(0,t.isNumber)(w.x)||!(0,t.isNumber)(E.y)||!(0,t.isNumber)(w.y))){var C=s["".concat(m,"-").concat(y)],M=C.vl,A=C.vx,T=C.vy,I=(M-l(p))/M*c*h(p)*_,L=A*I,N=T*I,O=d[g];o[b].x-=L*O,o[b].y-=N*O,o[x].x+=L*(1-O),o[x].y+=N*(1-O)}}}})},a.prototype.getType=function(){return"comboForce"},a}(e.Base);return fs.ComboForceLayout=n,fs}var Na={},AM;function oD(){if(AM)return Na;AM=1;var r=Na&&Na.__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=Na&&Na.__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(Na,"__esModule",{value:!0}),Na.ComboCombinedLayout=void 0;var t=Iv(),n=ln(),i=$r(),a=fD(),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(N){g[N.id]=N});var y={};d.forEach(function(N){y[N.id]=N});var m=l.getInnerGraphs(g),x=[],b=[],w={},E=!0;this.comboTrees.forEach(function(N){var O=m[N.id];if(O){var B=e(e({},N),{x:O.x||y[N.id].x,y:O.y||y[N.id].y,fx:O.fx||y[N.id].fx,fy:O.fy||y[N.id].fy,mass:O.mass||y[N.id].mass,size:O.size});b.push(B),!isNaN(B.x)&&B.x!==0&&!isNaN(B.y)&&B.y!==0?E=!1:(B.x=Math.random()*100,B.y=Math.random()*100),x.push(N.id),(0,i.traverseTreeUp)(N,function(W){return W.id!==N.id&&(w[W.id]=N.id),!0})}}),c.forEach(function(N){if(!(N.comboId&&y[N.comboId])){var O=e({},N);b.push(O),!isNaN(O.x)&&O.x!==0&&!isNaN(O.y)&&O.y!==0?E=!1:(O.x=Math.random()*100,O.y=Math.random()*100),x.push(N.id)}});var S=[];if(h.concat(v).forEach(function(N){var O=w[N.source]||N.source,B=w[N.target]||N.target;O!==B&&x.includes(O)&&x.includes(B)&&S.push({source:O,target:B})}),b!=null&&b.length){if(b.length===1)b[0].x=p[0],b[0].y=p[1];else{var _={nodes:b,edges:S},C=this.outerLayout||new a.GForceLayout({gravity:1,factor:4,linkDistance:function(N,O,B){var W,D,P=((((W=O.size)===null||W===void 0?void 0:W[0])||30)+(((D=B.size)===null||D===void 0?void 0:D[0])||30))/2;return Math.min(P*1.5,700)}}),M=(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[M]){var A=b.length<100?new a.MDSLayout:new a.GridLayout;A.layout(_)}C.layout(_)}b.forEach(function(N){var O=m[N.id];if(!O){var B=g[N.id];B&&(B.x=N.x,B.y=N.y);return}O.visited=!0,O.x=N.x,O.y=N.y,O.nodes.forEach(function(W){W.x+=N.x,W.y+=N.y})})}for(var T=Object.keys(m),I=function(N){var O=T[N],B=m[O];if(!B)return"continue";B.nodes.forEach(function(W){B.visited||(W.x+=B.x||0,W.y+=B.y||0),g[W.id]&&(g[W.id].x=W.x,g[W.id].y=W.y)}),y[O]&&(y[O].x=B.x,y[O].y=B.y)},L=T.length-1;L>=0;L--)I(L);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(x){var b,w=(v==null?void 0:v(x))||10;if((0,i.isArray)(w)&&(w=Math.max.apply(Math,w)),!((b=x.children)===null||b===void 0)&&b.length){var S=x.children.map(function(D){if(D.itemType==="combo")return g[D.id];var P=f[D.id]||{};return e(e({},P),D)}),_=S.map(function(D){return D.id}),C={nodes:S,edges:d.filter(function(D){return _.includes(D.source)&&_.includes(D.target)})},M=1/0;S.forEach(function(D){var P;D.size||(D.size=((P=g[D.id])===null||P===void 0?void 0:P.size)||(h==null?void 0:h(D))||[30,30]),(0,i.isNumber)(D.size)&&(D.size=[D.size,D.size]),M>D.size[0]&&(M=D.size[0]),M>D.size[1]&&(M=D.size[1])}),y.layout(C);var A=(0,i.getLayoutBBox)(S),T=A.minX,I=A.minY,L=A.maxX,N=A.maxY,O={x:(L+T)/2,y:(N+I)/2};C.nodes.forEach(function(D){D.x-=O.x,D.y-=O.y});var B=Math.max(L-T,M)+w*2,W=Math.max(N-I,M)+w*2;g[x.id]={id:x.id,nodes:S,size:[B,W]}}else if(x.itemType==="combo"){var E=w?[w*2,w*2]:[30,30];g[x.id]={id:x.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(x){var b=d(x);if(x.size){if((0,i.isArray)(x.size)){var w=x.size[0]>x.size[1]?x.size[0]:x.size[1];return(w+b)/2}if((0,i.isObject)(x.size)){var w=x.size.width>x.size.height?x.size.width:x.size.height;return(w+b)/2}return(x.size+b)/2}return 10+b/2};else if((0,i.isFunction)(l))h=function(x){var b=l(x),w=d(x);if((0,i.isArray)(x.size)){var E=x.size[0]>x.size[1]?x.size[0]:x.size[1];return(E+w)/2}return((b||10)+w)/2};else if((0,i.isArray)(l)){var v=l[0]>l[1]?l[0]:l[1],p=v/2;h=function(x){return p+d(x)/2}}else{var g=l/2;h=function(x){return g+d(x)/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 Na.ComboCombinedLayout=o,Na}var Oa={},$h={},TM;function Rte(){if(TM)return $h;TM=1,Object.defineProperty($h,"__esModule",{value:!0});var r=function(){function e(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}return e.prototype.distanceTo=function(t){var n=this.rx-t.rx,i=this.ry-t.ry;return Math.hypot(n,i)},e.prototype.setPos=function(t,n){this.rx=t,this.ry=n},e.prototype.resetForce=function(){this.fx=0,this.fy=0},e.prototype.addForce=function(t){var n=t.rx-this.rx,i=t.ry-this.ry,a=Math.hypot(n,i);a=a<1e-4?1e-4:a;var o=this.g*(this.degree+1)*(t.degree+1)/a;this.fx+=o*n/a,this.fy+=o*i/a},e.prototype.in=function(t){return t.contains(this.rx,this.ry)},e.prototype.add=function(t){var n=this.mass+t.mass,i=(this.rx*this.mass+t.rx*t.mass)/n,a=(this.ry*this.mass+t.ry*t.mass)/n,o=this.degree+t.degree,s={rx:i,ry:a,mass:n,degree:o};return new e(s)},e}();return $h.default=r,$h}var Xh={},IM;function Bte(){if(IM)return Xh;IM=1,Object.defineProperty(Xh,"__esModule",{value:!0});var r=function(){function e(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return e.prototype.getLength=function(){return this.length},e.prototype.contains=function(t,n){var i=this.length/2;return t<=this.xmid+i&&t>=this.xmid-i&&n<=this.ymid+i&&n>=this.ymid-i},e.prototype.NW=function(){var t=this.xmid-this.length/4,n=this.ymid+this.length/4,i=this.length/2,a={xmid:t,ymid:n,length:i},o=new e(a);return o},e.prototype.NE=function(){var t=this.xmid+this.length/4,n=this.ymid+this.length/4,i=this.length/2,a={xmid:t,ymid:n,length:i},o=new e(a);return o},e.prototype.SW=function(){var t=this.xmid-this.length/4,n=this.ymid-this.length/4,i=this.length/2,a={xmid:t,ymid:n,length:i},o=new e(a);return o},e.prototype.SE=function(){var t=this.xmid+this.length/4,n=this.ymid-this.length/4,i=this.length/2,a={xmid:t,ymid:n,length:i},o=new e(a);return o},e}();return Xh.default=r,Xh}var Yh={},kM;function Fte(){if(kM)return Yh;kM=1,Object.defineProperty(Yh,"__esModule",{value:!0});var r=function(){function e(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,t!=null&&(this.quad=t)}return e.prototype.insert=function(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new e(this.quad.NW()),this.NE=new e(this.quad.NE()),this.SW=new e(this.quad.SW()),this.SE=new e(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))},e.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},e.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},e.prototype.updateForce=function(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{var n=this.quad?this.quad.getLength():0,i=this.body.distanceTo(t);n/i<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}},e}();return Yh.default=r,Yh}var LM;function sD(){if(LM)return Oa;LM=1;var r=Oa&&Oa.__extends||function(){var u=function(f,l){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,h){c.__proto__=h}||function(c,h){for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(c[d]=h[d])},u(f,l)};return function(f,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");u(f,l);function c(){this.constructor=f}f.prototype=l===null?Object.create(l):(c.prototype=l.prototype,new c)}}(),e=Oa&&Oa.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Oa,"__esModule",{value:!0}),Oa.ForceAtlas2Layout=void 0;var t=ln(),n=$r(),i=e(Rte()),a=e(Bte()),o=e(Fte()),s=function(u){r(f,u);function f(l){var c=u.call(this)||this;return c.center=[0,0],c.width=300,c.height=300,c.nodes=[],c.edges=[],c.kr=5,c.kg=1,c.mode="normal",c.preventOverlap=!1,c.dissuadeHubs=!1,c.barnesHut=void 0,c.maxIteration=0,c.ks=.1,c.ksmax=10,c.tao=.1,c.onLayoutEnd=function(){},c.prune=void 0,c.updateCfg(l),c}return f.prototype.getDefaultCfg=function(){return{}},f.prototype.execute=function(){var l=this,c=l.nodes,h=l.onLayoutEnd,d=l.prune,v=l.maxIteration;!l.width&&typeof window<"u"&&(l.width=window.innerWidth),!l.height&&typeof window<"u"&&(l.height=window.innerHeight);for(var p=[],g=c.length,y=0;y<g;y+=1){var m=c[y],x=10,b=10;(0,n.isNumber)(m.size)&&(x=m.size,b=m.size),(0,n.isArray)(m.size)?(isNaN(m.size[0])||(x=m.size[0]),isNaN(m.size[1])||(b=m.size[1])):(0,n.isObject)(m.size)&&(x=m.size.width,b=m.size.height),l.getWidth&&!isNaN(l.getWidth(m))&&(b=l.getWidth(m)),l.getHeight&&!isNaN(l.getHeight(m))&&(x=l.getHeight(m));var w=Math.max(x,b);p.push(w)}l.barnesHut===void 0&&g>250&&(l.barnesHut=!0),l.prune===void 0&&g>100&&(l.prune=!0),this.maxIteration===0&&!l.prune?(v=250,g<=200&&g>100?v=1e3:g>200&&(v=1200),this.maxIteration=v):this.maxIteration===0&&d&&(v=100,g<=200&&g>100?v=500:g>200&&(v=950),this.maxIteration=v),l.kr||(l.kr=50,g>100&&g<=500?l.kr=20:g>500&&(l.kr=1)),l.kg||(l.kg=20,g>100&&g<=500?l.kg=10:g>500&&(l.kg=1)),this.nodes=l.updateNodesByForces(p),h()},f.prototype.updateNodesByForces=function(l){for(var c=this,h=c.edges,d=c.maxIteration,v=c.nodes,p=h.filter(function(N){var O=(0,n.getEdgeTerminal)(N,"source"),B=(0,n.getEdgeTerminal)(N,"target");return O!==B}),g=v.length,y=p.length,m=[],x={},b={},w=[],E=0;E<g;E+=1)x[v[E].id]=E,m[E]=0,(v[E].x===void 0||isNaN(v[E].x))&&(v[E].x=Math.random()*1e3),(v[E].y===void 0||isNaN(v[E].y))&&(v[E].y=Math.random()*1e3),w.push({x:v[E].x,y:v[E].y});for(var E=0;E<y;E+=1){for(var S=void 0,_=void 0,C=0,M=0,A=0;A<g;A+=1){var T=(0,n.getEdgeTerminal)(p[E],"source"),I=(0,n.getEdgeTerminal)(p[E],"target");v[A].id===T?(S=v[A],C=A):v[A].id===I&&(_=v[A],M=A),b[E]={sourceIdx:C,targetIdx:M}}S&&(m[x[S.id]]+=1),_&&(m[x[_.id]]+=1)}var L=d;if(v=this.iterate(L,x,b,y,m,l),c.prune){for(var A=0;A<y;A+=1)m[b[A].sourceIdx]<=1?(v[b[A].sourceIdx].x=v[b[A].targetIdx].x,v[b[A].sourceIdx].y=v[b[A].targetIdx].y):m[b[A].targetIdx]<=1&&(v[b[A].targetIdx].x=v[b[A].sourceIdx].x,v[b[A].targetIdx].y=v[b[A].sourceIdx].y);c.prune=!1,c.barnesHut=!1,L=100,v=this.iterate(L,x,b,y,m,l)}return v},f.prototype.iterate=function(l,c,h,d,v,p){for(var g=this,y=g.nodes,m=g.kr,x=g.preventOverlap,b=g.barnesHut,w=y.length,E=0,S=100,_=l,C=50,M=[],A=[],T=[],I=0;I<w;I+=1)if(M[2*I]=0,M[2*I+1]=0,b){var L={id:I,rx:y[I].x,ry:y[I].y,mass:1,g:m,degree:v[I]};T[I]=new i.default(L)}for(;_>0;){for(var I=0;I<w;I+=1)A[2*I]=M[2*I],A[2*I+1]=M[2*I+1],M[2*I]=0,M[2*I+1]=0;M=this.getAttrForces(_,C,d,c,h,v,p,M),b&&(x&&_>C||!x)?M=this.getOptRepGraForces(M,T,v):M=this.getRepGraForces(_,C,M,S,p,v);var N=this.updatePos(M,A,E,v);y=N.nodes,E=N.sg,_--,g.tick&&g.tick()}return y},f.prototype.getAttrForces=function(l,c,h,d,v,p,g,y){for(var m=this,x=m.nodes,b=m.preventOverlap,w=m.dissuadeHubs,E=m.mode,S=m.prune,_=0;_<h;_+=1){var C=x[v[_].sourceIdx],M=v[_].sourceIdx,A=x[v[_].targetIdx],T=v[_].targetIdx;if(!(S&&(p[M]<=1||p[T]<=1))){var I=[A.x-C.x,A.y-C.y],L=Math.hypot(I[0],I[1]);L=L<1e-4?1e-4:L,I[0]=I[0]/L,I[1]=I[1]/L,b&&l<c&&(L=L-g[M]-g[T]);var N=L,O=N;E==="linlog"&&(N=Math.log(1+L),O=N),w&&(N=L/p[M],O=L/p[T]),b&&l<c&&L<=0?(N=0,O=0):b&&l<c&&L>0&&(N=L,O=L),y[2*d[C.id]]+=N*I[0],y[2*d[A.id]]-=O*I[0],y[2*d[C.id]+1]+=N*I[1],y[2*d[A.id]+1]-=O*I[1]}}return y},f.prototype.getRepGraForces=function(l,c,h,d,v,p){for(var g=this,y=g.nodes,m=g.preventOverlap,x=g.kr,b=g.kg,w=g.center,E=g.prune,S=y.length,_=0;_<S;_+=1){for(var C=_+1;C<S;C+=1)if(!(E&&(p[_]<=1||p[C]<=1))){var M=[y[C].x-y[_].x,y[C].y-y[_].y],A=Math.hypot(M[0],M[1]);A=A<1e-4?1e-4:A,M[0]=M[0]/A,M[1]=M[1]/A,m&&l<c&&(A=A-v[_]-v[C]);var T=x*(p[_]+1)*(p[C]+1)/A;m&&l<c&&A<0?T=d*(p[_]+1)*(p[C]+1):m&&l<c&&A===0?T=0:m&&l<c&&A>0&&(T=x*(p[_]+1)*(p[C]+1)/A),h[2*_]-=T*M[0],h[2*C]+=T*M[0],h[2*_+1]-=T*M[1],h[2*C+1]+=T*M[1]}var I=[y[_].x-w[0],y[_].y-w[1]],L=Math.hypot(I[0],I[1]);I[0]=I[0]/L,I[1]=I[1]/L;var N=b*(p[_]+1);h[2*_]-=N*I[0],h[2*_+1]-=N*I[1]}return h},f.prototype.getOptRepGraForces=function(l,c,h){for(var d=this,v=d.nodes,p=d.kg,g=d.center,y=d.prune,m=v.length,x=9e10,b=-9e10,w=9e10,E=-9e10,S=0;S<m;S+=1)y&&h[S]<=1||(c[S].setPos(v[S].x,v[S].y),v[S].x>=b&&(b=v[S].x),v[S].x<=x&&(x=v[S].x),v[S].y>=E&&(E=v[S].y),v[S].y<=w&&(w=v[S].y));for(var _=Math.max(b-x,E-w),C={xmid:(b+x)/2,ymid:(E+w)/2,length:_,massCenter:g,mass:m},M=new a.default(C),A=new o.default(M),S=0;S<m;S+=1)y&&h[S]<=1||c[S].in(M)&&A.insert(c[S]);for(var S=0;S<m;S+=1)if(!(y&&h[S]<=1)){c[S].resetForce(),A.updateForce(c[S]),l[2*S]-=c[S].fx,l[2*S+1]-=c[S].fy;var T=[v[S].x-g[0],v[S].y-g[1]],I=Math.hypot(T[0],T[1]);I=I<1e-4?1e-4:I,T[0]=T[0]/I,T[1]=T[1]/I;var L=p*(h[S]+1);l[2*S]-=L*T[0],l[2*S+1]-=L*T[1]}return l},f.prototype.updatePos=function(l,c,h,d){for(var v=this,p=v.nodes,g=v.ks,y=v.tao,m=v.prune,x=v.ksmax,b=p.length,w=[],E=[],S=0,_=0,C=0;C<b;C+=1)if(!(m&&d[C]<=1)){var M=[l[2*C]-c[2*C],l[2*C+1]-c[2*C+1]],A=Math.hypot(M[0],M[1]),T=[l[2*C]+c[2*C],l[2*C+1]+c[2*C+1]],I=Math.hypot(T[0],T[1]);w[C]=A,E[C]=I/2,S+=(d[C]+1)*w[C],_+=(d[C]+1)*E[C]}var L=h;h=y*_/S,L!==0&&(h=h>1.5*L?1.5*L:h);for(var C=0;C<b;C+=1)if(!(m&&d[C]<=1)&&!((0,n.isNumber)(p[C].fx)&&(0,n.isNumber)(p[C].fy))){var N=g*h/(1+h*Math.sqrt(w[C])),O=Math.hypot(l[2*C],l[2*C+1]);O=O<1e-4?1e-4:O;var B=x/O;N=N>B?B:N;var W=N*l[2*C],D=N*l[2*C+1];p[C].x+=W,p[C].y+=D}return{nodes:p,sg:h}},f}(t.Base);return Oa.ForceAtlas2Layout=s,Oa}var Da={},Rn={},xu={},wu={},NM;function Gte(){if(NM)return wu;NM=1;var r=wu&&wu.__assign||function(){return r=Object.assign||function(t){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r.apply(this,arguments)};Object.defineProperty(wu,"__esModule",{value:!0});var e=function(){function t(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return t.prototype.init=function(n,i,a){this.cells=[],this.CELL_W=a.CELL_W||t.DEFAULT_CELL_W,this.CELL_H=a.CELL_H||t.DEFAULT_CELL_H,this.columnNum=Math.ceil(n/this.CELL_W),this.rowNum=Math.ceil(i/this.CELL_H),t.MIN_DIST=Math.pow(n,2)+Math.pow(i,2);for(var o=0;o<this.columnNum;o++){for(var s=[],u=0;u<this.rowNum;u++){var f={dx:o,dy:u,x:o*this.CELL_W,y:u*this.CELL_H,occupied:!1};s.push(f)}this.cells.push(s)}},t.prototype.findGridByNodeId=function(n){for(var i,a,o=0;o<this.columnNum;o++)for(var s=0;s<this.rowNum;s++)if(this.cells[o][s].node&&((a=(i=this.cells[o][s])===null||i===void 0?void 0:i.node)===null||a===void 0?void 0:a.id)===n)return{column:o,row:s};return null},t.prototype.sqdist=function(n,i){return Math.pow(n.x-i.x,2)+Math.pow(n.y-i.y,2)},t.prototype.occupyNearest=function(n){for(var i=t.MIN_DIST,a,o=null,s=0;s<this.columnNum;s++)for(var u=0;u<this.rowNum;u++)!this.cells[s][u].occupied&&(a=this.sqdist(n,this.cells[s][u]))<i&&(i=a,o=this.cells[s][u]);return o&&(o.occupied=!0),o},t.prototype.insertColumn=function(n,i){if(!(i<=0)){for(var a=0;a<i;a++){this.cells[a+this.columnNum]=[];for(var o=0;o<this.rowNum;o++)this.cells[a+this.columnNum][o]={dx:a,dy:o,x:a*this.CELL_W,y:o*this.CELL_H,occupied:!1,node:null}}for(var a=this.columnNum-1;a>n;a--)for(var o=0;o<this.rowNum;o++)this.cells[a+i][o]=r(r({},this.cells[a][o]),{x:(a+i)*this.CELL_W,y:o*this.CELL_H}),this.cells[a][o]={x:a*this.CELL_W,y:o*this.CELL_H,occupied:!0,node:null};for(var o=0;o<this.additionColumn.length;o++)this.additionColumn[o]>=n&&(this.additionColumn[o]+=i);for(var a=0;a<i;a++)this.additionColumn.push(n+a+1);this.columnNum+=i}},t.prototype.insertRow=function(n,i){if(!(i<=0)){for(var a=0;a<i;a++)for(var o=0;o<this.columnNum;o++)this.cells[o][a+this.rowNum]={dx:o,dy:a,x:o*this.CELL_W,y:a*this.CELL_H,occupied:!1,node:null};for(var o=0;o<this.columnNum;o++)for(var a=this.rowNum-1;a>n;a--)this.cells[o][a+i]=r(r({},this.cells[o][a]),{dx:o,dy:a+i,x:o*this.CELL_W,y:(a+i)*this.CELL_H}),this.cells[o][a]={dx:o,dy:a,x:o*this.CELL_W,y:a*this.CELL_H,occupied:!1,node:null};for(var a=0;a<this.additionRow.length;a++)this.additionRow[a]>=n&&(this.additionRow[a]+=i);for(var o=0;o<i;o++)this.additionRow.push(n+o+1);this.rowNum+=i}},t.prototype.getNodes=function(){for(var n=[],i=0;i<this.columnNum;i++)for(var a=0;a<this.rowNum;a++)this.cells[i][a].node&&n.push(this.cells[i][a]);return n},t.MIN_DIST=50,t.DEFAULT_CELL_W=80,t.DEFAULT_CELL_H=80,t}();return wu.default=e,wu}var OM;function zte(){if(OM)return xu;OM=1;var r=xu&&xu.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(xu,"__esModule",{value:!0});var e=r(Gte());function t(n,i){if(!n.nodes||n.nodes.length===0)return n;var a=i.width,o=i.height,s=i.nodeMinGap,u=1e4,f=1e4;n.nodes.forEach(function(w){var E=w.size[0]||50,S=w.size[1]||50;u=Math.min(E,u),f=Math.min(S,f)});var l=new e.default;l.init(a,o,{CELL_H:f,CELL_W:u}),n.nodes.forEach(function(w){var E=l.occupyNearest(w);E&&(E.node={id:w.id,size:w.size},w.x=E.x,w.y=E.y,w.dx=E.dx,w.dy=E.dy)});for(var c=0;c<n.nodes.length;c++){var h=n.nodes[c],d=l.findGridByNodeId(h.id);if(!d)throw new Error("can not find node cell");var v=d.column,p=d.row;if(h.size[0]+s>u){for(var g=Math.ceil((h.size[0]+s)/u)-1,y=g,m=0;m<g;m++){var x=l.additionColumn.indexOf(v+m+1)>-1;if(x&&!l.cells[v+m+1][p].node)y--;else break}l.insertColumn(v,y)}if(h.size[1]+s>f){for(var g=Math.ceil((h.size[1]+s)/f)-1,y=g,m=0;m<g;m++){var x=l.additionRow.indexOf(p+m+1)>-1;if(x&&!l.cells[v][p+m+1].node)y--;else break}l.insertRow(p,y)}}for(var c=0;c<l.columnNum;c++)for(var b=function(E){var S=l.cells[c][E];if(S.node){var _=n.nodes.find(function(C){var M;return C.id===((M=S==null?void 0:S.node)===null||M===void 0?void 0:M.id)});_&&(_.x=S.x+_.size[0]/2,_.y=S.y+_.size[1]/2)}},m=0;m<l.rowNum;m++)b(m)}return xu.default=t,xu}var Wh={},DM;function jte(){if(DM)return Wh;DM=1,Object.defineProperty(Wh,"__esModule",{value:!0});var r=1200,e=800,t=1e7,n=10,i=3.141592653589793,a=1.5707963267948966,o=i*.375,s=i*.625,u=new Map,f=10,l=10,c=.8,h=.1,d=.5;function v(w,E,S){var _=w.x-w.size[0]/2,C=w.y-w.size[1]/2,M=w.x+w.size[0]/2,A=w.y+w.size[1]/2,T=E.x-E.size[0]/2,I=E.y-E.size[1]/2,L=E.x+E.size[0]/2,N=E.y+E.size[1]/2,O=w.x,B=w.y,W=E.x,D=E.y,P=W-O,R=Math.atan2(P,D-B),X=0,Y=0,ee=0,U=0;R>a?(Y=C-N,X=T-M,ee=parseFloat(Y?(Y/Math.cos(R)).toFixed(2):X.toFixed(2)),U=parseFloat(X?(X/Math.sin(R)).toFixed(2):Y.toFixed(2))):0<R&&R<=a?(Y=I-A,X=T-M,Y>X?ee=U=parseFloat(Y?(Y/Math.cos(R)).toFixed(2):X.toFixed(2)):ee=U=parseFloat(X?(X/Math.sin(R)).toFixed(2):Y.toFixed(2))):R<-a?(Y=C-N,X=-(L-_),Y>X?ee=U=parseFloat(Y?(Y/Math.cos(R)).toFixed(2):X.toFixed(2)):ee=U=parseFloat(X?(X/Math.sin(R)).toFixed(2):Y.toFixed(2))):(Y=I-A,Math.abs(P)>(M-_)/2?X=_-L:X=P,Y>X?ee=U=parseFloat(Y?(Y/Math.cos(R)).toFixed(2):X.toFixed(2)):ee=U=parseFloat(X&&R!==0?(X/Math.sin(R)).toFixed(2):Y.toFixed(2)));var Z=parseFloat(R.toFixed(2)),K=S;return S&&(K=o<Z&&Z<s),{distance:Math.abs(ee<U?ee:U),isHoriz:K}}function p(w,E){var S=u.get(w.id)||[],_=S.find(function(kt){return kt.source===E.id||kt.target===E.id}),C=w.size[0]*w.size[1],M=E.size[0]*E.size[1],A=C>M?E:w,T=C>M?w:E,I=A.x-A.size[0]/2,L=A.y-A.size[1]/2,N=A.x+A.size[0]/2,O=A.y+A.size[1]/2,B=T.x-T.size[0]/2,W=T.y-T.size[1]/2,D=T.x+T.size[0]/2,P=T.y+T.size[1]/2,R=A.x,X=A.y,Y=T.x,ee=T.y,U=N>=B&&D>=I&&O>=W&&P>=L,Z=0,K=0;if(U){K=Math.sqrt(Math.pow(Y-R,2)+Math.pow(ee-X,2));var se=I>B?I:B,re=L>W?L:W,J=N<D?N:D,me=O<P?O:P,Ae=J-se,Ye=me-re,Ve=Ae*Ye;K===0&&(K=1e-7),Z=n*1/K*100+Ve,Z*=t}else{var Ke=!1,xt=v(A,T,Ke);K=xt.distance,Ke=xt.isHoriz,K<=n?K!==0?_?Z+=n+t*1/K:Z+=n+t*n/K:Z+=t:(Z+=K,_&&(Z+=K*K))}return Z}function g(w){for(var E=0,S=0;S<w.length;S++){var _=w[S];(_.x<0||_.y<0||_.x>r||_.y>e)&&(E+=1e12);for(var C=S+1;C<w.length;C++)E+=p(_,w[C])}return E}function y(w,E,S,_){var C=new Map;S.forEach(function(R,X){C.set(R.id,R)});var M=_.filter(function(R){return R.source===w.id||R.target===w.id})||[],A=[];M.forEach(function(R){var X=R.source===w.id?R.target:R.source,Y=C.get(X);Y&&A.push(Y)});for(var T=!0,I=0;I<A.length;I++){var L=A[I],N=Math.atan((w.y-L.y)/(L.x-w.y))*180,O=Math.atan((E.y-L.y)/(L.x-E.y))*180,B=N<30||N>150,W=O<30||O>150,D=N>70&&N<110,P=O>70&&O<110;if(B&&!W||N*O<0){T=!1;break}else if(D&&!P||N*O<0){T=!1;break}else if((L.x-w.x)*(L.x-E.x)<0){T=!1;break}else if((L.y-w.y)*(L.y-E.y)<0){T=!1;break}}return T}function m(w,E){for(var S=!1,_=1,C=f*_,M=l*_,A=[C,-C,0,0],T=[0,0,M,-M],I=0;I<w.length;++I)for(var L=w[I],N=x(L,w),O=0;O<A.length;O++){var B=y(L,{x:L.x+A[O],y:L.y+T[O]},w,E);if(B){L.x+=A[O],L.y+=T[O];var W=x(L,w),D=Math.random();W<N||D<c&&D>h?(N=W,S=!0):(L.x-=A[O],L.y-=T[O])}}return c>h&&(c*=d),S?g(w):0}function x(w,E){var S=0;(w.x<0||w.y<0||w.x+w.size[0]+20>r||w.y+w.size[1]+20>e)&&(S+=1e12);for(var _=0;_<E.length;++_)w.id!==E[_].id&&(S+=p(w,E[_]));return S}function b(w,E){if(w.length===0)return{nodes:w,edges:E};w.forEach(function(L){var N=E.filter(function(O){return O.source===L.id||O.target===L.id});u.set(L,N)}),w.sort(function(L,N){var O,B;return((O=u.get(L.id))===null||O===void 0?void 0:O.length)-((B=u.get(N.id))===null||B===void 0?void 0:B.length)});for(var S=g(w),_=20,C=1,M=0,A=50,T=0;_>0&&(T++,!(T>=A));){var I=m(w,E);I!==0&&(M=I),C=M-S,S=M,C===0?--_:_=20}return w.forEach(function(L){L.x=L.x-L.size[0]/2,L.y=L.y-L.size[1]/2}),{nodes:w,edges:E}}return Wh.default=b,Wh}var PM;function Ute(){if(PM)return Rn;PM=1;var r=Rn&&Rn.__assign||function(){return r=Object.assign||function(l){for(var c,h=1,d=arguments.length;h<d;h++){c=arguments[h];for(var v in c)Object.prototype.hasOwnProperty.call(c,v)&&(l[v]=c[v])}return l},r.apply(this,arguments)},e=Rn&&Rn.__createBinding||(Object.create?function(l,c,h,d){d===void 0&&(d=h);var v=Object.getOwnPropertyDescriptor(c,h);(!v||("get"in v?!c.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return c[h]}}),Object.defineProperty(l,d,v)}:function(l,c,h,d){d===void 0&&(d=h),l[d]=c[h]}),t=Rn&&Rn.__setModuleDefault||(Object.create?function(l,c){Object.defineProperty(l,"default",{enumerable:!0,value:c})}:function(l,c){l.default=c}),n=Rn&&Rn.__importStar||function(l){if(l&&l.__esModule)return l;var c={};if(l!=null)for(var h in l)h!=="default"&&Object.prototype.hasOwnProperty.call(l,h)&&e(c,l,h);return t(c,l),c},i=Rn&&Rn.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Rn,"__esModule",{value:!0});var a=n(u1),o=i(zte()),s=i(jte()),u=d1();function f(l,c){var h=l.nodes,d=l.edges,v=c.width,p=c.height;if(!(h!=null&&h.length))return Promise.resolve();var g=[];h.forEach(function(_){var C=d.filter(function(A){return A.source===_.id||A.target===_.id});if(C.length>1){var M=r({},_);delete M.size,g.push(M)}});var y=[];d.forEach(function(_){var C=g.find(function(A){return A.id===_.source}),M=g.find(function(A){return A.id===_.target});C&&M&&y.push(_)});var m=new u.DagreLayout({type:"dagre",ranksep:c.nodeMinGap,nodesep:c.nodeMinGap}),x=m.layout({nodes:g,edges:y}).nodes;h.forEach(function(_){var C=(x||[]).find(function(M){return M.id===_.id});_.x=(C==null?void 0:C.x)||v/2,_.y=(C==null?void 0:C.y)||p/2});var b=JSON.parse(JSON.stringify(h)),w=JSON.parse(JSON.stringify(d)),E=a.forceSimulation().nodes(b).force("link",a.forceLink(w).id(function(_){return _.id}).distance(function(_){var C=y.find(function(M){return M.source===_.source&&M.target===_.target});return C?30:20})).force("charge",a.forceManyBody()).force("center",a.forceCenter(v/2,p/2)).force("x",a.forceX(v/2)).force("y",a.forceY(p/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),S=new Promise(function(_){E.on("end",function(){h.forEach(function(N){var O=b.find(function(B){return B.id===N.id});O&&(N.x=O.x,N.y=O.y)});var C=Math.min.apply(Math,h.map(function(N){return N.x})),M=Math.max.apply(Math,h.map(function(N){return N.x})),A=Math.min.apply(Math,h.map(function(N){return N.y})),T=Math.max.apply(Math,h.map(function(N){return N.y})),I=v/(M-C),L=p/(T-A);h.forEach(function(N){N.x!==void 0&&I<1&&(N.x=(N.x-C)*I),N.y!==void 0&&L<1&&(N.y=(N.y-A)*L)}),h.forEach(function(N){N.sizeTemp=N.size,N.size=[10,10]}),(0,s.default)(h,d),h.forEach(function(N){N.size=N.sizeTemp||[],delete N.sizeTemp}),(0,o.default)({nodes:h,edges:d},c),_()})});return S}return Rn.default=f,Rn}var RM;function uD(){if(RM)return Da;RM=1;var r=Da&&Da.__extends||function(){var a=function(o,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(u[l]=f[l])},a(o,s)};return function(o,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");a(o,s);function u(){this.constructor=o}o.prototype=s===null?Object.create(s):(u.prototype=s.prototype,new u)}}(),e=Da&&Da.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Da,"__esModule",{value:!0}),Da.ERLayout=void 0;var t=ln(),n=e(Ute()),i=function(a){r(o,a);function o(s){var u=a.call(this)||this;return u.width=300,u.height=300,u.nodeMinGap=50,u.onLayoutEnd=function(){},s&&u.updateCfg(s),u}return o.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},o.prototype.execute=function(){var s=this,u=s.nodes,f=s.edges;return u==null||u.forEach(function(l){l.size||(l.size=[50,50])}),(0,n.default)({nodes:u,edges:f},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){s.onLayoutEnd&&s.onLayoutEnd()})},o.prototype.getType=function(){return"er"},o}(t.Base);return Da.ERLayout=i,Da}var ls={},BM;function $te(){if(BM)return ls;BM=1,Object.defineProperty(ls,"__esModule",{value:!0}),ls.Layouts=ls.Layout=void 0;var r=xL(),e=wL(),t=EL(),n=ML(),i=_L(),a=LL(),o=NL(),s=d1(),u=YO(),f=WO(),l=qO(),c=VO(),h=nD(),d=iD(),v=aD(),p=oD(),g=sD(),y=uD(),m=RO(),x=$r(),b=function(){function w(E){var S=(0,r.getLayoutByName)(E.type);this.layoutInstance=new S(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 S=1/0,_=[];if(E.forEach(function(M){(0,x.isString)(M.layer)&&(M.layer=parseInt(M.layer,10)),!(M.layer===void 0||isNaN(M.layer))&&(_.push(M),M.layer<S&&(S=M.layer))}),S<=0){var C=Math.abs(S)+1;_.forEach(function(M){return M.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 ls.Layout=b,ls.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},ls}var p0={},FM;function Xte(){return FM||(FM=1,Object.defineProperty(p0,"__esModule",{value:!0})),p0}var GM;function fD(){return GM||(GM=1,function(r){var e=Zo&&Zo.__createBinding||(Object.create?function(E,S,_,C){C===void 0&&(C=_);var M=Object.getOwnPropertyDescriptor(S,_);(!M||("get"in M?!S.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return S[_]}}),Object.defineProperty(E,C,M)}:function(E,S,_,C){C===void 0&&(C=_),E[C]=S[_]}),t=Zo&&Zo.__exportStar||function(E,S){for(var _ in E)_!=="default"&&!Object.prototype.hasOwnProperty.call(S,_)&&e(S,E,_)};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=wL();Object.defineProperty(r,"GridLayout",{enumerable:!0,get:function(){return n.GridLayout}});var i=EL();Object.defineProperty(r,"RandomLayout",{enumerable:!0,get:function(){return i.RandomLayout}});var a=_L();Object.defineProperty(r,"GForceLayout",{enumerable:!0,get:function(){return a.GForceLayout}});var o=ML();Object.defineProperty(r,"Force2Layout",{enumerable:!0,get:function(){return o.Force2Layout}});var s=LL();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=d1();Object.defineProperty(r,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var l=RO();Object.defineProperty(r,"DagreCompoundLayout",{enumerable:!0,get:function(){return l.DagreCompoundLayout}});var c=YO();Object.defineProperty(r,"RadialLayout",{enumerable:!0,get:function(){return c.RadialLayout}});var h=WO();Object.defineProperty(r,"ConcentricLayout",{enumerable:!0,get:function(){return h.ConcentricLayout}});var d=qO();Object.defineProperty(r,"MDSLayout",{enumerable:!0,get:function(){return d.MDSLayout}});var v=VO();Object.defineProperty(r,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var p=nD();Object.defineProperty(r,"FruchtermanGPULayout",{enumerable:!0,get:function(){return p.FruchtermanGPULayout}});var g=iD();Object.defineProperty(r,"GForceGPULayout",{enumerable:!0,get:function(){return g.GForceGPULayout}});var y=aD();Object.defineProperty(r,"ComboForceLayout",{enumerable:!0,get:function(){return y.ComboForceLayout}});var m=oD();Object.defineProperty(r,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var x=sD();Object.defineProperty(r,"ForceAtlas2Layout",{enumerable:!0,get:function(){return x.ForceAtlas2Layout}});var b=uD();Object.defineProperty(r,"ERLayout",{enumerable:!0,get:function(){return b.ERLayout}});var w=$te();Object.defineProperty(r,"Layout",{enumerable:!0,get:function(){return w.Layout}}),Object.defineProperty(r,"Layouts",{enumerable:!0,get:function(){return w.Layouts}}),t(Xte(),r)}(Zo)),Zo}var zM;function Yte(){return zM||(zM=1,function(r){var e=qo&&qo.__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=qo&&qo.__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=xL();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(fD(),r)}(qo)),qo}var nr=Yte(),g0,jM;function Lo(){if(jM)return g0;jM=1;function r(e,t,n,i){return i===void 0&&(i="height"),n==="center"?(e[i]+t[i])/2:e.height}return g0={assign:Object.assign,getHeight:r},g0}var y0,UM;function lD(){if(UM)return y0;UM=1;var r=Lo(),e=18,t=e*2,n=e,i={getId:function(u){return u.id||u.name},getPreH:function(u){return u.preH||0},getPreV:function(u){return u.preV||0},getHGap:function(u){return u.hgap||n},getVGap:function(u){return u.vgap||n},getChildren:function(u){return u.children},getHeight:function(u){return u.height||t},getWidth:function(u){var f=u.label||" ";return u.width||f.split("").length*e}};function a(s,u){var f=this;if(f.vgap=f.hgap=0,s instanceof a)return s;f.data=s;var l=u.getHGap(s),c=u.getVGap(s);return f.preH=u.getPreH(s),f.preV=u.getPreV(s),f.width=u.getWidth(s),f.height=u.getHeight(s),f.width+=f.preH,f.height+=f.preV,f.id=u.getId(s),f.x=f.y=0,f.depth=0,f.children||(f.children=[]),f.addGap(l,c),f}r.assign(a.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(u,f){var l=this;l.hgap+=u,l.vgap+=f,l.width+=2*u,l.height+=2*f},eachNode:function(u){for(var f=this,l=[f],c;c=l.shift();)u(c),l=c.children.concat(l)},DFTraverse:function(u){this.eachNode(u)},BFTraverse:function(u){for(var f=this,l=[f],c;c=l.shift();)u(c),l=l.concat(c.children)},getBoundingBox:function(){var u={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(f){u.left=Math.min(u.left,f.x),u.top=Math.min(u.top,f.y),u.width=Math.max(u.width,f.x+f.width),u.height=Math.max(u.height,f.y+f.height)}),u},translate:function(u,f){u===void 0&&(u=0),f===void 0&&(f=0),this.eachNode(function(l){l.x+=u,l.y+=f,l.x+=l.preH,l.y+=l.preV})},right2left:function(){var u=this,f=u.getBoundingBox();u.eachNode(function(l){l.x=l.x-(l.x-f.left)*2-l.width}),u.translate(f.width,0)},bottom2top:function(){var u=this,f=u.getBoundingBox();u.eachNode(function(l){l.y=l.y-(l.y-f.top)*2-l.height}),u.translate(0,f.height)}});function o(s,u,f){u===void 0&&(u={}),u=r.assign({},i,u);var l=new a(s,u),c=[l],h;if(!f&&!s.collapsed){for(;h=c.shift();)if(!h.data.collapsed){var d=u.getChildren(h.data),v=d?d.length:0;if(h.children=new Array(v),d&&v)for(var p=0;p<v;p++){var g=new a(d[p],u);h.children[p]=g,c.push(g),g.parent=h,g.depth=h.depth+1}}}return l}return y0=o,y0}var m0,$M;function Kv(){if($M)return m0;$M=1;var r=lD(),e=function(){function t(i,a){a===void 0&&(a={});var o=this;o.options=a,o.rootNode=r(i,a)}var n=t.prototype;return n.execute=function(){throw new Error("please override this method")},t}();return m0=e,m0}var b0,XM;function Wte(){if(XM)return b0;XM=1;function r(o,s,u,f){f===void 0&&(f=[]);var l=this;l.w=o||0,l.h=s||0,l.y=u||0,l.x=0,l.c=f||[],l.cs=f.length,l.prelim=0,l.mod=0,l.shift=0,l.change=0,l.tl=null,l.tr=null,l.el=null,l.er=null,l.msel=0,l.mser=0}r.fromNode=function(o,s){if(!o)return null;var u=[];return o.children.forEach(function(f){u.push(r.fromNode(f,s))}),s?new r(o.height,o.width,o.x,u):new r(o.width,o.height,o.y,u)};function e(o,s,u){u?o.y+=s:o.x+=s,o.children.forEach(function(f){e(f,s,u)})}function t(o,s){var u=s?o.y:o.x;return o.children.forEach(function(f){u=Math.min(t(f,s),u)}),u}function n(o,s){var u=t(o,s);e(o,-u,s)}function i(o,s,u){u?s.y=o.x:s.x=o.x,o.c.forEach(function(f,l){i(f,s.children[l],u)})}function a(o,s,u){u===void 0&&(u=0),s?(o.x=u,u+=o.width):(o.y=u,u+=o.height),o.children.forEach(function(f){a(f,s,u)})}return b0=function(o,s){s===void 0&&(s={});var u=s.isHorizontal;function f(_){if(_.cs===0){l(_);return}f(_.c[0]);for(var C=E(p(_.c[0].el),0,null),M=1;M<_.cs;++M){f(_.c[M]);var A=p(_.c[M].er);c(_,M,C),C=E(A,M,C)}m(_),l(_)}function l(_){_.cs===0?(_.el=_,_.er=_,_.msel=_.mser=0):(_.el=_.c[0].el,_.msel=_.c[0].msel,_.er=_.c[_.cs-1].er,_.mser=_.c[_.cs-1].mser)}function c(_,C,M){for(var A=_.c[C-1],T=A.mod,I=_.c[C],L=I.mod;A!==null&&I!==null;){p(A)>M.low&&(M=M.nxt);var N=T+A.prelim+A.w-(L+I.prelim);N>0&&(L+=N,h(_,C,M.index,N));var O=p(A),B=p(I);O<=B&&(A=v(A),A!==null&&(T+=A.mod)),O>=B&&(I=d(I),I!==null&&(L+=I.mod))}!A&&I?g(_,C,I,L):A&&!I&&y(_,C,A,T)}function h(_,C,M,A){_.c[C].mod+=A,_.c[C].msel+=A,_.c[C].mser+=A,b(_,C,M,A)}function d(_){return _.cs===0?_.tl:_.c[0]}function v(_){return _.cs===0?_.tr:_.c[_.cs-1]}function p(_){return _.y+_.h}function g(_,C,M,A){var T=_.c[0].el;T.tl=M;var I=A-M.mod-_.c[0].msel;T.mod+=I,T.prelim-=I,_.c[0].el=_.c[C].el,_.c[0].msel=_.c[C].msel}function y(_,C,M,A){var T=_.c[C].er;T.tr=M;var I=A-M.mod-_.c[C].mser;T.mod+=I,T.prelim-=I,_.c[C].er=_.c[C-1].er,_.c[C].mser=_.c[C-1].mser}function m(_){_.prelim=(_.c[0].prelim+_.c[0].mod+_.c[_.cs-1].mod+_.c[_.cs-1].prelim+_.c[_.cs-1].w)/2-_.w/2}function x(_,C){C+=_.mod,_.x=_.prelim+C,w(_);for(var M=0;M<_.cs;M++)x(_.c[M],C)}function b(_,C,M,A){if(M!==C-1){var T=C-M;_.c[M+1].shift+=A/T,_.c[C].shift-=A/T,_.c[C].change-=A-A/T}}function w(_){for(var C=0,M=0,A=0;A<_.cs;A++)C+=_.c[A].shift,M+=C+_.c[A].change,_.c[A].mod+=M}function E(_,C,M){for(;M!==null&&_>=M.low;)M=M.nxt;return{low:_,index:C,nxt:M}}a(o,u);var S=r.fromNode(o,u);return f(S),x(S,0),i(S,o,u),n(o,u),o},b0}var x0,YM;function cD(){if(YM)return x0;YM=1;var r=lD();return x0=function(e,t){for(var n=r(e.data,t,!0),i=r(e.data,t,!0),a=e.children.length,o=Math.round(a/2),s=t.getSide||function(c,h){return h<o?"right":"left"},u=0;u<a;u++){var f=e.children[u],l=s(f,u);l==="right"?i.children.push(f):n.children.push(f)}return n.eachNode(function(c){c.isRoot()||(c.side="left")}),i.eachNode(function(c){c.isRoot()||(c.side="right")}),{left:n,right:i}},x0}var w0,WM;function R1(){if(WM)return w0;WM=1;var r=cD(),e=["LR","RL","TB","BT","H","V"],t=["LR","RL","H"],n=function(o){return t.indexOf(o)>-1},i=e[0];return w0=function(a,o,s){var u=o.direction||i;if(o.isHorizontal=n(u),u&&e.indexOf(u)===-1)throw new TypeError("Invalid direction: "+u);if(u===e[0])s(a,o);else if(u===e[1])s(a,o),a.right2left();else if(u===e[2])s(a,o);else if(u===e[3])s(a,o),a.bottom2top();else if(u===e[4]||u===e[5]){var f=r(a,o),l=f.left,c=f.right;s(l,o),s(c,o),o.isHorizontal?l.right2left():l.bottom2top(),c.translate(l.x-c.x,l.y-c.y),a.x=l.x,a.y=c.y;var h=a.getBoundingBox();o.isHorizontal?h.top<0&&a.translate(0,-h.top):h.left<0&&a.translate(-h.left,0)}var d=o.fixedRoot;return d===void 0&&(d=!0),d&&a.translate(-(a.x+a.width/2+a.hgap),-(a.y+a.height/2+a.vgap)),a},w0}var E0,qM;function qte(){if(qM)return E0;qM=1;function r(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,e(f,l)}function e(f,l){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,d){return h.__proto__=d,h},e(f,l)}var t=Kv(),n=Wte(),i=R1(),a=Lo(),o=function(f){function l(){return f.apply(this,arguments)||this}r(l,f);var c=l.prototype;return c.execute=function(){var d=this;return i(d.rootNode,d.options,n)},l}(t),s={};function u(f,l){return l=a.assign({},s,l),new o(f,l).execute()}return E0=u,E0}var _0,VM;function Vte(){if(VM)return _0;VM=1;var r=Lo();function e(i,a){a===void 0&&(a=[]);var o=this;o.x=o.y=0,o.leftChild=o.rightChild=null,o.height=0,o.children=a}var t={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function n(i,a,o){o?(a.x=i.x,a.y=i.y):(a.x=i.y,a.y=i.x),i.children.forEach(function(s,u){n(s,a.children[u],o)})}return _0=function(i,a){a===void 0&&(a={}),a=r.assign({},t,a);var o=0;function s(h){if(!h)return null;h.width=0,h.depth&&h.depth>o&&(o=h.depth);var d=h.children,v=d.length,p=new e(h.height,[]);return d.forEach(function(g,y){var m=s(g);p.children.push(m),y===0&&(p.leftChild=m),y===v-1&&(p.rightChild=m)}),p.originNode=h,p.isLeaf=h.isLeaf(),p}function u(h){if(h.isLeaf||h.children.length===0)h.drawingDepth=o;else{var d=h.children.map(function(p){return u(p)}),v=Math.min.apply(null,d);h.drawingDepth=v-1}return h.drawingDepth}var f;function l(h){h.x=h.drawingDepth*a.rankSep,h.isLeaf?(h.y=0,f&&(h.y=f.y+f.height+a.nodeSep,h.originNode.parent!==f.originNode.parent&&(h.y+=a.subTreeSep)),f=h):(h.children.forEach(function(d){l(d)}),h.y=(h.leftChild.y+h.rightChild.y)/2)}var c=s(i);return u(c),l(c),n(c,i,a.isHorizontal),i},_0}var S0,HM;function Hte(){if(HM)return S0;HM=1;function r(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,e(f,l)}function e(f,l){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,d){return h.__proto__=d,h},e(f,l)}var t=Kv(),n=Vte(),i=R1(),a=Lo(),o=function(f){function l(){return f.apply(this,arguments)||this}r(l,f);var c=l.prototype;return c.execute=function(){var d=this;return d.rootNode.width=0,i(d.rootNode,d.options,n)},l}(t),s={};function u(f,l){return l=a.assign({},s,l),new o(f,l).execute()}return S0=u,S0}var M0,ZM;function Zte(){if(ZM)return M0;ZM=1;var r=Lo();function e(t,n,i,a,o){var s=typeof i=="function"?i(t):i*t.depth;if(!a)try{if(t.id===t.parent.children[0].id){t.x+=s,t.y=n?n.y:0;return}}catch{}if(t.x+=s,n){if(t.y=n.y+r.getHeight(n,t,o),n.parent&&t.parent.id!==n.parent.id){var u=n.parent,f=u.y+r.getHeight(u,t,o);t.y=f>t.y?f:t.y}}else t.y=0}return M0=function(t,n,i,a){var o=null;t.eachNode(function(s){e(s,o,n,i,a),o=s})},M0}var C0,KM;function Kte(){if(KM)return C0;KM=1;function r(c,h){c.prototype=Object.create(h.prototype),c.prototype.constructor=c,e(c,h)}function e(c,h){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(v,p){return v.__proto__=p,v},e(c,h)}var t=Kv(),n=Zte(),i=cD(),a=Lo(),o=["LR","RL","H"],s=o[0],u=function(c){function h(){return c.apply(this,arguments)||this}r(h,c);var d=h.prototype;return d.execute=function(){var p=this,g=p.options,y=p.rootNode;g.isHorizontal=!0;var m=g.indent,x=m===void 0?20:m,b=g.dropCap,w=b===void 0?!0:b,E=g.direction,S=E===void 0?s:E,_=g.align;if(S&&o.indexOf(S)===-1)throw new TypeError("Invalid direction: "+S);if(S===o[0])n(y,x,w,_);else if(S===o[1])n(y,x,w,_),y.right2left();else if(S===o[2]){var C=i(y,g),M=C.left,A=C.right;n(M,x,w,_),M.right2left(),n(A,x,w,_);var T=M.getBoundingBox();A.translate(T.width,0),y.x=A.x-y.width/2}return y},h}(t),f={};function l(c,h){return h=a.assign({},f,h),new u(c,h).execute()}return C0=l,C0}var A0,QM;function Qte(){if(QM)return A0;QM=1;var r=Lo();function e(i,a){var o=0;return i.children.length?i.children.forEach(function(s){o+=e(s,a)}):o=i.height,i._subTreeSep=a.getSubTreeSep(i.data),i.totalHeight=Math.max(i.height,o)+2*i._subTreeSep,i.totalHeight}function t(i){var a=i.children,o=a.length;if(o){a.forEach(function(h){t(h)});var s=a[0],u=a[o-1],f=u.y-s.y+u.height,l=0;if(a.forEach(function(h){l+=h.totalHeight}),f>i.height)i.y=s.y+f/2-i.height/2;else if(a.length!==1||i.height>l){var c=i.y+(i.height-f)/2-s.y;a.forEach(function(h){h.translate(0,c)})}else i.y=(s.y+s.height/2+u.y+u.height/2)/2-i.height/2}}var n={getSubTreeSep:function(){return 0}};return A0=function(i,a){a===void 0&&(a={}),a=r.assign({},n,a),i.parent={x:0,width:0,height:0,y:0},i.BFTraverse(function(o){o.x=o.parent.x+o.parent.width}),i.parent=null,e(i,a),i.startY=0,i.y=i.totalHeight/2-i.height/2,i.eachNode(function(o){var s=o.children,u=s.length;if(u){var f=s[0];if(f.startY=o.startY+o._subTreeSep,u===1)f.y=o.y+o.height/2-f.height/2;else{f.y=f.startY+f.totalHeight/2-f.height/2;for(var l=1;l<u;l++){var c=s[l];c.startY=s[l-1].startY+s[l-1].totalHeight,c.y=c.startY+c.totalHeight/2-c.height/2}}}}),t(i)},A0}var T0,JM;function Jte(){if(JM)return T0;JM=1;function r(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,e(f,l)}function e(f,l){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,d){return h.__proto__=d,h},e(f,l)}var t=Kv(),n=Qte(),i=R1(),a=Lo(),o=function(f){function l(){return f.apply(this,arguments)||this}r(l,f);var c=l.prototype;return c.execute=function(){var d=this;return i(d.rootNode,d.options,n)},l}(t),s={};function u(f,l){return l=a.assign({},s,l),new o(f,l).execute()}return T0=u,T0}var I0,eC;function ere(){if(eC)return I0;eC=1;var r={compactBox:qte(),dendrogram:Hte(),indented:Kte(),mindmap:Jte()};return I0=r,I0}var tre=ere();const uv=va(tre);var tC=Sn.traverseTree,rre=function(e,t){var n;return e?dt(e)?n=function(a){return e}:n=e:n=function(a){return t||1},n},nre=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}},ire=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}},are=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}},ore=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}},sre=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)},ure=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;tC(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||tC(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 fre=Object.freeze(Object.defineProperty({__proto__:null,arrayToTextureData:sre,attributesToTextureData:ore,buildTextureData:nre,buildTextureDataWithOneEdgeAttr:ire,buildTextureDataWithTwoEdgeAttr:are,proccessToFunc:rre,radialLayout:ure},Symbol.toStringTag,{value:"Module"}));var hD=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(`
|
|
480
|
+
`):['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(`
|
|
481
|
+
`)),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 lre=Object.freeze(Object.defineProperty({__proto__:null,gpuDetector:hD},Symbol.toStringTag,{value:"Module"}));var dD=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 cre=Object.freeze(Object.defineProperty({__proto__:null,getBrowserName:dD},Symbol.toStringTag,{value:"Module"}));var Va=z(z(z(z(z({},Sn),w7),fre),lre),cre),hre=Va.radialLayout,dre=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=uv[t.type](n,t.config);return hre(i),i};return}this.layoutMethod=function(n){return uv[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}();nr.registerLayout("grid",nr.GridLayout);nr.registerLayout("random",nr.RandomLayout);nr.registerLayout("force",nr.ForceLayout);nr.registerLayout("circular",nr.CircularLayout);nr.registerLayout("dagre",nr.DagreLayout);nr.registerLayout("dagreCompound",nr.DagreCompoundLayout);nr.registerLayout("radial",nr.RadialLayout);nr.registerLayout("concentric",nr.ConcentricLayout);nr.registerLayout("mds",nr.MDSLayout);nr.registerLayout("fruchterman",nr.FruchtermanLayout);nr.registerLayout("fruchterman-gpu",nr.FruchtermanGPULayout);nr.registerLayout("gForce",nr.GForceLayout);nr.registerLayout("force2",nr.Force2Layout);nr.registerLayout("gForce-gpu",nr.GForceGPULayout);nr.registerLayout("comboForce",nr.ComboForceLayout);nr.registerLayout("comboCombined",nr.ComboCombinedLayout);nr.registerLayout("forceAtlas2",nr.ForceAtlas2Layout);var vre=function(e,t){t.isCustomLayout=!0,nr.Layouts[e]=nr.registerLayout(e,t)},pre=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}(),gre=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,x=m.nodes,h=m.edges,b=m.layoutCfg,v=b===void 0?{}:b,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:x,edges:h}),E.executeWithWorker(w,this);break}}}onmessage=function(u){a(u)&&o(u)}}var n=new pre(t,e);return n},Eu={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function Vy(r){"@babel/helpers - typeof";return Vy=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},Vy(r)}var rC=function(e){return setTimeout(e,16)},nC=function(e){return clearTimeout(e)},qh={requestAnimationFrame:function(e){var t=typeof window<"u"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||rC;return t(e)},cancelAnimationFrame:function(e){var t=typeof window<"u"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||nC;return t(e)}},yre=["fruchterman","gForce"],mre=["force","grid","circular"],bre=function(r){Rt(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=gre(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(qh.cancelAnimationFrame(t.requestId),t.requestId=null),t.requestId2&&(qh.cancelAnimationFrame(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Vn(i,void 0,void 0,function(){var s,u,f,l,c,p,h,d,v,p,g;return Hn(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&&(vD(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),Sn.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 nr.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),Ere(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 Vn(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Hn(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()},Sn.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=iC(c,h);var y=c.onLayoutEnd,m=c.layoutEndFormatted,x=c.adjust;if(m||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Vn(n,void 0,void 0,function(){return Hn(this,function(w){switch(w.label){case 0:return y&&y(s),this.refreshLayout(),x&&c.pipes?[4,this.adjustPipesBox(this.data,x)]:[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 b=!1;return c.type?(b=!0,p=p.then(function(){return Vn(n,void 0,void 0,function(){return Hn(this,function(w){switch(w.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,w.sent()]}})})})):c.pipes&&(b=!0,c.pipes.forEach(function(w,E){p=p.then(function(){return Vn(n,void 0,void 0,function(){return Hn(this,function(S){switch(S.label){case 0:return[4,this.execLayoutMethod(w,E)];case 1:return[2,S.sent()]}})})})})),b?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 Vn(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Hn(this,function(v){switch(v.label){case 0:return s=this,u=s.layoutCfg,f=s.data,l=u.preset,!(l!=null&&l.type)||!nr.Layouts[l==null?void 0:l.type]?(n==null||n(),a(),[2,!1]):(c=iC(l,l.type),h=c?"".concat(l.type,"-gpu"):l.type,d=new nr.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=xre(i,function(v){return typeof v!="function"});if(!c)t.postMessage({type:Eu.RUN,nodes:u,edges:f,layoutCfg:h});else{var d=l.transferControlToOffscreen();h.type="".concat(h.type,"-gpu"),t.postMessage({type:Eu.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 Eu.TICK:f.currentTick=l.currentTick,f.currentTickData=l,f.requestId||(f.requestId=qh.requestAnimationFrame(function(){k0(a,l),u.refreshPositions(),h(),l.currentTick===l.totalTicks?t():f.currentTick===l.totalTicks&&(f.requestId2=qh.requestAnimationFrame(function(){k0(a,f.currentTickData),u.refreshPositions(),f.requestId2=null,h(),t()})),f.requestId=null}));break;case Eu.END:f.currentTick==null&&(k0(a,l),t());break;case Eu.GPUEND:f.currentTick==null&&(wre(a,l),t());break;case Eu.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=un(t,["disableTriggerLayout"]),f=bt({},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 Vn(n,void 0,void 0,function(){return Hn(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 Vn(n,void 0,void 0,function(){return Hn(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(),mre.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=Jt(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),x=d.y-((g=c[v])===null||g===void 0?void 0:g.y);(y=f[v])===null||y===void 0||y.forEach(function(b){b.x+=m,b.y+=x})}),a()};var h=new nr.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}(Pk);function k0(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 xre(r,e){var t={};return r&&Vy(r)==="object"?(Object.keys(r).forEach(function(n){r.hasOwnProperty(n)&&e(r[n])&&(t[n]=r[n])}),t):r}function wre(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 Ere(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 vD(r){return yre.includes(r)}function iC(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,hD().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),n=!1)),n&&!vD(t)&&(console.warn("The '".concat(t,"' layout does not support GPU calculation for now, it will run in CPU.")),n=!1),n}var aC=vi,_re="svg",pD=function(r){Rt(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 bre(this);this.set({layoutController:t})},e.prototype.initEventController=function(){var t=new T7(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===_re)u=new yl({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 Fa(f)}this.set("canvas",u)},e.prototype.initPlugins=function(){var t=this;_e(t.get("plugins"),function(n){!n.destroyed&&n.initPlugin&&n.initPlugin(t)})},e.prototype.downloadImageWatermark=function(t,n,i,a){return Vn(this,void 0,void 0,function(){var o,s,u;return Hn(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 Vn(u,void 0,void 0,function(){var v,p,g,y,m,x,b,w,E,S;return Hn(this,function(_){switch(_.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,x=h.getContext("2d"),b=a||this.get("width"),w=o||this.get("height"),E=void 0,f?[4,this.downloadImageWatermark(f,x,b,w)]:[3,3];case 2:_.sent(),_.label=3;case 3:if(n){S=typeof window<"u"?window.devicePixelRatio:1;try{m=x.getImageData(0,0,b*S,w*S),E=x.globalCompositeOperation,x.globalCompositeOperation="destination-over",x.fillStyle=n,x.fillRect(0,0,b,w)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}d=h.toDataURL(t),n&&(x.clearRect(0,0,b,w),x.putImageData(m,0,0),x.globalCompositeOperation=E),_.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=Or('<div id="virtual-image"></div>'),l=i?i.backgroundColor:void 0,c=i?i.padding:void 0;c?dt(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 yl(v):new Fa(v),g=this.get("group"),y=g.clone(),m=Jt(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var x=(a.maxX+a.minX)/2,b=(a.maxY+a.minY)/2;m=aC(m,[["t",-x,-b],["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 S=w.cloneNode(!0),_=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",_);C.replaceChild(S,C.documentElement);var M=new XMLSerializer().serializeToString(C);E="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(M))}else{var A=void 0,T=w.getContext("2d"),I=void 0;if(l){var L=typeof window<"u"?window.devicePixelRatio:1;try{A=T.getImageData(0,0,d*L,h*L),I=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=I)}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=Or('<div id="virtual-image"></div>'),c=document.querySelector(".g6-graph-watermarker"),h=i?i.backgroundColor:void 0,d=i?i.padding:void 0;d?dt(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 x={container:l,height:v,width:p},b=f==="svg"?new yl(x):new Fa(x),w=this.get("group"),E=S7(w),S=Jt(E.getMatrix());S||(S=[1,0,0,0,1,0,0,0,1]);var _=(o.maxX+o.minX)/2,C=(o.maxY+o.minY)/2;S=aC(S,[["t",-_,-C],["t",u/2+d[3],s/2+d[0]]]),E.resetMatrix(),E.setMatrix(S),b.add(E);var M=b.get("el");n||(n="image/png"),this.asyncToDataUrl(n,h,function(A){var T=document.createElement("a"),I=(t||"graph")+(f==="svg"?".svg":".".concat(n.split("/")[1]));a.dataURLToImage(A,f,T,I);var L=document.createEvent("MouseEvents");L.initEvent("click",!1,!1),T.dispatchEvent(L)},p,v,M)},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":".".concat(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=_s.waterMarkerImage);var i=this.get("container");Fe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=Tr({},_s.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 Fa(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 x=document.querySelector(".g6-graph-watermarker");x||(x=document.createElement("div"),x.className="g6-graph-watermarker"),x.className="g6-graph-watermarker",a.destroyed||(x.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(x))}}},e.prototype.setTextWaterMarker=function(t,n){var i=this.get("container");Fe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=Tr({},_s.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 Fa(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,x=l.baseline,b=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=x;for(var S=Fe(t)?[t]:t,_=S.length-1;_>=0;_--)v.fillText(S[_],b,w+_*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;_e(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}(Lk);function Hy(r){"@babel/helpers - typeof";return Hy=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},Hy(r)}function gD(r,e){if(e===void 0&&(e=new WeakMap),r===null)return r;if(r instanceof Date)return new Date(r);if(r instanceof RegExp)return new RegExp(r);if(Hy(r)!=="object")return r;if(e.get(r))return e.get(r);var t=Array.isArray(r)?[]:{};e.set(r,t);for(var n in r)r.hasOwnProperty(n)&&r[n]!==void 0&&(t[n]=gD(r[n],e));return t}function Sre(r){try{return structuredClone(r)}catch{return gD(r)}}var Mre=Va.radialLayout,L0=Va.traverseTree,Cre=function(r){Rt(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=uv[t.type](n,t);return Mre(i),i}:function(n){return uv[t.type](n,t)}):null},e.indexOfChild=function(t,n){var i=-1;return _e(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 _e(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}_e(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(_e(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=Jt(i.get("data"));var f={};L0(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,L0(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}),Fe(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 _e(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){L0(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}),_e(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(){_e(i.getNodes(),function(s){s.set("originAttrs",null)}),_e(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||!wn(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",Sre(t))},e}(pD),$n=function(){function r(e){this._cfgs=Tr(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={};_e(n,function(a,o){var s=gs(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;_e(t,function(n,i){e.off(i,n)}),this._events=null,this._cfgs=null,this.destroyed=!0},r}(),Are=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)}}(),oC="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Tre=function(r){Are(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{img:oC,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")||oC;a.includes("url(")||(a='url("'.concat(a,'")'));var o=Or(`<div class='g6-grid-container' style="position:absolute;overflow:hidden;z-index: -1;"></div>`),s=Or(`<div
|
|
482
|
+
class='g6-grid'
|
|
483
|
+
style='position:absolute;
|
|
484
|
+
background-image: `.concat(a,`;
|
|
485
|
+
user-select: none
|
|
486
|
+
'></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");Qt(this.get("container"),{width:"".concat(i,"px"),height:"".concat(a,"px")});var o=i*80/n,s=a*80/n;Qt(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",")");Qt(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}($n),Vh={exports:{}},sC;function Ire(){if(sC)return Vh.exports;sC=1;var r=[],e=[],t="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function n(a,o){if(o=o||{},a===void 0)throw new Error(t);var s=o.prepend===!0?"prepend":"append",u=o.container!==void 0?o.container:document.querySelector("head"),f=r.indexOf(u);f===-1&&(f=r.push(u)-1,e[f]={});var l;return e[f]!==void 0&&e[f][s]!==void 0?l=e[f][s]:(l=e[f][s]=i(),s==="prepend"?u.insertBefore(l,u.childNodes[0]):u.appendChild(l)),a.charCodeAt(0)===65279&&(a=a.substr(1,a.length)),l.styleSheet?l.styleSheet.cssText+=a:l.textContent+=a,l}function i(){var a=document.createElement("style");return a.setAttribute("type","text/css"),a}return Vh.exports=n,Vh.exports.insertCss=n,Vh.exports}var kre=Ire();const Qv=va(kre);var Lre=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"&&Qv(`
|
|
487
|
+
.g6-component-contextmenu {
|
|
488
|
+
border: 1px solid #e2e2e2;
|
|
489
|
+
border-radius: 4px;
|
|
490
|
+
font-size: 12px;
|
|
491
|
+
color: #545454;
|
|
492
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
493
|
+
padding: 10px 8px;
|
|
494
|
+
box-shadow: rgb(174, 174, 174) 0px 0px 10px;
|
|
495
|
+
}
|
|
496
|
+
.g6-contextmenu-ul {
|
|
497
|
+
padding: 0;
|
|
498
|
+
margin: 0;
|
|
499
|
+
list-style: none;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
`);var Nre=function(r){Lre(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`
|
|
503
|
+
<ul class='g6-contextmenu-ul'>
|
|
504
|
+
<li>菜单项1</li>
|
|
505
|
+
<li>菜单项2</li>
|
|
506
|
+
</ul>
|
|
507
|
+
`},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=Or("<div class=".concat(t||"g6-component-contextmenu","></div>"));Qt(n,{top:"0px",position:"absolute",visibility:"hidden"});var i=this.get("container");i||(i=this.get("graph").get("container")),Fe(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);Fe(f)?o.innerHTML=f:o.innerHTML=f.outerHTML,this.removeMenuEventListener();var l=this.get("handleMenuClick");if(l){var c=function(_){l(_.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,x=t.canvasX+m+p,b=t.canvasY+y+g;x+v.width>h&&(x=t.canvasX-v.width-p+m),b+v.height>d&&(b=t.canvasY-v.height-g+y),b<0&&(b=0),Qt(o,{top:"".concat(b,"px"),left:"".concat(x,"px"),visibility:"visible"});var w=this.get("trigger")==="click",E=function(_){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&&Qt(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")),Fe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}($n),Ore=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)}}(),Zy=function(){return Zy=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},Zy.apply(this,arguments)},uC=Math.max,Dre=vi,Pre="default",Rre="keyShape",Bre="delegate",fC="svg",Fre=function(r){Ore(e,r);function e(t){var n=r.call(this,t)||this;return n.handleUpdateCanvas=Kl(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=Or(`
|
|
508
|
+
<div
|
|
509
|
+
class=`.concat(n.viewportClassName,`
|
|
510
|
+
style='position:absolute;
|
|
511
|
+
left:0;
|
|
512
|
+
top:0;
|
|
513
|
+
box-sizing:border-box;
|
|
514
|
+
outline: 2px solid #1980ff;
|
|
515
|
+
cursor:move'
|
|
516
|
+
draggable=`).concat(!(f||u),`
|
|
517
|
+
</div>`)),c=0,h=0,d=!1,v=0,p=0,g=0,y=0,m=0,x=0,b=f||u?"mousedown":"dragstart";l.addEventListener(b,function(_){var C,M;if(_.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",(M=(C=_.dataTransfer).setDragImage)===null||M===void 0||M.call(C,A,0,0);try{_.dataTransfer.setData("text/html","view-port-minimap")}catch{_.dataTransfer.setData("text","view-port-minimap")}}if(n.refresh=!1,_.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])&&(x=a.getZoom(),m=t.get("ratio"),d=!0,c=_.clientX,h=_.clientY)}},!1);var w=function(C){if(!(!d||ht(C.clientX)||ht(C.clientY))){var M=c-C.clientX,A=h-C.clientY;(v-M<0||v-M+g>=i[0])&&(M=0),(p-A<0||p-A+y>=i[1])&&(A=0),v-=M,p-=A,Qt(l,{left:"".concat(v,"px"),top:"".concat(p,"px")}),a.translate(M*x/m,A*x/m),c=C.clientX,h=C.clientY}};!f&&!u&&l.addEventListener("drag",w,!1);var E=function(){d=!1,n.refresh=!0},S=f||u?"mouseup":"dragend";l.addEventListener(S,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 x="".concat(p,"px"),b="".concat(g,"px");Qt(h,{left:x,top:b,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===fC&&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")||_e(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),_e(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||(_e(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")||_e(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),_e(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||(_e(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:Zy({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=Or("<div class='".concat(a,"' style='width: ").concat(i[0],"px; height: ").concat(i[1],"px; overflow: hidden'></div>"));Fe(o)&&(o=document.getElementById(o)),o?o.appendChild(s):n.get("container").appendChild(s),t.set("container",s);var u=Or('<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===fC?f=new yl({container:u,width:i[0],height:i[1]}):f=new Fa({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 Pre:this.updateGraphShapes();break;case Rre:this.updateKeyShapes();break;case Bre: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=uC(f.width,h),d=uC(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,x=(i[1]-(d-2*s)*v)/2;p=Dre(p,[["t",g,y],["s",v,v],["t",m,x]]),u.setMatrix(p),this.set("ratio",v),this.set("totaldx",m+g*v),this.set("totaldy",x+y*v),this.set("dx",m),this.set("dy",x),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}($n),Gre=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 ta(r,e,t){var n=r.x-e.x,i=r.y-e.y;return Math.sqrt(n*n+i*i)}function zre(r,e){return r.x*e.x+r.y*e.y}function lC(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 jre=function(r){Gre(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(b){(b.x===null||!b.y===null||b.x===void 0||!b.y===void 0)&&(s=!0),o[b.id]=b}),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(S,_){if(S.source!==S.target){var C=o[S.source],M=o[S.target];E[_]=n.getEdgeForces({source:C,target:M},_,u,p);for(var A=0;A<u+1;A++)l[_][A].x+=E[_][A].x,l[_][A].y+=E[_][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(b,w){b.source!==b.target&&(b.type="polyline",b.controlPoints=l[w].slice(1,l[w].length-1))});var x=n.get("graph");x.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=ta({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=ta(g,o[u][y-1]);m>v;){var x=v/m,b={x:o[u][y-1].x,y:o[u][y-1].y};b.x+=x*(g.x-o[u][y-1].x),b.y+=x*(g.y-o[u][y-1].y),p.push(b),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+=ta(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=ta({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),n.length=ta({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=zre({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=ta(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=lC(n.source,t),a=lC(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*ta(o,s)/ta(i,a))},e.prototype.getEdgeForces=function(t,n,i,a){for(var o=this,s=o.get("edgePoints"),u=o.get("K"),f=u/(ta(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=ta(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}($n),Ure=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)}}(),Ky=function(){return Ky=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},Ky.apply(this,arguments)},Hh=.05,cC={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},$re=function(r){Ure(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:Jt(cC),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-Hh:a=1/(1-Hh);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-Hh:o=1/(1-Hh);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(),x=m.x,b=m.y;if(!(isNaN(x)||isNaN(b))){var w=(x-p.x)*(x-p.x)+(b-p.y)*(b-p.y);if(!isNaN(w)&&w<l&&w!==0){var E=Math.sqrt(w),S=h*E/(c*E+f),_=(x-p.x)/E,C=(b-p.y)/E;if(m.x=_*S+p.x,m.y=C*S+p.y,s[m.id]||(s[m.id]={x,y:b,texts:[]}),o.push(m),u&&2*E<f)for(var M=d[y],A=M.getContainer(),T=A.getChildren(),I=T.length,L=0;L<I;L++){var N=T[L];N.get("type")==="text"&&(s[m.id].texts.push({visible:N.get("visible"),shape:N}),N.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")||cC;s=u.addShape("circle",{attrs:Ky({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}($n),Xre=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)}}(),hC=.05;typeof document<"u"&&Qv(`
|
|
518
|
+
.g6-component-toolbar {
|
|
519
|
+
position: absolute;
|
|
520
|
+
list-style-type: none;
|
|
521
|
+
padding: 6px;
|
|
522
|
+
left: 0px;
|
|
523
|
+
top: 0px;
|
|
524
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
525
|
+
border: 1px solid #e2e2e2;
|
|
526
|
+
border-radius: 4px;
|
|
527
|
+
font-size: 12px;
|
|
528
|
+
color: #545454;
|
|
529
|
+
margin: 0;
|
|
530
|
+
}
|
|
531
|
+
.g6-component-toolbar li {
|
|
532
|
+
float: left;
|
|
533
|
+
text-align: center;
|
|
534
|
+
width: 35px;
|
|
535
|
+
height: 24px;
|
|
536
|
+
cursor: pointer;
|
|
537
|
+
list-style-type:none;
|
|
538
|
+
list-style: none;
|
|
539
|
+
margin-left: 0px;
|
|
540
|
+
}
|
|
541
|
+
.g6-component-toolbar li .icon {
|
|
542
|
+
opacity: 0.7;
|
|
543
|
+
}
|
|
544
|
+
.g6-component-toolbar li .icon:hover {
|
|
545
|
+
opacity: 1;
|
|
546
|
+
}
|
|
547
|
+
`);var Yre=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},Wre=function(r){Xre(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{handleClick:void 0,getContent:function(n){return`
|
|
548
|
+
<ul class='g6-component-toolbar'>
|
|
549
|
+
<li code='redo'>
|
|
550
|
+
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
551
|
+
<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>
|
|
552
|
+
</svg>
|
|
553
|
+
</li>
|
|
554
|
+
<li code='undo'>
|
|
555
|
+
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
556
|
+
<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>
|
|
557
|
+
</svg>
|
|
558
|
+
</li>
|
|
559
|
+
<li code='zoomOut'>
|
|
560
|
+
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
561
|
+
<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>
|
|
562
|
+
</svg>
|
|
563
|
+
</li>
|
|
564
|
+
<li code='zoomIn'>
|
|
565
|
+
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
566
|
+
<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>
|
|
567
|
+
</svg>
|
|
568
|
+
</li>
|
|
569
|
+
<li code='realZoom'>
|
|
570
|
+
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
|
|
571
|
+
<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>
|
|
572
|
+
</svg>
|
|
573
|
+
</li>
|
|
574
|
+
<li code='autoZoom'>
|
|
575
|
+
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
|
|
576
|
+
<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>
|
|
577
|
+
</svg>
|
|
578
|
+
</li>
|
|
579
|
+
</ul>
|
|
580
|
+
`},zoomSensitivity:2}},e.prototype.init=function(){var t=this,n=this.get("graph"),i=this.get("getContent"),a=i(n),o=a;Fe(a)&&(o=Or(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")),Fe(u)&&(u=document.getElementById(u)),u.appendChild(o),this.set("toolBar",o);var f=this.get("handleClick");o.addEventListener("click",function(c){var h=Yre(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&&Qt(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,Jt(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,Jt(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-hC*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-hC*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")),Fe(n)&&(n=document.getElementById(n)),n.removeChild(t)}var i=this.get("handleClick");i&&t.removeEventListener("click",i)},e}($n),qre=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"&&Qv(`
|
|
581
|
+
.g6-component-tooltip {
|
|
582
|
+
border: 1px solid #e2e2e2;
|
|
583
|
+
border-radius: 4px;
|
|
584
|
+
font-size: 12px;
|
|
585
|
+
color: #545454;
|
|
586
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
587
|
+
padding: 10px 8px;
|
|
588
|
+
box-shadow: rgb(174, 174, 174) 0px 0px 10px;
|
|
589
|
+
}
|
|
590
|
+
.tooltip-type {
|
|
591
|
+
padding: 0;
|
|
592
|
+
margin: 0;
|
|
593
|
+
}
|
|
594
|
+
.tooltip-id {
|
|
595
|
+
color: #531dab;
|
|
596
|
+
}
|
|
597
|
+
`);var Vre=function(r){qre(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`
|
|
598
|
+
<h4 class='tooltip-type'>类型:`.concat(n.item.getType(),`</h4>
|
|
599
|
+
<span class='tooltip-id'>ID:`).concat(n.item.getID(),`</span>
|
|
600
|
+
`)},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=Or("<div class='".concat(n,"'></div>")),a=t.get("container");a||(a=t.get("graph").get("container")),Fe(a)&&(a=document.getElementById(a)),Qt(i,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(i),t.get("trigger")!=="click"&&(i.addEventListener("mouseenter",function(o){Qt(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);Fe(o)?i.innerHTML=o:(this.clearContainer(),i.appendChild(o)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&Qt(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var n=this.get("shouldBegin"),i=this.get("tooltip");if(!n(t)){Qt(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&&mt(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};Qt(i,{visibility:"visible",display:"unset"});var x=i.getBoundingClientRect();p+x.width+u>o&&(m.x-=x.width+u),g+x.height+f>s&&(m.y-=x.height+f,m.y<0&&(m.y=0)),Qt(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")),Fe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}($n),yD="timebarstartplay",mD="timebarendplay",oa="valuechange",Ss="timebarConfigChanged",Eo="playPauseBtn",ql="nextStepBtn",Vl="preStepBtn",Hre=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,x=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=x,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=Or("<div class='".concat(t,`' style="position: absolute; width: fit-content; height: fit-content; opacity: `).concat(s,'"></div>'));Fe(f)&&(f=document.getElementById(f)),f.appendChild(l),e.parentHeight=f.offsetHeight,e.parentWidth=f.offsetWidth,Qt(l,{visibility:"hidden",top:0,left:0});var c=Or(`
|
|
601
|
+
<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=Or("<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;Qt(t.container,{top:"".concat(-o-u,"px"),left:"".concat(i,"px"),visibility:"visible"}),Qt(t.backgroundDOM,{marginLeft:"".concat(-a/2,"px")}),Qt(t.arrowDOM,{marginLeft:"".concat(-s/2,"px"),top:"".concat(o,"px")});var f=i-a/2,l=i+a/2;f<0?Qt(t.backgroundDOM,{marginLeft:"".concat(-a/2-f,"px")}):l>t.parentWidth&&Qt(t.backgroundDOM,{marginLeft:"".concat(-a/2-l+t.parentWidth+12,"px")})},r.prototype.hide=function(){Qt(this.container,{top:0,left:0,visibility:"hidden"})},r}(),Qy=function(){return Qy=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},Qy.apply(this,arguments)},Zre=function(){function r(e){this.config=Tr({},e),this.init()}return r.prototype.update=function(e){this.config=Tr({},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:Eo});this.startMarkerGroup=h.addGroup({name:Eo}),this.circle=t.addShape("circle",{attrs:Qy({x:l,y:c,r:this.config.r*a},n),name:Eo}),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:Eo});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}(),en=function(){return en=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},en.apply(this,arguments)},tl=vi,Kre="#aaa",Qre="green",Jre={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},ene={fill:"#fff"},tne={fill:"green"},bD={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},xD={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"}},rne={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:bD,timeTypeControllerStyle:xD},N0=110,fo=50,ia={SINGLE:"single",RANGE:"range"},wD=function(){function r(e){this.controllerCfg=Tr({},rne,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||ia.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?Kre:s,f=e.stroke,l=f===void 0?Qre:f,c=e.containerStyle,h=c===void 0?{}:c,d=en(en({},Jre),e.playBtnStyle||{}),v=en(en({},ene),e.preBtnStyle||{}),p=en(en({},tne),e.nextBtnStyle||{}),g=n/2-5,y=a+10,m=this.controllerGroup.addShape("rect",{attrs:en({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 Zre({group:this.controllerGroup,x:t/2,y:y+g+5,r:g,isPlay:this.isPlay,style:d});var x=v.offsetX||0,b=v.offsetY||0,w=(v.scale||1)*g;this.controllerGroup.addShape("path",{attrs:en({path:this.getPreMarkerPath(t/2-5*g+x,y+g+5+b,w*.5)},v),name:Vl});var E=p.offsetX||0,S=p.offsetY||0,_=(p.scale||1)*g;this.controllerGroup.addShape("path",{attrs:en({path:this.getNextMarkerPath(t/2+5*g+E,y+g+5+S,_*.5)},p),name:ql}),m.toBack(),this.renderSpeedBtn(),o||this.renderToggleTime(),this.bindEvent();var C=this.controllerCfg.scale,M=C===void 0?1:C,A=this.controllerGroup.getCanvasBBox(),T=(A.maxX+A.minX)/2,I=(A.maxY+A.minY)/2,L=tl([1,0,0,0,1,0,0,0,1],[["t",-T,-I],["s",M,M],["t",T,I]]);this.controllerGroup.setMatrix(L)},r.prototype.renderSpeedBtn=function(){var e=this.controllerCfg,t=e.y,n=e.width,i=e.hideTimeTypeController,a=en(en({},bD),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 x=5;this.speedAxisY=[19,22,26,32,39];for(var b=0;b<5;b++){var w=t+this.speedAxisY[b],E=n-(i?fo:N0);m.addShape("line",{attrs:en({x1:E,x2:E+15,y1:w,y2:w},s),speed:x,name:"speed-rect"}),this.speedAxisY[b]=w,x=x-1}this.speedText=m.addShape("text",{attrs:en({x:n-(i?fo:N0)+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:en({path:this.getPointerPath(n-(i?fo:N0),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},c),name:"speed-pointer"});var S=this.speedGroup.getCanvasBBox(),_=(S.maxX+S.minX)/2,C=(S.maxY+S.minY)/2,M=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];M=tl(M,[["t",-_,-C],["s",d,d],["t",_+p*d,C+y*d]]),this.speedGroup.setMatrix(M)},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=en(en({},xD),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 x=a===ia.SINGLE;this.toggleGroup.addShape("rect",{attrs:en({x:i-fo,y:this.speedAxisY[0]+3.5},v),isChecked:x,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:en({path:[["M",i-fo+3,this.speedAxisY[1]+6],["L",i-fo+7,this.speedAxisY[1]+10],["L",i-fo+12,this.speedAxisY[1]+4]]},g),capture:!1,name:"check-icon"}),x||this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:en({text:x?((e=this.controllerCfg)===null||e===void 0?void 0:e.timeRangeControllerText)||"时间范围":((t=this.controllerCfg)===null||t===void 0?void 0:t.timePointControllerText)||"单一时间",x:i-fo+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 b=this.toggleGroup.getCanvasBBox(),w=(b.maxX+b.minX)/2,E=(b.maxY+b.minY)/2,S=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];S=tl(S,[["t",-w,-E],["s",u,u],["t",w+l*u,E+h*u]]),this.toggleGroup.setMatrix(S)},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=tl(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(Ss,{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=tl(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(Ss,{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=ia.RANGE):(e.checkedIcon.show(),e.checkedText.attr("text",((n=e.controllerCfg)===null||n===void 0?void 0:n.timeRangeControllerText)||"时间范围"),e.currentType=ia.SINGLE),t.target.set("isChecked",!a),e.group.emit(Ss,{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}(),El=function(){return El=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},El.apply(this,arguments)},nne=vi,ine={fill:"#5B8FF9"},ane={fill:"#e6e8e9"},one=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?ine:g,m=e.unselectedTickStyle,x=m===void 0?ane:m,b=e.tooltipBackgroundColor,w=e.tooltipFomatter,E=e.tickLabelStyle,S=e.controllerCfg,_=S===void 0?{speed:1}:S;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=x,this.controllerCfg=_,this.currentSpeed=_.speed||1,this.x=h,this.y=v,this.tooltipBackgroundColor=b,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,x=o.length,b=(d-m*(x-1))/x;this.tickWidth=b;var w=this.sliceGroup,E=[],S=[],_=Math.round(x*s),C=Math.round(x*u);this.startTickRectId=_,this.endTickRectId=C;var M=h.rotate;delete h.rotate,o.forEach(function(T,I){var L=I>=_&&I<=C,N=L?l:c,O=w.addShape("rect",{attrs:El({x:a+I*(b+m),y:a,width:b,height:y},N),draggable:!0,name:"tick-rect-".concat(I)}),B=w.addShape("rect",{attrs:{x:a+I*b+m*(2*I-1)/2,y:a,width:I===0||I===x-1?b+m/2:b+m,height:y,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(I)});B.toFront();var W=O.getBBox(),D=(W.minX+W.maxX)/2;E.push({rect:O,pickRect:B,value:T.date,x:D,y:W.minY});var P;if(f?(P=f(T),!Fe(P)&&P&&(P=T.date)):I%Math.round(x/10)===0&&(P=T.date),P){S.push(P);var R=W.maxY+a*2;w.addShape("line",{attrs:{stroke:"#BFBFBF",x1:D,y1:R,x2:D,y2:R+p},name:"tick-line"});var X=R+p+a,Y=w.addShape("text",{attrs:El({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:D,y:X,textAlign:"center",text:P,textBaseline:"top",fontSize:10,fontFamily:e.fontFamily||"Arial, sans-serif"},h),capture:!1,name:"tick-label"}),ee=Y.getBBox();if(ee.maxX>n?Y.attr("textAlign","right"):ee.minX<0&&Y.attr("textAlign","left"),dt(M)&&S.length!==10){var U=nne([1,0,0,0,1,0,0,0,1],[["t",-D,-X],["r",M],["t",D-5,X+2]]);Y.attr({textAlign:"left",matrix:U})}S.length===1?Y.attr({textAlign:"left"}):S.length===10&&Y.attr({textAlign:"right"})}}),this.tickRects=E;var A=this.group;this.currentSpeed=1,this.controllerBtnGroup=new wD(El({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(oa,{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(oa,{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 x=h/m,b=c/m;e.graph.emit(oa,{value:[x,b]})}}),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(oa,{value:[g,y]})}}});var n=this,i=n.tooltipBackgroundColor,a=n.tooltipFomatter,o=n.canvas,s=new Hre({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(Eo,":click"),function(){e.isPlay=!e.isPlay,e.changePlayStatus()}),f.on("".concat(ql,":click"),function(){e.updateStartEnd(1)}),f.on("".concat(Vl,":click"),function(){e.updateStartEnd(-1)}),f.on(Ss,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(yD,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(mD,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(oa,{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(Eo,":click")),e.off("".concat(ql,":click")),e.off("".concat(Vl,":click")),e.off(Ss),this.sliceGroup.destroy()},r}(),ED={};function sne(r){return ED[r]}function ma(r,e){ED[r]=e}var B1=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){bt(this.__cfg__,e),this.init()},r.prototype.clone=function(){return this.constructor(this.__cfg__)},r.prototype.getTicks=function(){var e=this;return As(this.ticks,function(t,n){return wn(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 ht(i)||!Pr(i.toString)?"":i.toString()},r.prototype.getConfig=function(e){return this.__cfg__[e]},r.prototype.init=function(){bt(this,this.__cfg__),this.setDomain(),IA(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(Fe(e)){var n=sne(e);if(!n)throw new Error("There is no method to to calculate ticks!");t=n(this)}else Pr(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 dt(e)?(e-t)/(n-t):NaN},r.prototype.calcValue=function(e,t,n){return t+e*(n-t)},r}(),oc=function(r){Rt(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=dt(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 dt(t)&&!this.values.includes(t)&&(a=this.values[a]),r.prototype.getText.apply(this,pv([a],n))},e.prototype.initCfg=function(){this.tickMethod="cat"},e.prototype.setDomain=function(){if(ht(this.getConfig("min"))&&(this.min=0),ht(this.getConfig("max"))){var t=this.values.length;this.max=t>1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(B1),_D=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,vo="\\d\\d?",lo="\\d\\d",une="\\d{3}",fne="\\d{4}",_l="[^\\s]+",SD=/\[([^]*?)\]/gm;function MD(r,e){for(var t=[],n=0,i=r.length;n<i;n++)t.push(r[n].substr(0,e));return t}var dC=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 Ao(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 CD=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AD=["January","February","March","April","May","June","July","August","September","October","November","December"],lne=MD(AD,3),cne=MD(CD,3),F1={dayNamesShort:cne,dayNames:CD,monthNamesShort:lne,monthNames:AD,amPm:["am","pm"],DoFn:function(r){return r+["th","st","nd","rd"][r%10>3?0:(r-r%10!==10?1:0)*r%10]}},fv=Ao({},F1),TD=function(r){return fv=Ao(fv,r)},vC=function(r){return r.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},Bn=function(r,e){for(e===void 0&&(e=2),r=String(r);r.length<e;)r="0"+r;return r},hne={D:function(r){return String(r.getDate())},DD:function(r){return Bn(r.getDate())},Do:function(r,e){return e.DoFn(r.getDate())},d:function(r){return String(r.getDay())},dd:function(r){return Bn(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 Bn(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 Bn(String(r.getFullYear()),4).substr(2)},YYYY:function(r){return Bn(r.getFullYear(),4)},h:function(r){return String(r.getHours()%12||12)},hh:function(r){return Bn(r.getHours()%12||12)},H:function(r){return String(r.getHours())},HH:function(r){return Bn(r.getHours())},m:function(r){return String(r.getMinutes())},mm:function(r){return Bn(r.getMinutes())},s:function(r){return String(r.getSeconds())},ss:function(r){return Bn(r.getSeconds())},S:function(r){return String(Math.round(r.getMilliseconds()/100))},SS:function(r){return Bn(Math.round(r.getMilliseconds()/10),2)},SSS:function(r){return Bn(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?"-":"+")+Bn(Math.floor(Math.abs(e)/60)*100+Math.abs(e)%60,4)},Z:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+Bn(Math.floor(Math.abs(e)/60),2)+":"+Bn(Math.abs(e)%60,2)}},pC=function(r){return+r-1},gC=[null,vo],yC=[null,_l],mC=["isPm",_l,function(r,e){var t=r.toLowerCase();return t===e.amPm[0]?0:t===e.amPm[1]?1:null}],bC=["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}],dne={D:["day",vo],DD:["day",lo],Do:["day",vo+_l,function(r){return parseInt(r,10)}],M:["month",vo,pC],MM:["month",lo,pC],YY:["year",lo,function(r){var e=new Date,t=+(""+e.getFullYear()).substr(0,2);return+(""+(+r>68?t-1:t)+r)}],h:["hour",vo,void 0,"isPm"],hh:["hour",lo,void 0,"isPm"],H:["hour",vo],HH:["hour",lo],m:["minute",vo],mm:["minute",lo],s:["second",vo],ss:["second",lo],YYYY:["year",fne],S:["millisecond","\\d",function(r){return+r*100}],SS:["millisecond",lo,function(r){return+r*10}],SSS:["millisecond",une],d:gC,dd:gC,ddd:yC,dddd:yC,MMM:["month",_l,dC("monthNamesShort")],MMMM:["month",_l,dC("monthNames")],a:mC,A:mC,ZZ:bC,Z:bC},lv={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"},ID=function(r){return Ao(lv,r)},kD=function(r,e,t){if(e===void 0&&(e=lv.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=lv[e]||e;var n=[];e=e.replace(SD,function(a,o){return n.push(o),"@@@"});var i=Ao(Ao({},fv),t);return e=e.replace(_D,function(a){return hne[a](r,i)}),e.replace(/@@@/g,function(){return n.shift()})};function LD(r,e,t){if(t===void 0&&(t={}),typeof e!="string")throw new Error("Invalid format in fecha parse");if(e=lv[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(SD,function(b,w){return o.push(vC(w)),"@@@"}),u={},f={};s=vC(s).replace(_D,function(b){var w=dne[b],E=w[0],S=w[1],_=w[3];if(u[E])throw new Error("Invalid format. "+E+" specified twice in format");return u[E]=!0,_&&(f[_]=!0),a.push(w),"("+S+")"}),Object.keys(f).forEach(function(b){if(!u[b])throw new Error("Invalid format. "+b+" 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=Ao(Ao({},fv),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,x=m.length;h<x;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 ND={format:kD,parse:LD,defaultI18n:F1,setGlobalDateI18n:TD,setGlobalDateMasks:ID};const vne=Object.freeze(Object.defineProperty({__proto__:null,assign:Ao,default:ND,defaultI18n:F1,format:kD,parse:LD,setGlobalDateI18n:TD,setGlobalDateMasks:ID},Symbol.toStringTag,{value:"Module"}));function pne(r){return function(e,t,n,i){for(var a=ht(n)?0:n,o=ht(i)?e.length:i;a<o;){var s=a+o>>>1;r(e[s])>t?o=s:a=s+1}return a}}var xC="format";function OD(r,e){var t=vne[xC]||ND[xC];return t(r,e)}function cv(r){return Fe(r)&&(r.indexOf("T")>0?r=new Date(r).getTime():r=new Date(r.replace(/-/gi,"/")).getTime()),cm(r)&&(r=r.getTime()),r}var Ni=1e3,Ms=60*Ni,Cs=60*Ms,za=24*Cs,Sl=za*31,wC=za*365,rl=[["HH:mm:ss",Ni],["HH:mm:ss",Ni*10],["HH:mm:ss",Ni*30],["HH:mm",Ms],["HH:mm",Ms*10],["HH:mm",Ms*30],["HH",Cs],["HH",Cs*6],["HH",Cs*12],["YYYY-MM-DD",za],["YYYY-MM-DD",za*4],["YYYY-WW",za*7],["YYYY-MM",Sl],["YYYY-MM",Sl*4],["YYYY-MM",Sl*6],["YYYY",za*380]];function gne(r,e,t){var n=(e-r)/t,i=pne(function(o){return o[1]})(rl,n)-1,a=rl[i];return i<0?a=rl[0]:i>=rl.length&&(a=ci(rl)),a}var yne=function(r){Rt(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=cv(t);var n=this.values.indexOf(t);return n===-1&&(dt(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):OD(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;_e(t,function(n,i){t[i]=cv(n)}),t.sort(function(n,i){return n-i}),r.prototype.setDomain.call(this)},e}(oc),Jv=function(r){Rt(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(ht(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=ua(t),i=ci(t);n<this.min&&(this.min=n),i>this.max&&(this.max=i),ht(this.minLimit)||(this.min=n),ht(this.maxLimit)||(this.max=i)},e.prototype.setDomain=function(){var t=yA(this.values),n=t.min,i=t.max;ht(this.min)&&(this.min=n),ht(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=gv(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}(B1),sc=function(r){Rt(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}(Jv);function mo(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 fi(r,e){return r===1?1:Math.log(e)/Math.log(r)}function DD(r,e,t){ht(t)&&(t=Math.max.apply(null,r));var n=t;return _e(r,function(i){i>0&&i<n&&(n=i)}),n===t&&(n=t/e),n>1&&(n=1),n}var mne=function(r){Rt(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=fi(n,this.max),a=this.rangeMin(),o=this.rangeMax()-a,s,u=this.positiveMin;if(u){if(t===0)return 0;s=fi(n,u/n);var f=1/(i-s)*o;if(t<f)return t/f*u}else s=fi(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=DD(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/(fi(a,n)-fi(a,i)):s=(fi(a,t)-fi(a,i))/(fi(a,n)-fi(a,i)),s},e}(Jv),bne=function(r){Rt(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=mo(i,this.max),o=mo(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=(mo(a,t)-mo(a,i))/(mo(a,n)-mo(a,i));return o},e}(Jv),xne=function(r){Rt(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):OD(i,this.mask)},e.prototype.scale=function(t){var n=t;return(Fe(n)||cm(n))&&(n=this.translate(n)),r.prototype.scale.call(this,n)},e.prototype.translate=function(t){return cv(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((!ht(n)||!dt(n))&&(this.min=this.translate(this.min)),(!ht(i)||!dt(i))&&(this.max=this.translate(this.max)),t&&t.length){var a=[],o=1/0,s=o,u=0;_e(t,function(f){var l=cv(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),ht(n)&&(this.min=o),ht(i)&&(this.max=u)}},e}(sc),PD=function(r){Rt(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 ci(n);if(o<0)return ua(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||(ci(t)!==this.max&&t.push(this.max),ua(t)!==this.min&&t.unshift(this.min)),t},e.prototype.getScalePercent=function(t){var n=this.ticks;if(t<ua(n))return 0;if(t>ci(n))return 1;var i=0;return _e(n,function(a,o){if(t>=a)i=o;else return!1}),i/(n.length-1)},e}(Jv),wne=function(r){Rt(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}(PD),RD={};function Ene(r){return RD[r]}function ba(r,e){if(Ene(r))throw new Error("type '"+r+"' existed.");RD[r]=e}var _ne=function(r){Rt(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&&dt(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}(B1);function BD(r){var e=r.values,t=r.tickInterval,n=r.tickCount,i=r.showLast;if(dt(t)){var a=gv(e,function(v,p){return p%t===0}),o=ci(e);return i&&ci(a)!==o&&a.push(o),a}var s=e.length,u=r.min,f=r.max;if(ht(u)&&(u=0),ht(f)&&(f=e.length-1),!dt(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 Sne(r){var e=r.min,t=r.max,n=r.nice,i=r.tickCount,a=new Mne;return a.domain([e,t]),n&&a.nice(i),a.ticks(i)}var O0=5,EC=Math.sqrt(50),_C=Math.sqrt(10),SC=Math.sqrt(2),Mne=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=O0);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=_d(s,u,e),f>0?(s=Math.floor(s/f)*f,u=Math.ceil(u/f)*f,f=_d(s,u,e)):f<0&&(s=Math.ceil(s*f)/f,u=Math.floor(u*f)/f,f=_d(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=O0),Cne(this._domain[0],this._domain[this._domain.length-1],e||O0)},r}();function Cne(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=_d(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 _d(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>=EC?10:a>=_C?5:a>=SC?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=EC?10:a>=_C?5:a>=SC?2:1)}function MC(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 G1(r,e,t){var n=MC(r,t,"floor"),i=MC(e,t,"ceil");n=rd(n,t),i=rd(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=rd(s,o);a.push(u)}return{min:n,max:i,ticks:a}}function z1(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=ht(i)?ht(e)?o:e:i,c=ht(a)?ht(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 Ane(r){var e=r.min,t=r.max,n=r.tickInterval,i=r.minLimit,a=r.maxLimit,o=Sne(r);return!ht(i)||!ht(a)?z1(r,ua(o),ci(o)):n?G1(e,t,n).ticks:o}function ps(r){return Math.abs(r)<1e-15?r:parseFloat(r.toFixed(15))}var Tne=[1,5,2,2.5,4,3],CC=Number.EPSILON*100;function Ine(r,e){return(r%e+e)%e}function kne(r){return Math.round(r*1e12)/1e12}function Lne(r,e,t,n,i,a){var o=bv(e),s=hm(e,r),u=0,f=Ine(n,a);return(f<CC||a-f<CC)&&n<=0&&i>=0&&(u=1),1-s/(o-1)-t+u}function Nne(r,e,t){var n=bv(e),i=hm(e,r),a=1;return 1-i/(n-1)-t+a}function One(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 Dne(r,e){return r>=e?2-(r-1)/(e-1):1}function Pne(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 Rne(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 Bne(){return 1}function Fne(r,e,t,n,i,a){t===void 0&&(t=5),n===void 0&&(n=!0),i===void 0&&(i=Tne),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(R,X){return ps(r+u*X)})}}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=Nne(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=Dne(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),x=Rne(r,e,m*(v-1));if(a[0]*d+a[1]*x+a[2]*p+a[3]<f.score)break;var b=Math.floor(e/m)*l-(v-1)*l,w=Math.ceil(r/m)*l;if(b<=w)for(var s=w-b,E=0;E<=s;E+=1){var S=b+E,_=S*(m/l),C=_+m*(v-1),M=m,A=Lne(h,i,l,_,C,M),T=Pne(r,e,_,C),I=One(v,o,r,e,_,C),L=Bne(),N=a[0]*A+a[1]*T+a[2]*I+a[3]*L;N>f.score&&(!n||_<=r&&C>=e)&&(f.lmin=_,f.lmax=C,f.lstep=M,f.score=N)}y+=1}v+=1}}l+=1}var O=ps(f.lmax),B=ps(f.lmin),W=ps(f.lstep),D=Math.floor(kne((O-B)/W))+1,P=new Array(D);P[0]=ps(B);for(var c=1;c<D;c++)P[c]=ps(P[c-1]+W);return{min:Math.min(r,ua(P)),max:Math.max(e,ci(P)),ticks:P}}function Gne(r){var e=r.min,t=r.max,n=r.tickCount,i=r.nice,a=r.tickInterval,o=r.minLimit,s=r.maxLimit,u=Fne(e,t,n,i).ticks;return!ht(o)||!ht(s)?z1(r,ua(u),ci(u)):a?G1(e,t,a).ticks:u}function zne(r){var e=r.base,t=r.tickCount,n=r.min,i=r.max,a=r.values,o,s=fi(e,i);if(n>0)o=Math.floor(fi(e,n));else{var u=DD(a,e,i);o=Math.floor(fi(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 FD(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]=ps(d+g*f);return{min:d,max:h,ticks:p}}function jne(r){var e=r.exponent,t=r.tickCount,n=Math.ceil(mo(e,r.max)),i=Math.floor(mo(e,r.min)),a=FD(i,n,t).ticks;return a.map(function(o){var s=o>=0?1:-1;return Math.pow(o,e)*s})}function Une(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 $ne(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(Une(n,o))}return i}function Xne(r){var e=r.min,t=r.max,n=r.tickCount,i=r.tickInterval,a=r.minLimit,o=r.maxLimit,s=FD(e,t,n).ticks;return!ht(a)||!ht(o)?z1(r,ua(s),ci(s)):i?G1(e,t,i).ticks:s}function Yne(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=gne(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 Wne(r){var e=BD(z({showLast:!0},r));return e}function hv(r){return new Date(r).getFullYear()}function qne(r){return new Date(r,0,1).getTime()}function Jy(r){return new Date(r).getMonth()}function Vne(r,e){var t=hv(r),n=hv(e),i=Jy(r),a=Jy(e);return(n-t)*12+(a-i)%12}function Hne(r,e){return new Date(r,e,1).getTime()}function Zne(r,e){return Math.ceil((e-r)/za)}function Kne(r,e){return Math.ceil((e-r)/Cs)}function Qne(r,e){return Math.ceil((e-r)/(60*1e3))}function Jne(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=hv(e);if(a>wC)for(var u=hv(t),f=Math.ceil(a/wC),l=s;l<=u+f;l=l+f)o.push(qne(l));else if(a>Sl)for(var c=Math.ceil(a/Sl),h=Jy(e),d=Vne(e,t),l=0;l<=d+c;l=l+c)o.push(Hne(s,l+h));else if(a>za)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),y=v.getDate(),m=Math.ceil(a/za),x=Zne(e,t),l=0;l<x+m;l=l+m)o.push(new Date(p,g,y+l).getTime());else if(a>Cs)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),m=v.getDate(),b=v.getHours(),w=Math.ceil(a/Cs),E=Kne(e,t),l=0;l<=E+w;l=l+w)o.push(new Date(p,g,m,b+l).getTime());else if(a>Ms)for(var S=Qne(e,t),_=Math.ceil(a/Ms),l=0;l<=S+_;l=l+_)o.push(e+l*Ms);else{var C=a;C<Ni&&(C=Ni);for(var M=Math.floor(e/Ni)*Ni,A=Math.ceil((t-e)/Ni),T=Math.ceil(C/Ni),l=0;l<A+T;l=l+T)o.push(M+l*Ni)}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}ma("cat",BD);ma("time-cat",Wne);ma("wilkinson-extended",Gne);ma("r-pretty",Xne);ma("time",Yne);ma("time-pretty",Jne);ma("log",zne);ma("pow",jne);ma("quantile",$ne);ma("d3-linear",Ane);ba("cat",oc);ba("category",oc);ba("identity",_ne);ba("linear",sc);ba("log",mne);ba("pow",bne);ba("time",xne);ba("timeCat",yne);ba("quantize",PD);ba("quantile",wne);var eie=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 tie(r){return As(r,function(e,t){var n=t===0?"M":"L",i=e[0],a=e[1];return[n,i,a]})}function GD(r){return tie(r)}function rie(r){if(r.length<=2)return GD(r);var e=[];_e(r,function(o){So(o,e.slice(e.length-2))||e.push(o[0],o[1])});var t=yk(e,!1),n=ua(r),i=n[0],a=n[1];return t.unshift(["M",i,a]),t}function nie(r,e,t,n){n===void 0&&(n=!0);var i=new sc({values:r}),a=new oc({values:As(r,function(s,u){return u})}),o=As(r,function(s,u){return[a.scale(u)*e,t-i.scale(s)*t]});return n?rie(o):GD(o)}function iie(r,e,t,n){n===void 0&&(n=5);for(var i=new sc({values:r}),a=new oc({values:As(r,function(h,d){return d})}),o=As(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=sie(l);s.push.apply(s,c)}return uie(s)}function aie(r,e){var t=new sc({values:r}),n=Math.max(0,t.min);return e-t.scale(n)*e}function oie(r,e,t,n){var i=eie([],r,!0),a=aie(n,t);return i.push(["L",e,a]),i.push(["L",0,a]),i.push(["Z"]),i}function sie(r){var e=r.x,t=r.y,n=r.y0,i=r.size,a,o;mt(t)?(a=t[0],o=t[1]):(a=n,o=t);var s,u;mt(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 uie(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 Ml=function(){return Ml=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},Ml.apply(this,arguments)},fie={stroke:"#C5C5C5",strokeOpacity:.85},lie={fill:"#CACED4",opacity:.85},cie=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,x=e.interval,b=x===void 0?null:x;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({},fie,g),this.areaStyle=Object.assign({},lie,y),this.intervalConfig=b,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=nie(o,i,a,s);if(c.addShape("path",{attrs:Ml({path:h},f),name:"trend-line"}),u){var d=oie(h,i,a,o);c.addShape("path",{attrs:Ml({path:d},l),name:"trend-area"})}}this.intervalConfig&&c.addShape("path",{attrs:Ml({path:iie(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}(),Lu=function(){return Lu=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},Lu.apply(this,arguments)},hie={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},die={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},AC=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=Lu(Lu({},hie),v):i==="simple"&&(this.style=Lu(Lu({},die),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){dt(e)&&(this.x=e),dt(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}(),kr=function(){return kr=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},kr.apply(this,arguments)},vie=vi,pie={fill:"#416180",opacity:.05},gie={fill:"#416180",opacity:.15,radius:5},yie={fill:"#5B8FF9",opacity:.3,cursor:"grab"},em=2,mie={width:em,height:24},bie={textBaseline:"middle",fill:"#000",opacity:.45},xie={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},wie={lineWidth:1,stroke:"#ccc"},Eie=function(){function r(e){var t=this;this.prevX=0,this.onMouseDown=function(R){return function(X){t.currentHandler=R;var Y=X.originalEvent;Y.stopPropagation(),Y.preventDefault(),t.prevX=Pa(Y,"touches.0.pageX",Y.pageX);var ee=t.canvas.get("container");ee.addEventListener("mousemove",t.onMouseMove),ee.addEventListener("mouseup",t.onMouseUp),ee.addEventListener("mouseleave",t.onMouseUp),ee.addEventListener("touchmove",t.onMouseMove),ee.addEventListener("touchend",t.onMouseUp),ee.addEventListener("touchcancel",t.onMouseUp)}},this.onMouseMove=function(R){R.stopPropagation(),R.preventDefault();var X=Pa(R,"touches.0.pageX",R.pageX),Y=X-t.prevX,ee=t.adjustOffsetRange(Y/t.width);t.updateStartEnd(ee),t.updateUI(),t.prevX=X},this.onMouseUp=function(){t.currentHandler&&(t.currentHandler=void 0);var R=t.canvas.get("container");R&&(R.removeEventListener("mousemove",t.onMouseMove),R.removeEventListener("mouseup",t.onMouseUp),R.removeEventListener("mouseleave",t.onMouseUp),R.removeEventListener("touchmove",t.onMouseMove),R.removeEventListener("touchend",t.onMouseUp),R.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,x=e.handlerStyle,b=x===void 0?{}:x,w=e.textStyle,E=w===void 0?{}:w,S=e.start,_=S===void 0?0:S,C=e.end,M=C===void 0?1:C,A=e.minText,T=A===void 0?"":A,I=e.maxText,L=I===void 0?"":I,N=e.group,O=e.graph,B=e.canvas,W=e.tick,D=W===void 0?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(X){return X},ticks:[]}:W,P=e.type;this.graph=O,this.canvas=B,this.group=N,this.timeBarType=P,this.x=i,this.y=o,this.width=u,this.height=f,this.padding=c,this.ticks=D.ticks,this.trendCfg=h,this.controllerCfg=v,this.currentSpeed=v.speed||1,this.tickLabelFormatter=D.tickLabelFormatter,P==="trend"?this.backgroundStyle=kr(kr({},pie),g):P==="simple"&&(this.backgroundStyle=kr(kr({},gie),g)),this.foregroundStyle=kr(kr({},yie),m),this.handlerStyle=kr(kr({},mie),b),this.textStyle=kr(kr({},bie),E),this.tickLabelStyle=kr(kr({},xie),D.tickLabelStyle),this.tickLineStyle=kr(kr({},wie),D.tickLineStyle),this.currentMode=v.defaultTimeType||ia.RANGE,this.start=_,this.end=M,this.minText=T,this.maxText=L,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)),bt(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"&&bv(Pa(this.trendCfg,"data"))){var o=new cie(kr(kr({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:kr({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:kr({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:kr({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:kr({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:kr({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:kr({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=Pa(this.handlerStyle,"width",2),l=Pa(this.handlerStyle,"height",24),c=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new AC({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 AC({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 x;e.tickLabelFormatter?(x=e.tickLabelFormatter(y),!Fe(x)&&x&&(x=y.date)):x=y.date;var b=e.x+m*v,w=e.y+i+5,E=e.group.addShape("text",{attrs:kr({x:b,y:w,text:x,fontFamily:e.fontFamily||"Arial, sans-serif"},e.tickLabelStyle),name:"tick-label"});if(dt(g)&&m!==d.length-1){var S=vie([1,0,0,0,1,0,0,0,1],[["t",-b,-w],["r",g],["t",b-5,w+2]]);E.attr({textAlign:"left",matrix:S})}m===0?E.attr({textAlign:"left"}):m!==d.length-1&&E.attr({textAlign:"right"});var _=e.group.addShape("line",{attrs:kr({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"});_.toBack();var C=E.getBBox();return C.minX>p?(E.show(),_.show(),p=C.minX+C.width+10):(E.hide(),_.hide()),E}),this.controllerBtnGroup=new wD(kr({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===ia.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(Eo,":click"),function(){e.isPlay=!e.isPlay,e.currentHandler=e.maxHandlerShape,e.changePlayStatus()}),this.group.on("".concat(ql,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(.01),e.updateUI()}),this.group.on("".concat(Vl,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(-.01),e.updateUI()}),this.group.on(Ss,function(i){var a=i.type,o=i.speed;e.currentSpeed=o,e.currentMode=a,a===ia.SINGLE?(e.minHandlerShape.hide(),e.foregroundShape.hide(),e.minTextShape.hide()):a===ia.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=Pa(this.handlerStyle,"width",em);this.setText(this.minText,this.maxText);var a=this.dodgeText([t,n]),o=a[0],s=a[1];this.minHandlerShape.setX(t-i/2),_e(o,function(u,f){return e.minTextShape.attr(f,u)}),this.maxHandlerShape.setX(n-i/2),_e(s,function(u,f){return e.maxTextShape.attr(f,u)}),this.currentMode===ia.RANGE?this.graph.emit(oa,{value:[this.start,this.end].sort()}):this.currentMode===ia.SINGLE&&this.graph.emit(oa,{value:[this.end,this.end]})},r.prototype.dodgeText=function(e){var t,n,i=2,a=Pa(this.handlerStyle,"width",em),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(yD,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(mD,null))},r.prototype.destory=function(){this.graph.off(oa,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(Eo,":click")),e.off("".concat(ql,":click")),e.off("".concat(Vl,":click")),e.off(Ss),e.destroy(),this.trendComponent&&this.trendComponent.destory()},r}(),_ie=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)}}(),Ra=function(){return Ra=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},Ra.apply(this,arguments)},Sie=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},Mie=4,Cie=26,Aie=function(r){_ie(e,r);function e(t){var n=r.call(this,t)||this;return n.afterrenderListener=function(i){return n.filterData({})},n.valueChangeListener=Tl(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?(Fe(u)&&(u=document.getElementById(u)),f=u):(f=Or("<div class='".concat(s,"'></div>")),Qt(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 yl({container:f,width:i,height:a}):c=new Fa({container:f,width:i,height:a}),this.get("containerCSS")&&Qt(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=Sie(f,["data"]),m=i-2*s,x=u==="trend"?Cie:Mie,b=this.get("graph"),w=this.get("timeBarGroup"),E=this.get("canvas"),S=null;if(u==="trend"||u==="simple"){var _=this.get("getValue");S=new Eie(Ra(Ra({graph:b,canvas:E,group:w,type:u,x:a+s,y:u==="trend"?o+s:o+s+15,width:m,height:x,padding:s,backgroundStyle:v,foregroundStyle:p,trendCfg:Ra(Ra({},y),{data:g.map(function(M){return(_==null?void 0:_(M))||M.value})})},l),{tick:{ticks:g,tickLabelFormatter:d.tickLabelFormatter,tickLabelStyle:d.tickLabelStyle,tickLineStyle:d.tickLineStyle},handlerStyle:Ra(Ra({},l.handlerStyle),{height:l.height||x}),controllerCfg:c,textStyle:h}))}else u==="tick"&&(S=new one(Ra({graph:b,canvas:E,group:w,x:a+s,y:o+s,width:i,height:42,padding:2,controllerCfg:c},d)));var C=function M(){var A=t.get("timebar");A.draggingHandler=!1,A.isPlay&&(A.isPlay=!1,A.currentHandler=A.maxHandlerShape,A.changePlayStatus()),document.removeEventListener("mouseup",M)};E.on("mousedown",function(M){(M.target.get("name")==="maxHandlerShape-handler"||M.target.get("name")==="minHandlerShape-handler"||M.target===S.foregroundShape)&&document.addEventListener("mouseup",C)}),this.set("timebar",S)},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"),x=this.get("shouldIgnore"),b=o[l].date,w=o[c].date;if(y||y===void 0){var E=this.cacheGraphData.nodes,S=this.cacheGraphData.edges,_={},C={};f.getNodes().forEach(function(M){return _[M.getID()]=!0}),f.getEdges().forEach(function(M){return C[M.getID()]=!0}),g.includes("node")&&(E==null||E.forEach(function(M){var A=+((m==null?void 0:m(M))||M.date),T=A>=b&&A<=w||(x==null?void 0:x("node",M,{min:b,max:w})),I=_[M.id];I&&!T?(f.removeItem(M.id),_[M.id]=!1):!I&&T&&(f.addItem("node",M),_[M.id]=!0)}),S==null||S.forEach(function(M){var A=_[M.source]&&_[M.target]||(x==null?void 0:x("edge",M,{min:b,max:w})),T=!!f.findById(M.id);T&&!A?(f.removeItem(M.id),C[M.id]=!1):!T&&A?(f.addItem("edge",M),C[M.id]=!0):T||(C[M.id]=!1)})),(this.get("filterEdge")||g.includes("edge"))&&(S==null||S.filter(function(M){var A=+((m==null?void 0:m(M))||M.date),T=A>=b&&A<=w||(x==null?void 0:x("edge",M,{min:b,max:w})),I=_[M.source]&&_[M.target],L=T&&I,N=C[M.id];N&&!L?(C[M.id]=!1,f.removeItem(M.id)):!N&&L&&(C[M.id]=!0,f.addItem("edge",M))}))}else g.includes("node")&&f.getNodes().forEach(function(M){var A=M.getModel();if(!(x!=null&&x("node",A,{min:b,max:w}))){var T=+((m==null?void 0:m(A))||A.date);T<b||T>w?f.hideItem(M):f.showItem(M)}}),(this.get("filterEdge")||g.includes("edge"))&&f.getEdges().forEach(function(M){var A=M.getModel();if(!(x!=null&&x("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(M);else{var I=M.getSource().isVisible(),L=M.getTarget().isVisible();I&&L&&f.showItem(M)}}})}},e.prototype.initEvent=function(){var t=this.get("graph");t.on("afterchangedata",this.changeData),t.on("afterrender",this.afterrenderListener),t.on(oa,this.valueChangeListener)},e.prototype.destroy=function(){var t=this.get("graph");t.off("afterchangedata",this.changeData),t.off("afterrender",this.afterrenderListener),t.off(oa,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")),Fe(a)&&(a=document.getElementById(a)),a===i&&(a=a.parentElement),a.removeChild(i)}},e}($n),Tie=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)}}(),Iie=Sn.applyMatrix;function kie(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 Lie=function(r){Tie(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");Fe(a)&&(a=document.getElementById(a));var o=Or("<div class=".concat(n.viewportClassName,`
|
|
602
|
+
style='position:absolute;
|
|
603
|
+
left:0;
|
|
604
|
+
top:0;
|
|
605
|
+
box-sizing:border-box;
|
|
606
|
+
border: 2px solid #1980ff;
|
|
607
|
+
cursor:move'
|
|
608
|
+
</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"),x=t.get("height");h>m||d>x||(p=i.getZoom(),v=t.get("ratio"),f=!0,s=g.clientX,u=g.clientY)}},!1),a.addEventListener("mousemove",function(g){if(!(!f||ht(g.clientX)||ht(g.clientY))){var y=t.get("width"),m=t.get("height"),x=o.style;l=parseInt(x.left,10),c=parseInt(x.top,10),h=parseInt(x.width,10),d=parseInt(x.height,10);var b=s-g.clientX,w=u-g.clientY;l-b<0?b=l:l-b+h>=y&&(b=0),c-w<0?w=c:c-w+d>=m&&(w=0),l-=b,c-=w,Qt(o,{left:"".concat(l,"px"),top:"".concat(c,"px")}),i.translate(b*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=vm([1,0,0,0,1,0,0,0,1],v),g=Iie({x:d.minX,y:d.minY},p),y=a.getCanvasByPoint(g.x,g.y),m=this.get("viewport");m||this.initViewport();var x=o/d.width,b=x*n,w=x*i,E=n*-y.x/d.width,S=i*-y.y/d.height,_=E+b,C=S+w;E<0&&(b+=E,E=0),_>n&&(b=b-(_-n)),S<0&&(w+=S,S=0),C>i&&(w=w-(C-i)),this.set("ratio",t);var M="".concat(E,"px"),A="".concat(S,"px");Qt(m,{left:M,top:A,width:"".concat(b,"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=Or("<div class='".concat(s,"' style='width: ").concat(f,"px; height: ").concat(l,"px; overflow: hidden; position: relative;'></div>"));Fe(u)&&(u=document.getElementById(u)),u?u.appendChild(c):n.get("container").appendChild(c),t.set("container",c);var h=Or('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');c.appendChild(h);var d=Or('<span style="display: table-cell; vertical-align: middle; "></span>');h.appendChild(d),t.set("containerDOM",h),t.set("containerSpan",d);var v=Or('<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=kie(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=Or('<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}($n),Nie=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)}}(),tm=function(){return tm=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},tm.apply(this,arguments)},Oie=Sn.distance,TC=.05,IC={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},Die=function(r){Nie(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:Jt(IC),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-TC:a=1/(1-TC);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(),x=m.x,b=m.y;Oie({x,y:b},f)<s&&(o[m.id]=y)});var h=i.getEdges(),d=[];h.forEach(function(y){var m=y.getModel(),x=m.source,b=m.target;l(m)&&(u==="only-source"||u==="one"?o[x]&&!o[b]&&d.push(y):u==="only-target"||u==="one"?o[b]&&!o[x]&&d.push(y):u==="both"&&o[x]&&o[b]&&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(x){var b=x.get("type"),w=g.addShape(b,{attrs:x.attr()});c.push(w),v&&b==="text"&&w.set("visible",!0)})}),Object.keys(o).forEach(function(y){var m=o[y],x=m.get("group").clone();if(g.add(x),c.push(x),p)for(var b=x.get("children"),w=0;w<b.length;w++){var E=b[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")||IC;o=s.addShape("circle",{attrs:tm({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}($n),Pie=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)}}(),Rie=Sn.pointLineDistance,Bie={stroke:"#FA8C16",lineWidth:1},Fie=function(r){Pie(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{line:Bie,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=bt({},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(),_e(s,function(x){x[4].isVisible&&(p.push(a.getLineDisObject(x,l)),p.push(a.getLineDisObject(x,c)),p.push(a.getLineDisObject(x,h)))}),_e(u,function(x){x[4].isVisible&&(g.push(a.getLineDisObject(x,d)),g.push(a.getLineDisObject(x,c)),g.push(a.getLineDisObject(x,v)))}),p.sort(function(x,b){return x.dis-b.dis}),g.sort(function(x,b){return x.dis-b.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&&_e(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=bt({x1:g,y1:d[1],x2:y,y2:d[1]},u),x=c.addShape("line",{attrs:m,capture:!1});f.push(x)}),o&&_e(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=bt({x1:d[0],y1:g,x2:d[0],y2:y},u),x=c.addShape("line",{attrs:m,capture:!1});f.push(x)}))},e.prototype.getLineDisObject=function(t,n){return{line:t,point:n,dis:Rie(t,n)}},e.prototype.getContainer=function(){return this.get("container")},e.prototype.clearAlignLine=function(){var t=this._cfgs.alignLines;_e(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}($n),Gie=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)}}(),Fr=function(){return Fr=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},Fr.apply(this,arguments)},zie=["click","mouseenter"],jie=function(r){Gie(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=Or(`<div class='g6-legend-container' style="position: absolute;"></div>`);s.appendChild(u),this.set("container",u);var f=this.render();Qt(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";zie.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();Qt(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(Fr(Fr({},d.get("oriAttrs")),s)),v.attr(Fr(Fr({},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(Fr(Fr({},d.get("oriAttrs")),f)),v.attr(Fr(Fr({},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 x=!1,b=y==="getNodes"?d:v;b.forEach(function(w){var E=i[w.get("id")];x=x||E(m.getModel())}),x?(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 Fa({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(O,B){s[O].forEach(function(W){var D,P=f[B].addGroup({id:W.id,name:"node-container"}),R,X=W.type,Y=t.getShapeSize(W),ee=Y.width,U=Y.height,Z=Y.r,K=t.getStyle(O.substr(0,4),W);switch(W.type){case"circle":R={r:Z,x:0,y:0};break;case"rect":R={width:ee,height:U,x:-ee/2,y:-U/2};break;case"ellipse":R={rx:ee,ry:U,x:0,y:0},X="ellipse";break;case"line":R={x1:-ee/2,y1:0,x2:ee/2,y2:0},X="line";break;case"quadratic":R={path:[["M",-ee/2,0],["Q",0,ee/2,ee/2,0]]},X="path";break;case"cubic":R={path:[["M",-ee/2,0],["C",-ee/6,ee/2,ee/6,-ee/2,ee/2,0]]},X="path";break;case"diamond":R={path:[["M",0,-U],["L",ee,0],["L",0,U],["L",-ee,0],["Z"]]},X="path";break;case"triangle":R={path:[["M",-ee,U],["L",0,-U],["L",ee,U],["Z"]]},X="path";break;case"star":R={path:Sn.getStarPath(Z*3,Z*1.2)},X="path";break;default:R={r:Z,x:0,y:0};break}var se=P.addShape(X,{attrs:Fr(Fr({},R),K),name:"".concat(W.type,"-node-keyShape"),oriAttrs:Fr({opacity:1},K)});if(W.label){var re=se.getBBox(),J=((D=W.labelCfg)===null||D===void 0?void 0:D.style)||{},me=Fr({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},J);P.addShape("text",{attrs:Fr({x:re.maxX+4,y:0,text:W.label},me),className:"legend-label",name:"".concat(W.type,"-node-text"),oriAttrs:me})}})});var l=this.get("padding"),c,h=i.find(function(O){return O.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:Fr({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(),x=m.minX<0?Math.abs(m.minX)+l[3]:l[3],b=d.maxY<m.minY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],w=[1,0,0,0,1,0,x,b,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=Fr({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));d=h.getCanvasBBox();var S=h.getMatrix()||[1,0,0,0,1,0,0,0,1];p.position==="center"?S[6]=E[0]/2+p.offsetX:p.position==="right"?(S[6]=E[0]-l[3]+p.offsetX,c.attr({textAlign:"right"})):(S[6]=l[3]+p.offsetX,c.attr({textAlign:"left"})),h.setMatrix(S),d=h.getCanvasBBox(),x=m.minX<0?Math.abs(m.minX)+l[3]:l[3],b=m.minY<d.maxY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],w=[1,0,0,0,1,0,x,b,1],a.setMatrix(w);var _=[1,0,0,0,1,0,x,b,1];this.get("layout")==="vertical"?_[6]+=m.maxX+this.get("horiSep"):_[7]+=m.maxY+this.get("vertiSep"),o.setMatrix(_)}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 M=o.getMatrix()||[1,0,0,0,1,0,0,0,1],A=o.getCanvasBBox();E=[Math.max(m.width+w[6],A.width+M[6])+l[1],Math.max(m.height+w[7],A.height+M[7])+l[2]],n.changeSize(E[0],E[1]);var T=this.get("containerStyle"),I=i.getMatrix()||[1,0,0,0,1,0,0,0,1],L=Sn.invertMatrix({x:0,y:0},I),N=i.addShape("rect",{attrs:Fr({x:L.x+(T.lineWidth||1),y:L.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 N.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(x){return x.get("name")==="root"}),f=u.find(function(x){return x.get("name")==="node-group"}),l=u.find(function(x){return x.get("name")==="edge-group"}),c={min:0,max:-1/0};f.get("children").forEach(function(x,b){b===0&&(c.min=s[0]);var w=x.get("children")[0],E=x.getCanvasBBox(),S=w.getBBox(),_=S.width,C=S.height,M=0,A=0;a==="vertical"?(M=s[1],A=s[0]+_/2,s[0]=A+E.height+i,E.maxX+M+_/2):(M=s[0]+_/2,A=s[1],s[0]=M+E.width+n,E.maxY+A+C/2),s[0]>c.max&&(c.max=s[0]),x.setMatrix([1,0,0,0,1,0,M,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(x,b){b===0&&(d.min=s[0]);var w=x.get("children")[0],E=x.getCanvasBBox(),S=w.getBBox(),_=S.width,C=S.height,M=0,A=0;a==="vertical"?(M=s[1],A=s[0],s[0]=A+E.height+i,x.setMatrix([1,0,0,0,1,0,0,A+C/2,1])):(M=s[0],A=s[1],s[0]=M+E.width+n,x.setMatrix([1,0,0,0,1,0,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(x){var b=x.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?b[7]+=y:b[6]+=y,x.setMatrix(b)})}},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||ha(),type:i.type||"circle",style:Fr({},i.style),order:i.order,label:i.label,itemType:"node",size:l,labelCfg:{position:"right",style:Fr({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||ha(),type:s,size:f,style:Fr({lineWidth:mt(f)?f[1]:1},i.style),order:i.order,label:i.label,itemType:"edge",labelCfg:{position:"right",style:Fr({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(dt(n))this.set(t,[n,n,n,n]);else if(mt(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&&(mt(t.size)?(n=t.size[0],i=t.size[1]||t.size[0],a=t.size[0]/2):dt(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 Fr(Fr({},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}($n),Uie=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)}}(),oi=function(){return oi=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},oi.apply(this,arguments)},kC=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"&&Qv(`
|
|
609
|
+
.g6-annotation-container {
|
|
610
|
+
background-color: rgba(255, 255, 255, 0.3);
|
|
611
|
+
padding: 8px;
|
|
612
|
+
}
|
|
613
|
+
.g6-annotation-wrapper {
|
|
614
|
+
background-color: #fff;
|
|
615
|
+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.85);
|
|
616
|
+
}
|
|
617
|
+
.g6-annotation-header-wapper {
|
|
618
|
+
height: fit-content;
|
|
619
|
+
width: 100%;
|
|
620
|
+
background-color: #5B8FF9;
|
|
621
|
+
display: inline-flex;
|
|
622
|
+
cursor: move;
|
|
623
|
+
}
|
|
624
|
+
.g6-annotation-title {
|
|
625
|
+
margin: 4px 40px 4px 8px;
|
|
626
|
+
cursor: text;
|
|
627
|
+
min-width: 32px;
|
|
628
|
+
}
|
|
629
|
+
.g6-annotation-collapse {
|
|
630
|
+
margin: 4px;
|
|
631
|
+
cursor: pointer;
|
|
632
|
+
}
|
|
633
|
+
.g6-annotation-expand {
|
|
634
|
+
margin: 4px;
|
|
635
|
+
cursor: pointer;
|
|
636
|
+
}
|
|
637
|
+
.g6-annotation-close {
|
|
638
|
+
margin: 4px 8px 4px 0;
|
|
639
|
+
cursor: pointer;
|
|
640
|
+
}
|
|
641
|
+
.g6-annotation-content {
|
|
642
|
+
padding: 8px;
|
|
643
|
+
width: fit-content;
|
|
644
|
+
cursor: text;
|
|
645
|
+
word-break: break-all;
|
|
646
|
+
min-width: 32px;
|
|
647
|
+
}
|
|
648
|
+
.g6-annotation-title-input-wrapper {
|
|
649
|
+
margin: 4px 40px 4px 8px;
|
|
650
|
+
}
|
|
651
|
+
.g6-annotation-content-input {
|
|
652
|
+
height: 100%;
|
|
653
|
+
word-break: break-all;
|
|
654
|
+
}
|
|
655
|
+
.g6-annotation-content-input-wrapper {
|
|
656
|
+
margin: 8px;
|
|
657
|
+
height: 100%;
|
|
658
|
+
}
|
|
659
|
+
`);var LC="canvas-annotation",$ie=function(r){Uie(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=oi(oi({},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">
|
|
660
|
+
<div
|
|
661
|
+
class="g6-annotation-header-wapper"
|
|
662
|
+
style="border-radius: `).concat(v,`;"
|
|
663
|
+
>
|
|
664
|
+
<h4 class='g6-annotation-title'>`).concat(o,`</h4>
|
|
665
|
+
`).concat(c,`
|
|
666
|
+
`).concat(d,`
|
|
667
|
+
</div>
|
|
668
|
+
`).concat(h,`
|
|
669
|
+
</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 Fa({container:i,width:s.right-s.left,height:s.bottom-s.top});Qt(u.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",Kl(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,x=kC(n,["position","offsetX","offsetY"]),b=n.height,w=b===void 0?"fit-content":b,E=n.width,S=E===void 0?i.getWidth():E;w==="100%"&&(w=c),S==="100%"&&(S=h);var _="unset",C="unset",M={};switch(v){case"right":_="".concat(c,"px"),M={top:0,right:0},M.right+=s+g,M.top+=f+m;break;case"bottom":C="".concat(h,"px"),M={bottom:0,left:0},M.left+=s+g,M.bottom+=f+m;break;case"top":C="".concat(h,"px");case"left":_="".concat(c,"px");default:M={top:0,left:0},M.left+=s+g,M.top+=f+m;break}Object.keys(M).forEach(function(T){M[T]="".concat(M[T],"px")});var A=Or("<div class='".concat(n.className," g6-annotation-container'></div>"));return Qt(A,oi(oi({position:"absolute",display:v==="top"||v==="bottom"?"inline-flex":"unset",width:dt(S)?"".concat(S,"px"):S,height:dt(w)?"".concat(w,"px"):w,maxHeight:_,maxWidth:C,overflow:"scroll"},M),x)),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=cs(g.left),m=cs(g.top),x=p.getBoundingClientRect(),b=x.width,w=x.height,E=y,S=m;y+b>h-f&&(E=h-f-b),y<0&&(E=0),m+w>d-l&&(S=d-l-w),m<0&&(S=0),Qt(p,{left:"".concat(E,"px"),top:"".concat(S,"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,x=c.y,b=c.title,w=c.content,E=c.maxTitleLength,S=c.defaultBegin,_=kC(c,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),C=o.get("linkGroup"),M=this.get("rows")||[[]],A=(i=t.isCanvas)===null||i===void 0?void 0:i.call(t),T=A?LC:t.getID(),I=s[T]||{},L=I.card,N=I.link,O=I.x,B=I.y,W=I.title,D=I.content,P=this.get("getTitle"),R=this.get("getContent"),X=this.get("getContentPlaceholder")||function(){return""},Y=this.get("getTitlePlaceHolder")||function(){return""},ee=X(t),U=Y(t),Z=Or(this.getDOMContent(oi({itemId:T,collapsed:y,title:((a=W||b||(P==null?void 0:P(t)))===null||a===void 0?void 0:a.substr(0,E))||U,content:D||w||(R==null?void 0:R(t))||ee},_))),K=dt(h)?"".concat(h,"px"):h;Qt(Z,{minHeight:y?"unset":K,minWidth:dt(d)?"".concat(d,"px"):d,height:p,width:v});var se=!!L;se?(N==null||N.remove(!0),f.replaceChild(Z,L)):f.appendChild(Z);var re;if(!l){if(re=f.getBoundingClientRect()||{},m!==void 0&&x!==void 0)O=m,B=x;else if(!se&&!A){var J=re.top,me=S||{},Ae=me.left,Ye=me.right,Ve=Ye===void 0?16:Ye,Ke=me.top,xt=Ke===void 0?8:Ke,kt=me.bottom,Lt=Ve,vr=xt;isNaN(Ae)||(Lt=f.scrollWidth-Ae),isNaN(kt)||(vr=f.scrollHeight-kt);var xr=dt(d)?d:100;O=f.scrollWidth-Z.scrollWidth-(M.length-1)*xr-Lt;var pt=M[M.length-1],Nt=(pt[pt.length-1]||{}).bbox;B=(Nt==null?void 0:Nt.bottom)-J||vr}Qt(Z,{position:"absolute",left:"".concat(O,"px"),top:"".concat(B,"px"),cusor:l?"unset":"move"})}this.bindListener(Z,T);var F=Z.getBoundingClientRect();if(!A){var zt=D0(t,F,u,this.get("canvas")),Ot=this.get("linkStyle");N=C.addShape("path",{attrs:oi({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:zt},Ot)})}if(s[T]=oi(oi({},s[T]||{}),{id:T,collapsed:y,card:Z,link:N,x:O,y:B,cardBBox:F,content:D||w,title:W||b,contentPlaceholder:ee,titlePlaceholder:U,isCanvas:A}),o.set("cardInfoMap",s),l)this.updateCardPositionsInConatainer(),this.updateLinks();else{var ut=!isNaN(m)&&!isNaN(x);if(!se&&!A&&!ut){var Gt=re.bottom,_t=Gt===void 0?0:Gt,J=re.top;M[M.length-1].push({id:T,bbox:F}),F.top>_t-J-F.height-16&&M.push([]),this.set("rows",M)}}this.updateCardSize(T);var ct=this.get("onAnnotationChange");ct==null||ct(s[T],se?"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=cs(o.paddingLeft)+cs(o.paddingRight);a-=s,Object.values(t).forEach(function(u){var f=u.card,l=f.getBoundingClientRect().width;switch(i){case"right":Qt(f,{marginLeft:a?"".concat(a-l,"px"):"0px"});break;case"top":case"bottom":Qt(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]=oi(oi({},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;Qt(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",x=Or("<".concat(m,' class="').concat(d,'-input" type="textarea" style="width:').concat(p,"px; height: ").concat(g,'px; min-width: 16px;"/>')),b=Or('<div class="'.concat(d,'-input-wrapper" style="width: ').concat(p,"px; height: ").concat(g,"px; min-width: 16px; margin-right: ").concat(y.marginRight,'" />'));b.appendChild(x),h.parentNode.replaceChild(b,h);var w=f[n],E=w.contentPlaceholder,S=w.titlePlaceholder,_=w.content,C=w.title,M=_;d==="g6-annotation-title"?(x.name="title",x.maxLength=c,M=C):x.name="content",M?(x.innerHTML=h.innerHTML,x.value=h.innerHTML):x.placeholder=d==="g6-annotation-title"?S:E,x.focus(),x.addEventListener("blur",function(A){x.value&&(h.innerHTML=x.value,w[x.name||"title"]=x.value),b.parentNode.replaceChild(h,b),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:cs(l.left),top:cs(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,x=c-v;p+=m,g+=x;var b=i.get("graph"),w=b.getPointByCanvas(0,0),E=b.getPointByCanvas(b.getWidth(),b.getHeight()),S=b.getClientByPoint(w.x,w.y),_=S.x,C=S.y,M=b.getClientByPoint(E.x,E.y),A=M.x,T=M.y,I=y.getBoundingClientRect(),L=I.right-I.left,N=I.bottom-I.top;(p>A-_-L&&m>0||p<0&&m<0)&&(p-=m),(g>T-C-N&&x>0||g<0&&x<0)&&(g-=x),Qt(y,{left:"".concat(p,"px"),top:"".concat(g,"px"),visibility:"hidden"}),d=l,v=c;var O=(f[n]||{}).link;if(O){var B=b.findById(n);O.attr("path",D0(B,I,b,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,Qt(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=cs(s.marginLeft),f=o.getBoundingClientRect().width;Qt(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=D0(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===LC&&(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}($n),Xie=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=Sn.getControlPoint(n,i,.5,o);return[["M",n.x,n.y],["Q",s.x,s.y,i.x,i.y]]},D0=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 M=o[C],A=M.x,T=M.y,I=n.getClientByPoint(A,T);o[C]=i.getPointByClient(I.x,I.y)});var g=t.top,y=g===void 0?0:g,m=t.left,x=m===void 0?0:m,b=t.right,w=b===void 0?0:b,E=t.bottom,S=E===void 0?0:E,_={left:i.getPointByClient(x,(y+S)/2),right:i.getPointByClient(w,(y+S)/2),top:i.getPointByClient((x+w)/2,y),bottom:i.getPointByClient((x+w)/2,S)};return Xie(o,_)},cs=function(e){return Number(e.replace(/\s+|px/gi,""))||0},Zn={PluginBase:$n,Menu:Nre,Grid:Tre,Minimap:Fre,Bundling:jre,ToolBar:Wre,Tooltip:Vre,Fisheye:$re,TimeBar:Aie,ImageMinimap:Lie,EdgeFilterLens:Die,SnapLine:Fie,Legend:jie,Annotation:$ie};$a("circle",{options:{size:Je.defaultNode.size,style:{x:0,y:0,stroke:Je.defaultNode.style.stroke,fill:Je.defaultNode.style.fill,lineWidth:Je.defaultNode.style.lineWidth},labelCfg:{style:{fill:Je.nodeLabel.style.fill,fontSize:Je.nodeLabel.style.fontSize,fontFamily:Je.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Je.defaultNode.linkPoints.size,lineWidth:Je.defaultNode.linkPoints.lineWidth,fill:Je.defaultNode.linkPoints.fill,stroke:Je.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:z({},Je.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=Tr({},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:z({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:z({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=un(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:z(z({},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:z(z({},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:z(z({},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:z(z({},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=Tr({},t,n),a=this.getSize(e),o=a[0]/2,s=z({x:0,y:0,r:o},i);return s},update:function(e,t,n){var i=t.getContainer(),a=this.getSize(e),o=z({},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");$a("rect",{options:{size:[100,30],style:{radius:0,stroke:Je.defaultNode.style.stroke,fill:Je.defaultNode.style.fill,lineWidth:Je.defaultNode.style.lineWidth},labelCfg:{style:{fill:Je.nodeLabel.style.fill,fontSize:Je.nodeLabel.style.fontSize,fontFamily:Je.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Je.defaultNode.linkPoints.size,lineWidth:Je.defaultNode.linkPoints.lineWidth,fill:Je.defaultNode.linkPoints.fill,stroke:Je.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:z({},Je.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=un(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:z(z({},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:z(z({},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:z(z({},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:z(z({},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=bt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=z({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=bt({},a,s.attr(),u);f=bt(f,e.style),this.updateShape(e,t,f,!1,n),this.updateLinkPoints(e,i)}},"single-node");$a("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:Je.defaultNode.style.stroke,fill:Je.defaultNode.style.fill,lineWidth:Je.defaultNode.style.lineWidth},labelCfg:{style:{fill:Je.nodeLabel.style.fill,fontSize:Je.nodeLabel.style.fontSize,fontFamily:Je.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Je.defaultNode.linkPoints.size,lineWidth:Je.defaultNode.linkPoints.lineWidth,fill:Je.defaultNode.linkPoints.fill,stroke:Je.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:z({},Je.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:z({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:z({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=un(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:z(z({},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:z(z({},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:z(z({},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:z(z({},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=bt({},t,n),a=this.getSize(e),o=a[0]/2,s=a[1]/2,u=z({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=bt({},a,u.attr(),s);f=bt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node");$a("diamond",{options:{size:[80,80],style:{stroke:Je.defaultNode.style.stroke,fill:Je.defaultNode.style.fill,lineWidth:Je.defaultNode.style.lineWidth},labelCfg:{style:{fill:Je.nodeLabel.style.fill,fontSize:Je.nodeLabel.style.fontSize,fontFamily:Je.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Je.defaultNode.linkPoints.size,lineWidth:Je.defaultNode.linkPoints.lineWidth,fill:Je.defaultNode.linkPoints.fill,stroke:Je.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:z({},Je.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:z({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:z({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=un(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:z(z({},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:z(z({},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:z(z({},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:z(z({},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=bt({},t,n),a=this.getPath(e),o=z({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=bt({},a,u.attr(),s);f=bt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node");$a("triangle",{options:{size:40,direction:"up",style:{stroke:Je.defaultNode.style.stroke,fill:Je.defaultNode.style.fill,lineWidth:Je.defaultNode.style.lineWidth},labelCfg:{style:{fill:Je.nodeLabel.style.fill,fontSize:Je.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Je.defaultNode.linkPoints.size,lineWidth:Je.defaultNode.linkPoints.lineWidth,fill:Je.defaultNode.linkPoints.fill,stroke:Je.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:z({},Je.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:z({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:z({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=un(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),x=g*Math.sin(1/3*Math.PI);s==="up"?y=[-x,m]:s==="down"?y=[-x,-m]:s==="left"&&(y=[-x,x-m]),y&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:z(z({},v),{x:y[0],y:y[1],r:h/2||d||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var b=null,m=g*Math.sin(1/3*Math.PI),x=g*Math.sin(1/3*Math.PI);s==="up"?b=[x,m]:s==="down"?b=[x,-m]:s==="right"&&(b=[x,x-m]),b&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:z(z({},v),{x:b[0],y:b[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),x=g*Math.sin(1/3*Math.PI);s==="up"?w=[x-m,-m]:s==="left"?w=[x,-m]:s==="right"&&(w=[-x,-m]),w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:z(z({},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),x=g*Math.sin(1/3*Math.PI);s==="down"?E=[-x+m,m]:s==="left"?E=[x,m]:s==="right"&&(E=[-x,m]),E&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:z(z({},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=bt({},t,n),a=this.getPath(e),o=z({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=bt({},a,u.attr(),s);f=bt(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(O){return O.get("className")==="link-point-left"}),u=t.shapeMap["link-point-right"]||t.find(function(O){return O.get("className")==="link-point-right"}),f=t.shapeMap["link-point-top"]||t.find(function(O){return O.get("className")==="link-point-top"}),l=t.shapeMap["link-point-bottom"]||t.find(function(O){return O.get("className")==="link-point-bottom"}),c=i,h=s||u||f||l;h&&(c=h.attr());var d=bt({},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},x=m.left,b=m.right,w=m.top,E=m.bottom,S=this.getSize(e),_=S[0],C={r:y,fill:v,stroke:p,lineWidth:g},M=null,A=_*Math.sin(1/3*Math.PI),T=_*Math.sin(1/3*Math.PI);o==="up"?M=[-T,A]:o==="down"?M=[-T,-A]:o==="left"&&(M=[-T,T-A]),M&&(s?!x&&x!==void 0?(s.remove(),delete t.shapeMap["link-point-left"]):s.attr(z(z({},C),{x:M[0],y:M[1]})):x&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:z(z({},C),{x:M[0],y:M[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var I=null;o==="up"?I=[T,A]:o==="down"?I=[T,-A]:o==="right"&&(I=[T,T-A]),I&&(u?!b&&b!==void 0?(u.remove(),delete t.shapeMap["link-point-right"]):u.attr(z(z({},C),{x:I[0],y:I[1]})):b&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:z(z({},C),{x:I[0],y:I[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var L=null;o==="up"?L=[T-A,-A]:o==="left"?L=[T,-A]:o==="right"&&(L=[-T,-A]),L&&(f?!w&&w!==void 0?(f.remove(),delete t.shapeMap["link-point-top"]):f.attr(z(z({},C),{x:L[0],y:L[1]})):w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:z(z({},C),{x:L[0],y:L[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var N=null;o==="down"?N=[-T+A,A]:o==="left"?N=[T,A]:o==="right"&&(N=[-T,A]),N&&(l?!E&&E!==void 0?(l.remove(),delete t.shapeMap["link-point-bottom"]):l.attr(z(z({},C),{x:N[0],y:N[1]})):E&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:z(z({},C),{x:N[0],y:N[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node");$a("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:Je.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:Je.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:Je.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=un(i,["show"]);return l&&(t.shapeMap["pre-rect"]=t.addShape("rect",{attrs:z({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=un(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-logo-icon"]=t.addShape("text",{attrs:z({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:z(z({},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=un(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-state-icon"]=t.addShape("text",{attrs:z({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:z(z({},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=un(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:z(z({},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:z(z({},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:z(z({},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:z(z({},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 Fe(e.description)?(h=t.addShape("text",{attrs:z(z({},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:z(z({},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:z(z({},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=bt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=z({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(z(z({},a),{x:-c/2,y:-h/2,width:c,height:h}));var v=t.getContainer(),p=v.shapeMap["rect-logo-icon"]||v.find(function(Z){return Z.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=bt({},g,e.logoIcon),m=y.width;m===void 0&&(m=this.options.logoIcon.width);var x=e.logoIcon?e.logoIcon.show:void 0,b=s.offset,w=-c/2+m+b;!x&&x!==void 0&&(w=-c/2+b);var E=v.shapeMap["node-label"]||v.find(function(Z){return Z.get("className")==="node-label"}),S=v.shapeMap["rect-description"]||v.find(function(Z){return Z.get("className")==="rect-description"});if(e.label)if(!E)v.shapeMap["node-label"]=v.addShape("text",{attrs:z(z({},s.style),{x:w,y:e.description?-5:7,text:e.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var _=e.labelCfg?e.labelCfg.style:{},C=bt({},E.attr(),_);e.label&&(C.text=e.label),C.x=w,Fe(e.description)&&(C.y=-5),S&&(S.resetMatrix(),S.attr({x:w})),E.resetMatrix(),E.attr(C)}if(Fe(e.description)){var M=f.paddingTop;if(!S)v.shapeMap["rect-description"]=v.addShape("text",{attrs:z(z({},f.style),{x:w,y:17+(M||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var _=e.descriptionCfg?e.descriptionCfg.style:{},A=bt({},S.attr(),_);Fe(e.description)&&(A.text=e.description),A.x=w,S.resetMatrix(),S.attr(z(z({},A),{y:17+(M||0)}))}}var T=v.shapeMap["pre-rect"]||v.find(function(Z){return Z.get("className")==="pre-rect"});if(T&&!T.destroyed){var I=bt({},T.attr(),e.preRect);T.attr(z(z({},I),{x:-c/2,y:-h/2,height:h}))}if(p&&!p.destroyed)if(!x&&x!==void 0)p.remove(),delete v.shapeMap["pre-rect"];else{var L=y.width,N=y.height,O=y.x,B=y.y,W=y.offset,D=un(y,["width","height","x","y","offset"]);p.attr(z(z({},D),{x:O||-c/2+L+W,y:B||-N/2,width:L,height:N}))}else x&&this.drawLogoIcon(e,v);var P=v.shapeMap["rect-state-icon"]||v.find(function(Z){return Z.get("className")==="rect-state-icon"}),R=P?P.attr():{},X=bt({},R,e.stateIcon);if(P){!X.show&&X.show!==void 0&&(P.remove(),delete v.shapeMap["rect-state-icon"]);var Y=X.width,N=X.height,O=X.x,B=X.y,ee=X.offset,U=un(X,["width","height","x","y","offset"]);P.attr(z(z({},U),{x:O||c/2-Y+ee,y:B||-N/2,width:Y,height:N}))}else X.show&&this.drawStateIcon(e,v);this.updateLinkPoints(e,v)},getOptions:function(e,t){return t==="move"?e:Tr({},this.options,this.getCustomConfig(e)||{},e)}},"single-node");$a("star",{options:{size:60,style:{stroke:Je.defaultNode.style.stroke,fill:Je.defaultNode.style.fill,lineWidth:Je.defaultNode.style.lineWidth},labelCfg:{style:{fill:Je.nodeLabel.style.fill,fontSize:Je.nodeLabel.style.fontSize,fontFamily:Je.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Je.defaultNode.linkPoints.size,lineWidth:Je.defaultNode.linkPoints.lineWidth,fill:Je.defaultNode.linkPoints.fill,stroke:Je.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:z({},Je.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:z({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:z({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=un(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:z(z({},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:z(z({},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:z(z({},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:z(z({},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:z(z({},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 Sn.getStarPath(n,a)},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=bt({},t,n),a=this.getPath(e),o=z({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=bt({},a,u.attr(),s);f=bt(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=bt({},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,x=g.top,b=g.leftBottom,w=g.rightBottom,E=this.getSize(e),S=E[0],_={r:p,fill:h,stroke:d,lineWidth:v},C=Math.cos((18+72*0)/180*Math.PI)*S,M=Math.sin((18+72*0)/180*Math.PI)*S;a?!m&&m!==void 0?(a.remove(),delete t.shapeMap["link-point-right"]):a.attr(z(z({},_),{x:C,y:-M})):m&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:z(z({},_),{x:C,y:-M}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),C=Math.cos((18+72*1)/180*Math.PI)*S,M=Math.sin((18+72*1)/180*Math.PI)*S,o?!x&&x!==void 0?(o.remove(),delete t.shapeMap["link-point-top"]):o.attr(z(z({},_),{x:C,y:-M})):x&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:z(z({},_),{x:C,y:-M}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),C=Math.cos((18+72*2)/180*Math.PI)*S,M=Math.sin((18+72*2)/180*Math.PI)*S,i?!y&&y!==void 0?(i.remove(),delete t.shapeMap["link-point-left"]):i.attr(z(z({},_),{x:C,y:-M})):y&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:z(z({},_),{x:C,y:-M}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),C=Math.cos((18+72*3)/180*Math.PI)*S,M=Math.sin((18+72*3)/180*Math.PI)*S,s?!b&&b!==void 0?(s.remove(),delete t.shapeMap["link-point-left-bottom"]):s.attr(z(z({},_),{x:C,y:-M})):b&&(t.shapeMap["link-point-left-bottom"]=t.addShape("circle",{attrs:z(z({},_),{x:C,y:-M}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),C=Math.cos((18+72*4)/180*Math.PI)*S,M=Math.sin((18+72*4)/180*Math.PI)*S,u?!w&&w!==void 0?(u.remove(),delete t.shapeMap["link-point-right-bottom"]):u.attr(z(z({},_),{x:C,y:-M})):w&&(t.shapeMap["link-point-right-bottom"]=t.addShape("circle",{attrs:z(z({},_),{x:C,y:-M}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var NC=Sn.defaultSubjectColors,Cl="fan-shape-";$a("donut",{options:{size:Je.defaultNode.size,style:{x:0,y:0,stroke:Je.defaultNode.style.stroke,fill:Je.defaultNode.style.fill,lineWidth:Je.defaultNode.style.lineWidth},labelCfg:{style:{fill:Je.nodeLabel.style.fill,fontSize:Je.nodeLabel.style.fontSize,fontFamily:Je.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Je.defaultNode.linkPoints.size,lineWidth:Je.defaultNode.linkPoints.lineWidth,fill:Je.defaultNode.linkPoints.fill,stroke:Je.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:z({},Je.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=Tr({},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:z({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:z({x:-u/2,y:-f/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Yie(e,t,s),this.drawLinkPoints(e,t),s},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(z({},n)),Wie(e,t,o),this.updateLabel(e,t,a),i&&this.updateIcon(e,t)}},"circle");var Yie=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=zD(a,s),l=f.configs,c=f.totalValue;if(c){var h=jD(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0;if(u===1){rm(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=rm(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}}}},rm=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 x={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"))||NC[s%NC.length],lineWidth:u};return d?d.attr(x):e.shapeMap["".concat(Cl).concat(s)]=e.addShape("path",{attrs:x,name:"".concat(Cl).concat(s),draggable:!0}),{beginAngle:g,arcBegin:p,shape:e.shapeMap["".concat(Cl).concat(s)],shouldEnd:c||v>.999}},Wie=function(e,t,n){var i=e.donutAttrs,a=e.donutColorMap,o=a===void 0?{}:a,s={},u=t.getContainer();if(i){var f=zD(i,o),l=f.configs,c=f.totalValue;if(c)for(var h=jD(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0,y=0;y<l.length;y++){var m="".concat(Cl).concat(y),x=rm(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(x.shape&&(s[m]=!0),x.shouldEnd)break;p=x.arcBegin,g=x.beginAngle}}var b=Object.keys(u.shapeMap).filter(function(w){return w.includes(Cl)});b.forEach(function(w){s[w]||(u.shapeMap[w].remove(!0),delete u.shapeMap[w])})},zD=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}},jD=function(e){var t=e.attr("r"),n=.6*t,i=(t+n)/2,a=t-n;return{lineWidth:a,arcR:i}},Zh=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}},qie=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}},j1=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},UD=function(e){return j1(e)},dv=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},Vie=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},nm=function(e,t,n){var i=Vie(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}},OC=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}},im=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}]},Kh=function(e,t){var n=e.x,i=e.y;return n<t.minX||n>t.maxX||i<t.minY||i>t.maxY},Hie=function(e,t){return t<e.minX||t>e.maxX?[]:[{x:t,y:e.minY},{x:t,y:e.maxY}]},Zie=function(e,t){return t<e.minY||t>e.maxY?[]:[{x:e.minX,y:t},{x:e.maxX,y:t}]},Kie=function(e,t){return Hie(e,t.x).concat(Zie(e,t.y))},Hl=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},Qie=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},DC=function(e,t,n,i,a){return Hl(e,t)+Hl(e,n)+Qie(e,[t,n,i,a])},Jie=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)},Qh=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},am=function(e,t,n){if(n.width||n.height){var i=im(n),a=i[0],o=i[1],s=i[2],u=i[3];return Qh(e,t,a,o)||Qh(e,t,a,u)||Qh(e,t,o,s)||Qh(e,t,s,u)}return!1},eae=function(e,t,n,i){var a=[];return e.forEach(function(o){if(o!==t&&(o.x===t.x||o.y===t.y)){if(am(o,t,n)||am(o,t,i))return;a.push(o)}}),j1(a)},tae=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]=DC(t,n,t);var v=new XD;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 Jie(m,p,c,n.id),m}delete l[g.id],v.remove(g.id),f.push(g);var x=eae(e,g,i,a),b=function(E){E.forEach(function(S){if(f.indexOf(S)===-1){var _=S.id;l[_]||(l[_]=S);var C=d[g.id]+Hl(g,S);if(h[_]&&C>=h[_]){v.add({id:_,value:d[_]});return}c[_]=g.id,h[_]=C,d[_]=h[_]+DC(S,n,t,o,s),v.add({id:_,value:d[_]})}})};b(x)}return[t,n]},rae=function(e,t,n){return!(e.x===t.x&&t.x===n.x||e.y===t.y&&t.y===n.y)},nae=function(e,t,n,i){var a=Hl(e,t),o=Hl(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]},PC=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(rae(a,s,u)){var f=nae(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("")},$D=function(e,t,n,i,a){var o,s;if(!n||!n.getType())o=Zh(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=Zh(e)}else o=n&&n.getBBox();if(!i||!i.getType())s=Zh(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=Zh(t)}else s=i&&i.getBBox();var g=dv(o,a),y=dv(s,a),m=nm(g,e,t),x=nm(y,t,e),b=qie([m,x]),w=OC(g,b),E=OC(y,b),S=[];S=S.concat(im(w)).concat(im(E));var _={x:(e.x+t.x)/2,y:(e.y+t.y)/2};[b,w,E].forEach(function(M){S=S.concat(Kie(M,_).filter(function(A){return Kh(A,g)&&Kh(A,y)}))}),[{x:m.x,y:x.y},{x:x.x,y:m.y}].forEach(function(M){Kh(M,g)&&Kh(M,y)&&S.push(M)}),S.unshift(m),S.push(x),S=j1(S);var C=tae(S,m,x,o,s,e,t);return C.unshift(e),C.push(t),UD(C)},iae=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},XD=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}(),aae=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},oae=function(e,t,n,i,a){return UD($D(e,t,n,i,a.offset))},sae={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:aae,fallbackRoute:oae},ja=function(e,t){var n=Math.round(Math.abs(e/t)),i=e<0?-1:1;return n<0?0:i*n},uae=function(e,t,n){var i={};return e.forEach(function(a){if(a)for(var o=dv(a.getBBox(),n),s=ja(o.minX,t);s<=ja(o.maxX,t);s+=1)for(var u=ja(o.minY,t);u<=ja(o.maxY,t);u+=1)i["".concat(s,"|||").concat(u)]=!0}),i},P0=function(e,t){var n=t.x-e.x,i=t.y-e.y;return n||i?Math.atan2(i,n):0},RC=function(e,t){var n=Math.abs(e-t);return n>Math.PI?2*Math.PI-n:n},BC=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},FC=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=dv(f,u);for(var h in c)c[h]=ja(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=Sn.getLineIntersect(e,{x:e.x+p.stepX*c.width,y:e.y+p.stepY*c.height},y[0],y[1]);m&&!am(e,m,f)&&(m.id="".concat(m.x,"|||").concat(m.y),o.push(m))}return o}var x=nm(c,e,i);return x.id="".concat(x.x,"|||").concat(x.y),[x]},om=function(e,t,n,i){var a=P0(e,t),o=n[e.id];if(!o){var s=P0(i,e);return RC(s,a)}var u=P0({x:o.x,y:o.y},e);return RC(u,a)},fae=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};om(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=om(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},lae=function(e,t,n,i,a){if(isNaN(e.x)||isNaN(t.x))return[];var o=Tr(sae,a);o.obstacles=o.obstacles||[];var s=o.penalties,u=o.gridSize,f=uae(o.obstacles.concat([n,i]),u,o.offset),l={x:ja(e.x,u),y:ja(e.y,u)},c={x:ja(t.x,u),y:ja(t.y,u)};e.id="".concat(l.x,"|||").concat(l.y),t.id="".concat(c.x,"|||").concat(c.y);var h=FC(l,e,n,c,o),d=FC(c,t,i,l,o);h.forEach(function(D){delete f[D.id]}),d.forEach(function(D){delete f[D.id]});for(var v={},p={},g={},y={},m={},x=new XD,b=0;b<h.length;b++){var w=h[b];v[w.id]=w,y[w.id]=0,m[w.id]=BC(w,d,o.distFunc),x.add({id:w.id,value:m[w.id]})}var E=o.maximumLoops,S,_,C,M,A,T,I=1/0,L={};for(d.forEach(function(D){L["".concat(D.x,"|||").concat(D.y)]=!0}),Object.keys(v).forEach(function(D){var P=v[D].id;m[P]<=I&&(I=m[P],S=v[P])});Object.keys(v).length>0&&E>0;){var N=x.minId((E+1)%30===0);if(N)S=v[N];else break;if(L["".concat(S.x,"|||").concat(S.y)])return fae(S,g,l,t,e,c,u);delete v[S.id],x.remove(S.id),p[S.id]=!0;for(var b=0;b<o.directions.length;b++){_=o.directions[b];var O="".concat(Math.round(S.x)+_.stepX,"|||").concat(Math.round(S.y)+_.stepY);if(C={x:S.x+_.stepX,y:S.y+_.stepY,id:O},!p[O]&&(T=om(S,C,g,l),!(T>o.maxAllowedDirectionChange)&&!f[O])){v[O]||(v[O]=C);var B=s[T];M=o.distFunc(S,C)+(isNaN(B)?u:B),A=y[S.id]+M;var W=y[O];W&&A>=W||(g[O]=S,y[O]=A,m[O]=A+BC(C,d,o.distFunc),x.add({id:O,value:m[O]}))}}E-=1}return o.fallbackRoute(e,t,n,i,o)};Bk("polyline",{options:{color:Je.defaultEdge.color,size:Je.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:Je.defaultEdge.style.stroke,lineAppendWidth:Je.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Je.edgeLabel.style.fill,fontSize:Je.edgeLabel.style.fontSize,fontFamily:Je.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:z({},Je.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=bt({},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=bt({},h,e.routeCfg);d.offset=i.offset;var v=this.getPath(u,f,l,c,d,!s);(mt(v)&&v.length<=1||Fe(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=bt({},Je.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(b){return b.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=bt({},i,c,e.style),d=e.sourceNode,v=e.targetNode,p=h.radius,g=this.options.routeCfg,y=bt({},g,e.routeCfg);y.offset=h.offset;var m=this.getPath(l,d,v,p,y,!f);(mt(m)&&m.length<=1||Fe(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 x=bt(i,a.attr(),{lineWidth:o,path:m},e.style);a&&a.attr(x)}},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 PC(e,i);var l=[];return _e(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?$D(e[e.length-1],e[0],n,t,s):lae(e[0],e[e.length-1],t,n,a);if(!c||!c.length)return"M0 0, L0 0";if(i){var h=PC(c,i);return h}c=iae(c);var d=Sn.pointsToPolygon(c);return d}},"single-edge");var GC=Va.cloneEvent,zC=Va.isNaN,jC=Math.abs,cae=10,hae=["shift","ctrl","alt","control"];const dae={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(!(zC(n)||zC(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(x){x.set("ori-visibility",x.get("ori-visibility")||x.get("visible")),x.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(x){return m.onMouseUp(x)},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=GC(e),!!this.origin)){if(this.dragging)e.type="drag",t.emit("canvas:drag",e);else{if(jC(this.origin.x-e.clientX)+jC(this.origin.y-e.clientY)<cae)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(S){return S.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(S){var _=S.get("ori-visibility");S.set("ori-visibility",void 0),_&&S.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,x=y;m<x.length;m++){var b=x[m],w=b.get("isKeyShape");if(!w){var E=b.get("ori-visibility");b.set("ori-visibility",void 0),E&&b.show()}}}if(!this.dragging){this.origin=null;return}e=GC(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&&(hae.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(Zl(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(wn(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}},vae={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(z(z({},e),this.mousedown)):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var t=this;if(this.currentShouldEnd=!0,!!this.shouldBegin(z(z({},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",Jt(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:Kl(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=Tr({},_s.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:z({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)})}};var Jh=null;const pae={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldClearStatusOnSecond:!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,n=this.shouldClearStatusOnSecond;n&&(Jh=null),this.timer=setTimeout(function(){t.throttleClearActiveState(e,t)},50)},throttleSetAllItemStates:Tl(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))){var i=e.shouldClearStatusOnSecond,a=t.getModel().id;if(Jh===a&&i){e.throttleClearActiveState(r,e),Jh=null;return}for(var o=e.activeState,s=e.inactiveState,u=n.getNodes(),f=n.getCombos(),l=n.getEdges(),c=n.get("vedges"),h=u.length,d=f.length,v=l.length,p=c.length,g=e.inactiveItems||{},y=e.activeItems||{},m=0;m<h;m++){var x=u[m],b=x.getID(),w=x.hasState("selected");e.resetSelected&&w&&n.setItemState(x,"selected",!1),y[b]&&(n.setItemState(x,o,!1),delete y[b]),s&&!g[b]&&(n.setItemState(x,s,!0),g[b]=x)}for(var m=0;m<d;m++){var E=f[m],S=E.getID(),w=E.hasState("selected");e.resetSelected&&w&&n.setItemState(E,"selected",!1),y[S]&&(n.setItemState(E,o,!1),delete y[S]),s&&!g[S]&&(n.setItemState(E,s,!0),g[S]=E)}for(var m=0;m<v;m++){var _=l[m],C=_.getID();y[C]&&(n.setItemState(_,o,!1),delete y[C]),s&&!g[C]&&(n.setItemState(_,s,!0),g[C]=_)}for(var m=0;m<p;m++){var M=c[m],A=M.getID();y[A]&&(n.setItemState(M,o,!1),delete y[A]),s&&!g[A]&&(n.setItemState(M,s,!0),g[A]=M)}if(t&&!t.destroyed){s&&(n.setItemState(t,s,!1),delete g[t.getID()]),y[t.getID()]||(n.setItemState(t,o,!0),y[t.getID()]=t);for(var T=t.getEdges(),I=T.length,m=0;m<I;m++){var _=T[m],C=_.getID(),L=void 0;_.getSource()===t?L=_.getTarget():L=_.getSource();var N=L.getID();s&&g[N]&&(n.setItemState(L,s,!1),delete g[N]),y[N]||(n.setItemState(L,o,!0),y[N]=L),g[C]&&(n.setItemState(_,s,!1),delete g[C]),y[C]||(n.setItemState(_,o,!0),y[C]=_),_.toFront()}}e.activeItems=y,e.inactiveItems=g,i&&(Jh=t.getModel().id),n.emit("afteractivaterelations",{item:r.item,action:"activate"})}},50,{trailing:!0,leading:!0}),throttleClearActiveState:Tl(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 ed=Math.min,UC=Math.max,$C=Math.abs,XC="shift",gae=["drag","shift","ctrl","alt","control"];const yae={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:XC,includeEdges:!0,includeCombos:!1,selectOnCombo:!1,selectedEdges:[],selectedNodes:[],selectedCombos:[]}},getEvents:function(){return gae.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=XC,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,i=this.selectOnCombo,a=(t==null?void 0:t.getType())==="combo";a&&!i||!a&&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=ed(f.x,l.x),h=UC(f.x,l.x),d=ed(f.y,l.y),v=UC(f.y,l.y),p=[],g=[];i.getNodes().forEach(function(x){if(x.isVisible()&&s(x,c,h,d,v)&&o(x,"select",t)){p.push(x);var b=x.getModel();g.push(b.id),i.setItemState(x,u,!0)}});var y=[];this.includeEdges&&p.forEach(function(x){var b=x.getOutEdges();b.forEach(function(w){if(w.isVisible()){var E=w.getModel(),S=E.source,_=E.target;g.includes(S)&&g.includes(_)&&o(w,"select",t)&&(y.push(w),i.setItemState(w,t.selectedState,!0))}})});var m=[];this.includeCombos&&i.getCombos().forEach(function(x){if(x.isVisible()&&s(x,c,h,d,v)&&o(x,"select",t)){m.push(x);var b=x.getModel();g.push(b.id),i.setItemState(x,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:$C(e.canvasX-t.x),height:$C(e.canvasY-t.y),x:ed(e.canvasX,t.x),y:ed(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 YC="shift",mae=["shift","ctrl","alt","control"];const bae={getDefaultCfg:function(){return{multiple:!0,trigger:YC,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var e=this;return mae.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=YC,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));_e(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);_e(o,function(f){i.setItemState(f,t.selectedState,!1)});var s=i.findAllByState("edge",this.selectedState);_e(s,function(f){i.setItemState(f,t.selectedState,!1)});var u=i.findAllByState("combo",this.selectedState);_e(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 xae=vi,td=.05;const wae={getDefaultCfg:function(){return this.isFireFox=dD()==="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-td*u:l=1/(1-td*u):e.wheelDelta<0?l=1-td*u:l=1/(1-td*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(),x=y.length,b=m.length;if(!g){for(var w=0;w<x;w++){var E=y[w];if(!E.destroyed)for(var S=E.get("group").get("children"),_=S.length,C=0;C<_;C++){var M=S[C];!M.destoryed&&!M.get("isKeyShape")&&(M.set("ori-visibility",M.get("ori-visibility")||M.get("visible")),M.hide())}}for(var A=0;A<b;A++)for(var T=m[A],S=T.get("group").get("children"),_=S.length,C=0;C<_;C++){var M=S[C];M.set("ori-visibility",M.get("ori-visibility")||M.get("visible")),M.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var I=setTimeout(function(){var pt=i.getZoom(),Nt=t.get("optimized");if(Nt){t.set("optimized",!1);for(var F=0;F<x;F++){var zt=y[F],Ot=zt.get("group").get("children"),ut=Ot.length;if(pt<p){var Gt=zt.getKeyShape(),_t=Gt.get("ori-visibility");Gt.set("ori-visibility",void 0),_t&&Gt.show()}else for(var ct=0;ct<ut;ct++){var ve=Ot[ct],_t=ve.get("ori-visibility");ve.set("ori-visibility",void 0),!ve.get("visible")&&_t&&_t&&ve.show()}}for(var Te=0;Te<b;Te++){var nt=m[Te],Ot=nt.get("group").get("children"),ut=Ot.length;if(pt<p){var Gt=nt.getKeyShape(),_t=Gt.get("ori-visibility");Gt.set("ori-visibility",void 0),_t&&Gt.show()}else for(var ct=0;ct<ut;ct++){var ve=Ot[ct];if(!ve.get("visible")){var _t=ve.get("ori-visibility");ve.set("ori-visibility",void 0),_t&&ve.show()}}}}},100);this.set("timeout",I)}if(f<=1){var L=void 0,N=void 0;if(a.fixAll||a.fixLineWidth||a.fixLabel){L=i.findAllByState("node",a.fixState),N=i.findAllByState("edge",a.fixState);for(var O=f/c,B=L.length,W=0;W<B;W++){var E=L[W],D=E.getContainer(),P=E.getModel(),R=E.getOriginStyle(),X=E.getStateStyle(a.fixState),Y=E.get("shapeFactory").getShape(P.type).getStateStyle(a.fixState,E)[a.fixState];if(a.fixAll){if(c<=1){var ee=Jt(D.getMatrix());ee||(ee=[1,0,0,0,1,0,0,0,1]);var U=E.getModel(),Z=U.x,K=U.y;ee=xae(ee,[["t",-Z,-K],["s",O,O],["t",Z,K]]),D.setMatrix(ee)}}else for(var S=D.get("children"),_=S.length,C=0;C<_;C++){var M=S[C],se=void 0,re=void 0;if(a.fixLabel){var J=M.get("type");if(J==="text"){se=M.attr("fontSize")||12;var me=X[M.get("name")],Ae=Y[M.get("name")],Ye=me?me.fontSize:12,Ve=Ae?Ae.fontSize:12,Ke=Ye||Ve||12;if(c<=1&&M.attr("fontSize",Ke/c),re)break}}if(a.fixLineWidth&&M.get("isKeyShape")){re=M.attr("lineWidth")||0;var xt=X.lineWidth||Y.lineWidth||R.lineWidth||0;if(c<=1&&M.attr("lineWidth",xt/c),se)break}}}for(var kt=N.length,Lt=0;Lt<kt;Lt++)for(var T=N[Lt],D=T.getContainer(),S=D.get("children"),P=T.getModel(),X=T.getStateStyle(a.fixState),Y=T.get("shapeFactory").getShape(P.type).getStateStyle(a.fixState,T)[a.fixState],_=S.length,C=0;C<_;C++){var M=S[C],se=void 0,re=void 0;if(a.fixLabel||a.fixAll){var J=M.get("type");if(J==="text"){se=M.attr("fontSize")||12;var me=X[M.get("name")],Ae=Y[M.get("name")],Ye=me?me.fontSize:12,Ve=Ae?Ae.fontSize:12,Ke=Ye||Ve||12;if(c<=1&&M.attr("fontSize",Ke/c),re)break}}if((a.fixLineWidth||a.fixAll)&&M.get("isKeyShape")){re=M.attr("lineWidth")||0;var xt=X.lineWidth||Y.lineWidth||1;if(c<=1&&M.attr("lineWidth",xt/c),se)break}}}}var vr=this.get("animate"),xr=this.get("animateCfg");i.zoomTo(c,{x:s.x,y:s.y},vr,xr),i.emit("wheelzoom",e)}}},YD={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,Qt(this.container,{visibility:"visible"}),this.updatePosition(e)}},hideTooltip:function(){Qt(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)){Qt(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");Qt(this.container,{left:d,top:v,visibility:"visible"})},createTooltip:function(e){var t=e.get("el");t.style.position="relative";var n=Or('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return t.parentNode.appendChild(n),Qt(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}},Eae=z({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"}}},YD),_ae=z({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"}}},YD);var WC="click",Sae=["click","dblclick"];const Mae={getDefaultCfg:function(){return{trigger:WC,onChange:function(){}}},getEvents:function(){var e,t;return Sae.includes(this.trigger)?t=this.trigger:(t=WC,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 Cae=Va.calculationItemsBBox,Aae=function r(e,t){if(t(e)!==!1&&e){var n=e.get("combos");if(n.length===0)return!1;_e(n,function(i){r(i,t)})}};const Tae={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=[],Aae(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,x=2*Math.sqrt(y*y+m*m);l+g-x>.8*l?n.setItemState(h,t.activeState,!0):n.setItemState(h,t.activeState,!1)})}_e(this.targets,function(h){t.updateCombo(h,e)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(e,t){var n=this;(this.enableDelegate||t)&&_e(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");_e(a,function(s){i.traverse(s,t,n)});var o=e.get("nodes");_e(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=Cae(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=z(z({},_s.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:z({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 qC="dblclick",Iae=["click","dblclick"];const kae={getDefaultCfg:function(){return{trigger:qC,relayout:!0}},getEvents:function(){var e,t;return Iae.includes(this.trigger)?t=this.trigger:(t=qC,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 Lae=Va.isPolygonsIntersect,Nae=Va.pathToPoints,VC="shift",Oae=["drag","shift","ctrl","alt","control"],Dae=function(e,t){var n,i=e.getKeyShape();if(e.get("type")==="path")n=Nae(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 Lae(t,n)};const Pae={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:VC,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Oae.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=VC,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()&&Dae(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:z({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 HC="click",Rae=["click","drag"],ZC=void 0,Bae=["shift","ctrl","control","alt","meta",void 0];const Fae={getDefaultCfg:function(){return{trigger:HC,key:ZC,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var e=this;Rae.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=HC,console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),e.key&&Bae.indexOf(e.key.toLowerCase())===-1&&(e.trigger=ZC,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&&Pr(o)?s=o({source:t.source,target:a.id},t):s=t.edgeConfig;var u=z({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=z(z({},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&&Pr(o)?s=o({source:a.id,target:a.id},t):s=t.edgeConfig,t.edge=i.addItem("edge",z({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 KC="ctrl",Gae=["shift","ctrl","alt","control"],zae="1";const jae={getDefaultCfg:function(){return{trigger:KC,combinedKey:zae,functionName:"fitView",functionParams:[]}},getEvents:function(){return Gae.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=KC,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 Uae=["shift","ctrl","alt","control","meta"];const $ae={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||Uae.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,x=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?x<-p?l=0:x-l<-p&&(l=x+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 b=this.get("enableOptimize");if(b){var w=this.get("optimizeZoom"),E=this.get("optimized"),S=n.getNodes(),_=n.getEdges(),C=S.length,M=_.length;if(!E){for(var A=0;A<C;A++){var T=S[A];if(!T.destroyed)for(var I=T.get("group").get("children"),L=I.length,N=0;N<L;N++){var O=I[N];!O.destoryed&&!O.get("isKeyShape")&&(O.set("ori-visibility",O.get("ori-visibility")||O.get("visible")),O.hide())}}for(var B=0;B<M;B++)for(var W=_[B],I=W.get("group").get("children"),L=I.length,N=0;N<L;N++){var O=I[N];O.set("ori-visibility",O.get("ori-visibility")||O.get("visible")),O.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var D=setTimeout(function(){var P=n.getZoom(),R=t.get("optimized");if(R){t.set("optimized",!1);for(var X=0;X<C;X++){var Y=S[X],ee=Y.get("group").get("children"),U=ee.length;if(P<w){var Z=Y.getKeyShape(),K=Z.get("ori-visibility");K&&Z.show()}else for(var se=0;se<U;se++){var re=ee[se],K=re.get("ori-visibility");!re.get("visible")&&K&&K&&re.show()}}for(var J=0;J<M;J++){var me=_[J],ee=me.get("group").get("children"),U=ee.length;if(P<w){var Z=me.getKeyShape(),K=Z.get("ori-visibility");K&&Z.show()}else for(var se=0;se<U;se++){var re=ee[se];if(!re.get("visible")){var K=re.get("ori-visibility");K&&re.show()}}}}},100);this.set("timeout",D)}}},allowDrag:function(e){var t,n,i=e.target,a=i&&i.isCanvas&&i.isCanvas();if(Zl(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(wn(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}};var Xae={"drag-canvas":dae,"zoom-canvas":wae,"drag-node":vae,"activate-relations":pae,"brush-select":yae,"click-select":bae,"lasso-select":Pae,tooltip:Eae,"edge-tooltip":_ae,"collapse-expand":Mae,"drag-combo":Tae,"collapse-expand-combo":kae,"create-edge":Fae,"shortcuts-call":jae,"scroll-canvas":$ae};_e(Xae,function(r,e){Fk(e,r)});var Yae=z(z({},hz),_9),Wae=Zn.Fisheye,qae=Zn.TimeBar,Vae=Zn.ImageMinimap,Hae=Zn.EdgeFilterLens,Zae=Zn.SnapLine,Kae=Zn.Annotation;const ep={version:_s.version,Graph:pD,TreeGraph:Cre,Util:Va,Layout:nr.Layouts,TreeLayout:dre,registerLayout:vre,Global:_s,registerBehavior:Fk,registerCombo:QU,registerEdge:Bk,registerNode:$a,Minimap:Zn.Minimap,Grid:Zn.Grid,Bundling:Zn.Bundling,Menu:Zn.Menu,ToolBar:Zn.ToolBar,Tooltip:Zn.Tooltip,Legend:Zn.Legend,TimeBar:qae,SnapLine:Zae,Fisheye:Wae,ImageMinimap:Vae,EdgeFilterLens:Hae,Annotation:Kae,Algorithm:Yae,Arrow:Nk,Marker:Ok,Shape:Ir};ep.version="4.8.23";ep.registerNode("file-node",{draw(r,e){const t=e.addShape("rect",{name:"rect-shape",attrs:{x:0,y:0,fill:"#fff",stroke:null}});return r.children.length==0||e.addShape("marker",{name:"marker-shape",attrs:{symbol:"triangle-down",x:0,y:0,r:4,fill:"#767c82"}}),e.addShape("text",{name:"text-shape",attrs:{x:6,y:8,fontSize:16,text:r.label,fill:r.tracked?"#00f":"#333639",textAlign:"left",fontFamily:window.getComputedStyle(document.body,null).getPropertyValue("font-family")}}),t}});ep.registerEdge("step-line",{getControlPoints(r){const e=r.startPoint,t=r.endPoint;return[e,{x:e==null?void 0:e.x,y:t==null?void 0:t.y},t]}},"polyline");const eoe=d3({__name:"TrackGraph",props:{track:{}},setup(r){const e=r,t=v3(()=>{var c;const o=Array.from(e.track.nodes).reverse(),s=(c=e.track.nodes[e.track.selector.targetIndex])==null?void 0:c.id,u=(()=>{const h=o.reduce((d,v)=>v.id<d.id?v:d,o[0]);return h.parent&&o.some(d=>d!==h&&d.pid==h.pid)?h.parent:h})(),f=new Set;f.add(u),o.forEach(h=>{f.add(h);let d=h;for(;d&&d!==u;)f.add(d),d=d.parent});const l=Array.from(f).map(h=>({_node:h,children:[],id:h.id.toString(),label:Ox(h),tracked:s===h.id}));return l.sort((h,d)=>h._node.id-d._node.id),l.forEach(h=>{const d=l.find(v=>v.id===h._node.pid.toString());d&&d.children.push(h)}),l.forEach(h=>{if(h.children.length<h._node.children.length){const d=[],v=()=>{for(;d.length>0;)d.pop()},p=()=>{if(d.length==0)return;const g=d[0].parent.children,y=d[0];if(g.length>1&&g.indexOf(y)==1&&g.indexOf(d.at(-1))==g.length-1){v();return}h.children.push({_node:y,children:[],id:y.id.toString(),label:d.length==1?Ox(y):`[${g.indexOf(y)} ... ${g.indexOf(d.at(-1))}]`,tracked:s===y.id}),v()};h._node.children.forEach(g=>{h.children.find(y=>y.id===g.id.toString())?p():d.push(g)}),d.length>0&&p(),h.children.sort((g,y)=>h._node.children.indexOf(g._node)-h._node.children.indexOf(y._node))}}),l}),n=p3();let i;g3(()=>{if(!n.value)return;i==null||i.destroy();const o=n.value.scrollWidth,s=n.value.scrollHeight||o;i=new ep.TreeGraph({container:n.value,width:o,height:s,modes:{default:["drag-canvas","zoom-canvas"]},layout:{type:"indented",indent:25,getHeight(){return 10}}}),i.node(c=>({type:"file-node"})),i.edge(c=>{if(c.id&&c.id.startsWith("-")){const h=Number.parseInt(c.source)>Number.parseInt(c.target)?-1:1,d=String(c.connect),v=Number(c.count);let p=40;if(d.startsWith("<<")){let y=u.find(x=>x.id.toString()==c.source).parent,m=1;for(;y&&y.id.toString()!=c.target;)y=y.parent,m++;m>1&&(p+=m*20)}return v>1&&(p+=(v-1)*20),p*=h,{type:"quadratic",color:"#ff00ff80",curveOffset:p,style:{startArrow:!0},label:d,labelCfg:{style:{fill:"#f00",fontSize:12,background:{fill:"#ffffff",stroke:"#f0f",lineWidth:1,padding:[2,1,0,1],radius:2}}}}}return{type:"step-line"}}),i.data({...t.value[0]}),i.render();const u=Array.from(e.track.nodes),f=e.track.selector.connectKeys,l={};u.forEach((c,h)=>{const d=u[h+1];if(d&&i){const v=d.id>c.id?`-${c.id}:${d.id}`:`-${d.id}:${c.id}`;l[v]=(l[v]||0)+1;const p=`${v}/${l[v]}`,g=f[f.length-h-1],y={"+":()=>d.parent.children.slice(0,d.parent.children.indexOf(d)).reverse().indexOf(c),"-":()=>d.parent.children.slice(d.parent.children.indexOf(d)+1).indexOf(c),">":()=>{let m=0,x=d.parent;for(;x;){if(x===c)return m;x=x.parent,m++}return m},"<":()=>d.children.indexOf(c),"<<":()=>{let m=0;const x=Array.from(d.children).reverse();for(;x.length>0;){const b=x.pop();if(b===c)return m;x.push(...Array.from(b.children).reverse()),m++}return m}}[g]()+1;i.addItem("edge",{source:c.id.toString(),target:d.id.toString(),id:p,connect:y>1?g+y:g,count:l[v]},!1)}}),i.fitView(30)}),Nx(()=>{i==null||i.destroy()});const a=()=>{!i||i.get("destroyed")||!n.value||!n.value||!n.value.scrollWidth||!n.value.scrollHeight||i.changeSize(n.value.scrollWidth,n.value.scrollHeight)};return window.addEventListener("resize",a),Nx(()=>{window.removeEventListener("resize",a)}),(o,s)=>(y3(),m3("div",{ref_key:"container",ref:n},null,512))}});export{eoe as default};
|
|
670
|
+
//# sourceMappingURL=TrackGraph-pCILQKep.js.map
|