@gkd-kit/inspect 0.0.1719771844368 → 0.0.1719809477737

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.
Files changed (58) hide show
  1. package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-BQ_8fdAM.js → ActionCard.vue_vue_type_script_setup_true_lang-DgjceEKQ.js} +2 -2
  2. package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-BQ_8fdAM.js.map → ActionCard.vue_vue_type_script_setup_true_lang-DgjceEKQ.js.map} +1 -1
  3. package/dist/assets/{DevicePage-DVADu81G.js → DevicePage-BCFULpTW.js} +3 -3
  4. package/dist/assets/{DevicePage-DVADu81G.js.map → DevicePage-BCFULpTW.js.map} +1 -1
  5. package/dist/assets/{HomePage-CaxY_1lw.js → HomePage-BOJ7AWRK.js} +11 -11
  6. package/dist/assets/{HomePage-CaxY_1lw.js.map → HomePage-BOJ7AWRK.js.map} +1 -1
  7. package/dist/assets/{ImportPage-NLsJri71.js → ImportPage-ECg81H0f.js} +2 -2
  8. package/dist/assets/{ImportPage-NLsJri71.js.map → ImportPage-ECg81H0f.js.map} +1 -1
  9. package/dist/assets/{PreviewSharePage-CQKWL6mm.js → PreviewSharePage-DsMC2Kvy.js} +2 -2
  10. package/dist/assets/{PreviewSharePage-CQKWL6mm.js.map → PreviewSharePage-DsMC2Kvy.js.map} +1 -1
  11. package/dist/assets/SnapshotPage-7pjh0kaY.js +276 -0
  12. package/dist/assets/SnapshotPage-7pjh0kaY.js.map +1 -0
  13. package/dist/assets/TrackGraph-B7kpqlUB.js +670 -0
  14. package/dist/assets/TrackGraph-B7kpqlUB.js.map +1 -0
  15. package/dist/assets/{_404Page-FYDSyMId.js → _404Page-CgpMnAhm.js} +2 -2
  16. package/dist/assets/{_404Page-FYDSyMId.js.map → _404Page-CgpMnAhm.js.map} +1 -1
  17. package/dist/assets/dayjs.min-BqNkeEPL.js +362 -0
  18. package/dist/assets/{dayjs.min-Dk3SwgwA.js.map → dayjs.min-BqNkeEPL.js.map} +1 -1
  19. package/dist/assets/error-FVVi9B_k.js +2 -0
  20. package/dist/assets/{error-cRQAxhsF.js.map → error-FVVi9B_k.js.map} +1 -1
  21. package/dist/assets/{export-BbCEpSmy.js → export-DGrWqYFo.js} +3 -3
  22. package/dist/assets/export-DGrWqYFo.js.map +1 -0
  23. package/dist/assets/fetch-C_hNy3_z.js +332 -0
  24. package/dist/assets/fetch-C_hNy3_z.js.map +1 -0
  25. package/dist/assets/{import-CtVhDhqQ.js → import-AT6hHH71.js} +2 -2
  26. package/dist/assets/{import-CtVhDhqQ.js.map → import-AT6hHH71.js.map} +1 -1
  27. package/dist/assets/index-CN4MFbvb.js +579 -0
  28. package/dist/assets/index-CN4MFbvb.js.map +1 -0
  29. package/dist/assets/index-Dt1fnF8L.js +2 -0
  30. package/dist/assets/index-Dt1fnF8L.js.map +1 -0
  31. package/dist/assets/index-JWFVa-I-.js +2 -0
  32. package/dist/assets/index-JWFVa-I-.js.map +1 -0
  33. package/dist/assets/index-bjp6bkMr.css +1 -0
  34. package/dist/assets/{index-B3yJ_cuJ.js → index-cauuWky0.js} +16 -16
  35. package/dist/assets/index-cauuWky0.js.map +1 -0
  36. package/dist/assets/polyfills-B0jv7P3V.js +1 -0
  37. package/dist/assets/{table-Nqs-aN9a.js → table-D46ImQL9.js} +13 -13
  38. package/dist/assets/{table-Nqs-aN9a.js.map → table-D46ImQL9.js.map} +1 -1
  39. package/dist/index.html +3 -3
  40. package/package.json +24 -24
  41. package/dist/assets/SnapshotPage-CaEVhDB3.js +0 -276
  42. package/dist/assets/SnapshotPage-CaEVhDB3.js.map +0 -1
  43. package/dist/assets/TrackGraph-LNwgG7Zu.js +0 -670
  44. package/dist/assets/TrackGraph-LNwgG7Zu.js.map +0 -1
  45. package/dist/assets/dayjs.min-Dk3SwgwA.js +0 -362
  46. package/dist/assets/error-cRQAxhsF.js +0 -2
  47. package/dist/assets/export-BbCEpSmy.js.map +0 -1
  48. package/dist/assets/fetch-H6IWSOXO.js +0 -332
  49. package/dist/assets/fetch-H6IWSOXO.js.map +0 -1
  50. package/dist/assets/index-B3yJ_cuJ.js.map +0 -1
  51. package/dist/assets/index-DUNQCHBS.js +0 -585
  52. package/dist/assets/index-DUNQCHBS.js.map +0 -1
  53. package/dist/assets/index-DgVERJQU.js +0 -2
  54. package/dist/assets/index-DgVERJQU.js.map +0 -1
  55. package/dist/assets/index-RwQljgyW.js +0 -2
  56. package/dist/assets/index-RwQljgyW.js.map +0 -1
  57. package/dist/assets/index-TfJ1MK62.css +0 -1
  58. package/dist/assets/polyfills-C-WU4AZr.js +0 -1
@@ -1,670 +0,0 @@
1
- import{cx as fd,cy as ma,aR as ba,aP as xe,h as t3,m as r3,A as n3,B as i3,au as yE,I as a3,C as o3}from"./index-DUNQCHBS.js";import{R as mE}from"./dayjs.min-Dk3SwgwA.js";import"./index-B3yJ_cuJ.js";import"./fetch-H6IWSOXO.js";function s3(r,t){for(var e=0;e<t.length;e++){const n=t[e];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 um=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return Gi},get Circle(){return _W},get Ellipse(){return SW},get Image(){return MW},get Line(){return CW},get Marker(){return TW},get Path(){return o1},get Polygon(){return NW},get Polyline(){return RW},get Rect(){return GW},get Text(){return zW}},Symbol.toStringTag,{value:"Module"})),fm=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return Ei},get Circle(){return WW},get Dom(){return XW},get Ellipse(){return YW},get Image(){return VW},get Line(){return HW},get Marker(){return KW},get Path(){return qW},get Polygon(){return ZW},get Polyline(){return QW},get Rect(){return e7},get Text(){return i7}},Symbol.toStringTag,{value:"Module"}));function S0(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function u3(r,t){if(r){if(typeof r=="string")return S0(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return S0(r,t)}}function Ri(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function f3(r,t){if(fd(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(fd(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function ZM(r){var t=f3(r,"string");return fd(t)==="symbol"?t:String(t)}function bE(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,ZM(n.key),n)}}function Bi(r,t,e){return t&&bE(r.prototype,t),e&&bE(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function et(r,t,e){return t=ZM(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var QM={exports:{}};(function(r){function t(e){"@babel/helpers - typeof";return r.exports=t=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,t(e)}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports})(QM);var l3=QM.exports,M0=function(r,t){return M0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])},M0(r,t)};function Ot(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");M0(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var F=function(){return F=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},F.apply(this,arguments)};function sn(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function JM(r,t,e,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(t,e,a):o(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a}function eC(r,t){return function(e,n){t(e,n,r)}}function c3(r,t,e,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=!t&&r?n.static?r:r.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),c,h=!1,d=e.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,e[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 h3(r,t,e){for(var n=arguments.length>2,i=0;i<t.length;i++)e=n?t[i].call(r,e):t[i].call(r);return n?e:void 0}function d3(r){return typeof r=="symbol"?r:"".concat(r)}function v3(r,t,e){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:e?"".concat(e," ",t):t})}function tC(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)}function Hn(r,t,e,n){function i(a){return a instanceof e?a:new e(function(o){o(a)})}return new(e||(e=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,t||[])).next())})}function Kn(r,t){var e={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]&&(e=0)),e;)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 e.label++,{value:f[1],done:!1};case 5:e.label++,i=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){e.label=f[1];break}if(f[0]===6&&e.label<a[1]){e.label=a[1],a=f;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(f);break}a[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(r,e)}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 nv=Object.create?function(r,t,e,n){n===void 0&&(n=e);var i=Object.getOwnPropertyDescriptor(t,e);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,i)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]};function rC(r,t){for(var e in r)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&nv(t,r,e)}function ld(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.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(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function lm(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a}function nC(){for(var r=[],t=0;t<arguments.length;t++)r=r.concat(lm(arguments[t]));return r}function iv(){for(var r=0,t=0,e=arguments.length;t<e;t++)r+=arguments[t].length;for(var n=Array(r),i=0,t=0;t<e;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}function ri(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))}function Du(r){return this instanceof Du?(this.v=r,this):new Du(r)}function iC(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(h){n[h]&&(i[h]=function(d){return new Promise(function(v,p){a.push([h,d,v,p])>1||s(h,d)})})}function s(h,d){try{u(n[h](d))}catch(v){c(a[0][3],v)}}function u(h){h.value instanceof Du?Promise.resolve(h.value.v).then(f,l):c(a[0][2],h)}function f(h){s("next",h)}function l(h){s("throw",h)}function c(h,d){h(d),a.shift(),a.length&&s(a[0][0],a[0][1])}}function aC(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,a){t[i]=r[i]?function(o){return(e=!e)?{value:Du(r[i](o)),done:!1}:a?a(o):o}:a}}function oC(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof ld=="function"?ld(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(a){e[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 sC(r,t){return Object.defineProperty?Object.defineProperty(r,"raw",{value:t}):r.raw=t,r}var p3=Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t};function uC(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&nv(t,r,e);return p3(t,r),t}function fC(r){return r&&r.__esModule?r:{default:r}}function lC(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)}function cC(r,t,e,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 t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e}function hC(r,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?t===r:r.has(t)}function dC(r,t,e){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var n;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if(typeof n!="function")throw new TypeError("Object not disposable.");r.stack.push({value:t,dispose:n,async:e})}else e&&r.stack.push({async:!0});return t}var g3=typeof SuppressedError=="function"?SuppressedError:function(r,t,e){var n=new Error(e);return n.name="SuppressedError",n.error=r,n.suppressed=t,n};function vC(r){function t(n){r.error=r.hasError?new g3(n,r.error,"An error was suppressed during disposal."):n,r.hasError=!0}function e(){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(e,function(a){return t(a),e()})}catch(a){t(a)}}if(r.hasError)throw r.error}return e()}const y3={__extends:Ot,__assign:F,__rest:sn,__decorate:JM,__param:eC,__metadata:tC,__awaiter:Hn,__generator:Kn,__createBinding:nv,__exportStar:rC,__values:ld,__read:lm,__spread:nC,__spreadArrays:iv,__spreadArray:ri,__await:Du,__asyncGenerator:iC,__asyncDelegator:aC,__asyncValues:oC,__makeTemplateObject:sC,__importStar:uC,__importDefault:fC,__classPrivateFieldGet:lC,__classPrivateFieldSet:cC,__classPrivateFieldIn:hC,__addDisposableResource:dC,__disposeResources:vC},m3=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:dC,get __assign(){return F},__asyncDelegator:aC,__asyncGenerator:iC,__asyncValues:oC,__await:Du,__awaiter:Hn,__classPrivateFieldGet:lC,__classPrivateFieldIn:hC,__classPrivateFieldSet:cC,__createBinding:nv,__decorate:JM,__disposeResources:vC,__esDecorate:c3,__exportStar:rC,__extends:Ot,__generator:Kn,__importDefault:fC,__importStar:uC,__makeTemplateObject:sC,__metadata:tC,__param:eC,__propKey:d3,__read:lm,__rest:sn,__runInitializers:h3,__setFunctionName:v3,__spread:nC,__spreadArray:ri,__spreadArrays:iv,__values:ld,default:y3},Symbol.toStringTag,{value:"Module"}));var Fn=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},cd=function(r,t){return Fn(r)?r.indexOf(t)>-1:!1},av=function(r,t){if(!Fn(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];t(i,n)&&e.push(i)}return e},b3=function(r,t){return t===void 0&&(t=[]),av(r,function(e){return!cd(t,e)})},x3={}.toString,Fi=function(r,t){return x3.call(r)==="[object "+t+"]"};const Cr=function(r){return Fi(r,"Function")};var ct=function(r){return r==null};const gt=function(r){return Array.isArray?Array.isArray(r):Fi(r,"Array")},bn=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function me(r,t){if(r){var e;if(gt(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(bn(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}var pC=Object.keys?function(r){return Object.keys(r)}:function(r){var t=[];return me(r,function(e,n){Cr(r)&&n==="prototype"||t.push(n)}),t};function gC(r,t){var e=pC(t),n=e.length;if(ct(r))return!n;for(var i=0;i<n;i+=1){var a=e[i];if(t[a]!==r[a]||!(a in r))return!1}return!0}var hd=function(r){return typeof r=="object"&&r!==null},yn=function(r){if(!hd(r)||!Fi(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var t=r;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t};function E3(r,t){if(!gt(r))return null;var e;if(Cr(t)&&(e=t),yn(t)&&(e=function(i){return gC(i,t)}),e){for(var n=0;n<r.length;n+=1)if(e(r[n]))return r[n]}return null}function w3(r,t,e){e===void 0&&(e=0);for(var n=e;n<r.length;n++)if(t(r[n],n))return n;return-1}var _3=function(r,t){for(var e=null,n=0;n<r.length;n++){var i=r[n],a=i[t];if(!ct(a)){gt(a)?e=a[0]:e=a;break}}return e},S3=function(r){if(!gt(r))return[];for(var t=[],e=0;e<r.length;e++)t=t.concat(r[e]);return t},yC=function(r,t){if(t===void 0&&(t=[]),!gt(r))t.push(r);else for(var e=0;e<r.length;e+=1)yC(r[e],t);return t};const pa=function(r){if(gt(r))return r.reduce(function(t,e){return Math.max(t,e)},r[0])},ga=function(r){if(gt(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};var mC=function(r){var t=r.filter(function(o){return!isNaN(o)});if(!t.length)return{min:0,max:0};if(gt(r[0])){for(var e=[],n=0;n<r.length;n++)e=e.concat(r[n]);t=e}var i=pa(t),a=ga(t);return{min:a,max:i}},bC=Array.prototype,M3=bC.splice,C3=bC.indexOf,A3=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n++)for(var i=t[n],a=-1;(a=C3.call(r,i))>-1;)M3.call(r,a,1);return r},T3=Array.prototype.splice,xC=function(t,e){if(!Fn(t))return[];for(var n=t?e.length:0,i=n-1;n--;){var a=void 0,o=e[n];(n===i||o!==a)&&(a=o,T3.call(t,o,1))}return t},EC=function(r,t,e){if(!gt(r)&&!yn(r))return r;var n=e;return me(r,function(i,a){n=t(n,i,a)}),n},I3=function(r,t){var e=[];if(!Fn(r))return e;for(var n=-1,i=[],a=r.length;++n<a;){var o=r[n];t(o,n,r)&&(e.push(o),i.push(n))}return xC(r,i),e};const Ne=function(r){return Fi(r,"String")};function O3(r,t){var e;if(Cr(t))e=function(i,a){return t(i)-t(a)};else{var n=[];Ne(t)?n.push(t):gt(t)&&(n=t),e=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(e),r}function fl(r,t){t===void 0&&(t=new Map);var e=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];t.has(a)||(e.push(a),t.set(a,!0))}return e}var L3=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return fl([].concat.apply([],r))};const D3=function(r,t){for(var e=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[t];if(!ct(o)){gt(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(e.push(u),n[u]=!0)}}}return e};function ha(r){if(Fn(r))return r[0]}function yi(r){if(Fn(r)){var t=r;return t[t.length-1]}}function k3(r,t){return gt(r)||Ne(r)?r[0]===t:!1}function P3(r,t){return gt(r)||Ne(r)?r[r.length-1]===t:!1}var N3=function(r,t){for(var e=0;e<r.length;e++)if(!t(r[e],e))return!1;return!0},R3=function(r,t){for(var e=0;e<r.length;e++)if(t(r[e],e))return!0;return!1},B3=Object.prototype.hasOwnProperty;function dd(r,t){if(!t||!gt(r))return{};for(var e={},n=Cr(t)?t:function(s){return s[t]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),B3.call(e,i)?e[i].push(o):e[i]=[o]}return e}function wC(r,t){if(!t)return{0:r};if(!Cr(t)){var e=gt(t)?t:t.replace(/\s+/g,"").split("*");t=function(n){for(var i="_",a=0,o=e.length;a<o;a++)i+=n[e[a]]&&n[e[a]].toString();return i}}return dd(r,t)}const F3=function(r,t){if(!t)return[r];var e=wC(r,t),n=[];for(var i in e)n.push(e[i]);return n};function G3(r,t){return r["_wrap_"+t]}function vs(r,t){if(r["_wrap_"+t])return r["_wrap_"+t];var e=function(n){r[t](n)};return r["_wrap_"+t]=e,e}var xE={};function z3(r){var t=xE[r];if(!t){for(var e=r.toString(16),n=e.length;n<6;n++)e="0"+e;t="#"+e,xE[r]=t}return t}function j3(r){var t=0,e=0,n=0,i=0;return gt(r)?r.length===1?t=e=n=i=r[0]:r.length===2?(t=n=r[0],e=i=r[1]):r.length===3?(t=r[0],e=i=r[1],n=r[2]):(t=r[0],e=r[1],n=r[2],i=r[3]):t=e=n=i=r,{r1:t,r2:e,r3:n,r4:i}}var U3=function(r,t,e){return r<t?t:r>e?e:r},Fh=function(r,t){var e=t.toString(),n=e.indexOf(".");if(n===-1)return Math.round(r);var i=e.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))},ht=function(r){return Fi(r,"Number")},$3=function(r){return ht(r)&&r%1!==0},W3=function(r){return ht(r)&&r%2===0},X3=Number.isInteger?Number.isInteger:function(r){return ht(r)&&r%1===0},Y3=function(r){return ht(r)&&r<0},V3=1e-5;function _C(r,t,e){return e===void 0&&(e=V3),Math.abs(r-t)<e}var H3=function(r){return ht(r)&&r%2!==0},K3=function(r){return ht(r)&&r>0};const q3=function(r,t){if(gt(r)){for(var e,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=Cr(t)?t(a):a[t];o>n&&(e=a,n=o)}return e}},Z3=function(r,t){if(gt(r)){for(var e,n=1/0,i=0;i<r.length;i++){var a=r[i],o=Cr(t)?t(a):a[t];o<n&&(e=a,n=o)}return e}};var ov=function(r,t){return(r%t+t)%t},Q3=180/Math.PI,J3=function(r){return Q3*r};const e5=parseInt;var t5=Math.PI/180,sv=function(r){return t5*r};const EE=function(r,t){return r.hasOwnProperty(t)};var cm=Object.values?function(r){return Object.values(r)}:function(r){var t=[];return me(r,function(e,n){Cr(r)&&n==="prototype"||t.push(e)}),t};const r5=function(r,t){return cd(cm(r),t)},qu=function(r){return ct(r)?"":r.toString()};var n5=function(r){return qu(r).toLowerCase()},i5=function(r){var t=qu(r);return t.charAt(0).toLowerCase()+t.substring(1)};function a5(r,t){return!r||!t?r:r.replace(/\\?\{([^{}]+)\}/g,function(e,n){return e.charAt(0)==="\\"?e.slice(1):t[n]===void 0?"":t[n]})}var o5=function(r){return qu(r).toUpperCase()},ku=function(r){var t=qu(r);return t.charAt(0).toUpperCase()+t.substring(1)},s5={}.toString,SC=function(r){return s5.call(r).replace(/^\[object /,"").replace(/]$/,"")},u5=function(r){return Fi(r,"Arguments")},Pl=function(r){return Fi(r,"Boolean")},hm=function(r){return Fi(r,"Date")},f5=function(r){return Fi(r,"Error")};function l5(r){return ht(r)&&isFinite(r)}var c5=function(r){return r===null},h5=Object.prototype,MC=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||h5;return r===e},d5=function(r){return Fi(r,"RegExp")},v5=function(r){return r===void 0},p5=function(r){return r instanceof Element||r instanceof HTMLDocument};function CC(r){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)};return t(r)}function AC(r){var t=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;t(r)}function cg(r,t){for(var e in t)t.hasOwnProperty(e)&&e!=="constructor"&&t[e]!==void 0&&(r[e]=t[e])}function yt(r,t,e,n){return t&&cg(r,t),e&&cg(r,e),n&&cg(r,n),r}var g5=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var e=r[0],n=1;n<r.length;n++){var i=r[n];Cr(i)&&(i=i.prototype),yt(e.prototype,i)}},Vt=function(r){if(typeof r!="object"||r===null)return r;var t;if(gt(r)){t=[];for(var e=0,n=r.length;e<n;e++)typeof r[e]=="object"&&r[e]!=null?t[e]=Vt(r[e]):t[e]=r[e]}else{t={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?t[i]=Vt(r[i]):t[i]=r[i]}return t};function Nl(r,t,e){var n;return function(){var i=this,a=arguments,o=function(){n=null,e||r.apply(i,a)},s=e&&!n;clearTimeout(n),n=setTimeout(o,t),s&&r.apply(i,a)}}const TC=function(r,t){if(!Cr(r))throw new TypeError("Expected a function");var e=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=t?t.apply(this,n):n[0],o=e.cache;if(o.has(a))return o.get(a);var s=r.apply(this,n);return o.set(a,s),s};return e.cache=new Map,e};var y5=5;function IC(r,t,e,n){e=e||0,n=n||y5;for(var i in t)if(t.hasOwnProperty(i)){var a=t[i];a!==null&&yn(a)?(yn(r[i])||(r[i]={}),e<n?IC(r[i],a,e+1,n):r[i]=t[i]):gt(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var mr=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)IC(r,t[n]);return r},m5=function(r,t,e,n){Cr(t)||(e=t,t=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(t.prototype,r);return r.prototype=yt(a,r.prototype),r.superclass=i(t.prototype,t),yt(a,e),yt(r,n),r},dm=function(r,t){if(!Fn(r))return-1;var e=Array.prototype.indexOf;if(e)return e.call(r,t);for(var n=-1,i=0;i<r.length;i++)if(r[i]===t){n=i;break}return n},b5=Object.prototype.hasOwnProperty;function OC(r){if(ct(r))return!0;if(Fn(r))return!r.length;var t=SC(r);if(t==="Map"||t==="Set")return!r.size;if(MC(r))return!Object.keys(r).length;for(var e in r)if(b5.call(r,e))return!1;return!0}var Oo=function(r,t){if(r===t)return!0;if(!r||!t||Ne(r)||Ne(t))return!1;if(Fn(r)||Fn(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n<r.length&&(e=Oo(r[n],t[n]),!!e);n++);return e}if(hd(r)||hd(t)){var i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)return!1;for(var e=!0,n=0;n<i.length&&(e=Oo(r[i[n]],t[i[n]]),!!e);n++);return e}return!1};const x5=function(r,t,e){return Cr(e)?!!e(r,t):Oo(r,t)};var Ss=function(r,t){if(!Fn(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];e.push(t(i,n))}return e},E5=function(r){return r};const w5=function(r,t){t===void 0&&(t=E5);var e={};return bn(r)&&!ct(r)&&Object.keys(r).forEach(function(n){e[n]=t(r[n],n)}),e},za=function(r,t,e){for(var n=0,i=Ne(t)?t.split("."):t;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?e:r},_5=function(r,t,e){var n=r,i=Ne(t)?t.split("."):t;return i.forEach(function(a,o){o<i.length-1?(bn(n[a])||(n[a]=ht(i[o+1])?[]:{}),n=n[a]):n[a]=e}),r};var S5=Object.prototype.hasOwnProperty;const M5=function(r,t){if(r===null||!yn(r))return{};var e={};return me(t,function(n){S5.call(r,n)&&(e[n]=r[n])}),e},C5=function(r,t){return EC(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})},ll=function(r,t,e){var n,i,a,o,s=0;e||(e={});var u=function(){s=e.leading===!1?0:Date.now(),n=null,o=r.apply(i,a),n||(i=a=null)},f=function(){var l=Date.now();!s&&e.leading===!1&&(s=l);var c=t-(l-s);return i=this,a=arguments,c<=0||c>t?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},LC=function(r){return Fn(r)?Array.prototype.slice.call(r):[]};var jc={};const ya=function(r){return r=r||"g",jc[r]?jc[r]+=1:jc[r]=1,r+jc[r]},Ff=function(){},A5=function(r){return r};function uv(r){return ct(r)?0:Fn(r)?r.length:Object.keys(r).length}var Uc;const Gf=TC(function(r,t){t===void 0&&(t={});var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,o=t.fontVariant;return Uc||(Uc=document.createElement("canvas").getContext("2d")),Uc.font=[a,o,i,e+"px",n].join(" "),Uc.measureText(Ne(r)?r:"").width},function(r,t){return t===void 0&&(t={}),iv([r],cm(t)).join("")}),T5=function(r,t,e,n){n===void 0&&(n="...");var i=16,a=Gf(n,e),o=Ne(r)?r:qu(r),s=t,u=[],f,l;if(Gf(r,e)<=t)return r;for(;f=o.substr(0,i),l=Gf(f,e),!(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=Gf(f,e),!(l+a>s);)if(u.push(f),s-=l,o=o.substr(1),!o)return u.join("");return""+u.join("")+n};var I5=function(){function r(){this.map={}}return r.prototype.has=function(t){return this.map[t]!==void 0},r.prototype.get=function(t,e){var n=this.map[t];return n===void 0?e:n},r.prototype.set=function(t,e){this.map[t]=e},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(t){delete this.map[t]},r.prototype.size=function(){return Object.keys(this.map).length},r}();const O5=Object.freeze(Object.defineProperty({__proto__:null,Cache:I5,assign:yt,augment:g5,clamp:U3,clearAnimationFrame:AC,clone:Vt,contains:cd,debounce:Nl,deepMix:mr,difference:b3,each:me,endsWith:P3,every:N3,extend:m5,filter:av,find:E3,findIndex:w3,firstValue:_3,fixedBase:Fh,flatten:S3,flattenDeep:yC,forIn:me,get:za,getEllipsisText:T5,getRange:mC,getType:SC,getWrapBehavior:G3,group:F3,groupBy:dd,groupToMap:wC,has:EE,hasKey:EE,hasValue:r5,head:ha,identity:A5,includes:cd,indexOf:dm,isArguments:u5,isArray:gt,isArrayLike:Fn,isBoolean:Pl,isDate:hm,isDecimal:$3,isElement:p5,isEmpty:OC,isEqual:Oo,isEqualWith:x5,isError:f5,isEven:W3,isFinite:l5,isFunction:Cr,isInteger:X3,isMatch:gC,isNegative:Y3,isNil:ct,isNull:c5,isNumber:ht,isNumberEqual:_C,isObject:bn,isObjectLike:hd,isOdd:H3,isPlainObject:yn,isPositive:K3,isPrototype:MC,isRegExp:d5,isString:Ne,isType:Fi,isUndefined:v5,keys:pC,last:yi,lowerCase:n5,lowerFirst:i5,map:Ss,mapValues:w5,max:pa,maxBy:q3,measureTextWidth:Gf,memoize:TC,min:ga,minBy:Z3,mix:yt,mod:ov,noop:Ff,number2color:z3,omit:C5,parseRadius:j3,pick:M5,pull:A3,pullAt:xC,reduce:EC,remove:I3,requestAnimationFrame:CC,set:_5,size:uv,some:R3,sortBy:O3,startsWith:k3,substitute:a5,throttle:ll,toArray:LC,toDegree:J3,toInteger:e5,toRadian:sv,toString:qu,union:L3,uniq:fl,uniqueId:ya,upperCase:o5,upperFirst:ku,values:cm,valuesOfKey:D3,wrapBehavior:vs},Symbol.toStringTag,{value:"Module"})),L5={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(t){return Object.assign(this,t),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(t){var e=this,n=this.events;this.graph=t,(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&t.get("canvas").set("draggable",!0),me(n,function(i,a){t.on(a,i)}),document.addEventListener("visibilitychange",function(){e.keydown=!1})},unbind:function(t){var e=this.events,n=t.get("canvas").get("draggable");(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&t.get("canvas").set("draggable",!1),me(e,function(i,a){t.off(a,i)}),t.get("canvas").set("draggable",n)},get:function(t){return this[t]},set:function(t,e){return this[t]=e,this}};var vm=function(){function r(){}return r.registerBehavior=function(t,e){if(!e)throw new Error("please specify handler for this behavior: ".concat(t));var n=Vt(L5);Object.assign(n,e);var i=function(o){var s=this;Object.assign(this,this.getDefaultCfg(),o);var u=this.getEvents();this.events=null;var f={};u&&(me(u,function(l,c){f[c]=vs(s,l)}),this.events=f)};i.prototype=n,r.types[t]=i},r.hasBehavior=function(t){return!!r.types[t]},r.getBehavior=function(t){return r.types[t]},r.types={},r}(),D5="*",DC=function(){function r(){this._events={}}return r.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},r.prototype.once=function(t,e){return this.on(t,e,!0)},r.prototype.emit=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=this._events[t]||[],o=this._events[D5]||[],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 e._events[t],f--,l--),h.apply(e,n)}};s(a),s(o)},r.prototype.off=function(t,e){if(!t)this._events={};else if(!e)delete this._events[t];else{for(var n=this._events[t]||[],i=n.length,a=0;a<i;a++)n[a].callback===e&&(n.splice(a,1),i--,a--);n.length===0&&delete this._events[t]}return this},r.prototype.getEvents=function(){return this._events},r}(),_t=1e-6,Qt=typeof Float32Array<"u"?Float32Array:Array,Di=Math.random;function k5(r){Qt=r}var P5=Math.PI/180;function N5(r){return r*P5}function R5(r,t){return Math.abs(r-t)<=_t*Math.max(1,Math.abs(r),Math.abs(t))}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});const B5=Object.freeze(Object.defineProperty({__proto__:null,get ARRAY_TYPE(){return Qt},EPSILON:_t,RANDOM:Di,equals:R5,setMatrixArrayType:k5,toRadian:N5},Symbol.toStringTag,{value:"Module"}));function F5(){var r=new Qt(4);return Qt!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}function G5(r){var t=new Qt(4);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t}function z5(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function j5(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}function U5(r,t,e,n){var i=new Qt(4);return i[0]=r,i[1]=t,i[2]=e,i[3]=n,i}function $5(r,t,e,n,i){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function W5(r,t){if(r===t){var e=t[1];r[1]=t[2],r[2]=e}else r[0]=t[0],r[1]=t[2],r[2]=t[1],r[3]=t[3];return r}function X5(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=e*a-i*n;return o?(o=1/o,r[0]=a*o,r[1]=-n*o,r[2]=-i*o,r[3]=e*o,r):null}function Y5(r,t){var e=t[0];return r[0]=t[3],r[1]=-t[1],r[2]=-t[2],r[3]=e,r}function V5(r){return r[0]*r[3]-r[2]*r[1]}function kC(r,t,e){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]=n*s+a*u,r[1]=i*s+o*u,r[2]=n*f+a*l,r[3]=i*f+o*l,r}function H5(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(e),u=Math.cos(e);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 K5(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1];return r[0]=n*s,r[1]=i*s,r[2]=a*u,r[3]=o*u,r}function q5(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=-e,r[3]=n,r}function Z5(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=t[1],r}function Q5(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function J5(r){return Math.hypot(r[0],r[1],r[2],r[3])}function eB(r,t,e,n){return r[2]=n[2]/n[0],e[0]=n[0],e[1]=n[1],e[3]=n[3]-r[2]*e[1],[r,t,e]}function tB(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r}function PC(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r}function rB(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]}function nB(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],o=t[0],s=t[1],u=t[2],f=t[3];return Math.abs(e-o)<=_t*Math.max(1,Math.abs(e),Math.abs(o))&&Math.abs(n-s)<=_t*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=_t*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=_t*Math.max(1,Math.abs(a),Math.abs(f))}function iB(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r}function aB(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r}var oB=kC,sB=PC;const uB=Object.freeze(Object.defineProperty({__proto__:null,LDU:eB,add:tB,adjoint:Y5,clone:G5,copy:z5,create:F5,determinant:V5,equals:nB,exactEquals:rB,frob:J5,fromRotation:q5,fromScaling:Z5,fromValues:U5,identity:j5,invert:X5,mul:oB,multiply:kC,multiplyScalar:iB,multiplyScalarAndAdd:aB,rotate:H5,scale:K5,set:$5,str:Q5,sub:sB,subtract:PC,transpose:W5},Symbol.toStringTag,{value:"Module"}));function fB(){var r=new Qt(6);return Qt!=Float32Array&&(r[1]=0,r[2]=0,r[4]=0,r[5]=0),r[0]=1,r[3]=1,r}function lB(r){var t=new Qt(6);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t}function cB(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r}function hB(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function dB(r,t,e,n,i,a){var o=new Qt(6);return o[0]=r,o[1]=t,o[2]=e,o[3]=n,o[4]=i,o[5]=a,o}function vB(r,t,e,n,i,a,o){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r}function pB(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=e*a-n*i;return u?(u=1/u,r[0]=a*u,r[1]=-n*u,r[2]=-i*u,r[3]=e*u,r[4]=(i*s-a*o)*u,r[5]=(n*o-e*s)*u,r):null}function gB(r){return r[0]*r[3]-r[1]*r[2]}function NC(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=e[0],l=e[1],c=e[2],h=e[3],d=e[4],v=e[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 yB(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=Math.sin(e),l=Math.cos(e);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 mB(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=e[0],l=e[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 bB(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=e[0],l=e[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 xB(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=-e,r[3]=n,r[4]=0,r[5]=0,r}function EB(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=t[1],r[4]=0,r[5]=0,r}function wB(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=t[0],r[5]=t[1],r}function _B(r){return"mat2d("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+")"}function SB(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],1)}function MB(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r}function RC(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r}function CB(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r}function AB(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r}function TB(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]}function IB(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=t[0],f=t[1],l=t[2],c=t[3],h=t[4],d=t[5];return Math.abs(e-u)<=_t*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(n-f)<=_t*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=_t*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-c)<=_t*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-h)<=_t*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=_t*Math.max(1,Math.abs(s),Math.abs(d))}var OB=NC,LB=RC;const DB=Object.freeze(Object.defineProperty({__proto__:null,add:MB,clone:lB,copy:cB,create:fB,determinant:gB,equals:IB,exactEquals:TB,frob:SB,fromRotation:xB,fromScaling:EB,fromTranslation:wB,fromValues:dB,identity:hB,invert:pB,mul:OB,multiply:NC,multiplyScalar:CB,multiplyScalarAndAdd:AB,rotate:yB,scale:mB,set:vB,str:_B,sub:LB,subtract:RC,translate:bB},Symbol.toStringTag,{value:"Module"}));function BC(){var r=new Qt(9);return Qt!=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 kB(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[4],r[4]=t[5],r[5]=t[6],r[6]=t[8],r[7]=t[9],r[8]=t[10],r}function PB(r){var t=new Qt(9);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t}function NB(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r}function RB(r,t,e,n,i,a,o,s,u){var f=new Qt(9);return f[0]=r,f[1]=t,f[2]=e,f[3]=n,f[4]=i,f[5]=a,f[6]=o,f[7]=s,f[8]=u,f}function BB(r,t,e,n,i,a,o,s,u,f){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r[8]=f,r}function FB(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 GB(r,t){if(r===t){var e=t[1],n=t[2],i=t[5];r[1]=t[3],r[2]=t[6],r[3]=e,r[5]=t[7],r[6]=n,r[7]=i}else r[0]=t[0],r[1]=t[3],r[2]=t[6],r[3]=t[1],r[4]=t[4],r[5]=t[7],r[6]=t[2],r[7]=t[5],r[8]=t[8];return r}function pm(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=l*o-s*f,h=-l*a+s*u,d=f*a-o*u,v=e*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*e-i*u)*v,r[5]=(-s*e+i*a)*v,r[6]=d*v,r[7]=(-f*e+n*u)*v,r[8]=(o*e-n*a)*v,r):null}function zB(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[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]=e*l-i*u,r[5]=i*a-e*s,r[6]=a*f-o*u,r[7]=n*u-e*f,r[8]=e*o-n*a,r}function jB(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],o=r[5],s=r[6],u=r[7],f=r[8];return t*(f*a-o*u)+e*(-f*i+o*s)+n*(u*i-a*s)}function xa(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[7],c=t[8],h=e[0],d=e[1],v=e[2],p=e[3],g=e[4],y=e[5],m=e[6],b=e[7],x=e[8];return r[0]=h*n+d*o+v*f,r[1]=h*i+d*s+v*l,r[2]=h*a+d*u+v*c,r[3]=p*n+g*o+y*f,r[4]=p*i+g*s+y*l,r[5]=p*a+g*u+y*c,r[6]=m*n+b*o+x*f,r[7]=m*i+b*s+x*l,r[8]=m*a+b*u+x*c,r}function UB(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[7],c=t[8],h=e[0],d=e[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 $B(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[7],c=t[8],h=Math.sin(e),d=Math.cos(e);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 WB(r,t,e){var n=e[0],i=e[1];return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=i*t[3],r[4]=i*t[4],r[5]=i*t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r}function gm(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=t[0],r[7]=t[1],r[8]=1,r}function ym(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=0,r[3]=-e,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function mm(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=t[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function XB(r,t){return r[0]=t[0],r[1]=t[1],r[2]=0,r[3]=t[2],r[4]=t[3],r[5]=0,r[6]=t[4],r[7]=t[5],r[8]=1,r}function YB(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=e+e,s=n+n,u=i+i,f=e*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 VB(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=t[9],h=t[10],d=t[11],v=t[12],p=t[13],g=t[14],y=t[15],m=e*s-n*o,b=e*u-i*o,x=e*f-a*o,E=n*u-i*s,w=n*f-a*s,_=i*f-a*u,M=l*p-c*v,C=l*g-h*v,S=l*y-d*v,A=c*g-h*p,T=c*y-d*p,I=h*y-d*g,D=m*I-b*T+x*A+E*S-w*C+_*M;return D?(D=1/D,r[0]=(s*I-u*T+f*A)*D,r[1]=(u*S-o*I-f*C)*D,r[2]=(o*T-s*S+f*M)*D,r[3]=(i*T-n*I-a*A)*D,r[4]=(e*I-i*S+a*C)*D,r[5]=(n*S-e*T-a*M)*D,r[6]=(p*_-g*w+y*E)*D,r[7]=(g*x-v*_-y*b)*D,r[8]=(v*w-p*x+y*m)*D,r):null}function HB(r,t,e){return r[0]=2/t,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/e,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function KB(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function qB(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function ZB(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r[8]=t[8]+e[8],r}function FC(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r[6]=t[6]-e[6],r[7]=t[7]-e[7],r[8]=t[8]-e[8],r}function QB(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r[6]=t[6]*e,r[7]=t[7]*e,r[8]=t[8]*e,r}function JB(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r[6]=t[6]+e[6]*n,r[7]=t[7]+e[7]*n,r[8]=t[8]+e[8]*n,r}function eF(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]}function tF(r,t){var e=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=t[0],h=t[1],d=t[2],v=t[3],p=t[4],g=t[5],y=t[6],m=t[7],b=t[8];return Math.abs(e-c)<=_t*Math.max(1,Math.abs(e),Math.abs(c))&&Math.abs(n-h)<=_t*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-d)<=_t*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-v)<=_t*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(o-p)<=_t*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-g)<=_t*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(u-y)<=_t*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(f-m)<=_t*Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(l-b)<=_t*Math.max(1,Math.abs(l),Math.abs(b))}var rF=xa,nF=FC;const GC=Object.freeze(Object.defineProperty({__proto__:null,add:ZB,adjoint:zB,clone:PB,copy:NB,create:BC,determinant:jB,equals:tF,exactEquals:eF,frob:qB,fromMat2d:XB,fromMat4:kB,fromQuat:YB,fromRotation:ym,fromScaling:mm,fromTranslation:gm,fromValues:RB,identity:FB,invert:pm,mul:rF,multiply:xa,multiplyScalar:QB,multiplyScalarAndAdd:JB,normalFromMat4:VB,projection:HB,rotate:$B,scale:WB,set:BB,str:KB,sub:nF,subtract:FC,translate:UB,transpose:GB},Symbol.toStringTag,{value:"Module"}));function iF(){var r=new Qt(16);return Qt!=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 aF(r){var t=new Qt(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t}function oF(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function sF(r,t,e,n,i,a,o,s,u,f,l,c,h,d,v,p){var g=new Qt(16);return g[0]=r,g[1]=t,g[2]=e,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 uF(r,t,e,n,i,a,o,s,u,f,l,c,h,d,v,p,g){return r[0]=t,r[1]=e,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 zC(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 fF(r,t){if(r===t){var e=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=e,r[6]=t[9],r[7]=t[13],r[8]=n,r[9]=a,r[11]=t[14],r[12]=i,r[13]=o,r[14]=s}else r[0]=t[0],r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=t[1],r[5]=t[5],r[6]=t[9],r[7]=t[13],r[8]=t[2],r[9]=t[6],r[10]=t[10],r[11]=t[14],r[12]=t[3],r[13]=t[7],r[14]=t[11],r[15]=t[15];return r}function lF(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=t[9],h=t[10],d=t[11],v=t[12],p=t[13],g=t[14],y=t[15],m=e*s-n*o,b=e*u-i*o,x=e*f-a*o,E=n*u-i*s,w=n*f-a*s,_=i*f-a*u,M=l*p-c*v,C=l*g-h*v,S=l*y-d*v,A=c*g-h*p,T=c*y-d*p,I=h*y-d*g,D=m*I-b*T+x*A+E*S-w*C+_*M;return D?(D=1/D,r[0]=(s*I-u*T+f*A)*D,r[1]=(i*T-n*I-a*A)*D,r[2]=(p*_-g*w+y*E)*D,r[3]=(h*w-c*_-d*E)*D,r[4]=(u*S-o*I-f*C)*D,r[5]=(e*I-i*S+a*C)*D,r[6]=(g*x-v*_-y*b)*D,r[7]=(l*_-h*x+d*b)*D,r[8]=(o*T-s*S+f*M)*D,r[9]=(n*S-e*T-a*M)*D,r[10]=(v*w-p*x+y*m)*D,r[11]=(c*x-l*w-d*m)*D,r[12]=(s*C-o*A-u*M)*D,r[13]=(e*A-n*C+i*M)*D,r[14]=(p*b-v*E-g*m)*D,r[15]=(l*E-c*b+h*m)*D,r):null}function cF(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=t[9],h=t[10],d=t[11],v=t[12],p=t[13],g=t[14],y=t[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]=e*(h*y-d*g)-l*(i*y-a*g)+v*(i*d-a*h),r[6]=-(e*(u*y-f*g)-o*(i*y-a*g)+v*(i*f-a*u)),r[7]=e*(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]=-(e*(c*y-d*p)-l*(n*y-a*p)+v*(n*d-a*c)),r[10]=e*(s*y-f*p)-o*(n*y-a*p)+v*(n*f-a*s),r[11]=-(e*(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]=e*(c*g-h*p)-l*(n*g-i*p)+v*(n*h-i*c),r[14]=-(e*(s*g-u*p)-o*(n*g-i*p)+v*(n*u-i*s)),r[15]=e*(s*h-u*c)-o*(n*h-i*c)+l*(n*u-i*s),r}function hF(r){var t=r[0],e=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=t*o-e*a,m=t*s-n*a,b=t*u-i*a,x=e*s-n*o,E=e*u-i*o,w=n*u-i*s,_=f*v-l*d,M=f*p-c*d,C=f*g-h*d,S=l*p-c*v,A=l*g-h*v,T=c*g-h*p;return y*T-m*A+b*S+x*C-E*M+w*_}function jC(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[7],c=t[8],h=t[9],d=t[10],v=t[11],p=t[12],g=t[13],y=t[14],m=t[15],b=e[0],x=e[1],E=e[2],w=e[3];return r[0]=b*n+x*s+E*c+w*p,r[1]=b*i+x*u+E*h+w*g,r[2]=b*a+x*f+E*d+w*y,r[3]=b*o+x*l+E*v+w*m,b=e[4],x=e[5],E=e[6],w=e[7],r[4]=b*n+x*s+E*c+w*p,r[5]=b*i+x*u+E*h+w*g,r[6]=b*a+x*f+E*d+w*y,r[7]=b*o+x*l+E*v+w*m,b=e[8],x=e[9],E=e[10],w=e[11],r[8]=b*n+x*s+E*c+w*p,r[9]=b*i+x*u+E*h+w*g,r[10]=b*a+x*f+E*d+w*y,r[11]=b*o+x*l+E*v+w*m,b=e[12],x=e[13],E=e[14],w=e[15],r[12]=b*n+x*s+E*c+w*p,r[13]=b*i+x*u+E*h+w*g,r[14]=b*a+x*f+E*d+w*y,r[15]=b*o+x*l+E*v+w*m,r}function dF(r,t,e){var n=e[0],i=e[1],a=e[2],o,s,u,f,l,c,h,d,v,p,g,y;return t===r?(r[12]=t[0]*n+t[4]*i+t[8]*a+t[12],r[13]=t[1]*n+t[5]*i+t[9]*a+t[13],r[14]=t[2]*n+t[6]*i+t[10]*a+t[14],r[15]=t[3]*n+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],u=t[2],f=t[3],l=t[4],c=t[5],h=t[6],d=t[7],v=t[8],p=t[9],g=t[10],y=t[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+t[12],r[13]=s*n+c*i+p*a+t[13],r[14]=u*n+h*i+g*a+t[14],r[15]=f*n+d*i+y*a+t[15]),r}function vF(r,t,e){var n=e[0],i=e[1],a=e[2];return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r[3]=t[3]*n,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*a,r[9]=t[9]*a,r[10]=t[10]*a,r[11]=t[11]*a,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function pF(r,t,e,n){var i=n[0],a=n[1],o=n[2],s=Math.hypot(i,a,o),u,f,l,c,h,d,v,p,g,y,m,b,x,E,w,_,M,C,S,A,T,I,D,N;return s<_t?null:(s=1/s,i*=s,a*=s,o*=s,u=Math.sin(e),f=Math.cos(e),l=1-f,c=t[0],h=t[1],d=t[2],v=t[3],p=t[4],g=t[5],y=t[6],m=t[7],b=t[8],x=t[9],E=t[10],w=t[11],_=i*i*l+f,M=a*i*l+o*u,C=o*i*l-a*u,S=i*a*l-o*u,A=a*a*l+f,T=o*a*l+i*u,I=i*o*l+a*u,D=a*o*l-i*u,N=o*o*l+f,r[0]=c*_+p*M+b*C,r[1]=h*_+g*M+x*C,r[2]=d*_+y*M+E*C,r[3]=v*_+m*M+w*C,r[4]=c*S+p*A+b*T,r[5]=h*S+g*A+x*T,r[6]=d*S+y*A+E*T,r[7]=v*S+m*A+w*T,r[8]=c*I+p*D+b*N,r[9]=h*I+g*D+x*N,r[10]=d*I+y*D+E*N,r[11]=v*I+m*D+w*N,t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r)}function gF(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[4],o=t[5],s=t[6],u=t[7],f=t[8],l=t[9],c=t[10],h=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[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 yF(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],o=t[1],s=t[2],u=t[3],f=t[8],l=t[9],c=t[10],h=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[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 mF(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],o=t[1],s=t[2],u=t[3],f=t[4],l=t[5],c=t[6],h=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[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 bF(r,t){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]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function xF(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function EF(r,t,e){var n=e[0],i=e[1],a=e[2],o=Math.hypot(n,i,a),s,u,f;return o<_t?null:(o=1/o,n*=o,i*=o,a*=o,s=Math.sin(t),u=Math.cos(t),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 wF(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=e,r[7]=0,r[8]=0,r[9]=-e,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function _F(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=0,r[2]=-e,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=e,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function SF(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=0,r[3]=0,r[4]=-e,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 UC(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[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]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function MF(r,t){var e=new Qt(3),n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[7],c=n*n+i*i+a*a+o*o;return c>0?(e[0]=(s*o+l*n+u*a-f*i)*2/c,e[1]=(u*o+l*i+f*n-s*a)*2/c,e[2]=(f*o+l*a+s*i-u*n)*2/c):(e[0]=(s*o+l*n+u*a-f*i)*2,e[1]=(u*o+l*i+f*n-s*a)*2,e[2]=(f*o+l*a+s*i-u*n)*2),UC(r,t,e),r}function $C(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function WC(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],f=t[9],l=t[10];return r[0]=Math.hypot(e,n,i),r[1]=Math.hypot(a,o,s),r[2]=Math.hypot(u,f,l),r}function XC(r,t){var e=new Qt(3);WC(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],o=t[0]*n,s=t[1]*i,u=t[2]*a,f=t[4]*n,l=t[5]*i,c=t[6]*a,h=t[8]*n,d=t[9]*i,v=t[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 CF(r,t,e,n){var i=t[0],a=t[1],o=t[2],s=t[3],u=i+i,f=a+a,l=o+o,c=i*u,h=i*f,d=i*l,v=a*f,p=a*l,g=o*l,y=s*u,m=s*f,b=s*l,x=n[0],E=n[1],w=n[2];return r[0]=(1-(v+g))*x,r[1]=(h+b)*x,r[2]=(d-m)*x,r[3]=0,r[4]=(h-b)*E,r[5]=(1-(c+g))*E,r[6]=(p+y)*E,r[7]=0,r[8]=(d+m)*w,r[9]=(p-y)*w,r[10]=(1-(c+v))*w,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function AF(r,t,e,n,i){var a=t[0],o=t[1],s=t[2],u=t[3],f=a+a,l=o+o,c=s+s,h=a*f,d=a*l,v=a*c,p=o*l,g=o*c,y=s*c,m=u*f,b=u*l,x=u*c,E=n[0],w=n[1],_=n[2],M=i[0],C=i[1],S=i[2],A=(1-(p+y))*E,T=(d+x)*E,I=(v-b)*E,D=(d-x)*w,N=(1-(h+y))*w,P=(g+m)*w,G=(v+b)*_,W=(g-m)*_,k=(1-(h+p))*_;return r[0]=A,r[1]=T,r[2]=I,r[3]=0,r[4]=D,r[5]=N,r[6]=P,r[7]=0,r[8]=G,r[9]=W,r[10]=k,r[11]=0,r[12]=e[0]+M-(A*M+D*C+G*S),r[13]=e[1]+C-(T*M+N*C+W*S),r[14]=e[2]+S-(I*M+P*C+k*S),r[15]=1,r}function TF(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=e+e,s=n+n,u=i+i,f=e*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 IF(r,t,e,n,i,a,o){var s=1/(e-t),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]=(e+t)*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 YC(r,t,e,n,i){var a=1/Math.tan(t/2),o;return r[0]=a/e,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 OF=YC;function LF(r,t,e,n,i){var a=1/Math.tan(t/2),o;return r[0]=a/e,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 DF(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.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/(e-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*e/(e-n),r[15]=0,r}function VC(r,t,e,n,i,a,o){var s=1/(t-e),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]=(t+e)*s,r[13]=(i+n)*u,r[14]=(o+a)*f,r[15]=1,r}var kF=VC;function PF(r,t,e,n,i,a,o){var s=1/(t-e),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]=(t+e)*s,r[13]=(i+n)*u,r[14]=a*f,r[15]=1,r}function NF(r,t,e,n){var i,a,o,s,u,f,l,c,h,d,v=t[0],p=t[1],g=t[2],y=n[0],m=n[1],b=n[2],x=e[0],E=e[1],w=e[2];return Math.abs(v-x)<_t&&Math.abs(p-E)<_t&&Math.abs(g-w)<_t?zC(r):(l=v-x,c=p-E,h=g-w,d=1/Math.hypot(l,c,h),l*=d,c*=d,h*=d,i=m*h-b*c,a=b*l-y*h,o=y*c-m*l,d=Math.hypot(i,a,o),d?(d=1/d,i*=d,a*=d,o*=d):(i=0,a=0,o=0),s=c*o-h*a,u=h*i-l*o,f=l*a-c*i,d=Math.hypot(s,u,f),d?(d=1/d,s*=d,u*=d,f*=d):(s=0,u=0,f=0),r[0]=i,r[1]=s,r[2]=l,r[3]=0,r[4]=a,r[5]=u,r[6]=c,r[7]=0,r[8]=o,r[9]=f,r[10]=h,r[11]=0,r[12]=-(i*v+a*p+o*g),r[13]=-(s*v+u*p+f*g),r[14]=-(l*v+c*p+h*g),r[15]=1,r)}function RF(r,t,e,n){var i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],f=n[2],l=i-e[0],c=a-e[1],h=o-e[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 BF(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 FF(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 GF(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r[8]=t[8]+e[8],r[9]=t[9]+e[9],r[10]=t[10]+e[10],r[11]=t[11]+e[11],r[12]=t[12]+e[12],r[13]=t[13]+e[13],r[14]=t[14]+e[14],r[15]=t[15]+e[15],r}function HC(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r[6]=t[6]-e[6],r[7]=t[7]-e[7],r[8]=t[8]-e[8],r[9]=t[9]-e[9],r[10]=t[10]-e[10],r[11]=t[11]-e[11],r[12]=t[12]-e[12],r[13]=t[13]-e[13],r[14]=t[14]-e[14],r[15]=t[15]-e[15],r}function zF(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r[6]=t[6]*e,r[7]=t[7]*e,r[8]=t[8]*e,r[9]=t[9]*e,r[10]=t[10]*e,r[11]=t[11]*e,r[12]=t[12]*e,r[13]=t[13]*e,r[14]=t[14]*e,r[15]=t[15]*e,r}function jF(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r[6]=t[6]+e[6]*n,r[7]=t[7]+e[7]*n,r[8]=t[8]+e[8]*n,r[9]=t[9]+e[9]*n,r[10]=t[10]+e[10]*n,r[11]=t[11]+e[11]*n,r[12]=t[12]+e[12]*n,r[13]=t[13]+e[13]*n,r[14]=t[14]+e[14]*n,r[15]=t[15]+e[15]*n,r}function UF(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]}function $F(r,t){var e=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=t[0],b=t[1],x=t[2],E=t[3],w=t[4],_=t[5],M=t[6],C=t[7],S=t[8],A=t[9],T=t[10],I=t[11],D=t[12],N=t[13],P=t[14],G=t[15];return Math.abs(e-m)<=_t*Math.max(1,Math.abs(e),Math.abs(m))&&Math.abs(n-b)<=_t*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=_t*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-E)<=_t*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(o-w)<=_t*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-_)<=_t*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(u-M)<=_t*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(f-C)<=_t*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(l-S)<=_t*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-A)<=_t*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(h-T)<=_t*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(d-I)<=_t*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(v-D)<=_t*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(p-N)<=_t*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(g-P)<=_t*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(y-G)<=_t*Math.max(1,Math.abs(y),Math.abs(G))}var WF=jC,XF=HC;const YF=Object.freeze(Object.defineProperty({__proto__:null,add:GF,adjoint:cF,clone:aF,copy:oF,create:iF,determinant:hF,equals:$F,exactEquals:UF,frob:FF,fromQuat:TF,fromQuat2:MF,fromRotation:EF,fromRotationTranslation:UC,fromRotationTranslationScale:CF,fromRotationTranslationScaleOrigin:AF,fromScaling:xF,fromTranslation:bF,fromValues:sF,fromXRotation:wF,fromYRotation:_F,fromZRotation:SF,frustum:IF,getRotation:XC,getScaling:WC,getTranslation:$C,identity:zC,invert:lF,lookAt:NF,mul:WF,multiply:jC,multiplyScalar:zF,multiplyScalarAndAdd:jF,ortho:kF,orthoNO:VC,orthoZO:PF,perspective:OF,perspectiveFromFieldOfView:DF,perspectiveNO:YC,perspectiveZO:LF,rotate:pF,rotateX:gF,rotateY:yF,rotateZ:mF,scale:vF,set:uF,str:BF,sub:XF,subtract:HC,targetTo:RF,translate:dF,transpose:fF},Symbol.toStringTag,{value:"Module"}));function bm(){var r=new Qt(3);return Qt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function VF(r){var t=new Qt(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function KC(r){var t=r[0],e=r[1],n=r[2];return Math.hypot(t,e,n)}function C0(r,t,e){var n=new Qt(3);return n[0]=r,n[1]=t,n[2]=e,n}function HF(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function KF(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function qF(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function qC(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function ZC(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function QC(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r[2]=t[2]/e[2],r}function ZF(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r}function QF(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r}function JF(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r[2]=Math.min(t[2],e[2]),r}function e4(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r}function t4(r,t){return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r}function r4(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function n4(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r}function JC(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2];return Math.hypot(e,n,i)}function eA(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2];return e*e+n*n+i*i}function tA(r){var t=r[0],e=r[1],n=r[2];return t*t+e*e+n*n}function i4(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r}function a4(r,t){return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r}function rA(r,t){var e=t[0],n=t[1],i=t[2],a=e*e+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r}function xm(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Gh(r,t,e){var n=t[0],i=t[1],a=t[2],o=e[0],s=e[1],u=e[2];return r[0]=i*u-a*s,r[1]=a*o-n*u,r[2]=n*s-i*o,r}function o4(r,t,e,n){var i=t[0],a=t[1],o=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=o+n*(e[2]-o),r}function s4(r,t,e,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]=t[0]*s+e[0]*u+n[0]*f+i[0]*l,r[1]=t[1]*s+e[1]*u+n[1]*f+i[1]*l,r[2]=t[2]*s+e[2]*u+n[2]*f+i[2]*l,r}function u4(r,t,e,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]=t[0]*f+e[0]*l+n[0]*c+i[0]*h,r[1]=t[1]*f+e[1]*l+n[1]*c+i[1]*h,r[2]=t[2]*f+e[2]*l+n[2]*c+i[2]*h,r}function f4(r,t){t=t||1;var e=Di()*2*Math.PI,n=Di()*2-1,i=Math.sqrt(1-n*n)*t;return r[0]=Math.cos(e)*i,r[1]=Math.sin(e)*i,r[2]=n*t,r}function l4(r,t,e){var n=t[0],i=t[1],a=t[2],o=e[3]*n+e[7]*i+e[11]*a+e[15];return o=o||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/o,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/o,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/o,r}function fv(r,t,e){var n=t[0],i=t[1],a=t[2];return r[0]=n*e[0]+i*e[3]+a*e[6],r[1]=n*e[1]+i*e[4]+a*e[7],r[2]=n*e[2]+i*e[5]+a*e[8],r}function c4(r,t,e){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[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 h4(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[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]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function d4(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[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]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function v4(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[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]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function p4(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],o=t[1],s=t[2],u=Math.sqrt(e*e+n*n+i*i),f=Math.sqrt(a*a+o*o+s*s),l=u*f,c=l&&xm(r,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))}function g4(r){return r[0]=0,r[1]=0,r[2]=0,r}function y4(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function m4(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]}function b4(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],o=t[1],s=t[2];return Math.abs(e-a)<=_t*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-o)<=_t*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=_t*Math.max(1,Math.abs(i),Math.abs(s))}var x4=qC,E4=ZC,w4=QC,_4=JC,S4=eA,nA=KC,M4=tA,C4=function(){var r=bm();return function(t,e,n,i,a,o){var s,u;for(e||(e=3),n||(n=0),i?u=Math.min(i*e+n,t.length):u=t.length,s=n;s<u;s+=e)r[0]=t[s],r[1]=t[s+1],r[2]=t[s+2],a(r,r,o),t[s]=r[0],t[s+1]=r[1],t[s+2]=r[2];return t}}();const A4=Object.freeze(Object.defineProperty({__proto__:null,add:qF,angle:p4,bezier:u4,ceil:ZF,clone:VF,copy:HF,create:bm,cross:Gh,dist:_4,distance:JC,div:w4,divide:QC,dot:xm,equals:b4,exactEquals:m4,floor:QF,forEach:C4,fromValues:C0,hermite:s4,inverse:a4,len:nA,length:KC,lerp:o4,max:e4,min:JF,mul:E4,multiply:ZC,negate:i4,normalize:rA,random:f4,rotateX:h4,rotateY:d4,rotateZ:v4,round:t4,scale:r4,scaleAndAdd:n4,set:KF,sqrDist:S4,sqrLen:M4,squaredDistance:eA,squaredLength:tA,str:y4,sub:x4,subtract:qC,transformMat3:fv,transformMat4:l4,transformQuat:c4,zero:g4},Symbol.toStringTag,{value:"Module"}));function iA(){var r=new Qt(4);return Qt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function aA(r){var t=new Qt(4);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t}function oA(r,t,e,n){var i=new Qt(4);return i[0]=r,i[1]=t,i[2]=e,i[3]=n,i}function sA(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function uA(r,t,e,n,i){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function fA(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r}function lA(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r}function cA(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r[3]=t[3]*e[3],r}function hA(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r[2]=t[2]/e[2],r[3]=t[3]/e[3],r}function T4(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r[3]=Math.ceil(t[3]),r}function I4(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r[3]=Math.floor(t[3]),r}function O4(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r[2]=Math.min(t[2],e[2]),r[3]=Math.min(t[3],e[3]),r}function L4(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r[3]=Math.max(t[3],e[3]),r}function D4(r,t){return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r[3]=Math.round(t[3]),r}function dA(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r}function k4(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r}function vA(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2],a=t[3]-r[3];return Math.hypot(e,n,i,a)}function pA(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2],a=t[3]-r[3];return e*e+n*n+i*i+a*a}function Em(r){var t=r[0],e=r[1],n=r[2],i=r[3];return Math.hypot(t,e,n,i)}function wm(r){var t=r[0],e=r[1],n=r[2],i=r[3];return t*t+e*e+n*n+i*i}function P4(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r}function N4(r,t){return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r[3]=1/t[3],r}function gA(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=e*e+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),r[0]=e*o,r[1]=n*o,r[2]=i*o,r[3]=a*o,r}function yA(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]*t[3]}function R4(r,t,e,n){var i=e[0]*n[1]-e[1]*n[0],a=e[0]*n[2]-e[2]*n[0],o=e[0]*n[3]-e[3]*n[0],s=e[1]*n[2]-e[2]*n[1],u=e[1]*n[3]-e[3]*n[1],f=e[2]*n[3]-e[3]*n[2],l=t[0],c=t[1],h=t[2],d=t[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 mA(r,t,e,n){var i=t[0],a=t[1],o=t[2],s=t[3];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=o+n*(e[2]-o),r[3]=s+n*(e[3]-s),r}function B4(r,t){t=t||1;var e,n,i,a,o,s;do e=Di()*2-1,n=Di()*2-1,o=e*e+n*n;while(o>=1);do i=Di()*2-1,a=Di()*2-1,s=i*i+a*a;while(s>=1);var u=Math.sqrt((1-o)/s);return r[0]=t*e,r[1]=t*n,r[2]=t*i*u,r[3]=t*a*u,r}function F4(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3];return r[0]=e[0]*n+e[4]*i+e[8]*a+e[12]*o,r[1]=e[1]*n+e[5]*i+e[9]*a+e[13]*o,r[2]=e[2]*n+e[6]*i+e[10]*a+e[14]*o,r[3]=e[3]*n+e[7]*i+e[11]*a+e[15]*o,r}function G4(r,t,e){var n=t[0],i=t[1],a=t[2],o=e[0],s=e[1],u=e[2],f=e[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]=t[3],r}function z4(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function j4(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function bA(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]}function xA(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],o=t[0],s=t[1],u=t[2],f=t[3];return Math.abs(e-o)<=_t*Math.max(1,Math.abs(e),Math.abs(o))&&Math.abs(n-s)<=_t*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=_t*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=_t*Math.max(1,Math.abs(a),Math.abs(f))}var U4=lA,$4=cA,W4=hA,X4=vA,Y4=pA,V4=Em,H4=wm,K4=function(){var r=iA();return function(t,e,n,i,a,o){var s,u;for(e||(e=4),n||(n=0),i?u=Math.min(i*e+n,t.length):u=t.length,s=n;s<u;s+=e)r[0]=t[s],r[1]=t[s+1],r[2]=t[s+2],r[3]=t[s+3],a(r,r,o),t[s]=r[0],t[s+1]=r[1],t[s+2]=r[2],t[s+3]=r[3];return t}}();const q4=Object.freeze(Object.defineProperty({__proto__:null,add:fA,ceil:T4,clone:aA,copy:sA,create:iA,cross:R4,dist:X4,distance:vA,div:W4,divide:hA,dot:yA,equals:xA,exactEquals:bA,floor:I4,forEach:K4,fromValues:oA,inverse:N4,len:V4,length:Em,lerp:mA,max:L4,min:O4,mul:$4,multiply:cA,negate:P4,normalize:gA,random:B4,round:D4,scale:dA,scaleAndAdd:k4,set:uA,sqrDist:Y4,sqrLen:H4,squaredDistance:pA,squaredLength:wm,str:j4,sub:U4,subtract:lA,transformMat4:F4,transformQuat:G4,zero:z4},Symbol.toStringTag,{value:"Module"}));function vd(){var r=new Qt(4);return Qt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Z4(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function EA(r,t,e){e=e*.5;var n=Math.sin(e);return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=Math.cos(e),r}function Q4(r,t){var e=Math.acos(t[3])*2,n=Math.sin(e/2);return n>_t?(r[0]=t[0]/n,r[1]=t[1]/n,r[2]=t[2]/n):(r[0]=1,r[1]=0,r[2]=0),e}function J4(r,t){var e=Sm(r,t);return Math.acos(2*e*e-1)}function wA(r,t,e){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]=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 _A(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(e),u=Math.cos(e);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 SA(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(e),u=Math.cos(e);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 MA(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(e),u=Math.cos(e);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 e6(r,t){var e=t[0],n=t[1],i=t[2];return r[0]=e,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-e*e-n*n-i*i)),r}function CA(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=Math.sqrt(e*e+n*n+i*i),s=Math.exp(a),u=o>0?s*Math.sin(o)/o:0;return r[0]=e*u,r[1]=n*u,r[2]=i*u,r[3]=s*Math.cos(o),r}function AA(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=Math.sqrt(e*e+n*n+i*i),s=o>0?Math.atan2(o,a)/o:0;return r[0]=e*s,r[1]=n*s,r[2]=i*s,r[3]=.5*Math.log(e*e+n*n+i*i+a*a),r}function t6(r,t,e){return AA(r,t),IA(r,r,e),CA(r,r),r}function zh(r,t,e,n){var i=t[0],a=t[1],o=t[2],s=t[3],u=e[0],f=e[1],l=e[2],c=e[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>_t?(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 r6(r){var t=Di(),e=Di(),n=Di(),i=Math.sqrt(1-t),a=Math.sqrt(t);return r[0]=i*Math.sin(2*Math.PI*e),r[1]=i*Math.cos(2*Math.PI*e),r[2]=a*Math.sin(2*Math.PI*n),r[3]=a*Math.cos(2*Math.PI*n),r}function n6(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],o=e*e+n*n+i*i+a*a,s=o?1/o:0;return r[0]=-e*s,r[1]=-n*s,r[2]=-i*s,r[3]=a*s,r}function i6(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r}function TA(r,t){var e=t[0]+t[4]+t[8],n;if(e>0)n=Math.sqrt(e+1),r[3]=.5*n,n=.5/n,r[0]=(t[5]-t[7])*n,r[1]=(t[6]-t[2])*n,r[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[o*3+o]+1),r[i]=.5*n,n=.5/n,r[3]=(t[a*3+o]-t[o*3+a])*n,r[a]=(t[a*3+i]+t[i*3+a])*n,r[o]=(t[o*3+i]+t[i*3+o])*n}return r}function a6(r,t,e,n){var i=.5*Math.PI/180;t*=i,e*=i,n*=i;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(e),u=Math.cos(e),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 o6(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var s6=aA,u6=oA,_m=sA,f6=uA,l6=fA,c6=wA,IA=dA,Sm=yA,h6=mA,Mm=Em,d6=Mm,Cm=wm,v6=Cm,Am=gA,p6=bA,g6=xA,y6=function(){var r=bm(),t=C0(1,0,0),e=C0(0,1,0);return function(n,i,a){var o=xm(i,a);return o<-.999999?(Gh(r,t,i),nA(r)<1e-6&&Gh(r,e,i),rA(r,r),EA(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Gh(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,Am(n,n))}}(),m6=function(){var r=vd(),t=vd();return function(e,n,i,a,o,s){return zh(r,n,o,s),zh(t,i,a,s),zh(e,r,t,2*s*(1-s)),e}}(),b6=function(){var r=BC();return function(t,e,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]=-e[0],r[5]=-e[1],r[8]=-e[2],Am(t,TA(t,r))}}();const x6=Object.freeze(Object.defineProperty({__proto__:null,add:l6,calculateW:e6,clone:s6,conjugate:i6,copy:_m,create:vd,dot:Sm,equals:g6,exactEquals:p6,exp:CA,fromEuler:a6,fromMat3:TA,fromValues:u6,getAngle:J4,getAxisAngle:Q4,identity:Z4,invert:n6,len:d6,length:Mm,lerp:h6,ln:AA,mul:c6,multiply:wA,normalize:Am,pow:t6,random:r6,rotateX:_A,rotateY:SA,rotateZ:MA,rotationTo:y6,scale:IA,set:f6,setAxes:b6,setAxisAngle:EA,slerp:zh,sqlerp:m6,sqrLen:v6,squaredLength:Cm,str:o6},Symbol.toStringTag,{value:"Module"}));function E6(){var r=new Qt(8);return Qt!=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 w6(r){var t=new Qt(8);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t}function _6(r,t,e,n,i,a,o,s){var u=new Qt(8);return u[0]=r,u[1]=t,u[2]=e,u[3]=n,u[4]=i,u[5]=a,u[6]=o,u[7]=s,u}function S6(r,t,e,n,i,a,o){var s=new Qt(8);s[0]=r,s[1]=t,s[2]=e,s[3]=n;var u=i*.5,f=a*.5,l=o*.5;return s[4]=u*n+f*e-l*t,s[5]=f*n+l*r-u*e,s[6]=l*n+u*t-f*r,s[7]=-u*r-f*t-l*e,s}function OA(r,t,e){var n=e[0]*.5,i=e[1]*.5,a=e[2]*.5,o=t[0],s=t[1],u=t[2],f=t[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 M6(r,t){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r[4]=t[0]*.5,r[5]=t[1]*.5,r[6]=t[2]*.5,r[7]=0,r}function C6(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=0,r[5]=0,r[6]=0,r[7]=0,r}function A6(r,t){var e=vd();XC(e,t);var n=new Qt(3);return $C(n,t),OA(r,e,n),r}function LA(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r}function T6(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 I6(r,t,e,n,i,a,o,s,u){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r}var O6=_m;function L6(r,t){return r[0]=t[4],r[1]=t[5],r[2]=t[6],r[3]=t[7],r}var D6=_m;function k6(r,t){return r[4]=t[0],r[5]=t[1],r[6]=t[2],r[7]=t[3],r}function P6(r,t){var e=t[4],n=t[5],i=t[6],a=t[7],o=-t[0],s=-t[1],u=-t[2],f=t[3];return r[0]=(e*f+a*o+n*u-i*s)*2,r[1]=(n*f+a*s+i*o-e*u)*2,r[2]=(i*f+a*u+e*s-n*o)*2,r}function N6(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0]*.5,u=e[1]*.5,f=e[2]*.5,l=t[4],c=t[5],h=t[6],d=t[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 R6(r,t,e){var n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[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 _A(r,t,e),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 B6(r,t,e){var n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[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 SA(r,t,e),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 F6(r,t,e){var n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[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 MA(r,t,e),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 G6(r,t,e){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]=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=t[4],u=t[5],f=t[6],l=t[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 z6(r,t,e){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]=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=e[4],u=e[5],f=e[6],l=e[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 j6(r,t,e,n){if(Math.abs(n)<_t)return LA(r,t);var i=Math.hypot(e[0],e[1],e[2]);n=n*.5;var a=Math.sin(n),o=a*e[0]/i,s=a*e[1]/i,u=a*e[2]/i,f=Math.cos(n),l=t[0],c=t[1],h=t[2],d=t[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=t[4],p=t[5],g=t[6],y=t[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 U6(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r}function DA(r,t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[4],u=e[5],f=e[6],l=e[7],c=t[4],h=t[5],d=t[6],v=t[7],p=e[0],g=e[1],y=e[2],m=e[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 $6=DA;function W6(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r[6]=t[6]*e,r[7]=t[7]*e,r}var kA=Sm;function X6(r,t,e,n){var i=1-n;return kA(t,e)<0&&(n=-n),r[0]=t[0]*i+e[0]*n,r[1]=t[1]*i+e[1]*n,r[2]=t[2]*i+e[2]*n,r[3]=t[3]*i+e[3]*n,r[4]=t[4]*i+e[4]*n,r[5]=t[5]*i+e[5]*n,r[6]=t[6]*i+e[6]*n,r[7]=t[7]*i+e[7]*n,r}function Y6(r,t){var e=lv(t);return r[0]=-t[0]/e,r[1]=-t[1]/e,r[2]=-t[2]/e,r[3]=t[3]/e,r[4]=-t[4]/e,r[5]=-t[5]/e,r[6]=-t[6]/e,r[7]=t[7]/e,r}function V6(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[7]=t[7],r}var PA=Mm,H6=PA,lv=Cm,K6=lv;function q6(r,t){var e=lv(t);if(e>0){e=Math.sqrt(e);var n=t[0]/e,i=t[1]/e,a=t[2]/e,o=t[3]/e,s=t[4],u=t[5],f=t[6],l=t[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)/e,r[5]=(u-i*c)/e,r[6]=(f-a*c)/e,r[7]=(l-o*c)/e}return r}function Z6(r){return"quat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+")"}function Q6(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]}function J6(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=t[0],c=t[1],h=t[2],d=t[3],v=t[4],p=t[5],g=t[6],y=t[7];return Math.abs(e-l)<=_t*Math.max(1,Math.abs(e),Math.abs(l))&&Math.abs(n-c)<=_t*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=_t*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-d)<=_t*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-v)<=_t*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(s-p)<=_t*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-g)<=_t*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(f-y)<=_t*Math.max(1,Math.abs(f),Math.abs(y))}const eG=Object.freeze(Object.defineProperty({__proto__:null,add:U6,clone:w6,conjugate:V6,copy:LA,create:E6,dot:kA,equals:J6,exactEquals:Q6,fromMat4:A6,fromRotation:C6,fromRotationTranslation:OA,fromRotationTranslationValues:S6,fromTranslation:M6,fromValues:_6,getDual:L6,getReal:O6,getTranslation:P6,identity:T6,invert:Y6,len:H6,length:PA,lerp:X6,mul:$6,multiply:DA,normalize:q6,rotateAroundAxis:j6,rotateByQuatAppend:G6,rotateByQuatPrepend:z6,rotateX:R6,rotateY:B6,rotateZ:F6,scale:W6,set:I6,setDual:k6,setReal:D6,sqrLen:K6,squaredLength:lv,str:Z6,translate:N6},Symbol.toStringTag,{value:"Module"}));function NA(){var r=new Qt(2);return Qt!=Float32Array&&(r[0]=0,r[1]=0),r}function tG(r){var t=new Qt(2);return t[0]=r[0],t[1]=r[1],t}function rG(r,t){var e=new Qt(2);return e[0]=r,e[1]=t,e}function nG(r,t){return r[0]=t[0],r[1]=t[1],r}function iG(r,t,e){return r[0]=t,r[1]=e,r}function gn(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r}function RA(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r}function BA(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r}function FA(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r}function aG(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r}function oG(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r}function go(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r}function yo(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r}function sG(r,t){return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r}function An(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r}function uG(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r}function pd(r,t){var e=t[0]-r[0],n=t[1]-r[1];return Math.hypot(e,n)}function GA(r,t){var e=t[0]-r[0],n=t[1]-r[1];return e*e+n*n}function zA(r){var t=r[0],e=r[1];return Math.hypot(t,e)}function jA(r){var t=r[0],e=r[1];return t*t+e*e}function fG(r,t){return r[0]=-t[0],r[1]=-t[1],r}function lG(r,t){return r[0]=1/t[0],r[1]=1/t[1],r}function To(r,t){var e=t[0],n=t[1],i=e*e+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=t[0]*i,r[1]=t[1]*i,r}function Tm(r,t){return r[0]*t[0]+r[1]*t[1]}function cG(r,t,e){var n=t[0]*e[1]-t[1]*e[0];return r[0]=r[1]=0,r[2]=n,r}function hG(r,t,e,n){var i=t[0],a=t[1];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r}function dG(r,t){t=t||1;var e=Di()*2*Math.PI;return r[0]=Math.cos(e)*t,r[1]=Math.sin(e)*t,r}function vG(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[2]*i,r[1]=e[1]*n+e[3]*i,r}function pG(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[2]*i+e[4],r[1]=e[1]*n+e[3]*i+e[5],r}function gG(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[3]*i+e[6],r[1]=e[1]*n+e[4]*i+e[7],r}function yG(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[4]*i+e[12],r[1]=e[1]*n+e[5]*i+e[13],r}function mG(r,t,e,n){var i=t[0]-e[0],a=t[1]-e[1],o=Math.sin(n),s=Math.cos(n);return r[0]=i*s-a*o+e[0],r[1]=i*o+a*s+e[1],r}function UA(r,t){var e=r[0],n=r[1],i=t[0],a=t[1],o=Math.sqrt(e*e+n*n)*Math.sqrt(i*i+a*a),s=o&&(e*i+n*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function bG(r){return r[0]=0,r[1]=0,r}function xG(r){return"vec2("+r[0]+", "+r[1]+")"}function Im(r,t){return r[0]===t[0]&&r[1]===t[1]}function EG(r,t){var e=r[0],n=r[1],i=t[0],a=t[1];return Math.abs(e-i)<=_t*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(n-a)<=_t*Math.max(1,Math.abs(n),Math.abs(a))}var wG=zA,jh=RA,_G=BA,SG=FA,MG=pd,CG=GA,AG=jA,TG=function(){var r=NA();return function(t,e,n,i,a,o){var s,u;for(e||(e=2),n||(n=0),i?u=Math.min(i*e+n,t.length):u=t.length,s=n;s<u;s+=e)r[0]=t[s],r[1]=t[s+1],a(r,r,o),t[s]=r[0],t[s+1]=r[1];return t}}();const IG=Object.freeze(Object.defineProperty({__proto__:null,add:gn,angle:UA,ceil:aG,clone:tG,copy:nG,create:NA,cross:cG,dist:MG,distance:pd,div:SG,divide:FA,dot:Tm,equals:EG,exactEquals:Im,floor:oG,forEach:TG,fromValues:rG,inverse:lG,len:wG,length:zA,lerp:hG,max:yo,min:go,mul:_G,multiply:BA,negate:fG,normalize:To,random:dG,rotate:mG,round:sG,scale:An,scaleAndAdd:uG,set:iG,sqrDist:CG,sqrLen:AG,squaredDistance:GA,squaredLength:jA,str:xG,sub:jh,subtract:RA,transformMat2:vG,transformMat2d:pG,transformMat3:gG,transformMat4:yG,zero:bG},Symbol.toStringTag,{value:"Module"})),OG=Object.freeze(Object.defineProperty({__proto__:null,glMatrix:B5,mat2:uB,mat2d:DB,mat3:GC,mat4:YF,quat:x6,quat2:eG,vec2:IG,vec3:A4,vec4:q4},Symbol.toStringTag,{value:"Module"}));function LG(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return gm(n,e),xa(r,n,t)}function DG(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return ym(n,e),xa(r,n,t)}function kG(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return mm(n,e),xa(r,n,t)}function PG(r,t,e){return xa(r,e,t)}function xi(r,t){for(var e=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=t.length;n<i;n++){var a=t[n];switch(a[0]){case"t":LG(e,e,[a[1],a[2]]);break;case"s":kG(e,e,[a[1],a[2]]);break;case"r":DG(e,e,a[1]);break;case"m":PG(e,e,a[1]);break}}return e}var Ms=function(t,e){var n=t.nodes,i=t.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,e||(a[c][l]=1))}),a},NG=function(t,e){return t===e},wE=function(){function r(t,e){e===void 0&&(e=null),this.value=t,this.next=e}return r.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},r}(),$A=function(){function r(t){t===void 0&&(t=NG),this.head=null,this.tail=null,this.compare=t}return r.prototype.prepend=function(t){var e=new wE(t,this.head);return this.head=e,this.tail||(this.tail=e),this},r.prototype.append=function(t){var e=new wE(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},r.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},r.prototype.find=function(t){var e=t.value,n=e===void 0?void 0:e,i=t.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 t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},r.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},r.prototype.fromArray=function(t){var e=this;return t.forEach(function(n){return e.append(n)}),this},r.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},r.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},r.prototype.toString=function(t){return t===void 0&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},r}(),RG=function(){function r(){this.linkedList=new $A}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(t){this.linkedList.append(t)},r.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toString=function(t){return this.linkedList.toString(t)},r}(),Jn=function(t,e,n){e===void 0&&(e=[]);var i=e.filter(function(u){return u.source===t||u.target===t});if(n==="target"){var a=function(f){return f.source===t};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===t};return i.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===t?f.target:f.source};return i.map(s)},BG=function(t,e){return e.filter(function(n){return n.source===t})},Uh=function(t,e){return e.filter(function(n){return n.source===t||n.target===t})},WA=function(t){t===void 0&&(t=0);var e="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(t,"-").concat(e).concat(n)};function FG(r){r===void 0&&(r={});var t=r,e=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return t.allowTraversal=r.allowTraversal||n,t.enter=r.enter||e,t.leave=r.leave||e,t}var XA=function(t,e,n,i){i===void 0&&(i=!0);var a=FG(n),o=new RG,s=t.edges,u=s===void 0?[]:s;o.enqueue(e);for(var f="",l=function(){var h=o.dequeue();a.enter({current:h,previous:f}),Jn(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()},GG=function(t){for(var e=t.nodes,n=e===void 0?[]:e,i=t.edges,a=i===void 0?[]:i,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=Jn(v.id,a),g=function(b){var x=p[b];if(!s[x]){var E=n.filter(function(w){return w.id===x});E.length>0&&d(E[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},YA=function(t){for(var e=t.nodes,n=e===void 0?[]:e,i=t.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=Jn(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x<m.length;x++)b(x);if(f[y.id]===u[y.id]){for(var E=[];o.length>0;){var w=o.pop();if(s[w.id]=!1,E.push(w),w===y)break}E.length>0&&l.push(E)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};function Om(r,t){return t?YA(r):GG(r)}var Ka=function(t){var e={},n=t.nodes,i=n===void 0?[]:n,a=t.edges,o=a===void 0?[]:a;return i.forEach(function(s){e[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){e[s.source].degree++,e[s.source].outDegree++,e[s.target].degree++,e[s.target].inDegree++}),e},VA=function(t,e){var n=Ka(t);return n[e]?Ka(t)[e].inDegree:0},HA=function(t,e){var n=Ka(t);return n[e]?Ka(t)[e].outDegree:0};function zG(r){r===void 0&&(r={});var t=r,e=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return t.allowTraversal=r.allowTraversal||n,t.enter=r.enter||e,t.leave=r.leave||e,t}function KA(r,t,e,n,i){i===void 0&&(i=!0),n.enter({current:t,previous:e});var a=r.edges,o=a===void 0?[]:a;Jn(t,o,i?"target":void 0).forEach(function(s){n.allowTraversal({previous:e,current:t,next:s})&&KA(r,s,t,n,i)}),n.leave({current:t,previous:e})}function Lm(r,t,e,n){n===void 0&&(n=!0),KA(r,t,"",zG(e),n)}var Dm=function(t){var e=null,n=t.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]){e={};for(var p=d,g=v;g!==d;)e[p]=g,p=g,g=a[g];e[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 e?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];Lm(t,l,f)}return e},km=function(t,e,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=Om(t,!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=Jn(y,t.edges),b=function(w){var _,M=m[w],C=t.nodes.find(function(N){return N.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),e&&n?(S=!1,A.findIndex(function(N){return e.indexOf(N.id)>-1})>-1&&(S=!0)):e&&!n&&A.findIndex(function(N){return e.indexOf(N.id)>-1})>-1&&(S=!1),S){for(var I={},D=1;D<A.length;D+=1)I[A[D-1].id]=A[D];A.length&&(I[A[A.length-1].id]=A[0]),o.push(I)}p[M].add(g)}},x=0;x<m.length;x+=1)b(x)}return o},Pm=function(t,e,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 D=I.pop();a.has(D)&&(a.delete(D),o[D.id].forEach(function(N){I.push(N)}),o[D.id].clear())}},c=function A(T,I,D){var N=!1;if(e&&n===!1&&e.indexOf(T.id)>-1)return N;i.push(T),a.add(T);for(var P=D[T.id],G=0;G<P.length;G+=1){var W=u[P[G]];if(W===I){for(var k={},R=1;R<i.length;R+=1)k[i[R-1].id]=i[R];i.length&&(k[i[i.length-1].id]=i[0]),s.push(k),N=!0}else a.has(W)||A(W,I,D)&&(N=!0)}if(N)l(T);else for(var G=0;G<P.length;G+=1){var W=u[P[G]];o[W.id].has(T)||o[W.id].add(T)}return i.pop(),N},h=t.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(e&&n)for(var y=function(T){var I=e[T];f[d[T].id]=f[I],f[I]=0,u[0]=d.find(function(D){return D.id===I}),u[f[d[T].id]]=d[T]},v=0;v<e.length;v++)y(v);for(var m=function(T){for(var I,D,N=1/0,P=0;P<T.length;P+=1)for(var G=T[P],W=0;W<G.length;W++){var k=f[G[W].id];k<N&&(N=k,D=P)}for(var R=T[D],Y=[],P=0;P<R.length;P+=1){var J=R[P];Y[J.id]=[];for(var te=0,H=Jn(J.id,t.edges,"target").filter(function(Le){return R.map(function(qe){return qe.id}).indexOf(Le)>-1});te<H.length;te++){var pe=H[te];pe===J.id&&!(n===!1&&e.indexOf(J.id)>-1)?s.push((I={},I[J.id]=J,I)):Y[J.id].push(f[pe])}}return{component:R,adjList:Y,minIdx:N}},b=0;b<d.length;){var x=d.filter(function(A){return f[A.id]>=b}),E=YA({nodes:x,edges:t.edges}).filter(function(A){return A.length>1});if(E.length===0)break;var w=m(E),_=w.minIdx,M=w.adjList,C=w.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(e&&n&&e.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s},qA=function(t,e,n,i){return i===void 0&&(i=!0),e?Pm(t,n,i):km(t,n,i)},jG=function(t,e,n){for(var i=1/0,a,o=0;o<e.length;o++){var s=e[o].id;!n[s]&&t[s]<=i&&(i=t[s],a=e[o])}return a},cl=function(t,e,n,i){var a=t.nodes,o=a===void 0?[]:a,s=t.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var x=m.id;l[x]=1/0,x===e&&(l[x]=0)});for(var h=o.length,d=function(b){var x=jG(l,o,f),E=x.id;if(f[E]=!0,l[E]===1/0)return"continue";var w=[];n?w=BG(E,u):w=Uh(E,u),w.forEach(function(_){var M=_.target,C=_.source,S=M===E?C:M,A=i&&_[i]?_[i]:1;l[S]>l[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.id)})},v=0;v<h;v++)d();c[e]=[e];var p={};for(var g in l)l[g]!==1/0&&ZA(e,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}};function ZA(r,t,e,n){if(r===t)return[r];if(n[t])return n[t];for(var i=[],a=0,o=e[t];a<o.length;a++){var s=o[a],u=ZA(r,s,e,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];gt(c)?i.push(ri(ri([],c,!0),[t],!1)):i.push([c,t])}}return n[t]=i,n[t]}var QA=function(t,e,n,i,a){var o=cl(t,e,i,a),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}},JA=function(t,e,n,i){var a;if(e===n)return[[e]];var o=t.edges,s=o===void 0?[]:o,u=[e],f=(a={},a[e]=!0,a),l=[],c=[],h=i?Jn(e,s,"target"):Jn(e,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?Jn(v,s,"target"):Jn(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},hl=function(t,e){for(var n=Ms(t,e),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},eT=function(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=t.nodes,o=a===void 0?[]:a,s=t.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var E=WA();b.clusterId=E,f[E]={id:E,nodes:[b]},l[b.id]={node:b,idx:x}});var c=Ms(t,e),h={};c.forEach(function(b,x){var E=o[x].id;h[E]={},b.forEach(function(w,_){if(w){var M=o[_].id;h[E][M]=w}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(E){var w={};Object.keys(h[E.id]).forEach(function(D){var N=h[E.id][D],P=l[D].node,G=P.clusterId;w[G]||(w[G]=0),w[G]+=N});var _=-1/0,M=[];if(Object.keys(w).forEach(function(D){_<w[D]?(_=w[D],M=[D]):_===w[D]&&M.push(D)}),!(M.length===1&&M[0]===E.clusterId)){var C=M.indexOf(E.clusterId);if(C>=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[E.clusterId],A=S.nodes.indexOf(E);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),I=f[M[T]];I.nodes.push(E),E.clusterId=I.id}}}),!x)return"break";d++};d<i;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var x=f[b];(!x.nodes||!x.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var x=b.source,E=b.target,w=b[n]||1,_=l[x].node.clusterId,M=l[E].node.clusterId,C="".concat(_,"---").concat(M);if(y[C])y[C].weight+=w,y[C].count++;else{var S={source:_,target:M,weight:w,count:1};y[C]=S,g.push(S)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},gi=function(){function r(t){this.arr=t}return r.prototype.getArr=function(){return this.arr||[]},r.prototype.add=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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(t){var e=[];if(t!==0)for(var n in this.arr)e[n]=this.arr[n]/t;return new r(e)},r.prototype.negate=function(){var t=[];for(var e in this.arr)t[e]=-this.arr[e];return new r(t)},r.prototype.squareEuclideanDistance=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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]-t.arr[a],2);return i}},r.prototype.euclideanDistance=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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]-t.arr[a],2);return Math.sqrt(i)}else console.error("The two vectors are unequal in length.")},r.prototype.normalize=function(){var t=[],e=Vt(this.arr);e.sort(function(o,s){return o-s});var n=e[e.length-1],i=e[0];for(var a in this.arr)t[a]=(this.arr[a]-i)/(n-i);return new r(t)},r.prototype.norm2=function(){var t;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return 0;var e=0;for(var n in this.arr)e+=Math.pow(this.arr[n],2);return Math.sqrt(e)},r.prototype.dot=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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]*t.arr[a];return i}else console.error("The two vectors are unequal in length.")},r.prototype.equal=function(t){var e,n=t.arr;if(((e=this.arr)===null||e===void 0?void 0:e.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}(),Nm=function(t,e){e===void 0&&(e=void 0);var n=[];return t.forEach(function(i){e===void 0&&n.push(i),i[e]!==void 0&&n.push(i[e])}),n},Li;(function(r){r.EuclideanDistance="euclideanDistance"})(Li||(Li={}));var UG=function(t,e,n){var i=[];e!=null&&e.length?i=e:(t.forEach(function(o){i=i.concat(Object.keys(o))}),i=fl(i));var a={};return i.forEach(function(o){var s=[];t.forEach(function(u){u[o]!==void 0&&u[o]!==""&&s.push(u[o])}),s.length&&!(n!=null&&n.includes(o))&&(a[o]=fl(s))}),a},Rm=function(t,e,n){var i=UG(t,e,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 t.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},_E=function(t,e,n,i){n===void 0&&(n=Li.EuclideanDistance);var a=0;switch(n){case Li.EuclideanDistance:a=new gi(t).euclideanDistance(new gi(e));break}return a},SE=function(t,e,n,i){for(var a=e.length,o=2*i,s=0,u=0;u<a;u++)for(var f=t[u].clusterId,l=0;l<a;l++){var c=t[l].clusterId;if(f===c){var h=e[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},hg=function(t,e){t===void 0&&(t=[]);for(var n=t.length,i=new gi([]),a=0;a<n;a++)i=i.add(new gi(e[a]));var o=i.avg(n);o.normalize();for(var s=0,a=0;a<n;a++){var u=new gi(e[a]),f=u.squareEuclideanDistance(o);s+=f}var l=[];t.forEach(function(){l.push([])});for(var a=0;a<n;a++){var u=new gi(e[a]);t[a].clusterInertial=0;for(var c=0;c<n;c++){if(a===c){l[a][c]=0;continue}var h=new gi(e[c]);l[a][c]=u.squareEuclideanDistance(h),t[a].clusterInertial+=l[a][c]}}for(var d=0,v=2*n*s,a=0;a<n;a++)for(var p=t[a].clusterId,c=0;c<n;c++){var g=t[c].clusterId;if(!(a===c||p!==g)){var y=t[a].clusterInertial*t[c].clusterInertial/Math.pow(v,2)-l[a][c]/v;d+=y}}return Number(d.toFixed(4))},Bm=function(t,e,n,i,a,o,s,u,f){e===void 0&&(e=!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=t.nodes,c=l===void 0?[]:l,h=t.edges,d=h===void 0?[]:h,v=[];if(a){c.forEach(function(k,R){k.properties=k.properties||{},k.originIndex=R});var p=[];c.every(function(k){return k.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(k){return k.nodeType}))),c.forEach(function(k){k.properties.nodeType=p.findIndex(function(R){return R===k.nodeType})}));var g=Nm(c,o);v=Rm(g,s,u)}var y=1,m={},b={};c.forEach(function(k,R){var Y=String(y++);k.clusterId=Y,m[Y]={id:Y,nodes:[k]},b[k.id]={node:k,idx:R}});var x=Ms(t,e),E=[],w={},_=0;x.forEach(function(k,R){var Y=0,J=c[R].id;w[J]={},k.forEach(function(te,H){if(te){Y+=te;var pe=c[H].id;w[J][pe]=te,_+=te}}),E.push(Y)}),_/=2;for(var M=1/0,C=1/0,S=0,A=[],T={};;){a&&c.every(function(k){return k.hasOwnProperty("properties")})?M=SE(c,x,E,_)+hg(c,v)*f:M=SE(c,x,E,_),S===0&&(C=M,A=c,T=m);var I=M>0&&M>C&&M-C<i;if(M>C&&(A=c.map(function(k){return{node:k,clusterId:k.clusterId}}),T=Vt(m),C=M),I||S>100)break;S++,Object.keys(m).forEach(function(k){var R=0;d.forEach(function(Y){var J=Y.source,te=Y.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===k&&pe!==k||pe===k&&H!==k)&&(R=R+(Y[n]||1))}),m[k].sumTot=R}),c.forEach(function(k,R){var Y=m[k.clusterId],J=0,te,H=E[R]/(2*_),pe=0,Ae=Y.nodes;Ae.forEach(function(Ut){var dr=b[Ut.id].idx;pe+=x[R][dr]||0});var Le=pe-Y.sumTot*H,qe=Ae.filter(function(Ut){return Ut.id!==k.id});qe.forEach(function(Ut,dr){v[Ut.originIndex]});var at=hg(qe,v)*f,rt=w[k.id];if(Object.keys(rt).forEach(function(Ut){var dr=b[Ut].node,fr=dr.clusterId;if(fr!==k.clusterId){var Gt=m[fr],Jt=Gt.nodes;if(!(!Jt||!Jt.length)){var Rr=0;Jt.forEach(function(Be){var ye=b[Be.id].idx;Rr+=x[R][ye]||0});var tt=Rr-Gt.sumTot*H,ie=Jt.concat([k]);ie.forEach(function(Be,ye){v[Be.originIndex]});var L=hg(ie,v)*f,_e=tt-Le;a&&(_e=tt+L-(Le+at)),_e>J&&(J=_e,te=Gt)}}}),J>0){te.nodes.push(k);var xt=k.clusterId;k.clusterId=te.id;var Et=Y.nodes.indexOf(k);Y.nodes.splice(Et,1);var ur=0,Bt=0;d.forEach(function(Ut){var dr=Ut.source,fr=Ut.target,Gt=b[dr].node.clusterId,Jt=b[fr].node.clusterId;(Gt===te.id&&Jt!==te.id||Jt===te.id&&Gt!==te.id)&&(ur=ur+(Ut[n]||1)),(Gt===xt&&Jt!==xt||Jt===xt&&Gt!==xt)&&(Bt=Bt+(Ut[n]||1))}),te.sumTot=ur,Y.sumTot=Bt}})}var D={},N=0;Object.keys(T).forEach(function(k){var R=T[k];if(!R.nodes||!R.nodes.length){delete T[k];return}var Y=String(N+1);Y!==k&&(R.id=Y,R.nodes=R.nodes.map(function(J){return{id:J.id,clusterId:Y}}),T[Y]=R,D[k]=Y,delete T[k],N++)}),A.forEach(function(k){var R=k.node,Y=k.clusterId;R&&(R.clusterId=Y,R.clusterId&&D[R.clusterId]&&(R.clusterId=D[R.clusterId]))});var P=[],G={};d.forEach(function(k){var R=k.source,Y=k.target,J=k[n]||1,te=b[R].node.clusterId,H=b[Y].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if(G[pe])G[pe].weight+=J,G[pe].count++;else{var Ae={source:te,target:H,weight:J,count:1};G[pe]=Ae,P.push(Ae)}}});var W=[];return Object.keys(T).forEach(function(k){W.push(T[k])}),{clusters:W,clusterEdges:P}},tT=function(t,e,n,i,a,o,s,u){return e===void 0&&(e=!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),Bm(t,e,n,i,!0,a,o,s,u)},rT=function(t,e){var n;e===void 0&&(e=1);for(var i=Vt(t),a=i.nodes,o=a===void 0?[]:a,s=i.edges,u=s===void 0?[]:s,f=function(){var h=Ka({nodes:o,edges:u}),d=Object.keys(h);d.sort(function(g,y){var m,b;return((m=h[g])===null||m===void 0?void 0:m.degree)-((b=h[y])===null||b===void 0?void 0:b.degree)});var v=d[0];if(!o.length||((n=h[v])===null||n===void 0?void 0:n.degree)>=e)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}},ME=function(t,e,n){var i=[];switch(t){case Li.EuclideanDistance:i=e[n];break;default:i=[];break}return i},nT=function(t,e,n,i,a,o){e===void 0&&(e=3),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=["id"]),o===void 0&&(o=Li.EuclideanDistance);var s=t.nodes,u=s===void 0?[]:s,f=t.edges,l=f===void 0?[]:f,c={clusters:[{id:"0",nodes:u}],clusterEdges:[]};if(o===Li.EuclideanDistance&&!u.every(function(Y){return Y.hasOwnProperty(n)}))return c;var h=[],d=[];if(o===Li.EuclideanDistance&&(h=Nm(u,n),d=Rm(h,i,a)),!d.length)return c;for(var v=fl(d.map(function(Y){return Y.join("")})),p=Math.min(e,u.length,v.length),g=0;g<u.length;g++)u[g].originIndex=g;for(var y=[],m=[],b=[],g=0;g<p;g++)if(g===0){var x=Math.floor(Math.random()*u.length);switch(o){case Li.EuclideanDistance:y[g]=d[x];break;default:y[g]=[];break}m.push(x),b[g]=[u[x]],u[x].clusterId=String(g)}else{for(var E=-1/0,w=0,_=function(te){if(!m.includes(te)){for(var H=0,pe=0;pe<y.length;pe++){var Ae=0;switch(o){case Li.EuclideanDistance:Ae=_E(d[u[te].originIndex],y[pe],o);break}H+=Ae}var Le=H/y.length;Le>E&&!y.find(function(qe){return Oo(qe,ME(o,d,u[te].originIndex))})&&(E=Le,w=te)}},M=0;M<u.length;M++)_(M);y[g]=ME(o,d,w),m.push(w),b[g]=[u[w]],u[w].clusterId=String(g)}for(var C=0;;){for(var g=0;g<u.length;g++){var S=0,A=1/0;if(!(C===0&&m.includes(g))){for(var T=0;T<y.length;T++){var I=0;switch(o){case Li.EuclideanDistance:I=_E(d[g],y[T],o);break}I<A&&(A=I,S=T)}if(u[g].clusterId!==void 0)for(var D=b[Number(u[g].clusterId)].length-1;D>=0;D--)b[Number(u[g].clusterId)][D].id===u[g].id&&b[Number(u[g].clusterId)].splice(D,1);u[g].clusterId=String(S),b[S].push(u[g])}}for(var N=!1,g=0;g<b.length;g++){for(var P=b[g],G=new gi([]),T=0;T<P.length;T++)G=G.add(new gi(d[P[T].originIndex]));var W=G.avg(P.length);W.equal(new gi(y[g]))||(N=!0,y[g]=W.getArr())}if(C++,u.every(function(Y){return Y.clusterId!==void 0})&&N||C>=1e3)break}var k=[],R={};return l.forEach(function(Y){var J,te,H=Y.source,pe=Y.target,Ae=(J=u.find(function(rt){return rt.id===H}))===null||J===void 0?void 0:J.clusterId,Le=(te=u.find(function(rt){return rt.id===pe}))===null||te===void 0?void 0:te.clusterId,qe="".concat(Ae,"---").concat(Le);if(R[qe])R[qe].count++;else{var at={source:Ae,target:Le,count:1};R[qe]=at,k.push(at)}}),{clusters:b,clusterEdges:k}},Fm=function(t,e){var n=new gi(e),i=n.norm2(),a=new gi(t),o=a.norm2(),s=n.dot(a),u=i*o,f=u?s/u:0;return f},iT=function(t,e,n,i,a){t===void 0&&(t=[]),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=[]);var o=Vt(t.filter(function(h){return h.id!==e.id})),s=t.findIndex(function(h){return h.id===e.id}),u=Nm(t,n),f=Rm(u,i,a),l=f[s],c=[];return o.forEach(function(h,d){if(h.id!==e.id){var v=f[d],p=Fm(v,l);c.push(p),h.cosineSimilarity=p}}),o.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:o}},$G=function(){function r(t){this.count=t.length,this.parent={};for(var e=0,n=t;e<n.length;e++){var i=n[e];this.parent[i]=i}}return r.prototype.find=function(t){for(;this.parent[t]!==t;)t=this.parent[t];return t},r.prototype.union=function(t,e){var n=this.find(t),i=this.find(e);n!==i&&(n<i?(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]):(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]))},r.prototype.connected=function(t,e){return this.find(t)===this.find(e)},r}(),WG=function(t,e){return t-e},XG=function(){function r(t){t===void 0&&(t=WG),this.compareFn=t,this.list=[]}return r.prototype.getLeft=function(t){return 2*t+1},r.prototype.getRight=function(t){return 2*t+2},r.prototype.getParent=function(t){return t===0?null:Math.floor((t-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 t=this.top(),e=this.list.pop();return this.list.length>0&&(this.list[0]=e,this.moveDown(0)),t},r.prototype.insert=function(t){if(t!==null){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},r.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var n=this.list[e];this.list[e]=this.list[t],this.list[t]=n,t=e,e=this.getParent(t)}},r.prototype.moveDown=function(t){var e,n=t,i=this.getLeft(t),a=this.getRight(t),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),t!==n&&(e=[this.list[n],this.list[t]],this.list[t]=e[0],this.list[n]=e[1],this.moveDown(n))},r}(),YG=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,o=t.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 e?g.weight-y.weight:0},c=new XG(l);for(Uh(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),Uh(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),Uh(v,s).forEach(function(p){c.insert(p)})))}return n},CE=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,o=t.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});e&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new $G(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},aT=function(t,e,n){var i={prim:YG,kruskal:CE};return n?i[n](t,e):CE(t,e)},oT=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=t.nodes,u=s===void 0?[]:s,f=t.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=Ka(t);o>0&&i>e;){a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;if(h=0,m[g.id].inDegree===0)d[y]=0;else{for(var b=Jn(y,l,"source"),x=0;x<b.length;++x){var E=b[x],w=m[E].outDegree;w>0&&(h+=v[E]/w)}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},VG=-1,gd=-1,sT="-1",aa="-1",uT=-1,AE=function(){function r(t,e,n,i){t===void 0&&(t=VG),e===void 0&&(e=gd),n===void 0&&(n=gd),i===void 0&&(i=sT),this.id=t,this.from=e,this.to=n,this.label=i}return r}(),HG=function(){function r(t,e){t===void 0&&(t=gd),e===void 0&&(e=aa),this.id=t,this.label=e,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(t){this.edges.push(t),this.edgeMap[t.id]=t},r}(),fT=function(){function r(t,e,n){t===void 0&&(t=gd),e===void 0&&(e=!0),n===void 0&&(n=!1),this.id=t,this.edgeIdAutoIncrease=e,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(t,e){if(!this.nodeMap[t]){var n=new HG(t,e);this.nodes.push(n),this.nodeMap[t]=n,this.nodeLabelMap[e]||(this.nodeLabelMap[e]=[]),this.nodeLabelMap[e].push(t)}},r.prototype.addEdge=function(t,e,n,i){if((this.edgeIdAutoIncrease||t===void 0)&&(t=this.counter++),!(this.nodeMap[e]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[t])){var a=new AE(t,e,n,i);if(this.edges.push(a),this.edgeMap[t]=a,this.nodeMap[e].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new AE(t,n,e,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}(),fs=function(){function r(t,e,n,i,a){this.fromNode=t,this.toNode=e,this.nodeEdgeNodeLabel={nodeLabel1:n||aa,edgeLabel:i||sT,nodeLabel2:a||aa}}return r.prototype.equalTo=function(t){return this.fromNode===t.formNode&&this.toNode===t.toNode&&this.nodeEdgeNodeLabel===t.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(t){return!this.equalTo(t)},r}(),TE=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(t){var e=this.dfsEdgeList.length,n=t.length;if(e!==n)return!1;for(var i=0;i<e;i++)if(this.dfsEdgeList[i]!==t[i])return!1;return!0},r.prototype.notEqualTo=function(t){return!this.equalTo(t)},r.prototype.pushBack=function(t,e,n,i,a){return this.dfsEdgeList.push(new fs(t,e,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(t,e){t===void 0&&(t=uT),e===void 0&&(e=!1);var n=new fT(t,!0,e);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!==aa&&n.addNode(a,u),l!==aa&&n.addNode(o,l),u!==aa&&l!==u&&n.addEdge(void 0,a,o,f)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var t=void 0,e=this.dfsEdgeList.length,n=e-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(t===void 0||o===t)&&(this.rmpath.push(n),t=a)}return this.rmpath},r.prototype.getNodeNum=function(){var t={};return this.dfsEdgeList.forEach(function(e){t[e.fromNode]||(t[e.fromNode]=!0),t[e.toNode]||(t[e.toNode]=!0)}),Object.keys(t).length},r}(),$c=function(){function r(t){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!t){for(;t;){var e=t.edge;this.edges.push(e),this.nodesUsed[e.from]=1,this.nodesUsed[e.to]=1,this.edgesUsed[e.id]=1,t=t.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(t){return this.nodesUsed[t.id]===1},r.prototype.hasEdge=function(t){return this.edgesUsed[t.id]===1},r}(),KG=function(){function r(t){var e=t.graphs,n=t.minSupport,i=n===void 0?2:n,a=t.minNodeNum,o=a===void 0?1:a,s=t.maxNodeNum,u=s===void 0?4:s,f=t.top,l=f===void 0?10:f,c=t.directed,h=c===void 0?!1:c,d=t.verbose,v=d===void 0?!1:d;this.graphs=e,this.dfsCode=new TE,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(t,e){var n=this,i=[],a=t.nodeMap;return e.edges.forEach(function(o){(n.directed||e.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(t,e,n,i){if(!this.directed&&e===n)return null;for(var a=t.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!==e.from)){if(this.directed){if(a[e.from].label<a[n.to].label||a[e.from].label===a[n.to].label&&e.label<=l.label)return l}else if(e.label<l.label||e.label===l.label&&a[e.to].label<=a[n.to].label)return l}}return null},r.prototype.findForwardPureEdges=function(t,e,n,i){for(var a=[],o=e.to,s=t.nodeMap[o].edges,u=s.length,f=0;f<u;f++){var l=s[f],c=t.nodeMap[l.to];n<=c.label&&!i.hasNode(c)&&a.push(l)}return a},r.prototype.findForwardRmpathEdges=function(t,e,n,i){for(var a=[],o=t.nodeMap,s=o[e.to].label,u=o[e.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;e.to===h.to||n>d||i.hasNode(o[h.to])||(e.label<h.label||e.label===h.label&&s<=d)&&a.push(h)}return a},r.prototype.getSupport=function(t){var e={};return t.forEach(function(n){e[n.graphId]||(e[n.graphId]=!0)}),Object.keys(e).length},r.prototype.findMinLabel=function(t){var e=void 0;return Object.keys(t).forEach(function(n){var i=t[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!e){e={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<e.nodeLabel1||a===e.nodeLabel1&&o<e.edgeLabel||a===e.nodeLabel1&&o===e.edgeLabel&&s<e.nodeLabel2)&&(e={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),e},r.prototype.isMin=function(){var t=this,e=this.dfsCode;if(this.verbose&&console.log("isMin checking",e),e.dfsEdgeList.length===1)return!0;var n=this.directed,i=e.toGraph(uT,n),a=i.nodeMap,o=new TE,s={};i.nodes.forEach(function(c){var h=t.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 fs(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var f=function c(h){for(var d=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[d[0]].toNode,g={},y=!1,m=0,b=n?-1:0,x=function(G){if(y)return"break";h.forEach(function(W){var k=new $c(W),R=t.findBackwardEdge(i,k.edges[d[G]],k.edges[d[0]],k);R&&(g[R.label]||(g[R.label]={projected:[],edgeLabel:R.label}),g[R.label].projected.push({graphId:i.id,edge:g,preNode:W}),m=o.dfsEdgeList[d[G]].fromNode,y=!0)})},E=d.length-1;E>b;E--){var w=x(E);if(w==="break")break}if(y){var _=t.findMinLabel(g);o.dfsEdgeList.push(new fs(p,m,aa,_.edgeLabel,aa));var M=o.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(P){var G=new $c(P),W=t.findForwardPureEdges(i,G.edges[d[0]],v,G);W.length>0&&(y=!0,S=p,W.forEach(function(k){var R="".concat(k.label,"-").concat(a[k.to].label);C[R]||(C[R]={projected:[],edgeLabel:k.label,nodeLabel2:a[k.to].label}),C[R].projected.push({graphId:i.id,edge:k,preNode:P})}))});for(var A=d.length,T=function(G){if(y)return"break";var W=d[G];h.forEach(function(k){var R=new $c(k),Y=t.findForwardRmpathEdges(i,R.edges[W],v,R);Y.length>0&&(y=!0,S=o.dfsEdgeList[W].fromNode,Y.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:k})}))})},E=0;E<A;E++){var I=T(E);if(I==="break")break}if(!y)return!0;var D=t.findMinLabel(C);o.dfsEdgeList.push(new fs(S,p+1,aa,D.edgeLabel,D.nodeLabel2));var N=o.dfsEdgeList.length-1;return e.dfsEdgeList[N]!==o.dfsEdgeList[N]?!1:c(C["".concat(D.edgeLabel,"-").concat(D.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 t=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(Vt(t))}},r.prototype.subGraphMining=function(t){var e=this,n=this.getSupport(t);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={};t.forEach(function(l){for(var c=e.graphs[l.graphId],h=c.nodeMap,d=new $c(l),v=a.length-1;v>=0;v--){var p=e.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(e.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=e.maxNodeNum)){var y=e.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var E=e.findForwardRmpathEdges(c,d.edges[a[x]],s,d);E.forEach(function(w){var _="".concat(e.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(w.label,"-").concat(h[w.to].label);u[_]||(u[_]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[a[x]].fromNode,edgeLabel:w.label,nodeLabel2:h[w.to].label}),u[_].projected.push({graphId:l.graphId,edge:w,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;e.dfsCode.dfsEdgeList.push(new fs(o,h,"-1",d,"-1")),e.subGraphMining(f[l].projected),e.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;e.dfsCode.dfsEdgeList.push(new fs(h,o+1,aa,d,v)),e.subGraphMining(u[l].projected),e.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var t=this.graphs,e=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={};return Object.keys(t).forEach(function(u){var f=t[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(!e&&y>m){var b=m;m=y,y=b}var x=g.label,E="".concat(y,"-").concat(x,"-").concat(m);if(!o[E]){var w=o[E]||0;w++,o[E]=w}})})}),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 t=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var e=this.graphs;this.directed;var n={};Object.keys(e).forEach(function(i){var a=e[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=t.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;t.dfsCode.dfsEdgeList.push(new fs(0,1,s,u,f)),t.subGraphMining(o),t.dfsCode.dfsEdgeList.pop()})}},r}(),qG=function(t,e,n,i){var a={};return Object.keys(t).forEach(function(o,s){var u=t[o],f=new fT(s,!0,e),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},ZG=function(t,e,n){var i=[];return t.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[e]=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},IE="cluster",QG=function(t){var e=t.graphs,n=t.directed,i=n===void 0?!1:n,a=t.nodeLabelProp,o=a===void 0?IE:a,s=t.edgeLabelProp,u=s===void 0?IE:s,f=qG(e,i,o,u),l=t.minSupport,c=t.maxNodeNum,h=t.minNodeNum,d=t.verbose,v=t.top,p={graphs:f,minSupport:l,maxNodeNum:c,minNodeNum:h,top:v,verbose:d,directed:i},g=new KG(p);g.run();var y=ZG(g.frequentSubgraphs,o,u);return y},OE=function(t,e,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=t.nodes;return e.forEach(function(s,u){a.push(lT(o,s,u,n,i))}),a},lT=function(t,e,n,i,a){var o=[n],s=[],u={};return e.forEach(function(f,l){if(f<=a&&n!==l){o.push(l),s.push(t[l]);var c=t[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:t[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},JG=function(t,e,n,i,a){var o=Math.ceil(n/e),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()*e),g++,!(g>2*e)););if(g<2*e&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*e)break}if(c<o){var y=o-c;o=(o+y)/(e-l-1)}}),s},$h=function(t,e,n,i){var a=n.nodes;return i||(i={}),Object.keys(t).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var f=t[o],l=(s=e[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=e[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},Wh=function(t,e,n,i){var a,o,s={};t.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((a=e==null?void 0:e.edges)===null||a===void 0)&&a.length)||((o=e==null?void 0:e.nodes)===null||o===void 0?void 0:o.length)<2?0:(t.edges.forEach(function(f){var l=s[f.source][n],c=s[f.target][n],h=e==null?void 0:e.nodes[0][n],d=e==null?void 0:e.nodes[1][n],v=e==null?void 0:e.edges[0][i];f[i]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},ez=function(t,e,n){for(var i=1/0,a=0,o=function(f){var l=t[f],c=Object.keys(l).sort(function(m,b){return l[m]-l[b]}),h=10,d=[];c.forEach(function(m,b){d[b%h]||(d[b%h]={graphs:[],totalCount:0,aveCount:0}),d[b%h].graphs.push(m),d[b%h].totalCount+=l[m]});var v=0,p=[];d.forEach(function(m){var b=m.totalCount/m.graphs.length;m.aveCount=b,p.push(b);var x=0,E=m.length;m.graphs.forEach(function(w,_){var M=l[w];m.graphs.forEach(function(C,S){_!==S&&(x+=Math.abs(M-l[C]))})}),x/=E*(E-1)/2,v+=x}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(x,E){b!==E&&(g+=Math.abs(m-x))}),g/=p.length*(p.length-1)/2});var y=g-v;i<y&&(i=y,a=f)},s=0;s<e;s++)o(s);return{structure:n[a],structureCountMap:t[a]}},LE=function(t,e){var n={},i={};return t.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[e];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},DE=function(t,e,n){var i={},a={};return t.forEach(function(o,s){i["".concat(WA)]={idx:s,edge:o};var u=o[e];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}},kE=function(t,e,n){var i=e.length,a={};return e.forEach(function(o,s){for(var u=n?0:s+1,f=t[s].id,l=u;l<i;l++)if(s!==l){var c=t[l].id,h=o[l];a["".concat(f,"-").concat(c)]=h,n||(a["".concat(c,"-").concat(f)]=h)}}),a},tz=function(t,e,n,i,a,o,s,u,f,l,c){var h,d="".concat(e.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[e.id].idx,end:i[n.id].idx,distance:a},h);c=$h(p,o,t,c),v=c[d]}return Wh(v,s,u,f)},PE=function(t,e,n,i){var a,o,s,u=(a=t[e])===null||a===void 0?void 0:a.degree,f=(o=t[e])===null||o===void 0?void 0:o.inDegree,l=(s=t[e])===null||s===void 0?void 0:s.outDegree;return t[e]===void 0&&(u=1/0,f=1/0,l=1/0,i[e].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)}),t[e]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},cT=function(t,e,n,i,a,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!t||!t.nodes)){var f=t.nodes.length;if(f){var l=hl(t,n),c=hl(e,n),h=kE(t.nodes,l,n),d=kE(e.nodes,c,n),v=LE(t.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=LE(e.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;DE(t.edges,s,p);var x=DE(e.edges,s,m).edgeLabelMap,E=[];c==null||c.forEach(function(tt){E=E.concat(tt)}),a||(a=Math.max.apply(Math,ri(ri([],E,!1),[2],!1))),i||(i=a);var w=OE(t,l,o,i),_=OE(e,c,o,i),M=Math.min(100,f*(f-1)/2),C=JG(i,f,M,w,l),S=$h(C,w,t),A=10,T=1,I=1,D=4,N={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:I,maxNodeNum:D,directed:n},P=QG(N).slice(0,A),G=P.length,W=[];P.forEach(function(tt,ie){W[ie]={},Object.keys(S).forEach(function(L){var _e=S[L],Be=Wh(_e,tt,o,s);W[ie][L]=Be})});var k=ez(W,G,P),R=k.structure,Y=k.structureCountMap,J=e.nodes[0],te=[],H=(u=e.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;e.nodes.forEach(function(tt){var ie=tt[o],L=g[ie];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ie,J=tt)});var Ae={},Le={},qe={},at={},rt={},xt={};Object.keys(b).forEach(function(tt,ie){rt[tt]=[],n&&(xt[tt]=[]);var L=b[tt],_e={};L.forEach(function(Ke){var Qe=d["".concat(J.id,"-").concat(Ke.id)];if(Qe&&rt[tt].push(Qe),_e["".concat(J.id,"-").concat(Ke.id)]={start:0,end:m[Ke.id].idx,distance:Qe},n){var vt=d["".concat(Ke.id,"-").concat(J.id)];vt&&xt[tt].push(vt)}}),rt[tt]=rt[tt].sort(function(Ke,Qe){return Ke-Qe}),n&&(xt[tt]=xt[tt].sort(function(Ke,Qe){return Ke-Qe})),Le=$h(_e,_,e,Le);var Be=[];if(Object.keys(_e).forEach(function(Ke){if(qe[Ke]){Be.push(qe[Ke]);return}var Qe=Le[Ke];qe[Ke]=Wh(Qe,R,o,s),Be.push(qe[Ke])}),Be=Be.sort(function(Ke,Qe){return Qe-Ke}),at["".concat(J.id,"-").concat(tt)]=Be,tt!==H)for(var ye=(te==null?void 0:te.length)||0,$e=function(Qe){var vt=te[Qe],Dt=w[p[vt.id].idx],lr=Dt.nodeLabelCountMap[tt],kt=b[tt].length;if(!lr||lr.count<kt)return te.splice(Qe,1),"continue";for(var hr=!1,or=0;or<kt;or++)if(lr.dists[or]>rt[tt][or]){hr=!0;break}if(hr)return te.splice(Qe,1),"continue";var gr={};Dt.neighbors.forEach(function(er){var Or=h["".concat(vt.id,"-").concat(er.id)];gr["".concat(vt.id,"-").concat(er.id)]={start:p[vt.id].idx,end:p[er.id].idx,distance:Or}}),S=$h(gr,w,t,S);var vr=[];Object.keys(gr).forEach(function(er){if(Y[er]){vr.push(Y[er]);return}var Or=S[er];Y[er]=Wh(Or,R,o,s),vr.push(Y[er])}),vr=vr.sort(function(er,Or){return Or-er});for(var en=!1,or=0;or<kt;or++)if(vr[or]<Be[or]){en=!0;break}if(en)return te.splice(Qe,1),"continue"},We=ye-1;We>=0;We--)$e(We)});var Et=[];te==null||te.forEach(function(tt){for(var ie=p[tt.id].idx,L=lT(t.nodes,l[ie],ie,o,a),_e=L.neighbors,Be=_e.length,ye=!1,$e=Be-1;$e>=0;$e--){if(_e.length+1<e.nodes.length){ye=!0;return}var We=_e[$e],Ke=We[o];if(!b[Ke]||!b[Ke].length){_e.splice($e,1);continue}if(!rt[Ke]||!rt[Ke].length){_e.splice($e,1);continue}var Qe="".concat(tt.id,"-").concat(We.id),vt=h[Qe],Dt=rt[Ke].length-1,lr=rt[Ke][Dt];if(vt>lr){_e.splice($e,1);continue}if(n){var kt="".concat(We.id,"-").concat(tt.id),hr=h[kt];Dt=xt[Ke].length-1;var or=xt[Ke][Dt];if(hr>or){_e.splice($e,1);continue}}var gr=Y[Qe]?Y[Qe]:tz(t,tt,We,p,vt,w,R,o,s,Y,S),vr="".concat(J.id,"-").concat(Ke),en=at[vr][at[vr].length-1];if(gr<en){_e.splice($e,1);continue}var er=PE(Ae,Ke,m,b),Or=er.minPatternNodeLabelDegree;if(er.minPatternNodeLabelInDegree,er.minPatternNodeLabelOutDegree,p[We.id].degree<Or){_e.splice($e,1);continue}}ye||Et.push({nodes:[tt].concat(_e)})});var ur=cl(e,J.id,!1).length,Bt={};n?(Object.keys(ur).forEach(function(tt){var ie=m[tt].node[o];Bt[ie]?Bt[ie].push(ur[tt]):Bt[ie]=[ur[tt]]}),Object.keys(Bt).forEach(function(tt){Bt[tt].sort(function(ie,L){return ie-L})})):Bt=rt;for(var Ut=Et.length,dr=function(ie){var L=Et[ie],_e=L.nodes[0],Be={},ye={};L.nodes.forEach(function(At,pr){ye[At.id]={idx:pr,node:At,degree:0,inDegree:0,outDegree:0};var mt=At[o];Be[mt]?Be[mt]++:Be[mt]=1});var $e=[],We={};t.edges.forEach(function(At){ye[At.source]&&ye[At.target]&&($e.push(At),We[At[s]]?We[At[s]]++:We[At[s]]=1,ye[At.source].degree++,ye[At.target].degree++,ye[At.source].outDegree++,ye[At.target].inDegree++)});for(var Ke=Object.keys(x).length,Qe=!1,vt=0;vt<Ke;vt++){var Dt=Object.keys(x)[vt];if(!We[Dt]||We[Dt]<x[Dt].length){Qe=!0;break}}if(Qe)return Et.splice(ie,1),"continue";var lr=$e.length;if(lr<e.edges.length)return Et.splice(ie,1),"break";for(var kt=!1,hr=function(pr){var mt=$e[pr],_r=mt[s],tn=x[_r];if(!tn||!tn.length)return We[_r]--,tn&&We[_r]<tn.length?(kt=!0,"break"):($e.splice(pr,1),ye[mt.source].degree--,ye[mt.target].degree--,ye[mt.source].outDegree--,ye[mt.target].inDegree--,"continue");var Aa=ye[mt.source].node[o],Ta=ye[mt.target].node[o],_i=!1;if(tn.forEach(function($i){var Ia=m[$i.source].node,Oa=m[$i.target].node;Ia[o]===Aa&&Oa[o]===Ta&&(_i=!0),!n&&Ia[o]===Ta&&Oa[o]===Aa&&(_i=!0)}),!_i)return We[_r]--,tn&&We[_r]<tn.length?(kt=!0,"break"):($e.splice(pr,1),ye[mt.source].degree--,ye[mt.target].degree--,ye[mt.source].outDegree--,ye[mt.target].inDegree--,"continue")},vt=lr-1;vt>=0;vt--){var or=hr(vt);if(or==="break")break}if(kt)return Et.splice(ie,1),"continue";L.edges=$e;var gr=cl(L,L.nodes[0].id,!1).length;if(Object.keys(gr).reverse().forEach(function(At){if(!(At===L.nodes[0].id||kt)){if(gr[At]===1/0){var pr=ye[At].node[o];if(Be[pr]--,Be[pr]<b[pr].length){kt=!0;return}var mt=L.nodes.indexOf(ye[At].node);L.nodes.splice(mt,1),ye[At]=void 0;return}var _r=p[At].node[o];if(!Bt[_r]||!Bt[_r].length||gr[At]>Bt[_r][Bt[_r].length-1]){var pr=ye[At].node[o];if(Be[pr]--,Be[pr]<b[pr].length){kt=!0;return}var mt=L.nodes.indexOf(ye[At].node);L.nodes.splice(mt,1),ye[At]=void 0}}}),kt)return Et.splice(ie,1),"continue";for(var vr=!0,en=0;vr&&!kt;){vr=!1;var er=n?ye[_e.id].degree<m[J.id].degree||ye[_e.id].inDegree<m[J.id].inDegree||ye[_e.id].outDegree<m[J.id].outDegree:ye[_e.id].degree<m[J.id].degree;if(er){kt=!0;break}if(Be[_e[o]]<b[_e[o]].length){kt=!0;break}for(var Or=L.nodes.length,Un=Or-1;Un>=0;Un--){var Br=L.nodes[Un],Ui=ye[Br.id].degree,Uo=ye[Br.id].inDegree,$o=ye[Br.id].outDegree,qr=Br[o],wi=PE(Ae,qr,m,b),Ca=wi.minPatternNodeLabelDegree,Wo=wi.minPatternNodeLabelInDegree,Xo=wi.minPatternNodeLabelOutDegree,Yo=n?Ui<Ca||Uo<Wo||$o<Xo:Ui<Ca;if(Yo){if(Be[Br[o]]--,Be[Br[o]]<b[Br[o]].length){kt=!0;break}L.nodes.splice(Un,1),ye[Br.id]=void 0,vr=!0}}if(kt||!vr&&en!==0)break;lr=$e.length;for(var $n=lr-1;$n>=0;$n--){var Lr=$e[$n];if(!ye[Lr.source]||!ye[Lr.target]){$e.splice($n,1);var Wn=Lr[s];if(We[Wn]--,ye[Lr.source]&&(ye[Lr.source].degree--,ye[Lr.source].outDegree--),ye[Lr.target]&&(ye[Lr.target].degree--,ye[Lr.target].inDegree--),x[Wn]&&We[Wn]<x[Wn].length){kt=!0;break}vr=!0}}en++}if(kt||kt||L.nodes.length<e.nodes.length||$e.length<e.edges.length)return Et.splice(ie,1),"continue"},fr=Ut-1;fr>=0;fr--){var Gt=dr(fr);if(Gt==="break")break}for(var Jt=Et.length,Rr=function(ie){var L=Et[ie],_e={};L.edges.forEach(function($e){var We="".concat($e.source,"-").concat($e.target,"-").concat($e.label);_e[We]?_e[We]++:_e[We]=1});for(var Be=function(We){var Ke=Et[We],Qe={};Ke.edges.forEach(function(Dt){var lr="".concat(Dt.source,"-").concat(Dt.target,"-").concat(Dt.label);Qe[lr]?Qe[lr]++:Qe[lr]=1});var vt=!0;Object.keys(Qe).length!==Object.keys(_e).length?vt=!1:Object.keys(_e).forEach(function(Dt){Qe[Dt]!==_e[Dt]&&(vt=!1)}),vt&&Et.splice(We,1)},ye=Jt-1;ye>ie;ye--)Be(ye);Jt=Et.length},fr=0;fr<=Jt-1;fr++)Rr(fr);return Et}}},Eu=function(){function r(t){t===void 0&&(t=10),this.linkedList=new $A,this.maxStep=t}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(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r}(),hT=Dm;const rz={getAdjMatrix:Ms,breadthFirstSearch:XA,connectedComponent:Om,getDegree:Ka,getInDegree:VA,getOutDegree:HA,detectCycle:Dm,detectDirectedCycle:hT,detectAllCycles:qA,detectAllDirectedCycle:Pm,detectAllUndirectedCycle:km,depthFirstSearch:Lm,dijkstra:cl,findAllPath:JA,findShortestPath:QA,floydWarshall:hl,labelPropagation:eT,louvain:Bm,iLouvain:tT,kCore:rT,kMeans:nT,cosineSimilarity:Fm,nodesCosineSimilarity:iT,minimumSpanningTree:aT,pageRank:oT,getNeighbors:Jn,Stack:Eu,GADDI:cT},nz=Object.freeze(Object.defineProperty({__proto__:null,GADDI:cT,Stack:Eu,breadthFirstSearch:XA,connectedComponent:Om,cosineSimilarity:Fm,default:rz,depthFirstSearch:Lm,detectAllCycles:qA,detectAllDirectedCycle:Pm,detectAllUndirectedCycle:km,detectCycle:Dm,detectDirectedCycle:hT,dijkstra:cl,findAllPath:JA,findShortestPath:QA,floydWarshall:hl,getAdjMatrix:Ms,getDegree:Ka,getInDegree:VA,getNeighbors:Jn,getOutDegree:HA,iLouvain:tT,kCore:rT,kMeans:nT,labelPropagation:eT,louvain:Bm,minimumSpanningTree:aT,nodesCosineSimilarity:iT,pageRank:oT},Symbol.toStringTag,{value:"Module"}));var yd=xi,iz=function(t){return function(e,n){return e[t]-n[t]}},NE=function(t,e,n){return t>=e&&t<=n},cv=function(t,e,n,i){var a=1e-4,o={x:n.x-t.x,y:n.y-t.y},s={x:e.x-t.x,y:e.y-t.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!NE(v,0,1)||!NE(p,0,1)?null:{x:t.x+v*s.x,y:t.y+v*s.y}}return null},dT=function(t,e){var n=t.x,i=t.y,a=t.width,o=t.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=cv(f[h-1],f[h],l,e),!c);h++);return c},vT=function(t,e){var n=t.x,i=t.y,a=t.r,o=e.x,s=e.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)}},pT=function(t,e){var n=t.rx,i=t.ry,a=t.x,o=t.y,s=e.x-a,u=e.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)}},Mu=function(t,e,n){n===void 0&&(n=1);var i=[t.x,t.y,n];return(!e||isNaN(e[0]))&&(e=[1,0,0,0,1,0,0,0,1]),fv(i,i,e),{x:i[0],y:i[1]}},gT=function(t,e,n){n===void 0&&(n=1),(!e||isNaN(e[0]))&&(e=[1,0,0,0,1,0,0,0,1]);var i=pm([1,0,0,0,1,0,0,0,1],e);i||(i=[1,0,0,0,1,0,0,0,1]);var a=[t.x,t.y,n];return fv(a,a,i),{x:a[0],y:a[1]}},A0=function(t,e,n){var i=t.x-e.x,a=t.y-e.y,o=t.x-n.x,s=t.y-n.y,u=(t.x*t.x-e.x*e.x-e.y*e.y+t.y*t.y)/2,f=(t.x*t.x-n.x*n.x-n.y*n.y+t.y*t.y)/2,l=a*o-i*s;return{x:-(s*u-a*f)/l,y:-(i*f-o*u)/l}},md=function(t,e){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)},az=function(t,e){var n=[];return t.forEach(function(i){var a=[];i.forEach(function(o){a.push(o*e)}),n.push(a)}),n},oz=function(t){for(var e=[],n=t.length,i=0;i<n;i+=1){e[i]=[];for(var a=0;a<n;a+=1)i===a?e[i][a]=0:t[i][a]===0||!t[i][a]?e[i][a]=1/0:e[i][a]=t[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)e[i][a]>e[i][o]+e[o][a]&&(e[i][a]=e[i][o]+e[o][a]);return e},sz=function(t,e){var n=t.nodes,i=t.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,e||(a[c][l]=1)}),a},yT=function(t,e){t.translate(e.x,e.y)},T0=function(t,e,n,i){i===void 0&&(i={duration:500});var a=t.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var o=t.getCanvasBBox(),s=e.x-o.minX,u=e.y-o.minY;if(n){var f=s*a[0],l=u*a[4],c=0,h=0,d=0,v=0;t.animate(function(g){return d=f*g,v=l*g,a=yd(a,[["t",d-c,v-h]]),c=d,h=v,{matrix:a}},i)}else{var p=yd(a,[["t",s,u]]);t.setMatrix(p)}},uz=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=e;gt(e)||(i=[e,e]),gt(e)&&e.length===1&&(i=[e[0],e[0]]),n=yd(n,[["s",i[0],i[1]]]),t.setMatrix(n)},fz=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=yd(n,[["r",e]]),t.setMatrix(n)},lz=function(t,e,n){for(var i=[],a=0;a<t;a++)i[a]=0;return n.forEach(function(o){o.source&&(i[e[o.source]]+=1),o.target&&(i[e[o.target]]+=1)}),i};function cz(r,t,e){return(e[0]-r[0])*(t[1]-r[1])===(t[0]-r[0])*(e[1]-r[1])&&Math.min(r[0],t[0])<=e[0]&&e[0]<=Math.max(r[0],t[0])&&Math.min(r[1],t[1])<=e[1]&&e[1]<=Math.max(r[1],t[1])}var dl=function(t,e,n){var i=!1,a=t.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=t[u],l=t[(u+1)%a];if(cz(f,l,[e,n]))return!0;s(f[1]-n)>0!=s(l[1]-n)>0&&s(e-(n-f[1])*(f[0]-l[0])/(f[1]-l[1])-f[0])<0&&(i=!i)}return i},mT=function(t,e){return!(e.minX>t.maxX||e.maxX<t.minX||e.minY>t.maxY||e.maxY<t.minY)},hz=function(t,e){var n=!1;return me(t,function(i){if(cv(i.from,i.to,e.from,e.to))return n=!0,!1}),n},bT=function(t,e){var n=function(h){var d=h.map(function(p){return p[0]}),v=h.map(function(p){return p[1]});return{minX:Math.min.apply(null,d),maxX:Math.max.apply(null,d),minY:Math.min.apply(null,v),maxY:Math.max.apply(null,v)}},i=function(h){for(var d=[],v=h.length,p=0;p<v-1;p++){var g=h[p],y=h[p+1];d.push({from:{x:g[0],y:g[1]},to:{x:y[0],y:y[1]}})}if(d.length>1){var m=h[0],b=h[v-1];d.push({from:{x:b[0],y:b[1]},to:{x:m[0],y:m[1]}})}return d};if(t.length<2||e.length<2)return!1;var a=n(t),o=n(e);if(!mT(a,o))return!1;var s=!1;if(me(e,function(c){if(dl(t,c[0],c[1]))return s=!0,!1}),s||(me(t,function(c){if(dl(e,c[0],c[1]))return s=!0,!1}),s))return!0;var u=i(t),f=i(e),l=!1;return me(f,function(c){if(hz(u,c))return l=!0,!1}),l},Cs=function(){function r(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i}return r.prototype.getBBox=function(){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),i=Math.max(this.y1,this.y2),a={x:t,y:e,minX:t,minY:e,maxX:n,maxY:i,width:n-t,height:i-e};return a},r}(),Gm=function(t,e){var n={top:[t.minX,t.minY,t.maxX,t.minY],left:[t.minX,t.minY,t.minX,t.maxY],bottom:[t.minX,t.maxY,t.maxX,t.maxY],right:[t.maxX,t.minY,t.maxX,t.maxY]};return n[e]},dz=function(t,e){var n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),i=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),a=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.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},xT=function(t,e){for(var n=["top","left","bottom","right"],i=t.getBBox(),a=0,o=[],s=0;s<4;s++){var u=Gm(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3];o[s]=cv({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:f,y:l},{x:c,y:h}),o[s]&&(a+=1)}return[o,a]},zm=function(t,e){for(var n=["top","left","bottom","right"],i=t.getBBox(),a=Number.POSITIVE_INFINITY,o=0,s=0;s<4;s++){var u=Gm(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3],d=dz(e,new Cs(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},ET=function(t){var e=0,n=0;if(t.length>0){for(var i=0,a=t;i<a.length;i++){var o=a[i];e+=o.x,n+=o.y}e/=t.length,n/=t.length}return{x:e,y:n}},bd=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},wT=function(t,e){var n=e.x1,i=e.y1,a=e.x2-n,o=e.y2-i,s=t.x-n,u=t.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},I0=function(t,e,n){return n===void 0&&(n=.001),Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(n,2)},_T=function(t,e){var n=t.x<e.x,i=t.x>e.x+e.width,a=t.y>e.y+e.height,o=t.y<e.y,s=n||i||a||o;if(!s)return 0;if(a&&!n&&!i)return Math.pow(e.y+e.height-t.y,2);if(o&&!n&&!i)return Math.pow(t.y-e.y,2);if(n&&!a&&!o)return Math.pow(e.x-t.x,2);if(i&&!a&&!o)return Math.pow(e.x+e.width-t.x,2);var u=Math.min(Math.abs(e.x-t.x),Math.abs(e.x+e.width-t.x)),f=Math.min(Math.abs(e.y-t.y),Math.abs(e.y+e.height-t.y));return u*u+f*f},vz=function(t,e){var n=t[0],i=t[1],a=t[2],o=t[3],s=e.x,u=e.y,f=[a-n,o-i];if(Im(f,[0,0]))return NaN;var l=[-f[1],f[0]];To(l,l);var c=[s-n,u-i];return Math.abs(Tm(c,l))},jm=function(t,e,n){return t+(e-t)*n},O0=function(t,e,n){for(var i=Math.min(t.length,e.length),a=new Array(i),o=0;o<i;o++)a[o]=jm(t[o],e[o],n);return a};const pz=Object.freeze(Object.defineProperty({__proto__:null,Line:Cs,applyMatrix:Mu,compare:iz,distance:md,floydWarshall:oz,fractionToLine:zm,getAdjMatrix:sz,getBBoxBoundLine:Gm,getCircleCenterByPoints:A0,getCircleIntersectByPoint:vT,getDegree:lz,getEllipseIntersectByPoint:pT,getLineIntersect:cv,getPointsCenter:ET,getRectIntersectByPoint:dT,intersectBBox:mT,invertMatrix:gT,isPointInPolygon:dl,isPointsOverlap:I0,isPolygonsIntersect:bT,itemIntersectByLine:xT,lerp:jm,lerpArray:O0,move:T0,pointLineDistance:vz,pointLineSquareDist:wT,pointRectSquareDist:_T,rotate:fz,scale:uz,scaleMatrix:az,squareDist:bd,translate:yT},Symbol.toStringTag,{value:"Module"}));var fo="rgb(95, 149, 255)",gz="rgb(255, 255, 255)",RE="rgb(0, 0, 0)",dg="rgb(247, 250, 255)",ST="rgb(239, 244, 255)",Wc="rgb(253, 253, 253)",BE="rgb(250, 250, 250)",Xc="rgb(224, 224, 224)",FE="rgb(234, 234, 234)",yz="rgb(245, 245, 245)",mz="rgb(191, 213, 255)",GE="#4572d9",bz="rgb(223, 234, 255)",ir={mainStroke:fo,mainFill:ST,activeStroke:fo,activeFill:dg,inactiveStroke:mz,inactiveFill:dg,selectedStroke:fo,selectedFill:gz,highlightStroke:GE,highlightFill:bz,disableStroke:Xc,disableFill:BE,edgeMainStroke:Xc,edgeActiveStroke:fo,edgeInactiveStroke:FE,edgeSelectedStroke:fo,edgeHighlightStroke:fo,edgeDisableStroke:yz,comboMainStroke:Xc,comboMainFill:Wc,comboActiveStroke:fo,comboActiveFill:dg,comboInactiveStroke:Xc,comboInactiveFill:Wc,comboSelectedStroke:fo,comboSelectedFill:Wc,comboHighlightStroke:GE,comboHighlightFill:Wc,comboDisableStroke:FE,comboDisableFill:BE};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:ir.mainStroke,fill:ST},size:20,color:ir.mainStroke,linkPoints:{size:8,lineWidth:1,fill:ir.activeFill,stroke:ir.activeStroke}},nodeStateStyles:{active:{fill:ir.activeFill,stroke:ir.activeStroke,lineWidth:2,shadowColor:ir.mainStroke,shadowBlur:10},selected:{fill:ir.selectedFill,stroke:ir.selectedStroke,lineWidth:4,shadowColor:ir.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:ir.highlightFill,stroke:ir.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:ir.inactiveFill,stroke:ir.inactiveStroke,lineWidth:1},disable:{fill:ir.disableFill,stroke:ir.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:RE,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:ir.edgeMainStroke,lineAppendWidth:2},color:ir.edgeMainStroke},edgeStateStyles:{active:{stroke:ir.edgeActiveStroke,lineWidth:1},selected:{stroke:ir.edgeSelectedStroke,lineWidth:2,shadowColor:ir.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ir.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:ir.edgeInactiveStroke,lineWidth:1},disable:{stroke:ir.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:RE,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:ir.comboMainFill,lineWidth:1,stroke:ir.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:ir.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:ir.comboActiveStroke,lineWidth:1,fill:ir.comboActiveFill},selected:{stroke:ir.comboSelectedStroke,lineWidth:2,fill:ir.comboSelectedFill,shadowColor:ir.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ir.comboHighlightStroke,lineWidth:2,fill:ir.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:ir.comboInactiveStroke,fill:ir.comboInactiveFill,lineWidth:1},disable:{stroke:ir.comboDisableStroke,fill:ir.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"},xz={" ":.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 Ji=Math.PI,L0=Math.sin,D0=Math.cos,vn=L0(Ji/8),pn=D0(Ji/8),xd=function(t,e){var n=t.getBBox(),i={x:n.minX,y:n.minY},a={x:n.maxX,y:n.maxY};if(e){var o=e.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),i=Mu(i,o),a=Mu(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}},MT=function(t){var e=t.sourceNode||t.targetNode,n=e.get("group"),i=n.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var a=e.getKeyShape(),o=a.getBBox(),s=t.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=[t.startPoint.x,t.startPoint.y],h=[t.endPoint.x,t.endPoint.y],d=o.height/2,v=o.width/2,p=d,g=d,y=p*vn,m=p*pn,b=g*vn,x=g*pn,E=a.get("type"),w=Math.min(d/2,v/2),_=Math.min(d,v),M=s!=null&&s.pointPadding?Math.min(_,s==null?void 0:s.pointPadding):w;if(c[0]===h[0]&&c[1]===h[1]){switch(f){case"top":E==="circle"?(c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]):(c=[l[0]-M,l[1]-d],h=[l[0]+M,l[1]-d]);break;case"top-right":p=d,g=v,E==="circle"?(y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]+y,l[1]-m],h=[l[0]+x,l[1]-b]):(c=[l[0]+v-M,l[1]-d],h=[l[0]+v,l[1]-d+M]);break;case"right":p=v,g=v,E==="circle"?(y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]+m,l[1]-y],h=[l[0]+x,l[1]+b]):(c=[l[0]+v,l[1]-M],h=[l[0]+v,l[1]+M]);break;case"bottom-right":p=v,g=d,E==="circle"?(y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]+m,l[1]+y],h=[l[0]+b,l[1]+x]):(c=[l[0]+v,l[1]+d-M],h=[l[0]+v-M,l[1]+d]);break;case"bottom":p=d,g=d,E==="circle"?(y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]+y,l[1]+m],h=[l[0]-b,l[1]+x]):(c=[l[0]-M,l[1]+d],h=[l[0]+M,l[1]+d]);break;case"bottom-left":p=d,g=v,E==="circle"?(y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]-y,l[1]+m],h=[l[0]-x,l[1]+b]):(c=[l[0]-v,l[1]+d-M],h=[l[0]-v+M,l[1]+d]);break;case"left":p=v,g=v,E==="circle"?(y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]-m,l[1]+y],h=[l[0]-x,l[1]-b]):(c=[l[0]-v,l[1]-M],h=[l[0]-v,l[1]+M]);break;case"top-left":p=v,g=d,E==="circle"?(y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]-m,l[1]-y],h=[l[0]-b,l[1]-x]):(c=[l[0]-v+M,l[1]-d],h=[l[0]-v,l[1]-d+M]);break;default:p=v,g=v,y=p*vn,m=p*pn,b=g*vn,x=g*pn,c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]}if(s.clockwise===!1){var C=[c[0],c[1]];c=[h[0],h[1]],h=[C[0],C[1]]}}var S=[c[0]-l[0],c[1]-l[1]],A=(p+u)/p,T=(g+u)/g;s.clockwise===!1&&(A=(g+u)/g,T=(p+u)/p);var I=An([0,0],S,A),D=[l[0]+I[0],l[1]+I[1]],N=[h[0]-l[0],h[1]-l[1]],P=An([0,0],N,T),G=[l[0]+P[0],l[1]+P[1]];return t.startPoint={x:c[0],y:c[1]},t.endPoint={x:h[0],y:h[1]},t.controlPoints=[{x:D[0],y:D[1]},{x:G[0],y:G[1]}],t},CT=function(t,e,n,i,a){var o=1e-4,s=[],u=t==null?void 0:t.getPoint(e);if(!u)return{x:0,y:0,angle:0};if(e<o)s=t.getStartTangent().reverse();else if(e>1-o)s=t.getEndTangent();else{var f=t==null?void 0:t.getPoint(e+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+=Ji*2),n&&(u.x+=D0(l)*n,u.y+=L0(l)*n),i){var c=l-Ji/2;l>1/2*Ji&&l<3*1/2*Ji&&(c-=Ji),u.x+=D0(c)*i,u.y+=L0(c)*i}var h={x:u.x,y:u.y,angle:l};return a?(l>.5*Ji&&l<1.5*Ji&&(l-=Ji),F({rotate:l},h)):h},Ez=function r(t,e,n,i){if(i(t,e,n)===!1)return!1;if(t&&t.children){for(var a=t.children.length-1;a>=0;a--)if(!r(t.children[a],t,a,i))return!1}return!0},wz=function r(t,e,n,i){if(t&&t.children){for(var a=t.children.length-1;a>=0;a--)if(!r(t.children[a],t,a,i))return}return i(t,e,n)!==!1},Cn=function(t,e){typeof e=="function"&&Ez(t,null,-1,e)},ea=function(t,e){typeof e=="function"&&wz(t,null,-1,e)},AT=function(t,e){return e*(xz[t]||1)},TT=function(t,e){var n=0,i=new RegExp("[一-龥]+");return t.split("").forEach(function(a){i.test(a)?n+=e:n+=AT(a,e)}),[n,e]},IT=function(t,e){return typeof e!="number"||e<=0||e>=t.length?t:t.substring(0,e)+"..."},k0=function(t,e){var n=[],i={},a={};t.forEach(function(u){a[u.id]=u}),t.forEach(function(u,f){var l=Vt(u);l.itemType="combo",l.children=void 0,l.parentId===l.id?(console.warn("The parentId for combo ".concat(l.id," can not be the same as the combo's id")),delete l.parentId):l.parentId&&!a[l.parentId]&&(console.warn("The parent combo for combo ".concat(l.id," does not exist!")),delete l.parentId);var c=i[l.id];if(c){if(l.children=c.children,i[l.id]=l,c=l,!c.parentId){n.push(c);return}var h=i[c.parentId];if(h)h.children?h.children.push(l):h.children=[l];else{var d={id:c.parentId,children:[c]};i[c.parentId]=d,i[l.id]=l}return}if(Ne(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={};(e||[]).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},P0=function(t,e,n){var i,a=t,o,s={root:{children:t}},u=!1,f="root";(t||[]).forEach(function(v){if(!u){if(v.id===e){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||e===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:e,itemType:"node",comboId:n},s[e]={children:void 0}),e){var c=!1;if(n){var h=0;(t||[]).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"&&t.push(o);var d=o.depth;Cn(o,function(v){return v.itemType==="node"?d+=2:d+=1,v.depth=d,!0})}return t},Xh=function(t,e,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(!t||t.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=gt(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 t.forEach(function(y){var m=e.findById(y.id);if(!(!m||!m.isVisible())){m.set("bboxCanvasCache",void 0);var b=m.getCanvasBBox();b.x&&i.minX>b.minX&&(i.minX=b.minX),b.y&&i.minY>b.minY&&(i.minY=b.minY),b.x&&i.maxX<b.maxX&&(i.maxX=b.maxX),b.y&&i.maxY<b.maxY&&(i.maxY=b.maxY)}}),i.x=(i.minX+i.maxX)/2,i.y=(i.minY+i.maxY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY,i.centerX=(i.minX+i.maxX)/2,i.centerY=(i.minY+i.maxY)/2,(n==null?void 0:n.getKeyShape().get("type"))==="circle"&&(i.width=Math.hypot(i.height,i.width),i.height=i.width),Object.keys(i).forEach(function(y){(i[y]===1/0||i[y]===-1/0)&&(i[y]=void 0)}),i},_z=function(t){var e=ht(t.x)||ht(t.y)||t.type||t.anchorPoints||t.size;return t.style&&(e=e||ht(t.style.r)||ht(t.style.width)||ht(t.style.height)||ht(t.style.rx)||ht(t.style.ry)),e},Yh=function(t){var e={};return Object.keys(t).forEach(function(n){var i=t[n];if(!(n==="img"&&!Ne(i)))if(bn(i)&&!gt(i)){var a={};Object.keys(i).forEach(function(o){var s=i[o];o==="img"&&!Ne(s)||(a[o]=Vt(s))}),e[n]=a}else e[n]=Vt(i)}),e},vl=function(t){var e=t.animateCfg,n=t.callback,i;if(!e)i={duration:500,callback:n};else if(i=Vt(e),e.callback){var a=e.callback;i.callback=function(){n(),a()}}else i.callback=n;return i};const Sz=Object.freeze(Object.defineProperty({__proto__:null,cloneBesidesImg:Yh,getAnimateCfgWithCallback:vl,getBBox:xd,getComboBBox:Xh,getLabelPosition:CT,getLetterWidth:AT,getLoopCfgs:MT,getTextSize:TT,plainCombosToTrees:k0,reconstructTree:P0,shouldRefreshEdge:_z,traverseTree:Cn,traverseTreeUp:ea,truncateLabelByLength:IT},Symbol.toStringTag,{value:"Module"}));var zE=function(t){if(!t)return console.error("G6 Error Tips: the data must be defined"),!1;var e=t.nodes,n=t.edges,i=t.combos,a=i===void 0?[]:i;if(!e&&!n){var o=!0;return Cn(t,function(h){return Ne(h.id)?!0:(o=!1,!1)}),o}var s=(e||[]).find(function(h){return!Ne(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=(e||[]).map(function(h){return h.id}),f=a==null?void 0:a.map(function(h){return h.id}),l=ri(ri([],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},Mz=function(t,e){if(t==="node"||t==="combo"){if(e.id&&!Ne(e.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(e.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(t==="edge"&&(!e.source||!e.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0},Cz=function(){function r(t){this.graph=t,this.destroyed=!1,this.modes=t.get("modes")||{default:[]},this.formatModes(),this.mode=t.get("defaultMode")||"default",this.currentBehaves=[],this.setMode(this.mode)}return r.prototype.formatModes=function(){var t=this.modes;me(t,function(e){me(e,function(n,i){Ne(n)&&(e[i]={type:n})})})},r.prototype.setBehaviors=function(t){var e=this.graph,n=this.modes[t],i=[],a;me(n||[],function(o){var s=vm.getBehavior(o.type||o);s&&(a=new s(o),a&&(a.bind(e),i.push(a)))}),this.currentBehaves=i},r.mergeBehaviors=function(t,e){return me(e,function(n){t.indexOf(n)<0&&(Ne(n)&&(n={type:n}),t.push(n))}),t},r.filterBehaviors=function(t,e){var n=[];return t.forEach(function(i){var a="";Ne(i)?a=i:a=i.type,e.indexOf(a)<0&&n.push(i)}),n},r.prototype.setMode=function(t){var e=this,n=e.modes,i=e.graph,a=t,o=n[a];o&&(i.emit("beforemodechange",{mode:t}),me(this.currentBehaves,function(s){s.delegate&&s.delegate.remove(),s.unbind(i)}),this.setBehaviors(a),i.emit("aftermodechange",{mode:t}),this.mode=t)},r.prototype.getMode=function(){return this.mode},r.prototype.manipulateBehaviors=function(t,e,n){var i=this,a;if(gt(t)?a=t:a=[t],gt(e))return me(e,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=e;return e||(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(t,e,n){Ne(t)&&(t={type:t});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===t.type)return s.updateCfg(e),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===t.type||s===t.type)return s===t.type&&(s={type:s}),Object.assign(s,e),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}(),Kf=`
2
- \v\f\r   ᠎              \u2028\u2029`,Az=new RegExp("([a-z])["+Kf+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+Kf+"]*,?["+Kf+"]*)+)","ig"),Tz=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+Kf+"]*,?["+Kf+"]*","ig"),wu=function(r){if(!r)return null;if(gt(r))return r;var t={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},e=[];return String(r).replace(Az,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(Tz,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(e.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&e.push([i,o[0]]),s==="r")e.push([i].concat(o));else for(;o.length>=t[s]&&(e.push([i].concat(o.splice(0,t[s]))),!!t[s]););return r}),e},N0=function(r,t){for(var e=[],n=0,i=r.length;i-2*!t>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]}];t?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]}),e.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 e},Yc=function(r,t,e,n,i){var a=[];if(i===null&&n===null&&(n=e),r=+r,t=+t,e=+e,n=+n,i!==null){var o=Math.PI/180,s=r+e*Math.cos(-n*o),u=r+e*Math.cos(-i*o),f=t+e*Math.sin(-n*o),l=t+e*Math.sin(-i*o);a=[["M",s,f],["A",e,e,0,+(i-n>180),0,u,l]]}else a=[["M",r,t],["m",0,-n],["a",e,n,0,1,1,0,2*n],["a",e,n,0,1,1,0,-2*n],["z"]];return a},R0=function(r){if(r=wu(r),!r||!r.length)return[["M",0,0]];var t=[],e=0,n=0,i=0,a=0,o=0,s,u;r[0][0]==="M"&&(e=+r[0][1],n=+r[0][2],i=e,a=n,o++,t[0]=["M",e,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(t.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]+e,l[7]=+c[7]+n;break;case"V":l[1]=+c[1]+n;break;case"H":l[1]=+c[1]+e;break;case"R":u=[e,n].concat(c.slice(1));for(var v=2,p=u.length;v<p;v++)u[v]=+u[v]+e,u[++v]=+u[v]+n;t.pop(),t=t.concat(N0(u,f));break;case"O":t.pop(),u=Yc(e,n,c[1],c[2]),u.push(u[0]),t=t.concat(u);break;case"U":t.pop(),t=t.concat(Yc(e,n,c[1],c[2],c[3])),l=["U"].concat(t[t.length-1].slice(-2));break;case"M":i=+c[1]+e,a=+c[2]+n;break;default:for(var v=1,p=c.length;v<p;v++)l[v]=+c[v]+(v%2?e:n)}else if(s==="R")u=[e,n].concat(c.slice(1)),t.pop(),t=t.concat(N0(u,f)),l=["R"].concat(c.slice(-2));else if(s==="O")t.pop(),u=Yc(e,n,c[1],c[2]),u.push(u[0]),t=t.concat(u);else if(s==="U")t.pop(),t=t.concat(Yc(e,n,c[1],c[2],c[3])),l=["U"].concat(t[t.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":e=+i,n=+a;break;case"H":e=l[1];break;case"V":n=l[1];break;case"M":i=l[l.length-2],a=l[l.length-1];break;default:e=l[l.length-2],n=l[l.length-1]}}return t},Vc=function(r,t,e,n){return[r,t,e,n,e,n]},jE=function(r,t,e,n,i,a){var o=.3333333333333333,s=2/3;return[o*r+s*e,o*t+s*n,o*i+s*e,o*a+s*n,i,a]},OT=function(r,t,e,n,i,a,o,s,u,f){e===n&&(e+=1);var l=Math.PI*120/180,c=Math.PI/180*(+i||0),h=[],d,v,p,g,y,m=function(Le,qe,at){var rt=Le*Math.cos(at)-qe*Math.sin(at),xt=Le*Math.sin(at)+qe*Math.cos(at);return{x:rt,y:xt}};if(f)v=f[0],p=f[1],g=f[2],y=f[3];else{d=m(r,t,-c),r=d.x,t=d.y,d=m(s,u,-c),s=d.x,u=d.y,r===s&&t===u&&(s+=1,u+=1);var b=(r-s)/2,x=(t-u)/2,E=b*b/(e*e)+x*x/(n*n);E>1&&(E=Math.sqrt(E),e=E*e,n=E*n);var w=e*e,_=n*n,M=(a===o?-1:1)*Math.sqrt(Math.abs((w*_-w*x*x-_*b*b)/(w*x*x+_*b*b)));g=M*e*x/n+(r+s)/2,y=M*-n*b/e+(t+u)/2,v=Math.asin(((t-y)/n).toFixed(9)),p=Math.asin(((u-y)/n).toFixed(9)),v=r<g?Math.PI-v:v,p=s<g?Math.PI-p:p,v<0&&(v=Math.PI*2+v),p<0&&(p=Math.PI*2+p),o&&v>p&&(v=v-Math.PI*2),!o&&p>v&&(p=p-Math.PI*2)}var C=p-v;if(Math.abs(C)>l){var S=p,A=s,T=u;p=v+l*(o&&p>v?1:-1),s=g+e*Math.cos(p),u=y+n*Math.sin(p),h=OT(s,u,e,n,i,0,o,A,T,[p,S,g,y])}C=p-v;var I=Math.cos(v),D=Math.sin(v),N=Math.cos(p),P=Math.sin(p),G=Math.tan(C/4),W=4/3*e*G,k=4/3*n*G,R=[r,t],Y=[r+W*D,t-k*I],J=[s+W*P,u-k*N],te=[s,u];if(Y[0]=2*R[0]-Y[0],Y[1]=2*R[1]-Y[1],f)return[Y,J,te].concat(h);h=[Y,J,te].concat(h).join().split(",");for(var H=[],pe=0,Ae=h.length;pe<Ae;pe++)H[pe]=pe%2?m(h[pe-1],h[pe],c).y:m(h[pe],h[pe+1],c).x;return H},B0=function(r,t){var e=R0(r),n=t&&R0(t),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=[],s=[],u="",f="",l,c=function(b,x,E){var w,_;if(!b)return["C",x.x,x.y,x.x,x.y,x.x,x.y];switch(!(b[0]in{T:1,Q:1})&&(x.qx=x.qy=null),b[0]){case"M":x.X=b[1],x.Y=b[2];break;case"A":b=["C"].concat(OT.apply(0,[x.x,x.y].concat(b.slice(1))));break;case"S":E==="C"||E==="S"?(w=x.x*2-x.bx,_=x.y*2-x.by):(w=x.x,_=x.y),b=["C",w,_].concat(b.slice(1));break;case"T":E==="Q"||E==="T"?(x.qx=x.x*2-x.qx,x.qy=x.y*2-x.qy):(x.qx=x.x,x.qy=x.y),b=["C"].concat(jE(x.x,x.y,x.qx,x.qy,b[1],b[2]));break;case"Q":x.qx=b[1],x.qy=b[2],b=["C"].concat(jE(x.x,x.y,b[1],b[2],b[3],b[4]));break;case"L":b=["C"].concat(Vc(x.x,x.y,b[1],b[2]));break;case"H":b=["C"].concat(Vc(x.x,x.y,b[1],x.y));break;case"V":b=["C"].concat(Vc(x.x,x.y,x.x,b[1]));break;case"Z":b=["C"].concat(Vc(x.x,x.y,x.X,x.Y));break}return b},h=function(b,x){if(b[x].length>7){b[x].shift();for(var E=b[x];E.length;)o[x]="A",n&&(s[x]="A"),b.splice(x++,0,["C"].concat(E.splice(0,6)));b.splice(x,1),l=Math.max(e.length,n&&n.length||0)}},d=function(b,x,E,w,_){b&&x&&b[_][0]==="M"&&x[_][0]!=="M"&&(x.splice(_,0,["M",w.x,w.y]),E.bx=0,E.by=0,E.x=b[_][1],E.y=b[_][2],l=Math.max(e.length,n&&n.length||0))};l=Math.max(e.length,n&&n.length||0);for(var v=0;v<l;v++){e[v]&&(u=e[v][0]),u!=="C"&&(o[v]=u,v&&(f=o[v-1])),e[v]=c(e[v],i,f),o[v]!=="A"&&u==="C"&&(o[v]="C"),h(e,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(e,n,i,a,v),d(n,e,a,i,v);var p=e[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?[e,n]:e},Iz=/,?([a-z]),?/gi,LT=function(r){return r.join(",").replace(Iz,"$1")},UE=function(r,t,e,n,i){var a=-3*t+9*e-9*n+3*i,o=r*a+6*t-12*e+6*n;return r*o-3*t+3*e},$E=function(r,t,e,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=UE(p,r,e,i,o),y=UE(p,t,n,a,s),m=g*g+y*y;d+=h[v]*Math.sqrt(m)}return f*d},Oz=function(r,t,e,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*e+6*i,l=-3*r+9*e-9*i+3*o,h=3*e-3*r):(c=6*t-12*n+6*a,l=-3*t+9*n-9*a+3*s,h=3*n-3*t),Math.abs(l)<1e-12){if(Math.abs(c)<1e-12)continue;d=-h/c,d>0&&d<1&&u.push(d);continue}var p=c*c-4*h*l,g=Math.sqrt(p);if(!(p<0)){var y=(-c+g)/(2*l);y>0&&y<1&&u.push(y);var m=(-c-g)/(2*l);m>0&&m<1&&u.push(m)}}for(var b=u.length,x=b,E;b--;)d=u[b],E=1-d,f[0][b]=E*E*E*r+3*E*E*d*e+3*E*d*d*i+d*d*d*o,f[1][b]=E*E*E*t+3*E*E*d*n+3*E*d*d*a+d*d*d*s;return f[0][x]=r,f[1][x]=t,f[0][x+1]=o,f[1][x+1]=s,f[0].length=f[1].length=x+2,{min:{x:Math.min.apply(0,f[0]),y:Math.min.apply(0,f[1])},max:{x:Math.max.apply(0,f[0]),y:Math.max.apply(0,f[1])}}},Lz=function(r,t,e,n,i,a,o,s){if(!(Math.max(r,e)<Math.min(i,o)||Math.min(r,e)>Math.max(i,o)||Math.max(t,n)<Math.min(a,s)||Math.min(t,n)>Math.max(a,s))){var u=(r*n-t*e)*(i-o)-(r-e)*(i*s-a*o),f=(r*n-t*e)*(a-s)-(t-n)*(i*s-a*o),l=(r-e)*(a-s)-(t-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,e).toFixed(2)||d>+Math.max(r,e).toFixed(2)||d<+Math.min(i,o).toFixed(2)||d>+Math.max(i,o).toFixed(2)||v<+Math.min(t,n).toFixed(2)||v>+Math.max(t,n).toFixed(2)||v<+Math.min(a,s).toFixed(2)||v>+Math.max(a,s).toFixed(2)))return{x:c,y:h}}}},lo=function(r,t,e){return t>=r.x&&t<=r.x+r.width&&e>=r.y&&e<=r.y+r.height},DT=function(r,t,e,n,i){if(i)return[["M",+r+ +i,t],["l",e-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-e,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,t],["l",e,0],["l",0,n],["l",-e,0],["z"]];return a.parsePathArray=LT,a},F0=function(r,t,e,n){return r===null&&(r=t=e=n=0),t===null&&(t=r.y,e=r.width,n=r.height,r=r.x),{x:r,y:t,width:e,w:e,height:n,h:n,x2:r+e,y2:t+n,cx:r+e/2,cy:t+n/2,r1:Math.min(e,n)/2,r2:Math.max(e,n)/2,r0:Math.sqrt(e*e+n*n)/2,path:DT(r,t,e,n),vb:[r,t,e,n].join(" ")}},Dz=function(r,t){return r=F0(r),t=F0(t),lo(t,r.x,r.y)||lo(t,r.x2,r.y)||lo(t,r.x,r.y2)||lo(t,r.x2,r.y2)||lo(r,t.x,t.y)||lo(r,t.x2,t.y)||lo(r,t.x,t.y2)||lo(r,t.x2,t.y2)||(r.x<t.x2&&r.x>t.x||t.x<r.x2&&t.x>r.x)&&(r.y<t.y2&&r.y>t.y||t.y<r.y2&&t.y>r.y)},WE=function(r,t,e,n,i,a,o,s){gt(r)||(r=[r,t,e,n,i,a,o,s]);var u=Oz.apply(null,r);return F0(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},XE=function(r,t,e,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*e+f*3*u*u*i+d*o,p=l*t+c*3*u*n+f*3*u*u*a+d*s,g=r+2*u*(e-r)+h*(i-2*e+r),y=t+2*u*(n-t)+h*(a-2*n+t),m=e+2*u*(i-e)+h*(o-2*i+e),b=n+2*u*(a-n)+h*(s-2*a+n),x=f*r+u*e,E=f*t+u*n,w=f*i+u*o,_=f*a+u*s,M=90-Math.atan2(g-m,y-b)*180/Math.PI;return{x:v,y:p,m:{x:g,y},n:{x:m,y:b},start:{x,y:E},end:{x:w,y:_},alpha:M}},kz=function(r,t,e){var n=WE(r),i=WE(t);if(!Dz(n,i))return e?0:[];for(var a=$E.apply(0,r),o=$E.apply(0,t),s=~~(a/8),u=~~(o/8),f=[],l=[],c={},h=e?0:[],d=0;d<s+1;d++){var v=XE.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=XE.apply(0,t.concat(d/u));l.push({x:v.x,y:v.y,t:d/u})}for(var d=0;d<s;d++)for(var p=0;p<u;p++){var g=f[d],y=f[d+1],m=l[p],b=l[p+1],x=Math.abs(y.x-g.x)<.001?"y":"x",E=Math.abs(b.x-m.x)<.001?"y":"x",w=Lz(g.x,g.y,y.x,y.y,m.x,m.y,b.x,b.y);if(w){if(c[w.x.toFixed(4)]===w.y.toFixed(4))continue;c[w.x.toFixed(4)]=w.y.toFixed(4);var _=g.t+Math.abs((w[x]-g[x])/(y[x]-g[x]))*(y.t-g.t),M=m.t+Math.abs((w[E]-m[E])/(b[E]-m[E]))*(b.t-m.t);_>=0&&_<=1&&M>=0&&M<=1&&(e?h+=1:h.push({x:w.x,y:w.y,t1:_,t2:M}))}}return h},Pz=function(r,t,e){r=B0(r),t=B0(t);for(var n,i,a,o,s,u,f,l,c,h,d=e?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=t.length;y<m;y++){var b=t[y];if(b[0]==="M")a=f=b[1],o=l=b[2];else{b[0]==="C"?(h=[a,o].concat(b.slice(1)),a=h[6],o=h[7]):(h=[a,o,a,o,f,l,f,l],a=f,o=l);var x=kz(c,h,e);if(e)d+=x;else{for(var E=0,w=x.length;E<w;E++)x[E].segment1=v,x[E].segment2=y,x[E].bez1=c,x[E].bez2=h;d=d.concat(x)}}}}}return d},Nz=function(r,t){return Pz(r,t)};function Rz(r,t){var e=[],n=[];function i(a,o){if(a.length===1)e.push(a[0]),n.push(a[0]);else{for(var s=[],u=0;u<a.length-1;u++)u===0&&e.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,t),{left:e,right:n.reverse()}}function Bz(r,t,e){var n=[[r[1],r[2]]];e=e||2;var i=[];t[0]==="A"?(n.push(t[6]),n.push(t[7])):t[0]==="C"?(n.push([t[1],t[2]]),n.push([t[3],t[4]]),n.push([t[5],t[6]])):t[0]==="S"||t[0]==="Q"?(n.push([t[1],t[2]]),n.push([t[3],t[4]])):n.push([t[1],t[2]]);for(var a=n,o=1/e,s=0;s<e-1;s++){var u=o/(1-o*s),f=Rz(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 Fz=function(r,t,e){if(e===1)return[[].concat(r)];var n=[];if(t[0]==="L"||t[0]==="C"||t[0]==="Q")n=n.concat(Bz(r,t,e));else{var i=[].concat(r);i[0]==="M"&&(i[0]="L");for(var a=0;a<=e-1;a++)n.push(i)}return n},Gz=function(r,t){if(r.length===1)return r;var e=r.length-1,n=t.length-1,i=e/n,a=[];if(r.length===1&&r[0][0]==="M"){for(var o=0;o<n-e;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===e?f.concat(r[e]):f.concat(Fz(r[c],r[c+1],l))},[]);return u.unshift(r[0]),(t[n]==="Z"||t[n]==="z")&&u.push("Z"),u},zz=function(r,t){if(r.length!==t.length)return!1;var e=!0;return me(r,function(n,i){if(n!==t[i])return e=!1,!1}),e};function jz(r,t,e){var n=null,i=e;return t<i&&(i=t,n="add"),r<i&&(i=r,n="del"),{type:n,min:i}}var Uz=function(r,t){var e=r.length,n=t.length,i,a,o=0;if(e===0||n===0)return null;for(var s=[],u=0;u<=e;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<=e;u++){i=r[u-1];for(var f=1;f<=n;f++){a=t[f-1],zz(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]=jz(l,c,h)}}return s},kT=function(r,t){var e=Uz(r,t),n=r.length,i=t.length,a=[],o=1,s=1;if(e[n][i].min!==n){for(var u=1;u<=n;u++){var f=e[u][u].min;s=u;for(var l=o;l<=i;l++)e[u][l].min<f&&(f=e[u][l].min,s=l);o=s,e[u][o].type&&a.push({index:u-1,type:e[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 vg(r,t,e){for(var n=[].concat(r),i,a=1/(e+1),o=PT(t)[0],s=1;s<=e;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 PT(r){var t=[];switch(r[0]){case"M":t.push([r[1],r[2]]);break;case"L":t.push([r[1],r[2]]);break;case"A":t.push([r[6],r[7]]);break;case"Q":t.push([r[3],r[4]]),t.push([r[1],r[2]]);break;case"T":t.push([r[1],r[2]]);break;case"C":t.push([r[5],r[6]]),t.push([r[1],r[2]]),t.push([r[3],r[4]]);break;case"S":t.push([r[3],r[4]]),t.push([r[1],r[2]]);break;case"H":t.push([r[1],r[1]]);break;case"V":t.push([r[1],r[1]]);break}return t}var G0=function(r,t){if(r.length<=1)return r;for(var e,n=0;n<t.length;n++)if(r[n][0]!==t[n][0])switch(e=PT(r[n]),t[n][0]){case"M":r[n]=["M"].concat(e[0]);break;case"L":r[n]=["L"].concat(e[0]);break;case"A":r[n]=[].concat(t[n]),r[n][6]=e[0][0],r[n][7]=e[0][1];break;case"Q":if(e.length<2)if(n>0)e=vg(e,r[n-1],1);else{r[n]=t[n];break}r[n]=["Q"].concat(e.reduce(function(i,a){return i.concat(a)},[]));break;case"T":r[n]=["T"].concat(e[0]);break;case"C":if(e.length<3)if(n>0)e=vg(e,r[n-1],2);else{r[n]=t[n];break}r[n]=["C"].concat(e.reduce(function(i,a){return i.concat(a)},[]));break;case"S":if(e.length<2)if(n>0)e=vg(e,r[n-1],1);else{r[n]=t[n];break}r[n]=["S"].concat(e.reduce(function(i,a){return i.concat(a)},[]));break;default:r[n]=t[n]}return r};const $z=Object.freeze(Object.defineProperty({__proto__:null,catmullRomToBezier:N0,fillPath:Gz,fillPathByDiff:kT,formatPath:G0,intersection:Nz,parsePathArray:LT,parsePathString:wu,pathToAbsolute:R0,pathToCurve:B0,rectPath:DT},Symbol.toStringTag,{value:"Module"}));var NT=function(){function r(t,e){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=t,this.name=t,this.originalEvent=e,this.timeStamp=e.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 t=this.type;return"[Event (type="+t+")]"},r.prototype.save=function(){},r.prototype.restore=function(){},r}();function RT(r,t){var e=r.indexOf(t);e!==-1&&r.splice(e,1)}var YE=typeof window<"u"&&typeof window.document<"u";function BT(r,t){if(r.isCanvas())return!0;for(var e=t.getParent(),n=!1;e;){if(e===r){n=!0;break}e=e.getParent()}return n}function z0(r){return r.cfg.visible&&r.cfg.capture}var Wz=function(r){Ot(t,r);function t(e){var n=r.call(this)||this;n.destroyed=!1;var i=n.getDefaultCfg();return n.cfg=yt(i,e),n}return t.prototype.getDefaultCfg=function(){return{}},t.prototype.get=function(e){return this.cfg[e]},t.prototype.set=function(e,n){this.cfg[e]=n},t.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},t}(DC),VE=function(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},Xz=function(){function r(t,e,n){this.name=t,this.version=e,this.os=n,this.type="browser"}return r}(),Yz=function(){function r(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return r}(),Vz=function(){function r(t,e,n,i){this.name=t,this.version=e,this.os=n,this.bot=i,this.type="bot-device"}return r}(),Hz=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),Kz=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),qz=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Zz=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,HE=3,Qz=[["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",qz]],KE=[["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 FT(r){return r?qE(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Kz:typeof navigator<"u"?qE(navigator.userAgent):t8()}function Jz(r){return r!==""&&Qz.reduce(function(t,e){var n=e[0],i=e[1];if(t)return t;var a=i.exec(r);return!!a&&[n,a]},!1)}function qE(r){var t=Jz(r);if(!t)return null;var e=t[0],n=t[1];if(e==="searchbot")return new Hz;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<HE&&(i=VE(VE([],i,!0),r8(HE-i.length),!0)):i=[];var a=i.join("."),o=e8(r),s=Zz.exec(r);return s&&s[1]?new Vz(e,a,o,s[1]):new Xz(e,a,o)}function e8(r){for(var t=0,e=KE.length;t<e;t++){var n=KE[t],i=n[0],a=n[1],o=a.exec(r);if(o)return i}return null}function t8(){var r=typeof process<"u"&&process.version;return r?new Yz(process.version.slice(1)):null}function r8(r){for(var t=[],e=0;e<r;e++)t.push("0");return t}function ZE(r,t){var e=[],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=t[0],d=t[1],v=t[2],p=t[3],g=t[4],y=t[5],m=t[6],b=t[7],x=t[8];return e[0]=h*n+d*o+v*f,e[1]=h*i+d*s+v*l,e[2]=h*a+d*u+v*c,e[3]=p*n+g*o+y*f,e[4]=p*i+g*s+y*l,e[5]=p*a+g*u+y*c,e[6]=m*n+b*o+x*f,e[7]=m*i+b*s+x*l,e[8]=m*a+b*u+x*c,e}function ps(r,t){var e=[],n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function GT(r){var t=[],e=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=e*c+n*h+i*d;return v?(v=1/v,t[0]=c*v,t[1]=(-l*n+i*f)*v,t[2]=(s*n-i*o)*v,t[3]=h*v,t[4]=(l*e-i*u)*v,t[5]=(-s*e+i*a)*v,t[6]=d*v,t[7]=(-f*e+n*u)*v,t[8]=(o*e-n*a)*v,t):null}var xf=xi,pg="matrix",n8=["zIndex","capture","visible","type"],i8=["repeat"],a8=":",o8="*";function s8(r){for(var t=[],e=0;e<r.length;e++)gt(r[e])?t.push([].concat(r[e])):t.push(r[e]);return t}function u8(r,t){var e={},n=t.attrs;for(var i in r)e[i]=n[i];return e}function f8(r,t){var e={},n=t.attr();return me(r,function(i,a){i8.indexOf(a)===-1&&!Oo(n[a],i)&&(e[a]=i)}),e}function l8(r,t){if(t.onFrame)return r;var e=t.startTime,n=t.delay,i=t.duration,a=Object.prototype.hasOwnProperty;return me(r,function(o){e+n<o.startTime+o.delay+o.duration&&i>o.delay&&me(t.toAttrs,function(s,u){a.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),r}var zT=function(r){Ot(t,r);function t(e){var n=r.call(this,e)||this;n.attrs={};var i=n.getDefaultAttrs();return yt(i,e.attrs),n.attrs=i,n.initAttrs(i),n.initAnimate(),n}return t.prototype.getDefaultCfg=function(){return{visible:!0,capture:!0,zIndex:0}},t.prototype.getDefaultAttrs=function(){return{matrix:this.getDefaultMatrix(),opacity:1}},t.prototype.onCanvasChange=function(e){},t.prototype.initAttrs=function(e){},t.prototype.initAnimate=function(){this.set("animable",!0),this.set("animating",!1)},t.prototype.isGroup=function(){return!1},t.prototype.getParent=function(){return this.get("parent")},t.prototype.getCanvas=function(){return this.get("canvas")},t.prototype.attr=function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=n[0],o=n[1];if(!a)return this.attrs;if(bn(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((e={},e[a]=o,e)),this):this.attrs[a]},t.prototype.isClipped=function(e,n){var i=this.getClip();return i&&!i.isHit(e,n)},t.prototype.setAttr=function(e,n){var i=this.attrs[e];i!==n&&(this.attrs[e]=n,this.onAttrChange(e,n,i))},t.prototype.onAttrChange=function(e,n,i){e==="matrix"&&this.set("totalMatrix",null)},t.prototype.afterAttrsChange=function(e){if(this.cfg.isClipShape){var n=this.cfg.applyTo;n&&n.onCanvasChange("clip")}else this.onCanvasChange("attr")},t.prototype.show=function(){return this.set("visible",!0),this.onCanvasChange("show"),this},t.prototype.hide=function(){return this.set("visible",!1),this.onCanvasChange("hide"),this},t.prototype.setZIndex=function(e){this.set("zIndex",e);var n=this.getParent();return n&&n.sort(),this},t.prototype.toFront=function(){var e=this.getParent();if(e){var n=e.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.push(this),this.onCanvasChange("zIndex")}},t.prototype.toBack=function(){var e=this.getParent();if(e){var n=e.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.unshift(this),this.onCanvasChange("zIndex")}},t.prototype.remove=function(e){e===void 0&&(e=!0);var n=this.getParent();n?(RT(n.getChildren(),this),n.get("clearing")||this.onCanvasChange("remove")):this.onCanvasChange("remove"),e&&this.destroy()},t.prototype.resetMatrix=function(){this.attr(pg,this.getDefaultMatrix()),this.onCanvasChange("matrix")},t.prototype.getMatrix=function(){return this.attr(pg)},t.prototype.setMatrix=function(e){this.attr(pg,e),this.onCanvasChange("matrix")},t.prototype.getTotalMatrix=function(){var e=this.cfg.totalMatrix;if(!e){var n=this.attr("matrix"),i=this.cfg.parentMatrix;i&&n?e=ZE(i,n):e=n||i,this.set("totalMatrix",e)}return e},t.prototype.applyMatrix=function(e){var n=this.attr("matrix"),i=null;e&&n?i=ZE(e,n):i=n||e,this.set("totalMatrix",i),this.set("parentMatrix",e)},t.prototype.getDefaultMatrix=function(){return null},t.prototype.applyToMatrix=function(e){var n=this.attr("matrix");return n?ps(n,e):e},t.prototype.invertFromMatrix=function(e){var n=this.attr("matrix");if(n){var i=GT(n);if(i)return ps(i,e)}return e},t.prototype.setClip=function(e){var n=this.getCanvas(),i=null;if(e){var a=this.getShapeBase(),o=ku(e.type),s=a[o];s&&(i=new s({type:e.type,isClipShape:!0,applyTo:this,attrs:e.attrs,canvas:n}))}return this.set("clipShape",i),this.onCanvasChange("clip"),i},t.prototype.getClip=function(){var e=this.cfg.clipShape;return e||null},t.prototype.clone=function(){var e=this,n=this.attrs,i={};me(n,function(s,u){gt(n[u])?i[u]=s8(n[u]):i[u]=n[u]});var a=this.constructor,o=new a({attrs:i});return me(n8,function(s){o.set(s,e.get(s))}),o},t.prototype.destroy=function(){var e=this.destroyed;e||(this.attrs={},r.prototype.destroy.call(this))},t.prototype.isAnimatePaused=function(){return this.get("_pause").isPaused},t.prototype.animate=function(){for(var e=[],n=0;n<arguments.length;n++)e[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=e[0],s=e[1],u=e[2],f=u===void 0?"easeLinear":u,l=e[3],c=l===void 0?Ff:l,h=e[4],d=h===void 0?0:h,v,p,g,y,m;Cr(o)?(v=o,o={}):bn(o)&&o.onFrame&&(v=o.onFrame,p=o.repeat),bn(s)?(m=s,s=m.duration,f=m.easing||"easeLinear",d=m.delay||0,p=m.repeat||p||!1,c=m.callback||Ff,g=m.pauseCallback||Ff,y=m.resumeCallback||Ff):(ht(c)&&(d=c,c=null),Cr(f)?(c=f,f="easeLinear"):f=f||"easeLinear");var b=f8(o,this),x={fromAttrs:u8(b,this),toAttrs:b,duration:s,easing:f,repeat:p,callback:c,pauseCallback:g,resumeCallback:y,delay:d,startTime:i.getTime(),id:ya(),onFrame:v,pathFormatted:!1};a.length>0?a=l8(a,x):i.addAnimator(this),a.push(x),this.set("animations",a),this.set("_pause",{isPaused:!1})}},t.prototype.stopAnimate=function(e){var n=this;e===void 0&&(e=!0);var i=this.get("animations");me(i,function(a){e&&(a.onFrame?n.attr(a.onFrame(1)):n.attr(a.toAttrs)),a.callback&&a.callback()}),this.set("animating",!1),this.set("animations",[])},t.prototype.pauseAnimate=function(){var e=this.get("timeline"),n=this.get("animations"),i=e.getTime();return me(n,function(a){a._paused=!0,a._pauseTime=i,a.pauseCallback&&a.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:i}),this},t.prototype.resumeAnimate=function(){var e=this.get("timeline"),n=e.getTime(),i=this.get("animations"),a=this.get("_pause").pauseTime;return me(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},t.prototype.emitDelegation=function(e,n){var i=this,a=n.propagationPath;this.getEvents();var o;e==="mouseenter"?o=n.fromShape:e==="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&&BT(h,o))return"break";gt(d)?me(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}},t.prototype.emitDelegateEvent=function(e,n,i){var a=this.getEvents(),o=n+a8+i.type;(a[o]||a[o8])&&(i.name=o,i.currentTarget=e,i.delegateTarget=this,i.delegateObject=e.get("delegateObject"),this.emit(o,i))},t.prototype.translate=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.getMatrix(),a=xf(i,[["t",e,n]]);return this.setMatrix(a),this},t.prototype.move=function(e,n){var i=this.attr("x")||0,a=this.attr("y")||0;return this.translate(e-i,n-a),this},t.prototype.moveTo=function(e,n){return this.move(e,n)},t.prototype.scale=function(e,n){var i=this.getMatrix(),a=xf(i,[["s",e,n||e]]);return this.setMatrix(a),this},t.prototype.rotate=function(e){var n=this.getMatrix(),i=xf(n,[["r",e]]);return this.setMatrix(i),this},t.prototype.rotateAtStart=function(e){var n=this.attr(),i=n.x,a=n.y,o=this.getMatrix(),s=xf(o,[["t",-i,-a],["r",e],["t",i,a]]);return this.setMatrix(s),this},t.prototype.rotateAtPoint=function(e,n,i){var a=this.getMatrix(),o=xf(a,[["t",-e,-n],["r",i],["t",e,n]]);return this.setMatrix(o),this},t}(Wz),QE={},j0="_INDEX";function jT(r,t){if(r.set("canvas",t),r.isGroup()){var e=r.get("children");e.length&&e.forEach(function(n){jT(n,t)})}}function UT(r,t){if(r.set("timeline",t),r.isGroup()){var e=r.get("children");e.length&&e.forEach(function(n){UT(n,t)})}}function c8(r,t,e){e===void 0&&(e=!0),e?t.destroy():(t.set("parent",null),t.set("canvas",null)),RT(r.getChildren(),t)}function h8(r){return function(t,e){var n=r(t,e);return n===0?t[j0]-e[j0]:n}}var $T=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.isCanvas=function(){return!1},t.prototype.getBBox=function(){var e=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?me(o,function(u){var f=u.getBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<e&&(e=l),c>n&&(n=c),h<i&&(i=h),d>a&&(a=d)}):(e=0,n=0,i=0,a=0);var s={x:e,y:i,minX:e,minY:i,maxX:n,maxY:a,width:n-e,height:a-i};return s},t.prototype.getCanvasBBox=function(){var e=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?me(o,function(u){var f=u.getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<e&&(e=l),c>n&&(n=c),h<i&&(i=h),d>a&&(a=d)}):(e=0,n=0,i=0,a=0);var s={x:e,y:i,minX:e,minY:i,maxX:n,maxY:a,width:n-e,height:a-i};return s},t.prototype.getDefaultCfg=function(){var e=r.prototype.getDefaultCfg.call(this);return e.children=[],e},t.prototype.onAttrChange=function(e,n,i){if(r.prototype.onAttrChange.call(this,e,n,i),e==="matrix"){var a=this.getTotalMatrix();this._applyChildrenMarix(a)}},t.prototype.applyMatrix=function(e){var n=this.getTotalMatrix();r.prototype.applyMatrix.call(this,e);var i=this.getTotalMatrix();i!==n&&this._applyChildrenMarix(i)},t.prototype._applyChildrenMarix=function(e){var n=this.getChildren();me(n,function(i){i.applyMatrix(e)})},t.prototype.addShape=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=e[0],a=e[1];bn(i)?a=i:a.type=i;var o=QE[a.type];o||(o=ku(a.type),QE[a.type]=o);var s=this.getShapeBase(),u=new s[o](a);return this.add(u),u},t.prototype.addGroup=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=e[0],a=e[1],o;if(Cr(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},t.prototype.getCanvas=function(){var e;return this.isCanvas()?e=this:e=this.get("canvas"),e},t.prototype.getShape=function(e,n,i){if(!z0(this))return null;var a=this.getChildren(),o;if(this.isCanvas())o=this._findShape(a,e,n,i);else{var s=[e,n,1];s=this.invertFromMatrix(s),this.isClipped(s[0],s[1])||(o=this._findShape(a,s[0],s[1],i))}return o},t.prototype._findShape=function(e,n,i,a){for(var o=null,s=e.length-1;s>=0;s--){var u=e[s];if(z0(u)&&(u.isGroup()?o=u.getShape(n,i,a):u.isHit(n,i)&&(o=u)),o)break}return o},t.prototype.add=function(e){var n=this.getCanvas(),i=this.getChildren(),a=this.get("timeline"),o=e.getParent();o&&c8(o,e,!1),e.set("parent",this),n&&jT(e,n),a&&UT(e,a),i.push(e),e.onCanvasChange("add"),this._applyElementMatrix(e)},t.prototype._applyElementMatrix=function(e){var n=this.getTotalMatrix();n&&e.applyMatrix(n)},t.prototype.getChildren=function(){return this.get("children")},t.prototype.sort=function(){var e=this.getChildren();me(e,function(n,i){return n[j0]=i,n}),e.sort(h8(function(n,i){return n.get("zIndex")-i.get("zIndex")})),this.onCanvasChange("sort")},t.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var e=this.getChildren(),n=e.length-1;n>=0;n--)e[n].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},t.prototype.destroy=function(){this.get("destroyed")||(this.clear(),r.prototype.destroy.call(this))},t.prototype.getFirst=function(){return this.getChildByIndex(0)},t.prototype.getLast=function(){var e=this.getChildren();return this.getChildByIndex(e.length-1)},t.prototype.getChildByIndex=function(e){var n=this.getChildren();return n[e]},t.prototype.getCount=function(){var e=this.getChildren();return e.length},t.prototype.contain=function(e){var n=this.getChildren();return n.indexOf(e)>-1},t.prototype.removeChild=function(e,n){n===void 0&&(n=!0),this.contain(e)&&e.remove(n)},t.prototype.findAll=function(e){var n=[],i=this.getChildren();return me(i,function(a){e(a)&&n.push(a),a.isGroup()&&(n=n.concat(a.findAll(e)))}),n},t.prototype.find=function(e){var n=null,i=this.getChildren();return me(i,function(a){if(e(a)?n=a:a.isGroup()&&(n=a.find(e)),n)return!1}),n},t.prototype.findById=function(e){return this.find(function(n){return n.get("id")===e})},t.prototype.findByClassName=function(e){return this.find(function(n){return n.get("className")===e})},t.prototype.findAllByName=function(e){return this.findAll(function(n){return n.get("name")===e})},t}(zT),Pu=0,zf=0,Ef=0,WT=1e3,Ed,jf,wd=0,As=0,hv=0,pl=typeof performance=="object"&&performance.now?performance:Date,XT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function YT(){return As||(XT(d8),As=pl.now()+hv)}function d8(){As=0}function U0(){this._call=this._time=this._next=null}U0.prototype=VT.prototype={constructor:U0,restart:function(r,t,e){if(typeof r!="function")throw new TypeError("callback is not a function");e=(e==null?YT():+e)+(t==null?0:+t),!this._next&&jf!==this&&(jf?jf._next=this:Ed=this,jf=this),this._call=r,this._time=e,$0()},stop:function(){this._call&&(this._call=null,this._time=1/0,$0())}};function VT(r,t,e){var n=new U0;return n.restart(r,t,e),n}function v8(){YT(),++Pu;for(var r=Ed,t;r;)(t=As-r._time)>=0&&r._call.call(null,t),r=r._next;--Pu}function JE(){As=(wd=pl.now())+hv,Pu=zf=0;try{v8()}finally{Pu=0,g8(),As=0}}function p8(){var r=pl.now(),t=r-wd;t>WT&&(hv-=t,wd=r)}function g8(){for(var r,t=Ed,e,n=1/0;t;)t._call?(n>t._time&&(n=t._time),r=t,t=t._next):(e=t._next,t._next=null,t=r?r._next=e:Ed=e);jf=r,$0(n)}function $0(r){if(!Pu){zf&&(zf=clearTimeout(zf));var t=r-As;t>24?(r<1/0&&(zf=setTimeout(JE,r-pl.now()-hv)),Ef&&(Ef=clearInterval(Ef))):(Ef||(wd=pl.now(),Ef=setInterval(p8,WT)),Pu=1,XT(JE))}}function Um(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function HT(r,t){var e=Object.create(r.prototype);for(var n in t)e[n]=t[n];return e}function Rl(){}var gl=.7,_d=1/gl,Cu="\\s*([+-]?\\d+)\\s*",yl="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",da="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",y8=/^#([0-9a-f]{3,8})$/,m8=new RegExp("^rgb\\("+[Cu,Cu,Cu]+"\\)$"),b8=new RegExp("^rgb\\("+[da,da,da]+"\\)$"),x8=new RegExp("^rgba\\("+[Cu,Cu,Cu,yl]+"\\)$"),E8=new RegExp("^rgba\\("+[da,da,da,yl]+"\\)$"),w8=new RegExp("^hsl\\("+[yl,da,da]+"\\)$"),_8=new RegExp("^hsla\\("+[yl,da,da,yl]+"\\)$"),ew={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};Um(Rl,ml,{copy:function(r){return Object.assign(new this.constructor,this,r)},displayable:function(){return this.rgb().displayable()},hex:tw,formatHex:tw,formatHsl:S8,formatRgb:rw,toString:rw});function tw(){return this.rgb().formatHex()}function S8(){return KT(this).formatHsl()}function rw(){return this.rgb().formatRgb()}function ml(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=y8.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?nw(t):e===3?new ei(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Hc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Hc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=m8.exec(r))?new ei(t[1],t[2],t[3],1):(t=b8.exec(r))?new ei(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=x8.exec(r))?Hc(t[1],t[2],t[3],t[4]):(t=E8.exec(r))?Hc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=w8.exec(r))?ow(t[1],t[2]/100,t[3]/100,1):(t=_8.exec(r))?ow(t[1],t[2]/100,t[3]/100,t[4]):ew.hasOwnProperty(r)?nw(ew[r]):r==="transparent"?new ei(NaN,NaN,NaN,0):null}function nw(r){return new ei(r>>16&255,r>>8&255,r&255,1)}function Hc(r,t,e,n){return n<=0&&(r=t=e=NaN),new ei(r,t,e,n)}function M8(r){return r instanceof Rl||(r=ml(r)),r?(r=r.rgb(),new ei(r.r,r.g,r.b,r.opacity)):new ei}function W0(r,t,e,n){return arguments.length===1?M8(r):new ei(r,t,e,n==null?1:n)}function ei(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}Um(ei,W0,HT(Rl,{brighter:function(r){return r=r==null?_d:Math.pow(_d,r),new ei(this.r*r,this.g*r,this.b*r,this.opacity)},darker:function(r){return r=r==null?gl:Math.pow(gl,r),new ei(this.r*r,this.g*r,this.b*r,this.opacity)},rgb:function(){return this},displayable:function(){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:iw,formatHex:iw,formatRgb:aw,toString:aw}));function iw(){return"#"+gg(this.r)+gg(this.g)+gg(this.b)}function aw(){var r=this.opacity;return r=isNaN(r)?1:Math.max(0,Math.min(1,r)),(r===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(r===1?")":", "+r+")")}function gg(r){return r=Math.max(0,Math.min(255,Math.round(r)||0)),(r<16?"0":"")+r.toString(16)}function ow(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ra(r,t,e,n)}function KT(r){if(r instanceof ra)return new ra(r.h,r.s,r.l,r.opacity);if(r instanceof Rl||(r=ml(r)),!r)return new ra;if(r instanceof ra)return r;r=r.rgb();var t=r.r/255,e=r.g/255,n=r.b/255,i=Math.min(t,e,n),a=Math.max(t,e,n),o=NaN,s=a-i,u=(a+i)/2;return s?(t===a?o=(e-n)/s+(e<n)*6:e===a?o=(n-t)/s+2:o=(t-e)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new ra(o,s,u,r.opacity)}function C8(r,t,e,n){return arguments.length===1?KT(r):new ra(r,t,e,n==null?1:n)}function ra(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}Um(ra,C8,HT(Rl,{brighter:function(r){return r=r==null?_d:Math.pow(_d,r),new ra(this.h,this.s,this.l*r,this.opacity)},darker:function(r){return r=r==null?gl:Math.pow(gl,r),new ra(this.h,this.s,this.l*r,this.opacity)},rgb:function(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,n=e+(e<.5?e:1-e)*t,i=2*e-n;return new ei(yg(r>=240?r-240:r+120,i,n),yg(r,i,n),yg(r<120?r+240:r-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var r=this.opacity;return r=isNaN(r)?1:Math.max(0,Math.min(1,r)),(r===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(r===1?")":", "+r+")")}}));function yg(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const $m=r=>()=>r;function A8(r,t){return function(e){return r+e*t}}function T8(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(n){return Math.pow(r+n*t,e)}}function I8(r){return(r=+r)==1?qT:function(t,e){return e-t?T8(t,e,r):$m(isNaN(t)?e:t)}}function qT(r,t){var e=t-r;return e?A8(r,e):$m(isNaN(r)?t:r)}const sw=function r(t){var e=I8(t);function n(i,a){var o=e((i=W0(i)).r,(a=W0(a)).r),s=e(i.g,a.g),u=e(i.b,a.b),f=qT(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 ZT(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,n=t.slice(),i;return function(a){for(i=0;i<e;++i)n[i]=r[i]*(1-a)+t[i]*a;return n}}function QT(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function O8(r,t){return(QT(t)?ZT:JT)(r,t)}function JT(r,t){var e=t?t.length:0,n=r?Math.min(e,r.length):0,i=new Array(n),a=new Array(e),o;for(o=0;o<n;++o)i[o]=Sd(r[o],t[o]);for(;o<e;++o)a[o]=t[o];return function(s){for(o=0;o<n;++o)a[o]=i[o](s);return a}}function L8(r,t){var e=new Date;return r=+r,t=+t,function(n){return e.setTime(r*(1-n)+t*n),e}}function X0(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function D8(r,t){var e={},n={},i;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in r?e[i]=Sd(r[i],t[i]):n[i]=t[i];return function(a){for(i in e)n[i]=e[i](a);return n}}var Y0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,mg=new RegExp(Y0.source,"g");function k8(r){return function(){return r}}function P8(r){return function(t){return r(t)+""}}function N8(r,t){var e=Y0.lastIndex=mg.lastIndex=0,n,i,a,o=-1,s=[],u=[];for(r=r+"",t=t+"";(n=Y0.exec(r))&&(i=mg.exec(t));)(a=i.index)>e&&(a=t.slice(e,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:X0(n,i)})),e=mg.lastIndex;return e<t.length&&(a=t.slice(e),s[o]?s[o]+=a:s[++o]=a),s.length<2?u[0]?P8(u[0].x):k8(t):(t=u.length,function(f){for(var l=0,c;l<t;++l)s[(c=u[l]).i]=c.x(f);return s.join("")})}function Sd(r,t){var e=typeof t,n;return t==null||e==="boolean"?$m(t):(e==="number"?X0:e==="string"?(n=ml(t))?(t=n,sw):N8:t instanceof ml?sw:t instanceof Date?L8:QT(t)?ZT:Array.isArray(t)?JT:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?D8:X0)(r,t)}function R8(r){return+r}function B8(r){return r*r}function F8(r){return r*(2-r)}function uw(r){return((r*=2)<=1?r*r:--r*(2-r)+1)/2}function G8(r){return r*r*r}function z8(r){return--r*r*r+1}function fw(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var Wm=3,j8=function r(t){t=+t;function e(n){return Math.pow(n,t)}return e.exponent=r,e}(Wm),U8=function r(t){t=+t;function e(n){return 1-Math.pow(1-n,t)}return e.exponent=r,e}(Wm),lw=function r(t){t=+t;function e(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}return e.exponent=r,e}(Wm),eI=Math.PI,tI=eI/2;function $8(r){return+r==1?1:1-Math.cos(r*tI)}function W8(r){return Math.sin(r*tI)}function cw(r){return(1-Math.cos(eI*r))/2}function Lo(r){return(Math.pow(2,-10*r)-.0009765625)*1.0009775171065494}function X8(r){return Lo(1-+r)}function Y8(r){return 1-Lo(r)}function hw(r){return((r*=2)<=1?Lo(1-r):2-Lo(r-1))/2}function V8(r){return 1-Math.sqrt(1-r*r)}function H8(r){return Math.sqrt(1- --r*r)}function dw(r){return((r*=2)<=1?1-Math.sqrt(1-r*r):Math.sqrt(1-(r-=2)*r)+1)/2}var V0=4/11,K8=6/11,q8=8/11,Z8=3/4,Q8=9/11,J8=10/11,ej=15/16,tj=21/22,rj=63/64,Kc=1/V0/V0;function nj(r){return 1-bl(1-r)}function bl(r){return(r=+r)<V0?Kc*r*r:r<q8?Kc*(r-=K8)*r+Z8:r<J8?Kc*(r-=Q8)*r+ej:Kc*(r-=tj)*r+rj}function ij(r){return((r*=2)<=1?1-bl(1-r):bl(r-1)+1)/2}var Xm=1.70158,aj=function r(t){t=+t;function e(n){return(n=+n)*n*(t*(n-1)+n)}return e.overshoot=r,e}(Xm),oj=function r(t){t=+t;function e(n){return--n*n*((n+1)*t+n)+1}return e.overshoot=r,e}(Xm),vw=function r(t){t=+t;function e(n){return((n*=2)<1?n*n*((t+1)*n-t):(n-=2)*n*((t+1)*n+t)+2)/2}return e.overshoot=r,e}(Xm),Nu=2*Math.PI,Ym=1,Vm=.3,sj=function r(t,e){var n=Math.asin(1/(t=Math.max(1,t)))*(e/=Nu);function i(a){return t*Lo(- --a)*Math.sin((n-a)/e)}return i.amplitude=function(a){return r(a,e*Nu)},i.period=function(a){return r(t,a)},i}(Ym,Vm),pw=function r(t,e){var n=Math.asin(1/(t=Math.max(1,t)))*(e/=Nu);function i(a){return 1-t*Lo(a=+a)*Math.sin((a+n)/e)}return i.amplitude=function(a){return r(a,e*Nu)},i.period=function(a){return r(t,a)},i}(Ym,Vm),uj=function r(t,e){var n=Math.asin(1/(t=Math.max(1,t)))*(e/=Nu);function i(a){return((a=a*2-1)<0?t*Lo(-a)*Math.sin((n-a)/e):2-t*Lo(a)*Math.sin((n+a)/e))/2}return i.amplitude=function(a){return r(a,e*Nu)},i.period=function(a){return r(t,a)},i}(Ym,Vm);const fj=Object.freeze(Object.defineProperty({__proto__:null,easeBack:vw,easeBackIn:aj,easeBackInOut:vw,easeBackOut:oj,easeBounce:bl,easeBounceIn:nj,easeBounceInOut:ij,easeBounceOut:bl,easeCircle:dw,easeCircleIn:V8,easeCircleInOut:dw,easeCircleOut:H8,easeCubic:fw,easeCubicIn:G8,easeCubicInOut:fw,easeCubicOut:z8,easeElastic:pw,easeElasticIn:sj,easeElasticInOut:uj,easeElasticOut:pw,easeExp:hw,easeExpIn:X8,easeExpInOut:hw,easeExpOut:Y8,easeLinear:R8,easePoly:lw,easePolyIn:j8,easePolyInOut:lw,easePolyOut:U8,easeQuad:uw,easeQuadIn:B8,easeQuadInOut:uw,easeQuadOut:F8,easeSin:cw,easeSinIn:$8,easeSinInOut:cw,easeSinOut:W8},Symbol.toStringTag,{value:"Module"}));var lj={};function cj(r){return lj[r.toLowerCase()]||fj[r]}var hj=function(r){return["fill","stroke","fillStyle","strokeStyle"].includes(r)},dj=function(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)},gw=[1,0,0,0,1,0,0,0,1];function vj(r,t,e){var n={},i=t.fromAttrs,a=t.toAttrs;if(!r.destroyed){var o;for(var s in a)if(!Oo(i[s],a[s]))if(s==="path"){var u=a[s],f=i[s];u.length>f.length?(u=wu(a[s]),f=wu(i[s]),f=kT(f,u),f=G0(f,u),t.fromAttrs.path=f,t.toAttrs.path=u):t.pathFormatted||(u=wu(a[s]),f=wu(i[s]),f=G0(f,u),t.fromAttrs.path=f,t.toAttrs.path=u,t.pathFormatted=!0),n[s]=[];for(var l=0;l<u.length;l++){for(var c=u[l],h=f[l],d=[],v=0;v<c.length;v++)ht(c[v])&&h&&ht(h[v])?(o=Sd(h[v],c[v]),d.push(o(e))):d.push(c[v]);n[s].push(d)}}else if(s==="matrix"){var p=O8(i[s]||gw,a[s]||gw),g=p(e);n[s]=g}else hj(s)&&dj(a[s])?n[s]=a[s]:Cr(a[s])||(o=Sd(i[s],a[s]),n[s]=o(e));r.attr(n)}}function pj(r,t,e){var n=t.startTime,i=t.delay;if(e<n+i||t._paused)return!1;var a,o=t.duration,s=t.easing,u=cj(s);if(e=e-n-t.delay,t.repeat)a=e%o/o,a=u(a);else if(a=e/o,a<1)a=u(a);else return t.onFrame?r.attr(t.onFrame(1)):r.attr(t.toAttrs),!0;if(t.onFrame){var f=t.onFrame(a);r.attr(f)}else vj(r,t,a);return!1}var gj=function(){function r(t){this.animators=[],this.current=0,this.timer=null,this.canvas=t}return r.prototype.initTimer=function(){var t=this,e=!1,n,i,a;this.timer=VT(function(o){if(t.current=o,t.animators.length>0){for(var s=t.animators.length-1;s>=0;s--){if(n=t.animators[s],n.destroyed){t.removeAnimator(s);continue}if(!n.isAnimatePaused()){i=n.get("animations");for(var u=i.length-1;u>=0;u--)a=i[u],e=pj(n,a,o),e&&(i.splice(u,1),e=!1,a.callback&&a.callback())}i.length===0&&t.removeAnimator(s)}var f=t.canvas.get("autoDraw");f||t.canvas.draw()}})},r.prototype.addAnimator=function(t){this.animators.push(t)},r.prototype.removeAnimator=function(t){this.animators.splice(t,1)},r.prototype.isAnimating=function(){return!!this.animators.length},r.prototype.stop=function(){this.timer&&this.timer.stop()},r.prototype.stopAllAnimations=function(t){t===void 0&&(t=!0),this.animators.forEach(function(e){e.stopAnimate(t)}),this.animators=[],this.canvas.draw()},r.prototype.getTime=function(){return this.current},r}(),yj=40,yw=0,mw=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function bw(r,t,e){e.name=t,e.target=r,e.currentTarget=r,e.delegateTarget=r,r.emit(t,e)}function mj(r,t,e){if(e.bubbles){var n=void 0,i=!1;if(t==="mouseenter"?(n=e.fromShape,i=!0):t==="mouseleave"&&(i=!0,n=e.toShape),r.isCanvas()&&i)return;if(n&&BT(r,n)){e.bubbles=!1;return}e.name=t,e.currentTarget=r,e.delegateTarget=r,r.emit(t,e)}}var bj=function(){function r(t){var e=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(n){var i=n.type;e._triggerEvent(i,n)},this._onDocumentMove=function(n){var i=e.canvas,a=i.get("el");if(a!==n.target&&(e.dragging||e.currentShape)){var o=e._getPointInfo(n);e.dragging&&e._emitEvent("drag",n,o,e.draggingShape)}},this._onDocumentMouseUp=function(n){var i=e.canvas,a=i.get("el");if(a!==n.target&&e.dragging){var o=e._getPointInfo(n);e.draggingShape&&e._emitEvent("drop",n,o,null),e._emitEvent("dragend",n,o,e.draggingShape),e._afterDrag(e.draggingShape,o,n)}},this.canvas=t.canvas}return r.prototype.init=function(){this._bindEvents()},r.prototype._bindEvents=function(){var t=this,e=this.canvas.get("el");me(mw,function(n){e.addEventListener(n,t._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._clearEvents=function(){var t=this,e=this.canvas.get("el");me(mw,function(n){e.removeEventListener(n,t._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._getEventObj=function(t,e,n,i,a,o){var s=new NT(t,e);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(t,e){return this.canvas.getShape(t.x,t.y,e)},r.prototype._getPointInfo=function(t){var e=this.canvas,n=e.getClientByEvent(t),i=e.getPointByEvent(t);return{x:i.x,y:i.y,clientX:n.x,clientY:n.y}},r.prototype._triggerEvent=function(t,e){var n=this._getPointInfo(e),i=this._getShape(n,e),a=this["_on"+t],o=!1;if(a)a.call(this,n,i,e);else{var s=this.currentShape;t==="mouseenter"||t==="dragenter"||t==="mouseover"?(this._emitEvent(t,e,n,null,null,i),i&&this._emitEvent(t,e,n,i,null,i),t==="mouseenter"&&this.draggingShape&&this._emitEvent("dragenter",e,n,null)):t==="mouseleave"||t==="dragleave"||t==="mouseout"?(o=!0,s&&this._emitEvent(t,e,n,s,s,null),this._emitEvent(t,e,n,null,s,null),t==="mouseleave"&&this.draggingShape&&this._emitEvent("dragleave",e,n,null)):this._emitEvent(t,e,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(t,e,n){n.button===yw&&(this.mousedownShape=e,this.mousedownPoint=t,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,t,e,null,null)},r.prototype._emitMouseoverEvents=function(t,e,n,i){var a=this.canvas.get("el");n!==i&&(n&&(this._emitEvent("mouseout",t,e,n,n,i),this._emitEvent("mouseleave",t,e,n,n,i),(!i||i.get("destroyed"))&&(a.style.cursor=this.canvas.get("cursor"))),i&&(this._emitEvent("mouseover",t,e,i,n,i),this._emitEvent("mouseenter",t,e,i,n,i)))},r.prototype._emitDragoverEvents=function(t,e,n,i,a){i?(i!==n&&(n&&this._emitEvent("dragleave",t,e,n,n,i),this._emitEvent("dragenter",t,e,i,n,i)),a||this._emitEvent("dragover",t,e,i)):n&&this._emitEvent("dragleave",t,e,n,n,i),a&&this._emitEvent("dragover",t,e,i)},r.prototype._afterDrag=function(t,e,n){t&&(t.set("capture",!0),this.draggingShape=null),this.dragging=!1;var i=this._getShape(e,n);i!==t&&this._emitMouseoverEvents(n,e,t,i),this.currentShape=i},r.prototype._onmouseup=function(t,e,n){if(n.button===yw){var i=this.draggingShape;this.dragging?(i&&this._emitEvent("drop",n,t,e),this._emitEvent("dragend",n,t,i),this._afterDrag(i,t,n)):(this._emitEvent("mouseup",n,t,e),e===this.mousedownShape&&this._emitEvent("click",n,t,e),this.mousedownShape=null,this.mousedownPoint=null)}},r.prototype._ondragover=function(t,e,n){n.preventDefault();var i=this.currentShape;this._emitDragoverEvents(n,t,i,e,!0)},r.prototype._onmousemove=function(t,e,n){var i=this.canvas,a=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,t,a,e,!1),this._emitEvent("drag",n,t,o);else{var s=this.mousedownPoint;if(s){var u=this.mousedownShape,f=n.timeStamp,l=f-this.mousedownTimeStamp,c=s.clientX-t.clientX,h=s.clientY-t.clientY,d=c*c+h*h;l>120||d>yj?u&&u.get("draggable")?(o=this.mousedownShape,o.set("capture",!1),this.draggingShape=o,this.dragging=!0,this._emitEvent("dragstart",n,t,o),this.mousedownShape=null,this.mousedownPoint=null):!u&&i.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,t,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,t,a,e),this._emitEvent("mousemove",n,t,e)):(this._emitMouseoverEvents(n,t,a,e),this._emitEvent("mousemove",n,t,e))}else this._emitMouseoverEvents(n,t,a,e),this._emitEvent("mousemove",n,t,e)}},r.prototype._emitEvent=function(t,e,n,i,a,o){var s=this._getEventObj(t,e,n,i,a,o);if(i){s.shape=i,bw(i,t,s);for(var u=i.getParent();u;)u.emitDelegation(t,s),s.propagationStopped||mj(u,t,s),s.propagationPath.push(u),u=u.getParent()}else{var f=this.canvas;bw(f,t,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}(),xw="px",Ew=FT(),xj=Ew&&Ew.name==="firefox",rI=function(r){Ot(t,r);function t(e){var n=r.call(this,e)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return t.prototype.getDefaultCfg=function(){var e=r.prototype.getDefaultCfg.call(this);return e.cursor="default",e.supportCSSTransform=!1,e},t.prototype.initContainer=function(){var e=this.get("container");Ne(e)&&(e=document.getElementById(e),this.set("container",e))},t.prototype.initDom=function(){var e=this.createDom();this.set("el",e);var n=this.get("container");n.appendChild(e),this.setDOMSize(this.get("width"),this.get("height"))},t.prototype.initEvents=function(){var e=new bj({canvas:this});e.init(),this.set("eventController",e)},t.prototype.initTimeline=function(){var e=new gj(this);this.set("timeline",e)},t.prototype.setDOMSize=function(e,n){var i=this.get("el");YE&&(i.style.width=e+xw,i.style.height=n+xw)},t.prototype.changeSize=function(e,n){this.setDOMSize(e,n),this.set("width",e),this.set("height",n),this.onCanvasChange("changeSize")},t.prototype.getRenderer=function(){return this.get("renderer")},t.prototype.getCursor=function(){return this.get("cursor")},t.prototype.setCursor=function(e){this.set("cursor",e);var n=this.get("el");YE&&n&&(n.style.cursor=e)},t.prototype.getPointByEvent=function(e){var n=this.get("supportCSSTransform");if(n){if(xj&&!ct(e.layerX)&&e.layerX!==e.offsetX)return{x:e.layerX,y:e.layerY};if(!ct(e.offsetX))return{x:e.offsetX,y:e.offsetY}}var i=this.getClientByEvent(e),a=i.x,o=i.y;return this.getPointByClient(a,o)},t.prototype.getClientByEvent=function(e){var n=e;return e.touches&&(e.type==="touchend"?n=e.changedTouches[0]:n=e.touches[0]),{x:n.clientX,y:n.clientY}},t.prototype.getPointByClient=function(e,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:e-a.left,y:n-a.top}},t.prototype.getClientByPoint=function(e,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:e+a.left,y:n+a.top}},t.prototype.draw=function(){},t.prototype.removeDom=function(){var e=this.get("el");e.parentNode.removeChild(e)},t.prototype.clearEvents=function(){var e=this.get("eventController");e.destroy()},t.prototype.isCanvas=function(){return!0},t.prototype.getParent=function(){return null},t.prototype.destroy=function(){var e=this.get("timeline");this.get("destroyed")||(this.clear(),e&&e.stop(),this.clearEvents(),this.removeDom(),r.prototype.destroy.call(this))},t}($T),nI=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.isGroup=function(){return!0},t.prototype.isEntityGroup=function(){return!1},t.prototype.clone=function(){for(var e=r.prototype.clone.call(this),n=this.getChildren(),i=0;i<n.length;i++){var a=n[i];e.add(a.clone())}return e},t}($T),iI=function(r){Ot(t,r);function t(e){return r.call(this,e)||this}return t.prototype._isInBBox=function(e,n){var i=this.getBBox();return i.minX<=e&&i.maxX>=e&&i.minY<=n&&i.maxY>=n},t.prototype.afterAttrsChange=function(e){r.prototype.afterAttrsChange.call(this,e),this.clearCacheBBox()},t.prototype.getBBox=function(){var e=this.cfg.bbox;return e||(e=this.calculateBBox(),this.set("bbox",e)),e},t.prototype.getCanvasBBox=function(){var e=this.cfg.canvasBBox;return e||(e=this.calculateCanvasBBox(),this.set("canvasBBox",e)),e},t.prototype.applyMatrix=function(e){r.prototype.applyMatrix.call(this,e),this.set("canvasBBox",null)},t.prototype.calculateCanvasBBox=function(){var e=this.getBBox(),n=this.getTotalMatrix(),i=e.minX,a=e.minY,o=e.maxX,s=e.maxY;if(n){var u=ps(n,[e.minX,e.minY]),f=ps(n,[e.maxX,e.minY]),l=ps(n,[e.minX,e.maxY]),c=ps(n,[e.maxX,e.maxY]);i=Math.min(u[0],f[0],l[0],c[0]),o=Math.max(u[0],f[0],l[0],c[0]),a=Math.min(u[1],f[1],l[1],c[1]),s=Math.max(u[1],f[1],l[1],c[1])}var h=this.attrs;if(h.shadowColor){var d=h.shadowBlur,v=d===void 0?0:d,p=h.shadowOffsetX,g=p===void 0?0:p,y=h.shadowOffsetY,m=y===void 0?0:y,b=i-v+g,x=o+v+g,E=a-v+m,w=s+v+m;i=Math.min(i,b),o=Math.max(o,x),a=Math.min(a,E),s=Math.max(s,w)}return{x:i,y:a,minX:i,minY:a,maxX:o,maxY:s,width:o-i,height:s-a}},t.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},t.prototype.isClipShape=function(){return this.get("isClipShape")},t.prototype.isInShape=function(e,n){return!1},t.prototype.isOnlyHitBox=function(){return!1},t.prototype.isHit=function(e,n){var i=this.get("startArrowShape"),a=this.get("endArrowShape"),o=[e,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)))},t}(zT),aI=new Map;function Ea(r,t){aI.set(r,t)}function oI(r){return aI.get(r)}function sI(r){var t=r.attr(),e=t.x,n=t.y,i=t.width,a=t.height;return{x:e,y:n,width:i,height:a}}function uI(r){var t=r.attr(),e=t.x,n=t.y,i=t.r;return{x:e-i,y:n-i,width:i*2,height:i*2}}function Tn(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function Vh(r,t){return Math.abs(r-t)<.001}function Zu(r,t){var e=ga(r),n=ga(t),i=pa(r),a=pa(t);return{x:e,y:n,width:i-e,height:a-n}}function dv(r){return(r+Math.PI*2)%(Math.PI*2)}const mn={box:function(r,t,e,n){return Zu([r,e],[t,n])},length:function(r,t,e,n){return Tn(r,t,e,n)},pointAt:function(r,t,e,n,i){return{x:(1-i)*r+i*e,y:(1-i)*t+i*n}},pointDistance:function(r,t,e,n,i,a){var o=(e-r)*(i-r)+(n-t)*(a-t);if(o<0)return Tn(r,t,i,a);var s=(e-r)*(e-r)+(n-t)*(n-t);return o>s?Tn(e,n,i,a):this.pointToLine(r,t,e,n,i,a)},pointToLine:function(r,t,e,n,i,a){var o=[e-r,n-t];if(Im(o,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var s=[-o[1],o[0]];To(s,s);var u=[i-r,a-t];return Math.abs(Tm(u,s))},tangentAngle:function(r,t,e,n){return Math.atan2(n-t,e-r)}};var Ej=1e-4;function fI(r,t,e,n,i,a){var o,s=1/0,u=[e,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,t.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:t[0]};if(o===1){var g=r.length;return{x:r[g-1],y:t[g-1]}}s=1/0;for(var h=0;h<32&&!(c<Ej);h++){var y=o-c,m=o+c,v=[i.apply(null,r.concat([y])),i.apply(null,t.concat([y]))],p=Tn(u[0],u[1],v[0],v[1]);if(y>=0&&p<s)o=y,s=p;else{var b=[i.apply(null,r.concat([m])),i.apply(null,t.concat([m]))],x=Tn(u[0],u[1],b[0],b[1]);m<=1&&x<s?(o=m,s=x):c*=.5}}return{x:i.apply(null,r.concat([o])),y:i.apply(null,t.concat([o]))}}function wj(r,t){for(var e=0,n=r.length,i=0;i<n;i++){var a=r[i],o=t[i],s=r[(i+1)%n],u=t[(i+1)%n];e+=Tn(a,o,s,u)}return e/2}function bo(r,t,e,n){var i=1-n;return i*i*r+2*n*i*t+n*n*e}function ww(r,t,e){var n=r+e-2*t;if(Vh(n,0))return[.5];var i=(r-t)/n;return i<=1&&i>=0?[i]:[]}function _w(r,t,e,n){return 2*(1-n)*(t-r)+2*n*(e-t)}function lI(r,t,e,n,i,a,o){var s=bo(r,e,i,o),u=bo(t,n,a,o),f=mn.pointAt(r,t,e,n,o),l=mn.pointAt(e,n,i,a,o);return[[r,t,f.x,f.y,s,u],[s,u,l.x,l.y,i,a]]}function H0(r,t,e,n,i,a,o){if(o===0)return(Tn(r,t,e,n)+Tn(e,n,i,a)+Tn(r,t,i,a))/2;var s=lI(r,t,e,n,i,a,.5),u=s[0],f=s[1];return u.push(o-1),f.push(o-1),H0.apply(null,u)+H0.apply(null,f)}const cI={box:function(r,t,e,n,i,a){var o=ww(r,e,i)[0],s=ww(t,n,a)[0],u=[r,i],f=[t,a];return o!==void 0&&u.push(bo(r,e,i,o)),s!==void 0&&f.push(bo(t,n,a,s)),Zu(u,f)},length:function(r,t,e,n,i,a){return H0(r,t,e,n,i,a,3)},nearestPoint:function(r,t,e,n,i,a,o,s){return fI([r,e,i],[t,n,a],o,s,bo)},pointDistance:function(r,t,e,n,i,a,o,s){var u=this.nearestPoint(r,t,e,n,i,a,o,s);return Tn(u.x,u.y,o,s)},interpolationAt:bo,pointAt:function(r,t,e,n,i,a,o){return{x:bo(r,e,i,o),y:bo(t,n,a,o)}},divide:function(r,t,e,n,i,a,o){return lI(r,t,e,n,i,a,o)},tangentAngle:function(r,t,e,n,i,a,o){var s=_w(r,e,i,o),u=_w(t,n,a,o),f=Math.atan2(u,s);return dv(f)}};function xo(r,t,e,n,i){var a=1-i;return a*a*a*r+3*t*i*a*a+3*e*i*i*a+n*i*i*i}function Sw(r,t,e,n,i){var a=1-i;return 3*(a*a*(t-r)+2*a*i*(e-t)+i*i*(n-e))}function bg(r,t,e,n){var i=-3*r+9*t-9*e+3*n,a=6*r-12*t+6*e,o=3*t-3*r,s=[],u,f,l;if(Vh(i,0))Vh(a,0)||(u=-o/a,u>=0&&u<=1&&s.push(u));else{var c=a*a-4*i*o;Vh(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 hI(r,t,e,n,i,a,o,s,u){var f=xo(r,e,i,o,u),l=xo(t,n,a,s,u),c=mn.pointAt(r,t,e,n,u),h=mn.pointAt(e,n,i,a,u),d=mn.pointAt(i,a,o,s,u),v=mn.pointAt(c.x,c.y,h.x,h.y,u),p=mn.pointAt(h.x,h.y,d.x,d.y,u);return[[r,t,c.x,c.y,v.x,v.y,f,l],[f,l,p.x,p.y,d.x,d.y,o,s]]}function K0(r,t,e,n,i,a,o,s,u){if(u===0)return wj([r,e,i,o],[t,n,a,s]);var f=hI(r,t,e,n,i,a,o,s,.5),l=f[0],c=f[1];return l.push(u-1),c.push(u-1),K0.apply(null,l)+K0.apply(null,c)}const qf={extrema:bg,box:function(r,t,e,n,i,a,o,s){for(var u=[r,o],f=[t,s],l=bg(r,e,i,o),c=bg(t,n,a,s),h=0;h<l.length;h++)u.push(xo(r,e,i,o,l[h]));for(var h=0;h<c.length;h++)f.push(xo(t,n,a,s,c[h]));return Zu(u,f)},length:function(r,t,e,n,i,a,o,s){return K0(r,t,e,n,i,a,o,s,3)},nearestPoint:function(r,t,e,n,i,a,o,s,u,f,l){return fI([r,e,i,o],[t,n,a,s],u,f,xo,l)},pointDistance:function(r,t,e,n,i,a,o,s,u,f,l){var c=this.nearestPoint(r,t,e,n,i,a,o,s,u,f,l);return Tn(c.x,c.y,u,f)},interpolationAt:xo,pointAt:function(r,t,e,n,i,a,o,s,u){return{x:xo(r,e,i,o,u),y:xo(t,n,a,s,u)}},divide:function(r,t,e,n,i,a,o,s,u){return hI(r,t,e,n,i,a,o,s,u)},tangentAngle:function(r,t,e,n,i,a,o,s,u){var f=Sw(r,e,i,o,u),l=Sw(t,n,a,s,u);return dv(Math.atan2(l,f))}};function Mw(r,t){var e=Math.abs(r);return t>0?e:e*-1}const _j={box:function(r,t,e,n){return{x:r-e,y:t-n,width:e*2,height:n*2}},length:function(r,t,e,n){return Math.PI*(3*(e+n)-Math.sqrt((3*e+n)*(e+3*n)))},nearestPoint:function(r,t,e,n,i,a){var o=e,s=n;if(o===0||s===0)return{x:r,y:t};for(var u=i-r,f=a-t,l=Math.abs(u),c=Math.abs(f),h=o*o,d=s*s,v=Math.PI/4,p,g,y=0;y<4;y++){p=o*Math.cos(v),g=s*Math.sin(v);var m=(h-d)*Math.pow(Math.cos(v),3)/o,b=(d-h)*Math.pow(Math.sin(v),3)/s,x=p-m,E=g-b,w=l-m,_=c-b,M=Math.hypot(E,x),C=Math.hypot(_,w),S=M*Math.asin((x*_-E*w)/(M*C)),A=S/Math.sqrt(h+d-p*p-g*g);v+=A,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:r+Mw(p,u),y:t+Mw(g,f)}},pointDistance:function(r,t,e,n,i,a){var o=this.nearestPoint(r,t,e,n,i,a);return Tn(o.x,o.y,i,a)},pointAt:function(r,t,e,n,i){var a=2*Math.PI*i;return{x:r+e*Math.cos(a),y:t+n*Math.sin(a)}},tangentAngle:function(r,t,e,n,i){var a=2*Math.PI*i,o=Math.atan2(n*Math.cos(a),-e*Math.sin(a));return dv(o)}};function Sj(r,t,e,n,i,a,o,s){return-1*e*Math.cos(i)*Math.sin(s)-n*Math.sin(i)*Math.cos(s)}function Mj(r,t,e,n,i,a,o,s){return-1*e*Math.sin(i)*Math.sin(s)+n*Math.cos(i)*Math.cos(s)}function Cj(r,t,e){return Math.atan(-t/r*Math.tan(e))}function Aj(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function Cw(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function Aw(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function Tj(r,t,e,n){var i=Math.atan2(n*r,e*t);return(i+Math.PI*2)%(Math.PI*2)}function Tw(r,t,e){return{x:r*Math.cos(e),y:t*Math.sin(e)}}function Iw(r,t,e){var n=Math.cos(e),i=Math.sin(e);return[r*n-t*i,r*i+t*n]}const Ij={box:function(r,t,e,n,i,a,o){for(var s=Cj(e,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=Cw(r,t,e,n,i,l[c]);d<u&&(u=d),d>f&&(f=d)}for(var v=Aj(e,n,i),p=1/0,g=-1/0,y=[a,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var m=v+c;a<o?a<m&&m<o&&y.push(m):o<m&&m<a&&y.push(m)}for(var c=0;c<y.length;c++){var b=Aw(r,t,e,n,i,y[c]);b<p&&(p=b),b>g&&(g=b)}return{x:u,y:p,width:f-u,height:g-p}},length:function(r,t,e,n,i,a,o){},nearestPoint:function(r,t,e,n,i,a,o,s,u){var f=Iw(s-r,u-t,-i),l=f[0],c=f[1],h=_j.nearestPoint(0,0,e,n,l,c),d=Tj(e,n,h.x,h.y);d<a?h=Tw(e,n,a):d>o&&(h=Tw(e,n,o));var v=Iw(h.x,h.y,i);return{x:v[0]+r,y:v[1]+t}},pointDistance:function(r,t,e,n,i,a,o,s,u){var f=this.nearestPoint(r,t,e,n,s,u);return Tn(f.x,f.y,s,u)},pointAt:function(r,t,e,n,i,a,o,s){var u=(o-a)*s+a;return{x:Cw(r,t,e,n,i,u),y:Aw(r,t,e,n,i,u)}},tangentAngle:function(r,t,e,n,i,a,o,s){var u=(o-a)*s+a,f=Sj(r,t,e,n,i,a,o,u),l=Mj(r,t,e,n,i,a,o,u);return dv(Math.atan2(l,f))}};function dI(r){for(var t=0,e=[],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};e.push(s),t+=o}return{segments:e,totalLength:t}}function Oj(r){if(r.length<2)return 0;for(var t=0,e=0;e<r.length-1;e++){var n=r[e],i=r[e+1];t+=Tn(n[0],n[1],i[0],i[1])}return t}function Lj(r,t){if(t>1||t<0||r.length<2)return null;var e=dI(r),n=e.segments,i=e.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(t>=a&&t<=a+c){var h=(t-a)/c;o=mn.pointAt(f[0],f[1],l[0],l[1],h);break}a+=c}return o}function Dj(r,t){if(t>1||t<0||r.length<2)return 0;for(var e=dI(r),n=e.segments,i=e.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(t>=a&&t<=a+c){o=Math.atan2(l[1]-f[1],l[0]-f[0]);break}a+=c}return o}function kj(r,t,e){for(var n=1/0,i=0;i<r.length-1;i++){var a=r[i],o=r[i+1],s=mn.pointDistance(a[0],a[1],o[0],o[1],t,e);s<n&&(n=s)}return n}const vI={box:function(r){for(var t=[],e=[],n=0;n<r.length;n++){var i=r[n];t.push(i[0]),e.push(i[1])}return Zu(t,e)},length:function(r){return Oj(r)},pointAt:function(r,t){return Lj(r,t)},pointDistance:function(r,t,e){return kj(r,t,e)},tangentAngle:function(r,t){return Dj(r,t)}};function Ow(r,t){return!r||!t?r||t:{minX:Math.min(r.minX,t.minX),minY:Math.min(r.minY,t.minY),maxX:Math.max(r.maxX,t.maxX),maxY:Math.max(r.maxY,t.maxY)}}function Hm(r,t){var e=r.get("startArrowShape"),n=r.get("endArrowShape"),i=null,a=null;return e&&(i=e.getCanvasBBox(),t=Ow(t,i)),n&&(a=n.getCanvasBBox(),t=Ow(t,a)),t}function Pj(r){for(var t=r.attr(),e=t.points,n=[],i=[],a=0;a<e.length;a++){var o=e[a];n.push(o[0]),i.push(o[1])}var s=Zu(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=Hm(r,h),{x:h.minX,y:h.minY,width:h.maxX-h.minX,height:h.maxY-h.minY}}function Nj(r){for(var t=r.attr(),e=t.points,n=[],i=[],a=0;a<e.length;a++){var o=e[a];n.push(o[0]),i.push(o[1])}return Zu(n,i)}var xg=null;function pI(){if(!xg){var r=document.createElement("canvas");r.width=1,r.height=1,xg=r.getContext("2d")}return xg}function gI(r,t,e){var n=1;if(Ne(r)&&(n=r.split(`
3
- `).length),n>1){var i=Rj(t,e);return t*n+i*(n-1)}return t}function Rj(r,t){return t?t-r:r*.14}function Bj(r,t){var e=pI(),n=0;if(ct(r)||r==="")return n;if(e.save(),e.font=t,Ne(r)&&r.includes(`
4
- `)){var i=r.split(`
5
- `);me(i,function(a){var o=e.measureText(a).width;n<o&&(n=o)})}else n=e.measureText(r).width;return e.restore(),n}function yI(r){var t=r.fontSize,e=r.fontFamily,n=r.fontWeight,i=r.fontStyle,a=r.fontVariant;return[i,a,n,t+"px",e].join(" ").trim()}function Fj(r){var t=r.attr(),e=t.x,n=t.y,i=t.text,a=t.fontSize,o=t.lineHeight,s=t.font;s||(s=yI(t));var u=Bj(i,s),f;if(!u)f={x:e,y:n,width:0,height:0};else{var l=t.textAlign,c=t.textBaseline,h=gI(i,a,o),d={x:e,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 Gj=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig,zj=/[^\s\,]+/ig;function jj(r){var t=r||[];if(gt(t))return t;if(Ne(t))return t=t.match(Gj),me(t,function(e,n){if(e=e.match(zj),e[0].length>1){var i=e[0].charAt(0);e.splice(1,0,e[0].substr(1)),e[0]=i}me(e,function(a,o){isNaN(a)||(e[o]=+a)}),t[n]=e}),t}function Uj(r,t,e,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=go([0,0],u,p),f=yo([0,0],f,p)}}for(var d=0,g=r.length;d<g;d+=1){var p=r[d];if(d===0&&!e)h=p;else if(d===g-1&&!e)c=p,i.push(h),i.push(c);else{var y=[d?d-1:g-1,d-1][e?0:1];o=r[y],s=r[e?(d+1)%g:d+1];var m=[0,0];m=jh(m,s,o),m=An(m,m,t);var b=pd(p,o),x=pd(p,s),E=b+x;E!==0&&(b/=E,x/=E);var w=An([0,0],m,-b),_=An([0,0],m,x);c=gn([0,0],p,w),l=gn([0,0],p,_),l=go([0,0],l,yo([0,0],s,p)),l=yo([0,0],l,go([0,0],s,p)),w=jh([0,0],l,p),w=An([0,0],w,-b/x),c=gn([0,0],p,w),c=go([0,0],c,yo([0,0],o,p)),c=yo([0,0],c,go([0,0],o,p)),_=jh([0,0],p,c),_=An([0,0],_,x/b),l=gn([0,0],p,_),a&&(c=yo([0,0],c,u),c=go([0,0],c,f),l=yo([0,0],l,u),l=go([0,0],l,f)),i.push(h),i.push(c),h=l}}return e&&i.push(i.shift()),i}function mI(r,t,e){t===void 0&&(t=!1),e===void 0&&(e=[[0,0],[1,1]]);for(var n=!!t,i=[],a=0,o=r.length;a<o;a+=2)i.push([r[a],r[a+1]]);for(var s=Uj(i,.4,n,e),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 Zf=`
6
- \v\f\r   ᠎              \u2028\u2029`,$j=new RegExp("([a-z])["+Zf+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+Zf+"]*,?["+Zf+"]*)+)","ig"),Wj=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+Zf+"]*,?["+Zf+"]*","ig");function q0(r){if(!r)return null;if(gt(r))return r;var t={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},e=[];return String(r).replace($j,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(Wj,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(e.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&e.push([i,o[0]]),s==="r")e.push([i].concat(o));else for(;o.length>=t[s]&&(e.push([i].concat(o.splice(0,t[s]))),!!t[s]););return""}),e}var Xj=/[a-z]/;function Lw(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}function bI(r){var t=q0(r);if(!t||!t.length)return[["M",0,0]];for(var e=!1,n=0;n<t.length;n++){var i=t[n][0];if(Xj.test(i)||["V","H","T","S"].indexOf(i)>=0){e=!0;break}}if(!e)return t;var a=[],o=0,s=0,u=0,f=0,l=0,c=t[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=t.length;n<h;n++){var d=t[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=t[n];switch(g){case"Z":o=+u,s=+f;break;case"H":o=p[1],p=["L",o,s];break;case"V":s=p[1],p=["L",o,s];break;case"T":o=p[1],s=p[2];var b=Lw([v[1],v[2]],[v[3],v[4]]);p=["Q",b[0],b[1],o,s];break;case"S":o=p[p.length-2],s=p[p.length-1];var x=v.length,E=Lw([v[x-4],v[x-3]],[v[x-2],v[x-1]]);p=["C",E[0],E[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 qc(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Z0(r,t){return qc(r)*qc(t)?(r[0]*t[0]+r[1]*t[1])/(qc(r)*qc(t)):1}function Dw(r,t){return(r[0]*t[1]<r[1]*t[0]?-1:1)*Math.acos(Z0(r,t))}function Q0(r,t){return r[0]===t[0]&&r[1]===t[1]}function Yj(r,t){var e=t[1],n=t[2],i=ov(sv(t[3]),Math.PI*2),a=t[4],o=t[5],s=r[0],u=r[1],f=t[6],l=t[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/(e*e)+h*h/(n*n);d>1&&(e*=Math.sqrt(d),n*=Math.sqrt(d));var v=e*e*(h*h)+n*n*(c*c),p=v?Math.sqrt((e*e*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*e*h/n:0,y=e?p*-n*c/e:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/e,(h-y)/n],E=[(-1*c-g)/e,(-1*h-y)/n],w=Dw([1,0],x),_=Dw(x,E);return Z0(x,E)<=-1&&(_=Math.PI),Z0(x,E)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:Q0(r,[f,l])?0:e,ry:Q0(r,[f,l])?0:n,startAngle:w,endAngle:w+_,xRotation:i,arcFlag:a,sweepFlag:o}}function kw(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}function xI(r){r=jj(r);for(var t=[],e=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:e,params:u,startTangent:null,endTangent:null};switch(f){case"M":i=[u[1],u[2]],a=s;break;case"A":var c=Yj(e,u);l.arcParams=c;break}if(f==="Z")e=i,n=r[a+1];else{var h=u.length;e=[u[h-2],u[h-1]]}n&&n[0]==="Z"&&(n=r[a],t[a]&&(t[a].prePoint=e)),l.currentPoint=e,t[a]&&Q0(e,t[a].currentPoint)&&(t[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]-e[0],v[1]-e[1]],l.endTangent=[e[0]-v[0],e[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=[e[0]-p[0],e[1]-p[1]]}else if(f==="T"){var g=t[s-1],p=kw(g.currentPoint,v);g.command==="Q"?(l.command="Q",l.startTangent=[v[0]-p[0],v[1]-p[1]],l.endTangent=[e[0]-p[0],e[1]-p[1]]):(l.command="TL",l.startTangent=[v[0]-e[0],v[1]-e[1]],l.endTangent=[e[0]-v[0],e[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=[e[0]-m[0],e[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=t[s-1],y=kw(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=[e[0]-m[0],e[1]-m[1]]):(l.command="SQ",l.startTangent=[v[0]-m[0],v[1]-m[1]],l.endTangent=[e[0]-m[0],e[1]-m[1]])}else if(f==="A"){var b=.001,x=l.arcParams||{},E=x.cx,w=E===void 0?0:E,_=x.cy,M=_===void 0?0:_,C=x.rx,S=C===void 0?0:C,A=x.ry,T=A===void 0?0:A,I=x.sweepFlag,D=I===void 0?0:I,N=x.startAngle,P=N===void 0?0:N,G=x.endAngle,W=G===void 0?0:G;D===0&&(b*=-1);var k=S*Math.cos(P-b)+w,R=T*Math.sin(P-b)+M;l.startTangent=[k-i[0],R-i[1]];var Y=S*Math.cos(P+W+b)+w,J=T*Math.sin(P+W-b)+M;l.endTangent=[v[0]-Y,v[1]-J]}t.push(l)}return t}function Vj(r,t){for(var e=[],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=cI.box(f[0],f[1],u[1],u[2],u[3],u[4]);break;case"C":l=qf.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=Ij.box(c.cx,c.cy,c.rx,c.ry,c.xRotation,c.startAngle,c.endAngle);break;default:e.push(s[0]),n.push(s[1]);break}l&&(o.box=l,e.push(l.x,l.x+l.width),n.push(l.y,l.y+l.height)),t&&(o.command==="L"||o.command==="M")&&o.prePoint&&o.nextPoint&&i.push(o)}e=e.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=ga(e),d=ga(n),v=pa(e),p=pa(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=Zc(o,t),h=h-g.xExtra):s[0]===v&&(g=Zc(o,t),v=v+g.xExtra),s[1]===d?(g=Zc(o,t),d=d-g.yExtra):s[1]===p&&(g=Zc(o,t),p=p+g.yExtra)}return{x:h,y:d,width:v-h,height:p-d}}function Zc(r,t){var e=r.prePoint,n=r.currentPoint,i=r.nextPoint,a=Math.pow(n[0]-e[0],2)+Math.pow(n[1]-e[1],2),o=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),s=Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2),u=Math.acos((a+o-s)/(2*Math.sqrt(a)*Math.sqrt(o)));if(!u||Math.sin(u)===0||_C(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)*(t/2*(1/Math.sin(u/2)))-t/2||0,yExtra:Math.cos(l-u/2)*(t/2*(1/Math.sin(u/2)))-t/2||0};return c}function Hj(r){var t=r.attr(),e=t.path,n=t.stroke,i=n?t.lineWidth:0,a=r.get("segments")||xI(e),o=Vj(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=Hm(r,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function Kj(r){var t=r.attr(),e=t.x1,n=t.y1,i=t.x2,a=t.y2,o=Math.min(e,i),s=Math.max(e,i),u=Math.min(n,a),f=Math.max(n,a),l={minX:o,maxX:s,minY:u,maxY:f};return l=Hm(r,l),{x:l.minX,y:l.minY,width:l.maxX-l.minX,height:l.maxY-l.minY}}function qj(r){var t=r.attr(),e=t.x,n=t.y,i=t.rx,a=t.ry;return{x:e-i,y:n-a,width:i*2,height:a*2}}Ea("rect",sI);Ea("image",sI);Ea("circle",uI);Ea("marker",uI);Ea("polyline",Pj);Ea("polygon",Nj);Ea("text",Fj);Ea("path",Hj);Ea("line",Kj);Ea("ellipse",qj);var Zj=function(r){Ot(t,r);function t(e,n){var i=r.call(this,e,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 t}(NT),J0=function(t){return"".concat(t,"-").concat(Math.random()).concat(Date.now())},Km=function(t){if(gt(t))switch(t.length){case 4:return t;case 3:return t.push(t[1]),t;case 2:return t.concat(t);case 1:return[t[0],t[0],t[0],t[0]];default:return[0,0,0,0]}if(ht(t))return[t,t,t,t];if(Ne(t)){var e=parseInt(t,10);return[e,e,e,e]}return[0,0,0,0]},Qj=function(t){var e=new Zj(t.type,t);return e.clientX=t.clientX,e.clientY=t.clientY,e.x=t.x,e.y=t.y,e.target=t.target,e.currentTarget=t.currentTarget,e.bubbles=!0,e.item=t.item,e},Jj=function(t){if(!t)return!1;for(var e=9,n=[1,0,0,0,1,0,0,0,1],i=0;i<e;i++)if(t[i]!==n[i])return!0;return!1},na=function(t){return Number.isNaN(Number(t))},EI=function(t){for(var e=1/0,n=-1/0,i=1/0,a=-1/0,o=0;o<t.length;o++){var s=t[o],u=s.getBBox(),f=u.minX,l=u.minY,c=u.maxX,h=u.maxY;f<e&&(e=f),l<i&&(i=l),c>n&&(n=c),h>a&&(a=h)}var d=Math.floor(e),v=Math.floor(i),p=Math.ceil(n)-Math.floor(e),g=Math.ceil(a)-Math.floor(i);return{x:d,y:v,width:p,height:g,minX:e,minY:i,maxX:n,maxY:a}},eU=function(t,e,n,i,a){e===void 0&&(e=15),n===void 0&&(n="quadratic"),i===void 0&&(i=void 0),a===void 0&&(a=void 0);for(var o=t.length,s=e*2,u=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],f={},l=[],c={},h=0;h<o;h++){var d=t[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=t[y],b=m.source,x=m.target;l[y]||(v===x&&p===b?(f[g].push(m),l[y]=!0,c["".concat(b,"|").concat(x,"|").concat(f[g].length-1)]=!0):v===b&&p===x&&(f[g].push(m),l[y]=!0))}}}for(var E in f)for(var w=f[E],_=w.length,M=0;M<_;M++){var C=w[M];if(C.source===C.target){a&&(C.type=a),C.loopCfg={position:u[M%8],dist:Math.floor(M/8)*20+50};continue}if(_===1&&i&&C.source!==C.target){C.type=i;continue}C.type=n;var S=(M%2===0?1:-1)*(c["".concat(C.source,"|").concat(C.target,"|").concat(M)]?-1:1);_%2===1?C.curveOffset=S*Math.ceil(M/2)*s:C.curveOffset=S*(Math.floor(M/2)*s+e)}return t};const tU=Object.freeze(Object.defineProperty({__proto__:null,calculationItemsBBox:EI,cloneEvent:Qj,formatPadding:Km,isNaN:na,isViewportChanged:Jj,processParallelEdges:eU,uniqueId:J0},Symbol.toStringTag,{value:"Module"}));var Fo={};const rU=ma(OG);Object.defineProperty(Fo,"__esModule",{value:!0});var Do=rU;function wI(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return Do.mat3.fromTranslation(n,e),Do.mat3.multiply(r,n,t)}Fo.leftTranslate=wI;function _I(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return Do.mat3.fromRotation(n,e),Do.mat3.multiply(r,n,t)}Fo.leftRotate=_I;function SI(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return Do.mat3.fromScaling(n,e),Do.mat3.multiply(r,n,t)}Fo.leftScale=SI;function nU(r,t,e){return Do.mat3.multiply(r,e,t)}function iU(r,t){for(var e=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=t.length;n<i;n++){var a=t[n];switch(a[0]){case"t":wI(e,e,[a[1],a[2]]);break;case"s":SI(e,e,[a[1],a[2]]);break;case"r":_I(e,e,a[1]);break;case"m":nU(e,e,a[1]);break}}return e}var Pw=Fo.transform=iU;function MI(r,t){return r[0]*t[1]-t[0]*r[1]}Fo.direction=MI;function aU(r,t,e){var n=Do.vec2.angle(r,t),i=MI(r,t)>=0;return e?i?Math.PI*2-n:n:i?n:Math.PI*2-n}Fo.angleTo=aU;function oU(r,t,e){return e?(r[0]=t[1],r[1]=-1*t[0]):(r[0]=-1*t[1],r[1]=t[0]),r}Fo.vertical=oU;var sU=function(){function r(t){this.destroyed=!1,this.graph=t,this.destroyed=!1}return r.prototype.getViewCenter=function(){var t=this.getFormatPadding(),e=this.graph,n=this.graph.get("width"),i=e.get("height");return{x:(n-t[1]-t[3])/2+t[3],y:(i-t[0]-t[2])/2+t[0]}},r.prototype.fitCenter=function(t,e){var n=this.graph,i=n.get("group"),a,o=n.getNodes();if(o.length>n.get("optimizeThreshold")){var s=1/0,u=1/0,f=-1/0,l=-1/0;o.forEach(function(x){var E=x.getModel(),w=E.x,_=E.y;s>w&&(s=w),u>_&&(u=_),f<w&&(f=w),l<_&&(l=_)});var c=i.getMatrix()||[1,0,0,0,1,0,0,0,1],h=Mu({x:s,y:u},c),d=h.x,v=h.y,p=Mu({x:f,y:l},c),g=p.x,y=p.y;a={minX:d,maxX:g,minY:v,maxY:y,width:g-d,height:y-v,x:d,y:v}}else a=i.getCanvasBBox();if(!(a.width===0||a.height===0)){var m=this.getViewCenter(),b={x:a.x+a.width/2,y:a.y+a.height/2};n.translate(m.x-b.x,m.y-b.y,t,e)}},r.prototype.animatedFitView=function(t,e,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(!(na(c)||na(h))){var d=Pw(l,[["t",c,h]]);if(!u){var v=vl({animateCfg:n,callback:function(){f.emit("viewportchange",{action:"translate",matrix:d})}});t.animate(function(x){return{matrix:O0(e,d,x)}},v);return}var p=f.get("minZoom"),g=f.get("maxZoom"),y=s;p&&s<p?(y=p,console.warn("fitview failed, ratio out of range, ratio: %f",s,"graph minzoom has been used instead")):g&&s>g&&(y=g,console.warn("fitview failed, ratio out of range, ratio: %f",s,"graph maxzoom has been used instead"));var m=Pw(d,[["t",-a.x,-a.y],["s",y,y],["t",a.x,a.y]]),b=vl({animateCfg:n,callback:function(){t.setMatrix(m),f.emit("viewportchange",{action:"translate",matrix:d}),f.emit("viewportchange",{action:"zoom",matrix:m})}});t.stopAnimate(),t.setMatrix(e),t.animate(function(x){return{matrix:O0(e,m,x)}},b)}},r.prototype.fitView=function(t,e){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(w){var _=w.getModel(),M=_.x,C=_.y;c>M&&(c=M),h>C&&(h=C),d<M&&(d=M),v<C&&(v=C)}),f={minX:c,maxX:d,minY:h,maxY:v,width:d-c,height:v-h,x:c,y:h}}else f=s.getCanvasBBox();if(!(f.width===0||f.height===0)){var p=this.getViewCenter(),g={x:f.x+f.width/2,y:f.y+f.height/2},y=(a-i[1]-i[3])/f.width,m=(o-i[0]-i[2])/f.height,b=y;if(y>m&&(b=m),t)this.animatedFitView(s,u,e,f,p,g,b,!0);else{var x=p.x-g.x,E=p.y-g.y;if(na(x)||na(E))return;n.translate(x,E),n.zoom(b,p)||console.warn("zoom failed, ratio out of range, ratio: %f",b)}}},r.prototype.fitViewByRules=function(t,e,n){var i=t.onlyOutOfViewPort,a=i===void 0?!1:i,o=t.direction,s=o===void 0?"both":o,u=t.ratioRule,f=u===void 0?"min":u,l=this.graph,c=this.getFormatPadding(),h=l.get("width"),d=l.get("height"),v=l.get("group"),p=v.getMatrix()||[1,0,0,0,1,0,0,0,1];v.resetMatrix();var g,y=l.getNodes();if(y.length>l.get("optimizeThreshold")){var m=1/0,b=1/0,x=-1/0,E=-1/0;y.forEach(function(D){var N=D.getModel(),P=N.x,G=N.y;m>P&&(m=P),b>G&&(b=G),x<P&&(x=P),E<G&&(E=G)}),g={minX:m,maxX:x,minY:b,maxY:E,width:x-m,height:E-b,x:m,y:b}}else g=v.getCanvasBBox();if(!(g.width===0||g.height===0)){var w=this.getViewCenter(),_={x:g.x+g.width/2,y:g.y+g.height/2},M=(h-c[1]-c[3])/g.width,C=(d-c[0]-c[2])/g.height,S;if(s==="x"?S=M:s==="y"?S=C:S=f==="max"?Math.max(M,C):Math.min(M,C),a&&(S=S<1?S:1),e)this.animatedFitView(v,p,n,g,w,_,S,!0);else{var A=l.getZoom(),T=A*S,I=l.get("minZoom");T<I&&(T=I,console.warn("fitview failed, ratio out of range, ratio: %f",S,"graph minzoom has been used instead")),l.translate(w.x-_.x,w.y-_.y),l.zoomTo(T,w)}}},r.prototype.getFormatPadding=function(){var t=this.graph.get("fitViewPadding");return Km(t)},r.prototype.focusPoint=function(t,e,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]),e){var u=(o.x-t.x)*s[0],f=(o.y-t.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},F({},n))}else this.graph.translate((o.x-t.x)*s[0],(o.y-t.y)*s[4])},r.prototype.getPointByCanvas=function(t,e){var n=this.graph.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=gT({x:t,y:e},n);return i},r.prototype.getPointByClient=function(t,e){var n=this.graph.get("canvas"),i=n.getPointByClient(t,e);return this.getPointByCanvas(i.x,i.y)},r.prototype.getClientByPoint=function(t,e){var n=this.graph.get("canvas"),i=this.getCanvasByPoint(t,e),a=n.getClientByPoint(i.x,i.y);return{x:a.x,y:a.y}},r.prototype.getCanvasByPoint=function(t,e){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Mu({x:t,y:e},n)},r.prototype.focus=function(t,e,n){if(Ne(t)&&(t=this.graph.findById(t)),t){var i=0,a=0;if(t.getType&&t.getType()==="edge"){var o=t.getSource().get("group").getMatrix(),s=t.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=t.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},e,n)}},r.prototype.focusItems=function(t,e,n,i){if(t.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=t;h<d.length;h++){var v=d[h],p=v.getBBox();p.minX<c.minX&&(c.minX=p.minX),p.minY<c.minY&&(c.minY=p.minY),p.maxX>c.maxX&&(c.maxX=p.maxX),p.maxY>c.maxY&&(c.maxY=p.maxY)}if(c.x=c.minX,c.y=c.minY,c.width=c.maxX-c.minX,c.height=c.maxY-c.minY,!(c.width===0||c.height===0)){var g=this.getViewCenter(),y={x:c.x+c.width/2,y:c.y+c.height/2},m=(s-o[1]-o[3])/c.width,b=(u-o[0]-o[2])/c.height,x=m;m>b&&(x=b),n?this.animatedFitView(f,l,i,c,g,y,x,e):(a.translate(g.x-y.x,g.y-y.y),e&&!a.zoom(x,g)&&console.warn("zoom failed, ratio out of range, ratio: %f",x))}}},r.prototype.changeSize=function(t,e){var n=this.graph;if(!ht(t)||!ht(e))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:t,height:e});var i=n.get("canvas");i.changeSize(t,e);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 ey(r){"@babel/helpers - typeof";return ey=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ey(r)}function Nw(r){if(typeof r!="string")return r;var t=function(_){if(typeof _!="string")return _;try{return JSON.parse(_.trim())}catch{return _.trim()}},e=t(r);if(typeof e!="string")return e;for(var n=function(_){return _[_.length-1]},i=r.trim(),a=[],o=[],s=function(){for(var _=[],M=0;M<arguments.length;M++)_[M]=arguments[M];return _.some(function(C){return n(o)===C})},u=function(){return n(a)},f=null,l=0,c="";l<i.length;){var h=i[l],d=s('"',"'");if(!d&&!h.trim()){l+=1;continue}var v=i[l-1]==="\\",p=s("}"),g=s("]"),y=s(","),m=u();if(d)if(n(o)===h&&!v){o.pop();var b=t(c);m.push(b),f=b,c=""}else c+=h;else if(g&&h===",")c&&(m.push(t(c)),c="");else if(p&&h===":")o.push(","),c&&(m.push(c),c="");else if(y&&h===",")c&&(m.push(t(c)),c=""),o.pop();else if(h==="}"&&(p||y)){c&&(m.push(t(c)),c=""),y&&o.pop();for(var x={},E=1;E<m.length;E+=2)x[m[E-1]]=m[E];a.pop(),a.length&&n(a).push(x),o.pop(),f=x}else h==="]"&&g?(c&&(m.push(t(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 uU=function(t){return t.split("-").reduce(function(e,n){return e+n.charAt(0).toUpperCase()+n.slice(1)})},fU=function(t){return function(e){for(var n=t.length,i=[],a=0,o="";a<n;)if(t[a]==="{"&&t[a+1]==="{")i.push(o),o="",a+=2;else if(t[a]==="}"&&t[a+1]==="}"){if(i.length){var s=i.pop();o=za(e,o,s.endsWith("=")?'"{'.concat(o,'}"'):o),i.push(s+o)}a+=2,o=""}else o+=t[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 CI(r,t){var e={},n=r.getAttributeNames&&r.getAttributeNames()||[],i=r.children&&Array.from(r.children).map(function(s){return CI(s,t)}),a={},o=r.tagName?r.tagName.toLowerCase():"group";return o==="text"&&(e.text=r.innerText),a.type=o,o==="img"&&(a.type="image"),Array.from(n).forEach(function(s){var u=uU(s),f=r.getAttribute(s);try{if(u==="style"||u==="attrs"){var l=Nw(f);e=F(F({},e),l)}else a[u]=Nw(f)}catch(c){if(u==="style")throw c;a[u]=f}}),a.attrs=e,t&&t.style&&a.name&&ey(t.style[a.name])==="object"&&(a.attrs=F(F({},a.attrs),t.style[a.name])),t&&t.style&&a.keyshape&&(a.attrs=F(F({},a.attrs),t.style)),i.length&&(a.children=i),a}function lU(r,t,e){var n=r.attrs,i=n===void 0?{}:n,a={x:t.x||0,y:t.y||0,width:e.width||0,height:e.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=TT(i.text,i.fontSize||12)[0],o=16,a.y+=o,a.height=o,a.width=s,r.attrs=F({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 AI(r,t){var e;t===void 0&&(t={x:0,y:0});var n=F({x:0,y:0,width:0,height:0},t);if(!((e=r.children)===null||e===void 0)&&e.length){var i=r.attrs,a=i===void 0?{}:i,o=a.marginTop,s=F({},t);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=AI(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=lU(r,t,n),r.attrs=F(F({},r.attrs),r.bbox),r}function TI(r,t){var e,n,i,a,o=(r||{}).type,s=((t==null?void 0:t.attrs)||{}).key;if(s&&r&&(r.attrs.key=s),!r&&t)return{action:"delete",val:t,type:o,key:s};if(r&&!t)return{action:"add",val:r,type:o};if(!r&&!t)return{action:"same",type:o};var u=[];if(((e=r.children)===null||e===void 0?void 0:e.length)>0||((n=t.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=t.children)===null||a===void 0?void 0:a.length),l=t.children||[],c=r.children||[],h=0;h<f;h+=1)u.push(TI(c[h],l[h]));var d=Object.keys(t.attrs),v=Object.keys(r.attrs);return t.type!==r.type?{action:"restructure",nowTarget:r,formerTarget:t,key:s,children:u}:d.filter(function(p){return p!=="children"}).some(function(p){return r.attrs[p]!==t.attrs[p]||!v.includes(p)})?{action:"change",val:r,children:u,type:o,key:s}:{action:"same",children:u,type:o,key:s}}function Rw(r){var t={},e=function(i){var a=typeof r=="function"?r(i):r,o=fU(a)(i),s=document.createElement("div");s.innerHTML=o;var u=s.children[0],f=AI(CI(u,i));return s.remove(),f};return{draw:function(i,a){var o=e(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=sn(l,["attrs","bbox","type","children"]);if(l.type!=="group"){var y=a.addShape(l.type,F({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),t[i.id]=[o],s},update:function(i,a){t[i.id]||(t[i.id]=[]);var o=a.getContainer(),s=o.get("children"),u=e(i),f=t[i.id].pop(),l=TI(u,f),c=function v(p){var g;p.type!=="group"&&o.addShape(p.type,{attrs:p.attrs}),!((g=p.children)===null||g===void 0)&&g.length&&p.children.map(function(y){return v(y)})},h=function v(p){var g,y=s.find(function(m){return m.attrs.key===p.attrs.key});y&&o.removeChild(y),!((g=p.children)===null||g===void 0)&&g.length&&p.children.map(function(m){return v(m)})},d=function v(p){var g=p.key;if(p.type!=="group"){var y=s.find(function(b){return b.attrs.key===g});switch(p.action){case"change":if(y){var m=p.val.keyshape?a.getOriginStyle():{};y.attr(F(F({},m),p.val.attrs))}break;case"add":c(p.val);break;case"delete":h(p.val);break;case"restructure":h(p.formerTarget),c(p.nowTarget);break}}p.children&&p.children.forEach(function(b){return v(b)})};d(l),t[i.id].push(u)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var Eg={};function Bw(r){return Eg[r]||(Eg[r]=ku(r)),Eg[r]}var cU={defaultShapeType:"defaultType",className:null,getShape:function(t){var e=this,n=e[t]||e[e.defaultShapeType]||e["simple-circle"];return n},draw:function(t,e,n){var i=this.getShape(t);n.shapeMap={};var a=i.draw(e,n);return i.afterDraw&&i.afterDraw(e,n,a),a},baseUpdate:function(t,e,n,i){var a,o,s=this.getShape(t);s.update&&(s.mergeStyle=(a=s.getOptions)===null||a===void 0?void 0:a.call(s,e,i),(o=s.update)===null||o===void 0||o.call(s,e,n,i)),s.afterUpdate&&s.afterUpdate(e,n)},setState:function(t,e,n,i){var a=this.getShape(t);a.setState(e,n,i)},shouldUpdate:function(t){var e=this.getShape(t);return!!e.update},getControlPoints:function(t,e){var n=this.getShape(t);return n.getControlPoints(e)},getAnchorPoints:function(t,e){var n=this.getShape(t);return n.getAnchorPoints(e)}},wg={options:{},draw:function(t,e){return this.drawShape(t,e)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e=this.options.anchorPoints,n=t.anchorPoints||e;return n}},br=function(){function r(){}return r.registerFactory=function(t,e){var n=Bw(t),i=cU,a=F(F({},i),e);return r[n]=a,a.className=n,a},r.getFactory=function(t){var e=Bw(t);return r[e]},r.registerNode=function(t,e,n){var i=r.Node,a;if(typeof e=="string"||typeof e=="function"){var o=Rw(e);a=F(F({},i.getShape("single-node")),o)}else if(e.jsx){var s=e.jsx,o=Rw(s);a=F(F(F({},i.getShape("single-node")),o),e)}else{i.getShape(n);var u=n?i.getShape(n):wg;a=F(F({},u),e)}return a.type=t,a.itemType="node",i[t]=a,a},r.registerEdge=function(t,e,n){var i=r.Edge,a=n?i.getShape(n):wg,o=F(F({},a),e);return o.type=t,o.itemType="edge",i[t]=o,o},r.registerCombo=function(t,e,n){var i=r.Combo,a=n?i.getShape(n):wg,o=F(F({},a),e);return o.type=t,o.itemType="combo",i[t]=o,o},r}();br.registerFactory("node",{defaultShapeType:"circle"});br.registerFactory("edge",{defaultShapeType:"line"});br.registerFactory("combo",{defaultShapeType:"circle"});var _g="bboxCache",Sg="bboxCanvasCache",II=function(){function r(t){this._cfg={},this.destroyed=!1,this.optimize=!1;var e={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(e,this.getDefaultCfg(),t);var n=this.get("model"),i=n.id,a=this.get("type");typeof i>"u"?i=J0(a):typeof i!="string"&&(i=String(i)),this.get("model").id=i,this.set("id",i);var o=t.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=mr({},f.stateStyles,l),this.set("styles",l)}}}return r.prototype.calculateBBox=function(){var t=this.get("keyShape"),e=this.get("group"),n=xd(t,e);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 t=this.get("keyShape"),e=this.get("group"),n=xd(t,e);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 t=this,e=t.get("shapeFactory"),n=t.get("group"),i=t.get("model");n.clear();var a=i.visible;if(a!==void 0&&!a&&t.changeVisibility(a),!!e){t.updatePosition(i);var o=t.getShapeCfg(i),s=o.type,u=e.draw(s,o,n);u&&(t.set("keyShape",u),u.set("isKeyShape",!0),u.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",s),this.restoreStates(e,s)}},r.prototype.setOriginStyle=function(){var t=this.get("group"),e=t.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=e[y],b=m.get("name"),x=m.attr();if(b&&b!==a){var E=v[b];d[b]||(d[b]={}),E?Object.keys(x).forEach(function(M){var C=x[M];C!==E[M]&&(d[b][M]=C)}):d[b]=m.get("type")!=="image"?Vt(x):i.getShapeStyleByName(b)}else{var w=m.attr(),_={};Object.keys(v).forEach(function(M){var C=v[M];(M===a||!yn(C))&&(_[M]=C)}),Object.keys(w).forEach(function(M){var C=w[M];_[M]!==C&&(a?d[a][M]=C:d[M]=C)})}},s=0;s<e.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<e.length;s++){var u=e[s],f=u.get("type"),l=u.get("name");if(l&&l!==a)o[l]=f!=="image"?Vt(u.attr()):i.getShapeStyleByName(l),f==="text"&&o[l]&&(delete o[l].x,delete o[l].y,delete o[l].matrix);else{var c=i.getShapeStyleByName();if(delete c.path,delete c.matrix,!a)Object.assign(o,c);else if(l)o[a]=c;else{var h=J0("shape");u.set("name",h),t.shapeMap[h]=u,o[h]=f!=="image"?Vt(u.attr()):i.getShapeStyleByName(l)}}}i.set("originStyle",o)}},r.prototype.restoreStates=function(t,e){var n=this,i=n.get("states");me(i,function(a){t.setState(e,a,!0,n)})},r.prototype.init=function(){var t=br.getFactory(this.get("type"));this.set("shapeFactory",t)},r.prototype.get=function(t){return this._cfg[t]},r.prototype.set=function(t,e){yn(t)?this._cfg=F(F({},this._cfg),t):this._cfg[t]=e},r.prototype.getDefaultCfg=function(){return{}},r.prototype.clearCache=function(){this.set(_g,null),this.set(Sg,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(t){var e=this.get("group"),n;if(t?n=e.shapeMap[t]||e.find(function(a){return a.get("name")===t}):n=this.getKeyShape(),n){var i={};return me(n.attr(),function(a,o){(o!=="img"||Ne(a))&&(i[o]=a)}),i}return{}},r.prototype.getShapeCfg=function(t,e){var n=this.get("styles");if(n){var i=t;return i.style=F(F({},n),t.style),i}return t},r.prototype.getStateStyle=function(t){var e=this.get("styles"),n=e&&e[t];return n},r.prototype.getOriginStyle=function(){return this.get("originStyle")},r.prototype.getCurrentStatesStyle=function(){var t=this,e={},n=t.getStates();return!n||!n.length?this.get("originStyle"):(me(t.getStates(),function(i){e=Object.assign(e,t.getStateStyle(i))}),e)},r.prototype.setState=function(t,e){var n=this.get("states"),i=this.get("shapeFactory"),a=t,o=t;Ne(e)&&(a="".concat(t,":").concat(e),o="".concat(t,":"));var s=n;if(Pl(e)){var u=n.indexOf(o);if(e){if(u>-1)return;n.push(a)}else u>-1&&n.splice(u,1)}else if(Ne(e)){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,t,e,this)}},r.prototype.clearStates=function(t){var e=this,n=e.getStates(),i=e.get("shapeFactory"),a=e.get("model"),o=a.type;t||(t=n),Ne(t)&&(t=[t]);var s=n.filter(function(u){return t.indexOf(u)===-1});e.set("states",s),t.forEach(function(u){i.setState(o,u,!1,e)})},r.prototype.setOptimize=function(t){this.optimize=t},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(t){var e=this.getStates();return e.indexOf(t)>=0},r.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},r.prototype.getUpdateType=function(t){},r.prototype.update=function(t,e){e===void 0&&(e=void 0);var n=this.get("model");if(e==="move")this.updatePosition(t);else{var i=n.visible,a=t.visible;i!==a&&a!==void 0&&this.changeVisibility(a);var o={x:n.x,y:n.y};t.x=isNaN(+t.x)?n.x:+t.x,t.y=isNaN(+t.y)?n.y:+t.y;var s=this.get("styles");if(t.stateStyles){var u=t.stateStyles;yt(s,u),delete t.stateStyles}Object.assign(n,t),(o.x!==t.x||o.y!==t.y)&&this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},r.prototype.updateShape=function(t){var e=this.get("shapeFactory"),n=this.get("model"),i=n.type;if(e.shouldUpdate(i)&&i===this.get("currentShape")){var a=this.getShapeCfg(n,t);e.baseUpdate(i,a,this,t),t!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(e,i)},r.prototype.updatePosition=function(t){var e=this.get("model"),n=isNaN(+t.x)?+e.x:+t.x,i=isNaN(+t.y)?+e.y:+t.y,a=this.get("group");if(isNaN(n)||isNaN(i))return!1;e.x=n,e.y=i;var o=a.getMatrix();return o&&o[6]===n&&o[7]===i?!1:(a.resetMatrix(),yT(a,{x:n,y:i}),this.clearCache(),!0)},r.prototype.getBBox=function(){var t=this.get(_g);return t||(t=this.calculateBBox(),this.set(_g,t)),t},r.prototype.getCanvasBBox=function(){var t=this.get(Sg);return t||(t=this.calculateCanvasBBox(),this.set(Sg,t)),t},r.prototype.toFront=function(){var t=this.get("group");t.toFront()},r.prototype.toBack=function(){var t=this.get("group");t.toBack()},r.prototype.show=function(){this.changeVisibility(!0)},r.prototype.hide=function(){this.changeVisibility(!1)},r.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},r.prototype.isVisible=function(){return this.get("visible")},r.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},r.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),e.remove(),this._cfg=null,this.destroyed=!0}},r}(),Qc={source:"start",target:"end"},Vi="Node",ru="Point",hU="Anchor",OI=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},t.prototype.setEnd=function(e,n){var i=Qc[e]+ru,a=e+Vi,o=this.get(a);o&&!o.destroyed&&o.removeEdge(this),yn(n)?(this.set(i,n),this.set(a,null)):n&&(n.addEdge(this),this.set(a,n),this.set(i,null))},t.prototype.getLinkPoint=function(e,n,i){var a=Qc[e]+ru,o=e+Vi,s=this.get(a);if(!s){var u=this.get(o),f=e+hU,l=this.getPrePoint(e,i),c=n[f];ct(c)||(s=u.getLinkPointByAnchor(c)),s=s||u.getLinkPoint(l),ct(s.index)||this.set("".concat(e,"AnchorIndex"),s.index)}return s},t.prototype.getPrePoint=function(e,n){if(n&&n.length){var i=e==="source"?0:n.length-1;return n[i]}var a=e==="source"?"target":"source";return this.getEndPoint(a)},t.prototype.getEndPoint=function(e){var n=e+Vi,i=Qc[e]+ru,a=this.get(n);return a&&!a.destroyed?a.get("model"):this.get(i)},t.prototype.getControlPointsByCenter=function(e){var n=this.getEndPoint("source"),i=this.getEndPoint("target"),a=this.get("shapeFactory"),o=e.type;return a.getControlPoints(o,{startPoint:n,endPoint:i})},t.prototype.getEndCenter=function(e){var n=e+Vi,i=Qc[e]+ru,a=this.get(n);if(a){var o=a.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(i)},t.prototype.init=function(){r.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},t.prototype.getShapeCfg=function(e,n){var i=this,a=i.get("linkCenter"),o=n!=null&&n.includes("move")?e:r.prototype.getShapeCfg.call(this,e);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",e,s),o.endPoint=i.getLinkPoint("target",e,s)}return o.sourceNode=i.get("sourceNode"),o.targetNode=i.get("targetNode"),o},t.prototype.getModel=function(){var e=this.get("model"),n=this.get("source".concat(Vi)),i=this.get("target".concat(Vi));return n?delete e["source".concat(Vi)]:e.source=this.get("start".concat(ru)),i?delete e["target".concat(Vi)]:e.target=this.get("end".concat(ru)),!Ne(e.source)&&!yn(e.source)&&(e.source=e.source.getID()),!Ne(e.target)&&!yn(e.target)&&(e.target=e.target.getID()),e},t.prototype.setSource=function(e){this.setEnd("source",e),this.set("source",e)},t.prototype.setTarget=function(e){this.setEnd("target",e),this.set("target",e)},t.prototype.getSource=function(){return this.get("source")},t.prototype.getTarget=function(){return this.get("target")},t.prototype.updatePosition=function(){return!1},t.prototype.update=function(e,n){n===void 0&&(n=void 0);var i=this.get("model"),a=i.visible,o=e.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(e.stateStyles){var l=e.stateStyles;yt(f,l),delete e.stateStyles}Object.assign(i,e),this.updateShape(n),this.afterUpdate(),this.clearCache()}},t.prototype.destroy=function(){var e=this.get("source".concat(Vi)),n=this.get("target".concat(Vi));e&&!e.destroyed&&e.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),r.prototype.destroy.call(this)},t}(II),Mg="anchorPointsCache",dU="bboxCache",qm=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getNearestPoint=function(e,n){for(var i=0,a=e[0],o=md(e[0],n),s=0;s<e.length;s++){var u=e[s],f=md(u,n);f<o&&(a=u,o=f,i=s)}return a.anchorIndex=i,a},t.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},t.prototype.getEdges=function(){return this.get("edges")},t.prototype.getInEdges=function(){var e=this;return this.get("edges").filter(function(n){return n.get("target")===e})},t.prototype.getOutEdges=function(){var e=this;return this.get("edges").filter(function(n){return n.get("source")===e})},t.prototype.getNeighbors=function(e){var n=this,i=this.get("edges");if(e==="target"){var a=function(f){return f.getSource()===n};return i.filter(a).map(function(u){return u.getTarget()})}if(e==="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)},t.prototype.getLinkPointByAnchor=function(e){var n=this.getAnchorPoints();return n[e]},t.prototype.getLinkPoint=function(e){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=vT({x:o,y:s,r:u.width/2},e);break;case"ellipse":l=pT({x:o,y:s,rx:u.width/2,ry:u.height/2},e);break;default:l=dT(u,e)}var c=l;return f.length&&(c||(c=e),c=this.getNearestPoint(f,c)),c||(c={x:o,y:s}),c},t.prototype.getAnchorPoints=function(){var e=this.get(Mg);if(!e){e=[];var n=this.get("shapeFactory"),i=this.getBBox(),a=this.get("model"),o=this.getShapeCfg(a),s=a.type,u=n.getAnchorPoints(s,o)||[];me(u,function(f,l){var c={x:i.minX+f[0]*i.width,y:i.minY+f[1]*i.height,anchorIndex:l};e.push(c)}),this.set(Mg,e)}return e},t.prototype.addEdge=function(e){this.get("edges").push(e)},t.prototype.lock=function(){this.set("locked",!0)},t.prototype.unlock=function(){this.set("locked",!1)},t.prototype.hasLocked=function(){return this.get("locked")},t.prototype.removeEdge=function(e){var n=this.getEdges(),i=n.indexOf(e);i>-1&&n.splice(i,1)},t.prototype.clearCache=function(){this.set(dU,null),this.set(Mg,null)},t.prototype.getUpdateType=function(e){var n,i,a,o,s;if(e){var u=!ct(e.x),f=!ct(e.y),l=Object.keys(e);if(l.length===1&&(u||f)||l.length===2&&u&&f)return"move";if(ht(e.x)||ht(e.y)||e.type||e.anchorPoints||e.size||e!=null&&e.style&&(!((n=e==null?void 0:e.style)===null||n===void 0)&&n.r||!((i=e==null?void 0:e.style)===null||i===void 0)&&i.width||!((a=e==null?void 0:e.style)===null||a===void 0)&&a.height||!((o=e==null?void 0:e.style)===null||o===void 0)&&o.rx||!((s=e==null?void 0:e.style)===null||s===void 0)&&s.ry))return"bbox|label";var c=l.includes("label")||l.includes("labelCfg");return c?"style|label":"style"}},t.prototype.setState=function(e,n){var i=this;if(this.optimize){r.prototype.setState.call(this,e,n);return}this.runWithBBoxAffected(function(){return r.prototype.setState.call(i,e,n)})},t.prototype.clearStates=function(e){var n=this;if(this.optimize){r.prototype.clearStates.call(this,e);return}this.runWithBBoxAffected(function(){return r.prototype.clearStates.call(n,e)})},t.prototype.runWithBBoxAffected=function(e){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])}),e();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}}},t}(II),Fw="bboxCache",Gw="bboxCanvasCache",Jc="sizeCache",zw="anchorPointsCache",LI=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},t.prototype.getShapeCfg=function(e){var n=this.get("styles"),i=this.get("bbox");if(n&&i){var a=e,o=ht(e.size)?[e.size,e.size]:e.size,s=ht(e.fixSize)?[e.fixSize,e.fixSize]:e.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=F(F(F({},n),e.style),f);var l=e.padding||lt.defaultCombo.padding;return ht(l)?(f.r+=l,f.width+=l*2,f.height+=l*2):(f.r=f.r+Math.max.apply(Math,l),f.width+=l[1]+l[3]||l[1]*2,f.height+=l[0]+l[2]||l[0]*2),this.set(Jc,f),a}return e},t.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var e=this.get("keyShape"),n=this.get("group"),i=this.get(Fw)||{},a=i.x,o=i.x,s=this.get(Jc),u=xd(e,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(Jc,s);var f=e.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(zw,null),u}},t.prototype.getChildren=function(){var e=this;return{nodes:e.getNodes(),combos:e.getCombos()}},t.prototype.getNodes=function(){var e=this;return e.get("nodes")},t.prototype.getCombos=function(){var e=this;return e.get("combos")},t.prototype.addChild=function(e){var n=this,i=e.getType();switch(i){case"node":n.addNode(e);break;case"combo":n.addCombo(e);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},t.prototype.addCombo=function(e){var n=this;return n.get("combos").push(e),!0},t.prototype.addNode=function(e){var n=this;return n.get("nodes").push(e),!0},t.prototype.removeChild=function(e){var n=this,i=e.getType();switch(i){case"node":n.removeNode(e);break;case"combo":n.removeCombo(e);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},t.prototype.removeCombo=function(e){if(e){var n=this.getCombos(),i=n.indexOf(e);return i>-1?(n.splice(i,1),!0):!1}},t.prototype.removeNode=function(e){if(e){var n=this.getNodes(),i=n.indexOf(e);return i>-1?(n.splice(i,1),!0):!1}},t.prototype.getUpdateType=function(e){},t.prototype.getBBox=function(){this.set(Gw,null);var e=this.calculateCanvasBBox();return e},t.prototype.clearCache=function(){this.set(Fw,null),this.set(Gw,null),this.set(zw,null)},t.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),n=this.get("group");e&&n.stopAnimate(),n.shapeMap={},this.clearCache(),this.set(Jc,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},t}(qm),eh="node",th="edge",jw="vedge",wf="combo",vU="default",Uw="Mapper",ka="stateStyles",pU=function(){function r(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=ll(function(n){var i=e.graph;if(!(!i||i.get("destroyed"))){var a=e.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)}}),e.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return r.prototype.addItem=function(t,e){var n=this.graph,i=t===jw?th:t,a=n.get("".concat(i,"Group"))||n.get("group"),o=ku(i),s=null,u=n.get(i+ku(ka))||{},f=n.get(vU+o);e[ka]&&(u=e[ka]),f&&me(f,function(w,_){bn(w)&&!gt(w)?e[_]=mr({},w,e[_]):gt(w)?e[_]=e[_]||Vt(f[_]):e[_]=e[_]||f[_]});var l=n.get(i+Uw);if(l){var c=l(e);c[ka]&&(u=c[ka],delete c[ka]),me(c,function(w,_){bn(w)&&!gt(w)?e[_]=mr({},e[_],w):e[_]=c[_]||e[_]})}if(n.emit("beforeadditem",{type:t,model:e}),t===th||t===jw){var h=void 0,d=void 0;if(h=e.source,d=e.target,h&&Ne(h)&&(h=n.findById(h)),d&&Ne(d)&&(d=n.findById(d)),!h||!d){console.warn("The source or target node of edge ".concat(e.id," does not exist!"));return}h.getType&&h.getType()==="combo"&&(e.isComboEdge=!0),d.getType&&d.getType()==="combo"&&(e.isComboEdge=!0),s=new OI({model:e,source:h,target:d,styles:u,linkCenter:n.get("linkCenter"),group:a.addGroup()})}else if(t===eh)s=new qm({model:e,styles:u,group:a.addGroup()});else if(t===wf){var v=e.children,p=Xh(v,n),g=void 0,y=void 0;if(isNaN(p.x)?isNaN(e.x)&&(g=Math.random()*100):g=p.x,isNaN(p.y)?isNaN(e.y)&&(y=Math.random()*100):y=p.y,isNaN(e.x)||isNaN(e.y))e.x=g,e.y=y;else{var m=e.x-g,b=e.y-y;this.updateComboSucceeds(e.id,m,b,v)}var x=a.addGroup();x.setZIndex(e.depth),s=new LI({model:e,styles:u,animate:n.get("animate"),bbox:e.collapsed?Xh([],n):p,group:x}),!e.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 E=s.getModel();(v||[]).forEach(function(w){var _=n.findById(w.id);s.addChild(_),w.depth=E.depth+2})}if(s)return s.setOptimize(n.getNodes().length>n.get("optimizeThreshold")),n.get("".concat(t,"s")).push(s),n.get("itemMap")[s.get("id")]=s,n.emit("afteradditem",{item:s,model:e}),s},r.prototype.updateItem=function(t,e){var n=this,i,a,o=this.graph;if(Ne(t)&&(t=o.findById(t)),!(!t||t.destroyed)){var s="";t.getType&&(s=t.getType());var u=o.get(s+Uw),f=t.getModel(),l=f.x,c=f.y,h=t.getUpdateType(e);if(u){var d=mr({},f,e),v=u(d),p=mr({},f,v,e);v[ka]&&(t.set("styles",p[ka]),delete p[ka]),me(p,function(S,A){e[A]=S})}else me(e,function(S,A){f[A]&&bn(S)&&!gt(S)&&(e[A]=F(F({},f[A]),e[A]))});if(o.emit("beforeupdateitem",{item:t,cfg:e}),s===th){if(e.source){var g=e.source;Ne(g)&&(g=o.findById(g)),t.setSource(g)}if(e.target){var y=e.target;Ne(y)&&(y=o.findById(y)),t.setTarget(y)}t.update(e)}else if(s===eh){t.update(e,h);var m=t.getEdges();h==="move"?me(m,function(S){n.edgeToBeUpdateMap[S.getID()]={edge:S,updateType:h},n.throttleRefresh()}):h!=null&&h.includes("bbox")&&me(m,function(S){S.refresh(h)})}else if(s===wf){if(t.update(e,h),!isNaN(e.x)||!isNaN(e.y)){var b=e.x-l||0,x=e.y-c||0;this.updateComboSucceeds(f.id,b,x)}var E=t.getEdges(),w=(h==null?void 0:h.includes("bbox"))||h==="move";if(w&&s===wf){var _=t.get("shapeFactory"),M=f.type||"circle",C=f.animate===void 0||e.animate===void 0?(a=(i=_[M])===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.animate:f.animate||e.animate;C?setTimeout(function(){if(!(!t||t.destroyed)){var S=t.getKeyShape();!S||S.destroyed||me(E,function(A){A&&!A.destroyed&&A.refresh()})}},201):me(E,function(S){S.refresh()})}}t.setOptimize(o.getNodes().length>o.get("optimizeThreshold")),o.emit("afterupdateitem",{item:t,cfg:e})}},r.prototype.updateCombo=function(t,e,n){var i=this,a,o,s=this.graph;if(Ne(t)&&(t=s.findById(t)),!(!t||t.destroyed)){var u=t.getModel(),f=Xh(e,s,t),l=f.x,c=f.y;t.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),t.update({x:h,y:d});var v=t.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(!(!t||t.destroyed)){var y=t.getKeyShape();!y||y.destroyed||(t.getShapeCfg(u),i.updateComboEdges(t))}},201):this.updateComboEdges(t)}},r.prototype.updateComboEdges=function(t){for(var e,n,i=t.getEdges()||[],a=0;a<i.length;a++){var o=i[a];!(o!=null&&o.destroyed)&&!(!((e=o==null?void 0:o.getSource())===null||e===void 0)&&e.destroyed)&&!(!((n=o==null?void 0:o.getTarget())===null||n===void 0)&&n.destroyed)&&o.refresh()}},r.prototype.collapseCombo=function(t,e){e===void 0&&(e=!0);var n=this.graph;Ne(t)&&(t=n.findById(t));var i=t.getChildren();i.nodes.forEach(function(a){n.hideItem(a,e)}),i.combos.forEach(function(a){n.hideItem(a,e)})},r.prototype.updateComboSucceeds=function(t,e,n,i){var a=this;i===void 0&&(i=[]);var o=this.graph;if(!(!e&&!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===t?(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)+e,y:(c.y||0)+n})}})}},r.prototype.expandCombo=function(t,e){e===void 0&&(e=!0);var n=this.graph;Ne(t)&&(t=n.findById(t));var i=t.getChildren(),a=new Set;i.nodes.forEach(function(o){n.showItem(o,e),o.getEdges().forEach(function(s){return a.add(s)})}),i.combos.forEach(function(o){o.getModel().collapsed?o.show():n.showItem(o,e),o.getEdges().forEach(function(s){return a.add(s)})}),a.forEach(function(o){return o.refresh()})},r.prototype.removeItem=function(t){var e=this,n=this.graph;if(Ne(t)&&(t=n.findById(t)),!(!t||t.destroyed)){var i=Vt(t.getModel()),a="";t.getType&&(a=t.getType()),n.emit("beforeremoveitem",{item:i,type:a});var o=n.get("".concat(a,"s")),s=o.indexOf(t);if(s>-1&&o.splice(s,1),a===th){var u=n.get("v".concat(a,"s")),f=u.indexOf(t);f>-1&&u.splice(f,1)}var l=t.get("id"),c=n.get("itemMap");delete c[l];var h=n.get("comboTrees"),d=t.get("id");if(a===eh){var v=t.getModel().comboId;if(h&&v){var p=h,g=!1;h.forEach(function(w){g||Cn(w,function(_){if(_.id===d&&p){var M=p.indexOf(_);return p.splice(M,1),g=!0,!1}return p=_.children,!0})})}for(var y=t.getEdges(),m=y.length-1;m>=0;m--)n.removeItem(y[m],!1);v&&n.updateCombo(v)}else if(a===wf){var b=t.getModel().parentId,x,E=!1;(h||[]).forEach(function(_){E||Cn(_,function(M){return M.id===d?(x=M,E=!0,!1):!0})}),x.removed=!0,x&&x.children&&x.children.forEach(function(_){e.removeItem(_.id)});for(var y=t.getEdges(),m=y.length;m>=0;m--)n.removeItem(y[m],!1);b&&n.updateCombo(b)}t.destroy(),n.emit("afterremoveitem",{item:i,type:a})}},r.prototype.setItemState=function(t,e,n){var i=this.graph,a=e;Ne(n)&&(a="".concat(e,":").concat(n)),!(t.hasState(a)===n&&n||Ne(n)&&t.hasState(a))&&(i.emit("beforeitemstatechange",{item:t,state:a,enabled:n}),t.setState(e,n),i.autoPaint(),i.emit("afteritemstatechange",{item:t,state:a,enabled:n}))},r.prototype.priorityState=function(t,e){var n=this.graph,i=t;Ne(t)&&(i=n.findById(t)),this.setItemState(i,e,!1),this.setItemState(i,e,!0)},r.prototype.clearItemStates=function(t,e){var n=this.graph;Ne(t)&&(t=n.findById(t)),n.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),n.emit("afteritemstatesclear",{item:t,states:e})},r.prototype.refreshItem=function(t){var e=this.graph;Ne(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},r.prototype.addCombos=function(t,e){var n=this,i=this.graph;(t||[]).forEach(function(o){ea(o,function(s){var u;return e.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(t,e){var n=this,i=this.graph;if(Ne(t)&&(t=i.findById(t)),!t){console.warn("The item to be shown or hidden does not exist!");return}if(i.emit("beforeitemvisibilitychange",{item:t,visible:e}),t.changeVisibility(e),t.getType&&t.getType()===eh){var a=t.getEdges();me(a,function(l){e&&!(l.get("source").isVisible()&&l.get("target").isVisible())||n.changeItemVisibility(l,e)})}else if(t.getType&&t.getType()===wf){var o=i.get("comboTrees"),s=t.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&&(!e||e&&!t.getModel().collapsed)&&u.forEach(function(c){var h=i.findById(c.id);n.changeItemVisibility(h,e)});var a=t.getEdges();me(a,function(c){e&&!(c.get("source").isVisible()&&c.get("target").isVisible())||n.changeItemVisibility(c,e)})}return i.emit("afteritemvisibilitychange",{item:t,visible:e}),t},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),gU=function(){function r(t){this.graph=t,this.destroyed=!1}return r.prototype.updateState=function(t,e,n){var i=this.graph.get("states"),a=e;Ne(n)&&(a="".concat(e,":").concat(n)),i[a]||(i[a]=[]),n?i[a].push(t):i[a]=i[a].filter(function(o){return o!==t}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:i})},r.prototype.updateStates=function(t,e,n){var i=this.graph.get("states"),a=Ne(e)?[e]:e;a.forEach(function(o){var s=o;i[s]||(i[s]=[]),Ne(n)&&(s="".concat(o,":").concat(n)),n?i[s].push(t):i[s]=i[s].filter(function(u){return u!==t})}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:e})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),yU=function(t,e){return!t||!e?t:t.replace(/\\?\{([^{}]+)\}/g,function(n,i){if(n.charAt(0)==="\\")return n.slice(1);var a=e[i];return a===0&&(a="0"),a||""})},DI=function(t){var e=[];if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));for(var n=0,i=t;n<i.length;n++){var a=i[n],o=a.x,s=a.y;e.push(o),e.push(s)}var u=mI(e);return u.unshift(["M",t[0].x,t[0].y]),u},Md=function(t,e,n,i){n===void 0&&(n=0),i===void 0&&(i=0);var a={x:(1-n)*t.x+n*e.x,y:(1-n)*t.y+n*e.y},o=[0,0];To(o,[e.x-t.x,e.y-t.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},mU=function(t,e){var n=t.length;if(!n)return"";for(var i="",a="",o=0;o<n;o++){var s=t[o];o===0?a="M{x} {y}":a="L{x} {y}",i+=yU(a,s)}return e&&(i+="Z"),i},ty=function(t){var e=[];return t.forEach(function(n){var i=n[0];if(i!=="A")for(var a=1;a<n.length;a=a+2)e.push([n[a],n[a+1]]);else{var o=n.length;e.push([n[o-2],n[o-1]])}}),e},ry=function(t){if(t.length<2)throw new Error("point length must larger than 2, now it's ".concat(t.length));var e=t[0],n=t[1],i=t[t.length-1],a=t[t.length-2];t.unshift(i),t.unshift(a),t.push(e),t.push(n);for(var o=[],s=1;s<t.length-2;s+=1){var u=t[s-1].x,f=t[s-1].y,l=t[s].x,c=t[s].y,h=t[s+1].x,d=t[s+1].y,v=s!==t.length-2?t[s+2].x:h,p=s!==t.length-2?t[s+2].y:d,g=l+(h-u)/6,y=c+(d-f)/6,m=h-(v-l)/6,b=d-(p-c)/6;o.push(["C",g,y,m,b,h,d])}return o.unshift(["M",i.x,i.y]),o},$w=function(t,e){return An([0,0],To([0,0],t),e)},Ww=function(t,e){var n=[t[1]-e[1],e[0]-t[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]},Xw=function(t,e){return[e[0]-t[0],e[1]-t[1]]};function ny(r,t){var e=function(c){var h=[c[0][0],c[0][1]-t],d=[c[0][0],c[0][1]+t];return"M ".concat(h," A ").concat(t,",").concat(t,",0,0,0,").concat(d," A ").concat(t,",").concat(t,",0,0,0,").concat(h)},n=function(c){var h=An([0,0],Ww(c[0],c[1]),t),d=An([0,0],h,-1),v=gn([0,0],c[0],h),p=gn([0,0],c[1],h),g=gn([0,0],c[1],d),y=gn([0,0],c[0],d);return"M ".concat(v," L ").concat(p," A ").concat([t,t,"0,0,0",g].join(",")," L ").concat(y," A ").concat([t,t,"0,0,0",v].join(","))};if(!r||r.length<1)return"";if(r.length===1)return e(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],Ww(o,s),t);i[a]=[gn([0,0],o,u),gn([0,0],s,u)]}var f="A ".concat([t,t,"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 kI(r,t){var e=r.length,n=function(l){var c=[l[0][0],l[0][1]-t],h=[l[0][0],l[0][1]+t];return"M ".concat(c," A ").concat([t,t,"0,0,0",h].join(",")," A ").concat([t,t,"0,0,0",c].join(","))},i=function(l){var c=Xw(l[0],l[1]),h=$w(c,t),d=gn([0,0],l[0],An([0,0],h,-1)),v=gn([0,0],l[1],h),p=1.2*t,g=$w(To([0,0],c),p),y=An([0,0],g,-1),m=gn([0,0],d,y),b=gn([0,0],v,y),x=gn([0,0],d,g);return"M ".concat(d," C ").concat([m,b,v].join(",")," S ").concat([x,d].join(",")," Z")};if(!r||e<1)return"";if(e===1)return n(r);if(e===2)return i(r);for(var a=r.map(function(f,l){var c=r[(l+1)%e];return{p:f,v:To([0,0],Xw(f,c))}}),o=0;o<a.length;++o){var s=o>0?o-1:e-1,u=To([0,0],gn([0,0],a[s].v,An([0,0],a[o].v,-1)));a[o].p=gn([0,0],a[o].p,An([0,0],u,t))}return a.map(function(f){var l=f.p;return{x:l[0],y:l[1]}})}var bU=function(t,e){for(var n=[],i=0;i<5;i++){var a=Math.cos((18+72*i)/180*Math.PI)*t,o=Math.sin((18+72*i)/180*Math.PI)*t,s=Math.cos((54+72*i)/180*Math.PI)*e,u=Math.sin((54+72*i)/180*Math.PI)*e;i===0?n.push(["M",a,-o]):n.push(["L",a,-o]),n.push(["L",s,-u])}return n.push(["Z"]),n};const xU=Object.freeze(Object.defineProperty({__proto__:null,getClosedSpline:ry,getControlPoint:Md,getSpline:DI,getStarPath:bU,paddedHull:kI,pathToPoints:ty,pointsToPolygon:mU,roundedHull:ny},Symbol.toStringTag,{value:"Module"}));var Yw=function(t,e,n){return(t.y-n.y)*(e.x-n.x)-(t.x-n.x)*(e.y-n.y)},Vw=function(t){var e=t.map(function(c){return{x:c.getModel().x,y:c.getModel().y}});e.sort(function(c,h){return c.x===h.x?c.y-h.y:c.x-h.x});for(var n={},i=e.length-1;i>=0;i--){var a=e[i],o=a.x,s=a.y;n["".concat(o,"-").concat(s)]&&e.splice(i,1),n["".concat(o,"-").concat(s)]=!0}if(e.length===1)return e;for(var u=[],i=0;i<e.length;i++){for(;u.length>=2&&Yw(u[u.length-2],u[u.length-1],e[i])<=0;)u.pop();u.push(e[i])}for(var f=[],i=e.length-1;i>=0;i--){for(;f.length>=2&&Yw(f[f.length-2],f[f.length-1],e[i])<=0;)f.pop();f.push(e[i])}f.pop(),u.pop();var l=u.concat(f);return l},EU={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 wU(r,t,e){var n=!1,i=function(u,f){return t.cells[u+f*t.width]},a=function(u,f){var l=0;return i(u-1,f-1)>=e&&(l+=1),i(u,f-1)>e&&(l+=2),i(u-1,f)>e&&(l+=4),i(u,f)>e&&(l+=8),l},o=function(u,f){for(var l=u,c=f,h,d,v=0;v<t.width*t.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<t.width&&!n;s+=1)for(var u=0;u<t.height&&!n;u+=1)i(s,u)>e&&a(s,u)!==15&&(n=o(s,u));return n}}var _U=function(t,e,n){var i=Math.ceil(t/n),a=Math.ceil(e/n),o=new Float32Array(Math.max(0,i*a)).fill(0);return{cells:o,width:i,height:a}},SU=function(t,e,n){var i=null,a=Number.POSITIVE_INFINITY;return e.forEach(function(o){var s={x:t.getModel().x,y:t.getModel().y},u={x:o.getModel().x,y:o.getModel().y},f=bd(s,u),l=new Cs(s.x,s.y,u.x,u.y),c=n.reduce(function(h,d){return zm(d,l)>0?h+1:h},0);f*Math.pow(c+1,2)<a&&(i=o,a=f*Math.pow(c+1,2))}),i},PI=function(t,e){var n=Number.POSITIVE_INFINITY,i=null;return t.forEach(function(a){var o=zm(a,e);o>=0&&o<n&&(i=a,n=o)}),i},MU=function(t,e,n,i){var a=[],o=[];o.push(t);for(var s=!0,u=0,f=function(d,v){var p=!1;return v.forEach(function(g){p||(I0(d,{x:g.x1,y:g.y1})||I0(d,{x:g.x2,y:g.y2}))&&(p=!0)}),p},l=function(d,v){for(var p=0,g=v;p<g.length;p++){var y=g[p],m=y.getBBox(),b=[[m.x,m.y],[m.x+m.width,m.y],[m.x,m.y+m.height],[m.x+m.width,m.y+m.height]];if(dl(b,d.x,d.y))return!0}return!1};s&&u<n;){s=!1;for(var c=function(){var d=o.pop(),v=PI(e,d);if(v){var p=xT(v,d),g=p[0],y=p[1];if(y===2){var m=function(x){for(var E=i,w=Hw(v,E,g,x),_=f(w,o)||f(w,a),M=l(w,e);!_&&M&&E>=1;)E/=1.5,w=Hw(v,E,g,x),_=f(w,o)||f(w,a),M=l(w,e);w&&!_&&(!x||!M)&&(o.push(new Cs(d.x1,d.y1,w.x,w.y)),o.push(new Cs(w.x,w.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 CU(r,t,e,n,i){var a=SU(r,e,t);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 Cs(d.x1,d.y1,v.x2,v.y2),g=PI(t,p);g?(h.push(d),c.push(v)):c.push(p)}return h},s=new Cs(r.getModel().x,r.getModel().y,a.getModel().x,a.getModel().y),u=MU(s,t,n,i),f=o(u);return f}var AU=function(t,e,n){var i=Object.assign(EU,n),a=ET(t.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));t=t.sort(function(m,b){return bd({x:m.getModel().x,y:m.getModel().y},a)-bd({x:b.getModel().x,y:b.getModel().y},a)});var o=[],s=[];t.forEach(function(m){var b=CU(m,e,o,i.maxRoutingIterations,i.morphBuffer);b.forEach(function(x){s.push(x)}),o.push(m)});for(var u=TU(t,s,i.nodeR0),f=_U(u.width,u.height,i.pixelGroupSize),l=[],c=[],h=0;h<i.maxMarchingIterations;h++)if(IU(t,e,s,u,f,i),l=[],c=[],!!new wU(l,f,i.threshold).march()){var d=l.map(function(m){return{x:Math.round(m.x*i.pixelGroupSize+u.minX),y:Math.round(m.y*i.pixelGroupSize+u.minY)}});if(d){var v=d.length;if(i.skip>1)for(v=Math.floor(d.length/i.skip);v<3&&i.skip>1;)i.skip-=1,v=Math.floor(d.length/i.skip);for(var p=0,g=0;g<v;g+=1,p+=i.skip)c.push({x:d[p].x,y:d[p].y})}var y=function(){for(var b=0,x=t;b<x.length;b++){var E=x[b],w=c.map(function(_){return[_.x,_.y]});if(!dl(w,E.getBBox().centerX,E.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&&e.length>0)i.nonMemberInfluenceFactor*=.8;else break}return c};function TU(r,t,e){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())}),t.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)-e,n.minY=(s.minY<n.minY?s.minY:n.minY)-e,n.maxX=(s.maxX>n.maxX?s.maxX:n.maxX)+e,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+e}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}function IU(r,t,e,n,i,a){function o(d,v){var p=Math.floor((d-v)/a.pixelGroupSize);return p<0?0:p}function s(d,v){return d*a.pixelGroupSize+v}var u=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),f=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1),l=function(v,p){var g=Math.min(o(v.minX,p+n.minX),i.width),y=Math.min(o(v.minY,p+n.minY),i.height),m=Math.min(o(v.maxX,-p+n.minX),i.width),b=Math.min(o(v.maxY,-p+n.minY),i.height);return[g,y,m,b]},c=function(v,p){for(var g=v.getBBox(),y=l(g,a.nodeR1),m=y[0],b=y[1],x=y[2],E=y[3],w=b;w<E;w+=1)for(var _=m;_<x;_+=1)if(!(p<0&&i[_+w*i.width]<=0)){var M=s(_,n.minX),C=s(w,n.minY),S=_T({x:M,y:C},{x:g.minX,y:g.minY,width:g.width,height:g.height});if(S<Math.pow(a.nodeR1,2)){var A=Math.sqrt(S)-a.nodeR1;i.cells[_+w*i.width]+=p*A*A}}},h=function(v,p){for(var g=v.getBBox(),y=l(g,a.edgeR1),m=y[0],b=y[1],x=y[2],E=y[3],w=b;w<E;w+=1)for(var _=m;_<x;_+=1)if(!(p<0&&i.cells[_+w*i.width]<=0)){var M=s(_,n.minX),C=s(w,n.minY),S=wT({x:M,y:C},v);if(S<Math.pow(a.edgeR1,2)){var A=Math.sqrt(S)-a.edgeR1;i.cells[_+w*i.width]+=p*A*A}}};a.nodeInfluenceFactor&&r.forEach(function(d){c(d,a.nodeInfluenceFactor/u)}),a.edgeInfluenceFactor&&e.forEach(function(d){h(d,a.edgeInfluenceFactor/f)}),a.negativeNodeInfluenceFactor&&t.forEach(function(d){c(d,a.negativeNodeInfluenceFactor/u)})}function Hw(r,t,e,n){var i=r.getBBox(),a=e[0],o=e[1],s=e[2],u=e[3],f={topLeft:{x:i.minX-t,y:i.minY-t},topRight:{x:i.maxX+t,y:i.minY-t},bottomLeft:{x:i.minX-t,y:i.maxY+t},bottomRight:{x:i.maxX+t,y:i.maxY+t}},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 NI=function(){function r(t,e){this.cfg=mr(this.getDefaultCfg(),e),this.graph=t,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map(function(n){return Ne(n)?t.findById(n):n}),this.nonMembers=this.cfg.nonMembers.map(function(n){return Ne(n)?t.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 t=this.members.length&&this.members[0].getKeyShape().getCanvasBBox().width/2;this.padding=this.cfg.padding>0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},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(t,e){var n,i,a;switch(this.type){case"round-convex":n=Vw(t),a=ny(n.map(function(o){return[o.x,o.y]}),this.padding),i=q0(a);break;case"smooth-convex":n=Vw(t),n.length===2?(a=ny(n.map(function(o){return[o.x,o.y]}),this.padding),i=q0(a)):n.length>2&&(a=kI(n.map(function(o){return[o.x,o.y]}),this.padding),i=ry(a));break;case"bubble":n=AU(t,e,this.cfg.bubbleCfg),i=n.length>=2&&ry(n);break}return i},r.prototype.render=function(){this.group.addShape("path",{attrs:F({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},r.prototype.addMember=function(t){if(t){Ne(t)&&(t=this.graph.findById(t)),this.members.push(t);var e=this.nonMembers.indexOf(t);return e>-1&&this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.addNonMember=function(t){if(t){Ne(t)&&(t=this.graph.findById(t)),this.nonMembers.push(t);var e=this.members.indexOf(t);return e>-1&&this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.removeMember=function(t){if(t){Ne(t)&&(t=this.graph.findById(t));var e=this.members.indexOf(t);return e>-1?(this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.removeNonMember=function(t){if(t){Ne(t)&&(t=this.graph.findById(t));var e=this.nonMembers.indexOf(t);return e>-1?(this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.updateData=function(t,e){var n=this;this.group.findById(this.id).remove(),t&&(this.members=t.map(function(i){return Ne(i)?n.graph.findById(i):i})),e&&(this.nonMembers=e.map(function(i){return Ne(i)?n.graph.findById(i):i})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.updateStyle=function(t){var e=this.group.findById(this.id);e.attr(F({},t))},r.prototype.updateCfg=function(t){var e=this;this.cfg=mr(this.cfg,t),this.id=this.cfg.id,this.group=this.cfg.group,t.members&&(this.members=this.cfg.members.map(function(n){return Ne(n)?e.graph.findById(n):n})),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return Ne(n)?e.graph.findById(n):n})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.contain=function(t){var e=this,n;Ne(t)?n=this.graph.findById(t):n=t;var i,a=n.getKeyShape();if(n.get("type")==="path")i=ty(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=e.graph.getPointByCanvas(s[0],s[1]);return[u.x,u.y]}),bT(i,ty(this.path))},r.prototype.destroy=function(){this.group.remove(),this.cfg=null},r}(),_f=xi,OU="node",RI=function(r){Ot(t,r);function t(e){var n=r.call(this)||this;return n.sortCombos=Nl(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=mr(n.getDefaultCfg(),e),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new Eu(n.cfg.maxStep),n.redoStack=new Eu(n.cfg.maxStep)),n}return t.prototype.init=function(){this.initCanvas();var e=new sU(this),n=new Cz(this),i=new pU(this),a=new gU(this);this.set({viewController:e,modeController:n,itemController:i,stateController:a}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},t.prototype.initGroups=function(){var e=this.get("canvas");if(e){var n=e.get("el"),i=(n||{}).id,a=i===void 0?"g6":i,o=e.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)}},t.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}},t.prototype.set=function(e,n){return yn(e)?this.cfg=F(F({},this.cfg),e):this.cfg[e]=n,e==="enabledStack"&&n&&!this.undoStack&&!this.redoStack&&(this.undoStack=new Eu(this.cfg.maxStep),this.redoStack=new Eu(this.cfg.maxStep)),this},t.prototype.get=function(e){var n;return(n=this.cfg)===null||n===void 0?void 0:n[e]},t.prototype.getGroup=function(){return this.get("group")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.getMinZoom=function(){return this.get("minZoom")},t.prototype.setMinZoom=function(e){return this.set("minZoom",e)},t.prototype.getMaxZoom=function(){return this.get("maxZoom")},t.prototype.setMaxZoom=function(e){return this.set("maxZoom",e)},t.prototype.getWidth=function(){return this.get("width")},t.prototype.getHeight=function(){return this.get("height")},t.prototype.clearItemStates=function(e,n){Ne(e)&&(e=this.findById(e));var i=this.get("itemController");n||(n=e.get("states")),i.clearItemStates(e,n);var a=this.get("stateController");a.updateStates(e,n,!1)},t.prototype.node=function(e){typeof e=="function"&&this.set("nodeMapper",e)},t.prototype.edge=function(e){typeof e=="function"&&this.set("edgeMapper",e)},t.prototype.combo=function(e){typeof e=="function"&&this.set("comboMapper",e)},t.prototype.findById=function(e){return this.get("itemMap")[e]},t.prototype.find=function(e,n){var i,a=this.get("".concat(e,"s"));return me(a,function(o,s){if(n(o,s))return i=o,i}),i},t.prototype.findAll=function(e,n){var i=[];return me(this.get("".concat(e,"s")),function(a,o){n(a,o)&&i.push(a)}),i},t.prototype.findAllByState=function(e,n,i){return i?this.findAll(e,function(a){return a.hasState(n)&&i(a)}):this.findAll(e,function(a){return a.hasState(n)})},t.prototype.translate=function(e,n,i,a){var o=this,s=this.get("group"),u=Vt(s.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),i){var f=vl({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:s.getMatrix()})}});T0(s,{x:s.getCanvasBBox().x+e,y:s.getCanvasBBox().y+n},i,f||{duration:500,easing:"easeCubic"})}else u=_f(u,[["t",e,n]]),s.setMatrix(u),this.emit("viewportchange",{action:"translate",matrix:u}),this.autoPaint()},t.prototype.moveTo=function(e,n,i,a){var o=this.get("group");T0(o,{x:e,y:n},i,a||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},t.prototype.fitView=function(e,n,i,a){e&&this.set("fitViewPadding",e);var o=this.get("viewController");n?o.fitViewByRules(n,i,a):o.fitView(i,a),this.autoPaint()},t.prototype.fitCenter=function(e,n){var i=this.get("viewController");i.fitCenter(e,n),this.autoPaint()},t.prototype.addBehaviors=function(e,n){var i=this.get("modeController");return i.manipulateBehaviors(e,n,!0),this},t.prototype.removeBehaviors=function(e,n){var i=this.get("modeController");return i.manipulateBehaviors(e,n,!1),this},t.prototype.updateBehavior=function(e,n,i){var a=this.get("modeController");return a.updateBehavior(e,n,i),this},t.prototype.zoom=function(e,n,i,a){var o=this,s=this.get("group"),u=Vt(s.getMatrix())||[1,0,0,0,1,0,0,0,1],f=this.get("minZoom"),l=this.get("maxZoom"),c=this.getZoom()||1,h=c*e,d=e,v=!1;if(f&&h<f?(d=f/c,v=!0):l&&h>l&&(d=l/c,v=!0),n?u=_f(u,[["t",-n.x,-n.y],["s",d,d],["t",n.x,n.y]]):u=_f(u,[["s",d,d]]),i){var p=Vt(s.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var g=p[0],y=g*d,m=vl({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:s.getMatrix()})}});s.animate(function(b){if(b===1)p=u;else{var x=jm(g,y,b)/p[0];n?p=_f(p,[["t",-n.x,-n.y],["s",x,x],["t",n.x,n.y]]):p=_f(p,[["s",x,x]])}return{matrix:p}},m)}else s.setMatrix(u),this.emit("viewportchange",{action:"zoom",matrix:u}),this.autoPaint();return!v},t.prototype.zoomTo=function(e,n,i,a){var o=e/this.getZoom();return this.zoom(o,n,i,a)},t.prototype.focusItem=function(e,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(e,o,s),this.autoPaint()},t.prototype.focusItems=function(e,n,i,a){var o=this.get("viewController");o.focusItems(e,n,i,a)},t.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},t.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},t.prototype.getPointByClient=function(e,n){var i=this.get("viewController");return i.getPointByClient(e,n)},t.prototype.getClientByPoint=function(e,n){var i=this.get("viewController");return i.getClientByPoint(e,n)},t.prototype.getPointByCanvas=function(e,n){var i=this.get("viewController");return i.getPointByCanvas(e,n)},t.prototype.getCanvasByPoint=function(e,n){var i=this.get("viewController");return i.getCanvasByPoint(e,n)},t.prototype.getGraphCenterPoint=function(){var e=this.get("group").getCanvasBBox();return{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}},t.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},t.prototype.showItem=function(e,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(e,!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})}},t.prototype.hideItem=function(e,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(e,!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})}},t.prototype.refreshItem=function(e){var n=this.get("itemController");n.refreshItem(e)},t.prototype.setAutoPaint=function(e){var n=this;n.set("autoPaint",e);var i=n.get("canvas");i.set("autoDraw",e)},t.prototype.remove=function(e,n){n===void 0&&(n=!0),this.removeItem(e,n)},t.prototype.removeItem=function(e,n){n===void 0&&(n=!0);var i=e;if(Ne(e)&&(i=this.findById(e)),!i&&Ne(e))console.warn("The item ".concat(e," to be removed does not exist!"));else if(i){var a="";if(i.getType&&(a=i.getType()),n&&this.get("enabledStack")){var o=F(F({},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(F(F({},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=P0(this.get("comboTrees"));this.set("comboTrees",h)}}},t.prototype.innerAddItem=function(e,n,i){if(!Mz(e,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(e==="combo"){var s=this.get("itemMap"),u=!1;if(o.forEach(function(v){u||ea(v,function(p){if(n.parentId===p.id){u=!0;var g=F({id:n.id,depth:p.depth+2},n);p.children?p.children.push(g):p.children=[g],n.depth=g.depth,a=i.addItem(e,n)}var y=s[p.id];return u&&y&&y.getType&&y.getType()==="combo"&&i.updateCombo(y,p.children),!0})}),!u){var f=F({id:n.id,depth:0},n);n.depth=f.depth,o.push(f),a=i.addItem(e,n)}this.set("comboTrees",o),n.collapsed&&(this.collapseCombo(a,!1),this.updateCombo(a))}else if(e==="node"&&Ne(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(e,n);var c=this.get("itemMap"),h=!1,d=!1;o.forEach(function(v){d||h||ea(v,function(p){if(p.id===n.id)return d=!0,!1;if(n.comboId===p.id&&!d){h=!0;var g=Vt(n);g.itemType="node",p.children?p.children.push(g):p.children=[g],g.depth=p.depth+1}return h&&c[p.id].getType&&c[p.id].getType()==="combo"&&i.updateCombo(c[p.id],p.children),!0})})}else a=i.addItem(e,n);if(e==="node"&&n.comboId||e==="combo"&&n.parentId){var l=this.findById(n.comboId||n.parentId);l&&l.getType&&l.getType()==="combo"&&l.addChild(a)}return a},t.prototype.addItem=function(e,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(e,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=F(F({},u.getModel()),{itemType:e}),c={};switch(e){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},t.prototype.addItems=function(e,n,i){e===void 0&&(e=[]),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<e.length;u++){var f=e[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<e.length;u++){var f=e[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<e.length;u++){var h=e[u].type,d=s[u];if(d&&d!==!0){var v=F(F({},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},t.prototype.add=function(e,n,i,a){return i===void 0&&(i=!0),a===void 0&&(a=!0),this.addItem(e,n,i,a)},t.prototype.updateItem=function(e,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController"),s;Ne(e)?s=this.findById(e):s=e;var u=i&&this.get("enabledStack"),f;u&&(f=Vt(s.getModel()));var l="";s.getType&&(l=s.getType());var c=ri([],s.getStates(),!0);if(l==="combo"&&me(c,function(p){return a.setItemState(s,p,!1)}),o.updateItem(s,n),l==="combo"&&me(c,function(p){return a.setItemState(s,p,!0)}),u){var h={nodes:[],edges:[],combos:[]},d={nodes:[],edges:[],combos:[]},v=F({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})}},t.prototype.update=function(e,n,i){i===void 0&&(i=!0),this.updateItem(e,n,i)},t.prototype.setItemState=function(e,n,i){Ne(e)&&(e=this.findById(e));var a=this.get("itemController");a.setItemState(e,n,i);var o=this.get("stateController");o.updateState(e,n,i)},t.prototype.priorityState=function(e,n){var i=this.get("itemController");i.priorityState(e,n)},t.prototype.data=function(e){zE(e),this.set("data",e)},t.prototype.render=function(){var e=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"),e.addItems(a.map(function(g){return{type:"node",model:g}}),!1,!1),(f==null?void 0:f.length)!==0){var l=k0(f,a);this.set("comboTrees",l),e.addCombos(f)}e.addItems(s.map(function(g){return{type:"edge",model:g}}),!1,!1);var c=e.get("animate");(e.get("fitView")||e.get("fitCenter"))&&e.set("animate",!1);var h=e.get("layoutController");if(h){if(h.layout(d),this.destroyed)return}else d();function d(){(e.get("comboTrees")||[]).forEach(function(g){ea(g,function(y){var m=e.findById(y.id);return m.getType()==="combo"&&y.collapsed&&(e.collapseCombo(y.id,!1),e.updateCombo(m)),!0})}),e.get("fitView")?e.fitView():e.get("fitCenter")&&e.fitCenter(),e.autoPaint(),e.emit("afterrender"),(e.get("fitView")||e.get("fitCenter"))&&e.set("animate",c),setTimeout(function(){var g;(g=e.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()})}},t.prototype.read=function(e){this.data(e),this.render()},t.prototype.diffItems=function(e,n,i){var a=this,o,s=this.get("itemMap");me(i,function(u){if(o=s[u.id],o){if(a.get("animate")&&e===OU){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(e,u,!1);o&&n["".concat(e,"s")].push(o)})},t.prototype.changeData=function(e,n){var i=this,a;n===void 0&&(n=!0);var o=this,s=e||o.get("data");if(!zE(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(x){return o.clearItemStates(x)}),this.getEdges().map(function(x){return o.clearItemStates(x)});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=k0(h,s.nodes);this.set("comboTrees",d)}else this.set("comboTrees",[]);this.diffItems("node",c,s.nodes),me(l,function(x,E){l[E].getModel().depth=0,!(x.getType&&x.getType()==="edge")&&(x.getType&&x.getType()==="combo"?(delete l[E],x.destroy()):c.nodes.indexOf(x)<0&&(delete l[E],o.remove(x,!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),me(l,function(x,E){x.getType&&(x.getType()==="node"||x.getType()==="combo")||c.edges.indexOf(x)<0&&(delete l[E],o.remove(x,!1))}),(this.get("comboTrees")||[]).forEach(function(x){ea(x,function(E){var w=i.findById(E.id);return w.getType()==="combo"&&E.collapsed&&i.collapseCombo(E.id,!1),!0})}),this.set({nodes:c.nodes,edges:c.edges});var y=(this.get("layout")||{}).relayoutAtChangeData,m=y===void 0?!0:y,b=this.get("layoutController");return m&&b&&(b.changeData(function(){setTimeout(function(){var x;(x=o.getCombos())===null||x===void 0||x.forEach(function(E){E.set("animate",!0)})},0)}),o.get("animate")&&!b.getLayoutType()?(o.positionsAnimate(),(a=o.getCombos())===null||a===void 0||a.forEach(function(x){return x.set("animate",!0)})):o.autoPaint()),setTimeout(function(){u.set("localRefresh",f)},16),this.set("data",s),this.emit("afterchangedata"),this},t.prototype.addCombos=function(e){var n=this,i=n.get("comboTrees"),a=this.get("itemController");a.addCombos(i,e)},t.prototype.createCombo=function(e,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController");this.set("comboSorted",!1);var s="",u;if(e){if(Ne(e))s=e,u={id:e};else{if(s=e.id,!s){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}u=e}var f=i&&this.get("enabledStack"),l={nodes:[],combos:[]};f&&n.forEach(function(y){var m=a.findById(y),b=m.getType();if(!(b!=="node"&&b!=="combo")){var x=m.getModel();l["".concat(b,"s")].push({id:y,parentId:b==="node"?x.comboId:x.parentId})}});var c=this.get("comboTrees"),h=new Set(n),d=new Map;c&&(c.forEach(function(y){ea(y,function(m,b,x){if(h.has(m.id)){if(b){var E=a.findById(b.id),w=a.findById(m.id);b.children.splice(x,1),E.removeChild(w),o.updateCombo(E,b.children)}m.itemType==="combo"&&d.set(m.id,m)}return!0})}),c=c.filter(function(y){return!h.has(y.id)}),this.set("comboTrees",c));var v={nodes:[],combos:[]},p=n.map(function(y){var m=a.findById(y),b=m.getModel(),x="";m.getType&&(x=m.getType());var E=d.get(y)||{id:m.getID(),itemType:x};return x==="combo"?(E.parentId=s,b.parentId=s):x==="node"&&(E.comboId=s,b.comboId=s),f&&v["".concat(x,"s")].push({id:b.id,parentId:s}),E});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)}},t.prototype.uncombo=function(e,n){var i=this,a,o;n===void 0&&(n=!0);var s=this,u=e;if(Ne(e)&&(u=this.findById(e)),!u||u.getType&&u.getType()!=="combo"){console.warn("The item is not a combo!");return}var f=u.getModel(),l=u.getModel().parentId,c=s.get("comboTrees");c||(c=[]);var h=this.get("itemMap"),d=u.get("id"),v,p=[],g=this.get("combos"),y=this.findById(l),m=n&&this.get("enabledStack"),b={};if(m&&(b=Vt(f),b.children=[]),c.forEach(function(_){v||ea(_,function(M){var C;if(M.id===d){v=M;var S=u.getEdges().map(function(I){return I.getID()});S.forEach(function(I){i.removeItem(I,!1)});var A=g.indexOf(u);g.splice(A,1),delete h[d];var T=Vt(u.getModel());u.destroy(),i.emit("afterremoveitem",{item:T,type:"combo"})}if(l&&v&&M.id===l){y.removeCombo(u),p=M.children;var A=p.indexOf(v);return A!==-1&&p.splice(A,1),(C=v.children)===null||C===void 0||C.forEach(function(D){var N=i.findById(D.id),P=N.getModel();N.getType&&N.getType()==="combo"?(D.parentId=l,delete D.comboId,P.parentId=l,delete P.comboId):N.getType&&N.getType()==="node"&&(D.comboId=l,P.comboId=l),y.addChild(N),p.push(D)}),i.updateCombo(y),!1}return!0})}),!l&&v){var x=c.indexOf(v);c.splice(x,1),(a=v.children)===null||a===void 0||a.forEach(function(_){_.parentId=void 0;var M=i.findById(_.id).getModel();delete M.parentId,delete M.comboId,_.itemType!=="node"&&c.push(_)})}if(m){var E={nodes:[],combos:[]},w={nodes:[],combos:[]};(o=v.children)===null||o===void 0||o.forEach(function(_){var M=i.findById(_.id),C=M.getType();C!=="node"&&C!=="combo"||(E["".concat(C,"s")].push({id:_.id,parentId:d}),w["".concat(C,"s")].push({id:_.id,parentId:l}))}),E.combos.push(b),this.pushStack("uncombo",{before:E,after:w})}},t.prototype.updateCombos=function(e){var n=this;e===void 0&&(e=!1);var i=this,a=this.get("comboTrees"),o=i.get("itemController"),s=i.get("itemMap");(a||[]).forEach(function(u){ea(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=ri([],c.getStates(),!0);me(h,function(d){return n.setItemState(c,d,!1)}),o.updateCombo(c,f.children,e),me(h,function(d){return n.setItemState(c,d,!0)})}return!0})}),i.sortCombos()},t.prototype.updateCombo=function(e){var n=this,i=this,a=e,o;if(Ne(e)&&(a=this.findById(e)),!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){ea(l,function(c){if(!c)return!0;var h=f[c.id];if(o===c.id&&h&&h.getType&&h.getType()==="combo"){var d=ri([],h.getStates(),!0);me(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!1)}),u.updateCombo(h,c.children),me(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!0)}),o&&(o=c.parentId)}return!0})})},t.prototype.updateComboTree=function(e,n,i){i===void 0&&(i=!0);var a=this;this.set("comboSorted",!1);var o;Ne(e)?o=a.findById(e):o=e;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(b){if(!h)return b.id===o.getID()&&(h=b),!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=P0(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},t.prototype.save=function(){var e=[],n=[],i=[];return me(this.get("nodes"),function(a){e.push(a.getModel())}),me(this.get("edges"),function(a){n.push(a.getModel())}),me(this.get("combos"),function(a){i.push(a.getModel())}),{nodes:e,edges:n,combos:i}},t.prototype.changeSize=function(e,n){var i=this.get("viewController");return i.changeSize(e,n),this},t.prototype.refresh=function(){var e=this;if(e.emit("beforegraphrefresh"),e.get("animate"))e.positionsAnimate();else{var n=e.get("nodes"),i=e.get("edges"),a=e.get("edges");me(n,function(o){o.refresh()}),me(i,function(o){o.refresh()}),me(a,function(o){o.refresh()})}e.emit("aftergraphrefresh"),e.autoPaint()},t.prototype.getNodes=function(){return this.get("nodes")},t.prototype.getEdges=function(){return this.get("edges")},t.prototype.getCombos=function(){return this.get("combos")},t.prototype.getComboChildren=function(e){if(Ne(e)&&(e=this.findById(e)),!e||e.getType&&e.getType()!=="combo"){console.warn("The combo does not exist!");return}return e.getChildren()},t.prototype.positionsAnimate=function(e){var n=this;n.emit("beforeanimate");var i=n.get("animateCfg"),a=i.onFrame,o=e?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){me(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(e)},{duration:i.duration,easing:i.easing,callback:function(){me(o,function(l){l.set("originAttrs",null)}),i.callback&&i.callback(),n.emit("afteranimate"),n.animating=!1}})},0)},t.prototype.refreshPositions=function(e){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){me(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&&(e&&l(s),n.updateCombos()),me(a,function(c){var h=c.getSource().getModel(),d=c.getTarget();if(!yn(d)){var v=d.getModel();(f[h.id]||f[v.id]||c.getModel().isComboEdge)&&c.refresh()}}),me(o,function(c){c.refresh()}),n.emit("aftergraphrefreshposition"),n.autoPaint()},t.prototype.stopAnimate=function(){var e=this.get("canvas"),n=e.cfg.timeline;n&&n.stopAllAnimations()},t.prototype.isAnimating=function(){return this.animating},t.prototype.getZoom=function(){var e=this.get("group").getMatrix();return e?e[0]:1},t.prototype.getCurrentMode=function(){var e=this.get("modeController");return e.getMode()},t.prototype.setMode=function(e){var n=this.get("modeController");return n.setMode(e),this},t.prototype.clear=function(e){var n;return e===void 0&&(e=!1),(n=this.get("canvas"))===null||n===void 0||n.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),e||this.emit("afterrender"),this},t.prototype.updateLayout=function(e,n,i,a){var o=this;e===void 0&&(e={}),a===void 0&&(a=!0);var s=this.get("layoutController");if(Ne(e)&&(e={type:e}),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(e.type)||!e.type&&f.includes(s==null?void 0:s.layoutType)?e.center=[u.x,u.y]:this.once("afterlayout",function(h){var d=o.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];u.x=u.x*d[0]+d[6],u.y=u.y*d[0]+d[7];var v=o.getGroup().getCanvasBBox(),p=v.minX,g=v.maxX,y=v.minY,m=v.maxY,b={x:(p+g)/2,y:(y+m)/2};n==="begin"&&(b.x=p,b.y=y),o.translate(u.x-b.x,u.y-b.y)})}var l=F({},this.get("layout")),c={};Object.assign(c,l,e),e.pipes&&!e.type?delete c.type:!e.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}))},t.prototype.destroyLayout=function(){var e=this.get("layoutController");e==null||e.destroyLayout()},t.prototype.layout=function(){var e,n=this.get("layoutController"),i=this.get("layout");if(!(!i||!n)){if(i.workerEnabled){n.layout();return}!((e=n.layoutMethods)===null||e===void 0)&&e.length?n.relayout(!0):n.layout()}},t.prototype.collapseCombo=function(e,n){var i=this;if(n===void 0&&(n=!0),!this.destroyed){if(Ne(e)&&(e=this.findById(e)),!e){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"collapse",item:e});var a=e.getModel(),o=this.get("itemController");o.collapseCombo(e,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(),b=null,x;if(y.getModel().id===a.id||u.includes(y)&&!u.includes(m)?(b=m,x=!1):(m.getModel().id===a.id||!u.includes(y)&&u.includes(m))&&(b=y,x=!0),b){if(v){i.removeItem(h,!1);return}for(var E=b.getModel();!b.isVisible();){var w=E.parentId,_=E.comboId,M=w||_;if(b=i.findById(M),!b||!M)return;E=b.getModel()}var C=E.id,S=x?{source:C,target:a.id,size:g,isVEdge:!0}:{source:a.id,target:C,size:g,isVEdge:!0},A="".concat(S.source,"-").concat(S.target);if(c[A]){c[A].size+=g;return}c[A]=S}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:e})}},t.prototype.expandCombo=function(e,n){var i=this;if(n===void 0&&(n=!0),Ne(e)&&(e=this.findById(e)),!e||e.getType&&e.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:e});var a=e.getModel(),o=this.get("itemController");o.expandCombo(e,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 b=h.getModel(),x=b.isVEdge,E=b.size,w=E===void 0?1:E;if(x){i.removeItem(h,!1);return}for(var _=y.getModel();!y.isVisible();){var M=_.parentId,C=_.comboId,S=M||C;if(y=i.findById(S),!y||!S)return;_=y.getModel()}for(var A=_.id,T=m?v:d,I=T.getModel();!T.isVisible();){var D=I.parentId,N=I.comboId,P=D||N;if(T=i.findById(P),!T||!P)return;if(I.comboId===a.id||I.parentId===a.id)break;I=T.getModel()}var G=I.id;if(A){var W=m?{source:A,target:G,isVEdge:!0,size:w}:{source:G,target:A,isVEdge:!0,size:w},k="".concat(W.source,"-").concat(W.target);if(c[k]){c[k].size+=w;return}c[k]=W}}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:e})},t.prototype.collapseExpandCombo=function(e,n){if(n===void 0&&(n=!0),Ne(e)&&(e=this.findById(e)),!(!e||e.getType&&e.getType()!=="combo")){for(var i=e.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(e,n):this.collapseCombo(e,n),this.updateCombo(e)}},t.prototype.getNeighbors=function(e,n){var i=e;return Ne(e)&&(i=this.findById(e)),i.getNeighbors(n)},t.prototype.getNodeDegree=function(e,n,i){n===void 0&&(n=void 0),i===void 0&&(i=!1);var a=e;Ne(e)&&(a=this.findById(e));var o=this.get("degrees");(!o||i)&&(o=Ka(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},t.prototype.getUndoStack=function(){return this.undoStack},t.prototype.getRedoStack=function(){return this.redoStack},t.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},t.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear(),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack}))},t.prototype.pushStack=function(e,n,i){if(e===void 0&&(e="update"),i===void 0&&(i="undo"),!this.get("enabledStack")){console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !");return}var a=n?Vt(n):{before:{},after:Vt(this.save())};i==="redo"?this.redoStack.push({action:e,data:a}):this.undoStack.push({action:e,data:a}),this.emit("stackchange",{action:e,stackType:i,undoStack:this.undoStack,redoStack:this.redoStack})},t.prototype.getAdjMatrix=function(e,n){e===void 0&&(e=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix");return(!i||!e)&&(i=Ms(this.save(),n),this.set("adjMatrix",i)),i},t.prototype.getShortestPathMatrix=function(e,n){e===void 0&&(e=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix"),a=this.get("shortestPathMatrix");return(!i||!e)&&(i=Ms(this.save(),n),this.set("adjMatrix",i)),(!a||!e)&&(a=hl(this.save(),n),this.set("shortestPathMatrix",a)),a},t.prototype.on=function(e,n,i){return r.prototype.on.call(this,e,n,i)},t.prototype.destroy=function(){var e,n,i,a,o;this.emit("beforedestroy"),this.clear(),this.clearStack(),(e=this.get("itemController"))===null||e===void 0||e.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")},t.prototype.createHull=function(e){if(!e.members||e.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[e.id])return console.warn("Existed hull id."),i[e.id];var a=n.addGroup({id:"".concat(e.id,"-container")}),o=new NI(this,F(F({},e),{group:a})),s=o.id;return i[s]=o,o},t.prototype.getHulls=function(){return this.get("hullMap")},t.prototype.getHullById=function(e){return this.get("hullMap")[e]},t.prototype.removeHull=function(e){var n,i;Ne(e)?i=this.getHullById(e):i=e,(n=this.get("hullMap"))===null||n===void 0||delete n[i.id],i.destroy()},t.prototype.removeHulls=function(){var e=this.getHulls();!e||!Object.keys(e).length||(Object.keys(e).forEach(function(n){var i=e[n];i.destroy()}),this.set("hullMap",{}))},t}(DC);function iy(r){"@babel/helpers - typeof";return iy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iy(r)}var nu=xi,Kw="-shape",Cg="-label",rh=["startArrow","endArrow"],qw={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},LU={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},nh={edge:LU,node:qw,combo:qw},ay="-label-bg",Zm={options:{labelCfg:{style:{fontFamily:lt.windowFontFamily}},descriptionCfg:{style:{fontFamily:lt.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return e==="move"||e!=null&&e.includes("bbox")?t:mr({},this.options,this.getCustomConfig(t)||{},t)},draw:function(t,e){e.shapeMap={},this.mergeStyle=this.getOptions(t);var n=this.drawShape(t,e);if(n.set("className",this.itemType+Kw),e.shapeMap[this.itemType+Kw]=n,t.label){var i=this.drawLabel(t,e);i.set("className",this.itemType+Cg),e.shapeMap[this.itemType+Cg]=i}return n},afterDraw:function(t,e,n){},drawShape:function(t,e){return null},drawLabel:function(t,e){var n=(this.mergeStyle||this.getOptions(t)||{}).labelCfg,i=n||{},a=this.getLabelStyle(t,i,e),o=a.rotate;delete a.rotate;var s=e.addShape("text",{attrs:a,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.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=nu(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":f=nu(f,[["t",-a.x,-a.y],["r",o],["t",a.x,a.y]]);break;case"leftcenter":f=nu(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);break;default:f=nu(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else f=nu(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(t,e,s),c=this.itemType+ay;l.set("classname",c),e.shapeMap[c]=l,s.toFront()}return s},drawLabelBg:function(t,e,n){var i=this.options.labelCfg,a=yt({},i,t.labelCfg),o=this.getLabelBgStyleByPosition(n,a),s=e.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return e.shapeMap["text-bg-shape"]=s,s},getLabelStyleByPosition:function(t,e,n){return{text:t.label}},getLabelBgStyleByPosition:function(t,e){return{}},getLabelStyle:function(t,e,n){var i=this.getLabelStyleByPosition(t,e,n),a="".concat(this.itemType,"Label"),o=lt[a]?lt[a].style:null;return F(F(F({},o),i),e.style)},getShapeStyle:function(t){return t.style},update:function(t,e,n){this.updateShapeStyle(t,e,n),this.updateLabel(t,e,n)},updateShapeStyle:function(t,e,n){var i,a=e.getContainer(),o=e.getKeyShape(),s=yt({},o.attr(),t.style),u=function(c){var h,d=s[c];if(yn(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(t,e,n){var i,a,o=e.getContainer(),s=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,u=s===void 0?{}:s,f=this.itemType+Cg,l=o.shapeMap[f]||o.find(function(x){return x.get("className")===f}),c=this.itemType+ay,h=o.shapeMap[c]||o.find(function(x){return x.get("className")===c});if(l&&t.label===void 0&&(o.removeChild(l),delete o.shapeMap[f],h&&(o.removeChild(h),delete o.shapeMap[c])),t.label||t.label==="")if(l){(!n||n==="bbox|label"||this.itemType==="edge"&&n!=="style")&&(u=mr(u,t.labelCfg));var v=this.getLabelStyleByPosition(t,u,o),p=(i=t.labelCfg)===null||i===void 0?void 0:i.style,g=F(F({},v),p),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=nu(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(t,o,l),h.set("classname",c),o.shapeMap[c]=h,l.toFront());else if(g.background){var b=this.getLabelBgStyleByPosition(l,u);h.attr(b)}else o.removeChild(h)}else{var d=this.drawLabel(t,o);d.set("className",f),o.shapeMap[f]=d}},afterUpdate:function(t,e){},setState:function(t,e,n){var i,a,o,s=n.get("keyShape");if(!(!s||s.destroyed)){var u=n.getType(),f=Pl(e)?t:"".concat(t,":").concat(e),l=this.getStateStyle(f,n),c=n.getStateStyle(f);if(!(!c&&!l)){var h=yt({},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),e){var p=function(P){var G,W=h[P];if(yn(W)&&!rh.includes(P)){var k=((o=d.shapeMap)===null||o===void 0?void 0:o[P])||d.find(function(R){return R.get("name")===P});k==null||k.attr(W)}else s.attr((G={},G[P]=W,G))};for(var g in h)p(g)}else{var y=Yh(n.getCurrentStatesStyle()),m=n.getModel(),b=yt({},m.style,Yh(n.getOriginStyle())),x=s.get("name"),E=s.attr(),w={};Object.keys(E).forEach(function(N){if(N!=="img"){var P=E[N];P&&iy(P)==="object"?w[N]=Vt(P):w[N]=P}});var _={},M=function(P){var G=h[P];if(yn(G)&&!rh.includes(P)){var W=d.shapeMap[P]||d.find(function(Y){return Y.get("name")===P});if(W){var k=Yh(W.attr());me(G,function(Y,J){if(P===x&&w[J]&&!v[J]){delete w[J];var te=b[P][J]||nh[u][J];s.attr(J,te)}else if(k[J]||k[J]===0){delete k[J];var H=b[P][J]||nh[u][J];W.attr(J,H)}}),_[P]=k}}else if(w[P]&&!v[P]){delete w[P];var R=b[P]||(b[x]?b[x][P]:void 0)||nh[u][P];s.attr(P,R)}};for(var C in h)M(C);x?_[x]=w:yt(_,w);for(var g in y)if(!v[g]){var S=y[g];(!yn(S)||rh.includes(g))&&(x?(yt(b[x],(a={},a[g]=S,a)),delete b[g]):yt(b,(i={},i[g]=S,i)),delete y[g])}var A={};mr(A,b,_,y);var T=!1,I=function(P){var G,W,k=A[P];if(yn(k)&&!rh.includes(P)){var R=d.shapeMap[P]||d.find(function(J){return J.get("name")===P});R&&((R.get("type")==="text"||R.get("labelRelated"))&&(delete k.x,delete k.y,delete k.matrix),P===x&&(u==="combo"&&(delete k.r,delete k.width,delete k.height),T=!0),R.attr(k))}else if(!T){var Y=k||nh[u][P];u==="combo"?x||s.attr((G={},G[P]=Y,G)):s.attr((W={},W[P]=Y,W))}};for(var D in A)I(D)}}}},getStateStyle:function(t,e){var n=e.getModel(),i=e.getType(),a=this.getOptions(n),o=a.stateStyles,s=a.style,u=s===void 0?{}:s,f=n.stateStyles?n.stateStyles[t]:o&&o[t];return i==="combo"?Vt(f):yt({},u,f)},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e,n,i=(t==null?void 0:t.anchorPoints)||((e=this.getCustomConfig(t))===null||e===void 0?void 0:e.anchorPoints)||((n=this.options)===null||n===void 0?void 0:n.anchorPoints);return i}},DU={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:lt.nodeLabel.offset,getSize:function(t){var e,n=((e=this.mergeStyle)===null||e===void 0?void 0:e.size)||t.size||this.getOptions({}).size||lt.defaultNode.size;return gt(n)&&n.length===1&&(n=[n[0],n[0]]),gt(n)||(n=[n,n]),n},getLabelStyleByPosition:function(t,e){var n=e.maxLength,i=t.label;n&&(i=IT(i,n));var a=e.position||this.labelPosition;if(a==="center")return{x:0,y:0,text:i,textBaseline:"middle",textAlign:"center"};var o=e.offset;ct(o)&&(o=this.offset);var s=this.getSize(t),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(t,e){var n;if(!t)return{};var i=(n=e.style)===null||n===void 0?void 0:n.background;if(!i)return{};var a=t.getBBox(),o=Km(i.padding),s=a.width+o[1]+o[3],u=a.height+o[0]+o[2];return F(F({x:a.minX-o[3],y:a.minY-o[0]},i),{width:s,height:u})},drawShape:function(t,e){var n=this.shapeType,i=this.getShapeStyle(t),a=e.addShape(n,{attrs:i,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=a,a},updateLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,i=e.shapeMap["link-point-left"]||e.find(function(A){return A.get("className")==="link-point-left"}),a=e.shapeMap["link-point-right"]||e.find(function(A){return A.get("className")==="link-point-right"}),o=e.shapeMap["link-point-top"]||e.find(function(A){return A.get("className")==="link-point-top"}),s=e.shapeMap["link-point-bottom"]||e.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=yt({},u,t.linkPoints),l=f.fill,c=f.stroke,h=f.lineWidth,d=f.size/2;d||(d=f.r);var v=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},p=v.left,g=v.right,y=v.top,m=v.bottom,b=this.getSize(t),x=b[0],E=b[1],w={r:d,fill:l,stroke:c,lineWidth:h};if(i)!p&&p!==void 0?(i.remove(),delete e.shapeMap["link-point-left"]):i.attr(F(F({},w),{x:-x/2,y:0}));else if(p){var _="link-point-left";e.shapeMap[_]=e.addShape("circle",{attrs:F(F({},w),{x:-x/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(a)!g&&g!==void 0&&(a.remove(),delete e.shapeMap["link-point-right"]),a.attr(F(F({},w),{x:x/2,y:0}));else if(g){var M="link-point-right";e.shapeMap[M]=e.addShape("circle",{attrs:F(F({},w),{x:x/2,y:0}),className:M,name:M,isAnchorPoint:!0})}if(o)!y&&y!==void 0&&(o.remove(),delete e.shapeMap["link-point-top"]),o.attr(F(F({},w),{x:0,y:-E/2}));else if(y){var C="link-point-top";e.shapeMap[C]=e.addShape("circle",{attrs:F(F({},w),{x:0,y:-E/2}),className:C,name:C,isAnchorPoint:!0})}if(s)!m&&m!==void 0?(s.remove(),delete e.shapeMap["link-point-bottom"]):s.attr(F(F({},w),{x:0,y:E/2}));else if(m){var S="link-point-bottom";e.shapeMap[S]=e.addShape("circle",{attrs:F(F({},w),{x:0,y:E/2}),className:S,name:S,isAnchorPoint:!0})}},updateShape:function(t,e,n,i,a){var o=e.get("keyShape");o.attr(F({},n)),this.updateLabel(t,e,a),i&&this.updateIcon(t,e)},updateIcon:function(t,e){var n=this,i=e.getContainer(),a=(this.mergeStyle||this.getOptions(t)).icon,o=t.icon?t.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=yt({},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(F(F({},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:F({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:F(F({},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()}}},kU=F(F({},Zm),DU);br.registerNode("single-node",kU);var ih="edge-shape";function PU(r){var t=r;return r==="start"?t="end":r==="end"&&(t="start"),t}var NU={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:F({},lt.edgeStateStyles)},getPath:function(t){var e=[];return me(t,function(n,i){i===0?e.push(["M",n.x,n.y]):e.push(["L",n.x,n.y])}),e},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},i=yt({},e,n,t.style),a=t.size||lt.defaultEdge.size;t=this.getPathPoints(t);var o=t.startPoint,s=t.endPoint,u=this.getControlPoints(t),f=[o];u&&(f=f.concat(u)),f.push(s);var l=this.getPath(f),c=yt({},lt.defaultEdge.style,{stroke:lt.defaultEdge.color,lineWidth:a,path:l},i);return c},updateShapeStyle:function(t,e,n){var i,a=e.getContainer(),o=((i=e.getKeyShape)===null||i===void 0?void 0:i.call(e))||a.shapeMap["edge-shape"],s=t.size;t=this.getPathPoints(t);var u=t.startPoint,f=t.endPoint,l=this.getControlPoints(t),c=[u];l&&(c=c.concat(l)),c.push(f);var h=o.attr(),d=t.style||{};d.stroke===void 0&&(d.stroke=t.color);var v=t.sourceNode,p=t.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&&(t.style.endArrow={path:""}),h.startArrow&&d.startArrow===!1&&(t.style.startArrow={path:""}),m=F({},t.style),m.lineWidth===void 0&&(m.lineWidth=(ht(s)?s:s==null?void 0:s[0])||h.lineWidth),m.path===void 0&&(m.path=y),m.stroke===void 0&&(m.stroke=h.stroke||t.color)),o&&o.attr(m)},getLabelStyleByPosition:function(t,e,n){var i=e.position||this.labelPosition,a={},o=n==null?void 0:n.shapeMap[ih],s;i==="start"?s=0:i==="end"?s=1:s=.5;var u=e.refX||this.refX,f=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return a.x=t.startPoint.x+u,a.y=t.startPoint.y+f,a.text=t.label,a;var l;ct(e.autoRotate)?l=this.labelAutoRotate:l=e.autoRotate;var c=CT(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=t.label,a},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var n=t.getBBox(),i=e.style&&e.style.background;if(!i)return{};var a=i.padding,o=n.width+a[1]+a[3],s=n.height+a[0]+a[2],u=F(F({},i),{width:o,height:s,x:n.minX-a[3],y:n.minY-a[0],matrix:[1,0,0,0,1,0,0,0,1]}),f;return ct(e.autoRotate)?f=this.labelAutoRotate:f=e.autoRotate,f&&(u.matrix=t.attr("matrix")||[1,0,0,0,1,0,0,0,1]),u},_getTextAlign:function(t,e){var n="center";return e?(e=e%(Math.PI*2),t!=="center"&&(e>=0&&e<=Math.PI/2||e>=3/2*Math.PI&&e<2*Math.PI?n=t:n=PU(t)),n):t},getControlPoints:function(t){return t.controlPoints},getPathPoints:function(t){return t},drawShape:function(t,e){var n=this.getShapeStyle(t),i=e.addShape("path",{className:ih,name:ih,attrs:n});return e.shapeMap[ih]=i,i},drawLabel:function(t,e){var n=this.options.labelCfg,i=mr({},n,t.labelCfg),a=this.getLabelStyle(t,i,e),o=a.rotate;delete a.rotate;var s=e.addShape("text",{attrs:a,name:"text-shape",labelRelated:!0,draggable:!0});if(e.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""&&s.rotateAtStart(o),a.background){var u=this.drawLabelBg(t,e,s,a,o),f=this.itemType+ay;u.set("classname",f),e.shapeMap[f]=u,s.toFront()}return s},drawLabelBg:function(t,e,n,i,a){var o=this.options.labelCfg,s=mr({},o,t.labelCfg),u=this.getLabelBgStyleByPosition(n,s),f=e.addShape("rect",{name:"text-bg-shape",attrs:u,labelRelated:!0});return e.shapeMap["text-bg-shape"]=f,f}},RU=F(F({},Zm),NU);br.registerEdge("single-edge",RU);br.registerEdge("line",{getControlPoints:function(){}},"single-edge");br.registerEdge("spline",{getPath:function(t){var e=DI(t);return e}},"single-edge");br.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(t){var e=t.startPoint,n=t.endPoint,i={x:(e.x+n.x)/2,y:(e.y+n.y)/2},a,o;if(t.controlPoints!==void 0){if(o=t.controlPoints[0],a=A0(e,o,n),e.x<=n.x&&e.y>n.y?this.clockwise=a.x>o.x?0:1:e.x<=n.x&&e.y<n.y?this.clockwise=a.x>o.x?1:0:e.x>n.x&&e.y<=n.y?this.clockwise=a.y<o.y?0:1:this.clockwise=a.y<o.y?1:0,(o.x-e.x)/(o.y-e.y)===(n.x-e.x)/(n.y-e.y))return[]}else{t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),gt(t.curveOffset)&&(t.curveOffset=t.curveOffset[0]),t.curveOffset<0?this.clockwise=0:this.clockwise=1;var s={x:n.x-e.x,y:n.y-e.y},u=Math.atan2(s.y,s.x);o={x:t.curveOffset*Math.cos(-Math.PI/2+u)+i.x,y:t.curveOffset*Math.sin(-Math.PI/2+u)+i.y},a=A0(e,o,n)}var f=md(e,a),l=[{x:f,y:f}];return l},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),t.length===2?e.push(["L",t[1].x,t[1].y]):e.push(["A",t[1].x,t[1].y,0,0,this.clockwise,t[2].x,t[2].y]),e}},"single-edge");br.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(t){var e=t.controlPoints;if(!e||!e.length){var n=t.startPoint,i=t.endPoint;t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),gt(t.curveOffset)&&(t.curveOffset=t.curveOffset[0]),gt(t.curvePosition)&&(t.curvePosition=t.curveOffset[0]);var a=Md(n,i,t.curvePosition,t.curveOffset);e=[a]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["Q",t[1].x,t[1].y,t[2].x,t[2].y]),e}},"single-edge");br.registerEdge("cubic",{curvePosition:[1/2,1/2],curveOffset:[-20,20],getControlPoints:function(t){var e=t.controlPoints;if(t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),ht(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),ht(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]),!e||!e.length||e.length<2){var n=t.startPoint,i=t.endPoint,a=Md(n,i,t.curvePosition[0],t.curveOffset[0]),o=Md(n,i,t.curvePosition[1],t.curveOffset[1]);e=[a,o]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["C",t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y]),e}},"single-edge");br.registerEdge("cubic-vertical",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,n=t.endPoint;t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.minCurveOffset===void 0&&(t.minCurveOffset=this.minCurveOffset),ht(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),ht(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),ht(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var i=n.y-e.y,a=[0,0];t.curveOffset?a=t.curveOffset:Math.abs(i)<Math.abs(t.minCurveOffset[0])&&(a=t.minCurveOffset);var o={x:e.x,y:e.y+i*this.curvePosition[0]+a[0]},s={x:n.x,y:n.y-i*this.curvePosition[1]+a[1]};return[o,s]}},"cubic");br.registerEdge("cubic-horizontal",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,n=t.endPoint;t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.minCurveOffset===void 0&&(t.minCurveOffset=this.minCurveOffset),ht(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),ht(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),ht(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var i=n.x-e.x,a=[0,0];t.curveOffset?a=t.curveOffset:Math.abs(i)<Math.abs(t.minCurveOffset[0])&&(a=t.minCurveOffset);var o={x:e.x+i*this.curvePosition[0]+a[0],y:e.y},s={x:n.x-i*this.curvePosition[1]+a[1],y:n.y},u=[o,s];return u}},"cubic");br.registerEdge("loop",{getPathPoints:function(t){return MT(t)},getControlPoints:function(t){return t.controlPoints},afterDraw:function(t){t.controlPoints=void 0},afterUpdate:function(t){t.controlPoints=void 0}},"cubic");var BU={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:F({},lt.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},getSize:function(t){var e=Vt(t.size||this.options.size||lt.defaultCombo.size);return gt(e)&&e.length===1&&(e=[e[0],e[0]]),gt(e)||(e=[e,e]),e},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition,i=t.style,a=t.padding||this.options.padding;gt(a)&&(a=Math.max.apply(Math,a));var o=e.refX,s=e.refY;ct(o)&&(o=this.refX),ct(s)&&(s=this.refY);var u=this.getSize(t),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:t.label,textAlign:"center"};break;default:c={x:l+o,y:0,textAlign:"right"};break}return c.text=t.label,c},drawShape:function(t,e){var n=this.shapeType,i=this.getShapeStyle(t),a=e.addShape(n,{attrs:i,draggable:!0,name:"combo-shape"});return a},updateCollapsedIcon:function(t,e,n){var i=t.collapsed,a=t.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=e.getContainer(),d=h.find(function(y){return y.get("name")==="combo-collapsed-substitute-icon"}),v=d&&!d.destroyed,p=e.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:F({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(t,e,n){var i=this,a=e.get("keyShape"),o=e.get("animate"),s=o&&(t.animate===void 0?this.options.animate:t.animate);s&&a.animate?(t.collapsed||this.updateCollapsedIcon(t,e,n),a.animate(n,{duration:200,easing:"easeLinear",callback:function(){t.collapsed&&i.updateCollapsedIcon(t,e,n)}})):(a.attr(F({},n)),this.updateCollapsedIcon(t,e,n)),this.updateLabel(t,e)}},FU=F(F({},Zm),BU);br.registerCombo("single-combo",FU);br.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:F({},lt.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"circle",labelPosition:"top",drawShape:function(t,e){var n=this.getShapeStyle(t);delete n.height,delete n.width;var i=e.addShape("circle",{attrs:n,className:"circle-combo",name:"circle-combo",draggable:!0});return i},getShapeStyle:function(t){var e=this.options.style,n=t.padding||this.options.padding;gt(n)&&(n=Math.max.apply(Math,n));var i={stroke:t.color},a=yt({},e,i,t.style),o=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize,s;if(o)s=ht(o)?o/2:o[0]/2;else{var u=this.getSize(t);!ht(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=F({x:0,y:0},a);return t.style?t.style.r=s:t.style={r:s},f},update:function(t,e){var n=this.getSize(t),i=t.padding||this.options.padding;gt(i)&&(i=Math.max.apply(Math,i));var a=Vt(t.style),o=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize,s;o?s=ht(o)?o/2:o[0]/2:s=Math.max(a.r,n[0]/2)||n[0]/2,a.r=s+i;var u=e.get("sizeCache");u&&(u.r=a.r);var f={stroke:t.color},l=e.get("keyShape"),c=yt({},l.attr(),f,a);t.style?t.style.r=s:t.style={r:s},this.updateShape(t,e,c,!0)}},"single-combo");br.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:F({},lt.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"rect",labelPosition:"top",drawShape:function(t,e){var n=this.getShapeStyle(t),i=e.addShape("rect",{attrs:n,className:"rect-combo",name:"rect-combo",draggable:!0});return i},getLabelStyleByPosition:function(t,e){var n=e.position||this.labelPosition,i=t.style,a=t.padding||this.options.padding;ht(a)&&(a=[a,a,a,a]);var o=e.refX,s=e.refY;ct(o)&&(o=this.refX),ct(s)&&(s=this.refY);var u=-i.width/2-a[3],f=i.width/2+a[1],l=-i.height/2-a[0],c=i.height/2+a[2],h;switch(n){case"top":h={x:u+o,y:l+s,textBaseline:"top",textAlign:"left"};break;case"bottom":h={x:0,y:c+s,textBaseline:"top",textAlign:"center"};break;case"left":h={x:u+s,y:0,textAlign:"left"};break;case"center":h={x:0,y:0,text:t.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=t.label,h},getShapeStyle:function(t){var e=this.options.style,n=t.padding||this.options.padding;ht(n)&&(n=[n,n,n,n]);var i={stroke:t.color},a=yt({},e,i,t.style),o=this.getSize(t),s,u,f=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;f?ht(f)?(s=f,u=f):(s=f[0],u=f[1]):(!ht(a.width)||isNaN(a.width)?s=o[0]||lt.defaultCombo.style.width:s=Math.max(a.width,o[0])||o[0],!ht(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=F({x:l,y:c},a);return t.style?(t.style.width=s,t.style.height=u):t.style={width:s,height:u},h},update:function(t,e){var n=this.getSize(t),i=t.padding||this.options.padding;ht(i)&&(i=[i,i,i,i]);var a=Vt(t.style),o,s,u=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;u?ht(u)?(o=u,s=u):(o=u[0],s=u[1]):(o=Math.max(a.width,n[0])||n[0],s=Math.max(a.height,n[1])||n[1]),a.width=o+i[1]+i[3],a.height=s+i[0]+i[2];var f=e.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:t.color},c=e.get("keyShape"),h=yt({},c.attr(),l,a);t.style?(t.style.width=o,t.style.height=s):t.style={width:o,height:s},this.updateShape(t,e,h,!1)}},"single-combo");br.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:F({},lt.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",shapeMap:{},drawShape:function(t,e){var n=this.getShapeStyle(t),i="".concat(this.type,"-keyShape"),a=e.addShape("circle",{attrs:n,className:"".concat(this.type,"-keyShape"),name:i,draggable:!0});return e.shapeMap[i]=a,a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=mr({},e,n),a=this.getSize(t),o=a[0]/2,s=F({x:0,y:0,r:o},i);return s},update:function(t,e,n){var i=this.getSize(t),a={stroke:t.color,r:i[0]/2},o=e.get("keyShape"),s=mr({},o.attr(),a,t.style);this.updateShape(t,e,s,!0,n)}},"single-node");br.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:F({},lt.nodeStateStyles)},shapeType:"simple-rect",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t),i=e.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return i},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=yt({},e,n),a=this.getSize(t),o=i.width||a[0],s=i.height||a[1],u=F({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(t,e,n){e.getContainer();var i=(this.mergeStyle||this.getOptions(t)).style,a=this.getSize(t),o=e.get("keyShape");t.size||(a[0]=o.attr("width")||i.width,a[1]=o.attr("height")||i.height);var s={stroke:t.color,x:-a[0]/2,y:-a[1]/2,width:a[0],height:a[1]},u=yt({},i,o.attr(),s);u=yt(u,t.style),this.updateShape(t,e,u,!1,n)}},"single-node");br.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(t,e){var n=this.shapeType,i=this.getShapeStyle(t);delete i.fill;var a=e.addShape(n,{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return this.drawClip(t,a),a},drawClip:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).clipCfg;if(n.show){var i=n.type,a=n.x,o=n.y,s=n.style;if(i==="circle"){var u=n.r;e.setClip({type:"circle",attrs:F({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;e.setClip({type:"rect",attrs:F({x:c,y:h,width:f,height:l},s)})}else if(i==="ellipse"){var d=n.rx,v=n.ry;e.setClip({type:"ellipse",attrs:F({x:a,y:o,rx:d,ry:v},s)})}else if(i==="polygon"){var p=n.points;e.setClip({type:"polygon",attrs:F({points:p},s)})}else if(i==="path"){var g=n.path;e.setClip({type:"path",attrs:F({path:g},s)})}}},getShapeStyle:function(t){var e=this.mergeStyle||this.getOptions(t),n=e.style,i=e.img,a=this.getSize(t),o=a[0],s=a[1];n&&(o=n.width||a[0],s=n.height||a[1]);var u=F({x:-o/2,y:-s/2,width:o,height:s,img:i},n);return u},updateShapeStyle:function(t,e){var n=e.getContainer(),i="".concat(this.itemType,"-shape"),a=n.shapeMap[i]||n.find(function(s){return s.get("className")===i})||e.getKeyShape(),o=this.getShapeStyle(t);a&&!a.destroyed&&a.attr(o)}},"single-node");const BI={triangle:function(t,e,n){t===void 0&&(t=10),e===void 0&&(e=15),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",0 L ").concat(i+e,",-").concat(t/2," L ").concat(i+e,",").concat(t/2," Z");return a},vee:function(t,e,n){t===void 0&&(t=15),e===void 0&&(e=20),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",0 L ").concat(i+e,",-").concat(t/2,`
7
- L `).concat(i+2*e/3,",0 L ").concat(i+e,",").concat(t/2," Z");return a},circle:function(t,e){t===void 0&&(t=5),e===void 0&&(e=0);var n=e*2,i="M ".concat(n,`, 0
8
- a `).concat(t,",").concat(t," 0 1,0 ").concat(t*2,`,0
9
- a `).concat(t,",").concat(t," 0 1,0 ").concat(-t*2,",0");return i},rect:function(t,e,n){t===void 0&&(t=10),e===void 0&&(e=10),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",").concat(-t/2,`
10
- L `).concat(i+e,",").concat(-t/2,`
11
- L `).concat(i+e,",").concat(t/2,`
12
- L `).concat(i,",").concat(t/2," Z");return a},diamond:function(t,e,n){t===void 0&&(t=15),e===void 0&&(e=15),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,`,0
13
- L `).concat(i+e/2,",").concat(-t/2,`
14
- L `).concat(i+e,`,0
15
- L `).concat(i+e/2,",").concat(t/2," Z");return a},triangleRect:function(t,e,n,i,a,o){t===void 0&&(t=15),e===void 0&&(e=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+e+a,f="M ".concat(s,",0 L ").concat(s+e,",-").concat(t/2," L ").concat(s+e,",").concat(t/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}},FI={collapse:function(t,e,n){return[["M",t-n,e],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",t-n+4,e],["L",t+n-4,e]]},expand:function(t,e,n){return[["M",t-n,e],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",t-n+4,e],["L",t-n+2*n-4,e],["M",t-n+n,e-n+4],["L",t,e+n-4]]},upTriangle:function(t,e,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",t-i,e+a],["L",t+i,e+a],["L",t,e-n],["Z"]]},downTriangle:function(t,e,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",t-i,e-a],["L",t+i,e-a],["L",t,e+n],["Z"]]}};var GU=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"];const zU=Object.freeze(Object.defineProperty({__proto__:null,defaultSubjectColors:GU},Symbol.toStringTag,{value:"Module"}));var GI=function(t){return t==="force"||t==="g6force"||t==="gForce"||t==="force2"};const jU=Object.freeze(Object.defineProperty({__proto__:null,isForce:GI},Symbol.toStringTag,{value:"Module"}));var UU=xi,_n=F(F(F(F(F(F(F({},tU),Sz),xU),pz),zU),jU),{transform:UU,mat3:GC}),zI=function(){function r(t){this.graph=t,this.layoutCfg=t.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(t){var e=t.type;if(e)return e;var n=t.pipes;return Array.isArray(n)?n.map(function(i){return(i==null?void 0:i.type)||""}):null},r.prototype.isLayoutTypeSame=function(t){var e=this.getLayoutCfgType(t),n=Array.isArray(this.layoutType),i=Array.isArray(e);return n&&i?this.layoutType.every(function(a,o){return a===e[o]}):Array.isArray(e)||Array.isArray(this.layoutType)?!1:(t==null?void 0:t.type)===this.layoutType},r.prototype.refreshLayout=function(){var t=this,e=t.graph,n=t.layoutType,i=t.layoutCfg,a=i===void 0?{}:i;if(e){var o=a.animate,s=o===void 0&&(n==="force"||n==="force2"),u=GI(n)&&(o||s);e.get("animate")&&!u?e.positionsAnimate(n==="comboCombined"):e.refreshPositions(n==="comboCombined")}},r.prototype.changeLayout=function(t){var e=t.disableTriggerLayout,n=sn(t,["disableTriggerLayout"]);this.layoutCfg=n,this.layoutType=n.type||this.layoutType,!e&&this.layout()},r.prototype.changeData=function(t){this.layout(t)},r.prototype.destoryLayoutMethods=function(){var t=this.layoutMethods,e=[];return t==null||t.forEach(function(n){var i,a=(i=n.getType)===null||i===void 0?void 0:i.call(n);a&&e.push(a),n.destroy()}),this.layoutMethods=[],e},r.prototype.destroyLayout=function(){this.destoryLayoutMethods();var t=this.graph;t&&!t.get("destroyed")&&t.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0},r.prototype.setDataFromGraph=function(){for(var t,e=[],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}e.push(p)}}for(var g=l.length,d=0;d<g;d++){var y=l[d];if(!(!y||y.destroyed)){var p=y.getModel();if(!y.isVisible()){a.push(p);continue}p.isComboEdge?o.push(p):i.push(p)}}for(var m=c.length,d=0;d<m;d++){var b=c[d];if(!b.destroyed){var p=b.getModel();if(!b.isVisible()){u.push(p);continue}s.push(p)}}return{nodes:e,hiddenNodes:n,edges:i,hiddenEdges:a,combos:s,hiddenCombos:u,comboEdges:o,vedges:(t=this.graph.get("vedges"))===null||t===void 0?void 0:t.map(function(x){return x.getModel()})}},r.prototype.relayout=function(t){var e=this,n=this,i=n.graph,a=n.layoutMethods,o=n.layoutCfg;if(!(!i||i.get("destroyed"))){var s=Promise.resolve();if(t){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=e.execLayoutMethod(c,l);return l===a.length-1&&((h=o.onAllLayoutEnd)===null||h===void 0||h.call(o)),d})})}},r.prototype.filterLayoutData=function(t,e){var n=t.nodes,i=t.edges,a=sn(t,["nodes","edges"]);if(!n)return t;var o,s;Cr(e==null?void 0:e.nodesFilter)?o=e.nodesFilter:o=function(){return!0};var u=n.filter(o);if(Cr(e==null?void 0:e.edgesFilter))s=e.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 F({nodes:u,edges:i.filter(s)},a)},r.prototype.getLayoutBBox=function(t){var e=this.graph,n=dd(e.getNodes(),function(o){return o.getModel().layoutOrder}),i=Object.values(n).map(function(o){var s=EI(o);return s.size=[s.width,s.height],s}),a=Object.values(dd(t,"layoutOrder"));return{groupNodes:a,layoutNodes:i}},r.prototype.layoutAnimate=function(){},r.prototype.moveToZero=function(){var t=this.graph,e=t.get("data"),n=e.nodes;if(!(n[0].x===void 0||n[0].x===null||na(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(t,e){var n;return Hn(this,void 0,void 0,function(){var i,a,o;return Kn(this,function(s){return i=this.graph,e!=null&&e.length?(a=e.filter(function(u){return na(u.x)||na(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=t[0]-u/2,p=t[1]-f/2,g=0;g<o;g++){var y=a[g];na(+y.x)&&(y.x=g%l*h+v),na(+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}(),jI=function(){function r(t){this.graph=t,this.destroyed=!1,this.initEvents()}return r}(),Za=br.registerNode,UI=br.registerEdge,$U=br.registerCombo,$I=vm.registerBehavior,Je=lt;lt.version,br.registerNode,br.registerEdge,br.registerCombo,vm.registerBehavior;var Qm={},Zt={},vv={},ko={};Object.defineProperty(ko,"__esModule",{value:!0});ko.MESSAGE=ko.ALGORITHM=void 0;var WU={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"};ko.ALGORITHM=WU;var XU={SUCCESS:"SUCCESS",FAILURE:"FAILURE"};ko.MESSAGE=XU;var pv={},WI={},Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.default=void 0;var YU=function(t,e){var n=t.nodes,i=t.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,e||(a[c][l]=1))}),a},VU=YU;Ps.default=VU;var gv={},yv={},Ru={};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.default=Ru.LinkedListNode=void 0;var HU=function(t,e){return t===e},oy=function(){function r(t,e){e===void 0&&(e=null),this.value=t,this.next=e}return r.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},r}();Ru.LinkedListNode=oy;var KU=function(){function r(t){t===void 0&&(t=HU),this.head=null,this.tail=null,this.compare=t}return r.prototype.prepend=function(t){var e=new oy(t,this.head);return this.head=e,this.tail||(this.tail=e),this},r.prototype.append=function(t){var e=new oy(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},r.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},r.prototype.find=function(t){var e=t.value,n=e===void 0?void 0:e,i=t.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 t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},r.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},r.prototype.fromArray=function(t){var e=this;return t.forEach(function(n){return e.append(n)}),this},r.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},r.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},r.prototype.toString=function(t){return t===void 0&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},r}(),qU=KU;Ru.default=qU;Object.defineProperty(yv,"__esModule",{value:!0});yv.default=void 0;var ZU=QU(Ru);function QU(r){return r&&r.__esModule?r:{default:r}}var JU=function(){function r(){this.linkedList=new ZU.default}return r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},r.prototype.enqueue=function(t){this.linkedList.append(t)},r.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toString=function(t){return this.linkedList.toString(t)},r}(),e$=JU;yv.default=e$;var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.uniqueId=Jr.getOutEdgesNodeId=Jr.getNeighbors=Jr.getEdgesByNodeId=void 0;var t$=function(t,e,n){e===void 0&&(e=[]);var i=e.filter(function(u){return u.source===t||u.target===t});if(n==="target"){var a=function(f){return f.source===t};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===t};return i.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===t?f.target:f.source};return i.map(s)};Jr.getNeighbors=t$;var r$=function(t,e){return e.filter(function(n){return n.source===t})};Jr.getOutEdgesNodeId=r$;var n$=function(t,e){return e.filter(function(n){return n.source===t||n.target===t})};Jr.getEdgesByNodeId=n$;var i$=function(t){t===void 0&&(t=0);var e="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(t,"-").concat(e).concat(n)};Jr.uniqueId=i$;Object.defineProperty(gv,"__esModule",{value:!0});gv.default=void 0;var a$=s$(yv),o$=Jr;function s$(r){return r&&r.__esModule?r:{default:r}}function u$(r){r===void 0&&(r={});var t=r,e=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return t.allowTraversal=r.allowTraversal||n,t.enter=r.enter||e,t.leave=r.leave||e,t}var f$=function(t,e,n,i){i===void 0&&(i=!0);var a=u$(n),o=new a$.default,s=t.edges,u=s===void 0?[]:s;o.enqueue(e);for(var f="",l=function(){var h=o.dequeue();a.enter({current:h,previous:f}),(0,o$.getNeighbors)(h,u,i?"target":void 0).forEach(function(d){a.allowTraversal({previous:f,current:h,next:d})&&o.enqueue(d)}),a.leave({current:h,previous:f}),f=h};!o.isEmpty();)l()},l$=f$;gv.default=l$;var Po={};Object.defineProperty(Po,"__esModule",{value:!0});Po.default=c$;Po.detectStrongConnectComponents=Po.detectConnectedComponents=void 0;var XI=Jr,YI=function(t){for(var e=t.nodes,n=e===void 0?[]:e,i=t.edges,a=i===void 0?[]:i,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=(0,XI.getNeighbors)(v.id,a),g=function(b){var x=p[b];if(!s[x]){var E=n.filter(function(w){return w.id===x});E.length>0&&d(E[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};Po.detectConnectedComponents=YI;var VI=function(t){for(var e=t.nodes,n=e===void 0?[]:e,i=t.edges,a=i===void 0?[]:i,o=[],s={},u={},f={},l=[],c=0,h=function g(y){u[y.id]=c,f[y.id]=c,c+=1,o.push(y),s[y.id]=!0;for(var m=(0,XI.getNeighbors)(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x<m.length;x++)b(x);if(f[y.id]===u[y.id]){for(var E=[];o.length>0;){var w=o.pop();if(s[w.id]=!1,E.push(w),w===y)break}E.length>0&&l.push(E)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};Po.detectStrongConnectComponents=VI;function c$(r,t){return t?VI(r):YI(r)}var Va={};Object.defineProperty(Va,"__esModule",{value:!0});Va.getOutDegree=Va.getInDegree=Va.default=void 0;var xl=function(t){var e={},n=t.nodes,i=n===void 0?[]:n,a=t.edges,o=a===void 0?[]:a;return i.forEach(function(s){e[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){e[s.source].degree++,e[s.source].outDegree++,e[s.target].degree++,e[s.target].inDegree++}),e},h$=xl;Va.default=h$;var d$=function(t,e){var n=xl(t);return n[e]?xl(t)[e].inDegree:0};Va.getInDegree=d$;var v$=function(t,e){var n=xl(t);return n[e]?xl(t)[e].outDegree:0};Va.getOutDegree=v$;var oa={},mv={};Object.defineProperty(mv,"__esModule",{value:!0});mv.default=y$;var p$=Jr;function g$(r){r===void 0&&(r={});var t=r,e=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return t.allowTraversal=r.allowTraversal||n,t.enter=r.enter||e,t.leave=r.leave||e,t}function HI(r,t,e,n,i){i===void 0&&(i=!0),n.enter({current:t,previous:e});var a=r.edges,o=a===void 0?[]:a;(0,p$.getNeighbors)(t,o,i?"target":void 0).forEach(function(s){n.allowTraversal({previous:e,current:t,next:s})&&HI(r,s,t,n,i)}),n.leave({current:t,previous:e})}function y$(r,t,e,n){n===void 0&&(n=!0),HI(r,t,"",g$(e),n)}function sy(r){"@babel/helpers - typeof";return sy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sy(r)}Object.defineProperty(oa,"__esModule",{value:!0});oa.detectAllUndirectedCycle=oa.detectAllDirectedCycle=oa.detectAllCycles=oa.default=void 0;var m$=x$(mv),KI=b$(Po),qI=Jr;function ZI(r){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(ZI=function(i){return i?e:t})(r)}function b$(r,t){if(!t&&r&&r.__esModule)return r;if(r===null||sy(r)!=="object"&&typeof r!="function")return{default:r};var e=ZI(t);if(e&&e.has(r))return e.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)){var o=i?Object.getOwnPropertyDescriptor(r,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=r[a]}return n.default=r,e&&e.set(r,n),n}function x$(r){return r&&r.__esModule?r:{default:r}}var E$=function(t){var e=null,n=t.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]){e={};for(var p=d,g=v;g!==d;)e[p]=g,p=g,g=a[g];e[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 e?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];(0,m$.default)(t,l,f)}return e},QI=function(t,e,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=(0,KI.default)(t,!1),u=0,f=s;u<f.length;u++){var l=f[u];if(l.length)for(var c=l[0],h=c.id,d=[c],v=(i={},i[h]=c,i),p=(a={},a[h]=new Set,a);d.length>0;)for(var g=d.pop(),y=g.id,m=(0,qI.getNeighbors)(y,t.edges),b=function(w){var _,M=m[w],C=t.nodes.find(function(N){return N.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),e&&n?(S=!1,A.findIndex(function(N){return e.indexOf(N.id)>-1})>-1&&(S=!0)):e&&!n&&A.findIndex(function(N){return e.indexOf(N.id)>-1})>-1&&(S=!1),S){for(var I={},D=1;D<A.length;D+=1)I[A[D-1].id]=A[D];A.length&&(I[A[A.length-1].id]=A[0]),o.push(I)}p[M].add(g)}},x=0;x<m.length;x+=1)b(x)}return o};oa.detectAllUndirectedCycle=QI;var JI=function(t,e,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 D=I.pop();a.has(D)&&(a.delete(D),o[D.id].forEach(function(N){I.push(N)}),o[D.id].clear())}},c=function A(T,I,D){var N=!1;if(e&&n===!1&&e.indexOf(T.id)>-1)return N;i.push(T),a.add(T);for(var P=D[T.id],G=0;G<P.length;G+=1){var W=u[P[G]];if(W===I){for(var k={},R=1;R<i.length;R+=1)k[i[R-1].id]=i[R];i.length&&(k[i[i.length-1].id]=i[0]),s.push(k),N=!0}else a.has(W)||A(W,I,D)&&(N=!0)}if(N)l(T);else for(var G=0;G<P.length;G+=1){var W=u[P[G]];o[W.id].has(T)||o[W.id].add(T)}return i.pop(),N},h=t.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(e&&n)for(var y=function(T){var I=e[T];f[d[T].id]=f[I],f[I]=0,u[0]=d.find(function(D){return D.id===I}),u[f[d[T].id]]=d[T]},v=0;v<e.length;v++)y(v);for(var m=function(T){for(var I,D,N=1/0,P=0;P<T.length;P+=1)for(var G=T[P],W=0;W<G.length;W++){var k=f[G[W].id];k<N&&(N=k,D=P)}for(var R=T[D],Y=[],P=0;P<R.length;P+=1){var J=R[P];Y[J.id]=[];for(var te=0,H=(0,qI.getNeighbors)(J.id,t.edges,"target").filter(function(Le){return R.map(function(qe){return qe.id}).indexOf(Le)>-1});te<H.length;te++){var pe=H[te];pe===J.id&&!(n===!1&&e.indexOf(J.id)>-1)?s.push((I={},I[J.id]=J,I)):Y[J.id].push(f[pe])}}return{component:R,adjList:Y,minIdx:N}},b=0;b<d.length;){var x=d.filter(function(A){return f[A.id]>=b}),E=(0,KI.detectStrongConnectComponents)({nodes:x,edges:t.edges}).filter(function(A){return A.length>1});if(E.length===0)break;var w=m(E),_=w.minIdx,M=w.adjList,C=w.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(e&&n&&e.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s};oa.detectAllDirectedCycle=JI;var w$=function(t,e,n,i){return i===void 0&&(i=!0),e?JI(t,n,i):QI(t,n,i)};oa.detectAllCycles=w$;var _$=E$;oa.default=_$;var Qu={};const eO=ma(m3),Bl=ma(O5);Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=void 0;var Zw=eO,S$=Bl,Qw=Jr,M$=function(t,e,n){for(var i=1/0,a,o=0;o<e.length;o++){var s=e[o].id;!n[s]&&t[s]<=i&&(i=t[s],a=e[o])}return a},C$=function(t,e,n,i){var a=t.nodes,o=a===void 0?[]:a,s=t.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var x=m.id;l[x]=1/0,x===e&&(l[x]=0)});for(var h=o.length,d=function(b){var x=M$(l,o,f),E=x.id;if(f[E]=!0,l[E]===1/0)return"continue";var w=[];n?w=(0,Qw.getOutEdgesNodeId)(E,u):w=(0,Qw.getEdgesByNodeId)(E,u),w.forEach(function(_){var M=_.target,C=_.source,S=M===E?C:M,A=i&&_[i]?_[i]:1;l[S]>l[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.id)})},v=0;v<h;v++)d();c[e]=[e];var p={};for(var g in l)l[g]!==1/0&&tO(e,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}},A$=C$;Qu.default=A$;function tO(r,t,e,n){if(r===t)return[r];if(n[t])return n[t];for(var i=[],a=0,o=e[t];a<o.length;a++){var s=o[a],u=tO(r,s,e,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];(0,S$.isArray)(c)?i.push((0,Zw.__spreadArray)((0,Zw.__spreadArray)([],c,!0),[t],!1)):i.push([c,t])}}return n[t]=i,n[t]}var Bu={};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.findShortestPath=Bu.findAllPath=void 0;var T$=I$(Qu),ah=Jr;function I$(r){return r&&r.__esModule?r:{default:r}}var O$=function(t,e,n,i,a){var o=(0,T$.default)(t,e,i,a),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}};Bu.findShortestPath=O$;var L$=function(t,e,n,i){var a;if(e===n)return[[e]];var o=t.edges,s=o===void 0?[]:o,u=[e],f=(a={},a[e]=!0,a),l=[],c=[],h=i?(0,ah.getNeighbors)(e,s,"target"):(0,ah.getNeighbors)(e,s);for(l.push(h);u.length>0&&l.length>0;){var d=l[l.length-1];if(d.length){var v=d.shift();v&&(u.push(v),f[v]=!0,h=i?(0,ah.getNeighbors)(v,s,"target"):(0,ah.getNeighbors)(v,s),l.push(h.filter(function(y){return!f[y]})))}else{var p=u.pop();f[p]=!1,l.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});c.push(g);var p=u.pop();f[p]=!1,l.pop()}}return c};Bu.findAllPath=L$;var Fl={};Object.defineProperty(Fl,"__esModule",{value:!0});Fl.default=void 0;var D$=k$(Ps);function k$(r){return r&&r.__esModule?r:{default:r}}var P$=function(t,e){for(var n=(0,D$.default)(t,e),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},N$=P$;Fl.default=N$;var bv={};Object.defineProperty(bv,"__esModule",{value:!0});bv.default=void 0;var R$=F$(Ps),B$=Jr;function F$(r){return r&&r.__esModule?r:{default:r}}var G$=function(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=t.nodes,o=a===void 0?[]:a,s=t.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var E=(0,B$.uniqueId)();b.clusterId=E,f[E]={id:E,nodes:[b]},l[b.id]={node:b,idx:x}});var c=(0,R$.default)(t,e),h={};c.forEach(function(b,x){var E=o[x].id;h[E]={},b.forEach(function(w,_){if(w){var M=o[_].id;h[E][M]=w}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(E){var w={};Object.keys(h[E.id]).forEach(function(D){var N=h[E.id][D],P=l[D].node,G=P.clusterId;w[G]||(w[G]=0),w[G]+=N});var _=-1/0,M=[];if(Object.keys(w).forEach(function(D){_<w[D]?(_=w[D],M=[D]):_===w[D]&&M.push(D)}),!(M.length===1&&M[0]===E.clusterId)){var C=M.indexOf(E.clusterId);if(C>=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[E.clusterId],A=S.nodes.indexOf(E);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),I=f[M[T]];I.nodes.push(E),E.clusterId=I.id}}}),!x)return"break";d++};d<i;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var x=f[b];(!x.nodes||!x.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var x=b.source,E=b.target,w=b[n]||1,_=l[x].node.clusterId,M=l[E].node.clusterId,C="".concat(_,"---").concat(M);if(y[C])y[C].weight+=w,y[C].count++;else{var S={source:_,target:M,weight:w,count:1};y[C]=S,g.push(S)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},z$=G$;bv.default=z$;var xv={},Gl={};Object.defineProperty(Gl,"__esModule",{value:!0});Gl.default=void 0;var j$=Bl,U$=function(){function r(t){this.arr=t}return r.prototype.getArr=function(){return this.arr||[]},r.prototype.add=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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(t){var e=[];if(t!==0)for(var n in this.arr)e[n]=this.arr[n]/t;return new r(e)},r.prototype.negate=function(){var t=[];for(var e in this.arr)t[e]=-this.arr[e];return new r(t)},r.prototype.squareEuclideanDistance=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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]-t.arr[a],2);return i}},r.prototype.euclideanDistance=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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]-t.arr[a],2);return Math.sqrt(i)}else console.error("The two vectors are unequal in length.")},r.prototype.normalize=function(){var t=[],e=(0,j$.clone)(this.arr);e.sort(function(o,s){return o-s});var n=e[e.length-1],i=e[0];for(var a in this.arr)t[a]=(this.arr[a]-i)/(n-i);return new r(t)},r.prototype.norm2=function(){var t;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return 0;var e=0;for(var n in this.arr)e+=Math.pow(this.arr[n],2);return Math.sqrt(e)},r.prototype.dot=function(t){var e,n=t.arr;if(!(!((e=this.arr)===null||e===void 0)&&e.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]*t.arr[a];return i}else console.error("The two vectors are unequal in length.")},r.prototype.equal=function(t){var e,n=t.arr;if(((e=this.arr)===null||e===void 0?void 0:e.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}(),$$=U$;Gl.default=$$;var sa={},Fu={};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.secondReg=Fu.dateReg=void 0;var W$=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;Fu.secondReg=W$;var X$=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;Fu.dateReg=X$;Object.defineProperty(sa,"__esModule",{value:!0});sa.getPropertyWeight=sa.getAllSortProperties=sa.getAllProperties=sa.default=void 0;var Jw=Fu,Jm=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=100);var n={};t.forEach(function(a){a.properties&&Object.keys(a.properties).forEach(function(o){if(o==="id"||!"".concat(a.properties[o]).match(Jw.secondReg)&&!"".concat(a.properties[o]).match(Jw.dateReg)&&isNaN(Number(a.properties[o]))){n.hasOwnProperty(o)&&delete n[o];return}n.hasOwnProperty(o)?n[o]+=1:n[o]=1})});var i=Object.keys(n).sort(function(a,o){return n[o]-n[a]});return i.length<e?i:i.slice(0,e)};sa.getAllSortProperties=Jm;var Y$=function(t,e){return e.map(function(n){return t.hasOwnProperty(n)?t[n]:0})},rO=function(t){for(var e=Jm(t),n=[],i=0;i<t.length;i++)n[i]=Y$(t[i].properties,e);return n};sa.getPropertyWeight=rO;var nO=function(t,e){e===void 0&&(e=void 0);var n=[];return t.forEach(function(i){e===void 0&&n.push(i),i[e]!==void 0&&n.push(i[e])}),n};sa.getAllProperties=nO;var V$={getAllSortProperties:Jm,getPropertyWeight:rO,getAllProperties:nO};sa.default=V$;var ua={},zl={};Object.defineProperty(zl,"__esModule",{value:!0});zl.DistanceType=void 0;var uy;zl.DistanceType=uy;(function(r){r.EuclideanDistance="euclideanDistance"})(uy||(zl.DistanceType=uy={}));Object.defineProperty(ua,"__esModule",{value:!0});ua.oneHot=ua.getDistance=ua.getAllKeyValueMap=ua.default=void 0;var e_=Bl,t_=zl,r_=H$(Gl);function H$(r){return r&&r.__esModule?r:{default:r}}var e1=function(t,e,n){var i=[];e!=null&&e.length?i=e:(t.forEach(function(o){i=i.concat(Object.keys(o))}),i=(0,e_.uniq)(i));var a={};return i.forEach(function(o){var s=[];t.forEach(function(u){u[o]!==void 0&&u[o]!==""&&s.push(u[o])}),s.length&&!(n!=null&&n.includes(o))&&(a[o]=(0,e_.uniq)(s))}),a};ua.getAllKeyValueMap=e1;var iO=function(t,e,n){var i=e1(t,e,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 t.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};ua.oneHot=iO;var aO=function(t,e,n,i){n===void 0&&(n=t_.DistanceType.EuclideanDistance);var a=0;switch(n){case t_.DistanceType.EuclideanDistance:a=new r_.default(t).euclideanDistance(new r_.default(e));break}return a};ua.getDistance=aO;var K$={getAllKeyValueMap:e1,oneHot:iO,getDistance:aO};ua.default=K$;Object.defineProperty(xv,"__esModule",{value:!0});xv.default=void 0;var q$=Bl,Z$=oO(Ps),Sf=oO(Gl),Q$=sa,J$=ua;function oO(r){return r&&r.__esModule?r:{default:r}}var n_=function(t,e,n,i){for(var a=e.length,o=2*i,s=0,u=0;u<a;u++)for(var f=t[u].clusterId,l=0;l<a;l++){var c=t[l].clusterId;if(f===c){var h=e[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},Ag=function(t,e){t===void 0&&(t=[]);for(var n=t.length,i=new Sf.default([]),a=0;a<n;a++)i=i.add(new Sf.default(e[a]));var o=i.avg(n);o.normalize();for(var s=0,a=0;a<n;a++){var u=new Sf.default(e[a]),f=u.squareEuclideanDistance(o);s+=f}var l=[];t.forEach(function(){l.push([])});for(var a=0;a<n;a++){var u=new Sf.default(e[a]);t[a].clusterInertial=0;for(var c=0;c<n;c++){if(a===c){l[a][c]=0;continue}var h=new Sf.default(e[c]);l[a][c]=u.squareEuclideanDistance(h),t[a].clusterInertial+=l[a][c]}}for(var d=0,v=2*n*s,a=0;a<n;a++)for(var p=t[a].clusterId,c=0;c<n;c++){var g=t[c].clusterId;if(!(a===c||p!==g)){var y=t[a].clusterInertial*t[c].clusterInertial/Math.pow(v,2)-l[a][c]/v;d+=y}}return Number(d.toFixed(4))},e9=function(t,e,n,i,a,o,s,u,f){e===void 0&&(e=!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=t.nodes,c=l===void 0?[]:l,h=t.edges,d=h===void 0?[]:h,v=[];if(a){c.forEach(function(k,R){k.properties=k.properties||{},k.originIndex=R});var p=[];c.every(function(k){return k.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(k){return k.nodeType}))),c.forEach(function(k){k.properties.nodeType=p.findIndex(function(R){return R===k.nodeType})}));var g=(0,Q$.getAllProperties)(c,o);v=(0,J$.oneHot)(g,s,u)}var y=1,m={},b={};c.forEach(function(k,R){var Y=String(y++);k.clusterId=Y,m[Y]={id:Y,nodes:[k]},b[k.id]={node:k,idx:R}});var x=(0,Z$.default)(t,e),E=[],w={},_=0;x.forEach(function(k,R){var Y=0,J=c[R].id;w[J]={},k.forEach(function(te,H){if(te){Y+=te;var pe=c[H].id;w[J][pe]=te,_+=te}}),E.push(Y)}),_/=2;for(var M=1/0,C=1/0,S=0,A=[],T={};;){a&&c.every(function(k){return k.hasOwnProperty("properties")})?M=n_(c,x,E,_)+Ag(c,v)*f:M=n_(c,x,E,_),S===0&&(C=M,A=c,T=m);var I=M>0&&M>C&&M-C<i;if(M>C&&(A=c.map(function(k){return{node:k,clusterId:k.clusterId}}),T=(0,q$.clone)(m),C=M),I||S>100)break;S++,Object.keys(m).forEach(function(k){var R=0;d.forEach(function(Y){var J=Y.source,te=Y.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===k&&pe!==k||pe===k&&H!==k)&&(R=R+(Y[n]||1))}),m[k].sumTot=R}),c.forEach(function(k,R){var Y=m[k.clusterId],J=0,te,H=E[R]/(2*_),pe=0,Ae=Y.nodes;Ae.forEach(function(Ut){var dr=b[Ut.id].idx;pe+=x[R][dr]||0});var Le=pe-Y.sumTot*H,qe=Ae.filter(function(Ut){return Ut.id!==k.id});qe.forEach(function(Ut,dr){v[Ut.originIndex]});var at=Ag(qe,v)*f,rt=w[k.id];if(Object.keys(rt).forEach(function(Ut){var dr=b[Ut].node,fr=dr.clusterId;if(fr!==k.clusterId){var Gt=m[fr],Jt=Gt.nodes;if(!(!Jt||!Jt.length)){var Rr=0;Jt.forEach(function(Be){var ye=b[Be.id].idx;Rr+=x[R][ye]||0});var tt=Rr-Gt.sumTot*H,ie=Jt.concat([k]);ie.forEach(function(Be,ye){v[Be.originIndex]});var L=Ag(ie,v)*f,_e=tt-Le;a&&(_e=tt+L-(Le+at)),_e>J&&(J=_e,te=Gt)}}}),J>0){te.nodes.push(k);var xt=k.clusterId;k.clusterId=te.id;var Et=Y.nodes.indexOf(k);Y.nodes.splice(Et,1);var ur=0,Bt=0;d.forEach(function(Ut){var dr=Ut.source,fr=Ut.target,Gt=b[dr].node.clusterId,Jt=b[fr].node.clusterId;(Gt===te.id&&Jt!==te.id||Jt===te.id&&Gt!==te.id)&&(ur=ur+(Ut[n]||1)),(Gt===xt&&Jt!==xt||Jt===xt&&Gt!==xt)&&(Bt=Bt+(Ut[n]||1))}),te.sumTot=ur,Y.sumTot=Bt}})}var D={},N=0;Object.keys(T).forEach(function(k){var R=T[k];if(!R.nodes||!R.nodes.length){delete T[k];return}var Y=String(N+1);Y!==k&&(R.id=Y,R.nodes=R.nodes.map(function(J){return{id:J.id,clusterId:Y}}),T[Y]=R,D[k]=Y,delete T[k],N++)}),A.forEach(function(k){var R=k.node,Y=k.clusterId;R&&(R.clusterId=Y,R.clusterId&&D[R.clusterId]&&(R.clusterId=D[R.clusterId]))});var P=[],G={};d.forEach(function(k){var R=k.source,Y=k.target,J=k[n]||1,te=b[R].node.clusterId,H=b[Y].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if(G[pe])G[pe].weight+=J,G[pe].count++;else{var Ae={source:te,target:H,weight:J,count:1};G[pe]=Ae,P.push(Ae)}}});var W=[];return Object.keys(T).forEach(function(k){W.push(T[k])}),{clusters:W,clusterEdges:P}},t9=e9;xv.default=t9;var Ev={},wv={};Object.defineProperty(wv,"__esModule",{value:!0});wv.default=void 0;var r9=function(){function r(t){this.count=t.length,this.parent={};for(var e=0,n=t;e<n.length;e++){var i=n[e];this.parent[i]=i}}return r.prototype.find=function(t){for(;this.parent[t]!==t;)t=this.parent[t];return t},r.prototype.union=function(t,e){var n=this.find(t),i=this.find(e);n!==i&&(n<i?(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]):(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]))},r.prototype.connected=function(t,e){return this.find(t)===this.find(e)},r}(),n9=r9;wv.default=n9;var _v={};Object.defineProperty(_v,"__esModule",{value:!0});_v.default=void 0;var i9=function(t,e){return t-e},a9=function(){function r(t){t===void 0&&(t=i9),this.compareFn=t,this.list=[]}return r.prototype.getLeft=function(t){return 2*t+1},r.prototype.getRight=function(t){return 2*t+2},r.prototype.getParent=function(t){return t===0?null:Math.floor((t-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 t=this.top(),e=this.list.pop();return this.list.length>0&&(this.list[0]=e,this.moveDown(0)),t},r.prototype.insert=function(t){if(t!==null){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},r.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var n=this.list[e];this.list[e]=this.list[t],this.list[t]=n,t=e,e=this.getParent(t)}},r.prototype.moveDown=function(t){var e,n=t,i=this.getLeft(t),a=this.getRight(t),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),t!==n&&(e=[this.list[n],this.list[t]],this.list[t]=e[0],this.list[n]=e[1],this.moveDown(n))},r}(),o9=a9;_v.default=o9;Object.defineProperty(Ev,"__esModule",{value:!0});Ev.default=void 0;var s9=sO(wv),u9=sO(_v),Tg=Jr;function sO(r){return r&&r.__esModule?r:{default:r}}var f9=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,o=t.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 e?g.weight-y.weight:0},c=new u9.default(l);for((0,Tg.getEdgesByNodeId)(u.id,s).forEach(function(p){c.insert(p)});!c.isEmpty();){var h=c.delMin(),d=h.source,v=h.target;f.has(d)&&f.has(v)||(n.push(h),f.has(d)||(f.add(d),(0,Tg.getEdgesByNodeId)(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),(0,Tg.getEdgesByNodeId)(v,s).forEach(function(p){c.insert(p)})))}return n},i_=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,o=t.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});e&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new s9.default(a.map(function(d){return d.id}));u.length>0;){var l=u.shift(),c=l.source,h=l.target;f.connected(c,h)||(n.push(l),f.union(c,h))}return n},l9=function(t,e,n){var i={prim:f9,kruskal:i_};return n?i[n](t,e):i_(t,e)},c9=l9;Ev.default=c9;var Sv={};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.default=void 0;var h9=v9(Va),d9=Jr;function v9(r){return r&&r.__esModule?r:{default:r}}var p9=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=t.nodes,u=s===void 0?[]:s,f=t.edges,l=f===void 0?[]:f,c=u.length,h,d={},v={},p=0;p<c;++p){var g=u[p],y=g.id;d[y]=1/c,v[y]=1/c}for(var m=(0,h9.default)(t);o>0&&i>e;){a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;if(h=0,m[g.id].inDegree===0)d[y]=0;else{for(var b=(0,d9.getNeighbors)(y,l,"source"),x=0;x<b.length;++x){var E=b[x],w=m[E].outDegree;w>0&&(h+=v[E]/w)}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},g9=p9;Sv.default=g9;var Mv={},Cv={},Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.VACANT_NODE_LABEL=Qr.VACANT_NODE_ID=Qr.VACANT_GRAPH_ID=Qr.VACANT_EDGE_LABEL=Qr.VACANT_EDGE_ID=Qr.Node=Qr.Graph=Qr.Edge=Qr.AUTO_EDGE_ID=void 0;var uO=-1;Qr.VACANT_EDGE_ID=uO;var El=-1;Qr.VACANT_NODE_ID=El;var fO="-1";Qr.VACANT_EDGE_LABEL=fO;var lO="-1";Qr.VACANT_NODE_LABEL=lO;var y9=-1;Qr.VACANT_GRAPH_ID=y9;var m9="-1";Qr.AUTO_EDGE_ID=m9;var fy=function(){function r(t,e,n,i){t===void 0&&(t=uO),e===void 0&&(e=El),n===void 0&&(n=El),i===void 0&&(i=fO),this.id=t,this.from=e,this.to=n,this.label=i}return r}();Qr.Edge=fy;var cO=function(){function r(t,e){t===void 0&&(t=El),e===void 0&&(e=lO),this.id=t,this.label=e,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(t){this.edges.push(t),this.edgeMap[t.id]=t},r}();Qr.Node=cO;var b9=function(){function r(t,e,n){t===void 0&&(t=El),e===void 0&&(e=!0),n===void 0&&(n=!1),this.id=t,this.edgeIdAutoIncrease=e,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(t,e){if(!this.nodeMap[t]){var n=new cO(t,e);this.nodes.push(n),this.nodeMap[t]=n,this.nodeLabelMap[e]||(this.nodeLabelMap[e]=[]),this.nodeLabelMap[e].push(t)}},r.prototype.addEdge=function(t,e,n,i){if((this.edgeIdAutoIncrease||t===void 0)&&(t=this.counter++),!(this.nodeMap[e]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[t])){var a=new fy(t,e,n,i);if(this.edges.push(a),this.edgeMap[t]=a,this.nodeMap[e].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new fy(t,n,e,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}();Qr.Graph=b9;Object.defineProperty(Cv,"__esModule",{value:!0});Cv.default=void 0;var x9=Bl,Rn=Qr,ls=function(){function r(t,e,n,i,a){this.fromNode=t,this.toNode=e,this.nodeEdgeNodeLabel={nodeLabel1:n||Rn.VACANT_NODE_LABEL,edgeLabel:i||Rn.VACANT_EDGE_LABEL,nodeLabel2:a||Rn.VACANT_NODE_LABEL}}return r.prototype.equalTo=function(t){return this.fromNode===t.formNode&&this.toNode===t.toNode&&this.nodeEdgeNodeLabel===t.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(t){return!this.equalTo(t)},r}(),a_=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(t){var e=this.dfsEdgeList.length,n=t.length;if(e!==n)return!1;for(var i=0;i<e;i++)if(this.dfsEdgeList[i]!==t[i])return!1;return!0},r.prototype.notEqualTo=function(t){return!this.equalTo(t)},r.prototype.pushBack=function(t,e,n,i,a){return this.dfsEdgeList.push(new ls(t,e,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(t,e){t===void 0&&(t=Rn.VACANT_GRAPH_ID),e===void 0&&(e=!1);var n=new Rn.Graph(t,!0,e);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!==Rn.VACANT_NODE_LABEL&&n.addNode(a,u),l!==Rn.VACANT_NODE_LABEL&&n.addNode(o,l),u!==Rn.VACANT_NODE_LABEL&&l!==u&&n.addEdge(void 0,a,o,f)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var t=void 0,e=this.dfsEdgeList.length,n=e-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(t===void 0||o===t)&&(this.rmpath.push(n),t=a)}return this.rmpath},r.prototype.getNodeNum=function(){var t={};return this.dfsEdgeList.forEach(function(e){t[e.fromNode]||(t[e.fromNode]=!0),t[e.toNode]||(t[e.toNode]=!0)}),Object.keys(t).length},r}(),oh=function(){function r(t){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!t){for(;t;){var e=t.edge;this.edges.push(e),this.nodesUsed[e.from]=1,this.nodesUsed[e.to]=1,this.edgesUsed[e.id]=1,t=t.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(t){return this.nodesUsed[t.id]===1},r.prototype.hasEdge=function(t){return this.edgesUsed[t.id]===1},r}(),E9=function(){function r(t){var e=t.graphs,n=t.minSupport,i=n===void 0?2:n,a=t.minNodeNum,o=a===void 0?1:a,s=t.maxNodeNum,u=s===void 0?4:s,f=t.top,l=f===void 0?10:f,c=t.directed,h=c===void 0?!1:c,d=t.verbose,v=d===void 0?!1:d;this.graphs=e,this.dfsCode=new a_,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(t,e){var n=this,i=[],a=t.nodeMap;return e.edges.forEach(function(o){(n.directed||e.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(t,e,n,i){if(!this.directed&&e===n)return null;for(var a=t.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!==e.from)){if(this.directed){if(a[e.from].label<a[n.to].label||a[e.from].label===a[n.to].label&&e.label<=l.label)return l}else if(e.label<l.label||e.label===l.label&&a[e.to].label<=a[n.to].label)return l}}return null},r.prototype.findForwardPureEdges=function(t,e,n,i){for(var a=[],o=e.to,s=t.nodeMap[o].edges,u=s.length,f=0;f<u;f++){var l=s[f],c=t.nodeMap[l.to];n<=c.label&&!i.hasNode(c)&&a.push(l)}return a},r.prototype.findForwardRmpathEdges=function(t,e,n,i){for(var a=[],o=t.nodeMap,s=o[e.to].label,u=o[e.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;e.to===h.to||n>d||i.hasNode(o[h.to])||(e.label<h.label||e.label===h.label&&s<=d)&&a.push(h)}return a},r.prototype.getSupport=function(t){var e={};return t.forEach(function(n){e[n.graphId]||(e[n.graphId]=!0)}),Object.keys(e).length},r.prototype.findMinLabel=function(t){var e=void 0;return Object.keys(t).forEach(function(n){var i=t[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!e){e={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<e.nodeLabel1||a===e.nodeLabel1&&o<e.edgeLabel||a===e.nodeLabel1&&o===e.edgeLabel&&s<e.nodeLabel2)&&(e={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),e},r.prototype.isMin=function(){var t=this,e=this.dfsCode;if(this.verbose&&console.log("isMin checking",e),e.dfsEdgeList.length===1)return!0;var n=this.directed,i=e.toGraph(Rn.VACANT_GRAPH_ID,n),a=i.nodeMap,o=new a_,s={};i.nodes.forEach(function(c){var h=t.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 ls(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var f=function c(h){for(var d=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[d[0]].toNode,g={},y=!1,m=0,b=n?-1:0,x=function(G){if(y)return"break";h.forEach(function(W){var k=new oh(W),R=t.findBackwardEdge(i,k.edges[d[G]],k.edges[d[0]],k);R&&(g[R.label]||(g[R.label]={projected:[],edgeLabel:R.label}),g[R.label].projected.push({graphId:i.id,edge:g,preNode:W}),m=o.dfsEdgeList[d[G]].fromNode,y=!0)})},E=d.length-1;E>b;E--){var w=x(E);if(w==="break")break}if(y){var _=t.findMinLabel(g);o.dfsEdgeList.push(new ls(p,m,Rn.VACANT_NODE_LABEL,_.edgeLabel,Rn.VACANT_NODE_LABEL));var M=o.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(P){var G=new oh(P),W=t.findForwardPureEdges(i,G.edges[d[0]],v,G);W.length>0&&(y=!0,S=p,W.forEach(function(k){var R="".concat(k.label,"-").concat(a[k.to].label);C[R]||(C[R]={projected:[],edgeLabel:k.label,nodeLabel2:a[k.to].label}),C[R].projected.push({graphId:i.id,edge:k,preNode:P})}))});for(var A=d.length,T=function(G){if(y)return"break";var W=d[G];h.forEach(function(k){var R=new oh(k),Y=t.findForwardRmpathEdges(i,R.edges[W],v,R);Y.length>0&&(y=!0,S=o.dfsEdgeList[W].fromNode,Y.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:k})}))})},E=0;E<A;E++){var I=T(E);if(I==="break")break}if(!y)return!0;var D=t.findMinLabel(C);o.dfsEdgeList.push(new ls(S,p+1,Rn.VACANT_NODE_LABEL,D.edgeLabel,D.nodeLabel2));var N=o.dfsEdgeList.length-1;return e.dfsEdgeList[N]!==o.dfsEdgeList[N]?!1:c(C["".concat(D.edgeLabel,"-").concat(D.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 t=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,x9.clone)(t))}},r.prototype.subGraphMining=function(t){var e=this,n=this.getSupport(t);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={};t.forEach(function(l){for(var c=e.graphs[l.graphId],h=c.nodeMap,d=new oh(l),v=a.length-1;v>=0;v--){var p=e.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(e.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=e.maxNodeNum)){var y=e.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var E=e.findForwardRmpathEdges(c,d.edges[a[x]],s,d);E.forEach(function(w){var _="".concat(e.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(w.label,"-").concat(h[w.to].label);u[_]||(u[_]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[a[x]].fromNode,edgeLabel:w.label,nodeLabel2:h[w.to].label}),u[_].projected.push({graphId:l.graphId,edge:w,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;e.dfsCode.dfsEdgeList.push(new ls(o,h,"-1",d,"-1")),e.subGraphMining(f[l].projected),e.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;e.dfsCode.dfsEdgeList.push(new ls(h,o+1,Rn.VACANT_NODE_LABEL,d,v)),e.subGraphMining(u[l].projected),e.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var t=this.graphs,e=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={};return Object.keys(t).forEach(function(u){var f=t[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(!e&&y>m){var b=m;m=y,y=b}var x=g.label,E="".concat(y,"-").concat(x,"-").concat(m);if(!o[E]){var w=o[E]||0;w++,o[E]=w}})})}),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 t=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var e=this.graphs;this.directed;var n={};Object.keys(e).forEach(function(i){var a=e[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=t.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;t.dfsCode.dfsEdgeList.push(new ls(0,1,s,u,f)),t.subGraphMining(o),t.dfsCode.dfsEdgeList.pop()})}},r}(),w9=function(t,e,n,i){var a={};return Object.keys(t).forEach(function(o,s){var u=t[o],f=new Rn.Graph(s,!0,e),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},_9=function(t,e,n){var i=[];return t.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[e]=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},o_="cluster",S9=function(t){var e=t.graphs,n=t.directed,i=n===void 0?!1:n,a=t.nodeLabelProp,o=a===void 0?o_:a,s=t.edgeLabelProp,u=s===void 0?o_:s,f=w9(e,i,o,u),l=t.minSupport,c=t.maxNodeNum,h=t.minNodeNum,d=t.verbose,v=t.top,p={graphs:f,minSupport:l,maxNodeNum:c,minNodeNum:h,top:v,verbose:d,directed:i},g=new E9(p);g.run();var y=_9(g.frequentSubgraphs,o,u);return y},M9=S9;Cv.default=M9;Object.defineProperty(Mv,"__esModule",{value:!0});Mv.default=void 0;var s_=eO,u_=t1(Fl),C9=t1(Cv),f_=t1(Qu),A9=Jr;function t1(r){return r&&r.__esModule?r:{default:r}}var l_=function(t,e,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=t.nodes;return e.forEach(function(s,u){a.push(hO(o,s,u,n,i))}),a},hO=function(t,e,n,i,a){var o=[n],s=[],u={};return e.forEach(function(f,l){if(f<=a&&n!==l){o.push(l),s.push(t[l]);var c=t[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:t[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},T9=function(t,e,n,i,a){var o=Math.ceil(n/e),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()*e),g++,!(g>2*e)););if(g<2*e&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*e)break}if(c<o){var y=o-c;o=(o+y)/(e-l-1)}}),s},Hh=function(t,e,n,i){var a=n.nodes;return i||(i={}),Object.keys(t).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var f=t[o],l=(s=e[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=e[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},Kh=function(t,e,n,i){var a,o,s={};t.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((a=e==null?void 0:e.edges)===null||a===void 0)&&a.length)||((o=e==null?void 0:e.nodes)===null||o===void 0?void 0:o.length)<2?0:(t.edges.forEach(function(f){var l=s[f.source][n],c=s[f.target][n],h=e==null?void 0:e.nodes[0][n],d=e==null?void 0:e.nodes[1][n],v=e==null?void 0:e.edges[0][i];f[i]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},I9=function(t,e,n){for(var i=1/0,a=0,o=function(f){var l=t[f],c=Object.keys(l).sort(function(m,b){return l[m]-l[b]}),h=10,d=[];c.forEach(function(m,b){d[b%h]||(d[b%h]={graphs:[],totalCount:0,aveCount:0}),d[b%h].graphs.push(m),d[b%h].totalCount+=l[m]});var v=0,p=[];d.forEach(function(m){var b=m.totalCount/m.graphs.length;m.aveCount=b,p.push(b);var x=0,E=m.length;m.graphs.forEach(function(w,_){var M=l[w];m.graphs.forEach(function(C,S){_!==S&&(x+=Math.abs(M-l[C]))})}),x/=E*(E-1)/2,v+=x}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(x,E){b!==E&&(g+=Math.abs(m-x))}),g/=p.length*(p.length-1)/2});var y=g-v;i<y&&(i=y,a=f)},s=0;s<e;s++)o(s);return{structure:n[a],structureCountMap:t[a]}},c_=function(t,e){var n={},i={};return t.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[e];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},h_=function(t,e,n){var i={},a={};return t.forEach(function(o,s){i["".concat(A9.uniqueId)]={idx:s,edge:o};var u=o[e];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}},d_=function(t,e,n){var i=e.length,a={};return e.forEach(function(o,s){for(var u=n?0:s+1,f=t[s].id,l=u;l<i;l++)if(s!==l){var c=t[l].id,h=o[l];a["".concat(f,"-").concat(c)]=h,n||(a["".concat(c,"-").concat(f)]=h)}}),a},O9=function(t,e,n,i,a,o,s,u,f,l,c){var h,d="".concat(e.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[e.id].idx,end:i[n.id].idx,distance:a},h);c=Hh(p,o,t,c),v=c[d]}return Kh(v,s,u,f)},v_=function(t,e,n,i){var a,o,s,u=(a=t[e])===null||a===void 0?void 0:a.degree,f=(o=t[e])===null||o===void 0?void 0:o.inDegree,l=(s=t[e])===null||s===void 0?void 0:s.outDegree;return t[e]===void 0&&(u=1/0,f=1/0,l=1/0,i[e].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)}),t[e]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},L9=function(t,e,n,i,a,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!t||!t.nodes)){var f=t.nodes.length;if(f){var l=(0,u_.default)(t,n),c=(0,u_.default)(e,n),h=d_(t.nodes,l,n),d=d_(e.nodes,c,n),v=c_(t.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=c_(e.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;h_(t.edges,s,p);var x=h_(e.edges,s,m).edgeLabelMap,E=[];c==null||c.forEach(function(tt){E=E.concat(tt)}),a||(a=Math.max.apply(Math,(0,s_.__spreadArray)((0,s_.__spreadArray)([],E,!1),[2],!1))),i||(i=a);var w=l_(t,l,o,i),_=l_(e,c,o,i),M=Math.min(100,f*(f-1)/2),C=T9(i,f,M,w,l),S=Hh(C,w,t),A=10,T=1,I=1,D=4,N={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:I,maxNodeNum:D,directed:n},P=(0,C9.default)(N).slice(0,A),G=P.length,W=[];P.forEach(function(tt,ie){W[ie]={},Object.keys(S).forEach(function(L){var _e=S[L],Be=Kh(_e,tt,o,s);W[ie][L]=Be})});var k=I9(W,G,P),R=k.structure,Y=k.structureCountMap,J=e.nodes[0],te=[],H=(u=e.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;e.nodes.forEach(function(tt){var ie=tt[o],L=g[ie];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ie,J=tt)});var Ae={},Le={},qe={},at={},rt={},xt={};Object.keys(b).forEach(function(tt,ie){rt[tt]=[],n&&(xt[tt]=[]);var L=b[tt],_e={};L.forEach(function(Ke){var Qe=d["".concat(J.id,"-").concat(Ke.id)];if(Qe&&rt[tt].push(Qe),_e["".concat(J.id,"-").concat(Ke.id)]={start:0,end:m[Ke.id].idx,distance:Qe},n){var vt=d["".concat(Ke.id,"-").concat(J.id)];vt&&xt[tt].push(vt)}}),rt[tt]=rt[tt].sort(function(Ke,Qe){return Ke-Qe}),n&&(xt[tt]=xt[tt].sort(function(Ke,Qe){return Ke-Qe})),Le=Hh(_e,_,e,Le);var Be=[];if(Object.keys(_e).forEach(function(Ke){if(qe[Ke]){Be.push(qe[Ke]);return}var Qe=Le[Ke];qe[Ke]=Kh(Qe,R,o,s),Be.push(qe[Ke])}),Be=Be.sort(function(Ke,Qe){return Qe-Ke}),at["".concat(J.id,"-").concat(tt)]=Be,tt!==H)for(var ye=(te==null?void 0:te.length)||0,$e=function(Qe){var vt=te[Qe],Dt=w[p[vt.id].idx],lr=Dt.nodeLabelCountMap[tt],kt=b[tt].length;if(!lr||lr.count<kt)return te.splice(Qe,1),"continue";for(var hr=!1,or=0;or<kt;or++)if(lr.dists[or]>rt[tt][or]){hr=!0;break}if(hr)return te.splice(Qe,1),"continue";var gr={};Dt.neighbors.forEach(function(er){var Or=h["".concat(vt.id,"-").concat(er.id)];gr["".concat(vt.id,"-").concat(er.id)]={start:p[vt.id].idx,end:p[er.id].idx,distance:Or}}),S=Hh(gr,w,t,S);var vr=[];Object.keys(gr).forEach(function(er){if(Y[er]){vr.push(Y[er]);return}var Or=S[er];Y[er]=Kh(Or,R,o,s),vr.push(Y[er])}),vr=vr.sort(function(er,Or){return Or-er});for(var en=!1,or=0;or<kt;or++)if(vr[or]<Be[or]){en=!0;break}if(en)return te.splice(Qe,1),"continue"},We=ye-1;We>=0;We--)$e(We)});var Et=[];te==null||te.forEach(function(tt){for(var ie=p[tt.id].idx,L=hO(t.nodes,l[ie],ie,o,a),_e=L.neighbors,Be=_e.length,ye=!1,$e=Be-1;$e>=0;$e--){if(_e.length+1<e.nodes.length){ye=!0;return}var We=_e[$e],Ke=We[o];if(!b[Ke]||!b[Ke].length){_e.splice($e,1);continue}if(!rt[Ke]||!rt[Ke].length){_e.splice($e,1);continue}var Qe="".concat(tt.id,"-").concat(We.id),vt=h[Qe],Dt=rt[Ke].length-1,lr=rt[Ke][Dt];if(vt>lr){_e.splice($e,1);continue}if(n){var kt="".concat(We.id,"-").concat(tt.id),hr=h[kt];Dt=xt[Ke].length-1;var or=xt[Ke][Dt];if(hr>or){_e.splice($e,1);continue}}var gr=Y[Qe]?Y[Qe]:O9(t,tt,We,p,vt,w,R,o,s,Y,S),vr="".concat(J.id,"-").concat(Ke),en=at[vr][at[vr].length-1];if(gr<en){_e.splice($e,1);continue}var er=v_(Ae,Ke,m,b),Or=er.minPatternNodeLabelDegree;if(er.minPatternNodeLabelInDegree,er.minPatternNodeLabelOutDegree,p[We.id].degree<Or){_e.splice($e,1);continue}}ye||Et.push({nodes:[tt].concat(_e)})});var ur=(0,f_.default)(e,J.id,!1).length,Bt={};n?(Object.keys(ur).forEach(function(tt){var ie=m[tt].node[o];Bt[ie]?Bt[ie].push(ur[tt]):Bt[ie]=[ur[tt]]}),Object.keys(Bt).forEach(function(tt){Bt[tt].sort(function(ie,L){return ie-L})})):Bt=rt;for(var Ut=Et.length,dr=function(ie){var L=Et[ie],_e=L.nodes[0],Be={},ye={};L.nodes.forEach(function(At,pr){ye[At.id]={idx:pr,node:At,degree:0,inDegree:0,outDegree:0};var mt=At[o];Be[mt]?Be[mt]++:Be[mt]=1});var $e=[],We={};t.edges.forEach(function(At){ye[At.source]&&ye[At.target]&&($e.push(At),We[At[s]]?We[At[s]]++:We[At[s]]=1,ye[At.source].degree++,ye[At.target].degree++,ye[At.source].outDegree++,ye[At.target].inDegree++)});for(var Ke=Object.keys(x).length,Qe=!1,vt=0;vt<Ke;vt++){var Dt=Object.keys(x)[vt];if(!We[Dt]||We[Dt]<x[Dt].length){Qe=!0;break}}if(Qe)return Et.splice(ie,1),"continue";var lr=$e.length;if(lr<e.edges.length)return Et.splice(ie,1),"break";for(var kt=!1,hr=function(pr){var mt=$e[pr],_r=mt[s],tn=x[_r];if(!tn||!tn.length)return We[_r]--,tn&&We[_r]<tn.length?(kt=!0,"break"):($e.splice(pr,1),ye[mt.source].degree--,ye[mt.target].degree--,ye[mt.source].outDegree--,ye[mt.target].inDegree--,"continue");var Aa=ye[mt.source].node[o],Ta=ye[mt.target].node[o],_i=!1;if(tn.forEach(function($i){var Ia=m[$i.source].node,Oa=m[$i.target].node;Ia[o]===Aa&&Oa[o]===Ta&&(_i=!0),!n&&Ia[o]===Ta&&Oa[o]===Aa&&(_i=!0)}),!_i)return We[_r]--,tn&&We[_r]<tn.length?(kt=!0,"break"):($e.splice(pr,1),ye[mt.source].degree--,ye[mt.target].degree--,ye[mt.source].outDegree--,ye[mt.target].inDegree--,"continue")},vt=lr-1;vt>=0;vt--){var or=hr(vt);if(or==="break")break}if(kt)return Et.splice(ie,1),"continue";L.edges=$e;var gr=(0,f_.default)(L,L.nodes[0].id,!1).length;if(Object.keys(gr).reverse().forEach(function(At){if(!(At===L.nodes[0].id||kt)){if(gr[At]===1/0){var pr=ye[At].node[o];if(Be[pr]--,Be[pr]<b[pr].length){kt=!0;return}var mt=L.nodes.indexOf(ye[At].node);L.nodes.splice(mt,1),ye[At]=void 0;return}var _r=p[At].node[o];if(!Bt[_r]||!Bt[_r].length||gr[At]>Bt[_r][Bt[_r].length-1]){var pr=ye[At].node[o];if(Be[pr]--,Be[pr]<b[pr].length){kt=!0;return}var mt=L.nodes.indexOf(ye[At].node);L.nodes.splice(mt,1),ye[At]=void 0}}}),kt)return Et.splice(ie,1),"continue";for(var vr=!0,en=0;vr&&!kt;){vr=!1;var er=n?ye[_e.id].degree<m[J.id].degree||ye[_e.id].inDegree<m[J.id].inDegree||ye[_e.id].outDegree<m[J.id].outDegree:ye[_e.id].degree<m[J.id].degree;if(er){kt=!0;break}if(Be[_e[o]]<b[_e[o]].length){kt=!0;break}for(var Or=L.nodes.length,Un=Or-1;Un>=0;Un--){var Br=L.nodes[Un],Ui=ye[Br.id].degree,Uo=ye[Br.id].inDegree,$o=ye[Br.id].outDegree,qr=Br[o],wi=v_(Ae,qr,m,b),Ca=wi.minPatternNodeLabelDegree,Wo=wi.minPatternNodeLabelInDegree,Xo=wi.minPatternNodeLabelOutDegree,Yo=n?Ui<Ca||Uo<Wo||$o<Xo:Ui<Ca;if(Yo){if(Be[Br[o]]--,Be[Br[o]]<b[Br[o]].length){kt=!0;break}L.nodes.splice(Un,1),ye[Br.id]=void 0,vr=!0}}if(kt||!vr&&en!==0)break;lr=$e.length;for(var $n=lr-1;$n>=0;$n--){var Lr=$e[$n];if(!ye[Lr.source]||!ye[Lr.target]){$e.splice($n,1);var Wn=Lr[s];if(We[Wn]--,ye[Lr.source]&&(ye[Lr.source].degree--,ye[Lr.source].outDegree--),ye[Lr.target]&&(ye[Lr.target].degree--,ye[Lr.target].inDegree--),x[Wn]&&We[Wn]<x[Wn].length){kt=!0;break}vr=!0}}en++}if(kt||kt||L.nodes.length<e.nodes.length||$e.length<e.edges.length)return Et.splice(ie,1),"continue"},fr=Ut-1;fr>=0;fr--){var Gt=dr(fr);if(Gt==="break")break}for(var Jt=Et.length,Rr=function(ie){var L=Et[ie],_e={};L.edges.forEach(function($e){var We="".concat($e.source,"-").concat($e.target,"-").concat($e.label);_e[We]?_e[We]++:_e[We]=1});for(var Be=function(We){var Ke=Et[We],Qe={};Ke.edges.forEach(function(Dt){var lr="".concat(Dt.source,"-").concat(Dt.target,"-").concat(Dt.label);Qe[lr]?Qe[lr]++:Qe[lr]=1});var vt=!0;Object.keys(Qe).length!==Object.keys(_e).length?vt=!1:Object.keys(_e).forEach(function(Dt){Qe[Dt]!==_e[Dt]&&(vt=!1)}),vt&&Et.splice(We,1)},ye=Jt-1;ye>ie;ye--)Be(ye);Jt=Et.length},fr=0;fr<=Jt-1;fr++)Rr(fr);return Et}}},D9=L9;Mv.default=D9;(function(r){function t(x){"@babel/helpers - typeof";return t=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},t(x)}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"GADDI",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(r,"breadthFirstSearch",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"connectedComponent",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"depthFirstSearch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"detectCycle",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(r,"dijkstra",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"findAllPath",{enumerable:!0,get:function(){return f.findAllPath}}),Object.defineProperty(r,"findShortestPath",{enumerable:!0,get:function(){return f.findShortestPath}}),Object.defineProperty(r,"floydWarshall",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"getAdjMatrix",{enumerable:!0,get:function(){return e.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 e=b(Ps),n=b(gv),i=b(Po),a=m(Va),o=b(oa),s=b(mv),u=b(Qu),f=Bu,l=b(Fl),c=b(bv),h=b(xv),d=b(Ev),v=b(Sv),p=b(Mv),g=Jr;function y(x){if(typeof WeakMap!="function")return null;var E=new WeakMap,w=new WeakMap;return(y=function(M){return M?w:E})(x)}function m(x,E){if(!E&&x&&x.__esModule)return x;if(x===null||t(x)!=="object"&&typeof x!="function")return{default:x};var w=y(E);if(w&&w.has(x))return w.get(x);var _={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in x)if(C!=="default"&&Object.prototype.hasOwnProperty.call(x,C)){var S=M?Object.getOwnPropertyDescriptor(x,C):null;S&&(S.get||S.set)?Object.defineProperty(_,C,S):_[C]=x[C]}return _.default=x,w&&w.set(x,_),_}function b(x){return x&&x.__esModule?x:{default:x}}})(WI);function ly(r){"@babel/helpers - typeof";return ly=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ly(r)}Object.defineProperty(pv,"__esModule",{value:!0});pv.default=void 0;var Ig=k9(WI),p_=ko;function dO(r){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(dO=function(i){return i?e:t})(r)}function k9(r,t){if(!t&&r&&r.__esModule)return r;if(r===null||ly(r)!=="object"&&typeof r!="function")return{default:r};var e=dO(t);if(e&&e.has(r))return e.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)){var o=i?Object.getOwnPropertyDescriptor(r,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=r[a]}return n.default=r,e&&e.set(r,n),n}var Og=typeof self<"u"?self:{};Og.onmessage=function(r){var t=r.data,e=t._algorithmType,n=t.data;if(e){if(typeof Ig[e]=="function"){var i=Ig[e].apply(Ig,n);Og.postMessage({_algorithmType:p_.MESSAGE.SUCCESS,data:i});return}Og.postMessage({_algorithmType:p_.MESSAGE.FAILURE})}};var P9=null;pv.default=P9;Object.defineProperty(vv,"__esModule",{value:!0});vv.default=void 0;var N9=ko,R9=B9(pv);function B9(r){return r&&r.__esModule?r:{default:r}}var F9=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new Promise(function(i,a){var o=new R9.default;o.postMessage({_algorithmType:t,data:e}),o.onmessage=function(s){var u=s.data,f=u.data,l=u._algorithmType;N9.MESSAGE.SUCCESS===l?i(f):a(),o.terminate()}})}},G9=F9;vv.default=G9;Object.defineProperty(Zt,"__esModule",{value:!0});Zt.pageRankAsync=Zt.minimumSpanningTreeAsync=Zt.louvainAsync=Zt.labelPropagationAsync=Zt.getOutDegreeAsync=Zt.getNeighborsAsync=Zt.getInDegreeAsync=Zt.getDegreeAsync=Zt.getAdjMatrixAsync=Zt.floydWarshallAsync=Zt.findShortestPathAsync=Zt.findAllPathAsync=Zt.dijkstraAsync=Zt.detectCycleAsync=Zt.detectAllUndirectedCycleAsync=Zt.detectAllDirectedCycleAsync=Zt.detectAllCyclesAsync=Zt.connectedComponentAsync=Zt.GADDIAsync=void 0;var fn=z9(vv),ln=ko;function z9(r){return r&&r.__esModule?r:{default:r}}var j9=function(t,e){return(0,fn.default)(ln.ALGORITHM.getAdjMatrix).apply(void 0,[t,e])};Zt.getAdjMatrixAsync=j9;var U9=function(t,e){return(0,fn.default)(ln.ALGORITHM.connectedComponent).apply(void 0,[t,e])};Zt.connectedComponentAsync=U9;var $9=function(t){return(0,fn.default)(ln.ALGORITHM.getDegree)(t)};Zt.getDegreeAsync=$9;var W9=function(t,e){return(0,fn.default)(ln.ALGORITHM.getInDegree)(t,e)};Zt.getInDegreeAsync=W9;var X9=function(t,e){return(0,fn.default)(ln.ALGORITHM.getOutDegree)(t,e)};Zt.getOutDegreeAsync=X9;var Y9=function(t){return(0,fn.default)(ln.ALGORITHM.detectCycle)(t)};Zt.detectCycleAsync=Y9;var V9=function(t){return(0,fn.default)(ln.ALGORITHM.detectAllCycles)(t)};Zt.detectAllCyclesAsync=V9;var H9=function(t){return(0,fn.default)(ln.ALGORITHM.detectAllDirectedCycle)(t)};Zt.detectAllDirectedCycleAsync=H9;var K9=function(t){return(0,fn.default)(ln.ALGORITHM.detectAllUndirectedCycle)(t)};Zt.detectAllUndirectedCycleAsync=K9;var q9=function(t,e,n,i){return(0,fn.default)(ln.ALGORITHM.dijkstra).apply(void 0,[t,e,n,i])};Zt.dijkstraAsync=q9;var Z9=function(t,e,n,i){return(0,fn.default)(ln.ALGORITHM.findAllPath).apply(void 0,[t,e,n,i])};Zt.findAllPathAsync=Z9;var Q9=function(t,e,n,i,a){return(0,fn.default)(ln.ALGORITHM.findShortestPath).apply(void 0,[t,e,n,i,a])};Zt.findShortestPathAsync=Q9;var J9=function(t,e){return(0,fn.default)(ln.ALGORITHM.floydWarshall).apply(void 0,[t,e])};Zt.floydWarshallAsync=J9;var eW=function(t,e,n,i){return i===void 0&&(i=1e3),(0,fn.default)(ln.ALGORITHM.labelPropagation)(t,e,n,i)};Zt.labelPropagationAsync=eW;var tW=function(t,e,n,i){return(0,fn.default)(ln.ALGORITHM.louvain)(t,e,n,i)};Zt.louvainAsync=tW;var rW=function(t,e,n){return(0,fn.default)(ln.ALGORITHM.minimumSpanningTree).apply(void 0,[t,e,n])};Zt.minimumSpanningTreeAsync=rW;var nW=function(t,e,n){return(0,fn.default)(ln.ALGORITHM.pageRank).apply(void 0,[t,e,n])};Zt.pageRankAsync=nW;var iW=function(t,e,n){return(0,fn.default)(ln.ALGORITHM.getNeighbors).apply(void 0,[t,e,n])};Zt.getNeighborsAsync=iW;var aW=function(t,e,n,i,a,o,s){return n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),(0,fn.default)(ln.ALGORITHM.GADDI).apply(void 0,[t,e,n,i,a,o,s])};Zt.GADDIAsync=aW;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"GADDIAsync",{enumerable:!0,get:function(){return t.GADDIAsync}}),Object.defineProperty(r,"connectedComponentAsync",{enumerable:!0,get:function(){return t.connectedComponentAsync}}),r.default=void 0,Object.defineProperty(r,"detectAllCyclesAsync",{enumerable:!0,get:function(){return t.detectAllCyclesAsync}}),Object.defineProperty(r,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return t.detectAllDirectedCycleAsync}}),Object.defineProperty(r,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return t.detectAllUndirectedCycleAsync}}),Object.defineProperty(r,"detectCycleAsync",{enumerable:!0,get:function(){return t.detectCycleAsync}}),r.detectDirectedCycleAsync=void 0,Object.defineProperty(r,"dijkstraAsync",{enumerable:!0,get:function(){return t.dijkstraAsync}}),Object.defineProperty(r,"findAllPathAsync",{enumerable:!0,get:function(){return t.findAllPathAsync}}),Object.defineProperty(r,"findShortestPathAsync",{enumerable:!0,get:function(){return t.findShortestPathAsync}}),Object.defineProperty(r,"floydWarshallAsync",{enumerable:!0,get:function(){return t.floydWarshallAsync}}),Object.defineProperty(r,"getAdjMatrixAsync",{enumerable:!0,get:function(){return t.getAdjMatrixAsync}}),Object.defineProperty(r,"getDegreeAsync",{enumerable:!0,get:function(){return t.getDegreeAsync}}),Object.defineProperty(r,"getInDegreeAsync",{enumerable:!0,get:function(){return t.getInDegreeAsync}}),Object.defineProperty(r,"getNeighborsAsync",{enumerable:!0,get:function(){return t.getNeighborsAsync}}),Object.defineProperty(r,"getOutDegreeAsync",{enumerable:!0,get:function(){return t.getOutDegreeAsync}}),Object.defineProperty(r,"labelPropagationAsync",{enumerable:!0,get:function(){return t.labelPropagationAsync}}),Object.defineProperty(r,"louvainAsync",{enumerable:!0,get:function(){return t.louvainAsync}}),Object.defineProperty(r,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return t.minimumSpanningTreeAsync}}),Object.defineProperty(r,"pageRankAsync",{enumerable:!0,get:function(){return t.pageRankAsync}});var t=Zt,e=t.detectCycleAsync;r.detectDirectedCycleAsync=e;var n={getAdjMatrixAsync:t.getAdjMatrixAsync,connectedComponentAsync:t.connectedComponentAsync,getDegreeAsync:t.getDegreeAsync,getInDegreeAsync:t.getInDegreeAsync,getOutDegreeAsync:t.getOutDegreeAsync,detectCycleAsync:t.detectCycleAsync,detectDirectedCycleAsync:e,detectAllCyclesAsync:t.detectAllCyclesAsync,detectAllDirectedCycleAsync:t.detectAllDirectedCycleAsync,detectAllUndirectedCycleAsync:t.detectAllUndirectedCycleAsync,dijkstraAsync:t.dijkstraAsync,findAllPathAsync:t.findAllPathAsync,findShortestPathAsync:t.findShortestPathAsync,floydWarshallAsync:t.floydWarshallAsync,labelPropagationAsync:t.labelPropagationAsync,louvainAsync:t.louvainAsync,minimumSpanningTreeAsync:t.minimumSpanningTreeAsync,pageRankAsync:t.pageRankAsync,getNeighborsAsync:t.getNeighborsAsync,GADDIAsync:t.GADDIAsync};r.default=n})(Qm);const oW=ba(Qm),sW=s3({__proto__:null,default:oW},[Qm]);function uW(){return window?window.devicePixelRatio:1}function vO(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function gs(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function wl(r,t){return!(t.minX>r.maxX||t.maxX<r.minX||t.minY>r.maxY||t.maxY<r.minY)}function fW(r,t){return!r||!t?r||t:{minX:Math.min(r.minX,t.minX),minY:Math.min(r.minY,t.minY),maxX:Math.max(r.maxX,t.maxX),maxY:Math.max(r.maxY,t.maxY)}}function g_(r,t){return r[0]===t[0]&&r[1]===t[1]}var lW=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,cW=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,hW=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,pO=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function gO(r,t){var e=r.match(pO);me(e,function(n){var i=n.split(":");t.addColorStop(i[0],i[1])})}function dW(r,t,e){var n=lW.exec(e),i=parseFloat(n[1])%360*(Math.PI/180),a=n[2],o=t.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 gO(a,d),d}function vW(r,t,e){var n=cW.exec(e),i=parseFloat(n[1]),a=parseFloat(n[2]),o=parseFloat(n[3]),s=n[4];if(o===0){var u=s.match(pO);return u[u.length-1].split(":")[1]}var f=t.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 gO(s,d),d}function pW(r,t,e){if(t.get("patternSource")&&t.get("patternSource")===e)return t.get("pattern");var n,i,a=hW.exec(e),o=a[1],s=a[2];function u(){n=r.createPattern(i,o),t.set("pattern",n),t.set("patternSource",e)}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 gW(r,t,e){var n=t.getBBox();if(isNaN(n.x)||isNaN(n.y)||isNaN(n.width)||isNaN(n.height))return e;if(Ne(e)){if(e[1]==="("||e[2]==="("){if(e[0]==="l")return dW(r,t,e);if(e[0]==="r")return vW(r,t,e);if(e[0]==="p")return pW(r,t,e)}return e}if(e instanceof CanvasPattern)return e}function yW(r){var t=0,e=0,n=0,i=0;return gt(r)?r.length===1?t=e=n=i=r[0]:r.length===2?(t=n=r[0],e=i=r[1]):r.length===3?(t=r[0],e=i=r[1],n=r[2]):(t=r[0],e=r[1],n=r[2],i=r[3]):t=e=n=i=r,[t,e,n,i]}function sh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function cy(r,t){return sh(r)*sh(t)?(r[0]*t[0]+r[1]*t[1])/(sh(r)*sh(t)):1}function y_(r,t){return(r[0]*t[1]<r[1]*t[0]?-1:1)*Math.acos(cy(r,t))}function m_(r,t){var e=t[1],n=t[2],i=ov(sv(t[3]),Math.PI*2),a=t[4],o=t[5],s=r[0],u=r[1],f=t[6],l=t[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/(e*e)+h*h/(n*n);d>1&&(e*=Math.sqrt(d),n*=Math.sqrt(d));var v=e*e*(h*h)+n*n*(c*c),p=v?Math.sqrt((e*e*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*e*h/n:0,y=e?p*-n*c/e:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/e,(h-y)/n],E=[(-1*c-g)/e,(-1*h-y)/n],w=y_([1,0],x),_=y_(x,E);return cy(x,E)<=-1&&(_=Math.PI),cy(x,E)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:g_(r,[f,l])?0:e,ry:g_(r,[f,l])?0:n,startAngle:w,endAngle:w+_,xRotation:i,arcFlag:a,sweepFlag:o}}var Cd=Math.sin,Ad=Math.cos,r1=Math.atan2,uh=Math.PI;function yO(r,t,e,n,i,a,o){var s=t.stroke,u=t.lineWidth,f=e-i,l=n-a,c=r1(l,f),h=new o1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*Ad(uh/6)+","+10*Cd(uh/6)+" L0,0 L"+10*Ad(uh/6)+",-"+10*Cd(uh/6),stroke:s,lineWidth:u}});h.translate(i,a),h.rotateAtPoint(i,a,c),r.set(o?"startArrowShape":"endArrowShape",h)}function mO(r,t,e,n,i,a,o){var s=t.startArrow,u=t.endArrow,f=t.stroke,l=t.lineWidth,c=o?s:u,h=c.d,d=c.fill,v=c.stroke,p=c.lineWidth,g=sn(c,["d","fill","stroke","lineWidth"]),y=e-i,m=n-a,b=r1(m,y);h&&(i=i-Ad(b)*h,a=a-Cd(b)*h);var x=new o1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:F(F({},g),{stroke:v||f,lineWidth:p||l,fill:d})});x.translate(i,a),x.rotateAtPoint(i,a,b),r.set(o?"startArrowShape":"endArrowShape",x)}function ms(r,t,e,n,i){var a=r1(n-t,e-r);return{dx:Ad(a)*i,dy:Cd(a)*i}}function n1(r,t,e,n,i,a){typeof t.startArrow=="object"?mO(r,t,e,n,i,a,!0):t.startArrow?yO(r,t,e,n,i,a,!0):r.set("startArrowShape",null)}function i1(r,t,e,n,i,a){typeof t.endArrow=="object"?mO(r,t,e,n,i,a,!1):t.endArrow?yO(r,t,e,n,i,a,!1):r.set("startArrowShape",null)}var b_={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function Gu(r,t){var e=t.attr();for(var n in e){var i=e[n],a=b_[n]?b_[n]:n;a==="matrix"&&i?r.transform(i[0],i[1],i[3],i[4],i[6],i[7]):a==="lineDash"&&r.setLineDash?gt(i)&&r.setLineDash(i):(a==="strokeStyle"||a==="fillStyle"?i=gW(r,t,i):a==="globalAlpha"&&(i=i*r.globalAlpha),r[a]=i)}}function hy(r,t,e){for(var n=0;n<t.length;n++){var i=t[n];i.cfg.visible?i.draw(r,e):i.skipDraw()}}function mW(r,t,e){var n=r.get("refreshElements");me(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?a1(t):dy(t,e)}function dy(r,t){for(var e=0;e<r.length;e++){var n=r[e];if(n.cfg.visible)if(n.cfg.hasChanged)n.cfg.refresh=!0,n.isGroup()&&a1(n.cfg.children);else if(n.cfg.refresh)n.isGroup()&&dy(n.cfg.children,t);else{var i=bW(n,t);n.cfg.refresh=i,i&&n.isGroup()&&dy(n.cfg.children,t)}}}function bO(r){for(var t=0;t<r.length;t++){var e=r[t];e.cfg.hasChanged=!1,e.isGroup()&&!e.destroyed&&bO(e.cfg.children)}}function a1(r,t){for(var e=0;e<r.length;e++){var n=r[e];n.cfg.visible&&(n.cfg.refresh=!0,n.isGroup()&&a1(n.get("children")))}}function bW(r,t){var e=r.cfg.cacheCanvasBBox,n=r.cfg.isInView&&e&&wl(e,t);return n}function xO(r,t,e,n){var i=e.path,a=e.startArrow,o=e.endArrow;if(i){var s=[0,0],u=[0,0],f={dx:0,dy:0};t.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=ms(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=ms(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=ms(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":t.moveTo(c[1]-p,c[2]-g),u=[c[1],c[2]];break;case"L":t.lineTo(c[1]-p,c[2]-g);break;case"Q":t.quadraticCurveTo(c[1],c[2],c[3]-p,c[4]-g);break;case"C":t.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=m_(s,c),n[l]=y)):y=m_(s,c);var m=y.cx,b=y.cy,x=y.rx,E=y.ry,w=y.startAngle,_=y.endAngle,M=y.xRotation,C=y.sweepFlag;if(t.ellipse)t.ellipse(m,b,x,E,M,w,_,1-C);else{var S=x>E?x:E,A=x>E?1:x/E,T=x>E?E/x:1;t.translate(m,b),t.rotate(M),t.scale(A,T),t.arc(0,0,S,w,_,1-C),t.scale(1/A,1/T),t.rotate(-M),t.translate(-m,-b)}break}case"Z":t.closePath();break}if(h==="Z")s=u;else{var I=c.length;s=[c[I-2],c[I-1]]}}}}function EO(r,t){var e=r.get("canvas");e&&(t==="remove"&&(r._cacheCanvasBBox=r.get("cacheCanvasBBox")),r.get("hasChanged")||(r.set("hasChanged",!0),r.cfg.parent&&r.cfg.parent.get("hasChanged")||(e.refreshElement(r,t,e),e.get("autoDraw")&&e.draw())))}function xW(r){var t;if(r.destroyed)t=r._cacheCanvasBBox;else{var e=r.get("cacheCanvasBBox"),n=e&&!!(e.width&&e.height),i=r.getCanvasBBox(),a=i&&!!(i.width&&i.height);n&&a?t=fW(e,i):n?t=e:a&&(t=i)}return t}function EW(r){if(!r.length)return null;var t=[],e=[],n=[],i=[];return me(r,function(a){var o=xW(a);o&&(t.push(o.minX),e.push(o.minY),n.push(o.maxX),i.push(o.maxY))}),{minX:ga(t),minY:ga(e),maxX:pa(n),maxY:pa(i)}}function wW(r,t){return!r||!t||!wl(r,t)?null:{minX:Math.max(r.minX,t.minX),minY:Math.max(r.minY,t.minY),maxX:Math.min(r.maxX,t.maxX),maxY:Math.min(r.maxY,t.maxY)}}var wO=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.onCanvasChange=function(e){EO(this,e)},t.prototype.getShapeBase=function(){return um},t.prototype.getGroupBase=function(){return t},t.prototype._applyClip=function(e,n){n&&(e.save(),Gu(e,n),n.createPath(e),e.restore(),e.clip(),n._afterDraw())},t.prototype.cacheCanvasBBox=function(){var e=this.cfg.children,n=[],i=[];me(e,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=ga(n),s=pa(n),u=ga(i),f=pa(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",wl(a,c))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",a)},t.prototype.draw=function(e,n){var i=this.cfg.children,a=n?this.cfg.refresh:!0;i.length&&a&&(e.save(),Gu(e,this),this._applyClip(e,this.getClip()),hy(e,i,n),e.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},t.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},t}(nI),Gi=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},t.prototype.getShapeBase=function(){return um},t.prototype.getGroupBase=function(){return wO},t.prototype.onCanvasChange=function(e){EO(this,e)},t.prototype.calculateBBox=function(){var e=this.get("type"),n=this.getHitLineWidth(),i=oI(e),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}},t.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},t.prototype.isStroke=function(){return!!this.attrs.stroke},t.prototype._applyClip=function(e,n){n&&(e.save(),Gu(e,n),n.createPath(e),e.restore(),e.clip(),n._afterDraw())},t.prototype.draw=function(e,n){var i=this.cfg.clipShape;if(n){if(this.cfg.refresh===!1){this.set("hasChanged",!1);return}var a=this.getCanvasBBox();if(!wl(n,a)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}e.save(),Gu(e,this),this._applyClip(e,i),this.drawPath(e),e.restore(),this._afterDraw()},t.prototype.getCanvasViewBox=function(){var e=this.cfg.canvas;return e?e.getViewRange():null},t.prototype.cacheCanvasBBox=function(){var e=this.getCanvasViewBox();if(e){var n=this.getCanvasBBox(),i=wl(n,e);this.set("isInView",i),i?this.set("cacheCanvasBBox",n):this.set("cacheCanvasBBox",null)}},t.prototype._afterDraw=function(){this.cacheCanvasBBox(),this.set("hasChanged",!1),this.set("refresh",null)},t.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("isInView",null),this.set("hasChanged",!1)},t.prototype.drawPath=function(e){this.createPath(e),this.strokeAndFill(e),this.afterDrawPath(e)},t.prototype.fill=function(e){e.fill()},t.prototype.stroke=function(e){e.stroke()},t.prototype.strokeAndFill=function(e){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isFill()&&(!ct(s)&&s!==1?(e.globalAlpha=s,this.fill(e),e.globalAlpha=a):this.fill(e)),this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(e.globalAlpha=o),this.stroke(e)),this.afterDrawPath(e)},t.prototype.createPath=function(e){},t.prototype.afterDrawPath=function(e){},t.prototype.isInShape=function(e,n){var i=this.isStroke(),a=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(e,n,i,a,o)},t.prototype.isInStrokeOrPath=function(e,n,i,a,o){return!1},t.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var e=this.attrs;return e.lineWidth+e.lineAppendWidth},t}(iI),_W=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,r:0})},t.prototype.isInStrokeOrPath=function(e,n,i,a,o){var s=this.attr(),u=s.x,f=s.y,l=s.r,c=o/2,h=vO(u,f,e,n);return a&&i?h<=l+c:a?h<=l:i?h>=l-c&&h<=l+c:!1},t.prototype.createPath=function(e){var n=this.attr(),i=n.x,a=n.y,o=n.r;e.beginPath(),e.arc(i,a,o,0,Math.PI*2,!1),e.closePath()},t}(Gi);function fh(r,t,e,n){return r/(e*e)+t/(n*n)}var SW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,rx:0,ry:0})},t.prototype.isInStrokeOrPath=function(e,n,i,a,o){var s=this.attr(),u=o/2,f=s.x,l=s.y,c=s.rx,h=s.ry,d=(e-f)*(e-f),v=(n-l)*(n-l);return a&&i?fh(d,v,c+u,h+u)<=1:a?fh(d,v,c,h)<=1:i?fh(d,v,c-u,h-u)>=1&&fh(d,v,c+u,h+u)<=1:!1},t.prototype.createPath=function(e){var n=this.attr(),i=n.x,a=n.y,o=n.rx,s=n.ry;if(e.beginPath(),e.ellipse)e.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;e.save(),e.translate(i,a),e.scale(f,l),e.arc(0,0,u,0,Math.PI*2),e.restore(),e.closePath()}},t}(Gi);function x_(r){return r instanceof HTMLElement&&Ne(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS"}var MW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,width:0,height:0})},t.prototype.initAttrs=function(e){this._setImage(e.img)},t.prototype.isStroke=function(){return!1},t.prototype.isOnlyHitBox=function(){return!0},t.prototype._afterLoading=function(){if(this.get("toDraw")===!0){var e=this.get("canvas");e?e.draw():this.createPath(this.get("context"))}},t.prototype._setImage=function(e){var n=this,i=this.attrs;if(Ne(e)){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=e,this.set("loading",!0)}else e instanceof Image?(i.width||(i.width=e.width),i.height||(i.height=e.height)):x_(e)&&(i.width||(i.width=Number(e.getAttribute("width"))),i.height||(i.height,Number(e.getAttribute("height"))))},t.prototype.onAttrChange=function(e,n,i){r.prototype.onAttrChange.call(this,e,n,i),e==="img"&&this._setImage(n)},t.prototype.createPath=function(e){if(this.get("loading")){this.set("toDraw",!0),this.set("context",e);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||x_(h))&&(!ct(u)&&!ct(f)&&!ct(l)&&!ct(c)?e.drawImage(h,u,f,l,c,i,a,o,s):e.drawImage(h,i,a,o,s))},t}(Gi);function _o(r,t,e,n,i,a,o){var s=Math.min(r,e),u=Math.max(r,e),f=Math.min(t,n),l=Math.max(t,n),c=i/2;return a>=s-c&&a<=u+c&&o>=f-c&&o<=l+c?mn.pointToLine(r,t,e,n,a,o)<=i/2:!1}var CW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},t.prototype.initAttrs=function(e){this.setArrow()},t.prototype.onAttrChange=function(e,n,i){r.prototype.onAttrChange.call(this,e,n,i),this.setArrow()},t.prototype.setArrow=function(){var e=this.attr(),n=e.x1,i=e.y1,a=e.x2,o=e.y2,s=e.startArrow,u=e.endArrow;s&&n1(this,e,a,o,n,i),u&&i1(this,e,n,i,a,o)},t.prototype.isInStrokeOrPath=function(e,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 _o(u,f,l,c,o,e,n)},t.prototype.createPath=function(e){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=ms(i,a,o,s,n.startArrow.d)),f&&f.d&&(c=ms(i,a,o,s,n.endArrow.d)),e.beginPath(),e.moveTo(i+l.dx,a+l.dy),e.lineTo(o-c.dx,s-c.dy)},t.prototype.afterDrawPath=function(e){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(e),i&&i.draw(e)},t.prototype.getTotalLength=function(){var e=this.attr(),n=e.x1,i=e.y1,a=e.x2,o=e.y2;return mn.length(n,i,a,o)},t.prototype.getPoint=function(e){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return mn.pointAt(i,a,o,s,e)},t}(Gi),AW={circle:function(r,t,e){return[["M",r-e,t],["A",e,e,0,1,0,r+e,t],["A",e,e,0,1,0,r-e,t]]},square:function(r,t,e){return[["M",r-e,t-e],["L",r+e,t-e],["L",r+e,t+e],["L",r-e,t+e],["Z"]]},diamond:function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},triangle:function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t+n],["L",r,t-n],["L",r+e,t+n],["Z"]]},"triangle-down":function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t-n],["L",r+e,t-n],["L",r,t+n],["Z"]]}},TW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.initAttrs=function(e){this._resetParamsCache()},t.prototype._resetParamsCache=function(){this.set("paramsCache",{})},t.prototype.onAttrChange=function(e,n,i){r.prototype.onAttrChange.call(this,e,n,i),["symbol","x","y","r","radius"].indexOf(e)!==-1&&this._resetParamsCache()},t.prototype.isOnlyHitBox=function(){return!0},t.prototype._getR=function(e){return ct(e.r)?e.radius:e.r},t.prototype._getPath=function(){var e=this.attr(),n=e.x,i=e.y,a=e.symbol||"circle",o=this._getR(e),s,u;if(Cr(a))s=a,u=s(n,i,o),u=bI(u);else{if(s=t.Symbols[a],!s)return console.warn(a+" marker is not supported."),null;u=s(n,i,o)}return u},t.prototype.createPath=function(e){var n=this._getPath(),i=this.get("paramsCache");xO(this,e,{path:n},i)},t.Symbols=AW,t}(Gi);function _O(r,t,e){var n=pI();return r.createPath(n),n.isPointInPath(t,e)}var IW=1e-6;function Lg(r){return Math.abs(r)<IW?0:r<0?-1:1}function OW(r,t,e){return(e[0]-r[0])*(t[1]-r[1])===(t[0]-r[0])*(e[1]-r[1])&&Math.min(r[0],t[0])<=e[0]&&e[0]<=Math.max(r[0],t[0])&&Math.min(r[1],t[1])<=e[1]&&e[1]<=Math.max(r[1],t[1])}function SO(r,t,e){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(OW(o,s,[t,e]))return!0;Lg(o[1]-e)>0!=Lg(s[1]-e)>0&&Lg(t-(e-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function Uf(r,t,e,n,i,a,o,s){var u=(Math.atan2(s-t,o-r)+Math.PI*2)%(Math.PI*2);if(u<n||u>i)return!1;var f={x:r+e*Math.cos(u),y:t+e*Math.sin(u)};return vO(f.x,f.y,o,s)<=a/2}var LW=xi;function DW(r){for(var t=!1,e=r.length,n=0;n<e;n++){var i=r[n],a=i[0];if(a==="C"||a==="A"||a==="Q"){t=!0;break}}return t}function kW(r,t,e,n,i){for(var a=!1,o=t/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&&!gs(h.x-o,h.y-o,h.width+t,h.height+t,e,n))){switch(u.command){case"L":case"Z":a=_o(c[0],c[1],f[0],f[1],t,e,n);break;case"Q":var d=cI.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],e,n);a=d<=t/2;break;case"C":var v=qf.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],l[5],l[6],e,n,i);a=v<=t/2;break;case"A":var p=u.arcParams,g=p.cx,y=p.cy,m=p.rx,b=p.ry,x=p.startAngle,E=p.endAngle,w=p.xRotation,_=[e,n,1],M=m>b?m:b,C=m>b?1:m/b,S=m>b?b/m:1,A=LW(null,[["t",-g,-y],["r",-w],["s",1/C,1/S]]);fv(_,_,A),a=Uf(0,0,M,x,E,t,_[0],_[1]);break}if(a)break}}return a}function PW(r){for(var t=r.length,e=[],n=[],i=[],a=0;a<t;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&&(e.push(i),i=[]):i.push([o[1],o[2]])}return i.length>0&&n.push(i),{polygons:e,polylines:n}}const lh=F({hasArc:DW,extractPolygons:PW,isPointInStroke:kW},$z);function E_(r,t,e){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=SO(a,t,e),n)break}return n}var o1=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{startArrow:!1,endArrow:!1})},t.prototype.initAttrs=function(e){this._setPathArr(e.path),this.setArrow()},t.prototype.onAttrChange=function(e,n,i){r.prototype.onAttrChange.call(this,e,n,i),e==="path"&&this._setPathArr(n),this.setArrow()},t.prototype._setPathArr=function(e){this.attrs.path=bI(e);var n=lh.hasArc(e);this.set("hasArc",n),this.set("paramsCache",{}),this.set("segments",null),this.set("curve",null),this.set("tCache",null),this.set("totalLength",null)},t.prototype.getSegments=function(){var e=this.get("segements");return e||(e=xI(this.attr("path")),this.set("segments",e)),e},t.prototype.setArrow=function(){var e=this.attr(),n=e.startArrow,i=e.endArrow;if(n){var a=this.getStartTangent();n1(this,e,a[0][0],a[0][1],a[1][0],a[1][1])}if(i){var a=this.getEndTangent();i1(this,e,a[0][0],a[0][1],a[1][0],a[1][1])}},t.prototype.isInStrokeOrPath=function(e,n,i,a,o){var s=this.getSegments(),u=this.get("hasArc"),f=!1;if(i){var l=this.getTotalLength();f=lh.isPointInStroke(s,o,e,n,l)}if(!f&&a)if(u)f=_O(this,e,n);else{var c=this.attr("path"),h=lh.extractPolygons(c);f=E_(h.polygons,e,n)||E_(h.polylines,e,n)}return f},t.prototype.createPath=function(e){var n=this.attr(),i=this.get("paramsCache");xO(this,e,n,i)},t.prototype.afterDrawPath=function(e){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(e),i&&i.draw(e)},t.prototype.getTotalLength=function(){var e=this.get("totalLength");return ct(e)?(this._calculateCurve(),this._setTcache(),this.get("totalLength")):e},t.prototype.getPoint=function(e){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;me(n,function(l,c){e>=l[0]&&e<=l[1]&&(i=(e-l[0])/(l[1]-l[0]),a=c)});var s=o[a];if(ct(s)||ct(a))return null;var u=s.length,f=o[a+1];return qf.pointAt(s[u-2],s[u-1],f[1],f[2],f[3],f[4],f[5],f[6],i)},t.prototype._calculateCurve=function(){var e=this.attr().path;this.set("curve",lh.pathToCurve(e))},t.prototype._setTcache=function(){var e=0,n=0,i=[],a,o,s,u,f=this.get("curve");if(f){if(me(f,function(l,c){s=f[c+1],u=l.length,s&&(e+=qf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6])||0)}),this.set("totalLength",e),e===0){this.set("tCache",[]);return}me(f,function(l,c){s=f[c+1],u=l.length,s&&(a=[],a[0]=n/e,o=qf.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/e,i.push(a))}),this.set("tCache",i)}},t.prototype.getStartTangent=function(){var e=this.getSegments(),n;if(e.length>1){var i=e[0].currentPoint,a=e[1].currentPoint,o=e[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},t.prototype.getEndTangent=function(){var e=this.getSegments(),n=e.length,i;if(n>1){var a=e[n-2].currentPoint,o=e[n-1].currentPoint,s=e[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},t}(Gi);function MO(r,t,e,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(_o(s,u,f,l,t,e,n))return!0}if(i){var c=r[0],h=r[a-1];if(_o(c[0],c[1],h[0],h[1],t,e,n))return!0}return!1}var NW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.isInStrokeOrPath=function(e,n,i,a,o){var s=this.attr().points,u=!1;return i&&(u=MO(s,o,e,n,!0)),!u&&a&&(u=SO(s,e,n)),u},t.prototype.createPath=function(e){var n=this.attr(),i=n.points;if(!(i.length<2)){e.beginPath();for(var a=0;a<i.length;a++){var o=i[a];a===0?e.moveTo(o[0],o[1]):e.lineTo(o[0],o[1])}e.closePath()}},t}(Gi),RW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{startArrow:!1,endArrow:!1})},t.prototype.initAttrs=function(e){this.setArrow()},t.prototype.onAttrChange=function(e,n,i){r.prototype.onAttrChange.call(this,e,n,i),this.setArrow(),["points"].indexOf(e)!==-1&&this._resetCache()},t.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},t.prototype.setArrow=function(){var e=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&&n1(this,e,i[1][0],i[1][1],u,f),o&&i1(this,e,i[s-2][0],i[s-2][1],l,c)},t.prototype.isFill=function(){return!1},t.prototype.isInStrokeOrPath=function(e,n,i,a,o){if(!i||!o)return!1;var s=this.attr().points;return MO(s,o,e,n,!1)},t.prototype.isStroke=function(){return!0},t.prototype.createPath=function(e){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=ms(u,f,i[1][0],i[1][1],a.d);u+=h.dx,f+=h.dy}if(o&&o.d){var h=ms(i[s-2][0],i[s-2][1],l,c,o.d);l-=h.dx,c-=h.dy}e.beginPath(),e.moveTo(u,f);for(var d=0;d<s-1;d++){var v=i[d];e.lineTo(v[0],v[1])}e.lineTo(l,c)}},t.prototype.afterDrawPath=function(e){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(e),i&&i.draw(e)},t.prototype.getTotalLength=function(){var e=this.attr().points,n=this.get("totalLength");return ct(n)?(this.set("totalLength",vI.length(e)),this.get("totalLength")):n},t.prototype.getPoint=function(e){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return me(i,function(s,u){e>=s[0]&&e<=s[1]&&(a=(e-s[0])/(s[1]-s[0]),o=u)}),mn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},t.prototype._setTcache=function(){var e=this.attr().points;if(!(!e||e.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;me(e,function(u,f){e[f+1]&&(o=[],o[0]=i/n,s=mn.length(u[0],u[1],e[f+1][0],e[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},t.prototype.getStartTangent=function(){var e=this.attr().points,n=[];return n.push([e[1][0],e[1][1]]),n.push([e[0][0],e[0][1]]),n},t.prototype.getEndTangent=function(){var e=this.attr().points,n=e.length-1,i=[];return i.push([e[n-1][0],e[n-1][1]]),i.push([e[n][0],e[n][1]]),i},t}(Gi);function BW(r,t,e,n,i,a,o){var s=i/2;return gs(r-s,t-s,e,i,a,o)||gs(r+e-s,t-s,i,n,a,o)||gs(r+s,t+n-s,e,i,a,o)||gs(r-s,t+s,i,n,a,o)}function FW(r,t,e,n,i,a,o,s){return _o(r+i,t,r+e-i,t,a,o,s)||_o(r+e,t+i,r+e,t+n-i,a,o,s)||_o(r+e-i,t+n,r+i,t+n,a,o,s)||_o(r,t+n-i,r,t+i,a,o,s)||Uf(r+e-i,t+i,i,1.5*Math.PI,2*Math.PI,a,o,s)||Uf(r+e-i,t+n-i,i,0,.5*Math.PI,a,o,s)||Uf(r+i,t+n-i,i,.5*Math.PI,Math.PI,a,o,s)||Uf(r+i,t+i,i,Math.PI,1.5*Math.PI,a,o,s)}var GW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,width:0,height:0,radius:0})},t.prototype.isInStrokeOrPath=function(e,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=FW(u,f,l,c,h,o,e,n)),!v&&a&&(v=_O(this,e,n)),v}else{var d=o/2;if(a&&i)return gs(u-d,f-d,l+d,c+d,e,n);if(a)return gs(u,f,l,c,e,n);if(i)return BW(u,f,l,c,o,e,n)}},t.prototype.createPath=function(e){var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.radius;if(e.beginPath(),u===0)e.rect(i,a,o,s);else{var f=yW(u),l=f[0],c=f[1],h=f[2],d=f[3];e.moveTo(i+l,a),e.lineTo(i+o-c,a),c!==0&&e.arc(i+o-c,a+c,c,-Math.PI/2,0),e.lineTo(i+o,a+s-h),h!==0&&e.arc(i+o-h,a+s-h,h,0,Math.PI/2),e.lineTo(i+d,a+s),d!==0&&e.arc(i+d,a+s-d,d,Math.PI/2,Math.PI),e.lineTo(i,a+l),l!==0&&e.arc(i+l,a+l,l,Math.PI,Math.PI*1.5),e.closePath()}},t}(Gi),zW=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},t.prototype.isOnlyHitBox=function(){return!0},t.prototype.initAttrs=function(e){this._assembleFont(),e.text&&this._setText(e.text)},t.prototype._assembleFont=function(){var e=this.attrs;e.font=yI(e)},t.prototype._setText=function(e){var n=null;Ne(e)&&e.indexOf(`
21
- `)!==-1&&(n=e.split(`
22
- `)),this.set("textArr",n)},t.prototype.onAttrChange=function(e,n,i){r.prototype.onAttrChange.call(this,e,n,i),e.startsWith("font")&&this._assembleFont(),e==="text"&&this._setText(n)},t.prototype._getSpaceingY=function(){var e=this.attrs,n=e.lineHeight,i=e.fontSize*1;return n?n-i:i*.14},t.prototype._drawTextArr=function(e,n,i){var a=this.attrs,o=a.textBaseline,s=a.x,u=a.y,f=a.fontSize*1,l=this._getSpaceingY(),c=gI(a.text,a.fontSize,a.lineHeight),h;me(n,function(d,v){h=u+v*(l+f)-c+f,o==="middle"&&(h+=c-f-(c-f)/2),o==="top"&&(h+=c-f),ct(d)||(i?e.fillText(d,s,h):e.strokeText(d,s,h))})},t.prototype._drawText=function(e,n){var i=this.attr(),a=i.x,o=i.y,s=this.get("textArr");if(s)this._drawTextArr(e,s,n);else{var u=i.text;ct(u)||(n?e.fillText(u,a,o):e.strokeText(u,a,o))}},t.prototype.strokeAndFill=function(e){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(e.globalAlpha=a),this.stroke(e)),this.isFill()&&(!ct(s)&&s!==1?(e.globalAlpha=s,this.fill(e),e.globalAlpha=a):this.fill(e)),this.afterDrawPath(e)},t.prototype.fill=function(e){this._drawText(e,!0)},t.prototype.stroke=function(e){this._drawText(e,!1)},t}(Gi);function jW(r,t){if(t){var e=GT(t);return ps(e,r)}return r}function CO(r,t,e){var n=r.getTotalMatrix();if(n){var i=jW([t,e,1],n),a=i[0],o=i[1];return[a,o]}return[t,e]}function w_(r,t,e){if(r.isCanvas&&r.isCanvas())return!0;if(!z0(r)||r.cfg.isInView===!1)return!1;if(r.cfg.clipShape){var n=CO(r,t,e),i=n[0],a=n[1];if(r.isClipped(i,a))return!1}var o=r.cfg.cacheCanvasBBox||r.getCanvasBBox();return t>=o.minX&&t<=o.maxX&&e>=o.minY&&e<=o.maxY}function AO(r,t,e){if(!w_(r,t,e))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=AO(s,t,e);else if(w_(s,t,e)){var u=s,f=CO(s,t,e),l=f[0],c=f[1];u.isInShape(l,c)&&(n=s)}if(n)break}return n}var $a=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getDefaultCfg=function(){var e=r.prototype.getDefaultCfg.call(this);return e.renderer="canvas",e.autoDraw=!0,e.localRefresh=!0,e.refreshElements=[],e.clipView=!0,e.quickHit=!1,e},t.prototype.onCanvasChange=function(e){(e==="attr"||e==="sort"||e==="changeSize")&&(this.set("refreshElements",[this]),this.draw())},t.prototype.getShapeBase=function(){return um},t.prototype.getGroupBase=function(){return wO},t.prototype.getPixelRatio=function(){var e=this.get("pixelRatio")||uW();return e>=1?Math.ceil(e):1},t.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},t.prototype.createDom=function(){var e=document.createElement("canvas"),n=e.getContext("2d");return this.set("context",n),e},t.prototype.setDOMSize=function(e,n){r.prototype.setDOMSize.call(this,e,n);var i=this.get("context"),a=this.get("el"),o=this.getPixelRatio();a.width=o*e,a.height=o*n,o>1&&i.scale(o,o)},t.prototype.clear=function(){r.prototype.clear.call(this),this._clearFrame();var e=this.get("context"),n=this.get("el");e.clearRect(0,0,n.width,n.height)},t.prototype.getShape=function(e,n){var i;return this.get("quickHit")?i=AO(this,e,n):i=r.prototype.getShape.call(this,e,n,null),i},t.prototype._getRefreshRegion=function(){var e=this.get("refreshElements"),n=this.getViewRange(),i;if(e.length&&e[0]===this)i=n;else if(i=EW(e),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=wW(i,n))}return i},t.prototype.refreshElement=function(e){var n=this.get("refreshElements");n.push(e)},t.prototype._clearFrame=function(){var e=this.get("drawFrame");e&&(AC(e),this.set("drawFrame",null),this.set("refreshElements",[]))},t.prototype.draw=function(){var e=this.get("drawFrame");this.get("autoDraw")&&e||this._startDraw()},t.prototype._drawAll=function(){var e=this.get("context"),n=this.get("el"),i=this.getChildren();e.clearRect(0,0,n.width,n.height),Gu(e,this),hy(e,i),this.set("refreshElements",[])},t.prototype._drawRegion=function(){var e=this.get("context"),n=this.get("refreshElements"),i=this.getChildren(),a=this._getRefreshRegion();a?(e.clearRect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),e.save(),e.beginPath(),e.rect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),e.clip(),Gu(e,this),mW(this,i,a),hy(e,i,a),e.restore()):n.length&&bO(n),me(n,function(o){o.get("hasChanged")&&o.set("hasChanged",!1)}),this.set("refreshElements",[])},t.prototype._startDraw=function(){var e=this,n=this.get("drawFrame");n||(n=CC(function(){e.get("localRefresh")?e._drawRegion():e._drawAll(),e.set("drawFrame",null)}),this.set("drawFrame",n))},t.prototype.skipDraw=function(){},t.prototype.removeDom=function(){var e=this.get("el");e.width=0,e.height=0,e.parentNode.removeChild(e)},t}(rI),vy={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},sr={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 mi(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function TO(r){var t=vy[r.type],e=r.getParent();if(!t)throw new Error("the type "+r.type+" is not supported by svg");var n=mi(t);if(r.get("id")&&(n.id=r.get("id")),r.set("el",n),r.set("attrs",{}),e){var i=e.get("el");i||(i=e.createDom(),e.set("el",i)),i.appendChild(n)}return n}function IO(r,t){var e=r.get("el"),n=LC(e.children).sort(t),i=document.createDocumentFragment();n.forEach(function(a){i.appendChild(a)}),e.appendChild(i)}function UW(r,t){var e=r.parentNode,n=Array.from(e.childNodes).filter(function(s){return s.nodeType===1&&s.nodeName.toLowerCase()!=="defs"}),i=n[t],a=n.indexOf(r);if(i){if(a>t)e.insertBefore(r,i);else if(a<t){var o=n[t+1];o?e.insertBefore(r,o):e.appendChild(r)}}else e.appendChild(r)}function $W(r,t){var e=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)e.removeAttribute("filter");else{var a=t.find("filter",i);a||(a=t.addShadow(i)),e.setAttribute("filter","url(#"+a+")")}}function jl(r){var t=r.attr().matrix;if(t){for(var e=r.cfg.el,n=[],i=0;i<9;i+=3)n.push(t[i]+","+t[i+1]);n=n.join(","),n.indexOf("NaN")===-1?e.setAttribute("transform","matrix("+n+")"):console.warn("invalid matrix:",t)}}function _l(r,t){var e=r.getClip(),n=r.get("el");if(!e)n.removeAttribute("clip-path");else if(e&&!n.hasAttribute("clip-path")){TO(e),e.createPath(t);var i=t.addClip(e);n.setAttribute("clip-path","url(#"+i+")")}}function OO(r,t){t.forEach(function(e){e.draw(r)})}function LO(r,t){var e=r.get("canvas");if(e&&e.get("autoDraw")){var n=e.get("context"),i=r.getParent(),a=i?i.getChildren():[e],o=r.get("el");if(t==="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(t==="show")o.setAttribute("visibility","visible");else if(t==="hide")o.setAttribute("visibility","hidden");else if(t==="zIndex")UW(o,a.indexOf(r));else if(t==="sort"){var l=r.get("children");l&&l.length&&IO(r,function(c,h){return l.indexOf(c)-l.indexOf(h)?1:0})}else t==="clear"?o&&(o.innerHTML=""):t==="matrix"?jl(r):t==="clip"?_l(r,n):t==="attr"||t==="add"&&r.draw(n)}}var DO=function(r){Ot(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.isEntityGroup=function(){return!0},t.prototype.createDom=function(){var e=mi("g");this.set("el",e);var n=this.getParent();if(n){var i=n.get("el");i||(i=n.createDom(),n.set("el",i)),i.appendChild(e)}return e},t.prototype.afterAttrsChange=function(e){r.prototype.afterAttrsChange.call(this,e);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.createPath(i,e)}},t.prototype.onCanvasChange=function(e){LO(this,e)},t.prototype.getShapeBase=function(){return fm},t.prototype.getGroupBase=function(){return t},t.prototype.draw=function(e){var n=this.getChildren(),i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||this.createDom(),_l(this,e),this.createPath(e),n.length&&OO(e,n))},t.prototype.createPath=function(e,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){sr[s]&&a.setAttribute(sr[s],o)}),jl(this)},t}(nI),Ei=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="svg",e.canFill=!1,e.canStroke=!1,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},t.prototype.afterAttrsChange=function(e){r.prototype.afterAttrsChange.call(this,e);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.draw(i,e)}},t.prototype.getShapeBase=function(){return fm},t.prototype.getGroupBase=function(){return DO},t.prototype.onCanvasChange=function(e){LO(this,e)},t.prototype.calculateBBox=function(){var e=this.get("el"),n=null;if(e)n=e.getBBox();else{var i=oI(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}},t.prototype.isFill=function(){var e=this.attr(),n=e.fill,i=e.fillStyle;return(n||i||this.isClipShape())&&this.canFill},t.prototype.isStroke=function(){var e=this.attr(),n=e.stroke,i=e.strokeStyle;return(n||i)&&this.canStroke},t.prototype.draw=function(e,n){var i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||TO(this),_l(this,e),this.createPath(e,n),this.shadow(e,n),this.strokeAndFill(e,n),this.transform(n))},t.prototype.createPath=function(e,n){},t.prototype.strokeAndFill=function(e,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(e,"fill",a):"fillStyle"in i&&this._setColor(e,"fill",o):this._setColor(e,"fill",a||o),f&&h.setAttribute(sr.fillOpacity,f)),this.canStroke&&c>0&&(n?"stroke"in i?this._setColor(e,"stroke",s):"strokeStyle"in i&&this._setColor(e,"stroke",u):this._setColor(e,"stroke",s||u),l&&h.setAttribute(sr.strokeOpacity,l),c&&h.setAttribute(sr.lineWidth,c))},t.prototype._setColor=function(e,n,i){var a=this.get("el");if(!i){a.setAttribute(sr[n],"none");return}if(i=i.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(i)){var o=e.find("gradient",i);o||(o=e.addGradient(i)),a.setAttribute(sr[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(i)){var o=e.find("pattern",i);o||(o=e.addPattern(i)),a.setAttribute(sr[n],"url(#"+o+")")}else a.setAttribute(sr[n],i)},t.prototype.shadow=function(e,n){var i=this.attr(),a=n||i,o=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,f=a.shadowColor;(o||s||u||f)&&$W(this,e)},t.prototype.transform=function(e){var n=this.attr(),i=(e||n).matrix;i&&jl(this)},t.prototype.isInShape=function(e,n){return this.isPointInPath(e,n)},t.prototype.isPointInPath=function(e,n){var i=this.get("el"),a=this.get("canvas"),o=a.get("el").getBoundingClientRect(),s=e+o.left,u=n+o.top,f=document.elementFromPoint(s,u);return!!(f&&f.isEqualNode(i))},t.prototype.getHitLineWidth=function(){var e=this.attrs,n=e.lineWidth,i=e.lineAppendWidth;return this.isStroke()?n+i:0},t}(iI),WW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="circle",e.canFill=!0,e.canStroke=!0,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,r:0})},t.prototype.createPath=function(e,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):sr[s]&&a.setAttribute(sr[s],o)})},t}(Ei),XW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="dom",e.canFill=!1,e.canStroke=!1,e}return t.prototype.createPath=function(e,n){var i=this.attr(),a=this.get("el");if(me(n||i,function(f,l){sr[l]&&a.setAttribute(sr[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},t}(Ei),YW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="ellipse",e.canFill=!0,e.canStroke=!0,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,rx:0,ry:0})},t.prototype.createPath=function(e,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):sr[s]&&a.setAttribute(sr[s],o)})},t}(Ei),VW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="image",e.canFill=!1,e.canStroke=!1,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,width:0,height:0})},t.prototype.createPath=function(e,n){var i=this,a=this.attr(),o=this.get("el");me(n||a,function(s,u){u==="img"?i._setImage(a.img):sr[u]&&o.setAttribute(sr[u],s)})},t.prototype.setAttr=function(e,n){this.attrs[e]=n,e==="img"&&this._setImage(n)},t.prototype._setImage=function(e){var n=this.attr(),i=this.get("el");if(Ne(e))i.setAttribute("href",e);else if(e instanceof window.Image)n.width||(i.setAttribute("width",e.width),this.attr("width",e.width)),n.height||(i.setAttribute("height",e.height),this.attr("height",e.height)),i.setAttribute("href",e.src);else if(e instanceof HTMLElement&&Ne(e.nodeName)&&e.nodeName.toUpperCase()==="CANVAS")i.setAttribute("href",e.toDataURL());else if(e instanceof ImageData){var a=document.createElement("canvas");a.setAttribute("width",""+e.width),a.setAttribute("height",""+e.height),a.getContext("2d").putImageData(e,0,0),n.width||(i.setAttribute("width",""+e.width),this.attr("width",e.width)),n.height||(i.setAttribute("height",""+e.height),this.attr("height",e.height)),i.setAttribute("href",a.toDataURL())}},t}(Ei),HW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="line",e.canFill=!1,e.canStroke=!0,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},t.prototype.createPath=function(e,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=bn(o)?e.addArrow(i,sr[s]):e.getDefaultArrow(i,sr[s]);a.setAttribute(sr[s],"url(#"+u+")")}else a.removeAttribute(sr[s]);else sr[s]&&a.setAttribute(sr[s],o)})},t.prototype.getTotalLength=function(){var e=this.attr(),n=e.x1,i=e.y1,a=e.x2,o=e.y2;return mn.length(n,i,a,o)},t.prototype.getPoint=function(e){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return mn.pointAt(i,a,o,s,e)},t}(Ei),ch={circle:function(r,t,e){return[["M",r,t],["m",-e,0],["a",e,e,0,1,0,e*2,0],["a",e,e,0,1,0,-e*2,0]]},square:function(r,t,e){return[["M",r-e,t-e],["L",r+e,t-e],["L",r+e,t+e],["L",r-e,t+e],["Z"]]},diamond:function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},triangle:function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t+n],["L",r,t-n],["L",r+e,t+n],["z"]]},triangleDown:function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t-n],["L",r+e,t-n],["L",r,t+n],["Z"]]}};const __={get:function(r){return ch[r]},register:function(r,t){ch[r]=t},remove:function(r){delete ch[r]},getAll:function(){return ch}};var KW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="marker",e.canFill=!0,e.canStroke=!0,e}return t.prototype.createPath=function(e){var n=this.get("el");n.setAttribute("d",this._assembleMarker())},t.prototype._assembleMarker=function(){var e=this._getPath();return gt(e)?e.map(function(n){return n.join(" ")}).join(""):e},t.prototype._getPath=function(){var e=this.attr(),n=e.x,i=e.y,a=e.r||e.radius,o=e.symbol||"circle",s;return Cr(o)?s=o:s=__.get(o),s?s(n,i,a):(console.warn(s+" symbol is not exist."),null)},t.symbolsFactory=__,t}(Ei),qW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="path",e.canFill=!0,e.canStroke=!0,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{startArrow:!1,endArrow:!1})},t.prototype.createPath=function(e,n){var i=this,a=this.attr(),o=this.get("el");me(n||a,function(s,u){if(u==="path"&&gt(s))o.setAttribute("d",i._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var f=bn(s)?e.addArrow(a,sr[u]):e.getDefaultArrow(a,sr[u]);o.setAttribute(sr[u],"url(#"+f+")")}else o.removeAttribute(sr[u]);else sr[u]&&o.setAttribute(sr[u],s)})},t.prototype._formatPath=function(e){var n=e.map(function(i){return i.join(" ")}).join("");return~n.indexOf("NaN")?"":n},t.prototype.getTotalLength=function(){var e=this.get("el");return e?e.getTotalLength():null},t.prototype.getPoint=function(e){var n=this.get("el"),i=this.getTotalLength();if(i===0)return null;var a=n?n.getPointAtLength(e*i):null;return a?{x:a.x,y:a.y}:null},t}(Ei),ZW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="polygon",e.canFill=!0,e.canStroke=!0,e}return t.prototype.createPath=function(e,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="points"&&gt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):sr[s]&&a.setAttribute(sr[s],o)})},t}(Ei),QW=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="polyline",e.canFill=!0,e.canStroke=!0,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{startArrow:!1,endArrow:!1})},t.prototype.onAttrChange=function(e,n,i){r.prototype.onAttrChange.call(this,e,n,i),["points"].indexOf(e)!==-1&&this._resetCache()},t.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},t.prototype.createPath=function(e,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="points"&&gt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):sr[s]&&a.setAttribute(sr[s],o)})},t.prototype.getTotalLength=function(){var e=this.attr().points,n=this.get("totalLength");return ct(n)?(this.set("totalLength",vI.length(e)),this.get("totalLength")):n},t.prototype.getPoint=function(e){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return me(i,function(s,u){e>=s[0]&&e<=s[1]&&(a=(e-s[0])/(s[1]-s[0]),o=u)}),mn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},t.prototype._setTcache=function(){var e=this.attr().points;if(!(!e||e.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;me(e,function(u,f){e[f+1]&&(o=[],o[0]=i/n,s=mn.length(u[0],u[1],e[f+1][0],e[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},t.prototype.getStartTangent=function(){var e=this.attr().points,n=[];return n.push([e[1][0],e[1][1]]),n.push([e[0][0],e[0][1]]),n},t.prototype.getEndTangent=function(){var e=this.attr().points,n=e.length-1,i=[];return i.push([e[n-1][0],e[n-1][1]]),i.push([e[n][0],e[n][1]]),i},t}(Ei);function JW(r){var t=0,e=0,n=0,i=0;return gt(r)?r.length===1?t=e=n=i=r[0]:r.length===2?(t=n=r[0],e=i=r[1]):r.length===3?(t=r[0],e=i=r[1],n=r[2]):(t=r[0],e=r[1],n=r[2],i=r[3]):t=e=n=i=r,{r1:t,r2:e,r3:n,r4:i}}var e7=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="rect",e.canFill=!0,e.canStroke=!0,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,width:0,height:0,radius:0})},t.prototype.createPath=function(e,n){var i=this,a=this.attr(),o=this.get("el"),s=!1,u=["x","y","width","height","radius"];me(n||a,function(f,l){u.indexOf(l)!==-1&&!s?(o.setAttribute("d",i._assembleRect(a)),s=!0):u.indexOf(l)===-1&&sr[l]&&o.setAttribute(sr[l],f)})},t.prototype._assembleRect=function(e){var n=e.x,i=e.y,a=e.width,o=e.height,s=e.radius;if(!s)return"M "+n+","+i+" l "+a+",0 l 0,"+o+" l"+-a+" 0 z";var u=JW(s);gt(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(" ")},t}(Ei),S_=.3,t7={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},r7={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},n7={left:"left",start:"left",center:"middle",right:"end",end:"end"},i7=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="text",e.canFill=!0,e.canStroke=!0,e}return t.prototype.getDefaultAttrs=function(){var e=r.prototype.getDefaultAttrs.call(this);return F(F({},e),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},t.prototype.createPath=function(e,n){var i=this,a=this.attr(),o=this.get("el");this._setFont(),me(n||a,function(s,u){u==="text"?i._setText(""+s):u==="matrix"&&s?jl(i):sr[u]&&o.setAttribute(sr[u],s)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},t.prototype._setFont=function(){var e=this.get("el"),n=this.attr(),i=n.textBaseline,a=n.textAlign,o=FT();o&&o.name==="firefox"?e.setAttribute("dominant-baseline",r7[i]||"alphabetic"):e.setAttribute("alignment-baseline",t7[i]||"baseline"),e.setAttribute("text-anchor",n7[a]||"left")},t.prototype._setText=function(e){var n=this.get("el"),i=this.attr(),a=i.x,o=i.textBaseline,s=o===void 0?"bottom":o;if(!e)n.innerHTML="";else if(~e.indexOf(`
23
- `)){var u=e.split(`
24
- `),f=u.length-1,l="";me(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+S_)+'em">'+c+"</tspan>":s==="hanging"&&(l+='<tspan x="'+a+'" dy="'+(-(f-1)-S_)+'em">'+c+"</tspan>"):l+='<tspan x="'+a+'" dy="1em">'+c+"</tspan>"}),n.innerHTML=l}else n.innerHTML=e},t}(Ei),a7=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,o7=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,s7=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function kO(r){var t=r.match(s7);if(!t)return"";var e="";return t.sort(function(n,i){return n=n.split(":"),i=i.split(":"),Number(n[0])-Number(i[0])}),me(t,function(n){n=n.split(":"),e+='<stop offset="'+n[0]+'" stop-color="'+n[1]+'"></stop>'}),e}function u7(r,t){var e=a7.exec(r),n=ov(sv(parseFloat(e[1])),Math.PI*2),i=e[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;t.setAttribute("x1",a.x),t.setAttribute("y1",a.y),t.setAttribute("x2",f),t.setAttribute("y2",l),t.innerHTML=kO(i)}function f7(r,t){var e=o7.exec(r),n=parseFloat(e[1]),i=parseFloat(e[2]),a=parseFloat(e[3]),o=e[4];t.setAttribute("cx",n),t.setAttribute("cy",i),t.setAttribute("r",a),t.innerHTML=kO(o)}var l7=function(){function r(t){this.cfg={};var e=null,n=ya("gradient_");return t.toLowerCase()[0]==="l"?(e=mi("linearGradient"),u7(t,e)):(e=mi("radialGradient"),f7(t,e)),e.setAttribute("id",n),this.el=e,this.id=n,this.cfg=t,this}return r.prototype.match=function(t,e){return this.cfg===e},r}(),c7={shadowColor:"color",shadowOpacity:"opacity",shadowBlur:"blur",shadowOffsetX:"dx",shadowOffsetY:"dy"},h7={x:"-40%",y:"-40%",width:"200%",height:"200%"},d7=function(){function r(t){this.type="filter",this.cfg={},this.type="filter";var e=mi("filter");return me(h7,function(n,i){e.setAttribute(i,n)}),this.el=e,this.id=ya("filter_"),this.el.id=this.id,this.cfg=t,this._parseShadow(t,e),this}return r.prototype.match=function(t,e){if(this.type!==t)return!1;var n=!0,i=this.cfg;return me(Object.keys(i),function(a){if(i[a]!==e[a])return n=!1,!1}),n},r.prototype.update=function(t,e){var n=this.cfg;return n[c7[t]]=e,this._parseShadow(n,this.el),this},r.prototype._parseShadow=function(t,e){var n=`<feDropShadow
25
- dx="`+(t.dx||0)+`"
26
- dy="`+(t.dy||0)+`"
27
- stdDeviation="`+(t.blur?t.blur/10:0)+`"
28
- flood-color="`+(t.color?t.color:"#000")+`"
29
- flood-opacity="`+(t.opacity?t.opacity:1)+`"
30
- />`;e.innerHTML=n},r}(),M_=function(){function r(t,e){this.cfg={};var n=mi("marker"),i=ya("marker_");n.setAttribute("id",i);var a=mi("path");a.setAttribute("stroke",t.stroke||"none"),a.setAttribute("fill",t.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=t[e==="marker-start"?"startArrow":"endArrow"];return this.stroke=t.stroke||"#000",o===!0?this._setDefaultPath(e,a):(this.cfg=o,this._setMarker(t.lineWidth,a)),this}return r.prototype.match=function(){return!1},r.prototype._setDefaultPath=function(t,e){var n=this.el;e.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(t,e){var n=this.el,i=this.cfg.path,a=this.cfg.d;gt(i)&&(i=i.map(function(o){return o.join(" ")}).join("")),e.setAttribute("d",i),n.appendChild(e),a&&n.setAttribute("refX",""+a/t)},r.prototype.update=function(t){var e=this.child;e.attr?e.attr("fill",t):e.setAttribute("fill",t)},r}(),v7=function(){function r(t){this.type="clip",this.cfg={};var e=mi("clipPath");this.el=e,this.id=ya("clip_"),e.id=this.id;var n=t.cfg.el;return e.appendChild(n),this.cfg=t,this}return r.prototype.match=function(){return!1},r.prototype.remove=function(){var t=this.el;t.parentNode.removeChild(t)},r}(),p7=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,g7=function(){function r(t){this.cfg={};var e=mi("pattern");e.setAttribute("patternUnits","userSpaceOnUse");var n=mi("image");e.appendChild(n);var i=ya("pattern_");e.id=i,this.el=e,this.id=i,this.cfg=t;var a=p7.exec(t),o=a[2];n.setAttribute("href",o);var s=new Image;o.match(/^data:/i)||(s.crossOrigin="Anonymous"),s.src=o;function u(){e.setAttribute("width",""+s.width),e.setAttribute("height",""+s.height)}return s.complete?u():(s.onload=u,s.src=s.src),this}return r.prototype.match=function(t,e){return this.cfg===e},r}(),y7=function(){function r(t){var e=mi("defs"),n=ya("defs_");e.id=n,t.appendChild(e),this.children=[],this.defaultArrow={},this.el=e,this.canvas=t}return r.prototype.find=function(t,e){for(var n=this.children,i=null,a=0;a<n.length;a++)if(n[a].match(t,e)){i=n[a].id;break}return i},r.prototype.findById=function(t){for(var e=this.children,n=null,i=0;i<e.length;i++)if(e[i].id===t){n=e[i];break}return n},r.prototype.add=function(t){this.children.push(t),t.canvas=this.canvas,t.parent=this},r.prototype.getDefaultArrow=function(t,e){var n=t.stroke||t.strokeStyle;if(this.defaultArrow[n])return this.defaultArrow[n].id;var i=new M_(t,e);return this.defaultArrow[n]=i,this.el.appendChild(i.el),this.add(i),i.id},r.prototype.addGradient=function(t){var e=new l7(t);return this.el.appendChild(e.el),this.add(e),e.id},r.prototype.addArrow=function(t,e){var n=new M_(t,e);return this.el.appendChild(n.el),this.add(n),n.id},r.prototype.addShadow=function(t){var e=new d7(t);return this.el.appendChild(e.el),this.add(e),e.id},r.prototype.addPattern=function(t){var e=new g7(t);return this.el.appendChild(e.el),this.add(e),e.id},r.prototype.addClip=function(t){var e=new v7(t);return this.el.appendChild(e.el),this.add(e),e.id},r}(),Qf=function(r){Ot(t,r);function t(e){return r.call(this,F(F({},e),{autoDraw:!0,renderer:"svg"}))||this}return t.prototype.getShapeBase=function(){return fm},t.prototype.getGroupBase=function(){return DO},t.prototype.getShape=function(e,n,i){var a=i.target||i.srcElement;if(!vy[a.tagName]){for(var o=a.parentNode;o&&!vy[o.tagName];)o=o.parentNode;a=o}return this.find(function(s){return s.get("el")===a})},t.prototype.createDom=function(){var e=mi("svg"),n=new y7(e);return e.setAttribute("width",""+this.get("width")),e.setAttribute("height",""+this.get("height")),this.set("context",n),e},t.prototype.onCanvasChange=function(e){var n=this.get("context"),i=this.get("el");if(e==="sort"){var a=this.get("children");a&&a.length&&IO(this,function(s,u){return a.indexOf(s)-a.indexOf(u)?1:0})}else if(e==="clear"){if(i){i.innerHTML="";var o=n.el;o.innerHTML="",i.appendChild(o)}}else e==="matrix"?jl(this):e==="clip"?_l(this,n):e==="changeSize"&&(i.setAttribute("width",""+this.get("width")),i.setAttribute("height",""+this.get("height")))},t.prototype.draw=function(){var e=this.get("context"),n=this.getChildren();_l(this,e),n.length&&OO(e,n)},t}(rI);function hh(r,t,e){if(r){if(typeof r.addEventListener=="function")return r.addEventListener(t,e,!1),{remove:function(){r.removeEventListener(t,e,!1)}};if(typeof r.attachEvent=="function")return r.attachEvent("on"+t,e),{remove:function(){r.detachEvent("on"+t,e)}}}}var $f,Dg,PO,py;function m7(){$f=document.createElement("table"),Dg=document.createElement("tr"),PO=/^\s*<(\w+|!)[^>]*>/,py={tr:document.createElement("tbody"),tbody:$f,thead:$f,tfoot:$f,td:Dg,th:Dg,"*":document.createElement("div")}}function wr(r){$f||m7();var t=PO.test(r)&&RegExp.$1;(!t||!(t in py))&&(t="*");var e=py[t];r=typeof r=="string"?r.replace(/(^\s*)|(\s*$)/g,""):r,e.innerHTML=""+r;var n=e.childNodes[0];return n&&e.contains(n)&&e.removeChild(n),n}function Xt(r,t){if(r)for(var e in t)t.hasOwnProperty(e)&&(r.style[e]=t[e]);return r}var NO={exports:{}},b7={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]},RO={exports:{}},x7=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")},E7=x7,w7=Array.prototype.concat,_7=Array.prototype.slice,C_=RO.exports=function(t){for(var e=[],n=0,i=t.length;n<i;n++){var a=t[n];E7(a)?e=w7.call(e,_7.call(a)):e.push(a)}return e};C_.wrap=function(r){return function(){return r(C_(arguments))}};var S7=RO.exports,Jf=b7,Ul=S7,BO=Object.hasOwnProperty,FO=Object.create(null);for(var kg in Jf)BO.call(Jf,kg)&&(FO[Jf[kg]]=kg);var ti=NO.exports={to:{},get:{}};ti.get=function(r){var t=r.substring(0,3).toLowerCase(),e,n;switch(t){case"hsl":e=ti.get.hsl(r),n="hsl";break;case"hwb":e=ti.get.hwb(r),n="hwb";break;default:e=ti.get.rgb(r),n="rgb";break}return e?{model:n,value:e}:null};ti.get.rgb=function(r){if(!r)return null;var t=/^#([a-f0-9]{3,4})$/i,e=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],s,u,f;if(s=r.match(e)){for(f=s[2],s=s[1],u=0;u<3;u++){var l=u*2;o[u]=parseInt(s.slice(l,l+2),16)}f&&(o[3]=parseInt(f,16)/255)}else if(s=r.match(t)){for(s=s[1],f=s[3],u=0;u<3;u++)o[u]=parseInt(s[u]+s[u],16);f&&(o[3]=parseInt(f+f,16)/255)}else if(s=r.match(n)){for(u=0;u<3;u++)o[u]=parseInt(s[u+1],0);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else if(s=r.match(i)){for(u=0;u<3;u++)o[u]=Math.round(parseFloat(s[u+1])*2.55);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else return(s=r.match(a))?s[1]==="transparent"?[0,0,0,0]:BO.call(Jf,s[1])?(o=Jf[s[1]],o[3]=1,o):null:null;for(u=0;u<3;u++)o[u]=Io(o[u],0,255);return o[3]=Io(o[3],0,1),o};ti.get.hsl=function(r){if(!r)return null;var t=/^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*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Io(parseFloat(e[2]),0,100),o=Io(parseFloat(e[3]),0,100),s=Io(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null};ti.get.hwb=function(r){if(!r)return null;var t=/^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*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Io(parseFloat(e[2]),0,100),o=Io(parseFloat(e[3]),0,100),s=Io(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null};ti.to.hex=function(){var r=Ul(arguments);return"#"+dh(r[0])+dh(r[1])+dh(r[2])+(r[3]<1?dh(Math.round(r[3]*255)):"")};ti.to.rgb=function(){var r=Ul(arguments);return r.length<4||r[3]===1?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"};ti.to.rgb.percent=function(){var r=Ul(arguments),t=Math.round(r[0]/255*100),e=Math.round(r[1]/255*100),n=Math.round(r[2]/255*100);return r.length<4||r[3]===1?"rgb("+t+"%, "+e+"%, "+n+"%)":"rgba("+t+"%, "+e+"%, "+n+"%, "+r[3]+")"};ti.to.hsl=function(){var r=Ul(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"};ti.to.hwb=function(){var r=Ul(arguments),t="";return r.length>=4&&r[3]!==1&&(t=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+t+")"};ti.to.keyword=function(r){return FO[r.slice(0,3)]};function Io(r,t,e){return Math.min(Math.max(t,r),e)}function dh(r){var t=Math.round(r).toString(16).toUpperCase();return t.length<2?"0"+t:t}var M7=NO.exports,GO={exports:{}},C7={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]},bs=C7,zO={};for(var Pg in bs)bs.hasOwnProperty(Pg)&&(zO[bs[Pg]]=Pg);var St=GO.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 Pn in St)if(St.hasOwnProperty(Pn)){if(!("channels"in St[Pn]))throw new Error("missing channels property: "+Pn);if(!("labels"in St[Pn]))throw new Error("missing channel labels property: "+Pn);if(St[Pn].labels.length!==St[Pn].channels)throw new Error("channel and label counts mismatch: "+Pn);var A7=St[Pn].channels,T7=St[Pn].labels;delete St[Pn].channels,delete St[Pn].labels,Object.defineProperty(St[Pn],"channels",{value:A7}),Object.defineProperty(St[Pn],"labels",{value:T7})}St.rgb.hsl=function(r){var t=r[0]/255,e=r[1]/255,n=r[2]/255,i=Math.min(t,e,n),a=Math.max(t,e,n),o=a-i,s,u,f;return a===i?s=0:t===a?s=(e-n)/o:e===a?s=2+(n-t)/o:n===a&&(s=4+(t-e)/o),s=Math.min(s*60,360),s<0&&(s+=360),f=(i+a)/2,a===i?u=0:f<=.5?u=o/(a+i):u=o/(2-a-i),[s,u*100,f*100]};St.rgb.hsv=function(r){var t,e,n,i,a,o=r[0]/255,s=r[1]/255,u=r[2]/255,f=Math.max(o,s,u),l=f-Math.min(o,s,u),c=function(h){return(f-h)/6/l+1/2};return l===0?i=a=0:(a=l/f,t=c(o),e=c(s),n=c(u),o===f?i=n-e:s===f?i=1/3+t-n:u===f&&(i=2/3+e-t),i<0?i+=1:i>1&&(i-=1)),[i*360,a*100,f*100]};St.rgb.hwb=function(r){var t=r[0],e=r[1],n=r[2],i=St.rgb.hsl(r)[0],a=1/255*Math.min(t,Math.min(e,n));return n=1-1/255*Math.max(t,Math.max(e,n)),[i,a*100,n*100]};St.rgb.cmyk=function(r){var t=r[0]/255,e=r[1]/255,n=r[2]/255,i,a,o,s;return s=Math.min(1-t,1-e,1-n),i=(1-t-s)/(1-s)||0,a=(1-e-s)/(1-s)||0,o=(1-n-s)/(1-s)||0,[i*100,a*100,o*100,s*100]};function I7(r,t){return Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2)+Math.pow(r[2]-t[2],2)}St.rgb.keyword=function(r){var t=zO[r];if(t)return t;var e=1/0,n;for(var i in bs)if(bs.hasOwnProperty(i)){var a=bs[i],o=I7(r,a);o<e&&(e=o,n=i)}return n};St.keyword.rgb=function(r){return bs[r]};St.rgb.xyz=function(r){var t=r[0]/255,e=r[1]/255,n=r[2]/255;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=t*.4124+e*.3576+n*.1805,a=t*.2126+e*.7152+n*.0722,o=t*.0193+e*.1192+n*.9505;return[i*100,a*100,o*100]};St.rgb.lab=function(r){var t=St.rgb.xyz(r),e=t[0],n=t[1],i=t[2],a,o,s;return e/=95.047,n/=100,i/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,a=116*n-16,o=500*(e-n),s=200*(n-i),[a,o,s]};St.hsl.rgb=function(r){var t=r[0]/360,e=r[1]/100,n=r[2]/100,i,a,o,s,u;if(e===0)return u=n*255,[u,u,u];n<.5?a=n*(1+e):a=n+e-n*e,i=2*n-a,s=[0,0,0];for(var f=0;f<3;f++)o=t+1/3*-(f-1),o<0&&o++,o>1&&o--,6*o<1?u=i+(a-i)*6*o:2*o<1?u=a:3*o<2?u=i+(a-i)*(2/3-o)*6:u=i,s[f]=u*255;return s};St.hsl.hsv=function(r){var t=r[0],e=r[1]/100,n=r[2]/100,i=e,a=Math.max(n,.01),o,s;return n*=2,e*=n<=1?n:2-n,i*=a<=1?a:2-a,s=(n+e)/2,o=n===0?2*i/(a+i):2*e/(n+e),[t,o*100,s*100]};St.hsv.rgb=function(r){var t=r[0]/60,e=r[1]/100,n=r[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*n*(1-e),s=255*n*(1-e*a),u=255*n*(1-e*(1-a));switch(n*=255,i){case 0:return[n,u,o];case 1:return[s,n,o];case 2:return[o,n,u];case 3:return[o,s,n];case 4:return[u,o,n];case 5:return[n,o,s]}};St.hsv.hsl=function(r){var t=r[0],e=r[1]/100,n=r[2]/100,i=Math.max(n,.01),a,o,s;return s=(2-e)*n,a=(2-e)*i,o=e*i,o/=a<=1?a:2-a,o=o||0,s/=2,[t,o*100,s*100]};St.hwb.rgb=function(r){var t=r[0]/360,e=r[1]/100,n=r[2]/100,i=e+n,a,o,s,u;i>1&&(e/=i,n/=i),a=Math.floor(6*t),o=1-n,s=6*t-a,a&1&&(s=1-s),u=e+s*(o-e);var f,l,c;switch(a){default:case 6:case 0:f=o,l=u,c=e;break;case 1:f=u,l=o,c=e;break;case 2:f=e,l=o,c=u;break;case 3:f=e,l=u,c=o;break;case 4:f=u,l=e,c=o;break;case 5:f=o,l=e,c=u;break}return[f*255,l*255,c*255]};St.cmyk.rgb=function(r){var t=r[0]/100,e=r[1]/100,n=r[2]/100,i=r[3]/100,a,o,s;return a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,e*(1-i)+i),s=1-Math.min(1,n*(1-i)+i),[a*255,o*255,s*255]};St.xyz.rgb=function(r){var t=r[0]/100,e=r[1]/100,n=r[2]/100,i,a,o;return i=t*3.2406+e*-1.5372+n*-.4986,a=t*-.9689+e*1.8758+n*.0415,o=t*.0557+e*-.204+n*1.057,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]};St.xyz.lab=function(r){var t=r[0],e=r[1],n=r[2],i,a,o;return t/=95.047,e/=100,n/=108.883,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=116*e-16,a=500*(t-e),o=200*(e-n),[i,a,o]};St.lab.xyz=function(r){var t=r[0],e=r[1],n=r[2],i,a,o;a=(t+16)/116,i=e/500+a,o=a-n/200;var s=Math.pow(a,3),u=Math.pow(i,3),f=Math.pow(o,3);return a=s>.008856?s:(a-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=f>.008856?f:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]};St.lab.lch=function(r){var t=r[0],e=r[1],n=r[2],i,a,o;return i=Math.atan2(n,e),a=i*360/2/Math.PI,a<0&&(a+=360),o=Math.sqrt(e*e+n*n),[t,o,a]};St.lch.lab=function(r){var t=r[0],e=r[1],n=r[2],i,a,o;return o=n/360*2*Math.PI,i=e*Math.cos(o),a=e*Math.sin(o),[t,i,a]};St.rgb.ansi16=function(r){var t=r[0],e=r[1],n=r[2],i=1 in arguments?arguments[1]:St.rgb.hsv(r)[2];if(i=Math.round(i/50),i===0)return 30;var a=30+(Math.round(n/255)<<2|Math.round(e/255)<<1|Math.round(t/255));return i===2&&(a+=60),a};St.hsv.ansi16=function(r){return St.rgb.ansi16(St.hsv.rgb(r),r[2])};St.rgb.ansi256=function(r){var t=r[0],e=r[1],n=r[2];if(t===e&&e===n)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;var i=16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(n/255*5);return i};St.ansi16.rgb=function(r){var t=r%10;if(t===0||t===7)return r>50&&(t+=3.5),t=t/10.5*255,[t,t,t];var e=(~~(r>50)+1)*.5,n=(t&1)*e*255,i=(t>>1&1)*e*255,a=(t>>2&1)*e*255;return[n,i,a]};St.ansi256.rgb=function(r){if(r>=232){var t=(r-232)*10+8;return[t,t,t]}r-=16;var e,n=Math.floor(r/36)/5*255,i=Math.floor((e=r%36)/6)/5*255,a=e%6/5*255;return[n,i,a]};St.rgb.hex=function(r){var t=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255),e=t.toString(16).toUpperCase();return"000000".substring(e.length)+e};St.hex.rgb=function(r){var t=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var e=t[0];t[0].length===3&&(e=e.split("").map(function(s){return s+s}).join(""));var n=parseInt(e,16),i=n>>16&255,a=n>>8&255,o=n&255;return[i,a,o]};St.rgb.hcg=function(r){var t=r[0]/255,e=r[1]/255,n=r[2]/255,i=Math.max(Math.max(t,e),n),a=Math.min(Math.min(t,e),n),o=i-a,s,u;return o<1?s=a/(1-o):s=0,o<=0?u=0:i===t?u=(e-n)/o%6:i===e?u=2+(n-t)/o:u=4+(t-e)/o+4,u/=6,u%=1,[u*360,o*100,s*100]};St.hsl.hcg=function(r){var t=r[1]/100,e=r[2]/100,n=1,i=0;return e<.5?n=2*t*e:n=2*t*(1-e),n<1&&(i=(e-.5*n)/(1-n)),[r[0],n*100,i*100]};St.hsv.hcg=function(r){var t=r[1]/100,e=r[2]/100,n=t*e,i=0;return n<1&&(i=(e-n)/(1-n)),[r[0],n*100,i*100]};St.hcg.rgb=function(r){var t=r[0]/360,e=r[1]/100,n=r[2]/100;if(e===0)return[n*255,n*255,n*255];var i=[0,0,0],a=t%1*6,o=a%1,s=1-o,u=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return u=(1-e)*n,[(e*i[0]+u)*255,(e*i[1]+u)*255,(e*i[2]+u)*255]};St.hcg.hsv=function(r){var t=r[1]/100,e=r[2]/100,n=t+e*(1-t),i=0;return n>0&&(i=t/n),[r[0],i*100,n*100]};St.hcg.hsl=function(r){var t=r[1]/100,e=r[2]/100,n=e*(1-t)+.5*t,i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[r[0],i*100,n*100]};St.hcg.hwb=function(r){var t=r[1]/100,e=r[2]/100,n=t+e*(1-t);return[r[0],(n-t)*100,(1-n)*100]};St.hwb.hcg=function(r){var t=r[1]/100,e=r[2]/100,n=1-e,i=n-t,a=0;return i<1&&(a=(n-i)/(1-i)),[r[0],i*100,a*100]};St.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]};St.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]};St.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]};St.gray.hsl=St.gray.hsv=function(r){return[0,0,r[0]]};St.gray.hwb=function(r){return[0,100,r[0]]};St.gray.cmyk=function(r){return[0,0,0,r[0]]};St.gray.lab=function(r){return[r[0],0,0]};St.gray.hex=function(r){var t=Math.round(r[0]/100*255)&255,e=(t<<16)+(t<<8)+t,n=e.toString(16).toUpperCase();return"000000".substring(n.length)+n};St.rgb.gray=function(r){var t=(r[0]+r[1]+r[2])/3;return[t/255*100]};var jO=GO.exports,Td=jO;function O7(){for(var r={},t=Object.keys(Td),e=t.length,n=0;n<e;n++)r[t[n]]={distance:-1,parent:null};return r}function L7(r){var t=O7(),e=[r];for(t[r].distance=0;e.length;)for(var n=e.pop(),i=Object.keys(Td[n]),a=i.length,o=0;o<a;o++){var s=i[o],u=t[s];u.distance===-1&&(u.distance=t[n].distance+1,u.parent=n,e.unshift(s))}return t}function D7(r,t){return function(e){return t(r(e))}}function k7(r,t){for(var e=[t[r].parent,r],n=Td[t[r].parent][r],i=t[r].parent;t[i].parent;)e.unshift(t[i].parent),n=D7(Td[t[i].parent][i],n),i=t[i].parent;return n.conversion=e,n}var P7=function(r){for(var t=L7(r),e={},n=Object.keys(t),i=n.length,a=0;a<i;a++){var o=n[a],s=t[o];s.parent!==null&&(e[o]=k7(o,t))}return e},gy=jO,N7=P7,vu={},R7=Object.keys(gy);function B7(r){var t=function(e){return e==null?e:(arguments.length>1&&(e=Array.prototype.slice.call(arguments)),r(e))};return"conversion"in r&&(t.conversion=r.conversion),t}function F7(r){var t=function(e){if(e==null)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var n=r(e);if(typeof n=="object")for(var i=n.length,a=0;a<i;a++)n[a]=Math.round(n[a]);return n};return"conversion"in r&&(t.conversion=r.conversion),t}R7.forEach(function(r){vu[r]={},Object.defineProperty(vu[r],"channels",{value:gy[r].channels}),Object.defineProperty(vu[r],"labels",{value:gy[r].labels});var t=N7(r),e=Object.keys(t);e.forEach(function(n){var i=t[n];vu[r][n]=F7(i),vu[r][n].raw=B7(i)})});var G7=vu,Wf=M7,Zn=G7,s1=[].slice,UO=["keyword","gray","hex"],yy={};Object.keys(Zn).forEach(function(r){yy[s1.call(Zn[r].labels).sort().join("")]=r});var Id={};function wn(r,t){if(!(this instanceof wn))return new wn(r,t);if(t&&t in UO&&(t=null),t&&!(t in Zn))throw new Error("Unknown model: "+t);var e,n;if(r==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(r instanceof wn)this.model=r.model,this.color=r.color.slice(),this.valpha=r.valpha;else if(typeof r=="string"){var i=Wf.get(r);if(i===null)throw new Error("Unable to parse color from string: "+r);this.model=i.model,n=Zn[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(r.length){this.model=t||"rgb",n=Zn[this.model].channels;var a=s1.call(r,0,n);this.color=my(a,n),this.valpha=typeof r[n]=="number"?r[n]:1}else if(typeof r=="number")r&=16777215,this.model="rgb",this.color=[r>>16&255,r>>8&255,r&255],this.valpha=1;else{this.valpha=1;var o=Object.keys(r);"alpha"in r&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof r.alpha=="number"?r.alpha:0);var s=o.sort().join("");if(!(s in yy))throw new Error("Unable to parse color from object: "+JSON.stringify(r));this.model=yy[s];var u=Zn[this.model].labels,f=[];for(e=0;e<u.length;e++)f.push(r[u[e]]);this.color=my(f)}if(Id[this.model])for(n=Zn[this.model].channels,e=0;e<n;e++){var l=Id[this.model][e];l&&(this.color[e]=l(this.color[e]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}wn.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(r){var t=this.model in Wf.to?this:this.rgb();t=t.round(typeof r=="number"?r:1);var e=t.valpha===1?t.color:t.color.concat(this.valpha);return Wf.to[t.model](e)},percentString:function(r){var t=this.rgb().round(typeof r=="number"?r:1),e=t.valpha===1?t.color:t.color.concat(this.valpha);return Wf.to.rgb.percent(e)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var r={},t=Zn[this.model].channels,e=Zn[this.model].labels,n=0;n<t;n++)r[e[n]]=this.color[n];return this.valpha!==1&&(r.alpha=this.valpha),r},unitArray:function(){var r=this.rgb().color;return r[0]/=255,r[1]/=255,r[2]/=255,this.valpha!==1&&r.push(this.valpha),r},unitObject:function(){var r=this.rgb().object();return r.r/=255,r.g/=255,r.b/=255,this.valpha!==1&&(r.alpha=this.valpha),r},round:function(r){return r=Math.max(r||0,0),new wn(this.color.map(j7(r)).concat(this.valpha),this.model)},alpha:function(r){return arguments.length?new wn(this.color.concat(Math.max(0,Math.min(1,r))),this.model):this.valpha},red:jr("rgb",0,nn(255)),green:jr("rgb",1,nn(255)),blue:jr("rgb",2,nn(255)),hue:jr(["hsl","hsv","hsl","hwb","hcg"],0,function(r){return(r%360+360)%360}),saturationl:jr("hsl",1,nn(100)),lightness:jr("hsl",2,nn(100)),saturationv:jr("hsv",1,nn(100)),value:jr("hsv",2,nn(100)),chroma:jr("hcg",1,nn(100)),gray:jr("hcg",2,nn(100)),white:jr("hwb",1,nn(100)),wblack:jr("hwb",2,nn(100)),cyan:jr("cmyk",0,nn(100)),magenta:jr("cmyk",1,nn(100)),yellow:jr("cmyk",2,nn(100)),black:jr("cmyk",3,nn(100)),x:jr("xyz",0,nn(100)),y:jr("xyz",1,nn(100)),z:jr("xyz",2,nn(100)),l:jr("lab",0,nn(100)),a:jr("lab",1),b:jr("lab",2),keyword:function(r){return arguments.length?new wn(r):Zn[this.model].keyword(this.color)},hex:function(r){return arguments.length?new wn(r):Wf.to.hex(this.rgb().round().color)},rgbNumber:function(){var r=this.rgb().color;return(r[0]&255)<<16|(r[1]&255)<<8|r[2]&255},luminosity:function(){for(var r=this.rgb().color,t=[],e=0;e<r.length;e++){var n=r[e]/255;t[e]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast:function(r){var t=this.luminosity(),e=r.luminosity();return t>e?(t+.05)/(e+.05):(e+.05)/(t+.05)},level:function(r){var t=this.contrast(r);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var r=this.rgb().color,t=(r[0]*299+r[1]*587+r[2]*114)/1e3;return t<128},isLight:function(){return!this.isDark()},negate:function(){for(var r=this.rgb(),t=0;t<3;t++)r.color[t]=255-r.color[t];return r},lighten:function(r){var t=this.hsl();return t.color[2]+=t.color[2]*r,t},darken:function(r){var t=this.hsl();return t.color[2]-=t.color[2]*r,t},saturate:function(r){var t=this.hsl();return t.color[1]+=t.color[1]*r,t},desaturate:function(r){var t=this.hsl();return t.color[1]-=t.color[1]*r,t},whiten:function(r){var t=this.hwb();return t.color[1]+=t.color[1]*r,t},blacken:function(r){var t=this.hwb();return t.color[2]+=t.color[2]*r,t},grayscale:function(){var r=this.rgb().color,t=r[0]*.3+r[1]*.59+r[2]*.11;return wn.rgb(t,t,t)},fade:function(r){return this.alpha(this.valpha-this.valpha*r)},opaquer:function(r){return this.alpha(this.valpha+this.valpha*r)},rotate:function(r){var t=this.hsl(),e=t.color[0];return e=(e+r)%360,e=e<0?360+e:e,t.color[0]=e,t},mix:function(r,t){if(!r||!r.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof r);var e=r.rgb(),n=this.rgb(),i=t===void 0?.5:t,a=2*i-1,o=e.alpha()-n.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,u=1-s;return wn.rgb(s*e.red()+u*n.red(),s*e.green()+u*n.green(),s*e.blue()+u*n.blue(),e.alpha()*i+n.alpha()*(1-i))}};Object.keys(Zn).forEach(function(r){if(UO.indexOf(r)===-1){var t=Zn[r].channels;wn.prototype[r]=function(){if(this.model===r)return new wn(this);if(arguments.length)return new wn(arguments,r);var e=typeof arguments[t]=="number"?t:this.valpha;return new wn(U7(Zn[this.model][r].raw(this.color)).concat(e),r)},wn[r]=function(e){return typeof e=="number"&&(e=my(s1.call(arguments),t)),new wn(e,r)}}});function z7(r,t){return Number(r.toFixed(t))}function j7(r){return function(t){return z7(t,r)}}function jr(r,t,e){return r=Array.isArray(r)?r:[r],r.forEach(function(n){(Id[n]||(Id[n]=[]))[t]=e}),r=r[0],function(n){var i;return arguments.length?(e&&(n=e(n)),i=this[r](),i.color[t]=n,i):(i=this[r]().color[t],e&&(i=e(i)),i)}}function nn(r){return function(t){return Math.max(0,Math.min(r,t))}}function U7(r){return Array.isArray(r)?r:[r]}function my(r,t){for(var e=0;e<t;e++)typeof r[e]!="number"&&(r[e]=0);return r}var $7=wn;const el=ba($7);function Od(r){"@babel/helpers - typeof";return Od=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Od(r)}var W7=/^\s+/,X7=/\s+$/;function Mt(r,t){if(r=r||"",t=t||{},r instanceof Mt)return r;if(!(this instanceof Mt))return new Mt(r,t);var e=Y7(r);this._originalInput=r,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||e.format,this._gradientType=t.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=e.ok}Mt.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 t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),e,n,i,a,o,s;return e=t.r/255,n=t.g/255,i=t.b/255,e<=.03928?a=e/12.92:a=Math.pow((e+.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(t){return this._a=$O(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=T_(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=T_(this._r,this._g,this._b),e=Math.round(t.h*360),n=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+e+", "+n+"%, "+i+"%)":"hsva("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=A_(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=A_(this._r,this._g,this._b),e=Math.round(t.h*360),n=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+e+", "+n+"%, "+i+"%)":"hsla("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return I_(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return q7(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},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(Ir(this._r,255)*100)+"%",g:Math.round(Ir(this._g,255)*100)+"%",b:Math.round(Ir(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ir(this._r,255)*100)+"%, "+Math.round(Ir(this._g,255)*100)+"%, "+Math.round(Ir(this._b,255)*100)+"%)":"rgba("+Math.round(Ir(this._r,255)*100)+"%, "+Math.round(Ir(this._g,255)*100)+"%, "+Math.round(Ir(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:uX[I_(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var e="#"+O_(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=Mt(t);n="#"+O_(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,i=this._a<1&&this._a>=0,a=!e&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return a?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(n=this.toRgbString()),t==="prgb"&&(n=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(n=this.toHexString()),t==="hex3"&&(n=this.toHexString(!0)),t==="hex4"&&(n=this.toHex8String(!0)),t==="hex8"&&(n=this.toHex8String()),t==="name"&&(n=this.toName()),t==="hsl"&&(n=this.toHslString()),t==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return Mt(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(eX,arguments)},brighten:function(){return this._applyModification(tX,arguments)},darken:function(){return this._applyModification(rX,arguments)},desaturate:function(){return this._applyModification(Z7,arguments)},saturate:function(){return this._applyModification(Q7,arguments)},greyscale:function(){return this._applyModification(J7,arguments)},spin:function(){return this._applyModification(nX,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(oX,arguments)},complement:function(){return this._applyCombination(iX,arguments)},monochromatic:function(){return this._applyCombination(sX,arguments)},splitcomplement:function(){return this._applyCombination(aX,arguments)},triad:function(){return this._applyCombination(L_,[3])},tetrad:function(){return this._applyCombination(L_,[4])}};Mt.fromRatio=function(r,t){if(Od(r)=="object"){var e={};for(var n in r)r.hasOwnProperty(n)&&(n==="a"?e[n]=r[n]:e[n]=Xf(r[n]));r=e}return Mt(r,t)};function Y7(r){var t={r:0,g:0,b:0},e=1,n=null,i=null,a=null,o=!1,s=!1;return typeof r=="string"&&(r=hX(r)),Od(r)=="object"&&(Pa(r.r)&&Pa(r.g)&&Pa(r.b)?(t=V7(r.r,r.g,r.b),o=!0,s=String(r.r).substr(-1)==="%"?"prgb":"rgb"):Pa(r.h)&&Pa(r.s)&&Pa(r.v)?(n=Xf(r.s),i=Xf(r.v),t=K7(r.h,n,i),o=!0,s="hsv"):Pa(r.h)&&Pa(r.s)&&Pa(r.l)&&(n=Xf(r.s),a=Xf(r.l),t=H7(r.h,n,a),o=!0,s="hsl"),r.hasOwnProperty("a")&&(e=r.a)),e=$O(e),{ok:o,format:r.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:e}}function V7(r,t,e){return{r:Ir(r,255)*255,g:Ir(t,255)*255,b:Ir(e,255)*255}}function A_(r,t,e){r=Ir(r,255),t=Ir(t,255),e=Ir(e,255);var n=Math.max(r,t,e),i=Math.min(r,t,e),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=(t-e)/u+(t<e?6:0);break;case t:a=(e-r)/u+2;break;case e:a=(r-t)/u+4;break}a/=6}return{h:a,s:o,l:s}}function H7(r,t,e){var n,i,a;r=Ir(r,360),t=Ir(t,100),e=Ir(e,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(t===0)n=i=a=e;else{var s=e<.5?e*(1+t):e+t-e*t,u=2*e-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 T_(r,t,e){r=Ir(r,255),t=Ir(t,255),e=Ir(e,255);var n=Math.max(r,t,e),i=Math.min(r,t,e),a,o,s=n,u=n-i;if(o=n===0?0:u/n,n==i)a=0;else{switch(n){case r:a=(t-e)/u+(t<e?6:0);break;case t:a=(e-r)/u+2;break;case e:a=(r-t)/u+4;break}a/=6}return{h:a,s:o,v:s}}function K7(r,t,e){r=Ir(r,360)*6,t=Ir(t,100),e=Ir(e,100);var n=Math.floor(r),i=r-n,a=e*(1-t),o=e*(1-i*t),s=e*(1-(1-i)*t),u=n%6,f=[e,o,a,a,s,e][u],l=[s,e,e,o,a,a][u],c=[a,a,s,e,e,o][u];return{r:f*255,g:l*255,b:c*255}}function I_(r,t,e,n){var i=[ki(Math.round(r).toString(16)),ki(Math.round(t).toString(16)),ki(Math.round(e).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 q7(r,t,e,n,i){var a=[ki(Math.round(r).toString(16)),ki(Math.round(t).toString(16)),ki(Math.round(e).toString(16)),ki(WO(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 O_(r,t,e,n){var i=[ki(WO(n)),ki(Math.round(r).toString(16)),ki(Math.round(t).toString(16)),ki(Math.round(e).toString(16))];return i.join("")}Mt.equals=function(r,t){return!r||!t?!1:Mt(r).toRgbString()==Mt(t).toRgbString()};Mt.random=function(){return Mt.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Z7(r,t){t=t===0?0:t||10;var e=Mt(r).toHsl();return e.s-=t/100,e.s=Av(e.s),Mt(e)}function Q7(r,t){t=t===0?0:t||10;var e=Mt(r).toHsl();return e.s+=t/100,e.s=Av(e.s),Mt(e)}function J7(r){return Mt(r).desaturate(100)}function eX(r,t){t=t===0?0:t||10;var e=Mt(r).toHsl();return e.l+=t/100,e.l=Av(e.l),Mt(e)}function tX(r,t){t=t===0?0:t||10;var e=Mt(r).toRgb();return e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(t/100)))),e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(t/100)))),e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(t/100)))),Mt(e)}function rX(r,t){t=t===0?0:t||10;var e=Mt(r).toHsl();return e.l-=t/100,e.l=Av(e.l),Mt(e)}function nX(r,t){var e=Mt(r).toHsl(),n=(e.h+t)%360;return e.h=n<0?360+n:n,Mt(e)}function iX(r){var t=Mt(r).toHsl();return t.h=(t.h+180)%360,Mt(t)}function L_(r,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var e=Mt(r).toHsl(),n=[Mt(r)],i=360/t,a=1;a<t;a++)n.push(Mt({h:(e.h+a*i)%360,s:e.s,l:e.l}));return n}function aX(r){var t=Mt(r).toHsl(),e=t.h;return[Mt(r),Mt({h:(e+72)%360,s:t.s,l:t.l}),Mt({h:(e+216)%360,s:t.s,l:t.l})]}function oX(r,t,e){t=t||6,e=e||30;var n=Mt(r).toHsl(),i=360/e,a=[Mt(r)];for(n.h=(n.h-(i*t>>1)+720)%360;--t;)n.h=(n.h+i)%360,a.push(Mt(n));return a}function sX(r,t){t=t||6;for(var e=Mt(r).toHsv(),n=e.h,i=e.s,a=e.v,o=[],s=1/t;t--;)o.push(Mt({h:n,s:i,v:a})),a=(a+s)%1;return o}Mt.mix=function(r,t,e){e=e===0?0:e||50;var n=Mt(r).toRgb(),i=Mt(t).toRgb(),a=e/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 Mt(o)};Mt.readability=function(r,t){var e=Mt(r),n=Mt(t);return(Math.max(e.getLuminance(),n.getLuminance())+.05)/(Math.min(e.getLuminance(),n.getLuminance())+.05)};Mt.isReadable=function(r,t,e){var n=Mt.readability(r,t),i,a;switch(a=!1,i=dX(e),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};Mt.mostReadable=function(r,t,e){var n=null,i=0,a,o,s,u;e=e||{},o=e.includeFallbackColors,s=e.level,u=e.size;for(var f=0;f<t.length;f++)a=Mt.readability(r,t[f]),a>i&&(i=a,n=Mt(t[f]));return Mt.isReadable(r,n,{level:s,size:u})||!o?n:(e.includeFallbackColors=!1,Mt.mostReadable(r,["#fff","#000"],e))};var by=Mt.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"},uX=Mt.hexNames=fX(by);function fX(r){var t={};for(var e in r)r.hasOwnProperty(e)&&(t[r[e]]=e);return t}function $O(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}function Ir(r,t){lX(r)&&(r="100%");var e=cX(r);return r=Math.min(t,Math.max(0,parseFloat(r))),e&&(r=parseInt(r*t,10)/100),Math.abs(r-t)<1e-6?1:r%t/parseFloat(t)}function Av(r){return Math.min(1,Math.max(0,r))}function Vn(r){return parseInt(r,16)}function lX(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}function cX(r){return typeof r=="string"&&r.indexOf("%")!=-1}function ki(r){return r.length==1?"0"+r:""+r}function Xf(r){return r<=1&&(r=r*100+"%"),r}function WO(r){return Math.round(parseFloat(r)*255).toString(16)}function D_(r){return Vn(r)/255}var Ai=function(){var r="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",e="(?:"+t+")|(?:"+r+")",n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?",i="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),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 Pa(r){return!!Ai.CSS_UNIT.exec(r)}function hX(r){r=r.replace(W7,"").replace(X7,"").toLowerCase();var t=!1;if(by[r])r=by[r],t=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=Ai.rgb.exec(r))?{r:e[1],g:e[2],b:e[3]}:(e=Ai.rgba.exec(r))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Ai.hsl.exec(r))?{h:e[1],s:e[2],l:e[3]}:(e=Ai.hsla.exec(r))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Ai.hsv.exec(r))?{h:e[1],s:e[2],v:e[3]}:(e=Ai.hsva.exec(r))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Ai.hex8.exec(r))?{r:Vn(e[1]),g:Vn(e[2]),b:Vn(e[3]),a:D_(e[4]),format:t?"name":"hex8"}:(e=Ai.hex6.exec(r))?{r:Vn(e[1]),g:Vn(e[2]),b:Vn(e[3]),format:t?"name":"hex"}:(e=Ai.hex4.exec(r))?{r:Vn(e[1]+""+e[1]),g:Vn(e[2]+""+e[2]),b:Vn(e[3]+""+e[3]),a:D_(e[4]+""+e[4]),format:t?"name":"hex8"}:(e=Ai.hex3.exec(r))?{r:Vn(e[1]+""+e[1]),g:Vn(e[2]+""+e[2]),b:Vn(e[3]+""+e[3]),format:t?"name":"hex"}:!1}function dX(r){var t,e;return r=r||{level:"AA",size:"small"},t=(r.level||"AA").toUpperCase(),e=(r.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),e!=="small"&&e!=="large"&&(e="small"),{level:t,size:e}}var vh=2,k_=.16,vX=.05,pX=.05,gX=.15,XO=5,YO=4,yX=[{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 P_(r,t,e){var n;return Math.round(r.h)>=60&&Math.round(r.h)<=240?n=e?Math.round(r.h)-vh*t:Math.round(r.h)+vh*t:n=e?Math.round(r.h)+vh*t:Math.round(r.h)-vh*t,n<0?n+=360:n>=360&&(n-=360),n}function N_(r,t,e){if(r.h===0&&r.s===0)return r.s;var n;return e?n=r.s-k_*t:t===YO?n=r.s+k_:n=r.s+vX*t,n>1&&(n=1),e&&t===XO&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function R_(r,t,e){var n;return e?n=r.v+pX*t:n=r.v-gX*t,n>1&&(n=1),Number(n.toFixed(2))}function Ld(r){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=[],n=Mt(r),i=XO;i>0;i-=1){var a=n.toHsv(),o=Mt({h:P_(a,i,!0),s:N_(a,i,!0),v:R_(a,i,!0)}).toHexString();e.push(o)}e.push(n.toHexString());for(var s=1;s<=YO;s+=1){var u=n.toHsv(),f=Mt({h:P_(u,s),s:N_(u,s),v:R_(u,s)}).toHexString();e.push(f)}return t.theme==="dark"?yX.map(function(l){var c=l.index,h=l.opacity,d=Mt.mix(t.backgroundColor||"#141414",e[c],h*100).toHexString();return d}):e}var Ng={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"},Rg={},Bg={};Object.keys(Ng).forEach(function(r){Rg[r]=Ld(Ng[r]),Rg[r].primary=Rg[r][5],Bg[r]=Ld(Ng[r],{theme:"dark",backgroundColor:"#141414"}),Bg[r].primary=Bg[r][5]});var on=function(t,e,n){var i=el(t),a=el(e);return el([(1-n)*i.red()+n*a.red(),(1-n)*i.green()+n*a.green(),(1-n)*i.blue()+n*a.blue()]).rgb()},mX=function(t,e,n){e===void 0&&(e="#fff"),n===void 0&&(n="rgb(150, 150, 150)");var i=on(e,t,.05).rgb().toString(),a=on(e,t,.1).rgb().toString(),o=on(e,t,.2).rgb().toString(),s=on(e,t,.4).rgb().toString(),u=on(e,n,.02).rgb().toString(),f=on(e,n,.05).rgb().toString(),l=on(e,n,.1).rgb().toString(),c=on(e,n,.2).rgb().toString(),h=on(e,n,.3).rgb().toString(),d=Ld(t,{theme:"default",backgroundColor:e}),v=el(t).hex().toLowerCase(),p=d.indexOf(v),g=t;return p!==-1&&(g=d[p+1]),{mainStroke:t,mainFill:a,activeStroke:t,activeFill:i,inactiveStroke:s,inactiveFill:i,selectedStroke:t,selectedFill:e,highlightStroke:g,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:h,edgeActiveStroke:t,edgeInactiveStroke:c,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:l,comboMainStroke:h,comboMainFill:u,comboActiveStroke:t,comboActiveFill:i,comboInactiveStroke:h,comboInactiveFill:u,comboSelectedStroke:t,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:c,comboDisableFill:f}},bX=function(t,e,n){e===void 0&&(e="#fff"),n===void 0&&(n="#777");var i=on(e,t,.2).rgb().toString(),a=on(e,t,.3).rgb().toString(),o=on(e,t,.6).rgb().toString(),s=on(e,t,.8).rgb().toString(),u=on(e,n,.2).rgb().toString(),f=on(e,n,.25).rgb().toString(),l=on(e,n,.3).rgb().toString(),c=on(e,n,.4).rgb().toString(),h=on(e,n,.5).rgb().toString(),d=Ld(t,{theme:"dark",backgroundColor:e}),v=el(t).hex().toLowerCase(),p=d.indexOf(v),g=t;return p!==-1&&(g=d[p+1]),{mainStroke:s,mainFill:i,activeStroke:t,activeFill:a,inactiveStroke:s,inactiveFill:i,selectedStroke:t,selectedFill:i,highlightStroke:t,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:n,edgeActiveStroke:t,edgeInactiveStroke:n,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:l,comboMainStroke:c,comboMainFill:f,comboActiveStroke:t,comboActiveFill:u,comboInactiveStroke:c,comboInactiveFill:f,comboSelectedStroke:t,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:f,comboDisableStroke:c,comboDisableFill:u}},u1=function(t,e,n,i){return e===void 0&&(e="#fff"),n===void 0&&(n="default"),n==="default"?mX(t,e,"rgb(150, 150, 150)"):bX(t,e,"#777")},xX=function(t,e,n,i){e===void 0&&(e="#fff"),n===void 0&&(n="default");var a=[];return t.forEach(function(o){a.push(u1(o,e,n))}),a};const EX=Object.freeze(Object.defineProperty({__proto__:null,getColorSetsBySubjectColors:xX,getColorsWithSubjectColor:u1,mixColor:on},Symbol.toStringTag,{value:"Module"}));var wX="rgb(95, 149, 255)",_X="rgb(255, 255, 255)",B_="rgb(0, 0, 0)",tr=u1(wX,_X);const xs={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:tr.mainStroke,fill:tr.mainFill},size:20,color:tr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:tr.activeFill,stroke:tr.activeStroke}},nodeStateStyles:{active:{fill:tr.activeFill,stroke:tr.activeStroke,lineWidth:2,shadowColor:tr.mainStroke,shadowBlur:10},selected:{fill:tr.selectedFill,stroke:tr.selectedStroke,lineWidth:4,shadowColor:tr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:tr.highlightFill,stroke:tr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:tr.inactiveFill,stroke:tr.inactiveStroke,lineWidth:1},disable:{fill:tr.disableFill,stroke:tr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:B_,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:tr.edgeMainStroke,lineAppendWidth:2},color:tr.edgeMainStroke},edgeStateStyles:{active:{stroke:tr.edgeActiveStroke,lineWidth:1},selected:{stroke:tr.edgeSelectedStroke,lineWidth:2,shadowColor:tr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:tr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:tr.edgeInactiveStroke,lineWidth:1},disable:{stroke:tr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:B_,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:tr.comboMainFill,lineWidth:1,stroke:tr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:tr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:tr.comboActiveStroke,lineWidth:1,fill:tr.comboActiveFill},selected:{stroke:tr.comboSelectedStroke,lineWidth:2,fill:tr.comboSelectedFill,shadowColor:tr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:tr.comboHighlightStroke,lineWidth:2,fill:tr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:tr.comboInactiveStroke,fill:tr.comboInactiveFill,lineWidth:1},disable:{stroke:tr.comboDisableStroke,fill:tr.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 SX=function(t){var e=t.clone();return MX(t,e),e},MX=function r(t,e){var n;t.isGroup()&&e.isGroup()&&((n=t.get("children"))===null||n===void 0||n.forEach(function(s,u){var f=e.get("children")[u];r(s,f)}));var i=t.get("type"),a=e.get("type");if(!(i!=="image"||a!=="image")){var o=t.get("clipShape");o&&e.setClip({type:o.get("type"),attrs:o.attr()})}},CX=_n.cloneEvent,AX=_n.isViewportChanged,TX=function(r){Ot(t,r);function t(e){var n=r.call(this,e)||this;return n.extendEvents=[],n.dragging=!1,n.mousedown=!1,n.preItem=null,n.destroy(),n.graph=e,n.destroyed=!1,n.initEvents(),n}return t.prototype.initEvents=function(){var e=this,n=e.graph,i=e.extendEvents,a=i===void 0?[]:i,o=n.get("canvas"),s=o.get("el"),u=vs(this,"onCanvasEvents"),f=vs(this,"onExtendEvents"),l=vs(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,a.push(hh(s,"wheel",l)),typeof window<"u"&&(a.push(hh(window,"keydown",f)),a.push(hh(window,"keyup",f)),a.push(hh(window,"focus",f))),this.resetHandler&&n.off("afterchangedata",this.resetHandler),this.resetHandler=vs(this,"resetStatus"),n.on("afterchangedata",this.resetHandler)},t.getItemRoot=function(e){for(;e&&!e.get("item");)e=e.get("parent");return e},t.prototype.onCanvasEvents=function(e){var n=this,i=this.graph,a=i.get("canvas"),o=e.target,s=e.type;switch(s){case"drag":this.onCanvasEvents(Object.assign({},e,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},e,{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}e.canvasX=e.x,e.canvasY=e.y;var u={x:e.canvasX,y:e.canvasY},f=i.get("group"),l=f.getMatrix();if(l||(l=[1,0,0,0,1,0,0,0,1]),AX(l)&&(u=i.getPointByClient(e.clientX,e.clientY)),e.x=u.x,e.y=u.y,e.currentTarget=i,o===a){(s==="mousemove"||s==="mouseleave")&&this.handleMouseMove(e,"canvas"),e.target=a,e.item=null,i.emit(s,e),i.emit("canvas:".concat(s),e);return}var c=t.getItemRoot(o);if(!c){i.emit(s,e);return}var h=c.get("item");if(!h.destroyed){var d=h.getType();if(e.target=o,e.item=h,e.canvasX===e.x&&e.canvasY===e.y){var v=i.getCanvasByPoint(e.x,e.y);e.canvasX=v.x,e.canvasY=v.y}e.name&&!e.name.includes(":")?(i.emit("".concat(d,":").concat(s),e),i.emit(s,e)):e.name&&i.emit(e.name,e),s==="dragstart"&&(this.dragging=!0),s==="dragend"&&(this.dragging=!1),s==="mousemove"&&this.handleMouseMove(e,d)}},t.prototype.onExtendEvents=function(e){this.graph.emit(e.type,e)},t.prototype.onWheelEvent=function(e){ct(e.wheelDelta)&&(e.wheelDelta=-e.detail),this.graph.emit("wheel",e)},t.prototype.handleMouseMove=function(e,n){var i=this,a=i.graph,o=i.preItem,s=a.get("canvas"),u=e.target===s?null:e.item;e=CX(e),o&&o!==u&&!o.destroyed&&(e.item=o,this.emitCustomEvent(o.getType(),"mouseleave",e),this.dragging&&this.emitCustomEvent(o.getType(),"dragleave",e)),u&&o!==u&&(e.item=u,this.emitCustomEvent(n,"mouseenter",e),this.dragging&&this.emitCustomEvent(n,"dragenter",e)),this.preItem=u},t.prototype.emitCustomEvent=function(e,n,i){i.type=n,this.graph.emit("".concat(e,":").concat(n),i)},t.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},t.prototype.destroy=function(){var e=this,n=e.graph,i=e.canvasHandler,a=e.extendEvents,o=n.get("canvas");o.off("*",i),me(a,function(s){s.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},t}(jI),Ht={},Ha={},Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.Base=void 0;var IX=function(){function r(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.vedges=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return r.prototype.layout=function(t){return this.init(t),this.execute(!0)},r.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||[]},r.prototype.execute=function(t){},r.prototype.executeWithWorker=function(){},r.prototype.getDefaultCfg=function(){return{}},r.prototype.updateCfg=function(t){t&&Object.assign(this,t)},r.prototype.getType=function(){return"base"},r.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},r}();Wr.Base=IX;var Fg={},zu={};Object.defineProperty(zu,"__esModule",{value:!0});zu.camelize=zu.isString=void 0;var OX=function(r){return typeof r=="string"};zu.isString=OX;var LX=function(r){var t=Object.create(null);return function(e){var n=t[e];return n||(t[e]=r(e))}},DX=/-(\w)/g;zu.camelize=LX(function(r){return r.replace(DX,function(t,e){return e?e.toUpperCase():""})});var $l={};Object.defineProperty($l,"__esModule",{value:!0});$l.isArray=void 0;$l.isArray=Array.isArray;var Tv={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.toNumber=r.isNaN=r.isNumber=void 0;var t=function(i){return typeof i=="number"};r.isNumber=t;var e=function(i){return Number.isNaN(Number(i))};r.isNaN=e;var n=function(i){var a=parseFloat(i);return(0,r.isNaN)(a)?i:a};r.toNumber=n})(Tv);var Iv={},f1={};(function(r){var t=xe&&xe.__assign||function(){return t=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},t.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),r.clone=r.isObject=void 0;var e=function(i){return i!==null&&typeof i=="object"};r.isObject=e;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=t({},i);return Object.keys(o).forEach(function(s){o[s]=(0,r.clone)(o[s])}),o}return i};r.clone=n})(f1);(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 t=$l,e=Tv,n=f1,i=function(m,b){var x=m[b];return(0,n.isObject)(x)?x.cell:x};r.getEdgeTerminal=i;var a=function(m,b,x){for(var E=[],w=0;w<m;w++)E[w]={in:0,out:0,all:0};return x&&x.forEach(function(_){var M=(0,r.getEdgeTerminal)(_,"source"),C=(0,r.getEdgeTerminal)(_,"target");M&&E[b[M]]&&(E[b[M]].out+=1,E[b[M]].all+=1),C&&E[b[C]]&&(E[b[C]].in+=1,E[b[C]].all+=1)}),E};r.getDegree=a;var o=function(m,b){var x={};return m.forEach(function(E){x[E.id]={in:0,out:0,all:0}}),b&&b.forEach(function(E){var w=(0,r.getEdgeTerminal)(E,"source"),_=(0,r.getEdgeTerminal)(E,"target");w&&(x[w].out+=1,x[w].all+=1),_&&(x[_].in+=1,x[_].all+=1)}),x};r.getDegreeMap=o;var s=function(m){for(var b=[],x=m.length,E=0;E<x;E+=1){b[E]=[];for(var w=0;w<x;w+=1)E===w?b[E][w]=0:m[E][w]===0||!m[E][w]?b[E][w]=1/0:b[E][w]=m[E][w]}for(var _=0;_<x;_+=1)for(var E=0;E<x;E+=1)for(var w=0;w<x;w+=1)b[E][w]>b[E][_]+b[_][w]&&(b[E][w]=b[E][_]+b[_][w]);return b};r.floydWarshall=s;var u=function(m,b){var x=m.nodes,E=m.edges,w=[],_={};if(!x)throw new Error("invalid nodes data!");return x&&x.forEach(function(M,C){_[M.id]=C;var S=[];w.push(S)}),E==null||E.forEach(function(M){var C=(0,r.getEdgeTerminal)(M,"source"),S=(0,r.getEdgeTerminal)(M,"target"),A=_[C],T=_[S];A===void 0||T===void 0||(w[A][T]=1,b||(w[T][A]=1))}),w};r.getAdjMatrix=u;var f=function(m,b){var x=[];return m.forEach(function(E){var w=[];E.forEach(function(_){w.push(_*b)}),x.push(w)}),x};r.scaleMatrix=f;var l=function(m,b){if(m&&m.children){for(var x=m.children.length-1;x>=0;x--)if(!l(m.children[x],b))return}return!!b(m)},c=function(m,b){typeof b=="function"&&l(m,b)};r.traverseTreeUp=c;var h=function(m){var b=1/0,x=1/0,E=-1/0,w=-1/0;return m.forEach(function(_){var M=_.size;(0,t.isArray)(M)?M.length===1&&(M=[M[0],M[0]]):(0,e.isNumber)(M)?M=[M,M]:(M===void 0||isNaN(M))&&(M=[30,30]);var C=[M[0]/2,M[1]/2],S=_.x-C[0],A=_.x+C[0],T=_.y-C[1],I=_.y+C[1];b>S&&(b=S),x>T&&(x=T),E<A&&(E=A),w<I&&(w=I)}),{minX:b,minY:x,maxX:E,maxY:w}};r.getLayoutBBox=h;var d=function(m){var b={x:0,y:0};m.forEach(function(E){b.x+=E.x||0,b.y+=E.y||0});var x=m.length||1;return{x:b.x/x,y:b.y/x}};r.getAvgNodePosition=d;var v=function(m,b,x){var E,w;return m==="source"?((E=x==null?void 0:x.find(function(_){return _.target===b.id}))===null||E===void 0?void 0:E.source)||{}:((w=x==null?void 0:x.find(function(_){return _.source===b.id}))===null||w===void 0?void 0:w.target)||{}},p=function(m,b,x){var E=[];switch(m){case"source":E=x==null?void 0:x.filter(function(_){return _.source===b.id}).map(function(_){return _.target});break;case"target":E=x==null?void 0:x.filter(function(_){return _.target===b.id}).map(function(_){return _.source});break;case"both":E=x==null?void 0:x.filter(function(_){return _.source===b.id}).map(function(_){return _.target}).concat(x==null?void 0:x.filter(function(_){return _.target===b.id}).map(function(_){return _.source}));break}var w=new Set(E);return Array.from(w)},g=function(m,b,x,E,w){var _=x[b]||"",M=(E==null?void 0:E.filter(function(C){return C[b]===_}))||[];return m==="leaf"&&(M=M.filter(function(C){var S,A;return((S=w[C.id])===null||S===void 0?void 0:S.in)===0||((A=w[C.id])===null||A===void 0?void 0:A.out)===0})),M},y=function(m,b,x,E,w,_){var M=w[b.id],C=M.in,S=M.out,A=b,T=[];C===0?(A=v("source",b,x),T=p("both",A,x).map(function(D){return _[D]})):S===0&&(A=v("target",b,x),T=p("both",A,x).map(function(D){return _[D]})),T=T.filter(function(D){return w[D.id]&&(w[D.id].in===0||w[D.id].out===0)});var I=g(m,E,b,T,w);return{coreNode:A,relativeLeafNodes:T,sameTypeLeafNodes:I}};r.getCoreNodeAndRelativeLeafNodes=y})(Iv);var Gg={},F_;function kX(){return F_||(F_=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.getFuncByUnknownType=r.getFunc=r.isFunction=void 0;var t=Nr(),e=Tv,n=function(o){return typeof o=="function"};r.isFunction=n;var i=function(o,s,u){var f;return u?f=u:(0,e.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,t.isArray)(f.size)?f.size[0]>f.size[1]?f.size[0]:f.size[1]:(0,t.isObject)(f.size)?f.size.width>f.size.height?f.size.width:f.size.height:f.size:o}:(0,r.isFunction)(s)?s:(0,e.isNumber)(s)?function(){return s}:(0,t.isArray)(s)?function(){if(u){var f=Math.max.apply(Math,s);return isNaN(f)?o:f}return s}:(0,t.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}(Gg)),Gg}var G_;function Nr(){return G_||(G_=1,function(r){var t=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),e=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),e(zu,r),e($l,r),e(Tv,r),e(Iv,r),e(f1,r),e(kX(),r)}(Fg)),Fg}var PX=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.getLayoutByName=Ha.unRegisterLayout=Ha.registerLayout=void 0;var NX=Wr,RX=Nr(),So=new Map,BX=function(r,t){if(So.get(r)&&console.warn("The layout with the name ".concat(r," exists already, it will be overridden")),(0,RX.isObject)(t)){var e=function(n){PX(i,n);function i(a){var o=this,s;o=n.call(this)||this;var u=o,f={},l=Object.assign({},u.getDefaultCfg(),((s=t.getDefaultCfg)===null||s===void 0?void 0:s.call(t))||{});return Object.assign(f,l,t,a),Object.keys(f).forEach(function(c){var h=f[c];u[c]=h}),o}return i}(NX.Base);So.set(r,e)}else So.set(r,t);return So.get(r)};Ha.registerLayout=BX;var FX=function(r){So.has(r)&&So.delete(r)};Ha.unRegisterLayout=FX;var GX=function(r){return So.has(r)?So.get(r):null};Ha.getLayoutByName=GX;var zg={},Wl={},zX=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(Wl,"__esModule",{value:!0});Wl.GridLayout=void 0;var iu=Nr(),jX=Wr,UX=function(r){zX(t,r);function t(e){var n=r.call(this)||this;return n.begin=[0,0],n.preventOverlap=!0,n.preventOverlapPadding=10,n.condense=!1,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.row=0,n.col=0,n.cellWidth=0,n.cellHeight=0,n.cellUsed={},n.id2manPos={},n.onLayoutEnd=function(){},n.updateCfg(e),n}return t.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}},t.prototype.execute=function(){var e=this,n=e.nodes,i=e.edges,a=e.begin,o=n.length;if(o===0)return e.onLayoutEnd&&e.onLayoutEnd(),{nodes:n,edges:i};if(o===1)return n[0].x=a[0],n[0].y=a[1],e.onLayoutEnd&&e.onLayoutEnd(),{nodes:n,edges:i};var s=e.sortBy,u=e.width,f=e.height,l=e.condense,c=e.preventOverlapPadding,h=e.preventOverlap,d=e.nodeSpacing,v=e.nodeSize,p=[];n.forEach(function(T){p.push(T)});var g={};if(p.forEach(function(T,I){g[T.id]=I}),(s==="degree"||!(0,iu.isString)(s)||p[0][s]===void 0)&&(s="degree",(0,iu.isNaN)(n[0].degree))){var y=(0,iu.getDegree)(p.length,g,i);p.forEach(function(T,I){T.degree=y[I].all})}p.sort(function(T,I){return I[s]-T[s]}),!u&&typeof window<"u"&&(u=window.innerWidth),!f&&typeof window<"u"&&(f=window.innerHeight);var m=e.rows,b=e.cols!=null?e.cols:e.columns;if(e.cells=o,m!=null&&b!=null?(e.rows=m,e.cols=b):m!=null&&b==null?(e.rows=m,e.cols=Math.ceil(e.cells/e.rows)):m==null&&b!=null?(e.cols=b,e.rows=Math.ceil(e.cells/e.cols)):(e.splits=Math.sqrt(e.cells*e.height/e.width),e.rows=Math.round(e.splits),e.cols=Math.round(e.width/e.height*e.splits)),e.rows=Math.max(e.rows,1),e.cols=Math.max(e.cols,1),e.cols*e.rows>e.cells){var x=e.small(),E=e.large();(x-1)*E>=e.cells?e.small(x-1):(E-1)*x>=e.cells&&e.large(E-1)}else for(;e.cols*e.rows<e.cells;){var x=e.small(),E=e.large();(E+1)*x>=e.cells?e.large(E+1):e.small(x+1)}if(e.cellWidth=u/e.cols,e.cellHeight=f/e.rows,l&&(e.cellWidth=0,e.cellHeight=0),h||d){var w=(0,iu.getFuncByUnknownType)(10,d),_=(0,iu.getFuncByUnknownType)(30,v,!1);p.forEach(function(T){(!T.x||!T.y)&&(T.x=0,T.y=0);var I=_(T)||30,D,N;(0,iu.isArray)(I)?(D=I[0],N=I[1]):(D=I,N=I);var P=w!==void 0?w(T):c,G=D+P,W=N+P;e.cellWidth=Math.max(e.cellWidth,G),e.cellHeight=Math.max(e.cellHeight,W)})}e.cellUsed={},e.row=0,e.col=0,e.id2manPos={};for(var M=0;M<p.length;M++){var C=p[M],S=void 0;if(e.position&&(S=e.position(C)),S&&(S.row!==void 0||S.col!==void 0)){var A={row:S.row,col:S.col};if(A.col===void 0)for(A.col=0;e.used(A.row,A.col);)A.col++;else if(A.row===void 0)for(A.row=0;e.used(A.row,A.col);)A.row++;e.id2manPos[C.id]=A,e.use(A.row,A.col)}e.getPos(C)}return e.onLayoutEnd&&e.onLayoutEnd(),{edges:i,nodes:p}},t.prototype.small=function(e){var n=this,i,a=n.rows||5,o=n.cols||5;if(e==null)i=Math.min(a,o);else{var s=Math.min(a,o);s===n.rows?n.rows=e:n.cols=e}return i},t.prototype.large=function(e){var n=this,i,a=n.rows||5,o=n.cols||5;if(e==null)i=Math.max(a,o);else{var s=Math.max(a,o);s===n.rows?n.rows=e:n.cols=e}return i},t.prototype.used=function(e,n){var i=this;return i.cellUsed["c-".concat(e,"-").concat(n)]||!1},t.prototype.use=function(e,n){var i=this;i.cellUsed["c-".concat(e,"-").concat(n)]=!0},t.prototype.moveToNextCell=function(){var e=this,n=e.cols||5;e.col++,e.col>=n&&(e.col=0,e.row++)},t.prototype.getPos=function(e){var n=this,i=n.begin,a=n.cellWidth,o=n.cellHeight,s,u,f=n.id2manPos[e.id];if(f)s=f.col*a+a/2+i[0],u=f.row*o+o/2+i[1];else{for(;n.used(n.row,n.col);)n.moveToNextCell();s=n.col*a+a/2+i[0],u=n.row*o+o/2+i[1],n.use(n.row,n.col),n.moveToNextCell()}e.x=s,e.y=u},t.prototype.getType=function(){return"grid"},t}(jX.Base);Wl.GridLayout=UX;var Xl={},$X=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(Xl,"__esModule",{value:!0});Xl.RandomLayout=void 0;var WX=Wr,XX=function(r){$X(t,r);function t(e){var n=r.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},t.prototype.execute=function(){var e=this,n=e.nodes,i=.9,a=e.center;return!e.width&&typeof window<"u"&&(e.width=window.innerWidth),!e.height&&typeof window<"u"&&(e.height=window.innerHeight),n&&n.forEach(function(o){o.x=(Math.random()-.5)*i*e.width+a[0],o.y=(Math.random()-.5)*i*e.height+a[1]}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:n,edges:this.edges}},t.prototype.getType=function(){return"random"},t}(WX.Base);Xl.RandomLayout=XX;var Yl={},YX=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(Yl,"__esModule",{value:!0});Yl.GForceLayout=void 0;var VX=Wr,Sn=Nr(),jg=function(r,t){var e;return r?(0,Sn.isNumber)(r)?e=function(n){return r}:e=r:e=function(n){return t||1},e},HX=function(r){YX(t,r);function t(e){var n=r.call(this)||this;return n.maxIteration=500,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.preventOverlap=!0,n.collideStrength=1,n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.animate=!0,n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},t.prototype.execute=function(){var e,n,i=this,a=i.nodes;if(i.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(i.timeInterval),!a||a.length===0){(e=i.onLayoutEnd)===null||e===void 0||e.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var o=i.center;if(a.length===1){a[0].x=o[0],a[0].y=o[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var s={},u={};a.forEach(function(v,p){(0,Sn.isNumber)(v.x)||(v.x=Math.random()*i.width),(0,Sn.isNumber)(v.y)||(v.y=Math.random()*i.height),s[v.id]=v,u[v.id]=p}),i.nodeMap=s,i.nodeIdxMap=u,i.linkDistance=jg(i.linkDistance,1),i.nodeStrength=jg(i.nodeStrength,1),i.edgeStrength=jg(i.edgeStrength,1);var f=i.nodeSize,l;if(i.preventOverlap){var c=i.nodeSpacing,h;(0,Sn.isNumber)(c)?h=function(){return c}:(0,Sn.isFunction)(c)?h=c:h=function(){return 0},f?(0,Sn.isArray)(f)?l=function(v){return Math.max(f[0],f[1])+h(v)}:l=function(v){return f+h(v)}:l=function(v){return v.size?(0,Sn.isArray)(v.size)?Math.max(v.size[0],v.size[1])+h(v):(0,Sn.isObject)(v.size)?Math.max(v.size.width,v.size.height)+h(v):v.size+h(v):10+h(v)}}i.nodeSize=l;var d=i.edges;i.degrees=(0,Sn.getDegree)(a.length,i.nodeIdxMap,d),i.getMass||(i.getMass=function(v){var p=v.mass||i.degrees[i.nodeIdxMap[v.id]].all||1;return p}),i.run()},t.prototype.run=function(){var e,n=this,i=n.maxIteration,a=n.nodes,o=n.workerEnabled,s=n.minMovement,u=n.animate;if(a)if(o||!u){for(var f=0;f<i;f++){var l=n.runOneStep(f);if(n.reachMoveThreshold(a,l,s))break}(e=n.onLayoutEnd)===null||e===void 0||e.call(n)}else{if(typeof window>"u")return;var c=0;this.timeInterval=window.setInterval(function(){var h,d;if(a){var v=n.runOneStep(c)||[];n.reachMoveThreshold(a,v,s)&&((h=n.onLayoutEnd)===null||h===void 0||h.call(n),window.clearInterval(n.timeInterval)),c++,c>=i&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))}},0)}},t.prototype.reachMoveThreshold=function(e,n,i){var a=0;return e.forEach(function(o,s){var u=o.x-n[s].x,f=o.y-n[s].y;a+=Math.sqrt(u*u+f*f)}),a/=e.length,a<i},t.prototype.runOneStep=function(e){var n,i=this,a=i.nodes,o=i.edges,s=[],u=[];if(a){a.forEach(function(c,h){s[2*h]=0,s[2*h+1]=0,u[2*h]=0,u[2*h+1]=0}),i.calRepulsive(s,a),o&&i.calAttractive(s,o),i.calGravity(s,a);var f=Math.max(.02,i.interval-e*.002);i.updateVelocity(s,u,f,a);var l=[];return a.forEach(function(c){l.push({x:c.x,y:c.y})}),i.updatePosition(u,f,a),(n=i.tick)===null||n===void 0||n.call(i),l}},t.prototype.calRepulsive=function(e,n){var i=this,a=i.getMass,o=i.factor,s=i.coulombDisScale,u=i.preventOverlap,f=i.collideStrength,l=f===void 0?1:f,c=i.nodeStrength,h=i.nodeSize;n.forEach(function(d,v){var p=a?a(d):1;n.forEach(function(g,y){if(!(v>=y)){var m=d.x-g.x,b=d.y-g.y;m===0&&b===0&&(m=Math.random()*.01,b=Math.random()*.01);var x=m*m+b*b,E=Math.sqrt(x),w=(E+.1)*s,_=m/E,M=b/E,C=(c(d)+c(g))*.5*o/(w*w),S=a?a(g):1;if(e[2*v]+=_*C,e[2*v+1]+=M*C,e[2*y]-=_*C,e[2*y+1]-=M*C,u&&(h(d)+h(g))/2>E){var A=l*(c(d)+c(g))*.5/x;e[2*v]+=_*A/p,e[2*v+1]+=M*A/p,e[2*y]-=_*A/S,e[2*y+1]-=M*A/S}}})})},t.prototype.calAttractive=function(e,n){var i=this,a=i.nodeMap,o=i.nodeIdxMap,s=i.linkDistance,u=i.edgeStrength,f=i.nodeSize,l=i.getMass;n.forEach(function(c,h){var d=(0,Sn.getEdgeTerminal)(c,"source"),v=(0,Sn.getEdgeTerminal)(c,"target"),p=a[d],g=a[v],y=g.x-p.x,m=g.y-p.y;y===0&&m===0&&(y=Math.random()*.01,m=Math.random()*.01);var b=Math.sqrt(y*y+m*m),x=y/b,E=m/b,w=s(c,p,g)||1+(f(p)+f(g)||0)/2,_=w-b,M=_*u(c),C=o[d],S=o[v],A=l?l(p):1,T=l?l(g):1;e[2*C]-=x*M/A,e[2*C+1]-=E*M/A,e[2*S]+=x*M/T,e[2*S+1]+=E*M/T})},t.prototype.calGravity=function(e,n){for(var i=this,a=i.center,o=i.gravity,s=i.degrees,u=n.length,f=0;f<u;f++){var l=n[f],c=l.x-a[0],h=l.y-a[1],d=o;if(i.getCenter){var v=i.getCenter(l,s[f].all);v&&(0,Sn.isNumber)(v[0])&&(0,Sn.isNumber)(v[1])&&(0,Sn.isNumber)(v[2])&&(c=l.x-v[0],h=l.y-v[1],d=v[2])}d&&(e[2*f]-=d*c,e[2*f+1]-=d*h)}},t.prototype.updateVelocity=function(e,n,i,a){var o=this,s=i*o.damping;a.forEach(function(u,f){var l=e[2*f]*s||.01,c=e[2*f+1]*s||.01,h=Math.sqrt(l*l+c*c);if(h>o.maxSpeed){var d=o.maxSpeed/h;l=d*l,c=d*c}n[2*f]=l,n[2*f+1]=c})},t.prototype.updatePosition=function(e,n,i){i.forEach(function(a,o){if((0,Sn.isNumber)(a.fx)&&(0,Sn.isNumber)(a.fy)){a.x=a.fx,a.y=a.fy;return}var s=e[2*o]*n,u=e[2*o+1]*n;a.x+=s,a.y+=u})},t.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},t.prototype.destroy=function(){var e=this;e.stop(),e.tick=null,e.nodes=null,e.edges=null,e.destroyed=!0},t.prototype.getType=function(){return"gForce"},t}(VX.Base);Yl.GForceLayout=HX;var Vl={},Ov={};function KX(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return VO(this.cover(t,e),t,e,r)}function VO(r,t,e,n){if(isNaN(t)||isNaN(e))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=t>=(c=(s+f)/2))?s=c:f=c,(g=e>=(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),t===d&&e===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=t>=(c=(s+f)/2))?s=c:f=c,(g=e>=(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 qX(r){var t,e,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(e=0;e<n;++e)isNaN(i=+this._x.call(null,t=r[e]))||isNaN(a=+this._y.call(null,t))||(o[e]=i,s[e]=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),e=0;e<n;++e)VO(this,o[e],s[e],r[e]);return this}function ZX(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var e=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(e))i=(e=Math.floor(r))+1,a=(n=Math.floor(t))+1;else{for(var o=i-e||1,s=this._root,u,f;e>r||r>=i||n>t||t>=a;)switch(f=(t<n)<<1|r<e,u=new Array(4),u[f]=s,s=u,o*=2,f){case 0:i=e+o,a=n+o;break;case 1:e=i-o,a=n+o;break;case 2:i=e+o,n=a-o;break;case 3:e=i-o,n=a-o;break}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=n,this._x1=i,this._y1=a,this}function QX(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function JX(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 Ln(r,t,e,n,i){this.node=r,this.x0=t,this.y0=e,this.x1=n,this.y1=i}function eY(r,t,e){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 Ln(d,i,a,l,c)),e==null?e=1/0:(i=r-e,a=t-e,l=r+e,c=t+e,e*=e);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 Ln(d[3],g,y,u,f),new Ln(d[2],o,y,g,f),new Ln(d[1],g,s,u,y),new Ln(d[0],o,s,g,y)),(p=(t>=y)<<1|r>=g)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-p],h[h.length-1-p]=v)}else{var m=r-+this._x.call(null,d.data),b=t-+this._y.call(null,d.data),x=m*m+b*b;if(x<e){var E=Math.sqrt(e=x);i=r-E,a=t-E,l=r+E,c=t+E,n=d.data}}return n}function tY(r){if(isNaN(l=+this._x.call(null,r))||isNaN(c=+this._y.call(null,r)))return this;var t,e=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(!e)return this;if(e.length)for(;;){if((v=l>=(h=(o+u)/2))?o=h:u=h,(p=c>=(d=(s+f)/2))?s=d:f=d,t=e,!(e=e[g=p<<1|v]))return this;if(!e.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(n=t,y=g)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[y]=e:this._root=e),this):(this._root=a,this)}function rY(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function nY(){return this._root}function iY(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function aY(r){var t=[],e,n=this._root,i,a,o,s,u;for(n&&t.push(new Ln(n,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!r(n=e.node,a=e.x0,o=e.y0,s=e.x1,u=e.y1)&&n.length){var f=(a+s)/2,l=(o+u)/2;(i=n[3])&&t.push(new Ln(i,f,l,s,u)),(i=n[2])&&t.push(new Ln(i,a,l,f,u)),(i=n[1])&&t.push(new Ln(i,f,o,s,l)),(i=n[0])&&t.push(new Ln(i,a,o,f,l))}return this}function oY(r){var t=[],e=[],n;for(this._root&&t.push(new Ln(this._root,this._x0,this._y0,this._x1,this._y1));n=t.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])&&t.push(new Ln(a,o,s,l,c)),(a=i[1])&&t.push(new Ln(a,l,s,u,c)),(a=i[2])&&t.push(new Ln(a,o,c,l,f)),(a=i[3])&&t.push(new Ln(a,l,c,u,f))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function sY(r){return r[0]}function uY(r){return arguments.length?(this._x=r,this):this._x}function fY(r){return r[1]}function lY(r){return arguments.length?(this._y=r,this):this._y}function Lv(r,t,e){var n=new l1(t==null?sY:t,e==null?fY:e,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function l1(r,t,e,n,i,a){this._x=r,this._y=t,this._x0=e,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function z_(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var Dn=Lv.prototype=l1.prototype;Dn.copy=function(){var r=new l1(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,n;if(!t)return r;if(!t.length)return r._root=z_(t),r;for(e=[{source:t,target:r._root=new Array(4)}];t=e.pop();)for(var i=0;i<4;++i)(n=t.source[i])&&(n.length?e.push({source:n,target:t.target[i]=new Array(4)}):t.target[i]=z_(n));return r};Dn.add=KX;Dn.addAll=qX;Dn.cover=ZX;Dn.data=QX;Dn.extent=JX;Dn.find=eY;Dn.remove=tY;Dn.removeAll=rY;Dn.root=nY;Dn.size=iY;Dn.visit=aY;Dn.visitAfter=oY;Dn.x=uY;Dn.y=lY;const cY=Object.freeze(Object.defineProperty({__proto__:null,quadtree:Lv},Symbol.toStringTag,{value:"Module"})),hY=ma(cY);Object.defineProperty(Ov,"__esModule",{value:!0});Ov.forceNBody=void 0;var dY=hY,vY=.81,j_=.1;function pY(r,t,e,n,i){var a=e/n,o=r.map(function(u,f){var l=t[u.id],c=l.data,h=l.x,d=l.y,v=l.size,p=c.layout.force.nodeStrength;return{x:h,y:d,size:v,index:f,vx:0,vy:0,weight:a*p}}),s=(0,dY.quadtree)(o,function(u){return u.x},function(u){return u.y}).visitAfter(gY);return o.forEach(function(u){mY(u,s)}),o.map(function(u,f){var l=t[r[f].id],c=l.data.layout.force.mass,h=c===void 0?1:c;i[2*f]=u.vx/h,i[2*f+1]=u.vy/h}),i}Ov.forceNBody=pY;function gY(r){var t=0,e=0,n=0;if(r.length){for(var i=0;i<4;i++){var a=r[i];a&&a.weight&&(t+=a.weight,e+=a.x*a.weight,n+=a.y*a.weight)}r.x=e/t,r.y=n/t,r.weight=t}else{var a=r;r.x=a.data.x,r.y=a.data.y,r.weight=a.data.weight}}var yY=function(r,t,e,n,i,a){var o=a.x-r.x||j_,s=a.y-r.y||j_,u=n-t,f=o*o+s*s,l=Math.sqrt(f)*f;if(u*u*vY<f){var c=r.weight/l;return a.vx+=o*c,a.vy+=s*c,!0}if(r.length)return!1;if(r.data!==a){var c=r.data.weight/l;a.vx+=o*c,a.vy+=s*c}};function mY(r,t){t.visit(function(e,n,i,a,o){return yY(e,n,i,a,o,r)})}var bY=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ti=xe&&xe.__assign||function(){return Ti=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Ti.apply(this,arguments)};Object.defineProperty(Vl,"__esModule",{value:!0});Vl.Force2Layout=void 0;var xY=Wr,an=Nr(),EY=Ov,Ug=function(r,t){var e;return r?(0,an.isNumber)(r)?e=function(n){return r}:e=r:e=function(n){return t||1},e},wY=function(r){bY(t,r);function t(e){var n=r.call(this)||this;n.maxIteration=1e3,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=500,n.minMovement=.4,n.interval=.02,n.factor=1,n.linkDistance=200,n.gravity=0,n.clusterNodeStrength=20,n.preventOverlap=!0,n.distanceThresholdMode="mean",n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.judgingDistance=0,n.centripetalOptions={leaf:2,single:2,others:1,center:function(a){return{x:n.width/2,y:n.height/2}}};var i=e.getMass;return n.propsGetMass=i,n.updateCfg(e),n}return t.prototype.getCentripetalOptions=function(){var e=this,n=e.leafCluster,i=e.clustering,a=e.nodeClusterBy,o=e.nodes,s=e.nodeMap,u=e.clusterNodeStrength,f=function(b){return typeof u=="function"?u(b):u},l={},c;if(n){c=this.getSameTypeLeafMap()||{};var h=Array.from(new Set(o==null?void 0:o.map(function(b){return b[a]})))||[];l={single:100,leaf:function(b,x,E){var w=c[b.id]||{},_=w.relativeLeafNodes,M=w.sameTypeLeafNodes;return(M==null?void 0:M.length)===(_==null?void 0:_.length)||(h==null?void 0:h.length)===1?1:f(b)},others:1,center:function(b,x,E){var w,_=(((w=b.data)===null||w===void 0?void 0:w.layout)||{}).degree;if(!_)return{x:100,y:100};var M;if(_===1){var C=(c[b.id]||{}).sameTypeLeafNodes,S=C===void 0?[]:C;S.length===1?M=void 0:S.length>1&&(M=(0,an.getAvgNodePosition)(S))}else M=void 0;return{x:M==null?void 0:M.x,y:M==null?void 0:M.y}}}}if(i){c||(c=this.getSameTypeLeafMap());var d=Array.from(new Set(o.map(function(b,x){return b[a]}))).filter(function(b){return b!==void 0}),v={};d.forEach(function(b){var x=o.filter(function(E){return E[a]===b}).map(function(E){return s[E.id]});v[b]=(0,an.getAvgNodePosition)(x)}),l={single:function(b){return f(b)},leaf:function(b){return f(b)},others:function(b){return f(b)},center:function(b,x,E){var w=v[b[a]];return{x:w==null?void 0:w.x,y:w==null?void 0:w.y}}}}this.centripetalOptions=Ti(Ti({},this.centripetalOptions),l);var p=this.centripetalOptions,g=p.leaf,y=p.single,m=p.others;g&&typeof g!="function"&&(this.centripetalOptions.leaf=function(){return g}),y&&typeof y!="function"&&(this.centripetalOptions.single=function(){return y}),m&&typeof m!="function"&&(this.centripetalOptions.others=function(){return m})},t.prototype.updateCfg=function(e){e&&Object.assign(this,e)},t.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},t.prototype.execute=function(){var e=this;e.stop();var n=e.nodes,i=e.edges,a=e.defSpringLen;if(e.judgingDistance=0,!n||n.length===0){e.onLayoutEnd([]);return}!e.width&&typeof window<"u"&&(e.width=window.innerWidth),!e.height&&typeof window<"u"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);var o=e.center;if(n.length===1){n[0].x=o[0],n[0].y=o[1],e.onLayoutEnd([Ti({},n[0])]);return}e.degreesMap=(0,an.getDegreeMap)(n,i),e.propsGetMass?e.getMass=e.propsGetMass:e.getMass=function(d){var v=1;(0,an.isNumber)(d.mass)&&(v=d.mass);var p=e.degreesMap[d.id].all;return!p||p<5?v:p*5*v};var s=e.nodeSize,u;if(e.preventOverlap){var f=e.nodeSpacing,l;(0,an.isNumber)(f)?l=function(){return f}:(0,an.isFunction)(f)?l=f:l=function(){return 0},s?(0,an.isArray)(s)?u=function(d){return Math.max(s[0],s[1])+l(d)}:u=function(d){return s+l(d)}:u=function(d){return d.size?(0,an.isArray)(d.size)?Math.max(d.size[0],d.size[1])+l(d):(0,an.isObject)(d.size)?Math.max(d.size.width,d.size.height)+l(d):d.size+l(d):10+l(d)}}e.nodeSize=u,e.linkDistance=Ug(e.linkDistance,1),e.nodeStrength=Ug(e.nodeStrength,1),e.edgeStrength=Ug(e.edgeStrength,1);var c={},h={};n.forEach(function(d,v){(0,an.isNumber)(d.x)||(d.x=Math.random()*e.width),(0,an.isNumber)(d.y)||(d.y=Math.random()*e.height);var p=e.degreesMap[d.id];c[d.id]=Ti(Ti({},d),{data:Ti(Ti({},d.data),{size:e.nodeSize(d)||30,layout:{inDegree:p.in,outDegree:p.out,degree:p.all,tDegree:p.in,sDegree:p.out,force:{mass:e.getMass(d),nodeStrength:e.nodeStrength(d,i)}}})}),h[d.id]=v}),e.nodeMap=c,e.nodeIdxMap=h,e.edgeInfos=[],i==null||i.forEach(function(d){var v=c[d.source],p=c[d.target];!v||!p?elf.edgeInfos.push({}):e.edgeInfos.push({edgeStrength:e.edgeStrength(d),linkDistance:a?a(Ti(Ti({},d),{source:v,target:p}),v,p):e.linkDistance(d,v,p)||1+(s(v)+s(v)||0)/2})}),this.getCentripetalOptions(),e.onLayoutEnd=e.onLayoutEnd||function(){},e.run()},t.prototype.run=function(){var e=this,n=e.maxIteration,i=e.nodes,a=e.edges,o=e.workerEnabled,s=e.minMovement,u=e.animate,f=e.nodeMap,l=e.height;if(e.currentMinY=0,e.currentMaxY=l,!!i){var c=[];if(i.forEach(function(y,m){c[2*m]=0,c[2*m+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var h={};a.forEach(function(y){var m=y.source,b=y.target;h[m]=h[m]||[],h[m].push(y),h[b]=h[b]||[],h[b].push(y)}),this.relatedEdges=h}var d=n,v=!u;if(o||v){for(var p=0;(e.judgingDistance>s||p<1)&&p<d;p++)e.runOneStep(p,c);e.onLayoutEnd(Object.values(f))}else{if(typeof window>"u")return;var g=0;this.timeInterval=window.setInterval(function(){i&&(e.runOneStep(g,c),g++,(g>=d||e.judgingDistance<s)&&(e.onLayoutEnd(Object.values(f)),window.clearInterval(e.timeInterval)))},0)}}},t.prototype.runOneStep=function(e,n){var i,a=this,o=a.nodes,s=a.edges;a.nodeMap;var u=a.monitor,f=[];if(o!=null&&o.length){a.calRepulsive(f),s&&a.calAttractive(f),a.calGravity(f),a.attractToSide(f);var l=a.interval;if(a.updateVelocity(f,n,l),a.updatePosition(n,l),(i=a.tick)===null||i===void 0||i.call(a),u){var c=this.calTotalEnergy(f);u({energy:c,nodes:o,edges:s,iterations:e})}}},t.prototype.calTotalEnergy=function(e){var n=this,i=n.nodes,a=n.nodeMap;if(!(i!=null&&i.length))return 0;var o=0;return i.forEach(function(s,u){var f=e[2*u],l=e[2*u+1],c=f*f+l*l,h=a[s.id].data.layout.force.mass,d=h===void 0?1:h;o+=d*c*.5}),o},t.prototype.calRepulsive=function(e){var n=this,i=n.nodes,a=n.nodeMap,o=n.factor,s=n.coulombDisScale;n.nodeSize,(0,EY.forceNBody)(i,a,o,s*s,e)},t.prototype.calAttractive=function(e){var n=this,i=n.edges,a=n.nodeMap,o=n.nodeIdxMap,s=n.edgeInfos;n.nodeSize,i.forEach(function(u,f){var l=(0,an.getEdgeTerminal)(u,"source"),c=(0,an.getEdgeTerminal)(u,"target"),h=a[l],d=a[c];if(!(!h||!d)){var v=d.x-h.x,p=d.y-h.y;!v&&!p&&(v=Math.random()*.01,p=Math.random()*.01);var g=Math.sqrt(v*v+p*p),y=v/g,m=p/g,b=s[f]||{},x=b.linkDistance,E=x===void 0?200:x,w=b.edgeStrength,_=w===void 0?200:w,M=E-g,C=M*_,S=h.data.layout.force.mass||1,A=d.data.layout.force.mass||1,T=1/S,I=1/A,D=y*C,N=m*C,P=2*o[l],G=2*o[c];e[P]-=D*T,e[P+1]-=N*T,e[G]+=D*I,e[G+1]+=N*I}})},t.prototype.calGravity=function(e){var n,i=this,a=i.nodes,o=i.edges,s=o===void 0?[]:o,u=i.nodeMap,f=i.width,l=i.height,c=i.center,h=i.gravity,d=i.degreesMap,v=i.centripetalOptions;if(a)for(var p=a.length,g=0;g<p;g++){var y=2*g,m=u[a[g].id],b=m.data.layout.force.mass,x=b===void 0?1:b,E=0,w=0,_=h,M=d[m.id],C=M.in,S=M.out,A=M.all,T=(n=i.getCenter)===null||n===void 0?void 0:n.call(i,m,A);if(T){var I=T[0],D=T[1],N=T[2];E=m.x-I,w=m.y-D,_=N}else E=m.x-c[0],w=m.y-c[1];if(_&&(e[y]-=_*E/x,e[y+1]-=_*w/x),v){var P=v.leaf,G=v.single,W=v.others,k=v.center,R=(k==null?void 0:k(m,a,s,f,l))||{x:0,y:0,centerStrength:0},Y=R.x,J=R.y,te=R.centerStrength;if(!(0,an.isNumber)(Y)||!(0,an.isNumber)(J))continue;var H=(m.x-Y)/x,pe=(m.y-J)/x;if(te&&(e[y]-=te*H,e[y+1]-=te*pe),A===0){var Ae=G(m);if(!Ae)continue;e[y]-=Ae*H,e[y+1]-=Ae*pe;continue}if(C===0||S===0){var Le=P(m,a,s);if(!Le)continue;e[y]-=Le*H,e[y+1]-=Le*pe;continue}var qe=W(m);if(!qe)continue;e[y]-=qe*H,e[y+1]-=qe*pe}}},t.prototype.attractToSide=function(e){var n=this,i=n.defSideCoe;n.height;var a=n.nodes,o=n.relatedEdges,s=n.currentMinY,u=s===void 0?0:s,f=n.currentMaxY,l=f===void 0?this.height:f;!i||typeof i!="function"||!(a!=null&&a.length)||a.forEach(function(c,h){var d=i(c,o[c.id]||[]);if(d!==0){var v=d<0?u:l,p=Math.abs(d);e[2*h+1]-=p*(c.y-v)}})},t.prototype.updateVelocity=function(e,n,i){var a=this,o=a.nodes,s=a.damping,u=a.maxSpeed;o!=null&&o.length&&o.forEach(function(f,l){var c=(n[2*l]+e[2*l]*i)*s||.01,h=(n[2*l+1]+e[2*l+1]*i)*s||.01,d=Math.sqrt(c*c+h*h);if(d>u){var v=u/d;c=v*c,h=v*h}n[2*l]=c,n[2*l+1]=h})},t.prototype.updatePosition=function(e,n){var i=this,a=i.nodes,o=i.distanceThresholdMode,s=i.nodeMap;if(!(a!=null&&a.length)){this.judgingDistance=0;return}var u=0;o==="max"?i.judgingDistance=-1/0:o==="min"&&(i.judgingDistance=1/0);var f=1/0,l=-1/0;a.forEach(function(c,h){var d=s[c.id];if((0,an.isNumber)(c.fx)&&(0,an.isNumber)(c.fy)){c.x=c.fx,c.y=c.fy,d.x=c.x,d.y=c.y;return}var v=e[2*h]*n,p=e[2*h+1]*n;c.x+=v,c.y+=p,d.x=c.x,d.y=c.y,c.y<f&&(f=c.y),c.y>l&&(l=c.y);var g=Math.sqrt(v*v+p*p);switch(o){case"max":i.judgingDistance<g&&(i.judgingDistance=g);break;case"min":i.judgingDistance>g&&(i.judgingDistance=g);break;default:u=u+g;break}}),this.currentMinY=f,this.currentMaxY=l,(!o||o==="mean")&&(i.judgingDistance=u/a.length)},t.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},t.prototype.destroy=function(){var e=this;e.stop(),e.tick=null,e.nodes=null,e.edges=null,e.destroyed=!0},t.prototype.getType=function(){return"force2"},t.prototype.getSameTypeLeafMap=function(){var e=this,n=e.nodeClusterBy,i=e.nodes,a=e.edges,o=e.nodeMap,s=e.degreesMap;if(i!=null&&i.length){var u={};return i.forEach(function(f,l){var c=s[f.id].all;c===1&&(u[f.id]=(0,an.getCoreNodeAndRelativeLeafNodes)("leaf",f,a,n,s,o))}),u}},t}(xY.Base);Vl.Force2Layout=wY;var c1={},Dv={};function _Y(r,t){var e,n=1;r==null&&(r=0),t==null&&(t=0);function i(){var a,o=e.length,s,u=0,f=0;for(a=0;a<o;++a)s=e[a],u+=s.x,f+=s.y;for(u=(u/o-r)*n,f=(f/o-t)*n,a=0;a<o;++a)s=e[a],s.x-=u,s.y-=f}return i.initialize=function(a){e=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(t=+a,i):t},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function un(r){return function(){return r}}function Mo(r){return(r()-.5)*1e-6}function SY(r){return r.x+r.vx}function MY(r){return r.y+r.vy}function CY(r){var t,e,n,i=1,a=1;typeof r!="function"&&(r=un(r==null?1:+r));function o(){for(var f,l=t.length,c,h,d,v,p,g,y=0;y<a;++y)for(c=Lv(t,SY,MY).visitAfter(s),f=0;f<l;++f)h=t[f],p=e[h.index],g=p*p,d=h.x+h.vx,v=h.y+h.vy,c.visit(m);function m(b,x,E,w,_){var M=b.data,C=b.r,S=p+C;if(M){if(M.index>h.index){var A=d-M.x-M.vx,T=v-M.y-M.vy,I=A*A+T*T;I<S*S&&(A===0&&(A=Mo(n),I+=A*A),T===0&&(T=Mo(n),I+=T*T),I=(S-(I=Math.sqrt(I)))/I*i,h.vx+=(A*=I)*(S=(C*=C)/(g+C)),h.vy+=(T*=I)*S,M.vx-=A*(S=1-S),M.vy-=T*S)}return}return x>d+S||w<d-S||E>v+S||_<v-S}}function s(f){if(f.data)return f.r=e[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(t){var f,l=t.length,c;for(e=new Array(l),f=0;f<l;++f)c=t[f],e[c.index]=+r(c,f,t)}}return o.initialize=function(f,l){t=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:un(+f),u(),o):r},o}function AY(r){return r.index}function U_(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function TY(r){var t=AY,e=c,n,i=un(30),a,o,s,u,f,l=1;r==null&&(r=[]);function c(g){return 1/Math.min(s[g.source.index],s[g.target.index])}function h(g){for(var y=0,m=r.length;y<l;++y)for(var b=0,x,E,w,_,M,C,S;b<m;++b)x=r[b],E=x.source,w=x.target,_=w.x+w.vx-E.x-E.vx||Mo(f),M=w.y+w.vy-E.y-E.vy||Mo(f),C=Math.sqrt(_*_+M*M),C=(C-a[b])/C*g*n[b],_*=C,M*=C,w.vx-=_*(S=u[b]),w.vy-=M*S,E.vx+=_*(S=1-S),E.vy+=M*S}function d(){if(o){var g,y=o.length,m=r.length,b=new Map(o.map((E,w)=>[t(E,w,o),E])),x;for(g=0,s=new Array(y);g<m;++g)x=r[g],x.index=g,typeof x.source!="object"&&(x.source=U_(b,x.source)),typeof x.target!="object"&&(x.target=U_(b,x.target)),s[x.source.index]=(s[x.source.index]||0)+1,s[x.target.index]=(s[x.target.index]||0)+1;for(g=0,u=new Array(m);g<m;++g)x=r[g],u[g]=s[x.source.index]/(s[x.source.index]+s[x.target.index]);n=new Array(m),v(),a=new Array(m),p()}}function v(){if(o)for(var g=0,y=r.length;g<y;++g)n[g]=+e(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?(t=g,h):t},h.iterations=function(g){return arguments.length?(l=+g,h):l},h.strength=function(g){return arguments.length?(e=typeof g=="function"?g:un(+g),v(),h):e},h.distance=function(g){return arguments.length?(i=typeof g=="function"?g:un(+g),p(),h):i},h}var IY={value:()=>{}};function HO(){for(var r=0,t=arguments.length,e={},n;r<t;++r){if(!(n=arguments[r]+"")||n in e||/[\s.]/.test(n))throw new Error("illegal type: "+n);e[n]=[]}return new qh(e)}function qh(r){this._=r}function OY(r,t){return r.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");if(i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}qh.prototype=HO.prototype={constructor:qh,on:function(r,t){var e=this._,n=OY(r+"",e),i,a=-1,o=n.length;if(arguments.length<2){for(;++a<o;)if((i=(r=n[a]).type)&&(i=LY(e[i],r.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<o;)if(i=(r=n[a]).type)e[i]=$_(e[i],r.name,t);else if(t==null)for(i in e)e[i]=$_(e[i],r.name,null);return this},copy:function(){var r={},t=this._;for(var e in t)r[e]=t[e].slice();return new qh(r)},call:function(r,t){if((i=arguments.length-2)>0)for(var e=new Array(i),n=0,i,a;n<i;++n)e[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(t,e)},apply:function(r,t,e){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(t,e)}};function LY(r,t){for(var e=0,n=r.length,i;e<n;++e)if((i=r[e]).name===t)return i.value}function $_(r,t,e){for(var n=0,i=r.length;n<i;++n)if(r[n].name===t){r[n]=IY,r=r.slice(0,n).concat(r.slice(n+1));break}return e!=null&&r.push({name:t,value:e}),r}var ju=0,Yf=0,Mf=0,KO=1e3,Dd,Vf,kd=0,Ts=0,kv=0,Sl=typeof performance=="object"&&performance.now?performance:Date,qO=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function ZO(){return Ts||(qO(DY),Ts=Sl.now()+kv)}function DY(){Ts=0}function xy(){this._call=this._time=this._next=null}xy.prototype=QO.prototype={constructor:xy,restart:function(r,t,e){if(typeof r!="function")throw new TypeError("callback is not a function");e=(e==null?ZO():+e)+(t==null?0:+t),!this._next&&Vf!==this&&(Vf?Vf._next=this:Dd=this,Vf=this),this._call=r,this._time=e,Ey()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ey())}};function QO(r,t,e){var n=new xy;return n.restart(r,t,e),n}function kY(){ZO(),++ju;for(var r=Dd,t;r;)(t=Ts-r._time)>=0&&r._call.call(null,t),r=r._next;--ju}function W_(){Ts=(kd=Sl.now())+kv,ju=Yf=0;try{kY()}finally{ju=0,NY(),Ts=0}}function PY(){var r=Sl.now(),t=r-kd;t>KO&&(kv-=t,kd=r)}function NY(){for(var r,t=Dd,e,n=1/0;t;)t._call?(n>t._time&&(n=t._time),r=t,t=t._next):(e=t._next,t._next=null,t=r?r._next=e:Dd=e);Vf=r,Ey(n)}function Ey(r){if(!ju){Yf&&(Yf=clearTimeout(Yf));var t=r-Ts;t>24?(r<1/0&&(Yf=setTimeout(W_,r-Sl.now()-kv)),Mf&&(Mf=clearInterval(Mf))):(Mf||(kd=Sl.now(),Mf=setInterval(PY,KO)),ju=1,qO(W_))}}const RY=1664525,BY=1013904223,X_=4294967296;function FY(){let r=1;return()=>(r=(RY*r+BY)%X_)/X_}function GY(r){return r.x}function zY(r){return r.y}var jY=10,UY=Math.PI*(3-Math.sqrt(5));function $Y(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,o=.6,s=new Map,u=QO(c),f=HO("tick","end"),l=FY();r==null&&(r=[]);function c(){h(),f.call("tick",t),e<n&&(u.stop(),f.call("end",t))}function h(p){var g,y=r.length,m;p===void 0&&(p=1);for(var b=0;b<p;++b)for(e+=(a-e)*i,s.forEach(function(x){x(e)}),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 t}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=jY*Math.sqrt(.5+p),b=p*UY;y.x=m*Math.cos(b),y.y=m*Math.sin(b)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function v(p){return p.initialize&&p.initialize(r,l),p}return d(),t={tick:h,restart:function(){return u.restart(c),t},stop:function(){return u.stop(),t},nodes:function(p){return arguments.length?(r=p,d(),s.forEach(v),t):r},alpha:function(p){return arguments.length?(e=+p,t):e},alphaMin:function(p){return arguments.length?(n=+p,t):n},alphaDecay:function(p){return arguments.length?(i=+p,t):+i},alphaTarget:function(p){return arguments.length?(a=+p,t):a},velocityDecay:function(p){return arguments.length?(o=1-p,t):1-o},randomSource:function(p){return arguments.length?(l=p,s.forEach(v),t):l},force:function(p,g){return arguments.length>1?(g==null?s.delete(p):s.set(p,v(g)),t):s.get(p)},find:function(p,g,y){var m=0,b=r.length,x,E,w,_,M;for(y==null?y=1/0:y*=y,m=0;m<b;++m)_=r[m],x=p-_.x,E=g-_.y,w=x*x+E*E,w<y&&(M=_,y=w);return M},on:function(p,g){return arguments.length>1?(f.on(p,g),t):f.on(p)}}}function WY(){var r,t,e,n,i=un(-30),a,o=1,s=1/0,u=.81;function f(d){var v,p=r.length,g=Lv(r,GY,zY).visitAfter(c);for(n=d,v=0;v<p;++v)t=r[v],g.visit(h)}function l(){if(r){var d,v=r.length,p;for(a=new Array(v),d=0;d<v;++d)p=r[d],a[p.index]=+i(p,d,r)}}function c(d){var v=0,p,g,y=0,m,b,x;if(d.length){for(m=b=x=0;x<4;++x)(p=d[x])&&(g=Math.abs(p.value))&&(v+=p.value,y+=g,m+=g*p.x,b+=g*p.y);d.x=m/y,d.y=b/y}else{p=d,p.x=p.data.x,p.y=p.data.y;do v+=a[p.data.index];while(p=p.next)}d.value=v}function h(d,v,p,g){if(!d.value)return!0;var y=d.x-t.x,m=d.y-t.y,b=g-v,x=y*y+m*m;if(b*b/u<x)return x<s&&(y===0&&(y=Mo(e),x+=y*y),m===0&&(m=Mo(e),x+=m*m),x<o&&(x=Math.sqrt(o*x)),t.vx+=y*d.value*n/x,t.vy+=m*d.value*n/x),!0;if(d.length||x>=s)return;(d.data!==t||d.next)&&(y===0&&(y=Mo(e),x+=y*y),m===0&&(m=Mo(e),x+=m*m),x<o&&(x=Math.sqrt(o*x)));do d.data!==t&&(b=a[d.data.index]*n/x,t.vx+=y*b,t.vy+=m*b);while(d=d.next)}return f.initialize=function(d,v){r=d,e=v,l()},f.strength=function(d){return arguments.length?(i=typeof d=="function"?d:un(+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 XY(r,t,e){var n,i=un(.1),a,o;typeof r!="function"&&(r=un(+r)),t==null&&(t=0),e==null&&(e=0);function s(f){for(var l=0,c=n.length;l<c;++l){var h=n[l],d=h.x-t||1e-6,v=h.y-e||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:un(+f),u(),s):i},s.radius=function(f){return arguments.length?(r=typeof f=="function"?f:un(+f),u(),s):r},s.x=function(f){return arguments.length?(t=+f,s):t},s.y=function(f){return arguments.length?(e=+f,s):e},s}function YY(r){var t=un(.1),e,n,i;typeof r!="function"&&(r=un(r==null?0:+r));function a(s){for(var u=0,f=e.length,l;u<f;++u)l=e[u],l.vx+=(i[u]-l.x)*n[u]*s}function o(){if(e){var s,u=e.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(e[s],s,e))?0:+t(e[s],s,e)}}return a.initialize=function(s){e=s,o()},a.strength=function(s){return arguments.length?(t=typeof s=="function"?s:un(+s),o(),a):t},a.x=function(s){return arguments.length?(r=typeof s=="function"?s:un(+s),o(),a):r},a}function VY(r){var t=un(.1),e,n,i;typeof r!="function"&&(r=un(r==null?0:+r));function a(s){for(var u=0,f=e.length,l;u<f;++u)l=e[u],l.vy+=(i[u]-l.y)*n[u]*s}function o(){if(e){var s,u=e.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(e[s],s,e))?0:+t(e[s],s,e)}}return a.initialize=function(s){e=s,o()},a.strength=function(s){return arguments.length?(t=typeof s=="function"?s:un(+s),o(),a):t},a.y=function(s){return arguments.length?(r=typeof s=="function"?s:un(+s),o(),a):r},a}const HY=Object.freeze(Object.defineProperty({__proto__:null,forceCenter:_Y,forceCollide:CY,forceLink:TY,forceManyBody:WY,forceRadial:XY,forceSimulation:$Y,forceX:YY,forceY:VY},Symbol.toStringTag,{value:"Module"})),h1=ma(HY);var d1={},KY=xe&&xe.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var i=Object.getOwnPropertyDescriptor(t,e);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,i)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),qY=xe&&xe.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),ZY=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&KY(t,r,e);return qY(t,r),t};Object.defineProperty(d1,"__esModule",{value:!0});var au=ZY(h1),ph=Nr();function QY(){function r(H){return function(){return H}}var t=function(H){return H.cluster},e=r(1),n=r(-1),i=r(100),a=r(.1),o=[0,0],s=[],u={},f=[],l=100,c=100,h={none:{x:0,y:0}},d=[],v,p="force",g=!0,y=.1;function m(H){if(!g)return m;v.tick(),M();for(var pe=0,Ae=s.length,Le=void 0,qe=H*y;pe<Ae;++pe)Le=s[pe],Le.vx+=(h[t(Le)].x-Le.x)*qe,Le.vy+=(h[t(Le)].y-Le.y)*qe}function b(){s&&x()}function x(){if(!(!s||!s.length)){if(t(s[0])===void 0)throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");var H=E();v=au.forceSimulation(H.nodes).force("x",au.forceX(l).strength(.1)).force("y",au.forceY(c).strength(.1)).force("collide",au.forceCollide(function(pe){return pe.r}).iterations(4)).force("charge",au.forceManyBody().strength(n)).force("links",au.forceLink(H.nodes.length?H.links:[]).distance(i).strength(a)),d=v.nodes(),M()}}function E(){var H=[],pe=[],Ae={},Le=[],qe={},at=[];return qe=w(s),at=_(f),Le=Object.keys(qe),Le.forEach(function(rt,xt){var Et=qe[rt];H.push({id:rt,size:Et.count,r:Math.sqrt(Et.sumforceNodeSize/Math.PI)}),Ae[rt]=xt}),at.forEach(function(rt){var xt=(0,ph.getEdgeTerminal)(rt,"source"),Et=(0,ph.getEdgeTerminal)(rt,"target"),ur=Ae[xt],Bt=Ae[Et];ur!==void 0&&Bt!==void 0&&pe.push({source:ur,target:Bt,count:rt.count})}),{nodes:H,links:pe}}function w(H){var pe={};return H.forEach(function(Ae){var Le=t(Ae);pe[Le]||(pe[Le]={count:0,sumforceNodeSize:0})}),H.forEach(function(Ae){var Le=t(Ae),qe=e(Ae),at=pe[Le];at.count=at.count+1,at.sumforceNodeSize=at.sumforceNodeSize+Math.PI*(qe*qe)*1.3,pe[Le]=at}),pe}function _(H){var pe={},Ae=[];H.forEach(function(qe){var at=C(qe),rt=0;pe[at]!==void 0&&(rt=pe[at]),rt+=1,pe[at]=rt});var Le=Object.entries(pe);return Le.forEach(function(qe){var at=qe[0],rt=qe[1],xt=at.split("~")[0],Et=at.split("~")[1];xt!==void 0&&Et!==void 0&&Ae.push({source:xt,target:Et,count:rt})}),Ae}function M(){return h={none:{x:0,y:0}},d.forEach(function(H){h[H.id]={x:H.x-o[0],y:H.y-o[1]}}),h}function C(H){var pe=(0,ph.getEdgeTerminal)(H,"source"),Ae=(0,ph.getEdgeTerminal)(H,"target"),Le=t(u[pe]),qe=t(u[Ae]);return Le<=qe?"".concat(Le,"~").concat(qe):"".concat(qe,"~").concat(Le)}function S(H){u={},H.forEach(function(pe){u[pe.id]=pe})}function A(H){return arguments.length?(p=H,b(),m):p}function T(H){return arguments.length?typeof H=="string"?(t=function(pe){return pe[H]},m):(t=H,m):t}function I(H){return arguments.length?(g=H,m):g}function D(H){return arguments.length?(y=H,m):y}function N(H){return arguments.length?(l=H,m):l}function P(H){return arguments.length?(c=H,m):c}function G(H){return arguments.length?(S(H||[]),s=H||[],m):s}function W(H){return arguments.length?(f=H||[],b(),m):f}function k(H){return arguments.length?(typeof H=="function"?e=H:e=r(+H),b(),m):e}function R(H){return arguments.length?(typeof H=="function"?n=H:n=r(+H),b(),m):n}function Y(H){return arguments.length?(typeof H=="function"?i=H:i=r(+H),b(),m):i}function J(H){return arguments.length?(typeof H=="function"?a=H:a=r(+H),b(),m):a}function te(H){return arguments.length?(o=H,m):o}return m.initialize=function(H){s=H,b()},m.template=A,m.groupBy=T,m.enableGrouping=I,m.strength=D,m.centerX=N,m.centerY=P,m.nodes=G,m.links=W,m.forceNodeSize=k,m.nodeSize=m.forceNodeSize,m.forceCharge=R,m.forceLinkDistance=Y,m.forceLinkStrength=J,m.offset=te,m.getFocis=M,m}d1.default=QY;var qa={};Object.defineProperty(qa,"__esModule",{value:!0});qa.FORCE_LAYOUT_TYPE_MAP=qa.LAYOUT_MESSAGE=void 0;qa.LAYOUT_MESSAGE={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};qa.FORCE_LAYOUT_TYPE_MAP={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0};var JY=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),eV=xe&&xe.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var i=Object.getOwnPropertyDescriptor(t,e);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,i)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),tV=xe&&xe.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),rV=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&eV(t,r,e);return tV(t,r),t},nV=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.ForceLayout=void 0;var ou=rV(h1),iV=nV(d1),is=Nr(),aV=Wr,oV=qa,sV=function(r){JY(t,r);function t(e){var n=r.call(this)||this;return n.center=[0,0],n.nodeStrength=null,n.edgeStrength=null,n.preventOverlap=!1,n.clusterNodeStrength=null,n.clusterEdgeStrength=null,n.clusterEdgeDistance=null,n.clusterNodeSize=null,n.clusterFociStrength=null,n.linkDistance=50,n.alphaDecay=.028,n.alphaMin=.001,n.alpha=.3,n.collideStrength=1,n.workerEnabled=!1,n.tick=function(){},n.onLayoutEnd=function(){},n.ticking=void 0,e&&n.updateCfg(e),n}return t.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}},t.prototype.init=function(e){var n=this;n.nodes=e.nodes||[];var i=e.edges||[];n.edges=i.map(function(a){var o={},s=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(a).forEach(function(u){s.indexOf(u)>-1||(o[u]=a[u])}),o}),n.ticking=!1},t.prototype.execute=function(e){var n=this,i=n.nodes,a=n.edges;if(!n.ticking){var o=n.forceSimulation,s=n.alphaMin,u=n.alphaDecay,f=n.alpha;if(o){if(e){if(n.clustering&&n.clusterForce&&(n.clusterForce.nodes(i),n.clusterForce.links(a)),o.nodes(i),a&&n.edgeForce)n.edgeForce.links(a);else if(a&&!n.edgeForce){var h=ou.forceLink().id(function(g){return g.id}).links(a);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}}n.preventOverlap&&n.overlapProcess(o),o.alpha(f).restart(),this.ticking=!0}else try{var l=ou.forceManyBody();if(n.nodeStrength&&l.strength(n.nodeStrength),o=ou.forceSimulation().nodes(i),n.clustering){var c=(0,iV.default)();c.centerX(n.center[0]).centerY(n.center[1]).template("force").strength(n.clusterFociStrength),a&&c.links(a),i&&c.nodes(i),c.forceLinkDistance(n.clusterEdgeDistance).forceLinkStrength(n.clusterEdgeStrength).forceCharge(n.clusterNodeStrength).forceNodeSize(n.clusterNodeSize),n.clusterForce=c,o.force("group",c)}if(o.force("center",ou.forceCenter(n.center[0],n.center[1])).force("charge",l).alpha(f).alphaDecay(u).alphaMin(s),n.preventOverlap&&n.overlapProcess(o),a){var h=ou.forceLink().id(function(p){return p.id}).links(a);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}if(n.workerEnabled&&!fV()&&(n.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!n.workerEnabled)o.on("tick",function(){n.tick()}).on("end",function(){n.ticking=!1,n.onLayoutEnd&&n.onLayoutEnd()}),n.ticking=!0;else{o.stop();for(var d=uV(o),v=1;v<=d;v++)o.tick(),postMessage({nodes:i,currentTick:v,totalTicks:d,type:oV.LAYOUT_MESSAGE.TICK},void 0);n.ticking=!1}n.forceSimulation=o,n.ticking=!0}catch(p){n.ticking=!1,console.warn(p)}}},t.prototype.overlapProcess=function(e){var n=this,i=n.nodeSize,a=n.nodeSpacing,o,s,u=n.collideStrength;if((0,is.isNumber)(a)?s=function(){return a}:(0,is.isFunction)(a)?s=a:s=function(){return 0},!i)o=function(h){if(h.size){if((0,is.isArray)(h.size)){var d=h.size[0]>h.size[1]?h.size[0]:h.size[1];return d/2+s(h)}if((0,is.isObject)(h.size)){var d=h.size.width>h.size.height?h.size.width:h.size.height;return d/2+s(h)}return h.size/2+s(h)}return 10+s(h)};else if((0,is.isFunction)(i))o=function(h){var d=i(h);return d+s(h)};else if((0,is.isArray)(i)){var f=i[0]>i[1]?i[0]:i[1],l=f/2;o=function(h){return l+s(h)}}else if((0,is.isNumber)(i)){var c=i/2;o=function(h){return c+s(h)}}else o=function(){return 10};e.force("collisionForce",ou.forceCollide(o).strength(u))},t.prototype.updateCfg=function(e){var n=this;n.ticking&&(n.forceSimulation.stop(),n.ticking=!1),n.forceSimulation=null,Object.assign(n,e)},t.prototype.destroy=function(){var e=this;e.ticking&&(e.forceSimulation.stop(),e.ticking=!1),e.nodes=null,e.edges=null,e.destroyed=!0},t}(aV.Base);Dv.ForceLayout=sV;function uV(r){var t=r.alphaMin(),e=r.alphaTarget(),n=r.alpha(),i=Math.log((t-e)/(n-e))/Math.log(1-r.alphaDecay()),a=Math.ceil(i);return a}function fV(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}(function(r){var t=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),e=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),e(Dv,r)})(c1);var Hl={},lV=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(Hl,"__esModule",{value:!0});Hl.CircularLayout=void 0;var cV=Wr,fa=Nr();function hV(r,t,e,n){r.forEach(function(i,a){r[a].children=[],r[a].parent=[]}),n?t.forEach(function(i){var a=(0,fa.getEdgeTerminal)(i,"source"),o=(0,fa.getEdgeTerminal)(i,"target"),s=0;a&&(s=e[a]);var u=0;o&&(u=e[o]);var f=r[s].children,l=r[u].parent;f.push(r[u].id),l.push(r[s].id)}):t.forEach(function(i){var a=(0,fa.getEdgeTerminal)(i,"source"),o=(0,fa.getEdgeTerminal)(i,"target"),s=0;a&&(s=e[a]);var u=0;o&&(u=e[o]);var f=r[s].children,l=r[u].children;f.push(r[u].id),l.push(r[s].id)})}function dV(r,t,e){for(var n=e.length,i=0;i<n;i++){var a=(0,fa.getEdgeTerminal)(e[i],"source"),o=(0,fa.getEdgeTerminal)(e[i],"target");if(r.id===a&&t.id===o||t.id===a&&r.id===o)return!0}return!1}function vV(r,t){var e=r.degree,n=t.degree;return e<n?-1:e>n?1:0}var pV=function(r){lV(t,r);function t(e){var n=r.call(this)||this;return n.radius=null,n.nodeSize=void 0,n.startRadius=null,n.endRadius=null,n.startAngle=0,n.endAngle=2*Math.PI,n.clockwise=!0,n.divisions=1,n.ordering=null,n.angleRatio=1,n.nodes=[],n.edges=[],n.nodeMap={},n.degrees=[],n.width=300,n.height=300,n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},t.prototype.execute=function(){var e,n=this,i=n.nodes,a=n.edges,o=i.length;if(o===0){n.onLayoutEnd&&n.onLayoutEnd();return}!n.width&&typeof window<"u"&&(n.width=window.innerWidth),!n.height&&typeof window<"u"&&(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var s=n.center;if(o===1){i[0].x=s[0],i[0].y=s[1],n.onLayoutEnd&&n.onLayoutEnd();return}var u=n.radius,f=n.startRadius,l=n.endRadius,c=n.divisions,h=n.startAngle,d=n.endAngle,v=n.angleRatio,p=n.ordering,g=n.clockwise,y=n.nodeSpacing,m=n.nodeSize,b=(d-h)/o,x={};i.forEach(function(P,G){x[P.id]=G}),n.nodeMap=x;var E=(0,fa.getDegree)(i.length,x,a);if(n.degrees=E,y){var w=(0,fa.getFuncByUnknownType)(10,y),_=(0,fa.getFuncByUnknownType)(10,m),M=-1/0;i.forEach(function(P){var G=_(P);M<G&&(M=G)});var C=0;i.forEach(function(P,G){G===0?C+=M||10:C+=(w(P)||0)+(M||10)}),u=C/(2*Math.PI)}else!u&&!f&&!l?u=n.height>n.width?n.width/2:n.height/2:!f&&l?f=l:f&&!l&&(l=f);var S=b*v,A=[];p==="topology"?A=n.topologyOrdering():p==="topology-directed"?A=n.topologyOrdering(!0):p==="degree"?A=n.degreeOrdering():A=i;for(var T=Math.ceil(o/c),I=0;I<o;++I){var D=u;!D&&f!==null&&l!==null&&(D=f+I*(l-f)/(o-1)),D||(D=10+I*100/(o-1));var N=h+I%T*S+2*Math.PI/c*Math.floor(I/T);g||(N=d-I%T*S-2*Math.PI/c*Math.floor(I/T)),A[I].x=s[0]+Math.cos(N)*D,A[I].y=s[1]+Math.sin(N)*D,A[I].weight=E[I].all}return(e=n.onLayoutEnd)===null||e===void 0||e.call(n),{nodes:A,edges:this.edges}},t.prototype.topologyOrdering=function(e){e===void 0&&(e=!1);var n=this,i=n.degrees,a=n.edges,o=n.nodes,s=(0,fa.clone)(o),u=n.nodeMap,f=[s[0]],l=[o[0]],c=[],h=o.length;c[0]=!0,hV(s,a,u,e);var d=0;return s.forEach(function(v,p){if(p!==0)if((p===h-1||i[p].all!==i[p+1].all||dV(f[d],v,a))&&!c[p])f.push(v),l.push(o[u[v.id]]),c[p]=!0,d++;else{for(var g=f[d].children,y=!1,m=0;m<g.length;m++){var b=u[g[m]];if(i[b].all===i[p].all&&!c[b]){f.push(s[b]),l.push(o[u[s[b].id]]),c[b]=!0,y=!0;break}}for(var x=0;!y&&(c[x]||(f.push(s[x]),l.push(o[u[s[x].id]]),c[x]=!0,y=!0),x++,x!==h););}}),l},t.prototype.degreeOrdering=function(){var e=this,n=e.nodes,i=[],a=e.degrees;return n.forEach(function(o,s){o.degree=a[s].all,i.push(o)}),i.sort(vV),i},t.prototype.getType=function(){return"circular"},t}(cV.Base);Hl.CircularLayout=pV;var Ju={},v1={},p1={},g1={},y1={},m1={};Object.defineProperty(m1,"__esModule",{value:!0});var gV=function(r,t){if(r!=="next"&&r!=="prev")return t},Y_=function(r){r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev},yV=function(){function r(){var t={};t.prev=t,t.next=t.prev,this.shortcut=t}return r.prototype.dequeue=function(){var t=this.shortcut,e=t.prev;if(e&&e!==t)return Y_(e),e},r.prototype.enqueue=function(t){var e=this.shortcut;t.prev&&t.next&&Y_(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e},r.prototype.toString=function(){for(var t=[],e=this.shortcut,n=e.prev;n!==e;)t.push(JSON.stringify(n,gV)),n=n==null?void 0:n.prev;return"[".concat(t.join(", "),"]")},r}();m1.default=yV;var Au;(function(r){r.DEFAULT_EDGE_NAME="\0",r.GRAPH_NODE="\0",r.EDGE_KEY_DELIM=""})(Au||(Au={}));function V_(r,t){var e=r.get(t)||0;r.set(t,e+1)}function H_(r,t){var e=r.get(t);e!==void 0&&(e=e-1,e>0?r.set(t,e):r.delete(t))}function JO(r,t,e,n){var i=String(t),a=String(e);if(!r&&i>a){var o=i;i=a,a=o}return i+Au.EDGE_KEY_DELIM+a+Au.EDGE_KEY_DELIM+(n===void 0?Au.DEFAULT_EDGE_NAME:n)}function K_(r,t,e,n){var i=String(t),a=String(e),o={v:t,w:e};if(!r&&i>a){var s=o.v;o.v=o.w,o.w=s}return n!==void 0&&(o.name=n),o}function $g(r,t){return JO(r,t.v,t.w,t.name)}function q_(r){return typeof r=="function"}var mV=function(t){return t.nodes().map(function(e){var n=t.node(e),i=t.parent(e),a={id:e,value:n,parent:i};return a.value===void 0&&delete a.value,a.parent===void 0&&delete a.parent,a})},bV=function(t){return t.edges().map(function(e){var n=t.edge(e),i={v:e.v,w:e.w,value:n,name:e.name};return i.name===void 0&&delete i.name,i.value===void 0&&delete i.value,i})},xV=function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:mV(t),edges:bV(t),value:t.graph()};return e.value===void 0&&delete e.value,e},EV=function(t){var e=new Ns(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(function(n){e.setNode(n.id,n.value),n.parent&&e.setParent(n.id,n.parent)}),t.edges.forEach(function(n){e.setEdge(n.v,n.w,n.value,n.name)}),e};function Z_(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),e.push.apply(e,n)}return e}function Q_(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Z_(Object(e),!0).forEach(function(n){wV(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):Z_(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function wV(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function _V(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function J_(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function SV(r,t,e){return t&&J_(r.prototype,t),e&&J_(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}var MV={compound:!1,multigraph:!1,directed:!0},Ns=function(){function r(){var t=this,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_V(this,r),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=Au.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 t.directed},this.isMultigraph=function(){return t.multigraph},this.isCompound=function(){return t.compound},this.setGraph=function(i){return t.label=i,t},this.graph=function(){return t.label},this.setDefaultNodeLabel=function(i){return q_(i)?t.defaultNodeLabelFn=i:t.defaultNodeLabelFn=function(){return i},t},this.nodeCount=function(){return t.nodeCountNum},this.node=function(i){return t.nodesLabelMap.get(i)},this.nodes=function(){return Array.from(t.nodesLabelMap.keys())},this.sources=function(){return t.nodes().filter(function(i){var a;return!(!((a=t.inEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.sinks=function(){return t.nodes().filter(function(i){var a;return!(!((a=t.outEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.setNodes=function(i,a){return i.map(function(o){return t.setNode(o,a)}),t},this.hasNode=function(i){return t.nodesLabelMap.has(i)},this.checkCompound=function(){if(!t.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(i){if(t.isCompound()){var a,o=(a=t.parentMap)===null||a===void 0?void 0:a.get(i);if(o!==t.GRAPH_NODE)return o}},this.removeFromParentsChildList=function(i){var a=t.parentMap.get(i);t.childrenMap.get(a).delete(i)},this.setParent=function(i,a){var o,s;t.checkCompound();for(var u=a===void 0?t.GRAPH_NODE:a,f=t.parent(u);f;){if(i===f)throw new Error("Setting "+a+" as parent of "+i+" would create a cycle");f=t.parent(f)}a&&t.setNode(a),t.setNode(i),t.removeFromParentsChildList(i),(o=t.parentMap)===null||o===void 0||o.set(i,u);var l=t.childrenMap.get(u);return l.set(i,!0),(s=t.childrenMap)===null||s===void 0||s.set(u,l),t},this.children=function(i){var a=i===void 0?t.GRAPH_NODE:i;if(t.isCompound()){var o,s=(o=t.childrenMap)===null||o===void 0?void 0:o.get(a);return s?Array.from(s.keys()):void 0}if(a===t.GRAPH_NODE)return t.nodes();if(i&&t.hasNode(i))return[]},this.predecessors=function(i){var a=t.predecessorsMap.get(i);return a?Array.from(a.keys()):void 0},this.successors=function(i){var a=t.successorsMap.get(i);return a?Array.from(a.keys()):void 0},this.neighbors=function(i){var a;if(t.hasNode(i))return Array.from(new Set((a=t.predecessors(i))===null||a===void 0?void 0:a.concat(t.successors(i))))},this.isLeaf=function(i){var a;if(t.isDirected()){var o;return!(!((o=t.successors(i))===null||o===void 0)&&o.length)}return!(!((a=t.neighbors(i))===null||a===void 0)&&a.length)},this.filterNodes=function(i){var a=t.directed,o=t.multigraph,s=t.compound,u=new r({directed:a,multigraph:o,compound:s});if(u.setGraph(t.graph()),t.nodes().forEach(function(l){i(l)&&u.setNode(l,t.node(l))}),t.edges().forEach(function(l){u.hasNode(l.v)&&u.hasNode(l.w)&&u.setEdgeObj(l,t.edge(l))}),s){var f=function(c){for(var h=t.parent(c);h!==void 0&&!u.hasNode(h);)h=t.parent(h);return h};u.nodes().forEach(function(l){u.setParent(l,f(l))})}return u},this.setDefaultEdgeLabel=function(i){return q_(i)?t.defaultEdgeLabelFn=i:t.defaultEdgeLabelFn=function(){return i},t},this.edgeCount=function(){return t.edgeCountNum},this.setEdgeObj=function(i,a){return t.setEdge(i.v,i.w,a,i.name)},this.setPath=function(i,a){return i.reduce(function(o,s){return t.setEdge(o,s,a),s}),t},this.edgeFromArgs=function(i,a,o){return t.edge({v:i,w:a,name:o})},this.edge=function(i){return t.edgesLabelsMap.get($g(t.isDirected(),i))},this.hasEdge=function(i,a,o){return t.edgesLabelsMap.has($g(t.isDirected(),{v:i,w:a,name:o}))},this.removeEdgeObj=function(i){var a=i.v,o=i.w,s=i.name;return t.removeEdge(a,o,s)},this.edges=function(){return Array.from(t.edgesMap.values())},this.inEdges=function(i,a){var o=t.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=t.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(t.hasNode(i))return(o=t.inEdges(i,a))===null||o===void 0?void 0:o.concat(t.outEdges(i,a))},this.toJSON=function(){return xV(t)},this.nodeInDegree=function(i){var a=t.inEdgesMap.get(i);return a?a.size:0},this.nodeOutDegree=function(i){var a=t.outEdgesMap.get(i);return a?a.size:0},this.nodeDegree=function(i){return t.nodeInDegree(i)+t.nodeOutDegree(i)},this.source=function(i){return i.v},this.target=function(i){return i.w};var n=Q_(Q_({},MV),e);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return SV(r,[{key:"setNode",value:function(e,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(e))return n!==void 0&&i.set(e,n),this;if(i.set(e,n||a(e)),o()){var d;s==null||s.set(e,this.GRAPH_NODE),u==null||u.set(e,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(e,!0)}return[f,l,c,h].forEach(function(v){return v.set(e,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(e){var n=this;if(this.hasNode(e)){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(e),(l=this.parentMap)===null||l===void 0||l.delete(e),(c=this.children(e))===null||c===void 0||c.forEach(function(p){return n.setParent(p)}),(h=this.childrenMap)===null||h===void 0||h.delete(e)}var d=a.get(e),v=o.get(e);Array.from(d.values()).forEach(function(p){return i(p)}),Array.from(v.values()).forEach(function(p){return i(p)}),f.delete(e),a.delete(e),o.delete(e),s.delete(e),u.delete(e),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(e,n,i,a){var o,s,u=K_(this.isDirected(),e,n,a),f=$g(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 V_(h,l),V_(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(e,n,i){var a=JO(this.isDirected(),e,n,i),o=this.edgesMap.get(a);if(o){var s=K_(this.isDirected(),e,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);H_(l,u),H_(c,f),this.inEdgesMap.get(f).delete(a),this.outEdgesMap.get(u).delete(a),this.edgeCountNum-=1}return this}}]),r}();Ns.fromJSON=EV;function wy(r){"@babel/helpers - typeof";return wy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wy(r)}function CV(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function e2(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function AV(r,t,e){return t&&e2(r.prototype,t),e&&e2(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function ys(){return typeof Reflect<"u"&&Reflect.get?ys=Reflect.get:ys=function(t,e,n){var i=TV(t,e);if(i){var a=Object.getOwnPropertyDescriptor(i,e);return a.get?a.get.call(arguments.length<3?t:n):a.value}},ys.apply(this,arguments)}function TV(r,t){for(;!Object.prototype.hasOwnProperty.call(r,t)&&(r=Wa(r),r!==null););return r}function IV(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&_y(r,t)}function _y(r,t){return _y=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},_y(r,t)}function OV(r){var t=kV();return function(){var n=Wa(r),i;if(t){var a=Wa(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return LV(this,i)}}function LV(r,t){if(t&&(wy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return DV(r)}function DV(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function kV(){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 Wa(r){return Wa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Wa(r)}var PV=function(r){IV(e,r);var t=OV(e);function e(){var n;CV(this,e);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=t.call.apply(t,[this].concat(a)),n.eventPool={},n}return AV(e,[{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 ys(Wa(e.prototype),"setNode",this).call(this,i,a),this.emitEvent("nodeAdd",i,a),this}},{key:"removeNode",value:function(i){return ys(Wa(e.prototype),"removeNode",this).call(this,i),this.emitEvent("nodeRemove",i),this}},{key:"setEdge",value:function(i,a,o,s){return ys(Wa(e.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 ys(Wa(e.prototype),"removeEdge",this).call(this,i,a,o),this.emitEvent("edgeRemove",i,a,o),this}}]),e}(Ns);function t2(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function NV(r,t,e){return t&&t2(r.prototype,t),e&&t2(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function RV(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var eL=NV(function r(){var t=this;RV(this,r),this.arr=[],this.keyIndice=new Map,this.size=function(){return t.arr.length},this.keys=function(){return t.arr.map(function(e){return e.key})},this.has=function(e){return t.keyIndice.has(e)},this.priority=function(e){var n=t.keyIndice.get(e);if(n!==void 0)return t.arr[n].priority},this.swap=function(e,n){var i=t.arr,a=t.keyIndice,o=[i[e],i[n]],s=o[0],u=o[1];i[e]=u,i[n]=s,a.set(s.key,n),a.set(u.key,e)},this.innerDecrease=function(e){for(var n=t.arr,i=n[e].priority,a,o=e;o!==0;){var s;if(a=o>>1,((s=n[a])===null||s===void 0?void 0:s.priority)<i)break;t.swap(o,a),o=a}},this.heapify=function(e){var n=t.arr,i=e<<1,a=i+1,o=e;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!==e&&(t.swap(e,o),t.heapify(o)))},this.min=function(){if(t.size()===0)throw new Error("Queue underflow");return t.arr[0].key},this.add=function(e,n){var i=t.keyIndice,a=t.arr;if(!i.has(e)){var o=a.length;return i.set(e,o),a.push({key:e,priority:n}),t.innerDecrease(o),!0}return!1},this.removeMin=function(){t.swap(0,t.arr.length-1);var e=t.arr.pop();return t.keyIndice.delete(e.key),t.heapify(0),e.key},this.decrease=function(e,n){if(!t.has(e))throw new Error("There's no key named ".concat(e));var i=t.keyIndice.get(e);if(n>t.arr[i].priority)throw new Error("New priority is greater than current priority.Key: ".concat(e," Old: + ").concat(t.arr[i].priority," New: ").concat(n));t.arr[i].priority=n,t.innerDecrease(i)}}),BV=function(t,e){var n=new Ns,i=new Map,a=new eL,o;function s(l){var c=l.v===o?l.w:l.v,h=a.priority(c);if(h!==void 0){var d=e(l);d<h&&(i.set(c,o),a.decrease(c,d))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(l){a.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),a.decrease(t.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: "+t.graph());u=!0}(f=t.nodeEdges(o))===null||f===void 0||f.forEach(s)}return n},FV=function(t){var e=new Set,n=[],i=t.nodes();return i.forEach(function(a){for(var o=[],s=[a];s.length>0;){var u=s.pop();if(!e.has(u)){var f,l;e.add(u),o.push(u),(f=t.successors(u))===null||f===void 0||f.forEach(function(c){return s.push(c)}),(l=t.predecessors(u))===null||l===void 0||l.forEach(function(c){return s.push(c)})}}o.length&&n.push(o)}),n},GV=function r(t,e,n,i,a,o){i.includes(e)||(i.push(e),n||o.push(e),a(e).forEach(function(s){return r(t,s,n,i,a,o)}),n&&o.push(e))},b1=function(t,e,n){var i=Array.isArray(e)?e:[e],a=function(f){return t.isDirected()?t.successors(f):t.neighbors(f)},o=[],s=[];return i.forEach(function(u){if(t.hasNode(u))GV(t,u,n==="post",s,a,o);else throw new Error("Graph does not have node: "+u)}),o};function zV(r,t){return WV(r)||$V(r,t)||UV(r,t)||jV()}function jV(){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 UV(r,t){if(r){if(typeof r=="string")return r2(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return r2(r,t)}}function r2(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function $V(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var n=[],i=!0,a=!1,o,s;try{for(e=e.call(r);!(i=(o=e.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(u){a=!0,s=u}finally{try{!i&&e.return!=null&&e.return()}finally{if(a)throw s}}return n}}function WV(r){if(Array.isArray(r))return r}var XV=function(){return 1},tL=function(t,e,n,i){return YV(t,e,n||XV,i||function(a){return t.outEdges(a)})},YV=function(t,e,n,i){var a=new Map,o=new eL,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(t.nodes().forEach(function(c){var h=c===e?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=zV(c,2),d=h[0],v=h[1];return l[String(d)]=v,l}),l},VV=function(t,e,n){var i={};return t.nodes().forEach(function(a){return i[String(a)]=tL(t,a,e,n),i}),i},rL=function(t){var e=0,n=[],i=new Map,a=[];function o(s){var u,f={onStack:!0,lowlink:e,index:e};if(i.set(s,f),e+=1,n.push(s),(u=t.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 t.nodes().forEach(function(s){i.has(s)||o(s)}),a},HV=function(t){return rL(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})};function Sy(r){"@babel/helpers - typeof";return Sy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sy(r)}function n2(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function KV(r,t,e){return t&&n2(r.prototype,t),e&&n2(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function qV(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function ZV(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&Ml(r,t)}function QV(r){var t=nL();return function(){var n=Cl(r),i;if(t){var a=Cl(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return JV(this,i)}}function JV(r,t){if(t&&(Sy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eH(r)}function eH(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function My(r){var t=typeof Map=="function"?new Map:void 0;return My=function(n){if(n===null||!tH(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return Zh(n,arguments,Cl(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ml(i,n)},My(r)}function Zh(r,t,e){return nL()?Zh=Reflect.construct:Zh=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),f=new u;return o&&Ml(f,o.prototype),f},Zh.apply(null,arguments)}function nL(){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 tH(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function Ml(r,t){return Ml=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ml(r,t)}function Cl(r){return Cl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Cl(r)}var Cy=function(r){ZV(e,r);var t=QV(e);function e(){return qV(this,e),t.apply(this,arguments)}return KV(e)}(My(Error));function iL(r){var t=new Set,e=new Set,n=[];function i(a){if(e.has(a))throw new Cy;if(!t.has(a)){var o;e.add(a),t.add(a),(o=r.predecessors(a))===null||o===void 0||o.forEach(i),e.delete(a),n.push(a)}}if(r.sinks().forEach(i),t.size!==r.nodeCount())throw new Cy;return n}var rH=function(t){try{iL(t)}catch(e){if(e instanceof Cy)return!1;throw e}return!0},nH=function(t,e){return b1(t,e,"post")},iH=function(t,e){return b1(t,e,"pre")},aH=function(){return 1};function oH(r,t,e){return sH(r,t||aH,e||function(n){return r.outEdges(n)})}function sH(r,t,e){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})}),e(a).forEach(function(s){var u=s.v===a?s.w:s.v,f=t(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 uH=Object.freeze(Object.defineProperty({__proto__:null,components:FV,dfs:b1,dijkstra:tL,dijkstraAll:VV,findCycles:HV,floydWarshall:oH,isAcyclic:rH,postorder:nH,preorder:iH,prim:BV,tarjan:rL,topsort:iL},Symbol.toStringTag,{value:"Module"}));var fH=function(t,e){for(var n=t.nodes(),i=0;i<n.length;i++){var a=n[i];if(e.hasNode(a))return!0}return!1},aL=function(t,e){for(var n=t.edges(),i=0;i<n.length;i++){var a=n[i];if(e.hasEdge(a.v,a.w,a.name))return!0}return!1},oL=function(t,e){var n=t.nodes(),i=n.filter(function(a){return e.hasNode(a)});return i},sL=function(t,e){var n=t.edges(),i=n.filter(function(a){return e.hasEdge(a.v,a.w,a.name)});return i},uL=function(t,e){return t.isCompound()===e.isCompound()&&t.isDirected()===e.isDirected()&&t.isMultigraph()===e.isMultigraph()},Pv=function(t,e){var n=oL(t,e);return n.length===t.nodes().length},x1=function(t,e){var n=sL(t,e);return n.length===t.edges().length},lH=function(t,e){return uL(t,e)&&t.nodeCount()===e.nodeCount()&&Pv(t,e)&&t.edgeCount()===e.edgeCount()&&x1(t,e)},cH=function(t,e){return Pv(t,e)&&x1(t,e)};function hH(r,t){return gH(r)||pH(r,t)||vH(r,t)||dH()}function dH(){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 vH(r,t){if(r){if(typeof r=="string")return i2(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i2(r,t)}}function i2(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function pH(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var n=[],i=!0,a=!1,o,s;try{for(e=e.call(r);!(i=(o=e.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(u){a=!0,s=u}finally{try{!i&&e.return!=null&&e.return()}finally{if(a)throw s}}return n}}function gH(r){if(Array.isArray(r))return r}function yH(r){return r instanceof Ns}function Pd(r){if(r.isMultigraph())return!1;for(var t=r.edges(),e=new Map,n=0;n<t.length;n++){var i=t[n];if(i.v===i.w)return!1;var a=[i.v,i.w].sort(),o=hH(a,2),s=o[0],u=o[1],f="".concat(s,"-").concat(u);if(e.has(f))return!1;e.set(f,!0)}return!0}function mH(r){return r.nodes().length===0}function bH(r){for(var t=r.edges(),e=0;e<t.length;e++){var n=t[e];if(n.v===n.w)return!0}return!1}const xH=Object.freeze(Object.defineProperty({__proto__:null,hasSelfLoop:bH,isGraph:yH,isNullGraph:mH,isSimpleGraph:Pd},Symbol.toStringTag,{value:"Module"}));var EH=function(t,e){if(!Pd(t)||!Pd(e)||!Pv(t,e)||aL(t,e))return!1;var n=t.nodeCount();return t.edgeCount()+e.edgeCount()===n*(n-1)/2};const wH=Object.freeze(Object.defineProperty({__proto__:null,containAllSameEdges:x1,containAllSameNodes:Pv,containSameEdges:aL,containSameNodes:fH,getSameEdges:sL,getSameNodes:oL,isGraphComplement:EH,isGraphContainsAnother:cH,isGraphOptionSame:uL,isGraphSame:lH},Symbol.toStringTag,{value:"Module"}));var _H=function(t){if(!Pd(t))return null;for(var e=t.nodeCount(),n=new Ns({compound:t.isCompound(),directed:t.isDirected(),multigraph:t.isMultigraph()}),i=t.nodes(),a=0;a<e;a++){var o=i[a];n.setNode(o,t.node(o));for(var s=a+1;s<e;s++){var u=i[s];t.hasEdge(o,u)||n.setEdge(o,u)}}return n};const SH=Object.freeze(Object.defineProperty({__proto__:null,getGraphComplement:_H},Symbol.toStringTag,{value:"Module"})),MH=Object.freeze(Object.defineProperty({__proto__:null,Graph:Ns,GraphWithEvent:PV,algorithm:uH,comparision:wH,essence:xH,generate:SH},Symbol.toStringTag,{value:"Module"})),Nv=ma(MH);var fL=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),CH=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(y1,"__esModule",{value:!0});var AH=CH(m1),TH=Nv,IH=function(r){fL(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(AH.default),OH=function(r){fL(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(TH.Graph),LH=function(){return 1},DH=function(r,t){var e;if(r.nodeCount()<=1)return[];var n=PH(r,t||LH),i=kH(n.graph,n.buckets,n.zeroIdx);return(e=i.map(function(a){return r.outEdges(a.v,a.w)}))===null||e===void 0?void 0:e.flat()},kH=function(r,t,e){for(var n=[],i=t[t.length-1],a=t[0],o;r.nodeCount();){for(;o=a.dequeue();)Wg(r,t,e,o);for(;o=i.dequeue();)Wg(r,t,e,o);if(r.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){n=n.concat(Wg(r,t,e,o,!0));break}}}return n},Wg=function(r,t,e,n,i){var a,o,s=[];return(a=r.inEdges(n.v))===null||a===void 0||a.forEach(function(u){var f=r.edge(u),l=r.node(u.v);i&&s.push({v:u.v,w:u.w,in:0,out:0}),l.out===void 0&&(l.out=0),l.out-=f,Ay(t,e,l)}),(o=r.outEdges(n.v))===null||o===void 0||o.forEach(function(u){var f=r.edge(u),l=u.w,c=r.node(l);c.in===void 0&&(c.in=0),c.in-=f,Ay(t,e,c)}),r.removeNode(n.v),i?s:void 0},PH=function(r,t){var e=new OH,n=0,i=0;r.nodes().forEach(function(f){e.setNode(f,{v:f,in:0,out:0})}),r.edges().forEach(function(f){var l=e.edge(f)||0,c=(t==null?void 0:t(f))||1,h=l+c;e.setEdge(f.v,f.w,h),i=Math.max(i,e.node(f.v).out+=c),n=Math.max(n,e.node(f.w).in+=c)});for(var a=[],o=i+n+3,s=0;s<o;s++)a.push(new IH);var u=n+1;return e.nodes().forEach(function(f){Ay(a,u,e.node(f))}),{buckets:a,zeroIdx:u,graph:e}},Ay=function(r,t,e){e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)};y1.default=DH;var NH=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(g1,"__esModule",{value:!0});var RH=NH(y1),BH=function(r){var t=function(n){return function(i){var a;return((a=n.edge(i))===null||a===void 0?void 0:a.weight)||1}},e=r.graph().acyclicer==="greedy"?(0,RH.default)(r,t(r)):FH(r);e==null||e.forEach(function(n){var i=r.edge(n);r.removeEdgeObj(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,"rev-".concat(Math.random()))})},FH=function(r){var t=[],e={},n={},i=function(a){var o;n[a]||(n[a]=!0,e[a]=!0,(o=r.outEdges(a))===null||o===void 0||o.forEach(function(s){e[s.w]?t.push(s):i(s.w)}),delete e[a])};return r.nodes().forEach(i),t},GH=function(r){r.edges().forEach(function(t){var e=r.edge(t);if(e.reversed){r.removeEdgeObj(t);var n=e.forwardName;delete e.reversed,delete e.forwardName,r.setEdge(t.w,t.v,e,n)}})};g1.default={run:BH,undo:GH};var E1={},ii={},Qa={},zH=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(Qa,"__esModule",{value:!0});Qa.Graph=void 0;var jH=Nv,UH=function(r){zH(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(jH.Graph);Qa.Graph=UH;(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 t=Nr(),e=Qa,n=function(x,E){return Number(x)-Number(E)},i=function(x,E,w,_){var M;do M="".concat(_).concat(Math.random());while(x.hasNode(M));return w.dummy=E,x.setNode(M,w),M};r.addDummyNode=i;var a=function(x){var E=new e.Graph().setGraph(x.graph());return x.nodes().forEach(function(w){E.setNode(w,x.node(w))}),x.edges().forEach(function(w){var _=E.edgeFromArgs(w.v,w.w)||{weight:0,minlen:1},M=x.edge(w);E.setEdge(w.v,w.w,{weight:_.weight+M.weight,minlen:Math.max(_.minlen,M.minlen)})}),E};r.simplify=a;var o=function(x){var E=new e.Graph({multigraph:x.isMultigraph()}).setGraph(x.graph());return x.nodes().forEach(function(w){var _;!((_=x.children(w))===null||_===void 0)&&_.length||E.setNode(w,x.node(w))}),x.edges().forEach(function(w){E.setEdgeObj(w,x.edge(w))}),E};r.asNonCompoundGraph=o;var s=function(x,E){return x==null?void 0:x.reduce(function(w,_,M){return w[_]=E[M],w},{})};r.zipObject=s;var u=function(x){var E={};return x.nodes().forEach(function(w){var _,M={};(_=x.outEdges(w))===null||_===void 0||_.forEach(function(C){var S;M[C.w]=(M[C.w]||0)+(((S=x.edge(C))===null||S===void 0?void 0:S.weight)||0)}),E[w]=M}),E};r.successorWeights=u;var f=function(x){var E=x.nodes(),w=E.map(function(_){var M,C={};return(M=x.inEdges(_))===null||M===void 0||M.forEach(function(S){C[S.v]=(C[S.v]||0)+x.edge(S).weight}),C});return(0,r.zipObject)(E,w)};r.predecessorWeights=f;var l=function(x,E){var w=Number(x.x),_=Number(x.y),M=Number(E.x)-w,C=Number(E.y)-_,S=Number(x.width)/2,A=Number(x.height)/2;if(!M&&!C)return{x:0,y:0};var T,I;return Math.abs(C)*S>Math.abs(M)*A?(C<0&&(A=-A),T=A*M/C,I=A):(M<0&&(S=-S),T=S,I=S*C/M),{x:w+T,y:_+I}};r.intersectRect=l;var c=function(x){for(var E=[],w=(0,r.maxRank)(x)+1,_=0;_<w;_++)E.push([]);x.nodes().forEach(function(M){var C=x.node(M);if(C){var S=C.rank;S!==void 0&&E[S]&&E[S].push(M)}});for(var _=0;_<w;_++)E[_]=E[_].sort(function(C,S){var A,T;return n((A=x.node(C))===null||A===void 0?void 0:A.order,(T=x.node(S))===null||T===void 0?void 0:T.order)});return E};r.buildLayerMatrix=c;var h=function(x){var E=x.nodes().filter(function(_){var M;return((M=x.node(_))===null||M===void 0?void 0:M.rank)!==void 0}).map(function(_){return x.node(_).rank}),w=Math.min.apply(Math,E);x.nodes().forEach(function(_){var M=x.node(_);M.hasOwnProperty("rank")&&w!==1/0&&(M.rank-=w)})};r.normalizeRanks=h;var d=function(x){var E=x.nodes(),w=E.filter(function(I){var D;return((D=x.node(I))===null||D===void 0?void 0:D.rank)!==void 0}).map(function(I){return x.node(I).rank}),_=Math.min.apply(Math,w),M=[];E.forEach(function(I){var D,N=(((D=x.node(I))===null||D===void 0?void 0:D.rank)||0)-_;M[N]||(M[N]=[]),M[N].push(I)});for(var C=0,S=x.graph().nodeRankFactor||0,A=0;A<M.length;A++){var T=M[A];T===void 0?A%S!==0&&(C-=1):C&&(T==null||T.forEach(function(I){var D=x.node(I);D&&(D.rank=D.rank||0,D.rank+=C)}))}};r.removeEmptyRanks=d;var v=function(x,E,w,_){var M={width:0,height:0};return(0,t.isNumber)(w)&&(0,t.isNumber)(_)&&(M.rank=w,M.order=_),(0,r.addDummyNode)(x,"border",M,E)};r.addBorderNode=v;var p=function(x){var E;return x.nodes().forEach(function(w){var _,M=(_=x.node(w))===null||_===void 0?void 0:_.rank;M!==void 0&&(E===void 0||M>E)&&(E=M)}),E||(E=0),E};r.maxRank=p;var g=function(x,E){var w={lhs:[],rhs:[]};return x==null||x.forEach(function(_){E(_)?w.lhs.push(_):w.rhs.push(_)}),w};r.partition=g;var y=function(x,E){var w=Date.now();try{return E()}finally{console.log("".concat(x," time: ").concat(Date.now()-w,"ms"))}};r.time=y;var m=function(x,E){return E()};r.notime=m;var b=function(x,E){return x.reduce(function(w,_){var M=E(w),C=E(_);return M>C?_:w})};r.minBy=b})(ii);Object.defineProperty(E1,"__esModule",{value:!0});var $H=ii,WH=function(r){r.graph().dummyChains=[],r.edges().forEach(function(t){return XH(r,t)})},XH=function(r,t){var e=t.v,n=r.node(e).rank,i=t.w,a=r.node(i).rank,o=t.name,s=r.edge(t),u=s.labelRank;if(a!==n+1){r.removeEdgeObj(t);var f=r.graph(),l,c,h;for(h=0,++n;n<a;++h,++n)s.points=[],c={edgeLabel:s,width:0,height:0,edgeObj:t,rank:n},l=(0,$H.addDummyNode)(r,"edge",c,"_d"),n===u&&(c.width=s.width,c.height=s.height,c.dummy="edge-label",c.labelpos=s.labelpos),r.setEdge(e,l,{weight:s.weight},o),h===0&&(f.dummyChains||(f.dummyChains=[]),f.dummyChains.push(l)),e=l;r.setEdge(e,i,{weight:s.weight},o)}},YH=function(r){var t;(t=r.graph().dummyChains)===null||t===void 0||t.forEach(function(e){var n=r.node(e),i=n.edgeLabel,a;n.edgeObj&&r.setEdgeObj(n.edgeObj,i);for(var o=e;n.dummy;)a=r.successors(o)[0],r.removeNode(o),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),o=a,n=r.node(o)})};E1.default={run:WH,undo:YH};var w1={},Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.slack=Pi.longestPathWithLayer=Pi.longestPath=void 0;var lL=function(r){var t,e={},n=function(i){var a,o=r.node(i);if(!o)return 0;if(e[i])return o.rank;e[i]=!0;var s;return(a=r.outEdges(i))===null||a===void 0||a.forEach(function(u){var f=n(u.w),l=r.edge(u).minlen,c=f-l;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),o.rank=s,s};(t=r.sources())===null||t===void 0||t.forEach(function(i){return n(i)})};Pi.longestPath=lL;var cL=function(r){var t,e={},n,i=function(s){var u,f=r.node(s);if(!f)return 0;if(e[s])return f.rank;e[s]=!0;var l;return(u=r.outEdges(s))===null||u===void 0||u.forEach(function(c){var h=i(c.w),d=r.edge(c).minlen,v=h-d;v&&(l===void 0||v<l)&&(l=v)}),l||(l=0),(n===void 0||l<n)&&(n=l),f.rank=l,l};(t=r.sources())===null||t===void 0||t.forEach(function(s){r.node(s)&&i(s)}),n===void 0&&(n=0);var a={},o=function(s,u){var f,l=r.node(s),c=isNaN(l.layer)?u:l.layer;(l.rank===void 0||l.rank<c)&&(l.rank=c),!a[s]&&(a[s]=!0,(f=r.outEdges(s))===null||f===void 0||f.map(function(h){o(h.w,c+r.edge(h).minlen)}))};r.nodes().forEach(function(s){var u=r.node(s);u&&(isNaN(u.layer)?u.rank-=n:o(s,u.layer))})};Pi.longestPathWithLayer=cL;var hL=function(r,t){return r.node(t.w).rank-r.node(t.v).rank-r.edge(t).minlen};Pi.slack=hL;Pi.default={longestPath:lL,longestPathWithLayer:cL,slack:hL};var No={};Object.defineProperty(No,"__esModule",{value:!0});No.feasibleTreeWithLayer=No.feasibleTree=void 0;var Is=Pi,VH=ii,dL=Qa,vL=function(r){var t=new dL.Graph({directed:!1}),e=r.nodes()[0],n=r.nodeCount();t.setNode(e,{});for(var i,a;HH(t,r)<n;)i=gL(t,r),a=t.hasNode(i.v)?(0,Is.slack)(r,i):-(0,Is.slack)(r,i),yL(t,r,a);return t};No.feasibleTree=vL;var HH=function(r,t){var e=function(n){t.nodeEdges(n).forEach(function(i){var a=i.v,o=n===a?i.w:a;!r.hasNode(o)&&!(0,Is.slack)(t,i)&&(r.setNode(o,{}),r.setEdge(n,o,{}),e(o))})};return r.nodes().forEach(e),r.nodeCount()},pL=function(r){var t=new dL.Graph({directed:!1}),e=r.nodes()[0],n=r.nodes().filter(function(o){return!!r.node(o)}).length;t.setNode(e,{});for(var i,a;KH(t,r)<n;)i=gL(t,r),a=t.hasNode(i.v)?(0,Is.slack)(r,i):-(0,Is.slack)(r,i),yL(t,r,a);return t};No.feasibleTreeWithLayer=pL;var KH=function(r,t){var e=function(n){var i;(i=t.nodeEdges(n))===null||i===void 0||i.forEach(function(a){var o=a.v,s=n===o?a.w:o;!r.hasNode(s)&&(t.node(s).layer!==void 0||!(0,Is.slack)(t,a))&&(r.setNode(s,{}),r.setEdge(n,s,{}),e(s))})};return r.nodes().forEach(e),r.nodeCount()},gL=function(r,t){return(0,VH.minBy)(t.edges(),function(e){return r.hasNode(e.v)!==r.hasNode(e.w)?(0,Is.slack)(t,e):1/0})},yL=function(r,t,e){r.nodes().forEach(function(n){t.node(n).rank||(t.node(n).rank=0),t.node(n).rank+=e})};No.default={feasibleTree:vL,feasibleTreeWithLayer:pL};var mL={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.exchangeEdges=r.enterEdge=r.leaveEdge=r.initLowLimValues=r.calcCutValue=r.initCutValues=void 0;var t=No,e=Pi,n=ii,i=Nv,a=i.algorithm.preorder,o=i.algorithm.postorder,s=function(b){var x=(0,n.simplify)(b);(0,e.longestPath)(x);var E=(0,t.feasibleTree)(x);(0,r.initLowLimValues)(E),(0,r.initCutValues)(E,x);for(var w,_;w=(0,r.leaveEdge)(E);)_=(0,r.enterEdge)(E,x,w),(0,r.exchangeEdges)(E,x,w,_)},u=function(b,x){var E=o(b,b.nodes());E=E==null?void 0:E.slice(0,(E==null?void 0:E.length)-1),E==null||E.forEach(function(w){f(b,x,w)})};r.initCutValues=u;var f=function(b,x,E){var w=b.node(E),_=w.parent;b.edgeFromArgs(E,_).cutvalue=(0,r.calcCutValue)(b,x,E)},l=function(b,x,E){var w,_=b.node(E),M=_.parent,C=!0,S=x.edgeFromArgs(E,M),A=0;return S||(C=!1,S=x.edgeFromArgs(M,E)),A=S.weight,(w=x.nodeEdges(E))===null||w===void 0||w.forEach(function(T){var I=T.v===E,D=I?T.w:T.v;if(D!==M){var N=I===C,P=x.edge(T).weight;if(A+=N?P:-P,y(b,E,D)){var G=b.edgeFromArgs(E,D).cutvalue;A+=N?-G:G}}}),A};r.calcCutValue=l;var c=function(b,x){x===void 0&&(x=b.nodes()[0]),h(b,{},1,x)};r.initLowLimValues=c;var h=function(b,x,E,w,_){var M,C=E,S=E,A=b.node(w);return x[w]=!0,(M=b.neighbors(w))===null||M===void 0||M.forEach(function(T){x[T]||(S=h(b,x,S,T,w))}),A.low=C,A.lim=S++,_?A.parent=_:delete A.parent,S},d=function(b){return b.edges().find(function(x){return b.edge(x).cutvalue<0})};r.leaveEdge=d;var v=function(b,x,E){var w=E.v,_=E.w;x.hasEdge(w,_)||(w=E.w,_=E.v);var M=b.node(w),C=b.node(_),S=M,A=!1;M.lim>C.lim&&(S=C,A=!0);var T=x.edges().filter(function(I){return A===m(b,b.node(I.v),S)&&A!==m(b,b.node(I.w),S)});return(0,n.minBy)(T,function(I){return(0,e.slack)(x,I)})};r.enterEdge=v;var p=function(b,x,E,w){var _=E.v,M=E.w;b.removeEdge(_,M),b.setEdge(w.v,w.w,{}),(0,r.initLowLimValues)(b),(0,r.initCutValues)(b,x),g(b,x)};r.exchangeEdges=p;var g=function(b,x){var E=b.nodes().find(function(_){var M;return!(!((M=x.node(_))===null||M===void 0)&&M.parent)}),w=a(b,E);w=w==null?void 0:w.slice(1),w==null||w.forEach(function(_){var M=b.node(_).parent,C=x.edgeFromArgs(_,M),S=!1;C||(C=x.edgeFromArgs(M,_),S=!0),x.node(_).rank=x.node(M).rank+(S?C.minlen:-C.minlen)})},y=function(b,x,E){return b.hasEdge(x,E)},m=function(b,x,E){return E.low<=x.lim&&x.lim<=E.lim};r.default=s})(mL);var qH=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(w1,"__esModule",{value:!0});var bL=Pi,ZH=No,QH=qH(mL),JH=function(r){switch(r.graph().ranker){case"network-simplex":tK(r);break;case"tight-tree":a2(r);break;case"longest-path":eK(r);break;default:a2(r)}},eK=bL.longestPath,a2=function(r){(0,bL.longestPathWithLayer)(r),(0,ZH.feasibleTreeWithLayer)(r)},tK=function(r){(0,QH.default)(r)};w1.default=JH;var _1={};Object.defineProperty(_1,"__esModule",{value:!0});var rK=function(r){var t,e={},n=0,i=function(a){var o,s=n;(o=r.children(a))===null||o===void 0||o.forEach(i),e[a]={low:s,lim:n++}};return(t=r.children())===null||t===void 0||t.forEach(i),e},nK=function(r,t,e,n){var i=[],a=[],o=Math.min(t[e].low,t[n].low),s=Math.max(t[e].lim,t[n].lim),u,f;u=e;do u=r.parent(u),i.push(u);while(u&&(t[u].low>o||s>t[u].lim));for(f=u,u=n;u&&u!==f;)a.push(u),u=r.parent(u);return{lca:f,path:i.concat(a.reverse())}},iK=function(r){var t,e=rK(r);(t=r.graph().dummyChains)===null||t===void 0||t.forEach(function(n){var i,a,o=n,s=r.node(o),u=s.edgeObj;if(u)for(var f=nK(r,e,u.v,u.w),l=f.path,c=f.lca,h=0,d=l[h],v=!0;o!==u.w;){if(s=r.node(o),v){for(;d!==c&&((i=r.node(d))===null||i===void 0?void 0:i.maxRank)<s.rank;)h++,d=l[h];d===c&&(v=!1)}if(!v){for(;h<l.length-1&&((a=r.node(l[h+1]))===null||a===void 0?void 0:a.minRank)<=s.rank;)h++;d=l[h]}r.setParent(o,d),o=r.successors(o)[0]}})};_1.default=iK;var S1={};Object.defineProperty(S1,"__esModule",{value:!0});var Ty=ii,aK=function(r){var t,e=(0,Ty.addDummyNode)(r,"root",{},"_root"),n=oK(r),i=Math.max.apply(Math,Object.values(n));Math.abs(i)===1/0&&(i=1);var a=i-1,o=2*a+1;r.graph().nestingRoot=e,r.edges().forEach(function(u){r.edge(u).minlen*=o});var s=sK(r)+1;(t=r.children())===null||t===void 0||t.forEach(function(u){xL(r,e,o,s,a,n,u)}),r.graph().nodeRankFactor=o},xL=function(r,t,e,n,i,a,o){var s=r.children(o);if(!(s!=null&&s.length)){o!==t&&r.setEdge(t,o,{weight:0,minlen:e});return}var u=(0,Ty.addBorderNode)(r,"_bt"),f=(0,Ty.addBorderNode)(r,"_bb"),l=r.node(o);r.setParent(u,o),l.borderTop=u,r.setParent(f,o),l.borderBottom=f,s==null||s.forEach(function(c){xL(r,t,e,n,i,a,c);var h=r.node(c),d=h.borderTop?h.borderTop:c,v=h.borderBottom?h.borderBottom:c,p=h.borderTop?n:2*n,g=d!==v?1:i-a[o]+1;r.setEdge(u,d,{minlen:g,weight:p,nestingEdge:!0}),r.setEdge(v,f,{minlen:g,weight:p,nestingEdge:!0})}),r.parent(o)||r.setEdge(t,u,{weight:0,minlen:i+a[o]})},oK=function(r){var t,e={},n=function(i,a){var o=r.children(i);o==null||o.forEach(function(s){return n(s,a+1)}),e[i]=a};return(t=r.children())===null||t===void 0||t.forEach(function(i){return n(i,1)}),e},sK=function(r){var t=0;return r.edges().forEach(function(e){t+=r.edge(e).weight}),t},uK=function(r){var t=r.graph();t.nestingRoot&&r.removeNode(t.nestingRoot),delete t.nestingRoot,r.edges().forEach(function(e){var n=r.edge(e);n.nestingEdge&&r.removeEdgeObj(e)})};S1.default={run:aK,cleanup:uK};var M1={};Object.defineProperty(M1,"__esModule",{value:!0});var fK=ii,lK=function(r){var t,e=function(n){var i=r.children(n),a=r.node(n);if(i!=null&&i.length&&i.forEach(function(u){return e(u)}),a.hasOwnProperty("minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,s=a.maxRank+1;o<s;o+=1)o2(r,"borderLeft","_bl",n,a,o),o2(r,"borderRight","_br",n,a,o)}};(t=r.children())===null||t===void 0||t.forEach(function(n){return e(n)})},o2=function(r,t,e,n,i,a){var o={rank:a,borderType:t,width:0,height:0},s=i[t][a-1],u=(0,fK.addDummyNode)(r,"border",o,e);i[t][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})};M1.default=lK;var C1={};Object.defineProperty(C1,"__esModule",{value:!0});var cK=function(r){var t,e=(t=r.graph().rankdir)===null||t===void 0?void 0:t.toLowerCase();(e==="lr"||e==="rl")&&EL(r)},hK=function(r){var t,e=(t=r.graph().rankdir)===null||t===void 0?void 0:t.toLowerCase();(e==="bt"||e==="rl")&&dK(r),(e==="lr"||e==="rl")&&(vK(r),EL(r))},EL=function(r){r.nodes().forEach(function(t){s2(r.node(t))}),r.edges().forEach(function(t){s2(r.edge(t))})},s2=function(r){var t=r.width;r.width=r.height,r.height=t},dK=function(r){r.nodes().forEach(function(t){Xg(r.node(t))}),r.edges().forEach(function(t){var e,n=r.edge(t);(e=n.points)===null||e===void 0||e.forEach(function(i){return Xg(i)}),n.hasOwnProperty("y")&&Xg(n)})},Xg=function(r){r!=null&&r.y&&(r.y=-r.y)},vK=function(r){r.nodes().forEach(function(t){Yg(r.node(t))}),r.edges().forEach(function(t){var e,n=r.edge(t);(e=n.points)===null||e===void 0||e.forEach(function(i){return Yg(i)}),n.hasOwnProperty("x")&&Yg(n)})},Yg=function(r){var t=r.x;r.x=r.y,r.y=t};C1.default={adjust:cK,undo:hK};var A1={},T1={};function wL(r){return[parseInt(r.substr(1,2),16),parseInt(r.substr(3,2),16),parseInt(r.substr(5,2),16)]}function Vg(r){var t=Math.round(r).toString(16);return t.length===1?"0"+t:t}function _L(r){return"#"+Vg(r[0])+Vg(r[1])+Vg(r[2])}var Gn=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},pK=function(r,t){return Gn(r)?r.indexOf(t)>-1:!1};const Nd=pK;var SL=function(r,t){if(!Gn(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];t(i,n)&&e.push(i)}return e},gK=function(r,t){return t===void 0&&(t=[]),SL(r,function(e){return!Nd(t,e)})};const yK=gK,ai=function(r){return typeof r=="function"};var Go=function(r){return r==null},mK={}.toString,wa=function(r,t){return mK.call(r)==="[object "+t+"]"};const Kr=function(r){return Array.isArray?Array.isArray(r):wa(r,"Array")},Rv=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function Uu(r,t){if(r){var e;if(Kr(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(Rv(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}var bK=Object.keys?function(r){return Object.keys(r)}:function(r){var t=[];return Uu(r,function(e,n){ai(r)&&n==="prototype"||t.push(n)}),t};const ML=bK;function CL(r,t){var e=ML(t),n=e.length;if(Go(r))return!n;for(var i=0;i<n;i+=1){var a=e[i];if(t[a]!==r[a]||!(a in r))return!1}return!0}var xK=function(r){return typeof r=="object"&&r!==null};const Rd=xK;var EK=function(r){if(!Rd(r)||!wa(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var t=r;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t};const $u=EK;function wK(r,t){if(!Kr(r))return null;var e;if(ai(t)&&(e=t),$u(t)&&(e=function(i){return CL(i,t)}),e){for(var n=0;n<r.length;n+=1)if(e(r[n]))return r[n]}return null}function _K(r,t,e){e===void 0&&(e=0);for(var n=e;n<r.length;n++)if(t(r[n],n))return n;return-1}var SK=function(r,t){for(var e=null,n=0;n<r.length;n++){var i=r[n],a=i[t];if(!Go(a)){Kr(a)?e=a[0]:e=a;break}}return e};const MK=SK;var CK=function(r){if(!Kr(r))return[];for(var t=[],e=0;e<r.length;e++)t=t.concat(r[e]);return t};const AK=CK;var AL=function(r,t){if(t===void 0&&(t=[]),!Kr(r))t.push(r);else for(var e=0;e<r.length;e+=1)AL(r[e],t);return t};const TK=AL,TL=function(r){if(Kr(r))return r.reduce(function(t,e){return Math.max(t,e)},r[0])},IL=function(r){if(Kr(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};var IK=function(r){var t=r.filter(function(o){return!isNaN(o)});if(!t.length)return{min:0,max:0};if(Kr(r[0])){for(var e=[],n=0;n<r.length;n++)e=e.concat(r[n]);t=e}var i=TL(t),a=IL(t);return{min:a,max:i}};const OK=IK;var OL=Array.prototype,LK=OL.splice,DK=OL.indexOf,kK=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n++)for(var i=t[n],a=-1;(a=DK.call(r,i))>-1;)LK.call(r,a,1);return r};const PK=kK;var NK=Array.prototype.splice,RK=function(t,e){if(!Gn(t))return[];for(var n=t?e.length:0,i=n-1;n--;){var a=void 0,o=e[n];(n===i||o!==a)&&(a=o,NK.call(t,o,1))}return t};const LL=RK;var BK=function(r,t,e){if(!Kr(r)&&!$u(r))return r;var n=e;return Uu(r,function(i,a){n=t(n,i,a)}),n};const DL=BK;var FK=function(r,t){var e=[];if(!Gn(r))return e;for(var n=-1,i=[],a=r.length;++n<a;){var o=r[n];t(o,n,r)&&(e.push(o),i.push(n))}return LL(r,i),e};const GK=FK,Ro=function(r){return wa(r,"String")};function zK(r,t){var e;if(ai(t))e=function(i,a){return t(i)-t(a)};else{var n=[];Ro(t)?n.push(t):Kr(t)&&(n=t),e=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(e),r}function kL(r,t){t===void 0&&(t=new Map);var e=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];t.has(a)||(e.push(a),t.set(a,!0))}return e}var jK=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return kL([].concat.apply([],r))};const UK=jK,$K=function(r,t){for(var e=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[t];if(!Go(o)){Kr(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(e.push(u),n[u]=!0)}}}return e};function WK(r){if(Gn(r))return r[0]}function XK(r){if(Gn(r)){var t=r;return t[t.length-1]}}function YK(r,t){return Kr(r)||Ro(r)?r[0]===t:!1}function VK(r,t){return Kr(r)||Ro(r)?r[r.length-1]===t:!1}var HK=function(r,t){for(var e=0;e<r.length;e++)if(!t(r[e],e))return!1;return!0};const KK=HK;var qK=function(r,t){for(var e=0;e<r.length;e++)if(t(r[e],e))return!0;return!1};const ZK=qK;var QK=Object.prototype.hasOwnProperty;function PL(r,t){if(!t||!Kr(r))return{};for(var e={},n=ai(t)?t:function(s){return s[t]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),QK.call(e,i)?e[i].push(o):e[i]=[o]}return e}function NL(r,t){if(!t)return{0:r};if(!ai(t)){var e=Kr(t)?t:t.replace(/\s+/g,"").split("*");t=function(n){for(var i="_",a=0,o=e.length;a<o;a++)i+=n[e[a]]&&n[e[a]].toString();return i}}return PL(r,t)}const JK=function(r,t){if(!t)return[r];var e=NL(r,t),n=[];for(var i in e)n.push(e[i]);return n};function eq(r,t){return r["_wrap_"+t]}function tq(r,t){if(r["_wrap_"+t])return r["_wrap_"+t];var e=function(n){r[t](n)};return r["_wrap_"+t]=e,e}var u2={};function rq(r){var t=u2[r];if(!t){for(var e=r.toString(16),n=e.length;n<6;n++)e="0"+e;t="#"+e,u2[r]=t}return t}function nq(r){var t=0,e=0,n=0,i=0;return Kr(r)?r.length===1?t=e=n=i=r[0]:r.length===2?(t=n=r[0],e=i=r[1]):r.length===3?(t=r[0],e=i=r[1],n=r[2]):(t=r[0],e=r[1],n=r[2],i=r[3]):t=e=n=i=r,{r1:t,r2:e,r3:n,r4:i}}var iq=function(r,t,e){return r<t?t:r>e?e:r};const aq=iq;var oq=function(r,t){var e=t.toString(),n=e.indexOf(".");if(n===-1)return Math.round(r);var i=e.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))};const sq=oq;var Ja=function(r){return wa(r,"Number")},uq=function(r){return Ja(r)&&r%1!==0};const fq=uq;var lq=function(r){return Ja(r)&&r%2===0};const cq=lq;var hq=Number.isInteger?Number.isInteger:function(r){return Ja(r)&&r%1===0};const dq=hq;var vq=function(r){return Ja(r)&&r<0};const pq=vq;var gq=1e-5;function yq(r,t,e){return e===void 0&&(e=gq),Math.abs(r-t)<e}var mq=function(r){return Ja(r)&&r%2!==0};const bq=mq;var xq=function(r){return Ja(r)&&r>0};const Eq=xq,wq=function(r,t){if(Kr(r)){for(var e,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=ai(t)?t(a):a[t];o>n&&(e=a,n=o)}return e}},_q=function(r,t){if(Kr(r)){for(var e,n=1/0,i=0;i<r.length;i++){var a=r[i],o=ai(t)?t(a):a[t];o<n&&(e=a,n=o)}return e}};var Sq=function(r,t){return(r%t+t)%t};const Mq=Sq;var Cq=180/Math.PI,Aq=function(r){return Cq*r};const Tq=Aq,Iq=parseInt;var Oq=Math.PI/180,Lq=function(r){return Oq*r};const Dq=Lq,f2=function(r,t){return r.hasOwnProperty(t)};var RL=Object.values?function(r){return Object.values(r)}:function(r){var t=[];return Uu(r,function(e,n){ai(r)&&n==="prototype"||t.push(e)}),t};const kq=function(r,t){return Nd(RL(r),t)},Kl=function(r){return Go(r)?"":r.toString()};var Pq=function(r){return Kl(r).toLowerCase()};const Nq=Pq;var Rq=function(r){var t=Kl(r);return t.charAt(0).toLowerCase()+t.substring(1)};const Bq=Rq;function Fq(r,t){return!r||!t?r:r.replace(/\\?\{([^{}]+)\}/g,function(e,n){return e.charAt(0)==="\\"?e.slice(1):t[n]===void 0?"":t[n]})}var Gq=function(r){return Kl(r).toUpperCase()};const zq=Gq;var jq=function(r){var t=Kl(r);return t.charAt(0).toUpperCase()+t.substring(1)};const Uq=jq;var $q={}.toString,Wq=function(r){return $q.call(r).replace(/^\[object /,"").replace(/]$/,"")};const BL=Wq;var Xq=function(r){return wa(r,"Arguments")};const Yq=Xq;var Vq=function(r){return wa(r,"Boolean")};const Hq=Vq;var Kq=function(r){return wa(r,"Date")};const qq=Kq;var Zq=function(r){return wa(r,"Error")};const Qq=Zq;function Jq(r){return Ja(r)&&isFinite(r)}var eZ=function(r){return r===null};const tZ=eZ;var rZ=Object.prototype,nZ=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||rZ;return r===e};const FL=nZ;var iZ=function(r){return wa(r,"RegExp")};const aZ=iZ;var oZ=function(r){return r===void 0};const sZ=oZ;var uZ=function(r){return r instanceof Element||r instanceof Document};const fZ=uZ;function lZ(r){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)};return t(r)}function cZ(r){var t=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;t(r)}function Hg(r,t){for(var e in t)t.hasOwnProperty(e)&&e!=="constructor"&&t[e]!==void 0&&(r[e]=t[e])}function Tu(r,t,e,n){return t&&Hg(r,t),e&&Hg(r,e),n&&Hg(r,n),r}var hZ=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var e=r[0],n=1;n<r.length;n++){var i=r[n];ai(i)&&(i=i.prototype),Tu(e.prototype,i)}};const dZ=hZ;var Iy=function(r){if(typeof r!="object"||r===null)return r;var t;if(Kr(r)){t=[];for(var e=0,n=r.length;e<n;e++)typeof r[e]=="object"&&r[e]!=null?t[e]=Iy(r[e]):t[e]=r[e]}else{t={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?t[i]=Iy(r[i]):t[i]=r[i]}return t};const vZ=Iy;function pZ(r,t,e){var n;return function(){var i=this,a=arguments,o=function(){n=null,e||r.apply(i,a)},s=e&&!n;clearTimeout(n),n=setTimeout(o,t),s&&r.apply(i,a)}}function gZ(r){var t,e,n,i=r||1;function a(s,u){++t>i&&(n=e,o(1),++t),e[s]=u}function o(s){t=0,e=Object.create(null),s||(n=Object.create(null))}return o(),{clear:o,has:function(s){return e[s]!==void 0||n[s]!==void 0},get:function(s){var u=e[s];if(u!==void 0)return u;if((u=n[s])!==void 0)return a(s,u),u},set:function(s,u){e[s]!==void 0?e[s]=u:a(s,u)}}}const GL=function(r,t,e){if(e===void 0&&(e=128),!ai(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=t?t.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=gZ(e),n};var yZ=5;function mZ(r,t){if(Object.hasOwn)return Object.hasOwn(r,t);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),t)}function zL(r,t,e,n){e=e||0,n=n||yZ;for(var i in t)if(mZ(t,i)){var a=t[i];a!==null&&$u(a)?($u(r[i])||(r[i]={}),e<n?zL(r[i],a,e+1,n):r[i]=t[i]):Kr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var bZ=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)zL(r,t[n]);return r};const xZ=bZ;var EZ=function(r,t,e,n){ai(t)||(e=t,t=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(t.prototype,r);return r.prototype=Tu(a,r.prototype),r.superclass=i(t.prototype,t),Tu(a,e),Tu(r,n),r};const wZ=EZ;var _Z=function(r,t){if(!Gn(r))return-1;var e=Array.prototype.indexOf;if(e)return e.call(r,t);for(var n=-1,i=0;i<r.length;i++)if(r[i]===t){n=i;break}return n};const SZ=_Z;var MZ=Object.prototype.hasOwnProperty;function CZ(r){if(Go(r))return!0;if(Gn(r))return!r.length;var t=BL(r);if(t==="Map"||t==="Set")return!r.size;if(FL(r))return!Object.keys(r).length;for(var e in r)if(MZ.call(r,e))return!1;return!0}var Oy=function(r,t){if(r===t)return!0;if(!r||!t||Ro(r)||Ro(t))return!1;if(Gn(r)||Gn(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n<r.length&&(e=Oy(r[n],t[n]),!!e);n++);return e}if(Rd(r)||Rd(t)){var i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)return!1;for(var e=!0,n=0;n<i.length&&(e=Oy(r[i[n]],t[i[n]]),!!e);n++);return e}return!1};const jL=Oy,AZ=function(r,t,e){return ai(e)?!!e(r,t):jL(r,t)};var TZ=function(r,t){if(!Gn(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];e.push(t(i,n))}return e};const IZ=TZ;var OZ=function(r){return r};const LZ=function(r,t){t===void 0&&(t=OZ);var e={};return Rv(r)&&!Go(r)&&Object.keys(r).forEach(function(n){e[n]=t(r[n],n)}),e},DZ=function(r,t,e){for(var n=0,i=Ro(t)?t.split("."):t;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?e:r},kZ=function(r,t,e){var n=r,i=Ro(t)?t.split("."):t;return i.forEach(function(a,o){o<i.length-1?(Rv(n[a])||(n[a]=Ja(i[o+1])?[]:{}),n=n[a]):n[a]=e}),r};var PZ=Object.prototype.hasOwnProperty;const NZ=function(r,t){if(r===null||!$u(r))return{};var e={};return Uu(t,function(n){PZ.call(r,n)&&(e[n]=r[n])}),e},RZ=function(r,t){return DL(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})},BZ=function(r,t,e){var n,i,a,o,s=0;e||(e={});var u=function(){s=e.leading===!1?0:Date.now(),n=null,o=r.apply(i,a),n||(i=a=null)},f=function(){var l=Date.now();!s&&e.leading===!1&&(s=l);var c=t-(l-s);return i=this,a=arguments,c<=0||c>t?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},FZ=function(r){return Gn(r)?Array.prototype.slice.call(r):[]};var gh={};const GZ=function(r){return r=r||"g",gh[r]?gh[r]+=1:gh[r]=1,r+gh[r]},zZ=function(){},jZ=function(r){return r};function UZ(r){return Go(r)?0:Gn(r)?r.length:Object.keys(r).length}var $Z=function(){function r(){this.map={}}return r.prototype.has=function(t){return this.map[t]!==void 0},r.prototype.get=function(t,e){var n=this.map[t];return n===void 0?e:n},r.prototype.set=function(t,e){this.map[t]=e},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(t){delete this.map[t]},r.prototype.size=function(){return Object.keys(this.map).length},r}();const WZ=$Z;var XZ=/rgba?\(([\s.,0-9]+)\)/;function YZ(){var r=document.createElement("i");return r.title="Web Colour Picker",r.style.display="none",document.body.appendChild(r),r}var yh;function VZ(r){if(r[0]==="#"&&r.length===7)return r;yh||(yh=YZ()),yh.style.color=r;var t=document.defaultView.getComputedStyle(yh,"").getPropertyValue("color"),e=XZ.exec(t),n=e[1].split(/\s*,\s*/).map(function(i){return Number(i)});return t=_L(n),t}var UL=GL(VZ,function(r){return r},256);function Kg(r,t,e,n){return r[n]+(t[n]-r[n])*e}function HZ(r,t){var e=isNaN(Number(t))||t<0?0:t>1?1:Number(t),n=r.length-1,i=Math.floor(n*e),a=n*e-i,o=r[i],s=i===n?o:r[i+1];return _L([Kg(o,s,a,0),Kg(o,s,a,1),Kg(o,s,a,2)])}function KZ(r){var t=typeof r=="string"?r.split("-"):r,e=t.map(function(n){return wL(n.indexOf("#")===-1?UL(n):n)});return function(n){return HZ(e,n)}}var qZ=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,ZZ=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,QZ=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function JZ(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)}function eQ(r){if(JZ(r)){var t,e=void 0;if(r[0]==="l"){var n=qZ.exec(r),i=+n[1]+90;e=n[2],t="linear-gradient("+i+"deg, "}else if(r[0]==="r"){t="radial-gradient(";var n=ZZ.exec(r);e=n[4]}var a=e.match(QZ);return a.forEach(function(o,s){var u=o.split(":");t+=u[1]+" "+Number(u[0])*100+"%",s!==a.length-1&&(t+=", ")}),t+=")",t}return r}function tQ(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return gm(n,e),xa(r,n,t)}function rQ(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return ym(n,e),xa(r,n,t)}function nQ(r,t,e){var n=[0,0,0,0,0,0,0,0,0];return mm(n,e),xa(r,n,t)}function iQ(r,t,e){return xa(r,e,t)}function aQ(r,t){for(var e=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=t.length;n<i;n++){var a=t[n];switch(a[0]){case"t":tQ(e,e,[a[1],a[2]]);break;case"s":nQ(e,e,[a[1],a[2]]);break;case"r":rQ(e,e,a[1]);break;case"m":iQ(e,e,a[1]);break}}return e}function $L(r,t){return r[0]*t[1]-t[0]*r[1]}function oQ(r,t,e){var n=UA(r,t),i=$L(r,t)>=0;return e?i?Math.PI*2-n:n:i?n:Math.PI*2-n}function sQ(r,t,e){return e?(r[0]=t[1],r[1]=-1*t[0]):(r[0]=-1*t[1],r[1]=t[0]),r}function uQ(r,t){if(t==="off")return[].concat(r);var e=typeof t=="number"&&t>=1?Math.pow(10,t):1;return r.map(function(n){var i=n.slice(1).map(Number).map(function(a){return t?Math.round(a*e)/e:Math.round(a)});return[n[0]].concat(i)})}function fQ(r,t){return t===void 0&&(t="off"),uQ(r,t).map(function(e){return e[0]+e.slice(1).join(" ")}).join("")}var WL={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function lQ(r,t,e){if(r[e].length>7){r[e].shift();for(var n=r[e],i=e;n.length;)t[e]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(e,1)}}var tl={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function XL(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return tl[e]===t.length-1&&"achlmqstvz".includes(e)})}function YL(r){return XL(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function VL(r){return YL(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function l2(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=tl[e]&&(e==="m"&&n.length>2?(r.segments.push([t].concat(n.splice(0,2))),e="l",t=t==="m"?"l":"L"):r.segments.push([t].concat(n.splice(0,tl[e]))),!!tl[e]););}function cQ(r){var t=r.index,e=r.pathValue,n=e.charCodeAt(t);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 "'+e[t]+'", expecting 0 or 1 at index '+t}function hQ(r){return r>=48&&r<=57||r===43||r===45||r===46}function su(r){return r>=48&&r<=57}function dQ(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,o=!1,s=!1,u=!1,f;if(i>=t){r.err="[path-util]: Invalid path value at index "+i+', "pathValue" is missing param';return}if(f=e.charCodeAt(i),(f===43||f===45)&&(i+=1,f=e.charCodeAt(i)),!su(f)&&f!==46){r.err="[path-util]: Invalid path value at index "+i+', "'+e[i]+'" is not a number';return}if(f!==46){if(a=f===48,i+=1,f=e.charCodeAt(i),a&&i<t&&f&&su(f)){r.err="[path-util]: Invalid path value at index "+n+', "'+e[n]+'" illegal number';return}for(;i<t&&su(e.charCodeAt(i));)i+=1,o=!0;f=e.charCodeAt(i)}if(f===46){for(u=!0,i+=1;su(e.charCodeAt(i));)i+=1,s=!0;f=e.charCodeAt(i)}if(f===101||f===69){if(u&&!o&&!s){r.err="[path-util]: Invalid path value at index "+i+', "'+e[i]+'" invalid float exponent';return}if(i+=1,f=e.charCodeAt(i),(f===43||f===45)&&(i+=1),i<t&&su(e.charCodeAt(i)))for(;i<t&&su(e.charCodeAt(i));)i+=1;else{r.err="[path-util]: Invalid path value at index "+i+', "'+e[i]+'" invalid integer exponent';return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function vQ(r){var t=[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&&t.includes(r)}function Qh(r){for(var t=r.pathValue,e=r.max;r.index<e&&vQ(t.charCodeAt(r.index));)r.index+=1}function pQ(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 gQ(r){return(r|32)===97}function yQ(r){var t=r.max,e=r.pathValue,n=r.index,i=e.charCodeAt(n),a=tl[e[n].toLowerCase()];if(r.segmentStart=n,!pQ(i)){r.err='[path-util]: Invalid path value "'+e[n]+'" is not a path command';return}if(r.index+=1,Qh(r),r.data=[],!a){l2(r);return}for(;;){for(var o=a;o>0;o-=1){if(gQ(i)&&(o===3||o===4)?cQ(r):dQ(r),r.err.length)return;r.data.push(r.param),Qh(r),r.index<t&&e.charCodeAt(r.index)===44&&(r.index+=1,Qh(r))}if(r.index>=r.max||!hQ(e.charCodeAt(r.index)))break}l2(r)}var mQ=function(){function r(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r}();function I1(r){if(XL(r))return[].concat(r);var t=new mQ(r);for(Qh(t);t.index<t.max&&!t.err.length;)yQ(t);return t.err?t.err:t.segments}function HL(r){if(YL(r))return[].concat(r);var t=I1(r),e=0,n=0,i=0,a=0;return t.map(function(o){var s=o.slice(1).map(Number),u=o[0],f=u.toUpperCase();if(u==="M")return e=s[0],n=s[1],i=e,a=n,["M",e,n];var l;if(u!==f)switch(f){case"A":l=[f,s[0],s[1],s[2],s[3],s[4],s[5]+e,s[6]+n];break;case"V":l=[f,s[0]+n];break;case"H":l=[f,s[0]+e];break;default:{var c=s.map(function(d,v){return d+(v%2?n:e)});l=[f].concat(c)}}else l=[f].concat(s);var h=l.length;switch(f){case"Z":e=i,n=a;break;case"H":e=l[1];break;case"V":n=l[1];break;default:e=l[h-2],n=l[h-1],f==="M"&&(i=e,a=n)}return l})}function bQ(r,t){var e=r[0],n=t.x1,i=t.y1,a=t.x2,o=t.y2,s=r.slice(1).map(Number),u=r;if("TQ".includes(e)||(t.qx=null,t.qy=null),e==="H")u=["L",r[1],i];else if(e==="V")u=["L",n,r[1]];else if(e==="S"){var f=n*2-a,l=i*2-o;t.x1=f,t.y1=l,u=["C",f,l].concat(s)}else if(e==="T"){var c=n*2-t.qx,h=i*2-t.qy;t.qx=c,t.qy=h,u=["Q",c,h].concat(s)}else if(e==="Q"){var d=s[0],v=s[1];t.qx=d,t.qy=v}return u}function Bv(r){if(VL(r))return[].concat(r);for(var t=HL(r),e=F({},WL),n=0;n<t.length;n+=1){t[n]=bQ(t[n],e);var i=t[n],a=i.length;e.x1=+i[a-2],e.y1=+i[a-1],e.x2=+i[a-4]||e.x1,e.y2=+i[a-3]||e.y1}return t}function xQ(r){return VL(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function mh(r,t,e){var n=r*Math.cos(e)-t*Math.sin(e),i=r*Math.sin(e)+t*Math.cos(e);return{x:n,y:i}}function O1(r,t,e,n,i,a,o,s,u,f){var l=r,c=t,h=e,d=n,v=s,p=u,g=Math.PI*120/180,y=Math.PI/180*(+i||0),m=[],b,x,E,w,_;if(f)x=f[0],E=f[1],w=f[2],_=f[3];else{b=mh(l,c,-y),l=b.x,c=b.y,b=mh(v,p,-y),v=b.x,p=b.y;var M=(l-v)/2,C=(c-p)/2,S=M*M/(h*h)+C*C/(d*d);S>1&&(S=Math.sqrt(S),h*=S,d*=S);var A=h*h,T=d*d,I=(a===o?-1:1)*Math.sqrt(Math.abs((A*T-A*C*C-T*M*M)/(A*C*C+T*M*M)));w=I*h*C/d+(l+v)/2,_=I*-d*M/h+(c+p)/2,x=Math.asin(((c-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),E=Math.asin(((p-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),x=l<w?Math.PI-x:x,E=v<w?Math.PI-E:E,x<0&&(x=Math.PI*2+x),E<0&&(E=Math.PI*2+E),o&&x>E&&(x-=Math.PI*2),!o&&E>x&&(E-=Math.PI*2)}var D=E-x;if(Math.abs(D)>g){var N=E,P=v,G=p;E=x+g*(o&&E>x?1:-1),v=w+h*Math.cos(E),p=_+d*Math.sin(E),m=O1(v,p,h,d,i,0,o,P,G,[E,N,w,_])}D=E-x;var W=Math.cos(x),k=Math.sin(x),R=Math.cos(E),Y=Math.sin(E),J=Math.tan(D/4),te=4/3*h*J,H=4/3*d*J,pe=[l,c],Ae=[l+te*k,c-H*W],Le=[v+te*Y,p-H*R],qe=[v,p];if(Ae[0]=2*pe[0]-Ae[0],Ae[1]=2*pe[1]-Ae[1],f)return Ae.concat(Le,qe,m);m=Ae.concat(Le,qe,m);for(var at=[],rt=0,xt=m.length;rt<xt;rt+=1)at[rt]=rt%2?mh(m[rt-1],m[rt],y).y:mh(m[rt],m[rt+1],y).x;return at}function EQ(r,t,e,n,i,a){var o=.3333333333333333,s=2/3;return[o*r+s*e,o*t+s*n,o*i+s*e,o*a+s*n,i,a]}function Eo(r,t,e){var n=r[0],i=r[1],a=t[0],o=t[1];return[n+(a-n)*e,i+(o-i)*e]}var c2=function(r,t,e,n){var i=.5,a=Eo([r,t],[e,n],i);return ri(ri([],a,!0),[e,n,e,n],!1)};function wQ(r,t){var e=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],o,s=t.x1,u=t.y1,f=t.x,l=t.y;switch("TQ".includes(e)||(t.qx=null,t.qy=null),e){case"M":return t.x=i,t.y=a,r;case"A":return o=[s,u].concat(n),["C"].concat(O1(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9]));case"Q":return t.qx=i,t.qy=a,o=[s,u].concat(n),["C"].concat(EQ(o[0],o[1],o[2],o[3],o[4],o[5]));case"L":return["C"].concat(c2(s,u,i,a));case"Z":return s===f&&u===l?["C",s,u,f,l,f,l]:["C"].concat(c2(s,u,f,l))}return r}function KL(r,t){if(t===void 0&&(t=!1),xQ(r)){var e=[].concat(r);return t?[e,[]]:e}for(var n=Bv(r),i=F({},WL),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=wQ(n[c],i);n[c]=h,lQ(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 t?[n,l]:n}function _Q(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function SQ(r){var t=r.slice(1).map(function(e,n,i){return n?i[n-1].slice(-2).concat(e.slice(1)):r[0].slice(1).concat(e.slice(1))}).map(function(e){return e.map(function(n,i){return e[e.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(function(e){return["C"].concat(e.slice(2))}))}function ef(r,t){return Math.sqrt((r[0]-t[0])*(r[0]-t[0])+(r[1]-t[1])*(r[1]-t[1]))}function Ly(r,t,e,n,i){var a=ef([r,t],[e,n]),o={x:0,y:0};if(typeof i=="number")if(i<=0)o={x:r,y:t};else if(i>=a)o={x:e,y:n};else{var s=Eo([r,t],[e,n],i/a),u=s[0],f=s[1];o={x:u,y:f}}return{length:a,point:o,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function h2(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,o=e*i+n*a,s=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),u=e*a-n*i<0?-1:1,f=u*Math.acos(o/s);return f}function MQ(r,t,e,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(e),g=l(n),y=(i%360+360)%360,m=y*(v/180);if(r===s&&t===u)return{x:r,y:t};if(p===0||g===0)return Ly(r,t,s,u,f).point;var b=(r-s)/2,x=(t-u)/2,E={x:h(m)*b+c(m)*x,y:-c(m)*b+h(m)*x},w=Math.pow(E.x,2)/Math.pow(p,2)+Math.pow(E.y,2)/Math.pow(g,2);w>1&&(p*=d(w),g*=d(w));var _=Math.pow(p,2)*Math.pow(g,2)-Math.pow(p,2)*Math.pow(E.y,2)-Math.pow(g,2)*Math.pow(E.x,2),M=Math.pow(p,2)*Math.pow(E.y,2)+Math.pow(g,2)*Math.pow(E.x,2),C=_/M;C=C<0?0:C;var S=(a!==o?1:-1)*d(C),A={x:S*(p*E.y/g),y:S*(-(g*E.x)/p)},T={x:h(m)*A.x-c(m)*A.y+(r+s)/2,y:c(m)*A.x+h(m)*A.y+(t+u)/2},I={x:(E.x-A.x)/p,y:(E.y-A.y)/g},D=h2({x:1,y:0},I),N={x:(-E.x-A.x)/p,y:(-E.y-A.y)/g},P=h2(I,N);!o&&P>0?P-=2*v:o&&P<0&&(P+=2*v),P%=2*v;var G=D+P*f,W=p*h(G),k=g*c(G),R={x:h(m)*W-c(m)*k+T.x,y:c(m)*W+h(m)*k+T.y};return R}function CQ(r,t,e,n,i,a,o,s,u,f,l){var c,h=l.bbox,d=h===void 0?!0:h,v=l.length,p=v===void 0?!0:v,g=l.sampleSize,y=g===void 0?30:g,m=typeof f=="number",b=r,x=t,E=0,w=[b,x,E],_=[b,x],M=0,C={x:0,y:0},S=[{x:b,y:x}];m&&f<=0&&(C={x:b,y:x});for(var A=0;A<=y;A+=1){if(M=A/y,c=MQ(r,t,e,n,i,a,o,s,u,M),b=c.x,x=c.y,d&&S.push({x:b,y:x}),p&&(E+=ef(_,[b,x])),_=[b,x],m&&E>=f&&f>w[2]){var T=(E-f)/(E-w[2]);C={x:_[0]*(1-T)+w[0]*T,y:_[1]*(1-T)+w[1]*T}}w=[b,x,E]}return m&&f>=E&&(C={x:s,y:u}),{length:E,point:C,min:{x:Math.min.apply(null,S.map(function(I){return I.x})),y:Math.min.apply(null,S.map(function(I){return I.y}))},max:{x:Math.max.apply(null,S.map(function(I){return I.x})),y:Math.max.apply(null,S.map(function(I){return I.y}))}}}function AQ(r,t,e,n,i,a,o,s,u){var f=1-u;return{x:Math.pow(f,3)*r+3*Math.pow(f,2)*u*e+3*f*Math.pow(u,2)*i+Math.pow(u,3)*o,y:Math.pow(f,3)*t+3*Math.pow(f,2)*u*n+3*f*Math.pow(u,2)*a+Math.pow(u,3)*s}}function qL(r,t,e,n,i,a,o,s,u,f){var l,c=f.bbox,h=c===void 0?!0:c,d=f.length,v=d===void 0?!0:d,p=f.sampleSize,g=p===void 0?10:p,y=typeof u=="number",m=r,b=t,x=0,E=[m,b,x],w=[m,b],_=0,M={x:0,y:0},C=[{x:m,y:b}];y&&u<=0&&(M={x:m,y:b});for(var S=0;S<=g;S+=1){if(_=S/g,l=AQ(r,t,e,n,i,a,o,s,_),m=l.x,b=l.y,h&&C.push({x:m,y:b}),v&&(x+=ef(w,[m,b])),w=[m,b],y&&x>=u&&u>E[2]){var A=(x-u)/(x-E[2]);M={x:w[0]*(1-A)+E[0]*A,y:w[1]*(1-A)+E[1]*A}}E=[m,b,x]}return y&&u>=x&&(M={x:o,y:s}),{length:x,point:M,min:{x:Math.min.apply(null,C.map(function(T){return T.x})),y:Math.min.apply(null,C.map(function(T){return T.y}))},max:{x:Math.max.apply(null,C.map(function(T){return T.x})),y:Math.max.apply(null,C.map(function(T){return T.y}))}}}function TQ(r,t,e,n,i,a,o){var s=1-o;return{x:Math.pow(s,2)*r+2*s*o*e+Math.pow(o,2)*i,y:Math.pow(s,2)*t+2*s*o*n+Math.pow(o,2)*a}}function IQ(r,t,e,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=t,m=0,b=[g,y,m],x=[g,y],E=0,w={x:0,y:0},_=[{x:g,y}];p&&o<=0&&(w={x:g,y});for(var M=0;M<=v;M+=1){if(E=M/v,u=TQ(r,t,e,n,i,a,E),g=u.x,y=u.y,l&&_.push({x:g,y}),h&&(m+=ef(x,[g,y])),x=[g,y],p&&m>=o&&o>b[2]){var C=(m-o)/(m-b[2]);w={x:x[0]*(1-C)+b[0]*C,y:x[1]*(1-C)+b[1]*C}}b=[g,y,m]}return p&&o>=m&&(w={x:i,y:a}),{length:m,point:w,min:{x:Math.min.apply(null,_.map(function(S){return S.x})),y:Math.min.apply(null,_.map(function(S){return S.y}))},max:{x:Math.max.apply(null,_.map(function(S){return S.x})),y:Math.max.apply(null,_.map(function(S){return S.y}))}}}function Fv(r,t,e){for(var n,i,a,o,s,u,f=Bv(r),l=typeof t=="number",c,h=[],d,v=0,p=0,g=0,y=0,m,b=[],x=[],E=0,w={x:0,y:0},_=w,M=w,C=w,S=0,A=0,T=f.length;A<T;A+=1)m=f[A],d=m[0],c=d==="M",h=c?h:[v,p].concat(m.slice(1)),c?(g=m[1],y=m[2],w={x:g,y},_=w,E=0,l&&t<.001&&(C=w)):d==="L"?(n=Ly(h[0],h[1],h[2],h[3],(t||0)-S),E=n.length,w=n.min,_=n.max,M=n.point):d==="A"?(i=CQ(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],(t||0)-S,e||{}),E=i.length,w=i.min,_=i.max,M=i.point):d==="C"?(a=qL(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],(t||0)-S,e||{}),E=a.length,w=a.min,_=a.max,M=a.point):d==="Q"?(o=IQ(h[0],h[1],h[2],h[3],h[4],h[5],(t||0)-S,e||{}),E=o.length,w=o.min,_=o.max,M=o.point):d==="Z"&&(h=[v,p,g,y],s=Ly(h[0],h[1],h[2],h[3],(t||0)-S),E=s.length,w=s.min,_=s.max,M=s.point),l&&S<t&&S+E>=t&&(C=M),x.push(_),b.push(w),S+=E,u=d!=="Z"?m.slice(-2):[g,y],v=u[0],p=u[1];return l&&t>=S&&(C={x:v,y:p}),{length:S,point:C,min:{x:Math.min.apply(null,b.map(function(I){return I.x})),y:Math.min.apply(null,b.map(function(I){return I.y}))},max:{x:Math.max.apply(null,x.map(function(I){return I.x})),y:Math.max.apply(null,x.map(function(I){return I.y}))}}}function OQ(r,t){if(!r)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=Fv(r,void 0,F(F({},t),{length:!1})),n=e.min,i=n.x,a=n.y,o=e.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 rl(r,t){return Fv(r,void 0,F(F({},t),{bbox:!1,length:!0})).length}function LQ(r,t){if(!r)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=Fv(r,void 0,F(F({},t),{bbox:!0,length:!0})),n=e.length,i=e.min,a=i.x,o=i.y,s=e.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 DQ(r){var t=r.length,e=t-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>=t&&(s-=e),r[s])})})}function kQ(r,t){var e=r.length-1,n=[],i=0,a=0,o=DQ(r);return o.forEach(function(s,u){r.slice(1).forEach(function(f,l){a+=ef(r[(u+l)%e].slice(-2),t[l%e].slice(-2))}),n[u]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),o[i]}function PQ(r,t,e,n,i,a,o,s){return 3*((s-t)*(e+i)-(o-r)*(n+a)+n*(r-i)-e*(t-a)+s*(i+r/3)-o*(a+t/3))/20}function ZL(r){var t=0,e=0,n=0;return KL(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=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=PQ(t,e,s,u,f,l,c,h),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function NQ(r){return ZL(r)>=0}function Jh(r,t,e){return Fv(r,t,F(F({},e),{bbox:!1,length:!0})).point}function RQ(r,t){var e=I1(r);if(typeof e=="string")throw TypeError(e);var n=e.slice(),i=rl(n),a=n.length-1,o=0,s=0,u=e[0],f=u.slice(-2),l=f[0],c=f[1],h={x:l,y:c};if(a<=0||!t||!Number.isFinite(t))return{segment:u,index:0,length:s,point:h,lengthAtSegment:o};if(t>=i)return n=e.slice(0,-1),o=rl(n),s=i-o,{segment:e[a],index:a,length:s,lengthAtSegment:o};for(var d=[];a>0;)u=n[a],n=n.slice(0,-1),o=rl(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<=t})}function BQ(r,t){for(var e=I1(r),n=Bv(e),i=rl(e),a=function(E){var w=E.x-t.x,_=E.y-t.y;return w*w+_*_},o=8,s,u=0,f,l=0,c=1/0,h=0;h<=i;h+=o)s=Jh(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=Jh(n,p),y=a(d),g=l+o,v=Jh(n,g),m=a(v),p>=0&&y<c?(f=d,l=p,c=y):g<=i&&m<c?(f=v,l=g,c=m):o/=2;var b=RQ(e,l),x=Math.sqrt(c);return{closest:f,distance:x,segment:b}}function FQ(r,t){var e=BQ(r,t).distance;return Math.abs(e)<.001}function GQ(r,t){t===void 0&&(t=.5);var e=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),o=Eo(e,n,t),s=Eo(n,i,t),u=Eo(i,a,t),f=Eo(o,s,t),l=Eo(s,u,t),c=Eo(f,l,t);return[["C"].concat(o,f,c),["C"].concat(l,u,a)]}function d2(r){return r.map(function(t,e,n){var i=e&&n[e-1].slice(-2).concat(t.slice(1)),a=e?qL(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,o;return e?o=a?GQ(i):[t,t]:o=[t],{s:t,ss:o,l:a}})}function QL(r,t,e){var n=d2(r),i=d2(t),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=e||Math.max(a,o),h=[f,l],d=[c-a,c-o],v=0,p=[n,i].map(function(g,y){return g.l===c?g.map(function(m){return m.s}):g.map(function(m,b){return v=b&&d[y]&&m.l>=h[y],d[y]-=v?1:0,v?m.ss:[m.s]}).flat()});return p[0].length===p[1].length?p:QL(p[0],p[1],c)}var zQ=1e-6;function qg(r){return Math.abs(r)<zQ?0:r<0?-1:1}function jQ(r,t,e){return(e[0]-r[0])*(t[1]-r[1])===(t[0]-r[0])*(e[1]-r[1])&&Math.min(r[0],t[0])<=e[0]&&e[0]<=Math.max(r[0],t[0])&&Math.min(r[1],t[1])<=e[1]&&e[1]<=Math.max(r[1],t[1])}function Dy(r,t,e){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(jQ(o,s,[t,e]))return!0;qg(o[1]-e)>0!=qg(s[1]-e)>0&&qg(t-(e-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}var v2=function(r,t,e){return r>=t&&r<=e};function UQ(r,t,e,n){var i=.001,a={x:e.x-r.x,y:e.y-r.y},o={x:t.x-r.x,y:t.y-r.y},s={x:n.x-e.x,y:n.y-e.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;v2(d,0,1)&&v2(v,0,1)&&(h={x:r.x+d*o.x,y:r.y+d*o.y})}return h}function p2(r){for(var t=[],e=r.length,n=0;n<e-1;n++){var i=r[n],a=r[n+1];t.push({from:{x:i[0],y:i[1]},to:{x:a[0],y:a[1]}})}if(t.length>1){var o=r[0],s=r[e-1];t.push({from:{x:s[0],y:s[1]},to:{x:o[0],y:o[1]}})}return t}function $Q(r,t){var e=!1;return r.forEach(function(n){if(UQ(n.from,n.to,t.from,t.to))return e=!0,!1}),e}function g2(r){var t=r.map(function(n){return n[0]}),e=r.map(function(n){return n[1]});return{minX:Math.min.apply(null,t),maxX:Math.max.apply(null,t),minY:Math.min.apply(null,e),maxY:Math.max.apply(null,e)}}function WQ(r,t){return!(t.minX>r.maxX||t.maxX<r.minX||t.minY>r.maxY||t.maxY<r.minY)}function XQ(r,t){if(r.length<2||t.length<2)return!1;var e=g2(r),n=g2(t);if(!WQ(e,n))return!1;var i=!1;if(t.forEach(function(u){if(Dy(r,u[0],u[1]))return i=!0,!1}),i||(r.forEach(function(u){if(Dy(t,u[0],u[1]))return i=!0,!1}),i))return!0;var a=p2(r),o=p2(t),s=!1;return o.forEach(function(u){if($Q(a,u))return s=!0,!1}),s}function YQ(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function VQ(r,t){if(r)return Object.keys(t).forEach(function(e){r.style[e]=t[e]}),r}const HQ=Object.freeze(Object.defineProperty({__proto__:null,Cache:WZ,angleTo:oQ,arcToCubic:O1,assign:Tu,augment:dZ,clamp:aq,clearAnimationFrame:cZ,clone:vZ,clonePath:_Q,contains:Nd,createDOM:YQ,debounce:pZ,deepMix:xZ,difference:yK,direction:$L,distanceSquareRoot:ef,each:Uu,endsWith:VK,equalizeSegments:QL,every:KK,extend:wZ,filter:SL,find:wK,findIndex:_K,firstValue:MK,fixedBase:sq,flatten:AK,flattenDeep:TK,forIn:Uu,get:DZ,getDrawDirection:NQ,getPathArea:ZL,getPathBBox:OQ,getPathBBoxTotalLength:LQ,getPointAtLength:Jh,getRange:OK,getRotatedCurve:kQ,getTotalLength:rl,getType:BL,getWrapBehavior:eq,gradient:KZ,group:JK,groupBy:PL,groupToMap:NL,has:f2,hasKey:f2,hasValue:kq,head:WK,identity:jZ,includes:Nd,indexOf:SZ,isArguments:Yq,isArray:Kr,isArrayLike:Gn,isBoolean:Hq,isDate:qq,isDecimal:fq,isElement:fZ,isEmpty:CZ,isEqual:jL,isEqualWith:AZ,isError:Qq,isEven:cq,isFinite:Jq,isFunction:ai,isInteger:dq,isMatch:CL,isNegative:pq,isNil:Go,isNull:tZ,isNumber:Ja,isNumberEqual:yq,isObject:Rv,isObjectLike:Rd,isOdd:bq,isPlainObject:$u,isPointInPolygon:Dy,isPointInStroke:FQ,isPolygonsIntersect:XQ,isPositive:Eq,isPrototype:FL,isRegExp:aZ,isString:Ro,isType:wa,isUndefined:sZ,keys:ML,last:XK,lowerCase:Nq,lowerFirst:Bq,map:IZ,mapValues:LZ,max:TL,maxBy:wq,memoize:GL,min:IL,minBy:_q,mix:Tu,mod:Mq,modifyCSS:VQ,noop:zZ,normalizePath:Bv,number2color:rq,omit:RZ,parseRadius:nq,path2Absolute:HL,path2Curve:KL,path2String:fQ,pick:NZ,pull:PK,pullAt:LL,reduce:DL,remove:GK,requestAnimationFrame:lZ,reverseCurve:SQ,rgb2arr:wL,set:kZ,size:UZ,some:ZK,sortBy:zK,startsWith:YK,substitute:Fq,throttle:BZ,toArray:FZ,toCSSGradient:eQ,toDegree:Tq,toInteger:Iq,toRGB:UL,toRadian:Dq,toString:Kl,transform:aQ,union:UK,uniq:kL,uniqueId:GZ,upperCase:zq,upperFirst:Uq,values:RL,valuesOfKey:$K,vertical:sQ,wrapBehavior:tq},Symbol.toStringTag,{value:"Module"})),JL=ma(HQ);Object.defineProperty(T1,"__esModule",{value:!0});var KQ=JL,qQ=function(r){for(var t={},e=r.nodes().filter(function(c){var h;return!(!((h=r.children(c))===null||h===void 0)&&h.length)}),n=e.map(function(c){return r.node(c).rank}),i=(0,KQ.max)(n),a=[],o=0;o<i+1;o++)a.push([]);var s=function(c){var h;if(!t.hasOwnProperty(c)){t[c]=!0;var d=r.node(c);isNaN(d.rank)||a[d.rank].push(c),(h=r.successors(c))===null||h===void 0||h.forEach(function(v){return s(v)})}},u=e.sort(function(c,h){return r.node(c).rank-r.node(h).rank}),f=u.filter(function(c){return r.node(c).fixorder!==void 0}),l=f.sort(function(c,h){return r.node(c).fixorder-r.node(h).fixorder});return l==null||l.forEach(function(c){isNaN(r.node(c).rank)||a[r.node(c).rank].push(c),t[c]=!0}),u==null||u.forEach(s),a};T1.default=qQ;var L1={};Object.defineProperty(L1,"__esModule",{value:!0});var ZQ=ii,QQ=function(r,t,e){for(var n=(0,ZQ.zipObject)(e,e.map(function(l,c){return c})),i=t.map(function(l){var c,h=(c=r.outEdges(l))===null||c===void 0?void 0:c.map(function(d){return{pos:n[d.w]||0,weight:r.edge(d).weight}});return h==null?void 0:h.sort(function(d,v){return d.pos-v.pos})}),a=i.flat().filter(function(l){return l!==void 0}),o=1;o<e.length;)o<<=1;var s=2*o-1;o-=1;var u=Array(s).fill(0,0,s),f=0;return a==null||a.forEach(function(l){if(l){var c=l.pos+o;u[c]+=l.weight;for(var h=0;c>0;)c%2&&(h+=u[c+1]),c=c-1>>1,u[c]+=l.weight;f+=l.weight*h}}),f},JQ=function(r,t){for(var e=0,n=1;n<(t==null?void 0:t.length);n+=1)e+=QQ(r,t[n-1],t[n]);return e};L1.default=JQ;var D1={};Object.defineProperty(D1,"__esModule",{value:!0});var eJ=Qa,tJ=function(r,t,e){var n=rJ(r),i=new eJ.Graph({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return r.nodes().forEach(function(a){var o,s=r.node(a),u=r.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(i.setNode(a),i.setParent(a,u||n),(o=r[e](a))===null||o===void 0||o.forEach(function(f){var l=f.v===a?f.w:f.v,c=i.edgeFromArgs(l,a),h=c!==void 0?c.weight:0;i.setEdge(l,a,{weight:r.edge(f).weight+h})}),s.hasOwnProperty("minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i},rJ=function(r){for(var t;r.hasNode(t="_root".concat(Math.random())););return t};D1.default=tJ;var k1={};Object.defineProperty(k1,"__esModule",{value:!0});var nJ=function(r,t,e){var n={},i;e==null||e.forEach(function(a){for(var o=r.parent(a),s,u;o;){if(s=r.parent(o),s?(u=n[s],n[s]=o):(u=i,i=o),u&&u!==o){t.setEdge(u,o);return}o=s}})};k1.default=nJ;var P1={},N1={};Object.defineProperty(N1,"__esModule",{value:!0});var iJ=function(r,t){return t.map(function(e){var n=r.inEdges(e);if(!(n!=null&&n.length))return{v:e};{var i={sum:0,weight:0};return n==null||n.forEach(function(a){var o=r.edge(a),s=r.node(a.v);i.sum+=o.weight*s.order,i.weight+=o.weight}),{v:e,barycenter:i.sum/i.weight,weight:i.weight}}})};N1.default=iJ;var R1={};Object.defineProperty(R1,"__esModule",{value:!0});var aJ=function(r,t){var e,n,i,a={};r==null||r.forEach(function(s,u){a[s.v]={i:u,indegree:0,in:[],out:[],vs:[s.v]};var f=a[s.v];s.barycenter!==void 0&&(f.barycenter=s.barycenter,f.weight=s.weight)}),(e=t.edges())===null||e===void 0||e.forEach(function(s){var u=a[s.v],f=a[s.w];u!==void 0&&f!==void 0&&(f.indegree++,u.out.push(a[s.w]))});var o=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,function(s){return!s.indegree});return oJ(o)},oJ=function(r){for(var t,e,n=[],i=function(f){return function(l){l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&sJ(f,l)}},a=function(f){return function(l){l.in.push(f),--l.indegree===0&&r.push(l)}},o=function(){var f=r.pop();n.push(f),(t=f.in.reverse())===null||t===void 0||t.forEach(function(l){return i(f)(l)}),(e=f.out)===null||e===void 0||e.forEach(function(l){return a(f)(l)})};r!=null&&r.length;)o();var s=n.filter(function(f){return!f.merged}),u=["vs","i","barycenter","weight"];return s.map(function(f){var l={};return u==null||u.forEach(function(c){f[c]!==void 0&&(l[c]=f[c])}),l})},sJ=function(r,t){var e,n=0,i=0;r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),r.vs=(e=t.vs)===null||e===void 0?void 0:e.concat(r.vs),r.barycenter=n/i,r.weight=i,r.i=Math.min(t.i,r.i),t.merged=!0};R1.default=aJ;var B1={};Object.defineProperty(B1,"__esModule",{value:!0});var uJ=ii,fJ=function(r,t,e,n){var i=(0,uJ.partition)(r,function(h){var d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),a=i.lhs,o=i.rhs.sort(function(h,d){return-h.i- -d.i}),s=[],u=0,f=0,l=0;a==null||a.sort(lJ(!!t,!!e)),l=y2(s,o,l),a==null||a.forEach(function(h){var d;l+=(d=h.vs)===null||d===void 0?void 0:d.length,s.push(h.vs),u+=h.barycenter*h.weight,f+=h.weight,l=y2(s,o,l)});var c={vs:s.flat()};return f&&(c.barycenter=u/f,c.weight=f),c},y2=function(r,t,e){for(var n=e,i;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),r==null||r.push(i.vs),n++;return n},lJ=function(r,t){return function(e,n){if(e.fixorder!==void 0&&n.fixorder!==void 0)return e.fixorder-n.fixorder;if(e.barycenter<n.barycenter)return-1;if(e.barycenter>n.barycenter)return 1;if(t&&e.order!==void 0&&n.order!==void 0){if(e.order<n.order)return-1;if(e.order>n.order)return 1}return r?n.i-e.i:e.i-n.i}};B1.default=fJ;var F1=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(P1,"__esModule",{value:!0});var cJ=F1(N1),hJ=F1(R1),dJ=F1(B1),eD=function(r,t,e,n,i,a){var o,s,u,f,l=r.children(t),c=r.node(t),h=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,v={};h&&(l=l==null?void 0:l.filter(function(x){return x!==h&&x!==d}));var p=(0,cJ.default)(r,l||[]);p==null||p.forEach(function(x){var E;if(!((E=r.children(x.v))===null||E===void 0)&&E.length){var w=eD(r,x.v,e,n,a);v[x.v]=w,w.hasOwnProperty("barycenter")&&pJ(x,w)}});var g=(0,hJ.default)(p,e);vJ(g,v),(o=g.filter(function(x){return x.vs.length>0}))===null||o===void 0||o.forEach(function(x){var E=r.node(x.vs[0]);E&&(x.fixorder=E.fixorder,x.order=E.order)});var y=(0,dJ.default)(g,n,i,a);if(h&&(y.vs=[h,y.vs,d].flat(),!((s=r.predecessors(h))===null||s===void 0)&&s.length)){var m=r.node(((u=r.predecessors(h))===null||u===void 0?void 0:u[0])||""),b=r.node(((f=r.predecessors(d))===null||f===void 0?void 0:f[0])||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y},vJ=function(r,t){r==null||r.forEach(function(e){var n,i=(n=e.vs)===null||n===void 0?void 0:n.map(function(a){return t[a]?t[a].vs:a});e.vs=i.flat()})},pJ=function(r,t){r.barycenter!==void 0?(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight):(r.barycenter=t.barycenter,r.weight=t.weight)};P1.default=eD;var ql=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(A1,"__esModule",{value:!0});var m2=ql(T1),b2=ql(L1),gJ=ql(D1),yJ=ql(k1),mJ=ql(P1),x2=Nr(),bJ=Qa,Zg=ii,xJ=function(r,t){for(var e=(0,Zg.maxRank)(r),n=[],i=[],a=1;a<e+1;a++)n.push(a);for(var a=e-1;a>-1;a--)i.push(a);var o=E2(r,n,"inEdges"),s=E2(r,i,"outEdges"),u=(0,m2.default)(r);Qg(r,u);for(var f=Number.POSITIVE_INFINITY,l,a=0,c=0;c<4;++a,++c){w2(a%2?o:s,a%4>=2,!1,t),u=(0,Zg.buildLayerMatrix)(r);var h=(0,b2.default)(r,u);h<f&&(c=0,l=(0,x2.clone)(u),f=h)}u=(0,m2.default)(r),Qg(r,u);for(var a=0,c=0;c<4;++a,++c){w2(a%2?o:s,a%4>=2,!0,t),u=(0,Zg.buildLayerMatrix)(r);var h=(0,b2.default)(r,u);h<f&&(c=0,l=(0,x2.clone)(u),f=h)}Qg(r,l)},E2=function(r,t,e){return t.map(function(n){return(0,gJ.default)(r,n,e)})},w2=function(r,t,e,n){var i=new bJ.Graph;r==null||r.forEach(function(a){for(var o,s=a.graph().root,u=(0,mJ.default)(a,s,i,t,e,n),f=0;f<((o=u.vs)===null||o===void 0?void 0:o.length);f++){var l=a.node(u.vs[f]);l&&(l.order=f)}(0,yJ.default)(a,i,u.vs)})},Qg=function(r,t){t==null||t.forEach(function(e){e==null||e.forEach(function(n,i){r.node(n).order=i})})};A1.default=xJ;var G1={},tD={};(function(r){var t=xe&&xe.__extends||function(){var x=function(E,w){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,M){_.__proto__=M}||function(_,M){for(var C in M)Object.prototype.hasOwnProperty.call(M,C)&&(_[C]=M[C])},x(E,w)};return function(E,w){if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");x(E,w);function _(){this.constructor=E}E.prototype=w===null?Object.create(w):(_.prototype=w.prototype,new _)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.width=r.sep=r.positionX=r.balance=r.alignCoordinates=r.findSmallestWidthAlignment=r.buildBlockGraph=r.horizontalCompaction=r.verticalAlignment=r.hasConflict=r.addConflict=r.findOtherInnerSegmentNode=r.findType2Conflicts=r.findType1Conflicts=void 0;var e=Nv,n=JL,i=ii,a=function(x){t(E,x);function E(){return x!==null&&x.apply(this,arguments)||this}return E}(e.Graph),o=function(x,E){var w={},_=function(M,C){var S=0,A=0,T=M.length,I=C==null?void 0:C[(C==null?void 0:C.length)-1];return C==null||C.forEach(function(D,N){var P,G=(0,r.findOtherInnerSegmentNode)(x,D),W=G?x.node(G).order:T;(G||D===I)&&((P=C.slice(A,N+1))===null||P===void 0||P.forEach(function(k){var R;(R=x.predecessors(k))===null||R===void 0||R.forEach(function(Y){var J,te=x.node(Y),H=te.order;(H<S||W<H)&&!(te.dummy&&(!((J=x.node(k))===null||J===void 0)&&J.dummy))&&(0,r.addConflict)(w,Y,k)})}),A=N+1,S=W)}),C};return E!=null&&E.length&&E.reduce(_),w};r.findType1Conflicts=o;var s=function(x,E){var w={};function _(A,T,I,D,N){for(var P,G,W,k=T;k<I;k++)W=A[k],!((P=x.node(W))===null||P===void 0)&&P.dummy&&((G=x.predecessors(W))===null||G===void 0||G.forEach(function(R){var Y=x.node(R);Y.dummy&&(Y.order<D||Y.order>N)&&(0,r.addConflict)(w,R,W)}))}function M(A){return JSON.stringify(A.slice(1))}function C(A,T){var I=M(A);T.get(I)||(_.apply(void 0,A),T.set(I,!0))}var S=function(A,T){var I=-1,D,N=0,P=new Map;return T==null||T.forEach(function(G,W){var k;if(((k=x.node(G))===null||k===void 0?void 0:k.dummy)==="border"){var R=x.predecessors(G)||[];R.length&&(D=x.node(R[0]).order,C([T,N,W,I,D],P),N=W,I=D)}C([T,N,T.length,D,A.length],P)}),T};return E!=null&&E.length&&E.reduce(S),w};r.findType2Conflicts=s;var u=function(x,E){var w,_;if(!((w=x.node(E))===null||w===void 0)&&w.dummy)return(_=x.predecessors(E))===null||_===void 0?void 0:_.find(function(M){return x.node(M).dummy})};r.findOtherInnerSegmentNode=u;var f=function(x,E,w){var _=E,M=w;if(_>M){var C=_;_=M,M=C}var S=x[_];S||(x[_]=S={}),S[M]=!0};r.addConflict=f;var l=function(x,E,w){var _=E,M=w;if(_>M){var C=E;_=M,M=C}return!!x[_]};r.hasConflict=l;var c=function(x,E,w,_){var M={},C={},S={};return E==null||E.forEach(function(A){A==null||A.forEach(function(T,I){M[T]=T,C[T]=T,S[T]=I})}),E==null||E.forEach(function(A){var T=-1;A==null||A.forEach(function(I){var D=_(I);if(D.length){D=D.sort(function(k,R){return S[k]-S[R]});for(var N=(D.length-1)/2,P=Math.floor(N),G=Math.ceil(N);P<=G;++P){var W=D[P];C[I]===I&&T<S[W]&&!(0,r.hasConflict)(w,I,W)&&(C[W]=I,C[I]=M[I]=M[W],T=S[W])}}})}),{root:M,align:C}};r.verticalAlignment=c;var h=function(x,E,w,_,M){var C,S={},A=(0,r.buildBlockGraph)(x,E,w,M),T=M?"borderLeft":"borderRight",I=function(P,G){for(var W=A.nodes(),k=W.pop(),R={};k;)R[k]?P(k):(R[k]=!0,W.push(k),W=W.concat(G(k))),k=W.pop()},D=function(P){S[P]=(A.inEdges(P)||[]).reduce(function(G,W){return Math.max(G,(S[W.v]||0)+A.edge(W))},0)},N=function(P){var G=(A.outEdges(P)||[]).reduce(function(k,R){return Math.min(k,(S[R.w]||0)-A.edge(R))},Number.POSITIVE_INFINITY),W=x.node(P);G!==Number.POSITIVE_INFINITY&&W.borderType!==T&&(S[P]=Math.max(S[P],G))};return I(D,A.predecessors.bind(A)),I(N,A.successors.bind(A)),(C=Object.values(_))===null||C===void 0||C.forEach(function(P){S[P]=S[w[P]]}),S};r.horizontalCompaction=h;var d=function(x,E,w,_){var M=new a,C=x.graph(),S=(0,r.sep)(C.nodesep,C.edgesep,_);return E==null||E.forEach(function(A){var T;A==null||A.forEach(function(I){var D=w[I];if(M.setNode(D),T){var N=w[T],P=M.edgeFromArgs(N,D);M.setEdge(N,D,Math.max(S(x,I,T),P||0))}T=I})}),M};r.buildBlockGraph=d;var v=function(x,E){return(0,i.minBy)(Object.values(E),function(w){var _,M=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return(_=Object.keys(w))===null||_===void 0||_.forEach(function(S){var A=w[S],T=(0,r.width)(x,S)/2;M=Math.max(A+T,M),C=Math.min(A-T,C)}),M-C})};r.findSmallestWidthAlignment=v;function p(x,E){var w=Object.values(E),_=(0,n.min)(w),M=(0,n.max)(w);["u","d"].forEach(function(C){["l","r"].forEach(function(S){var A=C+S,T=x[A],I;if(T!==E){var D=Object.values(T);I=S==="l"?_-(0,n.min)(D):M-(0,n.max)(D),I&&(x[A]={},Object.keys(T).forEach(function(N){x[A][N]=T[N]+I}))}})})}r.alignCoordinates=p;var g=function(x,E){var w={};return Object.keys(x.ul).forEach(function(_){if(E)w[_]=x[E.toLowerCase()][_];else{var M=Object.values(x).map(function(C){return C[_]});w[_]=(M[0]+M[1])/2}}),w};r.balance=g;var y=function(x){var E=(0,i.buildLayerMatrix)(x),w=Object.assign((0,r.findType1Conflicts)(x,E),(0,r.findType2Conflicts)(x,E)),_={},M;["u","d"].forEach(function(S){M=S==="u"?E:Object.values(E).reverse(),["l","r"].forEach(function(A){A==="r"&&(M=M.map(function(N){return Object.values(N).reverse()}));var T=(S==="u"?x.predecessors:x.successors).bind(x),I=(0,r.verticalAlignment)(x,M,w,T),D=(0,r.horizontalCompaction)(x,M,I.root,I.align,A==="r");A==="r"&&Object.keys(D).forEach(function(N){D[N]=-D[N]}),_[S+A]=D})});var C=(0,r.findSmallestWidthAlignment)(x,_);return p(_,C),(0,r.balance)(_,x.graph().align)};r.positionX=y;var m=function(x,E,w){return function(_,M,C){var S=_.node(M),A=_.node(C),T=0,I;if(T+=S.width/2,S.hasOwnProperty("labelpos"))switch((S.labelpos||"").toLowerCase()){case"l":I=-S.width/2;break;case"r":I=S.width/2;break}if(I&&(T+=w?I:-I),I=0,T+=(S.dummy?E:x)/2,T+=(A.dummy?E:x)/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+=w?I:-I),I=0,T}};r.sep=m;var b=function(x,E){return x.node(E).width||0};r.width=b})(tD);var _2=xe&&xe.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(G1,"__esModule",{value:!0});var z1=ii,as=tD,EJ=function(r){var t=(0,z1.buildLayerMatrix)(r),e=r.graph().ranksep,n=0;t==null||t.forEach(function(i){var a=i.map(function(s){return r.node(s).height}),o=Math.max.apply(Math,_2(_2([],a,!1),[0],!1));i==null||i.forEach(function(s){r.node(s).y=n+o/2}),n+=o+e})},wJ=function(r){var t=(0,z1.buildLayerMatrix)(r),e=Object.assign((0,as.findType1Conflicts)(r,t),(0,as.findType2Conflicts)(r,t)),n={},i=[];["u","d"].forEach(function(o){i=o==="u"?t:Object.values(t).reverse(),["l","r"].forEach(function(s){s==="r"&&(i=i.map(function(c){return Object.values(c).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),f=(0,as.verticalAlignment)(r,i,e,u),l=(0,as.horizontalCompaction)(r,i,f.root,f.align,s==="r");s==="r"&&Object.keys(l).forEach(function(c){return l[c]=-l[c]}),n[o+s]=l})});var a=(0,as.findSmallestWidthAlignment)(r,n);return a&&(0,as.alignCoordinates)(n,a),(0,as.balance)(n,r.graph().align)},_J=function(r){var t,e=(0,z1.asNonCompoundGraph)(r);EJ(e);var n=wJ(e);(t=Object.keys(n))===null||t===void 0||t.forEach(function(i){e.node(i).x=n[i]})};G1.default=_J;var j1={};Object.defineProperty(j1,"__esModule",{value:!0});var SJ=function(r,t){for(var e=r.nodes().filter(function(s){var u;return!(!((u=r.children(s))===null||u===void 0)&&u.length)}),n=e.map(function(s){return r.node(s).rank}),i=Math.max.apply(Math,n),a=[],o=0;o<i+1;o++)a[o]=[];t==null||t.forEach(function(s){var u=r.node(s);!u||u!=null&&u.dummy||isNaN(u.rank)||(u.fixorder=a[u.rank].length,a[u.rank].push(s))})};j1.default=SJ;var Bd=xe&&xe.__assign||function(){return Bd=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Bd.apply(this,arguments)},_a=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(p1,"__esModule",{value:!0});var S2=_a(g1),M2=_a(E1),MJ=_a(w1),va=ii,CJ=_a(_1),C2=_a(S1),AJ=_a(M1),A2=_a(C1),TJ=_a(A1),IJ=_a(G1),OJ=_a(j1),LJ=Qa,DJ=function(r,t){var e=t&&t.debugTiming?va.time:va.notime;e("layout",function(){t&&!t.keepNodeOrder&&t.prevGraph&&e(" inheritOrder",function(){PJ(r,t.prevGraph)});var n=e(" buildLayoutGraph",function(){return UJ(r)});t&&t.edgeLabelSpace===!1||e(" makeSpaceForEdgeLabels",function(){$J(n)});try{e(" runLayout",function(){kJ(n,e,t)})}catch(i){if(i.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:
33
- `,i);return}throw i}e(" updateInputGraph",function(){NJ(r,n)})})},kJ=function(r,t,e){t(" removeSelfEdges",function(){QJ(r)}),t(" acyclic",function(){S2.default.run(r)}),t(" nestingGraph.run",function(){C2.default.run(r)}),t(" rank",function(){(0,MJ.default)((0,va.asNonCompoundGraph)(r))}),t(" injectEdgeLabelProxies",function(){WJ(r)}),t(" removeEmptyRanks",function(){(0,va.removeEmptyRanks)(r)}),t(" nestingGraph.cleanup",function(){C2.default.cleanup(r)}),t(" normalizeRanks",function(){(0,va.normalizeRanks)(r)}),t(" assignRankMinMax",function(){XJ(r)}),t(" removeEdgeLabelProxies",function(){YJ(r)}),t(" normalize.run",function(){M2.default.run(r)}),t(" parentDummyChains",function(){(0,CJ.default)(r)}),t(" addBorderSegments",function(){(0,AJ.default)(r)}),e&&e.keepNodeOrder&&t(" initDataOrder",function(){(0,OJ.default)(r,e.nodeOrder)}),t(" order",function(){(0,TJ.default)(r,e==null?void 0:e.keepNodeOrder)}),t(" insertSelfEdges",function(){JJ(r)}),t(" adjustCoordinateSystem",function(){A2.default.adjust(r)}),t(" position",function(){(0,IJ.default)(r)}),t(" positionSelfEdges",function(){eee(r)}),t(" removeBorderNodes",function(){ZJ(r)}),t(" normalize.undo",function(){M2.default.undo(r)}),t(" fixupEdgeLabelCoords",function(){KJ(r)}),t(" undoCoordinateSystem",function(){A2.default.undo(r)}),t(" translateGraph",function(){VJ(r)}),t(" assignNodeIntersects",function(){HJ(r)}),t(" reversePoints",function(){qJ(r)}),t(" acyclic.undo",function(){S2.default.undo(r)})},PJ=function(r,t){r.nodes().forEach(function(e){var n=r.node(e),i=t.node(e);i!==void 0?(n.fixorder=i._order,delete i._order):delete n.fixorder})},NJ=function(r,t){r.nodes().forEach(function(e){var n,i=r.node(e);if(i){var a=t.node(e);i.x=a.x,i.y=a.y,i._order=a.order,i._rank=a.rank,!((n=t.children(e))===null||n===void 0)&&n.length&&(i.width=a.width,i.height=a.height)}}),r.edges().forEach(function(e){var n=r.edge(e),i=t.edge(e);n.points=i?i.points:[],i&&i.hasOwnProperty("x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=t.graph().width,r.graph().height=t.graph().height},RJ=["nodesep","edgesep","ranksep","marginx","marginy"],BJ={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Jg=["acyclicer","ranker","rankdir","align"],FJ=["width","height","layer","fixorder"],GJ={width:0,height:0},zJ=["minlen","weight","width","height","labeloffset"],jJ={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},e0=["labelpos"],UJ=function(r){var t=new LJ.Graph({multigraph:!0,compound:!0}),e=r0(r.graph()),n={};return Jg==null||Jg.forEach(function(i){e[i]!==void 0&&(n[i]=e[i])}),t.setGraph(Object.assign({},BJ,t0(e,RJ),n)),r.nodes().forEach(function(i){var a=r0(r.node(i)),o=Bd(Bd({},GJ),a),s=t0(o,FJ);t.setNode(i,s),t.setParent(i,r.parent(i))}),r.edges().forEach(function(i){var a=r0(r.edge(i)),o={};e0==null||e0.forEach(function(s){a[s]!==void 0&&(o[s]=a[s])}),t.setEdgeObj(i,Object.assign({},jJ,t0(a,zJ),o))}),t},$J=function(r){var t=r.graph();t.ranksep||(t.ranksep=0),t.ranksep/=2,r.nodes().forEach(function(e){var n=r.node(e);isNaN(n.layer)||n.layer||(n.layer=0)}),r.edges().forEach(function(e){var n,i=r.edge(e);i.minlen*=2,((n=i.labelpos)===null||n===void 0?void 0:n.toLowerCase())!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})},WJ=function(r){r.edges().forEach(function(t){var e=r.edge(t);if(e.width&&e.height){var n=r.node(t.v),i=r.node(t.w),a={e:t,rank:(i.rank-n.rank)/2+n.rank};(0,va.addDummyNode)(r,"edge-proxy",a,"_ep")}})},XJ=function(r){var t=0;r.nodes().forEach(function(e){var n,i,a=r.node(e);a.borderTop&&(a.minRank=(n=r.node(a.borderTop))===null||n===void 0?void 0:n.rank,a.maxRank=(i=r.node(a.borderBottom))===null||i===void 0?void 0:i.rank,t=Math.max(t,a.maxRank||-1/0))}),r.graph().maxRank=t},YJ=function(r){r.nodes().forEach(function(t){var e=r.node(t);e.dummy==="edge-proxy"&&(r.edge(e.e).labelRank=e.rank,r.removeNode(t))})},VJ=function(r){var t,e=0,n,i=0,a=r.graph(),o=a.marginx||0,s=a.marginy||0,u=function(f){if(f){var l=f.x,c=f.y,h=f.width,d=f.height;!isNaN(l)&&!isNaN(h)&&(t===void 0&&(t=l-h/2),t=Math.min(t,l-h/2),e=Math.max(e,l+h/2)),!isNaN(c)&&!isNaN(d)&&(n===void 0&&(n=c-d/2),n=Math.min(n,c-d/2),i=Math.max(i,c+d/2))}};r.nodes().forEach(function(f){u(r.node(f))}),r.edges().forEach(function(f){var l=r.edge(f);l!=null&&l.hasOwnProperty("x")&&u(l)}),t-=o,n-=s,r.nodes().forEach(function(f){var l=r.node(f);l&&(l.x-=t,l.y-=n)}),r.edges().forEach(function(f){var l,c=r.edge(f);(l=c.points)===null||l===void 0||l.forEach(function(h){h.x-=t,h.y-=n}),c.hasOwnProperty("x")&&(c.x-=t),c.hasOwnProperty("y")&&(c.y-=n)}),a.width=e-t+o,a.height=i-n+s},HJ=function(r){r.edges().forEach(function(t){var e=r.edge(t),n=r.node(t.v),i=r.node(t.w),a,o;e.points?(a=e.points[0],o=e.points[e.points.length-1]):(e.points=[],a=i,o=n),e.points.unshift((0,va.intersectRect)(n,a)),e.points.push((0,va.intersectRect)(i,o))})},KJ=function(r){r.edges().forEach(function(t){var e=r.edge(t);if(e!=null&&e.hasOwnProperty("x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})},qJ=function(r){r.edges().forEach(function(t){var e,n=r.edge(t);n.reversed&&((e=n.points)===null||e===void 0||e.reverse())})},ZJ=function(r){r.nodes().forEach(function(t){var e,n,i;if(!((e=r.children(t))===null||e===void 0)&&e.length){var a=r.node(t),o=r.node(a.borderTop),s=r.node(a.borderBottom),u=r.node(a.borderLeft[((n=a.borderLeft)===null||n===void 0?void 0:n.length)-1]),f=r.node(a.borderRight[((i=a.borderRight)===null||i===void 0?void 0:i.length)-1]);a.width=Math.abs((f==null?void 0:f.x)-(u==null?void 0:u.x))||10,a.height=Math.abs((s==null?void 0:s.y)-(o==null?void 0:o.y))||10,a.x=((u==null?void 0:u.x)||0)+a.width/2,a.y=((o==null?void 0:o.y)||0)+a.height/2}}),r.nodes().forEach(function(t){var e;((e=r.node(t))===null||e===void 0?void 0:e.dummy)==="border"&&r.removeNode(t)})},QJ=function(r){r.edges().forEach(function(t){if(t.v===t.w){var e=r.node(t.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:t,label:r.edge(t)}),r.removeEdgeObj(t)}})},JJ=function(r){var t=(0,va.buildLayerMatrix)(r);t==null||t.forEach(function(e){var n=0;e==null||e.forEach(function(i,a){var o,s=r.node(i);s.order=a+n,(o=s.selfEdges)===null||o===void 0||o.forEach(function(u){(0,va.addDummyNode)(r,"selfedge",{width:u.label.width,height:u.label.height,rank:s.rank,order:a+ ++n,e:u.e,label:u.label},"_se")}),delete s.selfEdges})})},eee=function(r){r.nodes().forEach(function(t){var e=r.node(t);if(e.dummy==="selfedge"){var n=r.node(e.e.v),i=n.x+n.width/2,a=n.y,o=e.x-i,s=n.height/2;r.setEdgeObj(e.e,e.label),r.removeNode(t),e.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{y:a,x:i+o},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],e.label.x=e.x,e.label.y=e.y}})},t0=function(r,t){var e={};return t==null||t.forEach(function(n){r[n]!==void 0&&(e[n]=+r[n])}),e},r0=function(r){r===void 0&&(r={});var t={};return Object.keys(r).forEach(function(e){t[e.toLowerCase()]=r[e]}),t};p1.default=DJ;var tee=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(v1,"__esModule",{value:!0});var ree=tee(p1),T2=ii;v1.default={layout:ree.default,util:{time:T2.time,notime:T2.notime}};var nee=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),iee=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.DagreLayout=void 0;var aee=iee(v1),Yn=Nr(),oee=Wr,I2=Qa,see=function(r){nee(t,r);function t(e){var n=r.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.ranksep=50,n.controlPoints=!1,n.sortByCombo=!1,n.edgeLabelSpace=!0,n.radial=!1,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.layoutNode=function(i){var a=n,o=a.nodes,s=o.find(function(f){return f.id===i});if(s){var u=s.layout!==!1;return u}return!0},n.updateCfg(e),n}return t.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}},t.prototype.execute=function(){var e=this,n,i,a,o,s=this,u=s.nodes,f=s.nodeSize,l=s.rankdir,c=s.combos,h=s.begin,d=s.radial,v=s.comboEdges,p=v===void 0?[]:v,g=s.vedges,y=g===void 0?[]:g;if(u){var m=s.edges||[],b=new I2.Graph({multigraph:!0,compound:!0});s.nodeMap={};var x={};u.forEach(function(ie){s.nodeMap[ie.id]=ie,ie.comboId&&(x[ie.comboId]=x[ie.comboId]||[],x[ie.comboId].push(ie.id))});var E=[],w={};!((n=s.nodeOrder)===null||n===void 0)&&n.length?(s.nodeOrder.forEach(function(ie){w[ie]=!0,E.push(s.nodeMap[ie])}),u.forEach(function(ie){w[ie.id]||E.push(ie)})):E=u;var _;f?(0,Yn.isArray)(f)?_=function(){return f}:_=function(){return[f,f]}:_=function(ie){return ie.size?(0,Yn.isArray)(ie.size)?ie.size:(0,Yn.isObject)(ie.size)?[ie.size.width||40,ie.size.height||40]:[ie.size,ie.size]:[40,40]};var M=(0,Yn.getFunc)(s.ranksep,50,s.ranksepFunc),C=(0,Yn.getFunc)(s.nodesep,50,s.nodesepFunc),S=C,A=M;(l==="LR"||l==="RL")&&(S=M,A=C),b.setDefaultEdgeLabel(function(){return{}}),b.setGraph(s);var T={};this.sortByCombo&&c&&c.forEach(function(ie){if(T[ie.id]=ie,ie.collapsed){var L=_(ie),_e=A(ie),Be=S(ie),ye=L[0]+2*Be,$e=L[1]+2*_e;b.setNode(ie.id,{width:ye,height:$e})}ie.parentId&&(T[ie.parentId]||b.setNode(ie.parentId,{}),b.setParent(ie.id,ie.parentId))}),E.filter(function(ie){return ie.layout!==!1}).forEach(function(ie){var L=_(ie),_e=A(ie),Be=S(ie),ye=L[0]+2*Be,$e=L[1]+2*_e,We=ie.layer;(0,Yn.isNumber)(We)?b.setNode(ie.id,{width:ye,height:$e,layer:We}):b.setNode(ie.id,{width:ye,height:$e}),e.sortByCombo&&ie.comboId&&(T[ie.comboId]||(T[ie.comboId]={id:ie.comboId},b.setNode(ie.comboId,{})),b.setParent(ie.id,ie.comboId))}),m.forEach(function(ie){var L=(0,Yn.getEdgeTerminal)(ie,"source"),_e=(0,Yn.getEdgeTerminal)(ie,"target");e.layoutNode(L)&&e.layoutNode(_e)&&b.setEdge(L,_e,{weight:ie.weight||1})}),(i=p==null?void 0:p.concat(y||[]))===null||i===void 0||i.forEach(function(ie){var L,_e,Be=ie.source,ye=ie.target,$e=!((L=T[Be])===null||L===void 0)&&L.collapsed?[Be]:x[Be]||[Be],We=!((_e=T[ye])===null||_e===void 0)&&_e.collapsed?[ye]:x[ye]||[ye];$e.forEach(function(Ke){We.forEach(function(Qe){b.setEdge(Ke,Qe,{weight:ie.weight||1})})})});var I=void 0;!((a=s.preset)===null||a===void 0)&&a.nodes&&(I=new I2.Graph({multigraph:!0,compound:!0}),s.preset.nodes.forEach(function(ie){I==null||I.setNode(ie.id,ie)})),aee.default.layout(b,{prevGraph:I,edgeLabelSpace:s.edgeLabelSpace,keepNodeOrder:!!s.nodeOrder,nodeOrder:s.nodeOrder});var D=[0,0];if(h){var N=1/0,P=1/0;b.nodes().forEach(function(ie){var L=b.node(ie);N>L.x&&(N=L.x),P>L.y&&(P=L.y)}),b.edges().forEach(function(ie){var L,_e=b.edge(ie);(L=_e.points)===null||L===void 0||L.forEach(function(Be){N>Be.x&&(N=Be.x),P>Be.y&&(P=Be.y)})}),D[0]=h[0]-N,D[1]=h[1]-P}var G=l==="LR"||l==="RL";if(d){var W=this,k=W.focusNode,R=W.ranksep,Y=W.getRadialPos,J=(0,Yn.isString)(k)?k:k==null?void 0:k.id,te=J?(o=b.node(J))===null||o===void 0?void 0:o._rank:0,H=[],pe=G?"y":"x",Ae=G?"height":"width",Le=1/0,qe=-1/0;b.nodes().forEach(function(ie){var L=b.node(ie);if(s.nodeMap[ie]){var _e=C(s.nodeMap[ie]);if(te===0)H[L._rank]||(H[L._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),H[L._rank].nodes.push(ie),H[L._rank].totalWidth+=_e*2+L[Ae],H[L._rank].maxSize<Math.max(L.width,L.height)&&(H[L._rank].maxSize=Math.max(L.width,L.height));else{var Be=L._rank-te;if(Be===0)H[Be]||(H[Be]={nodes:[],totalWidth:0,maxSize:-1/0}),H[Be].nodes.push(ie),H[Be].totalWidth+=_e*2+L[Ae],H[Be].maxSize<Math.max(L.width,L.height)&&(H[Be].maxSize=Math.max(L.width,L.height));else{var ye=Math.abs(Be);H[ye]||(H[ye]={left:[],right:[],totalWidth:0,maxSize:-1/0}),H[ye].totalWidth+=_e*2+L[Ae],H[ye].maxSize<Math.max(L.width,L.height)&&(H[ye].maxSize=Math.max(L.width,L.height)),Be<0?H[ye].left.push(ie):H[ye].right.push(ie)}}var $e=L[pe]-L[Ae]/2-_e,We=L[pe]+L[Ae]/2+_e;$e<Le&&(Le=$e),We>qe&&(qe=We)}});var at=R||50,rt={},xt=(qe-Le)/.9,Et=[(Le+qe-xt)*.5,(Le+qe+xt)*.5],ur=function(ie,L,_e,Be){_e===void 0&&(_e=-1/0),Be===void 0&&(Be=[0,1]);var ye=_e;return ie.forEach(function($e){var We=b.node($e);rt[$e]=L;var Ke=Y(We[pe],Et,xt,L,Be),Qe=Ke.x,vt=Ke.y;if(s.nodeMap[$e]){s.nodeMap[$e].x=Qe+D[0],s.nodeMap[$e].y=vt+D[1],s.nodeMap[$e]._order=We._order;var Dt=M(s.nodeMap[$e]);ye<Dt&&(ye=Dt)}}),ye},Bt=!0,Ut=0;H.forEach(function(ie){var L,_e,Be,ye,$e,We,Ke;if(!(!(!((L=ie==null?void 0:ie.nodes)===null||L===void 0)&&L.length)&&!(!((_e=ie==null?void 0:ie.left)===null||_e===void 0)&&_e.length)&&!(!((Be=ie==null?void 0:ie.right)===null||Be===void 0)&&Be.length))){if(Bt&&ie.nodes.length===1){var Qe=ie.nodes[0];if(!s.nodeMap[Qe])return;s.nodeMap[Qe].x=D[0],s.nodeMap[Qe].y=D[1],rt[ie.nodes[0]]=0,at=M(s.nodeMap[Qe]),Bt=!1;return}at=Math.max(at,ie.totalWidth/(2*Math.PI));var vt=-1/0;if(te===0||!((ye=ie.nodes)===null||ye===void 0)&&ye.length)vt=ur(ie.nodes,at,vt,[0,1]);else{var Dt=(($e=ie.left)===null||$e===void 0?void 0:$e.length)/(((We=ie.left)===null||We===void 0?void 0:We.length)+((Ke=ie.right)===null||Ke===void 0?void 0:Ke.length));vt=ur(ie.left,at,vt,[0,Dt]),vt=ur(ie.right,at,vt,[Dt+.05,1])}at+=vt,Bt=!1,Ut-ie.maxSize}}),b.edges().forEach(function(ie){var L,_e,Be,ye=b.edge(ie),$e=m.findIndex(function(hr){var or=(0,Yn.getEdgeTerminal)(hr,"source"),gr=(0,Yn.getEdgeTerminal)(hr,"target");return or===ie.v&&gr===ie.w});if(!($e<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[$e].type!=="loop"){var We=pe==="x"?"y":"x",Ke=(L=ye==null?void 0:ye.points)===null||L===void 0?void 0:L.slice(1,ye.points.length-1),Qe=[],vt=(_e=b.node(ie.v))===null||_e===void 0?void 0:_e[We],Dt=vt-((Be=b.node(ie.w))===null||Be===void 0?void 0:Be[We]),lr=rt[ie.v],kt=lr-rt[ie.w];Ke==null||Ke.forEach(function(hr){var or=(hr[We]-vt)/Dt*kt+lr,gr=Y(hr[pe],Et,xt,or);Qe.push({x:gr.x+D[0],y:gr.y+D[1]})}),m[$e].controlPoints=Qe}})}else{var dr=new Set,fr=l==="BT"||l==="RL",Gt=fr?function(ie,L){return L-ie}:function(ie,L){return ie-L};b.nodes().forEach(function(ie){var L=b.node(ie);if(L){var _e=e.nodeMap[ie];_e||(_e=c==null?void 0:c.find(function(Be){return Be.id===ie})),_e&&(_e.x=L.x+D[0],_e.y=L.y+D[1],_e._order=L._order,dr.add(G?_e.x:_e.y))}});var Jt=Array.from(dr).sort(Gt),Rr=G?function(ie,L){return ie.x!==L.x}:function(ie,L){return ie.y!==L.y},tt=G?function(ie,L,_e){var Be=Math.max(L.y,_e.y),ye=Math.min(L.y,_e.y);return ie.filter(function($e){return $e.y<=Be&&$e.y>=ye})}:function(ie,L,_e){var Be=Math.max(L.x,_e.x),ye=Math.min(L.x,_e.x);return ie.filter(function($e){return $e.x<=Be&&$e.x>=ye})};b.edges().forEach(function(ie){var L,_e=b.edge(ie),Be=m.findIndex(function(We){var Ke=(0,Yn.getEdgeTerminal)(We,"source"),Qe=(0,Yn.getEdgeTerminal)(We,"target");return Ke===ie.v&&Qe===ie.w});if(!(Be<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Be].type!=="loop"){(L=_e==null?void 0:_e.points)===null||L===void 0||L.forEach(function(We){We.x+=D[0],We.y+=D[1]});var ye=s.nodeMap[ie.v],$e=s.nodeMap[ie.w];m[Be].controlPoints=uee(_e==null?void 0:_e.points,ye,$e,Jt,G,Rr,tt)}})}return s.onLayoutEnd&&s.onLayoutEnd(),{nodes:u,edges:m}}},t.prototype.getRadialPos=function(e,n,i,a,o){o===void 0&&(o=[0,1]);var s=(e-n[0])/i;s=s*(o[1]-o[0])+o[0];var u=s*2*Math.PI;return{x:Math.cos(u)*a,y:Math.sin(u)*a}},t.prototype.getType=function(){return"dagre"},t}(oee.Base);Ju.DagreLayout=see;var uee=function(r,t,e,n,i,a,o){var s=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){var u=t.x,f=t.y,l=e.x,c=e.y;if(i&&(u=t.y,f=t.x,l=e.y,c=e.x),c!==f&&u!==l){var h=n.indexOf(f),d=n[h+1];if(d){var v=s[0],p=i?{x:(f+d)/2,y:(v==null?void 0:v.y)||l}:{x:(v==null?void 0:v.x)||l,y:(f+d)/2};(!v||a(v,p))&&s.unshift(p)}var g=n.indexOf(c),y=Math.abs(g-h);if(y===1)s=o(s,t,e),s.length||s.push(i?{x:(f+c)/2,y:u}:{x:u,y:(f+c)/2});else if(y>1){var m=n[g-1];if(m){var b=s[s.length-1],x=i?{x:(c+m)/2,y:(b==null?void 0:b.y)||l}:{x:(b==null?void 0:b.x)||u,y:(c+m)/2};(!b||a(b,x))&&s.push(x)}}}}return s},Zl={};const Fd={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 ky(r={},t=Fd){var e,n,i,a;const o=JSON.parse(JSON.stringify(t)),s=((e=r==null?void 0:r.graph)===null||e===void 0?void 0:e.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 rD(r){return`◬${r}◬`}const Wu=rD("ROOT"),nD=rD("BRIDGE_GRAPH");var Bn,Os,Xu,Py;(function(r){r[r.META=0]="META",r[r.NODE=1]="NODE",r[r.BRIDGE=2]="BRIDGE"})(Bn||(Bn={})),function(r){r[r.INCLUDE=0]="INCLUDE",r[r.EXCLUDE=1]="EXCLUDE",r[r.UNSPECIFIED=2]="UNSPECIFIED"}(Os||(Os={})),function(r){r[r.META=0]="META",r[r.CORE=1]="CORE",r[r.BRIDGE=2]="BRIDGE"}(Xu||(Xu={})),function(r){r[r.META=0]="META",r[r.OP=1]="OP",r[r.SERIES=2]="SERIES"}(Py||(Py={}));var bh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function U1(r,t){return r(t={exports:{}},t.exports),t.exports}var fee=function(){this.__data__=[],this.size=0},tf=function(r,t){return r===t||r!=r&&t!=t},Gv=function(r,t){for(var e=r.length;e--;)if(tf(r[e][0],t))return e;return-1},lee=Array.prototype.splice,cee=function(r){var t=this.__data__,e=Gv(t,r);return!(e<0)&&(e==t.length-1?t.pop():lee.call(t,e,1),--this.size,!0)},hee=function(r){var t=this.__data__,e=Gv(t,r);return e<0?void 0:t[e][1]},dee=function(r){return Gv(this.__data__,r)>-1},vee=function(r,t){var e=this.__data__,n=Gv(e,r);return n<0?(++this.size,e.push([r,t])):e[n][1]=t,this};function pu(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}pu.prototype.clear=fee,pu.prototype.delete=cee,pu.prototype.get=hee,pu.prototype.has=dee,pu.prototype.set=vee;var zv=pu,pee=function(){this.__data__=new zv,this.size=0},gee=function(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e},yee=function(r){return this.__data__.get(r)},mee=function(r){return this.__data__.has(r)},iD=typeof bh=="object"&&bh&&bh.Object===Object&&bh,bee=typeof self=="object"&&self&&self.Object===Object&&self,zi=iD||bee||Function("return this")(),bi=zi.Symbol,aD=Object.prototype,xee=aD.hasOwnProperty,Eee=aD.toString,Cf=bi?bi.toStringTag:void 0,wee=function(r){var t=xee.call(r,Cf),e=r[Cf];try{r[Cf]=void 0;var n=!0}catch{}var i=Eee.call(r);return n&&(t?r[Cf]=e:delete r[Cf]),i},_ee=Object.prototype.toString,See=function(r){return _ee.call(r)},O2=bi?bi.toStringTag:void 0,zo=function(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":O2&&O2 in Object(r)?wee(r):See(r)},zn=function(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")},L2,Ql=function(r){if(!zn(r))return!1;var t=zo(r);return t=="[object Function]"||t=="[object GeneratorFunction]"||t=="[object AsyncFunction]"||t=="[object Proxy]"},n0=zi["__core-js_shared__"],D2=(L2=/[^.]+$/.exec(n0&&n0.keys&&n0.keys.IE_PROTO||""))?"Symbol(src)_1."+L2:"",Mee=function(r){return!!D2&&D2 in r},Cee=Function.prototype.toString,Rs=function(r){if(r!=null){try{return Cee.call(r)}catch{}try{return r+""}catch{}}return""},Aee=/^\[object .+?Constructor\]$/,Tee=Function.prototype,Iee=Object.prototype,Oee=Tee.toString,Lee=Iee.hasOwnProperty,Dee=RegExp("^"+Oee.call(Lee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kee=function(r){return!(!zn(r)||Mee(r))&&(Ql(r)?Dee:Aee).test(Rs(r))},Pee=function(r,t){return r==null?void 0:r[t]},Bs=function(r,t){var e=Pee(r,t);return kee(e)?e:void 0},Al=Bs(zi,"Map"),Tl=Bs(Object,"create"),Nee=function(){this.__data__=Tl?Tl(null):{},this.size=0},Ree=function(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t},Bee=Object.prototype.hasOwnProperty,Fee=function(r){var t=this.__data__;if(Tl){var e=t[r];return e==="__lodash_hash_undefined__"?void 0:e}return Bee.call(t,r)?t[r]:void 0},Gee=Object.prototype.hasOwnProperty,zee=function(r){var t=this.__data__;return Tl?t[r]!==void 0:Gee.call(t,r)},jee=function(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=Tl&&t===void 0?"__lodash_hash_undefined__":t,this};function gu(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}gu.prototype.clear=Nee,gu.prototype.delete=Ree,gu.prototype.get=Fee,gu.prototype.has=zee,gu.prototype.set=jee;var k2=gu,Uee=function(){this.size=0,this.__data__={hash:new k2,map:new(Al||zv),string:new k2}},$ee=function(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null},jv=function(r,t){var e=r.__data__;return $ee(t)?e[typeof t=="string"?"string":"hash"]:e.map},Wee=function(r){var t=jv(this,r).delete(r);return this.size-=t?1:0,t},Xee=function(r){return jv(this,r).get(r)},Yee=function(r){return jv(this,r).has(r)},Vee=function(r,t){var e=jv(this,r),n=e.size;return e.set(r,t),this.size+=e.size==n?0:1,this};function yu(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}yu.prototype.clear=Uee,yu.prototype.delete=Wee,yu.prototype.get=Xee,yu.prototype.has=Yee,yu.prototype.set=Vee;var Uv=yu,Hee=function(r,t){var e=this.__data__;if(e instanceof zv){var n=e.__data__;if(!Al||n.length<199)return n.push([r,t]),this.size=++e.size,this;e=this.__data__=new Uv(n)}return e.set(r,t),this.size=e.size,this};function mu(r){var t=this.__data__=new zv(r);this.size=t.size}mu.prototype.clear=pee,mu.prototype.delete=gee,mu.prototype.get=yee,mu.prototype.has=mee,mu.prototype.set=Hee;var Iu=mu,$1=function(r,t){for(var e=-1,n=r==null?0:r.length;++e<n&&t(r[e],e,r)!==!1;);return r},Gd=function(){try{var r=Bs(Object,"defineProperty");return r({},"",{}),r}catch{}}(),$v=function(r,t,e){t=="__proto__"&&Gd?Gd(r,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):r[t]=e},Kee=Object.prototype.hasOwnProperty,Wv=function(r,t,e){var n=r[t];Kee.call(r,t)&&tf(n,e)&&(e!==void 0||t in r)||$v(r,t,e)},Jl=function(r,t,e,n){var i=!e;e||(e={});for(var a=-1,o=t.length;++a<o;){var s=t[a],u=n?n(e[s],r[s],s,e,r):void 0;u===void 0&&(u=r[s]),i?$v(e,s,u):Wv(e,s,u)}return e},qee=function(r,t){for(var e=-1,n=Array(r);++e<r;)n[e]=t(e);return n},Ni=function(r){return r!=null&&typeof r=="object"},P2=function(r){return Ni(r)&&zo(r)=="[object Arguments]"},oD=Object.prototype,Zee=oD.hasOwnProperty,Qee=oD.propertyIsEnumerable,Yu=P2(function(){return arguments}())?P2:function(r){return Ni(r)&&Zee.call(r,"callee")&&!Qee.call(r,"callee")},$r=Array.isArray,Jee=function(){return!1},Ls=U1(function(r,t){var e=t&&!t.nodeType&&t,n=e&&r&&!r.nodeType&&r,i=n&&n.exports===e?zi.Buffer:void 0,a=(i?i.isBuffer:void 0)||Jee;r.exports=a}),ete=/^(?:0|[1-9]\d*)$/,Xv=function(r,t){var e=typeof r;return!!(t=t==null?9007199254740991:t)&&(e=="number"||e!="symbol"&&ete.test(r))&&r>-1&&r%1==0&&r<t},W1=function(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=9007199254740991},Sr={};Sr["[object Float32Array]"]=Sr["[object Float64Array]"]=Sr["[object Int8Array]"]=Sr["[object Int16Array]"]=Sr["[object Int32Array]"]=Sr["[object Uint8Array]"]=Sr["[object Uint8ClampedArray]"]=Sr["[object Uint16Array]"]=Sr["[object Uint32Array]"]=!0,Sr["[object Arguments]"]=Sr["[object Array]"]=Sr["[object ArrayBuffer]"]=Sr["[object Boolean]"]=Sr["[object DataView]"]=Sr["[object Date]"]=Sr["[object Error]"]=Sr["[object Function]"]=Sr["[object Map]"]=Sr["[object Number]"]=Sr["[object Object]"]=Sr["[object RegExp]"]=Sr["[object Set]"]=Sr["[object String]"]=Sr["[object WeakMap]"]=!1;var tte=function(r){return Ni(r)&&W1(r.length)&&!!Sr[zo(r)]},Yv=function(r){return function(t){return r(t)}},Vu=U1(function(r,t){var e=t&&!t.nodeType&&t,n=e&&r&&!r.nodeType&&r,i=n&&n.exports===e&&iD.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}),N2=Vu&&Vu.isTypedArray,ec=N2?Yv(N2):tte,rte=Object.prototype.hasOwnProperty,sD=function(r,t){var e=$r(r),n=!e&&Yu(r),i=!e&&!n&&Ls(r),a=!e&&!n&&!i&&ec(r),o=e||n||i||a,s=o?qee(r.length,String):[],u=s.length;for(var f in r)!t&&!rte.call(r,f)||o&&(f=="length"||i&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Xv(f,u))||s.push(f);return s},nte=Object.prototype,Vv=function(r){var t=r&&r.constructor;return r===(typeof t=="function"&&t.prototype||nte)},uD=function(r,t){return function(e){return r(t(e))}},ite=uD(Object.keys,Object),ate=Object.prototype.hasOwnProperty,X1=function(r){if(!Vv(r))return ite(r);var t=[];for(var e in Object(r))ate.call(r,e)&&e!="constructor"&&t.push(e);return t},eo=function(r){return r!=null&&W1(r.length)&&!Ql(r)},jo=function(r){return eo(r)?sD(r):X1(r)},ote=function(r,t){return r&&Jl(t,jo(t),r)},ste=function(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t},ute=Object.prototype.hasOwnProperty,fte=function(r){if(!zn(r))return ste(r);var t=Vv(r),e=[];for(var n in r)(n!="constructor"||!t&&ute.call(r,n))&&e.push(n);return e},Fs=function(r){return eo(r)?sD(r,!0):fte(r)},lte=function(r,t){return r&&Jl(t,Fs(t),r)},fD=U1(function(r,t){var e=t&&!t.nodeType&&t,n=e&&r&&!r.nodeType&&r,i=n&&n.exports===e?zi.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}}),lD=function(r,t){var e=-1,n=r.length;for(t||(t=Array(n));++e<n;)t[e]=r[e];return t},cD=function(r,t){for(var e=-1,n=r==null?0:r.length,i=0,a=[];++e<n;){var o=r[e];t(o,e,r)&&(a[i++]=o)}return a},hD=function(){return[]},cte=Object.prototype.propertyIsEnumerable,R2=Object.getOwnPropertySymbols,Y1=R2?function(r){return r==null?[]:(r=Object(r),cD(R2(r),function(t){return cte.call(r,t)}))}:hD,hte=function(r,t){return Jl(r,Y1(r),t)},V1=function(r,t){for(var e=-1,n=t.length,i=r.length;++e<n;)r[i+e]=t[e];return r},Hv=uD(Object.getPrototypeOf,Object),dD=Object.getOwnPropertySymbols?function(r){for(var t=[];r;)V1(t,Y1(r)),r=Hv(r);return t}:hD,dte=function(r,t){return Jl(r,dD(r),t)},vD=function(r,t,e){var n=t(r);return $r(r)?n:V1(n,e(r))},Ny=function(r){return vD(r,jo,Y1)},vte=function(r){return vD(r,Fs,dD)},Ry=Bs(zi,"DataView"),By=Bs(zi,"Promise"),Ou=Bs(zi,"Set"),Fy=Bs(zi,"WeakMap"),pte=Rs(Ry),gte=Rs(Al),yte=Rs(By),mte=Rs(Ou),bte=Rs(Fy),cs=zo;(Ry&&cs(new Ry(new ArrayBuffer(1)))!="[object DataView]"||Al&&cs(new Al)!="[object Map]"||By&&cs(By.resolve())!="[object Promise]"||Ou&&cs(new Ou)!="[object Set]"||Fy&&cs(new Fy)!="[object WeakMap]")&&(cs=function(r){var t=zo(r),e=t=="[object Object]"?r.constructor:void 0,n=e?Rs(e):"";if(n)switch(n){case pte:return"[object DataView]";case gte:return"[object Map]";case yte:return"[object Promise]";case mte:return"[object Set]";case bte:return"[object WeakMap]"}return t});var Ds=cs,xte=Object.prototype.hasOwnProperty,Ete=function(r){var t=r.length,e=new r.constructor(t);return t&&typeof r[0]=="string"&&xte.call(r,"index")&&(e.index=r.index,e.input=r.input),e},zd=zi.Uint8Array,H1=function(r){var t=new r.constructor(r.byteLength);return new zd(t).set(new zd(r)),t},wte=function(r,t){var e=t?H1(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.byteLength)},_te=/\w*$/,Ste=function(r){var t=new r.constructor(r.source,_te.exec(r));return t.lastIndex=r.lastIndex,t},B2=bi?bi.prototype:void 0,F2=B2?B2.valueOf:void 0,Mte=function(r){return F2?Object(F2.call(r)):{}},pD=function(r,t){var e=t?H1(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length)},Cte=function(r,t,e){var n=r.constructor;switch(t){case"[object ArrayBuffer]":return H1(r);case"[object Boolean]":case"[object Date]":return new n(+r);case"[object DataView]":return wte(r,e);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 pD(r,e);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(r);case"[object RegExp]":return Ste(r);case"[object Set]":return new n;case"[object Symbol]":return Mte(r)}},G2=Object.create,gD=function(){function r(){}return function(t){if(!zn(t))return{};if(G2)return G2(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}(),yD=function(r){return typeof r.constructor!="function"||Vv(r)?{}:gD(Hv(r))},Ate=function(r){return Ni(r)&&Ds(r)=="[object Map]"},z2=Vu&&Vu.isMap,Tte=z2?Yv(z2):Ate,Ite=function(r){return Ni(r)&&Ds(r)=="[object Set]"},j2=Vu&&Vu.isSet,Ote=j2?Yv(j2):Ite,Er={};Er["[object Arguments]"]=Er["[object Array]"]=Er["[object ArrayBuffer]"]=Er["[object DataView]"]=Er["[object Boolean]"]=Er["[object Date]"]=Er["[object Float32Array]"]=Er["[object Float64Array]"]=Er["[object Int8Array]"]=Er["[object Int16Array]"]=Er["[object Int32Array]"]=Er["[object Map]"]=Er["[object Number]"]=Er["[object Object]"]=Er["[object RegExp]"]=Er["[object Set]"]=Er["[object String]"]=Er["[object Symbol]"]=Er["[object Uint8Array]"]=Er["[object Uint8ClampedArray]"]=Er["[object Uint16Array]"]=Er["[object Uint32Array]"]=!0,Er["[object Error]"]=Er["[object Function]"]=Er["[object WeakMap]"]=!1;var mD=function r(t,e,n,i,a,o){var s,u=1&e,f=2&e,l=4&e;if(n&&(s=a?n(t,i,a,o):n(t)),s!==void 0)return s;if(!zn(t))return t;var c=$r(t);if(c){if(s=Ete(t),!u)return lD(t,s)}else{var h=Ds(t),d=h=="[object Function]"||h=="[object GeneratorFunction]";if(Ls(t))return fD(t,u);if(h=="[object Object]"||h=="[object Arguments]"||d&&!a){if(s=f||d?{}:yD(t),!u)return f?dte(t,lte(s,t)):hte(t,ote(s,t))}else{if(!Er[h])return a?t:{};s=Cte(t,h,u)}}o||(o=new Iu);var v=o.get(t);if(v)return v;o.set(t,s),Ote(t)?t.forEach(function(g){s.add(r(g,e,n,g,t,o))}):Tte(t)&&t.forEach(function(g,y){s.set(y,r(g,e,n,y,t,o))});var p=c?void 0:(l?f?vte:Ny:f?Fs:jo)(t);return $1(p||t,function(g,y){p&&(g=t[y=g]),Wv(s,y,r(g,e,n,y,t,o))}),s},Lte=function(r){return mD(r,4)},K1=function(r){return function(){return r}},q1=function(r){return function(t,e,n){for(var i=-1,a=Object(t),o=n(t),s=o.length;s--;){var u=o[r?s:++i];if(e(a[u],u,a)===!1)break}return t}}(),Z1=function(r,t){return r&&q1(r,t,jo)},Kv=function(r,t){return function(e,n){if(e==null)return e;if(!eo(e))return r(e,n);for(var i=e.length,a=t?i:-1,o=Object(e);(t?a--:++a<i)&&n(o[a],a,o)!==!1;);return e}}(Z1),Gs=function(r){return r},bD=function(r){return typeof r=="function"?r:Gs},xD=function(r,t){return($r(r)?$1:Kv)(r,bD(t))},ED=xD,Dte=function(r,t){var e=[];return Kv(r,function(n,i,a){t(n,i,a)&&e.push(n)}),e},kte=function(r){return this.__data__.set(r,"__lodash_hash_undefined__"),this},Pte=function(r){return this.__data__.has(r)};function ed(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new Uv;++t<e;)this.add(r[t])}ed.prototype.add=ed.prototype.push=kte,ed.prototype.has=Pte;var wD=ed,Nte=function(r,t){for(var e=-1,n=r==null?0:r.length;++e<n;)if(t(r[e],e,r))return!0;return!1},_D=function(r,t){return r.has(t)},SD=function(r,t,e,n,i,a){var o=1&e,s=r.length,u=t.length;if(s!=u&&!(o&&u>s))return!1;var f=a.get(r),l=a.get(t);if(f&&l)return f==t&&l==r;var c=-1,h=!0,d=2&e?new wD:void 0;for(a.set(r,t),a.set(t,r);++c<s;){var v=r[c],p=t[c];if(n)var g=o?n(p,v,c,t,r,a):n(v,p,c,r,t,a);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!Nte(t,function(y,m){if(!_D(d,m)&&(v===y||i(v,y,e,n,a)))return d.push(m)})){h=!1;break}}else if(v!==p&&!i(v,p,e,n,a)){h=!1;break}}return a.delete(r),a.delete(t),h},Rte=function(r){var t=-1,e=Array(r.size);return r.forEach(function(n,i){e[++t]=[i,n]}),e},Q1=function(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=n}),e},U2=bi?bi.prototype:void 0,i0=U2?U2.valueOf:void 0,Bte=function(r,t,e,n,i,a,o){switch(e){case"[object DataView]":if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(r.byteLength!=t.byteLength||!a(new zd(r),new zd(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return tf(+r,+t);case"[object Error]":return r.name==t.name&&r.message==t.message;case"[object RegExp]":case"[object String]":return r==t+"";case"[object Map]":var s=Rte;case"[object Set]":var u=1&n;if(s||(s=Q1),r.size!=t.size&&!u)return!1;var f=o.get(r);if(f)return f==t;n|=2,o.set(r,t);var l=SD(s(r),s(t),n,i,a,o);return o.delete(r),l;case"[object Symbol]":if(i0)return i0.call(r)==i0.call(t)}return!1},Fte=Object.prototype.hasOwnProperty,Gte=function(r,t,e,n,i,a){var o=1&e,s=Ny(r),u=s.length;if(u!=Ny(t).length&&!o)return!1;for(var f=u;f--;){var l=s[f];if(!(o?l in t:Fte.call(t,l)))return!1}var c=a.get(r),h=a.get(t);if(c&&h)return c==t&&h==r;var d=!0;a.set(r,t),a.set(t,r);for(var v=o;++f<u;){var p=r[l=s[f]],g=t[l];if(n)var y=o?n(g,p,l,t,r,a):n(p,g,l,r,t,a);if(!(y===void 0?p===g||i(p,g,e,n,a):y)){d=!1;break}v||(v=l=="constructor")}if(d&&!v){var m=r.constructor,b=t.constructor;m==b||!("constructor"in r)||!("constructor"in t)||typeof m=="function"&&m instanceof m&&typeof b=="function"&&b instanceof b||(d=!1)}return a.delete(r),a.delete(t),d},$2=Object.prototype.hasOwnProperty,zte=function(r,t,e,n,i,a){var o=$r(r),s=$r(t),u=o?"[object Array]":Ds(r),f=s?"[object Array]":Ds(t),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&&Ls(r)){if(!Ls(t))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new Iu),o||ec(r)?SD(r,t,e,n,i,a):Bte(r,t,u,e,n,i,a);if(!(1&e)){var d=l&&$2.call(r,"__wrapped__"),v=c&&$2.call(t,"__wrapped__");if(d||v){var p=d?r.value():r,g=v?t.value():t;return a||(a=new Iu),i(p,g,e,n,a)}}return!!h&&(a||(a=new Iu),Gte(r,t,e,n,i,a))},MD=function r(t,e,n,i,a){return t===e||(t==null||e==null||!Ni(t)&&!Ni(e)?t!=t&&e!=e:zte(t,e,n,i,r,a))},jte=function(r,t,e,n){var i=e.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var s=e[i];if(o&&s[2]?s[1]!==r[s[0]]:!(s[0]in r))return!1}for(;++i<a;){var u=(s=e[i])[0],f=r[u],l=s[1];if(o&&s[2]){if(f===void 0&&!(u in r))return!1}else{var c=new Iu;if(n)var h=n(f,l,u,r,t,c);if(!(h===void 0?MD(l,f,3,n,c):h))return!1}}return!0},CD=function(r){return r==r&&!zn(r)},Ute=function(r){for(var t=jo(r),e=t.length;e--;){var n=t[e],i=r[n];t[e]=[n,i,CD(i)]}return t},AD=function(r,t){return function(e){return e!=null&&e[r]===t&&(t!==void 0||r in Object(e))}},$te=function(r){var t=Ute(r);return t.length==1&&t[0][2]?AD(t[0][0],t[0][1]):function(e){return e===r||jte(e,r,t)}},ks=function(r){return typeof r=="symbol"||Ni(r)&&zo(r)=="[object Symbol]"},Wte=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xte=/^\w*$/,J1=function(r,t){if($r(r))return!1;var e=typeof r;return!(e!="number"&&e!="symbol"&&e!="boolean"&&r!=null&&!ks(r))||Xte.test(r)||!Wte.test(r)||t!=null&&r in Object(t)};function eb(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");var e=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=e.cache;if(a.has(i))return a.get(i);var o=r.apply(this,n);return e.cache=a.set(i,o)||a,o};return e.cache=new(eb.Cache||Uv),e}eb.Cache=Uv;var Yte=eb,Vte=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hte=/\\(\\)?/g,Kte=function(r){var t=Yte(r,function(n){return e.size===500&&e.clear(),n}),e=t.cache;return t}(function(r){var t=[];return r.charCodeAt(0)===46&&t.push(""),r.replace(Vte,function(e,n,i,a){t.push(i?a.replace(Hte,"$1"):n||e)}),t}),Lu=function(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++e<n;)i[e]=t(r[e],e,r);return i},W2=bi?bi.prototype:void 0,X2=W2?W2.toString:void 0,qte=function r(t){if(typeof t=="string")return t;if($r(t))return Lu(t,r)+"";if(ks(t))return X2?X2.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e},TD=function(r){return r==null?"":qte(r)},qv=function(r,t){return $r(r)?r:J1(r,t)?[r]:Kte(TD(r))},tc=function(r){if(typeof r=="string"||ks(r))return r;var t=r+"";return t=="0"&&1/r==-1/0?"-0":t},Zv=function(r,t){for(var e=0,n=(t=qv(t,r)).length;r!=null&&e<n;)r=r[tc(t[e++])];return e&&e==n?r:void 0},Zte=function(r,t,e){var n=r==null?void 0:Zv(r,t);return n===void 0?e:n},Qte=function(r,t){return r!=null&&t in Object(r)},ID=function(r,t,e){for(var n=-1,i=(t=qv(t,r)).length,a=!1;++n<i;){var o=tc(t[n]);if(!(a=r!=null&&e(r,o)))break;r=r[o]}return a||++n!=i?a:!!(i=r==null?0:r.length)&&W1(i)&&Xv(o,i)&&($r(r)||Yu(r))},OD=function(r,t){return r!=null&&ID(r,t,Qte)},Jte=function(r,t){return J1(r)&&CD(t)?AD(tc(r),t):function(e){var n=Zte(e,r);return n===void 0&&n===t?OD(e,r):MD(t,n,3)}},LD=function(r){return function(t){return t==null?void 0:t[r]}},ere=function(r){return function(t){return Zv(t,r)}},tre=function(r){return J1(r)?LD(tc(r)):ere(r)},to=function(r){return typeof r=="function"?r:r==null?Gs:typeof r=="object"?$r(r)?Jte(r[0],r[1]):$te(r):tre(r)},DD=function(r,t){return($r(r)?cD:Dte)(r,to(t))},rre=Object.prototype.hasOwnProperty,nre=function(r,t){return r!=null&&rre.call(r,t)},kD=function(r,t){return r!=null&&ID(r,t,nre)},ire=Object.prototype.hasOwnProperty,are=function(r){if(r==null)return!0;if(eo(r)&&($r(r)||typeof r=="string"||typeof r.splice=="function"||Ls(r)||ec(r)||Yu(r)))return!r.length;var t=Ds(r);if(t=="[object Map]"||t=="[object Set]")return!r.size;if(Vv(r))return!X1(r).length;for(var e in r)if(ire.call(r,e))return!1;return!0},PD=function(r){return r===void 0},ND=function(r,t){var e=-1,n=eo(r)?Array(r.length):[];return Kv(r,function(i,a,o){n[++e]=t(i,a,o)}),n},RD=function(r,t){return($r(r)?Lu:ND)(r,to(t))},ore=function(r,t,e,n){var i=-1,a=r==null?0:r.length;for(n&&a&&(e=r[++i]);++i<a;)e=t(e,r[i],i,r);return e},sre=function(r,t,e,n,i){return i(r,function(a,o,s){e=n?(n=!1,a):t(e,a,o,s)}),e},BD=function(r,t,e){var n=$r(r)?ore:sre,i=arguments.length<3;return n(r,to(t),e,i,Kv)},ure=function(r){return typeof r=="string"||!$r(r)&&Ni(r)&&zo(r)=="[object String]"},fre=LD("length"),lre=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),cre=function(r){return lre.test(r)},hre="[\\ud800-\\udfff]",Gy="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",zy="\\ud83c[\\udffb-\\udfff]",FD="[^\\ud800-\\udfff]",GD="(?:\\ud83c[\\udde6-\\uddff]){2}",zD="[\\ud800-\\udbff][\\udc00-\\udfff]",Y2="(?:"+Gy+"|"+zy+")?",dre="[\\ufe0e\\ufe0f]?"+Y2+("(?:\\u200d(?:"+[FD,GD,zD].join("|")+")[\\ufe0e\\ufe0f]?"+Y2+")*"),vre="(?:"+[FD+Gy+"?",Gy,GD,zD,hre].join("|")+")",V2=RegExp(zy+"(?="+zy+")|"+vre+dre,"g"),pre=function(r){for(var t=V2.lastIndex=0;V2.test(r);)++t;return t},gre=function(r){return cre(r)?pre(r):fre(r)},yre=function(r){if(r==null)return 0;if(eo(r))return ure(r)?gre(r):r.length;var t=Ds(r);return t=="[object Map]"||t=="[object Set]"?r.size:X1(r).length},mre=function(r,t,e){var n=$r(r),i=n||Ls(r)||ec(r);if(t=to(t),e==null){var a=r&&r.constructor;e=i?n?new a:[]:zn(r)&&Ql(a)?gD(Hv(r)):{}}return(i?$1:Z1)(r,function(o,s,u){return t(e,o,s,u)}),e},H2=bi?bi.isConcatSpreadable:void 0,bre=function(r){return $r(r)||Yu(r)||!!(H2&&r&&r[H2])},tb=function r(t,e,n,i,a){var o=-1,s=t.length;for(n||(n=bre),a||(a=[]);++o<s;){var u=t[o];e>0&&n(u)?e>1?r(u,e-1,n,i,a):V1(a,u):i||(a[a.length]=u)}return a},xre=function(r,t,e){switch(e.length){case 0:return r.call(t);case 1:return r.call(t,e[0]);case 2:return r.call(t,e[0],e[1]);case 3:return r.call(t,e[0],e[1],e[2])}return r.apply(t,e)},K2=Math.max,jD=function(r,t,e){return t=K2(t===void 0?r.length-1:t,0),function(){for(var n=arguments,i=-1,a=K2(n.length-t,0),o=Array(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=e(o),xre(r,this,s)}},Ere=Gd?function(r,t){return Gd(r,"toString",{configurable:!0,enumerable:!1,value:K1(t),writable:!0})}:Gs,wre=Date.now,UD=function(r){var t=0,e=0;return function(){var n=wre(),i=16-(n-e);if(e=n,i>0){if(++t>=800)return arguments[0]}else t=0;return r.apply(void 0,arguments)}}(Ere),Qv=function(r,t){return UD(jD(r,t,Gs),r+"")},$D=function(r,t,e,n){for(var i=r.length,a=e+(n?1:-1);n?a--:++a<i;)if(t(r[a],a,r))return a;return-1},_re=function(r){return r!=r},Sre=function(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1},Mre=function(r,t,e){return t==t?Sre(r,t,e):$D(r,_re,e)},Cre=function(r,t){return!!(r!=null&&r.length)&&Mre(r,t,0)>-1},Are=function(r,t,e){for(var n=-1,i=r==null?0:r.length;++n<i;)if(e(t,r[n]))return!0;return!1},Tre=function(){},Ire=Ou&&1/Q1(new Ou([,-0]))[1]==1/0?function(r){return new Ou(r)}:Tre,Ore=function(r,t,e){var n=-1,i=Cre,a=r.length,o=!0,s=[],u=s;if(e)o=!1,i=Are;else if(a>=200){var f=t?null:Ire(r);if(f)return Q1(f);o=!1,i=_D,u=new wD}else u=t?[]:s;e:for(;++n<a;){var l=r[n],c=t?t(l):l;if(l=e||l!==0?l:0,o&&c==c){for(var h=u.length;h--;)if(u[h]===c)continue e;t&&u.push(c),s.push(l)}else i(u,c,e)||(u!==s&&u.push(c),s.push(l))}return s},WD=function(r){return Ni(r)&&eo(r)},Lre=Qv(function(r){return Ore(tb(r,1,WD,!0))}),Dre=function(r,t){return Lu(t,function(e){return r[e]})},jd,XD=function(r){return r==null?[]:Dre(r,jo(r))};try{jd={clone:Lte,constant:K1,each:ED,filter:DD,has:kD,isArray:$r,isEmpty:are,isFunction:Ql,isUndefined:PD,keys:jo,map:RD,reduce:BD,size:yre,transform:mre,union:Lre,values:XD}}catch{}jd||(jd=window._);var ut=jd,rb=ar;function ar(r){this._isDirected=!ut.has(r,"directed")||r.directed,this._isMultigraph=!!ut.has(r,"multigraph")&&r.multigraph,this._isCompound=!!ut.has(r,"compound")&&r.compound,this._label=void 0,this._defaultNodeLabelFn=ut.constant(void 0),this._defaultEdgeLabelFn=ut.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function q2(r,t){r[t]?r[t]++:r[t]=1}function Z2(r,t){--r[t]||delete r[t]}function Hf(r,t,e,n){var i=""+t,a=""+e;if(!r&&i>a){var o=i;i=a,a=o}return i+""+a+""+(ut.isUndefined(n)?"\0":n)}function kre(r,t,e,n){var i=""+t,a=""+e;if(!r&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}function a0(r,t){return Hf(r,t.v,t.w,t.name)}ar.prototype._nodeCount=0,ar.prototype._edgeCount=0,ar.prototype.isDirected=function(){return this._isDirected},ar.prototype.isMultigraph=function(){return this._isMultigraph},ar.prototype.isCompound=function(){return this._isCompound},ar.prototype.setGraph=function(r){return this._label=r,this},ar.prototype.graph=function(){return this._label},ar.prototype.setDefaultNodeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultNodeLabelFn=r,this},ar.prototype.nodeCount=function(){return this._nodeCount},ar.prototype.nodes=function(){return ut.keys(this._nodes)},ar.prototype.sources=function(){var r=this;return ut.filter(this.nodes(),function(t){return ut.isEmpty(r._in[t])})},ar.prototype.sinks=function(){var r=this;return ut.filter(this.nodes(),function(t){return ut.isEmpty(r._out[t])})},ar.prototype.setNodes=function(r,t){var e=arguments,n=this;return ut.each(r,function(i){e.length>1?n.setNode(i,t):n.setNode(i)}),this},ar.prototype.setNode=function(r,t){return ut.has(this._nodes,r)?(arguments.length>1&&(this._nodes[r]=t),this):(this._nodes[r]=arguments.length>1?t: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)},ar.prototype.node=function(r){return this._nodes[r]},ar.prototype.hasNode=function(r){return ut.has(this._nodes,r)},ar.prototype.removeNode=function(r){var t=this;if(ut.has(this._nodes,r)){var e=function(n){t.removeEdge(t._edgeObjs[n])};delete this._nodes[r],this._isCompound&&(this._removeFromParentsChildList(r),delete this._parent[r],ut.each(this.children(r),function(n){t.setParent(n)}),delete this._children[r]),ut.each(ut.keys(this._in[r]),e),delete this._in[r],delete this._preds[r],ut.each(ut.keys(this._out[r]),e),delete this._out[r],delete this._sucs[r],--this._nodeCount}return this},ar.prototype.setParent=function(r,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ut.isUndefined(t))t="\0";else{for(var e=t+="";!ut.isUndefined(e);e=this.parent(e))if(e===r)throw new Error("Setting "+t+" as parent of "+r+" would create a cycle");this.setNode(t)}return this.setNode(r),this._removeFromParentsChildList(r),this._parent[r]=t,this._children[t][r]=!0,this},ar.prototype._removeFromParentsChildList=function(r){delete this._children[this._parent[r]][r]},ar.prototype.parent=function(r){if(this._isCompound){var t=this._parent[r];if(t!=="\0")return t}},ar.prototype.children=function(r){if(ut.isUndefined(r)&&(r="\0"),this._isCompound){var t=this._children[r];if(t)return ut.keys(t)}else{if(r==="\0")return this.nodes();if(this.hasNode(r))return[]}},ar.prototype.predecessors=function(r){var t=this._preds[r];if(t)return ut.keys(t)},ar.prototype.successors=function(r){var t=this._sucs[r];if(t)return ut.keys(t)},ar.prototype.neighbors=function(r){var t=this.predecessors(r);if(t)return ut.union(t,this.successors(r))},ar.prototype.isLeaf=function(r){return(this.isDirected()?this.successors(r):this.neighbors(r)).length===0},ar.prototype.filterNodes=function(r){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var e=this;ut.each(this._nodes,function(a,o){r(o)&&t.setNode(o,a)}),ut.each(this._edgeObjs,function(a){t.hasNode(a.v)&&t.hasNode(a.w)&&t.setEdge(a,e.edge(a))});var n={};function i(a){var o=e.parent(a);return o===void 0||t.hasNode(o)?(n[a]=o,o):o in n?n[o]:i(o)}return this._isCompound&&ut.each(t.nodes(),function(a){t.setParent(a,i(a))}),t},ar.prototype.setDefaultEdgeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultEdgeLabelFn=r,this},ar.prototype.edgeCount=function(){return this._edgeCount},ar.prototype.edges=function(){return ut.values(this._edgeObjs)},ar.prototype.setPath=function(r,t){var e=this,n=arguments;return ut.reduce(r,function(i,a){return n.length>1?e.setEdge(i,a,t):e.setEdge(i,a),a}),this},ar.prototype.setEdge=function(){var r,t,e,n,i=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(r=a.v,t=a.w,e=a.name,arguments.length===2&&(n=arguments[1],i=!0)):(r=a,t=arguments[1],e=arguments[3],arguments.length>2&&(n=arguments[2],i=!0)),r=""+r,t=""+t,ut.isUndefined(e)||(e=""+e);var o=Hf(this._isDirected,r,t,e);if(ut.has(this._edgeLabels,o))return i&&(this._edgeLabels[o]=n),this;if(!ut.isUndefined(e)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(t),this._edgeLabels[o]=i?n:this._defaultEdgeLabelFn(r,t,e);var s=kre(this._isDirected,r,t,e);return r=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,q2(this._preds[t],r),q2(this._sucs[r],t),this._in[t][o]=s,this._out[r][o]=s,this._edgeCount++,this},ar.prototype.edge=function(r,t,e){var n=arguments.length===1?a0(this._isDirected,arguments[0]):Hf(this._isDirected,r,t,e);return this._edgeLabels[n]},ar.prototype.hasEdge=function(r,t,e){var n=arguments.length===1?a0(this._isDirected,arguments[0]):Hf(this._isDirected,r,t,e);return ut.has(this._edgeLabels,n)},ar.prototype.removeEdge=function(r,t,e){var n=arguments.length===1?a0(this._isDirected,arguments[0]):Hf(this._isDirected,r,t,e),i=this._edgeObjs[n];return i&&(r=i.v,t=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],Z2(this._preds[t],r),Z2(this._sucs[r],t),delete this._in[t][n],delete this._out[r][n],this._edgeCount--),this},ar.prototype.inEdges=function(r,t){var e=this._in[r];if(e){var n=ut.values(e);return t?ut.filter(n,function(i){return i.v===t}):n}},ar.prototype.outEdges=function(r,t){var e=this._out[r];if(e){var n=ut.values(e);return t?ut.filter(n,function(i){return i.w===t}):n}},ar.prototype.nodeEdges=function(r,t){var e=this.inEdges(r,t);if(e)return e.concat(this.outEdges(r,t))};var Q2={Graph:rb,version:"2.1.8"},Pre={write:function(r){var t={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:Nre(r),edges:Rre(r)};return ut.isUndefined(r.graph())||(t.value=ut.clone(r.graph())),t},read:function(r){var t=new rb(r.options).setGraph(r.value);return ut.each(r.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),ut.each(r.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}};function Nre(r){return ut.map(r.nodes(),function(t){var e=r.node(t),n=r.parent(t),i={v:t};return ut.isUndefined(e)||(i.value=e),ut.isUndefined(n)||(i.parent=n),i})}function Rre(r){return ut.map(r.edges(),function(t){var e=r.edge(t),n={v:t.v,w:t.w};return ut.isUndefined(t.name)||(n.name=t.name),ut.isUndefined(e)||(n.value=e),n})}var Bre=function(r){var t,e={},n=[];function i(a){ut.has(e,a)||(e[a]=!0,t.push(a),ut.each(r.successors(a),i),ut.each(r.predecessors(a),i))}return ut.each(r.nodes(),function(a){t=[],i(a),t.length&&n.push(t)}),n},YD=ci;function ci(){this._arr=[],this._keyIndices={}}ci.prototype.size=function(){return this._arr.length},ci.prototype.keys=function(){return this._arr.map(function(r){return r.key})},ci.prototype.has=function(r){return ut.has(this._keyIndices,r)},ci.prototype.priority=function(r){var t=this._keyIndices[r];if(t!==void 0)return this._arr[t].priority},ci.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},ci.prototype.add=function(r,t){var e=this._keyIndices;if(r=String(r),!ut.has(e,r)){var n=this._arr,i=n.length;return e[r]=i,n.push({key:r,priority:t}),this._decrease(i),!0}return!1},ci.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},ci.prototype.decrease=function(r,t){var e=this._keyIndices[r];if(t>this._arr[e].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[e].priority+" New: "+t);this._arr[e].priority=t,this._decrease(e)},ci.prototype._heapify=function(r){var t=this._arr,e=2*r,n=e+1,i=r;e<t.length&&(i=t[e].priority<t[i].priority?e:i,n<t.length&&(i=t[n].priority<t[i].priority?n:i),i!==r&&(this._swap(r,i),this._heapify(i)))},ci.prototype._decrease=function(r){for(var t,e=this._arr,n=e[r].priority;r!==0&&!(e[t=r>>1].priority<n);)this._swap(r,t),r=t},ci.prototype._swap=function(r,t){var e=this._arr,n=this._keyIndices,i=e[r],a=e[t];e[r]=a,e[t]=i,n[a.key]=r,n[i.key]=t};var VD=function(r,t,e,n){return function(i,a,o,s){var u,f,l={},c=new YD,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(t),e||Fre,n||function(i){return r.outEdges(i)})},Fre=ut.constant(1),Gre=function(r,t,e){return ut.transform(r.nodes(),function(n,i){n[i]=VD(r,i,t,e)},{})},HD=function(r){var t=0,e=[],n={},i=[];function a(o){var s=n[o]={onStack:!0,lowlink:t,index:t++};if(e.push(o),r.successors(o).forEach(function(l){ut.has(n,l)?n[l].onStack&&(s.lowlink=Math.min(s.lowlink,n[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,n[l].lowlink))}),s.lowlink===s.index){var u,f=[];do u=e.pop(),n[u].onStack=!1,f.push(u);while(o!==u);i.push(f)}}return r.nodes().forEach(function(o){ut.has(n,o)||a(o)}),i},zre=function(r){return ut.filter(HD(r),function(t){return t.length>1||t.length===1&&r.hasEdge(t[0],t[0])})},jre=function(r,t,e){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,t||Ure,e||function(n){return r.outEdges(n)})},Ure=ut.constant(1),o0=KD;function KD(r){var t={},e={},n=[];if(ut.each(r.sinks(),function i(a){if(ut.has(e,a))throw new Ud;ut.has(t,a)||(e[a]=!0,t[a]=!0,ut.each(r.predecessors(a),i),delete e[a],n.push(a))}),ut.size(t)!==r.nodeCount())throw new Ud;return n}function Ud(){}KD.CycleException=Ud,Ud.prototype=new Error;var J2=function(r,t,e){ut.isArray(t)||(t=[t]);var n=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return ut.each(t,function(o){if(!r.hasNode(o))throw new Error("Graph does not have node: "+o);qD(r,o,e==="post",a,n,i)}),i};function qD(r,t,e,n,i,a){ut.has(n,t)||(n[t]=!0,e||a.push(t),ut.each(i(t),function(o){qD(r,o,e,n,i,a)}),e&&a.push(t))}var $d,$re={Graph:Q2.Graph,json:Pre,alg:{components:Bre,dijkstra:VD,dijkstraAll:Gre,findCycles:zre,floydWarshall:jre,isAcyclic:function(r){try{o0(r)}catch(t){if(t instanceof o0.CycleException)return!1;throw t}return!0},postorder:function(r,t){return J2(r,t,"post")},preorder:function(r,t){return J2(r,t,"pre")},prim:function(r,t){var e,n=new rb,i={},a=new YD;function o(u){var f=u.v===e?u.w:u.v,l=a.priority(f);if(l!==void 0){var c=t(u);c<l&&(i[f]=e,a.decrease(f,c))}}if(r.nodeCount()===0)return n;ut.each(r.nodes(),function(u){a.add(u,Number.POSITIVE_INFINITY),n.setNode(u)}),a.decrease(r.nodes()[0],0);for(var s=!1;a.size()>0;){if(e=a.removeMin(),ut.has(i,e))n.setEdge(e,i[e]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(e).forEach(o)}return n},tarjan:HD,topsort:o0},version:Q2.version};try{$d=$re}catch{}$d||($d=window.graphlib);var ji=$d,Wre=function(r){return mD(r,5)},Il=function(r,t,e){if(!zn(e))return!1;var n=typeof t;return!!(n=="number"?eo(e)&&Xv(t,e.length):n=="string"&&t in e)&&tf(e[t],r)},ZD=Object.prototype,Xre=ZD.hasOwnProperty,Yre=Qv(function(r,t){r=Object(r);var e=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&Il(t[0],t[1],i)&&(n=1);++e<n;)for(var a=t[e],o=Fs(a),s=-1,u=o.length;++s<u;){var f=o[s],l=r[f];(l===void 0||tf(l,ZD[f])&&!Xre.call(r,f))&&(r[f]=a[f])}return r}),Vre=function(r){return function(t,e,n){var i=Object(t);if(!eo(t)){var a=to(e);t=jo(t),e=function(s){return a(i[s],s,i)}}var o=r(t,e,n);return o>-1?i[a?t[o]:o]:void 0}},Hre=/^\s+|\s+$/g,Kre=/^[-+]0x[0-9a-f]+$/i,qre=/^0b[01]+$/i,Zre=/^0o[0-7]+$/i,Qre=parseInt,Jre=function(r){if(typeof r=="number")return r;if(ks(r))return NaN;if(zn(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=zn(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(Hre,"");var e=qre.test(r);return e||Zre.test(r)?Qre(r.slice(2),e?2:8):Kre.test(r)?NaN:+r},td=function(r){return r?(r=Jre(r))===1/0||r===-1/0?17976931348623157e292*(r<0?-1:1):r==r?r:0:r===0?r:0},ene=function(r){var t=td(r),e=t%1;return t==t?e?t-e:t:0},tne=Math.max,rne=Vre(function(r,t,e){var n=r==null?0:r.length;if(!n)return-1;var i=e==null?0:ene(e);return i<0&&(i=tne(n+i,0)),$D(r,to(t),i)}),QD=function(r){return r!=null&&r.length?tb(r,1):[]},nne=function(r,t){return r==null?r:q1(r,bD(t),Fs)},ine=function(r){var t=r==null?0:r.length;return t?r[t-1]:void 0},ane=function(r,t){var e={};return t=to(t),Z1(r,function(n,i,a){$v(e,i,t(n,i,a))}),e},nb=function(r,t,e){for(var n=-1,i=r.length;++n<i;){var a=r[n],o=t(a);if(o!=null&&(s===void 0?o==o&&!ks(o):e(o,s)))var s=o,u=a}return u},one=function(r,t){return r>t},sne=function(r){return r&&r.length?nb(r,Gs,one):void 0},jy=function(r,t,e){(e!==void 0&&!tf(r[t],e)||e===void 0&&!(t in r))&&$v(r,t,e)},une=Function.prototype,fne=Object.prototype,JD=une.toString,lne=fne.hasOwnProperty,cne=JD.call(Object),hne=function(r){if(!Ni(r)||zo(r)!="[object Object]")return!1;var t=Hv(r);if(t===null)return!0;var e=lne.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&JD.call(e)==cne},Uy=function(r,t){if((t!=="constructor"||typeof r[t]!="function")&&t!="__proto__")return r[t]},dne=function(r){return Jl(r,Fs(r))},vne=function(r,t,e,n,i,a,o){var s=Uy(r,e),u=Uy(t,e),f=o.get(u);if(f)jy(r,e,f);else{var l=a?a(s,u,e+"",r,t,o):void 0,c=l===void 0;if(c){var h=$r(u),d=!h&&Ls(u),v=!h&&!d&&ec(u);l=u,h||d||v?$r(s)?l=s:WD(s)?l=lD(s):d?(c=!1,l=fD(u,!0)):v?(c=!1,l=pD(u,!0)):l=[]:hne(u)||Yu(u)?(l=s,Yu(s)?l=dne(s):zn(s)&&!Ql(s)||(l=yD(u))):c=!1}c&&(o.set(u,l),i(l,u,n,a,o),o.delete(u)),jy(r,e,l)}},pne=function r(t,e,n,i,a){t!==e&&q1(e,function(o,s){if(a||(a=new Iu),zn(o))vne(t,e,s,n,r,i,a);else{var u=i?i(Uy(t,s),o,s+"",t,e,a):void 0;u===void 0&&(u=o),jy(t,s,u)}},Fs)},gne=function(r){return Qv(function(t,e){var n=-1,i=e.length,a=i>1?e[i-1]:void 0,o=i>2?e[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&Il(e[0],e[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++n<i;){var s=e[n];s&&r(t,s,n,a)}return t})}(function(r,t,e){pne(r,t,e)}),ek=function(r,t){return r<t},yne=function(r){return r&&r.length?nb(r,Gs,ek):void 0},mne=function(r,t){return r&&r.length?nb(r,to(t),ek):void 0},bne=function(){return zi.Date.now()},xne=function(r,t,e,n){if(!zn(r))return r;for(var i=-1,a=(t=qv(t,r)).length,o=a-1,s=r;s!=null&&++i<a;){var u=tc(t[i]),f=e;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=o){var l=s[u];(f=n?n(l,u,s):void 0)===void 0&&(f=zn(l)?l:Xv(t[i+1])?[]:{})}Wv(s,u,f),s=s[u]}return r},Ene=function(r,t,e){for(var n=-1,i=t.length,a={};++n<i;){var o=t[n],s=Zv(r,o);e(s,o)&&xne(a,qv(o,r),s)}return a},wne=function(r,t){return Ene(r,t,function(e,n){return OD(r,n)})},_ne=function(r){return UD(jD(r,void 0,QD),r+"")}(function(r,t){return r==null?{}:wne(r,t)}),Sne=Math.ceil,Mne=Math.max,Cne=function(r,t,e,n){for(var i=-1,a=Mne(Sne((t-r)/(e||1)),0),o=Array(a);a--;)o[n?a:++i]=r,r+=e;return o},Ane=function(r){return function(t,e,n){return n&&typeof n!="number"&&Il(t,e,n)&&(e=n=void 0),t=td(t),e===void 0?(e=t,t=0):e=td(e),n=n===void 0?t<e?1:-1:td(n),Cne(t,e,n,r)}}(),Tne=function(r,t){var e=r.length;for(r.sort(t);e--;)r[e]=r[e].value;return r},Ine=function(r,t){if(r!==t){var e=r!==void 0,n=r===null,i=r==r,a=ks(r),o=t!==void 0,s=t===null,u=t==t,f=ks(t);if(!s&&!f&&!a&&r>t||a&&o&&u&&!s&&!f||n&&o&&u||!e&&u||!i)return 1;if(!n&&!a&&!f&&r<t||f&&e&&i&&!n&&!a||s&&e&&i||!o&&i||!u)return-1}return 0},One=function(r,t,e){for(var n=-1,i=r.criteria,a=t.criteria,o=i.length,s=e.length;++n<o;){var u=Ine(i[n],a[n]);if(u)return n>=s?u:u*(e[n]=="desc"?-1:1)}return r.index-t.index},Lne=function(r,t,e){t=t.length?Lu(t,function(a){return $r(a)?function(o){return Zv(o,a.length===1?a[0]:a)}:a}):[Gs];var n=-1;t=Lu(t,Yv(to));var i=ND(r,function(a,o,s){return{criteria:Lu(t,function(u){return u(a)}),index:++n,value:a}});return Tne(i,function(a,o){return One(a,o,e)})},Dne=Qv(function(r,t){if(r==null)return[];var e=t.length;return e>1&&Il(r,t[0],t[1])?t=[]:e>2&&Il(t[0],t[1],t[2])&&(t=[t[0]]),Lne(r,tb(t,1),[])}),kne=0,Pne=function(r){var t=++kne;return TD(r)+t},Nne=function(r,t,e){for(var n=-1,i=r.length,a=t.length,o={};++n<i;){var s=n<a?t[n]:void 0;e(o,r[n],s)}return o},Wd,Rne=function(r,t){return Nne(r||[],t||[],Wv)};try{Wd={cloneDeep:Wre,constant:K1,defaults:Yre,each:ED,filter:DD,find:rne,flatten:QD,forEach:xD,forIn:nne,has:kD,isUndefined:PD,last:ine,map:RD,mapValues:ane,max:sne,merge:gne,min:yne,minBy:mne,now:bne,pick:_ne,range:Ane,reduce:BD,sortBy:Dne,uniqueId:Pne,values:XD,zipObject:Rne}}catch{}Wd||(Wd=window._);var Z=Wd,Bne=rd;function rd(){var r={};r._next=r._prev=r,this._sentinel=r}function eS(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function Fne(r,t){if(r!=="_next"&&r!=="_prev")return t}rd.prototype.dequeue=function(){var r=this._sentinel,t=r._prev;if(t!==r)return eS(t),t},rd.prototype.enqueue=function(r){var t=this._sentinel;r._prev&&r._next&&eS(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t},rd.prototype.toString=function(){for(var r=[],t=this._sentinel,e=t._prev;e!==t;)r.push(JSON.stringify(e,Fne)),e=e._prev;return"["+r.join(", ")+"]"};var Gne=ji.Graph,zne=function(r,t){if(r.nodeCount()<=1)return[];var e=function(i,a){var o=new Gne,s=0,u=0;Z.forEach(i.nodes(),function(c){o.setNode(c,{v:c,in:0,out:0})}),Z.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=Z.range(u+s+3).map(function(){return new Bne}),l=s+1;return Z.forEach(o.nodes(),function(c){$y(f,l,o.node(c))}),{graph:o,buckets:f,zeroIdx:l}}(r,t||jne),n=function(i,a,o){for(var s,u=[],f=a[a.length-1],l=a[0];i.nodeCount();){for(;s=l.dequeue();)s0(i,a,o,s);for(;s=f.dequeue();)s0(i,a,o,s);if(i.nodeCount()){for(var c=a.length-2;c>0;--c)if(s=a[c].dequeue()){u=u.concat(s0(i,a,o,s,!0));break}}}return u}(e.graph,e.buckets,e.zeroIdx);return Z.flatten(Z.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)},jne=Z.constant(1);function s0(r,t,e,n,i){var a=i?[]:void 0;return Z.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,$y(t,e,u)}),Z.forEach(r.outEdges(n.v),function(o){var s=r.edge(o),u=o.w,f=r.node(u);f.in-=s,$y(t,e,f)}),r.removeNode(n.v),a}function $y(r,t,e){e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)}var tS={run:function(r){var t=r.graph().acyclicer==="greedy"?zne(r,function(e){return function(n){return e.edge(n).weight}}(r)):function(e){var n=[],i={},a={};function o(s){Z.has(a,s)||(a[s]=!0,i[s]=!0,Z.forEach(e.outEdges(s),function(u){Z.has(i,u.w)?n.push(u):o(u.w)}),delete i[s])}return Z.forEach(e.nodes(),o),n}(r);Z.forEach(t,function(e){var n=r.edge(e);r.removeEdge(e),n.forwardName=e.name,n.reversed=!0,r.setEdge(e.w,e.v,n,Z.uniqueId("rev"))})},undo:function(r){Z.forEach(r.edges(),function(t){var e=r.edge(t);if(e.reversed){r.removeEdge(t);var n=e.forwardName;delete e.reversed,delete e.forwardName,r.setEdge(t.w,t.v,e,n)}})}},rS=ji.Graph,xn={addDummyNode:nS,simplify:function(r){var t=new rS().setGraph(r.graph());return Z.forEach(r.nodes(),function(e){t.setNode(e,r.node(e))}),Z.forEach(r.edges(),function(e){var n=t.edge(e.v,e.w)||{weight:0,minlen:1},i=r.edge(e);t.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t},asNonCompoundGraph:function(r){var t=new rS({multigraph:r.isMultigraph()}).setGraph(r.graph());return Z.forEach(r.nodes(),function(e){r.children(e).length||t.setNode(e,r.node(e))}),Z.forEach(r.edges(),function(e){t.setEdge(e,r.edge(e))}),t},successorWeights:function(r){var t=Z.map(r.nodes(),function(e){var n={};return Z.forEach(r.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return Z.zipObject(r.nodes(),t)},predecessorWeights:function(r){var t=Z.map(r.nodes(),function(e){var n={};return Z.forEach(r.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return Z.zipObject(r.nodes(),t)},intersectRect:function(r,t){var e,n,i=r.x,a=r.y,o=t.x-i,s=t.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),e=f*o/s,n=f):(o<0&&(u=-u),e=u,n=u*s/o),{x:i+e,y:a+n}},buildLayerMatrix:function(r){var t=Z.map(Z.range(iS(r)+1),function(){return[]});return Z.forEach(r.nodes(),function(e){var n=r.node(e),i=n.rank;Z.isUndefined(i)||(t[i][n.order]=e)}),t},normalizeRanks:function(r){var t=Z.min(Z.map(r.nodes(),function(e){return r.node(e).rank}));Z.forEach(r.nodes(),function(e){var n=r.node(e);Z.has(n,"rank")&&(n.rank-=t)})},removeEmptyRanks:function(r){var t=Z.min(Z.map(r.nodes(),function(a){return r.node(a).rank})),e=[];Z.forEach(r.nodes(),function(a){var o=r.node(a).rank-t;e[o]||(e[o]=[]),e[o].push(a)});var n=0,i=r.graph().nodeRankFactor;Z.forEach(e,function(a,o){Z.isUndefined(a)&&o%i!=0?--n:n&&Z.forEach(a,function(s){r.node(s).rank+=n})})},addBorderNode:function(r,t,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),nS(r,"border",i,t)},maxRank:iS,partition:function(r,t){var e={lhs:[],rhs:[]};return Z.forEach(r,function(n){t(n)?e.lhs.push(n):e.rhs.push(n)}),e},time:function(r,t){var e=Z.now();try{return t()}finally{console.log(r+" time: "+(Z.now()-e)+"ms")}},notime:function(r,t){return t()}};function nS(r,t,e,n){var i;do i=Z.uniqueId(n);while(r.hasNode(i));return e.dummy=t,r.setNode(i,e),i}function iS(r){return Z.max(Z.map(r.nodes(),function(t){var e=r.node(t).rank;if(!Z.isUndefined(e))return e}))}var aS={run:function(r){r.graph().dummyChains=[],Z.forEach(r.edges(),function(t){(function(e,n){var i,a,o,s=n.v,u=e.node(s).rank,f=n.w,l=e.node(f).rank,c=n.name,h=e.edge(n),d=h.labelRank;if(l!==u+1){for(e.removeEdge(n),o=0,++u;u<l;++o,++u)h.points=[],a={width:0,height:0,edgeLabel:h,edgeObj:n,rank:u},i=xn.addDummyNode(e,"edge",a,"_d"),u===d&&(a.width=h.width,a.height=h.height,a.dummy="edge-label",a.labelpos=h.labelpos),e.setEdge(s,i,{weight:h.weight},c),o===0&&e.graph().dummyChains.push(i),s=i;e.setEdge(s,f,{weight:h.weight},c)}})(r,t)})},undo:function(r){Z.forEach(r.graph().dummyChains,function(t){var e,n=r.node(t),i=n.edgeLabel;for(r.setEdge(n.edgeObj,i);n.dummy;)e=r.successors(t)[0],r.removeNode(t),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),t=e,n=r.node(t)})}},tk=function(r){var t={};Z.forEach(r.sources(),function e(n){var i=r.node(n);if(Z.has(t,n))return i.rank;t[n]=!0;var a=Z.min(Z.map(r.outEdges(n),function(o){return e(o.w)-r.edge(o).minlen}));return a!==Number.POSITIVE_INFINITY&&a!=null||(a=0),i.rank=a})},rk=function(r,t){return r.node(t.w).rank-r.node(t.v).rank-r.edge(t).minlen},Une=ji.Graph,Xd=rk,nk=function(r){var t,e,n=new Une({directed:!1}),i=r.nodes()[0],a=r.nodeCount();for(n.setNode(i,{});$ne(n,r)<a;)t=Wne(n,r),e=n.hasNode(t.v)?Xd(r,t):-Xd(r,t),Xne(n,r,e);return n};function $ne(r,t){return Z.forEach(r.nodes(),function e(n){Z.forEach(t.nodeEdges(n),function(i){var a=i.v,o=n===a?i.w:a;r.hasNode(o)||Xd(t,i)||(r.setNode(o,{}),r.setEdge(n,o,{}),e(o))})}),r.nodeCount()}function Wne(r,t){return Z.minBy(t.edges(),function(e){if(r.hasNode(e.v)!==r.hasNode(e.w))return Xd(t,e)})}function Xne(r,t,e){Z.forEach(r.nodes(),function(n){t.node(n).rank+=e})}var Yne=rk,Vne=tk,Hne=ji.alg.preorder,Kne=ji.alg.postorder,qne=xn.simplify,Zne=hs;function hs(r){r=qne(r),Vne(r);var t,e=nk(r);for(ab(e),ib(e,r);t=ok(e);)uk(e,r,t,sk(e,r,t))}function ib(r,t){var e=Kne(r,r.nodes());e=e.slice(0,e.length-1),Z.forEach(e,function(n){(function(i,a,o){var s=i.node(o).parent;i.edge(o,s).cutvalue=ik(i,a,o)})(r,t,n)})}function ik(r,t,e){var n=r.node(e).parent,i=!0,a=t.edge(e,n),o=0;return a||(i=!1,a=t.edge(n,e)),o=a.weight,Z.forEach(t.nodeEdges(e),function(s){var u,f,l=s.v===e,c=l?s.w:s.v;if(c!==n){var h=l===i,d=t.edge(s).weight;if(o+=h?d:-d,u=e,f=c,r.hasEdge(u,f)){var v=r.edge(e,c).cutvalue;o+=h?-v:v}}}),o}function ab(r,t){arguments.length<2&&(t=r.nodes()[0]),ak(r,{},1,t)}function ak(r,t,e,n,i){var a=e,o=r.node(n);return t[n]=!0,Z.forEach(r.neighbors(n),function(s){Z.has(t,s)||(e=ak(r,t,e,s,n))}),o.low=a,o.lim=e++,i?o.parent=i:delete o.parent,e}function ok(r){return Z.find(r.edges(),function(t){return r.edge(t).cutvalue<0})}function sk(r,t,e){var n=e.v,i=e.w;t.hasEdge(n,i)||(n=e.w,i=e.v);var a=r.node(n),o=r.node(i),s=a,u=!1;a.lim>o.lim&&(s=o,u=!0);var f=Z.filter(t.edges(),function(l){return u===oS(r,r.node(l.v),s)&&u!==oS(r,r.node(l.w),s)});return Z.minBy(f,function(l){return Yne(t,l)})}function uk(r,t,e,n){var i=e.v,a=e.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),ab(r),ib(r,t),function(o,s){var u=Z.find(o.nodes(),function(l){return!s.node(l).parent}),f=Hne(o,u);f=f.slice(1),Z.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,t)}function oS(r,t,e){return e.low<=t.lim&&t.lim<=e.lim}hs.initLowLimValues=ab,hs.initCutValues=ib,hs.calcCutValue=ik,hs.leaveEdge=ok,hs.enterEdge=sk,hs.exchangeEdges=uk;var fk=tk,Qne=function(r){switch(r.graph().ranker){case"network-simplex":sS(r);break;case"tight-tree":(function(t){fk(t),nk(t)})(r);break;case"longest-path":Jne(r);break;default:sS(r)}},Jne=fk;function sS(r){Zne(r)}var eie=function(r){var t=function(e){var n={},i=0;function a(o){var s=i;Z.forEach(e.children(o),a),n[o]={low:s,lim:i++}}return Z.forEach(e.children(),a),n}(r);Z.forEach(r.graph().dummyChains,function(e){for(var n=r.node(e),i=n.edgeObj,a=function(c,h,d,v){var p,g,y=[],m=[],b=Math.min(h[d].low,h[v].low),x=Math.max(h[d].lim,h[v].lim);p=d;do p=c.parent(p),y.push(p);while(p&&(h[p].low>b||x>h[p].lim));for(g=p,p=v;(p=c.parent(p))!==g;)m.push(p);return{path:y.concat(m.reverse()),lca:g}}(r,t,i.v,i.w),o=a.path,s=a.lca,u=0,f=o[u],l=!0;e!==i.w;){if(n=r.node(e),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(e,f),e=r.successors(e)[0]}})},uS={run:function(r){var t=xn.addDummyNode(r,"root",{},"_root"),e=function(o){var s={};function u(f,l){var c=o.children(f);c&&c.length&&Z.forEach(c,function(h){u(h,l+1)}),s[f]=l}return Z.forEach(o.children(),function(f){u(f,1)}),s}(r),n=Z.max(Z.values(e))-1,i=2*n+1;r.graph().nestingRoot=t,Z.forEach(r.edges(),function(o){r.edge(o).minlen*=i});var a=function(o){return Z.reduce(o.edges(),function(s,u){return s+o.edge(u).weight},0)}(r)+1;Z.forEach(r.children(),function(o){lk(r,t,i,a,n,e,o)}),r.graph().nodeRankFactor=i},cleanup:function(r){var t=r.graph();r.removeNode(t.nestingRoot),delete t.nestingRoot,Z.forEach(r.edges(),function(e){r.edge(e).nestingEdge&&r.removeEdge(e)})}};function lk(r,t,e,n,i,a,o){var s=r.children(o);if(s.length){var u=xn.addBorderNode(r,"_bt"),f=xn.addBorderNode(r,"_bb"),l=r.node(o);r.setParent(u,o),l.borderTop=u,r.setParent(f,o),l.borderBottom=f,Z.forEach(s,function(c){lk(r,t,e,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(t,u,{weight:0,minlen:i+a[o]})}else o!==t&&r.setEdge(t,o,{weight:0,minlen:e})}var tie=function(r){Z.forEach(r.children(),function t(e){var n=r.children(e),i=r.node(e);if(n.length&&Z.forEach(n,t),Z.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)fS(r,"borderLeft","_bl",e,i,a),fS(r,"borderRight","_br",e,i,a)}})};function fS(r,t,e,n,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],u=xn.addDummyNode(r,"border",o,e);i[t][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})}var lS={adjust:function(r){var t=r.graph().rankdir.toLowerCase();t!=="lr"&&t!=="rl"||cS(r)},undo:function(r){var t=r.graph().rankdir.toLowerCase();t!=="bt"&&t!=="rl"||function(e){Z.forEach(e.nodes(),function(n){u0(e.node(n))}),Z.forEach(e.edges(),function(n){var i=e.edge(n);Z.forEach(i.points,u0),Z.has(i,"y")&&u0(i)})}(r),t!=="lr"&&t!=="rl"||(function(e){Z.forEach(e.nodes(),function(n){f0(e.node(n))}),Z.forEach(e.edges(),function(n){var i=e.edge(n);Z.forEach(i.points,f0),Z.has(i,"x")&&f0(i)})}(r),cS(r))}};function cS(r){Z.forEach(r.nodes(),function(t){hS(r.node(t))}),Z.forEach(r.edges(),function(t){hS(r.edge(t))})}function hS(r){var t=r.width;r.width=r.height,r.height=t}function u0(r){r.y=-r.y}function f0(r){var t=r.x;r.x=r.y,r.y=t}var rie=function(r){var t={},e=Z.filter(r.nodes(),function(s){return!r.children(s).length}),n=Z.max(Z.map(e,function(s){return r.node(s).rank})),i=Z.map(Z.range(n+1),function(){return[]});function a(s){if(!Z.has(t,s)){t[s]=!0;var u=r.node(s);i[u.rank].push(s),Z.forEach(r.successors(s),a)}}var o=Z.sortBy(e,function(s){return r.node(s).rank});return Z.forEach(o,a),i},nie=function(r,t){for(var e=0,n=1;n<t.length;++n)e+=iie(r,t[n-1],t[n]);return e};function iie(r,t,e){for(var n=Z.zipObject(e,Z.map(e,function(f,l){return l})),i=Z.flatten(Z.map(t,function(f){return Z.sortBy(Z.map(r.outEdges(f),function(l){return{pos:n[l.w],weight:r.edge(l).weight}}),"pos")}),!0),a=1;a<e.length;)a<<=1;var o=2*a-1;a-=1;var s=Z.map(new Array(o),function(){return 0}),u=0;return Z.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 aie=function(r,t){return Z.map(t,function(e){var n=r.inEdges(e);if(n.length){var i=Z.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:e,barycenter:i.sum/i.weight,weight:i.weight}}return{v:e}})},oie=function(r,t){var e={};return Z.forEach(r,function(n,i){var a=e[n.v]={indegree:0,in:[],out:[],vs:[n.v],i};Z.isUndefined(n.barycenter)||(a.barycenter=n.barycenter,a.weight=n.weight)}),Z.forEach(t.edges(),function(n){var i=e[n.v],a=e[n.w];Z.isUndefined(i)||Z.isUndefined(a)||(a.indegree++,i.out.push(e[n.w]))}),function(n){var i=[];function a(u){return function(f){f.merged||(Z.isUndefined(f.barycenter)||Z.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),Z.forEach(s.in.reverse(),a(s)),Z.forEach(s.out,o(s))}return Z.map(Z.filter(i,function(u){return!u.merged}),function(u){return Z.pick(u,["vs","i","barycenter","weight"])})}(Z.filter(e,function(n){return!n.indegree}))},sie=function(r,t){var e=xn.partition(r,function(c){return Z.has(c,"barycenter")}),n=e.lhs,i=Z.sortBy(e.rhs,function(c){return-c.i}),a=[],o=0,s=0,u=0;n.sort((f=!!t,function(c,h){return c.barycenter<h.barycenter?-1:c.barycenter>h.barycenter?1:f?h.i-c.i:c.i-h.i})),u=dS(a,i,u),Z.forEach(n,function(c){u+=c.vs.length,a.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=dS(a,i,u)});var f,l={vs:Z.flatten(a,!0)};return s&&(l.barycenter=o/s,l.weight=s),l};function dS(r,t,e){for(var n;t.length&&(n=Z.last(t)).i<=e;)t.pop(),r.push(n.vs),e++;return e}var uie=function r(t,e,n,i){var a=t.children(e),o=t.node(e),s=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};s&&(a=Z.filter(a,function(p){return p!==s&&p!==u}));var l=aie(t,a);Z.forEach(l,function(p){if(t.children(p.v).length){var g=r(t,p.v,n,i);f[p.v]=g,Z.has(g,"barycenter")&&(y=p,m=g,Z.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=oie(l,n);(function(p,g){Z.forEach(p,function(y){y.vs=Z.flatten(y.vs.map(function(m){return g[m]?g[m].vs:m}),!0)})})(c,f);var h=sie(c,i);if(s&&(h.vs=Z.flatten([s,h.vs,u],!0),t.predecessors(s).length)){var d=t.node(t.predecessors(s)[0]),v=t.node(t.predecessors(u)[0]);Z.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},fie=ji.Graph,lie=function(r,t,e){var n=function(a){for(var o;a.hasNode(o=Z.uniqueId("_root")););return o}(r),i=new fie({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return Z.forEach(r.nodes(),function(a){var o=r.node(a),s=r.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||n),Z.forEach(r[e](a),function(u){var f=u.v===a?u.w:u.v,l=i.edge(f,a),c=Z.isUndefined(l)?0:l.weight;i.setEdge(f,a,{weight:r.edge(u).weight+c})}),Z.has(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i},cie=function(r,t,e){var n,i={};Z.forEach(e,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 t.setEdge(s,u);u=o}})},hie=ji.Graph,die=function(r){var t=xn.maxRank(r),e=vS(r,Z.range(1,t+1),"inEdges"),n=vS(r,Z.range(t-1,-1,-1),"outEdges"),i=rie(r);pS(r,i);for(var a,o=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){vie(s%2?e:n,s%4>=2),i=xn.buildLayerMatrix(r);var f=nie(r,i);f<o&&(u=0,a=Z.cloneDeep(i),o=f)}pS(r,a)};function vS(r,t,e){return Z.map(t,function(n){return lie(r,n,e)})}function vie(r,t){var e=new hie;Z.forEach(r,function(n){var i=n.graph().root,a=uie(n,i,e,t);Z.forEach(a.vs,function(o,s){n.node(o).order=s}),cie(n,e,a.vs)})}function pS(r,t){Z.forEach(t,function(e){Z.forEach(e,function(n,i){r.node(n).order=i})})}var pie=ji.Graph,gie=function(r){var t,e=xn.buildLayerMatrix(r),n=Z.merge(yie(r,e),mie(r,e)),i={};Z.forEach(["u","d"],function(o){t=o==="u"?e:Z.values(e).reverse(),Z.forEach(["l","r"],function(s){s==="r"&&(t=Z.map(t,function(c){return Z.values(c).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),f=xie(r,t,n,u),l=Eie(r,t,f.root,f.align,s==="r");s==="r"&&(l=Z.mapValues(l,function(c){return-c})),i[o+s]=l})});var a=wie(r,i);return _ie(i,a),Sie(i,r.graph().align)};function yie(r,t){var e={};return Z.reduce(t,function(n,i){var a=0,o=0,s=n.length,u=Z.last(i);return Z.forEach(i,function(f,l){var c=function(d,v){if(d.node(v).dummy)return Z.find(d.predecessors(v),function(p){return d.node(p).dummy})}(r,f),h=c?r.node(c).order:s;(c||f===u)&&(Z.forEach(i.slice(o,l+1),function(d){Z.forEach(r.predecessors(d),function(v){var p=r.node(v),g=p.order;!(g<a||h<g)||p.dummy&&r.node(d).dummy||ck(e,v,d)})}),o=l+1,a=h)}),i}),e}function mie(r,t){var e={};function n(i,a,o,s,u){var f;Z.forEach(Z.range(a,o),function(l){f=i[l],r.node(f).dummy&&Z.forEach(r.predecessors(f),function(c){var h=r.node(c);h.dummy&&(h.order<s||h.order>u)&&ck(e,c,f)})})}return Z.reduce(t,function(i,a){var o,s=-1,u=0;return Z.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}),e}function ck(r,t,e){if(t>e){var n=t;t=e,e=n}var i=r[t];i||(r[t]=i={}),i[e]=!0}function bie(r,t,e){if(t>e){var n=t;t=e,e=n}return Z.has(r[t],e)}function xie(r,t,e,n){var i={},a={},o={};return Z.forEach(t,function(s){Z.forEach(s,function(u,f){i[u]=u,a[u]=u,o[u]=f})}),Z.forEach(t,function(s){var u=-1;Z.forEach(s,function(f){var l=n(f);if(l.length)for(var c=((l=Z.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]&&!bie(e,f,v)&&(a[v]=f,a[f]=i[f]=i[v],u=o[v])}})}),{root:i,align:a}}function Eie(r,t,e,n,i){var a={},o=function(f,l,c,h){var d=new pie,v=f.graph(),p=function(g,y,m){return function(b,x,E){var w,_=b.node(x),M=b.node(E),C=0;if(C+=_.width/2,Z.has(_,"labelpos"))switch(_.labelpos.toLowerCase()){case"l":w=-_.width/2;break;case"r":w=_.width/2}if(w&&(C+=m?w:-w),w=0,C+=(_.dummy?y:g)/2,C+=(M.dummy?y:g)/2,C+=M.width/2,Z.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":w=M.width/2;break;case"r":w=-M.width/2}return w&&(C+=m?w:-w),w=0,C}}(v.nodesep,v.edgesep,h);return Z.forEach(l,function(g){var y;Z.forEach(g,function(m){var b=c[m];if(d.setNode(b),y){var x=c[y],E=d.edge(x,b);d.setEdge(x,b,Math.max(p(f,m,y),E||0))}y=m})}),d}(r,t,e,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)),Z.forEach(n,function(f){a[f]=a[e[f]]}),a}function wie(r,t){return Z.minBy(Z.values(t),function(e){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Z.forIn(e,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 _ie(r,t){var e=Z.values(t),n=Z.min(e),i=Z.max(e);Z.forEach(["u","d"],function(a){Z.forEach(["l","r"],function(o){var s,u=a+o,f=r[u];if(f!==t){var l=Z.values(f);(s=o==="l"?n-Z.min(l):i-Z.max(l))&&(r[u]=Z.mapValues(f,function(c){return c+s}))}})})}function Sie(r,t){return Z.mapValues(r.ul,function(e,n){if(t)return r[t.toLowerCase()][n];var i=Z.sortBy(Z.map(r,n));return(i[1]+i[2])/2})}var Mie=gie,Cie=function(r){(function(t){var e=xn.buildLayerMatrix(t),n=t.graph().ranksep,i=0;Z.forEach(e,function(a){var o=Z.max(Z.map(a,function(s){return t.node(s).height}));Z.forEach(a,function(s){t.node(s).y=i+o/2}),i+=o+n})})(r=xn.asNonCompoundGraph(r)),Z.forEach(Mie(r),function(t,e){r.node(e).x=t})},Aie=xn.normalizeRanks,Tie=xn.removeEmptyRanks,co=xn,Iie=ji.Graph,Oie=function(r,t){var e=t&&t.debugTiming?co.time:co.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return function(i){var a=new Iie({multigraph:!0,compound:!0}),o=c0(i.graph());return a.setGraph(Z.merge({},Die,l0(o,Lie),Z.pick(o,kie))),Z.forEach(i.nodes(),function(s){var u=c0(i.node(s));a.setNode(s,Z.defaults(l0(u,Pie),Nie)),a.setParent(s,i.parent(s))}),Z.forEach(i.edges(),function(s){var u=c0(i.edge(s));a.setEdge(s,Z.merge({},Bie,l0(u,Rie),Z.pick(u,Fie)))}),a}(r)});e(" runLayout",function(){(function(i,a){a(" makeSpaceForEdgeLabels",function(){(function(o){var s=o.graph();s.ranksep/=2,Z.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){Z.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(){tS.run(i)}),a(" nestingGraph.run",function(){uS.run(i)}),a(" rank",function(){Qne(co.asNonCompoundGraph(i))}),a(" injectEdgeLabelProxies",function(){(function(o){Z.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};co.addDummyNode(o,"edge-proxy",l,"_ep")}})})(i)}),a(" removeEmptyRanks",function(){Tie(i)}),a(" nestingGraph.cleanup",function(){uS.cleanup(i)}),a(" normalizeRanks",function(){Aie(i)}),a(" assignRankMinMax",function(){(function(o){var s=0;Z.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=Z.max(s,f.maxRank))}),o.graph().maxRank=s})(i)}),a(" removeEdgeLabelProxies",function(){(function(o){Z.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(){aS.run(i)}),a(" parentDummyChains",function(){eie(i)}),a(" addBorderSegments",function(){tie(i)}),a(" order",function(){die(i)}),a(" insertSelfEdges",function(){(function(o){var s=co.buildLayerMatrix(o);Z.forEach(s,function(u){var f=0;Z.forEach(u,function(l,c){var h=o.node(l);h.order=c+f,Z.forEach(h.selfEdges,function(d){co.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(){lS.adjust(i)}),a(" position",function(){Cie(i)}),a(" positionSelfEdges",function(){(function(o){Z.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){Z.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(Z.last(u.borderLeft)),h=o.node(Z.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}}),Z.forEach(o.nodes(),function(s){o.node(s).dummy==="border"&&o.removeNode(s)})})(i)}),a(" normalize.undo",function(){aS.undo(i)}),a(" fixupEdgeLabelCoords",function(){(function(o){Z.forEach(o.edges(),function(s){var u=o.edge(s);if(Z.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(){lS.undo(i)}),a(" translateGraph",function(){(function(o){var s=Number.POSITIVE_INFINITY,u=0,f=Number.POSITIVE_INFINITY,l=0,c=o.graph(),h=c.marginx||0,d=c.marginy||0;function v(p){var g=p.x,y=p.y,m=p.width,b=p.height;s=Math.min(s,g-m/2),u=Math.max(u,g+m/2),f=Math.min(f,y-b/2),l=Math.max(l,y+b/2)}Z.forEach(o.nodes(),function(p){v(o.node(p))}),Z.forEach(o.edges(),function(p){var g=o.edge(p);Z.has(g,"x")&&v(g)}),s-=h,f-=d,Z.forEach(o.nodes(),function(p){var g=o.node(p);g.x-=s,g.y-=f}),Z.forEach(o.edges(),function(p){var g=o.edge(p);Z.forEach(g.points,function(y){y.x-=s,y.y-=f}),Z.has(g,"x")&&(g.x-=s),Z.has(g,"y")&&(g.y-=f)}),c.width=u-s+h,c.height=l-f+d})(i)}),a(" assignNodeIntersects",function(){(function(o){Z.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(co.intersectRect(c,u)),l.points.push(co.intersectRect(h,f))})})(i)}),a(" reversePoints",function(){(function(o){Z.forEach(o.edges(),function(s){var u=o.edge(s);u.reversed&&u.points.reverse()})})(i)}),a(" acyclic.undo",function(){tS.undo(i)})})(n,e)}),e(" updateInputGraph",function(){(function(i,a){Z.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))}),Z.forEach(i.edges(),function(o){var s=i.edge(o),u=a.edge(o);s.points=u.points,Z.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)})})},Lie=["nodesep","edgesep","ranksep","marginx","marginy"],Die={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},kie=["acyclicer","ranker","rankdir","align"],Pie=["width","height"],Nie={width:0,height:0},Rie=["minlen","weight","width","height","labeloffset"],Bie={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Fie=["labelpos"];function l0(r,t){return Z.mapValues(Z.pick(r,t),Number)}function c0(r){var t={};return Z.forEach(r,function(e,n){t[n.toLowerCase()]=e}),t}var Gie=ji.Graph,hk={graphlib:ji,layout:Oie,debug:{debugOrdering:function(r){var t=xn.buildLayerMatrix(r),e=new Gie({compound:!0,multigraph:!0}).setGraph({});return Z.forEach(r.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+r.node(n).rank)}),Z.forEach(r.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),Z.forEach(t,function(n,i){var a="layer"+i;e.setNode(a,{rank:"same"}),Z.reduce(n,function(o,s){return e.setEdge(o,s,{style:"invis"}),s})}),e}},util:{time:xn.time,notime:xn.notime},version:"0.8.5"},zie=hk.graphlib,jie=hk.layout;class Uie{constructor(t){this.cardinality=1,this.include=Os.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=Bn.NODE,this.name=t.name,this.attr=t.attr||{},this.inputs=t.inputs,this.path=t.path||[],this.width=t.width,this.height=t.height}}class $ie{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}function Wie(r){const t=new $ie;return r.nodes.map(e=>new Uie(e)).forEach(e=>{t.nodes[e.name]=e,e.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}))})(t,e,n)})}),t}class Xie{constructor(t,e={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=Os.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=Bn.META,this.path=[],this.name=t,this.metaGraph=ob(t,Xu.META,e)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(t=>this.metaGraph.node(t))}leaves(){let t,e=[],n=[this];for(;n.length;){let i=n.shift();i.isGroupNode?(t=i.metaGraph,t.nodes().forEach(a=>n.push(t.node(a)))):e.push(i.name)}return e}}class Yie{constructor(t,e){this.v=t,this.w=e,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(t,e){this.baseEdgeList.push(t)}}function dk(r,t={}){return new Xie(r,t)}function vk(r,t){return new Yie(r,t)}function ob(r,t,e){const n=e||{},i=new zie.Graph(n);return i.setGraph({name:r,rankdir:n.rankdir,type:t,align:n.align}),i}class Vie{constructor(t={}){this.graphOptions=t,this.index={},this.graphOptions.compound=!0,this.root=dk(Wu,this.graphOptions),this.index[Wu]=this.root}getNodeMap(){return this.index}node(t){return this.index[t]}setNode(t,e){this.index[t]=e}getBridgeGraph(t){const e=this.index[t];if(!e)throw Error("Could not find node in hierarchy: "+t);if(!("metaGraph"in e))return null;const n=e;if(n.bridgeGraph)return n.bridgeGraph;const i=ob(nD,Xu.BRIDGE,this.graphOptions);if(n.bridgeGraph=i,!e.parentNode||!("metaGraph"in e.parentNode))return i;const a=e.parentNode;return[a.metaGraph,this.getBridgeGraph(a.name)].forEach(o=>{o.edges().filter(s=>s.v===t||s.w===t).forEach(s=>{const u=s.w===t;o.edge(s).baseEdgeList.forEach(f=>{const[l,c]=u?[f.w,s.v]:[f.v,s.w],h=this.getChildName(t,l),d={v:u?c:h,w:u?h:c};let v=i.edge(d);v||(v=vk(d.v,d.w),v.inbound=u,i.setEdge(d.v,d.w,v)),v.addBaseEdge(f,this)})})}),i}getChildName(t,e){let n=this.index[e];for(;n;){if(n.parentNode&&n.parentNode.name===t)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+e)}getPredecessors(t){const e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!0)}getSuccessors(t){const e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!1)}getOneWayEdges(t,e){const n=[];if(!t.parentNode||!t.parentNode.isGroupNode)return n;const i=t.parentNode,a=i.metaGraph,o=this.getBridgeGraph(i.name);return gS(a,t,e,n),gS(o,t,e,n),n}}function Hie(r,t){const{rankDirection:e,align:n}=t,i=new Vie({rankdir:e,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=dk(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=vk(p,g),v.metaGraph.setEdge(p,g,y)),y.addBaseEdge(c,a)})}(i,r),i}function gS(r,t,e,n){(e?r.inEdges(t.name):r.outEdges(t.name)).forEach(i=>{const a=r.edge(i);n.push(a)})}class Kie{constructor(t){this.hierarchy=t,this.index={},this.hasSubHierarchy={},this.root=new mS(this.hierarchy.root,this.hierarchy.graphOptions),this.index[t.root.name]=this.root,this.buildSubHierarchy(t.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(t){if(t in this.hasSubHierarchy)return;this.hasSubHierarchy[t]=!0;const e=this.index[t];if(e.node.type!==Bn.META)return;const n=e,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 yS(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(t);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=E=>{const w=h?{v:E,w:t}:{v:t,w:E};return s.coreGraph.edge(w)};let g=p(v);g||(g=p(u(h,v,o.name)));const y=u(h,t),m=u(h,v,t);let b=a.node(m);if(!b){let E=a.node(y);if(!E){const _={name:y,type:Bn.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:Os.UNSPECIFIED,inbound:h,attr:{}};E=new nd(_),this.index[y]=E,a.setNode(y,E)}const w={name:m,type:Bn.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:Os.UNSPECIFIED,inbound:h,attr:{}};b=new nd(w),this.index[m]=b,a.setNode(m,b),a.setParent(m,y),E.node.cardinality++}const x=new yS(c);x.adjoiningMetaEdge=g,h?a.setEdge(m,d,x):a.setEdge(d,m,x)})}getOrCreateRenderNodeByName(t){if(!t)return null;if(t in this.index)return this.index[t];const e=this.getNodeByName(t);return e?(this.index[t]=e.isGroupNode?new mS(e,this.hierarchy.graphOptions):new nd(e),this.index[t]):null}getRenderNodeByName(t){return this.index[t]}getNodeByName(t){return this.hierarchy.node(t)}}class nd{constructor(t){this.node=t,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=t.width||0,this.height=t.height||0,this.displayName=t.name,this.attr=t.attr}}class yS{constructor(t){this.metaEdge=t,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class mS extends nd{constructor(t,e){super(t);const n=t.metaGraph.graph();e.compound=!0,this.coreGraph=ob(n.name,Xu.CORE,e)}}function pk(r,t){r.node.isGroupNode&&function(e,n){const i=ky(n);e.coreGraph.nodes().map(a=>e.coreGraph.node(a)).forEach(a=>{var o,s,u,f,l,c;const{height:h,width:d}=a;switch(a.node.type){case Bn.NODE:Object.assign(a,i.nodeSize.node),a.height=h||i.nodeSize.node.height,a.width=d||i.nodeSize.node.width;break;case Bn.BRIDGE:Object.assign(a,i.nodeSize.bridge);break;case Bn.META:a.expanded?pk(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,t),r.node.type===Bn.META&&function(e,n){const i=ky(n),a=i.subScene.meta;Object.assign(e,a);const{nodeSep:o,rankSep:s,edgeSep:u,align:f}=i.graph.meta,l={nodesep:o,ranksep:s,edgesep:u,align:f};Object.assign(e.coreBox,function(d,v){const{ranksep:p,nodesep:g,edgesep:y,align:m}=v;Object.assign(d.graph(),{ranksep:p,nodesep:g,edgesep:y,align:m});const b=[];if(d.nodes().forEach(M=>{d.node(M).node.type!==Bn.BRIDGE&&b.push(M)}),!b.length)return{width:0,height:0};jie(d);let x=1/0,E=1/0,w=-1/0,_=-1/0;return b.forEach(M=>{const C=d.node(M),S=.5*C.width,A=C.x-S,T=C.x+S;x=A<x?A:x,w=T>w?T:w;const I=.5*C.height,D=C.y-I,N=C.y+I;E=D<E?D:E,_=N>_?N:_}),d.edges().forEach(M=>{const C=d.edge(M),S=d.node(C.metaEdge.v),A=d.node(C.metaEdge.w);if(C.points.length===3&&function(D){let N=bS(D[0],D[1]);for(let P=1;P<D.length-1;P++){const G=bS(D[P],D[P+1]);if(Math.abs(G-N)>1)return!1;N=G}return!0}(C.points)){if(S!=null){const D=S.expanded?S.x:Wy(S);C.points[0].x=D}if(A!=null){const D=A.expanded?A.x:Wy(A);C.points[2].x=D}C.points=[C.points[0],C.points[1]]}const T=C.points[C.points.length-2];A!=null&&(C.points[C.points.length-1]=xS(T,A));const I=C.points[1];S!=null&&(C.points[0]=xS(I,S)),C.points.forEach(D=>{x=D.x<x?D.x:x,w=D.x>w?D.x:w,E=D.y<E?D.y:E,_=D.y>_?D.y:_})}),d.nodes().forEach(M=>{const C=d.node(M);C.x-=x,C.y-=E}),d.edges().forEach(M=>{d.edge(M).points.forEach(C=>{C.x-=x,C.y-=E})}),{width:w-x,height:_-E}}(e.coreGraph,l));let c=0;e.coreGraph.nodeCount()>0&&c++;const h=c<=1?0:c;e.coreBox.width+=h+h,e.coreBox.height=a.labelHeight+e.coreBox.height,e.width=e.coreBox.width+a.paddingLeft+a.paddingRight,e.height=e.paddingTop+e.coreBox.height+e.paddingBottom}(r,t)}function bS(r,t){const e=t.x-r.x,n=t.y-r.y;return 180*Math.atan(n/e)/Math.PI}function Wy(r){return r.expanded?r.x:r.x-r.width/2+0+r.coreBox.width/2}function xS(r,t){const e=t.expanded?t.x:Wy(t),n=t.y,i=r.x-e,a=r.y-n;let o,s,u=t.expanded?t.width:t.coreBox.width,f=t.expanded?t.height:t.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:e+o,y:n+s}}function qie(r,t,e){var n,i,a,o;const s=r.nodes.filter((c,h,d)=>d.findIndex(v=>v.id===c.id)!==h).map(c=>c.id);if(s.length)throw new Error(`Duplicated ids found: ${s.join(", ")}`);const u=function(c){const h={nodes:[]},d=c.compound,v=Object.keys(d||{}),p=new Map,g=(m,b=[])=>{if(p.has(m))return p.get(m);for(let x=0;x<v.length;x++){let E=v[x];if(d&&d[E].indexOf(m)!==-1)return b.unshift(E),g(E,b)}return b.length===0&&p.set(m,b),b},y=m=>c.edges.filter(b=>b.w===m).map(b=>({name:b.v}));return c.nodes.forEach(m=>{const b=m.id,x=[...g(b),b];let E=y(b);h.nodes.push({name:b,path:x,inputs:E,width:m.width,height:m.height,attr:Object.assign({},m)})}),h}(r),f=function(c,h){const d=(p,g)=>{for(let y of g.values())if(y.includes(p))return!0;return!1},v=(p,g=[])=>{if(Object.keys(p).length===0)return[...new Set(g)];const y=new Map(Object.keys(p).map(b=>[b,p[b]])),m={};for(let[b,x]of y)d(b,y)?m[b]=x:g=g.concat(b,x);return v(m,g)};return v(c).filter(p=>h.includes(p))}(r.compound||{},(t==null?void 0:t.expanded)||[]),l=function(c,h){return function(d){return new Kie(d)}(Hie(Wie(c),h))}(u,{rankDirection:((i=(n=e==null?void 0:e.graph)===null||n===void 0?void 0:n.meta)===null||i===void 0?void 0:i.rankDir)||(t==null?void 0:t.rankDirection)||Fd.graph.meta.rankDir,align:((o=(a=e==null?void 0:e.graph)===null||a===void 0?void 0:a.meta)===null||o===void 0?void 0:o.align)||Fd.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),pk(l.root,e),gk(l.root)}function Zie(r,t=!1){const e=JSON.parse(JSON.stringify(r)),n={nodes:[e],edges:[...e.edges]};return e.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)}),t&&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!==Wu&&(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 Qie(r,t,e,n){var i,a;let o=[];const s=((i=e.find(c=>c.id===r))===null||i===void 0?void 0:i.path)||[],u=((a=e.find(c=>c.id===t))===null||a===void 0?void 0:a.path)||[],f=[Wu,...s].slice(0,s.length).reverse(),l=[Wu,...u].slice(0,u.length);return f.forEach(c=>{const h=e.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)||t))))}),l.filter(c=>!f.includes(c)).forEach(c=>{const h=e.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)||t))))}),o}function gk(r){const t=r.coreGraph.nodes().map(n=>r.coreGraph.node(n));return Object.assign(Object.assign({},ES(r)),{expanded:r.expanded,nodes:r.expanded?(e=t,e.map(n=>n.node.type===Bn.META?gk(n):ES(n))):[],edges:r.expanded?Jie(r):[]});var e}function ES(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 Jie(r){return r.coreGraph.edges().map(t=>({renderInfoEdge:r.coreGraph.edge(t),edge:t})).filter(({renderInfoEdge:t})=>t.metaEdge).map(({edge:t,renderInfoEdge:e})=>{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,e);return{adjoiningEdge:e.adjoiningMetaEdge?{w:e.adjoiningMetaEdge.metaEdge.w,v:e.adjoiningMetaEdge.metaEdge.v}:null,inbound:e.metaEdge.inbound,w:t.w,v:t.v,points:n,weight:e.weight,baseEdgeList:e.metaEdge.baseEdgeList,parentNodeName:r.node.name}})}const eae=Object.freeze(Object.defineProperty({__proto__:null,BRIDGE_GRAPH_NAME:nD,get GraphType(){return Xu},get HierarchyNodeType(){return Py},get InclusionType(){return Os},LAYOUT_CONFIG:Fd,get NodeType(){return Bn},ROOT_NAME:Wu,buildGraph:qie,flatGraph:Zie,getEdges:Qie,mergeConfig:ky},Symbol.toStringTag,{value:"Module"})),tae=ma(eae);var rae=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ii=xe&&xe.__assign||function(){return Ii=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Ii.apply(this,arguments)},uu=xe&&xe.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Zl,"__esModule",{value:!0});Zl.DagreCompoundLayout=void 0;var nae=Wr,ui=tae,xh=Nr(),iae=function(r){rae(t,r);function t(e){var n=r.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.edgesep=5,n.ranksep=50,n.controlPoints=!0,n.anchorPoint=!0,n.nodes=[],n.edges=[],n.combos=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,begin:void 0,nodeSize:void 0,nodesep:50,ranksep:50,controlPoints:!0,anchorPoint:!0}},t.prototype.init=function(e){var n=e.hiddenNodes||[],i=e.hiddenEdges||[],a=e.hiddenCombos||[];this.nodes=this.getDataByOrder((e.nodes||[]).concat(n)),this.edges=this.getDataByOrder((e.edges||[]).concat(i)),this.combos=(e.combos||[]).concat(a.map(function(o){return Ii(Ii({},o),{collapsed:!0})}))},t.prototype.execute=function(){var e=this,n=e.nodes,i=e.edges;if(n){var a=e.getLayoutConfig(),o=a.graphDef,s=a.graphOption,u=a.graphSettings,f=(0,ui.buildGraph)(o,s,u),l=(0,ui.flatGraph)(f,!0);return this.updatePosition(l),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:n,edges:i}}},t.prototype.getNodePath=function(e){var n=this,i=n.nodes,a=n.combos,o=i.find(function(u){return u.id===e}),s=function(u,f){f===void 0&&(f=[]);var l=a.find(function(c){return c.id===u});return l?(f.unshift(u),l.parentId?s(l.parentId,f):f):f};return o&&o.comboId?s(o.comboId,[e]):[e]},t.prototype.getLayoutConfig=function(){var e,n,i,a=this,o=a.nodes,s=a.edges,u=a.combos,f=a.nodeSize,l=a.rankdir,c=a.align,h=a.edgesep,d=a.nodesep,v=a.ranksep,p=a.settings,g=(u||[]).reduce(function(P,G){var W=o.filter(function(R){return R.comboId===G.id}).map(function(R){return R.id}),k=(u||[]).filter(function(R){return R.parentId===G.id}).map(function(R){return R.id});return(W.length||k.length)&&(P[G.id]=uu(uu([],W,!0),k,!0)),P},{}),y;f?(0,xh.isArray)(f)?y=function(){return f}:y=function(){return[f,f]}:y=function(P){return P&&P.size?(0,xh.isArray)(P.size)?P.size:(0,xh.isObject)(P.size)?[P.size.width||40,P.size.height||40]:[P.size,P.size]:[40,40]};var m=function(P){return P&&P.size?(0,xh.isArray)(P.size)?P.size:[P.size,P.size]:[80,40]},b=m(u==null?void 0:u[0]),x=b[0],E=b[1],w=(n=(e=a.graphSettings)===null||e===void 0?void 0:e.subScene)===null||n===void 0?void 0:n.meta,_=((i=u.find(function(P){return!P.collapsed}))===null||i===void 0?void 0:i.padding)||[20,20,20,20],M=_[0],C=_[1],S=_[2],A=_[3],T={compound:g,nodes:uu([],(o||[]).map(function(P){var G=y(P),W=G[0],k=G[1];return Ii(Ii({},P),{width:W,height:k})}),!0),edges:uu([],(s||[]).map(function(P){return Ii(Ii({},P),{v:P.source,w:P.target})}),!0)},I={expanded:(u||[]).filter(function(P){return!P.collapsed}).map(function(P){return P.id})},D={graph:{meta:{align:c,rankDir:l,nodeSep:d,edgeSep:h,rankSep:v}},subScene:{meta:{paddingTop:M||(w==null?void 0:w.paddingTop)||20,paddingRight:C||(w==null?void 0:w.paddingRight)||20,paddingBottom:S||(w==null?void 0:w.paddingBottom)||20,paddingLeft:A||(w==null?void 0:w.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:x,height:E}}},N=(0,ui.mergeConfig)(p,Ii({},(0,ui.mergeConfig)(D,ui.LAYOUT_CONFIG)));return a.graphSettings=N,{graphDef:T,graphOption:I,graphSettings:N}},t.prototype.updatePosition=function(e){var n=e.nodes,i=e.edges;this.updateNodePosition(n,i),this.updateEdgePosition(n,i)},t.prototype.getBegin=function(e,n){var i=this,a=i.begin,o=[0,0];if(a){var s=1/0,u=1/0;e.forEach(function(f){s>f.x&&(s=f.x),u>f.y&&(u=f.y)}),n.forEach(function(f){f.points.forEach(function(l){s>l.x&&(s=l.x),u>l.y&&(u=l.y)})}),o[0]=a[0]-s,o[1]=a[1]-u}return o},t.prototype.updateNodePosition=function(e,n){var i=this,a=i.combos,o=i.nodes,s=i.edges,u=i.anchorPoint,f=i.graphSettings,l=this.getBegin(e,n);e.forEach(function(c){var h,d=c.x,v=c.y,p=c.id,g=c.type,y=c.coreBox;if(g===ui.HierarchyNodeType.META&&p!==ui.ROOT_NAME){var m=a.findIndex(function(_){return _.id===p}),b=(h=f==null?void 0:f.subScene)===null||h===void 0?void 0:h.meta;a[m].offsetX=d+l[0],a[m].offsetY=v+l[1],a[m].fixSize=[y.width,y.height],a[m].fixCollapseSize=[y.width,y.height],c.expanded?a[m].padding=[b==null?void 0:b.paddingTop,b==null?void 0:b.paddingRight,b==null?void 0:b.paddingBottom,b==null?void 0:b.paddingLeft]:a[m].padding=[0,0,0,0]}else if(g===ui.HierarchyNodeType.OP){var m=o.findIndex(function(M){return M.id===p});if(o[m].x=d+l[0],o[m].y=v+l[1],u){var x=[],E=n.filter(function(M){return M.v===p}),w=n.filter(function(M){return M.w===p});E.length>0&&E.forEach(function(M){var C=M.points[0],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var I=s.find(function(D){return D.source===T.v&&D.target===T.w});I&&(I.sourceAnchor=x.length-1)})}),w.length>0&&w.forEach(function(M){var C=M.points[M.points.length-1],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var I=s.find(function(D){return D.source===T.v&&D.target===T.w});I&&(I.targetAnchor=x.length-1)})}),o[m].anchorPoints=x.length>0?x:o[m].anchorPoints||[]}}})},t.prototype.updateEdgePosition=function(e,n){var i=this,a=i.combos,o=i.edges,s=i.controlPoints,u=this.getBegin(e,n);s&&(a.forEach(function(f){f.inEdges=[],f.outEdges=[]}),o.forEach(function(f){var l,c,h,d,v=e.find(function(_){return _.id===f.source}),p=e.find(function(_){return _.id===f.target}),g=[],y=[];if(v&&p)y=(0,ui.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,e);else if(!v||!p){var m=i.getNodePath(f.source),b=i.getNodePath(f.target),x=m.reverse().slice(v?0:1).find(function(_){return e.find(function(M){return M.id===_})}),E=b.reverse().slice(p?0:1).find(function(_){return e.find(function(M){return M.id===_})});v=e.find(function(_){return _.id===x}),p=e.find(function(_){return _.id===E}),y=(0,ui.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,e,{v:f.source,w:f.target})}if(g=y.reduce(function(_,M){return uu(uu([],_,!0),M.points.map(function(C){return Ii(Ii({},C),{x:C.x+u[0],y:C.y+u[1]})}),!0)},[]),g=g.slice(1,-1),f.controlPoints=g,(p==null?void 0:p.type)===ui.NodeType.META){var w=a.findIndex(function(_){return _.id===(p==null?void 0:p.id)});if(!a[w]||!((l=a[w].inEdges)===null||l===void 0)&&l.some(function(_){return _.source===v.id&&_.target===p.id}))return;(c=a[w].inEdges)===null||c===void 0||c.push({source:v.id,target:p.id,controlPoints:g})}if((v==null?void 0:v.type)===ui.NodeType.META){var w=a.findIndex(function(M){return M.id===(v==null?void 0:v.id)});if(!a[w]||!((h=a[w].outEdges)===null||h===void 0)&&h.some(function(M){return M.source===v.id&&M.target===p.id}))return;(d=a[w].outEdges)===null||d===void 0||d.push({source:v.id,target:p.id,controlPoints:g})}}))},t.prototype.getType=function(){return"dagreCompound"},t.prototype.getDataByOrder=function(e){return e.every(function(n){return n.layoutOrder!==void 0})||e.forEach(function(n,i){n.layoutOrder=i}),e.sort(function(n,i){return n.layoutOrder-i.layoutOrder})},t}(nae.Base);Zl.DagreCompoundLayout=iae;var sb={},Jv={},ub={};const aae=Object.prototype.toString;function Yd(r){const t=aae.call(r);return t.endsWith("Array]")&&!t.includes("Big")}function oae(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Yd(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,n=e===void 0?0:e,i=t.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 sae(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Yd(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,n=e===void 0?0:e,i=t.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 wS(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Yd(r)){if(r.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var e;if(t.output!==void 0){if(!Yd(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(r.length);var n=sae(r),i=oae(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=t.min,o=a===void 0?t.autoMinMax?n:0:a,s=t.max,u=s===void 0?t.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++)e[l]=(r[l]-n)*f+o;return e}const Eh=" ".repeat(2),yk=" ".repeat(4);function uae(){return mk(this)}function mk(r,t={}){const{maxRows:e=15,maxColumns:n=10,maxNumSize:i=8}=t;return`${r.constructor.name} {
34
- ${Eh}[
35
- ${yk}${fae(r,e,n,i)}
36
- ${Eh}]
37
- ${Eh}rows: ${r.rows}
38
- ${Eh}columns: ${r.columns}
39
- }`}function fae(r,t,e,n){const{rows:i,columns:a}=r,o=Math.min(i,t),s=Math.min(a,e),u=[];for(let f=0;f<o;f++){let l=[];for(let c=0;c<s;c++)l.push(lae(r.get(f,c),n));u.push(`${l.join(" ")}`)}return s!==a&&(u[u.length-1]+=` ... ${a-e} more columns`),o!==i&&u.push(`... ${i-t} more rows`),u.join(`
40
- ${yk}`)}function lae(r,t){const e=String(r);if(e.length<=t)return e.padEnd(t," ");const n=r.toPrecision(t-2);if(n.length<=t)return n;const i=r.toExponential(t-2),a=i.indexOf("e"),o=i.slice(a);return i.slice(0,t-o.length)+o}function cae(r,t){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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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=t.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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(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 t(n).trunc()},r.pow=function(n,i){return new t(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=t.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 di(r,t,e){let n=e?r.rows:r.rows-1;if(t<0||t>n)throw new RangeError("Row index out of range")}function vi(r,t,e){let n=e?r.columns:r.columns-1;if(t<0||t>n)throw new RangeError("Column index out of range")}function bu(r,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==r.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function xu(r,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==r.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function bk(r,t,e){return{row:xk(r,t),column:Ek(r,e)}}function xk(r,t){if(typeof t!="object")throw new TypeError("unexpected type for row indices");if(t.some(n=>n<0||n>=r.rows))throw new RangeError("row indices are out of range");return Array.isArray(t)||(t=Array.from(t)),t}function Ek(r,t){if(typeof t!="object")throw new TypeError("unexpected type for column indices");if(t.some(n=>n<0||n>=r.columns))throw new RangeError("column indices are out of range");return Array.isArray(t)||(t=Array.from(t)),t}function Xy(r,t,e,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(wh("startRow",t),wh("endRow",e),wh("startColumn",n),wh("endColumn",i),t>e||n>i||t<0||t>=r.rows||e<0||e>=r.rows||n<0||n>=r.columns||i<0||i>=r.columns)throw new RangeError("Submatrix indices are out of range")}function ep(r,t=0){let e=[];for(let n=0;n<r;n++)e.push(t);return e}function wh(r,t){if(typeof t!="number")throw new TypeError(`${r} must be a number`)}function hae(r){let t=ep(r.rows);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[e]+=r.get(e,n);return t}function dae(r){let t=ep(r.columns);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[n]+=r.get(e,n);return t}function vae(r){let t=0;for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)t+=r.get(e,n);return t}function pae(r){let t=ep(r.rows,1);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[e]*=r.get(e,n);return t}function gae(r){let t=ep(r.columns,1);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[n]*=r.get(e,n);return t}function yae(r){let t=1;for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)t*=r.get(e,n);return t}function mae(r,t,e){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)-e[o],s+=f,u+=f*f;t?a.push((u-s*s/i)/(i-1)):a.push((u-s*s/i)/i)}return a}function bae(r,t,e){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)-e[o],s+=f,u+=f*f;t?a.push((u-s*s/n)/(n-1)):a.push((u-s*s/n)/n)}return a}function xae(r,t,e){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)-e,o+=u,s+=u*u;return t?(s-o*o/a)/(a-1):(s-o*o/a)/a}function Eae(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t[e])}function wae(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t[n])}function _ae(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t)}function Sae(r){const t=[];for(let e=0;e<r.rows;e++){let n=0;for(let i=0;i<r.columns;i++)n+=Math.pow(r.get(e,i),2)/(r.columns-1);t.push(Math.sqrt(n))}return t}function Mae(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[e])}function Cae(r){const t=[];for(let e=0;e<r.columns;e++){let n=0;for(let i=0;i<r.rows;i++)n+=Math.pow(r.get(i,e),2)/(r.rows-1);t.push(Math.sqrt(n))}return t}function Aae(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[n])}function Tae(r){const t=r.size-1;let e=0;for(let n=0;n<r.columns;n++)for(let i=0;i<r.rows;i++)e+=Math.pow(r.get(i,n),2)/t;return Math.sqrt(e)}function Iae(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t)}class Kt{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let a=new dt(t,e);for(let o=0;o<t;o++)for(let s=0;s<e;s++)a.set(o,s,n[o*e+s]);return a}static rowVector(t){let e=new dt(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new dt(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new dt(t,e)}static ones(t,e){return new dt(t,e).fill(1)}static rand(t,e,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new dt(t,e);for(let o=0;o<t;o++)for(let s=0;s<e;s++)a.set(o,s,i());return a}static randInt(t,e,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:o=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");let s=a-i,u=new dt(t,e);for(let f=0;f<t;f++)for(let l=0;l<e;l++){let c=i+Math.round(o()*s);u.set(f,l,c)}return u}static eye(t,e,n){e===void 0&&(e=t),n===void 0&&(n=1);let i=Math.min(t,e),a=this.zeros(t,e);for(let o=0;o<i;o++)a.set(o,o,n);return a}static diag(t,e,n){let i=t.length;e===void 0&&(e=i),n===void 0&&(n=e);let a=Math.min(i,e,n),o=this.zeros(e,n);for(let s=0;s<a;s++)o.set(s,s,t[s]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,a=new dt(n,i);for(let o=0;o<n;o++)for(let s=0;s<i;s++)a.set(o,s,Math.min(t.get(o,s),e.get(o,s)));return a}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.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(t.get(o,s),e.get(o,s)));return a}static checkMatrix(t){return Kt.isMatrix(t)?t:new dt(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 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 t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);for(let o=e+1;o<this.rows;o++)this.get(t,o)!==0&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let i=e;for(let a=e;a<t.rows;a++)t.get(a,n)>t.get(i,n)&&(i=a);if(t.get(i,n)===0)n++;else{t.swapRows(e,i);let a=t.get(e,n);for(let o=n;o<t.columns;o++)t.set(e,o,t.get(e,o)/a);for(let o=e+1;o<t.rows;o++){let s=t.get(o,n)/t.get(e,n);t.set(o,n,0);for(let u=n+1;u<t.columns;u++)t.set(o,u,t.get(o,u)-t.get(e,u)*s)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,i=n-1;for(;i>=0;)if(t.maxRow(i)===0)i--;else{let a=0,o=!1;for(;a<n&&o===!1;)t.get(i,a)===1?o=!0:a++;for(let s=0;s<i;s++){let u=t.get(s,a);for(let f=a;f<e;f++){let l=t.get(s,f)-u*t.get(i,f);t.set(s,f,l)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new dt(this.rows*e,this.columns*n);for(let a=0;a<e;a++)for(let o=0;o<n;o++)i.setSubMatrix(this,this.rows*a,this.columns*o);return i}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){di(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return dt.rowVector(this.getRow(t))}setRow(t,e){di(this,t),e=bu(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){di(this,t),di(this,e);for(let n=0;n<this.columns;n++){let i=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,i)}return this}getColumn(t){vi(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return dt.columnVector(this.getColumn(t))}setColumn(t,e){vi(this,t),e=xu(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){vi(this,t),vi(this,e);for(let n=0;n<this.rows;n++){let i=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,i)}return this}addRowVector(t){t=bu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=bu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=bu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=bu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=xu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=xu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=xu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=xu(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){di(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){vi(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(){let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}maxIndex(){let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}min(){let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}minIndex(){let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}maxRow(t){di(this,t);let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){di(this,t);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),n[1]=i);return n}minRow(t){di(this,t);let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){di(this,t);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),n[1]=i);return n}maxColumn(t){vi(this,t);let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){vi(this,t);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),n[0]=i);return n}minColumn(t){vi(this,t);let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){vi(this,t);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t),n[0]=i);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){let e=0;if(t==="max")return this.max();if(t==="frobenius"){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)e=e+this.get(n,i)*this.get(n,i);return Math.sqrt(e)}else throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){Kt.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i];return n}mmul(t){t=dt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.columns,a=new dt(e,i),o=new Float64Array(n);for(let s=0;s<i;s++){for(let u=0;u<n;u++)o[u]=t.get(u,s);for(let u=0;u<e;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(t){t=dt.checkMatrix(t);let e=new dt(2,2);const n=this.get(0,0),i=t.get(0,0),a=this.get(0,1),o=t.get(0,1),s=this.get(1,0),u=t.get(1,0),f=this.get(1,1),l=t.get(1,1),c=(n+f)*(i+l),h=(s+f)*i,d=n*(o-l),v=f*(u-i),p=(n+a)*l,g=(s-n)*(i+o),y=(a-f)*(u+l),m=c+v-p+y,b=d+p,x=h+v,E=c-h+d+g;return e.set(0,0,m),e.set(0,1,b),e.set(1,0,x),e.set(1,1,E),e}strassen3x3(t){t=dt.checkMatrix(t);let e=new dt(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),o=this.get(1,0),s=this.get(1,1),u=this.get(1,2),f=this.get(2,0),l=this.get(2,1),c=this.get(2,2),h=t.get(0,0),d=t.get(0,1),v=t.get(0,2),p=t.get(1,0),g=t.get(1,1),y=t.get(1,2),m=t.get(2,0),b=t.get(2,1),x=t.get(2,2),E=(n+i+a-o-s-l-c)*g,w=(n-o)*(-d+g),_=s*(-h+d+p-g-y-m+x),M=(-n+o+s)*(h-d+g),C=(o+s)*(-h+d),S=n*h,A=(-n+f+l)*(h-v+y),T=(-n+f)*(v-y),I=(f+l)*(-h+v),D=(n+i+a-s-u-f-l)*y,N=l*(-h+v+p-g-y-m+b),P=(-a+l+c)*(g+m-b),G=(a-c)*(g-b),W=a*m,k=(l+c)*(-m+b),R=(-a+s+u)*(y+m-x),Y=(a-u)*(y-x),J=(s+u)*(-m+x),te=i*p,H=u*b,pe=o*v,Ae=f*d,Le=c*x,qe=S+W+te,at=E+M+C+S+P+W+k,rt=S+A+I+D+W+R+J,xt=w+_+M+S+W+R+Y,Et=w+M+C+S+H,ur=W+R+Y+J+pe,Bt=S+A+T+N+P+G+W,Ut=P+G+W+k+Ae,dr=S+A+T+I+Le;return e.set(0,0,qe),e.set(0,1,at),e.set(0,2,rt),e.set(1,0,xt),e.set(1,1,Et),e.set(1,2,ur),e.set(2,0,Bt),e.set(2,1,Ut),e.set(2,2,dr),e}mmulStrassen(t){t=dt.checkMatrix(t);let e=this.clone(),n=e.rows,i=e.columns,a=t.rows,o=t.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=Kt.zeros(h,d);return g=g.setSubMatrix(c,0,0),g}}let u=Math.max(n,a),f=Math.max(i,o);e=s(e,u,f),t=s(t,u,f);function l(c,h,d,v){if(d<=512||v<=512)return c.mmul(h);d%2===1&&v%2===1?(c=s(c,d+1,v+1),h=s(h,d+1,v+1)):d%2===1?(c=s(c,d+1,v),h=s(h,d+1,v)):v%2===1&&(c=s(c,d,v+1),h=s(h,d,v+1));let p=parseInt(c.rows/2,10),g=parseInt(c.columns/2,10),y=c.subMatrix(0,p-1,0,g-1),m=h.subMatrix(0,p-1,0,g-1),b=c.subMatrix(0,p-1,g,c.columns-1),x=h.subMatrix(0,p-1,g,h.columns-1),E=c.subMatrix(p,c.rows-1,0,g-1),w=h.subMatrix(p,h.rows-1,0,g-1),_=c.subMatrix(p,c.rows-1,g,c.columns-1),M=h.subMatrix(p,h.rows-1,g,h.columns-1),C=l(Kt.add(y,_),Kt.add(m,M),p,g),S=l(Kt.add(E,_),m,p,g),A=l(y,Kt.sub(x,M),p,g),T=l(_,Kt.sub(w,m),p,g),I=l(Kt.add(y,b),M,p,g),D=l(Kt.sub(E,y),Kt.add(m,x),p,g),N=l(Kt.sub(b,_),Kt.add(w,M),p,g),P=Kt.add(C,T);P.sub(I),P.add(N);let G=Kt.add(A,I),W=Kt.add(S,T),k=Kt.sub(C,S);k.add(A),k.add(D);let R=Kt.zeros(2*P.rows,2*P.columns);return R=R.setSubMatrix(P,0,0),R=R.setSubMatrix(G,P.rows,0),R=R.setSubMatrix(W,0,P.columns),R=R.setSubMatrix(k,P.rows,P.columns),R.subMatrix(0,d-1,0,v-1)}return l(e,t,u,f)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const o=this.getRow(a);wS(o,{min:e,max:n,output:o}),i.setRow(a,o)}return i}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const o=this.getColumn(a);wS(o,{min:e,max:n,output:o}),i.setColumn(a,o)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let i=this.get(e,n),a=this.get(e,this.columns-1-n);this.set(e,n,a),this.set(e,this.columns-1-n,i)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let i=this.get(n,e),a=this.get(this.rows-1-n,e);this.set(n,e,a),this.set(this.rows-1-n,e,i)}return this}kroneckerProduct(t){t=dt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.rows,a=t.columns,o=new dt(e*i,n*a);for(let s=0;s<e;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)*t.get(f,l));return o}transpose(){let t=new dt(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=_S){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=_S){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,i){Xy(this,t,e,n,i);let a=new dt(e-t+1,i-n+1);for(let o=t;o<=e;o++)for(let s=n;s<=i;s++)a.set(o-t,s-n,this.get(o,s));return a}subMatrixRow(t,e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new dt(t.length,n-e+1);for(let a=0;a<t.length;a++)for(let o=e;o<=n;o++){if(t[a]<0||t[a]>=this.rows)throw new RangeError(`Row index out of range: ${t[a]}`);i.set(a,o-e,this.get(t[a],o))}return i}subMatrixColumn(t,e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new dt(n-e+1,t.length);for(let a=0;a<t.length;a++)for(let o=e;o<=n;o++){if(t[a]<0||t[a]>=this.columns)throw new RangeError(`Column index out of range: ${t[a]}`);i.set(o-e,a,this.get(o,t[a]))}return i}setSubMatrix(t,e,n){t=dt.checkMatrix(t);let i=e+t.rows-1,a=n+t.columns-1;Xy(this,e,i,n,a);for(let o=0;o<t.rows;o++)for(let s=0;s<t.columns;s++)this.set(e+o,n+s,t.get(o,s));return this}selection(t,e){let n=bk(this,t,e),i=new dt(t.length,e.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 t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){let t=new dt(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(e,n,this.get(e,n));return t}sum(t){switch(t){case"row":return hae(this);case"column":return dae(this);case void 0:return vae(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return pae(this);case"column":return gae(this);case void 0:return yae(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let n=0;n<this.rows;n++)e[n]/=this.columns;return e}case"column":{for(let n=0;n<this.columns;n++)e[n]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(t)}=e;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return mae(this,n,i)}case"column":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return bae(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return xae(this,n,i)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const n=this.variance(t,e);if(t===void 0)return Math.sqrt(n);for(let i=0;i<n.length;i++)n[i]=Math.sqrt(n[i]);return n}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":{if(!Array.isArray(n))throw new TypeError("center must be an array");return Eae(this,n),this}case"column":{if(!Array.isArray(n))throw new TypeError("center must be an array");return wae(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return _ae(this,n),this}default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":{if(n===void 0)n=Sae(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return Mae(this,n),this}case"column":{if(n===void 0)n=Cae(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return Aae(this,n),this}case void 0:{if(n===void 0)n=Tae(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return Iae(this,n),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return mk(this,t)}}Kt.prototype.klass="Matrix";typeof Symbol<"u"&&(Kt.prototype[Symbol.for("nodejs.util.inspect.custom")]=uae);function _S(r,t){return r-t}Kt.random=Kt.rand;Kt.randomInt=Kt.randInt;Kt.diagonal=Kt.diag;Kt.prototype.diagonal=Kt.prototype.diag;Kt.identity=Kt.eye;Kt.prototype.negate=Kt.prototype.neg;Kt.prototype.tensorProduct=Kt.prototype.kroneckerProduct;class dt extends Kt{constructor(t,e){if(super(),dt.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>0)if(this.data=[],Number.isInteger(e)&&e>0)for(let n=0;n<t;n++)this.data.push(new Float64Array(e));else throw new TypeError("nColumns must be a positive integer");else if(Array.isArray(t)){const n=t;if(t=n.length,e=n[0].length,typeof e!="number"||e===0)throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<t;i++){if(n[i].length!==e)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=t,this.columns=e,this}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){if(di(this,t),this.rows===1)throw new RangeError("A matrix cannot have less than one row");return this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return e===void 0&&(e=t,t=this.rows),di(this,t,!0),e=Float64Array.from(bu(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){if(vi(this,t),this.columns===1)throw new RangeError("A matrix cannot have less than one column");for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let i=0;i<t;i++)n[i]=this.data[e][i];for(let i=t+1;i<this.columns;i++)n[i-1]=this.data[e][i];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){typeof e>"u"&&(e=t,t=this.columns),vi(this,t,!0),e=xu(this,e);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<t;a++)i[a]=this.data[n][a];for(i[a++]=e[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}}cae(Kt,dt);class ro extends Kt{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class Oae extends ro{constructor(t,e){vi(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}}class Lae extends ro{constructor(t,e){e=Ek(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,n){return this.matrix.set(t,this.columnIndices[e],n),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class Dae extends ro{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class kae extends ro{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class Pae extends ro{constructor(t,e){di(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}}class Nae extends ro{constructor(t,e){e=xk(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,n){return this.matrix.set(this.rowIndices[t],e,n),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class id extends ro{constructor(t,e,n){let i=bk(t,e,n);super(t,i.row.length,i.column.length),this.rowIndices=i.row,this.columnIndices=i.column}set(t,e,n){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],n),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class Rae extends ro{constructor(t,e,n,i,a){Xy(t,e,n,i,a),super(t,n-e+1,a-i+1),this.startRow=e,this.startColumn=i}set(t,e,n){return this.matrix.set(this.startRow+t,this.startColumn+e,n),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class Bae extends ro{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}}class wk extends Kt{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let i=this._calculateIndex(t,e);return this.data[i]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class ni extends Kt{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}function Fae(r,t){if(Array.isArray(r))return r[0]&&Array.isArray(r[0])?new ni(r):new wk(r,t);throw new Error("the argument is not an array")}class Vd{constructor(t){t=ni.checkMatrix(t);let e=t.clone(),n=e.rows,i=e.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]=e.get(s,u);for(s=0;s<n;s++){for(p=Math.min(s,u),c=0,f=0;f<p;f++)c+=e.get(s,f)*v[f];v[s]-=c,e.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=e.get(l,f),e.set(l,f,e.get(u,f)),e.set(u,f,h);d=a[l],a[l]=a[u],a[u]=d,o=-o}if(u<n&&e.get(u,u)!==0)for(s=u+1;s<n;s++)e.set(s,u,e.get(s,u)/e.get(u,u))}this.LU=e,this.pivotVector=a,this.pivotSign=o}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(t.get(n,n)===0)return!0;return!1}solve(t){t=dt.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=t.columns,a=t.subMatrixRow(this.pivotVector,0,i-1),o=e.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)*e.get(s,f));for(f=o-1;f>=0;f--){for(u=0;u<i;u++)a.set(f,u,a.get(f,u)/e.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)*e.get(s,f))}return a}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let i=0;i<n;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new dt(e,n);for(let a=0;a<e;a++)for(let o=0;o<n;o++)a>o?i.set(a,o,t.get(a,o)):a===o?i.set(a,o,1):i.set(a,o,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new dt(e,n);for(let a=0;a<e;a++)for(let o=0;o<n;o++)a<=o?i.set(a,o,t.get(a,o)):i.set(a,o,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Ua(r,t){let e=0;return Math.abs(r)>Math.abs(t)?(e=t/r,Math.abs(r)*Math.sqrt(1+e*e)):t!==0?(e=r/t,Math.abs(t)*Math.sqrt(1+e*e)):0}class Yy{constructor(t){t=ni.checkMatrix(t);let e=t.clone(),n=t.rows,i=t.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=Ua(l,e.get(o,u));if(l!==0){for(e.get(u,u)<0&&(l=-l),o=u;o<n;o++)e.set(o,u,e.get(o,u)/l);for(e.set(u,u,e.get(u,u)+1),s=u+1;s<i;s++){for(f=0,o=u;o<n;o++)f+=e.get(o,u)*e.get(o,s);for(f=-f/e.get(u,u),o=u;o<n;o++)e.set(o,s,e.get(o,s)+f*e.get(o,u))}}a[u]=-l}this.QR=e,this.Rdiag=a}solve(t){t=dt.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=t.columns,a=t.clone(),o=e.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+=e.get(s,f)*a.get(s,u);for(l=-l/e.get(f,f),s=f;s<n;s++)a.set(s,u,a.get(s,u)+l*e.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)*e.get(s,f))}return a.subMatrix(0,o-1,0,i-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,n=new dt(e,e),i,a;for(i=0;i<e;i++)for(a=0;a<e;a++)i<a?n.set(i,a,t.get(i,a)):i===a?n.set(i,a,this.Rdiag[i]):n.set(i,a,0);return n}get orthogonalMatrix(){let t=this.QR,e=t.rows,n=t.columns,i=new dt(e,n),a,o,s,u;for(s=n-1;s>=0;s--){for(a=0;a<e;a++)i.set(a,s,0);for(i.set(s,s,1),o=s;o<n;o++)if(t.get(s,s)!==0){for(u=0,a=s;a<e;a++)u+=t.get(a,s)*i.get(a,o);for(u=-u/t.get(s,s),a=s;a<e;a++)i.set(a,o,i.get(a,o)+u*t.get(a,s))}}return i}}class Hu{constructor(t,e={}){t=ni.checkMatrix(t);let n=t.rows,i=t.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=e;let u=!!a,f=!!o,l=!1,c;if(n<i)if(!s)c=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{c=t.transpose(),n=c.rows,i=c.columns,l=!0;let S=u;u=f,f=S}else c=t.clone();let h=Math.min(n,i),d=Math.min(n+1,i),v=new Float64Array(d),p=new dt(n,h),g=new dt(i,i),y=new Float64Array(i),m=new Float64Array(n),b=new Float64Array(d);for(let S=0;S<d;S++)b[S]=S;let x=Math.min(n-1,i),E=Math.max(0,Math.min(i-2,n)),w=Math.max(x,E);for(let S=0;S<w;S++){if(S<x){v[S]=0;for(let A=S;A<n;A++)v[S]=Ua(v[S],c.get(A,S));if(v[S]!==0){c.get(S,S)<0&&(v[S]=-v[S]);for(let A=S;A<n;A++)c.set(A,S,c.get(A,S)/v[S]);c.set(S,S,c.get(S,S)+1)}v[S]=-v[S]}for(let A=S+1;A<i;A++){if(S<x&&v[S]!==0){let T=0;for(let I=S;I<n;I++)T+=c.get(I,S)*c.get(I,A);T=-T/c.get(S,S);for(let I=S;I<n;I++)c.set(I,A,c.get(I,A)+T*c.get(I,S))}y[A]=c.get(S,A)}if(u&&S<x)for(let A=S;A<n;A++)p.set(A,S,c.get(A,S));if(S<E){y[S]=0;for(let A=S+1;A<i;A++)y[S]=Ua(y[S],y[A]);if(y[S]!==0){y[S+1]<0&&(y[S]=0-y[S]);for(let A=S+1;A<i;A++)y[A]/=y[S];y[S+1]+=1}if(y[S]=-y[S],S+1<n&&y[S]!==0){for(let A=S+1;A<n;A++)m[A]=0;for(let A=S+1;A<n;A++)for(let T=S+1;T<i;T++)m[A]+=y[T]*c.get(A,T);for(let A=S+1;A<i;A++){let T=-y[A]/y[S+1];for(let I=S+1;I<n;I++)c.set(I,A,c.get(I,A)+T*m[I])}}if(f)for(let A=S+1;A<i;A++)g.set(A,S,y[A])}}let _=Math.min(i,n+1);if(x<i&&(v[x]=c.get(x,x)),n<_&&(v[_-1]=0),E+1<_&&(y[E]=c.get(E,_-1)),y[_-1]=0,u){for(let S=x;S<h;S++){for(let A=0;A<n;A++)p.set(A,S,0);p.set(S,S,1)}for(let S=x-1;S>=0;S--)if(v[S]!==0){for(let A=S+1;A<h;A++){let T=0;for(let I=S;I<n;I++)T+=p.get(I,S)*p.get(I,A);T=-T/p.get(S,S);for(let I=S;I<n;I++)p.set(I,A,p.get(I,A)+T*p.get(I,S))}for(let A=S;A<n;A++)p.set(A,S,-p.get(A,S));p.set(S,S,1+p.get(S,S));for(let A=0;A<S-1;A++)p.set(A,S,0)}else{for(let A=0;A<n;A++)p.set(A,S,0);p.set(S,S,1)}}if(f)for(let S=i-1;S>=0;S--){if(S<E&&y[S]!==0)for(let A=S+1;A<i;A++){let T=0;for(let I=S+1;I<i;I++)T+=g.get(I,S)*g.get(I,A);T=-T/g.get(S+1,S);for(let I=S+1;I<i;I++)g.set(I,A,g.get(I,A)+T*g.get(I,S))}for(let A=0;A<i;A++)g.set(A,S,0);g.set(S,S,1)}let M=_-1,C=Number.EPSILON;for(;_>0;){let S,A;for(S=_-2;S>=-1&&S!==-1;S--){const T=Number.MIN_VALUE+C*Math.abs(v[S]+Math.abs(v[S+1]));if(Math.abs(y[S])<=T||Number.isNaN(y[S])){y[S]=0;break}}if(S===_-2)A=4;else{let T;for(T=_-1;T>=S&&T!==S;T--){let I=(T!==_?Math.abs(y[T]):0)+(T!==S+1?Math.abs(y[T-1]):0);if(Math.abs(v[T])<=C*I){v[T]=0;break}}T===S?A=3:T===_-1?A=1:(A=2,S=T)}switch(S++,A){case 1:{let T=y[_-2];y[_-2]=0;for(let I=_-2;I>=S;I--){let D=Ua(v[I],T),N=v[I]/D,P=T/D;if(v[I]=D,I!==S&&(T=-P*y[I-1],y[I-1]=N*y[I-1]),f)for(let G=0;G<i;G++)D=N*g.get(G,I)+P*g.get(G,_-1),g.set(G,_-1,-P*g.get(G,I)+N*g.get(G,_-1)),g.set(G,I,D)}break}case 2:{let T=y[S-1];y[S-1]=0;for(let I=S;I<_;I++){let D=Ua(v[I],T),N=v[I]/D,P=T/D;if(v[I]=D,T=-P*y[I],y[I]=N*y[I],u)for(let G=0;G<n;G++)D=N*p.get(G,I)+P*p.get(G,S-1),p.set(G,S-1,-P*p.get(G,I)+N*p.get(G,S-1)),p.set(G,I,D)}break}case 3:{const T=Math.max(Math.abs(v[_-1]),Math.abs(v[_-2]),Math.abs(y[_-2]),Math.abs(v[S]),Math.abs(y[S])),I=v[_-1]/T,D=v[_-2]/T,N=y[_-2]/T,P=v[S]/T,G=y[S]/T,W=((D+I)*(D-I)+N*N)/2,k=I*N*(I*N);let R=0;(W!==0||k!==0)&&(W<0?R=0-Math.sqrt(W*W+k):R=Math.sqrt(W*W+k),R=k/(W+R));let Y=(P+I)*(P-I)+R,J=P*G;for(let te=S;te<_-1;te++){let H=Ua(Y,J);H===0&&(H=Number.MIN_VALUE);let pe=Y/H,Ae=J/H;if(te!==S&&(y[te-1]=H),Y=pe*v[te]+Ae*y[te],y[te]=pe*y[te]-Ae*v[te],J=Ae*v[te+1],v[te+1]=pe*v[te+1],f)for(let Le=0;Le<i;Le++)H=pe*g.get(Le,te)+Ae*g.get(Le,te+1),g.set(Le,te+1,-Ae*g.get(Le,te)+pe*g.get(Le,te+1)),g.set(Le,te,H);if(H=Ua(Y,J),H===0&&(H=Number.MIN_VALUE),pe=Y/H,Ae=J/H,v[te]=H,Y=pe*y[te]+Ae*v[te+1],v[te+1]=-Ae*y[te]+pe*v[te+1],J=Ae*y[te+1],y[te+1]=pe*y[te+1],u&&te<n-1)for(let Le=0;Le<n;Le++)H=pe*p.get(Le,te)+Ae*p.get(Le,te+1),p.set(Le,te+1,-Ae*p.get(Le,te)+pe*p.get(Le,te+1)),p.set(Le,te,H)}y[_-2]=Y;break}case 4:{if(v[S]<=0&&(v[S]=v[S]<0?-v[S]:0,f))for(let T=0;T<=M;T++)g.set(T,S,-g.get(T,S));for(;S<M&&!(v[S]>=v[S+1]);){let T=v[S];if(v[S]=v[S+1],v[S+1]=T,f&&S<i-1)for(let I=0;I<i;I++)T=g.get(I,S+1),g.set(I,S+1,g.get(I,S)),g.set(I,S,T);if(u&&S<n-1)for(let I=0;I<n;I++)T=p.get(I,S+1),p.set(I,S+1,p.get(I,S)),p.set(I,S,T);S++}_--;break}}}if(l){let S=g;g=p,p=S}this.m=n,this.n=i,this.s=v,this.U=p,this.V=g}solve(t){let e=t,n=this.threshold,i=this.s.length,a=dt.zeros(i,i);for(let h=0;h<i;h++)Math.abs(this.s[h])<=n?a.set(h,h,0):a.set(h,h,1/this.s[h]);let o=this.U,s=this.rightSingularVectors,u=s.mmul(a),f=s.rows,l=o.rows,c=dt.zeros(f,l);for(let h=0;h<f;h++)for(let d=0;d<l;d++){let v=0;for(let p=0;p<i;p++)v+=u.get(h,p)*o.get(d,p);c.set(h,d,v)}return c.mmul(e)}solveForDiagonal(t){return this.solve(dt.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,i=t.columns,a=new dt(n,this.s.length);for(let l=0;l<n;l++)for(let c=0;c<i;c++)Math.abs(this.s[c])>e&&a.set(l,c,t.get(l,c)/this.s[c]);let o=this.U,s=o.rows,u=o.columns,f=new dt(n,s);for(let l=0;l<n;l++)for(let c=0;c<s;c++){let h=0;for(let d=0;d<u;d++)h+=a.get(l,d)*o.get(c,d);f.set(l,c,h)}return f}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return dt.diag(this.s)}}function Gae(r,t=!1){return r=ni.checkMatrix(r),t?new Hu(r).inverse():_k(r,dt.eye(r.rows))}function _k(r,t,e=!1){return r=ni.checkMatrix(r),t=ni.checkMatrix(t),e?new Hu(r).solve(t):r.isSquare()?new Vd(r).solve(t):new Yy(r).solve(t)}function ad(r){if(r=dt.checkMatrix(r),r.isSquare()){let t,e,n,i;if(r.columns===2)return t=r.get(0,0),e=r.get(0,1),n=r.get(1,0),i=r.get(1,1),t*i-e*n;if(r.columns===3){let a,o,s;return a=new id(r,[1,2],[1,2]),o=new id(r,[1,2],[0,2]),s=new id(r,[1,2],[0,1]),t=r.get(0,0),e=r.get(0,1),n=r.get(0,2),t*ad(a)-e*ad(o)+n*ad(s)}else return new Vd(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function zae(r,t){let e=[];for(let n=0;n<r;n++)n!==t&&e.push(n);return e}function jae(r,t,e,n=1e-9,i=1e-9){if(r>i)return new Array(t.rows+1).fill(0);{let a=t.addRow(e,[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 Uae(r,t={}){const{thresholdValue:e=1e-9,thresholdError:n=1e-9}=t;r=dt.checkMatrix(r);let i=r.rows,a=new dt(i,i);for(let o=0;o<i;o++){let s=dt.columnVector(r.getRow(o)),u=r.subMatrixRow(zae(i,o)).transpose(),l=new Hu(u).solve(s),c=dt.sub(s,u.mmul(l)).abs().max();a.setRow(o,jae(c,l,o,e,n))}return a}function $ae(r,t=Number.EPSILON){r=dt.checkMatrix(r);let e=new Hu(r,{autoTranspose:!0}),n=e.leftSingularVectors,i=e.rightSingularVectors,a=e.diagonal;for(let o=0;o<a.length;o++)Math.abs(a[o])>t?a[o]=1/a[o]:a[o]=0;return i.mmul(dt.diag(a).mmul(n.transpose()))}function Wae(r,t=r,e={}){r=new dt(r);let n=!1;if(typeof t=="object"&&!dt.isMatrix(t)&&!Array.isArray(t)?(e=t,t=r,n=!0):t=new dt(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=e;i&&(r=r.center("column"),n||(t=t.center("column")));const a=r.transpose().mmul(t);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 Xae(r,t=r,e={}){r=new dt(r);let n=!1;if(typeof t=="object"&&!dt.isMatrix(t)&&!Array.isArray(t)?(e=t,t=r,n=!0):t=new dt(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:a=!0}=e;i&&(r.center("column"),n||t.center("column")),a&&(r.scale("column"),n||t.scale("column"));const o=r.standardDeviation("column",{unbiased:!0}),s=n?o:t.standardDeviation("column",{unbiased:!0}),u=r.transpose().mmul(t);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 SS{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(t=ni.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");let i=t.columns,a=new dt(i,i),o=new Float64Array(i),s=new Float64Array(i),u=t,f,l,c=!1;if(n?c=!0:c=t.isSymmetric(),c){for(f=0;f<i;f++)for(l=0;l<i;l++)a.set(f,l,u.get(f,l));Yae(i,s,o,a),Vae(i,s,o,a)}else{let h=new dt(i,i),d=new Float64Array(i);for(l=0;l<i;l++)for(f=0;f<i;f++)h.set(f,l,u.get(f,l));Hae(i,h,d,a),Kae(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 t=this.n,e=this.e,n=this.d,i=new dt(t,t),a,o;for(a=0;a<t;a++){for(o=0;o<t;o++)i.set(a,o,0);i.set(a,a,n[a]),e[a]>0?i.set(a,a+1,e[a]):e[a]<0&&i.set(a,a-1,e[a])}return i}}function Yae(r,t,e,n){let i,a,o,s,u,f,l,c;for(u=0;u<r;u++)e[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(e[f]);if(c===0)for(t[s]=e[s-1],u=0;u<s;u++)e[u]=n.get(s-1,u),n.set(s,u,0),n.set(u,s,0);else{for(f=0;f<s;f++)e[f]/=c,o+=e[f]*e[f];for(i=e[s-1],a=Math.sqrt(o),i>0&&(a=-a),t[s]=c*a,o=o-i*a,e[s-1]=i-a,u=0;u<s;u++)t[u]=0;for(u=0;u<s;u++){for(i=e[u],n.set(u,s,i),a=t[u]+n.get(u,u)*i,f=u+1;f<=s-1;f++)a+=n.get(f,u)*e[f],t[f]+=n.get(f,u)*i;t[u]=a}for(i=0,u=0;u<s;u++)t[u]/=o,i+=t[u]*e[u];for(l=i/(o+o),u=0;u<s;u++)t[u]-=l*e[u];for(u=0;u<s;u++){for(i=e[u],a=t[u],f=u;f<=s-1;f++)n.set(f,u,n.get(f,u)-(i*t[f]+a*e[f]));e[u]=n.get(s-1,u),n.set(s,u,0)}}e[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=e[s+1],o!==0){for(f=0;f<=s;f++)e[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*e[f])}}for(f=0;f<=s;f++)n.set(f,s+1,0)}for(u=0;u<r;u++)e[u]=n.get(r-1,u),n.set(r-1,u,0);n.set(r-1,r-1,1),t[0]=0}function Vae(r,t,e,n){let i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b;for(o=1;o<r;o++)t[o-1]=t[o];t[r-1]=0;let x=0,E=0,w=Number.EPSILON;for(f=0;f<r;f++){for(E=Math.max(E,Math.abs(e[f])+Math.abs(t[f])),l=f;l<r&&!(Math.abs(t[l])<=w*E);)l++;if(l>f)do{for(i=e[f],c=(e[f+1]-i)/(2*t[f]),h=Ua(c,1),c<0&&(h=-h),e[f]=t[f]/(c+h),e[f+1]=t[f]*(c+h),d=e[f+1],a=i-e[f],o=f+2;o<r;o++)e[o]-=a;for(x=x+a,c=e[l],v=1,p=v,g=v,y=t[f+1],m=0,b=0,o=l-1;o>=f;o--)for(g=p,p=v,b=m,i=v*t[o],a=v*c,h=Ua(c,t[o]),t[o+1]=m*h,m=t[o]/h,v=c/h,c=v*e[o]-m*i,e[o+1]=a+m*(v*i+m*e[o]),u=0;u<r;u++)a=n.get(u,o+1),n.set(u,o+1,m*n.get(u,o)+v*a),n.set(u,o,v*n.get(u,o)-m*a);c=-m*b*g*y*t[f]/d,t[f]=m*c,e[f]=v*c}while(Math.abs(t[f])>w*E);e[f]=e[f]+x,t[f]=0}for(o=0;o<r-1;o++){for(u=o,c=e[o],s=o+1;s<r;s++)e[s]<c&&(u=s,c=e[s]);if(u!==o)for(e[u]=e[o],e[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 Hae(r,t,e,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(t.get(f,c-1));if(h!==0){for(u=0,f=a;f>=c;f--)e[f]=t.get(f,c-1)/h,u+=e[f]*e[f];for(s=Math.sqrt(u),e[c]>0&&(s=-s),u=u-e[c]*s,e[c]=e[c]-s,l=c;l<r;l++){for(o=0,f=a;f>=c;f--)o+=e[f]*t.get(f,l);for(o=o/u,f=c;f<=a;f++)t.set(f,l,t.get(f,l)-o*e[f])}for(f=0;f<=a;f++){for(o=0,l=a;l>=c;l--)o+=e[l]*t.get(f,l);for(o=o/u,l=c;l<=a;l++)t.set(f,l,t.get(f,l)-o*e[l])}e[c]=h*e[c],t.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(t.get(c,c-1)!==0){for(f=c+1;f<=a;f++)e[f]=t.get(f,c-1);for(l=c;l<=a;l++){for(s=0,f=c;f<=a;f++)s+=e[f]*n.get(f,l);for(s=s/e[c]/t.get(c,c-1),f=c;f<=a;f++)n.set(f,l,n.get(f,l)+s*e[f])}}}function Kae(r,t,e,n,i){let a=r-1,o=0,s=r-1,u=Number.EPSILON,f=0,l=0,c=0,h=0,d=0,v=0,p=0,g=0,y,m,b,x,E,w,_,M,C,S,A,T,I,D,N;for(y=0;y<r;y++)for((y<o||y>s)&&(e[y]=i.get(y,y),t[y]=0),m=Math.max(y-1,0);m<r;m++)l=l+Math.abs(i.get(y,m));for(;a>=o;){for(x=a;x>o&&(v=Math.abs(i.get(x-1,x-1))+Math.abs(i.get(x,x)),v===0&&(v=l),!(Math.abs(i.get(x,x-1))<u*v));)x--;if(x===a)i.set(a,a,i.get(a,a)+f),e[a]=i.get(a,a),t[a]=0,a--,g=0;else if(x===a-1){if(_=i.get(a,a-1)*i.get(a-1,a),c=(i.get(a-1,a-1)-i.get(a,a))/2,h=c*c+_,p=Math.sqrt(Math.abs(h)),i.set(a,a,i.get(a,a)+f),i.set(a-1,a-1,i.get(a-1,a-1)+f),M=i.get(a,a),h>=0){for(p=c>=0?c+p:c-p,e[a-1]=M+p,e[a]=e[a-1],p!==0&&(e[a]=M-_/p),t[a-1]=0,t[a]=0,M=i.get(a,a-1),v=Math.abs(M)+Math.abs(p),c=M/v,h=p/v,d=Math.sqrt(c*c+h*h),c=c/d,h=h/d,m=a-1;m<r;m++)p=i.get(a-1,m),i.set(a-1,m,h*p+c*i.get(a,m)),i.set(a,m,h*i.get(a,m)-c*p);for(y=0;y<=a;y++)p=i.get(y,a-1),i.set(y,a-1,h*p+c*i.get(y,a)),i.set(y,a,h*i.get(y,a)-c*p);for(y=o;y<=s;y++)p=n.get(y,a-1),n.set(y,a-1,h*p+c*n.get(y,a)),n.set(y,a,h*n.get(y,a)-c*p)}else e[a-1]=M+c,e[a]=M+c,t[a-1]=p,t[a]=-p;a=a-2,g=0}else{if(M=i.get(a,a),C=0,_=0,x<a&&(C=i.get(a-1,a-1),_=i.get(a,a-1)*i.get(a-1,a)),g===10){for(f+=M,y=o;y<=a;y++)i.set(y,y,i.get(y,y)-M);v=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),M=C=.75*v,_=-.4375*v*v}if(g===30&&(v=(C-M)/2,v=v*v+_,v>0)){for(v=Math.sqrt(v),C<M&&(v=-v),v=M-_/((C-M)/2+v),y=o;y<=a;y++)i.set(y,y,i.get(y,y)-v);f+=v,M=C=_=.964}for(g=g+1,E=a-2;E>=x&&(p=i.get(E,E),d=M-p,v=C-p,c=(d*v-_)/i.get(E+1,E)+i.get(E,E+1),h=i.get(E+1,E+1)-p-d-v,d=i.get(E+2,E+1),v=Math.abs(c)+Math.abs(h)+Math.abs(d),c=c/v,h=h/v,d=d/v,!(E===x||Math.abs(i.get(E,E-1))*(Math.abs(h)+Math.abs(d))<u*(Math.abs(c)*(Math.abs(i.get(E-1,E-1))+Math.abs(p)+Math.abs(i.get(E+1,E+1))))));)E--;for(y=E+2;y<=a;y++)i.set(y,y-2,0),y>E+2&&i.set(y,y-3,0);for(b=E;b<=a-1&&(D=b!==a-1,b!==E&&(c=i.get(b,b-1),h=i.get(b+1,b-1),d=D?i.get(b+2,b-1):0,M=Math.abs(c)+Math.abs(h)+Math.abs(d),M!==0&&(c=c/M,h=h/M,d=d/M)),M!==0);b++)if(v=Math.sqrt(c*c+h*h+d*d),c<0&&(v=-v),v!==0){for(b!==E?i.set(b,b-1,-v*M):x!==E&&i.set(b,b-1,-i.get(b,b-1)),c=c+v,M=c/v,C=h/v,p=d/v,h=h/c,d=d/c,m=b;m<r;m++)c=i.get(b,m)+h*i.get(b+1,m),D&&(c=c+d*i.get(b+2,m),i.set(b+2,m,i.get(b+2,m)-c*p)),i.set(b,m,i.get(b,m)-c*M),i.set(b+1,m,i.get(b+1,m)-c*C);for(y=0;y<=Math.min(a,b+3);y++)c=M*i.get(y,b)+C*i.get(y,b+1),D&&(c=c+p*i.get(y,b+2),i.set(y,b+2,i.get(y,b+2)-c*d)),i.set(y,b,i.get(y,b)-c),i.set(y,b+1,i.get(y,b+1)-c*h);for(y=o;y<=s;y++)c=M*n.get(y,b)+C*n.get(y,b+1),D&&(c=c+p*n.get(y,b+2),n.set(y,b+2,n.get(y,b+2)-c*d)),n.set(y,b,n.get(y,b)-c),n.set(y,b+1,n.get(y,b+1)-c*h)}}}if(l!==0){for(a=r-1;a>=0;a--)if(c=e[a],h=t[a],h===0)for(x=a,i.set(a,a,1),y=a-1;y>=0;y--){for(_=i.get(y,y)-c,d=0,m=x;m<=a;m++)d=d+i.get(y,m)*i.get(m,a);if(t[y]<0)p=_,v=d;else if(x=y,t[y]===0?i.set(y,a,_!==0?-d/_:-d/(u*l)):(M=i.get(y,y+1),C=i.get(y+1,y),h=(e[y]-c)*(e[y]-c)+t[y]*t[y],w=(M*v-p*d)/h,i.set(y,a,w),i.set(y+1,a,Math.abs(M)>Math.abs(p)?(-d-_*w)/M:(-v-C*w)/p)),w=Math.abs(i.get(y,a)),u*w*w>1)for(m=y;m<=a;m++)i.set(m,a,i.get(m,a)/w)}else if(h<0)for(x=a-1,Math.abs(i.get(a,a-1))>Math.abs(i.get(a-1,a))?(i.set(a-1,a-1,h/i.get(a,a-1)),i.set(a-1,a,-(i.get(a,a)-c)/i.get(a,a-1))):(N=_h(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(S=0,A=0,m=x;m<=a;m++)S=S+i.get(y,m)*i.get(m,a-1),A=A+i.get(y,m)*i.get(m,a);if(_=i.get(y,y)-c,t[y]<0)p=_,d=S,v=A;else if(x=y,t[y]===0?(N=_h(-S,-A,_,h),i.set(y,a-1,N[0]),i.set(y,a,N[1])):(M=i.get(y,y+1),C=i.get(y+1,y),T=(e[y]-c)*(e[y]-c)+t[y]*t[y]-h*h,I=(e[y]-c)*2*h,T===0&&I===0&&(T=u*l*(Math.abs(_)+Math.abs(h)+Math.abs(M)+Math.abs(C)+Math.abs(p))),N=_h(M*d-p*S+h*A,M*v-p*A-h*S,T,I),i.set(y,a-1,N[0]),i.set(y,a,N[1]),Math.abs(M)>Math.abs(p)+Math.abs(h)?(i.set(y+1,a-1,(-S-_*i.get(y,a-1)+h*i.get(y,a))/M),i.set(y+1,a,(-A-_*i.get(y,a)-h*i.get(y,a-1))/M)):(N=_h(-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]))),w=Math.max(Math.abs(i.get(y,a-1)),Math.abs(i.get(y,a))),u*w*w>1)for(m=y;m<=a;m++)i.set(m,a-1,i.get(m,a-1)/w),i.set(m,a,i.get(m,a)/w)}for(y=0;y<r;y++)if(y<o||y>s)for(m=y;m<r;m++)n.set(y,m,i.get(y,m));for(m=r-1;m>=o;m--)for(y=o;y<=s;y++){for(p=0,b=o;b<=Math.min(m,s);b++)p=p+n.get(y,b)*i.get(b,m);n.set(y,m,p)}}}function _h(r,t,e,n){let i,a;return Math.abs(e)>Math.abs(n)?(i=n/e,a=e+i*n,[(r+i*t)/a,(t-i*r)/a]):(i=e/n,a=n+i*e,[(i*r+t)/a,(i*t-r)/a])}class MS{constructor(t){if(t=ni.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,n=e.rows,i=new dt(n,n),a=!0,o,s,u;for(s=0;s<n;s++){let f=0;for(u=0;u<s;u++){let l=0;for(o=0;o<u;o++)l+=i.get(u,o)*i.get(s,o);l=(e.get(s,u)-l)/i.get(u,u),i.set(s,u,l),f=f+l*l}for(f=e.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(t){t=ni.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=t.columns,a=t.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)*e.get(u,o));a.set(u,s,a.get(u,s)/e.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)*e.get(o,u));a.set(u,s,a.get(u,s)/e.get(u,u))}return a}get lowerTriangularMatrix(){return this.L}}class CS{constructor(t,e={}){t=ni.checkMatrix(t);let{Y:n}=e;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:o=1e-10}=e;let s;if(n){if(Array.isArray(n)&&typeof n[0]=="number"?n=dt.columnVector(n):n=ni.checkMatrix(n),!n.isColumnVector()||n.rows!==t.rows)throw new Error("Y must be a column vector of length X.rows");s=n}else s=t.getColumnVector(0);let u=1,f,l,c,h;for(let d=0;d<a&&u>o;d++)c=t.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),c=c.div(c.norm()),f=t.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=t.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0));d=d.div(d.norm());let v=t.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=t.sub(f.mmul(c.transpose()))}}const qae=Object.freeze(Object.defineProperty({__proto__:null,AbstractMatrix:Kt,CHO:MS,CholeskyDecomposition:MS,EVD:SS,EigenvalueDecomposition:SS,LU:Vd,LuDecomposition:Vd,Matrix:dt,MatrixColumnSelectionView:Lae,MatrixColumnView:Oae,MatrixFlipColumnView:Dae,MatrixFlipRowView:kae,MatrixRowSelectionView:Nae,MatrixRowView:Pae,MatrixSelectionView:id,MatrixSubView:Rae,MatrixTransposeView:Bae,NIPALS:CS,Nipals:CS,QR:Yy,QrDecomposition:Yy,SVD:Hu,SingularValueDecomposition:Hu,WrapperMatrix1D:wk,WrapperMatrix2D:ni,correlation:Xae,covariance:Wae,default:dt,determinant:ad,inverse:Gae,linearDependencies:Uae,pseudoInverse:$ae,solve:_k,wrap:Fae},Symbol.toStringTag,{value:"Module"})),Sk=ma(qae);Object.defineProperty(ub,"__esModule",{value:!0});var Af=Sk,Zae=function(){function r(t){this.distances=t.distances,this.dimension=t.dimension||2,this.linkDistance=t.linkDistance}return r.prototype.layout=function(){var t=this,e=t.dimension,n=t.distances,i=t.linkDistance;try{var a=Af.Matrix.mul(Af.Matrix.pow(n,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);var f=new Af.SingularValueDecomposition(a),l=Af.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(p){return Af.Matrix.mul([p],[l]).toJSON()[0].splice(0,e)})}catch{for(var c=[],h=0;h<n.length;h++){var d=Math.random()*i,v=Math.random()*i;c.push([d,v])}return c}},r}();ub.default=Zae;var fb={};Object.defineProperty(fb,"__esModule",{value:!0});var Qae=800,Jae=function(){function r(t){this.disp=[],this.positions=t.positions,this.adjMatrix=t.adjMatrix,this.focusID=t.focusID,this.radii=t.radii,this.iterations=t.iterations||10,this.height=t.height||10,this.width=t.width||10,this.speed=t.speed||100,this.gravity=t.gravity||10,this.nodeSizeFunc=t.nodeSizeFunc,this.k=t.k||5,this.strictRadial=t.strictRadial,this.nodes=t.nodes}return r.prototype.layout=function(){var t=this,e=t.positions,n=[],i=t.iterations,a=t.width/10;t.maxDisplace=a,t.disp=n;for(var o=0;o<i;o++)e.forEach(function(s,u){n[u]={x:0,y:0}}),t.getRepulsion(),t.updatePositions();return e},r.prototype.getRepulsion=function(){var t=this,e=t.positions,n=t.nodes,i=t.disp,a=t.k,o=t.radii||[];e.forEach(function(s,u){i[u]={x:0,y:0},e.forEach(function(f,l){if(u!==l&&o[u]===o[l]){var c=s[0]-f[0],h=s[1]-f[1],d=Math.sqrt(c*c+h*h);if(d===0){d=1;var v=u>l?1:-1;c=.01*v,h=.01*v}if(d<t.nodeSizeFunc(n[u])/2+t.nodeSizeFunc(n[l])/2){var p=a*a/d;i[u].x+=c/d*p,i[u].y+=h/d*p}}})})},r.prototype.updatePositions=function(){var t=this,e=t.positions,n=t.disp,i=t.speed,a=t.strictRadial,o=t.focusID,s=t.maxDisplace||t.width/10;a&&n.forEach(function(f,l){var c=e[l][0]-e[o][0],h=e[l][1]-e[o][1],d=Math.sqrt(c*c+h*h),v=h/d,p=-c/d,g=Math.sqrt(f.x*f.x+f.y*f.y),y=Math.acos((v*f.x+p*f.y)/g);y>Math.PI/2&&(y-=Math.PI/2,v*=-1,p*=-1);var m=Math.cos(y)*g;f.x=v*m,f.y=p*m});var u=t.radii;e.forEach(function(f,l){if(l!==o){var c=Math.sqrt(n[l].x*n[l].x+n[l].y*n[l].y);if(c>0&&l!==o){var h=Math.min(s*(i/Qae),c);if(f[0]+=n[l].x/c*h,f[1]+=n[l].y/c*h,a){var d=f[0]-e[o][0],v=f[1]-e[o][1],p=Math.sqrt(d*d+v*v);d=d/p*u[l],v=v/p*u[l],f[0]=e[o][0]+d,f[1]=e[o][1]+v}}}})},r}();fb.default=Jae;var eoe=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Mk=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.RadialLayout=void 0;var fi=Nr(),toe=Wr,roe=Mk(ub),noe=Mk(fb);function ioe(r){for(var t=r.length,e=r[0].length,n=[],i=0;i<t;i++){for(var a=[],o=0;o<e;o++)r[i][o]!==0?a.push(1/(r[i][o]*r[i][o])):a.push(0);n.push(a)}return n}function aoe(r,t){var e=-1;return r.forEach(function(n,i){n.id===t&&(e=i)}),e}function AS(r,t){return Math.sqrt((r[0]-t[0])*(r[0]-t[0])+(r[1]-t[1])*(r[1]-t[1]))}var ooe=function(r){eoe(t,r);function t(e){var n=r.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(e),n}return t.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}},t.prototype.execute=function(){var e=this,n=e.nodes,i=e.edges||[];if(!n||n.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}!e.width&&typeof window<"u"&&(e.width=window.innerWidth),!e.height&&typeof window<"u"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]);var a=e.center;if(n.length===1){n[0].x=a[0],n[0].y=a[1],e.onLayoutEnd&&e.onLayoutEnd();return}var o=e.linkDistance,s=null;if((0,fi.isString)(e.focusNode)){for(var u=!1,f=0;f<n.length;f++)n[f].id===e.focusNode&&(s=n[f],e.focusNode=s,u=!0,f=n.length);u||(s=null)}else s=e.focusNode;s||(s=n[0],e.focusNode=s);var l=aoe(n,s.id);l<0&&(l=0),e.focusIndex=l;var c=(0,fi.getAdjMatrix)({nodes:n,edges:i},!1),h=(0,fi.floydWarshall)(c),d=e.maxToFocus(h,l);e.handleInfinity(h,l,d+1),e.distances=h;var v=h[l],p=e.width||500,g=e.height||500,y=p-a[0]>a[0]?a[0]:p-a[0],m=g-a[1]>a[1]?a[1]:g-a[1];y===0&&(y=p/2),m===0&&(m=g/2);var b=m>y?y:m,x=Math.max.apply(Math,v),E=[];v.forEach(function(W,k){e.unitRadius||(e.unitRadius=b/x),E[k]=W*e.unitRadius}),e.radii=E;var w=e.eIdealDisMatrix();e.eIdealDistances=w;var _=ioe(w);e.weights=_;var M=new roe.default({linkDistance:o,distances:w}),C=M.layout();C.forEach(function(W){(0,fi.isNaN)(W[0])&&(W[0]=Math.random()*o),(0,fi.isNaN)(W[1])&&(W[1]=Math.random()*o)}),e.positions=C,C.forEach(function(W,k){n[k].x=W[0]+a[0],n[k].y=W[1]+a[1]}),C.forEach(function(W){W[0]-=C[l][0],W[1]-=C[l][1]}),e.run();var S=e.preventOverlap,A=e.nodeSize,T,I=e.strictRadial;if(S){var D=e.nodeSpacing,N;(0,fi.isNumber)(D)?N=function(){return D}:(0,fi.isFunction)(D)?N=D:N=function(){return 0},A?(0,fi.isArray)(A)?T=function(W){var k=A[0]>A[1]?A[0]:A[1];return k+N(W)}:T=function(W){return A+N(W)}:T=function(W){if(W.size){if((0,fi.isArray)(W.size)){var k=W.size[0]>W.size[1]?W.size[0]:W.size[1];return k+N(W)}if((0,fi.isObject)(W.size)){var k=W.size.width>W.size.height?W.size.width:W.size.height;return k+N(W)}return W.size+N(W)}return 10+N(W)};var P={nodes:n,nodeSizeFunc:T,adjMatrix:c,positions:C,radii:E,height:g,width:p,strictRadial:I,focusID:l,iterations:e.maxPreventOverlapIteration||200,k:C.length/4.5},G=new noe.default(P);C=G.layout()}return C.forEach(function(W,k){n[k].x=W[0]+a[0],n[k].y=W[1]+a[1]}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:n,edges:i}},t.prototype.run=function(){for(var e=this,n=e.maxIteration,i=e.positions||[],a=e.weights||[],o=e.eIdealDistances||[],s=e.radii||[],u=0;u<=n;u++){var f=u/n;e.oneIteration(f,i,s,o,a)}},t.prototype.oneIteration=function(e,n,i,a,o){var s=this,u=1-e,f=s.focusIndex;n.forEach(function(l,c){var h=AS(l,[0,0]),d=h===0?0:1/h;if(c!==f){var v=0,p=0,g=0;n.forEach(function(m,b){if(c!==b){var x=AS(l,m),E=x===0?0:1/x,w=a[b][c];g+=o[c][b],v+=o[c][b]*(m[0]+w*(l[0]-m[0])*E),p+=o[c][b]*(m[1]+w*(l[1]-m[1])*E)}});var y=i[c]===0?0:1/i[c];g*=u,g+=e*y*y,v*=u,v+=e*y*l[0]*d,l[0]=v/g,p*=u,p+=e*y*l[1]*d,l[1]=p/g}})},t.prototype.eIdealDisMatrix=function(){var e=this,n=e.nodes;if(!n)return[];var i=e.distances,a=e.linkDistance,o=e.radii||[],s=e.unitRadius||50,u=[];return i&&i.forEach(function(f,l){var c=[];f.forEach(function(h,d){if(l===d)c.push(0);else if(o[l]===o[d])if(e.sortBy==="data")c.push(h*(Math.abs(l-d)*e.sortStrength)/(o[l]/s));else if(e.sortBy){var v=n[l][e.sortBy]||0,p=n[d][e.sortBy]||0;(0,fi.isString)(v)&&(v=v.charCodeAt(0)),(0,fi.isString)(p)&&(p=p.charCodeAt(0)),c.push(h*(Math.abs(v-p)*e.sortStrength)/(o[l]/s))}else c.push(h*a/(o[l]/s));else{var g=(a+s)/2;c.push(h*g)}}),u.push(c)}),u},t.prototype.handleInfinity=function(e,n,i){for(var a=e.length,o=0;o<a;o++)if(e[n][o]===1/0){e[n][o]=i,e[o][n]=i;for(var s=0;s<a;s++)e[o][s]!==1/0&&e[n][s]===1/0&&(e[n][s]=i+e[o][s],e[s][n]=i+e[o][s])}for(var o=0;o<a;o++)if(o!==n){for(var s=0;s<a;s++)if(e[o][s]===1/0){var u=Math.abs(e[n][o]-e[n][s]);u=u===0?1:u,e[o][s]=u}}},t.prototype.maxToFocus=function(e,n){for(var i=0,a=0;a<e[n].length;a++)e[n][a]!==1/0&&(i=e[n][a]>i?e[n][a]:i);return i},t.prototype.getType=function(){return"radial"},t}(toe.Base);Jv.RadialLayout=ooe;(function(r){var t=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),e=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),e(Jv,r)})(sb);var rc={},soe=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(rc,"__esModule",{value:!0});rc.ConcentricLayout=void 0;var Hi=Nr(),uoe=Wr,foe=function(r){soe(t,r);function t(e){var n=r.call(this)||this;return n.nodeSize=30,n.minNodeSpacing=10,n.nodeSpacing=10,n.preventOverlap=!1,n.equidistant=!1,n.startAngle=3/2*Math.PI,n.clockwise=!0,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.onLayoutEnd=function(){},n.updateCfg(e),n}return t.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"}},t.prototype.execute=function(){var e,n,i=this,a=i.nodes,o=i.edges,s=a.length;if(s===0){(e=i.onLayoutEnd)===null||e===void 0||e.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var u=i.center;if(s===1){a[0].x=u[0],a[0].y=u[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var f=i.nodeSize,l=i.nodeSpacing,c=[],h,d=0;(0,Hi.isArray)(f)?h=Math.max(f[0],f[1]):h=f,(0,Hi.isArray)(l)?d=Math.max(l[0],l[1]):(0,Hi.isNumber)(l)&&(d=l),a.forEach(function(I){c.push(I);var D=h;(0,Hi.isArray)(I.size)?D=Math.max(I.size[0],I.size[1]):(0,Hi.isNumber)(I.size)?D=I.size:(0,Hi.isObject)(I.size)&&(D=Math.max(I.size.width,I.size.height)),h=Math.max(h,D),(0,Hi.isFunction)(l)&&(d=Math.max(l(I),d))}),i.clockwise=i.counterclockwise!==void 0?!i.counterclockwise:i.clockwise;var v={},p={};if(c.forEach(function(I,D){v[I.id]=I,p[I.id]=D}),(i.sortBy==="degree"||!(0,Hi.isString)(i.sortBy)||c[0][i.sortBy]===void 0)&&(i.sortBy="degree",!(0,Hi.isNumber)(a[0].degree))){var g=(0,Hi.getDegree)(a.length,p,o);c.forEach(function(I,D){I.degree=g[D].all})}c.sort(function(I,D){return D[i.sortBy]-I[i.sortBy]}),i.maxValueNode=c[0],i.maxLevelDiff=i.maxLevelDiff||i.maxValueNode[i.sortBy]/4;var y=[[]],m=y[0];c.forEach(function(I){if(m.length>0){var D=Math.abs(m[0][i.sortBy]-I[i.sortBy]);i.maxLevelDiff&&D>=i.maxLevelDiff&&(m=[],y.push(m))}m.push(I)});var b=h+(d||i.minNodeSpacing);if(!i.preventOverlap){var x=y.length>0&&y[0].length>1,E=Math.min(i.width,i.height)/2-b,w=E/(y.length+(x?1:0));b=Math.min(b,w)}var _=0;if(y.forEach(function(I){var D=i.sweep;D===void 0&&(D=2*Math.PI-2*Math.PI/I.length);var N=I.dTheta=D/Math.max(1,I.length-1);if(I.length>1&&i.preventOverlap){var P=Math.cos(N)-Math.cos(0),G=Math.sin(N)-Math.sin(0),W=Math.sqrt(b*b/(P*P+G*G));_=Math.max(W,_)}I.r=_,_+=b}),i.equidistant){for(var M=0,C=0,S=0;S<y.length;S++){var A=y[S],T=A.r-C;M=Math.max(M,T)}C=0,y.forEach(function(I,D){D===0&&(C=I.r),I.r=C,C+=M})}return y.forEach(function(I){var D=I.dTheta,N=I.r;I.forEach(function(P,G){var W=i.startAngle+(i.clockwise?1:-1)*D*G;P.x=u[0]+N*Math.cos(W),P.y=u[1]+N*Math.sin(W)})}),i.onLayoutEnd&&i.onLayoutEnd(),{nodes:a,edges:o}},t.prototype.getType=function(){return"concentric"},t}(uoe.Base);rc.ConcentricLayout=foe;var nc={},loe=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(nc,"__esModule",{value:!0});nc.MDSLayout=void 0;var Tf=Sk,h0=Nr(),coe=Wr,hoe=function(r){loe(t,r);function t(e){var n=r.call(this)||this;return n.center=[0,0],n.linkDistance=50,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},t.prototype.execute=function(){var e=this,n=e.nodes,i=e.edges,a=i===void 0?[]:i,o=e.center;if(!n||n.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}if(n.length===1){n[0].x=o[0],n[0].y=o[1],e.onLayoutEnd&&e.onLayoutEnd();return}var s=e.linkDistance,u=(0,h0.getAdjMatrix)({nodes:n,edges:a},!1),f=(0,h0.floydWarshall)(u);e.handleInfinity(f);var l=(0,h0.scaleMatrix)(f,s);e.scaledDistances=l;var c=e.runMDS();return e.positions=c,c.forEach(function(h,d){n[d].x=h[0]+o[0],n[d].y=h[1]+o[1]}),e.onLayoutEnd&&e.onLayoutEnd(),{nodes:n,edges:a}},t.prototype.runMDS=function(){var e=this,n=2,i=e.scaledDistances,a=Tf.Matrix.mul(Tf.Matrix.pow(i,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);var f=new Tf.SingularValueDecomposition(a),l=Tf.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(c){return Tf.Matrix.mul([c],[l]).toJSON()[0].splice(0,n)})},t.prototype.handleInfinity=function(e){var n=-999999;e.forEach(function(i){i.forEach(function(a){a!==1/0&&n<a&&(n=a)})}),e.forEach(function(i,a){i.forEach(function(o,s){o===1/0&&(e[a][s]=n)})})},t.prototype.getType=function(){return"mds"},t}(coe.Base);nc.MDSLayout=hoe;var ic={},doe=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(ic,"__esModule",{value:!0});ic.FruchtermanLayout=void 0;var voe=Wr,Ur=Nr(),poe=800,goe=function(r){doe(t,r);function t(e){var n=r.call(this)||this;return n.maxIteration=1e3,n.workerEnabled=!1,n.gravity=10,n.speed=5,n.clustering=!1,n.clusterGravity=10,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.onLayoutEnd=function(){},n.tick=function(){},n.animate=!0,n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},t.prototype.execute=function(){var e=this,n,i,a=this,o=a.nodes;if(a.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(a.timeInterval),!o||o.length===0){(n=a.onLayoutEnd)===null||n===void 0||n.call(a);return}!a.width&&typeof window<"u"&&(a.width=window.innerWidth),!a.height&&typeof window<"u"&&(a.height=window.innerHeight),a.center||(a.center=[a.width/2,a.height/2]);var s=a.center;if(o.length===1){o[0].x=s[0],o[0].y=s[1],(i=a.onLayoutEnd)===null||i===void 0||i.call(a);return}var u={},f={};return o.forEach(function(l,c){(0,Ur.isNumber)(l.x)||(l.x=Math.random()*e.width),(0,Ur.isNumber)(l.y)||(l.y=Math.random()*e.height),u[l.id]=l,f[l.id]=c}),a.nodeMap=u,a.nodeIdxMap=f,a.run()},t.prototype.run=function(){var e,n=this,i=n.nodes;if(i){var a=n.edges,o=n.maxIteration,s=n.workerEnabled,u=n.clustering,f=n.animate,l={};if(u&&i.forEach(function(d){l[d.cluster]===void 0&&(l[d.cluster]={name:d.cluster,cx:0,cy:0,count:0})}),s||!f){for(var c=0;c<o;c++)n.runOneStep(l);(e=n.onLayoutEnd)===null||e===void 0||e.call(n)}else{if(typeof window>"u")return;var h=0;this.timeInterval=window.setInterval(function(){var d;n.runOneStep(l),h++,h>=o&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))},0)}return{nodes:i,edges:a}}},t.prototype.runOneStep=function(e){var n,i=this,a=i.nodes;if(a){var o=i.edges,s=i.center,u=i.gravity,f=i.speed,l=i.clustering,c=i.height*i.width,h=Math.sqrt(c)/10,d=c/(a.length+1),v=Math.sqrt(d),p=[];if(a.forEach(function(m,b){p[b]={x:0,y:0}}),i.applyCalculate(a,o,p,v,d),l){for(var g in e)e[g].cx=0,e[g].cy=0,e[g].count=0;a.forEach(function(m){var b=e[m.cluster];(0,Ur.isNumber)(m.x)&&(b.cx+=m.x),(0,Ur.isNumber)(m.y)&&(b.cy+=m.y),b.count++});for(var g in e)e[g].cx/=e[g].count,e[g].cy/=e[g].count;var y=i.clusterGravity||u;a.forEach(function(m,b){if(!(!(0,Ur.isNumber)(m.x)||!(0,Ur.isNumber)(m.y))){var x=e[m.cluster],E=Math.sqrt((m.x-x.cx)*(m.x-x.cx)+(m.y-x.cy)*(m.y-x.cy)),w=v*y;p[b].x-=w*(m.x-x.cx)/E,p[b].y-=w*(m.y-x.cy)/E}})}a.forEach(function(m,b){if(!(!(0,Ur.isNumber)(m.x)||!(0,Ur.isNumber)(m.y))){var x=.01*v*u;p[b].x-=x*(m.x-s[0]),p[b].y-=x*(m.y-s[1])}}),a.forEach(function(m,b){if((0,Ur.isNumber)(m.fx)&&(0,Ur.isNumber)(m.fy)){m.x=m.fx,m.y=m.fy;return}if(!(!(0,Ur.isNumber)(m.x)||!(0,Ur.isNumber)(m.y))){var x=Math.sqrt(p[b].x*p[b].x+p[b].y*p[b].y);if(x>0){var E=Math.min(h*(f/poe),x);m.x+=p[b].x/x*E,m.y+=p[b].y/x*E}}}),(n=i.tick)===null||n===void 0||n.call(i)}},t.prototype.applyCalculate=function(e,n,i,a,o){var s=this;s.calRepulsive(e,i,o),n&&s.calAttractive(n,i,a)},t.prototype.calRepulsive=function(e,n,i){e.forEach(function(a,o){n[o]={x:0,y:0},e.forEach(function(s,u){if(o!==u&&!(!(0,Ur.isNumber)(a.x)||!(0,Ur.isNumber)(s.x)||!(0,Ur.isNumber)(a.y)||!(0,Ur.isNumber)(s.y))){var f=a.x-s.x,l=a.y-s.y,c=f*f+l*l;if(c===0){c=1;var h=o>u?1:-1;f=.01*h,l=.01*h}var d=i/c;n[o].x+=f*d,n[o].y+=l*d}})})},t.prototype.calAttractive=function(e,n,i){var a=this;e.forEach(function(o){var s=(0,Ur.getEdgeTerminal)(o,"source"),u=(0,Ur.getEdgeTerminal)(o,"target");if(!(!s||!u)){var f=a.nodeIdxMap[s],l=a.nodeIdxMap[u];if(f!==l){var c=a.nodeMap[s],h=a.nodeMap[u];if(!(!(0,Ur.isNumber)(h.x)||!(0,Ur.isNumber)(c.x)||!(0,Ur.isNumber)(h.y)||!(0,Ur.isNumber)(c.y))){var d=h.x-c.x,v=h.y-c.y,p=Math.sqrt(d*d+v*v),g=p*p/i;n[l].x-=d/p*g,n[l].y-=v/p*g,n[f].x+=d/p*g,n[f].y+=v/p*g}}}})},t.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},t.prototype.destroy=function(){var e=this;e.stop(),e.tick=null,e.nodes=null,e.edges=null,e.destroyed=!0},t.prototype.getType=function(){return"fruchterman"},t}(voe.Base);ic.FruchtermanLayout=goe;var ac={};function TS(r,t,e,n,i,a,o){try{var s=r[a](o),u=s.value}catch(f){e(f);return}s.done?t(u):Promise.resolve(u).then(n,i)}function Co(r){return function(){var t=this,e=arguments;return new Promise(function(n,i){var a=r.apply(t,e);function o(u){TS(a,n,i,o,s,"next",u)}function s(u){TS(a,n,i,o,s,"throw",u)}o(void 0)})}}var yoe=typeof xe=="object"&&xe&&xe.Object===Object&&xe,Ck=yoe,moe=Ck,boe=typeof self=="object"&&self&&self.Object===Object&&self,xoe=moe||boe||Function("return this")(),Eoe=xoe,woe=Eoe,_oe=woe.Symbol,Ak=_oe,IS=Ak,Tk=Object.prototype,Soe=Tk.hasOwnProperty,Moe=Tk.toString,If=IS?IS.toStringTag:void 0;function Coe(r){var t=Soe.call(r,If),e=r[If];try{r[If]=void 0;var n=!0}catch{}var i=Moe.call(r);return n&&(t?r[If]=e:delete r[If]),i}var Aoe=Coe,Toe=Object.prototype,Ioe=Toe.toString;function Ooe(r){return Ioe.call(r)}var Loe=Ooe,OS=Ak,Doe=Aoe,koe=Loe,Poe="[object Null]",Noe="[object Undefined]",LS=OS?OS.toStringTag:void 0;function Roe(r){return r==null?r===void 0?Noe:Poe:LS&&LS in Object(r)?Doe(r):koe(r)}var lb=Roe,Boe=9007199254740991;function Foe(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Boe}var Goe=Foe;function zoe(r){return r!=null&&typeof r=="object"}var cb=zoe,joe=lb,Uoe=Goe,$oe=cb,Woe="[object Arguments]",Xoe="[object Array]",Yoe="[object Boolean]",Voe="[object Date]",Hoe="[object Error]",Koe="[object Function]",qoe="[object Map]",Zoe="[object Number]",Qoe="[object Object]",Joe="[object RegExp]",ese="[object Set]",tse="[object String]",rse="[object WeakMap]",nse="[object ArrayBuffer]",ise="[object DataView]",ase="[object Float32Array]",ose="[object Float64Array]",sse="[object Int8Array]",use="[object Int16Array]",fse="[object Int32Array]",lse="[object Uint8Array]",cse="[object Uint8ClampedArray]",hse="[object Uint16Array]",dse="[object Uint32Array]",Mr={};Mr[ase]=Mr[ose]=Mr[sse]=Mr[use]=Mr[fse]=Mr[lse]=Mr[cse]=Mr[hse]=Mr[dse]=!0;Mr[Woe]=Mr[Xoe]=Mr[nse]=Mr[Yoe]=Mr[ise]=Mr[Voe]=Mr[Hoe]=Mr[Koe]=Mr[qoe]=Mr[Zoe]=Mr[Qoe]=Mr[Joe]=Mr[ese]=Mr[tse]=Mr[rse]=!1;function vse(r){return $oe(r)&&Uoe(r.length)&&!!Mr[joe(r)]}var pse=vse;function gse(r){return function(t){return r(t)}}var yse=gse,Hd={exports:{}};Hd.exports;(function(r,t){var e=Ck,n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&e.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})(Hd,Hd.exports);var mse=Hd.exports,bse=pse,xse=yse,DS=mse,kS=DS&&DS.isTypedArray,Ese=kS?xse(kS):bse,wse=Ese;const Kd=ba(wse);var _se=lb,Sse=cb,Mse="[object Number]";function Cse(r){return typeof r=="number"||Sse(r)&&_se(r)==Mse}var Ase=Cse;const Tse=ba(Ase);var Ise=Array.isArray,Ose=Ise;const Lse=ba(Ose);var Ik={exports:{}};(function(r){var t=l3.default;function e(){r.exports=e=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(k,R,Y){k[R]=Y.value},u=typeof Symbol=="function"?Symbol:{},f=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function h(k,R,Y){return Object.defineProperty(k,R,{value:Y,enumerable:!0,configurable:!0,writable:!0}),k[R]}try{h({},"")}catch{h=function(Y,J,te){return Y[J]=te}}function d(k,R,Y,J){var te=R&&R.prototype instanceof x?R:x,H=Object.create(te.prototype),pe=new G(J||[]);return s(H,"_invoke",{value:I(k,Y,pe)}),H}function v(k,R,Y){try{return{type:"normal",arg:k.call(R,Y)}}catch(J){return{type:"throw",arg:J}}}i.wrap=d;var p="suspendedStart",g="suspendedYield",y="executing",m="completed",b={};function x(){}function E(){}function w(){}var _={};h(_,f,function(){return this});var M=Object.getPrototypeOf,C=M&&M(M(W([])));C&&C!==a&&o.call(C,f)&&(_=C);var S=w.prototype=x.prototype=Object.create(_);function A(k){["next","throw","return"].forEach(function(R){h(k,R,function(Y){return this._invoke(R,Y)})})}function T(k,R){function Y(te,H,pe,Ae){var Le=v(k[te],k,H);if(Le.type!=="throw"){var qe=Le.arg,at=qe.value;return at&&t(at)=="object"&&o.call(at,"__await")?R.resolve(at.__await).then(function(rt){Y("next",rt,pe,Ae)},function(rt){Y("throw",rt,pe,Ae)}):R.resolve(at).then(function(rt){qe.value=rt,pe(qe)},function(rt){return Y("throw",rt,pe,Ae)})}Ae(Le.arg)}var J;s(this,"_invoke",{value:function(H,pe){function Ae(){return new R(function(Le,qe){Y(H,pe,Le,qe)})}return J=J?J.then(Ae,Ae):Ae()}})}function I(k,R,Y){var J=p;return function(te,H){if(J===y)throw new Error("Generator is already running");if(J===m){if(te==="throw")throw H;return{value:n,done:!0}}for(Y.method=te,Y.arg=H;;){var pe=Y.delegate;if(pe){var Ae=D(pe,Y);if(Ae){if(Ae===b)continue;return Ae}}if(Y.method==="next")Y.sent=Y._sent=Y.arg;else if(Y.method==="throw"){if(J===p)throw J=m,Y.arg;Y.dispatchException(Y.arg)}else Y.method==="return"&&Y.abrupt("return",Y.arg);J=y;var Le=v(k,R,Y);if(Le.type==="normal"){if(J=Y.done?m:g,Le.arg===b)continue;return{value:Le.arg,done:Y.done}}Le.type==="throw"&&(J=m,Y.method="throw",Y.arg=Le.arg)}}}function D(k,R){var Y=R.method,J=k.iterator[Y];if(J===n)return R.delegate=null,Y==="throw"&&k.iterator.return&&(R.method="return",R.arg=n,D(k,R),R.method==="throw")||Y!=="return"&&(R.method="throw",R.arg=new TypeError("The iterator does not provide a '"+Y+"' method")),b;var te=v(J,k.iterator,R.arg);if(te.type==="throw")return R.method="throw",R.arg=te.arg,R.delegate=null,b;var H=te.arg;return H?H.done?(R[k.resultName]=H.value,R.next=k.nextLoc,R.method!=="return"&&(R.method="next",R.arg=n),R.delegate=null,b):H:(R.method="throw",R.arg=new TypeError("iterator result is not an object"),R.delegate=null,b)}function N(k){var R={tryLoc:k[0]};1 in k&&(R.catchLoc=k[1]),2 in k&&(R.finallyLoc=k[2],R.afterLoc=k[3]),this.tryEntries.push(R)}function P(k){var R=k.completion||{};R.type="normal",delete R.arg,k.completion=R}function G(k){this.tryEntries=[{tryLoc:"root"}],k.forEach(N,this),this.reset(!0)}function W(k){if(k||k===""){var R=k[f];if(R)return R.call(k);if(typeof k.next=="function")return k;if(!isNaN(k.length)){var Y=-1,J=function te(){for(;++Y<k.length;)if(o.call(k,Y))return te.value=k[Y],te.done=!1,te;return te.value=n,te.done=!0,te};return J.next=J}}throw new TypeError(t(k)+" is not iterable")}return E.prototype=w,s(S,"constructor",{value:w,configurable:!0}),s(w,"constructor",{value:E,configurable:!0}),E.displayName=h(w,c,"GeneratorFunction"),i.isGeneratorFunction=function(k){var R=typeof k=="function"&&k.constructor;return!!R&&(R===E||(R.displayName||R.name)==="GeneratorFunction")},i.mark=function(k){return Object.setPrototypeOf?Object.setPrototypeOf(k,w):(k.__proto__=w,h(k,c,"GeneratorFunction")),k.prototype=Object.create(S),k},i.awrap=function(k){return{__await:k}},A(T.prototype),h(T.prototype,l,function(){return this}),i.AsyncIterator=T,i.async=function(k,R,Y,J,te){te===void 0&&(te=Promise);var H=new T(d(k,R,Y,J),te);return i.isGeneratorFunction(R)?H:H.next().then(function(pe){return pe.done?pe.value:H.next()})},A(S),h(S,c,"Generator"),h(S,f,function(){return this}),h(S,"toString",function(){return"[object Generator]"}),i.keys=function(k){var R=Object(k),Y=[];for(var J in R)Y.push(J);return Y.reverse(),function te(){for(;Y.length;){var H=Y.pop();if(H in R)return te.value=H,te.done=!1,te}return te.done=!0,te}},i.values=W,G.prototype={constructor:G,reset:function(R){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(P),!R)for(var Y in this)Y.charAt(0)==="t"&&o.call(this,Y)&&!isNaN(+Y.slice(1))&&(this[Y]=n)},stop:function(){this.done=!0;var R=this.tryEntries[0].completion;if(R.type==="throw")throw R.arg;return this.rval},dispatchException:function(R){if(this.done)throw R;var Y=this;function J(qe,at){return pe.type="throw",pe.arg=R,Y.next=qe,at&&(Y.method="next",Y.arg=n),!!at}for(var te=this.tryEntries.length-1;te>=0;--te){var H=this.tryEntries[te],pe=H.completion;if(H.tryLoc==="root")return J("end");if(H.tryLoc<=this.prev){var Ae=o.call(H,"catchLoc"),Le=o.call(H,"finallyLoc");if(Ae&&Le){if(this.prev<H.catchLoc)return J(H.catchLoc,!0);if(this.prev<H.finallyLoc)return J(H.finallyLoc)}else if(Ae){if(this.prev<H.catchLoc)return J(H.catchLoc,!0)}else{if(!Le)throw new Error("try statement without catch or finally");if(this.prev<H.finallyLoc)return J(H.finallyLoc)}}}},abrupt:function(R,Y){for(var J=this.tryEntries.length-1;J>=0;--J){var te=this.tryEntries[J];if(te.tryLoc<=this.prev&&o.call(te,"finallyLoc")&&this.prev<te.finallyLoc){var H=te;break}}H&&(R==="break"||R==="continue")&&H.tryLoc<=Y&&Y<=H.finallyLoc&&(H=null);var pe=H?H.completion:{};return pe.type=R,pe.arg=Y,H?(this.method="next",this.next=H.finallyLoc,b):this.complete(pe)},complete:function(R,Y){if(R.type==="throw")throw R.arg;return R.type==="break"||R.type==="continue"?this.next=R.arg:R.type==="return"?(this.rval=this.arg=R.arg,this.method="return",this.next="end"):R.type==="normal"&&Y&&(this.next=Y),b},finish:function(R){for(var Y=this.tryEntries.length-1;Y>=0;--Y){var J=this.tryEntries[Y];if(J.finallyLoc===R)return this.complete(J.completion,J.afterLoc),P(J),b}},catch:function(R){for(var Y=this.tryEntries.length-1;Y>=0;--Y){var J=this.tryEntries[Y];if(J.tryLoc===R){var te=J.completion;if(te.type==="throw"){var H=te.arg;P(J)}return H}}throw new Error("illegal catch attempt")},delegateYield:function(R,Y,J){return this.delegate={iterator:W(R),resultName:Y,nextLoc:J},this.method==="next"&&(this.arg=n),b}},i}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports})(Ik);var Dse=Ik.exports,od=Dse(),kse=od;try{regeneratorRuntime=od}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=od:Function("r","regeneratorRuntime = r")(od)}const Mn=ba(kse);var Pse=1;function Ok(){return Pse++}var De;(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"})(De||(De={}));var Nse=function(){function r(){Ri(this,r),this.config=void 0}return Bi(r,[{key:"get",value:function(){return this.config}},{key:"set",value:function(e){this.config=e}}]),r}(),Ol;(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>[]"})(Ol||(Ol={}));var PS;(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"})(PS||(PS={}));var Ku;(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"})(Ku||(Ku={}));var nl;(function(r){r.GLSL100="GLSL100",r.GLSL450="GLSL450",r.WGSL="WGSL"})(nl||(nl={}));var Rse="__DefineValuePlaceholder__";function Bse(){if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function NS(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),e.push.apply(e,n)}return e}function RS(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?NS(Object(e),!0).forEach(function(n){et(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):NS(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}var Lk=function(){function r(t,e){Ri(this,r),this.engine=t,this.configService=e,this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}return Bi(r,[{key:"init",value:function(){var e=this.configService.get(),n=e.canvas,i=e.engineOptions;this.initPromise=this.engine.init(RS({canvas:n||Bse(),antialiasing:!1},i))}},{key:"setBundle",value:function(e){this.compiledBundle=JSON.parse(JSON.stringify(e))}},{key:"setDispatch",value:function(e){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=e),this}},{key:"setMaxIteration",value:function(e){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=e),this}},{key:"setBinding",value:function(e,n){var i=this;if(typeof e=="string"){var a=Tse(n)||Kd(n)||Lse(n);if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find(function(u){return u.name===e});if(o)return o.value=n,this;var s=this.compiledBundle.context.uniforms.find(function(u){return u.name===e});s&&(a?(s.data=n,s.isReferer=!1,s.storageClass===Ku.Uniform?this.model&&this.model.updateUniform(e,n):this.model&&this.model.updateBuffer(e,n)):(s.isReferer=!0,s.data=n))}}else Object.keys(e).forEach(function(u){i.setBinding(u,e[u])});return this}},{key:"execute",value:function(){var t=Co(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 e(){return t.apply(this,arguments)}return e}()},{key:"getOutput",value:function(){var t=Co(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 e(){return t.apply(this,arguments)}return e}()},{key:"compile",value:function(){var t=Co(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=RS({},this.compiledBundle.context),a=this.engine.supportWebGPU?this.engine.useWGSL?nl.WGSL:nl.GLSL450:nl.GLSL100,o=this.compiledBundle.shaders[a],i.defines.filter(function(f){return f.runtime}).forEach(function(f){var l="".concat(Rse).concat(f.name);o=o.replace(l,"".concat(f.value))}),i.shader=o,i.uniforms.forEach(function(f){if(!f.data&&f.storageClass===Ku.StorageBuffer){var l=1;f.type===Ol.FloatArray?l=1:f.type===Ol.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 e(){return t.apply(this,arguments)}return e}()}]),r}(),Dk={exports:{}};(function(r,t){(function(e,n){r.exports=n()})(xe,function(){var e=function(O){return O instanceof Uint8Array||O instanceof Uint16Array||O instanceof Uint32Array||O instanceof Int8Array||O instanceof Int16Array||O instanceof Int32Array||O instanceof Float32Array||O instanceof Float64Array||O instanceof Uint8ClampedArray},n=function(O,z){for(var V=Object.keys(z),ce=0;ce<V.length;++ce)O[V[ce]]=z[V[ce]];return O},i=`
41
- `;function a(O){return typeof atob<"u"?atob(O):"base64:"+O}function o(O){var z=new Error("(regl) "+O);throw console.error(z),z}function s(O,z){O||o(z)}function u(O){return O?": "+O:""}function f(O,z,V){O in z||o("unknown parameter ("+O+")"+u(V)+". possible values: "+Object.keys(z).join())}function l(O,z){e(O)||o("invalid parameter type"+u(z)+". must be a typed array")}function c(O,z){switch(z){case"number":return typeof O=="number";case"object":return typeof O=="object";case"string":return typeof O=="string";case"boolean":return typeof O=="boolean";case"function":return typeof O=="function";case"undefined":return typeof O>"u";case"symbol":return typeof O=="symbol"}}function h(O,z,V){c(O,z)||o("invalid parameter type"+u(V)+". expected "+z+", got "+typeof O)}function d(O,z){O>=0&&(O|0)===O||o("invalid parameter type, ("+O+")"+u(z)+". must be a nonnegative integer")}function v(O,z,V){z.indexOf(O)<0&&o("invalid value"+u(V)+". must be one of: "+z)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(O){Object.keys(O).forEach(function(z){p.indexOf(z)<0&&o('invalid regl constructor argument "'+z+'". must be one of '+p)})}function y(O,z){for(O=O+"";O.length<z;)O=" "+O;return O}function m(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function b(O,z){this.number=O,this.line=z,this.errors=[]}function x(O,z,V){this.file=O,this.line=z,this.message=V}function E(){var O=new Error,z=(O.stack||O).toString(),V=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(z);if(V)return V[1];var ce=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(z);return ce?ce[1]:"unknown"}function w(){var O=new Error,z=(O.stack||O).toString(),V=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(z);if(V)return V[1];var ce=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(z);return ce?ce[1]:"unknown"}function _(O,z){var V=O.split(`
42
- `),ce=1,Ee=0,le={unknown:new m,0:new m};le.unknown.name=le[0].name=z||E(),le.unknown.lines.push(new b(0,""));for(var de=0;de<V.length;++de){var Ie=V[de],ke=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Ie);if(ke)switch(ke[1]){case"line":var Ge=/(\d+)(\s+\d+)?/.exec(ke[2]);Ge&&(ce=Ge[1]|0,Ge[2]&&(Ee=Ge[2]|0,Ee in le||(le[Ee]=new m)));break;case"define":var Pe=/SHADER_NAME(_B64)?\s+(.*)$/.exec(ke[2]);Pe&&(le[Ee].name=Pe[1]?a(Pe[2]):Pe[2]);break}le[Ee].lines.push(new b(ce++,Ie))}return Object.keys(le).forEach(function(je){var Ve=le[je];Ve.lines.forEach(function(Oe){Ve.index[Oe.number]=Oe})}),le}function M(O){var z=[];return O.split(`
43
- `).forEach(function(V){if(!(V.length<5)){var ce=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(V);ce?z.push(new x(ce[1]|0,ce[2]|0,ce[3].trim())):V.length>0&&z.push(new x("unknown",0,V))}}),z}function C(O,z){z.forEach(function(V){var ce=O[V.file];if(ce){var Ee=ce.index[V.line];if(Ee){Ee.errors.push(V),ce.hasErrors=!0;return}}O.unknown.hasErrors=!0,O.unknown.lines[0].errors.push(V)})}function S(O,z,V,ce,Ee){if(!O.getShaderParameter(z,O.COMPILE_STATUS)){var le=O.getShaderInfoLog(z),de=ce===O.FRAGMENT_SHADER?"fragment":"vertex";G(V,"string",de+" shader source must be a string",Ee);var Ie=_(V,Ee),ke=M(le);C(Ie,ke),Object.keys(Ie).forEach(function(Ge){var Pe=Ie[Ge];if(!Pe.hasErrors)return;var je=[""],Ve=[""];function Oe(Ue,oe){je.push(Ue),Ve.push(oe||"")}Oe("file number "+Ge+": "+Pe.name+`
44
- `,"color:red;text-decoration:underline;font-weight:bold"),Pe.lines.forEach(function(Ue){if(Ue.errors.length>0){Oe(y(Ue.number,4)+"| ","background-color:yellow; font-weight:bold"),Oe(Ue.line+i,"color:red; background-color:yellow; font-weight:bold");var oe=0;Ue.errors.forEach(function(ve){var Fe=ve.message,Ze=/^\s*'(.*)'\s*:\s*(.*)$/.exec(Fe);if(Ze){var Me=Ze[1];switch(Fe=Ze[2],Me){case"assign":Me="=";break}oe=Math.max(Ue.line.indexOf(Me,oe),0)}else oe=0;Oe(y("| ",6)),Oe(y("^^^",oe+3)+i,"font-weight:bold"),Oe(y("| ",6)),Oe(Fe+i,"font-weight:bold")}),Oe(y("| ",6)+i)}else Oe(y(Ue.number,4)+"| "),Oe(Ue.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(Ve[0]=je.join("%c"),console.log.apply(console,Ve)):console.log(je.join(""))}),s.raise("Error compiling "+de+" shader, "+Ie[0].name)}}function A(O,z,V,ce,Ee){if(!O.getProgramParameter(z,O.LINK_STATUS)){var le=O.getProgramInfoLog(z),de=_(V,Ee),Ie=_(ce,Ee),ke='Error linking program with vertex shader, "'+Ie[0].name+'", and fragment shader "'+de[0].name+'"';typeof document<"u"?console.log("%c"+ke+i+"%c"+le,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(ke+i+le),s.raise(ke)}}function T(O){O._commandRef=E()}function I(O,z,V,ce){T(O);function Ee(ke){return ke?ce.id(ke):0}O._fragId=Ee(O.static.frag),O._vertId=Ee(O.static.vert);function le(ke,Ge){Object.keys(Ge).forEach(function(Pe){ke[ce.id(Pe)]=!0})}var de=O._uniformSet={};le(de,z.static),le(de,z.dynamic);var Ie=O._attributeSet={};le(Ie,V.static),le(Ie,V.dynamic),O._hasCount="count"in O.static||"count"in O.dynamic||"elements"in O.static||"elements"in O.dynamic}function D(O,z){var V=w();o(O+" in command "+(z||E())+(V==="unknown"?"":" called from "+V))}function N(O,z,V){O||D(z,V||E())}function P(O,z,V,ce){O in z||D("unknown parameter ("+O+")"+u(V)+". possible values: "+Object.keys(z).join(),ce||E())}function G(O,z,V,ce){c(O,z)||D("invalid parameter type"+u(V)+". expected "+z+", got "+typeof O,ce||E())}function W(O){O()}function k(O,z,V){O.texture?v(O.texture._texture.internalformat,z,"unsupported texture format for attachment"):v(O.renderbuffer._renderbuffer.format,V,"unsupported renderbuffer format for attachment")}var R=33071,Y=9728,J=9984,te=9985,H=9986,pe=9987,Ae=5120,Le=5121,qe=5122,at=5123,rt=5124,xt=5125,Et=5126,ur=32819,Bt=32820,Ut=33635,dr=34042,fr=36193,Gt={};Gt[Ae]=Gt[Le]=1,Gt[qe]=Gt[at]=Gt[fr]=Gt[Ut]=Gt[ur]=Gt[Bt]=2,Gt[rt]=Gt[xt]=Gt[Et]=Gt[dr]=4;function Jt(O,z){return O===Bt||O===ur||O===Ut?2:O===dr?4:Gt[O]*z}function Rr(O){return!(O&O-1)&&!!O}function tt(O,z,V){var ce,Ee=z.width,le=z.height,de=z.channels;s(Ee>0&&Ee<=V.maxTextureSize&&le>0&&le<=V.maxTextureSize,"invalid texture shape"),(O.wrapS!==R||O.wrapT!==R)&&s(Rr(Ee)&&Rr(le),"incompatible wrap mode for texture, both width and height must be power of 2"),z.mipmask===1?Ee!==1&&le!==1&&s(O.minFilter!==J&&O.minFilter!==H&&O.minFilter!==te&&O.minFilter!==pe,"min filter requires mipmap"):(s(Rr(Ee)&&Rr(le),"texture must be a square power of 2 to support mipmapping"),s(z.mipmask===(Ee<<1)-1,"missing or incomplete mipmap data")),z.type===Et&&(V.extensions.indexOf("oes_texture_float_linear")<0&&s(O.minFilter===Y&&O.magFilter===Y,"filter not supported, must enable oes_texture_float_linear"),s(!O.genMipmaps,"mipmap generation not supported with float textures"));var Ie=z.images;for(ce=0;ce<16;++ce)if(Ie[ce]){var ke=Ee>>ce,Ge=le>>ce;s(z.mipmask&1<<ce,"missing mipmap data");var Pe=Ie[ce];if(s(Pe.width===ke&&Pe.height===Ge,"invalid shape for mip images"),s(Pe.format===z.format&&Pe.internalformat===z.internalformat&&Pe.type===z.type,"incompatible type for mip image"),!Pe.compressed)if(Pe.data){var je=Math.ceil(Jt(Pe.type,de)*ke/Pe.unpackAlignment)*Pe.unpackAlignment;s(Pe.data.byteLength===je*Ge,"invalid data for image, buffer size is inconsistent with image format")}else Pe.element||Pe.copy}else O.genMipmaps||s((z.mipmask&1<<ce)===0,"extra mipmap data");z.compressed&&s(!O.genMipmaps,"mipmap generation for compressed images not supported")}function ie(O,z,V,ce){var Ee=O.width,le=O.height,de=O.channels;s(Ee>0&&Ee<=ce.maxTextureSize&&le>0&&le<=ce.maxTextureSize,"invalid texture shape"),s(Ee===le,"cube map must be square"),s(z.wrapS===R&&z.wrapT===R,"wrap mode not supported by cube map");for(var Ie=0;Ie<V.length;++Ie){var ke=V[Ie];s(ke.width===Ee&&ke.height===le,"inconsistent cube map face shape"),z.genMipmaps&&(s(!ke.compressed,"can not generate mipmap for compressed textures"),s(ke.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var Ge=ke.images,Pe=0;Pe<16;++Pe){var je=Ge[Pe];if(je){var Ve=Ee>>Pe,Oe=le>>Pe;s(ke.mipmask&1<<Pe,"missing mipmap data"),s(je.width===Ve&&je.height===Oe,"invalid shape for mip images"),s(je.format===O.format&&je.internalformat===O.internalformat&&je.type===O.type,"incompatible type for mip image"),je.compressed||(je.data?s(je.data.byteLength===Ve*Oe*Math.max(Jt(je.type,de),je.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):je.element||je.copy)}}}}var L=n(s,{optional:W,raise:o,commandRaise:D,command:N,parameter:f,commandParameter:P,constructor:g,type:h,commandType:G,isTypedArray:l,nni:d,oneOf:v,shaderError:S,linkError:A,callSite:w,saveCommandRef:T,saveDrawInfo:I,framebufferFormat:k,guessCommand:E,texture2D:tt,textureCube:ie}),_e=0,Be=0,ye=5,$e=6;function We(O,z){this.id=_e++,this.type=O,this.data=z}function Ke(O){return O.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Qe(O){if(O.length===0)return[];var z=O.charAt(0),V=O.charAt(O.length-1);if(O.length>1&&z===V&&(z==='"'||z==="'"))return['"'+Ke(O.substr(1,O.length-2))+'"'];var ce=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(O);if(ce)return Qe(O.substr(0,ce.index)).concat(Qe(ce[1])).concat(Qe(O.substr(ce.index+ce[0].length)));var Ee=O.split(".");if(Ee.length===1)return['"'+Ke(O)+'"'];for(var le=[],de=0;de<Ee.length;++de)le=le.concat(Qe(Ee[de]));return le}function vt(O){return"["+Qe(O).join("][")+"]"}function Dt(O,z){return new We(O,vt(z+""))}function lr(O){return typeof O=="function"&&!O._reglType||O instanceof We}function kt(O,z){if(typeof O=="function")return new We(Be,O);if(typeof O=="number"||typeof O=="boolean")return new We(ye,O);if(Array.isArray(O))return new We($e,O.map((V,ce)=>kt(V,z+"["+ce+"]")));if(O instanceof We)return O;L(!1,"invalid option type in uniform "+z)}var hr={DynamicVariable:We,define:Dt,isDynamic:lr,unbox:kt,accessor:vt},or={next:typeof requestAnimationFrame=="function"?function(O){return requestAnimationFrame(O)}:function(O){return setTimeout(O,16)},cancel:typeof cancelAnimationFrame=="function"?function(O){return cancelAnimationFrame(O)}:clearTimeout},gr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function vr(){var O={"":0},z=[""];return{id:function(V){var ce=O[V];return ce||(ce=O[V]=z.length,z.push(V),ce)},str:function(V){return z[V]}}}function en(O,z,V){var ce=document.createElement("canvas");n(ce.style,{border:0,margin:0,padding:0,top:0,left:0}),O.appendChild(ce),O===document.body&&(ce.style.position="absolute",n(O.style,{margin:0,padding:0}));function Ee(){var Ie=window.innerWidth,ke=window.innerHeight;if(O!==document.body){var Ge=O.getBoundingClientRect();Ie=Ge.right-Ge.left,ke=Ge.bottom-Ge.top}ce.width=V*Ie,ce.height=V*ke,n(ce.style,{width:Ie+"px",height:ke+"px"})}var le;O!==document.body&&typeof ResizeObserver=="function"?(le=new ResizeObserver(function(){setTimeout(Ee)}),le.observe(O)):window.addEventListener("resize",Ee,!1);function de(){le?le.disconnect():window.removeEventListener("resize",Ee),O.removeChild(ce)}return Ee(),{canvas:ce,onDestroy:de}}function er(O,z){function V(ce){try{return O.getContext(ce,z)}catch{return null}}return V("webgl")||V("experimental-webgl")||V("webgl-experimental")}function Or(O){return typeof O.nodeName=="string"&&typeof O.appendChild=="function"&&typeof O.getBoundingClientRect=="function"}function Un(O){return typeof O.drawArrays=="function"||typeof O.drawElements=="function"}function Br(O){return typeof O=="string"?O.split():(L(Array.isArray(O),"invalid extension array"),O)}function Ui(O){return typeof O=="string"?(L(typeof document<"u","not supported outside of DOM"),document.querySelector(O)):O}function Uo(O){var z=O||{},V,ce,Ee,le,de={},Ie=[],ke=[],Ge=typeof window>"u"?1:window.devicePixelRatio,Pe=!1,je=function(Ue){Ue&&L.raise(Ue)},Ve=function(){};if(typeof z=="string"?(L(typeof document<"u","selector queries only supported in DOM enviroments"),V=document.querySelector(z),L(V,"invalid query string for element")):typeof z=="object"?Or(z)?V=z:Un(z)?(le=z,Ee=le.canvas):(L.constructor(z),"gl"in z?le=z.gl:"canvas"in z?Ee=Ui(z.canvas):"container"in z&&(ce=Ui(z.container)),"attributes"in z&&(de=z.attributes,L.type(de,"object","invalid context attributes")),"extensions"in z&&(Ie=Br(z.extensions)),"optionalExtensions"in z&&(ke=Br(z.optionalExtensions)),"onDone"in z&&(L.type(z.onDone,"function","invalid or missing onDone callback"),je=z.onDone),"profile"in z&&(Pe=!!z.profile),"pixelRatio"in z&&(Ge=+z.pixelRatio,L(Ge>0,"invalid pixel ratio"))):L.raise("invalid arguments to regl"),V&&(V.nodeName.toLowerCase()==="canvas"?Ee=V:ce=V),!le){if(!Ee){L(typeof document<"u","must manually specify webgl context outside of DOM environments");var Oe=en(ce||document.body,je,Ge);if(!Oe)return null;Ee=Oe.canvas,Ve=Oe.onDestroy}de.premultipliedAlpha===void 0&&(de.premultipliedAlpha=!0),le=er(Ee,de)}return le?{gl:le,canvas:Ee,container:ce,extensions:Ie,optionalExtensions:ke,pixelRatio:Ge,profile:Pe,onDone:je,onDestroy:Ve}:(Ve(),je("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function $o(O,z){var V={};function ce(de){L.type(de,"string","extension name must be string");var Ie=de.toLowerCase(),ke;try{ke=V[Ie]=O.getExtension(Ie)}catch{}return!!ke}for(var Ee=0;Ee<z.extensions.length;++Ee){var le=z.extensions[Ee];if(!ce(le))return z.onDestroy(),z.onDone('"'+le+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return z.optionalExtensions.forEach(ce),{extensions:V,restore:function(){Object.keys(V).forEach(function(de){if(V[de]&&!ce(de))throw new Error("(regl): error restoring extension "+de)})}}}function qr(O,z){for(var V=Array(O),ce=0;ce<O;++ce)V[ce]=z(ce);return V}var wi=5120,Ca=5121,Wo=5122,Xo=5123,Yo=5124,$n=5125,Lr=5126;function Wn(O){for(var z=16;z<=1<<28;z*=16)if(O<=z)return z;return 0}function At(O){var z,V;return z=(O>65535)<<4,O>>>=z,V=(O>255)<<3,O>>>=V,z|=V,V=(O>15)<<2,O>>>=V,z|=V,V=(O>3)<<1,O>>>=V,z|=V,z|O>>1}function pr(){var O=qr(8,function(){return[]});function z(le){var de=Wn(le),Ie=O[At(de)>>2];return Ie.length>0?Ie.pop():new ArrayBuffer(de)}function V(le){O[At(le.byteLength)>>2].push(le)}function ce(le,de){var Ie=null;switch(le){case wi:Ie=new Int8Array(z(de),0,de);break;case Ca:Ie=new Uint8Array(z(de),0,de);break;case Wo:Ie=new Int16Array(z(2*de),0,de);break;case Xo:Ie=new Uint16Array(z(2*de),0,de);break;case Yo:Ie=new Int32Array(z(4*de),0,de);break;case $n:Ie=new Uint32Array(z(4*de),0,de);break;case Lr:Ie=new Float32Array(z(4*de),0,de);break;default:return null}return Ie.length!==de?Ie.subarray(0,de):Ie}function Ee(le){V(le.buffer)}return{alloc:z,free:V,allocType:ce,freeType:Ee}}var mt=pr();mt.zero=pr();var _r=3408,tn=3410,Aa=3411,Ta=3412,_i=3413,$i=3414,Ia=3415,Oa=33901,ip=33902,ap=3379,op=3386,sp=34921,up=36347,fp=36348,lp=35661,cp=35660,hp=34930,dp=36349,vp=34076,pp=34024,AP=7936,TP=7937,IP=7938,OP=35724,LP=34047,DP=36063,kP=34852,hc=3553,Ab=34067,PP=34069,NP=33984,rf=6408,gp=5126,Tb=5121,yp=36160,RP=36053,BP=36064,FP=16384,GP=function(O,z){var V=1;z.ext_texture_filter_anisotropic&&(V=O.getParameter(LP));var ce=1,Ee=1;z.webgl_draw_buffers&&(ce=O.getParameter(kP),Ee=O.getParameter(DP));var le=!!z.oes_texture_float;if(le){var de=O.createTexture();O.bindTexture(hc,de),O.texImage2D(hc,0,rf,1,1,0,rf,gp,null);var Ie=O.createFramebuffer();if(O.bindFramebuffer(yp,Ie),O.framebufferTexture2D(yp,BP,hc,de,0),O.bindTexture(hc,null),O.checkFramebufferStatus(yp)!==RP)le=!1;else{O.viewport(0,0,1,1),O.clearColor(1,0,0,1),O.clear(FP);var ke=mt.allocType(gp,4);O.readPixels(0,0,1,1,rf,gp,ke),O.getError()?le=!1:(O.deleteFramebuffer(Ie),O.deleteTexture(de),le=ke[0]===1),mt.freeType(ke)}}var Ge=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Pe=!0;if(!Ge){var je=O.createTexture(),Ve=mt.allocType(Tb,36);O.activeTexture(NP),O.bindTexture(Ab,je),O.texImage2D(PP,0,rf,3,3,0,rf,Tb,Ve),mt.freeType(Ve),O.bindTexture(Ab,null),O.deleteTexture(je),Pe=!O.getError()}return{colorBits:[O.getParameter(tn),O.getParameter(Aa),O.getParameter(Ta),O.getParameter(_i)],depthBits:O.getParameter($i),stencilBits:O.getParameter(Ia),subpixelBits:O.getParameter(_r),extensions:Object.keys(z).filter(function(Oe){return!!z[Oe]}),maxAnisotropic:V,maxDrawbuffers:ce,maxColorAttachments:Ee,pointSizeDims:O.getParameter(Oa),lineWidthDims:O.getParameter(ip),maxViewportDims:O.getParameter(op),maxCombinedTextureUnits:O.getParameter(lp),maxCubeMapSize:O.getParameter(vp),maxRenderbufferSize:O.getParameter(pp),maxTextureUnits:O.getParameter(hp),maxTextureSize:O.getParameter(ap),maxAttributes:O.getParameter(sp),maxVertexUniforms:O.getParameter(up),maxVertexTextureUnits:O.getParameter(cp),maxVaryingVectors:O.getParameter(fp),maxFragmentUniforms:O.getParameter(dp),glsl:O.getParameter(OP),renderer:O.getParameter(TP),vendor:O.getParameter(AP),version:O.getParameter(IP),readFloat:le,npotTextureCube:Pe}};function Si(O){return!!O&&typeof O=="object"&&Array.isArray(O.shape)&&Array.isArray(O.stride)&&typeof O.offset=="number"&&O.shape.length===O.stride.length&&(Array.isArray(O.data)||e(O.data))}var Xn=function(O){return Object.keys(O).map(function(z){return O[z]})},dc={shape:$P,flatten:UP};function zP(O,z,V){for(var ce=0;ce<z;++ce)V[ce]=O[ce]}function jP(O,z,V,ce){for(var Ee=0,le=0;le<z;++le)for(var de=O[le],Ie=0;Ie<V;++Ie)ce[Ee++]=de[Ie]}function Ib(O,z,V,ce,Ee,le){for(var de=le,Ie=0;Ie<z;++Ie)for(var ke=O[Ie],Ge=0;Ge<V;++Ge)for(var Pe=ke[Ge],je=0;je<ce;++je)Ee[de++]=Pe[je]}function Ob(O,z,V,ce,Ee){for(var le=1,de=V+1;de<z.length;++de)le*=z[de];var Ie=z[V];if(z.length-V===4){var ke=z[V+1],Ge=z[V+2],Pe=z[V+3];for(de=0;de<Ie;++de)Ib(O[de],ke,Ge,Pe,ce,Ee),Ee+=le}else for(de=0;de<Ie;++de)Ob(O[de],z,V+1,ce,Ee),Ee+=le}function UP(O,z,V,ce){var Ee=1;if(z.length)for(var le=0;le<z.length;++le)Ee*=z[le];else Ee=0;var de=ce||mt.allocType(V,Ee);switch(z.length){case 0:break;case 1:zP(O,z[0],de);break;case 2:jP(O,z[0],z[1],de);break;case 3:Ib(O,z[0],z[1],z[2],de,0);break;default:Ob(O,z,0,de,0)}return de}function $P(O){for(var z=[],V=O;V.length;V=V[0])z.push(V.length);return z}var mp={"[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},WP=5120,XP=5122,YP=5124,VP=5121,HP=5123,KP=5125,qP=5126,ZP=5126,Vo={int8:WP,int16:XP,int32:YP,uint8:VP,uint16:HP,uint32:KP,float:qP,float32:ZP},QP=35048,JP=35040,vc={dynamic:QP,stream:JP,static:35044},bp=dc.flatten,Lb=dc.shape,Db=35044,eN=35040,xp=5121,Ep=5126,io=[];io[5120]=1,io[5122]=2,io[5124]=4,io[5121]=1,io[5123]=2,io[5125]=4,io[5126]=4;function pc(O){return mp[Object.prototype.toString.call(O)]|0}function kb(O,z){for(var V=0;V<z.length;++V)O[V]=z[V]}function Pb(O,z,V,ce,Ee,le,de){for(var Ie=0,ke=0;ke<V;++ke)for(var Ge=0;Ge<ce;++Ge)O[Ie++]=z[Ee*ke+le*Ge+de]}function tN(O,z,V,ce){var Ee=0,le={};function de(oe){this.id=Ee++,this.buffer=O.createBuffer(),this.type=oe,this.usage=Db,this.byteLength=0,this.dimension=1,this.dtype=xp,this.persistentData=null,V.profile&&(this.stats={size:0})}de.prototype.bind=function(){O.bindBuffer(this.type,this.buffer)},de.prototype.destroy=function(){Ve(this)};var Ie=[];function ke(oe,ve){var Fe=Ie.pop();return Fe||(Fe=new de(oe)),Fe.bind(),je(Fe,ve,eN,0,1,!1),Fe}function Ge(oe){Ie.push(oe)}function Pe(oe,ve,Fe){oe.byteLength=ve.byteLength,O.bufferData(oe.type,ve,Fe)}function je(oe,ve,Fe,Ze,Me,nt){var Te;if(oe.usage=Fe,Array.isArray(ve)){if(oe.dtype=Ze||Ep,ve.length>0){var Xe;if(Array.isArray(ve[0])){Te=Lb(ve);for(var Ce=1,Ye=1;Ye<Te.length;++Ye)Ce*=Te[Ye];oe.dimension=Ce,Xe=bp(ve,Te,oe.dtype),Pe(oe,Xe,Fe),nt?oe.persistentData=Xe:mt.freeType(Xe)}else if(typeof ve[0]=="number"){oe.dimension=Me;var pt=mt.allocType(oe.dtype,ve.length);kb(pt,ve),Pe(oe,pt,Fe),nt?oe.persistentData=pt:mt.freeType(pt)}else e(ve[0])?(oe.dimension=ve[0].length,oe.dtype=Ze||pc(ve[0])||Ep,Xe=bp(ve,[ve.length,ve[0].length],oe.dtype),Pe(oe,Xe,Fe),nt?oe.persistentData=Xe:mt.freeType(Xe)):L.raise("invalid buffer data")}}else if(e(ve))oe.dtype=Ze||pc(ve),oe.dimension=Me,Pe(oe,ve,Fe),nt&&(oe.persistentData=new Uint8Array(new Uint8Array(ve.buffer)));else if(Si(ve)){Te=ve.shape;var Tt=ve.stride,He=ve.offset,ze=0,Se=0,Ct=0,Pt=0;Te.length===1?(ze=Te[0],Se=1,Ct=Tt[0],Pt=0):Te.length===2?(ze=Te[0],Se=Te[1],Ct=Tt[0],Pt=Tt[1]):L.raise("invalid shape"),oe.dtype=Ze||pc(ve.data)||Ep,oe.dimension=Se;var ot=mt.allocType(oe.dtype,ze*Se);Pb(ot,ve.data,ze,Se,Ct,Pt,He),Pe(oe,ot,Fe),nt?oe.persistentData=ot:mt.freeType(ot)}else ve instanceof ArrayBuffer?(oe.dtype=xp,oe.dimension=Me,Pe(oe,ve,Fe),nt&&(oe.persistentData=new Uint8Array(new Uint8Array(ve)))):L.raise("invalid buffer data")}function Ve(oe){z.bufferCount--,ce(oe);var ve=oe.buffer;L(ve,"buffer must not be deleted already"),O.deleteBuffer(ve),oe.buffer=null,delete le[oe.id]}function Oe(oe,ve,Fe,Ze){z.bufferCount++;var Me=new de(ve);le[Me.id]=Me;function nt(Ce){var Ye=Db,pt=null,Tt=0,He=0,ze=1;return Array.isArray(Ce)||e(Ce)||Si(Ce)||Ce instanceof ArrayBuffer?pt=Ce:typeof Ce=="number"?Tt=Ce|0:Ce&&(L.type(Ce,"object","buffer arguments must be an object, a number or an array"),"data"in Ce&&(L(pt===null||Array.isArray(pt)||e(pt)||Si(pt),"invalid data for buffer"),pt=Ce.data),"usage"in Ce&&(L.parameter(Ce.usage,vc,"invalid buffer usage"),Ye=vc[Ce.usage]),"type"in Ce&&(L.parameter(Ce.type,Vo,"invalid buffer type"),He=Vo[Ce.type]),"dimension"in Ce&&(L.type(Ce.dimension,"number","invalid dimension"),ze=Ce.dimension|0),"length"in Ce&&(L.nni(Tt,"buffer length must be a nonnegative integer"),Tt=Ce.length|0)),Me.bind(),pt?je(Me,pt,Ye,He,ze,Ze):(Tt&&O.bufferData(Me.type,Tt,Ye),Me.dtype=He||xp,Me.usage=Ye,Me.dimension=ze,Me.byteLength=Tt),V.profile&&(Me.stats.size=Me.byteLength*io[Me.dtype]),nt}function Te(Ce,Ye){L(Ye+Ce.byteLength<=Me.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+Ce.byteLength+" starting from offset "+Ye+" to a buffer of size "+Me.byteLength),O.bufferSubData(Me.type,Ye,Ce)}function Xe(Ce,Ye){var pt=(Ye||0)|0,Tt;if(Me.bind(),e(Ce)||Ce instanceof ArrayBuffer)Te(Ce,pt);else if(Array.isArray(Ce)){if(Ce.length>0)if(typeof Ce[0]=="number"){var He=mt.allocType(Me.dtype,Ce.length);kb(He,Ce),Te(He,pt),mt.freeType(He)}else if(Array.isArray(Ce[0])||e(Ce[0])){Tt=Lb(Ce);var ze=bp(Ce,Tt,Me.dtype);Te(ze,pt),mt.freeType(ze)}else L.raise("invalid buffer data")}else if(Si(Ce)){Tt=Ce.shape;var Se=Ce.stride,Ct=0,Pt=0,ot=0,zt=0;Tt.length===1?(Ct=Tt[0],Pt=1,ot=Se[0],zt=0):Tt.length===2?(Ct=Tt[0],Pt=Tt[1],ot=Se[0],zt=Se[1]):L.raise("invalid shape");var It=Array.isArray(Ce.data)?Me.dtype:pc(Ce.data),Ft=mt.allocType(It,Ct*Pt);Pb(Ft,Ce.data,Ct,Pt,ot,zt,Ce.offset),Te(Ft,pt),mt.freeType(Ft)}else L.raise("invalid data for buffer subdata");return nt}return Fe||nt(oe),nt._reglType="buffer",nt._buffer=Me,nt.subdata=Xe,V.profile&&(nt.stats=Me.stats),nt.destroy=function(){Ve(Me)},nt}function Ue(){Xn(le).forEach(function(oe){oe.buffer=O.createBuffer(),O.bindBuffer(oe.type,oe.buffer),O.bufferData(oe.type,oe.persistentData||oe.byteLength,oe.usage)})}return V.profile&&(z.getTotalBufferSize=function(){var oe=0;return Object.keys(le).forEach(function(ve){oe+=le[ve].stats.size}),oe}),{create:Oe,createStream:ke,destroyStream:Ge,clear:function(){Xn(le).forEach(Ve),Ie.forEach(Ve)},getBuffer:function(oe){return oe&&oe._buffer instanceof de?oe._buffer:null},restore:Ue,_initBuffer:je}}var rN=0,nN=0,iN=1,aN=1,oN=4,sN=4,zs={points:rN,point:nN,lines:iN,line:aN,triangles:oN,triangle:sN,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},uN=0,fN=1,nf=4,lN=5120,js=5121,Nb=5122,Us=5123,Rb=5124,Ho=5125,wp=34963,cN=35040,hN=35044;function dN(O,z,V,ce){var Ee={},le=0,de={uint8:js,uint16:Us};z.oes_element_index_uint&&(de.uint32=Ho);function Ie(Ue){this.id=le++,Ee[this.id]=this,this.buffer=Ue,this.primType=nf,this.vertCount=0,this.type=0}Ie.prototype.bind=function(){this.buffer.bind()};var ke=[];function Ge(Ue){var oe=ke.pop();return oe||(oe=new Ie(V.create(null,wp,!0,!1)._buffer)),je(oe,Ue,cN,-1,-1,0,0),oe}function Pe(Ue){ke.push(Ue)}function je(Ue,oe,ve,Fe,Ze,Me,nt){Ue.buffer.bind();var Te;if(oe){var Xe=nt;!nt&&(!e(oe)||Si(oe)&&!e(oe.data))&&(Xe=z.oes_element_index_uint?Ho:Us),V._initBuffer(Ue.buffer,oe,ve,Xe,3)}else O.bufferData(wp,Me,ve),Ue.buffer.dtype=Te||js,Ue.buffer.usage=ve,Ue.buffer.dimension=3,Ue.buffer.byteLength=Me;if(Te=nt,!nt){switch(Ue.buffer.dtype){case js:case lN:Te=js;break;case Us:case Nb:Te=Us;break;case Ho:case Rb:Te=Ho;break;default:L.raise("unsupported type for element array")}Ue.buffer.dtype=Te}Ue.type=Te,L(Te!==Ho||!!z.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Ce=Ze;Ce<0&&(Ce=Ue.buffer.byteLength,Te===Us?Ce>>=1:Te===Ho&&(Ce>>=2)),Ue.vertCount=Ce;var Ye=Fe;if(Fe<0){Ye=nf;var pt=Ue.buffer.dimension;pt===1&&(Ye=uN),pt===2&&(Ye=fN),pt===3&&(Ye=nf)}Ue.primType=Ye}function Ve(Ue){ce.elementsCount--,L(Ue.buffer!==null,"must not double destroy elements"),delete Ee[Ue.id],Ue.buffer.destroy(),Ue.buffer=null}function Oe(Ue,oe){var ve=V.create(null,wp,!0),Fe=new Ie(ve._buffer);ce.elementsCount++;function Ze(Me){if(!Me)ve(),Fe.primType=nf,Fe.vertCount=0,Fe.type=js;else if(typeof Me=="number")ve(Me),Fe.primType=nf,Fe.vertCount=Me|0,Fe.type=js;else{var nt=null,Te=hN,Xe=-1,Ce=-1,Ye=0,pt=0;Array.isArray(Me)||e(Me)||Si(Me)?nt=Me:(L.type(Me,"object","invalid arguments for elements"),"data"in Me&&(nt=Me.data,L(Array.isArray(nt)||e(nt)||Si(nt),"invalid data for element buffer")),"usage"in Me&&(L.parameter(Me.usage,vc,"invalid element buffer usage"),Te=vc[Me.usage]),"primitive"in Me&&(L.parameter(Me.primitive,zs,"invalid element buffer primitive"),Xe=zs[Me.primitive]),"count"in Me&&(L(typeof Me.count=="number"&&Me.count>=0,"invalid vertex count for elements"),Ce=Me.count|0),"type"in Me&&(L.parameter(Me.type,de,"invalid buffer type"),pt=de[Me.type]),"length"in Me?Ye=Me.length|0:(Ye=Ce,pt===Us||pt===Nb?Ye*=2:(pt===Ho||pt===Rb)&&(Ye*=4))),je(Fe,nt,Te,Xe,Ce,Ye,pt)}return Ze}return Ze(Ue),Ze._reglType="elements",Ze._elements=Fe,Ze.subdata=function(Me,nt){return ve.subdata(Me,nt),Ze},Ze.destroy=function(){Ve(Fe)},Ze}return{create:Oe,createStream:Ge,destroyStream:Pe,getElements:function(Ue){return typeof Ue=="function"&&Ue._elements instanceof Ie?Ue._elements:null},clear:function(){Xn(Ee).forEach(Ve)}}}var Bb=new Float32Array(1),vN=new Uint32Array(Bb.buffer),pN=5123;function Fb(O){for(var z=mt.allocType(pN,O.length),V=0;V<O.length;++V)if(isNaN(O[V]))z[V]=65535;else if(O[V]===1/0)z[V]=31744;else if(O[V]===-1/0)z[V]=64512;else{Bb[0]=O[V];var ce=vN[0],Ee=ce>>>31<<15,le=(ce<<1>>>24)-127,de=ce>>13&1023;if(le<-24)z[V]=Ee;else if(le<-14){var Ie=-14-le;z[V]=Ee+(de+1024>>Ie)}else le>15?z[V]=Ee+31744:z[V]=Ee+(le+15<<10)+de}return z}function Dr(O){return Array.isArray(O)||e(O)}var Gb=function(O){return!(O&O-1)&&!!O},gN=34467,Wi=3553,_p=34067,gc=34069,Ko=6408,Sp=6406,yc=6407,af=6409,mc=6410,zb=32854,Mp=32855,jb=36194,yN=32819,mN=32820,bN=33635,xN=34042,Cp=6402,bc=34041,Ap=35904,Tp=35906,$s=36193,Ip=33776,Op=33777,Lp=33778,Dp=33779,Ub=35986,$b=35987,Wb=34798,Xb=35840,Yb=35841,Vb=35842,Hb=35843,Kb=36196,Ws=5121,kp=5123,Pp=5125,of=5126,EN=10242,wN=10243,_N=10497,Np=33071,SN=33648,MN=10240,CN=10241,Rp=9728,AN=9729,Bp=9984,qb=9985,Zb=9986,Fp=9987,TN=33170,xc=4352,IN=4353,ON=4354,LN=34046,DN=3317,kN=37440,PN=37441,NN=37443,Qb=37444,sf=33984,RN=[Bp,Zb,qb,Fp],Ec=[0,af,mc,yc,Ko],oi={};oi[af]=oi[Sp]=oi[Cp]=1,oi[bc]=oi[mc]=2,oi[yc]=oi[Ap]=3,oi[Ko]=oi[Tp]=4;function Xs(O){return"[object "+O+"]"}var Jb=Xs("HTMLCanvasElement"),ex=Xs("OffscreenCanvas"),tx=Xs("CanvasRenderingContext2D"),rx=Xs("ImageBitmap"),nx=Xs("HTMLImageElement"),ix=Xs("HTMLVideoElement"),BN=Object.keys(mp).concat([Jb,ex,tx,rx,nx,ix]),Ys=[];Ys[Ws]=1,Ys[of]=4,Ys[$s]=2,Ys[kp]=2,Ys[Pp]=4;var cn=[];cn[zb]=2,cn[Mp]=2,cn[jb]=2,cn[bc]=4,cn[Ip]=.5,cn[Op]=.5,cn[Lp]=1,cn[Dp]=1,cn[Ub]=.5,cn[$b]=1,cn[Wb]=1,cn[Xb]=.5,cn[Yb]=.25,cn[Vb]=.5,cn[Hb]=.25,cn[Kb]=.5;function ax(O){return Array.isArray(O)&&(O.length===0||typeof O[0]=="number")}function ox(O){if(!Array.isArray(O))return!1;var z=O.length;return!(z===0||!Dr(O[0]))}function qo(O){return Object.prototype.toString.call(O)}function sx(O){return qo(O)===Jb}function ux(O){return qo(O)===ex}function FN(O){return qo(O)===tx}function GN(O){return qo(O)===rx}function zN(O){return qo(O)===nx}function jN(O){return qo(O)===ix}function Gp(O){if(!O)return!1;var z=qo(O);return BN.indexOf(z)>=0?!0:ax(O)||ox(O)||Si(O)}function fx(O){return mp[Object.prototype.toString.call(O)]|0}function UN(O,z){var V=z.length;switch(O.type){case Ws:case kp:case Pp:case of:var ce=mt.allocType(O.type,V);ce.set(z),O.data=ce;break;case $s:O.data=Fb(z);break;default:L.raise("unsupported texture type, must specify a typed array")}}function lx(O,z){return mt.allocType(O.type===$s?of:O.type,z)}function cx(O,z){O.type===$s?(O.data=Fb(z),mt.freeType(z)):O.data=z}function $N(O,z,V,ce,Ee,le){for(var de=O.width,Ie=O.height,ke=O.channels,Ge=de*Ie*ke,Pe=lx(O,Ge),je=0,Ve=0;Ve<Ie;++Ve)for(var Oe=0;Oe<de;++Oe)for(var Ue=0;Ue<ke;++Ue)Pe[je++]=z[V*Oe+ce*Ve+Ee*Ue+le];cx(O,Pe)}function wc(O,z,V,ce,Ee,le){var de;if(typeof cn[O]<"u"?de=cn[O]:de=oi[O]*Ys[z],le&&(de*=6),Ee){for(var Ie=0,ke=V;ke>=1;)Ie+=de*ke*ke,ke/=2;return Ie}else return de*V*ce}function WN(O,z,V,ce,Ee,le,de){var Ie={"don't care":xc,"dont care":xc,nice:ON,fast:IN},ke={repeat:_N,clamp:Np,mirror:SN},Ge={nearest:Rp,linear:AN},Pe=n({mipmap:Fp,"nearest mipmap nearest":Bp,"linear mipmap nearest":qb,"nearest mipmap linear":Zb,"linear mipmap linear":Fp},Ge),je={none:0,browser:Qb},Ve={uint8:Ws,rgba4:yN,rgb565:bN,"rgb5 a1":mN},Oe={alpha:Sp,luminance:af,"luminance alpha":mc,rgb:yc,rgba:Ko,rgba4:zb,"rgb5 a1":Mp,rgb565:jb},Ue={};z.ext_srgb&&(Oe.srgb=Ap,Oe.srgba=Tp),z.oes_texture_float&&(Ve.float32=Ve.float=of),z.oes_texture_half_float&&(Ve.float16=Ve["half float"]=$s),z.webgl_depth_texture&&(n(Oe,{depth:Cp,"depth stencil":bc}),n(Ve,{uint16:kp,uint32:Pp,"depth stencil":xN})),z.webgl_compressed_texture_s3tc&&n(Ue,{"rgb s3tc dxt1":Ip,"rgba s3tc dxt1":Op,"rgba s3tc dxt3":Lp,"rgba s3tc dxt5":Dp}),z.webgl_compressed_texture_atc&&n(Ue,{"rgb atc":Ub,"rgba atc explicit alpha":$b,"rgba atc interpolated alpha":Wb}),z.webgl_compressed_texture_pvrtc&&n(Ue,{"rgb pvrtc 4bppv1":Xb,"rgb pvrtc 2bppv1":Yb,"rgba pvrtc 4bppv1":Vb,"rgba pvrtc 2bppv1":Hb}),z.webgl_compressed_texture_etc1&&(Ue["rgb etc1"]=Kb);var oe=Array.prototype.slice.call(O.getParameter(gN));Object.keys(Ue).forEach(function(X){var he=Ue[X];oe.indexOf(he)>=0&&(Oe[X]=he)});var ve=Object.keys(Oe);V.textureFormats=ve;var Fe=[];Object.keys(Oe).forEach(function(X){var he=Oe[X];Fe[he]=X});var Ze=[];Object.keys(Ve).forEach(function(X){var he=Ve[X];Ze[he]=X});var Me=[];Object.keys(Ge).forEach(function(X){var he=Ge[X];Me[he]=X});var nt=[];Object.keys(Pe).forEach(function(X){var he=Pe[X];nt[he]=X});var Te=[];Object.keys(ke).forEach(function(X){var he=ke[X];Te[he]=X});var Xe=ve.reduce(function(X,he){var fe=Oe[he];return fe===af||fe===Sp||fe===af||fe===mc||fe===Cp||fe===bc||z.ext_srgb&&(fe===Ap||fe===Tp)?X[fe]=fe:fe===Mp||he.indexOf("rgba")>=0?X[fe]=Ko:X[fe]=yc,X},{});function Ce(){this.internalformat=Ko,this.format=Ko,this.type=Ws,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Qb,this.width=0,this.height=0,this.channels=0}function Ye(X,he){X.internalformat=he.internalformat,X.format=he.format,X.type=he.type,X.compressed=he.compressed,X.premultiplyAlpha=he.premultiplyAlpha,X.flipY=he.flipY,X.unpackAlignment=he.unpackAlignment,X.colorSpace=he.colorSpace,X.width=he.width,X.height=he.height,X.channels=he.channels}function pt(X,he){if(!(typeof he!="object"||!he)){if("premultiplyAlpha"in he&&(L.type(he.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),X.premultiplyAlpha=he.premultiplyAlpha),"flipY"in he&&(L.type(he.flipY,"boolean","invalid texture flip"),X.flipY=he.flipY),"alignment"in he&&(L.oneOf(he.alignment,[1,2,4,8],"invalid texture unpack alignment"),X.unpackAlignment=he.alignment),"colorSpace"in he&&(L.parameter(he.colorSpace,je,"invalid colorSpace"),X.colorSpace=je[he.colorSpace]),"type"in he){var fe=he.type;L(z.oes_texture_float||!(fe==="float"||fe==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),L(z.oes_texture_half_float||!(fe==="half float"||fe==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),L(z.webgl_depth_texture||!(fe==="uint16"||fe==="uint32"||fe==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(fe,Ve,"invalid texture type"),X.type=Ve[fe]}var it=X.width,jt=X.height,U=X.channels,B=!1;"shape"in he?(L(Array.isArray(he.shape)&&he.shape.length>=2,"shape must be an array"),it=he.shape[0],jt=he.shape[1],he.shape.length===3&&(U=he.shape[2],L(U>0&&U<=4,"invalid number of channels"),B=!0),L(it>=0&&it<=V.maxTextureSize,"invalid width"),L(jt>=0&&jt<=V.maxTextureSize,"invalid height")):("radius"in he&&(it=jt=he.radius,L(it>=0&&it<=V.maxTextureSize,"invalid radius")),"width"in he&&(it=he.width,L(it>=0&&it<=V.maxTextureSize,"invalid width")),"height"in he&&(jt=he.height,L(jt>=0&&jt<=V.maxTextureSize,"invalid height")),"channels"in he&&(U=he.channels,L(U>0&&U<=4,"invalid number of channels"),B=!0)),X.width=it|0,X.height=jt|0,X.channels=U|0;var q=!1;if("format"in he){var ae=he.format;L(z.webgl_depth_texture||!(ae==="depth"||ae==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(ae,Oe,"invalid texture format");var se=X.internalformat=Oe[ae];X.format=Xe[se],ae in Ve&&("type"in he||(X.type=Ve[ae])),ae in Ue&&(X.compressed=!0),q=!0}!B&&q?X.channels=oi[X.format]:B&&!q?X.channels!==Ec[X.format]&&(X.format=X.internalformat=Ec[X.channels]):q&&B&&L(X.channels===oi[X.format],"number of channels inconsistent with specified format")}}function Tt(X){O.pixelStorei(kN,X.flipY),O.pixelStorei(PN,X.premultiplyAlpha),O.pixelStorei(NN,X.colorSpace),O.pixelStorei(DN,X.unpackAlignment)}function He(){Ce.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function ze(X,he){var fe=null;if(Gp(he)?fe=he:he&&(L.type(he,"object","invalid pixel data type"),pt(X,he),"x"in he&&(X.xOffset=he.x|0),"y"in he&&(X.yOffset=he.y|0),Gp(he.data)&&(fe=he.data)),L(!X.compressed||fe instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),he.copy){L(!fe,"can not specify copy and data field for the same texture");var it=Ee.viewportWidth,jt=Ee.viewportHeight;X.width=X.width||it-X.xOffset,X.height=X.height||jt-X.yOffset,X.needsCopy=!0,L(X.xOffset>=0&&X.xOffset<it&&X.yOffset>=0&&X.yOffset<jt&&X.width>0&&X.width<=it&&X.height>0&&X.height<=jt,"copy texture read out of bounds")}else if(!fe)X.width=X.width||1,X.height=X.height||1,X.channels=X.channels||4;else if(e(fe))X.channels=X.channels||4,X.data=fe,!("type"in he)&&X.type===Ws&&(X.type=fx(fe));else if(ax(fe))X.channels=X.channels||4,UN(X,fe),X.alignment=1,X.needsFree=!0;else if(Si(fe)){var U=fe.data;!Array.isArray(U)&&X.type===Ws&&(X.type=fx(U));var B=fe.shape,q=fe.stride,ae,se,ee,Q,re,$;B.length===3?(ee=B[2],$=q[2]):(L(B.length===2,"invalid ndarray pixel data, must be 2 or 3D"),ee=1,$=1),ae=B[0],se=B[1],Q=q[0],re=q[1],X.alignment=1,X.width=ae,X.height=se,X.channels=ee,X.format=X.internalformat=Ec[ee],X.needsFree=!0,$N(X,U,Q,re,$,fe.offset)}else if(sx(fe)||ux(fe)||FN(fe))sx(fe)||ux(fe)?X.element=fe:X.element=fe.canvas,X.width=X.element.width,X.height=X.element.height,X.channels=4;else if(GN(fe))X.element=fe,X.width=fe.width,X.height=fe.height,X.channels=4;else if(zN(fe))X.element=fe,X.width=fe.naturalWidth,X.height=fe.naturalHeight,X.channels=4;else if(jN(fe))X.element=fe,X.width=fe.videoWidth,X.height=fe.videoHeight,X.channels=4;else if(ox(fe)){var K=X.width||fe[0].length,j=X.height||fe.length,ne=X.channels;Dr(fe[0][0])?ne=ne||fe[0][0].length:ne=ne||1;for(var ue=dc.shape(fe),be=1,we=0;we<ue.length;++we)be*=ue[we];var ge=lx(X,be);dc.flatten(fe,ue,"",ge),cx(X,ge),X.alignment=1,X.width=K,X.height=j,X.channels=ne,X.format=X.internalformat=Ec[ne],X.needsFree=!0}X.type===of?L(V.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):X.type===$s&&L(V.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function Se(X,he,fe){var it=X.element,jt=X.data,U=X.internalformat,B=X.format,q=X.type,ae=X.width,se=X.height;Tt(X),it?O.texImage2D(he,fe,B,B,q,it):X.compressed?O.compressedTexImage2D(he,fe,U,ae,se,0,jt):X.needsCopy?(ce(),O.copyTexImage2D(he,fe,B,X.xOffset,X.yOffset,ae,se,0)):O.texImage2D(he,fe,B,ae,se,0,B,q,jt||null)}function Ct(X,he,fe,it,jt){var U=X.element,B=X.data,q=X.internalformat,ae=X.format,se=X.type,ee=X.width,Q=X.height;Tt(X),U?O.texSubImage2D(he,jt,fe,it,ae,se,U):X.compressed?O.compressedTexSubImage2D(he,jt,fe,it,q,ee,Q,B):X.needsCopy?(ce(),O.copyTexSubImage2D(he,jt,fe,it,X.xOffset,X.yOffset,ee,Q)):O.texSubImage2D(he,jt,fe,it,ee,Q,ae,se,B)}var Pt=[];function ot(){return Pt.pop()||new He}function zt(X){X.needsFree&&mt.freeType(X.data),He.call(X),Pt.push(X)}function It(){Ce.call(this),this.genMipmaps=!1,this.mipmapHint=xc,this.mipmask=0,this.images=Array(16)}function Ft(X,he,fe){var it=X.images[0]=ot();X.mipmask=1,it.width=X.width=he,it.height=X.height=fe,it.channels=X.channels=4}function rr(X,he){var fe=null;if(Gp(he))fe=X.images[0]=ot(),Ye(fe,X),ze(fe,he),X.mipmask=1;else if(pt(X,he),Array.isArray(he.mipmap))for(var it=he.mipmap,jt=0;jt<it.length;++jt)fe=X.images[jt]=ot(),Ye(fe,X),fe.width>>=jt,fe.height>>=jt,ze(fe,it[jt]),X.mipmask|=1<<jt;else fe=X.images[0]=ot(),Ye(fe,X),ze(fe,he),X.mipmask=1;Ye(X,X.images[0]),X.compressed&&(X.internalformat===Ip||X.internalformat===Op||X.internalformat===Lp||X.internalformat===Dp)&&L(X.width%4===0&&X.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function Gr(X,he){for(var fe=X.images,it=0;it<fe.length;++it){if(!fe[it])return;Se(fe[it],he,it)}}var Zr=[];function Wt(){var X=Zr.pop()||new It;Ce.call(X),X.mipmask=0;for(var he=0;he<16;++he)X.images[he]=null;return X}function Xr(X){for(var he=X.images,fe=0;fe<he.length;++fe)he[fe]&&zt(he[fe]),he[fe]=null;Zr.push(X)}function yr(){this.minFilter=Rp,this.magFilter=Rp,this.wrapS=Np,this.wrapT=Np,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=xc}function zr(X,he){if("min"in he){var fe=he.min;L.parameter(fe,Pe),X.minFilter=Pe[fe],RN.indexOf(X.minFilter)>=0&&!("faces"in he)&&(X.genMipmaps=!0)}if("mag"in he){var it=he.mag;L.parameter(it,Ge),X.magFilter=Ge[it]}var jt=X.wrapS,U=X.wrapT;if("wrap"in he){var B=he.wrap;typeof B=="string"?(L.parameter(B,ke),jt=U=ke[B]):Array.isArray(B)&&(L.parameter(B[0],ke),L.parameter(B[1],ke),jt=ke[B[0]],U=ke[B[1]])}else{if("wrapS"in he){var q=he.wrapS;L.parameter(q,ke),jt=ke[q]}if("wrapT"in he){var ae=he.wrapT;L.parameter(ae,ke),U=ke[ae]}}if(X.wrapS=jt,X.wrapT=U,"anisotropic"in he){var se=he.anisotropic;L(typeof se=="number"&&se>=1&&se<=V.maxAnisotropic,"aniso samples must be between 1 and "),X.anisotropic=he.anisotropic}if("mipmap"in he){var ee=!1;switch(typeof he.mipmap){case"string":L.parameter(he.mipmap,Ie,"invalid mipmap hint"),X.mipmapHint=Ie[he.mipmap],X.genMipmaps=!0,ee=!0;break;case"boolean":ee=X.genMipmaps=he.mipmap;break;case"object":L(Array.isArray(he.mipmap),"invalid mipmap type"),X.genMipmaps=!1,ee=!0;break;default:L.raise("invalid mipmap type")}ee&&!("min"in he)&&(X.minFilter=Bp)}}function Yr(X,he){O.texParameteri(he,CN,X.minFilter),O.texParameteri(he,MN,X.magFilter),O.texParameteri(he,EN,X.wrapS),O.texParameteri(he,wN,X.wrapT),z.ext_texture_filter_anisotropic&&O.texParameteri(he,LN,X.anisotropic),X.genMipmaps&&(O.hint(TN,X.mipmapHint),O.generateMipmap(he))}var Vr=0,rn={},hn=V.maxTextureUnits,kr=Array(hn).map(function(){return null});function Nt(X){Ce.call(this),this.mipmask=0,this.internalformat=Ko,this.id=Vr++,this.refCount=1,this.target=X,this.texture=O.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new yr,de.profile&&(this.stats={size:0})}function dn(X){O.activeTexture(sf),O.bindTexture(X.target,X.texture)}function cr(){var X=kr[0];X?O.bindTexture(X.target,X.texture):O.bindTexture(Wi,null)}function bt(X){var he=X.texture;L(he,"must not double destroy texture");var fe=X.unit,it=X.target;fe>=0&&(O.activeTexture(sf+fe),O.bindTexture(it,null),kr[fe]=null),O.deleteTexture(he),X.texture=null,X.params=null,X.pixels=null,X.refCount=0,delete rn[X.id],le.textureCount--}n(Nt.prototype,{bind:function(){var X=this;X.bindCount+=1;var he=X.unit;if(he<0){for(var fe=0;fe<hn;++fe){var it=kr[fe];if(it){if(it.bindCount>0)continue;it.unit=-1}kr[fe]=X,he=fe;break}he>=hn&&L.raise("insufficient number of texture units"),de.profile&&le.maxTextureUnits<he+1&&(le.maxTextureUnits=he+1),X.unit=he,O.activeTexture(sf+he),O.bindTexture(X.target,X.texture)}return he},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&bt(this)}});function $t(X,he){var fe=new Nt(Wi);rn[fe.id]=fe,le.textureCount++;function it(B,q){var ae=fe.texInfo;yr.call(ae);var se=Wt();return typeof B=="number"?typeof q=="number"?Ft(se,B|0,q|0):Ft(se,B|0,B|0):B?(L.type(B,"object","invalid arguments to regl.texture"),zr(ae,B),rr(se,B)):Ft(se,1,1),ae.genMipmaps&&(se.mipmask=(se.width<<1)-1),fe.mipmask=se.mipmask,Ye(fe,se),L.texture2D(ae,se,V),fe.internalformat=se.internalformat,it.width=se.width,it.height=se.height,dn(fe),Gr(se,Wi),Yr(ae,Wi),cr(),Xr(se),de.profile&&(fe.stats.size=wc(fe.internalformat,fe.type,se.width,se.height,ae.genMipmaps,!1)),it.format=Fe[fe.internalformat],it.type=Ze[fe.type],it.mag=Me[ae.magFilter],it.min=nt[ae.minFilter],it.wrapS=Te[ae.wrapS],it.wrapT=Te[ae.wrapT],it}function jt(B,q,ae,se){L(!!B,"must specify image data");var ee=q|0,Q=ae|0,re=se|0,$=ot();return Ye($,fe),$.width=0,$.height=0,ze($,B),$.width=$.width||(fe.width>>re)-ee,$.height=$.height||(fe.height>>re)-Q,L(fe.type===$.type&&fe.format===$.format&&fe.internalformat===$.internalformat,"incompatible format for texture.subimage"),L(ee>=0&&Q>=0&&ee+$.width<=fe.width&&Q+$.height<=fe.height,"texture.subimage write out of bounds"),L(fe.mipmask&1<<re,"missing mipmap data"),L($.data||$.element||$.needsCopy,"missing image data"),dn(fe),Ct($,Wi,ee,Q,re),cr(),zt($),it}function U(B,q){var ae=B|0,se=q|0||ae;if(ae===fe.width&&se===fe.height)return it;it.width=fe.width=ae,it.height=fe.height=se,dn(fe);for(var ee=0;fe.mipmask>>ee;++ee){var Q=ae>>ee,re=se>>ee;if(!Q||!re)break;O.texImage2D(Wi,ee,fe.format,Q,re,0,fe.format,fe.type,null)}return cr(),de.profile&&(fe.stats.size=wc(fe.internalformat,fe.type,ae,se,!1,!1)),it}return it(X,he),it.subimage=jt,it.resize=U,it._reglType="texture2d",it._texture=fe,de.profile&&(it.stats=fe.stats),it.destroy=function(){fe.decRef()},it}function qt(X,he,fe,it,jt,U){var B=new Nt(_p);rn[B.id]=B,le.cubeCount++;var q=new Array(6);function ae(Q,re,$,K,j,ne){var ue,be=B.texInfo;for(yr.call(be),ue=0;ue<6;++ue)q[ue]=Wt();if(typeof Q=="number"||!Q){var we=Q|0||1;for(ue=0;ue<6;++ue)Ft(q[ue],we,we)}else if(typeof Q=="object")if(re)rr(q[0],Q),rr(q[1],re),rr(q[2],$),rr(q[3],K),rr(q[4],j),rr(q[5],ne);else if(zr(be,Q),pt(B,Q),"faces"in Q){var ge=Q.faces;for(L(Array.isArray(ge)&&ge.length===6,"cube faces must be a length 6 array"),ue=0;ue<6;++ue)L(typeof ge[ue]=="object"&&!!ge[ue],"invalid input for cube map face"),Ye(q[ue],B),rr(q[ue],ge[ue])}else for(ue=0;ue<6;++ue)rr(q[ue],Q);else L.raise("invalid arguments to cube map");for(Ye(B,q[0]),V.npotTextureCube||L(Gb(B.width)&&Gb(B.height),"your browser does not support non power or two texture dimensions"),be.genMipmaps?B.mipmask=(q[0].width<<1)-1:B.mipmask=q[0].mipmask,L.textureCube(B,be,q,V),B.internalformat=q[0].internalformat,ae.width=q[0].width,ae.height=q[0].height,dn(B),ue=0;ue<6;++ue)Gr(q[ue],gc+ue);for(Yr(be,_p),cr(),de.profile&&(B.stats.size=wc(B.internalformat,B.type,ae.width,ae.height,be.genMipmaps,!0)),ae.format=Fe[B.internalformat],ae.type=Ze[B.type],ae.mag=Me[be.magFilter],ae.min=nt[be.minFilter],ae.wrapS=Te[be.wrapS],ae.wrapT=Te[be.wrapT],ue=0;ue<6;++ue)Xr(q[ue]);return ae}function se(Q,re,$,K,j){L(!!re,"must specify image data"),L(typeof Q=="number"&&Q===(Q|0)&&Q>=0&&Q<6,"invalid face");var ne=$|0,ue=K|0,be=j|0,we=ot();return Ye(we,B),we.width=0,we.height=0,ze(we,re),we.width=we.width||(B.width>>be)-ne,we.height=we.height||(B.height>>be)-ue,L(B.type===we.type&&B.format===we.format&&B.internalformat===we.internalformat,"incompatible format for texture.subimage"),L(ne>=0&&ue>=0&&ne+we.width<=B.width&&ue+we.height<=B.height,"texture.subimage write out of bounds"),L(B.mipmask&1<<be,"missing mipmap data"),L(we.data||we.element||we.needsCopy,"missing image data"),dn(B),Ct(we,gc+Q,ne,ue,be),cr(),zt(we),ae}function ee(Q){var re=Q|0;if(re!==B.width){ae.width=B.width=re,ae.height=B.height=re,dn(B);for(var $=0;$<6;++$)for(var K=0;B.mipmask>>K;++K)O.texImage2D(gc+$,K,B.format,re>>K,re>>K,0,B.format,B.type,null);return cr(),de.profile&&(B.stats.size=wc(B.internalformat,B.type,ae.width,ae.height,!1,!0)),ae}}return ae(X,he,fe,it,jt,U),ae.subimage=se,ae.resize=ee,ae._reglType="textureCube",ae._texture=B,de.profile&&(ae.stats=B.stats),ae.destroy=function(){B.decRef()},ae}function Pr(){for(var X=0;X<hn;++X)O.activeTexture(sf+X),O.bindTexture(Wi,null),kr[X]=null;Xn(rn).forEach(bt),le.cubeCount=0,le.textureCount=0}de.profile&&(le.getTotalTextureSize=function(){var X=0;return Object.keys(rn).forEach(function(he){X+=rn[he].stats.size}),X});function Yi(){for(var X=0;X<hn;++X){var he=kr[X];he&&(he.bindCount=0,he.unit=-1,kr[X]=null)}Xn(rn).forEach(function(fe){fe.texture=O.createTexture(),O.bindTexture(fe.target,fe.texture);for(var it=0;it<32;++it)if(fe.mipmask&1<<it)if(fe.target===Wi)O.texImage2D(Wi,it,fe.internalformat,fe.width>>it,fe.height>>it,0,fe.internalformat,fe.type,null);else for(var jt=0;jt<6;++jt)O.texImage2D(gc+jt,it,fe.internalformat,fe.width>>it,fe.height>>it,0,fe.internalformat,fe.type,null);Yr(fe.texInfo,fe.target)})}function ns(){for(var X=0;X<hn;++X){var he=kr[X];he&&(he.bindCount=0,he.unit=-1,kr[X]=null),O.activeTexture(sf+X),O.bindTexture(Wi,null),O.bindTexture(_p,null)}}return{create2D:$t,createCube:qt,clear:Pr,getTexture:function(X){return null},restore:Yi,refresh:ns}}var ao=36161,_c=32854,hx=32855,dx=36194,vx=33189,px=36168,gx=34041,yx=35907,mx=34836,bx=34842,xx=34843,Mi=[];Mi[_c]=2,Mi[hx]=2,Mi[dx]=2,Mi[vx]=2,Mi[px]=1,Mi[gx]=4,Mi[yx]=4,Mi[mx]=16,Mi[bx]=8,Mi[xx]=6;function Ex(O,z,V){return Mi[O]*z*V}var XN=function(O,z,V,ce,Ee){var le={rgba4:_c,rgb565:dx,"rgb5 a1":hx,depth:vx,stencil:px,"depth stencil":gx};z.ext_srgb&&(le.srgba=yx),z.ext_color_buffer_half_float&&(le.rgba16f=bx,le.rgb16f=xx),z.webgl_color_buffer_float&&(le.rgba32f=mx);var de=[];Object.keys(le).forEach(function(Oe){var Ue=le[Oe];de[Ue]=Oe});var Ie=0,ke={};function Ge(Oe){this.id=Ie++,this.refCount=1,this.renderbuffer=Oe,this.format=_c,this.width=0,this.height=0,Ee.profile&&(this.stats={size:0})}Ge.prototype.decRef=function(){--this.refCount<=0&&Pe(this)};function Pe(Oe){var Ue=Oe.renderbuffer;L(Ue,"must not double destroy renderbuffer"),O.bindRenderbuffer(ao,null),O.deleteRenderbuffer(Ue),Oe.renderbuffer=null,Oe.refCount=0,delete ke[Oe.id],ce.renderbufferCount--}function je(Oe,Ue){var oe=new Ge(O.createRenderbuffer());ke[oe.id]=oe,ce.renderbufferCount++;function ve(Ze,Me){var nt=0,Te=0,Xe=_c;if(typeof Ze=="object"&&Ze){var Ce=Ze;if("shape"in Ce){var Ye=Ce.shape;L(Array.isArray(Ye)&&Ye.length>=2,"invalid renderbuffer shape"),nt=Ye[0]|0,Te=Ye[1]|0}else"radius"in Ce&&(nt=Te=Ce.radius|0),"width"in Ce&&(nt=Ce.width|0),"height"in Ce&&(Te=Ce.height|0);"format"in Ce&&(L.parameter(Ce.format,le,"invalid renderbuffer format"),Xe=le[Ce.format])}else typeof Ze=="number"?(nt=Ze|0,typeof Me=="number"?Te=Me|0:Te=nt):Ze?L.raise("invalid arguments to renderbuffer constructor"):nt=Te=1;if(L(nt>0&&Te>0&&nt<=V.maxRenderbufferSize&&Te<=V.maxRenderbufferSize,"invalid renderbuffer size"),!(nt===oe.width&&Te===oe.height&&Xe===oe.format))return ve.width=oe.width=nt,ve.height=oe.height=Te,oe.format=Xe,O.bindRenderbuffer(ao,oe.renderbuffer),O.renderbufferStorage(ao,Xe,nt,Te),L(O.getError()===0,"invalid render buffer format"),Ee.profile&&(oe.stats.size=Ex(oe.format,oe.width,oe.height)),ve.format=de[oe.format],ve}function Fe(Ze,Me){var nt=Ze|0,Te=Me|0||nt;return nt===oe.width&&Te===oe.height||(L(nt>0&&Te>0&&nt<=V.maxRenderbufferSize&&Te<=V.maxRenderbufferSize,"invalid renderbuffer size"),ve.width=oe.width=nt,ve.height=oe.height=Te,O.bindRenderbuffer(ao,oe.renderbuffer),O.renderbufferStorage(ao,oe.format,nt,Te),L(O.getError()===0,"invalid render buffer format"),Ee.profile&&(oe.stats.size=Ex(oe.format,oe.width,oe.height))),ve}return ve(Oe,Ue),ve.resize=Fe,ve._reglType="renderbuffer",ve._renderbuffer=oe,Ee.profile&&(ve.stats=oe.stats),ve.destroy=function(){oe.decRef()},ve}Ee.profile&&(ce.getTotalRenderbufferSize=function(){var Oe=0;return Object.keys(ke).forEach(function(Ue){Oe+=ke[Ue].stats.size}),Oe});function Ve(){Xn(ke).forEach(function(Oe){Oe.renderbuffer=O.createRenderbuffer(),O.bindRenderbuffer(ao,Oe.renderbuffer),O.renderbufferStorage(ao,Oe.format,Oe.width,Oe.height)}),O.bindRenderbuffer(ao,null)}return{create:je,clear:function(){Xn(ke).forEach(Pe)},restore:Ve}},La=36160,zp=36161,Zo=3553,Sc=34069,wx=36064,_x=36096,Sx=36128,Mx=33306,Cx=36053,YN=36054,VN=36055,HN=36057,KN=36061,qN=36193,ZN=5121,QN=5126,Ax=6407,Tx=6408,JN=6402,eR=[Ax,Tx],jp=[];jp[Tx]=4,jp[Ax]=3;var Mc=[];Mc[ZN]=1,Mc[QN]=4,Mc[qN]=2;var tR=32854,rR=32855,nR=36194,iR=33189,aR=36168,Ix=34041,oR=35907,sR=34836,uR=34842,fR=34843,lR=[tR,rR,nR,oR,uR,fR,sR],Vs={};Vs[Cx]="complete",Vs[YN]="incomplete attachment",Vs[HN]="incomplete dimensions",Vs[VN]="incomplete, missing attachment",Vs[KN]="unsupported";function cR(O,z,V,ce,Ee,le){var de={cur:null,next:null,dirty:!1,setFBO:null},Ie=["rgba"],ke=["rgba4","rgb565","rgb5 a1"];z.ext_srgb&&ke.push("srgba"),z.ext_color_buffer_half_float&&ke.push("rgba16f","rgb16f"),z.webgl_color_buffer_float&&ke.push("rgba32f");var Ge=["uint8"];z.oes_texture_half_float&&Ge.push("half float","float16"),z.oes_texture_float&&Ge.push("float","float32");function Pe(He,ze,Se){this.target=He,this.texture=ze,this.renderbuffer=Se;var Ct=0,Pt=0;ze?(Ct=ze.width,Pt=ze.height):Se&&(Ct=Se.width,Pt=Se.height),this.width=Ct,this.height=Pt}function je(He){He&&(He.texture&&He.texture._texture.decRef(),He.renderbuffer&&He.renderbuffer._renderbuffer.decRef())}function Ve(He,ze,Se){if(He)if(He.texture){var Ct=He.texture._texture,Pt=Math.max(1,Ct.width),ot=Math.max(1,Ct.height);L(Pt===ze&&ot===Se,"inconsistent width/height for supplied texture"),Ct.refCount+=1}else{var zt=He.renderbuffer._renderbuffer;L(zt.width===ze&&zt.height===Se,"inconsistent width/height for renderbuffer"),zt.refCount+=1}}function Oe(He,ze){ze&&(ze.texture?O.framebufferTexture2D(La,He,ze.target,ze.texture._texture.texture,0):O.framebufferRenderbuffer(La,He,zp,ze.renderbuffer._renderbuffer.renderbuffer))}function Ue(He){var ze=Zo,Se=null,Ct=null,Pt=He;typeof He=="object"&&(Pt=He.data,"target"in He&&(ze=He.target|0)),L.type(Pt,"function","invalid attachment data");var ot=Pt._reglType;return ot==="texture2d"?(Se=Pt,L(ze===Zo)):ot==="textureCube"?(Se=Pt,L(ze>=Sc&&ze<Sc+6,"invalid cube map target")):ot==="renderbuffer"?(Ct=Pt,ze=zp):L.raise("invalid regl object for attachment"),new Pe(ze,Se,Ct)}function oe(He,ze,Se,Ct,Pt){if(Se){var ot=ce.create2D({width:He,height:ze,format:Ct,type:Pt});return ot._texture.refCount=0,new Pe(Zo,ot,null)}else{var zt=Ee.create({width:He,height:ze,format:Ct});return zt._renderbuffer.refCount=0,new Pe(zp,null,zt)}}function ve(He){return He&&(He.texture||He.renderbuffer)}function Fe(He,ze,Se){He&&(He.texture?He.texture.resize(ze,Se):He.renderbuffer&&He.renderbuffer.resize(ze,Se),He.width=ze,He.height=Se)}var Ze=0,Me={};function nt(){this.id=Ze++,Me[this.id]=this,this.framebuffer=O.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Te(He){He.colorAttachments.forEach(je),je(He.depthAttachment),je(He.stencilAttachment),je(He.depthStencilAttachment)}function Xe(He){var ze=He.framebuffer;L(ze,"must not double destroy framebuffer"),O.deleteFramebuffer(ze),He.framebuffer=null,le.framebufferCount--,delete Me[He.id]}function Ce(He){var ze;O.bindFramebuffer(La,He.framebuffer);var Se=He.colorAttachments;for(ze=0;ze<Se.length;++ze)Oe(wx+ze,Se[ze]);for(ze=Se.length;ze<V.maxColorAttachments;++ze)O.framebufferTexture2D(La,wx+ze,Zo,null,0);O.framebufferTexture2D(La,Mx,Zo,null,0),O.framebufferTexture2D(La,_x,Zo,null,0),O.framebufferTexture2D(La,Sx,Zo,null,0),Oe(_x,He.depthAttachment),Oe(Sx,He.stencilAttachment),Oe(Mx,He.depthStencilAttachment);var Ct=O.checkFramebufferStatus(La);!O.isContextLost()&&Ct!==Cx&&L.raise("framebuffer configuration not supported, status = "+Vs[Ct]),O.bindFramebuffer(La,de.next?de.next.framebuffer:null),de.cur=de.next,O.getError()}function Ye(He,ze){var Se=new nt;le.framebufferCount++;function Ct(ot,zt){var It;L(de.next!==Se,"can not update framebuffer which is currently in use");var Ft=0,rr=0,Gr=!0,Zr=!0,Wt=null,Xr=!0,yr="rgba",zr="uint8",Yr=1,Vr=null,rn=null,hn=null,kr=!1;if(typeof ot=="number")Ft=ot|0,rr=zt|0||Ft;else if(!ot)Ft=rr=1;else{L.type(ot,"object","invalid arguments for framebuffer");var Nt=ot;if("shape"in Nt){var dn=Nt.shape;L(Array.isArray(dn)&&dn.length>=2,"invalid shape for framebuffer"),Ft=dn[0],rr=dn[1]}else"radius"in Nt&&(Ft=rr=Nt.radius),"width"in Nt&&(Ft=Nt.width),"height"in Nt&&(rr=Nt.height);("color"in Nt||"colors"in Nt)&&(Wt=Nt.color||Nt.colors,Array.isArray(Wt)&&L(Wt.length===1||z.webgl_draw_buffers,"multiple render targets not supported")),Wt||("colorCount"in Nt&&(Yr=Nt.colorCount|0,L(Yr>0,"invalid color buffer count")),"colorTexture"in Nt&&(Xr=!!Nt.colorTexture,yr="rgba4"),"colorType"in Nt&&(zr=Nt.colorType,Xr?(L(z.oes_texture_float||!(zr==="float"||zr==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),L(z.oes_texture_half_float||!(zr==="half float"||zr==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):zr==="half float"||zr==="float16"?(L(z.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),yr="rgba16f"):(zr==="float"||zr==="float32")&&(L(z.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),yr="rgba32f"),L.oneOf(zr,Ge,"invalid color type")),"colorFormat"in Nt&&(yr=Nt.colorFormat,Ie.indexOf(yr)>=0?Xr=!0:ke.indexOf(yr)>=0?Xr=!1:Xr?L.oneOf(Nt.colorFormat,Ie,"invalid color format for texture"):L.oneOf(Nt.colorFormat,ke,"invalid color format for renderbuffer"))),("depthTexture"in Nt||"depthStencilTexture"in Nt)&&(kr=!!(Nt.depthTexture||Nt.depthStencilTexture),L(!kr||z.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Nt&&(typeof Nt.depth=="boolean"?Gr=Nt.depth:(Vr=Nt.depth,Zr=!1)),"stencil"in Nt&&(typeof Nt.stencil=="boolean"?Zr=Nt.stencil:(rn=Nt.stencil,Gr=!1)),"depthStencil"in Nt&&(typeof Nt.depthStencil=="boolean"?Gr=Zr=Nt.depthStencil:(hn=Nt.depthStencil,Gr=!1,Zr=!1))}var cr=null,bt=null,$t=null,qt=null;if(Array.isArray(Wt))cr=Wt.map(Ue);else if(Wt)cr=[Ue(Wt)];else for(cr=new Array(Yr),It=0;It<Yr;++It)cr[It]=oe(Ft,rr,Xr,yr,zr);L(z.webgl_draw_buffers||cr.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),L(cr.length<=V.maxColorAttachments,"too many color attachments, not supported"),Ft=Ft||cr[0].width,rr=rr||cr[0].height,Vr?bt=Ue(Vr):Gr&&!Zr&&(bt=oe(Ft,rr,kr,"depth","uint32")),rn?$t=Ue(rn):Zr&&!Gr&&($t=oe(Ft,rr,!1,"stencil","uint8")),hn?qt=Ue(hn):!Vr&&!rn&&Zr&&Gr&&(qt=oe(Ft,rr,kr,"depth stencil","depth stencil")),L(!!Vr+!!rn+!!hn<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var Pr=null;for(It=0;It<cr.length;++It)if(Ve(cr[It],Ft,rr),L(!cr[It]||cr[It].texture&&eR.indexOf(cr[It].texture._texture.format)>=0||cr[It].renderbuffer&&lR.indexOf(cr[It].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+It+" is invalid"),cr[It]&&cr[It].texture){var Yi=jp[cr[It].texture._texture.format]*Mc[cr[It].texture._texture.type];Pr===null?Pr=Yi:L(Pr===Yi,"all color attachments much have the same number of bits per pixel.")}return Ve(bt,Ft,rr),L(!bt||bt.texture&&bt.texture._texture.format===JN||bt.renderbuffer&&bt.renderbuffer._renderbuffer.format===iR,"invalid depth attachment for framebuffer object"),Ve($t,Ft,rr),L(!$t||$t.renderbuffer&&$t.renderbuffer._renderbuffer.format===aR,"invalid stencil attachment for framebuffer object"),Ve(qt,Ft,rr),L(!qt||qt.texture&&qt.texture._texture.format===Ix||qt.renderbuffer&&qt.renderbuffer._renderbuffer.format===Ix,"invalid depth-stencil attachment for framebuffer object"),Te(Se),Se.width=Ft,Se.height=rr,Se.colorAttachments=cr,Se.depthAttachment=bt,Se.stencilAttachment=$t,Se.depthStencilAttachment=qt,Ct.color=cr.map(ve),Ct.depth=ve(bt),Ct.stencil=ve($t),Ct.depthStencil=ve(qt),Ct.width=Se.width,Ct.height=Se.height,Ce(Se),Ct}function Pt(ot,zt){L(de.next!==Se,"can not resize a framebuffer which is currently in use");var It=Math.max(ot|0,1),Ft=Math.max(zt|0||It,1);if(It===Se.width&&Ft===Se.height)return Ct;for(var rr=Se.colorAttachments,Gr=0;Gr<rr.length;++Gr)Fe(rr[Gr],It,Ft);return Fe(Se.depthAttachment,It,Ft),Fe(Se.stencilAttachment,It,Ft),Fe(Se.depthStencilAttachment,It,Ft),Se.width=Ct.width=It,Se.height=Ct.height=Ft,Ce(Se),Ct}return Ct(He,ze),n(Ct,{resize:Pt,_reglType:"framebuffer",_framebuffer:Se,destroy:function(){Xe(Se),Te(Se)},use:function(ot){de.setFBO({framebuffer:Ct},ot)}})}function pt(He){var ze=Array(6);function Se(Pt){var ot;L(ze.indexOf(de.next)<0,"can not update framebuffer which is currently in use");var zt={color:null},It=0,Ft=null,rr="rgba",Gr="uint8",Zr=1;if(typeof Pt=="number")It=Pt|0;else if(!Pt)It=1;else{L.type(Pt,"object","invalid arguments for framebuffer");var Wt=Pt;if("shape"in Wt){var Xr=Wt.shape;L(Array.isArray(Xr)&&Xr.length>=2,"invalid shape for framebuffer"),L(Xr[0]===Xr[1],"cube framebuffer must be square"),It=Xr[0]}else"radius"in Wt&&(It=Wt.radius|0),"width"in Wt?(It=Wt.width|0,"height"in Wt&&L(Wt.height===It,"must be square")):"height"in Wt&&(It=Wt.height|0);("color"in Wt||"colors"in Wt)&&(Ft=Wt.color||Wt.colors,Array.isArray(Ft)&&L(Ft.length===1||z.webgl_draw_buffers,"multiple render targets not supported")),Ft||("colorCount"in Wt&&(Zr=Wt.colorCount|0,L(Zr>0,"invalid color buffer count")),"colorType"in Wt&&(L.oneOf(Wt.colorType,Ge,"invalid color type"),Gr=Wt.colorType),"colorFormat"in Wt&&(rr=Wt.colorFormat,L.oneOf(Wt.colorFormat,Ie,"invalid color format for texture"))),"depth"in Wt&&(zt.depth=Wt.depth),"stencil"in Wt&&(zt.stencil=Wt.stencil),"depthStencil"in Wt&&(zt.depthStencil=Wt.depthStencil)}var yr;if(Ft)if(Array.isArray(Ft))for(yr=[],ot=0;ot<Ft.length;++ot)yr[ot]=Ft[ot];else yr=[Ft];else{yr=Array(Zr);var zr={radius:It,format:rr,type:Gr};for(ot=0;ot<Zr;++ot)yr[ot]=ce.createCube(zr)}for(zt.color=Array(yr.length),ot=0;ot<yr.length;++ot){var Yr=yr[ot];L(typeof Yr=="function"&&Yr._reglType==="textureCube","invalid cube map"),It=It||Yr.width,L(Yr.width===It&&Yr.height===It,"invalid cube map shape"),zt.color[ot]={target:Sc,data:yr[ot]}}for(ot=0;ot<6;++ot){for(var Vr=0;Vr<yr.length;++Vr)zt.color[Vr].target=Sc+ot;ot>0&&(zt.depth=ze[0].depth,zt.stencil=ze[0].stencil,zt.depthStencil=ze[0].depthStencil),ze[ot]?ze[ot](zt):ze[ot]=Ye(zt)}return n(Se,{width:It,height:It,color:yr})}function Ct(Pt){var ot,zt=Pt|0;if(L(zt>0&&zt<=V.maxCubeMapSize,"invalid radius for cube fbo"),zt===Se.width)return Se;var It=Se.color;for(ot=0;ot<It.length;++ot)It[ot].resize(zt);for(ot=0;ot<6;++ot)ze[ot].resize(zt);return Se.width=Se.height=zt,Se}return Se(He),n(Se,{faces:ze,resize:Ct,_reglType:"framebufferCube",destroy:function(){ze.forEach(function(Pt){Pt.destroy()})}})}function Tt(){de.cur=null,de.next=null,de.dirty=!0,Xn(Me).forEach(function(He){He.framebuffer=O.createFramebuffer(),Ce(He)})}return n(de,{getFramebuffer:function(He){if(typeof He=="function"&&He._reglType==="framebuffer"){var ze=He._framebuffer;if(ze instanceof nt)return ze}return null},create:Ye,createCube:pt,clear:function(){Xn(Me).forEach(Xe)},restore:Tt})}var hR=5126,Ox=34962;function Up(){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=hR,this.offset=0,this.stride=0,this.divisor=0}function dR(O,z,V,ce,Ee){for(var le=V.maxAttributes,de=new Array(le),Ie=0;Ie<le;++Ie)de[Ie]=new Up;var ke=0,Ge={},Pe={Record:Up,scope:{},state:de,currentVAO:null,targetVAO:null,restore:Ve()?Me:function(){},createVAO:nt,getVAO:Ue,destroyBuffer:je,setVAO:Ve()?oe:ve,clear:Ve()?Fe:function(){}};function je(Te){for(var Xe=0;Xe<de.length;++Xe){var Ce=de[Xe];Ce.buffer===Te&&(O.disableVertexAttribArray(Xe),Ce.buffer=null)}}function Ve(){return z.oes_vertex_array_object}function Oe(){return z.angle_instanced_arrays}function Ue(Te){return typeof Te=="function"&&Te._vao?Te._vao:null}function oe(Te){if(Te!==Pe.currentVAO){var Xe=Ve();Te?Xe.bindVertexArrayOES(Te.vao):Xe.bindVertexArrayOES(null),Pe.currentVAO=Te}}function ve(Te){if(Te!==Pe.currentVAO){if(Te)Te.bindAttrs();else for(var Xe=Oe(),Ce=0;Ce<de.length;++Ce){var Ye=de[Ce];Ye.buffer?(O.enableVertexAttribArray(Ce),O.vertexAttribPointer(Ce,Ye.size,Ye.type,Ye.normalized,Ye.stride,Ye.offfset),Xe&&Ye.divisor&&Xe.vertexAttribDivisorANGLE(Ce,Ye.divisor)):(O.disableVertexAttribArray(Ce),O.vertexAttrib4f(Ce,Ye.x,Ye.y,Ye.z,Ye.w))}Pe.currentVAO=Te}}function Fe(){Xn(Ge).forEach(function(Te){Te.destroy()})}function Ze(){this.id=++ke,this.attributes=[];var Te=Ve();Te?this.vao=Te.createVertexArrayOES():this.vao=null,Ge[this.id]=this,this.buffers=[]}Ze.prototype.bindAttrs=function(){for(var Te=Oe(),Xe=this.attributes,Ce=0;Ce<Xe.length;++Ce){var Ye=Xe[Ce];Ye.buffer?(O.enableVertexAttribArray(Ce),O.bindBuffer(Ox,Ye.buffer.buffer),O.vertexAttribPointer(Ce,Ye.size,Ye.type,Ye.normalized,Ye.stride,Ye.offset),Te&&Ye.divisor&&Te.vertexAttribDivisorANGLE(Ce,Ye.divisor)):(O.disableVertexAttribArray(Ce),O.vertexAttrib4f(Ce,Ye.x,Ye.y,Ye.z,Ye.w))}for(var pt=Xe.length;pt<le;++pt)O.disableVertexAttribArray(pt)},Ze.prototype.refresh=function(){var Te=Ve();Te&&(Te.bindVertexArrayOES(this.vao),this.bindAttrs(),Pe.currentVAO=this)},Ze.prototype.destroy=function(){if(this.vao){var Te=Ve();this===Pe.currentVAO&&(Pe.currentVAO=null,Te.bindVertexArrayOES(null)),Te.deleteVertexArrayOES(this.vao),this.vao=null}Ge[this.id]&&(delete Ge[this.id],ce.vaoCount-=1)};function Me(){var Te=Ve();Te&&Xn(Ge).forEach(function(Xe){Xe.refresh()})}function nt(Te){var Xe=new Ze;ce.vaoCount+=1;function Ce(Ye){L(Array.isArray(Ye),"arguments to vertex array constructor must be an array"),L(Ye.length<le,"too many attributes"),L(Ye.length>0,"must specify at least one attribute");var pt={},Tt=Xe.attributes;Tt.length=Ye.length;for(var He=0;He<Ye.length;++He){var ze=Ye[He],Se=Tt[He]=new Up,Ct=ze.data||ze;if(Array.isArray(Ct)||e(Ct)||Si(Ct)){var Pt;Xe.buffers[He]&&(Pt=Xe.buffers[He],e(Ct)&&Pt._buffer.byteLength>=Ct.byteLength?Pt.subdata(Ct):(Pt.destroy(),Xe.buffers[He]=null)),Xe.buffers[He]||(Pt=Xe.buffers[He]=Ee.create(ze,Ox,!1,!0)),Se.buffer=Ee.getBuffer(Pt),Se.size=Se.buffer.dimension|0,Se.normalized=!1,Se.type=Se.buffer.dtype,Se.offset=0,Se.stride=0,Se.divisor=0,Se.state=1,pt[He]=1}else Ee.getBuffer(ze)?(Se.buffer=Ee.getBuffer(ze),Se.size=Se.buffer.dimension|0,Se.normalized=!1,Se.type=Se.buffer.dtype,Se.offset=0,Se.stride=0,Se.divisor=0,Se.state=1):Ee.getBuffer(ze.buffer)?(Se.buffer=Ee.getBuffer(ze.buffer),Se.size=(+ze.size||Se.buffer.dimension)|0,Se.normalized=!!ze.normalized||!1,"type"in ze?(L.parameter(ze.type,Vo,"invalid buffer type"),Se.type=Vo[ze.type]):Se.type=Se.buffer.dtype,Se.offset=(ze.offset||0)|0,Se.stride=(ze.stride||0)|0,Se.divisor=(ze.divisor||0)|0,Se.state=1,L(Se.size>=1&&Se.size<=4,"size must be between 1 and 4"),L(Se.offset>=0,"invalid offset"),L(Se.stride>=0&&Se.stride<=255,"stride must be between 0 and 255"),L(Se.divisor>=0,"divisor must be positive"),L(!Se.divisor||!!z.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in ze?(L(He>0,"first attribute must not be a constant"),Se.x=+ze.x||0,Se.y=+ze.y||0,Se.z=+ze.z||0,Se.w=+ze.w||0,Se.state=2):L(!1,"invalid attribute spec for location "+He)}for(var ot=0;ot<Xe.buffers.length;++ot)!pt[ot]&&Xe.buffers[ot]&&(Xe.buffers[ot].destroy(),Xe.buffers[ot]=null);return Xe.refresh(),Ce}return Ce.destroy=function(){for(var Ye=0;Ye<Xe.buffers.length;++Ye)Xe.buffers[Ye]&&Xe.buffers[Ye].destroy();Xe.buffers.length=0,Xe.destroy()},Ce._vao=Xe,Ce._reglType="vao",Ce(Te)}return Pe}var Lx=35632,vR=35633,pR=35718,gR=35721;function yR(O,z,V,ce){var Ee={},le={};function de(oe,ve,Fe,Ze){this.name=oe,this.id=ve,this.location=Fe,this.info=Ze}function Ie(oe,ve){for(var Fe=0;Fe<oe.length;++Fe)if(oe[Fe].id===ve.id){oe[Fe].location=ve.location;return}oe.push(ve)}function ke(oe,ve,Fe){var Ze=oe===Lx?Ee:le,Me=Ze[ve];if(!Me){var nt=z.str(ve);Me=O.createShader(oe),O.shaderSource(Me,nt),O.compileShader(Me),L.shaderError(O,Me,nt,oe,Fe),Ze[ve]=Me}return Me}var Ge={},Pe=[],je=0;function Ve(oe,ve){this.id=je++,this.fragId=oe,this.vertId=ve,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,ce.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function Oe(oe,ve,Fe){var Ze,Me,nt=ke(Lx,oe.fragId),Te=ke(vR,oe.vertId),Xe=oe.program=O.createProgram();if(O.attachShader(Xe,nt),O.attachShader(Xe,Te),Fe)for(Ze=0;Ze<Fe.length;++Ze){var Ce=Fe[Ze];O.bindAttribLocation(Xe,Ce[0],Ce[1])}O.linkProgram(Xe),L.linkError(O,Xe,z.str(oe.fragId),z.str(oe.vertId),ve);var Ye=O.getProgramParameter(Xe,pR);ce.profile&&(oe.stats.uniformsCount=Ye);var pt=oe.uniforms;for(Ze=0;Ze<Ye;++Ze)if(Me=O.getActiveUniform(Xe,Ze),Me)if(Me.size>1)for(var Tt=0;Tt<Me.size;++Tt){var He=Me.name.replace("[0]","["+Tt+"]");Ie(pt,new de(He,z.id(He),O.getUniformLocation(Xe,He),Me))}else Ie(pt,new de(Me.name,z.id(Me.name),O.getUniformLocation(Xe,Me.name),Me));var ze=O.getProgramParameter(Xe,gR);ce.profile&&(oe.stats.attributesCount=ze);var Se=oe.attributes;for(Ze=0;Ze<ze;++Ze)Me=O.getActiveAttrib(Xe,Ze),Me&&Ie(Se,new de(Me.name,z.id(Me.name),O.getAttribLocation(Xe,Me.name),Me))}ce.profile&&(V.getMaxUniformsCount=function(){var oe=0;return Pe.forEach(function(ve){ve.stats.uniformsCount>oe&&(oe=ve.stats.uniformsCount)}),oe},V.getMaxAttributesCount=function(){var oe=0;return Pe.forEach(function(ve){ve.stats.attributesCount>oe&&(oe=ve.stats.attributesCount)}),oe});function Ue(){Ee={},le={};for(var oe=0;oe<Pe.length;++oe)Oe(Pe[oe],null,Pe[oe].attributes.map(function(ve){return[ve.location,ve.name]}))}return{clear:function(){var oe=O.deleteShader.bind(O);Xn(Ee).forEach(oe),Ee={},Xn(le).forEach(oe),le={},Pe.forEach(function(ve){O.deleteProgram(ve.program)}),Pe.length=0,Ge={},V.shaderCount=0},program:function(oe,ve,Fe,Ze){L.command(oe>=0,"missing vertex shader",Fe),L.command(ve>=0,"missing fragment shader",Fe);var Me=Ge[ve];Me||(Me=Ge[ve]={});var nt=Me[oe];if(nt&&(nt.refCount++,!Ze))return nt;var Te=new Ve(ve,oe);return V.shaderCount++,Oe(Te,Fe,Ze),nt||(Me[oe]=Te),Pe.push(Te),n(Te,{destroy:function(){if(Te.refCount--,Te.refCount<=0){O.deleteProgram(Te.program);var Xe=Pe.indexOf(Te);Pe.splice(Xe,1),V.shaderCount--}Me[Te.vertId].refCount<=0&&(O.deleteShader(le[Te.vertId]),delete le[Te.vertId],delete Ge[Te.fragId][Te.vertId]),Object.keys(Ge[Te.fragId]).length||(O.deleteShader(Ee[Te.fragId]),delete Ee[Te.fragId],delete Ge[Te.fragId])}})},restore:Ue,shader:ke,frag:-1,vert:-1}}var mR=6408,uf=5121,bR=3333,Cc=5126;function xR(O,z,V,ce,Ee,le,de){function Ie(Pe){var je;z.next===null?(L(Ee.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),je=uf):(L(z.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),je=z.next.colorAttachments[0].texture._texture.type,le.oes_texture_float?(L(je===uf||je===Cc,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),je===Cc&&L(de.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):L(je===uf,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Ve=0,Oe=0,Ue=ce.framebufferWidth,oe=ce.framebufferHeight,ve=null;e(Pe)?ve=Pe:Pe&&(L.type(Pe,"object","invalid arguments to regl.read()"),Ve=Pe.x|0,Oe=Pe.y|0,L(Ve>=0&&Ve<ce.framebufferWidth,"invalid x offset for regl.read"),L(Oe>=0&&Oe<ce.framebufferHeight,"invalid y offset for regl.read"),Ue=(Pe.width||ce.framebufferWidth-Ve)|0,oe=(Pe.height||ce.framebufferHeight-Oe)|0,ve=Pe.data||null),ve&&(je===uf?L(ve instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):je===Cc&&L(ve instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),L(Ue>0&&Ue+Ve<=ce.framebufferWidth,"invalid width for read pixels"),L(oe>0&&oe+Oe<=ce.framebufferHeight,"invalid height for read pixels"),V();var Fe=Ue*oe*4;return ve||(je===uf?ve=new Uint8Array(Fe):je===Cc&&(ve=ve||new Float32Array(Fe))),L.isTypedArray(ve,"data buffer for regl.read() must be a typedarray"),L(ve.byteLength>=Fe,"data buffer for regl.read() too small"),O.pixelStorei(bR,4),O.readPixels(Ve,Oe,Ue,oe,mR,je,ve),ve}function ke(Pe){var je;return z.setFBO({framebuffer:Pe.framebuffer},function(){je=Ie(Pe)}),je}function Ge(Pe){return!Pe||!("framebuffer"in Pe)?Ie(Pe):ke(Pe)}return Ge}function Hs(O){return Array.prototype.slice.call(O)}function Ks(O){return Hs(O).join("")}function ER(){var O=0,z=[],V=[];function ce(je){for(var Ve=0;Ve<V.length;++Ve)if(V[Ve]===je)return z[Ve];var Oe="g"+O++;return z.push(Oe),V.push(je),Oe}function Ee(){var je=[];function Ve(){je.push.apply(je,Hs(arguments))}var Oe=[];function Ue(){var oe="v"+O++;return Oe.push(oe),arguments.length>0&&(je.push(oe,"="),je.push.apply(je,Hs(arguments)),je.push(";")),oe}return n(Ve,{def:Ue,toString:function(){return Ks([Oe.length>0?"var "+Oe.join(",")+";":"",Ks(je)])}})}function le(){var je=Ee(),Ve=Ee(),Oe=je.toString,Ue=Ve.toString;function oe(ve,Fe){Ve(ve,Fe,"=",je.def(ve,Fe),";")}return n(function(){je.apply(je,Hs(arguments))},{def:je.def,entry:je,exit:Ve,save:oe,set:function(ve,Fe,Ze){oe(ve,Fe),je(ve,Fe,"=",Ze,";")},toString:function(){return Oe()+Ue()}})}function de(){var je=Ks(arguments),Ve=le(),Oe=le(),Ue=Ve.toString,oe=Oe.toString;return n(Ve,{then:function(){return Ve.apply(Ve,Hs(arguments)),this},else:function(){return Oe.apply(Oe,Hs(arguments)),this},toString:function(){var ve=oe();return ve&&(ve="else{"+ve+"}"),Ks(["if(",je,"){",Ue(),"}",ve])}})}var Ie=Ee(),ke={};function Ge(je,Ve){var Oe=[];function Ue(){var Me="a"+Oe.length;return Oe.push(Me),Me}Ve=Ve||0;for(var oe=0;oe<Ve;++oe)Ue();var ve=le(),Fe=ve.toString,Ze=ke[je]=n(ve,{arg:Ue,toString:function(){return Ks(["function(",Oe.join(),"){",Fe(),"}"])}});return Ze}function Pe(){var je=['"use strict";',Ie,"return {"];Object.keys(ke).forEach(function(Ue){je.push('"',Ue,'":',ke[Ue].toString(),",")}),je.push("}");var Ve=Ks(je).replace(/;/g,`;
45
- `).replace(/}/g,`}
46
- `).replace(/{/g,`{
47
- `),Oe=Function.apply(null,z.concat(Ve));return Oe.apply(null,V)}return{global:Ie,link:ce,block:Ee,proc:Ge,scope:le,cond:de,compile:Pe}}var qs="xyzw".split(""),Dx=5121,Zs=1,$p=2,Wp=0,Xp=1,Yp=2,Vp=3,Ac=4,kx=5,Px=6,Nx="dither",Rx="blend.enable",Bx="blend.color",Hp="blend.equation",Kp="blend.func",Fx="depth.enable",Gx="depth.func",zx="depth.range",jx="depth.mask",qp="colorMask",Ux="cull.enable",$x="cull.face",Zp="frontFace",Qp="lineWidth",Wx="polygonOffset.enable",Jp="polygonOffset.offset",Xx="sample.alpha",Yx="sample.enable",eg="sample.coverage",Vx="stencil.enable",Hx="stencil.mask",tg="stencil.func",rg="stencil.opFront",ff="stencil.opBack",Kx="scissor.enable",Tc="scissor.box",Da="viewport",lf="profile",Qo="framebuffer",cf="vert",hf="frag",Jo="elements",es="primitive",ts="count",Ic="offset",Oc="instances",df="vao",ng="Width",ig="Height",Qs=Qo+ng,Js=Qo+ig,wR=Da+ng,_R=Da+ig,qx="drawingBuffer",Zx=qx+ng,Qx=qx+ig,SR=[Kp,Hp,tg,rg,ff,eg,Da,Tc,Jp],eu=34962,MR=34963,CR=35632,AR=35633,Jx=3553,TR=34067,IR=2884,OR=3042,LR=3024,DR=2960,kR=2929,PR=3089,NR=32823,RR=32926,BR=32928,ag=5126,Lc=35664,Dc=35665,kc=35666,og=5124,Pc=35667,Nc=35668,Rc=35669,sg=35670,Bc=35671,Fc=35672,Gc=35673,vf=35674,pf=35675,gf=35676,yf=35678,mf=35680,eE=4,bf=1028,rs=1029,tE=2304,ug=2305,FR=32775,GR=32776,zR=519,oo=7680,rE=0,nE=1,iE=32774,jR=513,aE=36160,UR=36064,Xi={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},oE=["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"],tu={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},so={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},sE={frag:CR,vert:AR},fg={cw:tE,ccw:ug};function zc(O){return Array.isArray(O)||e(O)||Si(O)}function uE(O){return O.sort(function(z,V){return z===Da?-1:V===Da?1:z<V?-1:1})}function In(O,z,V,ce){this.thisDep=O,this.contextDep=z,this.propDep=V,this.append=ce}function uo(O){return O&&!(O.thisDep||O.contextDep||O.propDep)}function Fr(O){return new In(!1,!1,!1,O)}function kn(O,z){var V=O.type;if(V===Wp){var ce=O.data.length;return new In(!0,ce>=1,ce>=2,z)}else if(V===Ac){var Ee=O.data;return new In(Ee.thisDep,Ee.contextDep,Ee.propDep,z)}else{if(V===kx)return new In(!1,!1,!1,z);if(V===Px){for(var le=!1,de=!1,Ie=!1,ke=0;ke<O.data.length;++ke){var Ge=O.data[ke];if(Ge.type===Xp)Ie=!0;else if(Ge.type===Yp)de=!0;else if(Ge.type===Vp)le=!0;else if(Ge.type===Wp){le=!0;var Pe=Ge.data;Pe>=1&&(de=!0),Pe>=2&&(Ie=!0)}else Ge.type===Ac&&(le=le||Ge.data.thisDep,de=de||Ge.data.contextDep,Ie=Ie||Ge.data.propDep)}return new In(le,de,Ie,z)}else return new In(V===Vp,V===Yp,V===Xp,z)}}var fE=new In(!1,!1,!1,function(){});function $R(O,z,V,ce,Ee,le,de,Ie,ke,Ge,Pe,je,Ve,Oe,Ue){var oe=Ge.Record,ve={add:32774,subtract:32778,"reverse subtract":32779};V.ext_blend_minmax&&(ve.min=FR,ve.max=GR);var Fe=V.angle_instanced_arrays,Ze=V.webgl_draw_buffers,Me={dirty:!0,profile:Ue.profile},nt={},Te=[],Xe={},Ce={};function Ye(U){return U.replace(".","_")}function pt(U,B,q){var ae=Ye(U);Te.push(U),nt[ae]=Me[ae]=!!q,Xe[ae]=B}function Tt(U,B,q){var ae=Ye(U);Te.push(U),Array.isArray(q)?(Me[ae]=q.slice(),nt[ae]=q.slice()):Me[ae]=nt[ae]=q,Ce[ae]=B}pt(Nx,LR),pt(Rx,OR),Tt(Bx,"blendColor",[0,0,0,0]),Tt(Hp,"blendEquationSeparate",[iE,iE]),Tt(Kp,"blendFuncSeparate",[nE,rE,nE,rE]),pt(Fx,kR,!0),Tt(Gx,"depthFunc",jR),Tt(zx,"depthRange",[0,1]),Tt(jx,"depthMask",!0),Tt(qp,qp,[!0,!0,!0,!0]),pt(Ux,IR),Tt($x,"cullFace",rs),Tt(Zp,Zp,ug),Tt(Qp,Qp,1),pt(Wx,NR),Tt(Jp,"polygonOffset",[0,0]),pt(Xx,RR),pt(Yx,BR),Tt(eg,"sampleCoverage",[1,!1]),pt(Vx,DR),Tt(Hx,"stencilMask",-1),Tt(tg,"stencilFunc",[zR,0,-1]),Tt(rg,"stencilOpSeparate",[bf,oo,oo,oo]),Tt(ff,"stencilOpSeparate",[rs,oo,oo,oo]),pt(Kx,PR),Tt(Tc,"scissor",[0,0,O.drawingBufferWidth,O.drawingBufferHeight]),Tt(Da,Da,[0,0,O.drawingBufferWidth,O.drawingBufferHeight]);var He={gl:O,context:Ve,strings:z,next:nt,current:Me,draw:je,elements:le,buffer:Ee,shader:Pe,attributes:Ge.state,vao:Ge,uniforms:ke,framebuffer:Ie,extensions:V,timer:Oe,isBufferArgs:zc},ze={primTypes:zs,compareFuncs:tu,blendFuncs:Xi,blendEquations:ve,stencilOps:so,glTypes:Vo,orientationType:fg};L.optional(function(){He.isArrayLike=Dr}),Ze&&(ze.backBuffer=[rs],ze.drawBuffer=qr(ce.maxDrawbuffers,function(U){return U===0?[0]:qr(U,function(B){return UR+B})}));var Se=0;function Ct(){var U=ER(),B=U.link,q=U.global;U.id=Se++,U.batchId="0";var ae=B(He),se=U.shared={props:"a0"};Object.keys(He).forEach(function(K){se[K]=q.def(ae,".",K)}),L.optional(function(){U.CHECK=B(L),U.commandStr=L.guessCommand(),U.command=B(U.commandStr),U.assert=function(K,j,ne){K("if(!(",j,"))",this.CHECK,".commandRaise(",B(ne),",",this.command,");")},ze.invalidBlendCombinations=oE});var ee=U.next={},Q=U.current={};Object.keys(Ce).forEach(function(K){Array.isArray(Me[K])&&(ee[K]=q.def(se.next,".",K),Q[K]=q.def(se.current,".",K))});var re=U.constants={};Object.keys(ze).forEach(function(K){re[K]=q.def(JSON.stringify(ze[K]))}),U.invoke=function(K,j){switch(j.type){case Wp:var ne=["this",se.context,se.props,U.batchId];return K.def(B(j.data),".call(",ne.slice(0,Math.max(j.data.length+1,4)),")");case Xp:return K.def(se.props,j.data);case Yp:return K.def(se.context,j.data);case Vp:return K.def("this",j.data);case Ac:return j.data.append(U,K),j.data.ref;case kx:return j.data.toString();case Px:return j.data.map(function(ue){return U.invoke(K,ue)})}},U.attribCache={};var $={};return U.scopeAttrib=function(K){var j=z.id(K);if(j in $)return $[j];var ne=Ge.scope[j];ne||(ne=Ge.scope[j]=new oe);var ue=$[j]=B(ne);return ue},U}function Pt(U){var B=U.static,q=U.dynamic,ae;if(lf in B){var se=!!B[lf];ae=Fr(function(Q,re){return se}),ae.enable=se}else if(lf in q){var ee=q[lf];ae=kn(ee,function(Q,re){return Q.invoke(re,ee)})}return ae}function ot(U,B){var q=U.static,ae=U.dynamic;if(Qo in q){var se=q[Qo];return se?(se=Ie.getFramebuffer(se),L.command(se,"invalid framebuffer object"),Fr(function(Q,re){var $=Q.link(se),K=Q.shared;re.set(K.framebuffer,".next",$);var j=K.context;return re.set(j,"."+Qs,$+".width"),re.set(j,"."+Js,$+".height"),$})):Fr(function(Q,re){var $=Q.shared;re.set($.framebuffer,".next","null");var K=$.context;return re.set(K,"."+Qs,K+"."+Zx),re.set(K,"."+Js,K+"."+Qx),"null"})}else if(Qo in ae){var ee=ae[Qo];return kn(ee,function(Q,re){var $=Q.invoke(re,ee),K=Q.shared,j=K.framebuffer,ne=re.def(j,".getFramebuffer(",$,")");L.optional(function(){Q.assert(re,"!"+$+"||"+ne,"invalid framebuffer object")}),re.set(j,".next",ne);var ue=K.context;return re.set(ue,"."+Qs,ne+"?"+ne+".width:"+ue+"."+Zx),re.set(ue,"."+Js,ne+"?"+ne+".height:"+ue+"."+Qx),ne})}else return null}function zt(U,B,q){var ae=U.static,se=U.dynamic;function ee($){if($ in ae){var K=ae[$];L.commandType(K,"object","invalid "+$,q.commandStr);var j=!0,ne=K.x|0,ue=K.y|0,be,we;return"width"in K?(be=K.width|0,L.command(be>=0,"invalid "+$,q.commandStr)):j=!1,"height"in K?(we=K.height|0,L.command(we>=0,"invalid "+$,q.commandStr)):j=!1,new In(!j&&B&&B.thisDep,!j&&B&&B.contextDep,!j&&B&&B.propDep,function(ft,Rt){var st=ft.shared.context,wt=be;"width"in K||(wt=Rt.def(st,".",Qs,"-",ne));var Lt=we;return"height"in K||(Lt=Rt.def(st,".",Js,"-",ue)),[ne,ue,wt,Lt]})}else if($ in se){var ge=se[$],Re=kn(ge,function(ft,Rt){var st=ft.invoke(Rt,ge);L.optional(function(){ft.assert(Rt,st+"&&typeof "+st+'==="object"',"invalid "+$)});var wt=ft.shared.context,Lt=Rt.def(st,".x|0"),nr=Rt.def(st,".y|0"),Ar=Rt.def('"width" in ',st,"?",st,".width|0:","(",wt,".",Qs,"-",Lt,")"),On=Rt.def('"height" in ',st,"?",st,".height|0:","(",wt,".",Js,"-",nr,")");return L.optional(function(){ft.assert(Rt,Ar+">=0&&"+On+">=0","invalid "+$)}),[Lt,nr,Ar,On]});return B&&(Re.thisDep=Re.thisDep||B.thisDep,Re.contextDep=Re.contextDep||B.contextDep,Re.propDep=Re.propDep||B.propDep),Re}else return B?new In(B.thisDep,B.contextDep,B.propDep,function(ft,Rt){var st=ft.shared.context;return[0,0,Rt.def(st,".",Qs),Rt.def(st,".",Js)]}):null}var Q=ee(Da);if(Q){var re=Q;Q=new In(Q.thisDep,Q.contextDep,Q.propDep,function($,K){var j=re.append($,K),ne=$.shared.context;return K.set(ne,"."+wR,j[2]),K.set(ne,"."+_R,j[3]),j})}return{viewport:Q,scissor_box:ee(Tc)}}function It(U,B){var q=U.static,ae=typeof q[hf]=="string"&&typeof q[cf]=="string";if(ae){if(Object.keys(B.dynamic).length>0)return null;var se=B.static,ee=Object.keys(se);if(ee.length>0&&typeof se[ee[0]]=="number"){for(var Q=[],re=0;re<ee.length;++re)L(typeof se[ee[re]]=="number","must specify all vertex attribute locations when using vaos"),Q.push([se[ee[re]]|0,ee[re]]);return Q}}return null}function Ft(U,B,q){var ae=U.static,se=U.dynamic;function ee(j){if(j in ae){var ne=z.id(ae[j]);L.optional(function(){Pe.shader(sE[j],ne,L.guessCommand())});var ue=Fr(function(){return ne});return ue.id=ne,ue}else if(j in se){var be=se[j];return kn(be,function(we,ge){var Re=we.invoke(ge,be),ft=ge.def(we.shared.strings,".id(",Re,")");return L.optional(function(){ge(we.shared.shader,".shader(",sE[j],",",ft,",",we.command,");")}),ft})}return null}var Q=ee(hf),re=ee(cf),$=null,K;return uo(Q)&&uo(re)?($=Pe.program(re.id,Q.id,null,q),K=Fr(function(j,ne){return j.link($)})):K=new In(Q&&Q.thisDep||re&&re.thisDep,Q&&Q.contextDep||re&&re.contextDep,Q&&Q.propDep||re&&re.propDep,function(j,ne){var ue=j.shared.shader,be;Q?be=Q.append(j,ne):be=ne.def(ue,".",hf);var we;re?we=re.append(j,ne):we=ne.def(ue,".",cf);var ge=ue+".program("+we+","+be;return L.optional(function(){ge+=","+j.command}),ne.def(ge+")")}),{frag:Q,vert:re,progVar:K,program:$}}function rr(U,B){var q=U.static,ae=U.dynamic;function se(){if(Jo in q){var j=q[Jo];zc(j)?j=le.getElements(le.create(j,!0)):j&&(j=le.getElements(j),L.command(j,"invalid elements",B.commandStr));var ne=Fr(function(be,we){if(j){var ge=be.link(j);return be.ELEMENTS=ge,ge}return be.ELEMENTS=null,null});return ne.value=j,ne}else if(Jo in ae){var ue=ae[Jo];return kn(ue,function(be,we){var ge=be.shared,Re=ge.isBufferArgs,ft=ge.elements,Rt=be.invoke(we,ue),st=we.def("null"),wt=we.def(Re,"(",Rt,")"),Lt=be.cond(wt).then(st,"=",ft,".createStream(",Rt,");").else(st,"=",ft,".getElements(",Rt,");");return L.optional(function(){be.assert(Lt.else,"!"+Rt+"||"+st,"invalid elements")}),we.entry(Lt),we.exit(be.cond(wt).then(ft,".destroyStream(",st,");")),be.ELEMENTS=st,st})}return null}var ee=se();function Q(){if(es in q){var j=q[es];return L.commandParameter(j,zs,"invalid primitve",B.commandStr),Fr(function(ue,be){return zs[j]})}else if(es in ae){var ne=ae[es];return kn(ne,function(ue,be){var we=ue.constants.primTypes,ge=ue.invoke(be,ne);return L.optional(function(){ue.assert(be,ge+" in "+we,"invalid primitive, must be one of "+Object.keys(zs))}),be.def(we,"[",ge,"]")})}else if(ee)return uo(ee)?ee.value?Fr(function(ue,be){return be.def(ue.ELEMENTS,".primType")}):Fr(function(){return eE}):new In(ee.thisDep,ee.contextDep,ee.propDep,function(ue,be){var we=ue.ELEMENTS;return be.def(we,"?",we,".primType:",eE)});return null}function re(j,ne){if(j in q){var ue=q[j]|0;return L.command(!ne||ue>=0,"invalid "+j,B.commandStr),Fr(function(we,ge){return ne&&(we.OFFSET=ue),ue})}else if(j in ae){var be=ae[j];return kn(be,function(we,ge){var Re=we.invoke(ge,be);return ne&&(we.OFFSET=Re,L.optional(function(){we.assert(ge,Re+">=0","invalid "+j)})),Re})}else if(ne&&ee)return Fr(function(we,ge){return we.OFFSET="0",0});return null}var $=re(Ic,!0);function K(){if(ts in q){var j=q[ts]|0;return L.command(typeof j=="number"&&j>=0,"invalid vertex count",B.commandStr),Fr(function(){return j})}else if(ts in ae){var ne=ae[ts];return kn(ne,function(we,ge){var Re=we.invoke(ge,ne);return L.optional(function(){we.assert(ge,"typeof "+Re+'==="number"&&'+Re+">=0&&"+Re+"===("+Re+"|0)","invalid vertex count")}),Re})}else if(ee)if(uo(ee)){if(ee)return $?new In($.thisDep,$.contextDep,$.propDep,function(we,ge){var Re=ge.def(we.ELEMENTS,".vertCount-",we.OFFSET);return L.optional(function(){we.assert(ge,Re+">=0","invalid vertex offset/element buffer too small")}),Re}):Fr(function(we,ge){return ge.def(we.ELEMENTS,".vertCount")});var ue=Fr(function(){return-1});return L.optional(function(){ue.MISSING=!0}),ue}else{var be=new In(ee.thisDep||$.thisDep,ee.contextDep||$.contextDep,ee.propDep||$.propDep,function(we,ge){var Re=we.ELEMENTS;return we.OFFSET?ge.def(Re,"?",Re,".vertCount-",we.OFFSET,":-1"):ge.def(Re,"?",Re,".vertCount:-1")});return L.optional(function(){be.DYNAMIC=!0}),be}return null}return{elements:ee,primitive:Q(),count:K(),instances:re(Oc,!1),offset:$}}function Gr(U,B){var q=U.static,ae=U.dynamic,se={};return Te.forEach(function(ee){var Q=Ye(ee);function re($,K){if(ee in q){var j=$(q[ee]);se[Q]=Fr(function(){return j})}else if(ee in ae){var ne=ae[ee];se[Q]=kn(ne,function(ue,be){return K(ue,be,ue.invoke(be,ne))})}}switch(ee){case Ux:case Rx:case Nx:case Vx:case Fx:case Kx:case Wx:case Xx:case Yx:case jx:return re(function($){return L.commandType($,"boolean",ee,B.commandStr),$},function($,K,j){return L.optional(function(){$.assert(K,"typeof "+j+'==="boolean"',"invalid flag "+ee,$.commandStr)}),j});case Gx:return re(function($){return L.commandParameter($,tu,"invalid "+ee,B.commandStr),tu[$]},function($,K,j){var ne=$.constants.compareFuncs;return L.optional(function(){$.assert(K,j+" in "+ne,"invalid "+ee+", must be one of "+Object.keys(tu))}),K.def(ne,"[",j,"]")});case zx:return re(function($){return L.command(Dr($)&&$.length===2&&typeof $[0]=="number"&&typeof $[1]=="number"&&$[0]<=$[1],"depth range is 2d array",B.commandStr),$},function($,K,j){L.optional(function(){$.assert(K,$.shared.isArrayLike+"("+j+")&&"+j+".length===2&&typeof "+j+'[0]==="number"&&typeof '+j+'[1]==="number"&&'+j+"[0]<="+j+"[1]","depth range must be a 2d array")});var ne=K.def("+",j,"[0]"),ue=K.def("+",j,"[1]");return[ne,ue]});case Kp:return re(function($){L.commandType($,"object","blend.func",B.commandStr);var K="srcRGB"in $?$.srcRGB:$.src,j="srcAlpha"in $?$.srcAlpha:$.src,ne="dstRGB"in $?$.dstRGB:$.dst,ue="dstAlpha"in $?$.dstAlpha:$.dst;return L.commandParameter(K,Xi,Q+".srcRGB",B.commandStr),L.commandParameter(j,Xi,Q+".srcAlpha",B.commandStr),L.commandParameter(ne,Xi,Q+".dstRGB",B.commandStr),L.commandParameter(ue,Xi,Q+".dstAlpha",B.commandStr),L.command(oE.indexOf(K+", "+ne)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+K+", "+ne+")",B.commandStr),[Xi[K],Xi[ne],Xi[j],Xi[ue]]},function($,K,j){var ne=$.constants.blendFuncs;L.optional(function(){$.assert(K,j+"&&typeof "+j+'==="object"',"invalid blend func, must be an object")});function ue(st,wt){var Lt=K.def('"',st,wt,'" in ',j,"?",j,".",st,wt,":",j,".",st);return L.optional(function(){$.assert(K,Lt+" in "+ne,"invalid "+ee+"."+st+wt+", must be one of "+Object.keys(Xi))}),Lt}var be=ue("src","RGB"),we=ue("dst","RGB");L.optional(function(){var st=$.constants.invalidBlendCombinations;$.assert(K,st+".indexOf("+be+'+", "+'+we+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var ge=K.def(ne,"[",be,"]"),Re=K.def(ne,"[",ue("src","Alpha"),"]"),ft=K.def(ne,"[",we,"]"),Rt=K.def(ne,"[",ue("dst","Alpha"),"]");return[ge,ft,Re,Rt]});case Hp:return re(function($){if(typeof $=="string")return L.commandParameter($,ve,"invalid "+ee,B.commandStr),[ve[$],ve[$]];if(typeof $=="object")return L.commandParameter($.rgb,ve,ee+".rgb",B.commandStr),L.commandParameter($.alpha,ve,ee+".alpha",B.commandStr),[ve[$.rgb],ve[$.alpha]];L.commandRaise("invalid blend.equation",B.commandStr)},function($,K,j){var ne=$.constants.blendEquations,ue=K.def(),be=K.def(),we=$.cond("typeof ",j,'==="string"');return L.optional(function(){function ge(Re,ft,Rt){$.assert(Re,Rt+" in "+ne,"invalid "+ft+", must be one of "+Object.keys(ve))}ge(we.then,ee,j),$.assert(we.else,j+"&&typeof "+j+'==="object"',"invalid "+ee),ge(we.else,ee+".rgb",j+".rgb"),ge(we.else,ee+".alpha",j+".alpha")}),we.then(ue,"=",be,"=",ne,"[",j,"];"),we.else(ue,"=",ne,"[",j,".rgb];",be,"=",ne,"[",j,".alpha];"),K(we),[ue,be]});case Bx:return re(function($){return L.command(Dr($)&&$.length===4,"blend.color must be a 4d array",B.commandStr),qr(4,function(K){return+$[K]})},function($,K,j){return L.optional(function(){$.assert(K,$.shared.isArrayLike+"("+j+")&&"+j+".length===4","blend.color must be a 4d array")}),qr(4,function(ne){return K.def("+",j,"[",ne,"]")})});case Hx:return re(function($){return L.commandType($,"number",Q,B.commandStr),$|0},function($,K,j){return L.optional(function(){$.assert(K,"typeof "+j+'==="number"',"invalid stencil.mask")}),K.def(j,"|0")});case tg:return re(function($){L.commandType($,"object",Q,B.commandStr);var K=$.cmp||"keep",j=$.ref||0,ne="mask"in $?$.mask:-1;return L.commandParameter(K,tu,ee+".cmp",B.commandStr),L.commandType(j,"number",ee+".ref",B.commandStr),L.commandType(ne,"number",ee+".mask",B.commandStr),[tu[K],j,ne]},function($,K,j){var ne=$.constants.compareFuncs;L.optional(function(){function ge(){$.assert(K,Array.prototype.join.call(arguments,""),"invalid stencil.func")}ge(j+"&&typeof ",j,'==="object"'),ge('!("cmp" in ',j,")||(",j,".cmp in ",ne,")")});var ue=K.def('"cmp" in ',j,"?",ne,"[",j,".cmp]",":",oo),be=K.def(j,".ref|0"),we=K.def('"mask" in ',j,"?",j,".mask|0:-1");return[ue,be,we]});case rg:case ff:return re(function($){L.commandType($,"object",Q,B.commandStr);var K=$.fail||"keep",j=$.zfail||"keep",ne=$.zpass||"keep";return L.commandParameter(K,so,ee+".fail",B.commandStr),L.commandParameter(j,so,ee+".zfail",B.commandStr),L.commandParameter(ne,so,ee+".zpass",B.commandStr),[ee===ff?rs:bf,so[K],so[j],so[ne]]},function($,K,j){var ne=$.constants.stencilOps;L.optional(function(){$.assert(K,j+"&&typeof "+j+'==="object"',"invalid "+ee)});function ue(be){return L.optional(function(){$.assert(K,'!("'+be+'" in '+j+")||("+j+"."+be+" in "+ne+")","invalid "+ee+"."+be+", must be one of "+Object.keys(so))}),K.def('"',be,'" in ',j,"?",ne,"[",j,".",be,"]:",oo)}return[ee===ff?rs:bf,ue("fail"),ue("zfail"),ue("zpass")]});case Jp:return re(function($){L.commandType($,"object",Q,B.commandStr);var K=$.factor|0,j=$.units|0;return L.commandType(K,"number",Q+".factor",B.commandStr),L.commandType(j,"number",Q+".units",B.commandStr),[K,j]},function($,K,j){L.optional(function(){$.assert(K,j+"&&typeof "+j+'==="object"',"invalid "+ee)});var ne=K.def(j,".factor|0"),ue=K.def(j,".units|0");return[ne,ue]});case $x:return re(function($){var K=0;return $==="front"?K=bf:$==="back"&&(K=rs),L.command(!!K,Q,B.commandStr),K},function($,K,j){return L.optional(function(){$.assert(K,j+'==="front"||'+j+'==="back"',"invalid cull.face")}),K.def(j,'==="front"?',bf,":",rs)});case Qp:return re(function($){return L.command(typeof $=="number"&&$>=ce.lineWidthDims[0]&&$<=ce.lineWidthDims[1],"invalid line width, must be a positive number between "+ce.lineWidthDims[0]+" and "+ce.lineWidthDims[1],B.commandStr),$},function($,K,j){return L.optional(function(){$.assert(K,"typeof "+j+'==="number"&&'+j+">="+ce.lineWidthDims[0]+"&&"+j+"<="+ce.lineWidthDims[1],"invalid line width")}),j});case Zp:return re(function($){return L.commandParameter($,fg,Q,B.commandStr),fg[$]},function($,K,j){return L.optional(function(){$.assert(K,j+'==="cw"||'+j+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),K.def(j+'==="cw"?'+tE+":"+ug)});case qp:return re(function($){return L.command(Dr($)&&$.length===4,"color.mask must be length 4 array",B.commandStr),$.map(function(K){return!!K})},function($,K,j){return L.optional(function(){$.assert(K,$.shared.isArrayLike+"("+j+")&&"+j+".length===4","invalid color.mask")}),qr(4,function(ne){return"!!"+j+"["+ne+"]"})});case eg:return re(function($){L.command(typeof $=="object"&&$,Q,B.commandStr);var K="value"in $?$.value:1,j=!!$.invert;return L.command(typeof K=="number"&&K>=0&&K<=1,"sample.coverage.value must be a number between 0 and 1",B.commandStr),[K,j]},function($,K,j){L.optional(function(){$.assert(K,j+"&&typeof "+j+'==="object"',"invalid sample.coverage")});var ne=K.def('"value" in ',j,"?+",j,".value:1"),ue=K.def("!!",j,".invert");return[ne,ue]})}}),se}function Zr(U,B){var q=U.static,ae=U.dynamic,se={};return Object.keys(q).forEach(function(ee){var Q=q[ee],re;if(typeof Q=="number"||typeof Q=="boolean")re=Fr(function(){return Q});else if(typeof Q=="function"){var $=Q._reglType;$==="texture2d"||$==="textureCube"?re=Fr(function(K){return K.link(Q)}):$==="framebuffer"||$==="framebufferCube"?(L.command(Q.color.length>0,'missing color attachment for framebuffer sent to uniform "'+ee+'"',B.commandStr),re=Fr(function(K){return K.link(Q.color[0])})):L.commandRaise('invalid data for uniform "'+ee+'"',B.commandStr)}else Dr(Q)?re=Fr(function(K){var j=K.global.def("[",qr(Q.length,function(ne){return L.command(typeof Q[ne]=="number"||typeof Q[ne]=="boolean","invalid uniform "+ee,K.commandStr),Q[ne]}),"]");return j}):L.commandRaise('invalid or missing data for uniform "'+ee+'"',B.commandStr);re.value=Q,se[ee]=re}),Object.keys(ae).forEach(function(ee){var Q=ae[ee];se[ee]=kn(Q,function(re,$){return re.invoke($,Q)})}),se}function Wt(U,B){var q=U.static,ae=U.dynamic,se={};return Object.keys(q).forEach(function(ee){var Q=q[ee],re=z.id(ee),$=new oe;if(zc(Q))$.state=Zs,$.buffer=Ee.getBuffer(Ee.create(Q,eu,!1,!0)),$.type=0;else{var K=Ee.getBuffer(Q);if(K)$.state=Zs,$.buffer=K,$.type=0;else if(L.command(typeof Q=="object"&&Q,"invalid data for attribute "+ee,B.commandStr),"constant"in Q){var j=Q.constant;$.buffer="null",$.state=$p,typeof j=="number"?$.x=j:(L.command(Dr(j)&&j.length>0&&j.length<=4,"invalid constant for attribute "+ee,B.commandStr),qs.forEach(function(ft,Rt){Rt<j.length&&($[ft]=j[Rt])}))}else{zc(Q.buffer)?K=Ee.getBuffer(Ee.create(Q.buffer,eu,!1,!0)):K=Ee.getBuffer(Q.buffer),L.command(!!K,'missing buffer for attribute "'+ee+'"',B.commandStr);var ne=Q.offset|0;L.command(ne>=0,'invalid offset for attribute "'+ee+'"',B.commandStr);var ue=Q.stride|0;L.command(ue>=0&&ue<256,'invalid stride for attribute "'+ee+'", must be integer betweeen [0, 255]',B.commandStr);var be=Q.size|0;L.command(!("size"in Q)||be>0&&be<=4,'invalid size for attribute "'+ee+'", must be 1,2,3,4',B.commandStr);var we=!!Q.normalized,ge=0;"type"in Q&&(L.commandParameter(Q.type,Vo,"invalid type for attribute "+ee,B.commandStr),ge=Vo[Q.type]);var Re=Q.divisor|0;"divisor"in Q&&(L.command(Re===0||Fe,'cannot specify divisor for attribute "'+ee+'", instancing not supported',B.commandStr),L.command(Re>=0,'invalid divisor for attribute "'+ee+'"',B.commandStr)),L.optional(function(){var ft=B.commandStr,Rt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(Q).forEach(function(st){L.command(Rt.indexOf(st)>=0,'unknown parameter "'+st+'" for attribute pointer "'+ee+'" (valid parameters are '+Rt+")",ft)})}),$.buffer=K,$.state=Zs,$.size=be,$.normalized=we,$.type=ge||K.dtype,$.offset=ne,$.stride=ue,$.divisor=Re}}se[ee]=Fr(function(ft,Rt){var st=ft.attribCache;if(re in st)return st[re];var wt={isStream:!1};return Object.keys($).forEach(function(Lt){wt[Lt]=$[Lt]}),$.buffer&&(wt.buffer=ft.link($.buffer),wt.type=wt.type||wt.buffer+".dtype"),st[re]=wt,wt})}),Object.keys(ae).forEach(function(ee){var Q=ae[ee];function re($,K){var j=$.invoke(K,Q),ne=$.shared,ue=$.constants,be=ne.isBufferArgs,we=ne.buffer;L.optional(function(){$.assert(K,j+"&&(typeof "+j+'==="object"||typeof '+j+'==="function")&&('+be+"("+j+")||"+we+".getBuffer("+j+")||"+we+".getBuffer("+j+".buffer)||"+be+"("+j+'.buffer)||("constant" in '+j+"&&(typeof "+j+'.constant==="number"||'+ne.isArrayLike+"("+j+".constant))))",'invalid dynamic attribute "'+ee+'"')});var ge={isStream:K.def(!1)},Re=new oe;Re.state=Zs,Object.keys(Re).forEach(function(wt){ge[wt]=K.def(""+Re[wt])});var ft=ge.buffer,Rt=ge.type;K("if(",be,"(",j,")){",ge.isStream,"=true;",ft,"=",we,".createStream(",eu,",",j,");",Rt,"=",ft,".dtype;","}else{",ft,"=",we,".getBuffer(",j,");","if(",ft,"){",Rt,"=",ft,".dtype;",'}else if("constant" in ',j,"){",ge.state,"=",$p,";","if(typeof "+j+'.constant === "number"){',ge[qs[0]],"=",j,".constant;",qs.slice(1).map(function(wt){return ge[wt]}).join("="),"=0;","}else{",qs.map(function(wt,Lt){return ge[wt]+"="+j+".constant.length>"+Lt+"?"+j+".constant["+Lt+"]:0;"}).join(""),"}}else{","if(",be,"(",j,".buffer)){",ft,"=",we,".createStream(",eu,",",j,".buffer);","}else{",ft,"=",we,".getBuffer(",j,".buffer);","}",Rt,'="type" in ',j,"?",ue.glTypes,"[",j,".type]:",ft,".dtype;",ge.normalized,"=!!",j,".normalized;");function st(wt){K(ge[wt],"=",j,".",wt,"|0;")}return st("size"),st("offset"),st("stride"),st("divisor"),K("}}"),K.exit("if(",ge.isStream,"){",we,".destroyStream(",ft,");","}"),ge}se[ee]=kn(Q,re)}),se}function Xr(U,B){var q=U.static,ae=U.dynamic;if(df in q){var se=q[df];return se!==null&&Ge.getVAO(se)===null&&(se=Ge.createVAO(se)),Fr(function(Q){return Q.link(Ge.getVAO(se))})}else if(df in ae){var ee=ae[df];return kn(ee,function(Q,re){var $=Q.invoke(re,ee);return re.def(Q.shared.vao+".getVAO("+$+")")})}return null}function yr(U){var B=U.static,q=U.dynamic,ae={};return Object.keys(B).forEach(function(se){var ee=B[se];ae[se]=Fr(function(Q,re){return typeof ee=="number"||typeof ee=="boolean"?""+ee:Q.link(ee)})}),Object.keys(q).forEach(function(se){var ee=q[se];ae[se]=kn(ee,function(Q,re){return Q.invoke(re,ee)})}),ae}function zr(U,B,q,ae,se){var ee=U.static,Q=U.dynamic;L.optional(function(){var st=[Qo,cf,hf,Jo,es,Ic,ts,Oc,lf,df].concat(Te);function wt(Lt){Object.keys(Lt).forEach(function(nr){L.command(st.indexOf(nr)>=0,'unknown parameter "'+nr+'"',se.commandStr)})}wt(ee),wt(Q)});var re=It(U,B),$=ot(U),K=zt(U,$,se),j=rr(U,se),ne=Gr(U,se),ue=Ft(U,se,re);function be(st){var wt=K[st];wt&&(ne[st]=wt)}be(Da),be(Ye(Tc));var we=Object.keys(ne).length>0,ge={framebuffer:$,draw:j,shader:ue,state:ne,dirty:we,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(ge.profile=Pt(U),ge.uniforms=Zr(q,se),ge.drawVAO=ge.scopeVAO=Xr(U),!ge.drawVAO&&ue.program&&!re&&V.angle_instanced_arrays){var Re=!0,ft=ue.program.attributes.map(function(st){var wt=B.static[st];return Re=Re&&!!wt,wt});if(Re&&ft.length>0){var Rt=Ge.getVAO(Ge.createVAO(ft));ge.drawVAO=new In(null,null,null,function(st,wt){return st.link(Rt)}),ge.useVAO=!0}}return re?ge.useVAO=!0:ge.attributes=Wt(B,se),ge.context=yr(ae),ge}function Yr(U,B,q){var ae=U.shared,se=ae.context,ee=U.scope();Object.keys(q).forEach(function(Q){B.save(se,"."+Q);var re=q[Q],$=re.append(U,B);Array.isArray($)?ee(se,".",Q,"=[",$.join(),"];"):ee(se,".",Q,"=",$,";")}),B(ee)}function Vr(U,B,q,ae){var se=U.shared,ee=se.gl,Q=se.framebuffer,re;Ze&&(re=B.def(se.extensions,".webgl_draw_buffers"));var $=U.constants,K=$.drawBuffer,j=$.backBuffer,ne;q?ne=q.append(U,B):ne=B.def(Q,".next"),ae||B("if(",ne,"!==",Q,".cur){"),B("if(",ne,"){",ee,".bindFramebuffer(",aE,",",ne,".framebuffer);"),Ze&&B(re,".drawBuffersWEBGL(",K,"[",ne,".colorAttachments.length]);"),B("}else{",ee,".bindFramebuffer(",aE,",null);"),Ze&&B(re,".drawBuffersWEBGL(",j,");"),B("}",Q,".cur=",ne,";"),ae||B("}")}function rn(U,B,q){var ae=U.shared,se=ae.gl,ee=U.current,Q=U.next,re=ae.current,$=ae.next,K=U.cond(re,".dirty");Te.forEach(function(j){var ne=Ye(j);if(!(ne in q.state)){var ue,be;if(ne in Q){ue=Q[ne],be=ee[ne];var we=qr(Me[ne].length,function(Re){return K.def(ue,"[",Re,"]")});K(U.cond(we.map(function(Re,ft){return Re+"!=="+be+"["+ft+"]"}).join("||")).then(se,".",Ce[ne],"(",we,");",we.map(function(Re,ft){return be+"["+ft+"]="+Re}).join(";"),";"))}else{ue=K.def($,".",ne);var ge=U.cond(ue,"!==",re,".",ne);K(ge),ne in Xe?ge(U.cond(ue).then(se,".enable(",Xe[ne],");").else(se,".disable(",Xe[ne],");"),re,".",ne,"=",ue,";"):ge(se,".",Ce[ne],"(",ue,");",re,".",ne,"=",ue,";")}}}),Object.keys(q.state).length===0&&K(re,".dirty=false;"),B(K)}function hn(U,B,q,ae){var se=U.shared,ee=U.current,Q=se.current,re=se.gl;uE(Object.keys(q)).forEach(function($){var K=q[$];if(!(ae&&!ae(K))){var j=K.append(U,B);if(Xe[$]){var ne=Xe[$];uo(K)?j?B(re,".enable(",ne,");"):B(re,".disable(",ne,");"):B(U.cond(j).then(re,".enable(",ne,");").else(re,".disable(",ne,");")),B(Q,".",$,"=",j,";")}else if(Dr(j)){var ue=ee[$];B(re,".",Ce[$],"(",j,");",j.map(function(be,we){return ue+"["+we+"]="+be}).join(";"),";")}else B(re,".",Ce[$],"(",j,");",Q,".",$,"=",j,";")}})}function kr(U,B){Fe&&(U.instancing=B.def(U.shared.extensions,".angle_instanced_arrays"))}function Nt(U,B,q,ae,se){var ee=U.shared,Q=U.stats,re=ee.current,$=ee.timer,K=q.profile;function j(){return typeof performance>"u"?"Date.now()":"performance.now()"}var ne,ue;function be(st){ne=B.def(),st(ne,"=",j(),";"),typeof se=="string"?st(Q,".count+=",se,";"):st(Q,".count++;"),Oe&&(ae?(ue=B.def(),st(ue,"=",$,".getNumPendingQueries();")):st($,".beginQuery(",Q,");"))}function we(st){st(Q,".cpuTime+=",j(),"-",ne,";"),Oe&&(ae?st($,".pushScopeStats(",ue,",",$,".getNumPendingQueries(),",Q,");"):st($,".endQuery();"))}function ge(st){var wt=B.def(re,".profile");B(re,".profile=",st,";"),B.exit(re,".profile=",wt,";")}var Re;if(K){if(uo(K)){K.enable?(be(B),we(B.exit),ge("true")):ge("false");return}Re=K.append(U,B),ge(Re)}else Re=B.def(re,".profile");var ft=U.block();be(ft),B("if(",Re,"){",ft,"}");var Rt=U.block();we(Rt),B.exit("if(",Re,"){",Rt,"}")}function dn(U,B,q,ae,se){var ee=U.shared;function Q($){switch($){case Lc:case Pc:case Bc:return 2;case Dc:case Nc:case Fc:return 3;case kc:case Rc:case Gc:return 4;default:return 1}}function re($,K,j){var ne=ee.gl,ue=B.def($,".location"),be=B.def(ee.attributes,"[",ue,"]"),we=j.state,ge=j.buffer,Re=[j.x,j.y,j.z,j.w],ft=["buffer","normalized","offset","stride"];function Rt(){B("if(!",be,".buffer){",ne,".enableVertexAttribArray(",ue,");}");var wt=j.type,Lt;if(j.size?Lt=B.def(j.size,"||",K):Lt=K,B("if(",be,".type!==",wt,"||",be,".size!==",Lt,"||",ft.map(function(Ar){return be+"."+Ar+"!=="+j[Ar]}).join("||"),"){",ne,".bindBuffer(",eu,",",ge,".buffer);",ne,".vertexAttribPointer(",[ue,Lt,wt,j.normalized,j.stride,j.offset],");",be,".type=",wt,";",be,".size=",Lt,";",ft.map(function(Ar){return be+"."+Ar+"="+j[Ar]+";"}).join(""),"}"),Fe){var nr=j.divisor;B("if(",be,".divisor!==",nr,"){",U.instancing,".vertexAttribDivisorANGLE(",[ue,nr],");",be,".divisor=",nr,";}")}}function st(){B("if(",be,".buffer){",ne,".disableVertexAttribArray(",ue,");",be,".buffer=null;","}if(",qs.map(function(wt,Lt){return be+"."+wt+"!=="+Re[Lt]}).join("||"),"){",ne,".vertexAttrib4f(",ue,",",Re,");",qs.map(function(wt,Lt){return be+"."+wt+"="+Re[Lt]+";"}).join(""),"}")}we===Zs?Rt():we===$p?st():(B("if(",we,"===",Zs,"){"),Rt(),B("}else{"),st(),B("}"))}ae.forEach(function($){var K=$.name,j=q.attributes[K],ne;if(j){if(!se(j))return;ne=j.append(U,B)}else{if(!se(fE))return;var ue=U.scopeAttrib(K);L.optional(function(){U.assert(B,ue+".state","missing attribute "+K)}),ne={},Object.keys(new oe).forEach(function(be){ne[be]=B.def(ue,".",be)})}re(U.link($),Q($.info.type),ne)})}function cr(U,B,q,ae,se){for(var ee=U.shared,Q=ee.gl,re,$=0;$<ae.length;++$){var K=ae[$],j=K.name,ne=K.info.type,ue=q.uniforms[j],be=U.link(K),we=be+".location",ge;if(ue){if(!se(ue))continue;if(uo(ue)){var Re=ue.value;if(L.command(Re!==null&&typeof Re<"u",'missing uniform "'+j+'"',U.commandStr),ne===yf||ne===mf){L.command(typeof Re=="function"&&(ne===yf&&(Re._reglType==="texture2d"||Re._reglType==="framebuffer")||ne===mf&&(Re._reglType==="textureCube"||Re._reglType==="framebufferCube")),"invalid texture for uniform "+j,U.commandStr);var ft=U.link(Re._texture||Re.color[0]._texture);B(Q,".uniform1i(",we,",",ft+".bind());"),B.exit(ft,".unbind();")}else if(ne===vf||ne===pf||ne===gf){L.optional(function(){L.command(Dr(Re),"invalid matrix for uniform "+j,U.commandStr),L.command(ne===vf&&Re.length===4||ne===pf&&Re.length===9||ne===gf&&Re.length===16,"invalid length for matrix uniform "+j,U.commandStr)});var Rt=U.global.def("new Float32Array(["+Array.prototype.slice.call(Re)+"])"),st=2;ne===pf?st=3:ne===gf&&(st=4),B(Q,".uniformMatrix",st,"fv(",we,",false,",Rt,");")}else{switch(ne){case ag:L.commandType(Re,"number","uniform "+j,U.commandStr),re="1f";break;case Lc:L.command(Dr(Re)&&Re.length===2,"uniform "+j,U.commandStr),re="2f";break;case Dc:L.command(Dr(Re)&&Re.length===3,"uniform "+j,U.commandStr),re="3f";break;case kc:L.command(Dr(Re)&&Re.length===4,"uniform "+j,U.commandStr),re="4f";break;case sg:L.commandType(Re,"boolean","uniform "+j,U.commandStr),re="1i";break;case og:L.commandType(Re,"number","uniform "+j,U.commandStr),re="1i";break;case Bc:L.command(Dr(Re)&&Re.length===2,"uniform "+j,U.commandStr),re="2i";break;case Pc:L.command(Dr(Re)&&Re.length===2,"uniform "+j,U.commandStr),re="2i";break;case Fc:L.command(Dr(Re)&&Re.length===3,"uniform "+j,U.commandStr),re="3i";break;case Nc:L.command(Dr(Re)&&Re.length===3,"uniform "+j,U.commandStr),re="3i";break;case Gc:L.command(Dr(Re)&&Re.length===4,"uniform "+j,U.commandStr),re="4i";break;case Rc:L.command(Dr(Re)&&Re.length===4,"uniform "+j,U.commandStr),re="4i";break}B(Q,".uniform",re,"(",we,",",Dr(Re)?Array.prototype.slice.call(Re):Re,");")}continue}else ge=ue.append(U,B)}else{if(!se(fE))continue;ge=B.def(ee.uniforms,"[",z.id(j),"]")}ne===yf?(L(!Array.isArray(ge),"must specify a scalar prop for textures"),B("if(",ge,"&&",ge,'._reglType==="framebuffer"){',ge,"=",ge,".color[0];","}")):ne===mf&&(L(!Array.isArray(ge),"must specify a scalar prop for cube maps"),B("if(",ge,"&&",ge,'._reglType==="framebufferCube"){',ge,"=",ge,".color[0];","}")),L.optional(function(){function On(Ci,gE){U.assert(B,Ci,'bad data or missing for uniform "'+j+'". '+gE)}function lg(Ci){L(!Array.isArray(ge),"must not specify an array type for uniform"),On("typeof "+ge+'==="'+Ci+'"',"invalid type, expected "+Ci)}function si(Ci,gE){Array.isArray(ge)?L(ge.length===Ci,"must have length "+Ci):On(ee.isArrayLike+"("+ge+")&&"+ge+".length==="+Ci,"invalid vector, should have length "+Ci,U.commandStr)}function pE(Ci){L(!Array.isArray(ge),"must not specify a value type"),On("typeof "+ge+'==="function"&&'+ge+'._reglType==="texture'+(Ci===Jx?"2d":"Cube")+'"',"invalid texture type",U.commandStr)}switch(ne){case og:lg("number");break;case Pc:si(2);break;case Nc:si(3);break;case Rc:si(4);break;case ag:lg("number");break;case Lc:si(2);break;case Dc:si(3);break;case kc:si(4);break;case sg:lg("boolean");break;case Bc:si(2);break;case Fc:si(3);break;case Gc:si(4);break;case vf:si(4);break;case pf:si(9);break;case gf:si(16);break;case yf:pE(Jx);break;case mf:pE(TR);break}});var wt=1;switch(ne){case yf:case mf:var Lt=B.def(ge,"._texture");B(Q,".uniform1i(",we,",",Lt,".bind());"),B.exit(Lt,".unbind();");continue;case og:case sg:re="1i";break;case Pc:case Bc:re="2i",wt=2;break;case Nc:case Fc:re="3i",wt=3;break;case Rc:case Gc:re="4i",wt=4;break;case ag:re="1f";break;case Lc:re="2f",wt=2;break;case Dc:re="3f",wt=3;break;case kc:re="4f",wt=4;break;case vf:re="Matrix2fv";break;case pf:re="Matrix3fv";break;case gf:re="Matrix4fv";break}if(B(Q,".uniform",re,"(",we,","),re.charAt(0)==="M"){var nr=Math.pow(ne-vf+2,2),Ar=U.global.def("new Float32Array(",nr,")");Array.isArray(ge)?B("false,(",qr(nr,function(On){return Ar+"["+On+"]="+ge[On]}),",",Ar,")"):B("false,(Array.isArray(",ge,")||",ge," instanceof Float32Array)?",ge,":(",qr(nr,function(On){return Ar+"["+On+"]="+ge+"["+On+"]"}),",",Ar,")")}else wt>1?B(qr(wt,function(On){return Array.isArray(ge)?ge[On]:ge+"["+On+"]"})):(L(!Array.isArray(ge),"uniform value must not be an array"),B(ge));B(");")}}function bt(U,B,q,ae){var se=U.shared,ee=se.gl,Q=se.draw,re=ae.draw;function $(){var Lt=re.elements,nr,Ar=B;return Lt?((Lt.contextDep&&ae.contextDynamic||Lt.propDep)&&(Ar=q),nr=Lt.append(U,Ar)):nr=Ar.def(Q,".",Jo),nr&&Ar("if("+nr+")"+ee+".bindBuffer("+MR+","+nr+".buffer.buffer);"),nr}function K(){var Lt=re.count,nr,Ar=B;return Lt?((Lt.contextDep&&ae.contextDynamic||Lt.propDep)&&(Ar=q),nr=Lt.append(U,Ar),L.optional(function(){Lt.MISSING&&U.assert(B,"false","missing vertex count"),Lt.DYNAMIC&&U.assert(Ar,nr+">=0","missing vertex count")})):(nr=Ar.def(Q,".",ts),L.optional(function(){U.assert(Ar,nr+">=0","missing vertex count")})),nr}var j=$();function ne(Lt){var nr=re[Lt];return nr?nr.contextDep&&ae.contextDynamic||nr.propDep?nr.append(U,q):nr.append(U,B):B.def(Q,".",Lt)}var ue=ne(es),be=ne(Ic),we=K();if(typeof we=="number"){if(we===0)return}else q("if(",we,"){"),q.exit("}");var ge,Re;Fe&&(ge=ne(Oc),Re=U.instancing);var ft=j+".type",Rt=re.elements&&uo(re.elements);function st(){function Lt(){q(Re,".drawElementsInstancedANGLE(",[ue,we,ft,be+"<<(("+ft+"-"+Dx+")>>1)",ge],");")}function nr(){q(Re,".drawArraysInstancedANGLE(",[ue,be,we,ge],");")}j?Rt?Lt():(q("if(",j,"){"),Lt(),q("}else{"),nr(),q("}")):nr()}function wt(){function Lt(){q(ee+".drawElements("+[ue,we,ft,be+"<<(("+ft+"-"+Dx+")>>1)"]+");")}function nr(){q(ee+".drawArrays("+[ue,be,we]+");")}j?Rt?Lt():(q("if(",j,"){"),Lt(),q("}else{"),nr(),q("}")):nr()}Fe&&(typeof ge!="number"||ge>=0)?typeof ge=="string"?(q("if(",ge,">0){"),st(),q("}else if(",ge,"<0){"),wt(),q("}")):st():wt()}function $t(U,B,q,ae,se){var ee=Ct(),Q=ee.proc("body",se);return L.optional(function(){ee.commandStr=B.commandStr,ee.command=ee.link(B.commandStr)}),Fe&&(ee.instancing=Q.def(ee.shared.extensions,".angle_instanced_arrays")),U(ee,Q,q,ae),ee.compile().body}function qt(U,B,q,ae){kr(U,B),q.useVAO?q.drawVAO?B(U.shared.vao,".setVAO(",q.drawVAO.append(U,B),");"):B(U.shared.vao,".setVAO(",U.shared.vao,".targetVAO);"):(B(U.shared.vao,".setVAO(null);"),dn(U,B,q,ae.attributes,function(){return!0})),cr(U,B,q,ae.uniforms,function(){return!0}),bt(U,B,B,q)}function Pr(U,B){var q=U.proc("draw",1);kr(U,q),Yr(U,q,B.context),Vr(U,q,B.framebuffer),rn(U,q,B),hn(U,q,B.state),Nt(U,q,B,!1,!0);var ae=B.shader.progVar.append(U,q);if(q(U.shared.gl,".useProgram(",ae,".program);"),B.shader.program)qt(U,q,B,B.shader.program);else{q(U.shared.vao,".setVAO(null);");var se=U.global.def("{}"),ee=q.def(ae,".id"),Q=q.def(se,"[",ee,"]");q(U.cond(Q).then(Q,".call(this,a0);").else(Q,"=",se,"[",ee,"]=",U.link(function(re){return $t(qt,U,B,re,1)}),"(",ae,");",Q,".call(this,a0);"))}Object.keys(B.state).length>0&&q(U.shared.current,".dirty=true;")}function Yi(U,B,q,ae){U.batchId="a1",kr(U,B);function se(){return!0}dn(U,B,q,ae.attributes,se),cr(U,B,q,ae.uniforms,se),bt(U,B,B,q)}function ns(U,B,q,ae){kr(U,B);var se=q.contextDep,ee=B.def(),Q="a0",re="a1",$=B.def();U.shared.props=$,U.batchId=ee;var K=U.scope(),j=U.scope();B(K.entry,"for(",ee,"=0;",ee,"<",re,";++",ee,"){",$,"=",Q,"[",ee,"];",j,"}",K.exit);function ne(ft){return ft.contextDep&&se||ft.propDep}function ue(ft){return!ne(ft)}if(q.needsContext&&Yr(U,j,q.context),q.needsFramebuffer&&Vr(U,j,q.framebuffer),hn(U,j,q.state,ne),q.profile&&ne(q.profile)&&Nt(U,j,q,!1,!0),ae)q.useVAO?q.drawVAO?ne(q.drawVAO)?j(U.shared.vao,".setVAO(",q.drawVAO.append(U,j),");"):K(U.shared.vao,".setVAO(",q.drawVAO.append(U,K),");"):K(U.shared.vao,".setVAO(",U.shared.vao,".targetVAO);"):(K(U.shared.vao,".setVAO(null);"),dn(U,K,q,ae.attributes,ue),dn(U,j,q,ae.attributes,ne)),cr(U,K,q,ae.uniforms,ue),cr(U,j,q,ae.uniforms,ne),bt(U,K,j,q);else{var be=U.global.def("{}"),we=q.shader.progVar.append(U,j),ge=j.def(we,".id"),Re=j.def(be,"[",ge,"]");j(U.shared.gl,".useProgram(",we,".program);","if(!",Re,"){",Re,"=",be,"[",ge,"]=",U.link(function(ft){return $t(Yi,U,q,ft,2)}),"(",we,");}",Re,".call(this,a0[",ee,"],",ee,");")}}function X(U,B){var q=U.proc("batch",2);U.batchId="0",kr(U,q);var ae=!1,se=!0;Object.keys(B.context).forEach(function(be){ae=ae||B.context[be].propDep}),ae||(Yr(U,q,B.context),se=!1);var ee=B.framebuffer,Q=!1;ee?(ee.propDep?ae=Q=!0:ee.contextDep&&ae&&(Q=!0),Q||Vr(U,q,ee)):Vr(U,q,null),B.state.viewport&&B.state.viewport.propDep&&(ae=!0);function re(be){return be.contextDep&&ae||be.propDep}rn(U,q,B),hn(U,q,B.state,function(be){return!re(be)}),(!B.profile||!re(B.profile))&&Nt(U,q,B,!1,"a1"),B.contextDep=ae,B.needsContext=se,B.needsFramebuffer=Q;var $=B.shader.progVar;if($.contextDep&&ae||$.propDep)ns(U,q,B,null);else{var K=$.append(U,q);if(q(U.shared.gl,".useProgram(",K,".program);"),B.shader.program)ns(U,q,B,B.shader.program);else{q(U.shared.vao,".setVAO(null);");var j=U.global.def("{}"),ne=q.def(K,".id"),ue=q.def(j,"[",ne,"]");q(U.cond(ue).then(ue,".call(this,a0,a1);").else(ue,"=",j,"[",ne,"]=",U.link(function(be){return $t(ns,U,B,be,2)}),"(",K,");",ue,".call(this,a0,a1);"))}}Object.keys(B.state).length>0&&q(U.shared.current,".dirty=true;")}function he(U,B){var q=U.proc("scope",3);U.batchId="a2";var ae=U.shared,se=ae.current;Yr(U,q,B.context),B.framebuffer&&B.framebuffer.append(U,q),uE(Object.keys(B.state)).forEach(function(Q){var re=B.state[Q],$=re.append(U,q);Dr($)?$.forEach(function(K,j){q.set(U.next[Q],"["+j+"]",K)}):q.set(ae.next,"."+Q,$)}),Nt(U,q,B,!0,!0),[Jo,Ic,ts,Oc,es].forEach(function(Q){var re=B.draw[Q];re&&q.set(ae.draw,"."+Q,""+re.append(U,q))}),Object.keys(B.uniforms).forEach(function(Q){var re=B.uniforms[Q].append(U,q);Array.isArray(re)&&(re="["+re.join()+"]"),q.set(ae.uniforms,"["+z.id(Q)+"]",re)}),Object.keys(B.attributes).forEach(function(Q){var re=B.attributes[Q].append(U,q),$=U.scopeAttrib(Q);Object.keys(new oe).forEach(function(K){q.set($,"."+K,re[K])})}),B.scopeVAO&&q.set(ae.vao,".targetVAO",B.scopeVAO.append(U,q));function ee(Q){var re=B.shader[Q];re&&q.set(ae.shader,"."+Q,re.append(U,q))}ee(cf),ee(hf),Object.keys(B.state).length>0&&(q(se,".dirty=true;"),q.exit(se,".dirty=true;")),q("a1(",U.shared.context,",a0,",U.batchId,");")}function fe(U){if(!(typeof U!="object"||Dr(U))){for(var B=Object.keys(U),q=0;q<B.length;++q)if(hr.isDynamic(U[B[q]]))return!0;return!1}}function it(U,B,q){var ae=B.static[q];if(!ae||!fe(ae))return;var se=U.global,ee=Object.keys(ae),Q=!1,re=!1,$=!1,K=U.global.def("{}");ee.forEach(function(ne){var ue=ae[ne];if(hr.isDynamic(ue)){typeof ue=="function"&&(ue=ae[ne]=hr.unbox(ue));var be=kn(ue,null);Q=Q||be.thisDep,$=$||be.propDep,re=re||be.contextDep}else{switch(se(K,".",ne,"="),typeof ue){case"number":se(ue);break;case"string":se('"',ue,'"');break;case"object":Array.isArray(ue)&&se("[",ue.join(),"]");break;default:se(U.link(ue));break}se(";")}});function j(ne,ue){ee.forEach(function(be){var we=ae[be];if(hr.isDynamic(we)){var ge=ne.invoke(ue,we);ue(K,".",be,"=",ge,";")}})}B.dynamic[q]=new hr.DynamicVariable(Ac,{thisDep:Q,contextDep:re,propDep:$,ref:K,append:j}),delete B.static[q]}function jt(U,B,q,ae,se){var ee=Ct();ee.stats=ee.link(se),Object.keys(B.static).forEach(function(re){it(ee,B,re)}),SR.forEach(function(re){it(ee,U,re)});var Q=zr(U,B,q,ae,ee);return Pr(ee,Q),he(ee,Q),X(ee,Q),n(ee.compile(),{destroy:function(){Q.shader.program.destroy()}})}return{next:nt,current:Me,procs:function(){var U=Ct(),B=U.proc("poll"),q=U.proc("refresh"),ae=U.block();B(ae),q(ae);var se=U.shared,ee=se.gl,Q=se.next,re=se.current;ae(re,".dirty=false;"),Vr(U,B),Vr(U,q,null,!0);var $;Fe&&($=U.link(Fe)),V.oes_vertex_array_object&&q(U.link(V.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var K=0;K<ce.maxAttributes;++K){var j=q.def(se.attributes,"[",K,"]"),ne=U.cond(j,".buffer");ne.then(ee,".enableVertexAttribArray(",K,");",ee,".bindBuffer(",eu,",",j,".buffer.buffer);",ee,".vertexAttribPointer(",K,",",j,".size,",j,".type,",j,".normalized,",j,".stride,",j,".offset);").else(ee,".disableVertexAttribArray(",K,");",ee,".vertexAttrib4f(",K,",",j,".x,",j,".y,",j,".z,",j,".w);",j,".buffer=null;"),q(ne),Fe&&q($,".vertexAttribDivisorANGLE(",K,",",j,".divisor);")}return q(U.shared.vao,".currentVAO=null;",U.shared.vao,".setVAO(",U.shared.vao,".targetVAO);"),Object.keys(Xe).forEach(function(ue){var be=Xe[ue],we=ae.def(Q,".",ue),ge=U.block();ge("if(",we,"){",ee,".enable(",be,")}else{",ee,".disable(",be,")}",re,".",ue,"=",we,";"),q(ge),B("if(",we,"!==",re,".",ue,"){",ge,"}")}),Object.keys(Ce).forEach(function(ue){var be=Ce[ue],we=Me[ue],ge,Re,ft=U.block();if(ft(ee,".",be,"("),Dr(we)){var Rt=we.length;ge=U.global.def(Q,".",ue),Re=U.global.def(re,".",ue),ft(qr(Rt,function(st){return ge+"["+st+"]"}),");",qr(Rt,function(st){return Re+"["+st+"]="+ge+"["+st+"];"}).join("")),B("if(",qr(Rt,function(st){return ge+"["+st+"]!=="+Re+"["+st+"]"}).join("||"),"){",ft,"}")}else ge=ae.def(Q,".",ue),Re=ae.def(re,".",ue),ft(ge,");",re,".",ue,"=",ge,";"),B("if(",ge,"!==",Re,"){",ft,"}");q(ft)}),U.compile()}(),compile:jt}}function WR(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var XR=34918,YR=34919,lE=35007,VR=function(O,z){if(!z.ext_disjoint_timer_query)return null;var V=[];function ce(){return V.pop()||z.ext_disjoint_timer_query.createQueryEXT()}function Ee(Fe){V.push(Fe)}var le=[];function de(Fe){var Ze=ce();z.ext_disjoint_timer_query.beginQueryEXT(lE,Ze),le.push(Ze),Oe(le.length-1,le.length,Fe)}function Ie(){z.ext_disjoint_timer_query.endQueryEXT(lE)}function ke(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var Ge=[];function Pe(){return Ge.pop()||new ke}function je(Fe){Ge.push(Fe)}var Ve=[];function Oe(Fe,Ze,Me){var nt=Pe();nt.startQueryIndex=Fe,nt.endQueryIndex=Ze,nt.sum=0,nt.stats=Me,Ve.push(nt)}var Ue=[],oe=[];function ve(){var Fe,Ze,Me=le.length;if(Me!==0){oe.length=Math.max(oe.length,Me+1),Ue.length=Math.max(Ue.length,Me+1),Ue[0]=0,oe[0]=0;var nt=0;for(Fe=0,Ze=0;Ze<le.length;++Ze){var Te=le[Ze];z.ext_disjoint_timer_query.getQueryObjectEXT(Te,YR)?(nt+=z.ext_disjoint_timer_query.getQueryObjectEXT(Te,XR),Ee(Te)):le[Fe++]=Te,Ue[Ze+1]=nt,oe[Ze+1]=Fe}for(le.length=Fe,Fe=0,Ze=0;Ze<Ve.length;++Ze){var Xe=Ve[Ze],Ce=Xe.startQueryIndex,Ye=Xe.endQueryIndex;Xe.sum+=Ue[Ye]-Ue[Ce];var pt=oe[Ce],Tt=oe[Ye];Tt===pt?(Xe.stats.gpuTime+=Xe.sum/1e6,je(Xe)):(Xe.startQueryIndex=pt,Xe.endQueryIndex=Tt,Ve[Fe++]=Xe)}Ve.length=Fe}}return{beginQuery:de,endQuery:Ie,pushScopeStats:Oe,update:ve,getNumPendingQueries:function(){return le.length},clear:function(){V.push.apply(V,le);for(var Fe=0;Fe<V.length;Fe++)z.ext_disjoint_timer_query.deleteQueryEXT(V[Fe]);le.length=0,V.length=0},restore:function(){le.length=0,V.length=0}}},HR=16384,KR=256,qR=1024,ZR=34962,cE="webglcontextlost",hE="webglcontextrestored",dE=1,QR=2,JR=3;function vE(O,z){for(var V=0;V<O.length;++V)if(O[V]===z)return V;return-1}function e3(O){var z=Uo(O);if(!z)return null;var V=z.gl,ce=V.getContextAttributes(),Ee=V.isContextLost(),le=$o(V,z);if(!le)return null;var de=vr(),Ie=WR(),ke=le.extensions,Ge=VR(V,ke),Pe=gr(),je=V.drawingBufferWidth,Ve=V.drawingBufferHeight,Oe={tick:0,time:0,viewportWidth:je,viewportHeight:Ve,framebufferWidth:je,framebufferHeight:Ve,drawingBufferWidth:je,drawingBufferHeight:Ve,pixelRatio:z.pixelRatio},Ue={},oe={elements:null,primitive:4,count:-1,offset:0,instances:-1},ve=GP(V,ke),Fe=tN(V,Ie,z,Me),Ze=dR(V,ke,ve,Ie,Fe);function Me(bt){return Ze.destroyBuffer(bt)}var nt=dN(V,ke,Fe,Ie),Te=yR(V,de,Ie,z),Xe=WN(V,ke,ve,function(){pt.procs.poll()},Oe,Ie,z),Ce=XN(V,ke,ve,Ie,z),Ye=cR(V,ke,ve,Xe,Ce,Ie),pt=$R(V,de,ke,ve,Fe,nt,Xe,Ye,Ue,Ze,Te,oe,Oe,Ge,z),Tt=xR(V,Ye,pt.procs.poll,Oe,ce,ke,ve),He=pt.next,ze=V.canvas,Se=[],Ct=[],Pt=[],ot=[z.onDestroy],zt=null;function It(){if(Se.length===0){Ge&&Ge.update(),zt=null;return}zt=or.next(It),hn();for(var bt=Se.length-1;bt>=0;--bt){var $t=Se[bt];$t&&$t(Oe,null,0)}V.flush(),Ge&&Ge.update()}function Ft(){!zt&&Se.length>0&&(zt=or.next(It))}function rr(){zt&&(or.cancel(It),zt=null)}function Gr(bt){bt.preventDefault(),Ee=!0,rr(),Ct.forEach(function($t){$t()})}function Zr(bt){V.getError(),Ee=!1,le.restore(),Te.restore(),Fe.restore(),Xe.restore(),Ce.restore(),Ye.restore(),Ze.restore(),Ge&&Ge.restore(),pt.procs.refresh(),Ft(),Pt.forEach(function($t){$t()})}ze&&(ze.addEventListener(cE,Gr,!1),ze.addEventListener(hE,Zr,!1));function Wt(){Se.length=0,rr(),ze&&(ze.removeEventListener(cE,Gr),ze.removeEventListener(hE,Zr)),Te.clear(),Ye.clear(),Ce.clear(),Xe.clear(),nt.clear(),Fe.clear(),Ze.clear(),Ge&&Ge.clear(),ot.forEach(function(bt){bt()})}function Xr(bt){L(!!bt,"invalid args to regl({...})"),L.type(bt,"object","invalid args to regl({...})");function $t(se){var ee=n({},se);delete ee.uniforms,delete ee.attributes,delete ee.context,delete ee.vao,"stencil"in ee&&ee.stencil.op&&(ee.stencil.opBack=ee.stencil.opFront=ee.stencil.op,delete ee.stencil.op);function Q(re){if(re in ee){var $=ee[re];delete ee[re],Object.keys($).forEach(function(K){ee[re+"."+K]=$[K]})}}return Q("blend"),Q("depth"),Q("cull"),Q("stencil"),Q("polygonOffset"),Q("scissor"),Q("sample"),"vao"in se&&(ee.vao=se.vao),ee}function qt(se,ee){var Q={},re={};return Object.keys(se).forEach(function($){var K=se[$];if(hr.isDynamic(K)){re[$]=hr.unbox(K,$);return}else if(ee&&Array.isArray(K)){for(var j=0;j<K.length;++j)if(hr.isDynamic(K[j])){re[$]=hr.unbox(K,$);return}}Q[$]=K}),{dynamic:re,static:Q}}var Pr=qt(bt.context||{},!0),Yi=qt(bt.uniforms||{},!0),ns=qt(bt.attributes||{},!1),X=qt($t(bt),!1),he={gpuTime:0,cpuTime:0,count:0},fe=pt.compile(X,ns,Yi,Pr,he),it=fe.draw,jt=fe.batch,U=fe.scope,B=[];function q(se){for(;B.length<se;)B.push(null);return B}function ae(se,ee){var Q;if(Ee&&L.raise("context lost"),typeof se=="function")return U.call(this,null,se,0);if(typeof ee=="function")if(typeof se=="number")for(Q=0;Q<se;++Q)U.call(this,null,ee,Q);else if(Array.isArray(se))for(Q=0;Q<se.length;++Q)U.call(this,se[Q],ee,Q);else return U.call(this,se,ee,0);else if(typeof se=="number"){if(se>0)return jt.call(this,q(se|0),se|0)}else if(Array.isArray(se)){if(se.length)return jt.call(this,se,se.length)}else return it.call(this,se)}return n(ae,{stats:he,destroy:function(){fe.destroy()}})}var yr=Ye.setFBO=Xr({framebuffer:hr.define.call(null,dE,"framebuffer")});function zr(bt,$t){var qt=0;pt.procs.poll();var Pr=$t.color;Pr&&(V.clearColor(+Pr[0]||0,+Pr[1]||0,+Pr[2]||0,+Pr[3]||0),qt|=HR),"depth"in $t&&(V.clearDepth(+$t.depth),qt|=KR),"stencil"in $t&&(V.clearStencil($t.stencil|0),qt|=qR),L(!!qt,"called regl.clear with no buffer specified"),V.clear(qt)}function Yr(bt){if(L(typeof bt=="object"&&bt,"regl.clear() takes an object as input"),"framebuffer"in bt)if(bt.framebuffer&&bt.framebuffer_reglType==="framebufferCube")for(var $t=0;$t<6;++$t)yr(n({framebuffer:bt.framebuffer.faces[$t]},bt),zr);else yr(bt,zr);else zr(null,bt)}function Vr(bt){L.type(bt,"function","regl.frame() callback must be a function"),Se.push(bt);function $t(){var qt=vE(Se,bt);L(qt>=0,"cannot cancel a frame twice");function Pr(){var Yi=vE(Se,Pr);Se[Yi]=Se[Se.length-1],Se.length-=1,Se.length<=0&&rr()}Se[qt]=Pr}return Ft(),{cancel:$t}}function rn(){var bt=He.viewport,$t=He.scissor_box;bt[0]=bt[1]=$t[0]=$t[1]=0,Oe.viewportWidth=Oe.framebufferWidth=Oe.drawingBufferWidth=bt[2]=$t[2]=V.drawingBufferWidth,Oe.viewportHeight=Oe.framebufferHeight=Oe.drawingBufferHeight=bt[3]=$t[3]=V.drawingBufferHeight}function hn(){Oe.tick+=1,Oe.time=Nt(),rn(),pt.procs.poll()}function kr(){Xe.refresh(),rn(),pt.procs.refresh(),Ge&&Ge.update()}function Nt(){return(gr()-Pe)/1e3}kr();function dn(bt,$t){L.type($t,"function","listener callback must be a function");var qt;switch(bt){case"frame":return Vr($t);case"lost":qt=Ct;break;case"restore":qt=Pt;break;case"destroy":qt=ot;break;default:L.raise("invalid event, must be one of frame,lost,restore,destroy")}return qt.push($t),{cancel:function(){for(var Pr=0;Pr<qt.length;++Pr)if(qt[Pr]===$t){qt[Pr]=qt[qt.length-1],qt.pop();return}}}}var cr=n(Xr,{clear:Yr,prop:hr.define.bind(null,dE),context:hr.define.bind(null,QR),this:hr.define.bind(null,JR),draw:Xr({}),buffer:function(bt){return Fe.create(bt,ZR,!1,!1)},elements:function(bt){return nt.create(bt,!1)},texture:Xe.create2D,cube:Xe.createCube,renderbuffer:Ce.create,framebuffer:Ye.create,framebufferCube:Ye.createCube,vao:Ze.createVAO,attributes:ce,frame:Vr,on:dn,limits:ve,hasExtension:function(bt){return ve.extensions.indexOf(bt.toLowerCase())>=0},read:Tt,destroy:Wt,_gl:V,_refresh:kr,poll:function(){hn(),Ge&&Ge.update()},now:Nt,stats:Ie});return z.onDone(null,cr),cr}return e3})})(Dk);var Fse=Dk.exports;const Gse=ba(Fse);var zse=function(){function r(t,e){Ri(this,r),this.attribute=void 0,this.buffer=void 0;var n=e.buffer,i=e.offset,a=e.stride,o=e.normalized,s=e.size,u=e.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 Bi(r,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(e){this.buffer.subData(e)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),r}(),Na,Of,Ra,li,Lf,ho,Df,Sh,Ki,os,En,qi,Zi,Mh,jse=(Na={},et(Na,De.POINTS,"points"),et(Na,De.LINES,"lines"),et(Na,De.LINE_LOOP,"line loop"),et(Na,De.LINE_STRIP,"line strip"),et(Na,De.TRIANGLES,"triangles"),et(Na,De.TRIANGLE_FAN,"triangle fan"),et(Na,De.TRIANGLE_STRIP,"triangle strip"),Na),kk=(Of={},et(Of,De.STATIC_DRAW,"static"),et(Of,De.DYNAMIC_DRAW,"dynamic"),et(Of,De.STREAM_DRAW,"stream"),Of),hb=(Ra={},et(Ra,De.BYTE,"int8"),et(Ra,De.UNSIGNED_INT,"int16"),et(Ra,De.INT,"int32"),et(Ra,De.UNSIGNED_BYTE,"uint8"),et(Ra,De.UNSIGNED_SHORT,"uint16"),et(Ra,De.UNSIGNED_INT,"uint32"),et(Ra,De.FLOAT,"float"),Ra),Use=(li={},et(li,De.ALPHA,"alpha"),et(li,De.LUMINANCE,"luminance"),et(li,De.LUMINANCE_ALPHA,"luminance alpha"),et(li,De.RGB,"rgb"),et(li,De.RGBA,"rgba"),et(li,De.RGBA4,"rgba4"),et(li,De.RGB5_A1,"rgb5 a1"),et(li,De.RGB565,"rgb565"),et(li,De.DEPTH_COMPONENT,"depth"),et(li,De.DEPTH_STENCIL,"depth stencil"),li),$se=(Lf={},et(Lf,De.DONT_CARE,"dont care"),et(Lf,De.NICEST,"nice"),et(Lf,De.FASTEST,"fast"),Lf),BS=(ho={},et(ho,De.NEAREST,"nearest"),et(ho,De.LINEAR,"linear"),et(ho,De.LINEAR_MIPMAP_LINEAR,"mipmap"),et(ho,De.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),et(ho,De.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),et(ho,De.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),ho),FS=(Df={},et(Df,De.REPEAT,"repeat"),et(Df,De.CLAMP_TO_EDGE,"clamp"),et(Df,De.MIRRORED_REPEAT,"mirror"),Df),Wse=(Sh={},et(Sh,De.NONE,"none"),et(Sh,De.BROWSER_DEFAULT_WEBGL,"browser"),Sh),Xse=(Ki={},et(Ki,De.NEVER,"never"),et(Ki,De.ALWAYS,"always"),et(Ki,De.LESS,"less"),et(Ki,De.LEQUAL,"lequal"),et(Ki,De.GREATER,"greater"),et(Ki,De.GEQUAL,"gequal"),et(Ki,De.EQUAL,"equal"),et(Ki,De.NOTEQUAL,"notequal"),Ki),GS=(os={},et(os,De.FUNC_ADD,"add"),et(os,De.MIN_EXT,"min"),et(os,De.MAX_EXT,"max"),et(os,De.FUNC_SUBTRACT,"subtract"),et(os,De.FUNC_REVERSE_SUBTRACT,"reverse subtract"),os),Ch=(En={},et(En,De.ZERO,"zero"),et(En,De.ONE,"one"),et(En,De.SRC_COLOR,"src color"),et(En,De.ONE_MINUS_SRC_COLOR,"one minus src color"),et(En,De.SRC_ALPHA,"src alpha"),et(En,De.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),et(En,De.DST_COLOR,"dst color"),et(En,De.ONE_MINUS_DST_COLOR,"one minus dst color"),et(En,De.DST_ALPHA,"dst alpha"),et(En,De.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),et(En,De.CONSTANT_COLOR,"constant color"),et(En,De.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),et(En,De.CONSTANT_ALPHA,"constant alpha"),et(En,De.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),et(En,De.SRC_ALPHA_SATURATE,"src alpha saturate"),En),Yse=(qi={},et(qi,De.NEVER,"never"),et(qi,De.ALWAYS,"always"),et(qi,De.LESS,"less"),et(qi,De.LEQUAL,"lequal"),et(qi,De.GREATER,"greater"),et(qi,De.GEQUAL,"gequal"),et(qi,De.EQUAL,"equal"),et(qi,De.NOTEQUAL,"notequal"),qi),fu=(Zi={},et(Zi,De.ZERO,"zero"),et(Zi,De.KEEP,"keep"),et(Zi,De.REPLACE,"replace"),et(Zi,De.INVERT,"invert"),et(Zi,De.INCR,"increment"),et(Zi,De.DECR,"decrement"),et(Zi,De.INCR_WRAP,"increment wrap"),et(Zi,De.DECR_WRAP,"decrement wrap"),Zi),Vse=(Mh={},et(Mh,De.FRONT,"front"),et(Mh,De.BACK,"back"),Mh),Hse=function(){function r(t,e){Ri(this,r),this.buffer=void 0;var n=e.data,i=e.usage,a=e.type;this.buffer=t.buffer({data:n,usage:kk[i||De.STATIC_DRAW],type:hb[a||De.UNSIGNED_BYTE]})}return Bi(r,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(e){var n=e.data,i=e.offset;this.buffer.subdata(n,i)}}]),r}();function Kse(r){if(Array.isArray(r))return S0(r)}function qse(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Zse(){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 Qse(r){return Kse(r)||qse(r)||u3(r)||Zse()}function zS(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),e.push.apply(e,n)}return e}function jS(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?zS(Object(e),!0).forEach(function(n){et(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):zS(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}var Jse=`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
- }`,US=0,eue=function(){function r(t,e){var n=this;Ri(this,r),this.reGl=t,this.context=e,this.entity=Ok(),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===Ku.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===Ku.Uniform){if(h&&(Array.isArray(h)||Kd(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:Jse,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return Bi(r,[{key:"run",value:function(){var e=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(){e.computeCommand()})}},{key:"readData",value:function(){var t=Co(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 e(){return t.apply(this,arguments)}return e}()},{key:"confirmInput",value:function(e,n){var i;this.entity===e.entity?(this.dynamicPingpong=!0,i=this):i=e,this.textureCache[n].id=i.getOuputDataTexture().id,this.textureCache[n].texture=i.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(e,n){var i=this.context.uniforms.find(function(u){var f=u.name;return f===e});if(i){var a=this.calcDataTexture(e,i.type,n),o=a.texture,s=a.data;this.textureCache[e].data=s,this.textureCache[e].texture=o}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var e=this.context.output.name;this.textureCache[e].id=this.getOuputDataTexture().id,this.textureCache[e].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 e=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=e}},{key:"cloneDataTexture",value:function(e){var n=e.data,i=e.textureWidth;return jS(jS({},e),{},{id:US++,texture:this.reGl.texture({width:i,height:i,data:n,type:"float"})})}},{key:"calcDataTexture",value:function(e,n,i){var a=1;n===Ol.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,Qse(new Array((c-f)*4).fill(0)));var h=this.reGl.texture({width:l,height:l,data:o,type:"float"});return{id:US++,data:o,originalDataLength:u,typedArrayConstructor:Kd(i)?i.constructor:void 0,textureWidth:l,texture:h,texelCount:f,elementsPerTexel:a,isOutput:e===this.context.output.name}}}]),r}(),tue=function(){function r(t,e){Ri(this,r),this.elements=void 0;var n=e.data,i=e.usage,a=e.type,o=e.count;this.elements=t.elements({data:n,usage:kk[i||De.STATIC_DRAW],type:hb[a||De.UNSIGNED_BYTE],count:o})}return Bi(r,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(e){var n=e.data;this.elements.subdata(n)}},{key:"destroy",value:function(){this.elements.destroy()}}]),r}(),rue=function(){function r(t,e){Ri(this,r),this.framebuffer=void 0;var n=e.width,i=e.height,a=e.color,o=e.colors;e.depth,e.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=t.framebuffer(s)}return Bi(r,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(e){var n=e.width,i=e.height;this.framebuffer.resize(n,i)}}]),r}();function nue(r,t){return function(e){return r(t(e))}}var iue=nue,aue=iue,oue=aue(Object.getPrototypeOf,Object),sue=oue,uue=lb,fue=sue,lue=cb,cue="[object Object]",hue=Function.prototype,due=Object.prototype,Pk=hue.toString,vue=due.hasOwnProperty,pue=Pk.call(Object);function gue(r){if(!lue(r)||uue(r)!=cue)return!1;var t=fue(r);if(t===null)return!0;var e=vue.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&Pk.call(e)==pue}var yue=gue;const mue=ba(yue);function d0(r){var t={};return Object.keys(r).forEach(function(e){Vy(e,r[e],t,"")}),t}function Vy(r,t,e,n){if(t===null||typeof t=="number"||typeof t=="boolean"||Array.isArray(t)&&typeof t[0]=="number"||Kd(t)||t===""||t.resize!==void 0){e["".concat(n&&n+".").concat(r)]=t;return}mue(t)&&Object.keys(t).forEach(function(i){Vy(i,t[i],e,"".concat(n&&n+".").concat(r))}),Array.isArray(t)&&t.forEach(function(i,a){Object.keys(i).forEach(function(o){Vy(o,i[o],e,"".concat(n&&n+".").concat(r,"[").concat(a,"]"))})})}function $S(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),e.push.apply(e,n)}return e}function lu(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?$S(Object(e),!0).forEach(function(n){et(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):$S(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}var bue=function(){function r(t,e){Ri(this,r),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=t;var n=e.vs,i=e.fs,a=e.defines,o=e.attributes,s=e.uniforms,u=e.primitive,f=e.count,l=e.elements,c=e.depth,h=e.blend,d=e.stencil,v=e.cull,p=e.instances,g=e.scissor,y=e.viewport,m={};s&&(this.uniforms=d0(s),Object.keys(s).forEach(function(w){m[w]=t.prop(w)}));var b={};Object.keys(o).forEach(function(w){b[w]=o[w].get()});var x=a&&this.generateDefines(a)||"",E={attributes:b,frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
62
- precision highp float;
63
- #else
64
- precision mediump float;
65
- #endif
66
- `.concat(x,`
67
- `).concat(i),uniforms:m,vert:`
68
- `.concat(x,`
69
- `).concat(n),primitive:jse[u===void 0?De.TRIANGLES:u]};p&&(E.instances=p),f&&(E.count=f),l&&(E.elements=l.get()),g&&(E.scissor=g),y&&(E.viewport=y),this.initDepthDrawParams({depth:c},E),this.initBlendDrawParams({blend:h},E),this.initStencilDrawParams({stencil:d},E),this.initCullDrawParams({cull:v},E),this.drawCommand=t(E)}return Bi(r,[{key:"addUniforms",value:function(e){this.uniforms=lu(lu({},this.uniforms),d0(e))}},{key:"draw",value:function(e){var n=lu(lu({},this.uniforms),d0(e.uniforms||{})),i={};Object.keys(n).forEach(function(a){var o=fd(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(e,n){var i=e.depth;i&&(n.depth={enable:i.enable===void 0?!0:!!i.enable,mask:i.mask===void 0?!0:!!i.mask,func:Xse[i.func||De.LESS],range:i.range||[0,1]})}},{key:"initBlendDrawParams",value:function(e,n){var i=e.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:Ch[o&&o.srcRGB||De.SRC_ALPHA],srcAlpha:Ch[o&&o.srcAlpha||De.SRC_ALPHA],dstRGB:Ch[o&&o.dstRGB||De.ONE_MINUS_SRC_ALPHA],dstAlpha:Ch[o&&o.dstAlpha||De.ONE_MINUS_SRC_ALPHA]},equation:{rgb:GS[s&&s.rgb||De.FUNC_ADD],alpha:GS[s&&s.alpha||De.FUNC_ADD]},color:f}}}},{key:"initStencilDrawParams",value:function(e,n){var i=e.stencil;if(i){var a=i.enable,o=i.mask,s=o===void 0?-1:o,u=i.func,f=u===void 0?{cmp:De.ALWAYS,ref:0,mask:-1}:u,l=i.opFront,c=l===void 0?{fail:De.KEEP,zfail:De.KEEP,zpass:De.KEEP}:l,h=i.opBack,d=h===void 0?{fail:De.KEEP,zfail:De.KEEP,zpass:De.KEEP}:h;n.stencil={enable:!!a,mask:s,func:lu(lu({},f),{},{cmp:Yse[f.cmp]}),opFront:{fail:fu[c.fail],zfail:fu[c.zfail],zpass:fu[c.zpass]},opBack:{fail:fu[d.fail],zfail:fu[d.zfail],zpass:fu[d.zpass]}}}}},{key:"initCullDrawParams",value:function(e,n){var i=e.cull;if(i){var a=i.enable,o=i.face,s=o===void 0?De.BACK:o;n.cull={enable:!!a,face:Vse[s]}}}},{key:"generateDefines",value:function(e){return Object.keys(e).map(function(n){return"#define ".concat(n," ").concat(Number(e[n]))}).join(`
70
- `)}}]),r}(),xue=function(){function r(t,e){Ri(this,r),this.texture=void 0,this.width=void 0,this.height=void 0;var n=e.data,i=e.type,a=i===void 0?De.UNSIGNED_BYTE:i,o=e.width,s=e.height,u=e.flipY,f=u===void 0?!1:u,l=e.format,c=l===void 0?De.RGBA:l,h=e.mipmap,d=h===void 0?!1:h,v=e.wrapS,p=v===void 0?De.CLAMP_TO_EDGE:v,g=e.wrapT,y=g===void 0?De.CLAMP_TO_EDGE:g,m=e.aniso,b=m===void 0?0:m,x=e.alignment,E=x===void 0?1:x,w=e.premultiplyAlpha,_=w===void 0?!1:w,M=e.mag,C=M===void 0?De.NEAREST:M,S=e.min,A=S===void 0?De.NEAREST:S,T=e.colorSpace,I=T===void 0?De.BROWSER_DEFAULT_WEBGL:T;this.width=o,this.height=s;var D={width:o,height:s,type:hb[a],format:Use[c],wrapS:FS[p],wrapT:FS[y],mag:BS[C],min:BS[A],alignment:E,flipY:f,colorSpace:Wse[I],premultiplyAlpha:_,aniso:b};n&&(D.data=n),typeof d=="number"?D.mipmap=$se[d]:typeof d=="boolean"&&(D.mipmap=d),this.texture=t.texture(D)}return Bi(r,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(e){var n=e.width,i=e.height;this.texture.resize(n,i),this.width=n,this.height=i}},{key:"destroy",value:function(){this.texture.destroy()}}]),r}(),Eue=function(){function r(){var t=this;Ri(this,r),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var e=Co(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=Co(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 bue(t.gl,i));case 4:case"end":return o.stop()}},n)}));return function(n){return e.apply(this,arguments)}}(),this.createAttribute=function(e){return new zse(t.gl,e)},this.createBuffer=function(e){return new Hse(t.gl,e)},this.createElements=function(e){return new tue(t.gl,e)},this.createTexture2D=function(e){return new xue(t.gl,e)},this.createFramebuffer=function(e){return new rue(t.gl,e)},this.useFramebuffer=function(e,n){t.gl({framebuffer:e?e.get():null})(n)},this.createComputeModel=function(){var e=Co(Mn.mark(function n(i){return Mn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new eue(t.gl,i));case 1:case"end":return o.stop()}},n)}));return function(n){return e.apply(this,arguments)}}(),this.clear=function(e){var n=e.color,i=e.depth,a=e.stencil,o=e.framebuffer,s=o===void 0?null:o,u={color:n,depth:i,stencil:a};u.framebuffer=s===null?s:s.get(),t.gl.clear(u)},this.setScissor=function(e){t.gl&&t.gl._gl&&(e.enable&&e.box?(t.gl._gl.enable(De.SCISSOR_TEST),t.gl._gl.scissor(e.box.x,e.box.y,e.box.width,e.box.height)):t.gl._gl.disable(De.SCISSOR_TEST),t.gl._refresh())},this.viewport=function(e){var n=e.x,i=e.y,a=e.width,o=e.height;t.gl&&t.gl._gl&&(t.gl._gl.viewport(n,i,a,o),t.gl._refresh())},this.readPixels=function(e){var n=e.framebuffer,i=e.x,a=e.y,o=e.width,s=e.height,u={x:i,y:a,width:o,height:s};return n&&(u.framebuffer=n.get()),t.gl.read(u)},this.getCanvas=function(){return t.$canvas},this.getGLContext=function(){return t.gl._gl},this.destroy=function(){t.gl&&(t.gl.destroy(),t.inited=!1)}}return Bi(r,[{key:"init",value:function(){var t=Co(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){Gse({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 e(n){return t.apply(this,arguments)}return e}()},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),r}(),wue=function(){function r(){Ri(this,r),this.engine=void 0,this.configService=new Nse}return Bi(r,[{key:"setConfig",value:function(e){this.configService.set(e)}},{key:"setEngine",value:function(e){this.engine=e}},{key:"createEntity",value:function(){return Ok()}},{key:"createKernel",value:function(e){var n=new Lk(this.engine,this.configService);return typeof e=="string"?n.setBundle(JSON.parse(e)):n.setBundle(e),n.init(),n}},{key:"destroy",value:function(){this.engine.destroy()}}],[{key:"create",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=new r;return n.setConfig(e),n.setEngine(new Eue),n}}]),r}();const _ue=Object.freeze(Object.defineProperty({__proto__:null,Kernel:Lk,World:wue},Symbol.toStringTag,{value:"Module"})),Nk=ma(_ue);var Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.arrayToTextureData=Qn.attributesToTextureData=Qn.buildTextureDataWithTwoEdgeAttr=Qn.buildTextureData=Qn.proccessToFunc=void 0;var Sue=Nr(),qd=Iv,Mue=function(r,t){var e;return r?(0,Sue.isNumber)(r)?e=function(){return r}:e=r:e=function(){return t||1},e};Qn.proccessToFunc=Mue;var Cue=function(r,t){var e=[],n=[],i={},a=0;for(a=0;a<r.length;a++){var o=r[a];i[o.id]=a,e.push(o.x),e.push(o.y),e.push(0),e.push(0),n.push([])}for(a=0;a<t.length;a++){var s=t[a],u=(0,qd.getEdgeTerminal)(s,"source"),f=(0,qd.getEdgeTerminal)(s,"target");!isNaN(i[u])&&!isNaN(i[f])&&(n[i[u]].push(i[f]),n[i[f]].push(i[u]))}var l=0;for(a=0;a<r.length;a++){var c=e.length,h=n[a],d=h.length;e[a*4+2]=c,e[a*4+3]=d,l=Math.max(l,d);for(var v=0;v<d;++v){var p=h[v];e.push(+p)}}for(;e.length%4!==0;)e.push(0);return{maxEdgePerVetex:l,array:new Float32Array(e)}};Qn.buildTextureData=Cue;var Aue=function(r,t,e,n){var i=[],a=[],o={},s=0;for(s=0;s<r.length;s++){var u=r[s];o[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),a.push([])}for(s=0;s<t.length;s++){var f=t[s],l=(0,qd.getEdgeTerminal)(f,"source"),c=(0,qd.getEdgeTerminal)(f,"target");a[o[l]].push(o[c]),a[o[l]].push(e(f)),a[o[l]].push(n(f)),a[o[l]].push(0),a[o[c]].push(o[l]),a[o[c]].push(e(f)),a[o[c]].push(n(f)),a[o[c]].push(0)}var h=0;for(s=0;s<r.length;s++){var d=i.length,v=a[s],p=v.length;i[s*4+2]=d+1048576*p/4,i[s*4+3]=0,h=Math.max(h,p/4);for(var g=0;g<p;++g){var y=v[g];i.push(+y)}}for(;i.length%4!==0;)i.push(0);return{maxEdgePerVetex:h,array:new Float32Array(i)}};Qn.buildTextureDataWithTwoEdgeAttr=Aue;var Tue=function(r,t){var e=[],n=r.length,i={};return t.forEach(function(a){r.forEach(function(o,s){if(i[a[o]]===void 0&&(i[a[o]]=Object.keys(i).length),e.push(i[a[o]]),s===n-1)for(;e.length%4!==0;)e.push(0)})}),{array:new Float32Array(e),count:Object.keys(i).length}};Qn.attributesToTextureData=Tue;var Iue=function(r){for(var t=[],e=r.length,n=r[0].length,i=function(o){r.forEach(function(s,u){if(t.push(s[o]),u===e-1)for(;t.length%4!==0;)t.push(0)})},a=0;a<n;a++)i(a);return new Float32Array(t)};Qn.arrayToTextureData=Iue;var la={};Object.defineProperty(la,"__esModule",{value:!0});la.clusterBundle=la.clusterCode=la.fruchtermanBundle=la.fruchtermanCode=void 0;la.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
- `;la.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}}';la.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
- `;la.clusterBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}';var Oue=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ah=xe&&xe.__awaiter||function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(o){o(a)})}return new(e||(e=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,t||[])).next())})},Th=xe&&xe.__generator||function(r,t){var e={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]&&(e=0)),e;)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 e.label++,{value:f[1],done:!1};case 5:e.label++,i=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){e.label=f[1];break}if(f[0]===6&&e.label<a[1]){e.label=a[1],a=f;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(f);break}a[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(r,e)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(ac,"__esModule",{value:!0});ac.FruchtermanGPULayout=void 0;var Lue=Wr,cu=Nr(),WS=Nk,XS=Qn,YS=la,Due=qa,kue=function(r){Oue(t,r);function t(e){var n=r.call(this)||this;return n.maxIteration=1e3,n.gravity=10,n.speed=1,n.clustering=!1,n.clusterField="cluster",n.clusterGravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},t.prototype.execute=function(){return Ah(this,void 0,void 0,function(){var e,n,i,a,o,s=this;return Th(this,function(u){switch(u.label){case 0:return e=this,n=e.nodes,!n||n.length===0?(e.onLayoutEnd&&e.onLayoutEnd(),[2]):(!e.width&&typeof window<"u"&&(e.width=window.innerWidth),!e.height&&typeof window<"u"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]),i=e.center,n.length===1?(n[0].x=i[0],n[0].y=i[1],e.onLayoutEnd&&e.onLayoutEnd(),[2]):(a={},o={},n.forEach(function(f,l){(0,cu.isNumber)(f.x)||(f.x=Math.random()*s.width),(0,cu.isNumber)(f.y)||(f.y=Math.random()*s.height),a[f.id]=f,o[f.id]=l}),e.nodeMap=a,e.nodeIdxMap=o,[4,e.run()]));case 1:return u.sent(),[2]}})})},t.prototype.executeWithWorker=function(e,n){return Ah(this,void 0,void 0,function(){var i,a,o,s,u,f=this;return Th(this,function(l){switch(l.label){case 0:return i=this,a=i.nodes,o=i.center,!a||a.length===0?[2]:a.length===1?(a[0].x=o[0],a[0].y=o[1],[2]):(s={},u={},a.forEach(function(c,h){(0,cu.isNumber)(c.x)||(c.x=Math.random()*f.width),(0,cu.isNumber)(c.y)||(c.y=Math.random()*f.height),s[c.id]=c,u[c.id]=h}),i.nodeMap=s,i.nodeIdxMap=u,[4,i.run(e,n)]);case 1:return l.sent(),[2]}})})},t.prototype.run=function(e,n){return Ah(this,void 0,void 0,function(){var i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b,x,E,w,_,M,C,S,A,T,I,D=this;return Th(this,function(N){switch(N.label){case 0:for(i=this,a=i.nodes,o=i.edges,s=i.maxIteration,u=i.center,f=i.height*i.width,l=Math.sqrt(f)/10,c=f/(a.length+1),h=Math.sqrt(c),d=i.speed,v=i.clustering,p=(0,XS.attributesToTextureData)([i.clusterField],a),g=p.array,y=p.count,a.forEach(function(P,G){var W=0,k=0;(0,cu.isNumber)(P.fx)&&(0,cu.isNumber)(P.fy)&&(W=P.fx||.001,k=P.fy||.001),g[4*G+1]=W,g[4*G+2]=k}),m=a.length,b=(0,XS.buildTextureData)(a,o),x=b.maxEdgePerVetex,E=b.array,w=i.workerEnabled,w?_=WS.World.create({canvas:e,engineOptions:{supportCompute:!0}}):_=WS.World.create({engineOptions:{supportCompute:!0}}),M=i.onLayoutEnd,C=[],S=0;S<y;S++)C.push(0,0,0,0);return A=_.createKernel(YS.fruchtermanBundle).setDispatch([m,1,1]).setBinding({u_Data:E,u_K:h,u_K2:c,u_Gravity:i.gravity,u_ClusterGravity:i.clusterGravity||i.gravity||1,u_Speed:d,u_MaxDisplace:l,u_Clustering:v?1:0,u_Center:u,u_AttributeArray:g,u_ClusterCenters:C,MAX_EDGE_PER_VERTEX:x,VERTEX_COUNT:m}),v&&(T=_.createKernel(YS.clusterBundle).setDispatch([y,1,1]).setBinding({u_Data:E,u_NodeAttributes:g,u_ClusterCenters:C,VERTEX_COUNT:m,CLUSTER_COUNT:y})),I=function(){return Ah(D,void 0,void 0,function(){var P,G;return Th(this,function(W){switch(W.label){case 0:P=0,W.label=1;case 1:return P<s?[4,A.execute()]:[3,6];case 2:return W.sent(),v?(T.setBinding({u_Data:A}),[4,T.execute()]):[3,4];case 3:W.sent(),A.setBinding({u_ClusterCenters:T}),W.label=4;case 4:A.setBinding({u_MaxDisplace:l*=.99}),W.label=5;case 5:return P++,[3,1];case 6:return[4,A.getOutput()];case 7:return G=W.sent(),e?n.postMessage({type:Due.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:G}):a.forEach(function(k,R){var Y=G[4*R],J=G[4*R+1];k.x=Y,k.y=J}),M&&M(),[2]}})})},[4,I()];case 1:return N.sent(),[2]}})})},t.prototype.getType=function(){return"fruchterman-gpu"},t}(Lue.Base);ac.FruchtermanGPULayout=kue;var oc={},ca={};Object.defineProperty(ca,"__esModule",{value:!0});ca.aveMovementBundle=ca.aveMovementCode=ca.gForceBundle=ca.gForceCode=void 0;ca.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
- `;ca.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}}';ca.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
- `;ca.aveMovementBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}';var Pue=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),v0=xe&&xe.__awaiter||function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(o){o(a)})}return new(e||(e=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,t||[])).next())})},p0=xe&&xe.__generator||function(r,t){var e={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]&&(e=0)),e;)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 e.label++,{value:f[1],done:!1};case 5:e.label++,i=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){e.label=f[1];break}if(f[0]===6&&e.label<a[1]){e.label=a[1],a=f;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(f);break}a[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(r,e)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(oc,"__esModule",{value:!0});oc.GForceGPULayout=void 0;var Nue=Wr,Ba=Nr(),VS=Nk,Fa=Qn,Rue=Iv,HS=ca,Bue=qa,Fue=function(r){Pue(t,r);function t(e){var n=r.call(this)||this;return n.maxIteration=1e3,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},t.prototype.execute=function(){return v0(this,void 0,void 0,function(){var e,n,i,a,o;return p0(this,function(s){switch(s.label){case 0:return e=this,n=e.nodes,!n||n.length===0?(e.onLayoutEnd&&e.onLayoutEnd(),[2]):(!e.width&&typeof window<"u"&&(e.width=window.innerWidth),!e.height&&typeof window<"u"&&(e.height=window.innerHeight),e.center||(e.center=[e.width/2,e.height/2]),i=e.center,n.length===1?(n[0].x=i[0],n[0].y=i[1],e.onLayoutEnd&&e.onLayoutEnd(),[2]):(a={},o={},n.forEach(function(u,f){(0,Ba.isNumber)(u.x)||(u.x=Math.random()*e.width),(0,Ba.isNumber)(u.y)||(u.y=Math.random()*e.height),a[u.id]=u,o[u.id]=f}),e.nodeMap=a,e.nodeIdxMap=o,e.nodeStrength=(0,Fa.proccessToFunc)(e.nodeStrength,1),e.edgeStrength=(0,Fa.proccessToFunc)(e.edgeStrength,1),[4,e.run()]));case 1:return s.sent(),[2]}})})},t.prototype.executeWithWorker=function(e,n){var i=this,a=i.nodes,o=i.center;if(!(!a||a.length===0)){if(a.length===1){a[0].x=o[0],a[0].y=o[1];return}var s={},u={};a.forEach(function(f,l){(0,Ba.isNumber)(f.x)||(f.x=Math.random()*i.width),(0,Ba.isNumber)(f.y)||(f.y=Math.random()*i.height),s[f.id]=f,u[f.id]=l}),i.nodeMap=s,i.nodeIdxMap=u,i.nodeStrength=(0,Fa.proccessToFunc)(i.nodeStrength,1),i.edgeStrength=(0,Fa.proccessToFunc)(i.edgeStrength,1),i.run(e,n)}},t.prototype.run=function(e,n){return v0(this,void 0,void 0,function(){var i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b,x,E,w,_,M,C,S,A,T,I,D,N=this;return p0(this,function(P){switch(P.label){case 0:for(i=this,a=i.nodes,o=i.edges,s=i.maxIteration,!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),u=a.length,i.linkDistance=(0,Fa.proccessToFunc)(i.linkDistance),i.edgeStrength=(0,Fa.proccessToFunc)(i.edgeStrength),f=(0,Fa.buildTextureDataWithTwoEdgeAttr)(a,o,i.linkDistance,i.edgeStrength),l=f.maxEdgePerVetex,c=f.array,i.degrees=(0,Rue.getDegree)(a.length,i.nodeIdxMap,o).map(function(G){return G.all}),h=[],d=[],v=[],p=[],g=[],y=[],m=[],i.getMass||(i.getMass=function(G){return i.degrees[i.nodeIdxMap[G.id]]||1}),b=i.gravity,x=i.center,a.forEach(function(G,W){h.push(i.getMass(G)),d.push(i.nodeStrength(G)),i.degrees[W]||(i.degrees[W]=0);var k=[x[0],x[1],b];if(i.getCenter){var R=i.getCenter(G,i.degrees[W]);R&&(0,Ba.isNumber)(R[0])&&(0,Ba.isNumber)(R[1])&&(0,Ba.isNumber)(R[2])&&(k=R)}v.push(k[0]),p.push(k[1]),g.push(k[2]),(0,Ba.isNumber)(G.fx)&&(0,Ba.isNumber)(G.fy)?(y.push(G.fx||.001),m.push(G.fy||.001)):(y.push(0),m.push(0))}),E=(0,Fa.arrayToTextureData)([h,i.degrees,d,y]),w=(0,Fa.arrayToTextureData)([v,p,g,m]),_=i.workerEnabled,_?M=VS.World.create({canvas:e,engineOptions:{supportCompute:!0}}):M=VS.World.create({engineOptions:{supportCompute:!0}}),C=i.onLayoutEnd,S=[],c.forEach(function(G){S.push(G)}),A=0;A<4;A++)S.push(0);return T=M.createKernel(HS.gForceBundle).setDispatch([u,1,1]).setBinding({u_Data:c,u_damping:i.damping,u_maxSpeed:i.maxSpeed,u_minMovement:i.minMovement,u_coulombDisScale:i.coulombDisScale,u_factor:i.factor,u_NodeAttributeArray1:E,u_NodeAttributeArray2:w,MAX_EDGE_PER_VERTEX:l,VERTEX_COUNT:u,u_AveMovement:S,u_interval:i.interval}),I=M.createKernel(HS.aveMovementBundle).setDispatch([1,1,1]).setBinding({u_Data:c,VERTEX_COUNT:u,u_AveMovement:[0,0,0,0]}),D=function(){return v0(N,void 0,void 0,function(){var G,W,k;return p0(this,function(R){switch(R.label){case 0:G=0,R.label=1;case 1:return G<s?[4,T.execute()]:[3,5];case 2:return R.sent(),I.setBinding({u_Data:T}),[4,I.execute()];case 3:R.sent(),W=Math.max(.02,i.interval-G*.002),T.setBinding({u_interval:W,u_AveMovement:I}),R.label=4;case 4:return G++,[3,1];case 5:return[4,T.getOutput()];case 6:return k=R.sent(),e?n.postMessage({type:Bue.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:k}):a.forEach(function(Y,J){var te=k[4*J],H=k[4*J+1];Y.x=te,Y.y=H}),C&&C(),[2]}})})},[4,D()];case 1:return P.sent(),[2]}})})},t.prototype.getType=function(){return"gForce-gpu"},t}(Nue.Base);oc.GForceGPULayout=Fue;var sc={},Gue=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(sc,"__esModule",{value:!0});sc.ComboForceLayout=void 0;var zue=Wr,Yt=Nr(),jue=function(r){Gue(t,r);function t(e){var n=r.call(this)||this;return n.center=[0,0],n.maxIteration=100,n.gravity=10,n.comboGravity=10,n.linkDistance=10,n.alpha=1,n.alphaMin=.001,n.alphaDecay=1-Math.pow(n.alphaMin,1/300),n.alphaTarget=0,n.velocityDecay=.6,n.edgeStrength=.6,n.nodeStrength=30,n.preventOverlap=!1,n.preventNodeOverlap=!1,n.preventComboOverlap=!1,n.collideStrength=void 0,n.nodeCollideStrength=.5,n.comboCollideStrength=.5,n.comboSpacing=20,n.comboPadding=10,n.optimizeRangeFactor=1,n.onTick=function(){},n.onLayoutEnd=function(){},n.depthAttractiveForceScale=1,n.depthRepulsiveForceScale=2,n.nodes=[],n.edges=[],n.combos=[],n.comboTrees=[],n.width=300,n.height=300,n.bias=[],n.nodeMap={},n.oriComboMap={},n.indexMap={},n.comboMap={},n.previousLayouted=!1,n.updateCfg(e),n}return t.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}},t.prototype.execute=function(){var e=this,n=e.nodes,i=e.center;if(e.comboTree={id:"comboTreeRoot",depth:-1,children:e.comboTrees},!n||n.length===0){e.onLayoutEnd&&e.onLayoutEnd();return}if(n.length===1){n[0].x=i[0],n[0].y=i[1],e.onLayoutEnd&&e.onLayoutEnd();return}e.initVals(),e.run(),e.onLayoutEnd&&e.onLayoutEnd()},t.prototype.run=function(){var e=this,n=e.nodes,i=e.previousLayouted?e.maxIteration/5:e.maxIteration;!e.width&&typeof window<"u"&&(e.width=window.innerWidth),!e.height&&typeof window<"u"&&(e.height=window.innerHeight);var a=e.center,o=e.velocityDecay,s=e.comboMap;e.previousLayouted||e.initPos(s);for(var u=function(h){var d=[];n.forEach(function(v,p){d[p]={x:0,y:0}}),e.applyCalculate(d),e.applyComboCenterForce(d),n.forEach(function(v,p){!(0,Yt.isNumber)(v.x)||!(0,Yt.isNumber)(v.y)||(v.x+=d[p].x*o,v.y+=d[p].y*o)}),e.alpha+=(e.alphaTarget-e.alpha)*e.alphaDecay,e.onTick()},f=0;f<i;f++)u();var l=[0,0];n.forEach(function(h){!(0,Yt.isNumber)(h.x)||!(0,Yt.isNumber)(h.y)||(l[0]+=h.x,l[1]+=h.y)}),l[0]/=n.length,l[1]/=n.length;var c=[a[0]-l[0],a[1]-l[1]];n.forEach(function(h,d){!(0,Yt.isNumber)(h.x)||!(0,Yt.isNumber)(h.y)||(h.x+=c[0],h.y+=c[1])}),e.combos.forEach(function(h){var d=s[h.id];d&&d.empty&&(h.x=d.cx||h.x,h.y=d.cy||h.y)}),e.previousLayouted=!0},t.prototype.initVals=function(){var e=this,n=e.edges,i=e.nodes,a=e.combos,o={},s={},u={};i.forEach(function(G,W){s[G.id]=G,u[G.id]=W}),e.nodeMap=s,e.indexMap=u;var f={};a.forEach(function(G){f[G.id]=G}),e.oriComboMap=f,e.comboMap=e.getComboMap();var l=e.preventOverlap;e.preventComboOverlap=e.preventComboOverlap||l,e.preventNodeOverlap=e.preventNodeOverlap||l;var c=e.collideStrength;c&&(e.comboCollideStrength=c,e.nodeCollideStrength=c),e.comboCollideStrength=e.comboCollideStrength?e.comboCollideStrength:0,e.nodeCollideStrength=e.nodeCollideStrength?e.nodeCollideStrength:0;for(var h=0;h<n.length;++h){var d=(0,Yt.getEdgeTerminal)(n[h],"source"),v=(0,Yt.getEdgeTerminal)(n[h],"target");o[d]?o[d]++:o[d]=1,o[v]?o[v]++:o[v]=1}for(var p=[],h=0;h<n.length;++h){var d=(0,Yt.getEdgeTerminal)(n[h],"source"),v=(0,Yt.getEdgeTerminal)(n[h],"target");p[h]=o[d]/(o[d]+o[v])}this.bias=p;var g=e.nodeSize,y=e.nodeSpacing,m,b;if((0,Yt.isNumber)(y)?b=function(){return y}:(0,Yt.isFunction)(y)?b=y:b=function(){return 0},this.nodeSpacing=b,!g)m=function(G){if(G.size){if((0,Yt.isArray)(G.size)){var W=G.size[0]>G.size[1]?G.size[0]:G.size[1];return W/2}if((0,Yt.isObject)(G.size)){var W=G.size.width>G.size.height?G.size.width:G.size.height;return W/2}return G.size/2}return 10};else if((0,Yt.isFunction)(g))m=function(G){return g(G)};else if((0,Yt.isArray)(g)){var x=g[0]>g[1]?g[0]:g[1],E=x/2;m=function(G){return E}}else{var w=g/2;m=function(G){return w}}this.nodeSize=m;var _=e.comboSpacing,M;(0,Yt.isNumber)(_)?M=function(){return _}:(0,Yt.isFunction)(_)?M=_:M=function(){return 0},this.comboSpacing=M;var C=e.comboPadding,S;(0,Yt.isNumber)(C)?S=function(){return C}:(0,Yt.isArray)(C)?S=function(){return Math.max.apply(null,C)}:(0,Yt.isFunction)(C)?S=C:S=function(){return 0},this.comboPadding=S;var A=this.linkDistance,T;A||(A=10),(0,Yt.isNumber)(A)?T=function(G){return A}:T=A,this.linkDistance=T;var I=this.edgeStrength,D;I||(I=1),(0,Yt.isNumber)(I)?D=function(G){return I}:D=I,this.edgeStrength=D;var N=this.nodeStrength,P;N||(N=30),(0,Yt.isNumber)(N)?P=function(G){return N}:P=N,this.nodeStrength=P},t.prototype.initPos=function(e){var n=this,i=n.nodes;i.forEach(function(a,o){var s=a.comboId,u=e[s];s&&u?(a.x=u.cx+100/(o+1),a.y=u.cy+100/(o+1)):(a.x=100/(o+1),a.y=100/(o+1))})},t.prototype.getComboMap=function(){var e=this,n=e.nodeMap,i=e.comboTrees,a=e.oriComboMap,o={};return(i||[]).forEach(function(s){var u=[];(0,Yt.traverseTreeUp)(s,function(f){if(f.itemType==="node"||!a[f.id])return!0;if(o[f.id]===void 0){var l={id:f.id,name:f.id,cx:0,cy:0,count:0,depth:e.oriComboMap[f.id].depth||0,children:[]};o[f.id]=l}var c=f.children;c&&c.forEach(function(v){if(!o[v.id]&&!n[v.id])return!0;u.push(v)});var h=o[f.id];if(h.cx=0,h.cy=0,u.length===0){h.empty=!0;var d=a[f.id];h.cx=d.x,h.cy=d.y}return u.forEach(function(v){if(h.count++,v.itemType!=="node"){var p=o[v.id];(0,Yt.isNumber)(p.cx)&&(h.cx+=p.cx),(0,Yt.isNumber)(p.cy)&&(h.cy+=p.cy);return}var g=n[v.id];g&&((0,Yt.isNumber)(g.x)&&(h.cx+=g.x),(0,Yt.isNumber)(g.y)&&(h.cy+=g.y))}),h.cx/=h.count||1,h.cy/=h.count||1,h.children=u,!0})}),o},t.prototype.applyComboCenterForce=function(e){var n=this,i=n.gravity,a=n.comboGravity||i,o=this.alpha,s=n.comboTrees,u=n.indexMap,f=n.nodeMap,l=n.comboMap;(s||[]).forEach(function(c){(0,Yt.traverseTreeUp)(c,function(h){if(h.itemType==="node")return!0;var d=l[h.id];if(!d)return!0;var v=l[h.id],p=(v.depth+1)/10*.5,g=v.cx,y=v.cy;return v.cx=0,v.cy=0,v.children.forEach(function(m){if(m.itemType!=="node"){var b=l[m.id];b&&(0,Yt.isNumber)(b.cx)&&(v.cx+=b.cx),b&&(0,Yt.isNumber)(b.cy)&&(v.cy+=b.cy);return}var x=f[m.id],E=x.x-g||.005,w=x.y-y||.005,_=Math.sqrt(E*E+w*w),M=u[x.id],C=a*o/_*p;e[M].x-=E*C,e[M].y-=w*C,(0,Yt.isNumber)(x.x)&&(v.cx+=x.x),(0,Yt.isNumber)(x.y)&&(v.cy+=x.y)}),v.cx/=v.count||1,v.cy/=v.count||1,!0})})},t.prototype.applyCalculate=function(e){var n=this,i=n.comboMap,a=n.nodes,o={};a.forEach(function(u,f){a.forEach(function(l,c){if(!(f<c)){var h=u.x-l.x||.005,d=u.y-l.y||.005,v=h*h+d*d,p=Math.sqrt(v);v<1&&(v=p),o["".concat(u.id,"-").concat(l.id)]={vx:h,vy:d,vl2:v,vl:p},o["".concat(l.id,"-").concat(u.id)]={vl2:v,vl:p,vx:-h,vy:-d}}})}),n.updateComboSizes(i),n.calRepulsive(e,o),n.calAttractive(e,o);var s=n.preventComboOverlap;s&&n.comboNonOverlapping(e,i)},t.prototype.updateComboSizes=function(e){var n=this,i=n.comboTrees,a=n.nodeMap,o=n.nodeSize,s=n.comboSpacing,u=n.comboPadding;(i||[]).forEach(function(f){var l=[];(0,Yt.traverseTreeUp)(f,function(c){if(c.itemType==="node")return!0;var h=e[c.id];if(!h)return!1;var d=c.children;d&&d.forEach(function(g){!e[g.id]&&!a[g.id]||l.push(g)}),h.minX=1/0,h.minY=1/0,h.maxX=-1/0,h.maxY=-1/0,l.forEach(function(g){if(g.itemType!=="node")return!0;var y=a[g.id];if(!y)return!0;var m=o(y),b=y.x-m,x=y.y-m,E=y.x+m,w=y.y+m;h.minX>b&&(h.minX=b),h.minY>x&&(h.minY=x),h.maxX<E&&(h.maxX=E),h.maxY<w&&(h.maxY=w)});var v=n.oriComboMap[c.id].size||10;(0,Yt.isArray)(v)&&(v=v[0]);var p=Math.max(h.maxX-h.minX,h.maxY-h.minY,v);return h.r=p/2+s(h)/2+u(h),!0})})},t.prototype.comboNonOverlapping=function(e,n){var i=this,a=i.comboTree,o=i.comboCollideStrength,s=i.indexMap,u=i.nodeMap;(0,Yt.traverseTreeUp)(a,function(f){if(!n[f.id]&&!u[f.id]&&f.id!=="comboTreeRoot")return!1;var l=f.children;return l&&l.length>1&&l.forEach(function(c,h){if(c.itemType==="node")return!1;var d=n[c.id];d&&l.forEach(function(v,p){if(h<=p||v.itemType==="node")return!1;var g=n[v.id];if(!g)return!1;var y=d.cx-g.cx||.005,m=d.cy-g.cy||.005,b=y*y+m*m,x=d.r||1,E=g.r||1,w=x+E,_=E*E,M=x*x;if(b<w*w){var C=c.children;if(!C||C.length===0)return!1;var S=v.children;if(!S||S.length===0)return!1;var A=Math.sqrt(b),T=(w-A)/A*o,I=y*T,D=m*T,N=_/(M+_),P=1-N;C.forEach(function(G){if(G.itemType!=="node")return!1;if(u[G.id]){var W=s[G.id];S.forEach(function(k){if(k.itemType!=="node"||!u[k.id])return!1;var R=s[k.id];e[W].x+=I*N,e[W].y+=D*N,e[R].x-=I*P,e[R].y-=D*P})}})}})}),!0})},t.prototype.calRepulsive=function(e,n){var i=this,a=i.nodes,o=i.width*i.optimizeRangeFactor,s=i.nodeStrength,u=i.alpha,f=i.nodeCollideStrength,l=i.preventNodeOverlap,c=i.nodeSize,h=i.nodeSpacing,d=i.depthRepulsiveForceScale,v=i.center;a.forEach(function(p,g){if(!(!p.x||!p.y)){if(v){var y=i.gravity,m=p.x-v[0]||.005,b=p.y-v[1]||.005,x=Math.sqrt(m*m+b*b);e[g].x-=m*y*u/x,e[g].y-=b*y*u/x}a.forEach(function(E,w){if(g!==w&&!(!E.x||!E.y)){var _=n["".concat(p.id,"-").concat(E.id)],M=_.vl2,C=_.vl;if(!(C>o)){var S=n["".concat(p.id,"-").concat(E.id)],A=S.vx,T=S.vy,I=Math.log(Math.abs(E.depth-p.depth)/10)+1||1;I=I<1?1:I,E.comboId!==p.comboId&&(I+=1);var D=I?Math.pow(d,I):1,N=s(E)*u/M*D;if(e[g].x+=A*N,e[g].y+=T*N,g<w&&l){var P=c(p)+h(p)||1,G=c(E)+h(E)||1,W=P+G;if(M<W*W){var k=(W-C)/C*f,R=G*G,Y=R/(P*P+R),J=A*k,te=T*k;e[g].x+=J*Y,e[g].y+=te*Y,Y=1-Y,e[w].x-=J*Y,e[w].y-=te*Y}}}}})}})},t.prototype.calAttractive=function(e,n){var i=this,a=i.edges,o=i.linkDistance,s=i.alpha,u=i.edgeStrength,f=i.bias,l=i.depthAttractiveForceScale;a.forEach(function(c,h){var d=(0,Yt.getEdgeTerminal)(c,"source"),v=(0,Yt.getEdgeTerminal)(c,"target");if(!(!d||!v||d===v)){var p=i.indexMap[d],g=i.indexMap[v],y=i.nodeMap[d],m=i.nodeMap[v];if(!(!y||!m)){var b=y.depth===m.depth?0:Math.log(Math.abs(y.depth-m.depth)/10);y.comboId===m.comboId&&(b=b/2);var x=b?Math.pow(l,b):1;if(y.comboId!==m.comboId&&x===1?x=l/2:y.comboId===m.comboId&&(x=2),!(!(0,Yt.isNumber)(m.x)||!(0,Yt.isNumber)(y.x)||!(0,Yt.isNumber)(m.y)||!(0,Yt.isNumber)(y.y))){var E=n["".concat(v,"-").concat(d)],w=E.vl,_=E.vx,M=E.vy,C=(w-o(c))/w*s*u(c)*x,S=_*C,A=M*C,T=f[h];e[g].x-=S*T,e[g].y-=A*T,e[p].x+=S*(1-T),e[p].y+=A*(1-T)}}}})},t.prototype.getType=function(){return"comboForce"},t}(zue.Base);sc.ComboForceLayout=jue;var kf={},KS;function Rk(){if(KS)return kf;KS=1;var r=xe&&xe.__extends||function(){var s=function(u,f){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,c){l.__proto__=c}||function(l,c){for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(l[h]=c[h])},s(u,f)};return function(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");s(u,f);function l(){this.constructor=u}u.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}(),t=xe&&xe.__assign||function(){return t=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},t.apply(this,arguments)};Object.defineProperty(kf,"__esModule",{value:!0}),kf.ComboCombinedLayout=void 0;var e=qa,n=Wr,i=Nr(),a=Wk(),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),b=[],x=[],E={},w=!0;this.comboTrees.forEach(function(N){var P=m[N.id];if(P){var G=t(t({},N),{x:P.x||y[N.id].x,y:P.y||y[N.id].y,fx:P.fx||y[N.id].fx,fy:P.fy||y[N.id].fy,mass:P.mass||y[N.id].mass,size:P.size});x.push(G),!isNaN(G.x)&&G.x!==0&&!isNaN(G.y)&&G.y!==0?w=!1:(G.x=Math.random()*100,G.y=Math.random()*100),b.push(N.id),(0,i.traverseTreeUp)(N,function(W){return W.id!==N.id&&(E[W.id]=N.id),!0})}}),c.forEach(function(N){if(!(N.comboId&&y[N.comboId])){var P=t({},N);x.push(P),!isNaN(P.x)&&P.x!==0&&!isNaN(P.y)&&P.y!==0?w=!1:(P.x=Math.random()*100,P.y=Math.random()*100),b.push(N.id)}});var _=[];if(h.concat(v).forEach(function(N){var P=E[N.source]||N.source,G=E[N.target]||N.target;P!==G&&b.includes(P)&&b.includes(G)&&_.push({source:P,target:G})}),x!=null&&x.length){if(x.length===1)x[0].x=p[0],x[0].y=p[1];else{var M={nodes:x,edges:_},C=this.outerLayout||new a.GForceLayout({gravity:1,factor:4,linkDistance:function(N,P,G){var W,k,R=((((W=P.size)===null||W===void 0?void 0:W[0])||30)+(((k=G.size)===null||k===void 0?void 0:k[0])||30))/2;return Math.min(R*1.5,700)}}),S=(f=C.getType)===null||f===void 0?void 0:f.call(C);if(C.updateCfg({center:p,kg:5,preventOverlap:!0,animate:!1}),w&&e.FORCE_LAYOUT_TYPE_MAP[S]){var A=x.length<100?new a.MDSLayout:new a.GridLayout;A.layout(M)}C.layout(M)}x.forEach(function(N){var P=m[N.id];if(!P){var G=g[N.id];G&&(G.x=N.x,G.y=N.y);return}P.visited=!0,P.x=N.x,P.y=N.y,P.nodes.forEach(function(W){W.x+=N.x,W.y+=N.y})})}for(var T=Object.keys(m),I=function(N){var P=T[N],G=m[P];if(!G)return"continue";G.nodes.forEach(function(W){G.visited||(W.x+=G.x||0,W.y+=G.y||0),g[W.id]&&(g[W.id].x=W.x,g[W.id].y=W.y)}),y[P]&&(y[P].x=G.x,y[P].y=G.y)},D=T.length-1;D>=0;D--)I(D);return{nodes:c,edges:h,combos:d,comboEdges:v}},u.prototype.getInnerGraphs=function(f){var l=this,c=l.comboTrees,h=l.nodeSize,d=l.edges,v=l.comboPadding,p=l.spacing,g={},y=this.innerLayout||new a.ConcentricLayout({type:"concentric",sortBy:"id"});return y.center=[0,0],y.preventOverlap=!0,y.nodeSpacing=p,(c||[]).forEach(function(m){(0,i.traverseTreeUp)(m,function(b){var x,E=(v==null?void 0:v(b))||10;if((0,i.isArray)(E)&&(E=Math.max.apply(Math,E)),!((x=b.children)===null||x===void 0)&&x.length){var _=b.children.map(function(k){if(k.itemType==="combo")return g[k.id];var R=f[k.id]||{};return t(t({},R),k)}),M=_.map(function(k){return k.id}),C={nodes:_,edges:d.filter(function(k){return M.includes(k.source)&&M.includes(k.target)})},S=1/0;_.forEach(function(k){var R;k.size||(k.size=((R=g[k.id])===null||R===void 0?void 0:R.size)||(h==null?void 0:h(k))||[30,30]),(0,i.isNumber)(k.size)&&(k.size=[k.size,k.size]),S>k.size[0]&&(S=k.size[0]),S>k.size[1]&&(S=k.size[1])}),y.layout(C);var A=(0,i.getLayoutBBox)(_),T=A.minX,I=A.minY,D=A.maxX,N=A.maxY,P={x:(D+T)/2,y:(N+I)/2};C.nodes.forEach(function(k){k.x-=P.x,k.y-=P.y});var G=Math.max(D-T,S)+E*2,W=Math.max(N-I,S)+E*2;g[b.id]={id:b.id,nodes:_,size:[G,W]}}else if(b.itemType==="combo"){var w=E?[E*2,E*2]:[30,30];g[b.id]={id:b.id,nodes:[],size:w}}return!0})}),g},u.prototype.initVals=function(){var f=this,l=f.nodeSize,c=f.spacing,h,d;if((0,i.isNumber)(c)?d=function(){return c}:(0,i.isFunction)(c)?d=c:d=function(){return 0},this.spacing=d,!l)h=function(b){var x=d(b);if(b.size){if((0,i.isArray)(b.size)){var E=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(E+x)/2}if((0,i.isObject)(b.size)){var E=b.size.width>b.size.height?b.size.width:b.size.height;return(E+x)/2}return(b.size+x)/2}return 10+x/2};else if((0,i.isFunction)(l))h=function(b){var x=l(b),E=d(b);if((0,i.isArray)(b.size)){var w=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(w+E)/2}return((x||10)+E)/2};else if((0,i.isArray)(l)){var v=l[0]>l[1]?l[0]:l[1],p=v/2;h=function(b){return p+d(b)/2}}else{var g=l/2;h=function(b){return g+d(b)/2}}this.nodeSize=h;var y=f.comboPadding,m;(0,i.isNumber)(y)?m=function(){return y}:(0,i.isArray)(y)?m=function(){return Math.max.apply(null,y)}:(0,i.isFunction)(y)?m=y:m=function(){return 0},this.comboPadding=m},u.prototype.getType=function(){return"comboCombined"},u}(n.Base);return kf.ComboCombinedLayout=o,kf}var uc={},db={};Object.defineProperty(db,"__esModule",{value:!0});var Uue=function(){function r(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 r.prototype.distanceTo=function(t){var e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)},r.prototype.setPos=function(t,e){this.rx=t,this.ry=e},r.prototype.resetForce=function(){this.fx=0,this.fy=0},r.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,i=Math.hypot(e,n);i=i<1e-4?1e-4:i;var a=this.g*(this.degree+1)*(t.degree+1)/i;this.fx+=a*e/i,this.fy+=a*n/i},r.prototype.in=function(t){return t.contains(this.rx,this.ry)},r.prototype.add=function(t){var e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,i=(this.ry*this.mass+t.ry*t.mass)/e,a=this.degree+t.degree,o={rx:n,ry:i,mass:e,degree:a};return new r(o)},r}();db.default=Uue;var vb={};Object.defineProperty(vb,"__esModule",{value:!0});var $ue=function(){function r(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 r.prototype.getLength=function(){return this.length},r.prototype.contains=function(t,e){var n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n},r.prototype.NW=function(){var t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n},a=new r(i);return a},r.prototype.NE=function(){var t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n},a=new r(i);return a},r.prototype.SW=function(){var t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n},a=new r(i);return a},r.prototype.SE=function(){var t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n},a=new r(i);return a},r}();vb.default=$ue;var pb={};Object.defineProperty(pb,"__esModule",{value:!0});var Wue=function(){function r(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 r.prototype.insert=function(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new r(this.quad.NW()),this.NE=new r(this.quad.NE()),this.SW=new r(this.quad.SW()),this.SE=new r(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))},r.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))},r.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},r.prototype.updateForce=function(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{var e=this.quad?this.quad.getLength():0,n=this.body.distanceTo(t);e/n<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))}},r}();pb.default=Wue;var Xue=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),gb=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(uc,"__esModule",{value:!0});uc.ForceAtlas2Layout=void 0;var Yue=Wr,Ga=Nr(),Vue=gb(db),Hue=gb(vb),Kue=gb(pb),que=function(r){Xue(t,r);function t(e){var n=r.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.kr=5,n.kg=1,n.mode="normal",n.preventOverlap=!1,n.dissuadeHubs=!1,n.barnesHut=void 0,n.maxIteration=0,n.ks=.1,n.ksmax=10,n.tao=.1,n.onLayoutEnd=function(){},n.prune=void 0,n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{}},t.prototype.execute=function(){var e=this,n=e.nodes,i=e.onLayoutEnd,a=e.prune,o=e.maxIteration;!e.width&&typeof window<"u"&&(e.width=window.innerWidth),!e.height&&typeof window<"u"&&(e.height=window.innerHeight);for(var s=[],u=n.length,f=0;f<u;f+=1){var l=n[f],c=10,h=10;(0,Ga.isNumber)(l.size)&&(c=l.size,h=l.size),(0,Ga.isArray)(l.size)?(isNaN(l.size[0])||(c=l.size[0]),isNaN(l.size[1])||(h=l.size[1])):(0,Ga.isObject)(l.size)&&(c=l.size.width,h=l.size.height),e.getWidth&&!isNaN(e.getWidth(l))&&(h=e.getWidth(l)),e.getHeight&&!isNaN(e.getHeight(l))&&(c=e.getHeight(l));var d=Math.max(c,h);s.push(d)}e.barnesHut===void 0&&u>250&&(e.barnesHut=!0),e.prune===void 0&&u>100&&(e.prune=!0),this.maxIteration===0&&!e.prune?(o=250,u<=200&&u>100?o=1e3:u>200&&(o=1200),this.maxIteration=o):this.maxIteration===0&&a&&(o=100,u<=200&&u>100?o=500:u>200&&(o=950),this.maxIteration=o),e.kr||(e.kr=50,u>100&&u<=500?e.kr=20:u>500&&(e.kr=1)),e.kg||(e.kg=20,u>100&&u<=500?e.kg=10:u>500&&(e.kg=1)),this.nodes=e.updateNodesByForces(s),i()},t.prototype.updateNodesByForces=function(e){for(var n=this,i=n.edges,a=n.maxIteration,o=n.nodes,s=i.filter(function(_){var M=(0,Ga.getEdgeTerminal)(_,"source"),C=(0,Ga.getEdgeTerminal)(_,"target");return M!==C}),u=o.length,f=s.length,l=[],c={},h={},d=[],v=0;v<u;v+=1)c[o[v].id]=v,l[v]=0,(o[v].x===void 0||isNaN(o[v].x))&&(o[v].x=Math.random()*1e3),(o[v].y===void 0||isNaN(o[v].y))&&(o[v].y=Math.random()*1e3),d.push({x:o[v].x,y:o[v].y});for(var v=0;v<f;v+=1){for(var p=void 0,g=void 0,y=0,m=0,b=0;b<u;b+=1){var x=(0,Ga.getEdgeTerminal)(s[v],"source"),E=(0,Ga.getEdgeTerminal)(s[v],"target");o[b].id===x?(p=o[b],y=b):o[b].id===E&&(g=o[b],m=b),h[v]={sourceIdx:y,targetIdx:m}}p&&(l[c[p.id]]+=1),g&&(l[c[g.id]]+=1)}var w=a;if(o=this.iterate(w,c,h,f,l,e),n.prune){for(var b=0;b<f;b+=1)l[h[b].sourceIdx]<=1?(o[h[b].sourceIdx].x=o[h[b].targetIdx].x,o[h[b].sourceIdx].y=o[h[b].targetIdx].y):l[h[b].targetIdx]<=1&&(o[h[b].targetIdx].x=o[h[b].sourceIdx].x,o[h[b].targetIdx].y=o[h[b].sourceIdx].y);n.prune=!1,n.barnesHut=!1,w=100,o=this.iterate(w,c,h,f,l,e)}return o},t.prototype.iterate=function(e,n,i,a,o,s){for(var u=this,f=u.nodes,l=u.kr,c=u.preventOverlap,h=u.barnesHut,d=f.length,v=0,p=100,g=e,y=50,m=[],b=[],x=[],E=0;E<d;E+=1)if(m[2*E]=0,m[2*E+1]=0,h){var w={id:E,rx:f[E].x,ry:f[E].y,mass:1,g:l,degree:o[E]};x[E]=new Vue.default(w)}for(;g>0;){for(var E=0;E<d;E+=1)b[2*E]=m[2*E],b[2*E+1]=m[2*E+1],m[2*E]=0,m[2*E+1]=0;m=this.getAttrForces(g,y,a,n,i,o,s,m),h&&(c&&g>y||!c)?m=this.getOptRepGraForces(m,x,o):m=this.getRepGraForces(g,y,m,p,s,o);var _=this.updatePos(m,b,v,o);f=_.nodes,v=_.sg,g--,u.tick&&u.tick()}return f},t.prototype.getAttrForces=function(e,n,i,a,o,s,u,f){for(var l=this,c=l.nodes,h=l.preventOverlap,d=l.dissuadeHubs,v=l.mode,p=l.prune,g=0;g<i;g+=1){var y=c[o[g].sourceIdx],m=o[g].sourceIdx,b=c[o[g].targetIdx],x=o[g].targetIdx;if(!(p&&(s[m]<=1||s[x]<=1))){var E=[b.x-y.x,b.y-y.y],w=Math.hypot(E[0],E[1]);w=w<1e-4?1e-4:w,E[0]=E[0]/w,E[1]=E[1]/w,h&&e<n&&(w=w-u[m]-u[x]);var _=w,M=_;v==="linlog"&&(_=Math.log(1+w),M=_),d&&(_=w/s[m],M=w/s[x]),h&&e<n&&w<=0?(_=0,M=0):h&&e<n&&w>0&&(_=w,M=w),f[2*a[y.id]]+=_*E[0],f[2*a[b.id]]-=M*E[0],f[2*a[y.id]+1]+=_*E[1],f[2*a[b.id]+1]-=M*E[1]}}return f},t.prototype.getRepGraForces=function(e,n,i,a,o,s){for(var u=this,f=u.nodes,l=u.preventOverlap,c=u.kr,h=u.kg,d=u.center,v=u.prune,p=f.length,g=0;g<p;g+=1){for(var y=g+1;y<p;y+=1)if(!(v&&(s[g]<=1||s[y]<=1))){var m=[f[y].x-f[g].x,f[y].y-f[g].y],b=Math.hypot(m[0],m[1]);b=b<1e-4?1e-4:b,m[0]=m[0]/b,m[1]=m[1]/b,l&&e<n&&(b=b-o[g]-o[y]);var x=c*(s[g]+1)*(s[y]+1)/b;l&&e<n&&b<0?x=a*(s[g]+1)*(s[y]+1):l&&e<n&&b===0?x=0:l&&e<n&&b>0&&(x=c*(s[g]+1)*(s[y]+1)/b),i[2*g]-=x*m[0],i[2*y]+=x*m[0],i[2*g+1]-=x*m[1],i[2*y+1]+=x*m[1]}var E=[f[g].x-d[0],f[g].y-d[1]],w=Math.hypot(E[0],E[1]);E[0]=E[0]/w,E[1]=E[1]/w;var _=h*(s[g]+1);i[2*g]-=_*E[0],i[2*g+1]-=_*E[1]}return i},t.prototype.getOptRepGraForces=function(e,n,i){for(var a=this,o=a.nodes,s=a.kg,u=a.center,f=a.prune,l=o.length,c=9e10,h=-9e10,d=9e10,v=-9e10,p=0;p<l;p+=1)f&&i[p]<=1||(n[p].setPos(o[p].x,o[p].y),o[p].x>=h&&(h=o[p].x),o[p].x<=c&&(c=o[p].x),o[p].y>=v&&(v=o[p].y),o[p].y<=d&&(d=o[p].y));for(var g=Math.max(h-c,v-d),y={xmid:(h+c)/2,ymid:(v+d)/2,length:g,massCenter:u,mass:l},m=new Hue.default(y),b=new Kue.default(m),p=0;p<l;p+=1)f&&i[p]<=1||n[p].in(m)&&b.insert(n[p]);for(var p=0;p<l;p+=1)if(!(f&&i[p]<=1)){n[p].resetForce(),b.updateForce(n[p]),e[2*p]-=n[p].fx,e[2*p+1]-=n[p].fy;var x=[o[p].x-u[0],o[p].y-u[1]],E=Math.hypot(x[0],x[1]);E=E<1e-4?1e-4:E,x[0]=x[0]/E,x[1]=x[1]/E;var w=s*(i[p]+1);e[2*p]-=w*x[0],e[2*p+1]-=w*x[1]}return e},t.prototype.updatePos=function(e,n,i,a){for(var o=this,s=o.nodes,u=o.ks,f=o.tao,l=o.prune,c=o.ksmax,h=s.length,d=[],v=[],p=0,g=0,y=0;y<h;y+=1)if(!(l&&a[y]<=1)){var m=[e[2*y]-n[2*y],e[2*y+1]-n[2*y+1]],b=Math.hypot(m[0],m[1]),x=[e[2*y]+n[2*y],e[2*y+1]+n[2*y+1]],E=Math.hypot(x[0],x[1]);d[y]=b,v[y]=E/2,p+=(a[y]+1)*d[y],g+=(a[y]+1)*v[y]}var w=i;i=f*g/p,w!==0&&(i=i>1.5*w?1.5*w:i);for(var y=0;y<h;y+=1)if(!(l&&a[y]<=1)&&!((0,Ga.isNumber)(s[y].fx)&&(0,Ga.isNumber)(s[y].fy))){var _=u*i/(1+i*Math.sqrt(d[y])),M=Math.hypot(e[2*y],e[2*y+1]);M=M<1e-4?1e-4:M;var C=c/M;_=_>C?C:_;var S=_*e[2*y],A=_*e[2*y+1];s[y].x+=S,s[y].y+=A}return{nodes:s,sg:i}},t}(Yue.Base);uc.ForceAtlas2Layout=que;var fc={},yb={},mb={},bb={},_u=xe&&xe.__assign||function(){return _u=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},_u.apply(this,arguments)};Object.defineProperty(bb,"__esModule",{value:!0});var Zue=function(){function r(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return r.prototype.init=function(t,e,n){this.cells=[],this.CELL_W=n.CELL_W||r.DEFAULT_CELL_W,this.CELL_H=n.CELL_H||r.DEFAULT_CELL_H,this.columnNum=Math.ceil(t/this.CELL_W),this.rowNum=Math.ceil(e/this.CELL_H),r.MIN_DIST=Math.pow(t,2)+Math.pow(e,2);for(var i=0;i<this.columnNum;i++){for(var a=[],o=0;o<this.rowNum;o++){var s={dx:i,dy:o,x:i*this.CELL_W,y:o*this.CELL_H,occupied:!1};a.push(s)}this.cells.push(a)}},r.prototype.findGridByNodeId=function(t){for(var e,n,i=0;i<this.columnNum;i++)for(var a=0;a<this.rowNum;a++)if(this.cells[i][a].node&&((n=(e=this.cells[i][a])===null||e===void 0?void 0:e.node)===null||n===void 0?void 0:n.id)===t)return{column:i,row:a};return null},r.prototype.sqdist=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},r.prototype.occupyNearest=function(t){for(var e=r.MIN_DIST,n,i=null,a=0;a<this.columnNum;a++)for(var o=0;o<this.rowNum;o++)!this.cells[a][o].occupied&&(n=this.sqdist(t,this.cells[a][o]))<e&&(e=n,i=this.cells[a][o]);return i&&(i.occupied=!0),i},r.prototype.insertColumn=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++){this.cells[n+this.columnNum]=[];for(var i=0;i<this.rowNum;i++)this.cells[n+this.columnNum][i]={dx:n,dy:i,x:n*this.CELL_W,y:i*this.CELL_H,occupied:!1,node:null}}for(var n=this.columnNum-1;n>t;n--)for(var i=0;i<this.rowNum;i++)this.cells[n+e][i]=_u(_u({},this.cells[n][i]),{x:(n+e)*this.CELL_W,y:i*this.CELL_H}),this.cells[n][i]={x:n*this.CELL_W,y:i*this.CELL_H,occupied:!0,node:null};for(var i=0;i<this.additionColumn.length;i++)this.additionColumn[i]>=t&&(this.additionColumn[i]+=e);for(var n=0;n<e;n++)this.additionColumn.push(t+n+1);this.columnNum+=e}},r.prototype.insertRow=function(t,e){if(!(e<=0)){for(var n=0;n<e;n++)for(var i=0;i<this.columnNum;i++)this.cells[i][n+this.rowNum]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var i=0;i<this.columnNum;i++)for(var n=this.rowNum-1;n>t;n--)this.cells[i][n+e]=_u(_u({},this.cells[i][n]),{dx:i,dy:n+e,x:i*this.CELL_W,y:(n+e)*this.CELL_H}),this.cells[i][n]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var n=0;n<this.additionRow.length;n++)this.additionRow[n]>=t&&(this.additionRow[n]+=e);for(var i=0;i<e;i++)this.additionRow.push(t+i+1);this.rowNum+=e}},r.prototype.getNodes=function(){for(var t=[],e=0;e<this.columnNum;e++)for(var n=0;n<this.rowNum;n++)this.cells[e][n].node&&t.push(this.cells[e][n]);return t},r.MIN_DIST=50,r.DEFAULT_CELL_W=80,r.DEFAULT_CELL_H=80,r}();bb.default=Zue;var Que=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(mb,"__esModule",{value:!0});var Jue=Que(bb);function efe(r,t){if(!r.nodes||r.nodes.length===0)return r;var e=t.width,n=t.height,i=t.nodeMinGap,a=1e4,o=1e4;r.nodes.forEach(function(m){var b=m.size[0]||50,x=m.size[1]||50;a=Math.min(b,a),o=Math.min(x,o)});var s=new Jue.default;s.init(e,n,{CELL_H:o,CELL_W:a}),r.nodes.forEach(function(m){var b=s.occupyNearest(m);b&&(b.node={id:m.id,size:m.size},m.x=b.x,m.y=b.y,m.dx=b.dx,m.dy=b.dy)});for(var u=0;u<r.nodes.length;u++){var f=r.nodes[u],l=s.findGridByNodeId(f.id);if(!l)throw new Error("can not find node cell");var c=l.column,h=l.row;if(f.size[0]+i>a){for(var d=Math.ceil((f.size[0]+i)/a)-1,v=d,p=0;p<d;p++){var g=s.additionColumn.indexOf(c+p+1)>-1;if(g&&!s.cells[c+p+1][h].node)v--;else break}s.insertColumn(c,v)}if(f.size[1]+i>o){for(var d=Math.ceil((f.size[1]+i)/o)-1,v=d,p=0;p<d;p++){var g=s.additionRow.indexOf(h+p+1)>-1;if(g&&!s.cells[c][h+p+1].node)v--;else break}s.insertRow(h,v)}}for(var u=0;u<s.columnNum;u++)for(var y=function(b){var x=s.cells[u][b];if(x.node){var E=r.nodes.find(function(w){var _;return w.id===((_=x==null?void 0:x.node)===null||_===void 0?void 0:_.id)});E&&(E.x=x.x+E.size[0]/2,E.y=x.y+E.size[1]/2)}},p=0;p<s.rowNum;p++)y(p)}mb.default=efe;var xb={};Object.defineProperty(xb,"__esModule",{value:!0});var Bk=1200,Fk=800,Ih=1e7,Pf=10,Gk=3.141592653589793,g0=1.5707963267948966,tfe=Gk*.375,rfe=Gk*.625,sd=new Map,nfe=10,ife=10,y0=.8,qS=.1,afe=.5;function ofe(r,t,e){var n=r.x-r.size[0]/2,i=r.y-r.size[1]/2,a=r.x+r.size[0]/2,o=r.y+r.size[1]/2,s=t.x-t.size[0]/2,u=t.y-t.size[1]/2,f=t.x+t.size[0]/2,l=t.y+t.size[1]/2,c=r.x,h=r.y,d=t.x,v=t.y,p=d-c,g=Math.atan2(p,v-h),y=0,m=0,b=0,x=0;g>g0?(m=i-l,y=s-a,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):0<g&&g<=g0?(m=u-o,y=s-a,m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):g<-g0?(m=i-l,y=-(f-n),m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):(m=u-o,Math.abs(p)>(a-n)/2?y=n-f:y=p,m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y&&g!==0?(y/Math.sin(g)).toFixed(2):m.toFixed(2)));var E=parseFloat(g.toFixed(2)),w=e;return e&&(w=tfe<E&&E<rfe),{distance:Math.abs(b<x?b:x),isHoriz:w}}function zk(r,t){var e=sd.get(r.id)||[],n=e.find(function(P){return P.source===t.id||P.target===t.id}),i=r.size[0]*r.size[1],a=t.size[0]*t.size[1],o=i>a?t:r,s=i>a?r:t,u=o.x-o.size[0]/2,f=o.y-o.size[1]/2,l=o.x+o.size[0]/2,c=o.y+o.size[1]/2,h=s.x-s.size[0]/2,d=s.y-s.size[1]/2,v=s.x+s.size[0]/2,p=s.y+s.size[1]/2,g=o.x,y=o.y,m=s.x,b=s.y,x=l>=h&&v>=u&&c>=d&&p>=f,E=0,w=0;if(x){w=Math.sqrt(Math.pow(m-g,2)+Math.pow(b-y,2));var _=u>h?u:h,M=f>d?f:d,C=l<v?l:v,S=c<p?c:p,A=C-_,T=S-M,I=A*T;w===0&&(w=1e-7),E=Pf*1/w*100+I,E*=Ih}else{var D=!1,N=ofe(o,s,D);w=N.distance,D=N.isHoriz,w<=Pf?w!==0?n?E+=Pf+Ih*1/w:E+=Pf+Ih*Pf/w:E+=Ih:(E+=w,n&&(E+=w*w))}return E}function jk(r){for(var t=0,e=0;e<r.length;e++){var n=r[e];(n.x<0||n.y<0||n.x>Bk||n.y>Fk)&&(t+=1e12);for(var i=e+1;i<r.length;i++)t+=zk(n,r[i])}return t}function sfe(r,t,e,n){var i=new Map;e.forEach(function(g,y){i.set(g.id,g)});var a=n.filter(function(g){return g.source===r.id||g.target===r.id})||[],o=[];a.forEach(function(g){var y=g.source===r.id?g.target:g.source,m=i.get(y);m&&o.push(m)});for(var s=!0,u=0;u<o.length;u++){var f=o[u],l=Math.atan((r.y-f.y)/(f.x-r.y))*180,c=Math.atan((t.y-f.y)/(f.x-t.y))*180,h=l<30||l>150,d=c<30||c>150,v=l>70&&l<110,p=c>70&&c<110;if(h&&!d||l*c<0){s=!1;break}else if(v&&!p||l*c<0){s=!1;break}else if((f.x-r.x)*(f.x-t.x)<0){s=!1;break}else if((f.y-r.y)*(f.y-t.y)<0){s=!1;break}}return s}function ufe(r,t){for(var e=!1,n=1,i=nfe*n,a=ife*n,o=[i,-i,0,0],s=[0,0,a,-a],u=0;u<r.length;++u)for(var f=r[u],l=ZS(f,r),c=0;c<o.length;c++){var h=sfe(f,{x:f.x+o[c],y:f.y+s[c]},r,t);if(h){f.x+=o[c],f.y+=s[c];var d=ZS(f,r),v=Math.random();d<l||v<y0&&v>qS?(l=d,e=!0):(f.x-=o[c],f.y-=s[c])}}return y0>qS&&(y0*=afe),e?jk(r):0}function ZS(r,t){var e=0;(r.x<0||r.y<0||r.x+r.size[0]+20>Bk||r.y+r.size[1]+20>Fk)&&(e+=1e12);for(var n=0;n<t.length;++n)r.id!==t[n].id&&(e+=zk(r,t[n]));return e}function ffe(r,t){if(r.length===0)return{nodes:r,edges:t};r.forEach(function(f){var l=t.filter(function(c){return c.source===f.id||c.target===f.id});sd.set(f,l)}),r.sort(function(f,l){var c,h;return((c=sd.get(f.id))===null||c===void 0?void 0:c.length)-((h=sd.get(l.id))===null||h===void 0?void 0:h.length)});for(var e=jk(r),n=20,i=1,a=0,o=50,s=0;n>0&&(s++,!(s>=o));){var u=ufe(r,t);u!==0&&(a=u),i=a-e,e=a,i===0?--n:n=20}return r.forEach(function(f){f.x=f.x-f.size[0]/2,f.y=f.y-f.size[1]/2}),{nodes:r,edges:t}}xb.default=ffe;var Hy=xe&&xe.__assign||function(){return Hy=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Hy.apply(this,arguments)},lfe=xe&&xe.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var i=Object.getOwnPropertyDescriptor(t,e);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,i)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),cfe=xe&&xe.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),hfe=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&lfe(t,r,e);return cfe(t,r),t},Uk=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(yb,"__esModule",{value:!0});var hu=hfe(h1),dfe=Uk(mb),vfe=Uk(xb),pfe=Ju;function gfe(r,t){var e=r.nodes,n=r.edges,i=t.width,a=t.height;if(!(e!=null&&e.length))return Promise.resolve();var o=[];e.forEach(function(v){var p=n.filter(function(y){return y.source===v.id||y.target===v.id});if(p.length>1){var g=Hy({},v);delete g.size,o.push(g)}});var s=[];n.forEach(function(v){var p=o.find(function(y){return y.id===v.source}),g=o.find(function(y){return y.id===v.target});p&&g&&s.push(v)});var u=new pfe.DagreLayout({type:"dagre",ranksep:t.nodeMinGap,nodesep:t.nodeMinGap}),f=u.layout({nodes:o,edges:s}).nodes;e.forEach(function(v){var p=(f||[]).find(function(g){return g.id===v.id});v.x=(p==null?void 0:p.x)||i/2,v.y=(p==null?void 0:p.y)||a/2});var l=JSON.parse(JSON.stringify(e)),c=JSON.parse(JSON.stringify(n)),h=hu.forceSimulation().nodes(l).force("link",hu.forceLink(c).id(function(v){return v.id}).distance(function(v){var p=s.find(function(g){return g.source===v.source&&g.target===v.target});return p?30:20})).force("charge",hu.forceManyBody()).force("center",hu.forceCenter(i/2,a/2)).force("x",hu.forceX(i/2)).force("y",hu.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise(function(v){h.on("end",function(){e.forEach(function(E){var w=l.find(function(_){return _.id===E.id});w&&(E.x=w.x,E.y=w.y)});var p=Math.min.apply(Math,e.map(function(E){return E.x})),g=Math.max.apply(Math,e.map(function(E){return E.x})),y=Math.min.apply(Math,e.map(function(E){return E.y})),m=Math.max.apply(Math,e.map(function(E){return E.y})),b=i/(g-p),x=a/(m-y);e.forEach(function(E){E.x!==void 0&&b<1&&(E.x=(E.x-p)*b),E.y!==void 0&&x<1&&(E.y=(E.y-y)*x)}),e.forEach(function(E){E.sizeTemp=E.size,E.size=[10,10]}),(0,vfe.default)(e,n),e.forEach(function(E){E.size=E.sizeTemp||[],delete E.sizeTemp}),(0,dfe.default)({nodes:e,edges:n},t),v()})});return d}yb.default=gfe;var yfe=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),mfe=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(fc,"__esModule",{value:!0});fc.ERLayout=void 0;var bfe=Wr,xfe=mfe(yb),Efe=function(r){yfe(t,r);function t(e){var n=r.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},e&&n.updateCfg(e),n}return t.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},t.prototype.execute=function(){var e=this,n=e.nodes,i=e.edges;return n==null||n.forEach(function(a){a.size||(a.size=[50,50])}),(0,xfe.default)({nodes:n,edges:i},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){e.onLayoutEnd&&e.onLayoutEnd()})},t.prototype.getType=function(){return"er"},t}(bfe.Base);fc.ERLayout=Efe;var ss={},QS;function wfe(){if(QS)return ss;QS=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.Layouts=ss.Layout=void 0;var r=Ha,t=Wl,e=Xl,n=Vl,i=Yl,a=c1,o=Hl,s=Ju,u=sb,f=rc,l=nc,c=ic,h=ac,d=oc,v=sc,p=Rk(),g=uc,y=fc,m=Zl,b=Nr(),x=function(){function E(w){var _=(0,r.getLayoutByName)(w.type);this.layoutInstance=new _(w)}return E.prototype.layout=function(w){return this.layoutInstance.layout(w)},E.prototype.updateCfg=function(w){this.layoutInstance.updateCfg(w)},E.prototype.init=function(w){this.correctLayers(w.nodes),this.layoutInstance.init(w)},E.prototype.correctLayers=function(w){if(w!=null&&w.length){var _=1/0,M=[];if(w.forEach(function(S){(0,b.isString)(S.layer)&&(S.layer=parseInt(S.layer,10)),!(S.layer===void 0||isNaN(S.layer))&&(M.push(S),S.layer<_&&(_=S.layer))}),_<=0){var C=Math.abs(_)+1;M.forEach(function(S){return S.layer+=C})}}},E.prototype.execute=function(){this.layoutInstance.execute()},E.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},E.prototype.destroy=function(){return this.layoutInstance.destroy()},E}();return ss.Layout=x,ss.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:t.GridLayout,mds:l.MDSLayout,comboForce:v.ComboForceLayout,comboCombined:p.ComboCombinedLayout,random:e.RandomLayout,"gForce-gpu":d.GForceGPULayout,"fruchterman-gpu":h.FruchtermanGPULayout,er:y.ERLayout},ss}var $k={};Object.defineProperty($k,"__esModule",{value:!0});var JS;function Wk(){return JS||(JS=1,function(r){var t=xe&&xe.__createBinding||(Object.create?function(w,_,M,C){C===void 0&&(C=M);var S=Object.getOwnPropertyDescriptor(_,M);(!S||("get"in S?!_.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return _[M]}}),Object.defineProperty(w,C,S)}:function(w,_,M,C){C===void 0&&(C=M),w[C]=_[M]}),e=xe&&xe.__exportStar||function(w,_){for(var M in w)M!=="default"&&!Object.prototype.hasOwnProperty.call(_,M)&&t(_,w,M)};Object.defineProperty(r,"__esModule",{value:!0}),r.ERLayout=r.ForceAtlas2Layout=r.ComboCombinedLayout=r.ComboForceLayout=r.GForceGPULayout=r.FruchtermanGPULayout=r.FruchtermanLayout=r.MDSLayout=r.ConcentricLayout=r.RadialLayout=r.DagreCompoundLayout=r.DagreLayout=r.CircularLayout=r.ForceLayout=r.Force2Layout=r.GForceLayout=r.RandomLayout=r.GridLayout=r.Layouts=r.Layout=void 0;var n=Wl;Object.defineProperty(r,"GridLayout",{enumerable:!0,get:function(){return n.GridLayout}});var i=Xl;Object.defineProperty(r,"RandomLayout",{enumerable:!0,get:function(){return i.RandomLayout}});var a=Yl;Object.defineProperty(r,"GForceLayout",{enumerable:!0,get:function(){return a.GForceLayout}});var o=Vl;Object.defineProperty(r,"Force2Layout",{enumerable:!0,get:function(){return o.Force2Layout}});var s=c1;Object.defineProperty(r,"ForceLayout",{enumerable:!0,get:function(){return s.ForceLayout}});var u=Hl;Object.defineProperty(r,"CircularLayout",{enumerable:!0,get:function(){return u.CircularLayout}});var f=Ju;Object.defineProperty(r,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var l=Zl;Object.defineProperty(r,"DagreCompoundLayout",{enumerable:!0,get:function(){return l.DagreCompoundLayout}});var c=sb;Object.defineProperty(r,"RadialLayout",{enumerable:!0,get:function(){return c.RadialLayout}});var h=rc;Object.defineProperty(r,"ConcentricLayout",{enumerable:!0,get:function(){return h.ConcentricLayout}});var d=nc;Object.defineProperty(r,"MDSLayout",{enumerable:!0,get:function(){return d.MDSLayout}});var v=ic;Object.defineProperty(r,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var p=ac;Object.defineProperty(r,"FruchtermanGPULayout",{enumerable:!0,get:function(){return p.FruchtermanGPULayout}});var g=oc;Object.defineProperty(r,"GForceGPULayout",{enumerable:!0,get:function(){return g.GForceGPULayout}});var y=sc;Object.defineProperty(r,"ComboForceLayout",{enumerable:!0,get:function(){return y.ComboForceLayout}});var m=Rk();Object.defineProperty(r,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var b=uc;Object.defineProperty(r,"ForceAtlas2Layout",{enumerable:!0,get:function(){return b.ForceAtlas2Layout}});var x=fc;Object.defineProperty(r,"ERLayout",{enumerable:!0,get:function(){return x.ERLayout}});var E=wfe();Object.defineProperty(r,"Layout",{enumerable:!0,get:function(){return E.Layout}}),Object.defineProperty(r,"Layouts",{enumerable:!0,get:function(){return E.Layouts}}),e($k,r)}(zg)),zg}(function(r){var t=xe&&xe.__createBinding||(Object.create?function(i,a,o,s){s===void 0&&(s=o);var u=Object.getOwnPropertyDescriptor(a,o);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,s,u)}:function(i,a,o,s){s===void 0&&(s=o),i[s]=a[o]}),e=xe&&xe.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),r.getLayoutByName=r.unRegisterLayout=r.registerLayout=void 0;var n=Ha;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}}),e(Wk(),r)})(Ht);var Xk={exports:{}};(function(r,t){(function(n,i){r.exports=i()})(typeof self<"u"?self:xe,function(){return function(e){var n={};function i(a){if(n[a])return n[a].exports;var o=n[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=n,i.d=function(a,o,s){i.o(a,o)||Object.defineProperty(a,o,{configurable:!1,enumerable:!0,get:s})},i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,"a",o),o},i.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)},i.p="",i(i.s=36)}([function(e,n,i){var a=i(3);n.a=function(o){return Array.isArray?Array.isArray(o):Object(a.a)(o,"Array")}},function(e,n,i){var a=function(o){return o!==null&&typeof o!="function"&&isFinite(o.length)};n.a=a},function(e,n,i){var a=i(3);n.a=function(o){return Object(a.a)(o,"Function")}},function(e,n,i){var a={}.toString,o=function(s,u){return a.call(s)==="[object "+u+"]"};n.a=o},function(e,n,i){var a=i(3);n.a=function(o){return Object(a.a)(o,"String")}},function(e,n,i){var a=i(3),o=function(s){return Object(a.a)(s,"Number")};n.a=o},function(e,n,i){var a=i(38),o=a.mix;function s(u,f,l,c){return c===void 0&&(c="height"),l==="center"?(u[c]+f[c])/2:u.height}e.exports={assign:o,getHeight:s}},function(e,n,i){var a=function(o){return o==null};n.a=a},function(e,n,i){var a=i(0),o=i(12);function s(u,f){if(u){var l;if(Object(a.a)(u))for(var c=0,h=u.length;c<h&&(l=f(u[c],c),l!==!1);c++);else if(Object(o.a)(u)){for(var d in u)if(u.hasOwnProperty(d)&&(l=f(u[d],d),l===!1))break}}}n.a=s},function(e,n,i){var a=i(7);n.a=function(o){return Object(a.a)(o)?"":o.toString()}},function(e,n,i){var a=i(14),o=i(3),s=function(u){if(!Object(a.a)(u)||!Object(o.a)(u,"Object"))return!1;if(Object.getPrototypeOf(u)===null)return!0;for(var f=u;Object.getPrototypeOf(f)!==null;)f=Object.getPrototypeOf(f);return Object.getPrototypeOf(u)===f};n.a=s},function(e,n,i){var a=i(18),o=function(){function s(f,l){l===void 0&&(l={});var c=this;c.options=l,c.rootNode=a(f,l)}var u=s.prototype;return u.execute=function(){throw new Error("please override this method")},s}();e.exports=o},function(e,n,i){n.a=function(a){var o=typeof a;return a!==null&&o==="object"||o==="function"}},function(e,n,i){var a=i(1),o=function(s,u){return Object(a.a)(s)?s.indexOf(u)>-1:!1};n.a=o},function(e,n,i){var a=function(o){return typeof o=="object"&&o!==null};n.a=a},function(e,n,i){var a=i(8),o=i(2),s=Object.values?function(u){return Object.values(u)}:function(u){var f=[];return Object(a.a)(u,function(l,c){Object(o.a)(u)&&c==="prototype"||f.push(l)}),f};n.a=s},function(e,n,i){n.a=o;function a(s,u){for(var f in u)u.hasOwnProperty(f)&&f!=="constructor"&&u[f]!==void 0&&(s[f]=u[f])}function o(s,u,f,l){return u&&a(s,u),f&&a(s,f),l&&a(s,l),s}},function(e,n,i){var a=i(35),o=["LR","RL","TB","BT","H","V"],s=["LR","RL","H"],u=function(c){return s.indexOf(c)>-1},f=o[0];e.exports=function(l,c,h){var d=c.direction||f;if(c.isHorizontal=u(d),d&&o.indexOf(d)===-1)throw new TypeError("Invalid direction: "+d);if(d===o[0])h(l,c);else if(d===o[1])h(l,c),l.right2left();else if(d===o[2])h(l,c);else if(d===o[3])h(l,c),l.bottom2top();else if(d===o[4]||d===o[5]){var v=a(l,c),p=v.left,g=v.right;h(p,c),h(g,c),c.isHorizontal?p.right2left():p.bottom2top(),g.translate(p.x-g.x,p.y-g.y),l.x=p.x,l.y=g.y;var y=l.getBoundingBox();c.isHorizontal?y.top<0&&l.translate(0,-y.top):y.left<0&&l.translate(-y.left,0)}var m=c.fixedRoot;return m===void 0&&(m=!0),m&&l.translate(-(l.x+l.width/2+l.hgap),-(l.y+l.height/2+l.vgap)),l}},function(e,n,i){var a=i(6),o=18,s=o*2,u=o,f={getId:function(d){return d.id||d.name},getPreH:function(d){return d.preH||0},getPreV:function(d){return d.preV||0},getHGap:function(d){return d.hgap||u},getVGap:function(d){return d.vgap||u},getChildren:function(d){return d.children},getHeight:function(d){return d.height||s},getWidth:function(d){var v=d.label||" ";return d.width||v.split("").length*o}};function l(h,d){var v=this;if(v.vgap=v.hgap=0,h instanceof l)return h;v.data=h;var p=d.getHGap(h),g=d.getVGap(h);return v.preH=d.getPreH(h),v.preV=d.getPreV(h),v.width=d.getWidth(h),v.height=d.getHeight(h),v.width+=v.preH,v.height+=v.preV,v.id=d.getId(h),v.x=v.y=0,v.depth=0,v.children||(v.children=[]),v.addGap(p,g),v}a.assign(l.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(d,v){var p=this;p.hgap+=d,p.vgap+=v,p.width+=2*d,p.height+=2*v},eachNode:function(d){for(var v=this,p=[v],g;g=p.shift();)d(g),p=g.children.concat(p)},DFTraverse:function(d){this.eachNode(d)},BFTraverse:function(d){for(var v=this,p=[v],g;g=p.shift();)d(g),p=p.concat(g.children)},getBoundingBox:function(){var d={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(v){d.left=Math.min(d.left,v.x),d.top=Math.min(d.top,v.y),d.width=Math.max(d.width,v.x+v.width),d.height=Math.max(d.height,v.y+v.height)}),d},translate:function(d,v){d===void 0&&(d=0),v===void 0&&(v=0),this.eachNode(function(p){p.x+=d,p.y+=v,p.x+=p.preH,p.y+=p.preV})},right2left:function(){var d=this,v=d.getBoundingBox();d.eachNode(function(p){p.x=p.x-(p.x-v.left)*2-p.width}),d.translate(v.width,0)},bottom2top:function(){var d=this,v=d.getBoundingBox();d.eachNode(function(p){p.y=p.y-(p.y-v.top)*2-p.height}),d.translate(0,v.height)}});function c(h,d,v){d===void 0&&(d={}),d=a.assign({},f,d);var p=new l(h,d),g=[p],y;if(!v&&!h.collapsed){for(;y=g.shift();)if(!y.data.collapsed){var m=d.getChildren(y.data),b=m?m.length:0;if(y.children=new Array(b),m&&b)for(var x=0;x<b;x++){var E=new l(m[x],d);y.children[x]=E,g.push(E),E.parent=y,E.depth=y.depth+1}}}return p}e.exports=c},function(e,n,i){var a=i(1),o=function(s,u){if(!Object(a.a)(s))return s;for(var f=[],l=0;l<s.length;l++){var c=s[l];u(c,l)&&f.push(c)}return f};n.a=o},function(e,n,i){var a=i(7),o=i(21);function s(u,f){var l=Object(o.a)(f),c=l.length;if(Object(a.a)(u))return!c;for(var h=0;h<c;h+=1){var d=l[h];if(f[d]!==u[d]||!(d in u))return!1}return!0}n.a=s},function(e,n,i){var a=i(8),o=i(2),s=Object.keys?function(u){return Object.keys(u)}:function(u){var f=[];return Object(a.a)(u,function(l,c){Object(o.a)(u)&&c==="prototype"||f.push(c)}),f};n.a=s},function(e,n,i){var a=i(0);n.a=function(o){if(Object(a.a)(o))return o.reduce(function(s,u){return Math.max(s,u)},o[0])}},function(e,n,i){var a=i(0);n.a=function(o){if(Object(a.a)(o))return o.reduce(function(s,u){return Math.min(s,u)},o[0])}},function(e,n,i){var a=i(1),o=Array.prototype.splice,s=function(f,l){if(!Object(a.a)(f))return[];for(var c=f?l.length:0,h=c-1;c--;){var d=void 0,v=l[c];(c===h||v!==d)&&(d=v,o.call(f,v,1))}return f};n.a=s},function(e,n,i){var a=i(8),o=i(0),s=i(10),u=function(f,l,c){if(!Object(o.a)(f)&&!Object(s.a)(f))return f;var h=c;return Object(a.a)(f,function(d,v){h=l(h,d,v)}),h};n.a=u},function(e,n,i){n.a=a;function a(o,s){s===void 0&&(s=new Map);var u=[];if(Array.isArray(o))for(var f=0,l=o.length;f<l;f++){var c=o[f];s.has(c)||(u.push(c),s.set(c,!0))}return u}},function(e,n,i){n.a=u;var a=i(0),o=i(2),s=i(28);function u(f,l){if(!l)return{0:f};if(!Object(o.a)(l)){var c=Object(a.a)(l)?l:l.replace(/\s+/g,"").split("*");l=function(h){for(var d="_",v=0,p=c.length;v<p;v++)d+=h[c[v]]&&h[c[v]].toString();return d}}return Object(s.a)(f,l)}},function(e,n,i){var a=i(0),o=i(2),s=Object.prototype.hasOwnProperty;function u(f,l){if(!l||!Object(a.a)(f))return{};for(var c={},h=Object(o.a)(l)?l:function(g){return g[l]},d,v=0;v<f.length;v++){var p=f[v];d=h(p),s.call(c,d)?c[d].push(p):c[d]=[p]}return c}n.a=u},function(e,n,i){n.a=function(a,o){return a.hasOwnProperty(o)}},function(e,n,i){var a={}.toString,o=function(s){return a.call(s).replace(/^\[object /,"").replace(/]$/,"")};n.a=o},function(e,n,i){var a=Object.prototype,o=function(s){var u=s&&s.constructor,f=typeof u=="function"&&u.prototype||a;return s===f};n.a=o},function(e,n,i){var a=i(2);n.a=function(o,s){if(!Object(a.a)(o))throw new TypeError("Expected a function");var u=function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];var c=s?s.apply(this,f):f[0],h=u.cache;if(h.has(c))return h.get(c);var d=o.apply(this,f);return h.set(c,d),d};return u.cache=new Map,u}},function(e,n,i){var a=i(14),o=i(1),s=i(4),u=function(f,l){if(f===l)return!0;if(!f||!l||Object(s.a)(f)||Object(s.a)(l))return!1;if(Object(o.a)(f)||Object(o.a)(l)){if(f.length!==l.length)return!1;for(var c=!0,h=0;h<f.length&&(c=u(f[h],l[h]),!!c);h++);return c}if(Object(a.a)(f)||Object(a.a)(l)){var d=Object.keys(f),v=Object.keys(l);if(d.length!==v.length)return!1;for(var c=!0,h=0;h<d.length&&(c=u(f[d[h]],l[d[h]]),!!c);h++);return c}return!1};n.a=u},function(e,n,i){var a=i(116),o=i(15),s=i(32),u=i(4),f;n.a=Object(s.a)(function(l,c){c===void 0&&(c={});var h=c.fontSize,d=c.fontFamily,v=c.fontWeight,p=c.fontStyle,g=c.fontVariant;return f||(f=document.createElement("canvas").getContext("2d")),f.font=[p,g,v,h+"px",d].join(" "),f.measureText(Object(u.a)(l)?l:"").width},function(l,c){return c===void 0&&(c={}),Object(a.a)([l],Object(o.a)(c)).join("")})},function(e,n,i){var a=i(18);e.exports=function(o,s){for(var u=a(o.data,s,!0),f=a(o.data,s,!0),l=o.children.length,c=Math.round(l/2),h=s.getSide||function(g,y){return y<c?"right":"left"},d=0;d<l;d++){var v=o.children[d],p=h(v,d);p==="right"?f.children.push(v):u.children.push(v)}return u.eachNode(function(g){g.isRoot()||(g.side="left")}),f.eachNode(function(g){g.isRoot()||(g.side="right")}),{left:u,right:f}}},function(e,n,i){var a={compactBox:i(37),dendrogram:i(120),indented:i(122),mindmap:i(124)};e.exports=a},function(e,n,i){function a(v,p){v.prototype=Object.create(p.prototype),v.prototype.constructor=v,o(v,p)}function o(v,p){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(y,m){return y.__proto__=m,y},o(v,p)}var s=i(11),u=i(119),f=i(17),l=i(6),c=function(v){a(p,v);function p(){return v.apply(this,arguments)||this}var g=p.prototype;return g.execute=function(){var m=this;return f(m.rootNode,m.options,u)},p}(s),h={};function d(v,p){return p=l.assign({},h,p),new c(v,p).execute()}e.exports=d},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(13);i.d(n,"contains",function(){return a.a}),i.d(n,"includes",function(){return a.a});var o=i(39);i.d(n,"difference",function(){return o.a});var s=i(40);i.d(n,"find",function(){return s.a});var u=i(41);i.d(n,"findIndex",function(){return u.a});var f=i(42);i.d(n,"firstValue",function(){return f.a});var l=i(43);i.d(n,"flatten",function(){return l.a});var c=i(44);i.d(n,"flattenDeep",function(){return c.a});var h=i(45);i.d(n,"getRange",function(){return h.a});var d=i(46);i.d(n,"pull",function(){return d.a});var v=i(24);i.d(n,"pullAt",function(){return v.a});var p=i(25);i.d(n,"reduce",function(){return p.a});var g=i(47);i.d(n,"remove",function(){return g.a});var y=i(48);i.d(n,"sortBy",function(){return y.a});var m=i(49);i.d(n,"union",function(){return m.a});var b=i(26);i.d(n,"uniq",function(){return b.a});var x=i(50);i.d(n,"valuesOfKey",function(){return x.a});var E=i(51);i.d(n,"head",function(){return E.a});var w=i(52);i.d(n,"last",function(){return w.a});var _=i(53);i.d(n,"startsWith",function(){return _.a});var M=i(54);i.d(n,"endsWith",function(){return M.a});var C=i(19);i.d(n,"filter",function(){return C.a});var S=i(55);i.d(n,"every",function(){return S.a});var A=i(56);i.d(n,"some",function(){return A.a});var T=i(57);i.d(n,"group",function(){return T.a});var I=i(28);i.d(n,"groupBy",function(){return I.a});var D=i(27);i.d(n,"groupToMap",function(){return D.a});var N=i(58);i.d(n,"getWrapBehavior",function(){return N.a});var P=i(59);i.d(n,"wrapBehavior",function(){return P.a});var G=i(60);i.d(n,"number2color",function(){return G.a});var W=i(61);i.d(n,"parseRadius",function(){return W.a});var k=i(62);i.d(n,"clamp",function(){return k.a});var R=i(63);i.d(n,"fixedBase",function(){return R.a});var Y=i(64);i.d(n,"isDecimal",function(){return Y.a});var J=i(65);i.d(n,"isEven",function(){return J.a});var te=i(66);i.d(n,"isInteger",function(){return te.a});var H=i(67);i.d(n,"isNegative",function(){return H.a});var pe=i(68);i.d(n,"isNumberEqual",function(){return pe.a});var Ae=i(69);i.d(n,"isOdd",function(){return Ae.a});var Le=i(70);i.d(n,"isPositive",function(){return Le.a});var qe=i(22);i.d(n,"max",function(){return qe.a});var at=i(71);i.d(n,"maxBy",function(){return at.a});var rt=i(23);i.d(n,"min",function(){return rt.a});var xt=i(72);i.d(n,"minBy",function(){return xt.a});var Et=i(73);i.d(n,"mod",function(){return Et.a});var ur=i(74);i.d(n,"toDegree",function(){return ur.a});var Bt=i(75);i.d(n,"toInteger",function(){return Bt.a});var Ut=i(76);i.d(n,"toRadian",function(){return Ut.a});var dr=i(77);i.d(n,"forIn",function(){return dr.a});var fr=i(29);i.d(n,"has",function(){return fr.a});var Gt=i(78);i.d(n,"hasKey",function(){return Gt.a});var Jt=i(79);i.d(n,"hasValue",function(){return Jt.a});var Rr=i(21);i.d(n,"keys",function(){return Rr.a});var tt=i(20);i.d(n,"isMatch",function(){return tt.a});var ie=i(15);i.d(n,"values",function(){return ie.a});var L=i(80);i.d(n,"lowerCase",function(){return L.a});var _e=i(81);i.d(n,"lowerFirst",function(){return _e.a});var Be=i(82);i.d(n,"substitute",function(){return Be.a});var ye=i(83);i.d(n,"upperCase",function(){return ye.a});var $e=i(84);i.d(n,"upperFirst",function(){return $e.a});var We=i(30);i.d(n,"getType",function(){return We.a});var Ke=i(85);i.d(n,"isArguments",function(){return Ke.a});var Qe=i(0);i.d(n,"isArray",function(){return Qe.a});var vt=i(1);i.d(n,"isArrayLike",function(){return vt.a});var Dt=i(86);i.d(n,"isBoolean",function(){return Dt.a});var lr=i(87);i.d(n,"isDate",function(){return lr.a});var kt=i(88);i.d(n,"isError",function(){return kt.a});var hr=i(2);i.d(n,"isFunction",function(){return hr.a});var or=i(89);i.d(n,"isFinite",function(){return or.a});var gr=i(7);i.d(n,"isNil",function(){return gr.a});var vr=i(90);i.d(n,"isNull",function(){return vr.a});var en=i(5);i.d(n,"isNumber",function(){return en.a});var er=i(12);i.d(n,"isObject",function(){return er.a});var Or=i(14);i.d(n,"isObjectLike",function(){return Or.a});var Un=i(10);i.d(n,"isPlainObject",function(){return Un.a});var Br=i(31);i.d(n,"isPrototype",function(){return Br.a});var Ui=i(91);i.d(n,"isRegExp",function(){return Ui.a});var Uo=i(4);i.d(n,"isString",function(){return Uo.a});var $o=i(3);i.d(n,"isType",function(){return $o.a});var qr=i(92);i.d(n,"isUndefined",function(){return qr.a});var wi=i(93);i.d(n,"isElement",function(){return wi.a});var Ca=i(94);i.d(n,"requestAnimationFrame",function(){return Ca.a});var Wo=i(95);i.d(n,"clearAnimationFrame",function(){return Wo.a});var Xo=i(96);i.d(n,"augment",function(){return Xo.a});var Yo=i(97);i.d(n,"clone",function(){return Yo.a});var $n=i(98);i.d(n,"debounce",function(){return $n.a});var Lr=i(32);i.d(n,"memoize",function(){return Lr.a});var Wn=i(99);i.d(n,"deepMix",function(){return Wn.a});var At=i(8);i.d(n,"each",function(){return At.a});var pr=i(100);i.d(n,"extend",function(){return pr.a});var mt=i(101);i.d(n,"indexOf",function(){return mt.a});var _r=i(102);i.d(n,"isEmpty",function(){return _r.a});var tn=i(33);i.d(n,"isEqual",function(){return tn.a});var Aa=i(103);i.d(n,"isEqualWith",function(){return Aa.a});var Ta=i(104);i.d(n,"map",function(){return Ta.a});var _i=i(105);i.d(n,"mapValues",function(){return _i.a});var $i=i(16);i.d(n,"mix",function(){return $i.a}),i.d(n,"assign",function(){return $i.a});var Ia=i(106);i.d(n,"get",function(){return Ia.a});var Oa=i(107);i.d(n,"set",function(){return Oa.a});var ip=i(108);i.d(n,"pick",function(){return ip.a});var ap=i(109);i.d(n,"omit",function(){return ap.a});var op=i(110);i.d(n,"throttle",function(){return op.a});var sp=i(111);i.d(n,"toArray",function(){return sp.a});var up=i(9);i.d(n,"toString",function(){return up.a});var fp=i(112);i.d(n,"uniqueId",function(){return fp.a});var lp=i(113);i.d(n,"noop",function(){return lp.a});var cp=i(114);i.d(n,"identity",function(){return cp.a});var hp=i(115);i.d(n,"size",function(){return hp.a});var dp=i(34);i.d(n,"measureTextWidth",function(){return dp.a});var vp=i(117);i.d(n,"getEllipsisText",function(){return vp.a});var pp=i(118);i.d(n,"Cache",function(){return pp.a})},function(e,n,i){var a=i(19),o=i(13),s=function(u,f){return f===void 0&&(f=[]),Object(a.a)(u,function(l){return!Object(o.a)(f,l)})};n.a=s},function(e,n,i){var a=i(2),o=i(20),s=i(0),u=i(10);function f(l,c){if(!Object(s.a)(l))return null;var h;if(Object(a.a)(c)&&(h=c),Object(u.a)(c)&&(h=function(v){return Object(o.a)(v,c)}),h){for(var d=0;d<l.length;d+=1)if(h(l[d]))return l[d]}return null}n.a=f},function(e,n,i){function a(o,s,u){u===void 0&&(u=0);for(var f=u;f<o.length;f++)if(s(o[f],f))return f;return-1}n.a=a},function(e,n,i){var a=i(7),o=i(0),s=function(u,f){for(var l=null,c=0;c<u.length;c++){var h=u[c],d=h[f];if(!Object(a.a)(d)){Object(o.a)(d)?l=d[0]:l=d;break}}return l};n.a=s},function(e,n,i){var a=i(0),o=function(s){if(!Object(a.a)(s))return[];for(var u=[],f=0;f<s.length;f++)u=u.concat(s[f]);return u};n.a=o},function(e,n,i){var a=i(0),o=function(s,u){if(u===void 0&&(u=[]),!Object(a.a)(s))u.push(s);else for(var f=0;f<s.length;f+=1)o(s[f],u);return u};n.a=o},function(e,n,i){var a=i(0),o=i(22),s=i(23),u=function(f){var l=f.filter(function(p){return!isNaN(p)});if(!l.length)return{min:0,max:0};if(Object(a.a)(f[0])){for(var c=[],h=0;h<f.length;h++)c=c.concat(f[h]);l=c}var d=Object(o.a)(l),v=Object(s.a)(l);return{min:v,max:d}};n.a=u},function(e,n,i){var a=Array.prototype,o=a.splice,s=a.indexOf,u=function(f){for(var l=[],c=1;c<arguments.length;c++)l[c-1]=arguments[c];for(var h=0;h<l.length;h++)for(var d=l[h],v=-1;(v=s.call(f,d))>-1;)o.call(f,v,1);return f};n.a=u},function(e,n,i){var a=i(1),o=i(24),s=function(u,f){var l=[];if(!Object(a.a)(u))return l;for(var c=-1,h=[],d=u.length;++c<d;){var v=u[c];f(v,c,u)&&(l.push(v),h.push(c))}return Object(o.a)(u,h),l};n.a=s},function(e,n,i){var a=i(0),o=i(4),s=i(2);function u(f,l){var c;if(Object(s.a)(l))c=function(d,v){return l(d)-l(v)};else{var h=[];Object(o.a)(l)?h.push(l):Object(a.a)(l)&&(h=l),c=function(d,v){for(var p=0;p<h.length;p+=1){var g=h[p];if(d[g]>v[g])return 1;if(d[g]<v[g])return-1}return 0}}return f.sort(c),f}n.a=u},function(e,n,i){var a=i(26),o=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return Object(a.a)([].concat.apply([],s))};n.a=o},function(e,n,i){var a=i(0),o=i(7);n.a=function(s,u){for(var f=[],l={},c=0;c<s.length;c++){var h=s[c],d=h[u];if(!Object(o.a)(d)){Object(a.a)(d)||(d=[d]);for(var v=0;v<d.length;v++){var p=d[v];l[p]||(f.push(p),l[p]=!0)}}}return f}},function(e,n,i){n.a=o;var a=i(1);function o(s){if(Object(a.a)(s))return s[0]}},function(e,n,i){n.a=o;var a=i(1);function o(s){if(Object(a.a)(s)){var u=s;return u[u.length-1]}}},function(e,n,i){var a=i(0),o=i(4);function s(u,f){return Object(a.a)(u)||Object(o.a)(u)?u[0]===f:!1}n.a=s},function(e,n,i){var a=i(0),o=i(4);function s(u,f){return Object(a.a)(u)||Object(o.a)(u)?u[u.length-1]===f:!1}n.a=s},function(e,n,i){var a=function(o,s){for(var u=0;u<o.length;u++)if(!s(o[u],u))return!1;return!0};n.a=a},function(e,n,i){var a=function(o,s){for(var u=0;u<o.length;u++)if(s(o[u],u))return!0;return!1};n.a=a},function(e,n,i){var a=i(27);n.a=function(o,s){if(!s)return[o];var u=Object(a.a)(o,s),f=[];for(var l in u)f.push(u[l]);return f}},function(e,n,i){function a(o,s){return o["_wrap_"+s]}n.a=a},function(e,n,i){function a(o,s){if(o["_wrap_"+s])return o["_wrap_"+s];var u=function(f){o[s](f)};return o["_wrap_"+s]=u,u}n.a=a},function(e,n,i){var a={};function o(s){var u=a[s];if(!u){for(var f=s.toString(16),l=f.length;l<6;l++)f="0"+f;u="#"+f,a[s]=u}return u}n.a=o},function(e,n,i){var a=i(0);function o(s){var u=0,f=0,l=0,c=0;return Object(a.a)(s)?s.length===1?u=f=l=c=s[0]:s.length===2?(u=l=s[0],f=c=s[1]):s.length===3?(u=s[0],f=c=s[1],l=s[2]):(u=s[0],f=s[1],l=s[2],c=s[3]):u=f=l=c=s,{r1:u,r2:f,r3:l,r4:c}}n.a=o},function(e,n,i){var a=function(o,s,u){return o<s?s:o>u?u:o};n.a=a},function(e,n,i){var a=function(o,s){var u=s.toString(),f=u.indexOf(".");if(f===-1)return Math.round(o);var l=u.substr(f+1).length;return l>20&&(l=20),parseFloat(o.toFixed(l))};n.a=a},function(e,n,i){var a=i(5),o=function(s){return Object(a.a)(s)&&s%1!==0};n.a=o},function(e,n,i){var a=i(5),o=function(s){return Object(a.a)(s)&&s%2===0};n.a=o},function(e,n,i){var a=i(5),o=Number.isInteger?Number.isInteger:function(s){return Object(a.a)(s)&&s%1===0};n.a=o},function(e,n,i){var a=i(5),o=function(s){return Object(a.a)(s)&&s<0};n.a=o},function(e,n,i){n.a=o;var a=1e-5;function o(s,u,f){return f===void 0&&(f=a),Math.abs(s-u)<f}},function(e,n,i){var a=i(5),o=function(s){return Object(a.a)(s)&&s%2!==0};n.a=o},function(e,n,i){var a=i(5),o=function(s){return Object(a.a)(s)&&s>0};n.a=o},function(e,n,i){var a=i(0),o=i(2);n.a=function(s,u){if(Object(a.a)(s)){for(var f,l=-1/0,c=0;c<s.length;c++){var h=s[c],d=Object(o.a)(u)?u(h):h[u];d>l&&(f=h,l=d)}return f}}},function(e,n,i){var a=i(0),o=i(2);n.a=function(s,u){if(Object(a.a)(s)){for(var f,l=1/0,c=0;c<s.length;c++){var h=s[c],d=Object(o.a)(u)?u(h):h[u];d<l&&(f=h,l=d)}return f}}},function(e,n,i){var a=function(o,s){return(o%s+s)%s};n.a=a},function(e,n,i){var a=180/Math.PI,o=function(s){return a*s};n.a=o},function(e,n,i){n.a=parseInt},function(e,n,i){var a=Math.PI/180,o=function(s){return a*s};n.a=o},function(e,n,i){var a=i(8);n.a=a.a},function(e,n,i){var a=i(29);n.a=a.a},function(e,n,i){var a=i(13),o=i(15);n.a=function(s,u){return Object(a.a)(Object(o.a)(s),u)}},function(e,n,i){var a=i(9),o=function(s){return Object(a.a)(s).toLowerCase()};n.a=o},function(e,n,i){var a=i(9),o=function(s){var u=Object(a.a)(s);return u.charAt(0).toLowerCase()+u.substring(1)};n.a=o},function(e,n,i){function a(o,s){return!o||!s?o:o.replace(/\\?\{([^{}]+)\}/g,function(u,f){return u.charAt(0)==="\\"?u.slice(1):s[f]===void 0?"":s[f]})}n.a=a},function(e,n,i){var a=i(9),o=function(s){return Object(a.a)(s).toUpperCase()};n.a=o},function(e,n,i){var a=i(9),o=function(s){var u=Object(a.a)(s);return u.charAt(0).toUpperCase()+u.substring(1)};n.a=o},function(e,n,i){var a=i(3),o=function(s){return Object(a.a)(s,"Arguments")};n.a=o},function(e,n,i){var a=i(3),o=function(s){return Object(a.a)(s,"Boolean")};n.a=o},function(e,n,i){var a=i(3),o=function(s){return Object(a.a)(s,"Date")};n.a=o},function(e,n,i){var a=i(3),o=function(s){return Object(a.a)(s,"Error")};n.a=o},function(e,n,i){var a=i(5);n.a=function(o){return Object(a.a)(o)&&isFinite(o)}},function(e,n,i){var a=function(o){return o===null};n.a=a},function(e,n,i){var a=i(3),o=function(s){return Object(a.a)(s,"RegExp")};n.a=o},function(e,n,i){var a=function(o){return o===void 0};n.a=a},function(e,n,i){var a=function(o){return o instanceof Element||o instanceof HTMLDocument};n.a=a},function(e,n,i){n.a=a;function a(o){var s=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(u){return setTimeout(u,16)};return s(o)}},function(e,n,i){n.a=a;function a(o){var s=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;s(o)}},function(e,n,i){var a=i(16),o=i(2),s=function(){for(var u=[],f=0;f<arguments.length;f++)u[f]=arguments[f];for(var l=u[0],c=1;c<u.length;c++){var h=u[c];Object(o.a)(h)&&(h=h.prototype),Object(a.a)(l.prototype,h)}};n.a=s},function(e,n,i){var a=i(0),o=function(s){if(typeof s!="object"||s===null)return s;var u;if(Object(a.a)(s)){u=[];for(var f=0,l=s.length;f<l;f++)typeof s[f]=="object"&&s[f]!=null?u[f]=o(s[f]):u[f]=s[f]}else{u={};for(var c in s)typeof s[c]=="object"&&s[c]!=null?u[c]=o(s[c]):u[c]=s[c]}return u};n.a=o},function(e,n,i){function a(o,s,u){var f;return function(){var l=this,c=arguments,h=function(){f=null,u||o.apply(l,c)},d=u&&!f;clearTimeout(f),f=setTimeout(h,s),d&&o.apply(l,c)}}n.a=a},function(e,n,i){var a=i(0),o=i(10),s=5;function u(l,c,h,d){h=h||0,d=d||s;for(var v in c)if(c.hasOwnProperty(v)){var p=c[v];p!==null&&Object(o.a)(p)?(Object(o.a)(l[v])||(l[v]={}),h<d?u(l[v],p,h+1,d):l[v]=c[v]):Object(a.a)(p)?(l[v]=[],l[v]=l[v].concat(p)):p!==void 0&&(l[v]=p)}}var f=function(l){for(var c=[],h=1;h<arguments.length;h++)c[h-1]=arguments[h];for(var d=0;d<c.length;d+=1)u(l,c[d]);return l};n.a=f},function(e,n,i){var a=i(16),o=i(2),s=function(u,f,l,c){Object(o.a)(f)||(l=f,f=u,u=function(){});var h=Object.create?function(v,p){return Object.create(v,{constructor:{value:p}})}:function(v,p){function g(){}g.prototype=v;var y=new g;return y.constructor=p,y},d=h(f.prototype,u);return u.prototype=Object(a.a)(d,u.prototype),u.superclass=h(f.prototype,f),Object(a.a)(d,l),Object(a.a)(u,c),u};n.a=s},function(e,n,i){var a=i(1),o=function(s,u){if(!Object(a.a)(s))return-1;var f=Array.prototype.indexOf;if(f)return f.call(s,u);for(var l=-1,c=0;c<s.length;c++)if(s[c]===u){l=c;break}return l};n.a=o},function(e,n,i){var a=i(7),o=i(1),s=i(30),u=i(31),f=Object.prototype.hasOwnProperty;function l(c){if(Object(a.a)(c))return!0;if(Object(o.a)(c))return!c.length;var h=Object(s.a)(c);if(h==="Map"||h==="Set")return!c.size;if(Object(u.a)(c))return!Object.keys(c).length;for(var d in c)if(f.call(c,d))return!1;return!0}n.a=l},function(e,n,i){var a=i(2),o=i(33);n.a=function(s,u,f){return Object(a.a)(f)?!!f(s,u):Object(o.a)(s,u)}},function(e,n,i){var a=i(1),o=function(s,u){if(!Object(a.a)(s))return s;for(var f=[],l=0;l<s.length;l++){var c=s[l];f.push(u(c,l))}return f};n.a=o},function(e,n,i){var a=i(7),o=i(12),s=function(u){return u};n.a=function(u,f){f===void 0&&(f=s);var l={};return Object(o.a)(u)&&!Object(a.a)(u)&&Object.keys(u).forEach(function(c){l[c]=f(u[c],c)}),l}},function(e,n,i){var a=i(4);n.a=function(o,s,u){for(var f=0,l=Object(a.a)(s)?s.split("."):s;o&&f<l.length;)o=o[l[f++]];return o===void 0||f<l.length?u:o}},function(e,n,i){var a=i(12),o=i(4),s=i(5);n.a=function(u,f,l){var c=u,h=Object(o.a)(f)?f.split("."):f;return h.forEach(function(d,v){v<h.length-1?(Object(a.a)(c[d])||(c[d]=Object(s.a)(h[v+1])?[]:{}),c=c[d]):c[d]=l}),u}},function(e,n,i){var a=i(8),o=i(10),s=Object.prototype.hasOwnProperty;n.a=function(u,f){if(u===null||!Object(o.a)(u))return{};var l={};return Object(a.a)(f,function(c){s.call(u,c)&&(l[c]=u[c])}),l}},function(e,n,i){var a=i(25);n.a=function(o,s){return Object(a.a)(o,function(u,f,l){return s.includes(l)||(u[l]=f),u},{})}},function(e,n,i){n.a=function(a,o,s){var u,f,l,c,h=0;s||(s={});var d=function(){h=s.leading===!1?0:Date.now(),u=null,c=a.apply(f,l),u||(f=l=null)},v=function(){var p=Date.now();!h&&s.leading===!1&&(h=p);var g=o-(p-h);return f=this,l=arguments,g<=0||g>o?(u&&(clearTimeout(u),u=null),h=p,c=a.apply(f,l),u||(f=l=null)):!u&&s.trailing!==!1&&(u=setTimeout(d,g)),c};return v.cancel=function(){clearTimeout(u),h=0,u=f=l=null},v}},function(e,n,i){var a=i(1);n.a=function(o){return Object(a.a)(o)?Array.prototype.slice.call(o):[]}},function(e,n,i){var a={};n.a=function(o){return o=o||"g",a[o]?a[o]+=1:a[o]=1,o+a[o]}},function(e,n,i){n.a=function(){}},function(e,n,i){n.a=function(a){return a}},function(e,n,i){n.a=s;var a=i(7),o=i(1);function s(u){return Object(a.a)(u)?0:Object(o.a)(u)?u.length:Object.keys(u).length}},function(e,n,i){n.a=a;function a(){for(var o=0,s=0,u=arguments.length;s<u;s++)o+=arguments[s].length;for(var f=Array(o),l=0,s=0;s<u;s++)for(var c=arguments[s],h=0,d=c.length;h<d;h++,l++)f[l]=c[h];return f}},function(e,n,i){var a=i(4),o=i(9),s=i(34);n.a=function(u,f,l,c){c===void 0&&(c="...");var h=16,d=Object(s.a)(c,l),v=Object(a.a)(u)?u:Object(o.a)(u),p=f,g=[],y,m;if(Object(s.a)(u,l)<=f)return u;for(;y=v.substr(0,h),m=Object(s.a)(y,l),!(m+d>p&&m>p);)if(g.push(y),p-=m,v=v.substr(h),!v)return g.join("");for(;y=v.substr(0,1),m=Object(s.a)(y,l),!(m+d>p);)if(g.push(y),p-=m,v=v.substr(1),!v)return g.join("");return""+g.join("")+c}},function(e,n,i){var a=function(){function o(){this.map={}}return o.prototype.has=function(s){return this.map[s]!==void 0},o.prototype.get=function(s,u){var f=this.map[s];return f===void 0?u:f},o.prototype.set=function(s,u){this.map[s]=u},o.prototype.clear=function(){this.map={}},o.prototype.delete=function(s){delete this.map[s]},o.prototype.size=function(){return Object.keys(this.map).length},o}();n.a=a},function(e,n){function i(l,c,h,d){d===void 0&&(d=[]);var v=this;v.w=l||0,v.h=c||0,v.y=h||0,v.x=0,v.c=d||[],v.cs=d.length,v.prelim=0,v.mod=0,v.shift=0,v.change=0,v.tl=null,v.tr=null,v.el=null,v.er=null,v.msel=0,v.mser=0}i.fromNode=function(l,c){if(!l)return null;var h=[];return l.children.forEach(function(d){h.push(i.fromNode(d,c))}),c?new i(l.height,l.width,l.x,h):new i(l.width,l.height,l.y,h)};function a(l,c,h){h?l.y+=c:l.x+=c,l.children.forEach(function(d){a(d,c,h)})}function o(l,c){var h=c?l.y:l.x;return l.children.forEach(function(d){h=Math.min(o(d,c),h)}),h}function s(l,c){var h=o(l,c);a(l,-h,c)}function u(l,c,h){h?c.y=l.x:c.x=l.x,l.c.forEach(function(d,v){u(d,c.children[v],h)})}function f(l,c,h){h===void 0&&(h=0),c?(l.x=h,h+=l.width):(l.y=h,h+=l.height),l.children.forEach(function(d){f(d,c,h)})}e.exports=function(l,c){c===void 0&&(c={});var h=c.isHorizontal;function d(T){if(T.cs===0){v(T);return}d(T.c[0]);for(var I=S(b(T.c[0].el),0,null),D=1;D<T.cs;++D){d(T.c[D]);var N=b(T.c[D].er);p(T,D,I),I=S(N,D,I)}w(T),v(T)}function v(T){T.cs===0?(T.el=T,T.er=T,T.msel=T.mser=0):(T.el=T.c[0].el,T.msel=T.c[0].msel,T.er=T.c[T.cs-1].er,T.mser=T.c[T.cs-1].mser)}function p(T,I,D){for(var N=T.c[I-1],P=N.mod,G=T.c[I],W=G.mod;N!==null&&G!==null;){b(N)>D.low&&(D=D.nxt);var k=P+N.prelim+N.w-(W+G.prelim);k>0&&(W+=k,g(T,I,D.index,k));var R=b(N),Y=b(G);R<=Y&&(N=m(N),N!==null&&(P+=N.mod)),R>=Y&&(G=y(G),G!==null&&(W+=G.mod))}!N&&G?x(T,I,G,W):N&&!G&&E(T,I,N,P)}function g(T,I,D,N){T.c[I].mod+=N,T.c[I].msel+=N,T.c[I].mser+=N,M(T,I,D,N)}function y(T){return T.cs===0?T.tl:T.c[0]}function m(T){return T.cs===0?T.tr:T.c[T.cs-1]}function b(T){return T.y+T.h}function x(T,I,D,N){var P=T.c[0].el;P.tl=D;var G=N-D.mod-T.c[0].msel;P.mod+=G,P.prelim-=G,T.c[0].el=T.c[I].el,T.c[0].msel=T.c[I].msel}function E(T,I,D,N){var P=T.c[I].er;P.tr=D;var G=N-D.mod-T.c[I].mser;P.mod+=G,P.prelim-=G,T.c[I].er=T.c[I-1].er,T.c[I].mser=T.c[I-1].mser}function w(T){T.prelim=(T.c[0].prelim+T.c[0].mod+T.c[T.cs-1].mod+T.c[T.cs-1].prelim+T.c[T.cs-1].w)/2-T.w/2}function _(T,I){I+=T.mod,T.x=T.prelim+I,C(T);for(var D=0;D<T.cs;D++)_(T.c[D],I)}function M(T,I,D,N){if(D!==I-1){var P=I-D;T.c[D+1].shift+=N/P,T.c[I].shift-=N/P,T.c[I].change-=N-N/P}}function C(T){for(var I=0,D=0,N=0;N<T.cs;N++)I+=T.c[N].shift,D+=I+T.c[N].change,T.c[N].mod+=D}function S(T,I,D){for(;D!==null&&T>=D.low;)D=D.nxt;return{low:T,index:I,nxt:D}}f(l,h);var A=i.fromNode(l,h);return d(A),_(A,0),u(A,l,h),s(l,h),l}},function(e,n,i){function a(v,p){v.prototype=Object.create(p.prototype),v.prototype.constructor=v,o(v,p)}function o(v,p){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(y,m){return y.__proto__=m,y},o(v,p)}var s=i(11),u=i(121),f=i(17),l=i(6),c=function(v){a(p,v);function p(){return v.apply(this,arguments)||this}var g=p.prototype;return g.execute=function(){var m=this;return m.rootNode.width=0,f(m.rootNode,m.options,u)},p}(s),h={};function d(v,p){return p=l.assign({},h,p),new c(v,p).execute()}e.exports=d},function(e,n,i){var a=i(6);function o(f,l){l===void 0&&(l=[]);var c=this;c.x=c.y=0,c.leftChild=c.rightChild=null,c.height=0,c.children=l}var s={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function u(f,l,c){c?(l.x=f.x,l.y=f.y):(l.x=f.y,l.y=f.x),f.children.forEach(function(h,d){u(h,l.children[d],c)})}e.exports=function(f,l){l===void 0&&(l={}),l=a.assign({},s,l);var c=0;function h(y){if(!y)return null;y.width=0,y.depth&&y.depth>c&&(c=y.depth);var m=y.children,b=m.length,x=new o(y.height,[]);return m.forEach(function(E,w){var _=h(E);x.children.push(_),w===0&&(x.leftChild=_),w===b-1&&(x.rightChild=_)}),x.originNode=y,x.isLeaf=y.isLeaf(),x}function d(y){if(y.isLeaf||y.children.length===0)y.drawingDepth=c;else{var m=y.children.map(function(x){return d(x)}),b=Math.min.apply(null,m);y.drawingDepth=b-1}return y.drawingDepth}var v;function p(y){y.x=y.drawingDepth*l.rankSep,y.isLeaf?(y.y=0,v&&(y.y=v.y+v.height+l.nodeSep,y.originNode.parent!==v.originNode.parent&&(y.y+=l.subTreeSep)),v=y):(y.children.forEach(function(m){p(m)}),y.y=(y.leftChild.y+y.rightChild.y)/2)}var g=h(f);return d(g),p(g),u(g,f,l.isHorizontal),f}},function(e,n,i){function a(g,y){g.prototype=Object.create(y.prototype),g.prototype.constructor=g,o(g,y)}function o(g,y){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,x){return b.__proto__=x,b},o(g,y)}var s=i(11),u=i(123),f=i(35),l=i(6),c=["LR","RL","H"],h=c[0],d=function(g){a(y,g);function y(){return g.apply(this,arguments)||this}var m=y.prototype;return m.execute=function(){var x=this,E=x.options,w=x.rootNode;E.isHorizontal=!0;var _=E.indent,M=_===void 0?20:_,C=E.dropCap,S=C===void 0?!0:C,A=E.direction,T=A===void 0?h:A,I=E.align;if(T&&c.indexOf(T)===-1)throw new TypeError("Invalid direction: "+T);if(T===c[0])u(w,M,S,I);else if(T===c[1])u(w,M,S,I),w.right2left();else if(T===c[2]){var D=f(w,E),N=D.left,P=D.right;u(N,M,S,I),N.right2left(),u(P,M,S,I);var G=N.getBoundingBox();P.translate(G.width,0),w.x=P.x-w.width/2}return w},y}(s),v={};function p(g,y){return y=l.assign({},v,y),new d(g,y).execute()}e.exports=p},function(e,n,i){var a=i(6);function o(s,u,f,l,c){var h=typeof f=="function"?f(s):f*s.depth;if(!l)try{if(s.id===s.parent.children[0].id){s.x+=h,s.y=u?u.y:0;return}}catch{}if(s.x+=h,u){if(s.y=u.y+a.getHeight(u,s,c),u.parent&&s.parent.id!==u.parent.id){var d=u.parent,v=d.y+a.getHeight(d,s,c);s.y=v>s.y?v:s.y}}else s.y=0}e.exports=function(s,u,f,l){var c=null;s.eachNode(function(h){o(h,c,u,f,l),c=h})}},function(e,n,i){function a(v,p){v.prototype=Object.create(p.prototype),v.prototype.constructor=v,o(v,p)}function o(v,p){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(y,m){return y.__proto__=m,y},o(v,p)}var s=i(11),u=i(125),f=i(17),l=i(6),c=function(v){a(p,v);function p(){return v.apply(this,arguments)||this}var g=p.prototype;return g.execute=function(){var m=this;return f(m.rootNode,m.options,u)},p}(s),h={};function d(v,p){return p=l.assign({},h,p),new c(v,p).execute()}e.exports=d},function(e,n,i){var a=i(6);function o(f,l){var c=0;return f.children.length?f.children.forEach(function(h){c+=o(h,l)}):c=f.height,f._subTreeSep=l.getSubTreeSep(f.data),f.totalHeight=Math.max(f.height,c)+2*f._subTreeSep,f.totalHeight}function s(f){var l=f.children,c=l.length;if(c){l.forEach(function(y){s(y)});var h=l[0],d=l[c-1],v=d.y-h.y+d.height,p=0;if(l.forEach(function(y){p+=y.totalHeight}),v>f.height)f.y=h.y+v/2-f.height/2;else if(l.length!==1||f.height>p){var g=f.y+(f.height-v)/2-h.y;l.forEach(function(y){y.translate(0,g)})}else f.y=(h.y+h.height/2+d.y+d.height/2)/2-f.height/2}}var u={getSubTreeSep:function(){return 0}};e.exports=function(f,l){l===void 0&&(l={}),l=a.assign({},u,l),f.parent={x:0,width:0,height:0,y:0},f.BFTraverse(function(c){c.x=c.parent.x+c.parent.width}),f.parent=null,o(f,l),f.startY=0,f.y=f.totalHeight/2-f.height/2,f.eachNode(function(c){var h=c.children,d=h.length;if(d){var v=h[0];if(v.startY=c.startY+c._subTreeSep,d===1)v.y=c.y+c.height/2-v.height/2;else{v.y=v.startY+v.totalHeight/2-v.height/2;for(var p=1;p<d;p++){var g=h[p];g.startY=h[p-1].startY+h[p-1].totalHeight,g.y=g.startY+g.totalHeight/2-g.height/2}}}}),s(f)}}])})})(Xk);var _fe=Xk.exports;const Zd=ba(_fe);var eM=_n.traverseTree,Sfe=function(t,e){var n;return t?ht(t)?n=function(a){return t}:n=t:n=function(a){return e||1},n},Mfe=function(t,e){var n=[],i=[],a={},o=0;for(o=0;o<t.length;o++){var s=t[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<e.length;o++){var u=e[o];i[a[u.source]].push(a[u.target]),i[a[u.target]].push(a[u.source])}var f=0;for(o=0;o<t.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}},Cfe=function(t,e,n){var i=[],a=[],o={},s=0;for(s=0;s<t.length;s++){var u=t[s];o[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),a.push([])}for(s=0;s<e.length;s++){var f=e[s];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<t.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}},Afe=function(t,e,n,i){var a=[],o=[],s={},u=0;for(u=0;u<t.length;u++){var f=t[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<e.length;u++){var l=e[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<t.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}},Tfe=function(t,e){var n=[],i=t.length,a={};return e.forEach(function(o){t.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}},Ife=function(t){for(var e=[],n=t.length,i=t[0].length,a=function(u){t.forEach(function(f,l){if(e.push(f[u]),l===n-1)for(;e.length%4!==0;)e.push(0)})},o=0;o<i;o++)a(o);return new Float32Array(e)},Ofe=function(t,e){var n=["V","TB","BT"],i={x:1/0,y:1/0},a={x:-1/0,y:-1/0},o="x",s="y";e&&n.indexOf(e)>=0&&(s="x",o="y");var u=0;eM(t,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||eM(t,function(c){var h=(c[s]-i[s])/l*(Math.PI*2-f)+f,d=Math.abs(o==="x"?c.x-t.x:c.y-t.y);return c.x=d*Math.cos(h),c.y=d*Math.sin(h),!0}),t};const Lfe=Object.freeze(Object.defineProperty({__proto__:null,arrayToTextureData:Ife,attributesToTextureData:Tfe,buildTextureData:Mfe,buildTextureDataWithOneEdgeAttr:Cfe,buildTextureDataWithTwoEdgeAttr:Afe,proccessToFunc:Sfe,radialLayout:Ofe},Symbol.toStringTag,{value:"Module"}));var Yk=function r(){return typeof window>"u"||typeof document>"u"?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl")))}catch{return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var e=document.createElement("div");return e.id="webgl-error-message",e.style.fontFamily="monospace",e.style.fontSize="13px",e.style.fontWeight="normal",e.style.textAlign="center",e.style.background="#fff",e.style.color="#000",e.style.padding="1.5em",e.style.width="400px",e.style.margin="5em auto 0",this.webgl||(e.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
- `)),e},addGetWebGLMessage:function(e){e=e||{};var n=e.parent!==void 0?e.parent:document.body,i=e.id!==void 0?e.id:"oldie",a=r().getWebGLErrorMessage();a.id=i,n.appendChild(a)}}};const Dfe=Object.freeze(Object.defineProperty({__proto__:null,gpuDetector:Yk},Symbol.toStringTag,{value:"Module"}));var Vk=function(){var t=navigator.userAgent.toLowerCase();return t.indexOf("firefox")>-1?"firefox":t.indexOf("safari")>-1?"safari":t.indexOf("opr")>-1?"opera":t.indexOf("chrome")>-1?"chrome":t.indexOf("trident")>-1?"ie 11":t.indexOf("ie")>-1?"ie":"unknown"};const kfe=Object.freeze(Object.defineProperty({__proto__:null,getBrowserName:Vk},Symbol.toStringTag,{value:"Module"}));var no=F(F(F(F(F({},_n),EX),Lfe),Dfe),kfe),Pfe=no.radialLayout,Nfe=function(){function r(t){this.type=t.type,this.radial=t.radial,this.config=t}return r.prototype.init=function(t){var e=this;if(this.data=t,this.radial){this.layoutMethod=function(n){var i=Zd[e.type](n,e.config);return Pfe(i),i};return}this.layoutMethod=function(n){return Zd[e.type](n,e.config)}},r.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},r.prototype.layout=function(t){return this.init(t),this.execute()},r}();Ht.registerLayout("grid",Ht.GridLayout);Ht.registerLayout("random",Ht.RandomLayout);Ht.registerLayout("force",Ht.ForceLayout);Ht.registerLayout("circular",Ht.CircularLayout);Ht.registerLayout("dagre",Ht.DagreLayout);Ht.registerLayout("dagreCompound",Ht.DagreCompoundLayout);Ht.registerLayout("radial",Ht.RadialLayout);Ht.registerLayout("concentric",Ht.ConcentricLayout);Ht.registerLayout("mds",Ht.MDSLayout);Ht.registerLayout("fruchterman",Ht.FruchtermanLayout);Ht.registerLayout("fruchterman-gpu",Ht.FruchtermanGPULayout);Ht.registerLayout("gForce",Ht.GForceLayout);Ht.registerLayout("force2",Ht.Force2Layout);Ht.registerLayout("gForce-gpu",Ht.GForceGPULayout);Ht.registerLayout("comboForce",Ht.ComboForceLayout);Ht.registerLayout("comboCombined",Ht.ComboCombinedLayout);Ht.registerLayout("forceAtlas2",Ht.ForceAtlas2Layout);var Rfe=function(t,e){e.isCustomLayout=!0,Ht.Layouts[t]=Ht.registerLayout(t,e)},Bfe=function(){function r(t,e){var n=t.toString(),i=new Blob(["importScripts('".concat(e,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(i))}return r}(),Ffe=function(t){t===void 0&&(t="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");function e(){var i={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout);function a(s){var u=s.data.type;return u===i.RUN||u===i.GPURUN}function o(s){var u=this,f=s.data.type;switch(f){case i.RUN:{var l=s.data,c=l.nodes,h=l.edges,d=l.layoutCfg,v=d===void 0?{}:d,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:i.ERROR,message:"layout ".concat(p," not found")});break}var y;v.onLayoutEnd=function(){u.postMessage({type:i.END,nodes:c}),y==null||y.destroy()},y=new g(v),y.init({nodes:c,edges:h}),y.execute();break}case i.GPURUN:{var m=s.data,b=m.nodes,h=m.edges,x=m.layoutCfg,v=x===void 0?{}:x,E=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 w=new g(v);w.init({nodes:b,edges:h}),w.executeWithWorker(E,this);break}}}onmessage=function(u){a(u)&&o(u)}}var n=new Bfe(e,t);return n},du={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function Ky(r){"@babel/helpers - typeof";return Ky=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ky(r)}var tM=function(t){return setTimeout(t,16)},rM=function(t){return clearTimeout(t)},Oh={requestAnimationFrame:function(t){var e=typeof window<"u"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||tM;return e(t)},cancelAnimationFrame:function(t){var e=typeof window<"u"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||rM;return e(t)}},Gfe=["fruchterman","gForce"],zfe=["force","grid","circular"],jfe=function(r){Ot(t,r);function t(e){var n=r.call(this,e)||this;return n.graph=e,n.layoutCfg=e.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return t.prototype.initLayout=function(){},t.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=Ffe(this.layoutCfg.workerScriptURL),this.worker)},t.prototype.stopWorker=function(){var e=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,e.requestId&&(Oh.cancelAnimationFrame(e.requestId),e.requestId=null),e.requestId2&&(Oh.cancelAnimationFrame(e.requestId2),e.requestId2=null))},t.prototype.execLayoutMethod=function(e,n){var i=this;return new Promise(function(a,o){return Hn(i,void 0,void 0,function(){var s,u,f,l,c,p,h,d,v,p,g;return Kn(this,function(y){switch(y.label){case 0:if(s=this.graph,!s||s.get("destroyed"))return[2];u=e.type,e.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},u&&this.isGPU&&(Hk(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),_n.isForce(u)?(f=e.onTick,l=e.animate,c=l===void 0&&(u==="force"||u==="force2"),p=function(){f&&f(),(l||c)&&s.refreshPositions()},e.tick=p):(u==="comboForce"||u==="comboCombined")&&(e.comboTrees=s.get("comboTrees")),h=!1;try{d=new Ht.Layouts[u](e),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=e.onTick,p=function(){v&&v(),s.refreshPositions()},d.tick=p),g=this.filterLayoutData(this.data,e),Wfe(g,n),d.init(g),s.emit("beforesublayout",{type:u}),[4,d.execute()];case 1:return y.sent(),d.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}})})})},t.prototype.updateLayoutMethod=function(e,n){var i=this;return new Promise(function(a,o){return Hn(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Kn(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()},_n.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),e.init(d),e.updateCfg(n),s.emit("beforesublayout",{type:u}),[4,e.execute()];case 1:return v.sent(),e.isCustomLayout&&n.onLayoutEnd&&n.onLayoutEnd(),[2]}})})})},t.prototype.layout=function(e){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(E){var w;return d=!!(!((w=E.nodes)===null||w===void 0)&&w.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=nM(c,h);var y=c.onLayoutEnd,m=c.layoutEndFormatted,b=c.adjust;if(m||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Hn(n,void 0,void 0,function(){return Kn(this,function(E){switch(E.label){case 0:return y&&y(s),this.refreshLayout(),b&&c.pipes?[4,this.adjustPipesBox(this.data,b)]:[3,2];case 1:E.sent(),this.refreshLayout(),E.label=2;case 2:return a.emit("afterlayout"),[2]}})})}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,e))return!0;var x=!1;return c.type?(x=!0,p=p.then(function(){return Hn(n,void 0,void 0,function(){return Kn(this,function(E){switch(E.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,E.sent()]}})})})):c.pipes&&(x=!0,c.pipes.forEach(function(E,w){p=p.then(function(){return Hn(n,void 0,void 0,function(){return Kn(this,function(_){switch(_.label){case 0:return[4,this.execLayoutMethod(E,w)];case 1:return[2,_.sent()]}})})})})),x?p.then(function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),e&&e()}).catch(function(E){console.warn("graph layout failed,",E)}):(a.refreshPositions(),e==null||e()),!1}},t.prototype.tweakInit=function(){var e=this,n=e.data,i=e.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})}},t.prototype.initWithPreset=function(e,n){var i=this;return new Promise(function(a,o){return Hn(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Kn(this,function(v){switch(v.label){case 0:return s=this,u=s.layoutCfg,f=s.data,l=u.preset,!(l!=null&&l.type)||!Ht.Layouts[l==null?void 0:l.type]?(n==null||n(),a(),[2,!1]):(c=nM(l,l.type),h=c?"".concat(l.type,"-gpu"):l.type,d=new Ht.Layouts[h](l),delete u.preset,d.init(f),[4,d.execute()]);case 1:return v.sent(),e==null||e(),a(),[2,!0]}})})})},t.prototype.layoutWithWorker=function(e,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,e,o)});else if(o.pipes){c=!0;for(var h=function(y){l=l.then(function(){return i.runWebworker(u,e,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},t.prototype.runWebworker=function(e,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=Ufe(i,function(v){return typeof v!="function"});if(!c)e.postMessage({type:du.RUN,nodes:u,edges:f,layoutCfg:h});else{var d=l.transferControlToOffscreen();h.type="".concat(h.type,"-gpu"),e.postMessage({type:du.GPURUN,nodes:u,edges:f,layoutCfg:h,canvas:d},[d])}return new Promise(function(v,p){e.onmessage=function(g){a.handleWorkerMessage(v,p,g,s,i)}})},t.prototype.handleWorkerMessage=function(e,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 du.TICK:f.currentTick=l.currentTick,f.currentTickData=l,f.requestId||(f.requestId=Oh.requestAnimationFrame(function(){m0(a,l),u.refreshPositions(),h(),l.currentTick===l.totalTicks?e():f.currentTick===l.totalTicks&&(f.requestId2=Oh.requestAnimationFrame(function(){m0(a,f.currentTickData),u.refreshPositions(),f.requestId2=null,h(),e()})),f.requestId=null}));break;case du.END:f.currentTick==null&&(m0(a,l),e());break;case du.GPUEND:f.currentTick==null&&($fe(a,l),e());break;case du.ERROR:console.warn("Web-Worker layout error!",l.message),n();break;default:n();break}},t.prototype.updateLayoutCfg=function(e){var n=this,i=this,a=i.graph,o=i.layoutMethods;if(!(!a||a.get("destroyed"))){var s=e.disableTriggerLayout,u=sn(e,["disableTriggerLayout"]),f=yt({},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 Hn(n,void 0,void 0,function(){return Kn(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 Hn(n,void 0,void 0,function(){return Kn(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)})}}}},t.prototype.adjustPipesBox=function(e,n){var i=this;return new Promise(function(a){var o=e.nodes;o!=null&&o.length||a(),zfe.includes(n)||(console.warn("The adjust type ".concat(n," is not supported yet, please assign it with 'force', 'grid', or 'circular'.")),a());var s={center:i.layoutCfg.center,nodeSize:function(v){return Math.max(v.height,v.width)},preventOverlap:!0,onLayoutEnd:function(){}},u=i.getLayoutBBox(o),f=u.groupNodes,l=u.layoutNodes,c=Vt(l);s.onLayoutEnd=function(){l==null||l.forEach(function(d,v){var p,g,y,m=d.x-((p=c[v])===null||p===void 0?void 0:p.x),b=d.y-((g=c[v])===null||g===void 0?void 0:g.y);(y=f[v])===null||y===void 0||y.forEach(function(x){x.x+=m,x.y+=b})}),a()};var h=new Ht.Layouts[n](s);h.layout({nodes:l})})},t.prototype.destroy=function(){this.destoryLayoutMethods();var e=this.worker;e&&(e.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},t}(zI);function m0(r,t){for(var e=r.nodes,n=t.nodes,i=e.length,a=0;a<i;a++){var o=e[a];o.x=n[a].x,o.y=n[a].y}}function Ufe(r,t){var e={};return r&&Ky(r)==="object"?(Object.keys(r).forEach(function(n){r.hasOwnProperty(n)&&t(r[n])&&(e[n]=r[n])}),e):r}function $fe(r,t){for(var e=r.nodes,n=t.vertexEdgeData,i=e.length,a=0;a<i;a++){var o=e[a],s=n[4*a],u=n[4*a+1];o.x=s,o.y=u}}function Wfe(r,t){var e;if(!((e=r==null?void 0:r.nodes)===null||e===void 0)&&e.length){var n=r.nodes;n.forEach(function(i){i.layoutOrder=t})}}function Hk(r){return Gfe.includes(r)}function nM(r,t){var e=t;t&&t.split("-")[1]==="gpu"&&(e=t.split("-")[0],r.gpuEnabled=!0);var n=!1;return r.gpuEnabled&&(n=!0,Yk().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),n=!1)),n&&!Hk(e)&&(console.warn("The '".concat(e,"' layout does not support GPU calculation for now, it will run in CPU.")),n=!1),n}var iM=xi,Xfe="svg",Kk=function(r){Ot(t,r);function t(e){var n=r.call(this,e)||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 t.prototype.initLayoutController=function(){var e=new jfe(this);this.set({layoutController:e})},t.prototype.initEventController=function(){var e=new TX(this);this.set({eventController:e})},t.prototype.initCanvas=function(){var e=this.get("container");if(typeof e=="string"&&(e=document.getElementById(e),this.set("container",e)),!e)throw new Error("invalid container");var n=e.clientWidth,i=e.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===Xfe)u=new Qf({container:e,width:a,height:o});else{var f={container:e,width:a,height:o},l=this.get("pixelRatio");l&&(f.pixelRatio=l,window.devicePixelRatio=l),u=new $a(f)}this.set("canvas",u)},t.prototype.initPlugins=function(){var e=this;me(e.get("plugins"),function(n){!n.destroyed&&n.initPlugin&&n.initPlugin(e)})},t.prototype.downloadImageWatermark=function(e,n,i,a){return Hn(this,void 0,void 0,function(){var o,s,u;return Kn(this,function(f){switch(f.label){case 0:return o=e.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]}})})},t.prototype.asyncToDataUrl=function(e,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="";e||(e="image/png"),setTimeout(function(){return Hn(u,void 0,void 0,function(){var v,p,g,y,m,b,x,E,w,_;return Kn(this,function(M){switch(M.label){case 0:return c!=="svg"?[3,1]:(v=h.cloneNode(!0),p=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),g=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",p),g.replaceChild(v,g.documentElement),y=new XMLSerializer().serializeToString(g),d="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(y)),[3,4]);case 1:return m=void 0,b=h.getContext("2d"),x=a||this.get("width"),E=o||this.get("height"),w=void 0,f?[4,this.downloadImageWatermark(f,b,x,E)]:[3,3];case 2:M.sent(),M.label=3;case 3:if(n){_=typeof window<"u"?window.devicePixelRatio:1;try{m=b.getImageData(0,0,x*_,E*_),w=b.globalCompositeOperation,b.globalCompositeOperation="destination-over",b.fillStyle=n,b.fillRect(0,0,x,E)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}d=h.toDataURL(e),n&&(b.clearRect(0,0,x,E),b.putImageData(m,0,0),b.globalCompositeOperation=w),M.label=4;case 4:return i&&i(d),[2]}})})},16)},t.prototype.toDataURL=function(e,n){var i=this.get("canvas"),a=i.getRenderer(),o=i.get("el");e||(e="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(e),n&&(d.clearRect(0,0,v,p),d.putImageData(h,0,0),d.globalCompositeOperation=g)}return s},t.prototype.toFullDataURL=function(e,n,i){var a=this.get("group").getCanvasBBox(),o=a.height,s=a.width,u=this.get("renderer"),f=wr('<div id="virtual-image"></div>'),l=i?i.backgroundColor:void 0,c=i?i.padding:void 0;c?ht(c)&&(c=[c,c,c,c]):c=[0,0,0,0];var h=o+c[0]+c[2],d=s+c[1]+c[3],v={container:f,height:h,width:d,quickHit:!0},p=u==="svg"?new Qf(v):new $a(v),g=this.get("group"),y=g.clone(),m=Vt(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var b=(a.maxX+a.minX)/2,x=(a.maxY+a.minY)/2;m=iM(m,[["t",-b,-x],["t",s/2+c[3],o/2+c[0]]]),y.resetMatrix(),y.setMatrix(m),p.add(y);var E=p.get("el"),w="";n||(n="image/png"),setTimeout(function(){if(u==="svg"){var _=E.cloneNode(!0),M=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),C=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",M);C.replaceChild(_,C.documentElement);var S=new XMLSerializer().serializeToString(C);w="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(S))}else{var A=void 0,T=E.getContext("2d"),I=void 0;if(l){var D=typeof window<"u"?window.devicePixelRatio:1;try{A=T.getImageData(0,0,d*D,h*D),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")}}w=E.toDataURL(n),l&&(T.clearRect(0,0,d,h),T.putImageData(A,0,0),T.globalCompositeOperation=I)}e&&e(w)},16)},t.prototype.downloadFullImage=function(e,n,i){var a=this,o=this.get("group").getCanvasBBox(),s=o.height,u=o.width,f=this.get("renderer"),l=wr('<div id="virtual-image"></div>'),c=document.querySelector(".g6-graph-watermarker"),h=i?i.backgroundColor:void 0,d=i?i.padding:void 0;d?ht(d)&&(d=[d,d,d,d]):d=[0,0,0,0];var v=s+d[0]+d[2],p=u+d[1]+d[3];if(c){var g=this.get("graphWaterMarker").cfg||{},y=g.width,m=g.height;v=Math.ceil(v/m)*m,p=Math.ceil(p/y)*y}var b={container:l,height:v,width:p},x=f==="svg"?new Qf(b):new $a(b),E=this.get("group"),w=SX(E),_=Vt(w.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var M=(o.maxX+o.minX)/2,C=(o.maxY+o.minY)/2;_=iM(_,[["t",-M,-C],["t",u/2+d[3],s/2+d[0]]]),w.resetMatrix(),w.setMatrix(_),x.add(w);var S=x.get("el");n||(n="image/png"),this.asyncToDataUrl(n,h,function(A){var T=document.createElement("a"),I=(e||"graph")+(f==="svg"?".svg":".".concat(n.split("/")[1]));a.dataURLToImage(A,f,T,I);var D=document.createEvent("MouseEvents");D.initEvent("click",!1,!1),T.dispatchEvent(D)},p,v,S)},t.prototype.downloadImage=function(e,n,i){var a=this,o=this;o.stopAnimate();var s=o.get("canvas"),u=s.getRenderer();n||(n="image/png");var f=(e||"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)})},t.prototype.dataURLToImage=function(e,n,i,a){if(!e||e==="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=e.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=e})},t.prototype.addPlugin=function(e){var n=this;e.destroyed||(n.get("plugins").push(e),e.initPlugin(n))},t.prototype.removePlugin=function(e){var n=this.get("plugins"),i=n.indexOf(e);i>=0&&(e.destroyPlugin(),n.splice(i,1))},t.prototype.setImageWaterMarker=function(e,n){e===void 0&&(e=xs.waterMarkerImage);var i=this.get("container");Ne(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=mr({},xs.imageWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.image;if(!e){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 $a(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=e,m.onload=function(){if(v.drawImage(m,g,y,l.width,l.height),v.rotate(p*Math.PI/180),f)i.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var b=document.querySelector(".g6-graph-watermarker");b||(b=document.createElement("div"),b.className="g6-graph-watermarker"),b.className="g6-graph-watermarker",a.destroyed||(b.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),i.appendChild(b))}}},t.prototype.setTextWaterMarker=function(e,n){var i=this.get("container");Ne(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=mr({},xs.textWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.text;if(!(e!=null&&e.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 $a(h),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var v=a.get("context"),p=l.rotate,g=l.fill,y=l.fontFamily,m=l.fontSize,b=l.baseline,x=l.x,E=l.y,w=l.lineHeight;v.rotate(-p*Math.PI/180),v.font="".concat(m,"px ").concat(y),v.fillStyle=g,v.textBaseline=b;for(var _=Ne(e)?[e]:e,M=_.length-1;M>=0;M--)v.fillText(_[M],x,E+M*w);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)}},t.prototype.destroy=function(){var e,n,i,a;me(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)}}(e=this.get("eventController"))===null||e===void 0||e.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)},t}(RI);function qy(r){"@babel/helpers - typeof";return qy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qy(r)}function qk(r,t){if(t===void 0&&(t=new WeakMap),r===null)return r;if(r instanceof Date)return new Date(r);if(r instanceof RegExp)return new RegExp(r);if(qy(r)!=="object")return r;if(t.get(r))return t.get(r);var e=Array.isArray(r)?[]:{};t.set(r,e);for(var n in r)r.hasOwnProperty(n)&&r[n]!==void 0&&(e[n]=qk(r[n],t));return e}function Yfe(r){try{return structuredClone(r)}catch{return qk(r)}}var Vfe=no.radialLayout,b0=no.traverseTree,Hfe=function(r){Ot(t,r);function t(e){var n=r.call(this,e)||this;return n.layoutAnimating=!1,n.set("removeList",[]),n.set("layoutMethod",n.getLayout()),n}return t.prototype.getLayout=function(){var e=this.get("layout");return e?typeof e=="function"?e:(e.type||(e.type="dendrogram"),e.direction||(e.direction=e.type==="indented"?"LR":"TB"),e.radial?function(n){var i=Zd[e.type](n,e);return Vfe(i),i}:function(n){return Zd[e.type](n,e)}):null},t.indexOfChild=function(e,n){var i=-1;return me(e,function(a,o){if(n===a.id)return i=o,!1}),i},t.prototype.getDefaultCfg=function(){var e=r.prototype.getDefaultCfg.call(this);return e.animate=!0,e},t.prototype.innerAddChild=function(e,n,i){var a=this,o=e.data;o&&(o.x=e.x,o.y=e.y,o.depth=e.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 me(e.children||[],function(c){a.innerAddChild(c,s,i)}),a.emit("afteraddchild",{item:s,parent:n}),s},t.prototype.innerUpdateChild=function(e,n,i){var a=this,o=a.findById(e.id);if(!o){a.innerAddChild(e,n,i);return}me(e.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();t.indexOfChild(e.children||[],l.id)===-1&&(a.innerRemoveChild(l.id,{x:e.x,y:e.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,e.data)),(c!==e.x||h!==e.y)&&o.updatePosition({x:e.x,y:e.y})},t.prototype.innerRemoveChild=function(e,n,i){var a=this,o=a.findById(e);if(o)if(me(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)},t.prototype.changeData=function(e,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:e||i.get("data")}),e?(i.data(e),i.render(!1)):i.layout(this.get("fitView"))},t.prototype.changeLayout=function(e){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var n=this;n.updateLayout(e)},t.prototype.updateLayout=function(e,n,i,a){a===void 0&&(a=!0);var o=this;if(!e){console.warn("layout cannot be null");return}if(a&&this.get("enabledStack")&&this.pushStack("layout",{before:o.get("layout"),after:e}),o.set("layout",e),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)}},t.prototype.refreshLayout=function(e){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var n=this;n.layout(e)},t.prototype.layout=function(e){var n=this,i=this,a=i.get("data"),o=i.get("layoutMethod"),s=i.get("layout"),u=a;if(s!=null&&s.excludeInvisibles){a=Vt(i.get("data"));var f={};b0(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,b0(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),e){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")},t.prototype.addChild=function(e,n,i){i===void 0&&(i=!0);var a=this;a.emit("beforeaddchild",{model:e,parent:n}),Ne(n)||(n=n.get("id"));var o=a.findDataById(n);if(o){o.children||(o.children=[]),o.children.push(e);var s=a.findById(n);s.refresh(),a.changeData(void 0,i)}},t.prototype.updateChildren=function(e,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=e,o.refresh(),a.changeData(void 0,i)},t.prototype.updateChild=function(e,n,i){i===void 0&&(i=!0);var a=this;if(!n||!a.findById(n)){a.changeData(e,i);return}var o=a.findDataById(n),s=a.findById(e.id);if(o.children||(o.children=[]),!s)o.children.push(e);else{var u=t.indexOfChild(o.children,e.id);u>-1&&(o.children[u]=e)}var f=a.findById(n);f==null||f.refresh(),a.changeData(void 0,i)},t.prototype.removeChild=function(e,n){n===void 0&&(n=!0);var i=this,a=i.findById(e),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===e})}),o&&!o.destroyed){var s=o.get("id"),u=i.findDataById(s),f=u&&u.children||[],l=t.indexOfChild(f,e);f.splice(l,1),o.refresh()}i.changeData(void 0,n)},t.prototype.findDataById=function(e,n){var i=this;if(n||(n=i.get("data")),e===n.id)return n;var a=null;return me(n.children||[],function(o){if(o.id===e)return a=o,!1;if(a=i.findDataById(e,o),a)return!1}),a},t.prototype.layoutAnimate=function(e,n){var i=this,a=this.get("animateCfg");i.emit("beforeanimate",{data:e}),i.getEdges().forEach(function(o){var s=o.get("model");s.sourceAnchor||(s.sourceAnchor=o.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(o){b0(e,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,e);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}),me(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(){me(i.getNodes(),function(s){s.set("originAttrs",null)}),me(i.get("removeList"),function(s){i.removeItem(s,!1)}),i.set("removeList",[]),a.callback&&a.callback(),i.emit("afteranimate",{data:e})},delay:a.delay})},t.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},t.prototype.isLayoutAnimating=function(){return this.layoutAnimating},t.prototype.render=function(e){e===void 0&&(e=!0);var n=this,i=n.get("data");if(!i||!bn(i)||!Object.keys(i).length)throw new Error("data must be defined first");n.clear(),e&&this.get("enabledStack")&&this.clearStack(),n.emit("beforerender"),n.layout(this.get("fitView")),n.emit("afterrender")},t.prototype.save=function(){return this.get("data")},t.prototype.data=function(e){r.prototype.data.call(this,e),this.set("originData",Yfe(e))},t}(Kk),Kfe=function(){function r(t){this._cfgs=mr(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return r.prototype.getDefaultCfgs=function(){return{}},r.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var n=e.getEvents(),i={};me(n,function(a,o){var s=vs(e,a);i[o]=s,t.on(o,s)}),this._events=i,this.init()},r.prototype.getEvents=function(){return{}},r.prototype.get=function(t){var e;return(e=this._cfgs)===null||e===void 0?void 0:e[t]},r.prototype.set=function(t,e){this._cfgs[t]=e},r.prototype.destroy=function(){},r.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;me(e,function(n,i){t.off(i,n)}),this._events=null,this._cfgs=null,this.destroyed=!0},r}();const jn=Kfe;var qfe=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),aM="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Zfe=function(r){qfe(t,r);function t(e){return r.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{img:aM,follow:!0}},t.prototype.init=function(){var e=this.get("graph"),n=e.get("container"),i=e.get("canvas").get("el"),a=this.get("img")||aM;a.includes("url(")||(a='url("'.concat(a,'")'));var o=wr(`<div class='g6-grid-container' style="position:absolute;overflow:hidden;z-index: -1;"></div>`),s=wr(`<div
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)},t.prototype.positionInit=function(){var e=this.get("graph"),n=e.get("minZoom"),i=e.get("width"),a=e.get("height");Xt(this.get("container"),{width:"".concat(i,"px"),height:"".concat(a,"px")});var o=i*80/n,s=a*80/n;Xt(this.get("gridContainer"),{width:"".concat(o,"px"),height:"".concat(s,"px"),left:"-".concat(o/2,"px"),top:"-".concat(s/2,"px")})},t.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},t.prototype.updateGrid=function(e){var n=this.get("gridContainer"),i=e.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",")");Xt(n,{transform:o})},t.prototype.getContainer=function(){return this.get("container")},t.prototype.destroy=function(){var e=this.get("graph"),n=e.get("container"),i=this.get("container");n.removeChild(i)},t}(jn);const Qfe=Zfe;var Eb={exports:{}},oM=[],Nf=[],Jfe="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function Zk(r,t){if(t=t||{},r===void 0)throw new Error(Jfe);var e=t.prepend===!0?"prepend":"append",n=t.container!==void 0?t.container:document.querySelector("head"),i=oM.indexOf(n);i===-1&&(i=oM.push(n)-1,Nf[i]={});var a;return Nf[i]!==void 0&&Nf[i][e]!==void 0?a=Nf[i][e]:(a=Nf[i][e]=ele(),e==="prepend"?n.insertBefore(a,n.childNodes[0]):n.appendChild(a)),r.charCodeAt(0)===65279&&(r=r.substr(1,r.length)),a.styleSheet?a.styleSheet.cssText+=r:a.textContent+=r,a}function ele(){var r=document.createElement("style");return r.setAttribute("type","text/css"),r}Eb.exports=Zk;Eb.exports.insertCss=Zk;var tle=Eb.exports;const tp=ba(tle);var rle=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();typeof document<"u"&&tp(`
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 nle=function(r){rle(t,r);function t(e){return r.call(this,e)||this}return t.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"}},t.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},t.prototype.init=function(){var e=this.get("className"),n=wr("<div class=".concat(e||"g6-component-contextmenu","></div>"));Xt(n,{top:"0px",position:"absolute",visibility:"hidden"});var i=this.get("container");i||(i=this.get("graph").get("container")),Ne(i)&&(i=document.getElementById(i)),i.appendChild(n),this.set("menu",n)},t.prototype.onMenuShow=function(e){var n=this;e.preventDefault();var i=this.get("itemTypes");if(e.item){if(e.item&&e.item.getType&&i.indexOf(e.item.getType())===-1){n.onMenuHide();return}}else if(i.indexOf("canvas")===-1){n.onMenuHide();return}var a=this.get("shouldBegin");if(a(e)){var o=this.get("menu"),s=this.get("getContent"),u=this.get("graph"),f=s(e,u);Ne(f)?o.innerHTML=f:o.innerHTML=f.outerHTML,this.removeMenuEventListener();var l=this.get("handleMenuClick");if(l){var c=function(M){l(M.target,e.item,u)};this.set("handleMenuClickWrapper",c),o.addEventListener("click",c)}var h=u.get("width"),d=u.get("height"),v=o.getBoundingClientRect(),p=this.get("offsetX")||0,g=this.get("offsetY")||0,y=u.getContainer().offsetTop,m=u.getContainer().offsetLeft,b=e.canvasX+m+p,x=e.canvasY+y+g;b+v.width>h&&(b=e.canvasX-v.width-p+m),x+v.height>d&&(x=e.canvasY-v.height-g+y),x<0&&(x=0),Xt(o,{top:"".concat(x,"px"),left:"".concat(b,"px"),visibility:"visible"});var E=this.get("trigger")==="click",w=function(M){if(E){E=!1;return}n.onMenuHide()};document.body.addEventListener("click",w),this.set("handler",w)}},t.prototype.removeMenuEventListener=function(){var e=this.get("handleMenuClickWrapper"),n=this.get("handler");if(e){var i=this.get("menu");i.removeEventListener("click",e),this.set("handleMenuClickWrapper",null)}n&&document.body.removeEventListener("click",n)},t.prototype.onMenuHide=function(){var e=this.get("menu");e&&Xt(e,{visibility:"hidden"}),this.removeMenuEventListener()},t.prototype.destroy=function(){var e=this.get("menu");if(this.removeMenuEventListener(),e){var n=this.get("container");n||(n=this.get("graph").get("container")),Ne(n)&&(n=document.getElementById(n)),n.removeChild(e)}},t}(jn);const ile=nle;var ale=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Zy=function(){return Zy=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Zy.apply(this,arguments)},sM=Math.max,ole=xi,sle="default",ule="keyShape",fle="delegate",uM="svg",lle=function(r){ale(t,r);function t(e){var n=r.call(this,e)||this;return n.handleUpdateCanvas=Nl(function(i){var a=n;a.destroyed||a.updateCanvas()},100,!1),n}return t.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}},t.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},t.prototype.disableRefresh=function(){this.set("refresh",!1)},t.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},t.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},t.prototype.initViewport=function(){var e=this,n=this._cfgs,i=n.size,a=n.graph;if(!this.destroyed){var o=this.get("canvas"),s=o.get("container"),u=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,f=navigator.userAgent.toLowerCase().indexOf("safari")>-1,l=wr(`
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,b=0,x=f||u?"mousedown":"dragstart";l.addEventListener(x,function(M){var C,S;if(M.dataTransfer){var A=new Image;A.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(S=(C=M.dataTransfer).setDragImage)===null||S===void 0||S.call(C,A,0,0);try{M.dataTransfer.setData("text/html","view-port-minimap")}catch{M.dataTransfer.setData("text","view-port-minimap")}}if(n.refresh=!1,M.target===l){var T=l.style;v=parseInt(T.left,10),p=parseInt(T.top,10),g=parseInt(T.width,10),y=parseInt(T.height,10),!(g>i[0]||y>i[1])&&(b=a.getZoom(),m=e.get("ratio"),d=!0,c=M.clientX,h=M.clientY)}},!1);var E=function(C){if(!(!d||ct(C.clientX)||ct(C.clientY))){var S=c-C.clientX,A=h-C.clientY;(v-S<0||v-S+g>=i[0])&&(S=0),(p-A<0||p-A+y>=i[1])&&(A=0),v-=S,p-=A,Xt(l,{left:"".concat(v,"px"),top:"".concat(p,"px")}),a.translate(S*b/m,A*b/m),c=C.clientX,h=C.clientY}};!f&&!u&&l.addEventListener("drag",E,!1);var w=function(){d=!1,n.refresh=!0},_=f||u?"mouseup":"dragend";l.addEventListener(_,w,!1),s.addEventListener("mouseleave",w),s.addEventListener("mouseup",w),(f||u)&&s.addEventListener("mousemove",E,!1),this.set("viewport",l),s.appendChild(l)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=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)*e,v=(c.y-l.y)*e,p=l.x*e+n,g=l.y*e+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",e);var b="".concat(p,"px"),x="".concat(g,"px");Xt(h,{left:b,top:x,width:"".concat(d,"px"),height:"".concat(v,"px")})}},t.prototype.updateGraphShapes=function(){var e=this._cfgs.graph,n=this.get("canvas"),i=e.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=e.get("renderer");o===uM&&this.updateVisible(a)}},t.prototype.updateVisible=function(e){var n=this;if(!e.isGroup()&&!e.get("visible"))e.hide();else{var i=e.get("children");if(!i||!i.length)return;i.forEach(function(a){a.get("visible")||a.hide(),n.updateVisible(a)})}},t.prototype.updateKeyShapes=function(){var e=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||me(n.getEdges(),function(u){e.updateOneEdgeKeyShape(u,a)}),me(n.getNodes(),function(u){e.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(){e.destroyed||(me(o,function(u){e.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),e.updateCanvas())},250)}this.clearDestroyedShapes()},t.prototype.updateOneComboKeyShape=function(e,n){if(!this.destroyed){var i=this.get("itemMap")||{},a=i[e.get("id")],o=e.getBBox(),s=e.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),e.isVisible()?a.show():a.hide(),a.exist=!0;var c=e.getModel().depth;isNaN(c)||a.set("zIndex",c),i[e.get("id")]=a,this.set("itemMap",i)}},t.prototype.updateOneNodeKeyShape=function(e,n){var i=this.get("itemMap")||{},a=i[e.get("id")],o=e.getBBox(),s=e.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),e.isVisible()?a.show():a.hide(),a.exist=!0;var c=e.getModel().depth;isNaN(c)||a.set("zIndex",c),i[e.get("id")]=a,this.set("itemMap",i)},t.prototype.updateDelegateShapes=function(){var e=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||me(n.getEdges(),function(u){e.updateOneEdgeKeyShape(u,a)}),me(n.getNodes(),function(u){e.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(){e.destroyed||(me(o,function(u){e.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),e.updateCanvas())},250)}this.clearDestroyedShapes()},t.prototype.clearDestroyedShapes=function(){var e=this.get("itemMap")||{},n=Object.keys(e);if(!(!n||n.length===0))for(var i=n.length-1;i>=0;i--){var a=e[n[i]],o=a.exist;a.exist=!1,o||(a.remove(),delete e[n[i]])}},t.prototype.updateOneEdgeKeyShape=function(e,n){var i=this.get("itemMap")||{},a=i[e.get("id")];if(a){var o=e.get("keyShape").attr("path");a.attr("path",o)}else a=e.get("keyShape").clone(),n.add(a);e.isVisible()?a.show():a.hide(),a.exist=!0,i[e.get("id")]=a,this.set("itemMap",i)},t.prototype.updateOneNodeDelegateShape=function(e,n){var i=this.get("delegateStyle"),a=this.get("itemMap")||{},o=a[e.get("id")],s=e.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"});e.isVisible()?o.show():o.hide(),o.exist=!0,a[e.get("id")]=o,this.set("itemMap",a)},t.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)},t.prototype.initContainer=function(){var e=this,n=e.get("graph"),i=e.get("size"),a=e.get("className"),o=e.get("container"),s=wr("<div class='".concat(a,"' style='width: ").concat(i[0],"px; height: ").concat(i[1],"px; overflow: hidden'></div>"));Ne(o)&&(o=document.getElementById(o)),o?o.appendChild(s):n.get("container").appendChild(s),e.set("container",s);var u=wr('<div class="g6-minimap-container" style="position: relative;"></div>');s.appendChild(u),u.addEventListener("dragenter",function(c){c.preventDefault()}),u.addEventListener("dragover",function(c){c.preventDefault()});var f,l=n.get("renderer");l===uM?f=new Qf({container:u,width:i[0],height:i[1]}):f=new $a({container:u,width:i[0],height:i[1]}),e.set("canvas",f),e.updateCanvas()},t.prototype.updateCanvas=function(){if(!this.destroyed){var e=this.get("refresh");if(e){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 sle:this.updateGraphShapes();break;case ule:this.updateKeyShapes();break;case fle: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=sM(f.width,h),d=sM(f.height,d)),h+=2*s,d+=2*s;var v=Math.min(i[0]/h,i[1]/d),p=[1,0,0,0,1,0,0,0,1],g=0,y=0;Number.isFinite(f.minX)&&(g=-f.minX),Number.isFinite(f.minY)&&(y=-f.minY);var m=(i[0]-(h-2*s)*v)/2,b=(i[1]-(d-2*s)*v)/2;p=ole(p,[["t",g,y],["s",v,v],["t",m,b]]),u.setMatrix(p),this.set("ratio",v),this.set("totaldx",m+g*v),this.set("totaldy",b+y*v),this.set("dx",m),this.set("dy",b),this.updateViewport()}}}}}},t.prototype.getCanvas=function(){return this.get("canvas")},t.prototype.getViewport=function(){return this.get("viewport")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.destroy=function(){var e;(e=this.get("canvas"))===null||e===void 0||e.destroy();var n=this.get("container");n!=null&&n.parentNode&&n.parentNode.removeChild(n)},t}(jn);const cle=lle;var hle=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();function Qi(r,t,e){var n=r.x-t.x,i=r.y-t.y;return!e||Math.abs(n)>e||Math.abs(i)>e?Math.sqrt(n*n+i*i):e}function dle(r,t){return r.x*t.x+r.y*t.y}function fM(r,t){var e=(t.source.y-t.target.y)/(t.source.x-t.target.x),n=(e*e*t.source.x+e*(r.y-t.source.y)+r.x)/(e*e+1),i=e*(n-t.source.x)+t.source.y;return{x:n,y:i}}var vle=function(r){hle(t,r);function t(e){return r.call(this,e)||this}return t.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(){}}},t.prototype.init=function(){var e=this.get("graph"),n=this.get("onTick"),i=function(){n&&n(),e.refreshPositions()};this.set("tick",i)},t.prototype.bundling=function(e){var n=this;if(n.set("data",e),!n.isTicking()){var i=e.edges||[],a=e.nodes||[],o={},s=!1;if(a.forEach(function(x){(x.x===null||!x.y===null||x.x===void 0||!x.y===void 0)&&(s=!0),o[x.id]=x}),s)throw new Error("please layout the graph or assign x and y for nodes first");n.set("nodeIdMap",o);var u=n.get("divisions"),f=n.get("divRate"),l=n.divideEdges(u);n.set("edgePoints",l);var c=n.getEdgeBundles();n.set("edgeBundles",c);for(var h=n.get("cycles"),d=n.get("iterations"),v=n.get("iterRate"),p=n.get("lambda"),g=0;g<h;g++){for(var y=function(E){var w=[];i.forEach(function(_,M){if(_.source!==_.target){var C=o[_.source],S=o[_.target];w[M]=n.getEdgeForces({source:C,target:S},M,u,p);for(var A=0;A<u+1;A++)l[M][A].x+=w[M][A].x,l[M][A].y+=w[M][A].y}})},m=0;m<d;m++)y(m);p=p/2,u*=f,d*=v,l=n.divideEdges(u),n.set("edgePoints",l)}i.forEach(function(x,E){x.source!==x.target&&(x.type="polyline",x.controlPoints=l[E].slice(1,l[E].length-1))});var b=n.get("graph");b.refresh()}},t.prototype.updateBundling=function(e){var n=this,i=e.data;if(i&&n.set("data",i),n.get("ticking")&&n.set("ticking",!1),Object.keys(e).forEach(function(o){n.set(o,e[o])}),e.onTick){var a=this.get("graph");n.set("tick",function(){e.onTick(),a.refresh()})}n.bundling(i)},t.prototype.divideEdges=function(e){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(e===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=Qi({x:l.x,y:l.y},{x:c.x,y:c.y});var d=h/(e+1),v=d,p=[{x:l.x,y:l.y}];o[u].forEach(function(g,y){if(y!==0){for(var m=Qi(g,o[u][y-1]);m>v;){var b=v/m,x={x:o[u][y-1].x,y:o[u][y-1].y};x.x+=b*(g.x-o[u][y-1].x),x.y+=b*(g.y-o[u][y-1].y),p.push(x),m-=v,v=d}v-=m}}),p.push({x:c.x,y:c.y}),o[u]=p}}),o},t.prototype.getEdgeLength=function(e){var n=0;return e.forEach(function(i,a){a!==0&&(n+=Qi(i,e[a-1]))}),n},t.prototype.getEdgeBundles=function(){var e=this,n=e.get("data"),i=n.edges||[],a=e.get("bundleThreshold"),o=e.get("nodeIdMap"),s=e.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=e.getBundleScore({source:l,target:c},{source:v,target:p});g>=a&&(s[f].push(d),s[d].push(f))}})}),s},t.prototype.getBundleScore=function(e,n){var i=this;e.vx=e.target.x-e.source.x,e.vy=e.target.y-e.source.y,n.vx=n.target.x-n.source.x,n.vy=n.target.y-n.source.y,e.length=Qi({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),n.length=Qi({x:n.source.x,y:n.source.y},{x:n.target.x,y:n.target.y});var a=i.getAngleScore(e,n),o=i.getScaleScore(e,n),s=i.getPositionScore(e,n),u=i.getVisibilityScore(e,n);return a*o*s*u},t.prototype.getAngleScore=function(e,n){var i=dle({x:e.vx,y:e.vy},{x:n.vx,y:n.vy});return i/(e.length*n.length)},t.prototype.getScaleScore=function(e,n){var i=(e.length+n.length)/2,a=2/(i/Math.min(e.length,n.length)+Math.max(e.length,n.length)/i);return a},t.prototype.getPositionScore=function(e,n){var i=(e.length+n.length)/2,a={x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2},o={x:(n.source.x+n.target.x)/2,y:(n.source.y+n.target.y)/2},s=Qi(a,o);return i/(i+s)},t.prototype.getVisibilityScore=function(e,n){var i=this.getEdgeVisibility(e,n),a=this.getEdgeVisibility(n,e);return i<a?i:a},t.prototype.getEdgeVisibility=function(e,n){var i=fM(n.source,e),a=fM(n.target,e),o={x:(i.x+a.x)/2,y:(i.y+a.y)/2},s={x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2};return Math.max(0,1-2*Qi(o,s)/Qi(i,a))},t.prototype.getEdgeForces=function(e,n,i,a){for(var o=this,s=o.get("edgePoints"),u=o.get("K"),f=u/(Qi(e.source,e.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},t.prototype.getSpringForce=function(e,n){var i=e.pre.x+e.next.x-2*e.cur.x,a=e.pre.y+e.next.y-2*e.cur.y;return i*=n,a*=n,{x:i,y:a}},t.prototype.getElectrostaticForce=function(e,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][e].x-s[n][e].x,y:s[l][e].y-s[n][e].y};if(Math.abs(c.x)>a||Math.abs(c.y)>a){var h=Qi(s[l][e],s[n][e]),d=1/h;f.x+=c.x*d,f.y+=c.y*d}}),f},t.prototype.isTicking=function(){return this.get("ticking")},t.prototype.getSimulation=function(){return this.get("forceSimulation")},t.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),r.prototype.destroy.call(this)},t}(jn);const ple=vle;var gle=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Qy=function(){return Qy=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Qy.apply(this,arguments)},Lh=.05,lM={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},yle=function(r){gle(t,r);function t(e){return r.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{trigger:"mousemove",d:1.5,r:300,delegateStyle:Vt(lM),showLabel:!1,maxD:5,minD:0,scaleRBy:"unset",scaleDBy:"unset",showDPercent:!0}},t.prototype.getEvents=function(){var e;switch(this.get("trigger")){case"click":e={click:"magnify"};break;case"drag":e={click:"createDelegate"};break;default:e={mousemove:"magnify"};break}return e},t.prototype.init=function(){var e=this,n=e.get("r");e.set("cachedMagnifiedModels",[]),e.set("cachedOriginPositions",{}),e.set("r2",n*n);var i=e.get("d");e.set("molecularParam",(i+1)*n)},t.prototype.createDelegate=function(e){var n=this,i=this,a=i.get("delegate");(!a||a.destroyed)&&(i.magnify(e),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)}))},t.prototype.scaleRByWheel=function(e){var n=this;if(!(!e||!e.originalEvent)){e.preventDefault&&e.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(e.clientX,e.clientY);e.originalEvent.wheelDelta<0?a=1-Lh:a=1/(1-Lh);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(e,u)}},t.prototype.scaleRByDrag=function(e){var n=this;if(e){var i=n.get("dragPrePos"),a=n.get("graph"),o,s=a.getPointByClient(e.clientX,e.clientY);e.x-i.x<0?o=1-Lh:o=1/(1-Lh);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(e,s),n.set("dragPrePos",{x:e.x,y:e.y})}},t.prototype.scaleDByWheel=function(e){var n=this;if(!(!e&&!e.originalEvent)){e.preventDefault&&e.preventDefault();var i=0;e.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(e,c)}}},t.prototype.scaleDByDrag=function(e){var n=this,i=n.get("dragPrePos"),a=e.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(e)}n.set("dragPrePos",{x:e.x,y:e.y})},t.prototype.magnify=function(e,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:e.x,y:e.y};i.get("dragging")&&(i.get("trigger")==="mousemove"||i.get("trigger")==="click")&&(p=i.get("cacheCenter"));var g=i.get("delegateCenterDiff");g&&(p.x+=g.x,p.y+=g.y),i.updateDelegate(p,f);for(var y=0;y<v;y++){var m=d[y].getModel(),b=m.x,x=m.y;if(!(isNaN(b)||isNaN(x))){var E=(b-p.x)*(b-p.x)+(x-p.y)*(x-p.y);if(!isNaN(E)&&E<l&&E!==0){var w=Math.sqrt(E),_=h*w/(c*w+f),M=(b-p.x)/w,C=(x-p.y)/w;if(m.x=M*_+p.x,m.y=C*_+p.y,s[m.id]||(s[m.id]={x:b,y:x,texts:[]}),o.push(m),u&&2*w<f)for(var S=d[y],A=S.getContainer(),T=A.getChildren(),I=T.length,D=0;D<I;D++){var N=T[D];N.get("type")==="text"&&(s[m.id].texts.push({visible:N.get("visible"),shape:N}),N.set("visible",!0))}}}}a.refreshPositions()},t.prototype.restoreCache=function(){for(var e=this,n=e.get("cachedMagnifiedModels"),i=e.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)}}e.set("cachedMagnifiedModels",[]),e.set("cachedOriginPositions",{})},t.prototype.updateParams=function(e){var n=this,i=e.r,a=e.d,o=e.trigger,s=e.minD,u=e.maxD,f=e.minR,l=e.maxR,c=e.scaleDBy,h=e.scaleRBy;isNaN(e.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())}},t.prototype.updateDelegate=function(e,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")||lM;s=u.addShape("circle",{attrs:Qy({r:n/1.5,x:e.x,y:e.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:e.x,y:e.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=e.y+n/1.5+16;if(!c||c.destroyed){var d=o.get("group");c=d.addShape("text",{attrs:{text:"".concat(l,"%"),x:e.x,y:h,fill:"#aaa",stroke:"#fff",lineWidth:1,fontSize:12}}),a.set("dPercentText",c)}else c.attr({text:"".concat(l,"%"),x:e.x,y:h})}a.set("delegate",s)},t.prototype.clear=function(){var e=this.get("graph");this.restoreCache(),e.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())},t.prototype.destroy=function(){this.clear()},t}(jn);const mle=yle;var ble=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),cM=.05;typeof document<"u"&&tp(`
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 xle=function(t){if(!t)return[];if(t.composedPath)return t.composedPath();for(var e=[],n=t.target;n;){if(e.push(n),n.tagName==="HTML")return e.push(document,window),e;n=n.parentElement}return e},Ele=function(r){ble(t,r);function t(e){return r.call(this,e)||this}return t.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}},t.prototype.init=function(){var e=this,n=this.get("graph"),i=this.get("getContent"),a=i(n),o=a;Ne(a)&&(o=wr(a));var s=this.get("className");o.setAttribute("class",s||"g6-component-toolbar");var u=this.get("container");u||(u=this.get("graph").get("container")),Ne(u)&&(u=document.getElementById(u)),u.appendChild(o),this.set("toolBar",o);var f=this.get("handleClick");o.addEventListener("click",function(c){var h=xle(c).filter(function(v){return v.nodeName==="LI"});if(h.length!==0){var d=h[0].getAttribute("code");d&&(f?f(d,n):e.handleDefaultOperator(d))}});var l=this.get("position");l&&Xt(o,{top:"".concat(l.y,"px"),left:"".concat(l.x,"px")}),this.bindUndoRedo()},t.prototype.bindUndoRedo=function(){var e=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"),e.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"))}))},t.prototype.undo=function(){var e=this.get("graph"),n=e.getUndoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action;e.pushStack(a,Vt(i.data),"redo");var o=i.data.before;if(a==="add"&&(o=i.data.after),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=e.findById(d.id);d.visible?e.showItem(v,!1):e.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=e.findById(d.id);delete d.id,e.updateItem(v,d,!1),v.getType()==="combo"&&e.updateCombo(v)})});break;case"changedata":e.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,e.addItem(v,d,!1)})});break}case"add":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){e.removeItem(d.id,!1)})});break;case"updateComboTree":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){e.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){e.updateComboTree(d.id,d.parentId,!1)})}),e.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});e.createCombo(f,l,!1);break;case"layout":e.updateLayout(o,void 0,void 0,!1);break}}}},t.prototype.redo=function(){var e=this.get("graph"),n=e.getRedoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action,o=i.data.after;if(e.pushStack(a,Vt(i.data)),a==="delete"&&(o=i.data.before),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=e.findById(h.id);h.visible?e.showItem(d,!1):e.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=e.findById(h.id);delete h.id,e.updateItem(d,h,!1),d.getType()==="combo"&&e.updateCombo(d)})});break;case"changedata":e.changeData(o,!1);break;case"delete":o.edges&&o.edges.forEach(function(l){e.removeItem(l.id,!1)}),o.nodes&&o.nodes.forEach(function(l){e.removeItem(l.id,!1)}),o.combos&&o.combos.forEach(function(l){e.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,e.addItem(d,h,!1)})});break}case"updateComboTree":Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){e.updateComboTree(h.id,h.parentId,!1)})});break;case"createCombo":var s=o.combos[o.combos.length-1];e.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];e.uncombo(f.id,!1);break;case"layout":e.updateLayout(o,void 0,void 0,!1);break}}}},t.prototype.zoomOut=function(){var e=this.get("graph"),n=e.getZoom(),i=1/(1-cM*this.get("zoomSensitivity")),a=this.get("maxZoom")||e.get("maxZoom");i*n>a||e.zoomTo(n*i)},t.prototype.zoomIn=function(){var e=this.get("graph"),n=e.getZoom(),i=1-cM*this.get("zoomSensitivity"),a=this.get("minZoom")||e.get("minZoom");i*n<a||e.zoomTo(n*i)},t.prototype.realZoom=function(){var e=this.get("graph");e.zoomTo(1)},t.prototype.autoZoom=function(){var e=this.get("graph");e.fitView([20,20])},t.prototype.handleDefaultOperator=function(e){switch(e){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}},t.prototype.destroy=function(){var e=this.get("toolBar");if(e){var n=this.get("container");n||(n=this.get("graph").get("container")),Ne(n)&&(n=document.getElementById(n)),n.removeChild(e)}var i=this.get("handleClick");i&&e.removeEventListener("click",i)},t}(jn);const wle=Ele;var _le=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();typeof document<"u"&&tp(`
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 Sle=function(r){_le(t,r);function t(e){return r.call(this,e)||this}return t.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}},t.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"}},t.prototype.init=function(){var e=this,n=e.get("className")||"g6-component-tooltip",i=wr("<div class='".concat(n,"'></div>")),a=e.get("container");a||(a=e.get("graph").get("container")),Ne(a)&&(a=document.getElementById(a)),Xt(i,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(i),e.get("trigger")!=="click"&&(i.addEventListener("mouseenter",function(o){Xt(i,{visibility:"visible",display:"unset"})}),i.addEventListener("mouseleave",function(o){e.hideTooltip()})),e.set("tooltip",i)},t.prototype.onClick=function(e){var n=this.get("itemTypes");if(!(e.item&&e.item.getType&&n.indexOf(e.item.getType())===-1)){var i=e.item,a=this.get("graph");this.currentTarget===i?(this.currentTarget=null,this.hideTooltip(),a.emit("tooltipchange",{item:e.item,action:"hide"})):(this.currentTarget=i,this.showTooltip(e),a.emit("tooltipchange",{item:e.item,action:"show"}))}},t.prototype.onMouseEnter=function(e){var n=this.get("itemTypes");if(!(e.item&&e.item.getType&&n.indexOf(e.item.getType())===-1)){var i=e.item,a=this.get("graph");this.currentTarget=i,this.showTooltip(e),a.emit("tooltipchange",{item:e.item,action:"show"})}},t.prototype.onMouseMove=function(e){var n=this.get("itemTypes");e.item&&e.item.getType&&n.indexOf(e.item.getType())===-1||!this.currentTarget||e.item!==this.currentTarget||this.showTooltip(e)},t.prototype.onMouseLeave=function(){this.hideTooltip();var e=this.get("graph");e.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},t.prototype.clearContainer=function(){var e=this.get("tooltip");e&&(e.innerHTML="")},t.prototype.showTooltip=function(e){if(e.item){var n=this.get("itemTypes");if(!(e.item.getType&&n.indexOf(e.item.getType())===-1)){var i=this.get("tooltip"),a=this.get("getContent"),o=a(e);Ne(o)?i.innerHTML=o:(this.clearContainer(),i.appendChild(o)),this.updatePosition(e)}}},t.prototype.hideTooltip=function(){var e=this.get("tooltip");e&&Xt(e,{visibility:"hidden",display:"none"})},t.prototype.updatePosition=function(e){var n=this.get("shouldBegin"),i=this.get("tooltip");if(!n(e)){Xt(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(e.clientX,e.clientY),c=this.get("fixToNode"),h=e.item;if(h.getType&&h.getType()==="node"&&c&&gt(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};Xt(i,{visibility:"visible",display:"unset"});var b=i.getBoundingClientRect();p+b.width+u>o&&(m.x-=b.width+u),g+b.height+f>s&&(m.y-=b.height+f,m.y<0&&(m.y=0)),Xt(i,{left:"".concat(m.x,"px"),top:"".concat(m.y,"px")})},t.prototype.hide=function(){this.onMouseLeave()},t.prototype.destroy=function(){var e=this.get("tooltip");if(e){var n=this.get("container");n||(n=this.get("graph").get("container")),Ne(n)&&(n=document.getElementById(n)),n.removeChild(e)}},t}(jn);const Mle=Sle;var Qk="timebarstartplay",Jk="timebarendplay",ia="valuechange",Es="timebarConfigChanged",Ao="playPauseBtn",Ll="nextStepBtn",Dl="preStepBtn",Cle=function(){function r(t){var e=t.x,n=e===void 0?0:e,i=t.y,a=i===void 0?0:i,o=t.container,s=t.text,u=t.padding,f=u===void 0?[4,4,4,4]:u,l=t.className,c=l===void 0?"g6-component-timebar-tooltip":l,h=t.backgroundColor,d=h===void 0?"#000":h,v=t.textColor,p=v===void 0?"#fff":v,g=t.opacity,y=g===void 0?.8:g,m=t.fontSize,b=m===void 0?12:m;this.container=o,this.className=c,this.backgroundColor=d,this.textColor=p,this.x=n,this.y=a,this.text=s,this.padding=f,this.opacity=y,this.fontSize=b,this.render()}return r.prototype.render=function(){var t=this,e=t.className;t.x,t.y;var n=t.backgroundColor,i=t.textColor,a=t.text,o=t.padding,s=t.opacity,u=t.fontSize,f=t.container,l=wr("<div class='".concat(e,`' style="position: absolute; width: fit-content; height: fit-content; opacity: `).concat(s,'"></div>'));Ne(f)&&(f=document.getElementById(f)),f.appendChild(l),t.parentHeight=f.offsetHeight,t.parentWidth=f.offsetWidth,Xt(l,{visibility:"hidden",top:0,left:0});var c=wr(`
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),t.backgroundDOM=c;var h=wr("<div style='position: absolute; width: 0px; height: 0px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 10px solid ".concat(n,"'></div>"));l.appendChild(h),t.arrowDOM=h,t.container=l},r.prototype.show=function(t){var e=this,n=t.text,i=t.x;t.y,t.clientX,t.clientY,e.backgroundDOM.innerHTML=n;var a=e.backgroundDOM.offsetWidth,o=e.backgroundDOM.offsetHeight,s=e.arrowDOM.offsetWidth,u=e.arrowDOM.offsetHeight;Xt(e.container,{top:"".concat(-o-u,"px"),left:"".concat(i,"px"),visibility:"visible"}),Xt(e.backgroundDOM,{marginLeft:"".concat(-a/2,"px")}),Xt(e.arrowDOM,{marginLeft:"".concat(-s/2,"px"),top:"".concat(o,"px")});var f=i-a/2,l=i+a/2;f<0?Xt(e.backgroundDOM,{marginLeft:"".concat(-a/2-f,"px")}):l>e.parentWidth&&Xt(e.backgroundDOM,{marginLeft:"".concat(-a/2-l+e.parentWidth+12,"px")})},r.prototype.hide=function(){Xt(this.container,{top:0,left:0,visibility:"hidden"})},r}();const Ale=Cle;var Jy=function(){return Jy=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Jy.apply(this,arguments)},Tle=function(){function r(t){this.config=mr({},t),this.init()}return r.prototype.update=function(t){this.config=mr({},this.config,t),this.updateElement(),this.renderMarker()},r.prototype.init=function(){this.initElement(),this.renderMarker()},r.prototype.initElement=function(){var t=this.config,e=t.group,n=t.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=e.addGroup({name:Ao});this.startMarkerGroup=h.addGroup({name:Ao}),this.circle=e.addShape("circle",{attrs:Jy({x:l,y:c,r:this.config.r*a},n),name:Ao}),this.startMarker=this.startMarkerGroup.addShape("path",{attrs:{path:this.getStartMarkerPath(l,c,a),fill:n.stroke||"#aaa"},name:"start-marker"}),this.pauseMarkerGroup=h.addGroup({name:Ao});var d=.25*this.config.r*a,v=.5*this.config.r*Math.sqrt(3)*a;this.pauseLeftMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:l-.375*this.config.r*a,y:c-v/2,width:d,height:v,fill:n.stroke||"#aaa",lineWidth:0}}),this.pauseRightMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:l+1/8*this.config.r*a,y:c-v/2,width:d,height:v,fill:n.stroke||"#aaa",lineWidth:0}})},r.prototype.updateElement=function(){var t=this.config.style,e=t.scale,n=e===void 0?1:e,i=t.offsetX,a=i===void 0?0:i,o=t.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(t,e,n){var i=.5*this.config.r*Math.sqrt(3)*n;return[["M",t-i/Math.sqrt(3)/2,e-i/2],["L",t+i/Math.sqrt(3),e],["L",t-i/Math.sqrt(3)/2,e+i/2]]},r}();const Ile=Tle;var Hr=function(){return Hr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Hr.apply(this,arguments)},Rf=xi,Ole="#aaa",Lle="green",Dle={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},kle={fill:"#fff"},Ple={fill:"green"},eP={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},tP={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"}},Nle={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:eP,timeTypeControllerStyle:tP},x0=110,vo=50,ta={SINGLE:"single",RANGE:"range"},Rle=function(){function r(t){this.controllerCfg=mr({},Nle,t),this.group=t.group,this.controllerGroup=this.group.addGroup({name:"controller-group"}),this.speedAxisY=[],this.currentSpeed=this.controllerCfg.speed,this.currentType=this.controllerCfg.defaultTimeType||ta.RANGE,this.fontFamily=t.fontFamily||"Arial, sans-serif",this.init()}return r.prototype.init=function(){this.renderPlayButton()},r.prototype.getNextMarkerPath=function(t,e,n){return[["M",t,e-n],["L",t+n,e],["L",t,e+n],["Z",t,e-n],["M",t,e],["L",t-n,e-n],["L",t-n,e+n],["Z"]]},r.prototype.getPreMarkerPath=function(t,e,n){return[["M",t,e-n],["L",t-n,e],["L",t,e+n],["L",t,e-n],["M",t,e],["L",t+n,e-n],["L",t+n,e+n],["Z"]]},r.prototype.renderPlayButton=function(){var t=this.controllerCfg,e=t.width,n=t.height,i=t.x,a=t.y,o=t.hideTimeTypeController,s=t.fill,u=s===void 0?Ole:s,f=t.stroke,l=f===void 0?Lle:f,c=t.containerStyle,h=c===void 0?{}:c,d=Hr(Hr({},Dle),t.playBtnStyle||{}),v=Hr(Hr({},kle),t.preBtnStyle||{}),p=Hr(Hr({},Ple),t.nextBtnStyle||{}),g=n/2-5,y=a+10,m=this.controllerGroup.addShape("rect",{attrs:Hr({x:i,y,width:e,height:n,stroke:l,fill:u},h),name:"container-rect"});this.playButton?this.playButton.update({x:e/2,y,r:g}):this.playButton=new Ile({group:this.controllerGroup,x:e/2,y:y+g+5,r:g,isPlay:this.isPlay,style:d});var b=v.offsetX||0,x=v.offsetY||0,E=(v.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Hr({path:this.getPreMarkerPath(e/2-5*g+b,y+g+5+x,E*.5)},v),name:Dl});var w=p.offsetX||0,_=p.offsetY||0,M=(p.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Hr({path:this.getNextMarkerPath(e/2+5*g+w,y+g+5+_,M*.5)},p),name:Ll}),m.toBack(),this.renderSpeedBtn(),o||this.renderToggleTime(),this.bindEvent();var C=this.controllerCfg.scale,S=C===void 0?1:C,A=this.controllerGroup.getCanvasBBox(),T=(A.maxX+A.minX)/2,I=(A.maxY+A.minY)/2,D=Rf([1,0,0,0,1,0,0,0,1],[["t",-T,-I],["s",S,S],["t",T,I]]);this.controllerGroup.setMatrix(D)},r.prototype.renderSpeedBtn=function(){var t=this.controllerCfg,e=t.y,n=t.width,i=t.hideTimeTypeController,a=Hr(Hr({},eP),this.controllerCfg.speedControllerStyle||{}),o=a.scroller,s=o===void 0?{}:o,u=a.text,f=u===void 0?{}:u,l=a.pointer,c=l===void 0?{}:l,h=a.scale,d=h===void 0?1:h,v=a.offsetX,p=v===void 0?0:v,g=a.offsetY,y=g===void 0?0:g,m=this.controllerGroup.addGroup({name:"speed-group"});this.speedGroup=m;var b=5;this.speedAxisY=[19,22,26,32,39];for(var x=0;x<5;x++){var E=e+this.speedAxisY[x],w=n-(i?vo:x0);m.addShape("line",{attrs:Hr({x1:w,x2:w+15,y1:E,y2:E},s),speed:b,name:"speed-rect"}),this.speedAxisY[x]=E,b=b-1}this.speedText=m.addShape("text",{attrs:Hr({x:n-(i?vo:x0)+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:Hr({path:this.getPointerPath(n-(i?vo:x0),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},c),name:"speed-pointer"});var _=this.speedGroup.getCanvasBBox(),M=(_.maxX+_.minX)/2,C=(_.maxY+_.minY)/2,S=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];S=Rf(S,[["t",-M,-C],["s",d,d],["t",M+p*d,C+y*d]]),this.speedGroup.setMatrix(S)},r.prototype.getPointerPath=function(t,e){return[["M",t,e],["L",t-10,e-4],["L",t-10,e+4],["Z"]]},r.prototype.renderToggleTime=function(){var t,e,n=this.controllerCfg,i=n.width,a=n.defaultTimeType,o=Hr(Hr({},tP),this.controllerCfg.timeTypeControllerStyle||{}),s=o.scale,u=s===void 0?1:s,f=o.offsetX,l=f===void 0?0:f,c=o.offsetY,h=c===void 0?0:c,d=o.box,v=d===void 0?{}:d,p=o.check,g=p===void 0?{}:p,y=o.text,m=y===void 0?{}:y;this.toggleGroup=this.controllerGroup.addGroup({name:"toggle-group"});var b=a===ta.SINGLE;this.toggleGroup.addShape("rect",{attrs:Hr({x:i-vo,y:this.speedAxisY[0]+3.5},v),isChecked:b,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:Hr({path:[["M",i-vo+3,this.speedAxisY[1]+6],["L",i-vo+7,this.speedAxisY[1]+10],["L",i-vo+12,this.speedAxisY[1]+4]]},g),capture:!1,name:"check-icon"}),b||this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:Hr({text:b?((t=this.controllerCfg)===null||t===void 0?void 0:t.timeRangeControllerText)||"时间范围":((e=this.controllerCfg)===null||e===void 0?void 0:e.timePointControllerText)||"单一时间",x:i-vo+15,y:this.speedAxisY[0]+4,fontFamily:typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},m),name:"checked-text"});var x=this.toggleGroup.getCanvasBBox(),E=(x.maxX+x.minX)/2,w=(x.maxY+x.minY)/2,_=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];_=Rf(_,[["t",-E,-w],["s",u,u],["t",E+l*u,w+h*u]]),this.toggleGroup.setMatrix(_)},r.prototype.bindEvent=function(){var t=this;this.speedGroup.on("speed-rect:click",function(e){var n=e.target.attr("y1"),i=t.speedPoint.attr("matrix"),a=t.speedAxisY.indexOf(i[7]||0),o=t.speedAxisY.indexOf(n),s=t.speedAxisY[o]-t.speedAxisY[a];i=Rf(i,[["t",0,s]]),t.speedPoint.setMatrix(i),t.currentSpeed=t.speedAxisY.length-o,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit(Es,{speed:t.currentSpeed,type:t.currentType})}),this.speedGroup.on("mousewheel",function(e){e.preventDefault();var n=t.speedPoint.attr("matrix")||[1,0,0,0,1,0,0,0,1],i=n[7],a=t.speedAxisY.indexOf(i);if(a===-1){var o=1/0;t.speedAxisY.forEach(function(u,f){var l=Math.abs(u-i);o>l&&(o=l,a=f)})}e.originalEvent.deltaY>0?a=Math.max(0,a-1):a=Math.min(t.speedAxisY.length-1,a+1);var s=t.speedAxisY[a]-i;n=Rf(n,[["t",0,s]]),t.speedPoint.setMatrix(n),t.currentSpeed=t.speedAxisY.length-a,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit(Es,{speed:t.currentSpeed,type:t.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(e){var n,i,a=e.target.get("isChecked");a?(t.checkedIcon.hide(),t.checkedText.attr("text",((i=t.controllerCfg)===null||i===void 0?void 0:i.timePointControllerText)||"单一时间"),t.currentType=ta.RANGE):(t.checkedIcon.show(),t.checkedText.attr("text",((n=t.controllerCfg)===null||n===void 0?void 0:n.timeRangeControllerText)||"时间范围"),t.currentType=ta.SINGLE),e.target.set("isChecked",!a),t.group.emit(Es,{type:t.currentType,speed:t.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}();const rP=Rle;var il=function(){return il=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},il.apply(this,arguments)},Ble=xi,Fle={fill:"#5B8FF9"},Gle={fill:"#e6e8e9"},zle=function(){function r(t){this.frameCount=0,this.fontFamily="Arial, sans-serif";var e=t.graph,n=t.canvas,i=t.group,a=t.width,o=t.height,s=t.padding,u=t.data,f=t.start,l=t.end,c=t.x,h=c===void 0?0:c,d=t.y,v=d===void 0?0:d,p=t.tickLabelFormatter,g=t.selectedTickStyle,y=g===void 0?Fle:g,m=t.unselectedTickStyle,b=m===void 0?Gle:m,x=t.tooltipBackgroundColor,E=t.tooltipFomatter,w=t.tickLabelStyle,_=t.controllerCfg,M=_===void 0?{speed:1}:_;this.graph=e,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=w||{},this.selectedTickStyle=y,this.unselectedTickStyle=b,this.controllerCfg=M,this.currentSpeed=M.speed||1,this.x=h,this.y=v,this.tooltipBackgroundColor=x,this.tooltipFomatter=E,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 t=this,e=this,n=e.width,i=e.height,a=e.padding,o=e.data,s=e.start,u=e.end,f=e.tickLabelFormatter,l=e.selectedTickStyle,c=e.unselectedTickStyle,h=e.tickLabelStyle,d=n-2*a,v=10,p=4,g=3*a+p+v,y=i-g-2*a,m=2,b=o.length,x=(d-m*(b-1))/b;this.tickWidth=x;var E=this.sliceGroup,w=[],_=[],M=Math.round(b*s),C=Math.round(b*u);this.startTickRectId=M,this.endTickRectId=C;var S=h.rotate;delete h.rotate,o.forEach(function(T,I){var D=I>=M&&I<=C,N=D?l:c,P=E.addShape("rect",{attrs:il({x:a+I*(x+m),y:a,width:x,height:y},N),draggable:!0,name:"tick-rect-".concat(I)}),G=E.addShape("rect",{attrs:{x:a+I*x+m*(2*I-1)/2,y:a,width:I===0||I===b-1?x+m/2:x+m,height:y,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(I)});G.toFront();var W=P.getBBox(),k=(W.minX+W.maxX)/2;w.push({rect:P,pickRect:G,value:T.date,x:k,y:W.minY});var R;if(f?(R=f(T),!Ne(R)&&R&&(R=T.date)):I%Math.round(b/10)===0&&(R=T.date),R){_.push(R);var Y=W.maxY+a*2;E.addShape("line",{attrs:{stroke:"#BFBFBF",x1:k,y1:Y,x2:k,y2:Y+p},name:"tick-line"});var J=Y+p+a,te=E.addShape("text",{attrs:il({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:k,y:J,textAlign:"center",text:R,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},h),capture:!1,name:"tick-label"}),H=te.getBBox();if(H.maxX>n?te.attr("textAlign","right"):H.minX<0&&te.attr("textAlign","left"),ht(S)&&_.length!==10){var pe=Ble([1,0,0,0,1,0,0,0,1],[["t",-k,-J],["r",S],["t",k-5,J+2]]);te.attr({textAlign:"left",matrix:pe})}_.length===1?te.attr({textAlign:"left"}):_.length===10&&te.attr({textAlign:"right"})}}),this.tickRects=w;var A=this.group;this.currentSpeed=1,this.controllerBtnGroup=new rP(il({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 t=this,e=this.sliceGroup;e.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=t.tickRects,v=t.unselectedTickStyle;d.forEach(function(m){m.rect.attr(v)});var p=t.selectedTickStyle;d[h].rect.attr(p),t.startTickRectId=h,t.endTickRectId=h;var g=d.length,y=h/g;t.graph.emit(ia,{value:[y,y]})}}}),e.on("dragstart",function(l){var c=t.tickRects,h=t.unselectedTickStyle;c.forEach(function(m){m.rect.attr(h)});var d=l.target,v=parseInt(d.get("name").split("-")[2],10),p=t.selectedTickStyle;c[v].rect.attr(p),t.startTickRectId=v;var g=c.length,y=v/g;t.graph.emit(ia,{value:[y,y]}),t.dragging=!0}),e.on("dragover",function(l){if(t.dragging&&l.target.get("type")==="rect"){for(var c=parseInt(l.target.get("name").split("-")[2],10),h=t.startTickRectId,d=t.tickRects,v=t.selectedTickStyle,p=t.unselectedTickStyle,g=0;g<d.length;g++){var y=g>=h&&g<=c?v:p;d[g].rect.attr(y)}var m=d.length;t.endTickRectId=c;var b=h/m,x=c/m;t.graph.emit(ia,{value:[b,x]})}}),e.on("drop",function(l){if(t.dragging&&(t.dragging=!1,l.target.get("type")==="rect")){var c=t.startTickRectId,h=parseInt(l.target.get("name").split("-")[2],10);if(!(h<c)){var d=t.selectedTickStyle,v=t.tickRects;v[h].rect.attr(d),t.endTickRectId=h;var p=v.length,g=c/p,y=h/p;t.graph.emit(ia,{value:[g,y]})}}});var n=this,i=n.tooltipBackgroundColor,a=n.tooltipFomatter,o=n.canvas,s=new Ale({container:o.get("container"),backgroundColor:i}),u=this.tickRects;u.forEach(function(l){var c=l.pickRect;c.on("mouseenter",function(h){var d=h.target;if(d.get("type")==="rect"){var v=parseInt(d.get("name").split("-")[2],10),p=o.getClientByPoint(u[v].x,u[v].y);s.show({x:u[v].x,y:u[v].y,clientX:p.x,clientY:p.y,text:a?a(u[v].value):u[v].value})}}),c.on("mouseleave",function(h){s.hide()})});var f=this.group;f.on("".concat(Ao,":click"),function(){t.isPlay=!t.isPlay,t.changePlayStatus()}),f.on("".concat(Ll,":click"),function(){t.updateStartEnd(1)}),f.on("".concat(Dl,":click"),function(){t.updateStartEnd(-1)}),f.on(Es,function(l){l.type;var c=l.speed;t.currentSpeed=c})},r.prototype.changePlayStatus=function(t){t===void 0&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(Qk,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit(Jk,null))},r.prototype.startPlay=function(){var t=this;return typeof window<"u"?window.requestAnimationFrame(function(){var e=t.currentSpeed;t.frameCount%(60/e)===0&&(t.frameCount=0,t.updateStartEnd(1)),t.frameCount++,t.isPlay&&(t.playHandler=t.startPlay())}):void 0},r.prototype.updateStartEnd=function(t){var e=this,n=this.tickRects,i=n.length,a=this.unselectedTickStyle,o=this.selectedTickStyle,s=e.endTickRectId;if(t>0?e.endTickRectId++:(n[e.endTickRectId].rect.attr(a),e.endTickRectId--),s!==e.startTickRectId)e.endTickRectId<e.startTickRectId&&(e.startTickRectId=e.endTickRectId);else{for(var u=e.startTickRectId;u<=e.endTickRectId-1;u++)n[u].rect.attr(a);e.startTickRectId=e.endTickRectId}if(n[e.endTickRectId]){n[e.endTickRectId].rect.attr(o);var f=e.startTickRectId/i,l=e.endTickRectId/i;this.graph.emit(ia,{value:[f,l]})}},r.prototype.destory=function(){var t=this.sliceGroup;t.off("click"),t.off("dragstart"),t.off("dragover"),t.off("drop"),this.tickRects.forEach(function(e){var n=e.pickRect;n.off("mouseenter"),n.off("mouseleave")}),this.tickRects.length=0,t.off("".concat(Ao,":click")),t.off("".concat(Ll,":click")),t.off("".concat(Dl,":click")),t.off(Es),this.sliceGroup.destroy()},r}();const jle=zle;var nP={};function Ule(r){return nP[r]}function Sa(r,t){nP[r]=t}var wb=function(){function r(t){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__=t,this.initCfg(),this.init()}return r.prototype.translate=function(t){return t},r.prototype.change=function(t){yt(this.__cfg__,t),this.init()},r.prototype.clone=function(){return this.constructor(this.__cfg__)},r.prototype.getTicks=function(){var t=this;return Ss(this.ticks,function(e,n){return bn(e)?e:{text:t.getText(e,n),tickValue:e,value:t.scale(e)}})},r.prototype.getText=function(t,e){var n=this.formatter,i=n?n(t,e):t;return ct(i)||!Cr(i.toString)?"":i.toString()},r.prototype.getConfig=function(t){return this.__cfg__[t]},r.prototype.init=function(){yt(this,this.__cfg__),this.setDomain(),OC(this.getConfig("ticks"))&&(this.ticks=this.calculateTicks())},r.prototype.initCfg=function(){},r.prototype.setDomain=function(){},r.prototype.calculateTicks=function(){var t=this.tickMethod,e=[];if(Ne(t)){var n=Ule(t);if(!n)throw new Error("There is no method to to calculate ticks!");e=n(this)}else Cr(t)&&(e=t(this));return e},r.prototype.rangeMin=function(){return this.range[0]},r.prototype.rangeMax=function(){return this.range[1]},r.prototype.calcPercent=function(t,e,n){return ht(t)?(t-e)/(n-e):NaN},r.prototype.calcValue=function(t,e,n){return e+t*(n-e)},r}(),lc=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="cat",e.isCategory=!0,e}return t.prototype.buildIndexMap=function(){if(!this.translateIndexMap){this.translateIndexMap=new Map;for(var e=0;e<this.values.length;e++)this.translateIndexMap.set(this.values[e],e)}},t.prototype.translate=function(e){this.buildIndexMap();var n=this.translateIndexMap.get(e);return n===void 0&&(n=ht(e)?e:NaN),n},t.prototype.scale=function(e){var n=this.translate(e),i=this.calcPercent(n,this.min,this.max);return this.calcValue(i,this.rangeMin(),this.rangeMax())},t.prototype.invert=function(e){var n=this.max-this.min,i=this.calcPercent(e,this.rangeMin(),this.rangeMax()),a=Math.round(n*i)+this.min;return a<this.min||a>this.max?NaN:this.values[a]},t.prototype.getText=function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=e;return ht(e)&&!this.values.includes(e)&&(a=this.values[a]),r.prototype.getText.apply(this,iv([a],n))},t.prototype.initCfg=function(){this.tickMethod="cat"},t.prototype.setDomain=function(){if(ct(this.getConfig("min"))&&(this.min=0),ct(this.getConfig("max"))){var e=this.values.length;this.max=e>1?e-1:e}this.translateIndexMap&&(this.translateIndexMap=void 0)},t}(wb),iP=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,mo="\\d\\d?",po="\\d\\d",$le="\\d{3}",Wle="\\d{4}",al="[^\\s]+",aP=/\[([^]*?)\]/gm;function oP(r,t){for(var e=[],n=0,i=r.length;n<i;n++)e.push(r[n].substr(0,t));return e}var hM=function(r){return function(t,e){var n=e[r].map(function(a){return a.toLowerCase()}),i=n.indexOf(t.toLowerCase());return i>-1?i:null}};function Bo(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0,i=t;n<i.length;n++){var a=i[n];for(var o in a)r[o]=a[o]}return r}var sP=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],uP=["January","February","March","April","May","June","July","August","September","October","November","December"],Xle=oP(uP,3),Yle=oP(sP,3),_b={dayNamesShort:Yle,dayNames:sP,monthNamesShort:Xle,monthNames:uP,amPm:["am","pm"],DoFn:function(r){return r+["th","st","nd","rd"][r%10>3?0:(r-r%10!==10?1:0)*r%10]}},Qd=Bo({},_b),fP=function(r){return Qd=Bo(Qd,r)},dM=function(r){return r.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},Nn=function(r,t){for(t===void 0&&(t=2),r=String(r);r.length<t;)r="0"+r;return r},Vle={D:function(r){return String(r.getDate())},DD:function(r){return Nn(r.getDate())},Do:function(r,t){return t.DoFn(r.getDate())},d:function(r){return String(r.getDay())},dd:function(r){return Nn(r.getDay())},ddd:function(r,t){return t.dayNamesShort[r.getDay()]},dddd:function(r,t){return t.dayNames[r.getDay()]},M:function(r){return String(r.getMonth()+1)},MM:function(r){return Nn(r.getMonth()+1)},MMM:function(r,t){return t.monthNamesShort[r.getMonth()]},MMMM:function(r,t){return t.monthNames[r.getMonth()]},YY:function(r){return Nn(String(r.getFullYear()),4).substr(2)},YYYY:function(r){return Nn(r.getFullYear(),4)},h:function(r){return String(r.getHours()%12||12)},hh:function(r){return Nn(r.getHours()%12||12)},H:function(r){return String(r.getHours())},HH:function(r){return Nn(r.getHours())},m:function(r){return String(r.getMinutes())},mm:function(r){return Nn(r.getMinutes())},s:function(r){return String(r.getSeconds())},ss:function(r){return Nn(r.getSeconds())},S:function(r){return String(Math.round(r.getMilliseconds()/100))},SS:function(r){return Nn(Math.round(r.getMilliseconds()/10),2)},SSS:function(r){return Nn(r.getMilliseconds(),3)},a:function(r,t){return r.getHours()<12?t.amPm[0]:t.amPm[1]},A:function(r,t){return r.getHours()<12?t.amPm[0].toUpperCase():t.amPm[1].toUpperCase()},ZZ:function(r){var t=r.getTimezoneOffset();return(t>0?"-":"+")+Nn(Math.floor(Math.abs(t)/60)*100+Math.abs(t)%60,4)},Z:function(r){var t=r.getTimezoneOffset();return(t>0?"-":"+")+Nn(Math.floor(Math.abs(t)/60),2)+":"+Nn(Math.abs(t)%60,2)}},vM=function(r){return+r-1},pM=[null,mo],gM=[null,al],yM=["isPm",al,function(r,t){var e=r.toLowerCase();return e===t.amPm[0]?0:e===t.amPm[1]?1:null}],mM=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(r){var t=(r+"").match(/([+-]|\d\d)/gi);if(t){var e=+t[1]*60+parseInt(t[2],10);return t[0]==="+"?e:-e}return 0}],Hle={D:["day",mo],DD:["day",po],Do:["day",mo+al,function(r){return parseInt(r,10)}],M:["month",mo,vM],MM:["month",po,vM],YY:["year",po,function(r){var t=new Date,e=+(""+t.getFullYear()).substr(0,2);return+(""+(+r>68?e-1:e)+r)}],h:["hour",mo,void 0,"isPm"],hh:["hour",po,void 0,"isPm"],H:["hour",mo],HH:["hour",po],m:["minute",mo],mm:["minute",po],s:["second",mo],ss:["second",po],YYYY:["year",Wle],S:["millisecond","\\d",function(r){return+r*100}],SS:["millisecond",po,function(r){return+r*10}],SSS:["millisecond",$le],d:pM,dd:pM,ddd:gM,dddd:gM,MMM:["month",al,hM("monthNamesShort")],MMMM:["month",al,hM("monthNames")],a:yM,A:yM,ZZ:mM,Z:mM},Jd={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"},lP=function(r){return Bo(Jd,r)},cP=function(r,t,e){if(t===void 0&&(t=Jd.default),e===void 0&&(e={}),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");t=Jd[t]||t;var n=[];t=t.replace(aP,function(a,o){return n.push(o),"@@@"});var i=Bo(Bo({},Qd),e);return t=t.replace(iP,function(a){return Vle[a](r,i)}),t.replace(/@@@/g,function(){return n.shift()})};function hP(r,t,e){if(e===void 0&&(e={}),typeof t!="string")throw new Error("Invalid format in fecha parse");if(t=Jd[t]||t,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=t.replace(aP,function(x,E){return o.push(dM(E)),"@@@"}),u={},f={};s=dM(s).replace(iP,function(x){var E=Hle[x],w=E[0],_=E[1],M=E[3];if(u[w])throw new Error("Invalid format. "+w+" specified twice in format");return u[w]=!0,M&&(f[M]=!0),a.push(E),"("+_+")"}),Object.keys(f).forEach(function(x){if(!u[x])throw new Error("Invalid format. "+x+" is required in specified format")}),s=s.replace(/@@@/g,function(){return o.shift()});var l=r.match(new RegExp(s,"i"));if(!l)return null;for(var c=Bo(Bo({},Qd),e),h=1;h<l.length;h++){var d=a[h-1],v=d[0],p=d[2],g=p?p(l[h],c):+l[h];if(g==null)return null;i[v]=g}i.isPm===1&&i.hour!=null&&+i.hour!=12?i.hour=+i.hour+12:i.isPm===0&&+i.hour==12&&(i.hour=0);var y;if(i.timezoneOffset==null){y=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);for(var m=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],h=0,b=m.length;h<b;h++)if(u[m[h][0]]&&i[m[h][0]]!==y[m[h][1]]())return null}else if(y=new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond)),i.month>11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return y}var dP={format:cP,parse:hP,defaultI18n:_b,setGlobalDateI18n:fP,setGlobalDateMasks:lP};const Kle=Object.freeze(Object.defineProperty({__proto__:null,assign:Bo,default:dP,defaultI18n:_b,format:cP,parse:hP,setGlobalDateI18n:fP,setGlobalDateMasks:lP},Symbol.toStringTag,{value:"Module"}));function qle(r){return function(t,e,n,i){for(var a=ct(n)?0:n,o=ct(i)?t.length:i;a<o;){var s=a+o>>>1;r(t[s])>e?o=s:a=s+1}return a}}var bM="format";function vP(r,t){var e=Kle[bM]||dP[bM];return e(r,t)}function ev(r){return Ne(r)&&(r.indexOf("T")>0?r=new Date(r).getTime():r=new Date(r.replace(/-/gi,"/")).getTime()),hm(r)&&(r=r.getTime()),r}var Oi=1e3,ws=60*Oi,_s=60*ws,Xa=24*_s,ol=Xa*31,xM=Xa*365,Bf=[["HH:mm:ss",Oi],["HH:mm:ss",Oi*10],["HH:mm:ss",Oi*30],["HH:mm",ws],["HH:mm",ws*10],["HH:mm",ws*30],["HH",_s],["HH",_s*6],["HH",_s*12],["YYYY-MM-DD",Xa],["YYYY-MM-DD",Xa*4],["YYYY-WW",Xa*7],["YYYY-MM",ol],["YYYY-MM",ol*4],["YYYY-MM",ol*6],["YYYY",Xa*380]];function Zle(r,t,e){var n=(t-r)/e,i=qle(function(o){return o[1]})(Bf,n)-1,a=Bf[i];return i<0?a=Bf[0]:i>=Bf.length&&(a=yi(Bf)),a}var Qle=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="timeCat",e}return t.prototype.translate=function(e){e=ev(e);var n=this.values.indexOf(e);return n===-1&&(ht(e)&&e<this.values.length?n=e:n=NaN),n},t.prototype.getText=function(e,n){var i=this.translate(e);if(i>-1){var a=this.values[i],o=this.formatter;return a=o?o(a,n):vP(a,this.mask),a}return e},t.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},t.prototype.setDomain=function(){var e=this.values;me(e,function(n,i){e[i]=ev(n)}),e.sort(function(n,i){return n-i}),r.prototype.setDomain.call(this)},t}(lc),rp=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.isContinuous=!0,e}return t.prototype.scale=function(e){if(ct(e))return NaN;var n=this.rangeMin(),i=this.rangeMax(),a=this.max,o=this.min;if(a===o)return n;var s=this.getScalePercent(e);return n+s*(i-n)},t.prototype.init=function(){r.prototype.init.call(this);var e=this.ticks,n=ha(e),i=yi(e);n<this.min&&(this.min=n),i>this.max&&(this.max=i),ct(this.minLimit)||(this.min=n),ct(this.maxLimit)||(this.max=i)},t.prototype.setDomain=function(){var e=mC(this.values),n=e.min,i=e.max;ct(this.min)&&(this.min=n),ct(this.max)&&(this.max=i),this.min>this.max&&(this.min=n,this.max=i)},t.prototype.calculateTicks=function(){var e=this,n=r.prototype.calculateTicks.call(this);return this.nice||(n=av(n,function(i){return i>=e.min&&i<=e.max})),n},t.prototype.getScalePercent=function(e){var n=this.max,i=this.min;return(e-i)/(n-i)},t.prototype.getInvertPercent=function(e){return(e-this.rangeMin())/(this.rangeMax()-this.rangeMin())},t}(wb),cc=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="linear",e.isLinear=!0,e}return t.prototype.invert=function(e){var n=this.getInvertPercent(e);return this.min+n*(this.max-this.min)},t.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},t}(rp);function wo(r,t){var e=Math.E,n;return t>=0?n=Math.pow(e,Math.log(t)/r):n=Math.pow(e,Math.log(-t)/r)*-1,n}function pi(r,t){return r===1?1:Math.log(t)/Math.log(r)}function pP(r,t,e){ct(e)&&(e=Math.max.apply(null,r));var n=e;return me(r,function(i){i>0&&i<n&&(n=i)}),n===e&&(n=e/t),n>1&&(n=1),n}var Jle=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="log",e}return t.prototype.invert=function(e){var n=this.base,i=pi(n,this.max),a=this.rangeMin(),o=this.rangeMax()-a,s,u=this.positiveMin;if(u){if(e===0)return 0;s=pi(n,u/n);var f=1/(i-s)*o;if(e<f)return e/f*u}else s=pi(n,this.min);var l=(e-a)/o,c=l*(i-s)+s;return Math.pow(n,c)},t.prototype.initCfg=function(){this.tickMethod="log",this.base=10,this.tickCount=6,this.nice=!0},t.prototype.setDomain=function(){r.prototype.setDomain.call(this);var e=this.min;if(e<0)throw new Error("When you use log scale, the minimum value must be greater than zero!");e===0&&(this.positiveMin=pP(this.values,this.base,this.max))},t.prototype.getScalePercent=function(e){var n=this.max,i=this.min;if(n===i||e<=0)return 0;var a=this.base,o=this.positiveMin;o&&(i=o*1/a);var s;return e<o?s=e/o/(pi(a,n)-pi(a,i)):s=(pi(a,e)-pi(a,i))/(pi(a,n)-pi(a,i)),s},t}(rp),ece=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="pow",e}return t.prototype.invert=function(e){var n=this.getInvertPercent(e),i=this.exponent,a=wo(i,this.max),o=wo(i,this.min),s=n*(a-o)+o,u=s>=0?1:-1;return Math.pow(s,i)*u},t.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},t.prototype.getScalePercent=function(e){var n=this.max,i=this.min;if(n===i)return 0;var a=this.exponent,o=(wo(a,e)-wo(a,i))/(wo(a,n)-wo(a,i));return o},t}(rp),tce=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="time",e}return t.prototype.getText=function(e,n){var i=this.translate(e),a=this.formatter;return a?a(i,n):vP(i,this.mask)},t.prototype.scale=function(e){var n=e;return(Ne(n)||hm(n))&&(n=this.translate(n)),r.prototype.scale.call(this,n)},t.prototype.translate=function(e){return ev(e)},t.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},t.prototype.setDomain=function(){var e=this.values,n=this.getConfig("min"),i=this.getConfig("max");if((!ct(n)||!ht(n))&&(this.min=this.translate(this.min)),(!ct(i)||!ht(i))&&(this.max=this.translate(this.max)),e&&e.length){var a=[],o=1/0,s=o,u=0;me(e,function(f){var l=ev(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)}),e.length>1&&(this.minTickInterval=s-o),ct(n)&&(this.min=o),ct(i)&&(this.max=u)}},t}(cc),gP=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="quantize",e}return t.prototype.invert=function(e){var n=this.ticks,i=n.length,a=this.getInvertPercent(e),o=Math.floor(a*(i-1));if(o>=i-1)return yi(n);if(o<0)return ha(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)},t.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},t.prototype.calculateTicks=function(){var e=r.prototype.calculateTicks.call(this);return this.nice||(yi(e)!==this.max&&e.push(this.max),ha(e)!==this.min&&e.unshift(this.min)),e},t.prototype.getScalePercent=function(e){var n=this.ticks;if(e<ha(n))return 0;if(e>yi(n))return 1;var i=0;return me(n,function(a,o){if(e>=a)i=o;else return!1}),i/(n.length-1)},t}(rp),rce=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="quantile",e}return t.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},t}(gP),yP={};function nce(r){return yP[r]}function Ma(r,t){if(nce(r))throw new Error("type '"+r+"' existed.");yP[r]=t}var ice=function(r){Ot(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type="identity",e.isIdentity=!0,e}return t.prototype.calculateTicks=function(){return this.values},t.prototype.scale=function(e){return this.values[0]!==e&&ht(e)?e:this.range[0]},t.prototype.invert=function(e){var n=this.range;return e<n[0]||e>n[1]?NaN:this.values[0]},t}(wb);function mP(r){var t=r.values,e=r.tickInterval,n=r.tickCount,i=r.showLast;if(ht(e)){var a=av(t,function(v,p){return p%e===0}),o=yi(t);return i&&yi(a)!==o&&a.push(o),a}var s=t.length,u=r.min,f=r.max;if(ct(u)&&(u=0),ct(f)&&(f=t.length-1),!ht(n)||n>=s)return t.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(t[f]):c.push(t[h]);return c}function ace(r){var t=r.min,e=r.max,n=r.nice,i=r.tickCount,a=new oce;return a.domain([t,e]),n&&a.nice(i),a.ticks(i)}var E0=5,EM=Math.sqrt(50),wM=Math.sqrt(10),_M=Math.sqrt(2),oce=function(){function r(){this._domain=[0,1]}return r.prototype.domain=function(t){return t?(this._domain=Array.from(t,Number),this):this._domain.slice()},r.prototype.nice=function(t){var e,n;t===void 0&&(t=E0);var i=this._domain.slice(),a=0,o=this._domain.length-1,s=this._domain[a],u=this._domain[o],f;return u<s&&(e=[u,s],s=e[0],u=e[1],n=[o,a],a=n[0],o=n[1]),f=ud(s,u,t),f>0?(s=Math.floor(s/f)*f,u=Math.ceil(u/f)*f,f=ud(s,u,t)):f<0&&(s=Math.ceil(s*f)/f,u=Math.floor(u*f)/f,f=ud(s,u,t)),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(t){return t===void 0&&(t=E0),sce(this._domain[0],this._domain[this._domain.length-1],t||E0)},r}();function sce(r,t,e){var n,i=-1,a,o,s;if(t=+t,r=+r,e=+e,r===t&&e>0)return[r];if((n=t<r)&&(a=r,r=t,t=a),(s=ud(r,t,e))===0||!isFinite(s))return[];if(s>0)for(r=Math.ceil(r/s),t=Math.floor(t/s),o=new Array(a=Math.ceil(t-r+1));++i<a;)o[i]=(r+i)*s;else for(r=Math.floor(r*s),t=Math.ceil(t*s),o=new Array(a=Math.ceil(r-t+1));++i<a;)o[i]=(r-i)/s;return n&&o.reverse(),o}function ud(r,t,e){var n=(t-r)/Math.max(0,e),i=Math.floor(Math.log(n)/Math.LN10),a=n/Math.pow(10,i);return i>=0?(a>=EM?10:a>=wM?5:a>=_M?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=EM?10:a>=wM?5:a>=_M?2:1)}function SM(r,t,e){var n;return e==="ceil"?n=Math.ceil(r/t):e==="floor"?n=Math.floor(r/t):n=Math.round(r/t),n*t}function Sb(r,t,e){var n=SM(r,e,"floor"),i=SM(t,e,"ceil");n=Fh(n,e),i=Fh(i,e);for(var a=[],o=Math.max((i-n)/(Math.pow(2,12)-1),e),s=n;s<=i;s=s+o){var u=Fh(s,o);a.push(u)}return{min:n,max:i,ticks:a}}function Mb(r,t,e){var n,i=r.minLimit,a=r.maxLimit,o=r.min,s=r.max,u=r.tickCount,f=u===void 0?5:u,l=ct(i)?ct(t)?o:t:i,c=ct(a)?ct(e)?s:e: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 uce(r){var t=r.min,e=r.max,n=r.tickInterval,i=r.minLimit,a=r.maxLimit,o=ace(r);return!ct(i)||!ct(a)?Mb(r,ha(o),yi(o)):n?Sb(t,e,n).ticks:o}function ds(r){return Math.abs(r)<1e-15?r:parseFloat(r.toFixed(15))}var fce=[1,5,2,2.5,4,3],MM=Number.EPSILON*100;function lce(r,t){return(r%t+t)%t}function cce(r){return Math.round(r*1e12)/1e12}function hce(r,t,e,n,i,a){var o=uv(t),s=dm(t,r),u=0,f=lce(n,a);return(f<MM||a-f<MM)&&n<=0&&i>=0&&(u=1),1-s/(o-1)-e+u}function dce(r,t,e){var n=uv(t),i=dm(t,r),a=1;return 1-i/(n-1)-e+a}function vce(r,t,e,n,i,a){var o=(r-1)/(a-i),s=(t-1)/(Math.max(a,n)-Math.min(e,i));return 2-Math.max(o/s,s/o)}function pce(r,t){return r>=t?2-(r-1)/(t-1):1}function gce(r,t,e,n){var i=t-r;return 1-.5*(Math.pow(t-n,2)+Math.pow(r-e,2))/Math.pow(.1*i,2)}function yce(r,t,e){var n=t-r;if(e>n){var i=(e-n)/2;return 1-Math.pow(i,2)/Math.pow(.1*n,2)}return 1}function mce(){return 1}function bce(r,t,e,n,i,a){e===void 0&&(e=5),n===void 0&&(n=!0),i===void 0&&(i=fce),a===void 0&&(a=[.25,.2,.5,.05]);var o=e<0?0:Math.round(e);if(Number.isNaN(r)||Number.isNaN(t)||typeof r!="number"||typeof t!="number"||!o)return{min:0,max:0,ticks:[]};if(t-r<1e-15||o===1)return{min:r,max:t,ticks:[r]};if(t-r>1e148){var s=e||5,u=(t-r)/s;return{min:r,max:t,ticks:Array(s).fill(null).map(function(Y,J){return ds(r+u*J)})}}for(var f={score:-2,lmin:0,lmax:0,lstep:0},l=1;l<1/0;){for(var c=0;c<i.length;c+=1){var h=i[c],d=dce(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=pce(v,o);if(a[0]*d+a[1]+a[2]*p+a[3]<f.score)break;for(var g=(t-r)/(v+1)/l/h,y=Math.ceil(Math.log10(g));y<1/0;){var m=l*h*Math.pow(10,y),b=yce(r,t,m*(v-1));if(a[0]*d+a[1]*b+a[2]*p+a[3]<f.score)break;var x=Math.floor(t/m)*l-(v-1)*l,E=Math.ceil(r/m)*l;if(x<=E)for(var s=E-x,w=0;w<=s;w+=1){var _=x+w,M=_*(m/l),C=M+m*(v-1),S=m,A=hce(h,i,l,M,C,S),T=gce(r,t,M,C),I=vce(v,o,r,t,M,C),D=mce(),N=a[0]*A+a[1]*T+a[2]*I+a[3]*D;N>f.score&&(!n||M<=r&&C>=t)&&(f.lmin=M,f.lmax=C,f.lstep=S,f.score=N)}y+=1}v+=1}}l+=1}var P=ds(f.lmax),G=ds(f.lmin),W=ds(f.lstep),k=Math.floor(cce((P-G)/W))+1,R=new Array(k);R[0]=ds(G);for(var c=1;c<k;c++)R[c]=ds(R[c-1]+W);return{min:Math.min(r,ha(R)),max:Math.max(t,yi(R)),ticks:R}}function xce(r){var t=r.min,e=r.max,n=r.tickCount,i=r.nice,a=r.tickInterval,o=r.minLimit,s=r.maxLimit,u=bce(t,e,n,i).ticks;return!ct(o)||!ct(s)?Mb(r,ha(u),yi(u)):a?Sb(t,e,a).ticks:u}function Ece(r){var t=r.base,e=r.tickCount,n=r.min,i=r.max,a=r.values,o,s=pi(t,i);if(n>0)o=Math.floor(pi(t,n));else{var u=pP(a,t,i);o=Math.floor(pi(t,u))}for(var f=s-o,l=Math.ceil(f/e),c=[],h=o;h<s+l;h=h+l)c.push(Math.pow(t,h));return n<=0&&c.unshift(0),c}function bP(r,t,e){if(e===void 0&&(e=5),r===t)return{max:t,min:r,ticks:[r]};var n=e<0?0:Math.round(e);if(n===0)return{max:t,min:r,ticks:[]};var i=1.5,a=.5+1.5*i,o=t-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(t/f),c=Math.floor(r/f),h=Math.max(l*f,t),d=Math.min(c*f,r),v=Math.floor((h-d)/f)+1,p=new Array(v),g=0;g<v;g++)p[g]=ds(d+g*f);return{min:d,max:h,ticks:p}}function wce(r){var t=r.exponent,e=r.tickCount,n=Math.ceil(wo(t,r.max)),i=Math.floor(wo(t,r.min)),a=bP(i,n,e).ticks;return a.map(function(o){var s=o>=0?1:-1;return Math.pow(o,t)*s})}function _ce(r,t){var e=r.length*t;return t===1?r[r.length-1]:t===0?r[0]:e%1!==0?r[Math.ceil(e)-1]:r.length%2===0?(r[e-1]+r[e])/2:r[e]}function Sce(r){var t=r.tickCount,e=r.values;if(!e||!e.length)return[];for(var n=e.slice().sort(function(s,u){return s-u}),i=[],a=0;a<t;a++){var o=a/(t-1);i.push(_ce(n,o))}return i}function Mce(r){var t=r.min,e=r.max,n=r.tickCount,i=r.tickInterval,a=r.minLimit,o=r.maxLimit,s=bP(t,e,n).ticks;return!ct(a)||!ct(o)?Mb(r,ha(s),yi(s)):i?Sb(t,e,i).ticks:s}function Cce(r){var t=r.min,e=r.max,n=r.minTickInterval,i=r.tickInterval,a=r.tickCount;if(i)a=Math.ceil((e-t)/i);else{i=Zle(t,e,a)[1];var o=(e-t)/i,s=o/a;s>1&&(i=i*Math.ceil(s)),n&&i<n&&(i=n)}i=Math.max(Math.floor((e-t)/(Math.pow(2,12)-1)),i);for(var u=[],f=t;f<e+i;f+=i)u.push(f);return u}function Ace(r){var t=mP(F({showLast:!0},r));return t}function tv(r){return new Date(r).getFullYear()}function Tce(r){return new Date(r,0,1).getTime()}function em(r){return new Date(r).getMonth()}function Ice(r,t){var e=tv(r),n=tv(t),i=em(r),a=em(t);return(n-e)*12+(a-i)%12}function Oce(r,t){return new Date(r,t,1).getTime()}function Lce(r,t){return Math.ceil((t-r)/Xa)}function Dce(r,t){return Math.ceil((t-r)/_s)}function kce(r,t){return Math.ceil((t-r)/(60*1e3))}function Pce(r){var t=r.min,e=r.max,n=r.minTickInterval,i=r.tickCount,a=r.tickInterval,o=[];a||(a=(e-t)/i,n&&a<n&&(a=n)),a=Math.max(Math.floor((e-t)/(Math.pow(2,12)-1)),a);var s=tv(t);if(a>xM)for(var u=tv(e),f=Math.ceil(a/xM),l=s;l<=u+f;l=l+f)o.push(Tce(l));else if(a>ol)for(var c=Math.ceil(a/ol),h=em(t),d=Ice(t,e),l=0;l<=d+c;l=l+c)o.push(Oce(s,l+h));else if(a>Xa)for(var v=new Date(t),p=v.getFullYear(),g=v.getMonth(),y=v.getDate(),m=Math.ceil(a/Xa),b=Lce(t,e),l=0;l<b+m;l=l+m)o.push(new Date(p,g,y+l).getTime());else if(a>_s)for(var v=new Date(t),p=v.getFullYear(),g=v.getMonth(),m=v.getDate(),x=v.getHours(),E=Math.ceil(a/_s),w=Dce(t,e),l=0;l<=w+E;l=l+E)o.push(new Date(p,g,m,x+l).getTime());else if(a>ws)for(var _=kce(t,e),M=Math.ceil(a/ws),l=0;l<=_+M;l=l+M)o.push(t+l*ws);else{var C=a;C<Oi&&(C=Oi);for(var S=Math.floor(t/Oi)*Oi,A=Math.ceil((e-t)/Oi),T=Math.ceil(C/Oi),l=0;l<A+T;l=l+T)o.push(S+l*Oi)}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}Sa("cat",mP);Sa("time-cat",Ace);Sa("wilkinson-extended",xce);Sa("r-pretty",Mce);Sa("time",Cce);Sa("time-pretty",Pce);Sa("log",Ece);Sa("pow",wce);Sa("quantile",Sce);Sa("d3-linear",uce);Ma("cat",lc);Ma("category",lc);Ma("identity",ice);Ma("linear",cc);Ma("log",Jle);Ma("pow",ece);Ma("time",tce);Ma("timeCat",Qle);Ma("quantize",gP);Ma("quantile",rce);var Nce=function(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};function Rce(r){return Ss(r,function(t,e){var n=e===0?"M":"L",i=t[0],a=t[1];return[n,i,a]})}function xP(r){return Rce(r)}function Bce(r){if(r.length<=2)return xP(r);var t=[];me(r,function(o){Oo(o,t.slice(t.length-2))||t.push(o[0],o[1])});var e=mI(t,!1),n=ha(r),i=n[0],a=n[1];return e.unshift(["M",i,a]),e}function Fce(r,t,e,n){n===void 0&&(n=!0);var i=new cc({values:r}),a=new lc({values:Ss(r,function(s,u){return u})}),o=Ss(r,function(s,u){return[a.scale(u)*t,e-i.scale(s)*e]});return n?Bce(o):xP(o)}function Gce(r,t,e,n){n===void 0&&(n=5);for(var i=new cc({values:r}),a=new lc({values:Ss(r,function(h,d){return d})}),o=Ss(r,function(h,d){return[a.scale(d)*t,e-i.scale(h)*e]}),s=[],u=0;u<o.length;u++){var f=o[u],l={x:f[0],y:f[1],y0:e,size:n},c=Uce(l);s.push.apply(s,c)}return $ce(s)}function zce(r,t){var e=new cc({values:r}),n=Math.max(0,e.min);return t-e.scale(n)*t}function jce(r,t,e,n){var i=Nce([],r,!0),a=zce(n,e);return i.push(["L",t,a]),i.push(["L",0,a]),i.push(["Z"]),i}function Uce(r){var t=r.x,e=r.y,n=r.y0,i=r.size,a,o;gt(e)?(a=e[0],o=e[1]):(a=n,o=e);var s,u;gt(t)?(s=t[0],u=t[1]):(s=t-i/2,u=t+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 $ce(r,t){t===void 0&&(t=!0);var e=[],n=r[0];e.push(["M",n.x,n.y]);for(var i=1,a=r.length;i<a;i++)e.push(["L",r[i].x,r[i].y]);return t&&(e.push(["L",n.x,n.y]),e.push(["z"])),e}var sl=function(){return sl=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},sl.apply(this,arguments)},Wce={stroke:"#C5C5C5",strokeOpacity:.85},Xce={fill:"#CACED4",opacity:.85},Yce=function(){function r(t){var e=t.x,n=e===void 0?0:e,i=t.y,a=i===void 0?0:i,o=t.width,s=o===void 0?200:o,u=t.height,f=u===void 0?26:u,l=t.smooth,c=l===void 0?!0:l,h=t.isArea,d=h===void 0?!1:h,v=t.data,p=v===void 0?[]:v,g=t.lineStyle,y=t.areaStyle,m=t.group,b=t.interval,x=b===void 0?null:b;this.group=m,this.x=n,this.y=a,this.width=s,this.height=f,this.data=p,this.smooth=c,this.isArea=d,this.lineStyle=Object.assign({},Wce,g),this.areaStyle=Object.assign({},Xce,y),this.intervalConfig=x,this.renderLine()}return r.prototype.renderLine=function(){var t=this,e=t.x,n=t.y,i=t.width,a=t.height;t.barWidth;var o=t.data,s=t.smooth,u=t.isArea,f=t.lineStyle,l=t.areaStyle,c=this.group.addGroup({name:"trend-group"});if(o){var h=Fce(o,i,a,s);if(c.addShape("path",{attrs:sl({path:h},f),name:"trend-line"}),u){var d=jce(h,i,a,o);c.addShape("path",{attrs:sl({path:d},l),name:"trend-area"})}}this.intervalConfig&&c.addShape("path",{attrs:sl({path:Gce(this.intervalConfig.data,i,a,this.intervalConfig.style.barWidth)},this.intervalConfig.style),name:"trend-interval"}),c.move(e,n)},r.prototype.destory=function(){this.group.destroy()},r}();const Vce=Yce;var Su=function(){return Su=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Su.apply(this,arguments)},Hce={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},Kce={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},qce=function(){function r(t){var e=t.group,n=t.name,i=t.type,a=t.x,o=a===void 0?0:a,s=t.y,u=s===void 0?0:s,f=t.width,l=f===void 0?2:f,c=t.height,h=c===void 0?24:c,d=t.style,v=d===void 0?{}:d;this.group=e,this.name=n,this.handleType=i,this.x=o,this.y=u,this.width=l,this.height=h,i==="trend"?this.style=Su(Su({},Hce),v):i==="simple"&&(this.style=Su(Su({},Kce),v)),this.renderHandle()}return r.prototype.setX=function(t){this.setXY(t,void 0)},r.prototype.setY=function(t){this.setXY(void 0,t)},r.prototype.setXY=function(t,e){ht(t)&&(this.x=t),ht(e)&&(this.y=e),this.updateXY()},r.prototype.renderHandle=function(){var t=this,e=t.width,n=t.height,i=t.style,a=t.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:e,height:n,fill:o,stroke:s,radius:u,opacity:f,cursor:l},name:"".concat(a,"-handler")}),this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:e/2,y:0,r:2*e,fill:o,stroke:s,radius:u,opacity:f,cursor:l,lineAppendWidth:12},name:"".concat(a,"-handler")}),this.bottomCircle=this.handleGroup.addShape("circle",{attrs:{x:e/2,y:n,r:2*e,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:e/2,y:n/2,r:2*e,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 t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),function(){var n=t.style.highLightFill;t.topCircle.attr("fill",n)}),this.handleGroup.on("".concat(e,"-handler:mouseleave"),function(){var n=t.style.fill;t.topCircle.attr("fill",n)})},r.prototype.bindTrendEvents=function(){var t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),function(){var n=t.style.highLightFill;t.verticalLine.attr("fill",n),t.topCircle.attr("fill",n),t.bottomCircle.attr("fill",n)}),this.handleGroup.on("".concat(e,"-handler:mouseleave"),function(){var n=t.style.fill;t.verticalLine.attr("fill",n),t.topCircle.attr("fill",n),t.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}();const CM=qce;var xr=function(){return xr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},xr.apply(this,arguments)},Zce=xi,Qce={fill:"#416180",opacity:.05},Jce={fill:"#416180",opacity:.15,radius:5},ehe={fill:"#5B8FF9",opacity:.3,cursor:"grab"},tm=2,the={width:tm,height:24},rhe={textBaseline:"middle",fill:"#000",opacity:.45},nhe={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},ihe={lineWidth:1,stroke:"#ccc"},ahe=function(){function r(t){var e=this;this.prevX=0,this.onMouseDown=function(Y){return function(J){e.currentHandler=Y;var te=J.originalEvent;te.stopPropagation(),te.preventDefault(),e.prevX=za(te,"touches.0.pageX",te.pageX);var H=e.canvas.get("container");H.addEventListener("mousemove",e.onMouseMove),H.addEventListener("mouseup",e.onMouseUp),H.addEventListener("mouseleave",e.onMouseUp),H.addEventListener("touchmove",e.onMouseMove),H.addEventListener("touchend",e.onMouseUp),H.addEventListener("touchcancel",e.onMouseUp)}},this.onMouseMove=function(Y){Y.stopPropagation(),Y.preventDefault();var J=za(Y,"touches.0.pageX",Y.pageX),te=J-e.prevX,H=e.adjustOffsetRange(te/e.width);e.updateStartEnd(H),e.updateUI(),e.prevX=J},this.onMouseUp=function(){e.currentHandler&&(e.currentHandler=void 0);var Y=e.canvas.get("container");Y&&(Y.removeEventListener("mousemove",e.onMouseMove),Y.removeEventListener("mouseup",e.onMouseUp),Y.removeEventListener("mouseleave",e.onMouseUp),Y.removeEventListener("touchmove",e.onMouseMove),Y.removeEventListener("touchend",e.onMouseUp),Y.removeEventListener("touchcancel",e.onMouseUp))};var n=t.x,i=n===void 0?0:n,a=t.y,o=a===void 0?0:a,s=t.width,u=s===void 0?100:s,f=t.height,l=t.padding,c=l===void 0?10:l,h=t.trendCfg,d=t.controllerCfg,v=d===void 0?{speed:1}:d,p=t.backgroundStyle,g=p===void 0?{}:p,y=t.foregroundStyle,m=y===void 0?{}:y,b=t.handlerStyle,x=b===void 0?{}:b,E=t.textStyle,w=E===void 0?{}:E,_=t.start,M=_===void 0?0:_,C=t.end,S=C===void 0?1:C,A=t.minText,T=A===void 0?"":A,I=t.maxText,D=I===void 0?"":I,N=t.group,P=t.graph,G=t.canvas,W=t.tick,k=W===void 0?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(J){return J},ticks:[]}:W,R=t.type;this.graph=P,this.canvas=G,this.group=N,this.timeBarType=R,this.x=i,this.y=o,this.width=u,this.height=f,this.padding=c,this.ticks=k.ticks,this.trendCfg=h,this.controllerCfg=v,this.currentSpeed=v.speed||1,this.tickLabelFormatter=k.tickLabelFormatter,R==="trend"?this.backgroundStyle=xr(xr({},Qce),g):R==="simple"&&(this.backgroundStyle=xr(xr({},Jce),g)),this.foregroundStyle=xr(xr({},ehe),m),this.handlerStyle=xr(xr({},the),x),this.textStyle=xr(xr({},rhe),w),this.tickLabelStyle=xr(xr({},nhe),k.tickLabelStyle),this.tickLineStyle=xr(xr({},ihe),k.tickLineStyle),this.currentMode=v.defaultTimeType||ta.RANGE,this.start=M,this.end=S,this.minText=T,this.maxText=D,this.fontFamily=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlider()}return r.prototype.update=function(t){var e=t.x,n=t.y,i=t.width,a=t.height,o=t.minText,s=t.maxText,u=t.start,f=t.end;this.start=Math.min(1,Math.max(u,0)),this.end=Math.min(1,Math.max(f,0)),yt(this,{x:e,y:n,width:i,height:a,minText:o,maxText:s}),this.updateUI()},r.prototype.setText=function(t,e){this.minTextShape.attr("text",t),this.maxTextShape.attr("text",e)},r.prototype.renderSlider=function(){var t=this,e=this,n=e.width,i=e.height,a=e.timeBarType;if(a==="trend"&&uv(za(this.trendCfg,"data"))){var o=new Vce(xr(xr({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:xr({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:xr({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:xr({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:xr({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:xr({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:xr({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",t.foregroundStyle.cursor||"grab")});var f=za(this.handlerStyle,"width",2),l=za(this.handlerStyle,"height",24),c=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new CM({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 CM({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){t.tickPosList.push(t.x+m*v);var b;t.tickLabelFormatter?(b=t.tickLabelFormatter(y),!Ne(b)&&b&&(b=y.date)):b=y.date;var x=t.x+m*v,E=t.y+i+5,w=t.group.addShape("text",{attrs:xr({x,y:E,text:b,fontFamily:t.fontFamily||"Arial, sans-serif"},t.tickLabelStyle),name:"tick-label"});if(ht(g)&&m!==d.length-1){var _=Zce([1,0,0,0,1,0,0,0,1],[["t",-x,-E],["r",g],["t",x-5,E+2]]);w.attr({textAlign:"left",matrix:_})}m===0?w.attr({textAlign:"left"}):m!==d.length-1&&w.attr({textAlign:"right"});var M=t.group.addShape("line",{attrs:xr({x1:t.x+m*v,y1:t.y+i+2,x2:t.x+m*v,y2:t.y+i+6},t.tickLineStyle),name:"tick-line"});M.toBack();var C=w.getBBox();return C.minX>p?(w.show(),M.show(),p=C.minX+C.width+10):(w.hide(),M.hide()),w}),this.controllerBtnGroup=new rP(xr({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===ta.SINGLE&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},r.prototype.bindEvents=function(){var t=this,e=this.group.find(function(i){return i.get("name")==="minHandlerShape"});e&&(e.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),e.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),n.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat(Ao,":click"),function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()}),this.group.on("".concat(Ll,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()}),this.group.on("".concat(Dl,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()}),this.group.on(Es,function(i){var a=i.type,o=i.speed;t.currentSpeed=o,t.currentMode=a,a===ta.SINGLE?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):a===ta.RANGE&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())})},r.prototype.adjustTickIndex=function(t){for(var e=0;e<this.tickPosList.length-1;e++)if(this.tickPosList[e]<=t&&t<=this.tickPosList[e+1])return Math.abs(this.tickPosList[e]-t)<Math.abs(t-this.tickPosList[e+1])?e:e+1;return 0},r.prototype.adjustOffsetRange=function(t){switch(this.currentHandler){case this.minHandlerShape:{var e=0-this.start,n=1-this.start;return Math.min(n,Math.max(e,t))}case this.maxHandlerShape:{var e=0-this.end,n=1-this.end;return Math.min(n,Math.max(e,t))}case this.foregroundShape:{var e=0-this.start,n=1-this.end;return Math.min(n,Math.max(e,t))}default:return 0}},r.prototype.updateStartEnd=function(t){var e=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(e):e==null?void 0:e.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+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date;break;case this.maxHandlerShape:this.minText=this.minTextShape.attr("text"),this.end+=t,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break;case this.foregroundShape:this.start+=t,this.end+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break}},r.prototype.updateUI=function(){var t=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 e=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",e),this.foregroundShape.attr("width",n-e);var i=za(this.handlerStyle,"width",tm);this.setText(this.minText,this.maxText);var a=this.dodgeText([e,n]),o=a[0],s=a[1];this.minHandlerShape.setX(e-i/2),me(o,function(u,f){return t.minTextShape.attr(f,u)}),this.maxHandlerShape.setX(n-i/2),me(s,function(u,f){return t.maxTextShape.attr(f,u)}),this.currentMode===ta.RANGE?this.graph.emit(ia,{value:[this.start,this.end].sort()}):this.currentMode===ta.SINGLE&&this.graph.emit(ia,{value:[this.end,this.end]})},r.prototype.dodgeText=function(t){var e,n,i=2,a=za(this.handlerStyle,"width",tm),o=this.minTextShape,s=this.maxTextShape,u=t[0],f=t[1],l=!1;u>f&&(e=[f,u],u=e[0],f=e[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 t=this;return typeof window<"u"?window.requestAnimationFrame(function(){var e=t,n=e.ticks,i=e.width,a=t.currentSpeed,o=i/n.length,s=o/((10-a)*1e3/60),u=t.adjustOffsetRange(s/t.width);t.updateStartEnd(u),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())}):void 0},r.prototype.changePlayStatus=function(t){t===void 0&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(Qk,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit(Jk,null))},r.prototype.destory=function(){this.graph.off(ia,function(){});var t=this.group,e=t.find(function(i){return i.get("name")==="minHandlerShape"});e&&(e.off("minHandlerShape-handler:mousedown"),e.off("minHandlerShape-handler:touchstart"),e.destroy());var n=t.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(),t.off("".concat(Ao,":click")),t.off("".concat(Ll,":click")),t.off("".concat(Dl,":click")),t.off(Es),t.destroy(),this.trendComponent&&this.trendComponent.destory()},r}();const ohe=ahe;var she=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ja=function(){return ja=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},ja.apply(this,arguments)},uhe=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e},fhe=4,lhe=26,che=function(r){she(t,r);function t(e){var n=r.call(this,e)||this;return n.afterrenderListener=function(i){return n.filterData({})},n.valueChangeListener=ll(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 t.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}},t.prototype.initContainer=function(){var e=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?(Ne(u)&&(u=document.getElementById(u)),f=u):(f=wr("<div class='".concat(s,"'></div>")),Xt(f,{position:"relative"})),o){var l=this.get("graph").get("container");l.appendChild(f)}this.set("timeBarContainer",f);var c,h=e.get("renderer");h==="SVG"?c=new Qf({container:f,width:i,height:a}):c=new $a({container:f,width:i,height:a}),this.get("containerCSS")&&Xt(f,this.get("containerCSS")),this.set("canvas",c)},t.prototype.init=function(){this.initContainer();var e=this.get("canvas"),n=e.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)},t.prototype.play=function(){this.togglePlay(!0)},t.prototype.pause=function(){this.togglePlay(!1)},t.prototype.togglePlay=function(e){var n=this.get("timebar");n&&(n.isPlay=!!e,n.changePlayStatus())},t.prototype.renderTrend=function(){var e=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=uhe(f,["data"]),m=i-2*s,b=u==="trend"?lhe:fhe,x=this.get("graph"),E=this.get("timeBarGroup"),w=this.get("canvas"),_=null;if(u==="trend"||u==="simple"){var M=this.get("getValue");_=new ohe(ja(ja({graph:x,canvas:w,group:E,type:u,x:a+s,y:u==="trend"?o+s:o+s+15,width:m,height:b,padding:s,backgroundStyle:v,foregroundStyle:p,trendCfg:ja(ja({},y),{data:g.map(function(S){return(M==null?void 0:M(S))||S.value})})},l),{tick:{ticks:g,tickLabelFormatter:d.tickLabelFormatter,tickLabelStyle:d.tickLabelStyle,tickLineStyle:d.tickLineStyle},handlerStyle:ja(ja({},l.handlerStyle),{height:l.height||b}),controllerCfg:c,textStyle:h}))}else u==="tick"&&(_=new jle(ja({graph:x,canvas:w,group:E,x:a+s,y:o+s,width:i,height:42,padding:2,controllerCfg:c},d)));var C=function S(){var A=e.get("timebar");A.draggingHandler=!1,A.isPlay&&(A.isPlay=!1,A.currentHandler=A.maxHandlerShape,A.changePlayStatus()),document.removeEventListener("mouseup",S)};w.on("mousedown",function(S){(S.target.get("name")==="maxHandlerShape-handler"||S.target.get("name")==="minHandlerShape-handler"||S.target===_.foregroundShape)&&document.addEventListener("mouseup",C)}),this.set("timebar",_)},t.prototype.filterData=function(e){var n,i=e.value;if(!i){i=[];var a=this._cfgs.type;!a||a==="trend"||a==="simple"?(i[0]=this._cfgs.slider.start,i[1]=this._cfgs.slider.end):a==="tick"&&(i[0]=this._cfgs.tick.start,i[1]=this._cfgs.tick.end)}var o=null,s=this._cfgs.type;if(s==="trend"||s==="simple"?o=this._cfgs.trend.data:s==="tick"&&(o=this._cfgs.tick.data),!o||o.length===0){console.warn("请配置 TimeBar 组件的数据");return}var u=this.get("rangeChange"),f=this.get("graph"),l=Math.round(o.length*i[0]),c=Math.round(o.length*i[1]);c=c>=o.length?o.length-1:c,l=l>=o.length?o.length-1:l;var h=(n=this._cfgs.tick)===null||n===void 0?void 0:n.tickLabelFormatter,d=h?h(o[l]):o[l].date,v=h?h(o[c]):o[c].date;if(s!=="tick"){var p=this.get("timebar");p.setText(d,v)}if(u)u(f,d,v);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=f.get("data"));var g=this.get("filterItemTypes"),y=this.get("changeData"),m=this.get("getDate"),b=this.get("shouldIgnore"),x=o[l].date,E=o[c].date;if(y||y===void 0){var w=this.cacheGraphData.nodes,_=this.cacheGraphData.edges,M={},C={};f.getNodes().forEach(function(S){return M[S.getID()]=!0}),f.getEdges().forEach(function(S){return C[S.getID()]=!0}),g.includes("node")&&(w==null||w.forEach(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=E||(b==null?void 0:b("node",S,{min:x,max:E})),I=M[S.id];I&&!T?(f.removeItem(S.id),M[S.id]=!1):!I&&T&&(f.addItem("node",S),M[S.id]=!0)}),_==null||_.forEach(function(S){var A=M[S.source]&&M[S.target]||(b==null?void 0:b("edge",S,{min:x,max:E})),T=!!f.findById(S.id);T&&!A?(f.removeItem(S.id),C[S.id]=!1):!T&&A?(f.addItem("edge",S),C[S.id]=!0):T||(C[S.id]=!1)})),(this.get("filterEdge")||g.includes("edge"))&&(_==null||_.filter(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=E||(b==null?void 0:b("edge",S,{min:x,max:E})),I=M[S.source]&&M[S.target],D=T&&I,N=C[S.id];N&&!D?(C[S.id]=!1,f.removeItem(S.id)):!N&&D&&(C[S.id]=!0,f.addItem("edge",S))}))}else g.includes("node")&&f.getNodes().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("node",A,{min:x,max:E}))){var T=+((m==null?void 0:m(A))||A.date);T<x||T>E?f.hideItem(S):f.showItem(S)}}),(this.get("filterEdge")||g.includes("edge"))&&f.getEdges().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("edge",A,{min:o[l].date,max:o[c].date}))){var T=+((m==null?void 0:m(A))||A.date);if(T<o[l].date||T>o[c].date)f.hideItem(S);else{var I=S.getSource().isVisible(),D=S.getTarget().isVisible();I&&D&&f.showItem(S)}}})}},t.prototype.initEvent=function(){var e=this.get("graph");e.on("afterchangedata",this.changeData),e.on("afterrender",this.afterrenderListener),e.on(ia,this.valueChangeListener)},t.prototype.destroy=function(){var e=this.get("graph");e.off("afterchangedata",this.changeData),e.off("afterrender",this.afterrenderListener),e.off(ia,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")),Ne(a)&&(a=document.getElementById(a)),a===i&&(a=a.parentElement),a.removeChild(i)}},t}(jn);const hhe=che;var dhe=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),vhe=_n.applyMatrix;function phe(r,t){var e,n;if(r.naturalWidth)e=r.naturalWidth,n=r.naturalHeight;else{var i=new Image;i.src=r.src,i.onload=function(){t&&t(i.width,i.height)}}return[e,n]}var ghe=function(r){dhe(t,r);function t(e){return r.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},t.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},t.prototype.disableRefresh=function(){this.set("refresh",!1)},t.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},t.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},t.prototype.initViewport=function(){var e=this,n=this._cfgs,i=n.graph;if(!this.destroyed){var a=this.get("container");Ne(a)&&(a=document.getElementById(a));var o=wr("<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=e.get("width"),b=e.get("height");h>m||d>b||(p=i.getZoom(),v=e.get("ratio"),f=!0,s=g.clientX,u=g.clientY)}},!1),a.addEventListener("mousemove",function(g){if(!(!f||ct(g.clientX)||ct(g.clientY))){var y=e.get("width"),m=e.get("height"),b=o.style;l=parseInt(b.left,10),c=parseInt(b.top,10),h=parseInt(b.width,10),d=parseInt(b.height,10);var x=s-g.clientX,E=u-g.clientY;l-x<0?x=l:l-x+h>=y&&(x=0),c-E<0?E=c:c-E+d>=m&&(E=0),l-=x,c-=E,Xt(o,{left:"".concat(l,"px"),top:"".concat(c,"px")}),i.translate(x*p/v,E*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)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=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=pm([1,0,0,0,1,0,0,0,1],v),g=vhe({x:d.minX,y:d.minY},p),y=a.getCanvasByPoint(g.x,g.y),m=this.get("viewport");m||this.initViewport();var b=o/d.width,x=b*n,E=b*i,w=n*-y.x/d.width,_=i*-y.y/d.height,M=w+x,C=_+E;w<0&&(x+=w,w=0),M>n&&(x=x-(M-n)),_<0&&(E+=_,_=0),C>i&&(E=E-(C-i)),this.set("ratio",e);var S="".concat(w,"px"),A="".concat(_,"px");Xt(m,{left:S,top:A,width:"".concat(x,"px"),height:"".concat(E,"px")})}},t.prototype.init=function(){this.initContainer()},t.prototype.initContainer=function(){var e=this,n=e.get("graph"),i=n.get("width"),a=n.get("height"),o=a/i,s=e.get("className"),u=e.get("container"),f=e.get("width"),l=e.get("height");!f&&!l&&(f=200),f?(l=o*f,e.set("height",l)):(f=1/o*l,e.set("width",f));var c=wr("<div class='".concat(s,"' style='width: ").concat(f,"px; height: ").concat(l,"px; overflow: hidden; position: relative;'></div>"));Ne(u)&&(u=document.getElementById(u)),u?u.appendChild(c):n.get("container").appendChild(c),e.set("container",c);var h=wr('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');c.appendChild(h);var d=wr('<span style="display: table-cell; vertical-align: middle; "></span>');h.appendChild(d),e.set("containerDOM",h),e.set("containerSpan",d);var v=wr('<img alt="" src="'.concat(this.get("graphImg"),'" style="display: inline-block; user-select: none;" draggable="false" />'));e.set("imgDOM",v),e.updateImgSize(),d.appendChild(v),e.updateCanvas()},t.prototype.updateImgSize=function(){var e=this,n=e.get("imgDOM"),i=e.get("width"),a=e.get("height");n.onload=function(){var o=phe(n);o[0]>o[1]?n.width=i:n.height=a}},t.prototype.updateCanvas=function(){var e=this.get("refresh");if(e){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()}}},t.prototype.getViewport=function(){return this.get("viewport")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.updateGraphImg=function(e){var n=this,i=n.get("imgDOM");i.remove(),n.set("graphImg",e);var a=wr('<img alt="" src="'.concat(e,'" style="display: inline-block;" ondragstart="return false;" onselectstart="return false;"/>'));n.set("imgDOM",a),a.src=e,n.updateImgSize();var o=n.get("containerSpan");o.appendChild(a),n.updateCanvas()},t.prototype.destroy=function(){var e=this.get("container");e.parentNode.removeChild(e)},t}(jn);const yhe=ghe;var mhe=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),rm=function(){return rm=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},rm.apply(this,arguments)},bhe=_n.distance,AM=.05,TM={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},xhe=function(r){mhe(t,r);function t(e){return r.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:Vt(TM),showLabel:"edge",scaleRBy:"wheel"}},t.prototype.getEvents=function(){var e;switch(this.get("trigger")){case"click":e={click:"filter"};break;case"drag":e={click:"createDelegate"};break;default:e={mousemove:"filter"};break}return e},t.prototype.init=function(){var e=this,n=e.get("showLabel"),i=n==="node"||n==="both",a=n==="edge"||n==="both";e.set("showNodeLabel",i),e.set("showEdgeLabel",a);var o=e.get("shouldShow");o||e.set("shouldShow",function(){return!0})},t.prototype.createDelegate=function(e){var n=this,i=n.get("delegate");(!i||i.destroyed)&&(n.filter(e),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)}))},t.prototype.scaleRByWheel=function(e){var n=this;if(!(!e||!e.originalEvent)){e.preventDefault&&e.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(e.clientX,e.clientY),e.originalEvent.wheelDelta<0?a=1-AM:a=1/(1-AM);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(e)}},t.prototype.filter=function(e){var n=this,i=n.get("graph"),a=i.getNodes(),o={},s=n.get("r"),u=n.get("type"),f={x:e.x,y:e.y};n.updateDelegate(f,s);var l=n.get("shouldShow"),c=n.get("vShapes");c&&c.forEach(function(y){y.remove(),y.destroy()}),c=[],a.forEach(function(y){var m=y.getModel(),b=m.x,x=m.y;bhe({x:b,y:x},f)<s&&(o[m.id]=y)});var h=i.getEdges(),d=[];h.forEach(function(y){var m=y.getModel(),b=m.source,x=m.target;l(m)&&(u==="only-source"||u==="one"?o[b]&&!o[x]&&d.push(y):u==="only-target"||u==="one"?o[x]&&!o[b]&&d.push(y):u==="both"&&o[b]&&o[x]&&d.push(y))});var v=n.get("showNodeLabel"),p=n.get("showEdgelabel"),g=i.get("group");d.forEach(function(y){var m=y.get("group").get("children");m.forEach(function(b){var x=b.get("type"),E=g.addShape(x,{attrs:b.attr()});c.push(E),v&&x==="text"&&E.set("visible",!0)})}),Object.keys(o).forEach(function(y){var m=o[y],b=m.get("group").clone();if(g.add(b),c.push(b),p)for(var x=b.get("children"),E=0;E<x.length;E++){var w=x[E];w.get("type")==="text"&&w.set("visible",!0)}}),n.set("vShapes",c)},t.prototype.updateParams=function(e){var n=this,i=e.r,a=e.trigger,o=e.minR,s=e.maxR,u=e.scaleRBy,f=e.showLabel,l=e.shouldShow;if(isNaN(e.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)},t.prototype.updateDelegate=function(e,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")||TM;o=s.addShape("circle",{attrs:rm({r:n,x:e.x,y:e.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:e.x,y:e.y,r:n});i.set("delegate",o)},t.prototype.clear=function(){var e=this,n=e.get("vShapes");n&&n.forEach(function(a){a.remove(),a.destroy()}),n=[],e.set("vShapes",n);var i=e.get("delegate");i&&!i.destroyed&&(i.remove(),i.destroy())},t.prototype.destroy=function(){this.clear()},t}(jn);const Ehe=xhe;var whe=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),_he=_n.pointLineDistance,She={stroke:"#FA8C16",lineWidth:1},Mhe=function(r){whe(t,r);function t(e){return r.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{line:She,itemAlignType:"center",tolerance:5,horizontalLines:{},verticalLines:{},alignLines:[]}},t.prototype.init=function(){},t.prototype.getEvents=function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd"}},t.prototype.onDragStart=function(){this.initBoxLine()},t.prototype.onDrag=function(e){var n=e.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})},t.prototype.onDragEnd=function(){this.destory()},t.prototype.initBoxLine=function(){var e=this._cfgs,n=e.horizontalLines,i=e.verticalLines,a=e.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])})},t.prototype.show=function(e,n){var i=yt({},e);return this.itemAlign(e,n,i),e},t.prototype.itemAlign=function(e,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(),me(s,function(b){b[4].isVisible&&(p.push(a.getLineDisObject(b,l)),p.push(a.getLineDisObject(b,c)),p.push(a.getLineDisObject(b,h)))}),me(u,function(b){b[4].isVisible&&(g.push(a.getLineDisObject(b,d)),g.push(a.getLineDisObject(b,c)),g.push(a.getLineDisObject(b,v)))}),p.sort(function(b,x){return b.dis-x.dis}),g.sort(function(b,x){return b.dis-x.dis}),p.length!==0&&p[0].dis<f){e.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){e.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))},t.prototype.addAlignLine=function(e){var n=e.bbox,i=e.type,a=e.horizontals,o=e.verticals,s=this._cfgs,u=s.line,f=s.alignLines,l=this.get("graph"),c=l.get("group");i==="item"&&(a&&me(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=yt({x1:g,y1:d[1],x2:y,y2:d[1]},u),b=c.addShape("line",{attrs:m,capture:!1});f.push(b)}),o&&me(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=yt({x1:d[0],y1:g,x2:d[0],y2:y},u),b=c.addShape("line",{attrs:m,capture:!1});f.push(b)}))},t.prototype.getLineDisObject=function(e,n){return{line:e,point:n,dis:_he(e,n)}},t.prototype.getContainer=function(){return this.get("container")},t.prototype.clearAlignLine=function(){var e=this._cfgs.alignLines;me(e,function(n){n.remove()}),e.length=0},t.prototype.destory=function(){var e=this._cfgs,n=e.horizontalLines,i=e.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()},t}(jn);const Che=Mhe;var Ahe=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Tr=function(){return Tr=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Tr.apply(this,arguments)},The=["click","mouseenter"],Ihe=function(r){Ahe(t,r);function t(e){return r.call(this,e)||this}return t.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"}}},t.prototype.init=function(){this.formatArray("padding"),this.formatArray("margin");var e=this.get("filter")||{},n=e.multiple;n&&e.trigger==="mouseenter"&&this.set("multiple",!1);var i=this.get("align");if(!i){var a=this.get("position").split("-");a.includes("left")&&(i="left"),a.includes("right")?i="right":i="center",this.set("align",i)}var o=this.get("graph"),s=o.get("container"),u=wr(`<div class='g6-legend-container' style="position: absolute;"></div>`);s.appendChild(u),this.set("container",u);var f=this.render();Xt(u,this.getContainerPos(f)),this.bindEvents()},t.prototype.getContainerPos=function(e){e===void 0&&(e=[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()-e[0])/2+l,top:(i.getHeight()-e[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()-e[1]-v+c,p="top";break;default:v=i.getWidth()-e[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},t.prototype.bindEvents=function(){var e=this,n=e.get("filter");if(!(!n||!n.enable)){var i=n.trigger||"click";The.includes(i)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),i="click");var a=e.get("legendCanvas");i==="mouseenter"?(a.on("node-container:mouseenter",function(o){return e.filterData(o)}),a.on("node-container:mouseleave",function(o){e.clearFilter(),e.clearActiveLegend()})):(a.on("node-container:click",function(o){return e.filterData(o)}),a.on("click",function(o){o.target&&o.target.isCanvas&&o.target.isCanvas()&&(e.clearFilter(),e.clearActiveLegend())}))}},t.prototype.changeData=function(e){this.set("data",e);var n=this.render();Xt(this.get("container"),this.getContainerPos(n))},t.prototype.activateLegend=function(e){var n=this.get("filter"),i=n==null?void 0:n.multiple;i||this.clearActiveLegend();var a=e.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(Tr(Tr({},d.get("oriAttrs")),s)),v.attr(Tr(Tr({},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(Tr(Tr({},d.get("oriAttrs")),f)),v.attr(Tr(Tr({},v.get("oriAttrs")),l))})},t.prototype.findLegendItemsByState=function(e,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(e)===i}):n==="edge"?s.get("children").filter(function(u){return!!u.get(e)===i}):o.get("children").filter(function(u){return!!u.get(e)===i}).concat(s.get("children").filter(function(u){return!!u.get(e)===i}))},t.prototype.clearActiveLegend=function(){var e=this.get("legendCanvas"),n=e.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"))})})},t.prototype.filterData=function(e){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(e.target);var l=a.find(function(y){return y.get("name")==="root"}),c=l.find(function(y){return y.get("name")==="node-group"}),h=l.find(function(y){return y.get("name")==="edge-group"}),d=c.get("children").filter(function(y){return y.get("active")}),v=h.get("children").filter(function(y){return y.get("active")}),p=0,g=["getNodes","getEdges"];g.forEach(function(y){o[y]().forEach(function(m){var b=!1,x=y==="getNodes"?d:v;x.forEach(function(E){var w=i[E.get("id")];b=b||w(m.getModel())}),b?(o.setItemState(m,u,!1),o.setItemState(m,s,!0),p++):(o.setItemState(m,s,!1),o.setItemState(m,u,!0))})}),p||g.forEach(function(y){o[y]().forEach(function(m){o.clearItemStates(m,[u])})})}},t.prototype.clearFilter=function(){var e=this.get("graph"),n=this.get("filter");if(n){var i=n.graphActiveState||"active",a=n.graphInactiveState||"inactive";e.getNodes().forEach(function(o){e.clearItemStates(o,[i,a])}),e.getEdges().forEach(function(o){e.clearItemStates(o,[i,a])})}},t.prototype.render=function(){var e=this;this.processData();var n=this.get("legendCanvas");n?n.clear():n=new $a({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(P,G){s[P].forEach(function(W){var k,R=f[G].addGroup({id:W.id,name:"node-container"}),Y,J=W.type,te=e.getShapeSize(W),H=te.width,pe=te.height,Ae=te.r,Le=e.getStyle(P.substr(0,4),W);switch(W.type){case"circle":Y={r:Ae,x:0,y:0};break;case"rect":Y={width:H,height:pe,x:-H/2,y:-pe/2};break;case"ellipse":Y={rx:H,ry:pe,x:0,y:0},J="ellipse";break;case"line":Y={x1:-H/2,y1:0,x2:H/2,y2:0},J="line";break;case"quadratic":Y={path:[["M",-H/2,0],["Q",0,H/2,H/2,0]]},J="path";break;case"cubic":Y={path:[["M",-H/2,0],["C",-H/6,H/2,H/6,-H/2,H/2,0]]},J="path";break;case"diamond":Y={path:[["M",0,-pe],["L",H,0],["L",0,pe],["L",-H,0],["Z"]]},J="path";break;case"triangle":Y={path:[["M",-H,pe],["L",0,-pe],["L",H,pe],["Z"]]},J="path";break;case"star":Y={path:_n.getStarPath(Ae*3,Ae*1.2)},J="path";break;default:Y={r:Ae,x:0,y:0};break}var qe=R.addShape(J,{attrs:Tr(Tr({},Y),Le),name:"".concat(W.type,"-node-keyShape"),oriAttrs:Tr({opacity:1},Le)});if(W.label){var at=qe.getBBox(),rt=((k=W.labelCfg)===null||k===void 0?void 0:k.style)||{},xt=Tr({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},rt);R.addShape("text",{attrs:Tr({x:at.maxX+4,y:0,text:W.label},xt),className:"legend-label",name:"".concat(W.type,"-node-text"),oriAttrs:xt})}})});var l=this.get("padding"),c,h=i.find(function(P){return P.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:Tr({text:this.get("title")},g)}),d=h.getCanvasBBox(),h.setMatrix([1,0,0,0,1,0,p.offsetX,p.offsetY,1])}this.layoutItems();var y=i.getCanvasBBox(),m=a.getCanvasBBox(),b=m.minX<0?Math.abs(m.minX)+l[3]:l[3],x=d.maxY<m.minY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],E=[1,0,0,0,1,0,b,x,1];a.setMatrix(E),y=i.getCanvasBBox();var w=[y.minX+y.width+l[1],y.minY+y.height+l[2]];if(c){var p=Tr({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));d=h.getCanvasBBox();var _=h.getMatrix()||[1,0,0,0,1,0,0,0,1];p.position==="center"?_[6]=w[0]/2+p.offsetX:p.position==="right"?(_[6]=w[0]-l[3]+p.offsetX,c.attr({textAlign:"right"})):(_[6]=l[3]+p.offsetX,c.attr({textAlign:"left"})),h.setMatrix(_),d=h.getCanvasBBox(),b=m.minX<0?Math.abs(m.minX)+l[3]:l[3],x=m.minY<d.maxY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],E=[1,0,0,0,1,0,b,x,1],a.setMatrix(E);var M=[1,0,0,0,1,0,b,x,1];this.get("layout")==="vertical"?M[6]+=m.maxX+this.get("horiSep"):M[7]+=m.maxY+this.get("vertiSep"),o.setMatrix(M)}else{m=a.getCanvasBBox();var C=[1,0,0,0,1,0,0,0,1];this.get("layout")==="vertical"?C[6]+=E[6]+m.maxX+this.get("horiSep"):C[7]+=E[7]+m.maxY+this.get("vertiSep"),o.setMatrix(C)}y=i.getCanvasBBox(),m=a.getCanvasBBox(),E=a.getMatrix()||[1,0,0,0,1,0,0,0,1];var S=o.getMatrix()||[1,0,0,0,1,0,0,0,1],A=o.getCanvasBBox();w=[Math.max(m.width+E[6],A.width+S[6])+l[1],Math.max(m.height+E[7],A.height+S[7])+l[2]],n.changeSize(w[0],w[1]);var T=this.get("containerStyle"),I=i.getMatrix()||[1,0,0,0,1,0,0,0,1],D=_n.invertMatrix({x:0,y:0},I),N=i.addShape("rect",{attrs:Tr({x:D.x+(T.lineWidth||1),y:D.y+(T.lineWidth||1),width:w[0]-2*(T.lineWidth||1),height:w[1]-2*(T.lineWidth||1),fill:"#f00",stroke:"#000",lineWidth:1,opacity:.5},T),name:"legend-back-rect",capture:!1});return N.toBack(),w},t.prototype.layoutItems=function(){var e=this.get("legendCanvas"),n=this.get("horiSep"),i=this.get("vertiSep"),a=this.get("layout"),o=this.get("align"),s=[0,0],u=e.find(function(b){return b.get("name")==="root"}),f=u.find(function(b){return b.get("name")==="node-group"}),l=u.find(function(b){return b.get("name")==="edge-group"}),c={min:0,max:-1/0};f.get("children").forEach(function(b,x){x===0&&(c.min=s[0]);var E=b.get("children")[0],w=b.getCanvasBBox(),_=E.getBBox(),M=_.width,C=_.height,S=0,A=0;a==="vertical"?(S=s[1],A=s[0]+M/2,s[0]=A+w.height+i,w.maxX+S+M/2):(S=s[0]+M/2,A=s[1],s[0]=S+w.width+n,w.maxY+A+C/2),s[0]>c.max&&(c.max=s[0]),b.setMatrix([1,0,0,0,1,0,S,A,1])});var h=c.max-c.min,d={min:0,max:-1/0},v=f.getCanvasBBox();s[0]=0,s[1]=a==="vertical"?v.maxX+n:v.maxY+i,l.get("children").forEach(function(b,x){x===0&&(d.min=s[0]);var E=b.get("children")[0],w=b.getCanvasBBox(),_=E.getBBox(),M=_.width,C=_.height,S=0,A=0;a==="vertical"?(S=s[1],A=s[0],s[0]=A+w.height+i,b.setMatrix([1,0,0,0,1,0,0,A+C/2,1])):(S=s[0],A=s[1],s[0]=S+w.width+n,b.setMatrix([1,0,0,0,1,0,S+M/2,0,1])),s[0]>d.max&&(d.max=s[0])});var p=d.max-d.min;if(o&&o!==""&&o!=="left"){var g=h-p,y=o==="center"?Math.abs(g)/2:Math.abs(g),m=g<0?f:l;m.get("children").forEach(function(b){var x=b.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?x[7]+=y:x[6]+=y,b.setMatrix(x)})}},t.prototype.processData=function(){var e=this.get("data"),n={nodes:[],edges:[]};e.nodes&&(e.nodes.sort(function(i,a){return i.order-a.order}),e.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||ya(),type:i.type||"circle",style:Tr({},i.style),order:i.order,label:i.label,itemType:"node",size:l,labelCfg:{position:"right",style:Tr({fontFamily:"Arial"},c)}})})),e.edges&&(e.edges.sort(function(i,a){return i.order-a.order}),e.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||ya(),type:s,size:f,style:Tr({lineWidth:gt(f)?f[1]:1},i.style),order:i.order,label:i.label,itemType:"edge",labelCfg:{position:"right",style:Tr({fontFamily:"Arial"},u)}})})),this.set("itemsData",n)},t.prototype.getContainer=function(){return this.get("container")},t.prototype.formatArray=function(e){var n=this.get(e);if(ht(n))this.set(e,[n,n,n,n]);else if(gt(n))switch(n.length){case 0:this.set(e,[0,0,0,0]);break;case 1:this.set(e,[n[0],n[0],n[0],n[0]]);break;case 2:this.set(e,[n[0],n[1],n[0],n[1]]);break;case 3:this.set(e,[n[0],n[1],n[2],n[1]]);break}return this.get(e)},t.prototype.getShapeSize=function(e){var n,i,a;return e.size&&(gt(e.size)?(n=e.size[0],i=e.size[1]||e.size[0],a=e.size[0]/2):ht(e.size)&&(n=e.size,i=e.size,a=e.size/2)),e.style&&(e.style.width&&(n=e.style.width),e.style.height&&(i=e.style.height),e.style.r&&(a=e.style.r)),a||(a=5),n||(n=a),i||(i=a),{width:n,height:i,r:a}},t.prototype.getStyle=function(e,n){var i=e==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return Tr(Tr({},i),n.style||{})},t.prototype.destroy=function(){var e=this.get("legendCanvas");e==null||e.destroy();var n=this.get("graph"),i=n.get("container"),a=this.get("container");i.removeChild(a)},t}(jn);const Ohe=Ihe;var Lhe=function(){var r=function(e,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(e,n)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),hi=function(){return hi=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},hi.apply(this,arguments)},IM=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};typeof document<"u"&&tp(`
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 OM="canvas-annotation",Dhe=function(r){Lhe(t,r);function t(e){return r.call(this,e)||this}return t.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}}},t.prototype.getEvents=function(){var e={viewportchange:"updateLinks",afterlayout:"updateLinks",aftergraphrefreshposition:"updateLinks",afterupdateitem:"updateLink",afterchangedata:"onGraphDataChange",afteritemvisibilitychange:"onGraphItemVisibilityChange"};switch(this.get("trigger")){case"click":e=hi(hi({},e),{"node:click":"showAnnotation","edge:click":"showAnnotation"})}return e},t.prototype.getDOMContent=function(e){if(!this.destroyed){var n=e.collapsed,i=e.maxWidth,a=e.title,o=a===void 0?"":a,s=e.content,u=s===void 0?"":s,f=e.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>`)}},t.prototype.init=function(){var e=this;if(!e.destroyed){var n=e.get("graph"),i=n.getContainer(),a=e.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 $a({container:i,width:s.right-s.left,height:s.bottom-s.top});Xt(u.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",Nl(function(){return e.resizeCanvas(e)},100));var f=u.addGroup({id:"annotation-link-group"});e.set("linkGroup",f),e.set("canvas",u),e.get("getTitle")||e.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||"-"}),e.get("getContent")||e.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=e.get("defaultData");l&&this.readData(l)}},t.prototype.createContainer=function(){var e=this;if(!this.destroyed){var n=this.get("containerCfg"),i=this.get("graph"),a=i.getContainer(),o=a.getBoundingClientRect(),s=o.left,u=o.right,f=o.top,l=o.bottom,c=l-f,h=u-s,d=n.position,v=d===void 0?"top":d,p=n.offsetX,g=p===void 0?0:p,y=n.offsetY,m=y===void 0?0:y,b=IM(n,["position","offsetX","offsetY"]),x=n.height,E=x===void 0?"fit-content":x,w=n.width,_=w===void 0?i.getWidth():w;E==="100%"&&(E=c),_==="100%"&&(_=h);var M="unset",C="unset",S={};switch(v){case"right":M="".concat(c,"px"),S={top:0,right:0},S.right+=s+g,S.top+=f+m;break;case"bottom":C="".concat(h,"px"),S={bottom:0,left:0},S.left+=s+g,S.bottom+=f+m;break;case"top":C="".concat(h,"px");case"left":M="".concat(c,"px");default:S={top:0,left:0},S.left+=s+g,S.top+=f+m;break}Object.keys(S).forEach(function(T){S[T]="".concat(S[T],"px")});var A=wr("<div class='".concat(n.className," g6-annotation-container'></div>"));return Xt(A,hi(hi({position:"absolute",display:v==="top"||v==="bottom"?"inline-flex":"unset",width:ht(_)?"".concat(_,"px"):_,height:ht(E)?"".concat(E,"px"):E,maxHeight:M,maxWidth:C,overflow:"scroll"},S),b)),a.appendChild(A),A.addEventListener("scroll",function(T){e.updateLinks()}),A}},t.prototype.resizeCanvas=function(e){clearTimeout(e.resizeTimer),e.resizeTimer=setTimeout(function(){if(!(!e||e.destroyed)){var n=e.get("container").getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top;e.get("canvas").changeSize(i,a),e.updateOutsideCards(e)}},250)},t.prototype.updateOutsideCards=function(e){var n=e||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=us(g.left),m=us(g.top),b=p.getBoundingClientRect(),x=b.width,E=b.height,w=y,_=m;y+x>h-f&&(w=h-f-x),y<0&&(w=0),m+E>d-l&&(_=d-l-E),m<0&&(_=0),Xt(p,{left:"".concat(w,"px"),top:"".concat(_,"px")})}}),n.updateLinks()},t.prototype.showAnnotation=function(e){if(!this.destroyed){var n=e.item;this.toggleAnnotation(n)}},t.prototype.hideCards=function(){var e=this;if(!e.destroyed){var n=e.get("cardInfoMap")||{};Object.keys(n).forEach(function(i){e.hideCard(i)})}},t.prototype.toggleAnnotation=function(e,n){var i,a;n===void 0&&(n={});var o=this;if(!o.destroyed){var s=o.get("cardInfoMap")||{},u=o.get("graph"),f=o.get("container"),l=o.get("containerCfg"),c=Object.assign({},o.get("cardCfg")||{},n),h=c.minHeight,d=c.minWidth,v=c.width,p=c.height,g=c.collapsed,y=g===void 0?!1:g,m=c.x,b=c.y,x=c.title,E=c.content,w=c.maxTitleLength,_=c.defaultBegin,M=IM(c,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),C=o.get("linkGroup"),S=this.get("rows")||[[]],A=(i=e.isCanvas)===null||i===void 0?void 0:i.call(e),T=A?OM:e.getID(),I=s[T]||{},D=I.card,N=I.link,P=I.x,G=I.y,W=I.title,k=I.content,R=this.get("getTitle"),Y=this.get("getContent"),J=this.get("getContentPlaceholder")||function(){return""},te=this.get("getTitlePlaceHolder")||function(){return""},H=J(e),pe=te(e),Ae=wr(this.getDOMContent(hi({itemId:T,collapsed:y,title:((a=W||x||(R==null?void 0:R(e)))===null||a===void 0?void 0:a.substr(0,w))||pe,content:k||E||(Y==null?void 0:Y(e))||H},M))),Le=ht(h)?"".concat(h,"px"):h;Xt(Ae,{minHeight:y?"unset":Le,minWidth:ht(d)?"".concat(d,"px"):d,height:p,width:v});var qe=!!D;qe?(N==null||N.remove(!0),f.replaceChild(Ae,D)):f.appendChild(Ae);var at;if(!l){if(at=f.getBoundingClientRect()||{},m!==void 0&&b!==void 0)P=m,G=b;else if(!qe&&!A){var rt=at.top,xt=_||{},Et=xt.left,ur=xt.right,Bt=ur===void 0?16:ur,Ut=xt.top,dr=Ut===void 0?8:Ut,fr=xt.bottom,Gt=Bt,Jt=dr;isNaN(Et)||(Gt=f.scrollWidth-Et),isNaN(fr)||(Jt=f.scrollHeight-fr);var Rr=ht(d)?d:100;P=f.scrollWidth-Ae.scrollWidth-(S.length-1)*Rr-Gt;var tt=S[S.length-1],ie=(tt[tt.length-1]||{}).bbox;G=(ie==null?void 0:ie.bottom)-rt||Jt}Xt(Ae,{position:"absolute",left:"".concat(P,"px"),top:"".concat(G,"px"),cusor:l?"unset":"move"})}this.bindListener(Ae,T);var L=Ae.getBoundingClientRect();if(!A){var _e=w0(e,L,u,this.get("canvas")),Be=this.get("linkStyle");N=C.addShape("path",{attrs:hi({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:_e},Be)})}if(s[T]=hi(hi({},s[T]||{}),{id:T,collapsed:y,card:Ae,link:N,x:P,y:G,cardBBox:L,content:k||E,title:W||x,contentPlaceholder:H,titlePlaceholder:pe,isCanvas:A}),o.set("cardInfoMap",s),l)this.updateCardPositionsInConatainer(),this.updateLinks();else{var ye=!isNaN(m)&&!isNaN(b);if(!qe&&!A&&!ye){var $e=at.bottom,We=$e===void 0?0:$e,rt=at.top;S[S.length-1].push({id:T,bbox:L}),L.top>We-rt-L.height-16&&S.push([]),this.set("rows",S)}}this.updateCardSize(T);var Ke=this.get("onAnnotationChange");Ke==null||Ke(s[T],qe?"update":"create")}},t.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var e=this.get("cardInfoMap");if(e){var n=this.get("container"),i=this.get("containerCfg").position,a=n.getBoundingClientRect().width,o=getComputedStyle(n),s=us(o.paddingLeft)+us(o.paddingRight);a-=s,Object.values(e).forEach(function(u){var f=u.card,l=f.getBoundingClientRect().width;switch(i){case"right":Xt(f,{marginLeft:a?"".concat(a-l,"px"):"0px"});break;case"top":case"bottom":Xt(f,{marginLeft:"8px"})}})}}},t.prototype.handleExpandCollapseCard=function(e){if(!this.destroyed){var n=this.get("graph"),i=this.get("cardInfoMap");if(i){var a=i[e].collapsed,o=n.findById(e);if(o){var s=this.get("cardCfg").collapseType;s==="hide"&&!a?this.hideCard(e):this.toggleAnnotation(o,{collapsed:!a}),i[e]=hi(hi({},i[e]),{collapsed:!a})}}}},t.prototype.hideCard=function(e){if(!this.destroyed){var n=this.get("cardInfoMap");if(!(!n||!n[e])){var i=n[e],a=i.card,o=i.link;Xt(a,{display:"none"}),o==null||o.hide();var s=this.get("onAnnotationChange");s(n[e],"hide")}}},t.prototype.removeCard=function(e){if(!this.destroyed){var n=this.get("cardInfoMap");if(n){var i=n[e],a=i.card,o=i.link,s=this.get("container");s.removeChild(a),o==null||o.remove(!0),delete n[e];var u=this.get("onAnnotationChange");u(i,"remove")}}},t.prototype.bindListener=function(e,n){var i=this;if(!this.destroyed){e.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)}}),e.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)}}),e.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)}}}),e.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)}}}),e.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&&e.addEventListener("dblclick",function(u){var f=i.get("cardInfoMap"),l=(i.get("cardCfg")||{}).maxTitleLength,c=l===void 0?20:l;if(f){var h=u.target,d=h.className;if(!(d!=="g6-annotation-title"&&d!=="g6-annotation-content")){var v=d==="g6-annotation-title"?h.getBoundingClientRect():h.parentNode.getBoundingClientRect(),p=v.width,g=v.height,y=getComputedStyle(h),m=d==="g6-annotation-title"?"input":"textarea",b=wr("<".concat(m,' class="').concat(d,'-input" type="textarea" style="width:').concat(p,"px; height: ").concat(g,'px; min-width: 16px;"/>')),x=wr('<div class="'.concat(d,'-input-wrapper" style="width: ').concat(p,"px; height: ").concat(g,"px; min-width: 16px; margin-right: ").concat(y.marginRight,'" />'));x.appendChild(b),h.parentNode.replaceChild(x,h);var E=f[n],w=E.contentPlaceholder,_=E.titlePlaceholder,M=E.content,C=E.title,S=M;d==="g6-annotation-title"?(b.name="title",b.maxLength=c,S=C):b.name="content",S?(b.innerHTML=h.innerHTML,b.value=h.innerHTML):b.placeholder=d==="g6-annotation-title"?_:w,b.focus(),b.addEventListener("blur",function(A){b.value&&(h.innerHTML=b.value,E[b.name||"title"]=b.value),x.parentNode.replaceChild(h,x),i.updateCardSize(n);var T=i.get("onAnnotationChange");T==null||T(E,"update")})}}});var o=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];e.draggable=!0,e.addEventListener("dragstart",function(u){var f=u.target.className;if(!o.includes(f)){var l=e.style;i.set("dragging",{card:e,x:u.clientX,y:u.clientY,left:us(l.left),top:us(l.top)})}}),e.addEventListener("drag",function(u){u.preventDefault();var f=i.get("cardInfoMap");if(f){var l=u.clientX,c=u.clientY,h=i.get("dragging");if(!(isNaN(l)||isNaN(c)||!h)){var d=h.x,v=h.y,p=h.left,g=h.top,y=h.card,m=l-d,b=c-v;p+=m,g+=b;var x=i.get("graph"),E=x.getPointByCanvas(0,0),w=x.getPointByCanvas(x.getWidth(),x.getHeight()),_=x.getClientByPoint(E.x,E.y),M=_.x,C=_.y,S=x.getClientByPoint(w.x,w.y),A=S.x,T=S.y,I=y.getBoundingClientRect(),D=I.right-I.left,N=I.bottom-I.top;(p>A-M-D&&m>0||p<0&&m<0)&&(p-=m),(g>T-C-N&&b>0||g<0&&b<0)&&(g-=b),Xt(y,{left:"".concat(p,"px"),top:"".concat(g,"px"),visibility:"hidden"}),d=l,v=c;var P=(f[n]||{}).link;if(P){var G=x.findById(n);P.attr("path",w0(G,I,x,i.get("canvas")))}i.set("dragging",{x:d,y:v,left:p,top:g,card:y})}}});var s=function(f){var l=i.get("cardInfoMap");if(l){var c=i.get("dragging");if(c){var h=c.left,d=c.top,v=c.card;l[n].x=h,l[n].y=d,Xt(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")}}};e.addEventListener("dragend",s)}},t.prototype.updateCardSize=function(e){var n=this.get("cardInfoMap");if(n){var i=n[e].card,a=i.getBoundingClientRect().width,o=i.getElementsByClassName("g6-annotation-title")[0];if(o){var s=getComputedStyle(o),u=us(s.marginLeft),f=o.getBoundingClientRect().width;Xt(o,{marginRight:"".concat(a-u-24-16-f,"px")})}}},t.prototype.updateLink=function(e){var n=e.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=w0(n,l.getBoundingClientRect(),o,a);f.attr("path",c)}}}},t.prototype.updateLinks=function(){var e=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);e.updateLink({item:s})})}}},t.prototype.onGraphDataChange=function(){var e=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()?e.toggleAnnotation(f):e.hideCard(o)}})}},t.prototype.onGraphItemVisibilityChange=function(e){var n=e.item,i=e.visible;if(!(!n||n.destroyed)){var a=this.get("cardInfoMap");if(a){var o=n.getID();a[o]&&(i||this.hideCard(o))}}},t.prototype.saveData=function(e){e===void 0&&(e=!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"&&!e)){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}},t.prototype.readData=function(e){var n=this,i=this.get("graph");e.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===OM&&(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)})},t.prototype.clear=function(){var e=this.get("cardInfoMap");if(e){var n=this.get("container");Object.values(e).forEach(function(i){var a=i.card,o=i.link;n.removeChild(a),o==null||o.remove(!0)}),this.set("cardInfoMap",{})}},t.prototype.destroy=function(){var e;this.clear(),(e=this.get("canvas"))===null||e===void 0||e.destroy();var n=this.get("graph");!n||n.destroyed||(this.get("containerCfg")&&n.getContainer().removeChild(this.get("container")),this.destroyed=!0)},t}(jn);const khe=Dhe;var Phe=function(t,e){var n,i,a=1/0;Object.keys(t).forEach(function(u){var f=t[u];Object.keys(e).forEach(function(l){var c=e[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=_n.getControlPoint(n,i,.5,o);return[["M",n.x,n.y],["Q",s.x,s.y,i.x,i.y]]},w0=function(t,e,n,i){var a,o,s=t.getType();if(s==="edge")o=[t.getKeyShape().getPoint(.5)];else{var u=(a=t.getKeyShape)===null||a===void 0?void 0:a.call(t).getBBox(),f=u.minX,l=u.minY,c=u.maxX,h=u.maxY,d=t.getModel(),v=d.x,p=d.y;f+=v,l+=p,c+=v,h+=p,o={left:{x:f,y:(l+h)/2},right:{x:c,y:(l+h)/2},top:{x:(f+c)/2,y:l},bottom:{x:(f+c)/2,y:h}}}Object.keys(o).forEach(function(C){var S=o[C],A=S.x,T=S.y,I=n.getClientByPoint(A,T);o[C]=i.getPointByClient(I.x,I.y)});var g=e.top,y=g===void 0?0:g,m=e.left,b=m===void 0?0:m,x=e.right,E=x===void 0?0:x,w=e.bottom,_=w===void 0?0:w,M={left:i.getPointByClient(b,(y+_)/2),right:i.getPointByClient(E,(y+_)/2),top:i.getPointByClient((b+E)/2,y),bottom:i.getPointByClient((b+E)/2,_)};return Phe(o,M)},us=function(t){return Number(t.replace(/\s+|px/gi,""))||0},qn={PluginBase:jn,Menu:ile,Grid:Qfe,Minimap:cle,Bundling:ple,ToolBar:wle,Tooltip:Mle,Fisheye:mle,TimeBar:hhe,ImageMinimap:yhe,EdgeFilterLens:Ehe,SnapLine:Che,Legend:Ohe,Annotation:khe};Za("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:F({},Je.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(t),o=mr({},i,t.icon),s="".concat(this.type,"-keyShape"),u=e.addShape("circle",{attrs:a,className:s,name:s,draggable:!0});e.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?e.shapeMap[d]=e.addShape("text",{attrs:F({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:d,name:d,draggable:!0}):e.shapeMap[d]=e.addShape("image",{attrs:F({x:-f/2,y:-l/2},o),className:d,name:d,draggable:!0})}return this.drawLinkPoints(t,e),u},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).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=sn(i,["top","left","right","bottom","size","r"]),h=this.getSize(t),d=h[0]/2;if(o){var v="link-point-left";e.shapeMap[v]=e.addShape("circle",{attrs:F(F({},c),{x:-d,y:0,r:f/2||l||5}),className:v,name:v,isAnchorPoint:!0})}if(s){var p="link-point-right";e.shapeMap[p]=e.addShape("circle",{attrs:F(F({},c),{x:d,y:0,r:f/2||l||5}),className:p,name:p,isAnchorPoint:!0})}if(a){var g="link-point-top";e.shapeMap[g]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:-d,r:f/2||l||5}),className:g,name:g,isAnchorPoint:!0})}if(u){var y="link-point-bottom";e.shapeMap[y]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:d,r:f/2||l||5}),className:y,name:y,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=mr({},e,n),a=this.getSize(t),o=a[0]/2,s=F({x:0,y:0,r:o},i);return s},update:function(t,e,n){var i=e.getContainer(),a=this.getSize(t),o=F({},t.style);t.style.stroke===void 0&&t.color&&(o.stroke=t.color),t.style.r===void 0&&!isNaN(a[0])&&(o.r=a[0]/2),this.updateShape(t,e,o,!0,n),this.updateLinkPoints(t,i)}},"single-node");Za("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:F({},Je.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t),i=e.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return e.shapeMap["".concat(this.type,"-keyShape")]=i,this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).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=sn(i,["top","left","right","bottom","size","r"]),h=this.getSize(t),d=h[0],v=h[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=yt({},e,n),a=this.getSize(t),o=i.width||a[0],s=i.height||a[1],u=F({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(t,e,n){var i=e.getContainer(),a=this.getOptions({}).style,o=this.getSize(t),s=e.get("keyShape");t.size||(o[0]=s.attr("width")||a.width,o[1]=s.attr("height")||a.height);var u={stroke:t.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},f=yt({},a,s.attr(),u);f=yt(f,t.style),this.updateShape(t,e,f,!1,n),this.updateLinkPoints(t,i)}},"single-node");Za("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:F({},Je.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(t),o=e.addShape("ellipse",{attrs:a,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:F({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}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:F({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).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=sn(i,["top","left","right","bottom","size","r"]),h=this.getSize(t),d=h[0]/2,v=h[1]/2;o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},c),{x:-d,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},c),{x:d,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:-v,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:v,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=yt({},e,n),a=this.getSize(t),o=a[0]/2,s=a[1]/2,u=F({x:0,y:0,rx:o,ry:s},i);return u},update:function(t,e,n){var i=e.getContainer(),a=this.getOptions({}).style,o=this.getSize(t),s={stroke:t.color,rx:o[0]/2,ry:o[1]/2},u=e.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,t.style),this.updateShape(t,e,f,!0,n),this.updateLinkPoints(t,i)}},"single-node");Za("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:F({},Je.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(t),o=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:F({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}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:F({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).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=sn(i,["top","left","right","bottom","size","r"]),h=this.getSize(t),d=h[0],v=h[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(t){var e=this.getSize(t),n=e[0],i=e[1],a=[["M",0,-i/2],["L",n/2,0],["L",0,i/2],["L",-n/2,0],["Z"]];return a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=yt({},e,n),a=this.getPath(t),o=F({path:a},i);return o},update:function(t,e,n){var i=e.getContainer(),a=this.getOptions({}).style,o=this.getPath(t),s={stroke:t.color,path:o},u=e.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,t.style),this.updateShape(t,e,f,!0,n),this.updateLinkPoints(t,i)}},"single-node");Za("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:F({},Je.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var n=this.mergeStyle||this.getOptions(t),i=n.icon,a=i===void 0?{}:i,o=n.direction,s=this.getShapeStyle(t),u=t.direction||o,f=e.addShape("path",{attrs:s,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.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)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:F({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),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:F({x:p,y:g},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),f},drawLinkPoints:function(t,e){var n=this.mergeStyle||this.getOptions(t),i=n.linkPoints,a=i===void 0?{}:i,o=n.direction,s=t.direction||o,u=a.top,f=a.left,l=a.right,c=a.bottom,h=a.size,d=a.r,v=sn(a,["top","left","right","bottom","size","r"]),p=this.getSize(t),g=p[0];if(f){var y=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?y=[-b,m]:s==="down"?y=[-b,-m]:s==="left"&&(y=[-b,b-m]),y&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},v),{x:y[0],y:y[1],r:h/2||d||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var x=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?x=[b,m]:s==="down"?x=[b,-m]:s==="right"&&(x=[b,b-m]),x&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},v),{x:x[0],y:x[1],r:h/2||d||5}),className:"link-point-right",name:"link-point-right"}))}if(u){var E=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?E=[b-m,-m]:s==="left"?E=[b,-m]:s==="right"&&(E=[-b,-m]),E&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},v),{x:E[0],y:E[1],r:h/2||d||5}),className:"link-point-top",name:"link-point-top"}))}if(c){var w=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="down"?w=[-b+m,m]:s==="left"?w=[b,m]:s==="right"&&(w=[-b,m]),w&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:F(F({},v),{x:w[0],y:w[1],r:h/2||d||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(t){var e=(this.mergeStyle||this.getOptions(t)).direction,n=t.direction||e,i=this.getSize(t),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(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=yt({},e,n),a=this.getPath(t),o=F({path:a},i);return o},update:function(t,e,n){var i=e.getContainer(),a=this.getOptions({}).style,o=this.getPath(t),s={stroke:t.color,path:o},u=e.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,t.style),this.updateShape(t,e,f,!0,n),this.updateLinkPoints(t,i)},updateLinkPoints:function(t,e){var n=this.getOptions({}),i=n.linkPoints,a=n.direction,o=t.direction||a,s=e.shapeMap["link-point-left"]||e.find(function(P){return P.get("className")==="link-point-left"}),u=e.shapeMap["link-point-right"]||e.find(function(P){return P.get("className")==="link-point-right"}),f=e.shapeMap["link-point-top"]||e.find(function(P){return P.get("className")==="link-point-top"}),l=e.shapeMap["link-point-bottom"]||e.find(function(P){return P.get("className")==="link-point-bottom"}),c=i,h=s||u||f||l;h&&(c=h.attr());var d=yt({},c,t.linkPoints),v=d.fill,p=d.stroke,g=d.lineWidth,y=d.size/2;y||(y=d.r);var m=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},b=m.left,x=m.right,E=m.top,w=m.bottom,_=this.getSize(t),M=_[0],C={r:y,fill:v,stroke:p,lineWidth:g},S=null,A=M*Math.sin(1/3*Math.PI),T=M*Math.sin(1/3*Math.PI);o==="up"?S=[-T,A]:o==="down"?S=[-T,-A]:o==="left"&&(S=[-T,T-A]),S&&(s?!b&&b!==void 0?(s.remove(),delete e.shapeMap["link-point-left"]):s.attr(F(F({},C),{x:S[0],y:S[1]})):b&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},C),{x:S[0],y:S[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?!x&&x!==void 0?(u.remove(),delete e.shapeMap["link-point-right"]):u.attr(F(F({},C),{x:I[0],y:I[1]})):x&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},C),{x:I[0],y:I[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var D=null;o==="up"?D=[T-A,-A]:o==="left"?D=[T,-A]:o==="right"&&(D=[-T,-A]),D&&(f?!E&&E!==void 0?(f.remove(),delete e.shapeMap["link-point-top"]):f.attr(F(F({},C),{x:D[0],y:D[1]})):E&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},C),{x:D[0],y:D[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?!w&&w!==void 0?(l.remove(),delete e.shapeMap["link-point-bottom"]):l.attr(F(F({},C),{x:N[0],y:N[1]})):w&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:F(F({},C),{x:N[0],y:N[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node");Za("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(t,e){var n=(this.mergeStyle||this.getOptions(t)).preRect,i=n===void 0?{}:n,a=this.getShapeStyle(t),o=this.getSize(t),s=o[0],u=o[1],f=e.addShape("rect",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=f;var l=i.show,c=sn(i,["show"]);return l&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:F({x:-s/2,y:-u/2,height:u},c),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),f},drawLogoIcon:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).logoIcon,i=n===void 0?{}:n,a=this.getSize(t),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=sn(i,["width","height","x","y","offset","text"]);h?e.shapeMap["rect-logo-icon"]=e.addShape("text",{attrs:F({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}):e.shapeMap["rect-logo-icon"]=e.addShape("image",{attrs:F(F({},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(t,e){var n=(this.mergeStyle||this.getOptions(t)).stateIcon,i=n===void 0?{}:n,a=this.getSize(t),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=sn(i,["width","height","x","y","offset","text"]);h?e.shapeMap["rect-state-icon"]=e.addShape("text",{attrs:F({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}):e.shapeMap["rect-state-icon"]=e.addShape("image",{attrs:F(F({},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(t,e){var n=(this.mergeStyle||this.getOptions(t)).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=sn(i,["top","left","right","bottom","size","r"]),h=this.getSize(t),d=h[0],v=h[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:F(F({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var n=this.getOptions(t),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(t),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 Ne(t.description)?(h=e.addShape("text",{attrs:F(F({},g),{x:p,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=h,e.shapeMap["rect-description"]=e.addShape("text",{attrs:F(F({},y),{x:p,y:17+(m||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(h=e.addShape("text",{attrs:F(F({},g),{x:p,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=h),h},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=yt({},e,n),a=this.getSize(t),o=i.width||a[0],s=i.height||a[1],u=F({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(t,e){var n=this.mergeStyle||this.getOptions(t),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(t),c=l[0],h=l[1],d=e.get("keyShape");d.attr(F(F({},a),{x:-c/2,y:-h/2,width:c,height:h}));var v=e.getContainer(),p=v.shapeMap["rect-logo-icon"]||v.find(function(Ae){return Ae.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=yt({},g,t.logoIcon),m=y.width;m===void 0&&(m=this.options.logoIcon.width);var b=t.logoIcon?t.logoIcon.show:void 0,x=s.offset,E=-c/2+m+x;!b&&b!==void 0&&(E=-c/2+x);var w=v.shapeMap["node-label"]||v.find(function(Ae){return Ae.get("className")==="node-label"}),_=v.shapeMap["rect-description"]||v.find(function(Ae){return Ae.get("className")==="rect-description"});if(t.label)if(!w)v.shapeMap["node-label"]=v.addShape("text",{attrs:F(F({},s.style),{x:E,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var M=t.labelCfg?t.labelCfg.style:{},C=yt({},w.attr(),M);t.label&&(C.text=t.label),C.x=E,Ne(t.description)&&(C.y=-5),_&&(_.resetMatrix(),_.attr({x:E})),w.resetMatrix(),w.attr(C)}if(Ne(t.description)){var S=f.paddingTop;if(!_)v.shapeMap["rect-description"]=v.addShape("text",{attrs:F(F({},f.style),{x:E,y:17+(S||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var M=t.descriptionCfg?t.descriptionCfg.style:{},A=yt({},_.attr(),M);Ne(t.description)&&(A.text=t.description),A.x=E,_.resetMatrix(),_.attr(F(F({},A),{y:17+(S||0)}))}}var T=v.shapeMap["pre-rect"]||v.find(function(Ae){return Ae.get("className")==="pre-rect"});if(T&&!T.destroyed){var I=yt({},T.attr(),t.preRect);T.attr(F(F({},I),{x:-c/2,y:-h/2,height:h}))}if(p&&!p.destroyed)if(!b&&b!==void 0)p.remove(),delete v.shapeMap["pre-rect"];else{var D=y.width,N=y.height,P=y.x,G=y.y,W=y.offset,k=sn(y,["width","height","x","y","offset"]);p.attr(F(F({},k),{x:P||-c/2+D+W,y:G||-N/2,width:D,height:N}))}else b&&this.drawLogoIcon(t,v);var R=v.shapeMap["rect-state-icon"]||v.find(function(Ae){return Ae.get("className")==="rect-state-icon"}),Y=R?R.attr():{},J=yt({},Y,t.stateIcon);if(R){!J.show&&J.show!==void 0&&(R.remove(),delete v.shapeMap["rect-state-icon"]);var te=J.width,N=J.height,P=J.x,G=J.y,H=J.offset,pe=sn(J,["width","height","x","y","offset"]);R.attr(F(F({},pe),{x:P||c/2-te+H,y:G||-N/2,width:te,height:N}))}else J.show&&this.drawStateIcon(t,v);this.updateLinkPoints(t,v)},getOptions:function(t,e){return e==="move"?t:mr({},this.options,this.getCustomConfig(t)||{},t)}},"single-node");Za("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:F({},Je.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(t),o=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:F({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}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:F({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).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=sn(i,["top","left","right","leftBottom","rightBottom","size","r"]),d=this.getSize(t),v=d[0];if(s){var p=Math.cos(.1*Math.PI)*v,g=Math.sin((18+72*0)/180*Math.PI)*v;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},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;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},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;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},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;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:F(F({},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;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:F(F({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){var e=this.getSize(t),n=e[0],i=n*3/8,a=t.innerR||i;return _n.getStarPath(n,a)},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},i=yt({},e,n),a=this.getPath(t),o=F({path:a},i);return o},update:function(t,e,n){var i=e.getContainer(),a=this.getOptions({}).style,o=this.getPath(t),s={stroke:t.color,path:o},u=e.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,t.style),this.updateShape(t,e,f,!0,n),this.updateLinkPoints(t,i)},updateLinkPoints:function(t,e){var n=this.getOptions({}).linkPoints,i=e.shapeMap["link-point-left"]||e.find(function(A){return A.get("className")==="link-point-left"}),a=e.shapeMap["link-point-right"]||e.find(function(A){return A.get("className")==="link-point-right"}),o=e.shapeMap["link-point-top"]||e.find(function(A){return A.get("className")==="link-point-top"}),s=e.shapeMap["link-point-left-bottom"]||e.find(function(A){return A.get("className")==="link-point-left-bottom"}),u=e.shapeMap["link-point-left-bottom"]||e.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=yt({},f,t.linkPoints),h=c.fill,d=c.stroke,v=c.lineWidth,p=c.size/2;p||(p=c.r);var g=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},y=g.left,m=g.right,b=g.top,x=g.leftBottom,E=g.rightBottom,w=this.getSize(t),_=w[0],M={r:p,fill:h,stroke:d,lineWidth:v},C=Math.cos((18+72*0)/180*Math.PI)*_,S=Math.sin((18+72*0)/180*Math.PI)*_;a?!m&&m!==void 0?(a.remove(),delete e.shapeMap["link-point-right"]):a.attr(F(F({},M),{x:C,y:-S})):m&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:F(F({},M),{x:C,y:-S}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),C=Math.cos((18+72*1)/180*Math.PI)*_,S=Math.sin((18+72*1)/180*Math.PI)*_,o?!b&&b!==void 0?(o.remove(),delete e.shapeMap["link-point-top"]):o.attr(F(F({},M),{x:C,y:-S})):b&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:F(F({},M),{x:C,y:-S}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),C=Math.cos((18+72*2)/180*Math.PI)*_,S=Math.sin((18+72*2)/180*Math.PI)*_,i?!y&&y!==void 0?(i.remove(),delete e.shapeMap["link-point-left"]):i.attr(F(F({},M),{x:C,y:-S})):y&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:F(F({},M),{x:C,y:-S}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),C=Math.cos((18+72*3)/180*Math.PI)*_,S=Math.sin((18+72*3)/180*Math.PI)*_,s?!x&&x!==void 0?(s.remove(),delete e.shapeMap["link-point-left-bottom"]):s.attr(F(F({},M),{x:C,y:-S})):x&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:F(F({},M),{x:C,y:-S}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),C=Math.cos((18+72*4)/180*Math.PI)*_,S=Math.sin((18+72*4)/180*Math.PI)*_,u?!E&&E!==void 0?(u.remove(),delete e.shapeMap["link-point-right-bottom"]):u.attr(F(F({},M),{x:C,y:-S})):E&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:F(F({},M),{x:C,y:-S}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var LM=_n.defaultSubjectColors,ul="fan-shape-";Za("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:F({},Je.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(t),o=mr({},i,t.icon),s=e.addShape("circle",{attrs:a,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=s;var u=o.width,f=o.height,l=o.show,c=o.text;return l&&(c?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:F({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}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:F({x:-u/2,y:-f/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Nhe(t,e,s),this.drawLinkPoints(t,e),s},updateShape:function(t,e,n,i,a){var o=e.get("keyShape");o.attr(F({},n)),Rhe(t,e,o),this.updateLabel(t,e,a),i&&this.updateIcon(t,e)}},"circle");var Nhe=function(t,e,n){var i=t.donutAttrs,a=i===void 0?{}:i,o=t.donutColorMap,s=o===void 0?{}:o,u=Object.keys(a).length;if(a&&u>1){var f=EP(a,s),l=f.configs,c=f.totalValue;if(c){var h=wP(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0;if(u===1){nm(e,{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=nm(e,{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}}}},nm=function(t,e){var n=e.arcR,i=e.arcBegin,a=e.beginAngle,o=e.config,s=e.fanIndex,u=e.lineWidth,f=e.totalValue,l=e.drawWhole,c=l===void 0?!1:l,h=e.updateShape,d=h===void 0?void 0:h,v=o.value/f;if(v<.001)return{beginAngle:a,arcBegin:i,shape:void 0,shouldEnd:!1};var p,g,y;if(c||v>.999)p=[n,1e-4],y=1;else{var m=v*Math.PI*2;g=a+m,p=[n*Math.cos(g),-n*Math.sin(g)],y=m>Math.PI?1:0}var b={path:[["M",i[0],i[1]],["A",n,n,0,y,0,p[0],p[1]]],stroke:o.color||(d==null?void 0:d.attr("stroke"))||LM[s%LM.length],lineWidth:u};return d?d.attr(b):t.shapeMap["".concat(ul).concat(s)]=t.addShape("path",{attrs:b,name:"".concat(ul).concat(s),draggable:!0}),{beginAngle:g,arcBegin:p,shape:t.shapeMap["".concat(ul).concat(s)],shouldEnd:c||v>.999}},Rhe=function(t,e,n){var i=t.donutAttrs,a=t.donutColorMap,o=a===void 0?{}:a,s={},u=e.getContainer();if(i){var f=EP(i,o),l=f.configs,c=f.totalValue;if(c)for(var h=wP(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0,y=0;y<l.length;y++){var m="".concat(ul).concat(y),b=nm(u,{arcR:v,arcBegin:p,beginAngle:g,config:l[y],fanIndex:y,lineWidth:d,totalValue:c,drawWhole:l.length===1,updateShape:u.shapeMap[m]});if(b.shape&&(s[m]=!0),b.shouldEnd)break;p=b.arcBegin,g=b.beginAngle}}var x=Object.keys(u.shapeMap).filter(function(E){return E.includes(ul)});x.forEach(function(E){s[E]||(u.shapeMap[E].remove(!0),delete u.shapeMap[E])})},EP=function(t,e){var n=0,i=[];return Object.keys(t).forEach(function(a){var o=+t[a];isNaN(o)||(i.push({key:a,value:o,color:e[a]}),n+=o)}),{totalValue:n,configs:i}},wP=function(t){var e=t.attr("r"),n=.6*e,i=(e+n)/2,a=e-n;return{lineWidth:a,arcR:i}},Dh=function(t){var e=t.x,n=t.y;return{x:e,y:n,centerX:e,centerY:n,minX:e,minY:n,maxX:e,maxY:n,height:0,width:0}},Bhe=function(t){t===void 0&&(t=[]);var e=[],n=[];t.forEach(function(u){e.push(u.x),n.push(u.y)});var i=Math.min.apply(Math,e),a=Math.max.apply(Math,e),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}},Cb=function(t){for(var e=[],n={},i=t.length,a=i-1;a>=0;a--){var o=t[a];o.id="".concat(o.x,"|||").concat(o.y),n[o.id]||(n[o.id]=o,e.push(o))}return e},_P=function(t){return Cb(t)},rv=function(t,e){return t.width||t.height?{centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}:t},Fhe=function(t,e){var n=Math.abs(t.x-e.centerX),i=Math.abs(t.y-e.centerY);return n===0&&i===0?0:n/e.width>i/e.height},im=function(t,e,n){var i=Fhe(e,t);if(i===0){var a=t.centerX,o=t.centerY;return n.y<e.y?o=t.minY:n.x>e.x?a=t.maxX:n.x<e.x?a=t.minX:n.x===e.x&&(o=t.maxY),{x:a,y:o}}return i?{x:e.x>t.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},DM=function(t,e){var n=Math.min(t.minX,e.minX),i=Math.min(t.minY,e.minY),a=Math.max(t.maxX,e.maxX),o=Math.max(t.maxY,e.maxY);return{centerX:(n+a)/2,centerY:(i+o)/2,minX:n,minY:i,maxX:a,maxY:o,height:o-i,width:a-n}},am=function(t){return[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]},kh=function(t,e){var n=t.x,i=t.y;return n<e.minX||n>e.maxX||i<e.minY||i>e.maxY},Ghe=function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]},zhe=function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]},jhe=function(t,e){return Ghe(t,e.x).concat(zhe(t,e.y))},kl=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},Uhe=function(t,e){var n=-2,i=0;return e.forEach(function(a){a&&(t.x===a.x&&(i+=n),t.y===a.y&&(i+=n))}),i},kM=function(t,e,n,i,a){return kl(t,e)+kl(t,n)+Uhe(t,[e,n,i,a])},$he=function r(t,e,n,i,a){a===void 0&&(a=0),t.unshift(e[i]),n[i]&&n[i]!==i&&a<=100&&r(t,e,n,n[i],a+1)},Ph=function(t,e,n,i){var a=n.x-t.x,o=n.y-t.y,s=i.x-t.x,u=i.y-t.y,f=n.x-e.x,l=n.y-e.y,c=i.x-e.x,h=i.y-e.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},om=function(t,e,n){if(n.width||n.height){var i=am(n),a=i[0],o=i[1],s=i[2],u=i[3];return Ph(t,e,a,o)||Ph(t,e,a,u)||Ph(t,e,o,s)||Ph(t,e,s,u)}return!1},Whe=function(t,e,n,i){var a=[];return t.forEach(function(o){if(o!==e&&(o.x===e.x||o.y===e.y)){if(om(o,e,n)||om(o,e,i))return;a.push(o)}}),Cb(a)},Xhe=function(t,e,n,i,a,o,s){var u,f=[],l=(u={},u[e.id]=e,u),c={},h={},d={};h[e.id]=0,d[e.id]=kM(e,n,e);var v=new MP;v.add({id:e.id,value:d[e.id]});var p={};t.forEach(function(E){p[E.id]=E});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 $he(m,p,c,n.id),m}delete l[g.id],v.remove(g.id),f.push(g);var b=Whe(t,g,i,a),x=function(w){w.forEach(function(_){if(f.indexOf(_)===-1){var M=_.id;l[M]||(l[M]=_);var C=d[g.id]+kl(g,_);if(h[M]&&C>=h[M]){v.add({id:M,value:d[M]});return}c[M]=g.id,h[M]=C,d[M]=h[M]+kM(_,n,e,o,s),v.add({id:M,value:d[M]})}})};x(b)}return[e,n]},Yhe=function(t,e,n){return!(t.x===e.x&&e.x===n.x||t.y===e.y&&e.y===n.y)},Vhe=function(t,e,n,i){var a=kl(t,e),o=kl(n,e);a<i&&(i=a),o<i&&(i=o);var s={x:e.x-i/a*(e.x-t.x),y:e.y-i/a*(e.y-t.y)},u={x:e.x-i/o*(e.x-n.x),y:e.y-i/o*(e.y-n.y)};return[s,u]},PM=function(t,e){var n=[],i=t[0];return n.push("M".concat(i.x," ").concat(i.y)),t.forEach(function(a,o){var s=t[o+1],u=t[o+2];if(s&&u)if(Yhe(a,s,u)){var f=Vhe(a,s,u,e),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("")},SP=function(t,e,n,i,a){var o,s;if(!n||!n.getType())o=Dh(t);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=Dh(t)}else o=n&&n.getBBox();if(!i||!i.getType())s=Dh(e);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=Dh(e)}else s=i&&i.getBBox();var g=rv(o,a),y=rv(s,a),m=im(g,t,e),b=im(y,e,t),x=Bhe([m,b]),E=DM(g,x),w=DM(y,x),_=[];_=_.concat(am(E)).concat(am(w));var M={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[x,E,w].forEach(function(S){_=_.concat(jhe(S,M).filter(function(A){return kh(A,g)&&kh(A,y)}))}),[{x:m.x,y:b.y},{x:b.x,y:m.y}].forEach(function(S){kh(S,g)&&kh(S,y)&&_.push(S)}),_.unshift(m),_.push(b),_=Cb(_);var C=Xhe(_,m,b,o,s,t,e);return C.unshift(t),C.push(e),_P(C)},Hhe=function(t){if(!(t!=null&&t.length))return t;for(var e=t[t.length-1],n={x:e.x,y:e.y},i=[e],a=[e],o=t.length-2;o>=0;o--){var s=t[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=t.indexOf(i[1]);u>-1&&t.splice(u,1);continue}if(a.length>2){var u=t.indexOf(a[1]);u>-1&&t.splice(u,1)}}return t},MP=function(){function r(){this.arr=[],this.map={},this.arr=[],this.map={}}return r.prototype._innerAdd=function(t,e){for(var n=[0,e-1];n[1]-n[0]>1;){var i=Math.floor((n[0]+n[1])/2);if(this.arr[i].value>t.value)n[1]=i;else if(this.arr[i].value<t.value)n[0]=i;else{this.arr.splice(i,0,t),this.map[t.id]=!0;return}}this.arr.splice(n[1],0,t),this.map[t.id]=!0},r.prototype.add=function(t){delete this.map[t.id];var e=this.arr.length;if(!e){this.arr.push(t),this.map[t.id]=!0;return}if(this.arr[e-1].value<t.value){this.arr.push(t),this.map[t.id]=!0;return}this._innerAdd(t,e)},r.prototype.remove=function(t){this.map[t]&&delete this.map[t]},r.prototype._clearAndGetMinId=function(){for(var t,e=this.arr.length-1;e>=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t},r.prototype._findFirstId=function(){for(;this.arr.length;){var t=this.arr.shift();if(this.map[t.id])return t.id}},r.prototype.minId=function(t){return t?this._clearAndGetMinId():this._findFirstId()},r}(),Khe=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},qhe=function(t,e,n,i,a){return _P(SP(t,e,n,i,a.offset))},Zhe={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:Khe,fallbackRoute:qhe},Ya=function(t,e){var n=Math.round(Math.abs(t/e)),i=t<0?-1:1;return n<0?0:i*n},Qhe=function(t,e,n){var i={};return t.forEach(function(a){if(a)for(var o=rv(a.getBBox(),n),s=Ya(o.minX,e);s<=Ya(o.maxX,e);s+=1)for(var u=Ya(o.minY,e);u<=Ya(o.maxY,e);u+=1)i["".concat(s,"|||").concat(u)]=!0}),i},_0=function(t,e){var n=e.x-t.x,i=e.y-t.y;return n||i?Math.atan2(i,n):0},NM=function(t,e){var n=Math.abs(t-e);return n>Math.PI?2*Math.PI-n:n},RM=function(t,e,n){for(var i=1/0,a=0,o=e.length;a<o;a++){var s=n(t,e[a]);s<i&&(i=s)}return i},BM=function(t,e,n,i,a){var o=[];if(!n)return[t];var s=a.directions,u=a.offset,f=n.getBBox(),l=e.x>f.minX&&e.x<f.maxX&&e.y>f.minY&&e.y<f.maxY,c=rv(f,u);for(var h in c)c[h]=Ya(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=_n.getLineIntersect(t,{x:t.x+p.stepX*c.width,y:t.y+p.stepY*c.height},y[0],y[1]);m&&!om(t,m,f)&&(m.id="".concat(m.x,"|||").concat(m.y),o.push(m))}return o}var b=im(c,t,i);return b.id="".concat(b.x,"|||").concat(b.y),[b]},sm=function(t,e,n,i){var a=_0(t,e),o=n[t.id];if(!o){var s=_0(i,t);return NM(s,a)}var u=_0({x:o.x,y:o.y},t);return NM(u,a)},Jhe=function(t,e,n,i,a,o,s){var u=[i],f=i,l=t.id,c=t.x,h=t.y,d={x:c,y:h,id:l};sm(d,o,e,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=e[l];v&&v.id!==l;){var p={x:c,y:h,id:l},g={x:v.x,y:v.y,id:v.id},y=sm(g,p,e,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=e[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},ede=function(t,e,n,i,a){if(isNaN(t.x)||isNaN(e.x))return[];var o=mr(Zhe,a);o.obstacles=o.obstacles||[];var s=o.penalties,u=o.gridSize,f=Qhe(o.obstacles.concat([n,i]),u,o.offset),l={x:Ya(t.x,u),y:Ya(t.y,u)},c={x:Ya(e.x,u),y:Ya(e.y,u)};t.id="".concat(l.x,"|||").concat(l.y),e.id="".concat(c.x,"|||").concat(c.y);var h=BM(l,t,n,c,o),d=BM(c,e,i,l,o);h.forEach(function(k){delete f[k.id]}),d.forEach(function(k){delete f[k.id]});for(var v={},p={},g={},y={},m={},b=new MP,x=0;x<h.length;x++){var E=h[x];v[E.id]=E,y[E.id]=0,m[E.id]=RM(E,d,o.distFunc),b.add({id:E.id,value:m[E.id]})}var w=o.maximumLoops,_,M,C,S,A,T,I=1/0,D={};for(d.forEach(function(k){D["".concat(k.x,"|||").concat(k.y)]=!0}),Object.keys(v).forEach(function(k){var R=v[k].id;m[R]<=I&&(I=m[R],_=v[R])});Object.keys(v).length>0&&w>0;){var N=b.minId((w+1)%30===0);if(N)_=v[N];else break;if(D["".concat(_.x,"|||").concat(_.y)])return Jhe(_,g,l,e,t,c,u);delete v[_.id],b.remove(_.id),p[_.id]=!0;for(var x=0;x<o.directions.length;x++){M=o.directions[x];var P="".concat(Math.round(_.x)+M.stepX,"|||").concat(Math.round(_.y)+M.stepY);if(C={x:_.x+M.stepX,y:_.y+M.stepY,id:P},!p[P]&&(T=sm(_,C,g,l),!(T>o.maxAllowedDirectionChange)&&!f[P])){v[P]||(v[P]=C);var G=s[T];S=o.distFunc(_,C)+(isNaN(G)?u:G),A=y[_.id]+S;var W=y[P];W&&A>=W||(g[P]=_,y[P]=A,m[P]=A+RM(C,d,o.distFunc),b.add({id:P,value:m[P]}))}}w-=1}return o.fallbackRoute(t,e,n,i,o)};UI("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:F({},Je.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t);n.radius===0&&delete n.radius;var i=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return e.shapeMap["edge-shape"]=i,i},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},i=yt({},e,n,t.style);t=this.getPathPoints(t),this.radius=i.radius,this.offset=i.offset;var a=t.startPoint,o=t.endPoint,s=this.getControlPoints(t),u=[a];s&&(u=u.concat(s)),u.push(o);var f=t.sourceNode,l=t.targetNode,c=i.radius,h=this.options.routeCfg,d=yt({},h,t.routeCfg);d.offset=i.offset;var v=this.getPath(u,f,l,c,d,!s);(gt(v)&&v.length<=1||Ne(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=yt({},Je.defaultEdge.style,i,{lineWidth:t.size,path:v});return p},updateShapeStyle:function(t,e){var n=e.getContainer();if(e.isVisible()){var i={stroke:t.color},a=n.shapeMap["edge-shape"]||n.find(function(x){return x.get("className")==="edge-shape"})||e.getKeyShape(),o=t.size;t=this.getPathPoints(t);var s=t.startPoint,u=t.endPoint,f=this.getControlPoints(t),l=[s];f&&(l=l.concat(f)),l.push(u);var c=a.attr(),h=yt({},i,c,t.style),d=t.sourceNode,v=t.targetNode,p=h.radius,g=this.options.routeCfg,y=yt({},g,t.routeCfg);y.offset=h.offset;var m=this.getPath(l,d,v,p,y,!f);(gt(m)&&m.length<=1||Ne(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&&(t.style.endArrow={path:""}),c.startArrow&&h.startArrow===!1&&(t.style.startArrow={path:""});var b=yt(i,a.attr(),{lineWidth:o,path:m},t.style);a&&a.attr(b)}},getPath:function(t,e,n,i,a,o){var s=a.offset,u=a.obstacles,f=a.simple;if(!s||t.length>2||o===!1){if(i)return PM(t,i);var l=[];return me(t,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?SP(t[t.length-1],t[0],n,e,s):ede(t[0],t[t.length-1],e,n,a);if(!c||!c.length)return"M0 0, L0 0";if(i){var h=PM(c,i);return h}c=Hhe(c);var d=_n.pointsToPolygon(c);return d}},"single-edge");var FM=no.cloneEvent,GM=no.isNaN,zM=Math.abs,tde=10,rde=["shift","ctrl","alt","control"];const nde={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(t){var e=this.origin,n=+t.clientX,i=+t.clientY;if(!(GM(n)||GM(i))){var a=n-e.x,o=i-e.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(t){var e=this,n=t.originalEvent.touches,i=n[0],a=n[1];i&&a||(t.preventDefault(),this.mousedown=!0,e.onDragStart(t))},onMouseDown:function(t){this.mousedown=!0},onDragMove:function(t){this.mousedown&&(this.dragstart?this.onDrag(t):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=this,n=t.originalEvent;if(!(n&&t.name!=="touchstart"&&n.button!==0)&&!(t.name!=="touchstart"&&typeof window<"u"&&window.event&&!window.event.buttons&&!window.event.button)&&this.shouldBegin(t,this)&&!e.keydown&&this.allowDrag(t)){if(e.origin={x:t.clientX,y:t.clientY},e.dragging=!1,this.enableOptimize){for(var i=this.graph,a=i.getEdges(),o=0,s=a.length;o<s;o++){var u=a[o].get("group").get("children");u&&u.forEach(function(b){b.set("ori-visibility",b.get("ori-visibility")||b.get("visible")),b.hide()})}for(var f=i.getNodes(),l=0,c=f.length;l<c;l++)for(var h=f[l].getContainer(),d=h.get("children"),v=0,p=d;v<p.length;v++){var g=p[v],y=g.get("isKeyShape");y||(g.set("ori-visibility",g.get("ori-visibility")||g.get("visible")),g.hide())}}if(typeof window<"u"){var m=this;this.handleDOMContextMenu=function(b){return m.onMouseUp(b)},document.body.addEventListener("contextmenu",this.handleDOMContextMenu)}}},onTouchMove:function(t){var e=this,n=t.originalEvent.touches,i=n[0],a=n[1];if(i&&a){this.onMouseUp(t);return}t.preventDefault(),e.onDrag(t)},onDrag:function(t){if(this.mousedown){var e=this.graph;if(!this.keydown&&this.allowDrag(t)&&(t=FM(t),!!this.origin)){if(this.dragging)t.type="drag",e.emit("canvas:drag",t);else{if(zM(this.origin.x-t.clientX)+zM(this.origin.y-t.clientY)<tde)return;this.shouldBegin(t,this)&&(t.type="dragstart",e.emit("canvas:dragstart",t),this.originPosition={x:t.clientX,y:t.clientY},this.dragging=!0)}this.shouldUpdate(t,this)&&this.updateViewport(t)}}},onMouseUp:function(t){var e,n;this.mousedown=!1,this.dragstart=!1;var i=this.graph;if(!this.keydown){var a=i.getZoom(),o=i.get("modeController"),s=(n=(e=o==null?void 0:o.modes[o.mode])===null||e===void 0?void 0:e.filter(function(_){return _.type==="zoom-canvas"}))===null||n===void 0?void 0:n[0],u=s?s.optimizeZoom||.1:0;if(this.enableOptimize){for(var f=i.getEdges(),l=0,c=f.length;l<c;l++){var h=f[l].get("group").get("children");h&&h.forEach(function(_){var M=_.get("ori-visibility");_.set("ori-visibility",void 0),M&&_.show()})}if(a>u)for(var d=i.getNodes(),v=0,p=d.length;v<p;v++)for(var g=d[v].getContainer(),y=g.get("children"),m=0,b=y;m<b.length;m++){var x=b[m],E=x.get("isKeyShape");if(!E){var w=x.get("ori-visibility");x.set("ori-visibility",void 0),w&&x.show()}}}if(!this.dragging){this.origin=null;return}t=FM(t),this.shouldEnd(t,this)&&this.updateViewport(t),t.type="dragend",t.dx=t.clientX-this.originPosition.x,t.dy=t.clientY-this.originPosition.y,i.emit("canvas:dragend",t),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(t){var e=this,n=t.key;n&&(rde.indexOf(n.toLowerCase())>-1?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(t){var e,n,i=t.target,a=i&&i.isCanvas&&i.isCanvas();if(Pl(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(bn(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(e=t.item)===null||e===void 0?void 0:e.getType)===null||n===void 0?void 0:n.call(e);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}},ide={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(t){if(!this.origin||!t||t.destroyed)return!1;var e=t.getType();return e==="combo"},onTouchStart:function(t){if(t.item){var e=this;try{var n=t.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;t.preventDefault()}catch{console.warn("Touch original event not exist!")}this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},this.dragstart=!0,e.onDragStart(t)}},onTouchMove:function(t){var e=this;try{var n=t.originalEvent.touches,i=n[0],a=n[1];if(i&&a){e.onDragEnd(t);return}t.preventDefault()}catch{console.warn("Touch original event not exist!")}e.onDrag(t)},onMouseDown:function(t){this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.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(t){var e,n;if(((n=(e=t.item)===null||e===void 0?void 0:e.getType)===null||n===void 0?void 0:n.call(e))!=="node"){this.onDragEnd();return}this.mousedown&&(this.dragstart?this.onDrag(F(F({},t),this.mousedown)):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,!!this.shouldBegin(F(F({},t),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||e.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()&&(e.hidenEdge[p.getID()]=!0,p.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;if(!(!this.mousedown||!this.origin)&&this.shouldUpdate(t,this))if(this.get("enableDelegate"))this.updateDelegate(t);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var n={};this.targets.map(function(i){e.update(i,t);var a=i.getModel().comboId;a&&(n[a]=e.graph.findById(a))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(t){var e=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){e.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var i=this.graph;if(i.get("enabledStack")&&this.enableStack){var a={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(o){a.before.nodes.push(o)}),this.targets.forEach(function(o){var s=o.getModel(),u=s.x,f=s.y,l=s.id;a.after.nodes.push({x:u,y:f,id:l})}),i.pushStack("update",Vt(a))}i.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(t){var e=t.item;if(this.currentShouldEnd=this.shouldEnd(t,e,this),this.updatePositions(t,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(e))){var n=this.graph;if(this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1),this.targetCombo=e,this.onlyChangeComboSize)n.updateCombos();else{var i=e.getModel();this.targets.map(function(a){var o=a.getModel();o.comboId!==i.id&&n.updateComboTree(a,i.id)}),n.updateCombo(e)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(t){var e=this.graph;this.currentShouldEnd=this.shouldEnd(t,void 0,this),this.updatePositions(t,!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&&e.updateComboTree(n)}))},onDropNode:function(t){if(!(!this.targets||this.targets.length===0)){var e=this,n=t.item,i=e.graph,a=n.getModel().comboId,o=a?i.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(t,o,this),this.updatePositions(t,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(a){var s=i.findById(a);e.comboActiveState&&i.setItemState(s,e.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(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!0)}},onDragLeave:function(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1)}},updatePositions:function(t,e){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:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):e||this.targets.map(function(i){return n.update(i,t)}):this.targets.map(function(i){return n.update(i,t,e)}))},update:function(t,e,n){var i=this.origin,a=t.get("model"),o=t.get("id");this.point[o]||(this.point[o]={x:a.x||0,y:a.y||0});var s=e.x-i.x+this.point[o].x,u=e.y-i.y+this.point[o].y;n&&(s+=i.x-e.x,u+=i.y-e.y);var f={x:s,y:u};this.get("updateEdge")?this.graph.updateItem(t,f,!1):t.updatePosition(f)},debounceUpdate:Nl(function(r){var t=r.targets,e=r.graph,n=r.point,i=r.origin,a=r.evt,o=r.updateEdge,s=r.onlyChangeComboSize,u=r.updateParentCombos;t.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?e.updateItem(f,v,!1):f.updatePosition(v)}),s&&u(e,t)},50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var h=t.x-this.origin.x+this.originPoint.minX,d=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:h,y:d})}else{var n=e.get("group"),i=mr({},xs.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),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:F({width:u,height:f,x:o,y:s},i),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(t){var e=this.targets;e.length===0&&e.push(t.item);for(var n=1/0,i=-1/0,a=1/0,o=-1/0,s=0;s<e.length;s++){var u=e[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(t,e){var n=t||this.graph,i=e||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 Nh=null;const ade={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(t){var e=this;try{var n=t.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;t.preventDefault()}catch{console.warn("Touch original event not exist!")}e.setAllItemStates(t)},clearOnTouchStart:function(t){var e=this;try{var n=t.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;t.preventDefault()}catch{console.warn("Touch original event not exist!")}e.clearActiveState(t)},setAllItemStates:function(t){clearTimeout(this.timer),this.throttleSetAllItemStates(t,this)},clearActiveState:function(t){var e=this,n=this.shouldClearStatusOnSecond;n&&(Nh=null),this.timer=setTimeout(function(){e.throttleClearActiveState(t,e)},50)},throttleSetAllItemStates:ll(function(r,t){var e=r.item,n=t.graph;if(!(!n||n.destroyed)&&(t.item=e,!!t.shouldUpdate(r.item,{event:r,action:"activate"},t))){var i=t.shouldClearStatusOnSecond,a=e.getModel().id;if(Nh===a&&i){t.throttleClearActiveState(r,t),Nh=null;return}for(var o=t.activeState,s=t.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=t.inactiveItems||{},y=t.activeItems||{},m=0;m<h;m++){var b=u[m],x=b.getID(),E=b.hasState("selected");t.resetSelected&&E&&n.setItemState(b,"selected",!1),y[x]&&(n.setItemState(b,o,!1),delete y[x]),s&&!g[x]&&(n.setItemState(b,s,!0),g[x]=b)}for(var m=0;m<d;m++){var w=f[m],_=w.getID(),E=w.hasState("selected");t.resetSelected&&E&&n.setItemState(w,"selected",!1),y[_]&&(n.setItemState(w,o,!1),delete y[_]),s&&!g[_]&&(n.setItemState(w,s,!0),g[_]=w)}for(var m=0;m<v;m++){var M=l[m],C=M.getID();y[C]&&(n.setItemState(M,o,!1),delete y[C]),s&&!g[C]&&(n.setItemState(M,s,!0),g[C]=M)}for(var m=0;m<p;m++){var S=c[m],A=S.getID();y[A]&&(n.setItemState(S,o,!1),delete y[A]),s&&!g[A]&&(n.setItemState(S,s,!0),g[A]=S)}if(e&&!e.destroyed){s&&(n.setItemState(e,s,!1),delete g[e.getID()]),y[e.getID()]||(n.setItemState(e,o,!0),y[e.getID()]=e);for(var T=e.getEdges(),I=T.length,m=0;m<I;m++){var M=T[m],C=M.getID(),D=void 0;M.getSource()===e?D=M.getTarget():D=M.getSource();var N=D.getID();s&&g[N]&&(n.setItemState(D,s,!1),delete g[N]),y[N]||(n.setItemState(D,o,!0),y[N]=D),g[C]&&(n.setItemState(M,s,!1),delete g[C]),y[C]||(n.setItemState(M,o,!0),y[C]=M),M.toFront()}}t.activeItems=y,t.inactiveItems=g,i&&(Nh=e.getModel().id),n.emit("afteractivaterelations",{item:r.item,action:"activate"})}},50,{trailing:!0,leading:!0}),throttleClearActiveState:ll(function(r,t){var e=t.get("graph");if(!(!e||e.destroyed)&&t.shouldUpdate(r.item,{event:r,action:"deactivate"},t)){var n=t.activeState,i=t.inactiveState,a=t.activeItems||{},o=t.inactiveItems||{};Object.values(a).filter(function(s){return!s.destroyed}).forEach(function(s){e.clearItemStates(s,n)}),Object.values(o).filter(function(s){return!s.destroyed}).forEach(function(s){e.clearItemStates(s,i)}),t.activeItems={},t.inactiveItems={},e.emit("afteractivaterelations",{item:r.item||t.get("item"),action:"deactivate"})}},50,{trailing:!0,leading:!0})};var Rh=Math.min,jM=Math.max,UM=Math.abs,$M="shift",ode=["drag","shift","ctrl","alt","control"];const sde={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:$M,includeEdges:!0,includeCombos:!1,selectOnCombo:!1,selectedEdges:[],selectedNodes:[],selectedCombos:[]}},getEvents:function(){return ode.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=$M,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(t){var e=t.item,n=this.brush,i=this.selectOnCombo,a=(e==null?void 0:e.getType())==="combo";a&&!i||!a&&e||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:t.canvasX,y:t.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(t){this.dragging&&(this.trigger!=="drag"&&!this.keydown||this.updateBrush(t))},onMouseUp:function(t){this.graph,!(!this.brush&&!this.dragging)&&(this.trigger!=="drag"&&!this.keydown||(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(t),this.dragging=!1))},clearStates:function(){var t=this,e=t.graph,n=t.selectedState,i=e.findAllByState("node",n),a=e.findAllByState("edge",n),o=e.findAllByState("combo",n);i.forEach(function(s){return e.setItemState(s,n,!1)}),a.forEach(function(s){return e.setItemState(s,n,!1)}),o.forEach(function(s){return e.setItemState(s,n,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),e.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(t,e,n,i,a){var o=t.getBBox();return o.centerX>=e&&o.centerX<=n&&o.centerY>=i&&o.centerY<=a},getSelectedNodes:function(t){var e=this,n=this,i=n.graph,a=n.originPoint,o=n.shouldUpdate,s=n.isBBoxCenterInRect,u=this.selectedState,f={x:t.x,y:t.y},l=i.getPointByCanvas(a.x,a.y),c=Rh(f.x,l.x),h=jM(f.x,l.x),d=Rh(f.y,l.y),v=jM(f.y,l.y),p=[],g=[];i.getNodes().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",e)){p.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}});var y=[];this.includeEdges&&p.forEach(function(b){var x=b.getOutEdges();x.forEach(function(E){if(E.isVisible()){var w=E.getModel(),_=w.source,M=w.target;g.includes(_)&&g.includes(M)&&o(E,"select",e)&&(y.push(E),i.setItemState(E,e.selectedState,!0))}})});var m=[];this.includeCombos&&i.getCombos().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",e)){m.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}}),this.selectedEdges=y,this.selectedNodes=p,this.selectedCombos=m,this.onSelect&&this.onSelect(p,y,m),i.emit("nodeselectchange",{selectedItems:{nodes:p,edges:y,combos:m},select:!0})},createBrush:function(){var t=this,e=t.graph.get("canvas").addShape("rect",{attrs:t.brushStyle,capture:!1,name:"brush-shape"});return this.brush=e,this.delegate=e,e},updateBrush:function(t){var e=this.originPoint;this.brush.attr({width:UM(t.canvasX-e.x),height:UM(t.canvasY-e.y),x:Rh(t.canvasX,e.x),y:Rh(t.canvasY,e.y)})},onKeyDown:function(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),i=e.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 WM="shift",ude=["shift","ctrl","alt","control"];const fde={getDefaultCfg:function(){return{multiple:!0,trigger:WM,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var t=this;return ude.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=WM,console.warn("Behavior click-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),t.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(t){var e=this,n=t.item;if(!(!n||n.destroyed)){var i=n.getType(),a=e.graph,o=e.keydown,s=e.multiple,u=e.shouldUpdate,f=e.shouldBegin;if(f(t,e)){if(!o||!s){var l=a.findAllByState("node",e.selectedState).concat(a.findAllByState("edge",e.selectedState)).concat(a.findAllByState("combo",e.selectedState));me(l,function(p){p!==n&&a.setItemState(p,e.selectedState,!1)})}var c=function(){switch(i){case"node":return e.selectNode;case"edge":return e.selectEdge;case"combo":return e.selectCombo;default:return!1}}();if(!c){var h=a.findAllByState("node",e.selectedState),d=a.findAllByState("edge",e.selectedState),v=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{selectedItems:{nodes:h,edges:d,combos:v},select:!1});return}if(n.hasState(e.selectedState)){u(t,e)&&a.setItemState(n,e.selectedState,!1);var h=a.findAllByState("node",e.selectedState),d=a.findAllByState("edge",e.selectedState),v=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!1})}else{u(t,e)&&a.setItemState(n,e.selectedState,!0);var h=a.findAllByState("node",e.selectedState),d=a.findAllByState("edge",e.selectedState),v=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!0})}}}},onCanvasClick:function(t){var e=this,n=this,i=n.graph,a=n.shouldBegin;if(a(t,this)){var o=i.findAllByState("node",this.selectedState);me(o,function(f){i.setItemState(f,e.selectedState,!1)});var s=i.findAllByState("edge",this.selectedState);me(s,function(f){i.setItemState(f,e.selectedState,!1)});var u=i.findAllByState("combo",this.selectedState);me(u,function(f){i.setItemState(f,e.selectedState,!1)}),i.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(t){var e=this,n=t.key;n&&(n.toLowerCase()===this.trigger.toLowerCase()||n.toLowerCase()==="control"?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){var t=this;t.keydown=!1}};var lde=xi,Bh=.05;const cde={getDefaultCfg:function(){return this.isFireFox=Vk()==="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 t=this.fixSelectedItems;return t.fixState||(t.fixState="selected"),t.fixAll&&(t.fixLineWidth=!0,t.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(t){var e=t.originalEvent.touches,n=e[0],i=e[1];t.preventDefault(),i&&(this.shouldBegin&&!this.shouldBegin(t,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(t){if(this.moveable){t.preventDefault();var e=t.originalEvent.touches,n=e[0],i=e[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(t.clientX,t.clientY);this.graph.zoomTo(s,{x:d.x,y:d.y},l,c),this.graph.emit("wheelzoom",t)}}}},onTouchEnd:function(){this.moveable=!1,this.endPoint=null},onWheel:function(t){var e=this,n=this,i=n.graph,a=n.fixSelectedItems;if(!(this.shouldBegin&&!this.shouldBegin(t,this))&&this.shouldUpdate(t,this)){t.preventDefault();var o=i.get("canvas"),s=o.getPointByClient(t.clientX,t.clientY),u=this.get("sensitivity"),f=i.getZoom(),l=f,c=f;this.isFireFox?t.deltaY>0||t.wheelDelta<0?l=1-Bh*u:l=1/(1-Bh*u):t.wheelDelta<0?l=1-Bh*u:l=1/(1-Bh*u),c=f*l;var h=this.get("minZoom")||i.get("minZoom"),d=this.get("maxZoom")||i.get("maxZoom");c>d?c=d:c<h&&(c=h);var v=this.get("enableOptimize");if(v){var p=this.get("optimizeZoom"),g=this.get("optimized"),y=i.getNodes(),m=i.getEdges(),b=y.length,x=m.length;if(!g){for(var E=0;E<b;E++){var w=y[E];if(!w.destroyed)for(var _=w.get("group").get("children"),M=_.length,C=0;C<M;C++){var S=_[C];!S.destoryed&&!S.get("isKeyShape")&&(S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide())}}for(var A=0;A<x;A++)for(var T=m[A],_=T.get("group").get("children"),M=_.length,C=0;C<M;C++){var S=_[C];S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var I=setTimeout(function(){var tt=i.getZoom(),ie=e.get("optimized");if(ie){e.set("optimized",!1);for(var L=0;L<b;L++){var _e=y[L],Be=_e.get("group").get("children"),ye=Be.length;if(tt<p){var $e=_e.getKeyShape(),We=$e.get("ori-visibility");$e.set("ori-visibility",void 0),We&&$e.show()}else for(var Ke=0;Ke<ye;Ke++){var Qe=Be[Ke],We=Qe.get("ori-visibility");Qe.set("ori-visibility",void 0),!Qe.get("visible")&&We&&We&&Qe.show()}}for(var vt=0;vt<x;vt++){var Dt=m[vt],Be=Dt.get("group").get("children"),ye=Be.length;if(tt<p){var $e=Dt.getKeyShape(),We=$e.get("ori-visibility");$e.set("ori-visibility",void 0),We&&$e.show()}else for(var Ke=0;Ke<ye;Ke++){var Qe=Be[Ke];if(!Qe.get("visible")){var We=Qe.get("ori-visibility");Qe.set("ori-visibility",void 0),We&&Qe.show()}}}}},100);this.set("timeout",I)}if(f<=1){var D=void 0,N=void 0;if(a.fixAll||a.fixLineWidth||a.fixLabel){D=i.findAllByState("node",a.fixState),N=i.findAllByState("edge",a.fixState);for(var P=f/c,G=D.length,W=0;W<G;W++){var w=D[W],k=w.getContainer(),R=w.getModel(),Y=w.getOriginStyle(),J=w.getStateStyle(a.fixState),te=w.get("shapeFactory").getShape(R.type).getStateStyle(a.fixState,w)[a.fixState];if(a.fixAll){if(c<=1){var H=Vt(k.getMatrix());H||(H=[1,0,0,0,1,0,0,0,1]);var pe=w.getModel(),Ae=pe.x,Le=pe.y;H=lde(H,[["t",-Ae,-Le],["s",P,P],["t",Ae,Le]]),k.setMatrix(H)}}else for(var _=k.get("children"),M=_.length,C=0;C<M;C++){var S=_[C],qe=void 0,at=void 0;if(a.fixLabel){var rt=S.get("type");if(rt==="text"){qe=S.attr("fontSize")||12;var xt=J[S.get("name")],Et=te[S.get("name")],ur=xt?xt.fontSize:12,Bt=Et?Et.fontSize:12,Ut=ur||Bt||12;if(c<=1&&S.attr("fontSize",Ut/c),at)break}}if(a.fixLineWidth&&S.get("isKeyShape")){at=S.attr("lineWidth")||0;var dr=J.lineWidth||te.lineWidth||Y.lineWidth||0;if(c<=1&&S.attr("lineWidth",dr/c),qe)break}}}for(var fr=N.length,Gt=0;Gt<fr;Gt++)for(var T=N[Gt],k=T.getContainer(),_=k.get("children"),R=T.getModel(),J=T.getStateStyle(a.fixState),te=T.get("shapeFactory").getShape(R.type).getStateStyle(a.fixState,T)[a.fixState],M=_.length,C=0;C<M;C++){var S=_[C],qe=void 0,at=void 0;if(a.fixLabel||a.fixAll){var rt=S.get("type");if(rt==="text"){qe=S.attr("fontSize")||12;var xt=J[S.get("name")],Et=te[S.get("name")],ur=xt?xt.fontSize:12,Bt=Et?Et.fontSize:12,Ut=ur||Bt||12;if(c<=1&&S.attr("fontSize",Ut/c),at)break}}if((a.fixLineWidth||a.fixAll)&&S.get("isKeyShape")){at=S.attr("lineWidth")||0;var dr=J.lineWidth||te.lineWidth||1;if(c<=1&&S.attr("lineWidth",dr/c),qe)break}}}}var Jt=this.get("animate"),Rr=this.get("animateCfg");i.zoomTo(c,{x:s.x,y:s.y},Jt,Rr),i.emit("wheelzoom",t)}}},CP={onMouseEnter:function(t){var e=t.item;this.currentTarget=e,this.showTooltip(t),this.graph.emit("tooltipchange",{item:t.item,action:"show"})},onMouseMove:function(t){if(!this.shouldUpdate(t,this)){this.hideTooltip();return}!this.currentTarget||t.item!==this.currentTarget||this.updatePosition(t)},onMouseLeave:function(t){this.shouldEnd(t,this)&&(this.hideTooltip(),this.graph.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null)},showTooltip:function(t){var e=this.container;if(!(!t.item||t.item.destroyed)){e||(e=this.createTooltip(this.graph.get("canvas")),this.container=e);var n=this.formatText(t.item.get("model"),t);e.innerHTML=n,Xt(this.container,{visibility:"visible"}),this.updatePosition(t)}},hideTooltip:function(){Xt(this.container,{visibility:"hidden"})},updatePosition:function(t){var e=this.get("shouldBegin"),n=this,i=n.width,a=n.height,o=n.container,s=n.graph;if(!e(t,this)){Xt(o,{visibility:"hidden"});return}var u=s.getPointByClient(t.clientX,t.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");Xt(this.container,{left:d,top:v,visibility:"visible"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var n=wr('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return e.parentNode.appendChild(n),Xt(n,{position:"absolute",visibility:"visible"}),this.width=t.get("width"),this.height=t.get("height"),this.container=n,this.graph.get("tooltips").push(n),n}},hde=F({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(e){return e.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},CP),dde=F({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(e){return"source: ".concat(e.source," target: ").concat(e.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},CP);var XM="click",vde=["click","dblclick"];const pde={getDefaultCfg:function(){return{trigger:XM,onChange:function(){}}},getEvents:function(){var t,e;return vde.includes(this.trigger)?e=this.trigger:(e=XM,console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),t={},t["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){e.toggle(t),clearTimeout(e.timer),e.timer=0},200)}else this.toggle(t)},toggle:function(t){var e=t.item;if(e){var n=this.graph.findDataById(e.get("id"));if(n){var i=n.children;if(!(!i||i.length===0)){var a=!n.collapsed;this.shouldBegin(t,a,this)&&(n.collapsed=a,e.getModel().collapsed=a,this.graph.emit("itemcollapsed",{item:t.item,collapsed:a}),this.shouldUpdate(t,a,this)&&(this.onChange(e,a,this),this.graph.layout()))}}}}};var gde=no.calculationItemsBBox,yde=function r(t,e){if(e(t)!==!1&&t){var n=t.get("combos");if(n.length===0)return!1;me(n,function(i){r(i,e)})}};const mde={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(t){var e=t.item;if(!e||e.destroyed||!this.shouldUpdate(t,this))return!1;var n=e.getType();return n==="combo"},onMouseDown:function(t){this.origin={x:t.x,y:t.y}},onDragStart:function(t){var e=this,n=this.graph,i=t.item;if(this.currentShouldEnd=!0,!!this.validationCombo(t)){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,e.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],yde(i,function(f){if(f.destroyed)return!1;var l=f.getModel();return e.currentItemChildCombos.push(l.id),!0})}},onDrag:function(t){var e=this;if(this.origin&&this.validationCombo(t))if(this.enableDelegate)this.updateDelegate(t);else{if(this.activeState){var n=this.graph,i=t.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&&!e.currentItemChildCombos.includes(d.id)});c.map(function(h){var d=h.getBBox(),v=d.centerX,p=d.centerY,g=d.width,y=u-v,m=f-p,b=2*Math.sqrt(y*y+m*m);l+g-b>.8*l?n.setItemState(h,e.activeState,!0):n.setItemState(h,e.activeState,!1)})}me(this.targets,function(h){e.updateCombo(h,t)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(t,e){var n=this;(this.enableDelegate||e)&&me(this.targets,function(i){n.updateCombo(i,t,e)})},onDrop:function(t){var e=this,n=t.item;if(this.currentShouldEnd=this.shouldEnd(t,n,this),this.updatePositions(t,!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?(e.activeState&&i.setItemState(n,e.activeState,!1),e.onlyChangeComboSize?i.updateCombo(o):i.updateComboTree(o,a.id,!1)):i.updateCombo(n)}),this.end(n,t),this.endComparison=!0}},onNodeDrop:function(t){var e=this;if(!(!this.targets||this.targets.length===0)){var n=this.graph,i=t.item,a=i.getModel().comboId,o=a?n.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(t,o,this),this.updatePositions(t,!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){e.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(e.onlyChangeComboSize)n.updateCombo(f);else{var l=f.getModel();l.comboId&&n.updateComboTree(f,void 0,!1)}});this.endComparison=!0,this.end(s,t)}}},onDragEnter:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!0)}},onDragLeave:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!1)}},onDragEnd:function(t){if(!(!this.targets||this.targets.length===0)){var e=t.item;this.currentShouldEnd&&this.updatePositions(t);var n=this.getParentCombo(e.getModel().parentId),i=this.graph;n&&this.activeState&&i.setItemState(n,this.activeState,!1),this.end(void 0,t)}},end:function(t,e){var n=this;if(this.origin){var i=this.graph;if(this.delegateShape){var a=i.get("delegateGroup");a.clear(),this.delegateShape=null}if(t&&this.activeState&&i.setItemState(t,this.activeState,!1),!t){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(t,e,n){var i=this;if(n===void 0&&(n={}),e(t,n)!==!1&&t){var a=t.get("combos");me(a,function(s){i.traverse(s,e,n)});var o=t.get("nodes");me(o,function(s){i.traverse(s,e,n)})}},updateCombo:function(t,e,n){this.updateSingleItem(t,e,n);var i={};this.traverse(t,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(t,e,n){var i=this.origin,a=this.graph,o=t.getModel(),s=t.get("id");this.point[s]||(this.point[s]={x:o.x,y:o.y});var u=e.x-i.x+this.point[s].x,f=e.y-i.y+this.point[s].y;n&&(u+=i.x-e.x,f+=i.y-e.y),a.updateItem(t,{x:u,y:f},!1)},getParentCombo:function(t){var e=this.graph;if(t){var n=e.findById(t);if(n)return n}},updateDelegate:function(t){var e=this.graph;if(this.delegateShape){var h=t.x-this.origin.x+this.originPoint.minX,d=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:h,y:d})}else{var n=e.get("delegateGroup"),i=null;this.targets.length>1?i=gde(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=F(F({},xs.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:F({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 t=this,e=t.graph,n=t.targets,i={};n==null||n.forEach(function(a){var o=a.getModel().parentId;o&&(i[o]=e.findById(o))}),Object.values(i).forEach(function(a){a&&e.updateCombo(a)})}};var YM="dblclick",bde=["click","dblclick"];const xde={getDefaultCfg:function(){return{trigger:YM,relayout:!0}},getEvents:function(){var t,e;return bde.includes(this.trigger)?e=this.trigger:(e=YM,console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),t={},t["combo:".concat(e)]="onComboClick",t},onComboClick:function(t){var e=t.item,n=this,i=n.graph,a=n.relayout;if(!(!e||e.destroyed||e.getType()!=="combo")){var o=e.getModel(),s=o.id;s&&(i.collapseExpandCombo(s),a&&i.get("layout")?i.layout():i.refreshPositions())}}};var Ede=no.isPolygonsIntersect,wde=no.pathToPoints,VM="shift",_de=["drag","shift","ctrl","alt","control"],Sde=function(t,e){var n,i=t.getKeyShape();if(t.get("type")==="path")n=wde(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 Ede(e,n)};const Mde={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:VM,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return _de.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=VM,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(t){var e=this.lasso,n=t.item;n||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),e||(e=this.createLasso()),this.dragging=!0,this.originPoint={x:t.x,y:t.y},this.points.push(this.originPoint),e.show())},onDragMove:function(t){this.dragging&&(this.trigger!=="drag"&&!this.keydown||(this.points.push({x:t.x,y:t.y}),this.updateLasso(t)))},onDragEnd:function(t){!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 t=this.points,e=[];return t.length&&(t.forEach(function(n,i){i===0?e.push(["M",n.x,n.y]):e.push(["L",n.x,n.y])}),e.push(["L",t[0].x,t[0].y])),e},clearStates:function(t){t===void 0&&(t="canvas:click");var e=this,n=e.graph,i=e.selectedState,a=e.shouldDeselect,o=n.findAllByState("node",i),s=n.findAllByState("edge",i);(!a||a({action:t,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 t=this,e=this,n=e.graph,i=e.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()&&Sde(l,a)&&i(l,"select",t)){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",t)&&(f.push(h),n.setItemState(h,t.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 t=this,e=t.graph.get("delegateGroup").addShape("path",{attrs:F({path:[]},t.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=e,this.delegate=e,this.points=[],e},updateLasso:function(t){var e=this;this.lasso.attr({path:e.getLassoPath()})},onKeyDown:function(t){var e=t.key;e&&(e.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 HM="click",Cde=["click","drag"],KM=void 0,Ade=["shift","ctrl","control","alt","meta",void 0];const Tde={getDefaultCfg:function(){return{trigger:HM,key:KM,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t=this;Cde.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=HM,console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),t.key&&Ade.indexOf(t.key.toLowerCase())===-1&&(t.trigger=KM,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined"));var e;return t.trigger==="drag"?e={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:t.trigger==="click"&&(e={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),t.key&&(e.keydown="onKeyDown",e.keyup="onKeyUp"),e},onDragEnd:function(t){var e=this;if(!(e.key&&!e.keydown)){var n=t.item;(!n||n.getID()===e.source||n.getType()!=="node")&&e.cancelCreating({item:e.edge,x:t.x,y:t.y})}},onClick:function(t){var e=this;if(!(e.key&&!e.keydown)){var n=t.item,i=e.graph,a=n.getModel(),o=e.getEdgeConfig;if(e.addingEdge&&e.edge){if(!e.shouldEnd(t,e))return;var s=void 0;o&&Cr(o)?s=o({source:e.source,target:a.id},e):s=e.edgeConfig;var u=F({target:a.id},s);if(e.source===a.id&&(u.type="loop"),i.emit("beforecreateedge",{}),i.updateItem(e.edge,u,!1),i.get("enabledStack")){var f=F(F({},e.edge.getModel()),{itemType:"edge"}),l={};l.edges=[f],i.pushStack("add",{before:{},after:l})}i.emit("aftercreateedge",{edge:e.edge}),e.edge.getKeyShape().set("capture",!0),e.edge=null,e.addingEdge=!1}else{if(!e.shouldBegin(t,e))return;var s=void 0;o&&Cr(o)?s=o({source:a.id,target:a.id},e):s=e.edgeConfig,e.edge=i.addItem("edge",F({source:a.id,target:a.id},s),!1),e.source=a.id,e.addingEdge=!0,e.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){var e=this;if(!(e.key&&!e.keydown)){e.edge&&e.edge.destroyed&&e.cancelCreating({item:e.edge});var n={x:t.x,y:t.y};if(!e.graph.findById(e.source)){e.addingEdge=!1;return}e.addingEdge&&e.edge&&e.graph.updateItem(e.edge,{target:n},!1)}},cancelCreating:function(t){var e,n,i=this;if(!(i.key&&!i.keydown)){var a=i.graph,o=t.item;if(i.addingEdge&&(i.edge===o||!((n=(e=t.target)===null||e===void 0?void 0:e.isCanvas)===null||n===void 0)&&n.call(e))){i.edge&&!i.edge.destroyed&&a.removeItem(i.edge,!1),i.edge=null,i.addingEdge=!1;return}}},onKeyDown:function(t){var e=this,n=t.key;n&&(n.toLowerCase()===e.key.toLowerCase()?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){var t=this;t.addingEdge&&t.edge&&(t.graph.removeItem(t.edge,!1),t.addingEdge=!1,t.edge=null),this.keydown=!1}};var qM="ctrl",Ide=["shift","ctrl","alt","control"],Ode="1";const Lde={getDefaultCfg:function(){return{trigger:qM,combinedKey:Ode,functionName:"fitView",functionParams:[]}},getEvents:function(){return Ide.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=qM,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(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),i=e.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 Dde=["shift","ctrl","alt","control","meta"];const kde={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||Dde.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this;if(this.allowDrag(t)){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(R){return t["".concat(R,"Key")]});if(a){var o=n.get("canvas"),s=o.getPointByClient(t.clientX,t.clientY),u=n.getZoom();t.wheelDelta>0?u=u+u*.05:u=u-u*.05,n.zoomTo(u,{x:s.x,y:s.y})}else{var f=t.deltaX||t.movementX,l=t.deltaY||t.movementY;!l&&navigator.userAgent.indexOf("Firefox")>-1&&(l=-t.wheelDelta*125/3);var c=this.graph.get("width"),h=this.graph.get("height"),d=this.graph.get("canvas").getCanvasBBox(),v=this.scalableRange,p=this.scalableRange;v<1&&v>-1&&(v=c*v,p=h*p);var g=d.minX,y=d.maxX,m=d.minY,b=d.maxY;f>0?y<-v?f=0:y-f<-v&&(f=y+v):f<0&&(g>c+v?f=0:g-f>c+v&&(f=g-(c+v))),l>0?b<-p?l=0:b-l<-p&&(l=b+p):l<0&&(m>h+p?l=0:m-l>h+p&&(l=m-(h+p))),this.get("direction")==="x"?l=0:this.get("direction")==="y"&&(f=0),n.translate(-f,-l)}t.preventDefault();var x=this.get("enableOptimize");if(x){var E=this.get("optimizeZoom"),w=this.get("optimized"),_=n.getNodes(),M=n.getEdges(),C=_.length,S=M.length;if(!w){for(var A=0;A<C;A++){var T=_[A];if(!T.destroyed)for(var I=T.get("group").get("children"),D=I.length,N=0;N<D;N++){var P=I[N];!P.destoryed&&!P.get("isKeyShape")&&(P.set("ori-visibility",P.get("ori-visibility")||P.get("visible")),P.hide())}}for(var G=0;G<S;G++)for(var W=M[G],I=W.get("group").get("children"),D=I.length,N=0;N<D;N++){var P=I[N];P.set("ori-visibility",P.get("ori-visibility")||P.get("visible")),P.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var k=setTimeout(function(){var R=n.getZoom(),Y=e.get("optimized");if(Y){e.set("optimized",!1);for(var J=0;J<C;J++){var te=_[J],H=te.get("group").get("children"),pe=H.length;if(R<E){var Ae=te.getKeyShape(),Le=Ae.get("ori-visibility");Le&&Ae.show()}else for(var qe=0;qe<pe;qe++){var at=H[qe],Le=at.get("ori-visibility");!at.get("visible")&&Le&&Le&&at.show()}}for(var rt=0;rt<S;rt++){var xt=M[rt],H=xt.get("group").get("children"),pe=H.length;if(R<E){var Ae=xt.getKeyShape(),Le=Ae.get("ori-visibility");Le&&Ae.show()}else for(var qe=0;qe<pe;qe++){var at=H[qe];if(!at.get("visible")){var Le=at.get("ori-visibility");Le&&at.show()}}}}},100);this.set("timeout",k)}}},allowDrag:function(t){var e,n,i=t.target,a=i&&i.isCanvas&&i.isCanvas();if(Pl(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(bn(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(e=t.item)===null||e===void 0?void 0:e.getType)===null||n===void 0?void 0:n.call(e);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}};var Pde={"drag-canvas":nde,"zoom-canvas":cde,"drag-node":ide,"activate-relations":ade,"brush-select":sde,"click-select":fde,"lasso-select":Mde,tooltip:hde,"edge-tooltip":dde,"collapse-expand":pde,"drag-combo":mde,"collapse-expand-combo":xde,"create-edge":Tde,"shortcuts-call":Lde,"scroll-canvas":kde};me(Pde,function(r,t){$I(t,r)});var Nde=F(F({},nz),sW),Rde=qn.Fisheye,Bde=qn.TimeBar,Fde=qn.ImageMinimap,Gde=qn.EdgeFilterLens,zde=qn.SnapLine,jde=qn.Annotation;const np={version:xs.version,Graph:Kk,TreeGraph:Hfe,Util:no,Layout:Ht.Layouts,TreeLayout:Nfe,registerLayout:Rfe,Global:xs,registerBehavior:$I,registerCombo:$U,registerEdge:UI,registerNode:Za,Minimap:qn.Minimap,Grid:qn.Grid,Bundling:qn.Bundling,Menu:qn.Menu,ToolBar:qn.ToolBar,Tooltip:qn.Tooltip,Legend:qn.Legend,TimeBar:Bde,SnapLine:zde,Fisheye:Rde,ImageMinimap:Fde,EdgeFilterLens:Gde,Annotation:jde,Algorithm:Nde,Arrow:BI,Marker:FI,Shape:br};np.version="4.8.23";np.registerNode("file-node",{draw(r,t){const e=t.addShape("rect",{name:"rect-shape",attrs:{x:0,y:0,fill:"#fff",stroke:null}});return r.children.length==0||t.addShape("marker",{name:"marker-shape",attrs:{symbol:"triangle-down",x:0,y:0,r:4,fill:"#767c82"}}),t.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")}}),e}});np.registerEdge("step-line",{getControlPoints(r){const t=r.startPoint,e=r.endPoint;return[t,{x:t==null?void 0:t.x,y:e==null?void 0:e.y},e]}},"polyline");const Yde=t3({__name:"TrackGraph",props:{track:{}},setup(r){const t=r,e=r3(()=>{var c;const o=t.track.nodes,s=(c=t.track.nodes[t.track.selector.trackIndex])==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:mE(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?mE(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=n3();let i;i3(()=>{if(!n.value)return;i==null||i.destroy();const o=n.value.scrollWidth,s=n.value.scrollHeight||o;i=new np.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=t.track.nodes.find(b=>b.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({...e.value[0]}),i.render();const u=Array.from(t.track.nodes).reverse(),f=t.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,b=d.parent;for(;b;){if(b===c)return m;b=b.parent,m++}return m},"<":()=>d.children.indexOf(c),"<<":()=>{let m=0;const b=Array.from(d.children).reverse();for(;b.length>0;){const x=b.pop();if(x===c)return m;b.push(...Array.from(x.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)}),yE(()=>{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),yE(()=>{window.removeEventListener("resize",a)}),(o,s)=>(a3(),o3("div",{ref_key:"container",ref:n},null,512))}});export{Yde as default};
670
- //# sourceMappingURL=TrackGraph-LNwgG7Zu.js.map