@gkd-kit/inspect 0.0.1749439290229 → 0.0.1750946427915

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 (82) hide show
  1. package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-PAYp10Bk.js +17 -0
  2. package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-PAYp10Bk.js.map +1 -0
  3. package/dist/assets/DevicePage-DsvVoBQM.js +49 -0
  4. package/dist/assets/DevicePage-DsvVoBQM.js.map +1 -0
  5. package/dist/assets/HomePage-D1aYSq5n.js +112 -0
  6. package/dist/assets/HomePage-D1aYSq5n.js.map +1 -0
  7. package/dist/assets/ImportPage-BpwSSxFv.js +2 -0
  8. package/dist/assets/ImportPage-BpwSSxFv.js.map +1 -0
  9. package/dist/assets/{Input-DgyUdul6.js → Input-DakhkhRu.js} +36 -36
  10. package/dist/assets/Input-DakhkhRu.js.map +1 -0
  11. package/dist/assets/SelectorPage-B8sK0rHd.js +2 -0
  12. package/dist/assets/SelectorPage-B8sK0rHd.js.map +1 -0
  13. package/dist/assets/SnapshotPage-BxGCD3gs.js +272 -0
  14. package/dist/assets/SnapshotPage-BxGCD3gs.js.map +1 -0
  15. package/dist/assets/SnapshotPage-DYZIR4dQ.css +1 -0
  16. package/dist/assets/SvgPage-DtOA2z5b.js +2 -0
  17. package/dist/assets/SvgPage-DtOA2z5b.js.map +1 -0
  18. package/dist/assets/TrackGraph-fb_DI1El.js +134 -0
  19. package/dist/assets/TrackGraph-fb_DI1El.js.map +1 -0
  20. package/dist/assets/_404Page-CtPfHH3v.js +2 -0
  21. package/dist/assets/_404Page-CtPfHH3v.js.map +1 -0
  22. package/dist/assets/chunk-BxBCNnrz.js +3 -0
  23. package/dist/assets/chunk-BxBCNnrz.js.map +1 -0
  24. package/dist/assets/{dayjs.min-CMwzZYWK.js → dayjs.min-lRbA81xW.js} +10 -14
  25. package/dist/assets/dayjs.min-lRbA81xW.js.map +1 -0
  26. package/dist/assets/{error-DLcDz2op.js → error-aAUoJqWJ.js} +13 -13
  27. package/dist/assets/{error-DLcDz2op.js.map → error-aAUoJqWJ.js.map} +1 -1
  28. package/dist/assets/import-FrDi0X_0.js +2 -0
  29. package/dist/assets/import-FrDi0X_0.js.map +1 -0
  30. package/dist/assets/{index-CHaIZrD6.css → index-C98pF2u5.css} +1 -1
  31. package/dist/assets/index-COYXkapr.js +977 -0
  32. package/dist/assets/index-COYXkapr.js.map +1 -0
  33. package/dist/assets/index-CVBUu2Si.js +10 -0
  34. package/dist/assets/{index-nrmjhBDW.js.map → index-CVBUu2Si.js.map} +1 -1
  35. package/dist/assets/{jszip.min-Dn-oymRr.js → jszip.min-Cy5MVem1.js} +3 -3
  36. package/dist/assets/{jszip.min-Dn-oymRr.js.map → jszip.min-Cy5MVem1.js.map} +1 -1
  37. package/dist/assets/node-BAV4BU5G.js +126 -0
  38. package/dist/assets/{node-BU-u7VcN.js.map → node-BAV4BU5G.js.map} +1 -1
  39. package/dist/assets/polyfills-DHsnwdd7.js +2 -0
  40. package/dist/assets/polyfills-DHsnwdd7.js.map +1 -0
  41. package/dist/assets/snapshot-DQoBFjtA.js +3 -0
  42. package/dist/assets/{snapshot-LXrnvSmm.js.map → snapshot-DQoBFjtA.js.map} +1 -1
  43. package/dist/assets/{table-JTn0xZC1.js → table-qWtkkPlj.js} +18 -17
  44. package/dist/assets/table-qWtkkPlj.js.map +1 -0
  45. package/dist/assets/worker-DFsORLo-.js +10 -0
  46. package/dist/assets/worker-DFsORLo-.js.map +1 -0
  47. package/dist/index.html +4 -2
  48. package/package.json +37 -36
  49. package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-Ddm4FDEW.js +0 -17
  50. package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-Ddm4FDEW.js.map +0 -1
  51. package/dist/assets/DevicePage-8odSV3Hq.js +0 -49
  52. package/dist/assets/DevicePage-8odSV3Hq.js.map +0 -1
  53. package/dist/assets/HomePage-PzBg6JK7.js +0 -112
  54. package/dist/assets/HomePage-PzBg6JK7.js.map +0 -1
  55. package/dist/assets/ImportPage-BjIx-_N1.js +0 -2
  56. package/dist/assets/ImportPage-BjIx-_N1.js.map +0 -1
  57. package/dist/assets/Input-DgyUdul6.js.map +0 -1
  58. package/dist/assets/SelectorPage-Dq0IIsjv.js +0 -2
  59. package/dist/assets/SelectorPage-Dq0IIsjv.js.map +0 -1
  60. package/dist/assets/SnapshotPage-BKYM296L.js +0 -273
  61. package/dist/assets/SnapshotPage-BKYM296L.js.map +0 -1
  62. package/dist/assets/SnapshotPage-DHogz4lw.css +0 -1
  63. package/dist/assets/SvgPage-Ub-pRGhU.js +0 -2
  64. package/dist/assets/SvgPage-Ub-pRGhU.js.map +0 -1
  65. package/dist/assets/TrackGraph-lKQE5cUJ.js +0 -134
  66. package/dist/assets/TrackGraph-lKQE5cUJ.js.map +0 -1
  67. package/dist/assets/_404Page-DRLShDBE.js +0 -2
  68. package/dist/assets/_404Page-DRLShDBE.js.map +0 -1
  69. package/dist/assets/chunk-CPNWa47E.js +0 -3
  70. package/dist/assets/chunk-CPNWa47E.js.map +0 -1
  71. package/dist/assets/dayjs.min-CMwzZYWK.js.map +0 -1
  72. package/dist/assets/import-Ck1vFpon.js +0 -2
  73. package/dist/assets/import-Ck1vFpon.js.map +0 -1
  74. package/dist/assets/index-DJ3BflFD.js +0 -978
  75. package/dist/assets/index-DJ3BflFD.js.map +0 -1
  76. package/dist/assets/index-nrmjhBDW.js +0 -10
  77. package/dist/assets/node-BU-u7VcN.js +0 -127
  78. package/dist/assets/snapshot-LXrnvSmm.js +0 -3
  79. package/dist/assets/table-JTn0xZC1.js.map +0 -1
  80. package/dist/assets/worker-lNTWuAmw.js +0 -10
  81. package/dist/assets/worker-lNTWuAmw.js.map +0 -1
  82. package/dist/test.xml +0 -26
@@ -1,134 +0,0 @@
1
- var VC=Object.defineProperty;var cb=r=>{throw TypeError(r)};var UC=(r,t,e)=>t in r?VC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var he=(r,t,e)=>UC(r,typeof t!="symbol"?t+"":t,e),qh=(r,t,e)=>t.has(r)||cb("Cannot "+e);var kr=(r,t,e)=>(qh(r,t,"read from private field"),e?e.call(r):t.get(r)),$h=(r,t,e)=>t.has(r)?cb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),yl=(r,t,e,n)=>(qh(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),Gh=(r,t,e)=>(qh(r,t,"access private method"),e);import{S as Wh,y as EO,z as YC,A as HC,C as XC,D as KC,E as ZC}from"./node-BU-u7VcN.js";import{bI as Go,cy as SO,b3 as ml,cx as jm,h as JC,o as QC,q as Us,aA as hb,A as tR,aF as eR,I as db,K as nR,L as rR}from"./index-DJ3BflFD.js";import{t as iR}from"./index-nrmjhBDW.js";function aR(){}function sR(r,t,e,n){for(var i=r.length,a=e+-1;++a<i;)if(t(r[a],a,r))return a;return-1}function oR(r){return r!==r}function lR(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1}function uR(r,t,e){return t===t?lR(r,t,e):sR(r,oR,e)}function cR(r,t){var e=r==null?0:r.length;return!!e&&uR(r,t,0)>-1}var hR=1/0,dR=Wh&&1/EO(new Wh([,-0]))[1]==hR?function(r){return new Wh(r)}:aR,fR=200;function gR(r,t,e){var n=-1,i=cR,a=r.length,s=!0,o=[],l=o;if(a>=fR){var u=t?null:dR(r);if(u)return EO(u);s=!1,i=HC,l=new YC}else l=t?[]:o;t:for(;++n<a;){var c=r[n],h=t?t(c):c;if(c=c!==0?c:0,s&&h===h){for(var d=l.length;d--;)if(l[d]===h)continue t;t&&l.push(h),o.push(c)}else i(l,h,e)||(l!==o&&l.push(h),o.push(c))}return o}function vR(r,t){return r&&r.length?gR(r,XC(t)):[]}function Qi(r){"@babel/helpers - typeof";return Qi=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},Qi(r)}function pR(r,t){if(Qi(r)!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t);if(Qi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function _O(r){var t=pR(r,"string");return Qi(t)=="symbol"?t:t+""}function _t(r,t,e){return(t=_O(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function fb(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 $t(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?fb(Object(e),!0).forEach(function(n){_t(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):fb(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function ht(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function gb(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,_O(n.key),n)}}function dt(r,t,e){return t&&gb(r.prototype,t),e&&gb(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Ay(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function yR(r){if(Array.isArray(r))return Ay(r)}function mR(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function qm(r,t){if(r){if(typeof r=="string")return Ay(r,t);var e={}.toString.call(r).slice(8,-1);return e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set"?Array.from(r):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ay(r,t):void 0}}function bR(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pe(r){return yR(r)||mR(r)||qm(r)||bR()}function Es(r){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Es(r)}function MO(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(MO=function(){return!!r})()}function wR(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function xR(r,t){if(t&&(Qi(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wR(r)}function Gt(r,t,e){return t=Es(t),xR(r,MO()?Reflect.construct(t,e||[],Es(r).constructor):t.apply(r,e))}function Py(r,t){return Py=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Py(r,t)}function Wt(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&&Py(r,t)}function ER(r){if(Array.isArray(r))return r}function SR(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var n,i,a,s,o=[],l=!0,u=!1;try{if(a=(e=e.call(r)).next,t===0){if(Object(e)!==e)return;l=!1}else for(;!(l=(n=a.call(e)).done)&&(o.push(n.value),o.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&e.return!=null&&(s=e.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function _R(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jt(r,t){return ER(r)||SR(r,t)||qm(r,t)||_R()}var Vh={exports:{}},vb;function MR(){return vb||(vb=1,function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function a(l,u,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new i(c,h||l,d),v=e?e+u:u;return l._events[v]?l._events[v].fn?l._events[v]=[l._events[v],f]:l._events[v].push(f):(l._events[v]=f,l._eventsCount++),l}function s(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,f=h.length,v=new Array(f);d<f;d++)v[d]=h[d].fn;return v},o.prototype.listenerCount=function(u){var c=e?e+u:u,h=this._events[c];return h?h.fn?1:h.length:0},o.prototype.emit=function(u,c,h,d,f,v){var p=e?e+u:u;if(!this._events[p])return!1;var g=this._events[p],y=arguments.length,m,w;if(g.fn){switch(g.once&&this.removeListener(u,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,h),!0;case 4:return g.fn.call(g.context,c,h,d),!0;case 5:return g.fn.call(g.context,c,h,d,f),!0;case 6:return g.fn.call(g.context,c,h,d,f,v),!0}for(w=1,m=new Array(y-1);w<y;w++)m[w-1]=arguments[w];g.fn.apply(g.context,m)}else{var E=g.length,_;for(w=0;w<E;w++)switch(g[w].once&&this.removeListener(u,g[w].fn,void 0,!0),y){case 1:g[w].fn.call(g[w].context);break;case 2:g[w].fn.call(g[w].context,c);break;case 3:g[w].fn.call(g[w].context,c,h);break;case 4:g[w].fn.call(g[w].context,c,h,d);break;default:if(!m)for(_=1,m=new Array(y-1);_<y;_++)m[_-1]=arguments[_];g[w].fn.apply(g[w].context,m)}}return!0},o.prototype.on=function(u,c,h){return a(this,u,c,h,!1)},o.prototype.once=function(u,c,h){return a(this,u,c,h,!0)},o.prototype.removeListener=function(u,c,h,d){var f=e?e+u:u;if(!this._events[f])return this;if(!c)return s(this,f),this;var v=this._events[f];if(v.fn)v.fn===c&&(!d||v.once)&&(!h||v.context===h)&&s(this,f);else{for(var p=0,g=[],y=v.length;p<y;p++)(v[p].fn!==c||d&&!v[p].once||h&&v[p].context!==h)&&g.push(v[p]);g.length?this._events[f]=g.length===1?g[0]:g:s(this,f)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=e?e+u:u,this._events[c]&&s(this,c)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,r.exports=o}(Vh)),Vh.exports}var kR=MR();const kO=Go(kR);var _e=1e-6,Ze=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});function OO(){var r=new Ze(9);return Ze!=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 OR(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 TR(r,t,e,n,i,a,s,o,l){var u=new Ze(9);return u[0]=r,u[1]=t,u[2]=e,u[3]=n,u[4]=i,u[5]=a,u[6]=s,u[7]=o,u[8]=l,u}function fe(){var r=new Ze(16);return Ze!=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 TO(r){var t=new Ze(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 Ss(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 AO(r,t,e,n,i,a,s,o,l,u,c,h,d,f,v,p){var g=new Ze(16);return g[0]=r,g[1]=t,g[2]=e,g[3]=n,g[4]=i,g[5]=a,g[6]=s,g[7]=o,g[8]=l,g[9]=u,g[10]=c,g[11]=h,g[12]=d,g[13]=f,g[14]=v,g[15]=p,g}function Ny(r,t,e,n,i,a,s,o,l,u,c,h,d,f,v,p,g){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=l,r[8]=u,r[9]=c,r[10]=h,r[11]=d,r[12]=f,r[13]=v,r[14]=p,r[15]=g,r}function ta(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 PO(r,t){if(r===t){var e=t[1],n=t[2],i=t[3],a=t[6],s=t[7],o=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]=s,r[14]=o}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 Zr(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],v=t[12],p=t[13],g=t[14],y=t[15],m=e*o-n*s,w=e*l-i*s,E=e*u-a*s,_=n*l-i*o,k=n*u-a*o,T=i*u-a*l,O=c*p-h*v,P=c*g-d*v,N=c*y-f*v,C=h*g-d*p,L=h*y-f*p,B=d*y-f*g,G=m*B-w*L+E*C+_*N-k*P+T*O;return G?(G=1/G,r[0]=(o*B-l*L+u*C)*G,r[1]=(i*L-n*B-a*C)*G,r[2]=(p*T-g*k+y*_)*G,r[3]=(d*k-h*T-f*_)*G,r[4]=(l*N-s*B-u*P)*G,r[5]=(e*B-i*N+a*P)*G,r[6]=(g*E-v*T-y*w)*G,r[7]=(c*T-d*E+f*w)*G,r[8]=(s*L-o*N+u*O)*G,r[9]=(n*N-e*L-a*O)*G,r[10]=(v*k-p*E+y*m)*G,r[11]=(h*E-c*k-f*m)*G,r[12]=(o*P-s*C-l*O)*G,r[13]=(e*C-n*P+i*O)*G,r[14]=(p*w-v*_-g*m)*G,r[15]=(c*_-h*w+d*m)*G,r):null}function AR(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],v=t[12],p=t[13],g=t[14],y=t[15];return r[0]=o*(d*y-f*g)-h*(l*y-u*g)+p*(l*f-u*d),r[1]=-(n*(d*y-f*g)-h*(i*y-a*g)+p*(i*f-a*d)),r[2]=n*(l*y-u*g)-o*(i*y-a*g)+p*(i*u-a*l),r[3]=-(n*(l*f-u*d)-o*(i*f-a*d)+h*(i*u-a*l)),r[4]=-(s*(d*y-f*g)-c*(l*y-u*g)+v*(l*f-u*d)),r[5]=e*(d*y-f*g)-c*(i*y-a*g)+v*(i*f-a*d),r[6]=-(e*(l*y-u*g)-s*(i*y-a*g)+v*(i*u-a*l)),r[7]=e*(l*f-u*d)-s*(i*f-a*d)+c*(i*u-a*l),r[8]=s*(h*y-f*p)-c*(o*y-u*p)+v*(o*f-u*h),r[9]=-(e*(h*y-f*p)-c*(n*y-a*p)+v*(n*f-a*h)),r[10]=e*(o*y-u*p)-s*(n*y-a*p)+v*(n*u-a*o),r[11]=-(e*(o*f-u*h)-s*(n*f-a*h)+c*(n*u-a*o)),r[12]=-(s*(h*g-d*p)-c*(o*g-l*p)+v*(o*d-l*h)),r[13]=e*(h*g-d*p)-c*(n*g-i*p)+v*(n*d-i*h),r[14]=-(e*(o*g-l*p)-s*(n*g-i*p)+v*(n*l-i*o)),r[15]=e*(o*d-l*h)-s*(n*d-i*h)+c*(n*l-i*o),r}function NO(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],l=r[7],u=r[8],c=r[9],h=r[10],d=r[11],f=r[12],v=r[13],p=r[14],g=r[15],y=t*s-e*a,m=t*o-n*a,w=t*l-i*a,E=e*o-n*s,_=e*l-i*s,k=n*l-i*o,T=u*v-c*f,O=u*p-h*f,P=u*g-d*f,N=c*p-h*v,C=c*g-d*v,L=h*g-d*p;return y*L-m*C+w*N+E*P-_*O+k*T}function An(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],f=t[10],v=t[11],p=t[12],g=t[13],y=t[14],m=t[15],w=e[0],E=e[1],_=e[2],k=e[3];return r[0]=w*n+E*o+_*h+k*p,r[1]=w*i+E*l+_*d+k*g,r[2]=w*a+E*u+_*f+k*y,r[3]=w*s+E*c+_*v+k*m,w=e[4],E=e[5],_=e[6],k=e[7],r[4]=w*n+E*o+_*h+k*p,r[5]=w*i+E*l+_*d+k*g,r[6]=w*a+E*u+_*f+k*y,r[7]=w*s+E*c+_*v+k*m,w=e[8],E=e[9],_=e[10],k=e[11],r[8]=w*n+E*o+_*h+k*p,r[9]=w*i+E*l+_*d+k*g,r[10]=w*a+E*u+_*f+k*y,r[11]=w*s+E*c+_*v+k*m,w=e[12],E=e[13],_=e[14],k=e[15],r[12]=w*n+E*o+_*h+k*p,r[13]=w*i+E*l+_*d+k*g,r[14]=w*a+E*u+_*f+k*y,r[15]=w*s+E*c+_*v+k*m,r}function ys(r,t,e){var n=e[0],i=e[1],a=e[2],s,o,l,u,c,h,d,f,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]):(s=t[0],o=t[1],l=t[2],u=t[3],c=t[4],h=t[5],d=t[6],f=t[7],v=t[8],p=t[9],g=t[10],y=t[11],r[0]=s,r[1]=o,r[2]=l,r[3]=u,r[4]=c,r[5]=h,r[6]=d,r[7]=f,r[8]=v,r[9]=p,r[10]=g,r[11]=y,r[12]=s*n+c*i+v*a+t[12],r[13]=o*n+h*i+p*a+t[13],r[14]=l*n+d*i+g*a+t[14],r[15]=u*n+f*i+y*a+t[15]),r}function CO(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 PR(r,t,e,n){var i=n[0],a=n[1],s=n[2],o=Math.hypot(i,a,s),l,u,c,h,d,f,v,p,g,y,m,w,E,_,k,T,O,P,N,C,L,B,G,V;return o<_e?null:(o=1/o,i*=o,a*=o,s*=o,l=Math.sin(e),u=Math.cos(e),c=1-u,h=t[0],d=t[1],f=t[2],v=t[3],p=t[4],g=t[5],y=t[6],m=t[7],w=t[8],E=t[9],_=t[10],k=t[11],T=i*i*c+u,O=a*i*c+s*l,P=s*i*c-a*l,N=i*a*c-s*l,C=a*a*c+u,L=s*a*c+i*l,B=i*s*c+a*l,G=a*s*c-i*l,V=s*s*c+u,r[0]=h*T+p*O+w*P,r[1]=d*T+g*O+E*P,r[2]=f*T+y*O+_*P,r[3]=v*T+m*O+k*P,r[4]=h*N+p*C+w*L,r[5]=d*N+g*C+E*L,r[6]=f*N+y*C+_*L,r[7]=v*N+m*C+k*L,r[8]=h*B+p*G+w*V,r[9]=d*B+g*G+E*V,r[10]=f*B+y*G+_*V,r[11]=v*B+m*G+k*V,t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r)}function RO(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[4],s=t[5],o=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=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+u*n,r[5]=s*i+c*n,r[6]=o*i+h*n,r[7]=l*i+d*n,r[8]=u*i-a*n,r[9]=c*i-s*n,r[10]=h*i-o*n,r[11]=d*i-l*n,r}function LO(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=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-u*n,r[1]=s*i-c*n,r[2]=o*i-h*n,r[3]=l*i-d*n,r[8]=a*n+u*i,r[9]=s*n+c*i,r[10]=o*n+h*i,r[11]=l*n+d*i,r}function NR(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=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+u*n,r[1]=s*i+c*n,r[2]=o*i+h*n,r[3]=l*i+d*n,r[4]=u*i-a*n,r[5]=c*i-s*n,r[6]=h*i-o*n,r[7]=d*i-l*n,r}function zi(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 ba(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 IO(r,t,e){var n=e[0],i=e[1],a=e[2],s=Math.hypot(n,i,a),o,l,u;return s<_e?null:(s=1/s,n*=s,i*=s,a*=s,o=Math.sin(t),l=Math.cos(t),u=1-l,r[0]=n*n*u+l,r[1]=i*n*u+a*o,r[2]=a*n*u-i*o,r[3]=0,r[4]=n*i*u-a*o,r[5]=i*i*u+l,r[6]=a*i*u+n*o,r[7]=0,r[8]=n*a*u+i*o,r[9]=i*a*u-n*o,r[10]=a*a*u+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function DO(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 BO(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 Cy(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 FO(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=n+n,l=i+i,u=a+a,c=n*o,h=n*l,d=n*u,f=i*l,v=i*u,p=a*u,g=s*o,y=s*l,m=s*u;return r[0]=1-(f+p),r[1]=h+m,r[2]=d-y,r[3]=0,r[4]=h-m,r[5]=1-(c+p),r[6]=v+g,r[7]=0,r[8]=d+y,r[9]=v-g,r[10]=1-(c+f),r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function CR(r,t){var e=new Ze(3),n=-t[0],i=-t[1],a=-t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=n*n+i*i+a*a+s*s;return h>0?(e[0]=(o*s+c*n+l*a-u*i)*2/h,e[1]=(l*s+c*i+u*n-o*a)*2/h,e[2]=(u*s+c*a+o*i-l*n)*2/h):(e[0]=(o*s+c*n+l*a-u*i)*2,e[1]=(l*s+c*i+u*n-o*a)*2,e[2]=(u*s+c*a+o*i-l*n)*2),FO(r,t,e),r}function Ou(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function _s(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],u=t[9],c=t[10];return r[0]=Math.hypot(e,n,i),r[1]=Math.hypot(a,s,o),r[2]=Math.hypot(l,u,c),r}function Tu(r,t){var e=new Ze(3);_s(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,l=t[2]*a,u=t[4]*n,c=t[5]*i,h=t[6]*a,d=t[8]*n,f=t[9]*i,v=t[10]*a,p=s+c+v,g=0;return p>0?(g=Math.sqrt(p+1)*2,r[3]=.25*g,r[0]=(h-f)/g,r[1]=(d-l)/g,r[2]=(o-u)/g):s>c&&s>v?(g=Math.sqrt(1+s-c-v)*2,r[3]=(h-f)/g,r[0]=.25*g,r[1]=(o+u)/g,r[2]=(d+l)/g):c>v?(g=Math.sqrt(1+c-s-v)*2,r[3]=(d-l)/g,r[0]=(o+u)/g,r[1]=.25*g,r[2]=(h+f)/g):(g=Math.sqrt(1+v-s-c)*2,r[3]=(o-u)/g,r[0]=(d+l)/g,r[1]=(h+f)/g,r[2]=.25*g),r}function RR(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,f=i*c,v=a*u,p=a*c,g=s*c,y=o*l,m=o*u,w=o*c,E=n[0],_=n[1],k=n[2];return r[0]=(1-(v+g))*E,r[1]=(d+w)*E,r[2]=(f-m)*E,r[3]=0,r[4]=(d-w)*_,r[5]=(1-(h+g))*_,r[6]=(p+y)*_,r[7]=0,r[8]=(f+m)*k,r[9]=(p-y)*k,r[10]=(1-(h+v))*k,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function yo(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],l=t[3],u=a+a,c=s+s,h=o+o,d=a*u,f=a*c,v=a*h,p=s*c,g=s*h,y=o*h,m=l*u,w=l*c,E=l*h,_=n[0],k=n[1],T=n[2],O=i[0],P=i[1],N=i[2],C=(1-(p+y))*_,L=(f+E)*_,B=(v-w)*_,G=(f-E)*k,V=(1-(d+y))*k,U=(g+m)*k,$=(v+w)*T,j=(g-m)*T,Z=(1-(d+p))*T;return r[0]=C,r[1]=L,r[2]=B,r[3]=0,r[4]=G,r[5]=V,r[6]=U,r[7]=0,r[8]=$,r[9]=j,r[10]=Z,r[11]=0,r[12]=e[0]+O-(C*O+G*P+$*N),r[13]=e[1]+P-(L*O+V*P+j*N),r[14]=e[2]+N-(B*O+U*P+Z*N),r[15]=1,r}function $m(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,u=e*s,c=n*s,h=n*o,d=i*s,f=i*o,v=i*l,p=a*s,g=a*o,y=a*l;return r[0]=1-h-v,r[1]=c+y,r[2]=d-g,r[3]=0,r[4]=c-y,r[5]=1-u-v,r[6]=f+p,r[7]=0,r[8]=d+g,r[9]=f-p,r[10]=1-u-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function LR(r,t,e,n,i,a,s){var o=1/(e-t),l=1/(i-n),u=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*l,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*l,r[10]=(s+a)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*u,r[15]=0,r}function zO(r,t,e,n,i){var a=1/Math.tan(t/2),s;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?(s=1/(n-i),r[10]=(i+n)*s,r[14]=2*i*n*s):(r[10]=-1,r[14]=-2*n),r}var IR=zO;function DR(r,t,e,n,i){var a=1/Math.tan(t/2),s;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?(s=1/(n-i),r[10]=i*s,r[14]=i*n*s):(r[10]=-1,r[14]=-n),r}function BR(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),u=2/(i+a);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=-((s-o)*l*.5),r[9]=(i-a)*u*.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 jO(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=(s+a)*u,r[15]=1,r}var qO=jO;function $O(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=a*u,r[15]=1,r}function GO(r,t,e,n){var i,a,s,o,l,u,c,h,d,f,v=t[0],p=t[1],g=t[2],y=n[0],m=n[1],w=n[2],E=e[0],_=e[1],k=e[2];return Math.abs(v-E)<_e&&Math.abs(p-_)<_e&&Math.abs(g-k)<_e?ta(r):(c=v-E,h=p-_,d=g-k,f=1/Math.hypot(c,h,d),c*=f,h*=f,d*=f,i=m*d-w*h,a=w*c-y*d,s=y*h-m*c,f=Math.hypot(i,a,s),f?(f=1/f,i*=f,a*=f,s*=f):(i=0,a=0,s=0),o=h*s-d*a,l=d*i-c*s,u=c*a-h*i,f=Math.hypot(o,l,u),f?(f=1/f,o*=f,l*=f,u*=f):(o=0,l=0,u=0),r[0]=i,r[1]=o,r[2]=c,r[3]=0,r[4]=a,r[5]=l,r[6]=h,r[7]=0,r[8]=s,r[9]=u,r[10]=d,r[11]=0,r[12]=-(i*v+a*p+s*g),r[13]=-(o*v+l*p+u*g),r[14]=-(c*v+h*p+d*g),r[15]=1,r)}function FR(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=n[0],l=n[1],u=n[2],c=i-e[0],h=a-e[1],d=s-e[2],f=c*c+h*h+d*d;f>0&&(f=1/Math.sqrt(f),c*=f,h*=f,d*=f);var v=l*d-u*h,p=u*c-o*d,g=o*h-l*c;return f=v*v+p*p+g*g,f>0&&(f=1/Math.sqrt(f),v*=f,p*=f,g*=f),r[0]=v,r[1]=p,r[2]=g,r[3]=0,r[4]=h*g-d*p,r[5]=d*v-c*g,r[6]=c*p-h*v,r[7]=0,r[8]=c,r[9]=h,r[10]=d,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function zR(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 jR(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 qR(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 WO(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 $R(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 GR(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 Ry(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 WR(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],u=r[7],c=r[8],h=r[9],d=r[10],f=r[11],v=r[12],p=r[13],g=r[14],y=r[15],m=t[0],w=t[1],E=t[2],_=t[3],k=t[4],T=t[5],O=t[6],P=t[7],N=t[8],C=t[9],L=t[10],B=t[11],G=t[12],V=t[13],U=t[14],$=t[15];return Math.abs(e-m)<=_e*Math.max(1,Math.abs(e),Math.abs(m))&&Math.abs(n-w)<=_e*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(i-E)<=_e*Math.max(1,Math.abs(i),Math.abs(E))&&Math.abs(a-_)<=_e*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(s-k)<=_e*Math.max(1,Math.abs(s),Math.abs(k))&&Math.abs(o-T)<=_e*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(l-O)<=_e*Math.max(1,Math.abs(l),Math.abs(O))&&Math.abs(u-P)<=_e*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(c-N)<=_e*Math.max(1,Math.abs(c),Math.abs(N))&&Math.abs(h-C)<=_e*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(d-L)<=_e*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(f-B)<=_e*Math.max(1,Math.abs(f),Math.abs(B))&&Math.abs(v-G)<=_e*Math.max(1,Math.abs(v),Math.abs(G))&&Math.abs(p-V)<=_e*Math.max(1,Math.abs(p),Math.abs(V))&&Math.abs(g-U)<=_e*Math.max(1,Math.abs(g),Math.abs(U))&&Math.abs(y-$)<=_e*Math.max(1,Math.abs(y),Math.abs($))}var VO=An,VR=WO;const UR=Object.freeze(Object.defineProperty({__proto__:null,add:qR,adjoint:AR,clone:TO,copy:Ss,create:fe,determinant:NO,equals:WR,exactEquals:Ry,frob:jR,fromQuat:$m,fromQuat2:CR,fromRotation:IO,fromRotationTranslation:FO,fromRotationTranslationScale:RR,fromRotationTranslationScaleOrigin:yo,fromScaling:ba,fromTranslation:zi,fromValues:AO,fromXRotation:DO,fromYRotation:BO,fromZRotation:Cy,frustum:LR,getRotation:Tu,getScaling:_s,getTranslation:Ou,identity:ta,invert:Zr,lookAt:GO,mul:VO,multiply:An,multiplyScalar:$R,multiplyScalarAndAdd:GR,ortho:qO,orthoNO:jO,orthoZO:$O,perspective:IR,perspectiveFromFieldOfView:BR,perspectiveNO:zO,perspectiveZO:DR,rotate:PR,rotateX:RO,rotateY:LO,rotateZ:NR,scale:CO,set:Ny,str:zR,sub:VR,subtract:WO,targetTo:FR,translate:ys,transpose:PO},Symbol.toStringTag,{value:"Module"}));function Zt(){var r=new Ze(3);return Ze!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function di(r){var t=new Ze(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function gi(r){var t=r[0],e=r[1],n=r[2];return Math.hypot(t,e,n)}function ye(r,t,e){var n=new Ze(3);return n[0]=r,n[1]=t,n[2]=e,n}function Jr(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function Tn(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function Xi(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function Ly(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function YR(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function HR(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 XR(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 Au(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function KR(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 ka(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 Qr(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function yu(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],l=e[2];return r[0]=i*l-a*o,r[1]=a*s-n*l,r[2]=n*o-i*s,r}function Iy(r,t,e,n){var i=t[0],a=t[1],s=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r}function Pn(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[3]*n+e[7]*i+e[11]*a+e[15];return s=s||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/s,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/s,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/s,r}function ZR(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 JR(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],u=t[2],c=i*u-a*l,h=a*o-n*u,d=n*l-i*o,f=i*d-a*h,v=a*c-n*d,p=n*h-i*c,g=s*2;return c*=g,h*=g,d*=g,f*=2,v*=2,p*=2,r[0]=o+c+f,r[1]=l+h+v,r[2]=u+d+p,r}function Ys(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2];return Math.abs(e-a)<=_e*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=_e*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=_e*Math.max(1,Math.abs(i),Math.abs(o))}var QR=Ly,pb=KR,UO=gi;(function(){var r=Zt();return function(t,e,n,i,a,s){var o,l;for(e||(e=3),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2];return t}})();function ti(){var r=new Ze(4);return Ze!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function ao(r,t,e,n){var i=new Ze(4);return i[0]=r,i[1]=t,i[2]=e,i[3]=n,i}function t3(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function e3(r,t,e,n,i){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function n3(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e+n*n+i*i+a*a;return s>0&&(s=1/Math.sqrt(s)),r[0]=e*s,r[1]=n*s,r[2]=i*s,r[3]=a*s,r}function bi(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3];return r[0]=e[0]*n+e[4]*i+e[8]*a+e[12]*s,r[1]=e[1]*n+e[5]*i+e[9]*a+e[13]*s,r[2]=e[2]*n+e[6]*i+e[10]*a+e[14]*s,r[3]=e[3]*n+e[7]*i+e[11]*a+e[15]*s,r}(function(){var r=ti();return function(t,e,n,i,a,s){var o,l;for(e||(e=4),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],r[3]=t[o+3],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2],t[o+3]=r[3];return t}})();function nn(){var r=new Ze(4);return Ze!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function qi(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 Ki(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],l=e[1],u=e[2],c=e[3];return r[0]=n*c+s*o+i*u-a*l,r[1]=i*c+s*l+a*o-n*u,r[2]=a*c+s*u+n*l-i*o,r[3]=s*c-n*o-i*l-a*u,r}function Uh(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=e[0],u=e[1],c=e[2],h=e[3],d,f,v,p,g;return f=i*l+a*u+s*c+o*h,f<0&&(f=-f,l=-l,u=-u,c=-c,h=-h),1-f>_e?(d=Math.acos(f),v=Math.sin(d),p=Math.sin((1-n)*d)/v,g=Math.sin(n*d)/v):(p=1-n,g=n),r[0]=p*i+g*l,r[1]=p*a+g*u,r[2]=p*s+g*c,r[3]=p*o+g*h,r}function Yh(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e+n*n+i*i+a*a,o=s?1/s:0;return r[0]=-e*o,r[1]=-n*o,r[2]=-i*o,r[3]=a*o,r}function r3(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,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[s*3+s]+1),r[i]=.5*n,n=.5/n,r[3]=(t[a*3+s]-t[s*3+a])*n,r[a]=(t[a*3+i]+t[i*3+a])*n,r[s]=(t[s*3+i]+t[i*3+s])*n}return r}function bl(r,t,e,n){var i=.5*Math.PI/180;t*=i,e*=i,n*=i;var a=Math.sin(t),s=Math.cos(t),o=Math.sin(e),l=Math.cos(e),u=Math.sin(n),c=Math.cos(n);return r[0]=a*l*c-s*o*u,r[1]=s*o*c+a*l*u,r[2]=s*l*u-a*o*c,r[3]=s*l*c+a*o*u,r}var i3=ao,wl=t3,yb=e3,mb=Ki,Pu=n3;(function(){var r=Zt(),t=ye(1,0,0),e=ye(0,1,0);return function(n,i,a){var s=Qr(i,a);return s<-.999999?(yu(r,t,i),UO(r)<1e-6&&yu(r,e,i),ka(r,r),qi(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(yu(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,Pu(n,n))}})();(function(){var r=nn(),t=nn();return function(e,n,i,a,s,o){return Uh(r,n,s,o),Uh(t,i,a,o),Uh(e,r,t,2*o*(1-o)),e}})();(function(){var r=OO();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],Pu(t,r3(t,r))}})();function Gm(){var r=new Ze(2);return Ze!=Float32Array&&(r[0]=0,r[1]=0),r}function a3(r,t){return r[0]=t[0],r[1]=t[1],r}function s3(r,t,e){return r[0]=t,r[1]=e,r}function o3(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 l3(r,t){return r[0]*t[0]+r[1]*t[1]}function u3(r,t){return r[0]===t[0]&&r[1]===t[1]}(function(){var r=Gm();return function(t,e,n,i,a,s){var o,l;for(e||(e=2),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],a(r,r,s),t[o]=r[0],t[o+1]=r[1];return t}})();var ko=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},c3=function(r,t){return ko(r)?r.indexOf(t)>-1:!1},h3=function(r,t){if(!ko(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];t(i,n)&&e.push(i)}return e},d3=function(r,t){return t===void 0&&(t=[]),h3(r,function(e){return!c3(t,e)})};function Ot(r){return typeof r=="function"}function Rt(r){return r==null}function lr(r){return Array.isArray(r)}const Ve=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function YO(r,t){if(r){var e;if(lr(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(Ve(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}var Dy=function(r){return typeof r=="object"&&r!==null},f3={}.toString,HO=function(r,t){return f3.call(r)==="[object "+t+"]"},Ms=function(r){if(!Dy(r)||!HO(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 Nu(r){if(!Array.isArray(r))return-1/0;var t=r.length;if(!t)return-1/0;for(var e=r[0],n=1;n<t;n++)e=Math.max(e,r[n]);return e}const Cu=function(r){if(lr(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};var g3=function(r,t,e){if(!lr(r)&&!Ms(r))return r;var n=e;return YO(r,function(i,a){n=t(n,i,a)}),n};function ee(r){return typeof r=="string"}function v3(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 p3=Object.prototype.hasOwnProperty;function cc(r,t){if(!t||!lr(r))return{};for(var e={},n=Ot(t)?t:function(o){return o[t]},i,a=0;a<r.length;a++){var s=r[a];i=n(s),p3.call(e,i)?e[i].push(s):e[i]=[s]}return e}var De=function(r,t,e){return r<t?t:r>e?e:r};function St(r){return typeof r=="number"}var y3=1e-5;function mo(r,t,e){return e===void 0&&(e=y3),r===t||Math.abs(r-t)<e}const m3=function(r,t){if(lr(r)){for(var e,n=-1/0,i=0;i<r.length;i++){var a=r[i],s=Ot(t)?t(a):a[t];s>n&&(e=a,n=s)}return e}},b3=function(r,t){if(lr(r)){for(var e,n=1/0,i=0;i<r.length;i++){var a=r[i],s=Ot(t)?t(a):a[t];s<n&&(e=a,n=s)}return e}};var XO=function(r,t){return(r%t+t)%t};const KO=function(r){return Rt(r)?"":r.toString()};var w3=function(r){var t=KO(r);return t.charAt(0).toLowerCase()+t.substring(1)};function x3(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 Ru=function(r){var t=KO(r);return t.charAt(0).toUpperCase()+t.substring(1)},E3={}.toString,S3=function(r){return E3.call(r).replace(/^\[object /,"").replace(/]$/,"")},Lu=function(r){return HO(r,"Boolean")};function _3(r){return r instanceof Date}function M3(r){return r===null}var k3=Object.prototype,O3=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||k3;return r===e},Bt=function(r){return r===void 0},ea=function(r){if(typeof r!="object"||r===null)return r;var t;if(lr(r)){t=[];for(var e=0,n=r.length;e<n;e++)typeof r[e]=="object"&&r[e]!=null?t[e]=ea(r[e]):t[e]=r[e]}else{t={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?t[i]=ea(r[i]):t[i]=r[i]}return t};function Wo(r,t,e){var n;return function(){var i=this,a=arguments,s=function(){n=null,e||r.apply(i,a)},o=e&&!n;clearTimeout(n),n=setTimeout(s,t),o&&r.apply(i,a)}}function T3(r){var t,e,n,i=r||1;function a(o,l){++t>i&&(n=e,s(1),++t),e[o]=l}function s(o){t=0,e=Object.create(null),o||(n=Object.create(null))}return s(),{clear:s,has:function(o){return e[o]!==void 0||n[o]!==void 0},get:function(o){var l=e[o];if(l!==void 0)return l;if((l=n[o])!==void 0)return a(o,l),l},set:function(o,l){e[o]!==void 0?e[o]=l:a(o,l)}}}var Hh=new Map;function By(r,t,e){e===void 0&&(e=128);var n=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=t?t.apply(this,i):i[0];Hh.has(r)||Hh.set(r,T3(e));var o=Hh.get(r);if(o.has(s))return o.get(s);var l=r.apply(this,i);return o.set(s,l),l};return n}var A3=5;function P3(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 ZO(r,t,e,n){e=e||0,n=n||A3;for(var i in t)if(P3(t,i)){var a=t[i];a!==null&&Ms(a)?(Ms(r[i])||(r[i]={}),e<n?ZO(r[i],a,e+1,n):r[i]=t[i]):lr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var Bn=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)ZO(r,t[n]);return r},N3=Object.prototype.hasOwnProperty;function Kr(r){if(Rt(r))return!0;if(ko(r))return!r.length;var t=S3(r);if(t==="Map"||t==="Set")return!r.size;if(O3(r))return!Object.keys(r).length;for(var e in r)if(N3.call(r,e))return!1;return!0}var Be=function(r,t){if(r===t)return!0;if(!r||!t||ee(r)||ee(t))return!1;if(ko(r)||ko(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n<r.length&&(e=Be(r[n],t[n]),!!e);n++);return e}if(Dy(r)||Dy(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=Be(r[i[n]],t[i[n]]),!!e);n++);return e}return!1};const Rn=function(r,t,e){for(var n=0,i=ee(t)?t.split("."):t;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?e:r},Oo=function(r,t,e){var n=r,i=ee(t)?t.split("."):t;return i.forEach(function(a,s){s<i.length-1?(Ve(n[a])||(n[a]=St(i[s+1])?[]:{}),n=n[a]):n[a]=e}),r};var C3=Object.prototype.hasOwnProperty;const Ra=function(r,t){if(r===null||!Ms(r))return{};var e={};return YO(t,function(n){C3.call(r,n)&&(e[n]=r[n])}),e},Wm=function(r,t){return g3(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})},JO=function(r,t,e){var n,i,a,s,o=0;e||(e={});var l=function(){o=e.leading===!1?0:Date.now(),n=null,s=r.apply(i,a),n||(i=a=null)},u=function(){var c=Date.now();!o&&e.leading===!1&&(o=c);var h=t-(c-o);return i=this,a=arguments,h<=0||h>t?(n&&(clearTimeout(n),n=null),o=c,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(l,h)),s};return u.cancel=function(){clearTimeout(n),o=0,n=i=a=null},u};var xl={};const R3=function(r){return r=r||"g",xl[r]?xl[r]+=1:xl[r]=1,r+xl[r]},Xh=function(){},Fy=function(r){return r};var zy=function(r,t){return zy=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])},zy(r,t)};function Yt(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");zy(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var ut=function(){return ut=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},ut.apply(this,arguments)};function je(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 Ut(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})}function Vo(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 q(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return a}function L3(){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],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n}function xt(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 Kh(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)}var QO={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function I3(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 bo={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function tT(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return bo[e]===t.length-1&&"achlmqstvz".includes(e)})}function eT(r){return tT(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function nT(r){return eT(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function bb(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=bo[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,bo[e]))),!!bo[e]););}function D3(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 "'.concat(e[t],'", expecting 0 or 1 at index ').concat(t)}function B3(r){return r>=48&&r<=57||r===43||r===45||r===46}function ts(r){return r>=48&&r<=57}function F3(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,l=!1,u;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(u=e.charCodeAt(i),(u===43||u===45)&&(i+=1,u=e.charCodeAt(i)),!ts(u)&&u!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(u!==46){if(a=u===48,i+=1,u=e.charCodeAt(i),a&&i<t&&u&&ts(u)){r.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(e[n],'" illegal number');return}for(;i<t&&ts(e.charCodeAt(i));)i+=1,s=!0;u=e.charCodeAt(i)}if(u===46){for(l=!0,i+=1;ts(e.charCodeAt(i));)i+=1,o=!0;u=e.charCodeAt(i)}if(u===101||u===69){if(l&&!s&&!o){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" invalid float exponent');return}if(i+=1,u=e.charCodeAt(i),(u===43||u===45)&&(i+=1),i<t&&ts(e.charCodeAt(i)))for(;i<t&&ts(e.charCodeAt(i));)i+=1;else{r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" invalid integer exponent');return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function z3(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 mu(r){for(var t=r.pathValue,e=r.max;r.index<e&&z3(t.charCodeAt(r.index));)r.index+=1}function j3(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 q3(r){return(r|32)===97}function $3(r){var t=r.max,e=r.pathValue,n=r.index,i=e.charCodeAt(n),a=bo[e[n].toLowerCase()];if(r.segmentStart=n,!j3(i)){r.err='[path-util]: Invalid path value "'.concat(e[n],'" is not a path command');return}if(r.index+=1,mu(r),r.data=[],!a){bb(r);return}for(;;){for(var s=a;s>0;s-=1){if(q3(i)&&(s===3||s===4)?D3(r):F3(r),r.err.length)return;r.data.push(r.param),mu(r),r.index<t&&e.charCodeAt(r.index)===44&&(r.index+=1,mu(r))}if(r.index>=r.max||!B3(e.charCodeAt(r.index)))break}bb(r)}var G3=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 W3(r){if(tT(r))return[].concat(r);var t=new G3(r);for(mu(t);t.index<t.max&&!t.err.length;)$3(t);return t.err?t.err:t.segments}function V3(r){if(eT(r))return[].concat(r);var t=W3(r),e=0,n=0,i=0,a=0;return t.map(function(s){var o=s.slice(1).map(Number),l=s[0],u=l.toUpperCase();if(l==="M")return e=o[0],n=o[1],i=e,a=n,["M",e,n];var c;if(l!==u)switch(u){case"A":c=[u,o[0],o[1],o[2],o[3],o[4],o[5]+e,o[6]+n];break;case"V":c=[u,o[0]+n];break;case"H":c=[u,o[0]+e];break;default:{var h=o.map(function(f,v){return f+(v%2?n:e)});c=[u].concat(h)}}else c=[u].concat(o);var d=c.length;switch(u){case"Z":e=i,n=a;break;case"H":e=c[1];break;case"V":n=c[1];break;default:e=c[d-2],n=c[d-1],u==="M"&&(i=e,a=n)}return c})}function U3(r,t){var e=r[0],n=t.x1,i=t.y1,a=t.x2,s=t.y2,o=r.slice(1).map(Number),l=r;if("TQ".includes(e)||(t.qx=null,t.qy=null),e==="H")l=["L",r[1],i];else if(e==="V")l=["L",n,r[1]];else if(e==="S"){var u=n*2-a,c=i*2-s;t.x1=u,t.y1=c,l=["C",u,c].concat(o)}else if(e==="T"){var h=n*2-t.qx,d=i*2-t.qy;t.qx=h,t.qy=d,l=["Q",h,d].concat(o)}else if(e==="Q"){var f=o[0],v=o[1];t.qx=f,t.qy=v}return l}function Iu(r){if(nT(r))return[].concat(r);for(var t=V3(r),e=ut({},QO),n=0;n<t.length;n+=1){t[n]=U3(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 Y3(r){return nT(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function El(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 Vm(r,t,e,n,i,a,s,o,l,u){var c=r,h=t,d=e,f=n,v=o,p=l,g=Math.PI*120/180,y=Math.PI/180*(+i||0),m=[],w,E,_,k,T;if(u)E=u[0],_=u[1],k=u[2],T=u[3];else{w=El(c,h,-y),c=w.x,h=w.y,w=El(v,p,-y),v=w.x,p=w.y;var O=(c-v)/2,P=(h-p)/2,N=O*O/(d*d)+P*P/(f*f);N>1&&(N=Math.sqrt(N),d*=N,f*=N);var C=d*d,L=f*f,B=(a===s?-1:1)*Math.sqrt(Math.abs((C*L-C*P*P-L*O*O)/(C*P*P+L*O*O)));k=B*d*P/f+(c+v)/2,T=B*-f*O/d+(h+p)/2,E=Math.asin(((h-T)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),_=Math.asin(((p-T)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),E=c<k?Math.PI-E:E,_=v<k?Math.PI-_:_,E<0&&(E=Math.PI*2+E),_<0&&(_=Math.PI*2+_),s&&E>_&&(E-=Math.PI*2),!s&&_>E&&(_-=Math.PI*2)}var G=_-E;if(Math.abs(G)>g){var V=_,U=v,$=p;_=E+g*(s&&_>E?1:-1),v=k+d*Math.cos(_),p=T+f*Math.sin(_),m=Vm(v,p,d,f,i,0,s,U,$,[_,V,k,T])}G=_-E;var j=Math.cos(E),Z=Math.sin(E),nt=Math.cos(_),st=Math.sin(_),ot=Math.tan(G/4),Pt=4/3*d*ot,K=4/3*f*ot,W=[c,h],tt=[c+Pt*Z,h-K*j],ct=[v+Pt*st,p-K*nt],Et=[v,p];if(tt[0]=2*W[0]-tt[0],tt[1]=2*W[1]-tt[1],u)return tt.concat(ct,Et,m);m=tt.concat(ct,Et,m);for(var Nt=[],Vt=0,ke=m.length;Vt<ke;Vt+=1)Nt[Vt]=Vt%2?El(m[Vt-1],m[Vt],y).y:El(m[Vt],m[Vt+1],y).x;return Nt}function H3(r,t,e,n,i,a){var s=.3333333333333333,o=2/3;return[s*r+o*e,s*t+o*n,s*i+o*e,s*a+o*n,i,a]}function Bi(r,t,e){var n=r[0],i=r[1],a=t[0],s=t[1];return[n+(a-n)*e,i+(s-i)*e]}var wb=function(r,t,e,n){var i=.5,a=Bi([r,t],[e,n],i);return xt(xt([],a,!0),[e,n,e,n],!1)};function X3(r,t){var e=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],s,o=t.x1,l=t.y1,u=t.x,c=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 s=[o,l].concat(n),["C"].concat(Vm(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]));case"Q":return t.qx=i,t.qy=a,s=[o,l].concat(n),["C"].concat(H3(s[0],s[1],s[2],s[3],s[4],s[5]));case"L":return["C"].concat(wb(o,l,i,a));case"Z":return o===u&&l===c?["C",o,l,u,c,u,c]:["C"].concat(wb(o,l,u,c))}return r}function jy(r,t){if(t===void 0&&(t=!1),Y3(r)){var e=[].concat(r);return t?[e,[]]:e}for(var n=Iu(r),i=ut({},QO),a=[],s="",o=n.length,l,u,c=[],h=0;h<o;h+=1){n[h]&&(s=n[h][0]),a[h]=s;var d=X3(n[h],i);n[h]=d,I3(n,a,h),o=n.length,s==="Z"&&c.push(h),l=n[h],u=l.length,i.x1=+l[u-2],i.y1=+l[u-1],i.x2=+l[u-4]||i.x1,i.y2=+l[u-3]||i.y1}return t?[n,c]:n}function K3(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function Z3(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 Wn(r,t){return Math.sqrt((r[0]-t[0])*(r[0]-t[0])+(r[1]-t[1])*(r[1]-t[1]))}function qy(r,t,e,n,i){var a=Wn([r,t],[e,n]),s={x:0,y:0};if(typeof i=="number")if(i<=0)s={x:r,y:t};else if(i>=a)s={x:e,y:n};else{var o=Bi([r,t],[e,n],i/a),l=o[0],u=o[1];s={x:l,y:u}}return{length:a,point:s,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function xb(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,s=e*i+n*a,o=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),l=e*a-n*i<0?-1:1,u=l*Math.acos(s/o);return u}function J3(r,t,e,n,i,a,s,o,l,u){var c=Math.abs,h=Math.sin,d=Math.cos,f=Math.sqrt,v=Math.PI,p=c(e),g=c(n),y=(i%360+360)%360,m=y*(v/180);if(r===o&&t===l)return{x:r,y:t};if(p===0||g===0)return qy(r,t,o,l,u).point;var w=(r-o)/2,E=(t-l)/2,_={x:d(m)*w+h(m)*E,y:-h(m)*w+d(m)*E},k=Math.pow(_.x,2)/Math.pow(p,2)+Math.pow(_.y,2)/Math.pow(g,2);k>1&&(p*=f(k),g*=f(k));var T=Math.pow(p,2)*Math.pow(g,2)-Math.pow(p,2)*Math.pow(_.y,2)-Math.pow(g,2)*Math.pow(_.x,2),O=Math.pow(p,2)*Math.pow(_.y,2)+Math.pow(g,2)*Math.pow(_.x,2),P=T/O;P=P<0?0:P;var N=(a!==s?1:-1)*f(P),C={x:N*(p*_.y/g),y:N*(-(g*_.x)/p)},L={x:d(m)*C.x-h(m)*C.y+(r+o)/2,y:h(m)*C.x+d(m)*C.y+(t+l)/2},B={x:(_.x-C.x)/p,y:(_.y-C.y)/g},G=xb({x:1,y:0},B),V={x:(-_.x-C.x)/p,y:(-_.y-C.y)/g},U=xb(B,V);!s&&U>0?U-=2*v:s&&U<0&&(U+=2*v),U%=2*v;var $=G+U*u,j=p*d($),Z=g*h($),nt={x:d(m)*j-h(m)*Z+L.x,y:h(m)*j+d(m)*Z+L.y};return nt}function Q3(r,t,e,n,i,a,s,o,l,u,c){var h,d=c.bbox,f=d===void 0?!0:d,v=c.length,p=v===void 0?!0:v,g=c.sampleSize,y=g===void 0?30:g,m=typeof u=="number",w=r,E=t,_=0,k=[w,E,_],T=[w,E],O=0,P={x:0,y:0},N=[{x:w,y:E}];m&&u<=0&&(P={x:w,y:E});for(var C=0;C<=y;C+=1){if(O=C/y,h=J3(r,t,e,n,i,a,s,o,l,O),w=h.x,E=h.y,f&&N.push({x:w,y:E}),p&&(_+=Wn(T,[w,E])),T=[w,E],m&&_>=u&&u>k[2]){var L=(_-u)/(_-k[2]);P={x:T[0]*(1-L)+k[0]*L,y:T[1]*(1-L)+k[1]*L}}k=[w,E,_]}return m&&u>=_&&(P={x:o,y:l}),{length:_,point:P,min:{x:Math.min.apply(null,N.map(function(B){return B.x})),y:Math.min.apply(null,N.map(function(B){return B.y}))},max:{x:Math.max.apply(null,N.map(function(B){return B.x})),y:Math.max.apply(null,N.map(function(B){return B.y}))}}}function tL(r,t,e,n,i,a,s,o,l){var u=1-l;return{x:Math.pow(u,3)*r+3*Math.pow(u,2)*l*e+3*u*Math.pow(l,2)*i+Math.pow(l,3)*s,y:Math.pow(u,3)*t+3*Math.pow(u,2)*l*n+3*u*Math.pow(l,2)*a+Math.pow(l,3)*o}}function rT(r,t,e,n,i,a,s,o,l,u){var c,h=u.bbox,d=h===void 0?!0:h,f=u.length,v=f===void 0?!0:f,p=u.sampleSize,g=p===void 0?10:p,y=typeof l=="number",m=r,w=t,E=0,_=[m,w,E],k=[m,w],T=0,O={x:0,y:0},P=[{x:m,y:w}];y&&l<=0&&(O={x:m,y:w});for(var N=0;N<=g;N+=1){if(T=N/g,c=tL(r,t,e,n,i,a,s,o,T),m=c.x,w=c.y,d&&P.push({x:m,y:w}),v&&(E+=Wn(k,[m,w])),k=[m,w],y&&E>=l&&l>_[2]){var C=(E-l)/(E-_[2]);O={x:k[0]*(1-C)+_[0]*C,y:k[1]*(1-C)+_[1]*C}}_=[m,w,E]}return y&&l>=E&&(O={x:s,y:o}),{length:E,point:O,min:{x:Math.min.apply(null,P.map(function(L){return L.x})),y:Math.min.apply(null,P.map(function(L){return L.y}))},max:{x:Math.max.apply(null,P.map(function(L){return L.x})),y:Math.max.apply(null,P.map(function(L){return L.y}))}}}function eL(r,t,e,n,i,a,s){var o=1-s;return{x:Math.pow(o,2)*r+2*o*s*e+Math.pow(s,2)*i,y:Math.pow(o,2)*t+2*o*s*n+Math.pow(s,2)*a}}function nL(r,t,e,n,i,a,s,o){var l,u=o.bbox,c=u===void 0?!0:u,h=o.length,d=h===void 0?!0:h,f=o.sampleSize,v=f===void 0?10:f,p=typeof s=="number",g=r,y=t,m=0,w=[g,y,m],E=[g,y],_=0,k={x:0,y:0},T=[{x:g,y}];p&&s<=0&&(k={x:g,y});for(var O=0;O<=v;O+=1){if(_=O/v,l=eL(r,t,e,n,i,a,_),g=l.x,y=l.y,c&&T.push({x:g,y}),d&&(m+=Wn(E,[g,y])),E=[g,y],p&&m>=s&&s>w[2]){var P=(m-s)/(m-w[2]);k={x:E[0]*(1-P)+w[0]*P,y:E[1]*(1-P)+w[1]*P}}w=[g,y,m]}return p&&s>=m&&(k={x:i,y:a}),{length:m,point:k,min:{x:Math.min.apply(null,T.map(function(N){return N.x})),y:Math.min.apply(null,T.map(function(N){return N.y}))},max:{x:Math.max.apply(null,T.map(function(N){return N.x})),y:Math.max.apply(null,T.map(function(N){return N.y}))}}}function iT(r,t,e){for(var n,i,a,s,o,l,u=Iu(r),c=typeof t=="number",h,d=[],f,v=0,p=0,g=0,y=0,m,w=[],E=[],_=0,k={x:0,y:0},T=k,O=k,P=k,N=0,C=0,L=u.length;C<L;C+=1)m=u[C],f=m[0],h=f==="M",d=h?d:[v,p].concat(m.slice(1)),h?(g=m[1],y=m[2],k={x:g,y},T=k,_=0,c&&t<.001&&(P=k)):f==="L"?(n=qy(d[0],d[1],d[2],d[3],(t||0)-N),_=n.length,k=n.min,T=n.max,O=n.point):f==="A"?(i=Q3(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],(t||0)-N,e||{}),_=i.length,k=i.min,T=i.max,O=i.point):f==="C"?(a=rT(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],(t||0)-N,e||{}),_=a.length,k=a.min,T=a.max,O=a.point):f==="Q"?(s=nL(d[0],d[1],d[2],d[3],d[4],d[5],(t||0)-N,e||{}),_=s.length,k=s.min,T=s.max,O=s.point):f==="Z"&&(d=[v,p,g,y],o=qy(d[0],d[1],d[2],d[3],(t||0)-N),_=o.length,k=o.min,T=o.max,O=o.point),c&&N<t&&N+_>=t&&(P=O),E.push(T),w.push(k),N+=_,l=f!=="Z"?m.slice(-2):[g,y],v=l[0],p=l[1];return c&&t>=N&&(P={x:v,y:p}),{length:N,point:P,min:{x:Math.min.apply(null,w.map(function(B){return B.x})),y:Math.min.apply(null,w.map(function(B){return B.y}))},max:{x:Math.max.apply(null,E.map(function(B){return B.x})),y:Math.max.apply(null,E.map(function(B){return B.y}))}}}function rL(r,t){return iT(r,void 0,ut(ut({},t),{bbox:!1,length:!0})).length}function iL(r){var t=r.length,e=t-1;return r.map(function(n,i){return r.map(function(a,s){var o=i+s,l;return s===0||r[o]&&r[o][0]==="M"?(l=r[o],["M"].concat(l.slice(-2))):(o>=t&&(o-=e),r[o])})})}function aL(r,t){var e=r.length-1,n=[],i=0,a=0,s=iL(r);return s.forEach(function(o,l){r.slice(1).forEach(function(u,c){a+=Wn(r[(l+c)%e].slice(-2),t[c%e].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}function sL(r,t,e,n,i,a,s,o){return 3*((o-t)*(e+i)-(s-r)*(n+a)+n*(r-i)-e*(t-a)+o*(i+r/3)-s*(a+t/3))/20}function oL(r){var t=0,e=0,n=0;return jy(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=i[2],0;default:var s=i.slice(1),o=s[0],l=s[1],u=s[2],c=s[3],h=s[4],d=s[5];return n=sL(t,e,o,l,u,c,h,d),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function Eb(r){return oL(r)>=0}function lL(r,t,e){return iT(r,t,ut(ut({},e),{bbox:!1,length:!0})).point}function uL(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),s=Bi(e,n,t),o=Bi(n,i,t),l=Bi(i,a,t),u=Bi(s,o,t),c=Bi(o,l,t),h=Bi(u,c,t);return[["C"].concat(s,u,h),["C"].concat(c,l,a)]}function Sb(r){return r.map(function(t,e,n){var i=e&&n[e-1].slice(-2).concat(t.slice(1)),a=e?rT(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,s;return e?s=a?uL(i):[t,t]:s=[t],{s:t,ss:s,l:a}})}function aT(r,t,e){var n=Sb(r),i=Sb(t),a=n.length,s=i.length,o=n.filter(function(g){return g.l}).length,l=i.filter(function(g){return g.l}).length,u=n.filter(function(g){return g.l}).reduce(function(g,y){var m=y.l;return g+m},0)/o||0,c=i.filter(function(g){return g.l}).reduce(function(g,y){var m=y.l;return g+m},0)/l||0,h=e||Math.max(a,s),d=[u,c],f=[h-a,h-s],v=0,p=[n,i].map(function(g,y){return g.l===h?g.map(function(m){return m.s}):g.map(function(m,w){return v=w&&f[y]&&m.l>=d[y],f[y]-=v?1:0,v?m.ss:[m.s]}).flat()});return p[0].length===p[1].length?p:aT(p[0],p[1],h)}function $y(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function cL(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=Es(r))!==null;);return r}function Gy(){return Gy=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=cL(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},Gy.apply(null,arguments)}function _b(r,t,e,n){var i=Gy(Es(r.prototype),t,e);return typeof i=="function"?function(a){return i.apply(e,a)}:i}function xi(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function sT(r,t){var e=Math.min.apply(Math,xt([],q(r),!1)),n=Math.min.apply(Math,xt([],q(t),!1)),i=Math.max.apply(Math,xt([],q(r),!1)),a=Math.max.apply(Math,xt([],q(t),!1));return{x:e,y:n,width:i-e,height:a-n}}function hL(r,t,e){return Math.atan(-t/r*Math.tan(e))}function dL(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function fL(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function gL(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function vL(r,t,e,n,i,a,s){for(var o=hL(e,n,i),l=1/0,u=-1/0,c=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var d=o+h;a<s?a<d&&d<s&&c.push(d):s<d&&d<a&&c.push(d)}for(var h=0;h<c.length;h++){var f=fL(r,t,e,n,i,c[h]);f<l&&(l=f),f>u&&(u=f)}for(var v=dL(e,n,i),p=1/0,g=-1/0,y=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var m=v+h;a<s?a<m&&m<s&&y.push(m):s<m&&m<a&&y.push(m)}for(var h=0;h<y.length;h++){var w=gL(r,t,e,n,i,y[h]);w<p&&(p=w),w>g&&(g=w)}return{x:l,y:p,width:u-l,height:g-p}}var pL=1e-4;function oT(r,t,e,n,i,a){var s=-1,o=1/0,l=[e,n],u=20;a&&a>200&&(u=a/10);for(var c=1/u,h=c/10,d=0;d<=u;d++){var f=d*c,v=[i.apply(void 0,xt([],q(r.concat([f])),!1)),i.apply(void 0,xt([],q(t.concat([f])),!1))],p=xi(l[0],l[1],v[0],v[1]);p<o&&(s=f,o=p)}if(s===0)return{x:r[0],y:t[0]};if(s===1){var g=r.length;return{x:r[g-1],y:t[g-1]}}o=1/0;for(var d=0;d<32&&!(h<pL);d++){var y=s-h,m=s+h,v=[i.apply(void 0,xt([],q(r.concat([y])),!1)),i.apply(void 0,xt([],q(t.concat([y])),!1))],p=xi(l[0],l[1],v[0],v[1]);if(y>=0&&p<o)s=y,o=p;else{var w=[i.apply(void 0,xt([],q(r.concat([m])),!1)),i.apply(void 0,xt([],q(t.concat([m])),!1))],E=xi(l[0],l[1],w[0],w[1]);m<=1&&E<o?(s=m,o=E):h*=.5}}return{x:i.apply(void 0,xt([],q(r.concat([s])),!1)),y:i.apply(void 0,xt([],q(t.concat([s])),!1))}}function lT(r,t,e,n){return xi(r,t,e,n)}function uT(r,t,e,n,i){return{x:(1-i)*r+i*e,y:(1-i)*t+i*n}}function yL(r,t,e,n,i,a){var s=[e-r,n-t];if(u3(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];o3(o,o);var l=[i-r,a-t];return Math.abs(l3(l,o))}function Wy(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 Mb(r,t,e,n){var i=-3*r+9*t-9*e+3*n,a=6*r-12*t+6*e,s=3*t-3*r,o=[],l,u,c;if(mo(i,0))mo(a,0)||(l=-s/a,l>=0&&l<=1&&o.push(l));else{var h=a*a-4*i*s;mo(h,0)?o.push(-a/(2*i)):h>0&&(c=Math.sqrt(h),l=(-a+c)/(2*i),u=(-a-c)/(2*i),l>=0&&l<=1&&o.push(l),u>=0&&u<=1&&o.push(u))}return o}function mL(r,t,e,n,i,a,s,o){for(var l=[r,s],u=[t,o],c=Mb(r,e,i,s),h=Mb(t,n,a,o),d=0;d<c.length;d++)l.push(Wy(r,e,i,s,c[d]));for(var d=0;d<h.length;d++)u.push(Wy(t,n,a,o,h[d]));return sT(l,u)}function bL(r,t,e,n,i,a,s,o,l,u,c){return oT([r,e,i,s],[t,n,a,o],l,u,Wy,c)}function kb(r,t,e,n,i,a,s,o,l,u,c){var h=bL(r,t,e,n,i,a,s,o,l,u,c);return xi(h.x,h.y,l,u)}function wL(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+=xi(n[0],n[1],i[0],i[1])}return t}function xL(r){return wL(r)}function Vy(r,t,e,n){var i=1-n;return i*i*r+2*n*i*t+n*n*e}function Ob(r,t,e){var n=r+e-2*t;if(mo(n,0))return[.5];var i=(r-t)/n;return i<=1&&i>=0?[i]:[]}function EL(r,t,e,n,i,a){var s=Ob(r,e,i)[0],o=Ob(t,n,a)[0],l=[r,i],u=[t,a];return s!==void 0&&l.push(Vy(r,e,i,s)),o!==void 0&&u.push(Vy(t,n,a,o)),sT(l,u)}function SL(r,t,e,n,i,a,s,o){return oT([r,e,i],[t,n,a],s,o,Vy)}function _L(r,t,e,n,i,a,s,o){var l=SL(r,t,e,n,i,a,s,o);return xi(l.x,l.y,s,o)}function wn(){wn=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(U,$,j){U[$]=j.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(U,$,j){return Object.defineProperty(U,$,{value:j,enumerable:!0,configurable:!0,writable:!0}),U[$]}try{u({},"")}catch{u=function(j,Z,nt){return j[Z]=nt}}function c(U,$,j,Z){var nt=$&&$.prototype instanceof y?$:y,st=Object.create(nt.prototype),ot=new G(Z||[]);return i(st,"_invoke",{value:N(U,j,ot)}),st}function h(U,$,j){try{return{type:"normal",arg:U.call($,j)}}catch(Z){return{type:"throw",arg:Z}}}t.wrap=c;var d="suspendedStart",f="suspendedYield",v="executing",p="completed",g={};function y(){}function m(){}function w(){}var E={};u(E,s,function(){return this});var _=Object.getPrototypeOf,k=_&&_(_(V([])));k&&k!==e&&n.call(k,s)&&(E=k);var T=w.prototype=y.prototype=Object.create(E);function O(U){["next","throw","return"].forEach(function($){u(U,$,function(j){return this._invoke($,j)})})}function P(U,$){function j(nt,st,ot,Pt){var K=h(U[nt],U,st);if(K.type!=="throw"){var W=K.arg,tt=W.value;return tt&&Qi(tt)=="object"&&n.call(tt,"__await")?$.resolve(tt.__await).then(function(ct){j("next",ct,ot,Pt)},function(ct){j("throw",ct,ot,Pt)}):$.resolve(tt).then(function(ct){W.value=ct,ot(W)},function(ct){return j("throw",ct,ot,Pt)})}Pt(K.arg)}var Z;i(this,"_invoke",{value:function(st,ot){function Pt(){return new $(function(K,W){j(st,ot,K,W)})}return Z=Z?Z.then(Pt,Pt):Pt()}})}function N(U,$,j){var Z=d;return function(nt,st){if(Z===v)throw Error("Generator is already running");if(Z===p){if(nt==="throw")throw st;return{value:r,done:!0}}for(j.method=nt,j.arg=st;;){var ot=j.delegate;if(ot){var Pt=C(ot,j);if(Pt){if(Pt===g)continue;return Pt}}if(j.method==="next")j.sent=j._sent=j.arg;else if(j.method==="throw"){if(Z===d)throw Z=p,j.arg;j.dispatchException(j.arg)}else j.method==="return"&&j.abrupt("return",j.arg);Z=v;var K=h(U,$,j);if(K.type==="normal"){if(Z=j.done?p:f,K.arg===g)continue;return{value:K.arg,done:j.done}}K.type==="throw"&&(Z=p,j.method="throw",j.arg=K.arg)}}}function C(U,$){var j=$.method,Z=U.iterator[j];if(Z===r)return $.delegate=null,j==="throw"&&U.iterator.return&&($.method="return",$.arg=r,C(U,$),$.method==="throw")||j!=="return"&&($.method="throw",$.arg=new TypeError("The iterator does not provide a '"+j+"' method")),g;var nt=h(Z,U.iterator,$.arg);if(nt.type==="throw")return $.method="throw",$.arg=nt.arg,$.delegate=null,g;var st=nt.arg;return st?st.done?($[U.resultName]=st.value,$.next=U.nextLoc,$.method!=="return"&&($.method="next",$.arg=r),$.delegate=null,g):st:($.method="throw",$.arg=new TypeError("iterator result is not an object"),$.delegate=null,g)}function L(U){var $={tryLoc:U[0]};1 in U&&($.catchLoc=U[1]),2 in U&&($.finallyLoc=U[2],$.afterLoc=U[3]),this.tryEntries.push($)}function B(U){var $=U.completion||{};$.type="normal",delete $.arg,U.completion=$}function G(U){this.tryEntries=[{tryLoc:"root"}],U.forEach(L,this),this.reset(!0)}function V(U){if(U||U===""){var $=U[s];if($)return $.call(U);if(typeof U.next=="function")return U;if(!isNaN(U.length)){var j=-1,Z=function nt(){for(;++j<U.length;)if(n.call(U,j))return nt.value=U[j],nt.done=!1,nt;return nt.value=r,nt.done=!0,nt};return Z.next=Z}}throw new TypeError(Qi(U)+" is not iterable")}return m.prototype=w,i(T,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:m,configurable:!0}),m.displayName=u(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(U){var $=typeof U=="function"&&U.constructor;return!!$&&($===m||($.displayName||$.name)==="GeneratorFunction")},t.mark=function(U){return Object.setPrototypeOf?Object.setPrototypeOf(U,w):(U.__proto__=w,u(U,l,"GeneratorFunction")),U.prototype=Object.create(T),U},t.awrap=function(U){return{__await:U}},O(P.prototype),u(P.prototype,o,function(){return this}),t.AsyncIterator=P,t.async=function(U,$,j,Z,nt){nt===void 0&&(nt=Promise);var st=new P(c(U,$,j,Z),nt);return t.isGeneratorFunction($)?st:st.next().then(function(ot){return ot.done?ot.value:st.next()})},O(T),u(T,l,"Generator"),u(T,s,function(){return this}),u(T,"toString",function(){return"[object Generator]"}),t.keys=function(U){var $=Object(U),j=[];for(var Z in $)j.push(Z);return j.reverse(),function nt(){for(;j.length;){var st=j.pop();if(st in $)return nt.value=st,nt.done=!1,nt}return nt.done=!0,nt}},t.values=V,G.prototype={constructor:G,reset:function($){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(B),!$)for(var j in this)j.charAt(0)==="t"&&n.call(this,j)&&!isNaN(+j.slice(1))&&(this[j]=r)},stop:function(){this.done=!0;var $=this.tryEntries[0].completion;if($.type==="throw")throw $.arg;return this.rval},dispatchException:function($){if(this.done)throw $;var j=this;function Z(W,tt){return ot.type="throw",ot.arg=$,j.next=W,tt&&(j.method="next",j.arg=r),!!tt}for(var nt=this.tryEntries.length-1;nt>=0;--nt){var st=this.tryEntries[nt],ot=st.completion;if(st.tryLoc==="root")return Z("end");if(st.tryLoc<=this.prev){var Pt=n.call(st,"catchLoc"),K=n.call(st,"finallyLoc");if(Pt&&K){if(this.prev<st.catchLoc)return Z(st.catchLoc,!0);if(this.prev<st.finallyLoc)return Z(st.finallyLoc)}else if(Pt){if(this.prev<st.catchLoc)return Z(st.catchLoc,!0)}else{if(!K)throw Error("try statement without catch or finally");if(this.prev<st.finallyLoc)return Z(st.finallyLoc)}}}},abrupt:function($,j){for(var Z=this.tryEntries.length-1;Z>=0;--Z){var nt=this.tryEntries[Z];if(nt.tryLoc<=this.prev&&n.call(nt,"finallyLoc")&&this.prev<nt.finallyLoc){var st=nt;break}}st&&($==="break"||$==="continue")&&st.tryLoc<=j&&j<=st.finallyLoc&&(st=null);var ot=st?st.completion:{};return ot.type=$,ot.arg=j,st?(this.method="next",this.next=st.finallyLoc,g):this.complete(ot)},complete:function($,j){if($.type==="throw")throw $.arg;return $.type==="break"||$.type==="continue"?this.next=$.arg:$.type==="return"?(this.rval=this.arg=$.arg,this.method="return",this.next="end"):$.type==="normal"&&j&&(this.next=j),g},finish:function($){for(var j=this.tryEntries.length-1;j>=0;--j){var Z=this.tryEntries[j];if(Z.finallyLoc===$)return this.complete(Z.completion,Z.afterLoc),B(Z),g}},catch:function($){for(var j=this.tryEntries.length-1;j>=0;--j){var Z=this.tryEntries[j];if(Z.tryLoc===$){var nt=Z.completion;if(nt.type==="throw"){var st=nt.arg;B(Z)}return st}}throw Error("illegal catch attempt")},delegateYield:function($,j,Z){return this.delegate={iterator:V($),resultName:j,nextLoc:Z},this.method==="next"&&(this.arg=r),g}},t}function Tb(r,t,e,n,i,a,s){try{var o=r[a](s),l=o.value}catch(u){return void e(u)}o.done?t(l):Promise.resolve(l).then(n,i)}function na(r){return function(){var t=this,e=arguments;return new Promise(function(n,i){var a=r.apply(t,e);function s(l){Tb(a,n,i,s,o,"next",l)}function o(l){Tb(a,n,i,s,o,"throw",l)}s(void 0)})}}function wa(r,t){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=qm(r))||t){e&&(r=e);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){e=e.call(r)},n:function(){var u=e.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||e.return==null||e.return()}finally{if(o)throw a}}}}function ML(r,t){if(r==null)return{};var e={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(t.indexOf(n)!==-1)continue;e[n]=r[n]}return e}function qa(r,t){if(r==null)return{};var e,n,i=ML(r,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(n=0;n<a.length;n++)e=a[n],t.indexOf(e)===-1&&{}.propertyIsEnumerable.call(r,e)&&(i[e]=r[e])}return i}var kL=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},cT={exports:{}};(function(r,t){(function(e,n){r.exports=n()})(kL,function(){function e(_,k,T,O,P){n(_,k,T||0,O||_.length-1,P||a)}function n(_,k,T,O,P){for(;O>T;){if(O-T>600){var N=O-T+1,C=k-T+1,L=Math.log(N),B=.5*Math.exp(2*L/3),G=.5*Math.sqrt(L*B*(N-B)/N)*(C-N/2<0?-1:1),V=Math.max(T,Math.floor(k-C*B/N+G)),U=Math.min(O,Math.floor(k+(N-C)*B/N+G));n(_,k,V,U,P)}var $=_[k],j=T,Z=O;for(i(_,T,k),P(_[O],$)>0&&i(_,T,O);j<Z;){for(i(_,j,Z),j++,Z--;P(_[j],$)<0;)j++;for(;P(_[Z],$)>0;)Z--}P(_[T],$)===0?i(_,T,Z):(Z++,i(_,Z,O)),Z<=k&&(T=Z+1),k<=Z&&(O=Z-1)}}function i(_,k,T){var O=_[k];_[k]=_[T],_[T]=O}function a(_,k){return _<k?-1:_>k?1:0}var s=function(k){k===void 0&&(k=9),this._maxEntries=Math.max(4,k),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(k){var T=this.data,O=[];if(!m(k,T))return O;for(var P=this.toBBox,N=[];T;){for(var C=0;C<T.children.length;C++){var L=T.children[C],B=T.leaf?P(L):L;m(k,B)&&(T.leaf?O.push(L):y(k,B)?this._all(L,O):N.push(L))}T=N.pop()}return O},s.prototype.collides=function(k){var T=this.data;if(!m(k,T))return!1;for(var O=[];T;){for(var P=0;P<T.children.length;P++){var N=T.children[P],C=T.leaf?this.toBBox(N):N;if(m(k,C)){if(T.leaf||y(k,C))return!0;O.push(N)}}T=O.pop()}return!1},s.prototype.load=function(k){if(!(k&&k.length))return this;if(k.length<this._minEntries){for(var T=0;T<k.length;T++)this.insert(k[T]);return this}var O=this._build(k.slice(),0,k.length-1,0);if(!this.data.children.length)this.data=O;else if(this.data.height===O.height)this._splitRoot(this.data,O);else{if(this.data.height<O.height){var P=this.data;this.data=O,O=P}this._insert(O,this.data.height-O.height-1,!0)}return this},s.prototype.insert=function(k){return k&&this._insert(k,this.data.height-1),this},s.prototype.clear=function(){return this.data=w([]),this},s.prototype.remove=function(k,T){if(!k)return this;for(var O=this.data,P=this.toBBox(k),N=[],C=[],L,B,G;O||N.length;){if(O||(O=N.pop(),B=N[N.length-1],L=C.pop(),G=!0),O.leaf){var V=o(k,O.children,T);if(V!==-1)return O.children.splice(V,1),N.push(O),this._condense(N),this}!G&&!O.leaf&&y(O,P)?(N.push(O),C.push(L),L=0,B=O,O=O.children[0]):B?(L++,O=B.children[L],G=!1):O=null}return this},s.prototype.toBBox=function(k){return k},s.prototype.compareMinX=function(k,T){return k.minX-T.minX},s.prototype.compareMinY=function(k,T){return k.minY-T.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(k){return this.data=k,this},s.prototype._all=function(k,T){for(var O=[];k;)k.leaf?T.push.apply(T,k.children):O.push.apply(O,k.children),k=O.pop();return T},s.prototype._build=function(k,T,O,P){var N=O-T+1,C=this._maxEntries,L;if(N<=C)return L=w(k.slice(T,O+1)),l(L,this.toBBox),L;P||(P=Math.ceil(Math.log(N)/Math.log(C)),C=Math.ceil(N/Math.pow(C,P-1))),L=w([]),L.leaf=!1,L.height=P;var B=Math.ceil(N/C),G=B*Math.ceil(Math.sqrt(C));E(k,T,O,G,this.compareMinX);for(var V=T;V<=O;V+=G){var U=Math.min(V+G-1,O);E(k,V,U,B,this.compareMinY);for(var $=V;$<=U;$+=B){var j=Math.min($+B-1,U);L.children.push(this._build(k,$,j,P-1))}}return l(L,this.toBBox),L},s.prototype._chooseSubtree=function(k,T,O,P){for(;P.push(T),!(T.leaf||P.length-1===O);){for(var N=1/0,C=1/0,L=void 0,B=0;B<T.children.length;B++){var G=T.children[B],V=f(G),U=p(k,G)-V;U<C?(C=U,N=V<N?V:N,L=G):U===C&&V<N&&(N=V,L=G)}T=L||T.children[0]}return T},s.prototype._insert=function(k,T,O){var P=O?k:this.toBBox(k),N=[],C=this._chooseSubtree(P,this.data,T,N);for(C.children.push(k),c(C,P);T>=0&&N[T].children.length>this._maxEntries;)this._split(N,T),T--;this._adjustParentBBoxes(P,N,T)},s.prototype._split=function(k,T){var O=k[T],P=O.children.length,N=this._minEntries;this._chooseSplitAxis(O,N,P);var C=this._chooseSplitIndex(O,N,P),L=w(O.children.splice(C,O.children.length-C));L.height=O.height,L.leaf=O.leaf,l(O,this.toBBox),l(L,this.toBBox),T?k[T-1].children.push(L):this._splitRoot(O,L)},s.prototype._splitRoot=function(k,T){this.data=w([k,T]),this.data.height=k.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(k,T,O){for(var P,N=1/0,C=1/0,L=T;L<=O-T;L++){var B=u(k,0,L,this.toBBox),G=u(k,L,O,this.toBBox),V=g(B,G),U=f(B)+f(G);V<N?(N=V,P=L,C=U<C?U:C):V===N&&U<C&&(C=U,P=L)}return P||O-T},s.prototype._chooseSplitAxis=function(k,T,O){var P=k.leaf?this.compareMinX:h,N=k.leaf?this.compareMinY:d,C=this._allDistMargin(k,T,O,P),L=this._allDistMargin(k,T,O,N);C<L&&k.children.sort(P)},s.prototype._allDistMargin=function(k,T,O,P){k.children.sort(P);for(var N=this.toBBox,C=u(k,0,T,N),L=u(k,O-T,O,N),B=v(C)+v(L),G=T;G<O-T;G++){var V=k.children[G];c(C,k.leaf?N(V):V),B+=v(C)}for(var U=O-T-1;U>=T;U--){var $=k.children[U];c(L,k.leaf?N($):$),B+=v(L)}return B},s.prototype._adjustParentBBoxes=function(k,T,O){for(var P=O;P>=0;P--)c(T[P],k)},s.prototype._condense=function(k){for(var T=k.length-1,O=void 0;T>=0;T--)k[T].children.length===0?T>0?(O=k[T-1].children,O.splice(O.indexOf(k[T]),1)):this.clear():l(k[T],this.toBBox)};function o(_,k,T){if(!T)return k.indexOf(_);for(var O=0;O<k.length;O++)if(T(_,k[O]))return O;return-1}function l(_,k){u(_,0,_.children.length,k,_)}function u(_,k,T,O,P){P||(P=w(null)),P.minX=1/0,P.minY=1/0,P.maxX=-1/0,P.maxY=-1/0;for(var N=k;N<T;N++){var C=_.children[N];c(P,_.leaf?O(C):C)}return P}function c(_,k){return _.minX=Math.min(_.minX,k.minX),_.minY=Math.min(_.minY,k.minY),_.maxX=Math.max(_.maxX,k.maxX),_.maxY=Math.max(_.maxY,k.maxY),_}function h(_,k){return _.minX-k.minX}function d(_,k){return _.minY-k.minY}function f(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function v(_){return _.maxX-_.minX+(_.maxY-_.minY)}function p(_,k){return(Math.max(k.maxX,_.maxX)-Math.min(k.minX,_.minX))*(Math.max(k.maxY,_.maxY)-Math.min(k.minY,_.minY))}function g(_,k){var T=Math.max(_.minX,k.minX),O=Math.max(_.minY,k.minY),P=Math.min(_.maxX,k.maxX),N=Math.min(_.maxY,k.maxY);return Math.max(0,P-T)*Math.max(0,N-O)}function y(_,k){return _.minX<=k.minX&&_.minY<=k.minY&&k.maxX<=_.maxX&&k.maxY<=_.maxY}function m(_,k){return k.minX<=_.maxX&&k.minY<=_.maxY&&k.maxX>=_.minX&&k.maxY>=_.minY}function w(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function E(_,k,T,O,P){for(var N=[k,T];N.length;)if(T=N.pop(),k=N.pop(),!(T-k<=O)){var C=k+Math.ceil((T-k)/O/2)*O;e(_,C,k,T,P),N.push(k,C,C,T)}}return s})})(cT);var OL=cT.exports,rt=function(r){return r.GROUP="g",r.FRAGMENT="fragment",r.CIRCLE="circle",r.ELLIPSE="ellipse",r.IMAGE="image",r.RECT="rect",r.LINE="line",r.POLYLINE="polyline",r.POLYGON="polygon",r.TEXT="text",r.PATH="path",r.HTML="html",r.MESH="mesh",r}({}),bu=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),aa=function(){function r(){ht(this,r),this.plugins=[]}return dt(r,[{key:"addRenderingPlugin",value:function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)}},{key:"removeAllRenderingPlugins",value:function(){var e=this;this.plugins.forEach(function(n){var i=e.context.renderingPlugins.indexOf(n);i>=0&&e.context.renderingPlugins.splice(i,1)})}}])}(),TL=function(){function r(t){ht(this,r),this.clipSpaceNearZ=bu.NEGATIVE_ONE,this.plugins=[],this.config=$t({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return dt(r,[{key:"registerPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n===-1&&this.plugins.push(e)}},{key:"unregisterPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n>-1&&this.plugins.splice(n,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(e){return this.plugins.find(function(n){return n.name===e})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(e){Object.assign(this.config,e)}}])}(),Zh=Xi,es=Jr,AL=XR,PL=HR,Ab=Au,Jh=QR,ge=function(){function r(){ht(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return dt(r,[{key:"update",value:function(e,n){es(this.center,e),es(this.halfExtents,n),Jh(this.min,this.center,this.halfExtents),Zh(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){Zh(this.center,n,e),Ab(this.center,this.center,.5),Jh(this.halfExtents,n,e),Ab(this.halfExtents,this.halfExtents,.5),es(this.min,e),es(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!r.isEmpty(e)){if(r.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,l=o[0],u=o[1],c=o[2],h=i-l,d=i+l,f=a-u,v=a+u,p=s-c,g=s+c,y=e.center,m=y[0],w=y[1],E=y[2],_=e.halfExtents,k=_[0],T=_[1],O=_[2],P=m-k,N=m+k,C=w-T,L=w+T,B=E-O,G=E+O;P<h&&(h=P),N>d&&(d=N),C<f&&(f=C),L>v&&(v=L),B<p&&(p=B),G>g&&(g=G),n[0]=(h+d)*.5,n[1]=(f+v)*.5,n[2]=(p+g)*.5,o[0]=(d-h)*.5,o[1]=(v-f)*.5,o[2]=(g-p)*.5,this.min[0]=h,this.min[1]=f,this.min[2]=p,this.max[0]=d,this.max[1]=v,this.max[2]=g}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,l=n[0],u=n[4],c=n[8],h=n[1],d=n[5],f=n[9],v=n[2],p=n[6],g=n[10],y=Math.abs(l),m=Math.abs(u),w=Math.abs(c),E=Math.abs(h),_=Math.abs(d),k=Math.abs(f),T=Math.abs(v),O=Math.abs(p),P=Math.abs(g);i[0]=n[12]+l*s[0]+u*s[1]+c*s[2],i[1]=n[13]+h*s[0]+d*s[1]+f*s[2],i[2]=n[14]+v*s[0]+p*s[1]+g*s[2],a[0]=y*o[0]+m*o[1]+w*o[2],a[1]=E*o[0]+_*o[1]+k*o[2],a[2]=T*o[0]+O*o[1]+P*o[2],Jh(this.min,i,a),Zh(this.max,i,a)}},{key:"intersects",value:function(e){var n=this.getMax(),i=this.getMin(),a=e.getMax(),s=e.getMin();return i[0]<=a[0]&&n[0]>=s[0]&&i[1]<=a[1]&&n[1]>=s[1]&&i[2]<=a[2]&&n[2]>=s[2]}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new r,i=AL([0,0,0],this.getMin(),e.getMin()),a=PL([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?es([0,0,0],this.min):e.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:e.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(e){return e.pnVertexFlag===273?es([0,0,0],this.max):e.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:e.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]}}],[{key:"isEmpty",value:function(e){return!e||e.halfExtents[0]===0&&e.halfExtents[1]===0&&e.halfExtents[2]===0}}])}(),NL=function(){function r(t,e){ht(this,r),this.distance=t||0,this.normal=e||ye(0,1,0),this.updatePNVertexFlag()}return dt(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(e){return Qr(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/UO(this.normal);Au(this.normal,this.normal,e),this.distance*=e}},{key:"intersectsLine",value:function(e,n,i){var a=this.distanceToPoint(e),s=this.distanceToPoint(n),o=a/(a-s),l=o>=0&&o<=1;return l&&i&&Iy(i,e,n,o),l}}])}(),ns=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),CL=function(){function r(t){if(ht(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new NL)}return dt(r,[{key:"extractFromVPMatrix",value:function(e){var n=jt(e,16),i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=n[5],c=n[6],h=n[7],d=n[8],f=n[9],v=n[10],p=n[11],g=n[12],y=n[13],m=n[14],w=n[15];Tn(this.planes[0].normal,o-i,h-l,p-d),this.planes[0].distance=w-g,Tn(this.planes[1].normal,o+i,h+l,p+d),this.planes[1].distance=w+g,Tn(this.planes[2].normal,o+a,h+u,p+f),this.planes[2].distance=w+y,Tn(this.planes[3].normal,o-a,h-u,p-f),this.planes[3].distance=w-y,Tn(this.planes[4].normal,o-s,h-c,p-v),this.planes[4].distance=w-m,Tn(this.planes[5].normal,o+s,h+c,p+v),this.planes[5].distance=w+m,this.planes.forEach(function(E){E.normalize(),E.updatePNVertexFlag()})}}])}(),mn=function(){function r(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;ht(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return dt(r,[{key:"clone",value:function(){return new r(this.x,this.y)}},{key:"copyFrom",value:function(e){this.x=e.x,this.y=e.y}}])}(),ks=function(){function r(t,e,n,i){ht(this,r),this.x=t,this.y=e,this.width=n,this.height=i,this.left=t,this.right=t+n,this.top=e,this.bottom=e+i}return dt(r,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new r(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var i=ao(e.x,e.y,0,1),a=ao(e.x+e.width,e.y,0,1),s=ao(e.x,e.y+e.height,0,1),o=ao(e.x+e.width,e.y+e.height,0,1),l=ti(),u=ti(),c=ti(),h=ti();bi(l,i,n),bi(u,a,n),bi(c,s,n),bi(h,o,n);var d=Math.min(l[0],u[0],c[0],h[0]),f=Math.min(l[1],u[1],c[1],h[1]),v=Math.max(l[0],u[0],c[0],h[0]),p=Math.max(l[1],u[1],c[1],h[1]);return r.fromRect({x:d,y:f,width:v-d,height:p-f})}}])}(),ie="Method not implemented.",rs="Use document.documentElement instead.",RL="Cannot append a destroyed element.";function ms(r){return r===void 0?0:r>360||r<-360?r%360:r}var Qh=Zt();function Cn(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(r)&&r.length===3?n?di(r):Jr(Qh,r):St(r)?n?ye(r,t,e):Tn(Qh,r,t,e):n?ye(r[0],r[1]||t,r[2]||e):Tn(Qh,r[0],r[1]||t,r[2]||e)}var LL=Math.PI/180;function ae(r){return r*LL}var IL=180/Math.PI;function Vn(r){return r*IL}function DL(r){return 360*r}var Du=Math.PI/2;function BL(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,l=i*i,u=a*a,c=s+o+l+u,h=e*a-n*i;return h>.499995*c?(r[0]=Du,r[1]=2*Math.atan2(n,e),r[2]=0):h<-.499995*c?(r[0]=-Du,r[1]=2*Math.atan2(n,e),r[2]=0):(r[0]=Math.asin(2*(e*i-a*n)),r[1]=Math.atan2(2*(e*a+n*i),1-2*(l+u)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+l))),r}function FL(r,t){var e,n,i=_s(Zt(),t),a=jt(i,3),s=a[0],o=a[1],l=a[2],u=Math.asin(-t[2]/s);return u<Du?u>-Du?(e=Math.atan2(t[6]/o,t[10]/l),n=Math.atan2(t[1]/s,t[0]/s)):(n=0,e=-Math.atan2(t[4]/o,t[5]/o)):(n=0,e=Math.atan2(t[4]/o,t[5]/o)),r[0]=e,r[1]=u,r[2]=n,r}function td(r,t){return t.length===16?FL(r,t):BL(r,t)}function zL(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return TR(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function jL(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,l=2*a,u=e-t,c=n-i,h=l/u,d=l/c,f=(e+t)/u,v=(n+i)/c,p,g,y=s-a,m=s*a;return o?(p=-s/y,g=-m/y):(p=-(s+a)/y,g=-2*m/y),r[0]=h,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=f,r[9]=v,r[10]=p,r[11]=-1,r[12]=0,r[13]=0,r[14]=g,r[15]=0,r}function Pb(r){var t=r[0],e=r[1],n=r[3],i=r[4],a=Math.sqrt(t*t+e*e),s=Math.sqrt(n*n+i*i),o=t*i-e*n;if(o<0&&(t<i?a=-a:s=-s),a){var l=1/a;t*=l,e*=l}if(s){var u=1/s;n*=u,i*=u}var c=Math.atan2(e,t),h=Vn(c);return[r[6],r[7],a,s,h]}var Ur=fe(),Or=fe(),Hs=ti(),It=[Zt(),Zt(),Zt()],Nb=Zt();function qL(r,t,e,n,i,a){if(!$L(Ur,r)||(Ss(Or,Ur),Or[3]=0,Or[7]=0,Or[11]=0,Or[15]=1,Math.abs(NO(Or))<1e-8))return!1;var s=Ur[3],o=Ur[7],l=Ur[11],u=Ur[12],c=Ur[13],h=Ur[14],d=Ur[15];if(s!==0||o!==0||l!==0){Hs[0]=s,Hs[1]=o,Hs[2]=l,Hs[3]=d;var f=Zr(Or,Or);if(!f)return!1;PO(Or,Or),bi(i,Hs,Or)}else i[0]=i[1]=i[2]=0,i[3]=1;if(t[0]=u,t[1]=c,t[2]=h,GL(It,Ur),e[0]=gi(It[0]),ka(It[0],It[0]),n[0]=Qr(It[0],It[1]),ed(It[1],It[1],It[0],1,-n[0]),e[1]=gi(It[1]),ka(It[1],It[1]),n[0]/=e[1],n[1]=Qr(It[0],It[2]),ed(It[2],It[2],It[0],1,-n[1]),n[2]=Qr(It[1],It[2]),ed(It[2],It[2],It[1],1,-n[2]),e[2]=gi(It[2]),ka(It[2],It[2]),n[1]/=e[2],n[2]/=e[2],yu(Nb,It[1],It[2]),Qr(It[0],Nb)<0)for(var v=0;v<3;v++)e[v]*=-1,It[v][0]*=-1,It[v][1]*=-1,It[v][2]*=-1;return a[0]=.5*Math.sqrt(Math.max(1+It[0][0]-It[1][1]-It[2][2],0)),a[1]=.5*Math.sqrt(Math.max(1-It[0][0]+It[1][1]-It[2][2],0)),a[2]=.5*Math.sqrt(Math.max(1-It[0][0]-It[1][1]+It[2][2],0)),a[3]=.5*Math.sqrt(Math.max(1+It[0][0]+It[1][1]+It[2][2],0)),It[2][1]>It[1][2]&&(a[0]=-a[0]),It[0][2]>It[2][0]&&(a[1]=-a[1]),It[1][0]>It[0][1]&&(a[2]=-a[2]),!0}function $L(r,t){var e=t[15];if(e===0)return!1;for(var n=1/e,i=0;i<16;i++)r[i]=t[i]*n;return!0}function GL(r,t){r[0][0]=t[0],r[0][1]=t[1],r[0][2]=t[2],r[1][0]=t[4],r[1][1]=t[5],r[1][2]=t[6],r[2][0]=t[8],r[2][1]=t[9],r[2][2]=t[10]}function ed(r,t,e,n,i){r[0]=t[0]*n+e[0]*i,r[1]=t[1]*n+e[1]*i,r[2]=t[2]*n+e[2]*i}var re=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),Uy=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),mr=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),hT={UPDATED:"updated"},Cb=2e-4,dT=function(){function r(){ht(this,r),this.clipSpaceNearZ=bu.NEGATIVE_ONE,this.eventEmitter=new kO,this.matrix=fe(),this.right=ye(1,0,0),this.up=ye(0,1,0),this.forward=ye(0,0,1),this.position=ye(0,0,1),this.focalPoint=ye(0,0,0),this.distanceVector=ye(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=fe(),this.projectionMatrixInverse=fe(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=re.EXPLORING,this.trackingMode=Uy.DEFAULT,this.projectionMode=mr.PERSPECTIVE,this.frustum=new CL,this.orthoMatrix=fe()}return dt(r,[{key:"isOrtho",value:function(){return this.projectionMode===mr.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(e){this.enableUpdate=e}},{key:"setType",value:function(e,n){return this.type=e,this.type===re.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===re.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(e){return this.projectionMode=e,this}},{key:"setTrackingMode",value:function(e){if(this.type!==re.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this}},{key:"setWorldRotation",value:function(e){return this.rotateWorld=e,this._getAngles(),this}},{key:"getViewTransform",value:function(){return Zr(fe(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=zi(fe(),[e,n,0]);this.jitteredProjectionMatrix=An(fe(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(e){return this.matrix=e,this._update(),this}},{key:"setProjectionMatrix",value:function(e){this.projectionMatrix=e}},{key:"setFov",value:function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this}},{key:"setAspect",value:function(e){return this.setPerspective(this.near,this.far,this.fov,e),this}},{key:"setNear",value:function(e){return this.projectionMode===mr.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this}},{key:"setFar",value:function(e){return this.projectionMode===mr.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this}},{key:"setViewOffset",value:function(e,n,i,a,s,o){return this.aspect=e/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.projectionMode===mr.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===mr.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(e){return this.zoom=e,this.projectionMode===mr.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===mr.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(e,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(e),this.rotate(0,0,o);var l=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),u=l.x,c=l.y,h=ye(u-a,c-s,0),d=Qr(h,this.right)/gi(this.right),f=Qr(h,this.up)/gi(this.up),v=this.getPosition(),p=jt(v,2),g=p[0],y=p[1],m=this.getFocalPoint(),w=jt(m,2),E=w[0],_=w[1];return this.setPosition(g-d,y-f),this.setFocalPoint(E-d,_-f),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=mr.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(ae(.5*this.fov))/this.zoom,l=2*o,u=this.aspect*l,c=-.5*u;if((s=this.view)!==null&&s!==void 0&&s.enabled){var h=this.view.fullWidth,d=this.view.fullHeight;c+=this.view.offsetX*u/h,o-=this.view.offsetY*l/d,u*=this.view.width/h,l*=this.view.height/d}return jL(this.projectionMatrix,c,c+u,o-l,o,e,this.far,this.clipSpaceNearZ===bu.ZERO),Zr(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var l;this.projectionMode=mr.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var u=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),h=(this.rright+this.left)/2,d=(this.top+this.bottom)/2,f=h-u,v=h+u,p=d+c,g=d-c;if((l=this.view)!==null&&l!==void 0&&l.enabled){var y=(this.rright-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;f+=y*this.view.offsetX,v=f+y*this.view.width,p-=m*this.view.offsetY,g=p-m*this.view.height}return this.clipSpaceNearZ===bu.NEGATIVE_ONE?qO(this.projectionMatrix,f,v,p,g,s,o):$O(this.projectionMatrix,f,v,p,g,s,o),Zr(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=Cn(e,n,i);return this._setPosition(a),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],a=ye(0,1,0);if(this.focalPoint=Cn(e,n,i),this.trackingMode===Uy.CINEMATIC){var s=Ly(Zt(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=gi(s),l=Vn(Math.asin(n/o)),u=90+Vn(Math.atan2(i,e)),c=fe();LO(c,c,ae(u)),RO(c,c,ae(l)),a=Pn(Zt(),[0,1,0],c)}return Zr(this.matrix,GO(fe(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance<Cb&&(this.distance=Cb),this.dollyingStep=this.distance/100;var n=Zt();e=this.distance;var i=this.forward,a=this.focalPoint;return n[0]=e*i[0]+a[0],n[1]=e*i[1]+a[1],n[2]=e*i[2]+a[2],this._setPosition(n),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(e){return this.maxDistance=e,this}},{key:"setMinDistance",value:function(e){return this.minDistance=e,this}},{key:"setAzimuth",value:function(e){return this.azimuth=ms(e),this.computeMatrix(),this._getAxes(),this.type===re.ORBITING||this.type===re.EXPLORING?this._getPosition():this.type===re.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(e){return this.elevation=ms(e),this.computeMatrix(),this._getAxes(),this.type===re.ORBITING||this.type===re.EXPLORING?this._getPosition():this.type===re.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(e){return this.roll=ms(e),this.computeMatrix(),this._getAxes(),this.type===re.ORBITING||this.type===re.EXPLORING?this._getPosition():this.type===re.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var e=qi(nn(),[0,0,1],ae(this.roll));ta(this.matrix);var n=qi(nn(),[1,0,0],ae((this.rotateWorld&&this.type!==re.TRACKING||this.type===re.TRACKING?1:-1)*this.elevation)),i=qi(nn(),[0,1,0],ae((this.rotateWorld&&this.type!==re.TRACKING||this.type===re.TRACKING?1:-1)*this.azimuth)),a=Ki(nn(),i,n);a=Ki(nn(),a,e);var s=$m(fe(),a);this.type===re.ORBITING||this.type===re.EXPLORING?(ys(this.matrix,this.matrix,this.focalPoint),An(this.matrix,this.matrix,s),ys(this.matrix,this.matrix,[0,0,this.distance])):this.type===re.TRACKING&&(ys(this.matrix,this.matrix,this.position),An(this.matrix,this.matrix,s))}},{key:"_setPosition",value:function(e,n,i){this.position=Cn(e,n,i);var a=this.matrix;a[12]=this.position[0],a[13]=this.position[1],a[14]=this.position[2],a[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){Jr(this.right,Cn(bi(ti(),[1,0,0,0],this.matrix))),Jr(this.up,Cn(bi(ti(),[0,1,0,0],this.matrix))),Jr(this.forward,Cn(bi(ti(),[0,0,1,0],this.matrix))),ka(this.right,this.right),ka(this.up,this.up),ka(this.forward,this.forward)}},{key:"_getAngles",value:function(){var e=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=gi(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===re.TRACKING?(this.elevation=Vn(Math.asin(n/a)),this.azimuth=Vn(Math.atan2(-e,-i))):this.rotateWorld?(this.elevation=Vn(Math.asin(n/a)),this.azimuth=Vn(Math.atan2(-e,-i))):(this.elevation=-Vn(Math.asin(n/a)),this.azimuth=-Vn(Math.atan2(-e,-i)))}},{key:"_getPosition",value:function(){Jr(this.position,Cn(bi(ti(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){ZR(this.distanceVector,[0,0,-this.distance],OR(OO(),this.matrix)),Xi(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=Ly(Zt(),this.focalPoint,this.position),this.distance=gi(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===mr.ORTHOGRAPHIC){var e=this.position,n=qi(nn(),[0,0,1],-this.roll*Math.PI/180);yo(this.orthoMatrix,n,ye((this.rright-this.left)/2-e[0],(this.top-this.bottom)/2-e[1],0),ye(this.zoom,this.zoom,1),e)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var e=this.getViewTransform(),n=An(fe(),this.getPerspective(),e);this.getFrustum().extractFromVPMatrix(n),this.eventEmitter.emit(hT.UPDATED)}}},{key:"rotate",value:function(e,n,i){throw new Error(ie)}},{key:"pan",value:function(e,n){throw new Error(ie)}},{key:"dolly",value:function(e){throw new Error(ie)}},{key:"createLandmark",value:function(e,n){throw new Error(ie)}},{key:"gotoLandmark",value:function(e,n){throw new Error(ie)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(ie)}}])}(),WL=function(r){return r[r.Standard=0]="Standard",r}({}),Bu=function(r){return r[r.ADDED=0]="ADDED",r[r.REMOVED=1]="REMOVED",r[r.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",r}({}),fT={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new ks(0,0,0,0)},bt=function(r){return r.COORDINATE="<coordinate>",r.COLOR="<color>",r.PAINT="<paint>",r.NUMBER="<number>",r.ANGLE="<angle>",r.OPACITY_VALUE="<opacity-value>",r.SHADOW_BLUR="<shadow-blur>",r.LENGTH="<length>",r.PERCENTAGE="<percentage>",r.LENGTH_PERCENTAGE="<length> | <percentage>",r.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",r.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",r.LIST_OF_POINTS="<list-of-points>",r.PATH="<path>",r.FILTER="<filter>",r.Z_INDEX="<z-index>",r.OFFSET_DISTANCE="<offset-distance>",r.DEFINED_PATH="<defined-path>",r.MARKER="<marker>",r.TRANSFORM="<transform>",r.TRANSFORM_ORIGIN="<transform-origin>",r.TEXT="<text>",r.TEXT_TRANSFORM="<text-transform>",r}({});function Um(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function gT(r,t){var e=Object.create(r.prototype);for(var n in t)e[n]=t[n];return e}function Uo(){}var To=.7,Fu=1/To,bs="\\s*([+-]?\\d+)\\s*",Ao="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ei="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",VL=/^#([0-9a-f]{3,8})$/,UL=new RegExp(`^rgb\\(${bs},${bs},${bs}\\)$`),YL=new RegExp(`^rgb\\(${ei},${ei},${ei}\\)$`),HL=new RegExp(`^rgba\\(${bs},${bs},${bs},${Ao}\\)$`),XL=new RegExp(`^rgba\\(${ei},${ei},${ei},${Ao}\\)$`),KL=new RegExp(`^hsl\\(${Ao},${ei},${ei}\\)$`),ZL=new RegExp(`^hsla\\(${Ao},${ei},${ei},${Ao}\\)$`),Rb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Um(Uo,hc,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:Lb,formatHex:Lb,formatHex8:JL,formatHsl:QL,formatRgb:Ib,toString:Ib});function Lb(){return this.rgb().formatHex()}function JL(){return this.rgb().formatHex8()}function QL(){return vT(this).formatHsl()}function Ib(){return this.rgb().formatRgb()}function hc(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=VL.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?Db(t):e===3?new Hn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Sl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Sl(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=UL.exec(r))?new Hn(t[1],t[2],t[3],1):(t=YL.exec(r))?new Hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=HL.exec(r))?Sl(t[1],t[2],t[3],t[4]):(t=XL.exec(r))?Sl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=KL.exec(r))?zb(t[1],t[2]/100,t[3]/100,1):(t=ZL.exec(r))?zb(t[1],t[2]/100,t[3]/100,t[4]):Rb.hasOwnProperty(r)?Db(Rb[r]):r==="transparent"?new Hn(NaN,NaN,NaN,0):null}function Db(r){return new Hn(r>>16&255,r>>8&255,r&255,1)}function Sl(r,t,e,n){return n<=0&&(r=t=e=NaN),new Hn(r,t,e,n)}function tI(r){return r instanceof Uo||(r=hc(r)),r?(r=r.rgb(),new Hn(r.r,r.g,r.b,r.opacity)):new Hn}function eI(r,t,e,n){return arguments.length===1?tI(r):new Hn(r,t,e,n==null?1:n)}function Hn(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}Um(Hn,eI,gT(Uo,{brighter(r){return r=r==null?Fu:Math.pow(Fu,r),new Hn(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?To:Math.pow(To,r),new Hn(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Hn(Oa(this.r),Oa(this.g),Oa(this.b),zu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Bb,formatHex:Bb,formatHex8:nI,formatRgb:Fb,toString:Fb}));function Bb(){return`#${Ea(this.r)}${Ea(this.g)}${Ea(this.b)}`}function nI(){return`#${Ea(this.r)}${Ea(this.g)}${Ea(this.b)}${Ea((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fb(){const r=zu(this.opacity);return`${r===1?"rgb(":"rgba("}${Oa(this.r)}, ${Oa(this.g)}, ${Oa(this.b)}${r===1?")":`, ${r})`}`}function zu(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Oa(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ea(r){return r=Oa(r),(r<16?"0":"")+r.toString(16)}function zb(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new Nr(r,t,e,n)}function vT(r){if(r instanceof Nr)return new Nr(r.h,r.s,r.l,r.opacity);if(r instanceof Uo||(r=hc(r)),!r)return new Nr;if(r instanceof Nr)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),s=NaN,o=a-i,l=(a+i)/2;return o?(t===a?s=(e-n)/o+(e<n)*6:e===a?s=(n-t)/o+2:s=(t-e)/o+4,o/=l<.5?a+i:2-a-i,s*=60):o=l>0&&l<1?0:s,new Nr(s,o,l,r.opacity)}function rI(r,t,e,n){return arguments.length===1?vT(r):new Nr(r,t,e,n==null?1:n)}function Nr(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}Um(Nr,rI,gT(Uo,{brighter(r){return r=r==null?Fu:Math.pow(Fu,r),new Nr(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?To:Math.pow(To,r),new Nr(this.h,this.s,this.l*r,this.opacity)},rgb(){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 Hn(nd(r>=240?r-240:r+120,i,n),nd(r,i,n),nd(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new Nr(jb(this.h),_l(this.s),_l(this.l),zu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=zu(this.opacity);return`${r===1?"hsl(":"hsla("}${jb(this.h)}, ${_l(this.s)*100}%, ${_l(this.l)*100}%${r===1?")":`, ${r})`}`}}));function jb(r){return r=(r||0)%360,r<0?r+360:r}function _l(r){return Math.max(0,Math.min(1,r||0))}function nd(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}function Je(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");var e=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=t?t.apply(this,a):a[0],l=e.cache;if(l.has(o))return l.get(o);var u=r.apply(this,a);return e.cache=l.set(o,u)||l,u};return e.cache=new(Je.Cache||Map),Je.cacheList.push(e.cache),e}Je.Cache=Map;Je.cacheList=[];Je.clearCache=function(){Je.cacheList.forEach(function(r){return r.clear()})};var wt=function(r){return r[r.kUnknown=0]="kUnknown",r[r.kNumber=1]="kNumber",r[r.kPercentage=2]="kPercentage",r[r.kEms=3]="kEms",r[r.kPixels=4]="kPixels",r[r.kRems=5]="kRems",r[r.kDegrees=6]="kDegrees",r[r.kRadians=7]="kRadians",r[r.kGradians=8]="kGradians",r[r.kTurns=9]="kTurns",r[r.kMilliseconds=10]="kMilliseconds",r[r.kSeconds=11]="kSeconds",r[r.kInteger=12]="kInteger",r}({}),Pr=function(r){return r[r.kUNumber=0]="kUNumber",r[r.kUPercent=1]="kUPercent",r[r.kULength=2]="kULength",r[r.kUAngle=3]="kUAngle",r[r.kUTime=4]="kUTime",r[r.kUOther=5]="kUOther",r}({}),iI=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),aI=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),sI=[{name:"em",unit_type:wt.kEms},{name:"px",unit_type:wt.kPixels},{name:"deg",unit_type:wt.kDegrees},{name:"rad",unit_type:wt.kRadians},{name:"grad",unit_type:wt.kGradians},{name:"ms",unit_type:wt.kMilliseconds},{name:"s",unit_type:wt.kSeconds},{name:"rem",unit_type:wt.kRems},{name:"turn",unit_type:wt.kTurns}],Os=function(r){return r[r.kUnknownType=0]="kUnknownType",r[r.kUnparsedType=1]="kUnparsedType",r[r.kKeywordType=2]="kKeywordType",r[r.kUnitType=3]="kUnitType",r[r.kSumType=4]="kSumType",r[r.kProductType=5]="kProductType",r[r.kNegateType=6]="kNegateType",r[r.kInvertType=7]="kInvertType",r[r.kMinType=8]="kMinType",r[r.kMaxType=9]="kMaxType",r[r.kClampType=10]="kClampType",r[r.kTransformType=11]="kTransformType",r[r.kPositionType=12]="kPositionType",r[r.kURLImageType=13]="kURLImageType",r[r.kColorType=14]="kColorType",r[r.kUnsupportedColorType=15]="kUnsupportedColorType",r}({}),oI=function(t){return sI.find(function(e){return e.name===t}).unit_type},lI=function(t){return t?t==="number"?wt.kNumber:t==="percent"||t==="%"?wt.kPercentage:oI(t):wt.kUnknown},uI=function(t){switch(t){case wt.kNumber:case wt.kInteger:return Pr.kUNumber;case wt.kPercentage:return Pr.kUPercent;case wt.kPixels:return Pr.kULength;case wt.kMilliseconds:case wt.kSeconds:return Pr.kUTime;case wt.kDegrees:case wt.kRadians:case wt.kGradians:case wt.kTurns:return Pr.kUAngle;default:return Pr.kUOther}},cI=function(t){switch(t){case Pr.kUNumber:return wt.kNumber;case Pr.kULength:return wt.kPixels;case Pr.kUPercent:return wt.kPercentage;case Pr.kUTime:return wt.kSeconds;case Pr.kUAngle:return wt.kDegrees;default:return wt.kUnknown}},qb=function(t){var e=1;switch(t){case wt.kPixels:case wt.kDegrees:case wt.kSeconds:break;case wt.kMilliseconds:e=.001;break;case wt.kRadians:e=180/Math.PI;break;case wt.kGradians:e=.9;break;case wt.kTurns:e=360;break}return e},Yy=function(t){switch(t){case wt.kNumber:case wt.kInteger:return"";case wt.kPercentage:return"%";case wt.kEms:return"em";case wt.kRems:return"rem";case wt.kPixels:return"px";case wt.kDegrees:return"deg";case wt.kRadians:return"rad";case wt.kGradians:return"grad";case wt.kMilliseconds:return"ms";case wt.kSeconds:return"s";case wt.kTurns:return"turn"}return""},dc=function(){function r(){ht(this,r)}return dt(r,[{key:"toString",value:function(){return this.buildCSSText(iI.kNo,aI.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=Os.kUnitType&&this.getType()<=Os.kClampType}}],[{key:"isAngle",value:function(e){return e===wt.kDegrees||e===wt.kRadians||e===wt.kGradians||e===wt.kTurns}},{key:"isLength",value:function(e){return e>=wt.kEms&&e<wt.kDegrees}},{key:"isRelativeUnit",value:function(e){return e===wt.kPercentage||e===wt.kEms||e===wt.kRems}},{key:"isTime",value:function(e){return e===wt.kSeconds||e===wt.kMilliseconds}}])}(),hI=function(r){function t(e){var n;return ht(this,t),n=Gt(this,t),n.colorSpace=e,n}return Wt(t,r),dt(t,[{key:"getType",value:function(){return Os.kColorType}},{key:"to",value:function(n){return this}}])}(dc),$i=function(r){return r[r.Constant=0]="Constant",r[r.LinearGradient=1]="LinearGradient",r[r.RadialGradient=2]="RadialGradient",r}({}),Ml=function(r){function t(e,n){var i;return ht(this,t),i=Gt(this,t),i.type=e,i.value=n,i}return Wt(t,r),dt(t,[{key:"clone",value:function(){return new t(this.type,this.value)}},{key:"buildCSSText",value:function(n,i,a){return a}},{key:"getType",value:function(){return Os.kColorType}}])}(dc),Er=function(r){function t(e){var n;return ht(this,t),n=Gt(this,t),n.value=e,n}return Wt(t,r),dt(t,[{key:"clone",value:function(){return new t(this.value)}},{key:"getType",value:function(){return Os.kKeywordType}},{key:"buildCSSText",value:function(n,i,a){return a+this.value}}])}(dc),dI=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(t)?n="NaN":t>0?n="infinity":n="-infinity",n+=e},Hy=function(t){return cI(uI(t))},hn=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:wt.kNumber;ht(this,t),n=Gt(this,t);var a;return typeof i=="string"?a=lI(i):a=i,n.unit=a,n.value=e,n}return Wt(t,r),dt(t,[{key:"clone",value:function(){return new t(this.value,this.unit)}},{key:"equals",value:function(n){var i=n;return this.value===i.value&&this.unit===i.unit}},{key:"getType",value:function(){return Os.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=Hy(this.unit);if(i!==Hy(n)||i===wt.kUnknown)return null;var a=qb(this.unit)/qb(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case wt.kUnknown:break;case wt.kInteger:s=Number(this.value).toFixed(0);break;case wt.kNumber:case wt.kPercentage:case wt.kEms:case wt.kRems:case wt.kPixels:case wt.kDegrees:case wt.kRadians:case wt.kGradians:case wt.kMilliseconds:case wt.kSeconds:case wt.kTurns:{var o=-999999,l=999999,u=this.value,c=Yy(this.unit);if(u<o||u>l){var h=Yy(this.unit);!Number.isFinite(u)||Number.isNaN(u)?s=dI(u,h):s=u+(h||"")}else s="".concat(u).concat(c)}}return a+=s,a}}])}(dc),Tr=new hn(0,"px");new hn(1,"px");var La=new hn(0,"deg"),Ym=function(r){function t(e,n,i){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return ht(this,t),a=Gt(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return Wt(t,r),dt(t,[{key:"clone",value:function(){return new t(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(n,i,a){return"".concat(a,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(hI),$b=new Er("unset"),fI=new Er("initial"),gI=new Er("inherit"),rd={"":$b,unset:$b,initial:fI,inherit:gI},vI=function(t){return rd[t]||(rd[t]=new Er(t)),rd[t]},pT=new Ym(0,0,0,0,!0),yT=new Ym(0,0,0,0),pI=Je(function(r,t,e,n){return new Ym(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),Me=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:wt.kNumber;return new hn(t,e)};new hn(50,"%");function yI(r){var t=r.type,e=r.value;return t==="hex"?"#".concat(e):t==="literal"?e:t==="rgb"?"rgb(".concat(e.join(","),")"):"rgba(".concat(e.join(","),")")}var mI=function(){var r={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function e($){throw new Error("".concat(t,": ").concat($))}function n(){var $=i();return t.length>0&&e("Invalid input not EOF"),$}function i(){return w(a)}function a(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,h)||s("repeating-radial-gradient",r.repeatingRadialGradient,h)||s("conic-gradient",r.conicGradient,h)}function s($,j,Z){return o(j,function(nt){var st=Z();return st&&(V(r.comma)||e("Missing comma before color stops")),{type:$,orientation:st,colorStops:w(E)}})}function o($,j){var Z=V($);if(Z){V(r.startCall)||e("Missing (");var nt=j(Z);return V(r.endCall)||e("Missing )"),nt}}function l(){return u()||c()}function u(){return G("directional",r.sideOrCorner,1)}function c(){return G("angular",r.angleValue,1)}function h(){var $,j=d(),Z;return j&&($=[],$.push(j),Z=t,V(r.comma)&&(j=d(),j?$.push(j):t=Z)),$}function d(){var $=f()||v();if($)$.at=g();else{var j=p();if(j){$=j;var Z=g();Z&&($.at=Z)}else{var nt=y();nt&&($={type:"default-radial",at:nt})}}return $}function f(){var $=G("shape",/^(circle)/i,0);return $&&($.style=B()||p()),$}function v(){var $=G("shape",/^(ellipse)/i,0);return $&&($.style=C()||p()),$}function p(){return G("extent-keyword",r.extentKeywords,1)}function g(){if(G("position",/^at/,0)){var $=y();return $||e("Missing positioning value"),$}}function y(){var $=m();if($.x||$.y)return{type:"position",value:$}}function m(){return{x:C(),y:C()}}function w($){var j=$(),Z=[];if(j)for(Z.push(j);V(r.comma);)j=$(),j?Z.push(j):e("One extra comma");return Z}function E(){var $=_();return $||e("Expected color definition"),$.length=C(),$}function _(){return T()||P()||O()||k()}function k(){return G("literal",r.literalColor,0)}function T(){return G("hex",r.hexColor,1)}function O(){return o(r.rgbColor,function(){return{type:"rgb",value:w(N)}})}function P(){return o(r.rgbaColor,function(){return{type:"rgba",value:w(N)}})}function N(){return V(r.number)[1]}function C(){return G("%",r.percentageValue,1)||L()||B()}function L(){return G("position-keyword",r.positionKeywords,1)}function B(){return G("px",r.pixelValue,1)||G("em",r.emValue,1)}function G($,j,Z){var nt=V(j);if(nt)return{type:$,value:nt[Z]}}function V($){var j=/^[\n\r\t\s]+/.exec(t);j&&U(j[0].length);var Z=$.exec(t);return Z&&U(Z[0].length),Z}function U($){t=t.substring($)}return function($){return t=$,n()}}();function bI(r,t,e,n){var i=ae(n.value),a=0,s=0,o=a+t/2,l=s+e/2,u=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),c=r[0]+o-Math.cos(i)*u/2,h=r[1]+l-Math.sin(i)*u/2,d=r[0]+o+Math.cos(i)*u/2,f=r[1]+l+Math.sin(i)*u/2;return{x1:c,y1:h,x2:d,y2:f}}function wI(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===wt.kPercentage&&(s=n.value/100*t),i.unit===wt.kPercentage&&(o=i.value/100*e);var l=Math.max(Wn([0,0],[s,o]),Wn([0,e],[s,o]),Wn([t,e],[s,o]),Wn([t,0],[s,o]));return a&&(a instanceof hn?l=a.value:a instanceof Er&&(a.value==="closest-side"?l=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?l=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(l=Math.min(Wn([0,0],[s,o]),Wn([0,e],[s,o]),Wn([t,e],[s,o]),Wn([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:l}}var xI=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,EI=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,SI=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,mT=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function _I(r){var t,e=r.length;if(r[e-1].length=(t=r[e-1].length)!==null&&t!==void 0?t:{type:"%",value:"100"},e>1){var n;r[0].length=(n=r[0].length)!==null&&n!==void 0?n:{type:"%",value:"0"}}for(var i=0,a=Number(r[0].length.value),s=1;s<e;s++){var o,l=(o=r[s].length)===null||o===void 0?void 0:o.value;if(!Rt(l)&&!Rt(a)){for(var u=1;u<s-i;u++)r[i+u].length={type:"%",value:"".concat(a+(Number(l)-a)*u/(s-i))};i=s,a=Number(l)}}}var MI={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},kI=Je(function(r){var t;return r.type==="angular"?t=Number(r.value):t=MI[r.value]||0,Me(t,"deg")}),OI=Je(function(r){var t=50,e=50,n="%",i="%";if((r==null?void 0:r.type)==="position"){var a=r.value,s=a.x,o=a.y;(s==null?void 0:s.type)==="position-keyword"&&(s.value==="left"?t=0:s.value==="center"?t=50:s.value==="right"?t=100:s.value==="top"?e=0:s.value==="bottom"&&(e=100)),(o==null?void 0:o.type)==="position-keyword"&&(o.value==="left"?t=0:o.value==="center"?e=50:o.value==="right"?t=100:o.value==="top"?e=0:o.value==="bottom"&&(e=100)),((s==null?void 0:s.type)==="px"||(s==null?void 0:s.type)==="%"||(s==null?void 0:s.type)==="em")&&(n=s==null?void 0:s.type,t=Number(s.value)),((o==null?void 0:o.type)==="px"||(o==null?void 0:o.type)==="%"||(o==null?void 0:o.type)==="em")&&(i=o==null?void 0:o.type,e=Number(o.value))}return{cx:Me(t,n),cy:Me(e,i)}}),TI=Je(function(r){if(r.indexOf("linear")>-1||r.indexOf("radial")>-1){var t=mI(r);return t.map(function(o){var l=o.type,u=o.orientation,c=o.colorStops;_I(c);var h=c.map(function(w){return{offset:Me(Number(w.length.value),"%"),color:yI(w)}});if(l==="linear-gradient")return new Ml($i.LinearGradient,{angle:u?kI(u):La,steps:h});if(l==="radial-gradient"&&(u||(u=[{type:"shape",value:"circle"}]),u[0].type==="shape"&&u[0].value==="circle")){var d=OI(u[0].at),f=d.cx,v=d.cy,p;if(u[0].style){var g=u[0].style,y=g.type,m=g.value;y==="extent-keyword"?p=vI(m):p=Me(m,y)}return new Ml($i.RadialGradient,{cx:f,cy:v,size:p,steps:h})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=xI.exec(r);if(n){var i,a=((i=n[2].match(mT))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new Ml($i.LinearGradient,{angle:Me(parseFloat(n[1]),"deg"),steps:a.map(function(o){var l=jt(o,2),u=l[0],c=l[1];return{offset:Me(Number(u)*100,"%"),color:c}})})]}}else if(e==="r"){var s=AI(r);if(s)if(ee(s))r=s;else return[new Ml($i.RadialGradient,s)]}else if(e==="p")return PI(r)}});function AI(r){var t=EI.exec(r);if(t){var e,n=((e=t[4].match(mT))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:Me(50,"%"),cy:Me(50,"%"),steps:n.map(function(i){var a=jt(i,2),s=a[0],o=a[1];return{offset:Me(Number(s)*100,"%"),color:o}})}}return null}function PI(r){var t=SI.exec(r);if(t){var e=t[1],n=t[2];switch(e){case"a":e="repeat";break;case"x":e="repeat-x";break;case"y":e="repeat-y";break;case"n":e="no-repeat";break;default:e="no-repeat"}return{image:n,repetition:e}}return null}function Ia(r){return r&&!!r.image}function ju(r){return r&&!Rt(r.r)&&!Rt(r.g)&&!Rt(r.b)}var wo=Je(function(r){if(Ia(r))return $t({repetition:"repeat"},r);if(Rt(r)&&(r=""),r==="transparent")return yT;if(r==="currentColor")r="black";else if(r==="none")return pT;var t=TI(r);if(t)return t;var e=hc(r),n=[0,0,0,0];return e!==null&&(n[0]=e.r||0,n[1]=e.g||0,n[2]=e.b||0,n[3]=e.opacity),pI.apply(void 0,n)});function NI(r,t){if(!(!ju(r)||!ju(t)))return[[Number(r.r),Number(r.g),Number(r.b),Number(r.alpha)],[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],function(e){var n=e.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(De(n[i],0,255));return n[3]=De(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function Yo(r,t){if(Rt(t))return Me(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return Me(Number(t),"px");if("deg".search(r)>=0)return Me(Number(t),"deg")}var e=[];t=t.replace(r,function(i){return e.push(i),"U".concat(i)});var n="U(".concat(r.source,")");return e.map(function(i){return Me(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var bT=function(t){return Yo(new RegExp("px","g"),t)},CI=Je(bT),RI=function(t){return Yo(new RegExp("%","g"),t)};Je(RI);var wT=function(t){return St(t)||isFinite(Number(t))?Me(Number(t)||0,"px"):Yo(new RegExp("px|%|em|rem","g"),t)},Xy=Je(wT),xT=function(t){return Yo(new RegExp("deg|rad|grad|turn","g"),t)},LI=Je(xT);function II(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a="",s=r.value||0,o=t.value||0,l=Hy(r.unit),u=r.convertTo(l),c=t.convertTo(l);return u&&c?(s=u.value,o=c.value,a=Yy(r.unit)):(hn.isLength(r.unit)||hn.isLength(t.unit))&&(s=tr(r,i,e),o=tr(t,i,e),a="px"),[s,o,function(h){return h+a}]}function Un(r){var t=0;return r.unit===wt.kDegrees?t=r.value:r.unit===wt.kRadians?t=Vn(Number(r.value)):r.unit===wt.kTurns?t=DL(Number(r.value)):r.value&&(t=r.value),t}function Gb(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):ee(r)?e=r.split(" ").map(function(n){return Number(n)}):St(r)&&(e=[r]),t===2?e.length===1?[e[0],e[0]]:[e[0],e[1]]:t===4?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0],e[1]]:e.length===3?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]:t==="even"&&e.length%2===1?[].concat(pe(e),pe(e)):e}function tr(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===wt.kPixels)return Number(r.value);if(r.unit===wt.kPercentage&&e){var i=e.nodeName===rt.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var DI=function(t){return Yo(/deg|rad|grad|turn|px|%/g,t)},BI=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function FI(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(r=r.toLowerCase().trim(),r==="none")return[];for(var t=/\s*([\w-]+)\(([^)]*)\)/g,e=[],n,i=0;n=t.exec(r);){if(n.index!==i)return[];if(i=n.index+n[0].length,BI.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return DI(a)||wo(a)})}),t.lastIndex===r.length)return e}return[]}function ET(r){return r.toString()}var ST=function(t){return typeof t=="number"?Me(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?Me(Number(t)):Me(0)},Ky=Je(ST);Je(function(r){return ee(r)?r.split(" ").map(Ky):r.map(Ky)});function Hm(r,t){return[r,t,ET]}function Xm(r,t){return function(e,n){return[e,n,function(i){return ET(De(i,r,t))}]}}function _T(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function Zy(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=rL(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function zI(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=xL(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function jI(r){for(var t=0;t<r.length;t++){var e=r[t-1],n=r[t],i=n[0];if(i==="M"&&e){var a=e[0],s=[n[1],n[2]],o=void 0;a==="L"||a==="M"?o=[e[1],e[2]]:(a==="C"||a==="A"||a==="Q")&&(o=[e[e.length-2],e[e.length-1]]),o&&qu(s,o)&&(r.splice(t,1),t--)}}}function qI(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 $I(r){for(var t=[],e=[],n=[],i=0;i<r.length;i++){var a=r[i],s=a[0];s==="M"?(n.length&&(e.push(n),n=[]),n.push([a[1],a[2]])):s==="Z"?n.length&&(t.push(n),n=[]):n.push([a[1],a[2]])}return n.length>0&&e.push(n),{polygons:t,polylines:e}}function qu(r,t){return r[0]===t[0]&&r[1]===t[1]}function GI(r,t){for(var e=[],n=[],i=[],a=0;a<r.length;a++){var s=r[a],o=s.currentPoint,l=s.params,u=s.prePoint,c=void 0;switch(s.command){case"Q":c=EL(u[0],u[1],l[1],l[2],l[3],l[4]);break;case"C":c=mL(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=s.arcParams;c=vL(h.cx,h.cy,h.rx,h.ry,h.xRotation,h.startAngle,h.endAngle);break;default:e.push(o[0]),n.push(o[1]);break}c&&(s.box=c,e.push(c.x,c.x+c.width),n.push(c.y,c.y+c.height))}e=e.filter(function(E){return!Number.isNaN(E)&&E!==1/0&&E!==-1/0}),n=n.filter(function(E){return!Number.isNaN(E)&&E!==1/0&&E!==-1/0});var d=Cu(e),f=Cu(n),v=Nu(e),p=Nu(n);if(i.length===0)return{x:d,y:f,width:v-d,height:p-f};for(var g=0;g<i.length;g++){var y=i[g],m=y.currentPoint,w=void 0;m[0]===d?(w=kl(y,t),d-=w.xExtra):m[0]===v&&(w=kl(y,t),v+=w.xExtra),m[1]===f?(w=kl(y,t),f-=w.yExtra):m[1]===p&&(w=kl(y,t),p+=w.yExtra)}return{x:d,y:f,width:v-d,height:p-f}}function kl(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),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),o=Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2),l=Math.acos((a+s-o)/(2*Math.sqrt(a)*Math.sqrt(s)));if(!l||Math.sin(l)===0||mo(l,0))return{xExtra:0,yExtra:0};var u=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),c=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));u=u>Math.PI/2?Math.PI-u:u,c=c>Math.PI/2?Math.PI-c:c;var h={xExtra:Math.cos(l/2-u)*(t/2*(1/Math.sin(l/2)))-t/2||0,yExtra:Math.cos(c-l/2)*(t/2*(1/Math.sin(l/2)))-t/2||0};return h}function Wb(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var Vb=function(t,e){var n=t.x*e.x+t.y*e.y,i=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2))),a=t.x*e.y-t.y*e.x<0?-1:1,s=a*Math.acos(n/i);return s},Ub=function(t,e,n,i,a,s,o,l){e=Math.abs(e),n=Math.abs(n),i=XO(i,360);var u=ae(i);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-o.x)/2,h=(t.y-o.y)/2,d={x:Math.cos(u)*c+Math.sin(u)*h,y:-Math.sin(u)*c+Math.cos(u)*h},f=Math.pow(d.x,2)/Math.pow(e,2)+Math.pow(d.y,2)/Math.pow(n,2);f>1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var v=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(d.y,2)-Math.pow(n,2)*Math.pow(d.x,2),p=Math.pow(e,2)*Math.pow(d.y,2)+Math.pow(n,2)*Math.pow(d.x,2),g=v/p;g=g<0?0:g;var y=(a!==s?1:-1)*Math.sqrt(g),m={x:y*(e*d.y/n),y:y*(-(n*d.x)/e)},w={x:Math.cos(u)*m.x-Math.sin(u)*m.y+(t.x+o.x)/2,y:Math.sin(u)*m.x+Math.cos(u)*m.y+(t.y+o.y)/2},E={x:(d.x-m.x)/e,y:(d.y-m.y)/n},_=Vb({x:1,y:0},E),k={x:(-d.x-m.x)/e,y:(-d.y-m.y)/n},T=Vb(E,k);!s&&T>0?T-=2*Math.PI:s&&T<0&&(T+=2*Math.PI),T%=2*Math.PI;var O=_+T*l,P=e*Math.cos(O),N=n*Math.sin(O),C={x:Math.cos(u)*P-Math.sin(u)*N+w.x,y:Math.sin(u)*P+Math.cos(u)*N+w.y,ellipticalArcStartAngle:_,ellipticalArcEndAngle:_+T,ellipticalArcAngle:O,ellipticalArcCenter:w,resultantRx:e,resultantRy:n};return C};function WI(r){for(var t=[],e=null,n=null,i=null,a=0,s=r.length,o=0;o<s;o++){var l=r[o];n=r[o+1];var u=l[0],c={command:u,prePoint:e,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(u){case"M":i=[l[1],l[2]],a=o;break;case"A":var h=VI(e,l);c.arcParams=h;break}if(u==="Z")e=i,n=r[a+1];else{var d=l.length;e=[l[d-2],l[d-1]]}n&&n[0]==="Z"&&(n=r[a],t[a]&&(t[a].prePoint=e)),c.currentPoint=e,t[a]&&qu(e,t[a].currentPoint)&&(t[a].prePoint=c.prePoint);var f=n?[n[n.length-2],n[n.length-1]]:null;c.nextPoint=f;var v=c.prePoint;if(["L","H","V"].includes(u))c.startTangent=[v[0]-e[0],v[1]-e[1]],c.endTangent=[e[0]-v[0],e[1]-v[1]];else if(u==="Q"){var p=[l[1],l[2]];c.startTangent=[v[0]-p[0],v[1]-p[1]],c.endTangent=[e[0]-p[0],e[1]-p[1]]}else if(u==="T"){var g=t[o-1],y=Wb(g.currentPoint,v);g.command==="Q"?(c.command="Q",c.startTangent=[v[0]-y[0],v[1]-y[1]],c.endTangent=[e[0]-y[0],e[1]-y[1]]):(c.command="TL",c.startTangent=[v[0]-e[0],v[1]-e[1]],c.endTangent=[e[0]-v[0],e[1]-v[1]])}else if(u==="C"){var m=[l[1],l[2]],w=[l[3],l[4]];c.startTangent=[v[0]-m[0],v[1]-m[1]],c.endTangent=[e[0]-w[0],e[1]-w[1]],c.startTangent[0]===0&&c.startTangent[1]===0&&(c.startTangent=[m[0]-w[0],m[1]-w[1]]),c.endTangent[0]===0&&c.endTangent[1]===0&&(c.endTangent=[w[0]-m[0],w[1]-m[1]])}else if(u==="S"){var E=t[o-1],_=Wb(E.currentPoint,v),k=[l[1],l[2]];E.command==="C"?(c.command="C",c.startTangent=[v[0]-_[0],v[1]-_[1]],c.endTangent=[e[0]-k[0],e[1]-k[1]]):(c.command="SQ",c.startTangent=[v[0]-k[0],v[1]-k[1]],c.endTangent=[e[0]-k[0],e[1]-k[1]])}else if(u==="A"){var T=Yb(c,0),O=T.x,P=T.y,N=Yb(c,1,!1),C=N.x,L=N.y;c.startTangent=[O,P],c.endTangent=[C,L]}t.push(c)}return t}function Yb(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,l=n.xRotation,u=n.arcFlag,c=n.sweepFlag,h=Ub({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},t),d=Ub({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),f=d.x-h.x,v=d.y-h.y,p=Math.sqrt(f*f+v*v);return{x:-f/p,y:-v/p}}function Ol(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Jy(r,t){return Ol(r)*Ol(t)?(r[0]*t[0]+r[1]*t[1])/(Ol(r)*Ol(t)):1}function Hb(r,t){return(r[0]*t[1]<r[1]*t[0]?-1:1)*Math.acos(Jy(r,t))}function VI(r,t){var e=t[1],n=t[2],i=XO(ae(t[3]),Math.PI*2),a=t[4],s=t[5],o=r[0],l=r[1],u=t[6],c=t[7],h=Math.cos(i)*(o-u)/2+Math.sin(i)*(l-c)/2,d=-1*Math.sin(i)*(o-u)/2+Math.cos(i)*(l-c)/2,f=h*h/(e*e)+d*d/(n*n);f>1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var v=e*e*(d*d)+n*n*(h*h),p=v?Math.sqrt((e*e*(n*n)-v)/v):1;a===s&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*e*d/n:0,y=e?p*-n*h/e:0,m=(o+u)/2+Math.cos(i)*g-Math.sin(i)*y,w=(l+c)/2+Math.sin(i)*g+Math.cos(i)*y,E=[(h-g)/e,(d-y)/n],_=[(-1*h-g)/e,(-1*d-y)/n],k=Hb([1,0],E),T=Hb(E,_);return Jy(E,_)<=-1&&(T=Math.PI),Jy(E,_)>=1&&(T=0),s===0&&T>0&&(T-=2*Math.PI),s===1&&T<0&&(T+=2*Math.PI),{cx:m,cy:w,rx:qu(r,[u,c])?0:e,ry:qu(r,[u,c])?0:n,startAngle:k,endAngle:k+T,xRotation:i,arcFlag:a,sweepFlag:s}}var MT=function(t){if(t===""||Array.isArray(t)&&t.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=Iu(t)}catch{e=Iu(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}jI(e);var n=qI(e),i=$I(e),a=i.polygons,s=i.polylines,o=WI(e),l=GI(o,0),u=l.x,c=l.y,h=l.width,d=l.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(u)?u:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(h)?h:0,height:Number.isFinite(d)?d:0}}},UI=Je(MT);function kT(r){return ee(r)?UI(r):MT(r)}function YI(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=jy(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=jy(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=aT(n,i));var s=Eb(a[0])!==Eb(a[1])?Z3(a[0]):K3(a[0]);return[s,aL(a[1],s),function(o){return o}]}function HI(r,t){var e;return ee(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=jt(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function XI(r,t){return[r.points,t.points,function(e){return e}]}var Ie=null,ws=/\s*(\w+)\(([^)]*)\)/g;function qn(r){return function(t){var e=0;return r.map(function(n){return n===Ie?t[e++]:n})}}function fa(r){return r}var Po={matrix:["NNNNNN",[Ie,Ie,0,0,Ie,Ie,0,0,0,0,1,0,Ie,Ie,0,1],fa],matrix3d:["NNNNNNNNNNNNNNNN",fa],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",qn([Ie,Ie,new hn(1)]),fa],scaleX:["N",qn([Ie,new hn(1),new hn(1)]),qn([Ie,new hn(1)])],scaleY:["N",qn([new hn(1),Ie,new hn(1)]),qn([new hn(1),Ie])],scaleZ:["N",qn([new hn(1),new hn(1),Ie])],scale3d:["NNN",fa],skew:["Aa",null,fa],skewX:["A",null,qn([Ie,La])],skewY:["A",null,qn([La,Ie])],translate:["Tt",qn([Ie,Ie,Tr]),fa],translateX:["T",qn([Ie,Tr,Tr]),qn([Ie,Tr])],translateY:["T",qn([Tr,Ie,Tr]),qn([Tr,Ie])],translateZ:["L",qn([Tr,Tr,Ie])],translate3d:["TTL",fa]};function OT(r){for(var t=[],e=r.length,n=0;n<e;n++){var i=r[n],a=i[0],s=i.slice(1);a==="translate"||a==="skew"?s.length===1&&s.push(0):a==="scale"&&s.length===1&&s.push(s[0]);var o=Po[a];if(!o)return[];var l=s.map(function(u){return Me(u)});t.push({t:a,d:l})}return t}function TT(r){if(Array.isArray(r))return OT(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(ws.lastIndex=0;e=ws.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=Po[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(v){return v.trim()==="0"?La:LI(v)},N:Ky,T:Xy,L:CI}[h.toUpperCase()](c):d={a:La,n:l[0],t:Tr}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),ws.lastIndex===r.length)return t}return[]}function KI(r){if(Array.isArray(r))return OT(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(ws.lastIndex=0;e=ws.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=Po[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(v){return v.trim()==="0"?La:xT(v)},N:ST,T:wT,L:bT}[h.toUpperCase()](c):d={a:La,n:l[0],t:Tr}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),ws.lastIndex===r.length)return t}return[]}function ZI(r){var t,e,n,i;switch(r.t){case"rotateX":return i=ae(Un(r.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotateY":return i=ae(Un(r.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotateZ":return i=ae(Un(r.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":t=r.d[0].value,e=r.d[1].value,n=r.d[2].value,i=ae(Un(r.d[3]));var a=t*t+e*e+n*n;if(a===0)t=1,e=0,n=0;else if(a!==1){var s=Math.sqrt(a);t/=s,e/=s,n/=s}var o=Math.sin(i/2),l=o*Math.cos(i/2),u=o*o;return[1-2*(e*e+n*n)*u,2*(t*e*u+n*l),2*(t*n*u-e*l),0,2*(t*e*u-n*l),1-2*(t*t+n*n)*u,2*(e*n*u+t*l),0,2*(t*n*u+e*l),2*(e*n*u-t*l),1-2*(t*t+e*e)*u,0,0,0,0,1];case"scale":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[r.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaleY":return[1,0,0,0,0,r.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scaleZ":return[1,0,0,0,0,1,0,0,0,0,r.d[0].value,0,0,0,0,1];case"scale3d":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,r.d[2].value,0,0,0,0,1];case"skew":var c=ae(Un(r.d[0])),h=ae(Un(r.d[1]));return[1,Math.tan(h),0,0,Math.tan(c),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=ae(Un(r.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return i=ae(Un(r.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return t=tr(r.d[0],0,null)||0,e=tr(r.d[1],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1];case"translateX":return t=tr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,0,0,1];case"translateY":return e=tr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,e,0,1];case"translateZ":return n=tr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,n,1];case"translate3d":return t=tr(r.d[0],0,null)||0,e=tr(r.d[1],0,null)||0,n=tr(r.d[2],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,n,1];case"perspective":var d=tr(r.d[0],0,null)||0,f=d?-1/d:0;return[1,0,0,0,0,1,0,0,0,0,1,f,0,0,0,1];case"matrix":return[r.d[0].value,r.d[1].value,0,0,r.d[2].value,r.d[3].value,0,0,0,0,1,0,r.d[4].value,r.d[5].value,0,1];case"matrix3d":return r.d.map(function(v){return v.value})}}function JI(r,t){return[r[0]*t[0]+r[4]*t[1]+r[8]*t[2]+r[12]*t[3],r[1]*t[0]+r[5]*t[1]+r[9]*t[2]+r[13]*t[3],r[2]*t[0]+r[6]*t[1]+r[10]*t[2]+r[14]*t[3],r[3]*t[0]+r[7]*t[1]+r[11]*t[2]+r[15]*t[3],r[0]*t[4]+r[4]*t[5]+r[8]*t[6]+r[12]*t[7],r[1]*t[4]+r[5]*t[5]+r[9]*t[6]+r[13]*t[7],r[2]*t[4]+r[6]*t[5]+r[10]*t[6]+r[14]*t[7],r[3]*t[4]+r[7]*t[5]+r[11]*t[6]+r[15]*t[7],r[0]*t[8]+r[4]*t[9]+r[8]*t[10]+r[12]*t[11],r[1]*t[8]+r[5]*t[9]+r[9]*t[10]+r[13]*t[11],r[2]*t[8]+r[6]*t[9]+r[10]*t[10]+r[14]*t[11],r[3]*t[8]+r[7]*t[9]+r[11]*t[10]+r[15]*t[11],r[0]*t[12]+r[4]*t[13]+r[8]*t[14]+r[12]*t[15],r[1]*t[12]+r[5]*t[13]+r[9]*t[14]+r[13]*t[15],r[2]*t[12]+r[6]*t[13]+r[10]*t[14]+r[14]*t[15],r[3]*t[12]+r[7]*t[13]+r[11]*t[14]+r[15]*t[15]]}function QI(r){return r.length===0?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:r.map(ZI).reduce(JI)}function Xb(r){var t=[0,0,0],e=[1,1,1],n=[0,0,0],i=[0,0,0,1],a=[0,0,0,1];return qL(QI(r),t,e,n,i,a),[[t,e,n,a,i]]}var tD=function(){function r(n,i){for(var a=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],s=0;s<4;s++)for(var o=0;o<4;o++)for(var l=0;l<4;l++)a[s][o]+=i[s][l]*n[l][o];return a}function t(n){return n[0][2]===0&&n[0][3]===0&&n[1][2]===0&&n[1][3]===0&&n[2][0]===0&&n[2][1]===0&&n[2][2]===1&&n[2][3]===0&&n[3][2]===0&&n[3][3]===1}function e(n,i,a,s,o){for(var l=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],u=0;u<4;u++)l[u][3]=o[u];for(var c=0;c<3;c++)for(var h=0;h<3;h++)l[3][c]+=n[h]*l[h][c];var d=s[0],f=s[1],v=s[2],p=s[3],g=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];g[0][0]=1-2*(f*f+v*v),g[0][1]=2*(d*f-v*p),g[0][2]=2*(d*v+f*p),g[1][0]=2*(d*f+v*p),g[1][1]=1-2*(d*d+v*v),g[1][2]=2*(f*v-d*p),g[2][0]=2*(d*v-f*p),g[2][1]=2*(f*v+d*p),g[2][2]=1-2*(d*d+f*f),l=r(l,g);var y=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];a[2]&&(y[2][1]=a[2],l=r(l,y)),a[1]&&(y[2][1]=0,y[2][0]=a[0],l=r(l,y)),a[0]&&(y[2][0]=0,y[1][0]=a[0],l=r(l,y));for(var m=0;m<3;m++)for(var w=0;w<3;w++)l[m][w]*=i[m];return t(l)?[l[0][0],l[0][1],l[1][0],l[1][1],l[3][0],l[3][1]]:l[0].concat(l[1],l[2],l[3])}return e}();function eD(r){return r.toFixed(6).replace(".000000","")}function id(r,t){var e,n;return r.decompositionPair!==t&&(r.decompositionPair=t,e=Xb(r)),t.decompositionPair!==r&&(t.decompositionPair=r,n=Xb(t)),e[0]===null||n[0]===null?[[!1],[!0],function(i){return i?t[0].d:r[0].d}]:(e[0].push(0),n[0].push(1),[e,n,function(i){var a=rD(e[0][3],n[0][3],i[5]),s=tD(i[0],i[1],i[2],a,i[4]),o=s.map(eD).join(",");return o}])}function nD(r,t){for(var e=0,n=0;n<r.length;n++)e+=r[n]*t[n];return e}function rD(r,t,e){var n=nD(r,t);n=De(n,-1,1);var i=[];if(n===1)i=r;else for(var a=Math.acos(n),s=Math.sin(e*a)*1/Math.sqrt(1-n*n),o=0;o<4;o++)i.push(r[o]*(Math.cos(e*a)-n*s)+t[o]*s);return i}function ad(r){return r.replace(/[XY]/,"")}function sd(r){return r.replace(/(X|Y|Z|3d)?$/,"3d")}var iD=function(t,e){return t==="perspective"&&e==="perspective"||(t==="matrix"||t==="matrix3d")&&(e==="matrix"||e==="matrix3d")};function aD(r,t,e){var n=!1;if(!r.length||!t.length){r.length||(n=!0,r=t,t=[]);for(var i=function(){var C=r[a],L=C.t,B=C.d,G=L.substring(0,5)==="scale"?1:0;t.push({t:L,d:B.map(function(V){return typeof V=="number"?Me(G):Me(G,V.unit)})})},a=0;a<r.length;a++)i()}var s=[],o=[],l=[];if(r.length!==t.length){var u=id(r,t);s=[u[0]],o=[u[1]],l=[["matrix",[u[2]]]]}else for(var c=0;c<r.length;c++){var h=r[c].t,d=t[c].t,f=r[c].d,v=t[c].d,p=Po[h],g=Po[d],y=void 0;if(iD(h,d)){var m=id([r[c]],[t[c]]);s.push(m[0]),o.push(m[1]),l.push(["matrix",[m[2]]]);continue}else if(h===d)y=h;else if(p[2]&&g[2]&&ad(h)===ad(d))y=ad(h),f=p[2](f),v=g[2](v);else if(p[1]&&g[1]&&sd(h)===sd(d))y=sd(h),f=p[1](f),v=g[1](v);else{var w=id(r,t);s=[w[0]],o=[w[1]],l=[["matrix",[w[2]]]];break}for(var E=[],_=[],k=[],T=0;T<f.length;T++){var O=II(f[T],v[T],e,!1,T);E[T]=O[0],_[T]=O[1],k.push(O[2])}s.push(E),o.push(_),l.push([y,k])}if(n){var P=s;s=o,o=P}return[s,o,function(N){return N.map(function(C,L){var B=C.map(function(G,V){return l[L][1][V](G)}).join(",");return l[L][0]==="matrix"&&B.split(",").length===16&&(l[L][0]="matrix3d"),l[L][0]==="matrix3d"&&B.split(",").length===6&&(l[L][0]="matrix"),"".concat(l[L][0],"(").concat(B,")")}).join(" ")}]}var sD=Je(function(r){if(ee(r)){if(r==="text-anchor")return[Me(0,"px"),Me(0,"px")];var t=r.split(" ");return t.length===1&&(t[0]==="top"||t[0]==="bottom"?(t[1]=t[0],t[0]="center"):t[1]="center"),t.length!==2?null:[Xy(Kb(t[0])),Xy(Kb(t[1]))]}return[Me(r[0]||0,"px"),Me(r[1]||0,"px")]});function Kb(r){return r==="center"?"50%":r==="left"||r==="top"?"0%":r==="right"||r==="bottom"?"100%":r}var Km=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:bt.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:bt.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:bt.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:bt.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:bt.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:bt.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:bt.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:bt.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:bt.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:bt.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:bt.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:bt.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:bt.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:bt.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:bt.FILTER},{n:"clipPath",syntax:bt.DEFINED_PATH},{n:"textPath",syntax:bt.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:bt.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:bt.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:bt.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:bt.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:bt.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:bt.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:bt.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:bt.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:bt.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:bt.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:bt.COORDINATE},{n:"y1",int:!0,l:!0,syntax:bt.COORDINATE},{n:"z1",int:!0,l:!0,syntax:bt.COORDINATE},{n:"x2",int:!0,l:!0,syntax:bt.COORDINATE},{n:"y2",int:!0,l:!0,syntax:bt.COORDINATE},{n:"z2",int:!0,l:!0,syntax:bt.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:bt.PATH,p:50},{n:"points",int:!0,l:!0,syntax:bt.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:bt.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:bt.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:bt.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:bt.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:bt.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:bt.NUMBER,d:function(t){return t===rt.PATH||t===rt.POLYGON||t===rt.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:bt.MARKER},{n:"markerEnd",syntax:bt.MARKER},{n:"markerMid",syntax:bt.MARKER},{n:"markerStartOffset",syntax:bt.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:bt.LENGTH,l:!0,int:!0,d:"0"}],oD=new Set(Km.filter(function(r){return!!r.l}).map(function(r){return r.n})),AT={},lD=function(){function r(t){var e=this;ht(this,r),this.runtime=t,Km.forEach(function(n){e.registerMetadata(n)})}return dt(r,[{key:"registerMetadata",value:function(e){[e.n].concat(pe(e.a||[])).forEach(function(n){AT[n]=e})}},{key:"getPropertySyntax",value:function(e){return this.runtime.CSSPropertySyntaxFactory[e]}},{key:"processProperties",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{forceUpdateGeometry:!1};Object.assign(e.attributes,n);var a=e.parsedStyle.clipPath,s=e.parsedStyle.offsetPath;uD(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var l in n)if(oD.has(l)){o=!0;break}}var u=PT(e);u.has("fill")&&n.fill&&(e.parsedStyle.fill=wo(n.fill)),u.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=wo(n.stroke)),u.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=wo(n.shadowColor)),u.has("filter")&&n.filter&&(e.parsedStyle.filter=FI(n.filter)),u.has("radius")&&!Rt(n.radius)&&(e.parsedStyle.radius=Gb(n.radius,4)),u.has("lineDash")&&!Rt(n.lineDash)&&(e.parsedStyle.lineDash=Gb(n.lineDash,"even")),u.has("points")&&n.points&&(e.parsedStyle.points=HI(n.points)),u.has("d")&&n.d===""&&(e.parsedStyle.d=$t({},fT)),u.has("d")&&n.d&&(e.parsedStyle.d=kT(n.d)),u.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[bt.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),u.has("clipPath")&&!Bt(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[bt.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),u.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[bt.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),u.has("transform")&&n.transform&&(e.parsedStyle.transform=TT(n.transform)),u.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=sD(n.transformOrigin)),u.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[bt.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),u.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[bt.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),u.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[bt.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),u.has("zIndex")&&!Rt(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[bt.Z_INDEX].postProcessor(e),u.has("offsetDistance")&&!Rt(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[bt.OFFSET_DISTANCE].postProcessor(e),u.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[bt.TRANSFORM].postProcessor(e),u.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[bt.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.geometry.dirty=!0,e.renderable.boundsDirty=!0,e.renderable.renderBoundsDirty=!0,i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtifyToRoot(e))}},{key:"updateGeometry",value:function(e){var n=e.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=e.geometry;a.contentBounds||(a.contentBounds=new ge),a.renderBounds||(a.renderBounds=new ge);var s=e.parsedStyle,o=i.update(s,e),l=o.cx,u=l===void 0?0:l,c=o.cy,h=c===void 0?0:c,d=o.cz,f=d===void 0?0:d,v=o.hwidth,p=v===void 0?0:v,g=o.hheight,y=g===void 0?0:g,m=o.hdepth,w=m===void 0?0:m,E=[Math.abs(p),Math.abs(y),w],_=s.stroke,k=s.lineWidth,T=k===void 0?1:k,O=s.increasedLineWidthForHitTesting,P=O===void 0?0:O,N=s.shadowType,C=N===void 0?"outer":N,L=s.shadowColor,B=s.filter,G=B===void 0?[]:B,V=s.transformOrigin,U=[u,h,f];a.contentBounds.update(U,E);var $=n===rt.POLYLINE||n===rt.POLYGON||n===rt.PATH?Math.SQRT2:.5,j=_&&!_.isNone;if(j){var Z=((T||0)+(P||0))*$;E[0]+=Z,E[1]+=Z}if(a.renderBounds.update(U,E),L&&C&&C!=="inner"){var nt=a.renderBounds,st=nt.min,ot=nt.max,Pt=s.shadowBlur,K=s.shadowOffsetX,W=s.shadowOffsetY,tt=Pt||0,ct=K||0,Et=W||0,Nt=st[0]-tt+ct,Vt=ot[0]+tt+ct,ke=st[1]-tt+Et,un=ot[1]+tt+Et;st[0]=Math.min(st[0],Nt),ot[0]=Math.max(ot[0],Vt),st[1]=Math.min(st[1],ke),ot[1]=Math.max(ot[1],un),a.renderBounds.setMinMax(st,ot)}G.forEach(function(Jt){var hr=Jt.name,we=Jt.params;if(hr==="blur"){var Za=we[0].value;a.renderBounds.update(a.renderBounds.center,Xi(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[Za,Za,0]))}else if(hr==="drop-shadow"){var dr=we[0].value,$e=we[1].value,Re=we[2].value,zn=a.renderBounds,jn=zn.min,fr=zn.max,ci=jn[0]-Re+dr,$r=fr[0]+Re+dr,Ja=jn[1]-Re+$e,Qa=fr[1]+Re+$e;jn[0]=Math.min(jn[0],ci),fr[0]=Math.max(fr[0],$r),jn[1]=Math.min(jn[1],Ja),fr[1]=Math.max(fr[1],Qa),a.renderBounds.setMinMax(jn,fr)}}),e.geometry.dirty=!1;var Oe=p<0,Ue=y<0,Xt=(Oe?-1:1)*(V?tr(V[0],0,e,!0):0),cr=(Ue?-1:1)*(V?tr(V[1],1,e,!0):0);(Xt||cr)&&e.setOrigin(Xt,cr)}}},{key:"updateSizeAttenuation",value:function(e,n){e.style.isSizeAttenuation?(e.style.rawLineWidth||(e.style.rawLineWidth=e.style.lineWidth),e.style.lineWidth=(e.style.rawLineWidth||1)/n,e.nodeName===rt.CIRCLE&&(e.style.rawR||(e.style.rawR=e.style.r),e.style.r=(e.style.rawR||1)/n)):(e.style.rawLineWidth&&(e.style.lineWidth=e.style.rawLineWidth,delete e.style.rawLineWidth),e.nodeName===rt.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function uD(r,t){var e=PT(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function PT(r){return r.constructor.PARSED_STYLE_LIST}var cD=function(){function r(){ht(this,r),this.mixer=Hm}return dt(r,[{key:"calculator",value:function(e,n,i,a){return Un(i)}}])}(),hD=function(){function r(){ht(this,r)}return dt(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof Er&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtifyToRoot(o)}),i}}])}(),dD=function(){function r(){ht(this,r),this.parser=wo,this.mixer=NI}return dt(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Er?i.value==="none"?pT:yT:i}}])}(),fD=function(){function r(){ht(this,r)}return dt(r,[{key:"calculator",value:function(e,n,i){return i instanceof Er?[]:i}}])}();function Zb(r){var t=r.parsedStyle,e=t.fontSize;return Rt(e)?null:e}var Qy=function(){function r(){ht(this,r),this.mixer=Hm}return dt(r,[{key:"calculator",value:function(e,n,i,a,s){if(St(i))return i;if(hn.isRelativeUnit(i.unit)){if(i.unit===wt.kPercentage)return 0;if(i.unit===wt.kEms){if(a.parentNode){var o=Zb(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===wt.kRems){var l;if(a!=null&&(l=a.ownerDocument)!==null&&l!==void 0&&l.documentElement){var u=Zb(a.ownerDocument.documentElement);if(u)return u*=i.value,u}return 0}}else return i.value}}])}(),gD=function(){function r(){ht(this,r),this.mixer=_T}return dt(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),vD=function(){function r(){ht(this,r),this.mixer=_T}return dt(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),pD=function(){function r(){ht(this,r)}return dt(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof Er&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),yD=function(){function r(){ht(this,r),this.mixer=Hm}return dt(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),mD=function(){function r(){ht(this,r),this.mixer=Xm(0,1)}return dt(r,[{key:"calculator",value:function(e,n,i){return i.value}},{key:"postProcessor",value:function(e){var n=e.parsedStyle,i=n.offsetPath,a=n.offsetDistance;if(i){var s=i.nodeName;if(s===rt.LINE||s===rt.PATH||s===rt.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),bD=function(){function r(){ht(this,r),this.mixer=Xm(0,1)}return dt(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),wD=function(){function r(){ht(this,r),this.parser=kT,this.mixer=YI}return dt(r,[{key:"calculator",value:function(e,n,i){return i instanceof Er&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new ks(0,0,0,0)}:i}}])}(),xD=dt(function r(){ht(this,r),this.mixer=XI}),ED=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.mixer=Xm(0,1/0),e}return Wt(t,r),dt(t)}(Qy),SD=function(){function r(){ht(this,r)}return dt(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Er?i.value==="unset"?"":i.value:"".concat(i)}},{key:"postProcessor",value:function(e){e.nodeValue="".concat(e.parsedStyle.text)||""}}])}(),_D=function(){function r(){ht(this,r)}return dt(r,[{key:"calculator",value:function(e,n,i,a){var s=a.getAttribute("text");if(s){var o=s;i.value==="capitalize"?o=s.charAt(0).toUpperCase()+s.slice(1):i.value==="lowercase"?o=s.toLowerCase():i.value==="uppercase"&&(o=s.toUpperCase()),a.parsedStyle.text=o}return i.value}}])}(),od=new WeakMap;function MD(r,t,e){if(r){var n=typeof r=="string"?document.getElementById(r):r;od.has(n)&&od.get(n).destroy(e),od.set(n,t)}}var Zm=typeof window<"u"&&typeof window.document<"u";function kD(r){return!!r.getAttribute}function OD(r,t){for(var e=0,n=r.length;e<n;){var i=e+n>>>1;NT(r[i],t)<0?e=i+1:n=i}return e}function NT(r,t){var e=Number(r.parsedStyle.zIndex||0),n=Number(t.parsedStyle.zIndex||0);if(e===n){var i=r.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(r)-a.indexOf(t)}}return e-n}function CT(r){var t=r;do{var e,n=(e=t.parsedStyle)===null||e===void 0?void 0:e.clipPath;if(n)return t;t=t.parentElement}while(t!==null);return null}var Jb="px";function TD(r,t,e){Zm&&r.style&&(r.style.width=t+Jb,r.style.height=e+Jb)}function RT(r,t){if(Zm)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function AD(r){var t=RT(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function PD(r){var t=RT(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var ND=1,CD={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},tm=typeof performance=="object"&&performance.now?performance:Date;function $u(r){return r.nodeName===rt.FRAGMENT?!0:r.getRootNode().nodeName===rt.FRAGMENT}function $a(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auto",t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,n=!1,i=!1,a=!!t&&!t.isNone,s=!!e&&!e.isNone;return r==="visiblepainted"||r==="painted"||r==="auto"?(n=a,i=s):r==="visiblefill"||r==="fill"?n=!0:r==="visiblestroke"||r==="stroke"?i=!0:(r==="visible"||r==="all")&&(n=!0,i=!0),[n,i]}var RD=1,LD=function(){return RD++},ni=typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:{},ID=Date.now(),DD=function(){return ni.performance&&typeof ni.performance.now=="function"?ni.performance.now():Date.now()-ID},so={},Qb=Date.now(),BD=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-Qb,i=n>16?0:16-n,a=LD();return so[a]=t,Object.keys(so).length>1||setTimeout(function(){Qb=e;var s=so;so={},Object.keys(s).forEach(function(o){return s[o](DD())})},i),a},FD=function(t){delete so[t]},zD=["","webkit","moz","ms","o"],LT=function(t){return typeof t!="string"?BD:t===""?ni.requestAnimationFrame:ni["".concat(t,"RequestAnimationFrame")]},jD=function(t){return typeof t!="string"?FD:t===""?ni.cancelAnimationFrame:ni["".concat(t,"CancelAnimationFrame")]||ni["".concat(t,"CancelRequestAnimationFrame")]},qD=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},IT=qD(zD,function(r){return!!LT(r)}),Jm=LT(IT),DT=jD(IT);ni.requestAnimationFrame=Jm;ni.cancelAnimationFrame=DT;var $D=function(){function r(){ht(this,r),this.callbacks=[]}return dt(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return Promise.all(this.callbacks.map(function(a){return a.apply(void 0,n)}))}}])}(),GD=function(){function r(){ht(this,r),this.callbacks=[]}return dt(r,[{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){var t=na(wn().mark(function n(){var i,a,s,o,l=arguments;return wn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!this.callbacks.length){c.next=14;break}return c.next=3,(i=this.callbacks)[0].apply(i,l);case 3:a=c.sent,s=0;case 5:if(!(s<this.callbacks.length-1)){c.next=13;break}return o=this.callbacks[s],c.next=9,o(a);case 9:a=c.sent;case 10:s++,c.next=5;break;case 13:return c.abrupt("return",a);case 14:return c.abrupt("return",null);case 15:case"end":return c.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),Nn=function(){function r(){ht(this,r),this.callbacks=[]}return dt(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var a=arguments;this.callbacks.forEach(function(s){s.apply(void 0,a)})}}])}(),ld=function(){function r(){ht(this,r),this.callbacks=[]}return dt(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(this.callbacks.length){for(var a=arguments,s=this.callbacks[0].apply(void 0,a),o=0;o<this.callbacks.length-1;o++){var l=this.callbacks[o];s=l(s)}return s}return null}}])}(),WD=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],VD=/([\"\'])[^\'\"]+\1/;function UD(r){for(var t=r.fontSize,e=t===void 0?16:t,n=r.fontFamily,i=n===void 0?"sans-serif":n,a=r.fontStyle,s=a===void 0?"normal":a,o=r.fontVariant,l=o===void 0?"normal":o,u=r.fontWeight,c=u===void 0?"normal":u,h=St(e)&&"".concat(e,"px")||"16px",d=i.split(","),f=d.length-1;f>=0;f--){var v=d[f].trim();!VD.test(v)&&WD.indexOf(v)<0&&(v='"'.concat(v,'"')),d[f]=v}return"".concat(s," ").concat(l," ").concat(c," ").concat(h," ").concat(d.join(","))}function ud(r,t,e){return ta(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var We=fe(),YD=fe(),HD={scale:function(t){ba(We,[t[0].value,t[1].value,1])},scaleX:function(t){ba(We,[t[0].value,1,1])},scaleY:function(t){ba(We,[1,t[0].value,1])},scaleZ:function(t){ba(We,[1,1,t[0].value])},scale3d:function(t){ba(We,[t[0].value,t[1].value,t[2].value])},translate:function(t){zi(We,[t[0].value,t[1].value,0])},translateX:function(t){zi(We,[t[0].value,0,0])},translateY:function(t){zi(We,[0,t[0].value,0])},translateZ:function(t){zi(We,[0,0,t[0].value])},translate3d:function(t){zi(We,[t[0].value,t[1].value,t[2].value])},rotate:function(t){Cy(We,ae(Un(t[0])))},rotateX:function(t){DO(We,ae(Un(t[0])))},rotateY:function(t){BO(We,ae(Un(t[0])))},rotateZ:function(t){Cy(We,ae(Un(t[0])))},rotate3d:function(t){IO(We,ae(Un(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){ud(We,ae(t[0].value),ae(t[1].value))},skewX:function(t){ud(We,ae(t[0].value),0)},skewY:function(t){ud(We,0,ae(t[0].value))},matrix:function(t){Ny(We,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){Ny.apply(UR,[We].concat(pe(t.map(function(e){return e.value}))))}},XD=ye(1,1,1),KD=Zt(),tw={translate:function(t,e){ft.sceneGraphService.setLocalScale(t,XD,!1),ft.sceneGraphService.setLocalEulerAngles(t,KD,void 0,void 0,!1),ft.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),ft.sceneGraphService.dirtifyLocal(t,t.transformable)}};function BT(r,t){if(r.length){if(r.length===1&&tw[r[0].t]){tw[r[0].t](t,r[0].d);return}for(var e=ta(YD),n=0;n<r.length;n++){var i=r[n],a=i.t,s=i.d,o=HD[a];o&&(o(s),VO(e,e,We))}t.setLocalTransform(e)}else t.resetLocalTransform();return t.getLocalTransform()}var ZD=function(){function r(){ht(this,r),this.parser=KI,this.mixer=aD}return dt(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Er?[]:i}},{key:"postProcessor",value:function(e){BT(e.parsedStyle.transform,e)}}])}(),JD=function(){function r(){ht(this,r)}return dt(r,[{key:"postProcessor",value:function(e){var n=e.parsedStyle.transformOrigin;n[0].unit===wt.kPixels&&n[1].unit===wt.kPixels?e.setOrigin(n[0].value,n[1].value):e.getGeometryBounds()}}])}(),QD=function(){function r(){ht(this,r)}return dt(r,[{key:"calculator",value:function(e,n,i,a){return i.value}},{key:"postProcessor",value:function(e){if(e.parentNode){var n=e.parentNode,i=n.renderable,a=n.sortable;i&&(i.dirty=!0),a&&(a.dirty=!0,a.dirtyReason=Bu.Z_INDEX_CHANGED)}}}])}(),t6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.r,u=l===void 0?0:l;return{cx:a,cy:o,hwidth:u,hheight:u}}}])}(),e6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.rx,u=l===void 0?0:l,c=e.ry,h=c===void 0?0:c;return{cx:a,cy:o,hwidth:u,hheight:h}}}])}(),n6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e){var n=e.x1,i=e.y1,a=e.x2,s=e.y2,o=Math.min(n,a),l=Math.max(n,a),u=Math.min(i,s),c=Math.max(i,s),h=l-o,d=c-u,f=h/2,v=d/2;return{cx:o+f,cy:u+v,hwidth:f,hheight:v}}}])}(),r6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e){var n=e.d,i=n.rect,a=i.x,s=i.y,o=i.width,l=i.height,u=o/2,c=l/2;return{cx:a+u,cy:s+c,hwidth:u,hheight:c}}}])}(),i6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e){if(e.points&&lr(e.points.points)){var n=e.points.points,i=Math.min.apply(Math,pe(n.map(function(d){return d[0]}))),a=Math.max.apply(Math,pe(n.map(function(d){return d[0]}))),s=Math.min.apply(Math,pe(n.map(function(d){return d[1]}))),o=Math.max.apply(Math,pe(n.map(function(d){return d[1]}))),l=a-i,u=o-s,c=l/2,h=u/2;return{cx:i+c,cy:s+h,hwidth:c,hheight:h}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),a6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.src,u=e.width,c=u===void 0?0:u,h=e.height,d=h===void 0?0:h,f=c,v=d;return l&&!ee(l)&&(f||(f=l.width,e.width=f),v||(v=l.height,e.height=v)),{cx:a+f/2,cy:o+v/2,hwidth:f/2,hheight:v/2}}}])}(),s6=function(){function r(t){ht(this,r),this.globalRuntime=t}return dt(r,[{key:"isReadyToMeasure",value:function(e,n){var i=e.text;return i}},{key:"update",value:function(e,n){var i,a=e.text,s=e.textAlign,o=s===void 0?"start":s,l=e.lineWidth,u=l===void 0?1:l,c=e.textBaseline,h=c===void 0?"alphabetic":c,d=e.dx,f=d===void 0?0:d,v=e.dy,p=v===void 0?0:v,g=e.x,y=g===void 0?0:g,m=e.y,w=m===void 0?0:m;if(!this.isReadyToMeasure(e,n))return e.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{hwidth:0,hheight:0,cx:0,cy:0};var E=(n==null||(i=n.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0?void 0:i.getConfig())||{},_=E.offscreenCanvas,k=this.globalRuntime.textService.measureText(a,e,_);e.metrics=k;var T=k.width,O=k.height,P=T/2,N=O/2,C=y+P;o==="center"||o==="middle"?C+=u/2-P:(o==="right"||o==="end")&&(C+=u-P*2);var L=w-N;return h==="middle"?L+=N:h==="top"||h==="hanging"?L+=N*2:h==="alphabetic"||(h==="bottom"||h==="ideographic")&&(L+=0),f&&(C+=f),p&&(L+=p),{cx:C,cy:L,hwidth:P,hheight:N}}}])}(),o6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e,n){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),l6=function(){function r(){ht(this,r)}return dt(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.width,u=l===void 0?0:l,c=e.height,h=c===void 0?0:c;return{cx:a+u/2,cy:o+h/2,hwidth:u/2,hheight:h/2}}}])}(),fc=function(){function r(t){ht(this,r),this.eventPhase=r.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new mn,this.page=new mn,this.canvas=new mn,this.viewport=new mn,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}return dt(r,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}},{key:"clone",value:function(){throw new Error(ie)}}])}(),FT=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.client=new mn,e.movement=new mn,e.offset=new mn,e.global=new mn,e.screen=new mn,e}return Wt(t,r),dt(t,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(n){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(n)}},{key:"initMouseEvent",value:function(){throw new Error(ie)}}])}(fc),Gu=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.width=0,e.height=0,e.isPrimary=!1,e}return Wt(t,r),dt(t,[{key:"getCoalescedEvents",value:function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])}(FT),em=function(r){function t(){return ht(this,t),Gt(this,t,arguments)}return Wt(t,r),dt(t,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}(FT),He=function(r){function t(e,n){var i;return ht(this,t),i=Gt(this,t,[null]),i.type=e,i.detail=n,Object.assign(i,n),i}return Wt(t,r),dt(t)}(fc),ew=new WeakMap,zT=function(){function r(){ht(this,r),this.emitter=new kO}return dt(r,[{key:"on",value:function(e,n,i){return this.addEventListener(e,n,i),this}},{key:"addEventListener",value:function(e,n,i){var a=!1,s=!1;if(Lu(i))a=i;else if(i){var o=i.capture;a=o===void 0?!1:o;var l=i.once;s=l===void 0?!1:l}a&&(e+="capture"),n=Ot(n)?n:n.handleEvent;var u=Ot(n)?void 0:n;return s?this.emitter.once(e,n,u):this.emitter.on(e,n,u),this}},{key:"off",value:function(e,n,i){return e?this.removeEventListener(e,n,i):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var e;(e=this.emitter)===null||e===void 0||e.removeAllListeners()}},{key:"removeEventListener",value:function(e,n,i){var a;if(!this.emitter)return this;var s=Lu(i)?i:i==null?void 0:i.capture;s&&(e+="capture"),n=Ot(n)?n:(a=n)===null||a===void 0?void 0:a.handleEvent;var o=Ot(n)?void 0:n;return this.emitter.off(e,n,o),this}},{key:"emit",value:function(e,n){this.dispatchEvent(new He(e,n))}},{key:"dispatchEvent",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=ew.get(this);if(!i){var a;this.document?i=this:this.defaultView?i=this.defaultView:i=(a=this.ownerDocument)===null||a===void 0?void 0:a.defaultView,i&&ew.set(this,i)}if(i){if(e.manager=i.getEventService(),!e.manager)return!1;e.defaultPrevented=!1,e.path?e.path.length=0:e.page=[],n||(e.target=this),e.manager.dispatchEvent(e,e.type,n)}else this.emitter.emit(e.type,e);return!e.defaultPrevented}}])}(),Ne=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.shadow=!1,e.ownerDocument=null,e.isConnected=!1,e.baseURI="",e.childNodes=[],e.nodeType=0,e.nodeName="",e.nodeValue=null,e.parentNode=null,e}return Wt(t,r),dt(t,[{key:"textContent",get:function(){var n="";this.nodeName===rt.TEXT&&(n+=this.style.text);var i=wa(this.childNodes),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;s.nodeName===rt.TEXT?n+=s.nodeValue:n+=s.textContent}}catch(o){i.e(o)}finally{i.f()}return n},set:function(n){var i=this;this.childNodes.slice().forEach(function(a){i.removeChild(a)}),this.nodeName===rt.TEXT&&(this.style.text="".concat(n))}},{key:"getRootNode",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(ie)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(ie)}},{key:"lookupPrefix",value:function(n){throw new Error(ie)}},{key:"normalize",value:function(){throw new Error(ie)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(l=i.parentNode)!==null&&l!==void 0?l:a.parentNode;){var l;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return t.DOCUMENT_POSITION_DISCONNECTED|t.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t.DOCUMENT_POSITION_PRECEDING;var u=s.length>o.length?s:o,c=u===s?o:s;if(u[u.length-c.length]===c[0])return u===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var h=u.length-c.length,d=c.length-1;d>=0;d--){var f=c[d],v=u[h+d];if(v!==f){var p=f.parentNode.childNodes;return p.indexOf(f)<p.indexOf(v)?c===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING:u===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING}}return t.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(n){return this.contains(n)}},{key:"contains",value:function(n){for(var i=n;i&&this!==i;)i=i.parentNode;return!!i}},{key:"getAncestor",value:function(n){for(var i=this;n>0&&i;)i=i.parentNode,n--;return i}},{key:"forEach",value:function(n){for(var i=[this];i.length>0;){var a=i.pop(),s=n(a);if(s===!1)break;for(var o=a.childNodes.length-1;o>=0;o--)i.push(a.childNodes[o])}}}],[{key:"isNode",value:function(n){return!!n.childNodes}}])}(zT);Ne.DOCUMENT_POSITION_DISCONNECTED=1;Ne.DOCUMENT_POSITION_PRECEDING=2;Ne.DOCUMENT_POSITION_FOLLOWING=4;Ne.DOCUMENT_POSITION_CONTAINS=8;Ne.DOCUMENT_POSITION_CONTAINED_BY=16;Ne.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var u6=2048,c6=function(){function r(t,e){var n=this;ht(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=fe(),this.tmpVec3=Zt(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var s=a.button===2;n.dispatchEvent(a,s?"rightdown":"mousedown")}var o=n.trackingData(i.pointerId);o.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a=tm.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var l=n.trackingData(i.pointerId),u=n.findMountedTarget(l.pressTargetsByButton[i.button]),c=u;if(u&&!s.composedPath().includes(u)){for(var h=u;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var d=s.button===2;n.notifyTarget(s,d?"rightupoutside":"mouseupoutside")}Ne.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],c=h}if(c){var f,v=n.clonePointerEvent(s,"click");v.target=c,v.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:v.target,timeStamp:a});var p=n.context.renderingContext.root.ownerDocument.defaultView,g=l.clicksByButton[i.button];g.target===v.target&&a-g.timeStamp<p.getConfig().dblClickSpeed?++g.clickCount:g.clickCount=1,g.target=v.target,g.timeStamp=a,v.detail=g.clickCount,(f=s.detail)!==null&&f!==void 0&&f.preventClick||(!n.context.config.useNativeClickEvent&&(v.pointerType==="mouse"||v.pointerType==="touch")&&n.dispatchEvent(v,"click"),n.dispatchEvent(v,"pointertap")),n.freeEvent(v)}n.freeEvent(s)},this.onPointerMove=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),s=a.pointerType==="mouse"||a.pointerType==="pen",o=n.trackingData(i.pointerId),l=n.findMountedTarget(o.overTargets);if(o.overTargets&&l!==a.target){var u=i.type==="mousemove"?"mouseout":"pointerout",c=n.createPointerEvent(i,u,l||void 0);if(n.dispatchEvent(c,"pointerout"),s&&n.dispatchEvent(c,"mouseout"),!a.composedPath().includes(l)){var h=n.createPointerEvent(i,"pointerleave",l||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&!a.composedPath().includes(h.target);)h.currentTarget=h.target,n.notifyTarget(h),s&&n.notifyTarget(h,"mouseleave"),Ne.isNode(h.target)&&(h.target=h.target.parentNode);n.freeEvent(h)}n.freeEvent(c)}if(l!==a.target){var d=i.type==="mousemove"?"mouseover":"pointerover",f=n.clonePointerEvent(a,d);n.dispatchEvent(f,"pointerover"),s&&n.dispatchEvent(f,"mouseover");for(var v=l&&Ne.isNode(l)&&l.parentNode;v&&v!==(Ne.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&v!==a.target;)v=v.parentNode;var p=!v||v===(Ne.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(p){var g=n.clonePointerEvent(a,"pointerenter");for(g.eventPhase=g.AT_TARGET;g.target&&g.target!==l&&g.target!==(Ne.isNode(n.rootTarget)&&n.rootTarget.parentNode);)g.currentTarget=g.target,n.notifyTarget(g),s&&n.notifyTarget(g,"mouseenter"),Ne.isNode(g.target)&&(g.target=g.target.parentNode);n.freeEvent(g)}n.freeEvent(f)}n.dispatchEvent(a,"pointermove"),a.pointerType==="touch"&&n.dispatchEvent(a,"touchmove"),s&&(n.dispatchEvent(a,"mousemove"),n.cursor=n.getCursor(a.target)),o.overTargets=a.composedPath(),n.freeEvent(a)},this.onPointerOut=function(i){var a=n.trackingData(i.pointerId);if(a.overTargets){var s=i.pointerType==="mouse"||i.pointerType==="pen",o=n.findMountedTarget(a.overTargets),l=n.createPointerEvent(i,"pointerout",o||void 0);n.dispatchEvent(l),s&&n.dispatchEvent(l,"mouseout");var u=n.createPointerEvent(i,"pointerleave",o||void 0);for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==(Ne.isNode(n.rootTarget)&&n.rootTarget.parentNode);)u.currentTarget=u.target,n.notifyTarget(u),s&&n.notifyTarget(u,"mouseleave"),Ne.isNode(u.target)&&(u.target=u.target.parentNode);a.overTargets=null,n.freeEvent(l),n.freeEvent(u)}n.cursor=null},this.onPointerOver=function(i){var a=n.trackingData(i.pointerId),s=n.createPointerEvent(i),o=s.pointerType==="mouse"||s.pointerType==="pen";n.dispatchEvent(s,"pointerover"),o&&n.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(n.cursor=n.getCursor(s.target));var l=n.clonePointerEvent(s,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==(Ne.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),o&&n.notifyTarget(l,"mouseenter"),Ne.isNode(l.target)&&(l.target=l.target.parentNode);a.overTargets=s.composedPath(),n.freeEvent(s),n.freeEvent(l)},this.onPointerUpOutside=function(i){var a=n.trackingData(i.pointerId),s=n.findMountedTarget(a.pressTargetsByButton[i.button]),o=n.createPointerEvent(i);if(s){for(var l=s;l;)o.currentTarget=l,n.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"||(o.pointerType==="mouse"||o.pointerType==="pen")&&n.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),Ne.isNode(l)&&(l=l.parentNode);delete a.pressTargetsByButton[i.button]}n.freeEvent(o)},this.onWheel=function(i){var a=n.createWheelEvent(i);n.dispatchEvent(a),n.freeEvent(a)},this.onClick=function(i){if(n.context.config.useNativeClickEvent){var a=n.createPointerEvent(i);n.dispatchEvent(a),n.freeEvent(a)}},this.onPointerCancel=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(a),n.freeEvent(a)},this.globalRuntime=t,this.context=e}return dt(r,[{key:"init",value:function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)}},{key:"destroy",value:function(){this.mappingTable={},this.mappingState={},this.eventPool.clear()}},{key:"getScale",value:function(){var e=this.context.contextService.getBoundingClientRect(),n=1,i=1,a=this.context.contextService.getDomElement();if(a&&e){var s=a.offsetWidth,o=a.offsetHeight;s&&o&&(n=e.width/s,i=e.height/o)}return{scaleX:n,scaleY:i,bbox:e}}},{key:"client2Viewport",value:function(e){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new mn((e.x-((s==null?void 0:s.left)||0))/i,(e.y-((s==null?void 0:s.top)||0))/a)}},{key:"viewport2Client",value:function(e){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new mn((e.x+((s==null?void 0:s.left)||0))*i,(e.y+((s==null?void 0:s.top)||0))*a)}},{key:"viewport2Canvas",value:function(e){var n=e.x,i=e.y,a=this.rootTarget.defaultView,s=a.getCamera(),o=this.context.config,l=o.width,u=o.height,c=s.getPerspectiveInverse(),h=s.getWorldTransform(),d=An(this.tmpMatrix,h,c),f=Tn(this.tmpVec3,n/l*2-1,(1-i/u)*2-1,0);return Pn(f,f,d),new mn(f[0],f[1])}},{key:"canvas2Viewport",value:function(e){var n=this.rootTarget.defaultView,i=n.getCamera(),a=i.getPerspective(),s=i.getViewTransform(),o=An(this.tmpMatrix,a,s),l=Tn(this.tmpVec3,e.x,e.y,0);Pn(this.tmpVec3,this.tmpVec3,o);var u=this.context.config,c=u.width,h=u.height;return new mn((l[0]+1)/2*c,(1-(l[1]+1)/2)*h)}},{key:"setPickHandler",value:function(e){this.pickHandler=e}},{key:"addEventMapping",value:function(e,n){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:n,priority:0}),this.mappingTable[e].sort(function(i,a){return i.priority-a.priority})}},{key:"mapEvent",value:function(e){if(this.rootTarget){var n=this.mappingTable[e.type];if(n)for(var i=0,a=n.length;i<a;i++)n[i].fn(e);else console.warn("[EventService]: Event mapping not defined for ".concat(e.type))}}},{key:"dispatchEvent",value:function(e,n,i){if(!i)e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,n);else{e.eventPhase=e.AT_TARGET;var a=this.rootTarget.defaultView||null;e.currentTarget=a,this.notifyListeners(e,n)}}},{key:"propagate",value:function(e,n){if(e.target){var i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(var a=i.length-1;a>=1;a--)if(e.currentTarget=i[a],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,n),!(e.propagationStopped||e.propagationImmediatelyStopped)){var s=i.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var o=s+1;o<i.length;o++)if(e.currentTarget=i[o],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(e){var n=[e],i=this.rootTarget.defaultView||null;if(i&&i===e)return n.unshift(i.document),n;for(var a=0;a<u6&&e!==this.rootTarget;a++)Ne.isNode(e)&&e.parentNode&&(n.push(e.parentNode),e=e.parentNode);return i&&n.push(i),n}},{key:"hitTest",value:function(e){var n=e.viewportX,i=e.viewportY,a=this.context.config,s=a.width,o=a.height,l=a.disableHitTesting;return n<0||i<0||n>s||i>o?null:!l&&this.pickHandler(e)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(e,n){var i,a=n==null?void 0:n.target;if((i=a)!==null&&i!==void 0&&i.shadowRoot&&(a=n.composedPath()[0]),a){if(a===e)return!0;if(e&&e.contains)return e.contains(a)}return n!=null&&n.composedPath?n.composedPath().indexOf(e)>-1:!1}},{key:"getExistedHTML",value:function(e){if(e.nativeEvent.composedPath)for(var n=0,i=e.nativeEvent.composedPath();n<i.length;n++){var a=i[n],s=this.nativeHTMLMap.get(a);if(s)return s}return null}},{key:"pickTarget",value:function(e){return this.hitTest({clientX:e.clientX,clientY:e.clientY,viewportX:e.viewportX,viewportY:e.viewportY,x:e.canvasX,y:e.canvasY})}},{key:"createPointerEvent",value:function(e,n,i,a){var s=this.allocateEvent(Gu);this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e;var o=this.getExistedHTML(s),l=this.context.contextService.getDomElement();return s.target=i!=null?i:o||this.isNativeEventFromCanvas(l,s.nativeEvent)&&this.pickTarget(s)||a,typeof n=="string"&&(s.type=n),s}},{key:"createWheelEvent",value:function(e){var n=this.allocateEvent(em);this.copyWheelData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n.originalEvent=e;var i=this.getExistedHTML(n),a=this.context.contextService.getDomElement();return n.target=i||this.isNativeEventFromCanvas(a,n.nativeEvent)&&this.pickTarget(n),n}},{key:"trackingData",value:function(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}},{key:"cloneWheelEvent",value:function(e){var n=this.allocateEvent(em);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyWheelData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=e.type,n}},{key:"clonePointerEvent",value:function(e,n){var i=this.allocateEvent(Gu);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=n!=null?n:i.type,i}},{key:"copyPointerData",value:function(e,n){n.pointerId=e.pointerId,n.width=e.width,n.height=e.height,n.isPrimary=e.isPrimary,n.pointerType=e.pointerType,n.pressure=e.pressure,n.tangentialPressure=e.tangentialPressure,n.tiltX=e.tiltX,n.tiltY=e.tiltY,n.twist=e.twist}},{key:"copyMouseData",value:function(e,n){n.altKey=e.altKey,n.button=e.button,n.buttons=e.buttons,n.ctrlKey=e.ctrlKey,n.metaKey=e.metaKey,n.shiftKey=e.shiftKey,n.client.copyFrom(e.client),n.movement.copyFrom(e.movement),n.canvas.copyFrom(e.canvas),n.screen.copyFrom(e.screen),n.global.copyFrom(e.global),n.offset.copyFrom(e.offset)}},{key:"copyWheelData",value:function(e,n){n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ}},{key:"copyData",value:function(e,n){n.isTrusted=e.isTrusted,n.timeStamp=tm.now(),n.type=e.type,n.detail=e.detail,n.view=e.view,n.page.copyFrom(e.page),n.viewport.copyFrom(e.viewport)}},{key:"allocateEvent",value:function(e){this.eventPool.has(e)||this.eventPool.set(e,[]);var n=this.eventPool.get(e).pop()||new e(this);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n}},{key:"freeEvent",value:function(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var n=e.constructor;this.eventPool.has(n)||this.eventPool.set(n,[]),this.eventPool.get(n).push(e)}},{key:"notifyTarget",value:function(e,n){n=n!=null?n:e.type;var i=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?"".concat(n,"capture"):n;this.notifyListeners(e,i),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,n)}},{key:"notifyListeners",value:function(e,n){var i=e.currentTarget.emitter,a=i._events[n];if(a)if("fn"in a)a.once&&i.removeListener(n,a.fn,void 0,!0),a.fn.call(e.currentTarget||a.context,e);else for(var s=0;s<a.length&&!e.propagationImmediatelyStopped;s++)a[s].once&&i.removeListener(n,a[s].fn,void 0,!0),a[s].fn.call(e.currentTarget||a[s].context,e)}},{key:"findMountedTarget",value:function(e){if(!e)return null;for(var n=e[e.length-1],i=e.length-2;i>=0;i--){var a=e[i];if(a===this.rootTarget||Ne.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=kD(n)&&n.getAttribute("cursor");if(i)return i;n=Ne.isNode(n)&&n.parentNode}}}])}(),Qm=function(){function r(){ht(this,r)}return dt(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||ft.offscreenCanvas)this.canvas=e||ft.offscreenCanvas,this.context=this.canvas.getContext("2d",$t({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",$t({willReadFrequently:!0},n)),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch{this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",$t({willReadFrequently:!0},n))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(e,n){return this.context?this.context:(this.getOrCreateCanvas(e,n),this.context)}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch{}try{return document.createElement("canvas")}catch{}return null}}])}(),xs=function(r){return r[r.CAMERA_CHANGED=0]="CAMERA_CHANGED",r[r.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",r[r.NONE=2]="NONE",r}({}),h6=function(){function r(t,e){ht(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new Nn,initAsync:new $D,dirtycheck:new ld,cull:new ld,beginFrame:new Nn,beforeRender:new Nn,render:new Nn,afterRender:new Nn,endFrame:new Nn,destroy:new Nn,pick:new GD,pickSync:new ld,pointerDown:new Nn,pointerUp:new Nn,pointerMove:new Nn,pointerOut:new Nn,pointerOver:new Nn,pointerWheel:new Nn,pointerCancel:new Nn,click:new Nn},this.globalRuntime=t,this.context=e}return dt(r,[{key:"init",value:function(e){var n=this,i=$t($t({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(a){a.apply(i,n.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,e()):this.hooks.initAsync.promise().then(function(){n.inited=!0,e()}).catch(function(a){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){var e=this.context.config.renderer,n=e.getConfig(),i=n.enableDirtyRectangleRendering;return!i||this.context.renderingContext.renderReasons.has(xs.CAMERA_CHANGED)}},{key:"render",value:function(e,n,i){var a=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var s=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(s.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),s.renderReasons.size&&this.inited){s.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var o=s.renderReasons.size===1&&s.renderReasons.has(xs.CAMERA_CHANGED),l=!e.disableRenderHooks||!(e.disableRenderHooks&&o);l&&this.renderDisplayObject(s.root,e,s),this.hooks.beginFrame.call(n),l&&s.renderListCurrentFrame.forEach(function(u){a.hooks.beforeRender.call(u),a.hooks.render.call(u),a.hooks.afterRender.call(u)}),this.hooks.endFrame.call(n),s.renderListCurrentFrame=[],s.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,l=s.enableCulling;function u(v){var p=v.renderable,g=v.sortable,y=o?p.dirty||i.dirtyRectangleRenderingDisabled?v:null:v;if(y){var m=l?a.hooks.cull.call(y,a.context.camera):y;m&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(m))}p.dirty=!1,g.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,g.dirty&&(a.sort(v,g),g.dirty=!1,g.dirtyChildren=[],g.dirtyReason=void 0)}for(var c=[e];c.length>0;){var h=c.pop();u(h);for(var d=h.sortable.sorted||h.childNodes,f=d.length-1;f>=0;f--)c.push(d[f])}}},{key:"sort",value:function(e,n){n.sorted&&n.dirtyReason!==Bu.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(i){var a=e.childNodes.indexOf(i);if(a===-1){var s=n.sorted.indexOf(i);s>=0&&n.sorted.splice(s,1)}else if(n.sorted.length===0)n.sorted.push(i);else{var o=OD(n.sorted,i);n.sorted.splice(o,0,i)}}):n.sorted=e.childNodes.slice().sort(NT)}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add(xs.DISPLAY_OBJECT_CHANGED)}}])}(),d6=/\[\s*(.*)=(.*)\s*\]/,f6=function(){function r(){ht(this,r)}return dt(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(l){return((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(l){return l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):null}return n.find(function(l){return n!==l&&l.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(l){return n!==l&&((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(l){return n!==l&&l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):[]}return n.findAll(function(l){return n!==l&&l.nodeName===e})}},{key:"is",value:function(e,n){if(e.startsWith("."))return n.className===this.getIdOrClassname(e);if(e.startsWith("#"))return n.id===this.getIdOrClassname(e);if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===e}},{key:"getIdOrClassname",value:function(e){return e.substring(1)}},{key:"getAttribute",value:function(e){var n=e.match(d6),i="",a="";return n&&n.length>2&&(i=n[1].replace(/"/g,""),a=n[2].replace(/"/g,"")),{name:i,value:a}}},{key:"attributeToString",value:function(e,n){if(!e.getAttribute)return"";var i=e.getAttribute(n);return Rt(i)?"":i.toString?i.toString():""}}])}(),Ht=function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r}({}),ri=function(r){function t(e,n,i,a,s,o,l,u){var c;return ht(this,t),c=Gt(this,t,[null]),c.relatedNode=n,c.prevValue=i,c.newValue=a,c.attrName=s,c.attrChange=o,c.prevParsedValue=l,c.newParsedValue=u,c.type=e,c}return Wt(t,r),dt(t)}(fc);ri.ADDITION=2;ri.MODIFICATION=1;ri.REMOVAL=3;function nw(r){var t=r.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var g6=new ri(Ht.REPARENT,null,"","","",0,"",""),v6=Gm(),Tl=Zt(),p6=ye(1,1,1),y6=fe(),m6=Gm(),Ni=Zt(),is=fe(),Ci=nn(),b6=Zt(),w6=nn(),x6=Zt(),Xs=Zt(),ga=Zt(),Al=fe(),rw=nn(),iw=nn(),Pl=nn(),cd={affectChildren:!0},E6=function(){function r(t){ht(this,r),this.pendingEvents=new Map,this.boundsChangedEvent=new He(Ht.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return dt(r,[{key:"matches",value:function(e,n){return this.runtime.sceneGraphSelector.is(e,n)}},{key:"querySelector",value:function(e,n){return this.runtime.sceneGraphSelector.selectOne(e,n)}},{key:"querySelectorAll",value:function(e,n){return this.runtime.sceneGraphSelector.selectAll(e,n)}},{key:"attach",value:function(e,n,i){var a,s=!1;e.parentNode&&(s=e.parentNode!==n,this.detach(e));var o=e.nodeName===rt.FRAGMENT,l=$u(n);e.parentNode=n;var u=o?e.childNodes:[e];St(i)?u.forEach(function(f){n.childNodes.splice(i,0,f),f.parentNode=n}):u.forEach(function(f){n.childNodes.push(f),f.parentNode=n});var c=n,h=c.sortable;if((h!=null&&(a=h.sorted)!==null&&a!==void 0&&a.length||e.parsedStyle.zIndex)&&(h.dirtyChildren.indexOf(e)===-1&&h.dirtyChildren.push(e),h.dirty=!0,h.dirtyReason=Bu.ADDED),!l){if(o)this.dirtifyFragment(e);else{var d=e.transformable;d&&this.dirtifyWorld(e,d)}s&&e.dispatchEvent(g6)}}},{key:"detach",value:function(e){if(e.parentNode){var n,i,a=e.transformable,s=e.parentNode,o=s.sortable;(o!=null&&(n=o.sorted)!==null&&n!==void 0&&n.length||(i=e.style)!==null&&i!==void 0&&i.zIndex)&&(o.dirtyChildren.indexOf(e)===-1&&o.dirtyChildren.push(e),o.dirty=!0,o.dirtyReason=Bu.REMOVED);var l=e.parentNode.childNodes.indexOf(e);l>-1&&e.parentNode.childNodes.splice(l,1),a&&this.dirtifyWorld(e,a),e.parentNode=null}}},{key:"getOrigin",value:function(e){return e.getGeometryBounds(),e.transformable.origin}},{key:"setOrigin",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=[n,i,a]);var s=e.transformable;if(!(n[0]===s.origin[0]&&n[1]===s.origin[1]&&n[2]===s.origin[2])){var o=s.origin;o[0]=n[0],o[1]=n[1],o[2]=n[2]||0,this.dirtifyLocal(e,s)}}},{key:"rotate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=ye(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=Ci;bl(o,n[0],n[1],n[2]);var l=this.getRotation(e),u=this.getRotation(e.parentNode);wl(Pl,u),Yh(Pl,Pl),Ki(o,Pl,o),Ki(s.localRotation,o,l),Pu(s.localRotation,s.localRotation),this.dirtifyLocal(e,s)}}},{key:"rotateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=ye(n,i,a));var s=e.transformable;bl(iw,n[0],n[1],n[2]),mb(s.localRotation,s.localRotation,iw),this.dirtifyLocal(e,s)}},{key:"setEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=ye(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{bl(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);wl(rw,Yh(Ci,o)),mb(s.localRotation,s.localRotation,rw),this.dirtifyLocal(e,s)}}},{key:"setLocalEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;typeof n=="number"&&(n=ye(n,i,a));var o=e.transformable;bl(o.localRotation,n[0],n[1],n[2]),s&&this.dirtifyLocal(e,o)}},{key:"translateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=ye(n,i,a));var s=e.transformable;Ys(n,Tl)||(JR(n,n,s.localRotation),Xi(s.localPosition,s.localPosition,n),this.dirtifyLocal(e,s))}},{key:"setPosition",value:function(e,n){var i,a=e.transformable;if(ga[0]=n[0],ga[1]=n[1],ga[2]=(i=n[2])!==null&&i!==void 0?i:0,!Ys(this.getPosition(e),ga)){if(Jr(a.position,ga),e.parentNode===null||!e.parentNode.transformable)Jr(a.localPosition,ga);else{var s=e.parentNode.transformable;Ss(Al,s.worldTransform),Zr(Al,Al),Pn(a.localPosition,ga,Al)}this.dirtifyLocal(e,a)}}},{key:"setLocalPosition",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Xs[0]=n[0],Xs[1]=n[1],Xs[2]=(i=n[2])!==null&&i!==void 0?i:0,!Ys(s.localPosition,Xs)&&(Jr(s.localPosition,Xs),a&&this.dirtifyLocal(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;YR(a.localScale,a.localScale,Tn(Ni,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:1)),this.dirtifyLocal(e,a)}},{key:"setLocalScale",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Tn(Ni,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!Ys(Ni,s.localScale)&&(Jr(s.localScale,Ni),a&&this.dirtifyLocal(e,s))}},{key:"translate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Tn(Ni,n,i,a)),!Ys(n,Tl)&&(Xi(Ni,this.getPosition(e),n),this.setPosition(e,Ni))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=i3(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var l=this.getRotation(e.parentNode);wl(Ci,l),Yh(Ci,Ci),Ki(o.localRotation,Ci,n),Pu(o.localRotation,o.localRotation),this.dirtifyLocal(e,o)}}},{key:"setLocalRotation",value:function(e,n,i,a,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;typeof n=="number"&&(n=yb(Ci,n,i,a,s));var l=e.transformable;wl(l.localRotation,n),o&&this.dirtifyLocal(e,l)}},{key:"setLocalSkew",value:function(e,n,i){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;typeof n=="number"&&(n=s3(m6,n,i));var s=e.transformable;a3(s.localSkew,n),a&&this.dirtifyLocal(e,s)}},{key:"dirtifyLocal",value:function(e,n){$u(e)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtifyWorld(e,n))}},{key:"dirtifyWorld",value:function(e,n){n.dirtyFlag||this.unfreezeParentToRoot(e),this.dirtifyWorldInternal(e,n),this.dirtifyToRoot(e,!0)}},{key:"dirtifyFragment",value:function(e){var n=e.transformable;n&&(n.frozen=!1,n.dirtyFlag=!0,n.localDirtyFlag=!0);var i=e.renderable;i&&(i.renderBoundsDirty=!0,i.boundsDirty=!0,i.dirty=!0);for(var a=e.childNodes.length,s=0;s<a;s++)this.dirtifyFragment(e.childNodes[s]);e.nodeName===rt.FRAGMENT&&this.pendingEvents.set(e,!1)}},{key:"triggerPendingEvents",value:function(){var e=this,n=new Set,i=function(s,o){!s.isConnected||n.has(s)||s.nodeName===rt.FRAGMENT||(e.boundsChangedEvent.detail=o,e.boundsChangedEvent.target=s,s.isMutationObserved?s.dispatchEvent(e.boundsChangedEvent):s.ownerDocument.defaultView.dispatchEvent(e.boundsChangedEvent,!0),n.add(s))};this.pendingEvents.forEach(function(a,s){s.nodeName!==rt.FRAGMENT&&(cd.affectChildren=a,a?s.forEach(function(o){i(o,cd)}):i(s,cd))}),n.clear(),this.clearPendingEvents()}},{key:"clearPendingEvents",value:function(){this.pendingEvents.clear()}},{key:"dirtifyToRoot",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e;for(i.renderable&&(i.renderable.dirty=!0);i;)nw(i),i=i.parentNode;n&&e.forEach(function(a){nw(a)}),this.informDependentDisplayObjects(e),this.pendingEvents.set(e,n)}},{key:"updateDisplayObjectDependency",value:function(e,n,i,a){if(n&&n!==i){var s=this.displayObjectDependencyMap.get(n);if(s&&s[e]){var o=s[e].indexOf(a);s[e].splice(o,1)}}if(i){var l=this.displayObjectDependencyMap.get(i);l||(this.displayObjectDependencyMap.set(i,{}),l=this.displayObjectDependencyMap.get(i)),l[e]||(l[e]=[]),l[e].push(a)}}},{key:"informDependentDisplayObjects",value:function(e){var n=this,i=this.displayObjectDependencyMap.get(e);i&&Object.keys(i).forEach(function(a){i[a].forEach(function(s){n.dirtifyToRoot(s,!0),s.dispatchEvent(new ri(Ht.ATTR_MODIFIED,s,n,n,a,ri.MODIFICATION,n,n)),s.isCustomElement&&s.isConnected&&s.attributeChangedCallback&&s.attributeChangedCallback(a,n,n)})})}},{key:"getPosition",value:function(e){var n=e.transformable;return Ou(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return Tu(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return _s(n.scaling,this.getWorldTransform(e,n))}},{key:"getWorldTransform",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e.transformable;return!n.localDirtyFlag&&!n.dirtyFlag||(e.parentNode&&e.parentNode.transformable&&this.getWorldTransform(e.parentNode),this.sync(e,n)),n.worldTransform}},{key:"getLocalPosition",value:function(e){return e.transformable.localPosition}},{key:"getLocalRotation",value:function(e){return e.transformable.localRotation}},{key:"getLocalScale",value:function(e){return e.transformable.localScale}},{key:"getLocalSkew",value:function(e){return e.transformable.localSkew}},{key:"calcLocalTransform",value:function(e){var n=e.localSkew[0]!==0||e.localSkew[1]!==0;if(n){yo(e.localTransform,e.localRotation,e.localPosition,ye(1,1,1),e.origin),(e.localSkew[0]!==0||e.localSkew[1]!==0)&&(ta(is),is[4]=Math.tan(e.localSkew[0]),is[1]=Math.tan(e.localSkew[1]),An(e.localTransform,e.localTransform,is));var i=yo(is,yb(Ci,0,0,0,1),Tn(Ni,1,1,1),e.localScale,e.origin);An(e.localTransform,e.localTransform,i)}else{var a=e.localTransform,s=e.localPosition,o=e.localRotation,l=e.localScale,u=e.origin,c=s[0]!==0||s[1]!==0||s[2]!==0,h=o[3]!==1||o[0]!==0||o[1]!==0||o[2]!==0,d=l[0]!==1||l[1]!==1||l[2]!==1,f=u[0]!==0||u[1]!==0||u[2]!==0;!h&&!d&&!f?c?zi(a,s):ta(a):yo(a,o,s,l,u)}}},{key:"getLocalTransform",value:function(e){var n=e.transformable;return n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.localTransform}},{key:"setLocalTransform",value:function(e,n){var i=Ou(b6,n),a=Tu(w6,n),s=_s(x6,n);this.setLocalScale(e,s,!1),this.setLocalPosition(e,i,!1),this.setLocalRotation(e,a,void 0,void 0,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"resetLocalTransform",value:function(e){this.setLocalScale(e,p6,!1),this.setLocalPosition(e,Tl,!1),this.setLocalEulerAngles(e,Tl,void 0,void 0,!1),this.setLocalSkew(e,v6,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"getTransformedGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0,a=this.getGeometryBounds(e,n);if(!ge.isEmpty(a)){var s=i||new ge;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&&ft.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new ge}},{key:"getBounds",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,l=this.getTransformedGeometryBounds(e,i,o),u=e.childNodes;if(u.forEach(function(d){var f=n.getBounds(d,i);f&&(l?l.add(f):(l=o||new ge,l.update(f.center,f.halfExtents)))}),l||(l=new ge),i){var c=CT(e);if(c){var h=c.parsedStyle.clipPath.getBounds(i);l?h&&(l=h.intersection(l)):l.update(h.center,h.halfExtents)}}return i?(s.renderBounds=l,s.renderBoundsDirty=!1):(s.bounds=l,s.boundsDirty=!1),l}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=y6;e.parentNode.transformable&&(n=Zr(is,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!ge.isEmpty(i)){var a=new ge;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);ge.isEmpty(a)||(i=new ge,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),l=jt(o,2),u=l[0],c=l[1],h=i.getMax(),d=jt(h,2),f=d[0],v=d[1];return new ks(u+((s==null?void 0:s.left)||0),c+((s==null?void 0:s.top)||0),f-u,v-c)}return new ks((s==null?void 0:s.left)||0,(s==null?void 0:s.top)||0,0,0)}},{key:"dirtifyWorldInternal",value:function(e,n){var i=this;if(!n.dirtyFlag){n.dirtyFlag=!0,n.frozen=!1,e.childNodes.forEach(function(o){var l=o.transformable;l.dirtyFlag||i.dirtifyWorldInternal(o,l)});var a=e,s=a.renderable;s&&(s.renderBoundsDirty=!0,s.boundsDirty=!0,s.dirty=!0)}}},{key:"syncHierarchy",value:function(e){var n=e.transformable;if(!n.frozen){n.frozen=!0,(n.localDirtyFlag||n.dirtyFlag)&&this.sync(e,n);for(var i=e.childNodes,a=0;a<i.length;a++)this.syncHierarchy(i[a])}}},{key:"sync",value:function(e,n){if(n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.dirtyFlag){var i=e.parentNode,a=i&&i.transformable;i===null||!a?Ss(n.worldTransform,n.localTransform):An(n.worldTransform,a.worldTransform,n.localTransform),n.dirtyFlag=!1}}},{key:"unfreezeParentToRoot",value:function(e){for(var n=e.parentNode;n;){var i=n.transformable;i&&(i.frozen=!1),n=n.parentNode}}}])}(),va={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},aw=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,S6=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,_6=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,M6=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,k6=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,O6=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,T6=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,A6=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,P6=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,N6=new RegExp("".concat(S6.source,"|").concat(M6.source,"|").concat(O6.source,"|").concat(A6.source)),C6=new RegExp("".concat(_6.source,"|").concat(k6.source,"|").concat(T6.source,"|").concat(P6.source)),R6=function(){function r(t){var e=this;ht(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&(C6.exec(i)||N6.exec(n)))},this.trimByKinsokuShorui=function(n){var i=pe(n),a=i[i.length-2];if(!a)return n;var s=a[a.length-1];return i[i.length-2]=a.slice(0,-1),i[i.length-1]=s+i[i.length-1],i},this.runtime=t}return dt(r,[{key:"measureFont",value:function(e,n){if(this.fontMetricsCache[e])return this.fontMetricsCache[e];var i={ascent:0,descent:0,fontSize:0},a=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(n),s=this.runtime.offscreenCanvasCreator.getOrCreateContext(n,{willReadFrequently:!0});s.font=e;var o=va.MetricsString+va.BaselineSymbol,l=Math.ceil(s.measureText(o).width),u=Math.ceil(s.measureText(va.BaselineSymbol).width),c=va.HeightMultiplier*u;u=u*va.BaselineMultiplier|0,a.width=l,a.height=c,s.fillStyle="#f00",s.fillRect(0,0,l,c),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,u);var h=s.getImageData(0,0,l||1,c||1).data,d=h.length,f=l*4,v=0,p=0,g=!1;for(v=0;v<u;++v){for(var y=0;y<f;y+=4)if(h[p+y]!==255){g=!0;break}if(!g)p+=f;else break}for(i.ascent=u-v,p=d-f,g=!1,v=c;v>u;--v){for(var m=0;m<f;m+=4)if(h[p+m]!==255){g=!0;break}if(!g)p-=f;else break}return i.descent=v-u,i.fontSize=i.ascent+i.descent,this.fontMetricsCache[e]=i,i}},{key:"measureText",value:function(e,n,i){var a=n.fontSize,s=a===void 0?16:a,o=n.wordWrap,l=o===void 0?!1:o,u=n.lineHeight,c=n.lineWidth,h=c===void 0?1:c,d=n.textBaseline,f=d===void 0?"alphabetic":d,v=n.textAlign,p=v===void 0?"start":v,g=n.letterSpacing,y=g===void 0?0:g,m=n.textPath;n.textPathSide,n.textPathStartOffset;var w=n.leading,E=w===void 0?0:w,_=UD(n),k=this.measureFont(_,i);k.fontSize===0&&(k.fontSize=s,k.ascent=s);var T=this.runtime.offscreenCanvasCreator.getOrCreateContext(i);T.font=_,n.isOverflowing=!1;var O=l?this.wordWrap(e,n,i):e,P=O.split(/(?:\r\n|\r|\n)/),N=new Array(P.length),C=0;if(m){m.getTotalLength();for(var L=0;L<P.length;L++)T.measureText(P[L]).width+(P[L].length-1)*y}else{for(var B=0;B<P.length;B++){var G=T.measureText(P[B]).width+(P[B].length-1)*y;N[B]=G,C=Math.max(C,G)}var V=C+h,U=u||k.fontSize+h,$=Math.max(U,k.fontSize+h)+(P.length-1)*(U+E);U+=E;var j=0;return f==="middle"?j=-$/2:f==="bottom"||f==="alphabetic"||f==="ideographic"?j=-$:(f==="top"||f==="hanging")&&(j=0),{font:_,width:V,height:$,lines:P,lineWidths:N,lineHeight:U,maxLineWidth:C,fontProperties:k,lineMetrics:N.map(function(Z,nt){var st=0;return p==="center"||p==="middle"?st-=Z/2:(p==="right"||p==="end")&&(st-=Z),new ks(st-h/2,j+nt*U,Z+h,U)})}}}},{key:"wordWrap",value:function(e,n,i){var a=this,s=this,o=n.wordWrapWidth,l=o===void 0?0:o,u=n.letterSpacing,c=u===void 0?0:u,h=n.maxLines,d=h===void 0?1/0:h,f=n.textOverflow,v=this.runtime.offscreenCanvasCreator.getOrCreateContext(i),p=l+c,g="";f==="ellipsis"?g="...":f&&f!=="clip"&&(g=f);var y=Array.from(e),m=[],w=0,E=0,_=0,k={},T=function(j){return a.getFromCache(j,c,k,v)},O=T(g);function P($,j,Z,nt){for(;T($)<nt&&j<y.length-1&&!s.isNewline(y[j+1]);)j+=1,$+=y[j];for(;T($)>nt&&j>Z;)j-=1,$=$.slice(0,-1);return{lineTxt:$,txtLastCharIndex:j}}function N($,j){if(!(O<=0||O>p)){if(!m[$]){m[$]=g;return}var Z=P(m[$],j,_+1,p-O);m[$]=Z.lineTxt+g}}for(var C=0;C<y.length;C++){var L=y[C],B=y[C-1],G=y[C+1],V=T(L);if(this.isNewline(L)){if(w+1>=d){n.isOverflowing=!0,C<y.length-1&&N(w,C-1);break}_=C-1,w+=1,E=0,m[w]="";continue}if(E>0&&E+V>p){var U=P(m[w],C-1,_+1,p);if(U.txtLastCharIndex!==C-1){if(m[w]=U.lineTxt,U.txtLastCharIndex===y.length-1)break;C=U.txtLastCharIndex+1,L=y[C],B=y[C-1],G=y[C+1],V=T(L)}if(w+1>=d){n.isOverflowing=!0,N(w,C-1);break}if(_=C-1,w+=1,E=0,m[w]="",this.isBreakingSpace(L))continue;this.canBreakInLastChar(L)||(m=this.trimToBreakable(m),E=this.sumTextWidthByCache(m[w]||"",T)),this.shouldBreakByKinsokuShorui(L,G)&&(m=this.trimByKinsokuShorui(m),E+=T(B||""))}E+=V,m[w]=(m[w]||"")+L}return m.join(`
5
- `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:va.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:va.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=pe(e),i=n[n.length-2],a=this.findBreakableIndex(i);if(a===-1||!i)return n;var s=i.slice(a,a+1),o=this.isBreakingSpace(s),l=a+1,u=a+(o?0:1);return n[n.length-1]+=i.slice(l,i.length),n[n.length-2]=i.slice(0,u),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&aw.test(e))}},{key:"sumTextWidthByCache",value:function(e,n){return e.split("").reduce(function(i,a){return i+n(a)},0)}},{key:"findBreakableIndex",value:function(e){for(var n=e.length-1;n>=0;n--)if(!aw.test(e[n]))return n;return-1}},{key:"getFromCache",value:function(e,n,i,a){var s=i[e];if(typeof s!="number"){var o=e.length*n,l=a.measureText(e);s=l.width+o,i[e]=s}return s}}])}(),ft={},L6=function(r){var t=new a6,e=new i6;return r={},_t(_t(_t(_t(_t(_t(_t(_t(_t(_t(r,rt.FRAGMENT,null),rt.CIRCLE,new t6),rt.ELLIPSE,new e6),rt.RECT,t),rt.IMAGE,t),rt.GROUP,new o6),rt.LINE,new n6),rt.TEXT,new s6(ft)),rt.POLYLINE,e),rt.POLYGON,e),_t(_t(_t(r,rt.PATH,new r6),rt.HTML,new l6),rt.MESH,null)}(),I6=function(r){var t=new dD,e=new Qy;return r={},_t(_t(_t(_t(_t(_t(_t(_t(_t(_t(r,bt.PERCENTAGE,null),bt.NUMBER,new yD),bt.ANGLE,new cD),bt.DEFINED_PATH,new hD),bt.PAINT,t),bt.COLOR,t),bt.FILTER,new fD),bt.LENGTH,e),bt.LENGTH_PERCENTAGE,e),bt.LENGTH_PERCENTAGE_12,new gD),_t(_t(_t(_t(_t(_t(_t(_t(_t(_t(r,bt.LENGTH_PERCENTAGE_14,new vD),bt.COORDINATE,new Qy),bt.OFFSET_DISTANCE,new mD),bt.OPACITY_VALUE,new bD),bt.PATH,new wD),bt.LIST_OF_POINTS,new xD),bt.SHADOW_BLUR,new ED),bt.TEXT,new SD),bt.TEXT_TRANSFORM,new _D),bt.TRANSFORM,new ZD),_t(_t(_t(r,bt.TRANSFORM_ORIGIN,new JD),bt.Z_INDEX,new QD),bt.MARKER,new pD)}(),D6=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};ft.CameraContribution=dT;ft.AnimationTimeline=null;ft.EasingFunction=null;ft.offscreenCanvasCreator=new Qm;ft.sceneGraphSelector=new f6;ft.sceneGraphService=new E6(ft);ft.textService=new R6(ft);ft.geometryUpdaterFactory=L6;ft.CSSPropertySyntaxFactory=I6;ft.styleValueRegistry=new lD(ft);ft.layoutRegistry=null;ft.globalThis=D6();ft.enableStyleSyntax=!0;ft.enableSizeAttenuation=!1;var B6=0,nm=new ri(Ht.INSERTED,null,"","","",0,"",""),rm=new ri(Ht.REMOVED,null,"","","",0,"",""),jT=new He(Ht.DESTROY),F6=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.entity=B6++,e.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},e.cullable={strategy:WL.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},e.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},e.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},e.geometry={contentBounds:void 0,renderBounds:void 0,dirty:!0},e.rBushNode={aabb:void 0},e.namespaceURI="g",e.scrollLeft=0,e.scrollTop=0,e.clientTop=0,e.clientLeft=0,e.destroyed=!1,e.style={},e.computedStyle={},e.parsedStyle={},e.attributes={},e}return Wt(t,r),dt(t,[{key:"className",get:function(){return this.getAttribute("class")||""},set:function(n){this.setAttribute("class",n)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(n){return n!==""})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n-1]||null}return null}},{key:"cloneNode",value:function(n){throw new Error(ie)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(RL);return ft.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!$u(this)&&n.nodeName===rt.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(nm.relatedNode=this,n.dispatchEvent(nm)),n}},{key:"insertBefore",value:function(n,i){if(!i)this.appendChild(n);else{n.parentElement&&n.parentElement.removeChild(n);var a=this.childNodes.indexOf(i);a===-1?this.appendChild(n):this.appendChild(n,a)}return n}},{key:"replaceChild",value:function(n,i){var a=this.childNodes.indexOf(i);return this.removeChild(i),this.appendChild(n,a),i}},{key:"removeChild",value:function(n){var i;return rm.relatedNode=this,n.dispatchEvent(rm),(i=n.ownerDocument)!==null&&i!==void 0&&i.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),ft.sceneGraphService.detach(n),n}},{key:"removeChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];this.removeChild(i)}}},{key:"destroyChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];i.childNodes.length>0&&i.destroyChildren(),i.destroy()}}},{key:"matches",value:function(n){return ft.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return ft.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return ft.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return ft.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return ft.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return ft.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return ft.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(ft.sceneGraphService.matches(n,i))return i;i=i.parentElement}while(i!==null);return null}},{key:"find",value:function(n){var i=this,a=null;return this.forEach(function(s){return s!==i&&n(s)?(a=s,!1):!0}),a}},{key:"findAll",value:function(n){var i=this,a=[];return this.forEach(function(s){s!==i&&n(s)&&a.push(s)}),a}},{key:"after",value:function(){var n=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];s.forEach(function(l,u){var c;return(c=n.parentNode)===null||c===void 0?void 0:c.appendChild(l,i+u+1)})}}},{key:"before",value:function(){if(this.parentNode){for(var n,i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];var l=s[0],u=s.slice(1);this.parentNode.appendChild(l,i),(n=l).after.apply(n,pe(u))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o){return n.appendChild(o)})}},{key:"prepend",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o,l){return n.appendChild(o,l)})}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){return this.parentNode?this.parentNode.removeChild(this):this}},{key:"destroy",value:function(){this.destroyChildren(),this.dispatchEvent(jT),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){return ft.sceneGraphService.getGeometryBounds(this)}},{key:"getRenderBounds",value:function(){return ft.sceneGraphService.getBounds(this,!0)}},{key:"getBounds",value:function(){return ft.sceneGraphService.getBounds(this)}},{key:"getLocalBounds",value:function(){return ft.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return ft.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(n){if(typeof n!="symbol"){var i=this.attributes[n];return i}}},{key:"hasAttribute",value:function(n){return this.getAttributeNames().includes(n)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(n){this.setAttribute(n,null),delete this.attributes[n]}},{key:"setAttribute",value:function(n,i,a,s){this.attributes[n]=i}},{key:"getAttributeNS",value:function(n,i){throw new Error(ie)}},{key:"getAttributeNode",value:function(n){throw new Error(ie)}},{key:"getAttributeNodeNS",value:function(n,i){throw new Error(ie)}},{key:"hasAttributeNS",value:function(n,i){throw new Error(ie)}},{key:"removeAttributeNS",value:function(n,i){throw new Error(ie)}},{key:"removeAttributeNode",value:function(n){throw new Error(ie)}},{key:"setAttributeNS",value:function(n,i,a){throw new Error(ie)}},{key:"setAttributeNode",value:function(n){throw new Error(ie)}},{key:"setAttributeNodeNS",value:function(n){throw new Error(ie)}},{key:"toggleAttribute",value:function(n,i){throw new Error(ie)}}])}(Ne);function te(r){return!!(r!=null&&r.nodeName)}var z6=ft.globalThis.Proxy?ft.globalThis.Proxy:function(){},Xr=new ri(Ht.ATTR_MODIFIED,null,null,null,null,ri.MODIFICATION,null,null),Ks=Zt(),j6=nn(),be=function(r){function t(e){var n;return ht(this,t),n=Gt(this,t),n.isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=e,n.id=e.id||"",n.name=e.name||"",(e.className||e.class)&&(n.className=e.className||e.class),n.nodeName=e.type||rt.GROUP,e.initialParsedStyle&&Object.assign(n.parsedStyle,e.initialParsedStyle),n.initAttributes(e.style),ft.enableStyleSyntax&&(n.style=new z6({setProperty:function(a,s){n.setAttribute(a,s)},getPropertyValue:function(a){return n.getAttribute(a)},removeProperty:function(a){n.removeAttribute(a)},item:function(){return""}},{get:function(a,s){return a[s]!==void 0?a[s]:n.getAttribute(s)},set:function(a,s,o){return n.setAttribute(s,o),!0}})),n}return Wt(t,r),dt(t,[{key:"destroy",value:function(){_b(t,"destroy",this)([]),this.getAnimations().forEach(function(n){n.cancel()})}},{key:"cloneNode",value:function(n,i){var a=$t({},this.attributes);for(var s in a){var o=a[s];te(o)&&s!=="clipPath"&&s!=="offsetPath"&&s!=="textPath"&&(a[s]=o.cloneNode(n)),i&&(a[s]=i(s,o))}var l=new this.constructor($t($t({},this.config),{},{style:a}));return l.setLocalTransform(this.getLocalTransform()),n&&this.children.forEach(function(u){if(!u.style.isMarker){var c=u.cloneNode(n);l.appendChild(c)}}),l}},{key:"initAttributes",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};ft.styleValueRegistry.processProperties(this,n,i),this.renderable.dirty=!0}},{key:"setAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;Bt(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),_b(t,"setAttribute",this)([n,i]))}},{key:"internalSetAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.renderable,o=this.attributes[n],l=this.parsedStyle[n];ft.styleValueRegistry.processProperties(this,_t({},n,i),a),s.dirty=!0;var u=this.parsedStyle[n];if(this.isConnected&&(Xr.relatedNode=this,Xr.prevValue=o,Xr.newValue=i,Xr.attrName=n,Xr.prevParsedValue=l,Xr.newParsedValue=u,this.isMutationObserved?this.dispatchEvent(Xr):(Xr.target=this,this.ownerDocument.defaultView.dispatchEvent(Xr,!0))),this.isCustomElement&&this.isConnected||!this.isCustomElement){var c,h;(c=(h=this).attributeChangedCallback)===null||c===void 0||c.call(h,n,o,i,l,u)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=jt(i,2),s=a[0],o=a[1],l=n.getMax(),u=jt(l,2),c=u[0],h=u[1];return new ks(s,o,c-s,h-o)}},{key:"setOrigin",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ft.sceneGraphService.setOrigin(this,Cn(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return ft.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ft.sceneGraphService.setPosition(this,Cn(n,i,a,!1)),this}},{key:"setLocalPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ft.sceneGraphService.setLocalPosition(this,Cn(n,i,a,!1)),this}},{key:"translate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ft.sceneGraphService.translate(this,Cn(n,i,a,!1)),this}},{key:"translateLocal",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ft.sceneGraphService.translateLocal(this,Cn(n,i,a,!1)),this}},{key:"getPosition",value:function(){return ft.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return ft.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(n,i,a){return this.scaleLocal(n,i,a)}},{key:"scaleLocal",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=Cn(n,i,a,!1)),ft.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=Cn(n,i,a,!1)),ft.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return ft.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return ft.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=td(Ks,ft.sceneGraphService.getWorldTransform(this)),i=jt(n,3),a=i[2];return Vn(a)}},{key:"getLocalEulerAngles",value:function(){var n=td(Ks,ft.sceneGraphService.getLocalRotation(this)),i=jt(n,3),a=i[2];return Vn(a)}},{key:"setEulerAngles",value:function(n){return ft.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return ft.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return Rt(i)&&Rt(a)?ft.sceneGraphService.rotateLocal(this,0,0,n):ft.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return Rt(i)&&Rt(a)?ft.sceneGraphService.rotate(this,0,0,n):ft.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return ft.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return ft.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return ft.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return ft.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return ft.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return ft.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return ft.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return ft.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return ft.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){ft.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(n,i){var a,s=(a=this.ownerDocument)===null||a===void 0?void 0:a.timeline;return s?s.play(this,n,i):null}},{key:"isVisible",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.visibility)!=="hidden"}},{key:"interactive",get:function(){return this.isInteractive()},set:function(n){this.style.pointerEvents=n?"auto":"none"}},{key:"isInteractive",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.pointerEvents)!=="none"}},{key:"isCulled",value:function(){return!!(this.cullable&&this.cullable.enable&&!this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,pe(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,pe(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=a[0],l=a[1];return o?Ve(o)?(Object.keys(o).forEach(function(u){n.setAttribute(u,o[u])}),this):a.length===2?(this.setAttribute(o,l),this):this.attributes[o]:this.attributes}},{key:"getMatrix",value:function(n){var i=n||this.getWorldTransform(),a=Ou(Ks,i),s=jt(a,2),o=s[0],l=s[1],u=_s(Ks,i),c=jt(u,2),h=c[0],d=c[1],f=Tu(j6,i),v=td(Ks,f),p=jt(v,3),g=p[0],y=p[2];return zL(g||y,o,l,h,d)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(n){var i=Pb(n),a=jt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setEulerAngles(c).setPosition(s,o).setLocalScale(l,u)}},{key:"setLocalMatrix",value:function(n){var i=Pb(n),a=jt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setLocalEulerAngles(c).setLocalPosition(s,o).setLocalScale(l,u)}},{key:"show",value:function(){this.forEach(function(n){n.style.visibility="visible"})}},{key:"hide",value:function(){this.forEach(function(n){n.style.visibility="hidden"})}},{key:"getCount",value:function(){return this.childElementCount}},{key:"getParent",value:function(){return this.parentElement}},{key:"getChildren",value:function(){return this.children}},{key:"getFirst",value:function(){return this.firstElementChild}},{key:"getLast",value:function(){return this.lastElementChild}},{key:"getChildByIndex",value:function(n){return this.children[n]||null}},{key:"add",value:function(n,i){return this.appendChild(n,i)}},{key:"set",value:function(n,i){this.config[n]=i}},{key:"get",value:function(n){return this.config[n]}},{key:"moveTo",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"move",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"setZIndex",value:function(n){return this.style.zIndex=n,this}}])}(F6);be.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var Ti=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ht(this,t),Gt(this,t,[$t({type:rt.CIRCLE},e)])}return Wt(t,r),dt(t)}(be);Ti.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var q6=["style"],t1=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,q6);return ht(this,t),e=Gt(this,t,[$t({style:i},a)]),e.isCustomElement=!0,e}return Wt(t,r),dt(t)}(be);t1.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var Ho=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ht(this,t),Gt(this,t,[$t({type:rt.ELLIPSE},e)])}return Wt(t,r),dt(t)}(be);Ho.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var $6=function(r){function t(){return ht(this,t),Gt(this,t,[{type:rt.FRAGMENT}])}return Wt(t,r),dt(t)}(be);$6.PARSED_STYLE_LIST=new Set(["class","className"]);var on=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ht(this,t),Gt(this,t,[$t({type:rt.GROUP},e)])}return Wt(t,r),dt(t)}(be);on.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var G6=["style"],Xo=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,G6);return ht(this,t),e=Gt(this,t,[$t({type:rt.HTML,style:i},a)]),e.cullable.enable=!1,e}return Wt(t,r),dt(t,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var n=Zr(fe(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!ge.isEmpty(i)){var a=new ge;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(be);Xo.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var Ko=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ht(this,t),Gt(this,t,[$t({type:rt.IMAGE},e)])}return Wt(t,r),dt(t)}(be);Ko.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var W6=["style"],Da=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,W6);ht(this,t),e=Gt(this,t,[$t({type:rt.LINE,style:$t({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},i)},a)]),e.markerStartAngle=0,e.markerEndAngle=0;var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd;return o&&te(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&te(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return Wt(t,r),dt(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="x1"||n==="y1"||n==="x2"||n==="y2"||n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&te(s)&&(this.markerStartAngle=0,s.remove()),o&&te(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&te(s)&&(this.markerEndAngle=0,s.remove()),o&&te(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1)))}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.x1,c=i.x2,h=i.y1,d=i.y2,f=n?a:s;if(!(!f||!te(f))){var v=0,p,g,y,m,w,E;n?(y=u,m=h,p=c-u,g=d-h,w=o||0,E=this.markerStartAngle):(y=c,m=d,p=u-c,g=h-d,w=l||0,E=this.markerEndAngle),v=Math.atan2(g,p),f.setLocalEulerAngles(v*180/Math.PI+E),f.setLocalPosition(y+Math.cos(v)*w,m+Math.sin(v)*w)}}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle,s=a.x1,o=a.y1,l=a.x2,u=a.y2,c=uT(s,o,l,u,n),h=c.x,d=c.y,f=Pn(Zt(),ye(h,d,0),i?this.getWorldTransform():this.getLocalTransform());return new mn(f[0],f[1])}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getTotalLength",value:function(){var n=this.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2;return lT(i,a,s,o)}}])}(be);Da.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var V6=["style"],rr=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,V6);ht(this,t),e=Gt(this,t,[$t({type:rt.PATH,style:i,initialParsedStyle:{miterLimit:4,d:$t({},fT)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&te(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&te(u)&&e.placeMarkerMid(u),l&&te(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return Wt(t,r),dt(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="d"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&te(s)&&(this.markerStartAngle=0,s.remove()),o&&te(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&te(s)&&(this.markerEndAngle=0,s.remove()),o&&te(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=n?a:s;if(!(!u||!te(u))){var c=0,h,d,f,v,p,g;if(n){var y=this.getStartTangent(),m=jt(y,2),w=m[0],E=m[1];f=E[0],v=E[1],h=w[0]-E[0],d=w[1]-E[1],p=o||0,g=this.markerStartAngle}else{var _=this.getEndTangent(),k=jt(_,2),T=k[0],O=k[1];f=O[0],v=O[1],h=T[0]-O[0],d=T[1]-O[1],p=l||0,g=this.markerEndAngle}c=Math.atan2(d,h),u.setLocalEulerAngles(c*180/Math.PI+g),u.setLocalPosition(f+Math.cos(c)*p,v+Math.sin(c)*p)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(c){c.remove()}),n&&te(n))for(var a=1;a<i.length-1;a++){var s=jt(i[a].currentPoint,2),o=s[0],l=s[1],u=a===1?n:n.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(o,l)}}},{key:"getTotalLength",value:function(){return Zy(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=lL(a,n),o=s.x,l=s.y,u=Pn(Zt(),ye(o,l,0),i?this.getWorldTransform():this.getLocalTransform());return new mn(u[0],u[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*Zy(this),i)}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.d.segments,i=[];if(n.length>1){var a=n[0].currentPoint,s=n[1].currentPoint,o=n[1].startTangent;i=[],o?(i.push([a[0]-o[0],a[1]-o[1]]),i.push([a[0],a[1]])):(i.push([s[0],s[1]]),i.push([a[0],a[1]]))}return i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.d.segments,i=n.length,a=[];if(i>1){var s=n[i-2].currentPoint,o=n[i-1].currentPoint,l=n[i-1].endTangent;a=[],l?(a.push([o[0]-l[0],o[1]-l[1]]),a.push([o[0],o[1]])):(a.push([s[0],s[1]]),a.push([o[0],o[1]]))}return a}}])}(be);rr.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var U6=["style"],Ga=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,U6);ht(this,t),e=Gt(this,t,[$t({type:rt.POLYGON,style:i,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&te(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&te(u)&&e.placeMarkerMid(u),l&&te(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return Wt(t,r),dt(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&te(s)&&(this.markerStartAngle=0,s.remove()),o&&te(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&te(s)&&(this.markerEndAngle=0,s.remove()),o&&te(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.points,c=u||{},h=c.points,d=n?a:s;if(!(!d||!te(d)||!h)){var f=0,v,p,g,y,m,w;if(g=h[0][0],y=h[0][1],n)v=h[1][0]-h[0][0],p=h[1][1]-h[0][1],m=o||0,w=this.markerStartAngle;else{var E=h.length;this.parsedStyle.isClosed?(v=h[E-1][0]-h[0][0],p=h[E-1][1]-h[0][1]):(g=h[E-1][0],y=h[E-1][1],v=h[E-2][0]-h[E-1][0],p=h[E-2][1]-h[E-1][1]),m=l||0,w=this.markerEndAngle}f=Math.atan2(p,v),d.setLocalEulerAngles(f*180/Math.PI+w),d.setLocalPosition(g+Math.cos(f)*m,y+Math.sin(f)*m)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],n&&te(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var l=s[o][0],u=s[o][1],c=o===1?n:n.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(l,u)}}}])}(be);Ga.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var Y6=["style"],gc=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=qa(e,Y6);return ht(this,t),Gt(this,t,[$t({type:rt.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return Wt(t,r),dt(t,[{key:"getTotalLength",value:function(){return zI(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var s=[],o=0,l,u,c=this.getTotalLength();a.forEach(function(y,m){a[m+1]&&(l=[0,0],l[0]=o/c,u=lT(y[0],y[1],a[m+1][0],a[m+1][1]),o+=u,l[1]=o/c,s.push(l))}),this.parsedStyle.points.segments=s}var h=0,d=0;this.parsedStyle.points.segments.forEach(function(y,m){n>=y[0]&&n<=y[1]&&(h=(n-y[0])/(y[1]-y[0]),d=m)});var f=uT(a[d][0],a[d][1],a[d+1][0],a[d+1][1],h),v=f.x,p=f.y,g=Pn(Zt(),ye(v,p,0),i?this.getWorldTransform():this.getLocalTransform());return new mn(g[0],g[1])}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.points.points,i=[];return i.push([n[1][0],n[1][1]]),i.push([n[0][0],n[0][1]]),i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.points.points,i=n.length-1,a=[];return a.push([n[i-1][0],n[i-1][1]]),a.push([n[i][0],n[i][1]]),a}}])}(Ga);gc.PARSED_STYLE_LIST=new Set([].concat(pe(Ga.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var xn=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ht(this,t),Gt(this,t,[$t({type:rt.RECT},e)])}return Wt(t,r),dt(t)}(be);xn.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var H6=["style"],Wa=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=qa(e,H6);return ht(this,t),Gt(this,t,[$t({type:rt.TEXT,style:$t({fill:"black"},n)},i)])}return Wt(t,r),dt(t,[{key:"getComputedTextLength",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(be);Wa.PARSED_STYLE_LIST=new Set([].concat(pe(be.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textPathSide","textPathStartOffset","metrics","dx","dy"]));var X6=function(){function r(){ht(this,r),this.registry={},this.define(rt.CIRCLE,Ti),this.define(rt.ELLIPSE,Ho),this.define(rt.RECT,xn),this.define(rt.IMAGE,Ko),this.define(rt.LINE,Da),this.define(rt.GROUP,on),this.define(rt.PATH,rr),this.define(rt.POLYGON,Ga),this.define(rt.POLYLINE,gc),this.define(rt.TEXT,Wa),this.define(rt.HTML,Xo)}return dt(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),qT=function(r){function t(){var e;ht(this,t),e=Gt(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new ft.AnimationTimeline(e)}catch{}var n={};return Km.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=Ot(o)?o(rt.GROUP):o)}),e.documentElement=new on({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return Wt(t,r),dt(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(n,i){if(n==="svg")return this.documentElement;var a=this.defaultView.customElements.get(n);a||(console.warn("Unsupported tagName: ",n),a=n==="tspan"?Wa:on);var s=new a(i);return s.ownerDocument=this,s}},{key:"createElementNS",value:function(n,i,a){return this.createElement(i,a)}},{key:"cloneNode",value:function(n){throw new Error(ie)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch{}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=this.defaultView.context.rBushRoot,l=o.search({minX:n,minY:i,maxX:a,maxY:s}),u=[];return l.forEach(function(c){var h=c.displayObject,d=h.parsedStyle.pointerEvents,f=d===void 0?"auto":d,v=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(f);(!v||v&&h.isVisible())&&!h.isCulled()&&h.isInteractive()&&u.push(h)}),u.sort(function(c,h){return h.sortable.renderOrder-c.sortable.renderOrder}),u}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return null;var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),p=v.picked;return p&&p[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=na(wn().mark(function i(a,s){var o,l,u,c,h,d,f,v,p,g,y;return wn().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){w.next=4;break}return w.abrupt("return",null);case 4:return f=this.defaultView.viewport2Client({x:l,y:u}),v=f.x,p=f.y,w.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:v,clientY:p},picked:[]});case 7:return g=w.sent,y=g.picked,w.abrupt("return",y&&y[0]||this.documentElement);case 10:case"end":return w.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"elementsFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return[];var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),p=v.picked;return p[p.length-1]!==this.documentElement&&p.push(this.documentElement),p}},{key:"elementsFromPoint",value:function(){var e=na(wn().mark(function i(a,s){var o,l,u,c,h,d,f,v,p,g,y;return wn().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){w.next=4;break}return w.abrupt("return",[]);case 4:return f=this.defaultView.viewport2Client({x:l,y:u}),v=f.x,p=f.y,w.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:v,clientY:p},picked:[]});case 7:return g=w.sent,y=g.picked,y[y.length-1]!==this.documentElement&&y.push(this.documentElement),w.abrupt("return",y);case 11:case"end":return w.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(rs)}},{key:"insertBefore",value:function(n,i){throw new Error(rs)}},{key:"removeChild",value:function(n,i){throw new Error(rs)}},{key:"replaceChild",value:function(n,i,a){throw new Error(rs)}},{key:"append",value:function(){throw new Error(rs)}},{key:"prepend",value:function(){throw new Error(rs)}},{key:"getElementById",value:function(n){return this.documentElement.getElementById(n)}},{key:"getElementsByName",value:function(n){return this.documentElement.getElementsByName(n)}},{key:"getElementsByTagName",value:function(n){return this.documentElement.getElementsByTagName(n)}},{key:"getElementsByClassName",value:function(n){return this.documentElement.getElementsByClassName(n)}},{key:"querySelector",value:function(n){return this.documentElement.querySelector(n)}},{key:"querySelectorAll",value:function(n){return this.documentElement.querySelectorAll(n)}},{key:"find",value:function(n){return this.documentElement.find(n)}},{key:"findAll",value:function(n){return this.documentElement.findAll(n)}}])}(Ne),$T=function(){function r(t){ht(this,r),this.strategies=t}return dt(r,[{key:"apply",value:function(e){var n=e.camera,i=e.renderingService,a=e.renderingContext,s=this.strategies;i.hooks.cull.tap(r.tag,function(o){if(o){var l=o.cullable;return s.length===0?l.visible=a.unculledEntities.indexOf(o.entity)>-1:l.visible=s.every(function(u){return u.isVisible(n,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new He(Ht.CULLED)),null)}return o}),i.hooks.afterRender.tap(r.tag,function(o){o.cullable.visibilityPlaneMask=-1})}}])}();$T.tag="Culling";var GT=function(){function r(){var t=this;ht(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new Gu(null),this.rootWheelEvent=new em(null),this.onPointerMove=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView;if(!(i.supportsTouchEvents&&e.pointerType==="touch")){var a=t.normalizeToPointerEvent(e,i),s=wa(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView,a=t.normalizeToPointerEvent(e,i),s=wa(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return dt(r,[{key:"apply",value:function(e){var n=this;this.context=e;var i=e.renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(s){var o=n.context.renderingService.hooks.pickSync.call({position:s,picked:[],topmost:!0}),l=o.picked;return l[0]||null}),i.hooks.pointerWheel.tap(r.tag,function(s){var o=n.normalizeWheelEvent(s);n.context.eventService.mapEvent(o)}),i.hooks.pointerDown.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.normalizeToPointerEvent(s,a);if(n.autoPreventDefault&&o[0].isNormalized){var l=s.cancelable||!("cancelable"in s);l&&s.preventDefault()}var u=wa(o),c;try{for(u.s();!(c=u.n()).done;){var h=c.value,d=n.bootstrapEvent(n.rootPointerEvent,h,a,s);n.context.eventService.mapEvent(d)}}catch(f){u.e(f)}finally{u.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerUp.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.context.contextService.getDomElement(),l=n.context.eventService.isNativeEventFromCanvas(o,s),u=l?"":"outside",c=n.normalizeToPointerEvent(s,a),h=wa(c),d;try{for(h.s();!(d=h.n()).done;){var f=d.value,v=n.bootstrapEvent(n.rootPointerEvent,f,a,s);v.type+=u,n.context.eventService.mapEvent(v)}}catch(p){h.e(p)}finally{h.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerMove.tap(r.tag,this.onPointerMove),i.hooks.pointerOver.tap(r.tag,this.onPointerMove),i.hooks.pointerOut.tap(r.tag,this.onPointerMove),i.hooks.click.tap(r.tag,this.onClick),i.hooks.pointerCancel.tap(r.tag,function(s){var o=n.normalizeToPointerEvent(s,a),l=wa(o),u;try{for(l.s();!(u=l.n()).done;){var c=u.value,h=n.bootstrapEvent(n.rootPointerEvent,c,a,s);n.context.eventService.mapEvent(h)}}catch(d){l.e(d)}finally{l.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(e,n,i,a){e.view=i,e.originalEvent=null,e.nativeEvent=a,e.pointerId=n.pointerId,e.width=n.width,e.height=n.height,e.isPrimary=n.isPrimary,e.pointerType=n.pointerType,e.pressure=n.pressure,e.tangentialPressure=n.tangentialPressure,e.tiltX=n.tiltX,e.tiltY=n.tiltY,e.twist=n.twist,this.transferMouseData(e,n);var s=this.context.eventService.client2Viewport({x:n.clientX,y:n.clientY}),o=s.x,l=s.y;e.viewport.x=o,e.viewport.y=l;var u=this.context.eventService.viewport2Canvas(e.viewport),c=u.x,h=u.y;return e.canvas.x=c,e.canvas.y=h,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=a.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=CD[e.type]||e.type),e}},{key:"normalizeWheelEvent",value:function(e){var n=this.rootWheelEvent;this.transferMouseData(n,e),n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ;var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),a=i.x,s=i.y;n.viewport.x=a,n.viewport.y=s;var o=this.context.eventService.viewport2Canvas(n.viewport),l=o.x,u=o.y;return n.canvas.x=l,n.canvas.y=u,n.global.copyFrom(n.canvas),n.offset.copyFrom(n.canvas),n.nativeEvent=e,n.type=e.type,n}},{key:"transferMouseData",value:function(e,n){e.isTrusted=n.isTrusted,e.srcElement=n.srcElement,e.timeStamp=tm.now(),e.type=n.type,e.altKey=n.altKey,e.metaKey=n.metaKey,e.shiftKey=n.shiftKey,e.ctrlKey=n.ctrlKey,e.button=n.button,e.buttons=n.buttons,e.client.x=n.clientX,e.client.y=n.clientY,e.movement.x=n.movementX,e.movement.y=n.movementY,e.page.x=n.pageX,e.page.y=n.pageY,e.screen.x=n.screenX,e.screen.y=n.screenY,e.relatedTarget=null}},{key:"setCursor",value:function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(e,n){var i=[];if(n.isTouchEvent(e))for(var a=0;a<e.changedTouches.length;a++){var s=e.changedTouches[a];Bt(s.button)&&(s.button=0),Bt(s.buttons)&&(s.buttons=1),Bt(s.isPrimary)&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),Bt(s.width)&&(s.width=s.radiusX||1),Bt(s.height)&&(s.height=s.radiusY||1),Bt(s.tiltX)&&(s.tiltX=0),Bt(s.tiltY)&&(s.tiltY=0),Bt(s.pointerType)&&(s.pointerType="touch"),Bt(s.pointerId)&&(s.pointerId=s.identifier||0),Bt(s.pressure)&&(s.pressure=s.force||.5),Bt(s.twist)&&(s.twist=0),Bt(s.tangentialPressure)&&(s.tangentialPressure=0),s.isNormalized=!0,s.type=e.type,i.push(s)}else if(n.isMouseEvent(e)){var o=e;Bt(o.isPrimary)&&(o.isPrimary=!0),Bt(o.width)&&(o.width=1),Bt(o.height)&&(o.height=1),Bt(o.tiltX)&&(o.tiltX=0),Bt(o.tiltY)&&(o.tiltY=0),Bt(o.pointerType)&&(o.pointerType="mouse"),Bt(o.pointerId)&&(o.pointerId=ND),Bt(o.pressure)&&(o.pressure=.5),Bt(o.twist)&&(o.twist=0),Bt(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,i.push(o)}else i.push(e);return i}}])}();GT.tag="Event";var K6=[rt.CIRCLE,rt.ELLIPSE,rt.IMAGE,rt.RECT,rt.LINE,rt.POLYLINE,rt.POLYGON,rt.TEXT,rt.PATH,rt.HTML],Z6=function(){function r(){ht(this,r)}return dt(r,[{key:"isVisible",value:function(e,n){var i,a=n.cullable;if(!a.enable)return!0;var s=n.getRenderBounds();if(ge.isEmpty(s))return!1;var o=e.getFrustum(),l=(i=n.parentNode)===null||i===void 0||(i=i.cullable)===null||i===void 0?void 0:i.visibilityPlaneMask;return a.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(n,s,l||ns.INDETERMINATE,o.planes),a.visible=a.visibilityPlaneMask!==ns.OUTSIDE,a.visible}},{key:"computeVisibilityWithPlaneMask",value:function(e,n,i,a){if(i===ns.OUTSIDE||i===ns.INSIDE)return i;for(var s=ns.INSIDE,o=K6.indexOf(e.nodeName)>-1,l=0,u=a.length;l<u;++l){var c=1<<l;if(i&c&&!(o&&(l===4||l===5))){var h=a[l],d=h.normal,f=h.distance;if(Qr(d,n.getPositiveFarPoint(a[l]))+f<0)return ns.OUTSIDE;Qr(d,n.getNegativeFarPoint(a[l]))+f<0&&(s|=c)}}return s}}])}(),WT=function(){function r(){ht(this,r),this.syncTasks=new Map,this.isFirstTimeRendering=!0,this.syncing=!1,this.isFirstTimeRenderingFinished=!1}return dt(r,[{key:"apply",value:function(e){var n=this,i,a=e.renderingService,s=e.renderingContext,o=e.rBushRoot,l=s.root.ownerDocument.defaultView;this.rBush=o;var u=function(p){var g=p.target;g.renderable.dirty=!0,a.dirtify()},c=function(p){n.syncTasks.set(p.target,p.detail.affectChildren),a.dirtify()},h=function(p){var g=p.target;ft.enableSizeAttenuation&&ft.styleValueRegistry.updateSizeAttenuation(g,l.getCamera().getZoom())},d=function(p){var g=p.target,y=g.rBushNode;y.aabb&&n.rBush.remove(y.aabb),n.syncTasks.delete(g),ft.sceneGraphService.dirtifyToRoot(g),a.dirtify()};a.hooks.init.tap(r.tag,function(){l.addEventListener(Ht.MOUNTED,h),l.addEventListener(Ht.UNMOUNTED,d),l.addEventListener(Ht.ATTR_MODIFIED,u),l.addEventListener(Ht.BOUNDS_CHANGED,c)}),a.hooks.destroy.tap(r.tag,function(){l.removeEventListener(Ht.MOUNTED,h),l.removeEventListener(Ht.UNMOUNTED,d),l.removeEventListener(Ht.ATTR_MODIFIED,u),l.removeEventListener(Ht.BOUNDS_CHANGED,c),n.syncTasks.clear()});var f=(i=ft.globalThis.requestIdleCallback)!==null&&i!==void 0?i:Jm.bind(ft.globalThis);a.hooks.endFrame.tap(r.tag,function(){n.isFirstTimeRendering?(n.isFirstTimeRendering=!1,n.syncing=!0,f(function(){n.syncRTree(!0),n.isFirstTimeRenderingFinished=!0})):n.syncRTree()})}},{key:"syncNode",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.isConnected){var i=e.rBushNode;i.aabb&&this.rBush.remove(i.aabb);var a=e.getRenderBounds();if(a){var s=e.renderable;n&&(s.dirtyRenderBounds||(s.dirtyRenderBounds=new ge),s.dirtyRenderBounds.update(a.center,a.halfExtents));var o=a.getMin(),l=jt(o,2),u=l[0],c=l[1],h=a.getMax(),d=jt(h,2),f=d[0],v=d[1];i.aabb||(i.aabb={}),i.aabb.displayObject=e,i.aabb.minX=u,i.aabb.minY=c,i.aabb.maxX=f,i.aabb.maxY=v}if(i.aabb&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.minX)&&!isNaN(i.aabb.minY))return i.aabb}}},{key:"syncRTree",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(!n&&(this.syncing||this.syncTasks.size===0))){this.syncing=!0;var i=[],a=new Set,s=function(l){if(!a.has(l)&&l.renderable){var u=e.syncNode(l,n);u&&(i.push(u),a.add(l))}};this.syncTasks.forEach(function(o,l){o&&l.forEach(s);for(var u=l;u;)s(u),u=u.parentElement}),this.rBush.load(i),i.length=0,this.syncing=!1}}}])}();WT.tag="Prepare";var er=function(r){return r.READY="ready",r.BEFORE_RENDER="beforerender",r.RERENDER="rerender",r.AFTER_RENDER="afterrender",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.RESIZE="resize",r.DIRTY_RECTANGLE="dirtyrectangle",r.RENDERER_CHANGED="rendererchanged",r}({}),sw=500,J6=.1,Q6=1e3,Nl=new He(Ht.MOUNTED),Cl=new He(Ht.UNMOUNTED),hd=new He(er.BEFORE_RENDER),ow=new He(er.RERENDER),dd=new He(er.AFTER_RENDER),im=function(r){function t(e){var n;ht(this,t),n=Gt(this,t),n.Element=be,n.inited=!1,n.context={};var i=e.container,a=e.canvas,s=e.renderer,o=e.width,l=e.height,u=e.background,c=e.cursor,h=e.supportsMutipleCanvasesInOneContainer,d=e.cleanUpOnDestroy,f=d===void 0?!0:d,v=e.offscreenCanvas,p=e.devicePixelRatio,g=e.requestAnimationFrame,y=e.cancelAnimationFrame,m=e.createImage,w=e.supportsTouchEvents,E=e.supportsPointerEvents,_=e.isTouchEvent,k=e.isMouseEvent,T=e.dblClickSpeed,O=o,P=l,N=p||Zm&&window.devicePixelRatio||1;return N=N>=1?Math.ceil(N):1,a&&(O=o||AD(a)||a.width/N,P=l||PD(a)||a.height/N),n.customElements=new X6,n.devicePixelRatio=N,n.requestAnimationFrame=g!=null?g:Jm.bind(ft.globalThis),n.cancelAnimationFrame=y!=null?y:DT.bind(ft.globalThis),n.supportsTouchEvents=w!=null?w:"ontouchstart"in ft.globalThis,n.supportsPointerEvents=E!=null?E:!!ft.globalThis.PointerEvent,n.isTouchEvent=_!=null?_:function(C){return n.supportsTouchEvents&&C instanceof ft.globalThis.TouchEvent},n.isMouseEvent=k!=null?k:function(C){return!ft.globalThis.MouseEvent||C instanceof ft.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(C instanceof ft.globalThis.PointerEvent))},v&&(ft.offscreenCanvas=v),n.document=new qT,n.document.defaultView=n,h||MD(i,n,f),n.initRenderingContext($t($t({},e),{},{width:O,height:P,background:u!=null?u:"transparent",cursor:c!=null?c:"default",cleanUpOnDestroy:f,devicePixelRatio:N,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:T!=null?T:200,createImage:m!=null?m:function(){return new window.Image}})),n.initDefaultCamera(O,P,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return Wt(t,r),dt(t,[{key:"initRenderingContext",value:function(n){this.context.config=n,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(n,i,a){var s=this,o=new ft.CameraContribution;o.clipSpaceNearZ=a,o.setType(re.EXPLORING,Uy.DEFAULT).setPosition(n/2,i/2,sw).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,J6,Q6),o.canvas=this,o.eventEmitter.on(hT.UPDATED,function(){s.context.renderingContext.renderReasons.add(xs.CAMERA_CHANGED),ft.enableSizeAttenuation&&s.getConfig().renderer.getConfig().enableSizeAttenuation&&s.updateSizeAttenuation()}),this.context.camera=o}},{key:"updateSizeAttenuation",value:function(){var n=this.getCamera().getZoom();this.document.documentElement.forEach(function(i){ft.styleValueRegistry.updateSizeAttenuation(i,n)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var n=this;return this.readyPromise||(this.readyPromise=new Promise(function(i){n.resolveReadyPromise=function(){i(n)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1?arguments[1]:void 0;Je.clearCache(),i||this.dispatchEvent(new He(er.BEFORE_DESTROY)),this.frameId&&this.cancelAnimationFrame(this.frameId);var a=this.getRoot();n&&(this.unmountChildren(a),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),this.context.rBushRoot&&this.context.rBushRoot.clear(),i||this.dispatchEvent(new He(er.AFTER_DESTROY));var s=function(l){l.currentTarget=null,l.manager=null,l.target=null,l.relatedNode=null};s(Nl),s(Cl),s(hd),s(ow),s(dd),s(Xr),s(nm),s(rm),s(jT)}},{key:"changeSize",value:function(n,i){this.resize(n,i)}},{key:"resize",value:function(n,i){var a=this.context.config;a.width=n,a.height=i,this.getContextService().resize(n,i);var s=this.context.camera,o=s.getProjectionMode();s.setPosition(n/2,i/2,sw).setFocalPoint(n/2,i/2,0),o===mr.ORTHOGRAPHIC?s.setOrthographic(n/-2,n/2,i/2,i/-2,s.getNear(),s.getFar()):s.setAspect(n/i),this.dispatchEvent(new He(er.RESIZE,{width:n,height:i}))}},{key:"appendChild",value:function(n,i){return this.document.documentElement.appendChild(n,i)}},{key:"insertBefore",value:function(n,i){return this.document.documentElement.insertBefore(n,i)}},{key:"removeChild",value:function(n){return this.document.documentElement.removeChild(n)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(n){var i=this;n&&(hd.detail=n,dd.detail=n),this.dispatchEvent(hd);var a=this.getRenderingService();a.render(this.getConfig(),n,function(){i.dispatchEvent(ow)}),this.dispatchEvent(dd)}},{key:"run",value:function(){var n=this,i=function(s,o){n.render(o),n.frameId=n.requestAnimationFrame(i)};i()}},{key:"initRenderer",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!n)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new OL,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new GT,new WT,new $T([new Z6])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService($t($t({},ft),this.context)),this.context.renderingService=new h6(ft,this.context),this.context.eventService=new c6(ft,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(n,a,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(n,a)}).catch(function(s){console.error(s)})}},{key:"initRenderingService",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){i.inited=!0,a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new He(er.READY))}):i.dispatchEvent(new He(er.READY)):i.dispatchEvent(new He(er.RENDERER_CHANGED)),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(o){var l=o,u=l.renderable;u&&(u.renderBoundsDirty=!0,u.boundsDirty=!0,u.dirty=!0)}),i.mountChildren(i.getRoot()),n.getConfig().enableAutoRendering&&i.run()})}},{key:"loadRendererContainerModule",value:function(n){var i=this,a=n.getPlugins();a.forEach(function(s){s.context=i.context,s.init(ft)})}},{key:"setRenderer",value:function(n){var i=this.getConfig();if(i.renderer!==n){var a=i.renderer;i.renderer=n,this.destroy(!1,!0),pe((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(ft)}),this.initRenderer(n)}}},{key:"setCursor",value:function(n){var i=this.getConfig();i.cursor=n,this.getContextService().applyCursorStyle(n)}},{key:"unmountChildren",value:function(n){var i=this;n.childNodes.forEach(function(a){i.unmountChildren(a)}),this.inited&&(n.isMutationObserved?n.dispatchEvent(Cl):(Cl.target=n,this.dispatchEvent(Cl,!0)),n!==this.document.documentElement&&(n.ownerDocument=null),n.isConnected=!1),n.isCustomElement&&n.disconnectedCallback&&n.disconnectedCallback()}},{key:"mountChildren",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$u(n);this.inited?n.isConnected||(n.ownerDocument=this.document,n.isConnected=!0,a||(n.isMutationObserved?n.dispatchEvent(Nl):(Nl.target=n,this.dispatchEvent(Nl,!0)))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",n.nodeName),n.childNodes.forEach(function(s){i.mountChildren(s,a)}),n.isCustomElement&&n.connectedCallback&&n.connectedCallback()}},{key:"mountFragment",value:function(n){this.mountChildren(n,!1)}},{key:"client2Viewport",value:function(n){return this.getEventService().client2Viewport(n)}},{key:"viewport2Client",value:function(n){return this.getEventService().viewport2Client(n)}},{key:"viewport2Canvas",value:function(n){return this.getEventService().viewport2Canvas(n)}},{key:"canvas2Viewport",value:function(n){return this.getEventService().canvas2Viewport(n)}},{key:"getPointByClient",value:function(n,i){return this.client2Viewport({x:n,y:i})}},{key:"getClientByPoint",value:function(n,i){return this.viewport2Client({x:n,y:i})}}])}(zT);var tB=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.landmarks=[],e}return Wt(t,r),dt(t,[{key:"rotate",value:function(n,i,a){if(this.relElevation=ms(i),this.relAzimuth=ms(n),this.relRoll=ms(a),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===re.EXPLORING){var s=qi(nn(),[1,0,0],ae((this.rotateWorld?1:-1)*this.relElevation)),o=qi(nn(),[0,1,0],ae((this.rotateWorld?1:-1)*this.relAzimuth)),l=qi(nn(),[0,0,1],ae(this.relRoll)),u=Ki(nn(),o,s);u=Ki(nn(),u,l);var c=$m(fe(),u);ys(this.matrix,this.matrix,[0,0,-this.distance]),An(this.matrix,this.matrix,c),ys(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===re.ORBITING||this.type===re.EXPLORING?this._getPosition():this.type===re.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=Cn(n,i,0),s=di(this.position);return Xi(s,s,Au(Zt(),this.right,a[0])),Xi(s,s,Au(Zt(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=di(this.position),s=n*this.dollyingStep,o=this.distance+n*this.dollyingStep;return s=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],this._setPosition(a),this.type===re.ORBITING||this.type===re.EXPLORING?this._getDistance():this.type===re.TRACKING&&Xi(this.focalPoint,a,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(n){var i,a,s,o,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=l.position,c=u===void 0?this.position:u,h=l.focalPoint,d=h===void 0?this.focalPoint:h,f=l.roll,v=l.zoom,p=new ft.CameraContribution;p.setType(this.type,void 0),p.setPosition(c[0],(i=c[1])!==null&&i!==void 0?i:this.position[1],(a=c[2])!==null&&a!==void 0?a:this.position[2]),p.setFocalPoint(d[0],(s=d[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=d[2])!==null&&o!==void 0?o:this.focalPoint[2]),p.setRoll(f!=null?f:this.roll),p.setZoom(v!=null?v:this.zoom);var g={name:n,matrix:TO(p.getWorldTransform()),right:di(p.right),up:di(p.up),forward:di(p.forward),position:di(p.getPosition()),focalPoint:di(p.getFocalPoint()),distanceVector:di(p.getDistanceVector()),distance:p.getDistance(),dollyingStep:p.getDollyingStep(),azimuth:p.getAzimuth(),elevation:p.getElevation(),roll:p.getRoll(),relAzimuth:p.relAzimuth,relElevation:p.relElevation,relRoll:p.relRoll,zoom:p.getZoom()};return this.landmarks.push(g),g}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=ee(n)?this.landmarks.find(function(C){return C.name===n}):n;if(s){var o=St(a)?{duration:a}:a,l=o.easing,u=l===void 0?"linear":l,c=o.duration,h=c===void 0?100:c,d=o.easingFunction,f=d===void 0?void 0:d,v=o.onfinish,p=v===void 0?void 0:v,g=o.onframe,y=g===void 0?void 0:g,m=.01;this.cancelLandmarkAnimation();var w=s.position,E=s.focalPoint,_=s.zoom,k=s.roll,T=f||ft.EasingFunction(u),O,P=function(){i.setFocalPoint(E),i.setPosition(w),i.setRoll(k),i.setZoom(_),i.computeMatrix(),i.triggerUpdate(),p==null||p()};if(h===0)return P();var N=function(L){O===void 0&&(O=L);var B=L-O;if(B>=h){P();return}var G=T(B/h),V=Zt(),U=Zt(),$=1,j=0;Iy(V,i.focalPoint,E,G),Iy(U,i.position,w,G),j=i.roll*(1-G)+k*G,$=i.zoom*(1-G)+_*G,i.setFocalPoint(V),i.setPosition(U),i.setRoll(j),i.setZoom($);var Z=pb(V,E)+pb(U,w);if(Z<=m&&_===void 0&&k===void 0)return P();i.computeMatrix(),i.triggerUpdate(),B<h&&(y==null||y(G),i.landmarkAnimationID=i.canvas.requestAnimationFrame(N))};this.canvas.requestAnimationFrame(N)}}}])}(dT);ft.CameraContribution=tB;var fd=function(r){function t(e,n,i,a){var s;return ht(this,t),s=Gt(this,t,[e]),s.currentTime=i,s.timelineTime=a,s.target=n,s.type="finish",s.bubbles=!1,s.currentTarget=n,s.defaultPrevented=!1,s.eventPhase=s.AT_TARGET,s.timeStamp=Date.now(),s.currentTime=i,s.timelineTime=a,s}return Wt(t,r),dt(t)}(fc),eB=0,nB=function(){function r(t,e){var n;ht(this,r),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=t,t.animation=this,this.timeline=e,this.id="".concat(eB++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number((n=this.effect)===null||n===void 0?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return dt(r,[{key:"pending",get:function(){return this._startTime===null&&!this._paused&&this.playbackRate!==0||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var e=this;return this.readyPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(n,i){e.resolveReadyPromise=function(){n(e)},e.rejectReadyPromise=function(){i(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var e=this;return this.finishedPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(n,i){e.resolveFinishedPromise=function(){n(e)},e.rejectFinishedPromise=function(){i(new Error)}}),this.playState==="finished"&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(e){if(e=Number(e),!isNaN(e)){if(this.timeline.restart(),!this._paused&&this._startTime!==null){var n;this._startTime=Number((n=this.timeline)===null||n===void 0?void 0:n.currentTime)-e/this.playbackRate}this.currentTimePending=!1,this._currentTime!==e&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(e,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(e){if(e!==null){if(this.updatePromises(),e=Number(e),isNaN(e)||this._paused||this._idle)return;this._startTime=e,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(e){if(e!==this._playbackRate){this.updatePromises();var n=this.currentTime;this._playbackRate=e,this.startTime=null,this.playState!=="paused"&&this.playState!=="idle"&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),n!==null&&(this.currentTime=n),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||this.playState==="running"||!this._finishedFlag}},{key:"updatePromises",value:function(){var e=this.oldPlayState,n=this.pending?"pending":this.playState;return this.readyPromise&&n!==e&&(n==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):e==="pending"?this.resolveReadyPromise():n==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&n!==e&&(n==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):n==="finished"?this.resolveFinishedPromise():e==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=n,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var n=new fd(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(n)})}}},{key:"reverse",value:function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()}},{key:"updatePlaybackRate",value:function(e){this.playbackRate=e}},{key:"targetAnimations",value:function(){var e,n=(e=this.effect)===null||e===void 0?void 0:e.target;return n.getAnimations()}},{key:"markTarget",value:function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)}},{key:"unmarkTarget",value:function(){var e=this.targetAnimations(),n=e.indexOf(this);n!==-1&&e.splice(n,1)}},{key:"tick",value:function(e,n){!this._idle&&!this._paused&&(this._startTime===null?n&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),n&&(this.currentTimePending=!1,this.fireEvents(e))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(ie)}},{key:"addEventListener",value:function(e,n,i){throw new Error(ie)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(ie)}},{key:"dispatchEvent",value:function(e){throw new Error(ie)}},{key:"commitStyles",value:function(){throw new Error(ie)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var e;this._inEffect=!!((e=this.effect)!==null&&e!==void 0&&e.update(-1))}else{var n;this._inEffect=!!((n=this.effect)!==null&&n!==void 0&&n.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(e,n){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!n&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(e){var n=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var i=new fd(null,this,this.currentTime,e);setTimeout(function(){n.onfinish&&n.onfinish(i)})}this._finishedFlag=!0}}else{if(this.onframe&&this.playState==="running"){var a=new fd(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),rB=4,iB=.001,aB=1e-7,sB=10,oo=11,Rl=1/(oo-1),oB=typeof Float32Array=="function",VT=function(t,e){return 1-3*e+3*t},UT=function(t,e){return 3*e-6*t},YT=function(t){return 3*t},Wu=function(t,e,n){return((VT(e,n)*t+UT(e,n))*t+YT(e))*t},HT=function(t,e,n){return 3*VT(e,n)*t*t+2*UT(e,n)*t+YT(e)},lB=function(t,e,n,i,a){var s,o,l=0;do o=e+(n-e)/2,s=Wu(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>aB&&++l<sB);return o},uB=function(t,e,n,i){for(var a=0;a<rB;++a){var s=HT(e,n,i);if(s===0)return e;var o=Wu(e,n,i)-t;e-=o/s}return e},e1=function(t,e,n,i){if(!(t>=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===i)return function(l){return l};for(var a=oB?new Float32Array(oo):new Array(oo),s=0;s<oo;++s)a[s]=Wu(s*Rl,t,n);var o=function(u){for(var c=0,h=1,d=oo-1;h!==d&&a[h]<=u;++h)c+=Rl;--h;var f=(u-a[h])/(a[h+1]-a[h]),v=c+f*Rl,p=HT(v,t,n);return p>=iB?uB(u,v,t,n):p===0?v:lB(u,c,c+Rl,t,n)};return function(l){return l===0||l===1?l:Wu(o(l),e,i)}},cB=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},Ll=function(t){return Math.pow(t,2)},Il=function(t){return Math.pow(t,3)},Dl=function(t){return Math.pow(t,4)},Bl=function(t){return Math.pow(t,5)},Fl=function(t){return Math.pow(t,6)},zl=function(t){return 1-Math.cos(t*Math.PI/2)},jl=function(t){return 1-Math.sqrt(1-t*t)},ql=function(t){return t*t*(3*t-2)},$l=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((e*3-2)/22-t,2)},Gl=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=jt(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,l=De(Number(a),1,10),u=De(Number(o),.1,2);return t===0||t===1?t:-l*Math.pow(2,10*(t-1))*Math.sin((t-1-u/(Math.PI*2)*Math.asin(1/l))*(Math.PI*2)/u)},Zs=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=jt(e,4),a=i[0],s=a===void 0?1:a,o=i[1],l=o===void 0?100:o,u=i[2],c=u===void 0?10:u,h=i[3],d=h===void 0?0:h;s=De(s,.1,1e3),l=De(l,.1,1e3),c=De(c,.1,1e3),d=De(d,.1,1e3);var f=Math.sqrt(l/s),v=c/(2*Math.sqrt(l*s)),p=v<1?f*Math.sqrt(1-v*v):0,g=1,y=v<1?(v*f+-d)/p:-d+f,m=n?n*t/1e3:t;return v<1?m=Math.exp(-m*v*f)*(g*Math.cos(p*m)+y*Math.sin(p*m)):m=(g+y*m)*Math.exp(-m*f),t===0||t===1?t:1-m},gd=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=jt(n,2),a=i[0],s=a===void 0?10:a,o=i[1],l=o==="start"?Math.ceil:Math.floor;return l(De(t,0,1)*s)/s},lw=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=jt(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return e1(i,a,s,o)(t)},Wl=e1(.42,0,1,1),gr=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return 1-t(1-e,n,i)}},vr=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?t(e*2,n,i)/2:1-t(e*-2+2,n,i)/2}},pr=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-e*2,n,i))/2:(t(e*2-1,n,i)+1)/2}},uw={steps:gd,"step-start":function(t){return gd(t,[1,"start"])},"step-end":function(t){return gd(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":lw,ease:function(t){return lw(t,[.25,.1,.25,1])},in:Wl,out:gr(Wl),"in-out":vr(Wl),"out-in":pr(Wl),"in-quad":Ll,"out-quad":gr(Ll),"in-out-quad":vr(Ll),"out-in-quad":pr(Ll),"in-cubic":Il,"out-cubic":gr(Il),"in-out-cubic":vr(Il),"out-in-cubic":pr(Il),"in-quart":Dl,"out-quart":gr(Dl),"in-out-quart":vr(Dl),"out-in-quart":pr(Dl),"in-quint":Bl,"out-quint":gr(Bl),"in-out-quint":vr(Bl),"out-in-quint":pr(Bl),"in-expo":Fl,"out-expo":gr(Fl),"in-out-expo":vr(Fl),"out-in-expo":pr(Fl),"in-sine":zl,"out-sine":gr(zl),"in-out-sine":vr(zl),"out-in-sine":pr(zl),"in-circ":jl,"out-circ":gr(jl),"in-out-circ":vr(jl),"out-in-circ":pr(jl),"in-back":ql,"out-back":gr(ql),"in-out-back":vr(ql),"out-in-back":pr(ql),"in-bounce":$l,"out-bounce":gr($l),"in-out-bounce":vr($l),"out-in-bounce":pr($l),"in-elastic":Gl,"out-elastic":gr(Gl),"in-out-elastic":vr(Gl),"out-in-elastic":pr(Gl),spring:Zs,"spring-in":Zs,"spring-out":gr(Zs),"spring-in-out":vr(Zs),"spring-out-in":pr(Zs)},hB=function(t){return cB(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},dB=function(t){return uw[hB(t)]||uw.linear},fB=function(t){return t},gB=1,vB=.5,cw=0;function hw(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var Vl="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",pB=new RegExp("cubic-bezier\\(".concat(Vl,",").concat(Vl,",").concat(Vl,",").concat(Vl,"\\)")),yB=/steps\(\s*(\d+)\s*\)/,mB=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function n1(r){var t=pB.exec(r);if(t)return e1.apply(void 0,pe(t.slice(1).map(Number)));var e=yB.exec(r);if(e)return hw(Number(e[1]),cw);var n=mB.exec(r);return n?hw(Number(n[1]),{start:gB,middle:vB,end:cw}[n[2]]):dB(r)}function bB(r){return Math.abs(wB(r)/(r.playbackRate||1))}function wB(r){var t;return r.duration===0||r.iterations===0?0:(r.duration==="auto"?0:Number(r.duration))*((t=r.iterations)!==null&&t!==void 0?t:1)}var XT=0,r1=1,vc=2,KT=3;function xB(r,t,e){if(t===null)return XT;var n=e.endTime;return t<Math.min(e.delay,n)?r1:t>=Math.min(e.delay+r+e.endDelay,n)?vc:KT}function EB(r,t,e,n,i){switch(n){case r1:return t==="backwards"||t==="both"?0:null;case KT:return e-i;case vc:return t==="forwards"||t==="both"?r:null;case XT:return null}}function SB(r,t,e,n,i){var a=i;return r===0?t!==r1&&(a+=e):a+=n/r,a}function _B(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===vc&&n!==0&&(i!==0||a===0)&&(s=1),s}function MB(r,t,e,n){return r===vc&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function kB(r,t,e){var n=r;if(r!=="normal"&&r!=="reverse"){var i=t;r==="alternate-reverse"&&(i+=1),n="normal",i!==1/0&&i%2!==0&&(n="reverse")}return n==="normal"?e:1-e}function OB(r,t,e){var n=xB(r,t,e),i=EB(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=SB(a,n,e.iterations,i,e.iterationStart),o=_B(s,e.iterationStart,n,e.iterations,i,a),l=MB(n,e.iterations,o,s),u=kB(e.direction,l,o);return e.currentIteration=l,e.progress=u,e.easingFunction(u)}function TB(r,t,e){var n=AB(r,t),i=PB(n,e);return function(a,s){if(s!==null)i.filter(function(l){return s>=l.applyFrom&&s<l.applyTo}).forEach(function(l){var u=s-l.startOffset,c=l.endOffset-l.startOffset,h=c===0?0:u/c;a.setAttribute(l.property,l.interpolation(h),!1,!1)});else for(var o in n)ZT(o)&&a.setAttribute(o,null)}}function ZT(r){return r!=="offset"&&r!=="easing"&&r!=="composite"&&r!=="computedOffset"}function AB(r,t){for(var e={},n=0;n<r.length;n++)for(var i in r[n])if(ZT(i)){var a={offset:r[n].offset,computedOffset:r[n].computedOffset,easing:r[n].easing,easingFunction:n1(r[n].easing)||t.easingFunction,value:r[n][i]};e[i]=e[i]||[],e[i].push(a)}return e}function PB(r,t){var e=[];for(var n in r)for(var i=r[n],a=0;a<i.length-1;a++){var s=a,o=a+1,l=i[s].computedOffset,u=i[o].computedOffset,c=l,h=u;a===0&&(c=-1/0,u===0&&(o=s)),a===i.length-2&&(h=1/0,l===1&&(s=o)),e.push({applyFrom:c,applyTo:h,startOffset:i[s].computedOffset,endOffset:i[o].computedOffset,easingFunction:i[s].easingFunction,property:n,interpolation:NB(n,i[s].value,i[o].value,t)})}return e.sort(function(d,f){return d.startOffset-f.startOffset}),e}var dw=function(t,e,n){return function(i){var a=JT(t,e,i);return St(a)?a:n(a)}};function NB(r,t,e,n){var i=AT[r];if(i&&i.syntax&&i.int){var a=ft.styleValueRegistry.getPropertySyntax(i.syntax);if(a){var s=a.parser,o=s?s(t,n):t,l=s?s(e,n):e,u=a.mixer(o,l,n);if(u){var c=dw.apply(void 0,pe(u));return function(h){return h===0?t:h===1?e:c(h)}}}}return dw(!1,!0,function(h){return h?e:t})}function JT(r,t,e){if(typeof r=="number"&&typeof t=="number")return r*(1-e)+t*e;if(typeof r=="boolean"&&typeof t=="boolean"||typeof r=="string"&&typeof t=="string")return e<.5?r:t;if(Array.isArray(r)&&Array.isArray(t)){for(var n=r.length,i=t.length,a=Math.max(n,i),s=[],o=0;o<a;o++)s.push(JT(r[o<n?o:n-1],t[o<i?o:i-1],e));return s}throw new Error("Mismatched interpolation arguments ".concat(r,":").concat(t))}var CB=function(){function r(){ht(this,r),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=fB,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return dt(r,[{key:"easing",get:function(){return this._easing},set:function(e){this.easingFunction=n1(e),this._easing=e}}])}();function RB(r){var t=[];for(var e in r)if(!(e in["easing","offset","composite"])){var n=r[e];Array.isArray(n)||(n=[n]);for(var i=n.length,a=0;a<i;a++){if(!t[a]){var s={};"offset"in r&&(s.offset=Number(r.offset)),"easing"in r&&(s.easing=r.easing),"composite"in r&&(s.composite=r.composite),t[a]=s}n[a]!==void 0&&n[a]!==null&&(t[a][e]=n[a])}}return t.sort(function(o,l){return(o.computedOffset||0)-(l.computedOffset||0)}),t}function fw(r,t){if(r===null)return[];Array.isArray(r)||(r=RB(r));for(var e=r.map(function(l){var u={};t!=null&&t.composite&&(u.composite="auto");for(var c in l){var h=l[c];if(c==="offset"){if(h!==null){if(h=Number(h),!isFinite(h))throw new Error("Keyframe offsets must be numbers.");if(h<0||h>1)throw new Error("Keyframe offsets must be between 0 and 1.");u.computedOffset=h}}else if(c==="composite"&&["replace","add","accumulate","auto"].indexOf(h)===-1)throw new Error("".concat(h," compositing is not supported"));u[c]=h}return u.offset===void 0&&(u.offset=null),u.easing===void 0&&(u.easing=(t==null?void 0:t.easing)||"linear"),u.composite===void 0&&(u.composite="auto"),u}),n=!0,i=-1/0,a=0;a<e.length;a++){var s=e[a].offset;if(Rt(s))n=!1;else{if(s<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=s}}e=e.filter(function(l){return Number(l.offset)>=0&&Number(l.offset)<=1});function o(){var l,u=e,c=u.length;if(e[c-1].computedOffset=Number((l=e[c-1].offset)!==null&&l!==void 0?l:1),c>1){var h;e[0].computedOffset=Number((h=e[0].offset)!==null&&h!==void 0?h:0)}for(var d=0,f=Number(e[0].computedOffset),v=1;v<c;v++){var p=e[v].computedOffset;if(!Rt(p)&&!Rt(f)){for(var g=1;g<v-d;g++)e[d+g].computedOffset=f+(Number(p)-f)*g/(v-d);d=v,f=Number(p)}}}return n||o(),e}var LB="backwards|forwards|both|none".split("|"),IB="reverse|alternate|alternate-reverse".split("|");function DB(r,t){var e=new CB;return typeof r=="number"&&!isNaN(r)?e.duration=r:r!==void 0&&Object.keys(r).forEach(function(n){if(r[n]!==void 0&&r[n]!==null&&r[n]!=="auto"){if((typeof e[n]=="number"||n==="duration")&&(typeof r[n]!="number"||isNaN(r[n]))||n==="fill"&&LB.indexOf(r[n])===-1||n==="direction"&&IB.indexOf(r[n])===-1)return;e[n]=r[n]}}),e}function BB(r,t){return r=FB(r!=null?r:{duration:"auto"}),DB(r)}function FB(r){return typeof r=="number"&&(isNaN(r)?r={duration:"auto"}:r={duration:r}),r}var zB=function(){function r(t,e,n){var i=this;ht(this,r),this.composite="replace",this.iterationComposite="replace",this.target=t,this.timing=BB(n),this.timing.effect=this,this.timing.activeDuration=bB(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=fw(e,this.timing),this.interpolations=TB(this.normalizedKeyframes,this.timing,this.target);var a=ft.globalThis.Proxy;this.computedTiming=a?new a(this.timing,{get:function(o,l){return l==="duration"?o.duration==="auto"?0:o.duration:l==="fill"?o.fill==="auto"?"none":o.fill:l==="localTime"?i.animation&&i.animation.currentTime||null:l==="currentIteration"?!i.animation||i.animation.playState!=="running"?null:o.currentIteration||0:l==="progress"?!i.animation||i.animation.playState!=="running"?null:o.progress||0:o[l]},set:function(){return!0}}):this.timing}return dt(r,[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(e){return e===null?!1:(this.timeFraction=OB(this.timing.activeDuration,e,this.timing),this.timeFraction!==null)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(e){this.normalizedKeyframes=fw(e)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(e){var n=this;Object.keys(e||{}).forEach(function(i){n.timing[i]=e[i]})}}])}();function gw(r,t){return Number(r.id)-Number(t.id)}var jB=function(){function r(t){var e=this;ht(this,r),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(n){e.currentTime=n,e.discardAnimations(),e.animations.length===0?e.timelineTicking=!1:e.requestAnimationFrame(e.webAnimationsNextTick)},this.processRafCallbacks=function(n){var i=e.rafCallbacks;e.rafCallbacks=[],n<Number(e.currentTime)&&(n=Number(e.currentTime)),e.animations.sort(gw),e.animations=e.tick(n,!0,e.animations)[0],i.forEach(function(a){a[1](n)}),e.applyPendingEffects()},this.document=t}return dt(r,[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(e,n,i){var a=new zB(e,n,i),s=new nB(a,this);return this.animations.push(s),this.restartWebAnimationsNextTick(),s.updatePromises(),s.play(),s.updatePromises(),s}},{key:"applyDirtiedAnimation",value:function(e){var n=this;if(!this.inTick){e.markTarget();var i=e.targetAnimations();i.sort(gw);var a=this.tick(Number(this.currentTime),!1,i.slice())[1];a.forEach(function(s){var o=n.animations.indexOf(s);o!==-1&&n.animations.splice(o,1)}),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach(function(e){e==null||e.applyInterpolations()}),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(e){return e.updatePromises()})}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(e){return e.playState!=="finished"&&e.playState!=="idle"})}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(e){var n=this.rafId++;return this.rafCallbacks.length===0&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([n,e]),n}},{key:"requestAnimationFrame",value:function(e){var n=this;return this.rAF(function(i){n.updateAnimationsPromises(),e(i),n.updateAnimationsPromises()})}},{key:"tick",value:function(e,n,i){var a=this,s,o;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=e,this.ticking=!1;var l=[],u=[],c=[],h=[];return i.forEach(function(d){d.tick(e,n),d._inEffect?(u.push(d.effect),d.markTarget()):(l.push(d.effect),d.unmarkTarget()),d._needsTick&&(a.ticking=!0);var f=d._inEffect||d._needsTick;d._inTimeline=f,f?c.push(d):h.push(d)}),(s=this.pendingEffects).push.apply(s,l),(o=this.pendingEffects).push.apply(o,u),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[c,h]}}])}();ft.EasingFunction=n1;ft.AnimationTimeline=jB;const qB={duration:500},$B={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var Se;(function(r){r.NodeAdded="NodeAdded",r.NodeUpdated="NodeUpdated",r.NodeRemoved="NodeRemoved",r.EdgeAdded="EdgeAdded",r.EdgeUpdated="EdgeUpdated",r.EdgeRemoved="EdgeRemoved",r.ComboAdded="ComboAdded",r.ComboUpdated="ComboUpdated",r.ComboRemoved="ComboRemoved"})(Se||(Se={}));var Gn;(function(r){r.DRAW="draw",r.COLLAPSE="collapse",r.EXPAND="expand",r.TRANSFORM="transform"})(Gn||(Gn={}));var Si;(function(r){r.CLICK="canvas:click",r.DBLCLICK="canvas:dblclick",r.POINTER_OVER="canvas:pointerover",r.POINTER_LEAVE="canvas:pointerleave",r.POINTER_ENTER="canvas:pointerenter",r.POINTER_MOVE="canvas:pointermove",r.POINTER_OUT="canvas:pointerout",r.POINTER_DOWN="canvas:pointerdown",r.POINTER_UP="canvas:pointerup",r.CONTEXT_MENU="canvas:contextmenu",r.DRAG_START="canvas:dragstart",r.DRAG="canvas:drag",r.DRAG_END="canvas:dragend",r.DRAG_ENTER="canvas:dragenter",r.DRAG_OVER="canvas:dragover",r.DRAG_LEAVE="canvas:dragleave",r.DROP="canvas:drop",r.WHEEL="canvas:wheel"})(Si||(Si={}));var Sa;(function(r){r.CLICK="combo:click",r.DBLCLICK="combo:dblclick",r.POINTER_OVER="combo:pointerover",r.POINTER_LEAVE="combo:pointerleave",r.POINTER_ENTER="combo:pointerenter",r.POINTER_MOVE="combo:pointermove",r.POINTER_OUT="combo:pointerout",r.POINTER_DOWN="combo:pointerdown",r.POINTER_UP="combo:pointerup",r.CONTEXT_MENU="combo:contextmenu",r.DRAG_START="combo:dragstart",r.DRAG="combo:drag",r.DRAG_END="combo:dragend",r.DRAG_ENTER="combo:dragenter",r.DRAG_OVER="combo:dragover",r.DRAG_LEAVE="combo:dragleave",r.DROP="combo:drop"})(Sa||(Sa={}));var it;(function(r){r.CLICK="click",r.DBLCLICK="dblclick",r.POINTER_OVER="pointerover",r.POINTER_LEAVE="pointerleave",r.POINTER_ENTER="pointerenter",r.POINTER_MOVE="pointermove",r.POINTER_OUT="pointerout",r.POINTER_DOWN="pointerdown",r.POINTER_UP="pointerup",r.CONTEXT_MENU="contextmenu",r.DRAG_START="dragstart",r.DRAG="drag",r.DRAG_END="dragend",r.DRAG_ENTER="dragenter",r.DRAG_OVER="dragover",r.DRAG_LEAVE="dragleave",r.DROP="drop",r.KEY_DOWN="keydown",r.KEY_UP="keyup",r.WHEEL="wheel",r.PINCH="pinch"})(it||(it={}));var gs;(function(r){r.KEY_DOWN="keydown",r.KEY_UP="keyup"})(gs||(gs={}));var Vu;(function(r){r.CLICK="edge:click",r.DBLCLICK="edge:dblclick",r.POINTER_OVER="edge:pointerover",r.POINTER_LEAVE="edge:pointerleave",r.POINTER_ENTER="edge:pointerenter",r.POINTER_MOVE="edge:pointermove",r.POINTER_OUT="edge:pointerout",r.POINTER_DOWN="edge:pointerdown",r.POINTER_UP="edge:pointerup",r.CONTEXT_MENU="edge:contextmenu",r.DRAG_ENTER="edge:dragenter",r.DRAG_OVER="edge:dragover",r.DRAG_LEAVE="edge:dragleave",r.DROP="edge:drop"})(Vu||(Vu={}));var pt;(function(r){r.BEFORE_CANVAS_INIT="beforecanvasinit",r.AFTER_CANVAS_INIT="aftercanvasinit",r.BEFORE_SIZE_CHANGE="beforesizechange",r.AFTER_SIZE_CHANGE="aftersizechange",r.BEFORE_ELEMENT_CREATE="beforeelementcreate",r.AFTER_ELEMENT_CREATE="afterelementcreate",r.BEFORE_ELEMENT_UPDATE="beforeelementupdate",r.AFTER_ELEMENT_UPDATE="afterelementupdate",r.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",r.AFTER_ELEMENT_DESTROY="afterelementdestroy",r.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",r.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",r.BEFORE_DRAW="beforedraw",r.AFTER_DRAW="afterdraw",r.BEFORE_RENDER="beforerender",r.AFTER_RENDER="afterrender",r.BEFORE_ANIMATE="beforeanimate",r.AFTER_ANIMATE="afteranimate",r.BEFORE_LAYOUT="beforelayout",r.AFTER_LAYOUT="afterlayout",r.BEFORE_STAGE_LAYOUT="beforestagelayout",r.AFTER_STAGE_LAYOUT="afterstagelayout",r.BEFORE_TRANSFORM="beforetransform",r.AFTER_TRANSFORM="aftertransform",r.BATCH_START="batchstart",r.BATCH_END="batchend",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.BEFORE_RENDERER_CHANGE="beforerendererchange",r.AFTER_RENDERER_CHANGE="afterrendererchange"})(pt||(pt={}));var Fi;(function(r){r.UNDO="undo",r.REDO="redo",r.CANCEL="cancel",r.ADD="add",r.CLEAR="clear",r.CHANGE="change"})(Fi||(Fi={}));var wr;(function(r){r.CLICK="node:click",r.DBLCLICK="node:dblclick",r.POINTER_OVER="node:pointerover",r.POINTER_LEAVE="node:pointerleave",r.POINTER_ENTER="node:pointerenter",r.POINTER_MOVE="node:pointermove",r.POINTER_OUT="node:pointerout",r.POINTER_DOWN="node:pointerdown",r.POINTER_UP="node:pointerup",r.CONTEXT_MENU="node:contextmenu",r.DRAG_START="node:dragstart",r.DRAG="node:drag",r.DRAG_END="node:dragend",r.DRAG_ENTER="node:dragenter",r.DRAG_OVER="node:dragover",r.DRAG_LEAVE="node:dragleave",r.DROP="node:drop"})(wr||(wr={}));const le="combo",nr="tree";var Ts;(function(r){r.NODE="node",r.EDGE="edge",r.COMBO="combo",r.THEME="theme",r.PALETTE="palette",r.LAYOUT="layout",r.BEHAVIOR="behavior",r.PLUGIN="plugin",r.ANIMATION="animation",r.TRANSFORM="transform",r.SHAPE="shape"})(Ts||(Ts={}));const am={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function _i(r,t){var e;const n=(e=am[r])===null||e===void 0?void 0:e[t];if(n)return n}const GB="5.0.43",WB="G6";function wi(r){return`[${WB} v${GB}] ${r}`}const ai={mute:!1,debug:r=>{console.debug(wi(r))},info:r=>{console.info(wi(r))},warn:r=>{console.warn(wi(r))},error:r=>{console.error(wi(r))}};function QT(r){const{theme:t}=r;if(!t)return{};const e=_i(Ts.THEME,t);return e||(ai.warn(`The theme of ${t} is not registered.`),{})}function i1(r,t){if(Array.isArray(r)&&r.length===0)return null;const e=Array.isArray(r)?r[0]:r,n=Array.isArray(r)?r.slice(1):t||[];return new Proxy(e,{get(i,a){return typeof i[a]=="function"&&!["onframe","onfinish"].includes(a)?(...s)=>{i[a](...s),n.forEach(o=>{var l;return(l=o[a])===null||l===void 0?void 0:l.call(o,...s)})}:a==="finished"?Promise.all([e.finished,...n.map(s=>s.finished)]):Reflect.get(i,a)},set(i,a,s){return["onframe","onfinish"].includes(a)||n.forEach(o=>{o[a]=s}),Reflect.set(i,a,s)}})}function sm(r){const t=r.reduce((n,i)=>(Object.entries(i).forEach(([a,s])=>{n[a]===void 0?n[a]=[s]:n[a].push(s)}),n),{});Object.entries(t).forEach(([n,i])=>{(i.length!==r.length||i.some(a=>Rt(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Be(a,i[0])))&&delete t[n]});const e=Object.entries(t).reduce((n,[i,a])=>(a.forEach((s,o)=>{n[o]?n[o][i]=s:n[o]={[i]:s}}),n),[]);return r.length!==0&&e.length===0&&e.push({_:0},{_:0}),e}function No(r){switch(r){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function tA(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},qB);return Ve(e)&&Object.assign(n,e),Ve(t)&&Object.assign(n,t),n}function VB(r){if(typeof r=="string"){const t=_i(Ts.ANIMATION,r);return t||(ai.warn(`The animation of ${r} is not registered.`),[])}return r}function UB(r,t,e,n){var i,a;const{animation:s}=r;if(s===!1||n===!1)return[];const o=(i=r==null?void 0:r[t])===null||i===void 0?void 0:i.animation;if(o===!1)return[];const l=o==null?void 0:o[e];if(l===!1)return[];const u=(a=QT(r)[t])===null||a===void 0?void 0:a.animation,c=(d=[])=>VB(d).map(f=>Object.assign(Object.assign(Object.assign(Object.assign({},$B),Ve(s)&&s),f),Ve(n)&&n));if(l)return c(l);if(!u)return[];const h=u[e];return h===!1?[]:c(h)}function eA(r,t,e,n=[]){if(!n&&r===0&&t===0&&e===0)return null;if(Array.isArray(n)){let a=-1;const s=[];for(let o=0;o<n.length;o++){const l=n[o];if(l[0]==="translate"){if(l[1]===r&&l[2]===t)return null;a=o,s.push(["translate",r,t])}else if(l[0]==="translate3d"){if(l[1]===r&&l[2]===t&&l[3]===e)return null;a=o,s.push(["translate3d",r,t,e!=null?e:0])}else s.push(l)}return a===-1&&s.splice(0,0,St(e)?["translate3d",r,t,e!=null?e:0]:["translate",r,t]),s.length===0?null:s}const i=n?n.replace(/translate(3d)?\([^)]*\)/g,""):"";return e===0?`translate(${r}, ${t})${i}`:`translate3d(${r}, ${t}, ${e})${i}`}var YB=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};const HB=(r,t,e)=>{if(!e.length)return null;const[n,i]=t,a=u=>{var c;if(u){const h=r.getShape(u);if(!h)return null;const d=`get${Ru(u)}Style`,f=((c=r==null?void 0:r[d])===null||c===void 0?void 0:c.bind(r))||(g=>g),v=(f==null?void 0:f(n))||{},p=(f==null?void 0:f(i))||{};return{shape:h,fromStyle:v,toStyle:p}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(u=>{var{fields:c,shape:h,states:d}=u,f=YB(u,["fields","shape","states"]);const v=a(h);if(!v)return null;const{shape:p,fromStyle:g,toStyle:y}=v,m=[{},{}];if(c.forEach(E=>{var _,k;Object.assign(m[0],{[E]:(_=g[E])!==null&&_!==void 0?_:No(E)}),Object.assign(m[1],{[E]:(k=y[E])!==null&&k!==void 0?k:No(E)})}),m.some(E=>Object.keys(E).some(_=>["x","y","z"].includes(_)))){const{x:E=0,y:_=0,z:k,transform:T=""}=p.attributes||{};m.forEach(O=>{var P,N,C;O.transform=eA((P=O.x)!==null&&P!==void 0?P:E,(N=O.y)!==null&&N!==void 0?N:_,(C=O.z)!==null&&C!==void 0?C:k,T)})}const w=p.animate(sm(m),f);return h===void 0&&(s=w),w}).filter(Boolean),l=s||(o==null?void 0:o[0]);return l?i1(l,o.filter(u=>u!==u)):null},XB=[{fields:["opacity"]}],KB=[{fields:["x","y"]}],nA=[{fields:["x","y"]}],ZB=nA,rA=[{fields:["sourceNode","targetNode"]}],JB=rA,iA=[{fields:["childrenNode","x","y"]}],QB=iA;function tF(r){return"source"in r&&"target"in r}function eF(r){return r.length===2}function As(r){return r instanceof Float32Array?!0:Array.isArray(r)&&(r.length===2||r.length===3)?r.every(t=>typeof t=="number"):!1}function ii(r,t,e){return r>=t&&r<=e}function si(r=0){if(Array.isArray(r)){const[t=0,e=t,n=t,i=e]=r;return[t,e,n,i]}return[r,r,r,r]}function nF(r=0){const t=si(r);return t[0]+t[2]}function oi(r){return r.max[0]-r.min[0]}function li(r){return r.max[1]-r.min[1]}function sa(r){return[oi(r),li(r)]}function Gi(r,t){const e=As(r)?a1(r):r.getShape("key").getBounds();return t?oa(e,t):e}function a1(r){const[t,e,n=0]=r,i=new ge;return i.setMinMax([t,e,n],[t,e,n]),i}function oa(r,t){const[e,n,i,a]=si(t),[s,o,l]=r.min,[u,c,h]=r.max,d=new ge;return d.setMinMax([s-a,o-e,l],[u+n,c+i,h]),d}function Zo(r){if(r.length===0)return new ge;if(r.length===1)return r[0];const t=new ge;t.setMinMax(r[0].min,r[0].max);for(let e=1;e<r.length;e++){const n=r[e];t.setMinMax([Math.min(t.min[0],n.min[0]),Math.min(t.min[1],n.min[1]),Math.min(t.min[2],n.min[2])],[Math.max(t.max[0],n.max[0]),Math.max(t.max[1],n.max[1]),Math.max(t.max[2],n.max[2])])}return t}function rF(r,t){const[e,n]=r.min,[i,a]=r.max,[s,o]=t.min,[l,u]=t.max;return e>=s&&i<=l&&n>=o&&a<=u}function Ir(r,t){return ii(r[0],t.min[0],t.max[0])&&ii(r[1],t.min[1],t.max[1])}function aA(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||ii(r[0],n,a)),l=(r[0]===n||r[0]===a)&&(e||ii(r[1],i,s));return o||l}function iF(r,t){return!Ir(r,t)}function Uu(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function xo(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,l=e-i,u=s-e,c=n-a,h=o-n,d=Math.min(l,u,c,h);return d===l?"left":d===u?"right":d===c?"top":d===h?"bottom":"left"}function Ta(r,t){const e=ea(r);if(Ir(r,t))switch(xo(r,t)){case"left":e[0]=t.min[0];break;case"right":e[0]=t.max[0];break;case"top":e[1]=t.min[1];break;case"bottom":e[1]=t.max[1];break}else{const[n,i]=r,[a,s]=t.min,[o,l]=t.max;e[0]=ii(n,a,o)?n:n<a?a:o,e[1]=ii(i,s,l)?i:i<s?s:l}return e}function aF(r,t){const{center:e}=r,[n,i]=sa(r),a=t==="up"||t==="down"?e[0]:t==="right"?e[0]-n/6:e[0]+n/6,s=t==="left"||t==="right"?e[1]:t==="down"?e[1]-i/6:e[1]+i/6;return[a,s]}function sF(r,t){let[e,n]=sa(r);return[e,n]=t==="up"||t==="down"?[e,n]:[n,e],(Math.pow(n,2)-Math.pow(Math.sqrt(Math.pow(e/2,2)+Math.pow(n,2))-e/2,2))/(2*n)}function oF(r){const{min:[t,e],max:[n,i]}=r,a=[t,i],s=[n,i],o=[n,e],l=[t,e];return[[a,s],[s,o],[o,l],[l,a]]}var lF=function(t,e){return t===e},vw=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}(),uF=function(){function r(t){t===void 0&&(t=lF),this.head=null,this.tail=null,this.compare=t}return r.prototype.prepend=function(t){var e=new vw(t,this.head);return this.head=e,this.tail||(this.tail=e),this},r.prototype.append=function(t){var e=new vw(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 s=this.head;s;){if(a&&a(s.value)||n!==void 0&&this.compare(s.value,n))return s;s=s.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}(),cF=function(t,e,n){e===void 0&&(e=[]);var i=e.filter(function(l){return l.source===t||l.target===t});if(n==="target"){var a=function(u){return u.source===t};return i.filter(a).map(function(l){return l.target})}if(n==="source"){var s=function(u){return u.target===t};return i.filter(s).map(function(l){return l.source})}var o=function(u){return u.source===t?u.target:u.source};return i.map(o)},hF=function(t,e){return e.filter(function(n){return n.source===t})},dF=function(t,e){return e.filter(function(n){return n.source===t||n.target===t})},fF=function(t){var e={},n=t.nodes,i=n===void 0?[]:n,a=t.edges,s=a===void 0?[]:a;return i.forEach(function(o){e[o.id]={degree:0,inDegree:0,outDegree:0}}),s.forEach(function(o){e[o.source].degree++,e[o.source].outDegree++,e[o.target].degree++,e[o.target].inDegree++}),e},gF={}.toString,s1=function(r,t){return gF.call(r)==="[object "+t+"]"};const sA=function(r){return s1(r,"Function")},oA=function(r){return Array.isArray?Array.isArray(r):s1(r,"Array")},vF=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function pF(r,t){if(r){var e;if(oA(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(vF(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}const yF=function(r){return s1(r,"String")};var mF=Object.values?function(r){return Object.values(r)}:function(r){var t=[];return pF(r,function(e,n){sA(r)&&n==="prototype"||t.push(e)}),t};const bF=function(r,t){if(!sA(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],s=e.cache;if(s.has(a))return s.get(a);var o=r.apply(this,n);return s.set(a,o),o};return e.cache=new Map,e};var Ul;bF(function(r,t){t===void 0&&(t={});var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return Ul||(Ul=document.createElement("canvas").getContext("2d")),Ul.font=[a,s,i,e+"px",n].join(" "),Ul.measureText(yF(r)?r:"").width},function(r,t){return t===void 0&&(t={}),L3([r],mF(t)).join("")});var wF=function(t,e,n){for(var i=1/0,a,s=0;s<e.length;s++){var o=e[s].id;!n[o]&&t[o]<=i&&(i=t[o],a=e[s])}return a},xF=function(t,e,n,i){var a=t.nodes,s=a===void 0?[]:a,o=t.edges,l=o===void 0?[]:o,u={},c={},h={};s.forEach(function(m,w){var E=m.id;c[E]=1/0,E===e&&(c[E]=0)});for(var d=s.length,f=function(w){var E=wF(c,s,u),_=E.id;if(u[_]=!0,c[_]===1/0)return"continue";var k=[];n?k=hF(_,l):k=dF(_,l),k.forEach(function(T){var O=T.target,P=T.source,N=O===_?P:O,C=i&&T[i]?T[i]:1;c[N]>c[E.id]+C?(c[N]=c[E.id]+C,h[N]=[E.id]):c[N]===c[E.id]+C&&h[N].push(E.id)})},v=0;v<d;v++)f();h[e]=[e];var p={};for(var g in c)c[g]!==1/0&&lA(e,g,h,p);var y={};for(var g in p)y[g]=p[g][0];return{length:c,path:y,allPath:p}};function lA(r,t,e,n){if(r===t)return[r];if(n[t])return n[t];for(var i=[],a=0,s=e[t];a<s.length;a++){var o=s[a],l=lA(r,o,e,n);if(!l)return;for(var u=0,c=l;u<c.length;u++){var h=c[u];oA(h)?i.push(xt(xt([],h,!0),[t],!1)):i.push([h,t])}}return n[t]=i,n[t]}var uA=function(t,e,n,i,a){var s=xF(t,e,i,a),o=s.length,l=s.path,u=s.allPath;return{length:o[n],path:l[n],allPath:u[n]}},pw;(function(r){r.EuclideanDistance="euclideanDistance"})(pw||(pw={}));var EF=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,s=1e3,o=t.nodes,l=o===void 0?[]:o,u=t.edges,c=u===void 0?[]:u,h=l.length,d,f={},v={},p=0;p<h;++p){var g=l[p],y=g.id;f[y]=1/h,v[y]=1/h}for(var m=fF(t);s>0&&i>e;){a=0;for(var p=0;p<h;++p){var g=l[p],y=g.id;if(d=0,m[g.id].inDegree===0)f[y]=0;else{for(var w=cF(y,c,"source"),E=0;E<w.length;++E){var _=w[E],k=m[_].outDegree;k>0&&(d+=v[_]/k)}f[y]=n*d,a+=f[y]}}a=(1-a)/h,i=0;for(var p=0;p<h;++p){var g=l[p],y=g.id;d=f[y]+a,i+=Math.abs(d-v[y]),v[y]=d}s-=1}return v};(function(){function r(t){t===void 0&&(t=10),this.linkedList=new uF,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})();function J(r){if(r.id!==void 0)return r.id;if(r.source!==void 0&&r.target!==void 0)return`${r.source}-${r.target}`;throw new Error(wi("The datum does not have available id."))}function Yl(r){return r.combo}function cA(r,t){const e={nodes:(r.nodes||[]).map(J),edges:(r.edges||[]).map(J),combos:(r.combos||[]).map(J)};return t?Object.values(e).flat():e}const hA=(r,t,e)=>{var n;switch(e.type){case"degree":{const i=new Map;return(n=r.nodes)===null||n===void 0||n.forEach(a=>{const s=t(J(a),e.direction).length;i.set(J(a),s)}),i}case"betweenness":return SF(r,e.directed,e.weightPropertyName);case"closeness":return _F(r,e.directed,e.weightPropertyName);case"eigenvector":return kF(r,e.directed);case"pagerank":return MF(r,e.epsilon,e.linkProb);default:return dA(r)}},dA=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(J(n),0)}),e},SF=(r,t,e)=>{const n=dA(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=uA(r,J(a),J(s),t,e),l=o.length;o.flat().forEach(u=>{u!==J(a)&&u!==J(s)&&n.set(u,n.get(u)+1/l)})}})}),n},_F=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,l)=>{if(a!==l){const{length:u}=uA(r,J(a),J(l),t,e);o+=u}return o},0);n.set(J(a),1/s)}),n},MF=(r,t,e)=>{var n;const i=new Map,a=EF(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(J(s),a[J(s)])}),i},kF=(r,t)=>{const{nodes:e=[]}=r,n=OF(r,t),i=TF(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(J(s),i[o])}),a},OF=(r,t)=>{const{nodes:e=[],edges:n=[]}=r,i=Array(e.length).fill(null).map(()=>Array(e.length).fill(0));return n.forEach(({source:a,target:s})=>{const o=e.findIndex(u=>J(u)===a),l=e.findIndex(u=>J(u)===s);t?i[o][l]=1:(i[o][l]=1,i[l][o]=1)}),i},TF=(r,t,e=100,n=1e-6)=>{let i=Array(t).fill(1),a=1/0;for(let s=0;s<e&&a>n;s++){const o=Array(t).fill(0);for(let u=0;u<t;u++)for(let c=0;c<t;c++)o[u]+=r[u][c]*i[c];const l=Math.sqrt(o.reduce((u,c)=>u+c*c,0));for(let u=0;u<t;u++)o[u]/=l;a=Math.sqrt(o.reduce((u,c,h)=>u+(c-i[h])*c,0)),i=o}return i};function Zi(r,t,e,n=Be){const i=new Map(r.map(d=>[e(d),d])),a=new Map(t.map(d=>[e(d),d])),s=new Set(i.keys()),o=new Set(a.keys()),l=[],u=[],c=[],h=[];return o.forEach(d=>{s.has(d)?n(i.get(d),a.get(d))?h.push(a.get(d)):u.push(a.get(d)):l.push(a.get(d))}),s.forEach(d=>{o.has(d)||c.push(i.get(d))}),{enter:l,exit:c,keep:h,update:u}}function Ba(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function AF(r,t,e){const n={},i=a=>(a in n||(n[a]=0),`${t}-${a}-${n[a]++}`);return e.map(a=>typeof a=="string"?{type:a,key:i(a)}:typeof a=="function"?a.call(r):a.key?a:Object.assign(Object.assign({},a),{key:i(a.type)}))}class o1{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=AF(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=Zi(this.extensions,e,o=>o.key);this.createExtensions(n),this.updateExtensions([...i,...s]),this.destroyExtensions(a),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:i}=t,a=_i(e,i);if(!a)return ai.warn(`The extension ${i} of ${e} is not registered.`);const s=new a(this.context,t);this.extensionMap[n]=s}createExtensions(t){t.forEach(e=>this.createExtension(e))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach(e=>this.updateExtension(e))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach(({key:e})=>this.destroyExtension(e))}destroy(){Object.values(this.extensionMap).forEach(t=>t.destroy()),this.context={},this.extensions=[],this.extensionMap={}}}class l1{constructor(t,e){this.events=[],this.destroyed=!1,this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class ur extends l1{}class pc extends ur{constructor(t,e){super(t,Object.assign({},pc.defaultOptions,e)),this.isOverlapping=(n,i)=>i.some(a=>n.intersects(a)),this.occupiedBounds=[],this.detectLabelCollision=n=>{const i=this.context.viewport,a={show:[],hide:[]};return this.occupiedBounds=[],n.forEach(s=>{const o=s.getShape("label").getRenderBounds();i.isInViewport(o,!0)&&!this.isOverlapping(o,this.occupiedBounds)?(a.show.push(s),this.occupiedBounds.push(oa(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=Zi(n,i,s=>s.id);a==null||a.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(n,i)=>{const{model:a}=this.context,s=a.getData(),o=a.getRelatedEdgesData.bind(a);return n.map(u=>(this.nodeCentralities.has(u.id)||(this.nodeCentralities=hA(s,o,i)),{node:u,centrality:this.nodeCentralities.get(u.id)})).sort((u,c)=>c.centrality-u.centrality).map(u=>u.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:l}=this.context;if(Ot(i))return n.sort((p,g)=>i(l.getElementDataById(p.id),l.getElementDataById(g.id)));const{node:u=[],edge:c=[],combo:h=[]}=cc(n,p=>p.type),d=Ot(s)?h.sort((p,g)=>s(...l.getComboData([p.id,g.id]))):h,f=Ot(a)?u.sort((p,g)=>a(...l.getNodeData([p.id,g.id]))):this.sortNodesByCentrality(u,a),v=Ot(o)?c.sort((p,g)=>o(...l.getEdgeData([p.id,g.id]))):c;return[...d,...f,...v]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=n=>{var i;if(((i=n.data)===null||i===void 0?void 0:i.stage)==="zIndex")return;if(!this.validate(n)){this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear());return}const a=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,a),this.labelElementsInView=a;const s=this.sortLabelElementsInView(this.labelElementsInView),{show:o,hide:l}=this.detectLabelCollision(s);for(let u=o.length-1;u>=0;u--)this.showLabel(o[u]);l.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Ba(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Ba(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=JO(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=n=>{this.enableToggle&&this.onToggleVisibility(n)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=n=>{this.onToggleVisibility(n),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const i=t[n];i.isVisible()&&i.getShape("label")&&e.push(i)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:t}=this.context;t.on(pt.BEFORE_RENDER,this.onBeforeRender),t.on(pt.AFTER_RENDER,this.onAfterRender),t.on(pt.AFTER_DRAW,this.toggle),t.on(pt.AFTER_LAYOUT,this.toggle),t.on(pt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(pt.BEFORE_RENDER,this.onBeforeRender),t.off(pt.AFTER_RENDER,this.onAfterRender),t.off(pt.AFTER_DRAW,this.toggle),t.off(pt.AFTER_LAYOUT,this.toggle),t.off(pt.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}pc.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const yw=[0,0,0];function qt(r,t){return r.map((e,n)=>e+t[n])}function oe(r,t){return r.map((e,n)=>e-t[n])}function vi(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function Dr(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function PF(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function NF(r,t){const e=Co(r),n=Co(t);return[e[1]*n[2]-e[2]*n[1],e[2]*n[0]-e[0]*n[2],e[0]*n[1]-e[1]*n[0]]}function Wi(r,t){return r.map(e=>e*t)}function me(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function Yu(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function Ei(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function u1(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(vi(r,t).reduce((a,s)=>a+s,0)/(me(r,yw)*me(t,yw)));return e&&n<0&&(i=2*Math.PI-i),i}function yc(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function CF(r,t){return r.map(e=>e%t)}function Fa(r){return[r[0],r[1]]}function Co(r){return eF(r)?[r[0],r[1],0]:r}function fA(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function gA(r,t){const[e,n]=r,[i,a]=t,s=oe(e,n),o=oe(i,a);return NF(s,o).every(l=>l===0)}function c1(r,t,e=!1){if(gA(r,t))return;const[n,i]=r,[a,s]=t,o=((n[0]-a[0])*(a[1]-s[1])-(n[1]-a[1])*(a[0]-s[0]))/((n[0]-i[0])*(a[1]-s[1])-(n[1]-i[1])*(a[0]-s[0])),l=s[0]-a[0]?(n[0]-a[0]+o*(i[0]-n[0]))/(s[0]-a[0]):(n[1]-a[1]+o*(i[1]-n[1]))/(s[1]-a[1]);if(!(!e&&(!ii(o,0,1)||!ii(l,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function vA(r){if(Array.isArray(r))return ii(r[0],0,1)&&ii(r[1],0,1)?r:[.5,.5];const t=r.split("-"),e=t.includes("left")?0:t.includes("right")?1:.5,n=t.includes("top")?0:t.includes("bottom")?1:.5;return[e,n]}function an(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function RF(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function LF(r,t){const[e,n]=t,{min:i,max:a}=r;return[i[0]+e*(a[0]-i[0]),i[1]+n*(a[1]-i[1])]}function pi(r,t="center"){const e=vA(t);return LF(r,e)}function bn(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function Cr(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function Js(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function Ji(r,t,e,n=!1){if(Be(r,t))return r;const i=n?oe(r,t):oe(t,r),a=Ei(i),s=[a[0]*e,a[1]*e];return qt(Fa(r),s)}function pA(r,t){return r[1]===t[1]}function IF(r,t){return r[0]===t[0]}function DF(r,t){return pA(r,t)||IF(r,t)}function yA(r,t,e){return gA([r,t],[t,e])}function mA(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function bA(r,t,e,n=!0,i=!1){for(let a=0;a<e.length;a++){let s=e[a],o=e[(a+1)%e.length];n&&(s=qt(t,s),o=qt(t,o));const l=i?mA(r,t):r,u=c1([t,l],[s,o]);if(u)return{point:u,line:[s,o]}}return{point:t,line:void 0}}function BF(r,t,e,n){const i=r[0],a=r[1];let s=!1;e===void 0&&(e=0),n===void 0&&(n=t.length);const o=n-e;for(let l=0,u=o-1;l<o;u=l++){const c=t[l+e][0],h=t[l+e][1],d=t[u+e][0],f=t[u+e][1];h>a!=f>a&&i<(d-c)*(a-h)/(f-h)+c&&(s=!s)}return s}function FF(r,t,e=!1){const n=pi(t,"center"),i=[pi(t,"left-top"),pi(t,"right-top"),pi(t,"right-bottom"),pi(t,"left-bottom")];return bA(r,n,i,!1,e).point}function mc(r,t,e=!1){const n=t.center,i=e?mA(r,n):r,a=oe(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=oi(t)/2,l=li(t)/2,u=n[0]+o*Math.cos(s),c=n[1]+l*Math.sin(s);return[u,c]}function zF(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=me(i,a);s<e&&(e=s,n=[i,a])})}),n}function jF(r,t){let e=1/0,n=[[0,0],[0,0]];return t.forEach(i=>{const a=qF(r,i);a<e&&(e=a,n=i)}),n}function qF(r,t){const e=wA(r,t);return me(r,e)}function wA(r,t){const[e,n]=t[0],[i,a]=t[1],[s,o]=r,l=i-e,u=a-n;if(l===0&&u===0)return[e,n];let c=((s-e)*l+(o-n)*u)/(l*l+u*u);c>1?c=1:c<0&&(c=0);const h=e+c*l,d=n+c*u;return[h,d]}function $F(r){const t=r.reduce((e,n)=>qt(e,n),[0,0]);return Dr(t,r.length)}function h1(r,t=!0){const e=$F(r);return r.sort(([n,i],[a,s])=>{const o=Math.atan2(i-e[1],n-e[0]),l=Math.atan2(s-e[1],a-e[0]);return t?l-o:o-l})}function mw(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class GF{constructor(t,e){this.callback=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents()}bindEvents(){const{emitter:t}=this;t.on(it.POINTER_DOWN,this.onPointerDown),t.on(it.POINTER_MOVE,this.onPointerMove),t.on(it.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const i=this.pointerByTouch.findIndex(a=>a.pointerId===t);i>=0&&(this.pointerByTouch[i]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client;if(!(e===void 0||n===void 0)&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),t.pointerType==="touch"&&this.pointerByTouch.length===2)){const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(i*i+a*a)}}onPointerMove(t){if(this.pointerByTouch.length!==2||this.initialDistance===null)return;const{x:e,y:n}=t.client;if(e===void 0||n===void 0)return;this.updatePointerPosition(t.pointerId,e,n);const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(i*i+a*a)/this.initialDistance;this.callback(t,{scale:(o-1)*5})}onPointerUp(){this.initialDistance=null,this.pointerByTouch=[]}destroy(){this.emitter.off(it.POINTER_DOWN,this.onPointerDown),this.emitter.off(it.POINTER_MOVE,this.onPointerMove),this.emitter.off(it.POINTER_UP,this.onPointerUp)}}const bw=r=>r.map(t=>ee(t)?t.toLocaleLowerCase():t);class Rs{constructor(t){this.map=new Map,this.recordKey=new Set,this.onKeyDown=e=>{e!=null&&e.key&&(this.recordKey.add(e.key),this.trigger(e))},this.onKeyUp=e=>{e!=null&&e.key&&this.recordKey.delete(e.key)},this.onWheel=e=>{this.triggerExtendKey(it.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(it.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(it.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=t,this.bindEvents()}bind(t,e){t.length!==0&&(t.includes(it.PINCH)&&!this.pinchHandler&&(this.pinchHandler=new GF(this.emitter,this.handlePinch.bind(this))),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{Be(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=bw(Array.from(this.recordKey)).sort(),n=bw(t).sort();return Be(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(it.KEY_DOWN,this.onKeyDown),e.on(it.KEY_UP,this.onKeyUp),e.on(it.WHEEL,this.onWheel),e.on(it.DRAG,this.onDrag),(t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,i)=>{i.includes(t)&&Be(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(it.KEY_DOWN,this.onKeyDown),this.emitter.off(it.KEY_UP,this.onKeyUp),this.emitter.off(it.WHEEL,this.onWheel),this.emitter.off(it.DRAG,this.onDrag),(t=this.pinchHandler)===null||t===void 0||t.destroy(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"blur",this.onFocus)}}class Jo extends ur{constructor(t,e){super(t,Bn({},Jo.defaultOptions,e)),this.shortcut=new Rs(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,i=Object.assign({},this.options.style);this.options.style.lineWidth&&(i.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new xn({id:"g6-brush-select",style:i}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:i}=this.options;this.endPoint=Hu(t),(e=this.rectShape)===null||e===void 0||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&i==="default"&&this.updateElementsStates(mw(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=Hu(t),this.updateElementsStates(mw(this.startPoint,this.endPoint)),this.clearBrush()}}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((n,i)=>Object.assign({},n,i.reduce((a,s)=>(a[J(s)]=[],a),{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:i,mode:a,onSelect:s}=this.options,o=this.selector(e,t,n);let l={};switch(a){case"union":o.forEach(u=>{l[u]=[...e.getElementState(u),i]});break;case"diff":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?c.filter(h=>h!==i):[...c,i]});break;case"intersect":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?[i]:[]});break;case"default":default:o.forEach(u=>{l[u]=[i]});break}Ot(s)&&(l=s(l)),e.setElementState(l,this.options.animation)}selector(t,e,n){if(!n||n.length===0)return[];const i=[],a=t.getData();if(n.forEach(s=>{a[`${s}s`].forEach(o=>{const l=J(o);t.getElementVisibility(l)!=="hidden"&&BF(t.getElementPosition(l),e)&&i.push(l)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:l,target:u}=o;i.includes(l)&&i.includes(u)&&i.push(J(o))})}return i}clearBrush(){var t;(t=this.rectShape)===null||t===void 0||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(n=>n!=="drag"))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(it.POINTER_DOWN,this.onPointerDown),t.on(it.POINTER_MOVE,this.onPointerMove),t.on(it.POINTER_UP,this.onPointerUp),t.on(Si.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(it.POINTER_DOWN,this.onPointerDown),t.off(it.POINTER_MOVE,this.onPointerMove),t.off(it.POINTER_UP,this.onPointerUp),t.off(Si.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=Bn(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Jo.defaultOptions={animation:!1,enable:!0,enableElements:["node","combo","edge"],immediately:!1,mode:"default",state:"selected",trigger:["shift"],style:{width:0,height:0,lineWidth:1,fill:"#1677FF",stroke:"#1677FF",fillOpacity:.1,zIndex:2,pointerEvents:"none"}};const Hu=r=>[r.canvas.x,r.canvas.y],Mi=.8,za=["node","edge","combo"];function Aa(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)Aa(s,t,e,n,i+1);n==="BT"&&t(r,i)}function WF(r,t,e){const n=[[r,0]];for(;n.length;){const[i,a]=n.shift();t(i,a);const s=e(i);if(s)for(const o of s)n.push([o,a+1])}}function xA(r,t,e,n,i="both"){if(t==="combo"||t==="node")return vd(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=vd(r,a.source,n-1,i),o=vd(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function vd(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return WF(t,(o,l)=>{l>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(u=>{const c=J(u);!a.has(c)&&l<e&&(s.add(c),a.add(c))}))},o=>r.getRelatedEdgesData(o,n).map(l=>l.source===o?l.target:l.source).filter(l=>i.has(l)?!1:(i.add(l),!0))),Array.from(s)}function pd(r){return r.states||[]}var Hl=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class bc extends ur{constructor(t,e){super(t,Object.assign({},bc.defaultOptions,e)),this.onClickSelect=n=>Hl(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.updateState(n),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.onClickCanvas=n=>Hl(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.clearState(),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.shortcut=new Rs(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),za.forEach(e=>{t.on(`${e}:${it.CLICK}`,this.onClickSelect)}),t.on(Si.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:i}=this.context,{degree:a}=this.options;return xA(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return Hl(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:i,animation:a}=this.options;if(!e&&!i&&!n)return;const{target:s}=t,{graph:o}=this.context,l=o.getElementData(s.id),u=pd(l).includes(e)?"unselect":"select",c={},h=this.isMultipleSelect,d=[s.id],f=this.getNeighborIds(t);if(h)if(Object.assign(c,this.getDataStates()),u==="select"){const v=(p,g)=>{p.forEach(y=>{const m=new Set(o.getElementState(y));m.add(g),m.delete(n),c[y]=Array.from(m)})};v(d,e),v(f,i),n&&Object.keys(c).forEach(p=>{const g=c[p];!g.includes(e)&&!g.includes(i)&&!g.includes(n)&&c[p].push(n)})}else{const v=c[s.id];c[s.id]=v.filter(p=>p!==e&&p!==i),v.includes(n)||c[s.id].push(n),f.forEach(p=>{c[p]=c[p].filter(g=>g!==i),c[p].includes(e)||c[p].push(n)})}else if(u==="select"){Object.assign(c,this.getClearStates(!!n));const v=(p,g)=>{p.forEach(y=>{c[y]||(c[y]=o.getElementState(y)),c[y].push(g)})};v(d,e),v(f,i),n&&Object.keys(c).forEach(p=>{!d.includes(p)&&!f.includes(p)&&c[p].push(n)})}else Object.assign(c,this.getClearStates());yield o.setElementState(c,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[J(s)]=pd(s)}),a}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:i,neighborState:a}=this.options,s=new Set([n,i,a]),{nodes:o,edges:l,combos:u}=e.getData(),c={};return[...o,...l,...u].forEach(h=>{const d=pd(h),f=d.filter(v=>!s.has(v));(t||f.length!==d.length)&&(c[J(h)]=f)}),c}clearState(){return Hl(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;za.forEach(e=>{t.off(`${e}:${it.CLICK}`,this.onClickSelect)}),t.off(Si.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}bc.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function Yn(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}function Xu(r,t){if(!r.startsWith(t))return!1;const e=r[t.length];return e>="A"&&e<="Z"}function VF(r,t){return`${t}${Ru(r)}`}function UF(r,t,e=!0){if(!t||!Xu(r,t))return r;const n=r.slice(t.length);return e?w3(n):n}function Ke(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||Xu(i,t)&&Object.assign(n,{[UF(i,t)]:a}),n),{});if("opacity"in r){const n=VF("opacity",t),i=r.opacity;if(n in r){const a=r[n];Object.assign(e,{opacity:i*a})}else Object.assign(e,{opacity:i})}return e}function om(r,t){const e=t.length;return Object.keys(r).reduce((n,i)=>{if(i.startsWith(t)){const a=i.slice(e);n[a]=r[i]}return n},{})}function EA(r,t){const e=typeof t=="string"?[t]:t,n={};return Object.keys(r).forEach(i=>{e.find(a=>i.startsWith(a))||(n[i]=r[i])}),n}function sr(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var YF=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};function ww(r,t){const{datum:e,graph:n}=t;return typeof r=="function"?r.call(n,e):Object.fromEntries(Object.entries(r).map(([i,a])=>typeof a=="function"?[i,a.call(n,e)]:[i,a]))}function gn(r,t){const e=(r==null?void 0:r.style)||{},n=(t==null?void 0:t.style)||{};for(const i in e)i in n||(n[i]=e[i]);return Object.assign({},r,t,{style:n})}function HF(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:l,visibility:u}=r;return YF(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function XF(r,t){const e=sr(r);let n={};return t.text&&!t.fontSize&&(n={fontSize:Math.min(...e)*.5}),t.src&&(!t.width||!t.height)&&(n={width:e[0]*.5,height:e[1]*.5}),n}function xw(r){if(r)return typeof r=="string"||typeof r=="function"||Array.isArray(r)?{type:"group",field:t=>t.id,color:r,invert:!1}:r}function KF(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=l=>{const u=typeof n=="string"?_i("palette",n):n;if(typeof u=="function"){const c={};return l.forEach(([h,d])=>{c[h]=u(a?1-d:d)}),c}else if(Array.isArray(u)){const c=a?[...u].reverse():u,h={};return l.forEach(([d,f])=>{h[d]=c[f%u.length]}),h}return{}},o=(l,u)=>{var c;return typeof l=="string"?(c=u.data)===null||c===void 0?void 0:c[l]:l==null?void 0:l(u)};if(e==="group"){const l=cc(r,d=>{if(!i)return"default";const f=o(i,d);return f?String(f):"default"}),u=Object.keys(l),c=s(u.map((d,f)=>[d,f])),h={};return Object.entries(l).forEach(([d,f])=>{f.forEach(v=>{h[J(v)]=c[d]})}),h}else if(e==="value"){const[l,u]=r.reduce(([h,d],f)=>{const v=o(i,f);if(typeof v!="number")throw new Error(wi(`Palette field ${i} is not a number`));return[Math.min(h,v),Math.max(d,v)]},[1/0,-1/0]),c=u-l;return s(r.map(h=>[h.id,(o(i,h)-l)/c]))}}function SA(r){const t=typeof r=="string"?_i("palette",r):r;if(typeof t!="function")return t}function _A(r,t){let e=2*r;return typeof t=="string"?e=r*Number(t.replace("%",""))/100:typeof t=="number"&&(e=t),isNaN(e)&&(e=2*r),e}function MA(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return _A(a,t)}function ZF(r,t,e=1){const n=me(r[0],r[1])*e;return _A(n,t)}class Qo extends t1{constructor(t){Ew(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(t,e,n,i,a){var s,o,l,u,c,h,d,f;const v=this.shapeMap[t];if(n===!1){v&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,v),i.removeChild(v),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,v));return}const p=typeof e=="string"?_i(Ts.SHAPE,e):e;if(!p)throw new Error(wi(`Shape ${e} not found`));if(!v||v.destroyed||!(v instanceof p)){v&&((l=a==null?void 0:a.beforeDestroy)===null||l===void 0||l.call(a,v),v==null||v.destroy(),(u=a==null?void 0:a.afterDestroy)===null||u===void 0||u.call(a,v)),(c=a==null?void 0:a.beforeCreate)===null||c===void 0||c.call(a);const g=new p({className:t,style:n});return i.appendChild(g),this.shapeMap[t]=g,(h=a==null?void 0:a.afterCreate)===null||h===void 0||h.call(a,g),g}return(d=a==null?void 0:a.beforeUpdate)===null||d===void 0||d.call(a,v),vm(v,n),(f=a==null?void 0:a.afterUpdate)===null||f===void 0||f.call(a,v),v}update(t={}){const e=Object.assign({},this.attributes,t);Ew(e),U4(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return HF(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(t.length===0)return null;const n=[];if(t[0].x!==void 0||t[0].y!==void 0||t[0].z!==void 0){const{x:a=0,y:s=0,z:o=0}=this.attributes;t.forEach(l=>{const{x:u=a,y:c=s,z:h=o}=l;Object.assign(l,{transform:h?[["translate3d",u,c,h]]:[["translate",u,c]]})})}const i=super.animate(t,e);if(i&&(yd(this,i),n.push(i)),Array.isArray(t)&&t.length>0){const a=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(s=>!a.includes(s))){Object.entries(this.shapeMap).forEach(([o,l])=>{const u=`get${Ru(o)}Style`,c=this[u];if(Ot(c)){const h=t.map(f=>c.call(this,Object.assign(Object.assign({},this.attributes),f))),d=l.animate(sm(h),e);d&&(yd(l,d),n.push(d))}});const s=(o,l)=>{if(!Kr(o)){const u=`get${Ru(l)}Style`,c=this[u];if(Ot(c)){const h=t.map(d=>c.call(this,Object.assign(Object.assign({},this.attributes),d)));Object.entries(h[0]).map(([d])=>{const f=h.map(p=>p[d]),v=o[d];if(v){const p=v.animate(sm(f),e);p&&(yd(v,p),n.push(p))}})}}};this.compositeShapes.forEach(([o,l])=>{const u=om(this.shapeMap,l);s(u,o)})}}return i1(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Ba(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function yd(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function Ew(r){if(!r)return{};if("x"in r||"y"in r||"z"in r){const{x:t=0,y:e=0,z:n,transform:i}=r,a=eA(t,e,n,i);a&&(r.transform=a)}return r}var JF=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};class la extends Qo{constructor(t){super(gn({style:la.defaultStyleProps},t))}isTextStyle(t){return Xu(t,"label")}isBackgroundStyle(t){return Xu(t,"background")}getTextStyle(t){const e=this.getGraphicStyle(t),{padding:n}=e,i=JF(e,["padding"]);return EA(i,"background")}getBackgroundStyle(t){if(t.background===!1)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:i,padding:a}=e,s=Ke(e,"background"),{min:[o,l],center:[u,c],halfExtents:[h,d]}=this.shapeMap.text.getGeometryBounds(),[f,v,p,g]=si(a),y=h*2+g+v,{width:m,height:w}=s;m&&w?Object.assign(s,{x:u-Number(m)/2,y:c-Number(w)/2}):Object.assign(s,{x:o-g,y:l-f,width:n?Math.min(y,i+g+v):y,height:d*2+f+p});const{radius:E}=s;if(typeof E=="string"&&E.endsWith("%")){const _=Number(E.replace("%",""))/100;s.radius=Math.min(+s.width,+s.height)*_}return s}render(t=this.parsedAttributes,e=this){this.upsert("text",Wa,this.getTextStyle(t),e),this.upsert("background",xn,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}la.defaultStyleProps={padding:0,fontSize:12,fontFamily:"system-ui, sans-serif",wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};class Ls extends Qo{constructor(t){super(gn({style:Ls.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",la,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}Ls.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};function QF(r,t=!0){const e=[];return r.forEach((n,i)=>{e.push([i===0?"M":"L",...n])}),t&&e.push(["Z"]),e}const Sw={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};function t5(r){const t=r.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),e=[];let n="",i={};for(;t.length>0;){let a=t.shift();a in Sw?n=a:t.unshift(a),i={type:n},Sw[n].forEach(l=>{a=t.shift(),i[l]=a}),n==="M"?n="L":n==="m"&&(n="l");const[s,...o]=Object.values(i);e.push([s,...o.map(Number)])}return e}function e5(r){const t=[];return(typeof r=="string"?t5(r):r).forEach(n=>{const i=n[0];if(i==="Z"){t.push(t[0]);return}if(i!=="A")for(let a=1;a<n.length;a=a+2)t.push([n[a],n[a+1],0]);else{const a=n.length;t.push([n[a-2],n[a-1],0])}}),t}const kA=r=>{if(r.length<2)return[["M",0,0],["L",0,0]];const t=r[0],e=r[1],n=r[r.length-1],i=r[r.length-2];r.unshift(i,n),r.push(t,e);const a=[["M",n[0],n[1]]];for(let s=1;s<r.length-2;s+=1){const[o,l]=r[s-1],[u,c]=r[s],[h,d]=r[s+1],[f,v]=s!==r.length-2?r[s+2]:[h,d],p=u+(h-o)/6,g=c+(d-l)/6,y=h-(f-u)/6,m=d-(v-c)/6;a.push(["C",p,g,y,m,h,d])}return a};function n5(r,t,e,n,i,a,s){const[o,l]=pi(r,t),u={textAlign:t==="left"?"right":t==="right"?"left":"center",textBaseline:t==="top"?"bottom":t==="bottom"?"top":"middle",transform:[["translate",o+e,l+n]]};if(t==="center"||!i)return u;const c=e5(a);if(!c||c.length<=3)return u;const h=c.map((v,p)=>{const g=v,y=c[(p+1)%c.length];return Be(g,y)?null:[g,y]}).filter(Boolean),d=jF([o,l],h),f=wA([o,l],d);if(f&&d&&(u.transform=[["translate",f[0]+e,f[1]+n]],s)){const v=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));u.transform.push(["rotate",v/Math.PI*180]),u.textAlign="center",(t==="right"||t==="left")&&(v>0?u.textBaseline=t==="right"?"bottom":"top":u.textBaseline=t==="right"?"top":"bottom")}return u}var r5=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};class tl extends Qo{constructor(t){super(gn({style:tl.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||t.d.length===0)return!1;const e=Ke(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:i,offsetY:a,autoRotate:s,placement:o,closeToPath:l}=e,u=r5(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),c=this.shapeMap.key,h=c==null?void 0:c.getRenderBounds();return Object.assign(n5(h,o,i,a,l,t.d,s),{wordWrapWidth:MA(h,n)},u)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",rr,this.getKeyStyle(t),e),this.upsert("label",la,this.getLabelStyle(t),e)}}tl.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};function i5(r){const t=[],e=n=>{n!=null&&n.children.length&&n.children.forEach(i=>{t.push(i),e(i)})};return e(r),t}function a5(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}let d1=class extends Ko{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},hs=this,this.isMutationObserved=!0,this.addEventListener(Ht.MOUNTED,this.onMounted),this.addEventListener(Ht.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:i=0}=this.attributes;if(t&&n&&i){const[a,s]=this.getBounds().min,o={x:a,y:s,radius:t,width:n,height:i};if(e)Object.assign(this.parsedStyle.clipPath.style,o);else{const l=new xn({style:o});this.style.clipPath=l}}else e&&(this.style.clipPath=null)}};const lm=new WeakMap;let hs=null;const f1=r=>{if(hs&&a5(hs).includes(r)){const t=lm.get(r);t?t.includes(hs)||t.push(hs):lm.set(r,[hs])}},g1=r=>{const t=lm.get(r);t&&t.forEach(e=>e.handleRadius())};class OA extends Qo{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,i=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},i):Object.assign({textBaseline:"middle",textAlign:"center"},i)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?d1:Wa,this.getIconStyle(t),e)}}class TA extends Qo{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then(()=>this.onframe())),n}}var Xl=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};class Fr extends TA{constructor(t){super(gn({style:Fr.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return sr(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(EA(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=Ke(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:i,offsetX:a,offsetY:s}=e,o=Xl(e,["placement","maxWidth","offsetX","offsetY"]),l=this.getShape("key").getLocalBounds();return Object.assign(zw(l,n,a,s),{wordWrapWidth:MA(l,i)},o)}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),{fill:n}=e,i=Xl(e,["fill"]),a=Ke(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},i),{stroke:n}),a)}getIconStyle(t){if(t.icon===!1||!t.iconText&&!t.iconSrc)return!1;const e=Ke(this.getGraphicStyle(t),"icon");return Object.assign(XF(t.size,e),e)}getBadgesStyle(t){var e;const n=om(this.shapeMap,"badge-"),i={};if(Object.keys(n).forEach(h=>{i[h]=!1}),t.badge===!1||!(!((e=t.badges)===null||e===void 0)&&e.length))return i;const{badges:a=[],badgePalette:s,opacity:o=1}=t,l=Xl(t,["badges","badgePalette","opacity"]),u=SA(s),c=Ke(this.getGraphicStyle(l),"badge");return a.forEach((h,d)=>{i[d]=Object.assign(Object.assign({backgroundFill:u?u[d%(u==null?void 0:u.length)]:void 0,opacity:o},c),this.getBadgeStyle(h))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=Xl(t,["placement","offsetX","offsetY"]),o=zw(e.getLocalBounds(),n,i,a,!0);return Object.assign(Object.assign({},o),s)}getPortsStyle(t){var e;const n=this.getPorts(),i={};if(Object.keys(n).forEach(o=>{i[o]=!1}),t.port===!1||!(!((e=t.ports)===null||e===void 0)&&e.length))return i;const a=Ke(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,l)=>{const u=o.key||l,c=Object.assign(Object.assign({},a),o);if(XA(c))i[u]=!1;else{const[h,d]=this.getPortXY(t,o);i[u]=Object.assign({transform:[["translate",h,d]]},c)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return b1(s5(this.context,i),n)}getPorts(){return om(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return FF(t,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t),i=this.getShape("key");this.upsert("halo",i.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);this.upsert("icon",OA,n,e),f1(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,Ls,a,e)})}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach(i=>{const a=n[i],s=`port-${i}`;this.upsert(s,Ti,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",la,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&g1(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}Fr.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};function s5(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Ba(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}let el=class AA extends Fr{constructor(t){super(gn({style:AA.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ti,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,i=n*2*Mi;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return mc(t,n,e)}};el.defaultStyleProps={size:32};class wc extends Fr{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",Ga,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,i;const{points:a}=this.getShape("key").attributes,s=[+(((n=this.attributes)===null||n===void 0?void 0:n.x)||0),+(((i=this.attributes)===null||i===void 0?void 0:i.y)||0)];return bA(t,s,a,!0,e).point}}class o5 extends wc{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return W4(e,n)}}var l5=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};class xc extends el{constructor(t){super(gn({style:xc.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...sr(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return ee(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(n!=null&&n.length))return;const i=n.map(h=>St(h)?{value:h}:h),a=Ke(this.getGraphicStyle(t),"donut"),s=SA(t.donutPalette);if(!s)return;const o=i.reduce((h,d)=>{var f;return h+((f=d.value)!==null&&f!==void 0?f:0)},0),l=this.parseOuterR(),u=this.parseInnerR();let c=0;i.forEach((h,d)=>{const{value:f=0,color:v=s[d%s.length]}=h,p=l5(h,["value","color"]),g=(o===0?1/i.length:f/o)*360;this.upsert(`round${d}`,rr,Object.assign(Object.assign(Object.assign({},a),{d:h5(l,u,c,c+g),fill:v}),p),e),c+=g})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}xc.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const Kl=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],u5=(r,t,e,n)=>n<=0||e<=n?[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"]]:[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"],["M",r+n,t],["A",n,n,0,1,0,r-n,t],["A",n,n,0,1,0,r+n,t],["Z"]],c5=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],l=[Kl(r,t,n,s),Kl(r,t,e,s),Kl(r,t,e,o),Kl(r,t,n,o)],u=o-s>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",e,e,0,u,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",n,n,0,u,0,l[0][0],l[0][1]],["Z"]]},h5=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?u5(i,a,r,t):c5(i,a,r,t,e,n)};class Ec extends Fr{constructor(t){super(gn({style:Ec.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ho,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:i/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:i}=this.getShape("key").attributes,a=Math.min(+n,+i)*2*Mi;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return mc(t,n,e)}}Ec.defaultStyleProps={size:[45,35]};class d5 extends wc{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return Y4(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*Mi;return e?Object.assign({width:n,height:n},e):!1}}function f5(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.r;r.arc(n,a,s,0,Math.PI*2,!1)}function g5(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.rx,o=t.ry;if(r.ellipse)r.ellipse(n,a,s,o,0,0,Math.PI*2,!1);else{var l=s>o?s:o,u=s>o?1:s/o,c=s>o?o/s:1;r.save(),r.scale(u,c),r.arc(n,a,l,0,Math.PI*2)}}function v5(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,l=t.markerStartOffset,u=t.markerEndOffset,c=0,h=0,d=0,f=0,v=0,p,g;s&&te(s)&&l&&(p=i-e,g=a-n,v=Math.atan2(g,p),c=Math.cos(v)*(l||0),h=Math.sin(v)*(l||0)),o&&te(o)&&u&&(p=e-i,g=n-a,v=Math.atan2(g,p),d=Math.cos(v)*(u||0),f=Math.sin(v)*(u||0)),r.moveTo(e+c,n+h),r.lineTo(i+d,a+f)}function p5(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,l=s.segments,u=0,c=0,h=0,d=0,f=0,v,p;if(e&&te(e)&&i){var g=e.parentNode.getStartTangent(),y=jt(g,2),m=y[0],w=y[1];v=m[0]-w[0],p=m[1]-w[1],f=Math.atan2(p,v),u=Math.cos(f)*(i||0),c=Math.sin(f)*(i||0)}if(n&&te(n)&&a){var E=n.parentNode.getEndTangent(),_=jt(E,2),k=_[0],T=_[1];v=k[0]-T[0],p=k[1]-T[1],f=Math.atan2(p,v),h=Math.cos(f)*(a||0),d=Math.sin(f)*(a||0)}for(var O=0;O<o.length;O++){var P=o[O],N=P[0],C=o[O+1],L=O===0&&(u!==0||c!==0),B=(O===o.length-1||C&&(C[0]==="M"||C[0]==="Z"))&&h!==0&&d!==0,G=L?[u,c]:[0,0],V=jt(G,2),U=V[0],$=V[1],j=B?[h,d]:[0,0],Z=jt(j,2),nt=Z[0],st=Z[1];switch(N){case"M":r.moveTo(P[1]+U,P[2]+$);break;case"L":r.lineTo(P[1]+nt,P[2]+st);break;case"Q":r.quadraticCurveTo(P[1],P[2],P[3]+nt,P[4]+st);break;case"C":r.bezierCurveTo(P[1],P[2],P[3],P[4],P[5]+nt,P[6]+st);break;case"A":{var ot=l[O].arcParams,Pt=ot.cx,K=ot.cy,W=ot.rx,tt=ot.ry,ct=ot.startAngle,Et=ot.endAngle,Nt=ot.xRotation,Vt=ot.sweepFlag;if(r.ellipse)r.ellipse(Pt,K,W,tt,Nt,ct,Et,!!(1-Vt));else{var ke=W>tt?W:tt,un=W>tt?1:W/tt,Oe=W>tt?tt/W:1;r.translate(Pt,K),r.rotate(Nt),r.scale(un,Oe),r.arc(0,0,ke,ct,Et,!!(1-Vt)),r.scale(1/un,1/Oe),r.rotate(-Nt),r.translate(-Pt,-K)}B&&r.lineTo(P[6]+h,P[7]+d);break}case"Z":r.closePath();break}}}function y5(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,f=0,v=0,p=0,g=0,y,m;e&&te(e)&&i&&(y=s[1][0]-s[0][0],m=s[1][1]-s[0][1],g=Math.atan2(m,y),d=Math.cos(g)*(i||0),f=Math.sin(g)*(i||0)),n&&te(n)&&a&&(y=s[o-1][0]-s[0][0],m=s[o-1][1]-s[0][1],g=Math.atan2(m,y),v=Math.cos(g)*(a||0),p=Math.sin(g)*(a||0)),r.moveTo(l+(d||v),u+(f||p));for(var w=1;w<o-1;w++){var E=s[w];r.lineTo(E[0],E[1])}r.lineTo(c,h)}function m5(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,f=0,v=0,p=0,g=0,y,m;e&&te(e)&&i&&(y=s[1][0]-s[0][0],m=s[1][1]-s[0][1],g=Math.atan2(m,y),d=Math.cos(g)*(i||0),f=Math.sin(g)*(i||0)),n&&te(n)&&a&&(y=s[o-2][0]-s[o-1][0],m=s[o-2][1]-s[o-1][1],g=Math.atan2(m,y),v=Math.cos(g)*(a||0),p=Math.sin(g)*(a||0)),r.moveTo(l+d,u+f);for(var w=1;w<o-1;w++){var E=s[w];r.lineTo(E[0],E[1])}r.lineTo(c+v,h+p)}function b5(r,t){var e=t.x,n=e===void 0?0:e,i=t.y,a=i===void 0?0:i,s=t.radius,o=t.width,l=t.height,u=o,c=l,h=s&&s.some(function(_){return _!==0});if(!h)r.rect(n,a,u,c);else{var d=o>0?1:-1,f=l>0?1:-1,v=d+f===0,p=s.map(function(_){return De(_,0,Math.min(Math.abs(u)/2,Math.abs(c)/2))}),g=jt(p,4),y=g[0],m=g[1],w=g[2],E=g[3];r.moveTo(d*y+n,a),r.lineTo(u-d*m+n,a),m!==0&&r.arc(u-d*m+n,f*m+a,m,-f*Math.PI/2,d>0?0:Math.PI,v),r.lineTo(u+n,c-f*w+a),w!==0&&r.arc(u-d*w+n,c-f*w+a,w,d>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,v),r.lineTo(d*E+n,c+a),E!==0&&r.arc(d*E+n,c-f*E+a,E,f>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,v),r.lineTo(n,f*y+a),y!==0&&r.arc(d*y+n,f*y+a,y,d>0?Math.PI:0,f>0?Math.PI*1.5:Math.PI/2,v)}}var w5=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.name="canvas-path-generator",e}return Wt(t,r),dt(t,[{key:"init",value:function(){var n,i=(n={},_t(_t(_t(_t(_t(_t(_t(_t(_t(_t(n,rt.CIRCLE,f5),rt.ELLIPSE,g5),rt.RECT,b5),rt.LINE,v5),rt.POLYLINE,m5),rt.POLYGON,y5),rt.PATH,p5),rt.TEXT,void 0),rt.GROUP,void 0),rt.IMAGE,void 0),_t(_t(_t(n,rt.HTML,void 0),rt.MESH,void 0),rt.FRAGMENT,void 0));this.context.pathGeneratorFactory=i}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(aa);var x5=Zt(),E5=Zt(),S5=Zt(),_5=fe(),PA=function(){function r(){var t=this;ht(this,r),this.isHit=function(e,n,i,a){var s=t.context.pointInPathPickerFactory[e.nodeName];if(s){var o=Zr(_5,i),l=Pn(E5,Tn(S5,n[0],n[1],0),o);if(s(e,new mn(l[0],l[1]),a,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var i=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),a=t.context.pathGeneratorFactory[e.nodeName];return a&&(i.beginPath(),a(i,e.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return dt(r,[{key:"apply",value:function(e,n){var i,a=this,s=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=n;var l=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;s.hooks.pick.tapPromise(r.tag,function(){var u=na(wn().mark(function c(h){return wn().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.abrupt("return",a.pick(l,h));case 1:case"end":return f.stop()}},c)}));return function(c){return u.apply(this,arguments)}}()),s.hooks.pickSync.tap(r.tag,function(u){return a.pick(l,u)})}},{key:"pick",value:function(e,n){var i=n.topmost,a=n.position,s=a.x,o=a.y,l=Tn(x5,s,o,0),u=e.elementsFromBBox(l[0],l[1],l[0],l[1]),c=[],h=wa(u),d;try{for(h.s();!(d=h.n()).done;){var f=d.value,v=f.getWorldTransform(),p=this.isHit(f,l,v,!1);if(p){var g=CT(f);if(g){var y=g.parsedStyle.clipPath,m=this.isHit(y,l,y.getWorldTransform(),!0);if(m){if(i)return n.picked=[f],n;c.push(f)}}else{if(i)return n.picked=[f],n;c.push(f)}}}}catch(w){h.e(w)}finally{h.f()}return n.picked=c,n}}])}();PA.tag="CanvasPicker";function M5(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.r,u=n.fill,c=n.stroke,h=n.lineWidth,d=h===void 0?1:h,f=n.increasedLineWidthForHitTesting,v=f===void 0?0:f,p=n.pointerEvents,g=p===void 0?"auto":p,y=(d+v)/2,m=xi(a,o,t.x,t.y),w=$a(g,u,c),E=jt(w,2),_=E[0],k=E[1];return _&&k||e?m<=l+y:_?m<=l:k?m>=l-y&&m<=l+y:!1}function Zl(r,t,e,n){return r/(e*e)+t/(n*n)}function k5(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.rx,u=n.ry,c=n.fill,h=n.stroke,d=n.lineWidth,f=d===void 0?1:d,v=n.increasedLineWidthForHitTesting,p=v===void 0?0:v,g=n.pointerEvents,y=g===void 0?"auto":g,m=t.x,w=t.y,E=$a(y,c,h),_=jt(E,2),k=_[0],T=_[1],O=(f+p)/2,P=(m-a)*(m-a),N=(w-o)*(w-o);return k&&T||e?Zl(P,N,l+O,u+O)<=1:k?Zl(P,N,l,u)<=1:T?Zl(P,N,l-O,u-O)>=1&&Zl(P,N,l+O,u+O)<=1:!1}function _a(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function O5(r,t,e,n,i,a,s){var o=i/2;return _a(r-o,t-o,e,i,a,s)||_a(r+e-o,t-o,i,n,a,s)||_a(r+o,t+n-o,e,i,a,s)||_a(r-o,t+o,i,n,a,s)}function Jl(r,t,e,n,i,a,s,o){var l=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),u={x:r+e*Math.cos(l),y:t+e*Math.sin(l)};return xi(u.x,u.y,s,o)<=a/2}function Vi(r,t,e,n,i,a,s){var o=Math.min(r,e),l=Math.max(r,e),u=Math.min(t,n),c=Math.max(t,n),h=i/2;return a>=o-h&&a<=l+h&&s>=u-h&&s<=c+h?yL(r,t,e,n,a,s)<=i/2:!1}function NA(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s<a-1;s++){var o=r[s][0],l=r[s][1],u=r[s+1][0],c=r[s+1][1];if(Vi(o,l,u,c,t,e,n))return!0}if(i){var h=r[0],d=r[a-1];if(Vi(h[0],h[1],d[0],d[1],t,e,n))return!0}return!1}var T5=1e-6;function md(r){return Math.abs(r)<T5?0:r<0?-1:1}function A5(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 CA(r,t,e){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var s=r[a],o=r[(a+1)%i];if(A5(s,o,[t,e]))return!0;md(s[1]-e)>0!=md(o[1]-e)>0&&md(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function _w(r,t,e){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=CA(a,t,e),n)break}return n}function P5(r,t,e){var n=r.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2,l=n.lineWidth,u=l===void 0?1:l,c=n.increasedLineWidthForHitTesting,h=c===void 0?0:c,d=n.pointerEvents,f=d===void 0?"auto":d,v=n.fill,p=n.stroke,g=$a(f,v,p),y=jt(g,2),m=y[1];return!m&&!e||!u?!1:Vi(i,a,s,o,u+h,t.x,t.y)}function N5(r,t,e,n,i){for(var a=!1,s=t/2,o=0;o<r.length;o++){var l=r[o],u=l.currentPoint,c=l.params,h=l.prePoint,d=l.box;if(!(d&&!_a(d.x-s,d.y-s,d.width+t,d.height+t,e,n)))switch(l.command){case"L":case"Z":if(a=Vi(h[0],h[1],u[0],u[1],t,e,n),a)return!0;break;case"Q":var f=_L(h[0],h[1],c[1],c[2],c[3],c[4],e,n);if(a=f<=t/2,a)return!0;break;case"C":var v=kb(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],e,n,i);if(a=v<=t/2,a)return!0;break;case"A":l.cubicParams||(l.cubicParams=Vm(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],c[7],void 0));for(var p=l.cubicParams,g=h,y=0;y<p.length;y+=6){var m=kb(g[0],g[1],p[y],p[y+1],p[y+2],p[y+3],p[y+4],p[y+5],e,n,i);if(g=[p[y+4],p[y+5]],a=m<=t/2,a)return!0}break}}return a}function C5(r,t,e,n,i,a){var s=r.parsedStyle,o=s.lineWidth,l=o===void 0?1:o,u=s.increasedLineWidthForHitTesting,c=u===void 0?0:u,h=s.stroke,d=s.fill,f=s.d,v=s.pointerEvents,p=v===void 0?"auto":v,g=f.segments,y=f.hasArc,m=f.polylines,w=f.polygons,E=$a(p,(w==null?void 0:w.length)&&d,h),_=jt(E,2),k=_[0],T=_[1],O=Zy(r),P=!1;return k||e?(y?P=n(r,t):P=_w(w,t.x,t.y)||_w(m,t.x,t.y),P):((T||e)&&(P=N5(g,l+c,t.x,t.y,O)),P)}function R5(r,t,e){var n=r.parsedStyle,i=n.stroke,a=n.fill,s=n.lineWidth,o=s===void 0?1:s,l=n.increasedLineWidthForHitTesting,u=l===void 0?0:l,c=n.points,h=n.pointerEvents,d=h===void 0?"auto":h,f=$a(d,a,i),v=jt(f,2),p=v[0],g=v[1],y=!1;return(g||e)&&(y=NA(c.points,o+u,t.x,t.y,!0)),!y&&(p||e)&&(y=CA(c.points,t.x,t.y)),y}function L5(r,t,e){var n=r.parsedStyle,i=n.lineWidth,a=i===void 0?1:i,s=n.increasedLineWidthForHitTesting,o=s===void 0?0:s,l=n.points,u=n.pointerEvents,c=u===void 0?"auto":u,h=n.fill,d=n.stroke,f=$a(c,h,d),v=jt(f,2),p=v[1];return!p&&!e||!a?!1:NA(l.points,a+o,t.x,t.y,!1)}function I5(r,t,e,n,i){var a=r.parsedStyle,s=a.radius,o=a.fill,l=a.stroke,u=a.lineWidth,c=u===void 0?1:u,h=a.increasedLineWidthForHitTesting,d=h===void 0?0:h,f=a.x,v=f===void 0?0:f,p=a.y,g=p===void 0?0:p,y=a.width,m=a.height,w=a.pointerEvents,E=w===void 0?"auto":w,_=$a(E,o,l),k=jt(_,2),T=k[0],O=k[1],P=s&&s.some(function(B){return B!==0}),N=c+d;if(P){var L=!1;return(O||e)&&(L=D5(v,g,y,m,s.map(function(B){return De(B,0,Math.min(Math.abs(y)/2,Math.abs(m)/2))}),N,t.x,t.y)),!L&&(T||e)&&(L=n(r,t)),L}else{var C=N/2;if(T&&O||e)return _a(v-C,g-C,y+C,m+C,t.x,t.y);if(T)return _a(v,g,y,m,t.x,t.y);if(O)return O5(v,g,y,m,N,t.x,t.y)}return!1}function D5(r,t,e,n,i,a,s,o){var l=jt(i,4),u=l[0],c=l[1],h=l[2],d=l[3];return Vi(r+u,t,r+e-c,t,a,s,o)||Vi(r+e,t+c,r+e,t+n-h,a,s,o)||Vi(r+e-h,t+n,r+d,t+n,a,s,o)||Vi(r,t+n-d,r,t+u,a,s,o)||Jl(r+e-c,t+c,c,1.5*Math.PI,2*Math.PI,a,s,o)||Jl(r+e-h,t+n-h,h,0,.5*Math.PI,a,s,o)||Jl(r+d,t+n-d,d,.5*Math.PI,Math.PI,a,s,o)||Jl(r+u,t+u,u,Math.PI,1.5*Math.PI,a,s,o)}function B5(r,t,e,n,i,a){var s=r.parsedStyle,o=s.pointerEvents,l=o===void 0?"auto":o,u=s.x,c=u===void 0?0:u,h=s.y,d=h===void 0?0:h,f=s.width,v=s.height;if(l==="non-transparent-pixel"){var p=i.config.offscreenCanvas,g=a.offscreenCanvasCreator.getOrCreateCanvas(p),y=a.offscreenCanvasCreator.getOrCreateContext(p,{willReadFrequently:!0});g.width=f,g.height=v,i.defaultStyleRendererFactory[rt.IMAGE].render(y,$t($t({},r.parsedStyle),{},{x:0,y:0}),r,void 0,void 0,void 0);var m=y.getImageData(t.x-c,t.y-d,1,1).data;return m.every(function(w){return w!==0})}return!0}function F5(r,t,e,n){var i=r.getGeometryBounds();return t.x>=i.min[0]&&t.y>=i.min[1]&&t.x<=i.max[0]&&t.y<=i.max[1]}var z5=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.name="canvas-picker",e}return Wt(t,r),dt(t,[{key:"init",value:function(){var n,i=(n={},_t(_t(_t(_t(_t(_t(_t(_t(_t(_t(n,rt.CIRCLE,M5),rt.ELLIPSE,k5),rt.RECT,I5),rt.LINE,P5),rt.POLYLINE,L5),rt.POLYGON,R5),rt.PATH,C5),rt.TEXT,F5),rt.GROUP,null),rt.IMAGE,B5),_t(_t(n,rt.HTML,null),rt.MESH,null));this.context.pointInPathPickerFactory=i,this.addRenderingPlugin(new PA)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(aa);function Yr(r,t){if(!{}.hasOwnProperty.call(r,t))throw new TypeError("attempted to use private field on non-instance");return r}var j5=0;function q5(r){return"__private_"+j5+++"_"+r}var $5=function(){function r(){ht(this,r),this.cacheStore=new Map}return dt(r,[{key:"onRefAdded",value:function(e){}},{key:"has",value:function(e){return this.cacheStore.has(e)}},{key:"put",value:function(e,n,i){return this.cacheStore.has(e)?!1:(this.cacheStore.set(e,{value:n,counter:new Set([i])}),this.onRefAdded(i),!0)}},{key:"get",value:function(e,n){var i=this.cacheStore.get(e);return i?(i.counter.has(n)||(i.counter.add(n),this.onRefAdded(n)),i.value):null}},{key:"update",value:function(e,n,i){var a=this.cacheStore.get(e);return a?(a.value=$t($t({},a.value),n),a.counter.has(i)||(a.counter.add(i),this.onRefAdded(i)),!0):!1}},{key:"release",value:function(e,n){var i=this.cacheStore.get(e);return i?(i.counter.delete(n),i.counter.size<=0&&this.cacheStore.delete(e),!0):!1}},{key:"releaseRef",value:function(e){var n=this;Array.from(this.cacheStore.keys()).forEach(function(i){n.release(i,e)})}},{key:"getSize",value:function(){return this.cacheStore.size}},{key:"clear",value:function(){this.cacheStore.clear()}}])}(),bd=[],wd=[],um=function(){function r(){ht(this,r)}return dt(r,null,[{key:"stop",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;r.rafId&&(e.cancelAnimationFrame(r.rafId),r.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;bd.length<=0&&wd.length<=0||(wd.forEach(function(n){return n()}),wd=bd.splice(0,r.TASK_NUM_PER_FRAME),r.rafId=e.requestAnimationFrame(function(){r.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,i,a){for(var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:r.api,l=e.naturalWidth||e.width,u=e.naturalHeight||e.height,c=n-s,h=i-s,d=Math.ceil(l/c),f=Math.ceil(u/h),v={tileSize:[n,i],gridSize:[f,d],tiles:Array(f).fill(null).map(function(){return Array(d).fill(null)})},p=function(m){for(var w=function(k){bd.push(function(){var T=k*c,O=m*h,P=[Math.min(n,l-T),Math.min(i,u-O)],N=P[0],C=P[1],L=o.createCanvas();L.width=n,L.height=i;var B=L.getContext("2d");B.drawImage(e,T,O,N,C,0,0,N,C),v.tiles[m][k]={x:T,y:O,tileX:k,tileY:m,data:L},a()})},E=0;E<d;E++)w(E)},g=0;g<f;g++)p(g);return r.stop(),r.executeTask(),v}}])}();um.TASK_NUM_PER_FRAME=10;var Jn=new $5;Jn.onRefAdded=function(t){var e=this;t.addEventListener(Ht.DESTROY,function(){e.releaseRef(t)},{once:!0})};var v1=function(){function r(t,e){ht(this,r),this.gradientCache={},this.patternCache={},this.context=t,this.runtime=e}return dt(r,[{key:"getImageSync",value:function(e,n,i){var a=ee(e)?e:e.src;if(Jn.has(a)){var s=Jn.get(a,n);if(s.img.complete)return i==null||i(s),s}return this.getOrCreateImage(e,n).then(function(o){i==null||i(o)}).catch(function(){}),null}},{key:"getOrCreateImage",value:function(e,n){var i=this,a=ee(e)?e:e.src;if(!ee(e)&&!Jn.has(a)){var s={img:e,size:[e.naturalWidth||e.width,e.naturalHeight||e.height],tileSize:Ql(e)};Jn.put(a,s,n)}if(Jn.has(a)){var o=Jn.get(a,n);return o.img.complete?Promise.resolve(o):new Promise(function(l,u){o.img.addEventListener("load",function(){o.size=[o.img.naturalWidth||o.img.width,o.img.naturalHeight||o.img.height],o.tileSize=Ql(o.img),l(o)}),o.img.addEventListener("error",function(c){u(c)})})}return new Promise(function(l,u){var c=i.context.config.createImage();if(c){var h={img:c,size:[0,0],tileSize:Ql(c)};Jn.put(a,h,n),c.onload=function(){h.size=[c.naturalWidth||c.width,c.naturalHeight||c.height],h.tileSize=Ql(h.img),l(h)},c.onerror=function(d){u(d)},c.crossOrigin="Anonymous",c.src=a}})}},{key:"createDownSampledImage",value:function(){var t=na(wn().mark(function n(i,a){var s,o,l,u,c,h,d,f,v,p,g,y,m,w;return wn().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return _.next=2,this.getOrCreateImage(i,a);case 2:if(s=_.sent,!(typeof s.downSamplingRate<"u")){_.next=5;break}return _.abrupt("return",s);case 5:if(o=this.context.config.enableLargeImageOptimization,l=typeof o=="boolean"?{}:o,u=l.maxDownSampledImageSize,c=u===void 0?2048:u,h=l.downSamplingRateThreshold,d=h===void 0?.5:h,f=this.runtime.globalThis.createImageBitmap,v=jt(s.size,2),p=v[0],g=v[1],y=s.img,m=Math.min((c+c)/(p+g),Math.max(.01,Math.min(d,.5))),w=$t($t({},s),{},{downSamplingRate:m}),Jn.update(s.img.src,w,a),!f){_.next=25;break}return _.prev=14,_.next=17,f(s.img,{resizeWidth:p*m,resizeHeight:g*m});case 17:y=_.sent,_.next=23;break;case 20:_.prev=20,_.t0=_.catch(14),m=1;case 23:_.next=26;break;case 25:m=1;case 26:return w=$t($t({},this.getImageSync(i,a)),{},{downSampled:y,downSamplingRate:m}),Jn.update(s.img.src,w,a),_.abrupt("return",w);case 29:case"end":return _.stop()}},n,this,[[14,20]])}));function e(n,i){return t.apply(this,arguments)}return e}()},{key:"createImageTiles",value:function(){var t=na(wn().mark(function n(i,a,s,o){var l,u,c,h,d;return wn().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,this.getOrCreateImage(i,o);case 2:return l=v.sent,u=o.ownerDocument.defaultView,c=u.requestAnimationFrame,h=u.cancelAnimationFrame,um.api={requestAnimationFrame:c,cancelAnimationFrame:h,createCanvas:function(){return Qm.createCanvas()}},d=$t($t({},l),um.sliceImage(l.img,l.tileSize[0],l.tileSize[0],s)),Jn.update(l.img.src,d,o),v.abrupt("return",d);case 8:case"end":return v.stop()}},n,this)}));function e(n,i,a,s){return t.apply(this,arguments)}return e}()},{key:"releaseImage",value:function(e,n){Jn.release(ee(e)?e:e.src,n)}},{key:"releaseImageRef",value:function(e){Jn.releaseRef(e)}},{key:"getOrCreatePatternSync",value:function(e,n,i,a,s,o,l){var u=this.generatePatternKey(n);if(u&&this.patternCache[u])return this.patternCache[u];var c=n.image,h=n.repetition,d=n.transform,f,v=!1;if(ee(c)){var p=this.getImageSync(c,e,l);f=p==null?void 0:p.img}else a?(f=a,v=!0):f=c;var g=f&&i.createPattern(f,h);if(g){var y;d?y=BT(TT(d),new be({})):y=ta(fe()),v&&CO(y,y,[1/s,1/s,1]),g.setTransform({a:y[0],b:y[1],c:y[4],d:y[5],e:y[12]+o[0],f:y[13]+o[1]})}return u&&g&&(this.patternCache[u]=g),g}},{key:"getOrCreateGradient",value:function(e,n){var i=this.generateGradientKey(e),a=e.type,s=e.steps,o=e.min,l=e.width,u=e.height,c=e.angle,h=e.cx,d=e.cy,f=e.size;if(this.gradientCache[i])return this.gradientCache[i];var v=null;if(a===$i.LinearGradient){var p=bI(o,l,u,c),g=p.x1,y=p.y1,m=p.x2,w=p.y2;v=n.createLinearGradient(g,y,m,w)}else if(a===$i.RadialGradient){var E=wI(o,l,u,h,d,f),_=E.x,k=E.y,T=E.r;v=n.createRadialGradient(_,k,0,_,k,T)}return v&&(s.forEach(function(O){var P=O.offset,N=O.color;if(P.unit===wt.kPercentage){var C;(C=v)===null||C===void 0||C.addColorStop(P.value/100,N.toString())}}),this.gradientCache[i]=v),this.gradientCache[i]}},{key:"generateGradientKey",value:function(e){var n=e.type,i=e.min,a=e.width,s=e.height,o=e.steps,l=e.angle,u=e.cx,c=e.cy,h=e.size;return"gradient-".concat(n,"-").concat((l==null?void 0:l.toString())||0,"-").concat((u==null?void 0:u.toString())||0,"-").concat((c==null?void 0:c.toString())||0,"-").concat((h==null?void 0:h.toString())||0,"-").concat(i[0],"-").concat(i[1],"-").concat(a,"-").concat(s,"-").concat(o.map(function(d){var f=d.offset,v=d.color;return"".concat(f).concat(v)}).join("-"))}},{key:"generatePatternKey",value:function(e){var n=e.image,i=e.repetition;if(ee(n))return"pattern-".concat(n,"-").concat(i);if(n.nodeName==="rect")return"pattern-".concat(n.entity,"-").concat(i)}}])}();v1.isSupportTile=!!Qm.createCanvas();function Ql(r){if(!r.complete)return[0,0];var t=r.naturalWidth||r.width,e=r.naturalHeight||r.height,n=256;return[256,512].forEach(function(i){var a=Math.ceil(e/i),s=Math.ceil(t/i);a*s<1e3&&(n=i)}),[n,n]}var RA=function(){function r(){ht(this,r)}return dt(r,[{key:"apply",value:function(e){var n=e.renderingService,i=e.renderingContext,a=e.imagePool,s=i.root.ownerDocument.defaultView,o=function(h,d,f){var v=h.parsedStyle,p=v.width,g=v.height;p&&!g?h.setAttribute("height",f/d*p):!p&&g&&h.setAttribute("width",d/f*g)},l=function(h){var d=h.target,f=d.nodeName,v=d.attributes;if(f===rt.IMAGE){var p=v.src,g=v.keepAspectRatio;a.getImageSync(p,d,function(y){var m=y.img,w=m.width,E=m.height;g&&o(d,w,E),d.renderable.dirty=!0,n.dirtify()})}},u=function(h){var d=h.target,f=h.attrName,v=h.prevValue,p=h.newValue;d.nodeName!==rt.IMAGE||f!=="src"||(v!==p&&a.releaseImage(v,d),ee(p)&&a.getOrCreateImage(p,d).then(function(g){var y=g.img,m=y.width,w=y.height;d.attributes.keepAspectRatio&&o(d,m,w),d.renderable.dirty=!0,n.dirtify()}).catch(function(){}))};n.hooks.init.tap(r.tag,function(){s.addEventListener(Ht.MOUNTED,l),s.addEventListener(Ht.ATTR_MODIFIED,u)}),n.hooks.destroy.tap(r.tag,function(){s.removeEventListener(Ht.MOUNTED,l),s.removeEventListener(Ht.ATTR_MODIFIED,u)})}}])}();RA.tag="LoadImage";var G5=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.name="image-loader",e}return Wt(t,r),dt(t,[{key:"init",value:function(n){this.context.imagePool=new v1(this.context,n),this.addRenderingPlugin(new RA)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(aa);var Ge=q5("renderState"),LA=function(){function r(t){ht(this,r),this.removedRBushNodeAABBs=[],this.renderQueue=[],Object.defineProperty(this,Ge,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=fe(),this.dprMatrix=fe(),this.tmpMat4=fe(),this.vec3a=Zt(),this.vec3b=Zt(),this.vec3c=Zt(),this.vec3d=Zt(),this.canvasRendererPluginOptions=t}return dt(r,[{key:"apply",value:function(e,n){var i=this;this.context=e;var a=this.context,s=a.config,o=a.camera,l=a.renderingService,u=a.renderingContext,c=a.rBushRoot,h=a.pathGeneratorFactory,d=s.renderer.getConfig().enableRenderingOptimization;s.renderer.getConfig().enableDirtyCheck=!1,s.renderer.getConfig().enableDirtyRectangleRendering=!1,this.rBush=c,this.pathGeneratorFactory=h;var f=e.contextService,v=u.root.ownerDocument.defaultView,p=function(w){var E=w.target,_=E.rBushNode;_.aabb&&i.removedRBushNodeAABBs.push(_.aabb)},g=function(w){var E=w.target,_=E.rBushNode;_.aabb&&i.removedRBushNodeAABBs.push(_.aabb)};l.hooks.init.tap(r.tag,function(){v.addEventListener(Ht.UNMOUNTED,p),v.addEventListener(Ht.CULLED,g);var m=f.getDPR(),w=s.width,E=s.height,_=f.getContext();i.clearRect(_,0,0,w*m,E*m,s.background)}),l.hooks.destroy.tap(r.tag,function(){v.removeEventListener(Ht.UNMOUNTED,p),v.removeEventListener(Ht.CULLED,g),i.renderQueue=[],i.removedRBushNodeAABBs=[],Yr(i,Ge)[Ge]={restoreStack:[],prevObject:null,currentContext:null}}),l.hooks.beginFrame.tap(r.tag,function(){var m,w=f.getContext(),E=f.getDPR(),_=s.width,k=s.height,T=i.canvasRendererPluginOptions,O=T.dirtyObjectNumThreshold,P=T.dirtyObjectRatioThreshold,N=l.getStats(),C=N.total,L=N.rendered,B=L/C;i.clearFullScreen=i.clearFullScreenLastFrame||!((m=v.context.renderingPlugins[1])!==null&&m!==void 0&&m.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||L>O&&B>P,w&&(typeof w.resetTransform=="function"?w.resetTransform():w.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(w,0,0,_*E,k*E,s.background))});var y=function(w,E){for(var _=[w];_.length>0;){var k=_.pop();k.isVisible()&&!k.isCulled()&&(d?i.renderDisplayObjectOptimized(k,E,i.context,Yr(i,Ge)[Ge],n):i.renderDisplayObject(k,E,i.context,Yr(i,Ge)[Ge],n));for(var T=k.sortable.sorted||k.childNodes,O=T.length-1;O>=0;O--)_.push(T[O])}};l.hooks.endFrame.tap(r.tag,function(){if(u.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}d=s.renderer.getConfig().enableRenderingOptimization,Yr(i,Ge)[Ge]={restoreStack:[],prevObject:null,currentContext:Yr(i,Ge)[Ge].currentContext},Yr(i,Ge)[Ge].currentContext.clear(),i.clearFullScreenLastFrame=!1;var m=f.getContext(),w=f.getDPR();if(ba(i.dprMatrix,[w,w,1]),An(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)d?(m.save(),y(u.root,m),m.restore()):y(u.root,m),i.removedRBushNodeAABBs=[];else{var E=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat(pe(i.removedRBushNodeAABBs.map(function(W){var tt=W.minX,ct=W.minY,Et=W.maxX,Nt=W.maxY,Vt=new ge;return Vt.setMinMax([tt,ct,0],[Et,Nt,0]),Vt}))));if(i.removedRBushNodeAABBs=[],ge.isEmpty(E)){i.renderQueue=[];return}var _=i.convertAABB2Rect(E),k=_.x,T=_.y,O=_.width,P=_.height,N=Pn(i.vec3a,[k,T,0],i.vpMatrix),C=Pn(i.vec3b,[k+O,T,0],i.vpMatrix),L=Pn(i.vec3c,[k,T+P,0],i.vpMatrix),B=Pn(i.vec3d,[k+O,T+P,0],i.vpMatrix),G=Math.min(N[0],C[0],B[0],L[0]),V=Math.min(N[1],C[1],B[1],L[1]),U=Math.max(N[0],C[0],B[0],L[0]),$=Math.max(N[1],C[1],B[1],L[1]),j=Math.floor(G),Z=Math.floor(V),nt=Math.ceil(U-G),st=Math.ceil($-V);m.save(),i.clearRect(m,j,Z,nt,st,s.background),m.beginPath(),m.rect(j,Z,nt,st),m.clip(),m.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var ot=s.renderer.getConfig(),Pt=ot.enableDirtyRectangleRenderingDebug;Pt&&v.dispatchEvent(new He(er.DIRTY_RECTANGLE,{dirtyRect:{x:j,y:Z,width:nt,height:st}}));var K=i.searchDirtyObjects(E);K.sort(function(W,tt){return W.sortable.renderOrder-tt.sortable.renderOrder}).forEach(function(W){W&&W.isVisible()&&!W.isCulled()&&i.renderDisplayObject(W,m,i.context,Yr(i,Ge)[Ge],n)}),m.restore(),i.renderQueue.forEach(function(W){i.saveDirtyAABB(W)}),i.renderQueue=[]}Yr(i,Ge)[Ge].restoreStack.forEach(function(){m.restore()}),Yr(i,Ge)[Ge].restoreStack=[]}),l.hooks.render.tap(r.tag,function(m){i.clearFullScreen||i.renderQueue.push(m)})}},{key:"clearRect",value:function(e,n,i,a,s,o){e.clearRect(n,i,a,s),o&&(e.fillStyle=o,e.fillRect(n,i,a,s))}},{key:"renderDisplayObjectOptimized",value:function(e,n,i,a,s){var o=e.nodeName,l=!1,u=!1,c=this.context.styleRendererFactory[o],h=this.pathGeneratorFactory[o],d=e.parsedStyle.clipPath;if(d){l=!a.prevObject||!Ry(d.getWorldTransform(),a.prevObject.getWorldTransform()),l&&(this.applyWorldTransform(n,d),a.prevObject=null);var f=this.pathGeneratorFactory[d.nodeName];f&&(n.save(),u=!0,n.beginPath(),f(n,d.parsedStyle),n.closePath(),n.clip())}if(c){l=!a.prevObject||!Ry(e.getWorldTransform(),a.prevObject.getWorldTransform()),l&&this.applyWorldTransform(n,e);var v=!a.prevObject;if(!v){var p=a.prevObject.nodeName;o===rt.TEXT?v=p!==rt.TEXT:o===rt.IMAGE?v=p!==rt.IMAGE:v=p===rt.TEXT||p===rt.IMAGE}c.applyStyleToContext(n,e,v,a),a.prevObject=e}h&&(n.beginPath(),h(n,e.parsedStyle),o!==rt.LINE&&o!==rt.PATH&&o!==rt.POLYLINE&&n.closePath()),c&&c.drawToContext(n,e,Yr(this,Ge)[Ge],this,s),u&&n.restore(),e.renderable.dirty=!1}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,l=a.restoreStack[a.restoreStack.length-1];l&&!(e.compareDocumentPosition(l)&Ne.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var u=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),a.restoreStack.push(e),n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}u&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),o!==rt.LINE&&o!==rt.PATH&&o!==rt.POLYLINE&&n.closePath()),u&&(u.render(n,e.parsedStyle,e,i,this,s),n.restore()),e.renderable.dirty=!1}},{key:"applyAttributesToContext",value:function(e,n){var i=n.parsedStyle,a=i.stroke,s=i.fill,o=i.opacity,l=i.lineDash,u=i.lineDashOffset;l&&e.setLineDash(l),Rt(u)||(e.lineDashOffset=u),Rt(o)||(e.globalAlpha*=o),!Rt(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!Rt(s)&&!Array.isArray(s)&&!s.isNone&&(e.fillStyle=n.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var n=e.getMin(),i=e.getMax(),a=Math.floor(n[0]),s=Math.floor(n[1]),o=Math.ceil(i[0]),l=Math.ceil(i[1]),u=o-a,c=l-s;return{x:a,y:s,width:u,height:c}}},{key:"mergeDirtyAABBs",value:function(e){var n=new ge;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"searchDirtyObjects",value:function(e){var n=e.getMin(),i=jt(n,2),a=i[0],s=i[1],o=e.getMax(),l=jt(o,2),u=l[0],c=l[1],h=this.rBush.search({minX:a,minY:s,maxX:u,maxY:c});return h.map(function(d){var f=d.displayObject;return f})}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new ge);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(Ss(this.tmpMat4,n.getLocalTransform()),An(this.tmpMat4,i,this.tmpMat4),An(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(Ss(this.tmpMat4,n.getWorldTransform()),An(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var e=new ge,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return i.forEach(function(s){e.add(s)}),e}}])}();LA.tag="CanvasRenderer";function Ku(r,t,e,n,i,a,s){var o,l;if(r.image.nodeName==="rect"){var u=r.image.parsedStyle,c=u.width,h=u.height;l=n.contextService.getDPR();var d=n.config.offscreenCanvas;o=a.offscreenCanvasCreator.getOrCreateCanvas(d),o.width=c*l,o.height=h*l;var f=a.offscreenCanvasCreator.getOrCreateContext(d),v={restoreStack:[],prevObject:null,currentContext:new Map};r.image.forEach(function(g){i.renderDisplayObject(g,f,n,v,a)}),v.restoreStack.forEach(function(){f.restore()})}var p=s.getOrCreatePatternSync(t,r,e,o,l,t.getGeometryBounds().min,function(){t.renderable.dirty=!0,n.renderingService.dirtify()});return p}function Zu(r,t,e,n){var i;if(r.type===$i.LinearGradient||r.type===$i.RadialGradient){var a=t.getGeometryBounds(),s=a&&a.halfExtents[0]*2||1,o=a&&a.halfExtents[1]*2||1,l=a&&a.min||[0,0];i=n.getOrCreateGradient($t($t({type:r.type},r.value),{},{min:l,width:s,height:o}),e)}return i}var tu=["shadowBlur","shadowOffsetX","shadowOffsetY"],Mw=["lineCap","lineJoin","miterLimit"],Ye={globalAlpha:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",filter:"none",globalCompositeOperation:"source-over",strokeStyle:"#000",strokeOpacity:1,lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,fillStyle:"#000",fillOpacity:1},kw={};function Le(r,t,e,n){var i=n.has(t)?n.get(t):Ye[t];return i!==e&&(t==="lineDash"?r.setLineDash(e):r[t]=e,n.set(t,e)),i}var W5=function(){function r(t){ht(this,r),this.imagePool=t}return dt(r,[{key:"applyAttributesToContext",value:function(e,n){}},{key:"render",value:function(e,n,i,a,s,o){}},{key:"applyCommonStyleToContext",value:function(e,n,i,a){var s=i?kw:a.prevObject.parsedStyle,o=n.parsedStyle;(i||o.opacity!==s.opacity)&&Le(e,"globalAlpha",Rt(o.opacity)?Ye.globalAlpha:o.opacity,a.currentContext),(i||o.blend!==s.blend)&&Le(e,"globalCompositeOperation",Rt(o.blend)?Ye.globalCompositeOperation:o.blend,a.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(e,n,i,a){var s=i?kw:a.prevObject.parsedStyle,o=n.parsedStyle,l=o.lineWidth,u=l===void 0?Ye.lineWidth:l,c=o.fill&&!o.fill.isNone,h=o.stroke&&!o.stroke.isNone&&u>0;if(h){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var d=!Rt(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:Ye.strokeStyle;Le(e,"strokeStyle",d,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&Le(e,"lineWidth",Rt(o.lineWidth)?Ye.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&Le(e,"lineDash",o.lineDash||Ye.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&Le(e,"lineDashOffset",Rt(o.lineDashOffset)?Ye.lineDashOffset:o.lineDashOffset,a.currentContext);for(var f=0;f<Mw.length;f++){var v=Mw[f];(i||o[v]!==s[v])&&Le(e,v,Rt(o[v])?Ye[v]:o[v],a.currentContext)}}if(c&&(i||n.attributes.fill!==a.prevObject.attributes.fill)){var p=!Rt(o.fill)&&!Array.isArray(o.fill)&&!o.fill.isNone?n.attributes.fill:Ye.fillStyle;Le(e,"fillStyle",p,a.currentContext)}}},{key:"applyStyleToContext",value:function(e,n,i,a){var s=n.nodeName;this.applyCommonStyleToContext(e,n,i,a),s===rt.IMAGE||this.applyStrokeFillStyleToContext(e,n,i,a)}},{key:"applyShadowAndFilterStyleToContext",value:function(e,n,i,a){var s=n.parsedStyle;if(i){Le(e,"shadowColor",s.shadowColor.toString(),a.currentContext);for(var o=0;o<tu.length;o++){var l=tu[o];Le(e,l,s[l]||Ye[l],a.currentContext)}}s.filter&&s.filter.length&&Le(e,"filter",n.attributes.filter,a.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(e,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(n){Le(e,"shadowColor",Ye.shadowColor,a.currentContext);for(var o=0;o<tu.length;o++){var l=tu[o];Le(e,l,Ye[l],a.currentContext)}}if(i)if(n&&s){var u=e.filter;!Rt(u)&&u.indexOf("drop-shadow")>-1&&Le(e,"filter",u.replace(/drop-shadow\([^)]*\)/,"").trim()||Ye.filter,a.currentContext)}else Le(e,"filter",Ye.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle,u=l.fill,c=l.fillRule,h=null;if(Array.isArray(u)&&u.length>0)u.forEach(function(f){var v=Le(e,"fillStyle",Zu(f,n,e,o.imagePool),i.currentContext);h=h!=null?h:v,c?e.fill(c):e.fill()});else{if(Ia(u)){var d=Ku(u,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);d&&(e.fillStyle=d,h=!0)}c?e.fill(c):e.fill()}h!==null&&Le(e,"fillStyle",h,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle.stroke,u=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var f=Le(e,"strokeStyle",Zu(d,n,e,o.imagePool),i.currentContext);u=u!=null?u:f,e.stroke()});else{if(Ia(l)){var c=Ku(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(c){var h=Le(e,"strokeStyle",c,i.currentContext);u=u!=null?u:h}}e.stroke()}u!==null&&Le(e,"strokeStyle",u,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,l=n.nodeName,u=n.parsedStyle,c=u.opacity,h=c===void 0?Ye.globalAlpha:c,d=u.fillOpacity,f=d===void 0?Ye.fillOpacity:d,v=u.strokeOpacity,p=v===void 0?Ye.strokeOpacity:v,g=u.lineWidth,y=g===void 0?Ye.lineWidth:g,m=u.fill&&!u.fill.isNone,w=u.stroke&&!u.stroke.isNone&&y>0;if(!(!m&&!w)){var E=!Rt(u.shadowColor)&&u.shadowBlur>0,_=u.shadowType==="inner",k=((o=u.fill)===null||o===void 0?void 0:o.alpha)===0,T=!!(u.filter&&u.filter.length),O=E&&w&&(l===rt.PATH||l===rt.LINE||l===rt.POLYLINE||k||_),P=null;if(m){O||this.applyShadowAndFilterStyleToContext(e,n,E,i);var N=h*f;P=Le(e,"globalAlpha",N,i.currentContext),this.fillToContext(e,n,i,a,s),O||this.clearShadowAndFilterStyleForContext(e,E,T,i)}if(w){var C=!1,L=h*p,B=Le(e,"globalAlpha",L,i.currentContext);if(P=m?P:B,O&&(this.applyShadowAndFilterStyleToContext(e,n,E,i),C=!0,_)){var G=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=G,this.clearShadowAndFilterStyleForContext(e,E,T,i,!0)}this.strokeToContext(e,n,i,a,s),C&&this.clearShadowAndFilterStyleForContext(e,E,T,i)}P!==null&&Le(e,"globalAlpha",P,i.currentContext)}}}])}(),p1=function(r){function t(){return ht(this,t),Gt(this,t,arguments)}return Wt(t,r),dt(t,[{key:"render",value:function(n,i,a,s,o,l){var u=i.fill,c=i.fillRule,h=i.opacity,d=h===void 0?1:h,f=i.fillOpacity,v=f===void 0?1:f,p=i.stroke,g=i.strokeOpacity,y=g===void 0?1:g,m=i.lineWidth,w=m===void 0?1:m,E=i.lineCap,_=i.lineJoin,k=i.shadowType,T=i.shadowColor,O=i.shadowBlur,P=i.filter,N=i.miterLimit,C=u&&!u.isNone,L=p&&!p.isNone&&w>0,B=(u==null?void 0:u.alpha)===0,G=!!(P&&P.length),V=!Rt(T)&&O>0,U=a.nodeName,$=k==="inner",j=L&&V&&(U===rt.PATH||U===rt.LINE||U===rt.POLYLINE||B||$);C&&(n.globalAlpha=d*v,j||Ju(a,n,V),IA(n,a,u,c,s,o,l,this.imagePool),j||this.clearShadowAndFilter(n,G,V)),L&&(n.globalAlpha=d*y,n.lineWidth=w,Rt(N)||(n.miterLimit=N),Rt(E)||(n.lineCap=E),Rt(_)||(n.lineJoin=_),j&&($&&(n.globalCompositeOperation="source-atop"),Ju(a,n,!0),$&&(cm(n,a,p,s,o,l,this.imagePool),n.globalCompositeOperation=Ye.globalCompositeOperation,this.clearShadowAndFilter(n,G,!0))),cm(n,a,p,s,o,l,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!Rt(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(W5);function Ju(r,t,e){var n=r.parsedStyle,i=n.filter,a=n.shadowColor,s=n.shadowBlur,o=n.shadowOffsetX,l=n.shadowOffsetY;i&&i.length&&(t.filter=r.style.filter),e&&(t.shadowColor=a.toString(),t.shadowBlur=s||0,t.shadowOffsetX=o||0,t.shadowOffsetY=l||0)}function IA(r,t,e,n,i,a,s,o){var l=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(u){r.fillStyle=Zu(u,t,r,o),l||(n?r.fill(n):r.fill())}):(Ia(e)&&(r.fillStyle=Ku(e,t,r,i,a,s,o)),l||(n?r.fill(n):r.fill()))}function cm(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1;Array.isArray(e)?e.forEach(function(l){r.strokeStyle=Zu(l,t,r,s),o||r.stroke()}):(Ia(e)&&(r.strokeStyle=Ku(e,t,r,n,i,a,s)),o||r.stroke())}function V5(r,t){var e=jt(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=jt(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=Math.max(n,l),f=Math.max(i,u),v=Math.min(n+a,l+c),p=Math.min(i+s,u+h);return v<=d||p<=f?null:[d,f,v-d,p-f]}function U5(r,t){var e=Pn(Zt(),[r[0],r[1],0],t),n=Pn(Zt(),[r[0]+r[2],r[1],0],t),i=Pn(Zt(),[r[0],r[1]+r[3],0],t),a=Pn(Zt(),[r[0]+r[2],r[1]+r[3],0],t);return[Math.min(e[0],n[0],i[0],a[0]),Math.min(e[1],n[1],i[1],a[1]),Math.max(e[0],n[0],i[0],a[0])-Math.min(e[0],n[0],i[0],a[0]),Math.max(e[1],n[1],i[1],a[1])-Math.min(e[1],n[1],i[1],a[1])]}var Y5=function(r){function t(){return ht(this,t),Gt(this,t,arguments)}return Wt(t,r),dt(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,l=s.imageCache;if(!l.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(u){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()}).catch(function(){});return}n.drawImage(l.downSampled,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}},{key:"renderTile",value:function(n,i,a,s){var o=s.src,l=s.imageCache,u=s.imageRect,c=s.drawRect,h=l.size,d=n.getTransform(),f=d.a,v=d.b,p=d.c,g=d.d,y=d.e,m=d.f;if(n.resetTransform(),!(l!=null&&l.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()},a).catch(function(){});return}for(var w=[h[0]/u[2],h[1]/u[3]],E=[l.tileSize[0]/w[0],l.tileSize[1]/w[1]],_=[Math.floor((c[0]-u[0])/E[0]),Math.ceil((c[0]+c[2]-u[0])/E[0])],k=_[0],T=_[1],O=[Math.floor((c[1]-u[1])/E[1]),Math.ceil((c[1]+c[3]-u[1])/E[1])],P=O[0],N=O[1],C=P;C<=N;C++)for(var L=k;L<=T;L++){var B=l.tiles[C][L];if(B){var G=[Math.floor(u[0]+B.tileX*E[0]),Math.floor(u[1]+B.tileY*E[1]),Math.ceil(E[0]),Math.ceil(E[1])];n.drawImage(B.data,G[0],G[1],G[2],G[3])}}n.setTransform(f,v,p,g,y,m)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,l=i.y,u=l===void 0?0:l,c=i.width,h=i.height,d=i.src,f=i.shadowColor,v=i.shadowBlur,p=this.imagePool.getImageSync(d,a),g=p==null?void 0:p.img,y=c,m=h;if(g){y||(y=g.width),m||(m=g.height);var w=!Rt(f)&&v>0;Ju(a,n,w);try{var E=a.ownerDocument.defaultView.getContextService().getDomElement(),_=E.width,k=E.height,T=n.getTransform(),O=T.a,P=T.b,N=T.c,C=T.d,L=T.e,B=T.f,G=AO(O,N,0,0,P,C,0,0,0,0,1,0,L,B,0,1),V=U5([o,u,y,m],G),U=V5([0,0,_,k],V);if(!U)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:g,drawRect:[o,u,y,m]});return}var $=V[2]/p.size[0];if($<(p.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:d,imageCache:p,drawRect:[o,u,y,m]});return}if(!v1.isSupportTile){t.renderFull(n,i,a,{image:g,drawRect:[o,u,y,m]});return}this.renderTile(n,i,a,{src:d,imageCache:p,imageRect:V,drawRect:U})}catch{}}}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i)}}],[{key:"renderFull",value:function(n,i,a,s){n.drawImage(s.image,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}}])}(p1),H5=function(r){function t(){return ht(this,t),Gt(this,t,arguments)}return Wt(t,r),dt(t,[{key:"render",value:function(n,i,a,s,o,l){a.getBounds();var u=i.lineWidth,c=u===void 0?1:u,h=i.textAlign,d=h===void 0?"start":h,f=i.textBaseline,v=f===void 0?"alphabetic":f,p=i.lineJoin,g=p===void 0?"miter":p,y=i.miterLimit,m=y===void 0?10:y,w=i.letterSpacing,E=w===void 0?0:w,_=i.stroke,k=i.fill,T=i.fillRule,O=i.fillOpacity,P=O===void 0?1:O,N=i.strokeOpacity,C=N===void 0?1:N,L=i.opacity,B=L===void 0?1:L,G=i.metrics,V=i.x,U=V===void 0?0:V,$=i.y,j=$===void 0?0:$,Z=i.dx,nt=i.dy,st=i.shadowColor,ot=i.shadowBlur,Pt=G.font,K=G.lines,W=G.height,tt=G.lineHeight,ct=G.lineMetrics;n.font=Pt,n.lineWidth=c,n.textAlign=d==="middle"?"center":d;var Et=v;Et==="alphabetic"&&(Et="bottom"),n.lineJoin=g,Rt(m)||(n.miterLimit=m);var Nt=j;v==="middle"?Nt+=-W/2-tt/2:v==="bottom"||v==="alphabetic"||v==="ideographic"?Nt+=-W:(v==="top"||v==="hanging")&&(Nt+=-tt);var Vt=U+(Z||0);Nt+=nt||0,K.length===1&&(Et==="bottom"?(Et="middle",Nt-=.5*W):Et==="top"&&(Et="middle",Nt+=.5*W)),n.textBaseline=Et;var ke=!Rt(st)&&ot>0;Ju(a,n,ke);for(var un=0;un<K.length;un++){var Oe=c/2+Vt;Nt+=tt,!Rt(_)&&!_.isNone&&c&&this.drawLetterSpacing(n,a,K[un],ct[un],d,Oe,Nt,E,k,T,P,_,C,B,!0,s,o,l),Rt(k)||this.drawLetterSpacing(n,a,K[un],ct[un],d,Oe,Nt,E,k,T,P,_,C,B,!1,s,o,l)}}},{key:"drawLetterSpacing",value:function(n,i,a,s,o,l,u,c,h,d,f,v,p,g,y,m,w,E){if(c===0){y?this.strokeText(n,i,a,l,u,v,p,m,w,E):this.fillText(n,i,a,l,u,h,d,f,g,m,w,E);return}var _=n.textAlign;n.textAlign="left";var k=l;o==="center"||o==="middle"?k=l-s.width/2:(o==="right"||o==="end")&&(k=l-s.width);for(var T=Array.from(a),O=n.measureText(a).width,P=0,N=0;N<T.length;++N){var C=T[N];y?this.strokeText(n,i,C,k,u,v,p,m,w,E):this.fillText(n,i,C,k,u,h,d,f,g,m,w,E),P=n.measureText(a.substring(N+1)).width,k+=O-P+c,O=P}n.textAlign=_}},{key:"fillText",value:function(n,i,a,s,o,l,u,c,h,d,f,v){IA(n,i,l,u,d,f,v,this.imagePool,!0);var p,g=!Rt(c)&&c!==1;g&&(p=n.globalAlpha,n.globalAlpha=c*h),n.fillText(a,s,o),g&&(n.globalAlpha=p)}},{key:"strokeText",value:function(n,i,a,s,o,l,u,c,h,d){cm(n,i,l,c,h,d,this.imagePool,!0);var f,v=!Rt(u)&&u!==1;v&&(f=n.globalAlpha,n.globalAlpha=u),n.strokeText(a,s,o),v&&(n.globalAlpha=f)}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i,i.ownerDocument.defaultView.context,s,o)}}])}(p1),X5=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ht(this,t),e=Gt(this,t),e.name="canvas-renderer",e.options=n,e}return Wt(t,r),dt(t,[{key:"init",value:function(){var n,i=$t({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new p1(a),o=(n={},_t(_t(_t(_t(_t(_t(_t(_t(_t(_t(n,rt.CIRCLE,s),rt.ELLIPSE,s),rt.RECT,s),rt.IMAGE,new Y5(a)),rt.TEXT,new H5(a)),rt.LINE,s),rt.POLYLINE,s),rt.POLYGON,s),rt.PATH,s),rt.GROUP,void 0),_t(_t(_t(n,rt.HTML,void 0),rt.MESH,void 0),rt.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new LA(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(aa);var DA=function(){function r(){ht(this,r)}return dt(r,[{key:"apply",value:function(e,n){var i=this,a=e.renderingService,s=e.renderingContext,o=e.config;this.context=e;var l=s.root.ownerDocument.defaultView,u=function(O){a.hooks.pointerMove.call(O)},c=function(O){a.hooks.pointerUp.call(O)},h=function(O){a.hooks.pointerDown.call(O)},d=function(O){a.hooks.pointerOver.call(O)},f=function(O){a.hooks.pointerOut.call(O)},v=function(O){a.hooks.pointerCancel.call(O)},p=function(O){a.hooks.pointerWheel.call(O)},g=function(O){a.hooks.click.call(O)},y=function(O){n.globalThis.document.addEventListener("pointermove",u,!0),O.addEventListener("pointerdown",h,!0),O.addEventListener("pointerleave",f,!0),O.addEventListener("pointerover",d,!0),n.globalThis.addEventListener("pointerup",c,!0),n.globalThis.addEventListener("pointercancel",v,!0)},m=function(O){O.addEventListener("touchstart",h,!0),O.addEventListener("touchend",c,!0),O.addEventListener("touchmove",u,!0),O.addEventListener("touchcancel",v,!0)},w=function(O){n.globalThis.document.addEventListener("mousemove",u,!0),O.addEventListener("mousedown",h,!0),O.addEventListener("mouseout",f,!0),O.addEventListener("mouseover",d,!0),n.globalThis.addEventListener("mouseup",c,!0)},E=function(O){n.globalThis.document.removeEventListener("pointermove",u,!0),O.removeEventListener("pointerdown",h,!0),O.removeEventListener("pointerleave",f,!0),O.removeEventListener("pointerover",d,!0),n.globalThis.removeEventListener("pointerup",c,!0),n.globalThis.removeEventListener("pointercancel",v,!0)},_=function(O){O.removeEventListener("touchstart",h,!0),O.removeEventListener("touchend",c,!0),O.removeEventListener("touchmove",u,!0),O.removeEventListener("touchcancel",v,!0)},k=function(O){n.globalThis.document.removeEventListener("mousemove",u,!0),O.removeEventListener("mousedown",h,!0),O.removeEventListener("mouseout",f,!0),O.removeEventListener("mouseover",d,!0),n.globalThis.removeEventListener("mouseup",c,!0)};a.hooks.init.tap(r.tag,function(){var T=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(T.style.msContentZooming="none",T.style.msTouchAction="none"):l.supportsPointerEvents&&(T.style.touchAction="none"),l.supportsPointerEvents?y(T):w(T),l.supportsTouchEvents&&m(T),o.useNativeClickEvent&&T.addEventListener("click",g,!0),T.addEventListener("wheel",p,{passive:!0,capture:!0})}),a.hooks.destroy.tap(r.tag,function(){var T=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(T.style.msContentZooming="",T.style.msTouchAction=""):l.supportsPointerEvents&&(T.style.touchAction=""),l.supportsPointerEvents?E(T):k(T),l.supportsTouchEvents&&_(T),o.useNativeClickEvent&&T.removeEventListener("click",g,!0),T.removeEventListener("wheel",p,!0)})}}])}();DA.tag="DOMInteraction";var K5=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.name="dom-interaction",e}return Wt(t,r),dt(t,[{key:"init",value:function(){this.addRenderingPlugin(new DA)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(aa);var Z5="g-canvas-camera",BA=function(){function r(){ht(this,r),this.displayObjectHTMLElementMap=new WeakMap}return dt(r,[{key:"joinTransformMatrix",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+n[0],e[13]+n[1]].join(","),")")}},{key:"apply",value:function(e,n){var i=this,a=e.camera,s=e.renderingContext,o=e.renderingService;this.context=e;var l=s.root.ownerDocument.defaultView,u=l.context.eventService.nativeHTMLMap,c=function(y,m){m.style.transform=i.joinTransformMatrix(y.getWorldTransform(),y.getOrigin())},h=function(y){var m=y.target;if(m.nodeName===rt.HTML){i.$camera||(i.$camera=i.createCamera(a));var w=i.getOrCreateEl(m);i.$camera.appendChild(w),Object.keys(m.attributes).forEach(function(E){i.updateAttribute(E,m)}),c(m,w),u.set(w,m)}},d=function(y){var m=y.target;if(m.nodeName===rt.HTML&&i.$camera){var w=i.getOrCreateEl(m);w&&(w.remove(),u.delete(w))}},f=function(y){var m=y.target;if(m.nodeName===rt.HTML){var w=y.attrName;i.updateAttribute(w,m)}},v=function(y){var m=y.target,w=m.nodeName===rt.FRAGMENT?m.childNodes:[m];w.forEach(function(E){if(E.nodeName===rt.HTML){var _=i.getOrCreateEl(E);c(E,_)}})},p=function(){if(i.$camera){var y=i.context.config,m=y.width,w=y.height;i.$camera.parentElement.style.width="".concat(m||0,"px"),i.$camera.parentElement.style.height="".concat(w||0,"px")}};o.hooks.init.tap(r.tag,function(){l.addEventListener(er.RESIZE,p),l.addEventListener(Ht.MOUNTED,h),l.addEventListener(Ht.UNMOUNTED,d),l.addEventListener(Ht.ATTR_MODIFIED,f),l.addEventListener(Ht.BOUNDS_CHANGED,v)}),o.hooks.endFrame.tap(r.tag,function(){i.$camera&&s.renderReasons.has(xs.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))}),o.hooks.destroy.tap(r.tag,function(){i.$camera&&i.$camera.remove(),l.removeEventListener(er.RESIZE,p),l.removeEventListener(Ht.MOUNTED,h),l.removeEventListener(Ht.UNMOUNTED,d),l.removeEventListener(Ht.ATTR_MODIFIED,f),l.removeEventListener(Ht.BOUNDS_CHANGED,v)})}},{key:"createCamera",value:function(e){var n=this.context.config,i=n.document,a=n.width,s=n.height,o=this.context.contextService.getDomElement(),l=o.parentNode;if(l){var u=Z5,c=l.querySelector("#".concat(u));if(!c){var h=(i||document).createElement("div");h.style.overflow="hidden",h.style.pointerEvents="none",h.style.position="absolute",h.style.left="0px",h.style.top="0px",h.style.width="".concat(a||0,"px"),h.style.height="".concat(s||0,"px");var d=(i||document).createElement("div");c=d,d.id=u,d.style.position="absolute",d.style.left="".concat(o.offsetLeft||0,"px"),d.style.top="".concat(o.offsetTop||0,"px"),d.style.transformOrigin="left top",d.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),d.style.pointerEvents="none",d.style.width="100%",d.style.height="100%",h.appendChild(d),l.appendChild(h)}return c}return null}},{key:"getOrCreateEl",value:function(e){var n=this.context.config.document,i=this.displayObjectHTMLElementMap.get(e);return i||(i=(n||document).createElement("div"),e.parsedStyle.$el=i,this.displayObjectHTMLElementMap.set(e,i),e.id&&(i.id=e.id),e.name&&i.setAttribute("name",e.name),e.className&&(i.className=e.className),i.style.position="absolute",i.style["will-change"]="transform",i.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),i}},{key:"updateAttribute",value:function(e,n){var i=this.getOrCreateEl(n);switch(e){case"innerHTML":var a=n.parsedStyle.innerHTML;ee(a)?i.innerHTML=a:(i.innerHTML="",i.appendChild(a));break;case"x":i.style.left="".concat(n.parsedStyle.x,"px");break;case"y":i.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var s=n.parsedStyle.transformOrigin;i.style["transform-origin"]="".concat(s[0].buildCSSText(null,null,"")," ").concat(s[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;i.style.width=St(o)?"".concat(o,"px"):o.toString();break;case"height":var l=n.parsedStyle.height;i.style.height=St(l)?"".concat(l,"px"):l.toString();break;case"zIndex":var u=n.parsedStyle.zIndex;i.style["z-index"]="".concat(u);break;case"visibility":var c=n.parsedStyle.visibility;i.style.visibility=c;break;case"pointerEvents":var h=n.parsedStyle.pointerEvents,d=h===void 0?"auto":h;i.style.pointerEvents=d;break;case"opacity":var f=n.parsedStyle.opacity;i.style.opacity="".concat(f);break;case"fill":var v=n.parsedStyle.fill,p="";ju(v)?v.isNone?p="transparent":p=n.getAttribute("fill"):Array.isArray(v)?p=n.getAttribute("fill"):Ia(v),i.style.background=p;break;case"stroke":var g=n.parsedStyle.stroke,y="";ju(g)?g.isNone?y="transparent":y=n.getAttribute("stroke"):Array.isArray(g)?y=n.getAttribute("stroke"):Ia(g),i.style["border-color"]=y,i.style["border-style"]="solid";break;case"lineWidth":var m=n.parsedStyle.lineWidth;i.style["border-width"]="".concat(m||0,"px");break;case"lineDash":i.style["border-style"]="dashed";break;case"filter":var w=n.style.filter;i.style.filter=w;break;default:!Rt(n.style[e])&&n.style[e]!==""&&(i.style[e]=n.style[e])}}}])}();BA.tag="HTMLRendering";var J5=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.name="html-renderer",e}return Wt(t,r),dt(t,[{key:"init",value:function(){this.addRenderingPlugin(new BA)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(aa);var Q5=function(){function r(t){ht(this,r),this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return dt(r,[{key:"init",value:function(){var e=this.canvasConfig,n=e.container,i=e.canvas;if(i)this.$canvas=i,n&&i.parentElement!==n&&n.appendChild(i),this.$container=i.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=ee(n)?document.getElementById(n):n,this.$container)){var a=document.createElement("canvas");this.$container.appendChild(a),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=a}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(e,n){var i=this.canvasConfig.devicePixelRatio;this.dpr=i,this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,TD(this.$canvas,e,n)),this.renderingContext.renderReasons.add(xs.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)}},{key:"toDataURL",value:function(){var t=na(wn().mark(function n(){var i,a,s,o=arguments;return wn().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return i=o.length>0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,u.abrupt("return",this.context.canvas.toDataURL(a,s));case 3:case"end":return u.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),t4=function(r){function t(){var e;ht(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Gt(this,t,[].concat(i)),e.name="canvas-context-register",e}return Wt(t,r),dt(t,[{key:"init",value:function(){this.context.ContextService=Q5}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(aa),Ro=function(r){function t(e){var n;return ht(this,t),n=Gt(this,t,[e]),n.registerPlugin(new t4),n.registerPlugin(new G5),n.registerPlugin(new w5),n.registerPlugin(new X5),n.registerPlugin(new K5),n.registerPlugin(new z5),n.registerPlugin(new J5),n}return Wt(t,r),dt(t)}(TL),e4=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};class Sc extends Fr{constructor(t){super(Object.assign(Object.assign({},t),{style:Object.assign({},Sc.defaultStyleProps,t.style)})),this.rootPointerEvent=new Gu(null),this.forwardEvents=e=>{const n=this.context.canvas,i=n.context.renderingContext.root.ownerDocument.defaultView;this.normalizeToPointerEvent(e,i).forEach(s=>{const o=this.bootstrapEvent(this.rootPointerEvent,s,i,e);Oo(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[it.CLICK,it.POINTER_DOWN,it.POINTER_MOVE,it.POINTER_UP,it.POINTER_OVER,it.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=Ra(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=e4(e,["dx","dy"]),[s,o]=this.getSize(t);return Object.assign(Object.assign({x:n,y:i},a),{width:s,height:o})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:i,y:a,width:s=0,height:o=0}=n,l=this.upsert("key-container",xn,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",Xo,n,l)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof Ro))return;const n=this.getDomElement();this.events.forEach(i=>{n.addEventListener(i,this.forwardEvents)})}attributeChangedCallback(t,e,n){t==="zIndex"&&e!==n&&(this.getDomElement().style.zIndex=n)}destroy(){const t=this.getDomElement();this.events.forEach(e=>{t.removeEventListener(e,this.forwardEvents)}),super.destroy()}normalizeToPointerEvent(t,e){const n=[];if(e.isTouchEvent(t))for(let i=0;i<t.changedTouches.length;i++){const a=t.changedTouches[i];Bt(a.button)&&(a.button=0),Bt(a.buttons)&&(a.buttons=1),Bt(a.isPrimary)&&(a.isPrimary=t.touches.length===1&&t.type==="touchstart"),Bt(a.width)&&(a.width=a.radiusX||1),Bt(a.height)&&(a.height=a.radiusY||1),Bt(a.tiltX)&&(a.tiltX=0),Bt(a.tiltY)&&(a.tiltY=0),Bt(a.pointerType)&&(a.pointerType="touch"),Bt(a.pointerId)&&(a.pointerId=a.identifier||0),Bt(a.pressure)&&(a.pressure=a.force||.5),Bt(a.twist)&&(a.twist=0),Bt(a.tangentialPressure)&&(a.tangentialPressure=0),a.isNormalized=!0,a.type=t.type,n.push(a)}else if(e.isMouseEvent(t)){const i=t;Bt(i.isPrimary)&&(i.isPrimary=!0),Bt(i.width)&&(i.width=1),Bt(i.height)&&(i.height=1),Bt(i.tiltX)&&(i.tiltX=0),Bt(i.tiltY)&&(i.tiltY=0),Bt(i.pointerType)&&(i.pointerType="mouse"),Bt(i.pointerId)&&(i.pointerId=1),Bt(i.pressure)&&(i.pressure=.5),Bt(i.twist)&&(i.twist=0),Bt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,n.push(i)}else n.push(t);return n}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}bootstrapEvent(t,e,n,i){t.view=n,t.originalEvent=null,t.nativeEvent=i,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:a,y:s}=this.getViewportXY(e);t.viewport.x=a,t.viewport.y=s;const[o,l]=this.context.canvas.getCanvasByViewport([a,s]);return t.canvas.x=o,t.canvas.y=l,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=i.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t}getViewportXY(t){let e,n;const{offsetX:i,offsetY:a,clientX:s,clientY:o}=t;if(!Rt(i)&&!Rt(a))e=i,n=a;else{const l=this.eventService.client2Viewport({x:s,y:o});e=l.x,n=l.y}return{x:e,y:n}}onframe(){super.onframe();const{opacity:t}=this.attributes;this.getDomElement().style.opacity=`${t}`}}Sc.defaultStyleProps={size:[160,80],halo:!1,icon:!1,label:!1,pointerEvents:"auto"};var Ow=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};let FA=class zA extends Fr{constructor(t){super(gn({style:zA.defaultStyleProps},t))}getKeyStyle(t){const[e,n]=this.getSize(t),i=super.getKeyStyle(t),{fillOpacity:a,opacity:s=a}=i,o=Ow(i,["fillOpacity","opacity"]);return Object.assign(Object.assign({opacity:s},o),{width:e,height:n,x:-e/2,y:-n/2})}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getShape("key").attributes,{fill:n,stroke:i}=e;Ow(e,["fill","stroke"]);const a=Ke(this.getGraphicStyle(t),"halo"),s=Number(a.lineWidth),[o,l]=qt(this.getSize(t),[s,s]);return Object.assign(Object.assign({},a),{width:o,height:l,fill:"transparent",x:-o/2,y:-l/2})}getIconStyle(t){const e=super.getIconStyle(t),[n,i]=this.getSize(t);return e?Object.assign({width:n*Mi,height:i*Mi},e):!1}drawKeyShape(t,e){const n=this.upsert("key",d1,this.getKeyStyle(t),e);return f1(this),n}drawHaloShape(t,e){this.upsert("halo",xn,this.getHaloStyle(t),e)}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&g1(this)}};FA.defaultStyleProps={size:32};class n4 extends Fr{constructor(t){super(t)}getKeyStyle(t){const[e,n]=this.getSize(t);return Object.assign(Object.assign({},super.getKeyStyle(t)),{width:e,height:n,x:-e/2,y:-n/2})}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:i}=this.getShape("key").attributes;return e?Object.assign({width:n*Mi,height:i*Mi},e):!1}drawKeyShape(t,e){return this.upsert("key",xn,this.getKeyStyle(t),e)}}class r4 extends wc{constructor(t){super(t)}getInnerR(t){return t.innerR||this.getOuterR(t)*3/8}getOuterR(t){return Math.min(...this.getSize(t))/2}getPoints(t){return j4(this.getOuterR(t),this.getInnerR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getInnerR(t)*2*Mi;return e?Object.assign({width:n,height:n},e):!1}getPortXY(t,e){const{placement:n="top"}=e,i=this.getShape("key").getLocalBounds(),a=q4(this.getOuterR(t),this.getInnerR(t));return b1(i,n,a,!1)}}class _c extends wc{constructor(t){super(gn({style:_c.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,i]=this.getSize(t);return $4(n,i,e)}getPortXY(t,e){const{direction:n}=t,{placement:i="top"}=e,a=this.getShape("key").getLocalBounds(),[s,o]=this.getSize(t),l=G4(s,o,n);return b1(a,i,l,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:i,direction:a}=t;if(e===!1||Kr(n||i))return!1;const s=Ke(this.getGraphicStyle(t),"icon"),o=this.getShape("key").getLocalBounds(),[l,u]=aF(o,a),c=sF(o,a)*2*Mi;return Object.assign({x:l,y:u,width:c,height:c},s)}}_c.defaultStyleProps={size:40,direction:"up"};var Tw=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};class Is extends Fr{constructor(t){super(gn({style:Is.defaultStyleProps},t)),this.type="combo",this.updateComboPosition(this.parsedAttributes)}getKeySize(t){const{collapsed:e,childrenNode:n=[]}=t;return n.length===0?this.getEmptyKeySize(t):e?this.getCollapsedKeySize(t):this.getExpandedKeySize(t)}getEmptyKeySize(t){const{padding:e,collapsedSize:n}=t,[i,a,s,o]=si(e);return qt(sr(n),[o+a,i+s,0])}getCollapsedKeySize(t){return sr(t.collapsedSize)}getExpandedKeySize(t){const e=this.getContentBBox(t);return[oi(e),li(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,i=e.map(s=>this.context.element.getElement(s)).filter(Boolean);if(i.length===0){const s=new ge,{x:o=0,y:l=0,size:u}=t,[c,h]=sr(u);return s.setMinMax([o-c/2,l-h/2,0],[o+c/2,l+h/2,0]),s}const a=Zo(i.map(s=>s.getBounds()));return n?oa(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",OA,n,e),f1(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=Ke(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=Tw(e,["type"]),a=this.getShape("key"),[s,o]=pi(a.getLocalBounds(),"center"),l=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const u=this.getCollapsedMarkerText(n,t);Object.assign(l,{text:u})}return l}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:i}=this.context;return t==="descendant-count"?i.getDescendantsData(this.id).length.toString():t==="child-count"?n.length.toString():t==="node-count"?i.getDescendantsData(this.id).filter(a=>i.getElementType(J(a))==="node").length.toString():Ot(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:i,childrenData:a=[]}=t;if(a.length===0)return[+e,+n,0];if(i){const{model:s}=this.context,o=s.getDescendantsData(this.id).filter(l=>!s.isCombo(J(l)));if(o.length>0&&o.some(RF)){const l=o.reduce((u,c)=>qt(u,an(c)),[0,0,0]);return Dr(l,o.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:i}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:i}}),g1(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(i=>{var{x:a,y:s,z:o,transform:l}=i,u=Tw(i,["x","y","z","transform"]);return u}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Is.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class i4 extends Is{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Ti,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&Ke(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=sr(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=sa(e),a=Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2;return[a*2,a*2,0]}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return mc(t,n,e)}}class a4 extends Is{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",xn,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&Ke(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}const s4={padding:10};function Aw(r,t,e,n,i,a){const{padding:s}=Object.assign(s4,a),o=Gi(e,s),l=Gi(n,s),u=[r,...i,t];let c=null;const h=[];for(let d=0,f=u.length;d<f-1;d++){const v=d+1,p=u[d],g=u[v],y=DF(p,g);let m=null;if(d===0)if(v===f-1)if(o.intersects(l))m=xd(p,g,o,l);else if(!Uu(p,o)&&!Uu(g,l)){const w=Ta(p,o),E=Ta(g,l);m=Nw(w,E,In(w,E)),m.points.unshift(w),m.points.push(E)}else y||(m=l4(p,g,o,l));else Ir(g,o)?m=xd(p,g,o,Gi(g,s),c):y||(m=wu(p,g,o));else v===f-1?Ir(p,l)?m=xd(p,g,Gi(p,s),l,c):y||(m=jA(p,g,l,c)):y||(m=Nw(p,g,c));m?(h.push(...m.points),c=m.direction):c=In(p,g),v<f-1&&h.push(g)}return h.map(Fa)}const o4={N:"S",S:"N",W:"E",E:"W"},Pw={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function In(r,t){const[e,n]=r,[i,a]=t;return e===i?n>a?"N":"S":n===a?e>i?"W":"E":null}function hm(r,t){return t==="N"||t==="S"?li(r):oi(r)}function Nw(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=In(r,n),s=In(r,i),o=e?o4[e]:null,l=a===e||a!==o&&s!==e?n:i;return{points:[l],direction:In(l,t)}}function wu(r,t,e){if(Uu(r,e)){const n=Lo(r,t,e);return{points:[n],direction:In(n,t)}}else{const n=Ta(r,e),a=["left","right"].includes(xo(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:In(a,t)}}}function jA(r,t,e,n){const i=Uu(t,e)?t:Ta(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(l=>iF(l,e)&&!aA(l,e,!0)),o=s.filter(l=>In(l,r)!==n);if(o.length>0){const l=o.find(u=>In(r,u)===n)||o[0];return{points:[l],direction:In(l,t)}}else{const l=d3(a,s)[0],u=Ji(t,l,hm(e,n)/2);return{points:[Lo(u,r,e),u],direction:In(u,t)}}}function l4(r,t,e,n){let i=wu(r,t,e);const a=Co(i.points[0]);if(Ir(a,n)){i=wu(t,r,n);const s=Co(i.points[0]);if(Ir(s,e)){const o=Ji(r,a,hm(e,In(r,a))/2),l=Ji(t,s,hm(n,In(t,s))/2),u=[(o[0]+l[0])/2,(o[1]+l[1])/2],c=wu(r,u,e),h=jA(u,t,n,c.direction);i.points=[c.points[0],h.points[0]],i.direction=h.direction}}return i}function xd(r,t,e,n,i){const s=Zo([e,n]),o=me(t,s.center)>me(r,s.center),[l,u]=o?[t,r]:[r,t],c=li(s)+oi(s);let h;if(i){const v=[l[0]+c*Math.cos(Pw[i]),l[1]+c*Math.sin(Pw[i])];h=Ji(Ta(v,s),v,.01)}else h=Ji(Ta(l,s),l,-.01);let d=Lo(h,u,s),f=[Js(h,2),Js(d,2)];if(Be(Js(h),Js(d))){const v=u1(oe(h,l),[1,0,0])+Math.PI/2;d=[u[0]+c*Math.cos(v),u[1]+c*Math.sin(v),0],d=Js(Ji(Ta(d,s),u,-.01),2);const p=Lo(h,d,s);f=[h,p,d]}return{points:o?f.reverse():f,direction:In(o?h:d,t)}}function Lo(r,t,e){let n=[r[0],t[1]];return Ir(n,e)&&(n=[t[0],r[1]]),n}function qA(r,t,e,n,i){let l=typeof t=="number"?t:.5;t==="start"&&(l=0),t==="end"&&(l=.99);const u=bn(r.getPoint(l)),c=bn(r.getPoint(l+.01));let h=t==="start"?"left":t==="end"?"right":"center";if(pA(u,c)||!e){const[y,m]=Cw(r,l,n,i);return{transform:[["translate",y,m]],textAlign:h}}let d=Math.atan2(c[1]-u[1],c[0]-u[0]);c[0]<u[0]&&(h=h==="center"?h:h==="left"?"right":"left",n*=-1,d+=Math.PI);const[v,p]=Cw(r,l,n,i,d),g=[["translate",v,p],["rotate",d/Math.PI*180]];return{textAlign:h,transform:g}}function u4(r,t,e,n,i){var a,s;const o=((a=r.badge)===null||a===void 0?void 0:a.getGeometryBounds().halfExtents[0])*2||0,l=((s=r.label)===null||s===void 0?void 0:s.getGeometryBounds().halfExtents[0])*2||0;return qA(r.key,e,!0,(l?(l/2+o/2)*(t==="suffix"?1:-1):0)+n,i)}function Cw(r,t,e,n,i){const[a,s]=bn(r.getPoint(t));let o=e,l=n;return i&&(o=e*Math.cos(i)-n*Math.sin(i),l=e*Math.sin(i)+n*Math.cos(i)),[a+o,s+l]}function dm(r,t,e,n){if(Be(r,t))return r;const i=oe(t,r),a=[r[0]+e*i[0],r[1]+e*i[1]],s=Ei(yc(i,!1));return a[0]+=n*s[0],a[1]+=n*s[1],a}function c4(r){return St(r)?[r,-r]:r}function h4(r){return St(r)?[r,1-r]:r}function d4(r,t,e){return[["M",r[0],r[1]],["Q",e[0],e[1],t[0],t[1]]]}function $A(r,t,e){return[["M",r[0],r[1]],["C",e[0][0],e[0][1],e[1][0],e[1][1],t[0],t[1]]]}function y1(r,t=0,e=!1){const n=r[0],i=r[r.length-1],a=r.slice(1,r.length-1),s=[["M",n[0],n[1]]];return a.forEach((o,l)=>{const u=a[l-1]||n,c=a[l+1]||i;if(!yA(u,o,c)&&t){const[h,d]=f4(u,o,c,t);s.push(["L",h[0],h[1]],["Q",o[0],o[1],d[0],d[1]],["L",d[0],d[1]])}else s.push(["L",o[0],o[1]])}),s.push(["L",i[0],i[1]]),e&&s.push(["Z"]),s}function f4(r,t,e,n){const i=Yu(r,t),a=Yu(e,t),s=Math.min(n,Math.min(i,a)/2),o=[t[0]-s/i*(t[0]-r[0]),t[1]-s/i*(t[1]-r[1])],l=[t[0]-s/a*(t[0]-e[0]),t[1]-s/a*(t[1]-e[1])];return[o,l]}const g4=r=>{const t=Math.PI/2,e=li(r)/2,n=oi(r)/2,i=Math.atan2(e,n)/2,a=Math.atan2(n,e)/2;return{top:[-t-a,-t+a],"top-right":[-t+a,-i],"right-top":[-t+a,-i],right:[-i,i],"bottom-right":[i,t-a],"right-bottom":[i,t-a],bottom:[t-a,t+a],"bottom-left":[t+a,Math.PI-i],"left-bottom":[t+a,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-t-a],"left-top":[Math.PI+i,-t-a]}};function GA(r,t,e,n,i){const a=Gi(r),s=r.getCenter();let o=n&&ra(n),l=i&&ra(i);if(!o||!l){const u=g4(a),c=u[t][0],h=u[t][1],[d,f]=sa(a),v=Math.max(d,f),p=qt(s,[v*Math.cos(c),v*Math.sin(c),0]),g=qt(s,[v*Math.cos(h),v*Math.sin(h),0]);o=gm(r,p),l=gm(r,g),e||([o,l]=[l,o])}return[o,l]}function v4(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[l,u]=GA(r,t,e,s,o);const c=p4(r,l,u,n);return s&&(l=Io(s,c[0])),o&&(u=Io(o,c[c.length-1])),$A(l,u,c)}function p4(r,t,e,n){const i=r.getCenter();if(Be(t,e)){const a=oe(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[qt(t,s),qt(e,vi(s,[1,-1,1]))]}return[Ji(i,t,me(i,t)+n),Ji(i,e,me(i,e)+n)]}function y4(r,t,e,n,i,a,s){const o=w1(r),l=o[a||s],u=o[s||a];let[c,h]=GA(r,e,n,l,u);const d=m4(r,c,h,i);return l&&(c=Io(l,d[0])),u&&(h=Io(u,d[d.length-1])),y1([c,...d,h],t)}function m4(r,t,e,n){const i=[],a=Gi(r);if(Be(t,e))switch(xo(t,a)){case"left":i.push([t[0]-n,t[1]]),i.push([t[0]-n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"right":i.push([t[0]+n,t[1]]),i.push([t[0]+n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"top":i.push([t[0],t[1]-n]),i.push([t[0]+n,t[1]-n]),i.push([t[0]+n,t[1]]);break;case"bottom":i.push([t[0],t[1]+n]),i.push([t[0]+n,t[1]+n]),i.push([t[0]+n,t[1]]);break}else{const s=xo(t,a),o=xo(e,a);if(s===o){const l=s;let u,c;switch(l){case"left":u=Math.min(t[0],e[0])-n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"right":u=Math.max(t[0],e[0])+n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"top":c=Math.min(t[1],e[1])-n,i.push([t[0],c]),i.push([e[0],c]);break;case"bottom":c=Math.max(t[1],e[1])+n,i.push([t[0],c]),i.push([e[0],c]);break}}else{const l=(d,f)=>({left:[f[0]-n,f[1]],right:[f[0]+n,f[1]],top:[f[0],f[1]-n],bottom:[f[0],f[1]+n]})[d],u=l(s,t),c=l(o,e),h=Lo(u,c,a);i.push(u,h,c)}}return i}function fm(r,t){const e=new Set,n=new Set,i=new Set;return r.forEach(a=>{t(a).forEach(o=>{e.add(o),r.includes(o.source)&&r.includes(o.target)?n.add(o):i.add(o)})}),{edges:Array.from(e),internal:Array.from(n),external:Array.from(i)}}function Rw(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(J(n));if(i)n=i;else break}if(e.some(i=>{var a;return(a=i.style)===null||a===void 0?void 0:a.collapsed})){const i=e.reverse().findIndex(Yn);return e[i]||e.at(-1)}return r}function b4(r,t){return t||(r<4?10:r===4?12:r*2.5)}const w4=(r,t)=>{const e=Math.max(r,t)/2;return[["M",-r/2,0],["A",e,e,0,1,0,2*e-r/2,0],["A",e,e,0,1,0,-r/2,0],["Z"]]},WA=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],x4=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],E4=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],S4=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],_4=(r,t)=>{const e=r/2,n=r/7,i=r-n;return[["M",-e,0],["L",0,-t/2],["L",0,t/2],["Z"],["M",i-e,-t/2],["L",i+n-e,-t/2],["L",i+n-e,t/2],["L",i-e,t/2],["Z"]]},M4=(r,t)=>[["M",r/2,-t/2],["L",-r/2,0],["L",r/2,0],["L",-r/2,0],["L",r/2,t/2]],k4=Object.freeze(Object.defineProperty({__proto__:null,circle:w4,diamond:x4,rect:S4,simple:M4,triangle:WA,triangleRect:_4,vee:E4},Symbol.toStringTag,{value:"Module"}));var eu=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};class ua extends TA{constructor(t){super(gn({style:ua.defaultStyleProps},t)),this.type="edge"}get sourceNode(){const{sourceNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}get targetNode(){const{targetNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}getKeyStyle(t){const e=this.getGraphicStyle(t),{loop:n}=e,i=eu(e,["loop"]),{sourceNode:a,targetNode:s}=this,l={d:n&&D4(a,s)?this.getLoopPath(t):this.getKeyPath(t)};return rr.PARSED_STYLE_LIST.forEach(u=>{u in i&&(l[u]=i[u])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=Gi(i),s=Math.max(oi(a),li(a)),{placement:o,clockwise:l,dist:u=s}=Ke(this.getGraphicStyle(t),"loop");return v4(i,o,l,u,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[l,u]=F4(s,o,i,a);if(!e){const f=l?ra(l):s.getCenter(),v=u?ra(u):o.getCenter();return[f,v]}const c=typeof n=="function"?n():n,h=Fw(l||s,c[0]||u||o),d=Fw(u||o,c[c.length-1]||l||s);return[h,d]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=Ke(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=Ke(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,l=eu(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),u=qA(this.shapeMap.key,n,s,i,a),c=this.shapeMap.key.getLocalBounds(),h=ZF([c.min,c.max],o);return Object.assign({wordWrapWidth:h},u,l)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=Ke(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=eu(e,["offsetX","offsetY","placement"]);return Object.assign(s,u4(this.shapeMap,a,t.labelPlacement,n,i))}drawArrow(t,e){var n;const i=e==="start",s=t[e==="start"?"startArrow":"endArrow"],o=this.shapeMap.key;if(s){const l=this.getArrowStyle(t,i),[u,c,h]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],d=o.parsedStyle[u];if(d)d.attr(l);else{const f=l.src?Ko:rr,v=new f({style:l});o.style[u]=v}o.style[c]=t[h]||l.width/2+ +l.lineWidth}else{const l=i?"markerStart":"markerEnd";(n=o.style[l])===null||n===void 0||n.destroy(),o.style[l]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=Ke(this.getGraphicStyle(t),i),{size:s,type:o}=a,l=eu(a,["size","type"]),[u,c]=sr(b4(n.lineWidth,s)),d=(Ot(o)?o:k4[o]||WA)(u,c);return Object.assign(Ra(n,["stroke","strokeOpacity","fillOpacity"]),{width:u,height:c},Object.assign({},d&&{d,fill:o==="simple"?"":n.stroke}),l)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",la,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",rr,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",Ls,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",rr,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}ua.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class Va extends ua{constructor(t){super(gn({style:Va.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,h4(a),c4(s),i);return $A(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[dm(t,e,n[0],i[0]),dm(t,e,n[1],i[1])]}}Va.defaultStyleProps={curvePosition:.5,curveOffset:20};class Mc extends Va{constructor(t){super(gn({style:Mc.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[0]-t[0];return[[t[0]+a*n[0]+i[0],t[1]],[e[0]-a*n[1]+i[1],e[1]]]}}Mc.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class kc extends Va{constructor(t){super(gn({style:kc.defaultStyleProps},t))}get ref(){return this.context.model.getRootsData()[0]}getEndpoints(t){if(this.sourceNode.id===this.ref.id)return super.getEndpoints(t);const e=an(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=an(this.ref),n=me(t,e),i=fA(oe(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),l=o-a;return[[t[0]+(l*n[0]+i[0])*Math.cos(s),t[1]+(l*n[0]+i[0])*Math.sin(s)],[e[0]-(l*n[1]-i[0])*Math.cos(s),e[1]-(l*n[1]-i[0])*Math.sin(s)]]}}kc.defaultStyleProps={curvePosition:.5,curveOffset:20};class Oc extends Va{constructor(t){super(gn({style:Oc.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[1]-t[1];return[[t[0],t[1]+a*n[0]+i[0]],[e[0],e[1]-a*n[1]+i[1]]]}}Oc.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let VA=class UA extends ua{constructor(t){super(gn({style:UA.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};VA.defaultStyleProps={};const O4={enableObstacleAvoidance:!1,offset:10,maxAllowedDirectionChange:Math.PI/2,maximumLoops:3e3,gridSize:5,startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{right:{stepX:1,stepY:0},left:{stepX:-1,stepY:0},bottom:{stepX:0,stepY:1},top:{stepX:0,stepY:-1}},penalties:{0:0,90:0},distFunc:Yu},fi=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function Ma(r,t){const e=n=>Math.round(n/t);return St(r)?e(r):r.map(e)}function T4(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function Lw(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function YA(r,t,e,n){const i=Lw(r,t),a=e[fi(r)],o=Lw(a||n,r);return T4(o,i)}const A4=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=oa(a.getRenderBounds(),e);for(let o=Ma(s.min[0],n);o<=Ma(s.max[0],n);o+=1)for(let l=Ma(s.min[1],n);l<=Ma(s.max[1],n);l+=1)i[`${o}|||${l}`]=!0}),i};function Iw(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function P4(r,t,e){let n=r[0],i=e(r[0],t);for(let a=0;a<r.length;a++){const s=r[a],o=e(s,t);o<i&&(n=s,i=o)}return n}const Dw=(r,t,e,n)=>{if(!t)return[r];const{directionMap:i,offset:a}=n,s=oa(t.getRenderBounds(),a),o=Object.keys(i).reduce((l,u)=>{if(e.includes(u)){const c=i[u],[h,d]=sa(s),f=[r[0]+c.stepX*h,r[1]+c.stepY*d],v=oF(s);for(let p=0;p<v.length;p++){const g=c1([r,f],v[p]);g&&aA(g,s)&&l.push(g)}}return l},[]);return Ir(r,s)||o.push(r),o.map(l=>Ma(l,n.gridSize))},N4=(r,t,e,n,i,a,s)=>{const o=[];let l=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(l);let u=r,c=t[fi(u)];for(;c;){const f=c,v=u;YA(f,v,t,e)&&(l=[f[0]===v[0]?l[0]:f[0]*s,f[1]===v[1]?l[1]:f[1]*s],o.unshift(l)),c=t[fi(f)],u=f}const h=i.map(f=>[f[0]*s,f[1]*s]),d=P4(h,l,Yu);return o.unshift(d),o};function C4(r,t,e,n){const i=Fa(r.getCenter()),a=Fa(t.getCenter()),s=Object.assign(O4,n),{gridSize:o}=s,l=s.enableObstacleAvoidance?e:[r,t],u=A4(l,s),c=Ma(i,o),h=Ma(a,o),d=Dw(i,r,s.startDirections,s),f=Dw(a,t,s.endDirections,s);d.forEach(O=>delete u[fi(O)]),f.forEach(O=>delete u[fi(O)]);const v={},p={},g={},y={},m={},w=new R4;for(let O=0;O<d.length;O++){const P=d[O],N=fi(P);v[N]=P,y[N]=0,m[N]=Iw(P,f,s.distFunc),w.add({id:N,value:m[N]})}const E=f.map(O=>fi(O));let _=s.maximumLoops,k,T=1/0;for(const[O,P]of Object.entries(v))m[O]<=T&&(T=m[O],k=P);for(;Object.keys(v).length>0&&_>0;){const O=w.minId(!1);if(O)k=v[O];else break;const P=fi(k);if(E.includes(P))return N4(k,g,c,a,d,h,o);delete v[P],w.remove(P),p[P]=!0;for(const N of Object.values(s.directionMap)){const C=qt(k,[N.stepX,N.stepY]),L=fi(C);if(p[L])continue;const B=YA(k,C,g,c);if(B>s.maxAllowedDirectionChange||u[L])continue;v[L]||(v[L]=C);const G=s.penalties[B],V=s.distFunc(k,C)+(isNaN(G)?o:G),U=y[P]+V,$=y[L];$&&U>=$||(g[L]=k,y[L]=U,m[L]=U+Iw(C,f,s.distFunc),w.add({id:L,value:m[L]}))}_-=1}return[]}class R4{constructor(){this.arr=[],this.map={},this.arr=[],this.map={}}_innerAdd(t,e){let n=0,i=e-1;for(;i-n>1;){const a=Math.floor((n+i)/2);if(this.arr[a].value>t.value)i=a;else if(this.arr[a].value<t.value)n=a;else{this.arr.splice(a,0,t),this.map[t.id]=!0;return}}this.arr.splice(i,0,t),this.map[t.id]=!0}add(t){delete this.map[t.id];const e=this.arr.length;if(!e||this.arr[e-1].value<t.value){this.arr.push(t),this.map[t.id]=!0;return}this._innerAdd(t,e)}remove(t){this.map[t]&&delete this.map[t]}_clearAndGetMinId(){let t;for(let e=this.arr.length-1;e>=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t}_findFirstId(){for(;this.arr.length;){const t=this.arr.shift();if(this.map[t.id])return t.id}}minId(t){return t?this._clearAndGetMinId():this._findFirstId()}}class Tc extends ua{constructor(t){super(gn({style:Tc.defaultStyleProps},t))}getControlPoints(t){const{router:e}=t,{sourceNode:n,targetNode:i}=this,[a,s]=this.getEndpoints(t,!1);let o=[];if(!e)o=t.controlPoints;else if(e.type==="shortest-path"){const l=this.context.element.getNodes();o=C4(n,i,l,e),o.length||(o=Aw(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=Aw(a,s,n,i,t.controlPoints,e));return o}getPoints(t){const e=this.getControlPoints(t),[n,i]=this.getEndpoints(t,!0,e);return[n,...e,i]}getKeyPath(t){const e=this.getPoints(t);return y1(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=Gi(a),o=Math.max(oi(s),li(s))/4,{placement:l,clockwise:u,dist:c=o}=Ke(this.getGraphicStyle(t),"loop");return y4(a,i,l,u,c,e,n)}}Tc.defaultStyleProps={radius:0,controlPoints:[],router:!1};class nl extends ua{constructor(t){super(gn({style:nl.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||dm(i,a,e,n);return d4(i,a,s)}}nl.defaultStyleProps={curvePosition:.5,curveOffset:30};var L4=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};function rl(r){return r instanceof Fr&&r.type==="node"}function HA(r){return r instanceof ua}function m1(r){return r instanceof Is}function I4(r){return rl(r)||HA(r)||m1(r)}function D4(r,t){return!r||!t?!1:r===t}const B4={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],default:[.5,.5]};function b1(r,t,e=B4,n=!0){const i=[.5,.5],a=ee(t)?Rn(e,t.toLocaleLowerCase(),i):t;if(!n&&ee(t))return a;const[s,o]=a||i;return[r.min[0]+oi(r)*s,r.min[1]+li(r)*o]}function w1(r){if(!r)return{};const t=r.getPorts();return(r.attributes.ports||[]).forEach((n,i)=>{var a;const{key:s,placement:o}=n;XA(n)&&(t[a=s||i]||(t[a]=pi(r.getShape("key").getBounds(),o)))}),t}function XA(r){const{r:t}=r;return!t||Number(t)===0}function ra(r){return As(r)?r:r.getPosition()}function F4(r,t,e,n){const i=Bw(r,t,e,n),a=Bw(t,r,n,e);return[i,a]}function Bw(r,t,e,n){const i=w1(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(u=>ra(u)),o=z4(t,n),[l]=zF(s,o);return a.find(u=>ra(u)===l)}function z4(r,t){const e=w1(r);if(t)return[ra(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>ra(i)):[r.getCenter()]}function Fw(r,t){return m1(r)||rl(r)?gm(r,t):Io(r,t)}function Io(r,t){if(!r||!t)return[0,0,0];if(As(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=As(t)?t:rl(t)?t.getCenter():t.getPosition();return mc(e,r.getBounds())}function gm(r,t){if(!r||!t)return[0,0,0];const e=As(t)?t:rl(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function zw(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=pi(r,t),l=a.includes("left")?"right":a.includes("right")?"left":"center";let u=a.includes("top")?"bottom":a.includes("bottom")?"top":"middle";return i&&(u=u==="top"?"bottom":u==="bottom"?"top":u),{transform:[["translate",s+e,o+n]],textBaseline:u,textAlign:l}}function j4(r,t){return[[0,-r],[t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)],[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[0,t],[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[-t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[-t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)]]}function q4(r,t){const e={};return e.top=[0,-r],e.left=[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e["left-bottom"]=[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.bottom=[0,t],e["right-bottom"]=[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.right=e.default=[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e}function $4(r,t,e){const n=t/2,i=r/2,a={up:[[-i,n],[i,n],[0,-n]],left:[[-i,0],[i,n],[i,-n]],right:[[-i,n],[-i,-n],[i,0]],down:[[-i,-n],[i,-n],[0,n]]};return a[e]||a.up}function G4(r,t,e){const n=t/2,i=r/2,a={};return e==="down"?(a.bottom=a.default=[0,n],a.right=[i,-n],a.left=[-i,-n]):e==="left"?(a.top=[i,-n],a.bottom=[i,n],a.left=a.default=[-i,0]):e==="right"?(a.top=[-i,-n],a.bottom=[-i,n],a.right=a.default=[i,0]):(a.left=[-i,n],a.top=a.default=[0,-n],a.right=[i,n]),a}function W4(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function V4(r){return Rn(r,["style","visibility"])!=="hidden"}function U4(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:l}=t,u=L4(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,u),n&&r.setAttribute("transform",n),St(e)&&r.setAttribute("zIndex",e),i&&r.setAttribute("transformOrigin",i),a&&r.setAttribute("visibility",a),s&&r.setAttribute("cursor",s),o&&r.setAttribute("clipPath",o),l&&r.setAttribute("component",l)}function vm(r,t){"update"in r?r.update(t):r.attr(t)}function Y4(r){return[[0,r],[r*Math.sqrt(3)/2,r/2],[r*Math.sqrt(3)/2,-r/2],[0,-r],[-r*Math.sqrt(3)/2,-r/2],[-r*Math.sqrt(3)/2,r/2]]}function H4(r){Oo(r,"__to_be_destroyed__",!0)}function Ac(r){return Rn(r,"__to_be_destroyed__",!1)}var X4=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Pc extends ur{constructor(t,e){super(t,Object.assign({},Pc.defaultOptions,e)),this.onCollapseExpand=n=>X4(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!I4(i))return;const a=i.id,{model:s,graph:o}=this.context,l=s.getElementDataById(a);if(!l)return!1;const{onCollapse:u,onExpand:c,animation:h,align:d}=this.options;Yn(l)?(yield o.expandElement(a,{animation:h,align:d}),c==null||c(a)):(yield o.collapseElement(a,{animation:h,align:d}),u==null||u(a))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Pc.defaultOptions={enable:!0,animation:!0,trigger:it.DBLCLICK,align:!0};var nu=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const K4="g6-create-edge-assist-edge-id",ru="g6-create-edge-assist-node-id";class Nc extends ur{constructor(t,e){super(t,Object.assign({},Nc.defaultOptions,e)),this.drop=n=>nu(this,void 0,void 0,function*(){const{targetType:i}=n;["combo","node"].includes(i)&&this.source?yield this.handleCreateEdge(n):yield this.cancelEdge()}),this.handleCreateEdge=n=>nu(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:l,batch:u,element:c}=this.context,{style:h}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}u.startBatch(),l.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const d=o.getElementData(this.source);o.addNodeData([{id:ru,style:{visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:(i=d.style)===null||i===void 0?void 0:i.x,y:(a=d.style)===null||a===void 0?void 0:a.y}}]),o.addEdgeData([{id:K4,source:this.source,target:ru,style:Object.assign({pointerEvents:"none"},h)}]),yield(s=c.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>nu(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(ru,[n.canvas.x,n.canvas.y]),yield(i=s.draw({animation:!1,silence:!0}))===null||i===void 0?void 0:i.finished}),this.createEdge=n=>{var i,a;const{graph:s}=this.context,{style:o,onFinish:l,onCreate:u}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const h=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],d=`${this.source}-${h}-${R3()}`,f=u({id:d,source:this.source,target:h,style:o});s.addEdgeData([f]),l(f)},this.cancelEdge=()=>nu(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([ru]),this.source=void 0,yield(n=a.draw({animation:!1}))===null||n===void 0?void 0:n.finished,s.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;this.unbindEvents(),e==="click"?(t.on(wr.CLICK,this.handleCreateEdge),t.on(Sa.CLICK,this.handleCreateEdge),t.on(Si.CLICK,this.cancelEdge),t.on(Vu.CLICK,this.cancelEdge)):(t.on(wr.DRAG_START,this.handleCreateEdge),t.on(Sa.DRAG_START,this.handleCreateEdge),t.on(it.POINTER_UP,this.drop)),t.on(it.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(wr.CLICK,this.handleCreateEdge),t.off(Sa.CLICK,this.handleCreateEdge),t.off(Si.CLICK,this.cancelEdge),t.off(Vu.CLICK,this.cancelEdge),t.off(wr.DRAG_START,this.handleCreateEdge),t.off(Sa.DRAG_START,this.handleCreateEdge),t.off(it.POINTER_UP,this.drop),t.off(it.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}Nc.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};var jw=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Cc extends ur{constructor(t,e){super(t,Object.assign({},Cc.defaultOptions,e)),this.isDragging=!1,this.onDragStart=n=>{this.validate(n)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=n=>{var i,a,s,o;if(!this.isDragging)return;const l=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,u=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;l|u&&this.translate([l,u],!1)},this.onDragEnd=()=>{var n,i;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},this.invokeOnFinish=Wo(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new Rs(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(Ve(t)){const{up:e=[],down:n=[],left:i=[],right:a=[]}=t;this.shortcut.bind(e,s=>this.onTranslate([0,1],s)),this.shortcut.bind(n,s=>this.onTranslate([0,-1],s)),this.shortcut.bind(i,s=>this.onTranslate([1,0],s)),this.shortcut.bind(a,s=>this.onTranslate([-1,0],s))}else{const{graph:e}=this.context;e.on(it.DRAG_START,this.onDragStart),e.on(it.DRAG,this.onDrag),e.on(it.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return jw(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(vi(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return jw(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),yield this.context.graph.translateBy(t,e)})}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=si(this.options.range),h=[s*o,a*l,s*u,a*c],d=oa(a1(n.getCanvasCenter()),h),f=oe(n.getViewportCenter(),[t,e,0]);if(!Ir(f,d)){const{min:[v,p],max:[g,y]}=d;(f[0]<v&&t>0||f[0]>g&&t<0)&&(t=0),(f[1]<p&&e>0||f[1]>y&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return typeof e=="function"?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:t}=this.context;t.off(it.DRAG_START,this.onDragStart),t.off(it.DRAG,this.onDrag),t.off(it.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}Cc.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var qw=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class il extends ur{constructor(t,e){super(t,Object.assign({},il.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>qw(this,void 0,void 0,function*(){var i;if(this.options.dropEffect!=="link")return;const{model:a,element:s}=this.context,o=n.target.id;this.target.forEach(l=>{const u=a.getParentData(l,le);u&&J(u)===o&&a.refreshComboData(o),a.setParent(l,o,le)}),yield(i=s==null?void 0:s.draw({animation:!0}))===null||i===void 0?void 0:i.finished}),this.setCursor=n=>{if(this.isDragging)return;const{type:i}=n,{canvas:a}=this.context,{cursor:s}=this.options;i===it.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.addEventListener("blur",this.onDragEnd),n.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.on(`${i}:${it.DRAG_START}`,this.onDragStart),t.on(`${i}:${it.DRAG}`,this.onDrag),t.on(`${i}:${it.DRAG_END}`,this.onDragEnd),t.on(`${i}:${it.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${it.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(Sa.DROP,this.onDrop),t.on(Si.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return Dr([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:i,graph:a}=this.context;i.setCursor(((e=this.options.cursor)===null||e===void 0?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const s=t.target.id;a.getElementState(s).includes(this.options.state)?this.target=this.getSelectedNodeIDs([s]):this.target=[s],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:s=0,y:o=0}=this.shadow.attributes,[l,u]=oe([+s,+o],this.shadowOrigin);this.moveElement(this.target,[l,u])}this.showEdges(),(e=(t=this.options).onFinish)===null||e===void 0||e.call(t,this.target);const{batch:i,canvas:a}=this.context;i.endBatch(),a.setCursor(((n=this.options.cursor)===null||n===void 0?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}moveElement(t,e){return qw(this,void 0,void 0,function*(){const{graph:n,model:i}=this.context,{dropEffect:a}=this.options;a==="move"&&t.forEach(s=>i.refreshComboData(s)),n.translateElementBy(Object.fromEntries(t.map(s=>[s,e])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[i,a]=t;this.shadow.attr({x:+e+i,y:+n+a})}createShadow(t){const e=Ke(this.options,"shadow"),n=Zo(t.map(u=>this.context.element.getElement(u).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=sa(n),l={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),l),{visibility:"visible"})):(this.shadow=new xn({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),l),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||this.hiddenEdges.length===0||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if(t==="none"||e)return;const{graph:n}=this.context;t==="all"?this.hiddenEdges=n.getEdgeData().map(J):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(J)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.removeEventListener("blur",this.onDragEnd),n.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.off(`${i}:${it.DRAG_START}`,this.onDragStart),t.off(`${i}:${it.DRAG}`,this.onDrag),t.off(`${i}:${it.DRAG_END}`,this.onDragEnd),t.off(`${i}:${it.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${it.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${it.DROP}`,this.onDrop),t.off(`canvas:${it.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}il.defaultOptions={animation:!0,enable:r=>["node","combo"].includes(r.targetType),dropEffect:"move",state:"selected",hideEdge:"none",shadow:!1,shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5],cursor:{default:"default",grab:"grab",grabbing:"grabbing"}};var Z4="*",Rc=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]||[],s=this._events[Z4]||[],o=function(l){for(var u=l.length,c=0;c<u;c++)if(l[c]){var h=l[c],d=h.callback,f=h.once;f&&(l.splice(c,1),l.length===0&&delete e._events[t],u--,c--),d.apply(e,n)}};o(a),o(s)},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}();function pm(r,t,e,n){for(;r.length;){const i=r.shift();if(e(i))return!0;t.add(i.id),n(i.id).forEach(s=>{t.has(s.id)||(t.add(s.id),r.push(s))})}return!1}function Qu(r,t,e,n){if(e(r))return!0;t.add(r.id);for(const a of n(r.id))if(!t.has(a.id)&&Qu(a,t,e,n))return!0;return!1}const $w=()=>!0;class J4{constructor(t){he(this,"graph");he(this,"nodeFilter");he(this,"edgeFilter");he(this,"cacheEnabled");he(this,"inEdgesMap",new Map);he(this,"outEdgesMap",new Map);he(this,"bothEdgesMap",new Map);he(this,"allNodesMap",new Map);he(this,"allEdgesMap",new Map);he(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});he(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});he(this,"updateCache",t=>{const e=new Set;t.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(a=>e.add(a.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const a=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),s=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...a,...s]));o.forEach(l=>e.add(l.id)),this.inEdgesMap.set(n,a),this.outEdgesMap.set(n,s),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),e.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});he(this,"handleGraphChanged",t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":(n.propertyName==="source"||n.propertyName==="target")&&(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const i=t.graph.getEdge(n.id);e.add(i.source),e.add(i.target)}break;case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"NodeRemoved":e.add(n.value.id);break}}),this.updateCache(e)});this.graph=t.graph;const e=t.nodeFilter||$w,n=t.edgeFilter||$w;this.nodeFilter=e,this.edgeFilter=i=>{const{source:a,target:s}=this.graph.getEdgeDetail(i.id);return!e(a)||!e(s)?!1:n(i,a,s)},t.cache==="auto"?(this.cacheEnabled=!0,this.startAutoCache()):t.cache==="manual"?this.cacheEnabled=!0:this.cacheEnabled=!1}startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some(n=>n.id===t)}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?e==="in"?this.inEdgesMap.get(t):e==="out"?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const n=this.getRelatedEdges(t,"out").map(i=>this.getNode(i.target));return Array.from(new Set(n))}getPredecessors(t){const n=this.getRelatedEdges(t,"in").map(i=>this.getNode(i.source));return Array.from(new Set(n))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return!n||!this.nodeFilter(n)?null:n}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];pm([this.getNode(t)],new Set,e,i)}dfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];Qu(this.getNode(t),new Set,e,i)}}let ln=class KA extends Rc{constructor(e){super();he(this,"nodeMap",new Map);he(this,"edgeMap",new Map);he(this,"inEdgesMap",new Map);he(this,"outEdgesMap",new Map);he(this,"bothEdgesMap",new Map);he(this,"treeIndices",new Map);he(this,"changes",[]);he(this,"batchCount",0);he(this,"onChanged",()=>{});he(this,"batch",e=>{this.batchCount+=1,e(),this.batchCount-=1,this.batchCount||this.commit()});e&&(e.nodes&&this.addNodes(e.nodes),e.edges&&this.addEdges(e.edges),e.tree&&this.addTree(e.tree),e.onChanged&&(this.onChanged=e.onChanged))}commit(){const e=this.changes;this.changes=[];const n={graph:this,changes:e};this.emit("changed",n),this.onChanged(n)}reduceChanges(e){let n=[];return e.forEach(i=>{switch(i.type){case"NodeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="NodeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else{if(s.type==="NodeDataUpdated")return s.id!==i.value.id;if(s.type==="TreeStructureChanged")return s.nodeId!==i.value.id}return!0}),a||n.push(i);break}case"EdgeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="EdgeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else if(s.type==="EdgeDataUpdated"||s.type==="EdgeUpdated")return s.id!==i.value.id;return!0}),a||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const a=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),s=n[a];s?i.propertyName!==void 0?s.newValue=i.newValue:(n.splice(a,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(a=>a.type==="TreeStructureAttached"||a.type==="TreeStructureChanged"?a.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const a=n.find(s=>s.type==="TreeStructureChanged"&&s.treeKey===i.treeKey&&s.nodeId===i.nodeId);a?a.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(e){this.getNode(e)}hasNode(e){return this.nodeMap.has(e)}areNeighbors(e,n){return this.getNeighbors(n).some(i=>i.id===e)}getNode(e){const n=this.nodeMap.get(e);if(!n)throw new Error("Node not found for id: "+e);return n}getRelatedEdges(e,n){if(this.checkNodeExistence(e),n==="in"){const i=this.inEdgesMap.get(e);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(e);return Array.from(i)}else{const i=this.bothEdgesMap.get(e);return Array.from(i)}}getDegree(e,n){return this.getRelatedEdges(e,n).length}getSuccessors(e){const i=this.getRelatedEdges(e,"out").map(a=>this.getNode(a.target));return Array.from(new Set(i))}getPredecessors(e){const i=this.getRelatedEdges(e,"in").map(a=>this.getNode(a.source));return Array.from(new Set(i))}getNeighbors(e){const n=this.getPredecessors(e),i=this.getSuccessors(e);return Array.from(new Set([...n,...i]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(n=>{n.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const n of e)this.doAddNode(n)})}addNode(e){this.addNodes([e])}doRemoveNode(e){const n=this.getNode(e),i=this.bothEdgesMap.get(e);i==null||i.forEach(a=>this.doRemoveEdge(a.id)),this.nodeMap.delete(e),this.treeIndices.forEach(a=>{var o,l;(o=a.childrenMap.get(e))==null||o.forEach(u=>{a.parentMap.delete(u.id)});const s=a.parentMap.get(e);s&&((l=a.childrenMap.get(s.id))==null||l.delete(n)),a.parentMap.delete(e),a.childrenMap.delete(e)}),this.bothEdgesMap.delete(e),this.inEdgesMap.delete(e),this.outEdgesMap.delete(e),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(e){this.batch(()=>{e.forEach(n=>this.doRemoveNode(n))})}removeNode(e){this.removeNodes([e])}updateNodeDataProperty(e,n,i){const a=this.getNode(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}mergeNodeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateNodeDataProperty(e,i,a)})})}updateNodeData(...e){const n=e[0],i=this.getNode(n);if(typeof e[1]=="string"){this.updateNodeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:s,newValue:o})})}checkEdgeExistence(e){if(!this.hasEdge(e))throw new Error("Edge not found for id: "+e)}hasEdge(e){return this.edgeMap.has(e)}getEdge(e){return this.checkEdgeExistence(e),this.edgeMap.get(e)}getEdgeDetail(e){const n=this.getEdge(e);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.target)}}doAddEdge(e){if(this.hasEdge(e.id))throw new Error("Edge already exists: "+e.id);this.checkNodeExistence(e.source),this.checkNodeExistence(e.target),this.edgeMap.set(e.id,e);const n=this.inEdgesMap.get(e.target),i=this.outEdgesMap.get(e.source),a=this.bothEdgesMap.get(e.source),s=this.bothEdgesMap.get(e.target);n.add(e),i.add(e),a.add(e),s.add(e),this.changes.push({type:"EdgeAdded",value:e})}addEdges(e){this.batch(()=>{for(const n of e)this.doAddEdge(n)})}addEdge(e){this.addEdges([e])}doRemoveEdge(e){const n=this.getEdge(e),i=this.outEdgesMap.get(n.source),a=this.inEdgesMap.get(n.target),s=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),a.delete(n),s.delete(n),o.delete(n),this.edgeMap.delete(e),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(e){this.batch(()=>{e.forEach(n=>this.doRemoveEdge(n))})}removeEdge(e){this.removeEdges([e])}updateEdgeSource(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.source,s=n;this.outEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.outEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"source",oldValue:a,newValue:s})})}updateEdgeTarget(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.target,s=n;this.inEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.inEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"target",oldValue:a,newValue:s})})}updateEdgeDataProperty(e,n,i){const a=this.getEdge(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}updateEdgeData(...e){const n=e[0],i=this.getEdge(n);if(typeof e[1]=="string"){this.updateEdgeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:s,newValue:o})})}mergeEdgeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateEdgeDataProperty(e,i,a)})})}checkTreeExistence(e){if(!this.hasTreeStructure(e))throw new Error("Tree structure not found for treeKey: "+e)}hasTreeStructure(e){return this.treeIndices.has(e)}attachTreeStructure(e){this.treeIndices.has(e)||(this.treeIndices.set(e,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:e})}))}detachTreeStructure(e){this.checkTreeExistence(e),this.treeIndices.delete(e),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:e})})}addTree(e,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],a=Array.isArray(e)?e:[e];for(;a.length;){const s=a.shift();i.push(s),s.children&&a.push(...s.children)}this.addNodes(i),i.forEach(s=>{var o;(o=s.children)==null||o.forEach(l=>{this.setParent(l.id,s.id,n)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(n=>!this.getParent(n.id,e))}getChildren(e,n){this.checkNodeExistence(e),this.checkTreeExistence(n);const a=this.treeIndices.get(n).childrenMap.get(e);return Array.from(a||[])}getParent(e,n){return this.checkNodeExistence(e),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(e)||null}getAncestors(e,n){const i=[];let a=this.getNode(e),s;for(;s=this.getParent(a.id,n);)i.push(s),a=s;return i}setParent(e,n,i){var c,h;this.checkTreeExistence(i);const a=this.treeIndices.get(i);if(!a)return;const s=this.getNode(e),o=a.parentMap.get(e);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((c=a.childrenMap.get(o.id))==null||c.delete(s)),a.parentMap.delete(e);return}const l=this.getNode(n);a.parentMap.set(e,l),o&&((h=a.childrenMap.get(o.id))==null||h.delete(s));let u=a.childrenMap.get(l.id);u||(u=new Set,a.childrenMap.set(l.id,u)),u.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:l.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Qu(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return pm([this.getNode(e)],new Set,n,a)}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return pm([this.getNode(e)],new Set,n,a)}dfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return Qu(this.getNode(e),new Set,n,a)}clone(){const e=this.getAllNodes().map(a=>({...a,data:{...a.data}})),n=this.getAllEdges().map(a=>({...a,data:{...a.data}})),i=new KA({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const l=new Map;a.forEach((c,h)=>{l.set(h,i.getNode(c.id))});const u=new Map;s.forEach((c,h)=>{u.set(h,new Set(Array.from(c).map(d=>i.getNode(d.id))))}),i.treeIndices.set(o,{parentMap:l,childrenMap:u})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new J4({graph:this,...e})}};class Lc{constructor(t,e){this.context=t,this.options=e||{}}}var Q4=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},tz=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};function ez(r){const{type:t}=r;return["compact-box","mindmap","dendrogram","indented"].includes(t)}function nz(r){return!Array.isArray(r)&&(r==null?void 0:r.preLayout)}function xu(r){const{nodes:t,edges:e}=r,n={nodes:[],edges:[],combos:[]};return t.forEach(i=>{const a=i.data._isCombo?n.combos:n.nodes,{x:s,y:o,z:l=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:l}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:l=[],controlPoints:u=l.slice(1,l.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},u!=null&&u.length?{controlPoints:u.map(bn)}:{})})}),n}function rz(r,t){class e extends Lc{constructor(i,a){if(super(i,a),this.instance=new r({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const s=this.instance;this.stop=s.stop.bind(s),this.tick=o=>{const l=s.tick(o);return xu(l)}}}execute(i,a){return Q4(this,void 0,void 0,function*(){return xu(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(Bn({},this.options,a))))})}transformOptions(i){const{onTick:a}=i;return a&&(i.onTick=s=>a(xu(s))),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,l=a.map(f=>{const v=J(f),{data:p,style:g,combo:y}=f,m=tz(f,["data","style","combo"]),w={id:v,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},p),{data:p}),y?{parentId:y}:{}),{style:g}),m)};return g!=null&&g.x&&Object.assign(w.data,{x:g.x}),g!=null&&g.y&&Object.assign(w.data,{y:g.y}),g!=null&&g.z&&Object.assign(w.data,{z:g.z}),w}),u=new Map(l.map(f=>[f.id,f])),c=s.filter(f=>{const{source:v,target:p}=f;return u.has(v)&&u.has(p)}).map(f=>{const{source:v,target:p,data:g,style:y}=f;return{id:J(f),source:v,target:p,data:Object.assign({},g),style:Object.assign({},y)}}),h=o.map(f=>({id:J(f),data:Object.assign({_isCombo:!0},f.data),style:Object.assign({},f.style)})),d=new ln({nodes:[...l,...h],edges:c});return t.model.model.hasTreeStructure(le)&&(d.attachTreeStructure(le),l.forEach(f=>{const v=t.model.model.getParent(f.id,le);v&&d.hasNode(v.id)&&d.setParent(f.id,v.id,le)})),d}}return e}function Ed(r,t,...e){if(t in r)return r[t](...e);if("instance"in r){const n=r.instance;if(t in n)return n[t](...e)}return null}function Gw(r,t){if(t in r)return r[t];if("instance"in r){const e=r.instance;if(t in e)return e[t]}return null}var iz=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class az extends il{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find(t=>["d3-force","d3-force-3d"].includes(t==null?void 0:t.id))}validate(t){return this.context.layout?this.forceLayoutInstance?super.validate(t):(ai.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return iz(this,void 0,void 0,function*(){const n=this.forceLayoutInstance;this.context.graph.getNodeData(t).forEach((i,a)=>{const{x:s=0,y:o=0}=i.style||{};n&&Ed(n,"setFixedPosition",t[a],[...qt([+s,+o],e)])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&Gw(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&Ed(e,"setFixedPosition",J(n),[+i,+a])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&Gw(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&Ed(t,"setFixedPosition",J(e),[null,null,null])})}}var Ww=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Ic extends ur{constructor(t,e){super(t,Object.assign({},Ic.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>Ww(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:l}=this.options,u=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),c=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),h=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(l),d=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,f=[...u,...h];f.length>0&&f.forEach(v=>this.fixNodeLike(v,d)),this.updateRelatedEdges(),c.length>0&&c.forEach(v=>this.fixEdge(v,d))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],l=((s=o.find(u=>u.shape===i))===null||s===void 0?void 0:s.style)||{};return a in l||(l[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(u=>u.shape!==i),{shape:i,style:l}])),l[a]},this.scaleEntireElement=(n,i,a)=>{i.setLocalScale(1/a);const s=this.cachedStyles.get(n)||[];s.push({shape:i}),this.cachedStyles.set(n,s)},this.scaleSpecificShapes=(n,i,a)=>{const s=i5(n);(Array.isArray(a)?a:[a]).forEach(l=>{const{shape:u,fields:c}=l,h=typeof u=="function"?u(s):n.getShape(u);if(h){if(!c){this.scaleEntireElement(n.id,h,i);return}c.forEach(d=>{const f=this.getOriginalFieldValue(n.id,h,d);St(f)&&(h.style[d]=f/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=J(n),{element:s,model:o}=this.context,l=s.getElement(a);if(!l||this.skipIfExceedViewport(l))return;o.getRelatedEdgesData(a).forEach(h=>this.relatedEdgeToUpdate.add(J(h)));const c=this.options[l.type];if(!c){this.scaleEntireElement(a,l,i);return}this.scaleSpecificShapes(l,i,c)},this.fixEdge=(n,i)=>{const a=J(n),s=this.context.element.getElement(a);if(!s||this.skipIfExceedViewport(s))return;const o=this.options.edge;if(!o){s.style.transformOrigin="center",this.scaleEntireElement(a,s,i);return}this.scaleSpecificShapes(s,i,o)},this.updateRelatedEdges=()=>{const{element:n}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(i=>{const a=n.getElement(i);a==null||a.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=n=>Ww(this,void 0,void 0,function*(){var i;!((i=n.data)===null||i===void 0)&&i.firstRender||(this.options.reset?this.restoreCachedStyles():this.fixElementSize({data:{scale:this.zoom}}))}),this.bindEvents()}restoreCachedStyles(){if(this.cachedStyles.size>0){this.cachedStyles.forEach(i=>{i.forEach(({shape:a,style:s})=>{if(Kr(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,l])=>a.style[o]=l)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(i=>i&&t.getElementType(i)==="node");if(n.length>0){const i=new Set;n.forEach(a=>{t.getRelatedEdgesData(a).forEach(s=>i.add(J(s)))}),i.forEach(a=>{const s=e==null?void 0:e.getElement(a);s==null||s.update({})})}}}bindEvents(){const{graph:t}=this.context;t.on(pt.AFTER_DRAW,this.resetTransform),t.on(pt.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(pt.AFTER_DRAW,this.resetTransform),t.off(pt.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Ic.defaultOptions={enable:r=>r.data.scale<1,nodeFilter:()=>!0,edgeFilter:()=>!0,comboFilter:()=>!0,edge:[{shape:"key",fields:["lineWidth"]},{shape:"halo",fields:["lineWidth"]},{shape:"label"}],reset:!1};var sz=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Dc extends ur{constructor(t,e){super(t,Object.assign({},Dc.defaultOptions,e)),this.focus=n=>sz(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context;yield i.focusElement(n.target.id,this.options.animation)}),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),za.forEach(e=>{t.on(`${e}:${it.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;za.forEach(e=>{t.off(`${e}:${it.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}Dc.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class Bc extends ur{constructor(t,e){super(t,Object.assign({},Bc.defaultOptions,e)),this.isFrozen=!1,this.toggleFrozen=n=>{this.isFrozen=n.type==="dragstart"},this.hoverElement=n=>{if(!this.validate(n))return;const i=n.type===it.POINTER_ENTER;this.updateElementsState(n,i);const{onHover:a,onHoverEnd:s}=this.options;i?a==null||a(n):s==null||s(n)},this.updateElementsState=(n,i)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:a}=this.context,{state:s,animation:o,inactiveState:l}=this.options,u=this.getActiveIds(n),c={};if(s&&Object.assign(c,this.getElementsState(u,s,i)),l){const h=cA(a.getData(),!0).filter(d=>!u.includes(d));Object.assign(c,this.getElementsState(h,l,i))}a.setElementState(c,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(l=>{const u=s.getElementState(l);a?o[l]=u.includes(i)?u:[...u,i]:o[l]=u.filter(c=>c!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),za.forEach(n=>{t.on(`${n}:${it.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${it.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${it.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${it.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?xA(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||Ac(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;za.forEach(n=>{t.off(`${n}:${it.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${it.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${it.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${it.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}Bc.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class oz extends Jo{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e}=this.context;this.pathShape=new rr({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[Hu(t)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(Hu(t)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",QF(this.points)),n&&i==="default"&&this.points.length>2&&super.updateElementsStates(this.points)}onPointerUp(){if(this.points){if(this.points.length<2){this.clearLasso();return}super.updateElementsStates(this.points),this.clearLasso()}}clearLasso(){var t;(t=this.pathShape)===null||t===void 0||t.remove(),this.pathShape=void 0,this.points=void 0}}class Fc extends ur{constructor(t,e){super(t,Object.assign({},Fc.defaultOptions,e)),this.hiddenShapes=[],this.isVisible=!0,this.setElementsVisibility=(n,i,a)=>{n.filter(Boolean).forEach(s=>{i==="hidden"&&!s.isVisible()?this.hiddenShapes.push(s):i==="visible"&&this.hiddenShapes.includes(s)?this.hiddenShapes.splice(this.hiddenShapes.indexOf(s),1):Ba(s,i,a)})},this.filterShapes=(n,i)=>{if(Ot(i))return s=>!i(n,s);const a=i==null?void 0:i[n];return s=>s.className?!(a!=null&&a.includes(s.className)):!0},this.hideShapes=n=>{if(!this.validate(n)||!this.isVisible)return;const{element:i}=this.context,{shapes:a={}}=this.options;this.setElementsVisibility(i.getNodes(),"hidden",this.filterShapes("node",a)),this.setElementsVisibility(i.getEdges(),"hidden",this.filterShapes("edge",a)),this.setElementsVisibility(i.getCombos(),"hidden",this.filterShapes("combo",a)),this.isVisible=!1},this.showShapes=Wo(n=>{if(!this.validate(n)||this.isVisible)return;const{element:i}=this.context;this.setElementsVisibility(i.getNodes(),"visible"),this.setElementsVisibility(i.getEdges(),"visible"),this.setElementsVisibility(i.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(pt.BEFORE_TRANSFORM,this.hideShapes),t.on(pt.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(pt.BEFORE_TRANSFORM,this.hideShapes),t.off(pt.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Fc.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};var Vw=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class zc extends ur{constructor(t,e){super(t,Object.assign({},zc.defaultOptions,e)),this.onWheel=n=>Vw(this,void 0,void 0,function*(){this.options.preventDefault&&n.preventDefault();const i=n.deltaX,a=n.deltaY;yield this.scroll([-i,-a],n)}),this.shortcut=new Rs(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),Ve(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(it.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,l=>this.scroll([0,-10],l)),this.shortcut.bind(a,l=>this.scroll([0,10],l)),this.shortcut.bind(s,l=>this.scroll([-10,0],l)),this.shortcut.bind(o,l=>this.scroll([10,0],l))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(it.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=vi(t,e),t=this.clampByDirection(t),t=this.clampByRange(t),t}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=si(this.options.range),h=[s*o,a*l,s*u,a*c],d=oa(a1(n.getCanvasCenter()),h),f=oe(n.getViewportCenter(),[t,e,0]);if(!Ir(f,d)){const{min:[v,p],max:[g,y]}=d;(f[0]<v&&t>0||f[0]>g&&t<0)&&(t=0),(f[1]<p&&e>0||f[1]>y&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return Vw(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,i=this.context.graph,a=this.formatDisplacement(t);yield i.translateBy(a,!1),n==null||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(it.WHEEL,this.onWheel),super.destroy()}}zc.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var Uw=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class jc extends ur{constructor(t,e){super(t,Object.assign({},jc.defaultOptions,e)),this.zoom=(n,i,a)=>Uw(this,void 0,void 0,function*(){if(!this.validate(i))return;const{graph:s}=this.context;let o;"viewport"in i&&(o=bn(i.viewport));const{sensitivity:l,onFinish:u}=this.options,c=1+De(n,-50,50)*l/100,h=s.getZoom();yield s.zoomTo(h*c,a,o),u==null||u()}),this.onReset=()=>Uw(this,void 0,void 0,function*(){yield this.context.graph.zoomTo(1,this.options.animation)}),this.preventDefault=n=>{this.options.preventDefault&&n.preventDefault()},this.shortcut=new Rs(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(this.shortcut.unbindAll(),Array.isArray(t))if(t.includes(it.PINCH))this.shortcut.bind([it.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(it.WHEEL,this.preventDefault),this.shortcut.bind([...t,it.WHEEL],n=>{const{deltaX:i,deltaY:a}=n;this.zoom(-(a!=null?a:i),n,!1)})}if(typeof t=="object"){const{zoomIn:e=[],zoomOut:n=[],reset:i=[]}=t;this.shortcut.bind(e,a=>this.zoom(10,a,this.options.animation)),this.shortcut.bind(n,a=>this.zoom(-10,a,this.options.animation)),this.shortcut.bind(i,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Ot(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(it.WHEEL,this.preventDefault),super.destroy()}}jc.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};var Sd,Yw;function ca(){if(Yw)return Sd;Yw=1;function r(t,e,n,i){return i===void 0&&(i="height"),n==="center"?(t[i]+e[i])/2:t.height}return Sd={assign:Object.assign,getHeight:r},Sd}var _d,Hw;function ZA(){if(Hw)return _d;Hw=1;var r=ca(),t=18,e=t*2,n=t,i={getId:function(l){return l.id||l.name},getPreH:function(l){return l.preH||0},getPreV:function(l){return l.preV||0},getHGap:function(l){return l.hgap||n},getVGap:function(l){return l.vgap||n},getChildren:function(l){return l.children},getHeight:function(l){return l.height||e},getWidth:function(l){var u=l.label||" ";return l.width||u.split("").length*t}};function a(o,l){var u=this;if(u.vgap=u.hgap=0,o instanceof a)return o;u.data=o;var c=l.getHGap(o),h=l.getVGap(o);return u.preH=l.getPreH(o),u.preV=l.getPreV(o),u.width=l.getWidth(o),u.height=l.getHeight(o),u.width+=u.preH,u.height+=u.preV,u.id=l.getId(o),u.x=u.y=0,u.depth=0,u.children||(u.children=[]),u.addGap(c,h),u}r.assign(a.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(l,u){var c=this;c.hgap+=l,c.vgap+=u,c.width+=2*l,c.height+=2*u},eachNode:function(l){for(var u=this,c=[u],h;h=c.shift();)l(h),c=h.children.concat(c)},DFTraverse:function(l){this.eachNode(l)},BFTraverse:function(l){for(var u=this,c=[u],h;h=c.shift();)l(h),c=c.concat(h.children)},getBoundingBox:function(){var l={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(u){l.left=Math.min(l.left,u.x),l.top=Math.min(l.top,u.y),l.width=Math.max(l.width,u.x+u.width),l.height=Math.max(l.height,u.y+u.height)}),l},translate:function(l,u){l===void 0&&(l=0),u===void 0&&(u=0),this.eachNode(function(c){c.x+=l,c.y+=u,c.x+=c.preH,c.y+=c.preV})},right2left:function(){var l=this,u=l.getBoundingBox();l.eachNode(function(c){c.x=c.x-(c.x-u.left)*2-c.width}),l.translate(u.width,0)},bottom2top:function(){var l=this,u=l.getBoundingBox();l.eachNode(function(c){c.y=c.y-(c.y-u.top)*2-c.height}),l.translate(0,u.height)}});function s(o,l,u){l===void 0&&(l={}),l=r.assign({},i,l);var c=new a(o,l),h=[c],d;if(!u&&!o.collapsed){for(;d=h.shift();)if(!d.data.collapsed){var f=l.getChildren(d.data),v=f?f.length:0;if(d.children=new Array(v),f&&v)for(var p=0;p<v;p++){var g=new a(f[p],l);d.children[p]=g,h.push(g),g.parent=d,g.depth=d.depth+1}}}return c}return _d=s,_d}var Md,Xw;function qc(){if(Xw)return Md;Xw=1;var r=ZA(),t=function(){function e(i,a){a===void 0&&(a={});var s=this;s.options=a,s.rootNode=r(i,a)}var n=e.prototype;return n.execute=function(){throw new Error("please override this method")},e}();return Md=t,Md}var kd,Kw;function lz(){if(Kw)return kd;Kw=1;function r(s,o,l,u){u===void 0&&(u=[]);var c=this;c.w=s||0,c.h=o||0,c.y=l||0,c.x=0,c.c=u||[],c.cs=u.length,c.prelim=0,c.mod=0,c.shift=0,c.change=0,c.tl=null,c.tr=null,c.el=null,c.er=null,c.msel=0,c.mser=0}r.fromNode=function(s,o){if(!s)return null;var l=[];return s.children.forEach(function(u){l.push(r.fromNode(u,o))}),o?new r(s.height,s.width,s.x,l):new r(s.width,s.height,s.y,l)};function t(s,o,l){l?s.y+=o:s.x+=o,s.children.forEach(function(u){t(u,o,l)})}function e(s,o){var l=o?s.y:s.x;return s.children.forEach(function(u){l=Math.min(e(u,o),l)}),l}function n(s,o){var l=e(s,o);t(s,-l,o)}function i(s,o,l){l?o.y=s.x:o.x=s.x,s.c.forEach(function(u,c){i(u,o.children[c],l)})}function a(s,o,l){l===void 0&&(l=0),o?(s.x=l,l+=s.width):(s.y=l,l+=s.height),s.children.forEach(function(u){a(u,o,l)})}return kd=function(s,o){o===void 0&&(o={});var l=o.isHorizontal;function u(O){if(O.cs===0){c(O);return}u(O.c[0]);for(var P=k(p(O.c[0].el),0,null),N=1;N<O.cs;++N){u(O.c[N]);var C=p(O.c[N].er);h(O,N,P),P=k(C,N,P)}m(O),c(O)}function c(O){O.cs===0?(O.el=O,O.er=O,O.msel=O.mser=0):(O.el=O.c[0].el,O.msel=O.c[0].msel,O.er=O.c[O.cs-1].er,O.mser=O.c[O.cs-1].mser)}function h(O,P,N){for(var C=O.c[P-1],L=C.mod,B=O.c[P],G=B.mod;C!==null&&B!==null;){p(C)>N.low&&(N=N.nxt);var V=L+C.prelim+C.w-(G+B.prelim);V>0&&(G+=V,d(O,P,N.index,V));var U=p(C),$=p(B);U<=$&&(C=v(C),C!==null&&(L+=C.mod)),U>=$&&(B=f(B),B!==null&&(G+=B.mod))}!C&&B?g(O,P,B,G):C&&!B&&y(O,P,C,L)}function d(O,P,N,C){O.c[P].mod+=C,O.c[P].msel+=C,O.c[P].mser+=C,E(O,P,N,C)}function f(O){return O.cs===0?O.tl:O.c[0]}function v(O){return O.cs===0?O.tr:O.c[O.cs-1]}function p(O){return O.y+O.h}function g(O,P,N,C){var L=O.c[0].el;L.tl=N;var B=C-N.mod-O.c[0].msel;L.mod+=B,L.prelim-=B,O.c[0].el=O.c[P].el,O.c[0].msel=O.c[P].msel}function y(O,P,N,C){var L=O.c[P].er;L.tr=N;var B=C-N.mod-O.c[P].mser;L.mod+=B,L.prelim-=B,O.c[P].er=O.c[P-1].er,O.c[P].mser=O.c[P-1].mser}function m(O){O.prelim=(O.c[0].prelim+O.c[0].mod+O.c[O.cs-1].mod+O.c[O.cs-1].prelim+O.c[O.cs-1].w)/2-O.w/2}function w(O,P){P+=O.mod,O.x=O.prelim+P,_(O);for(var N=0;N<O.cs;N++)w(O.c[N],P)}function E(O,P,N,C){if(N!==P-1){var L=P-N;O.c[N+1].shift+=C/L,O.c[P].shift-=C/L,O.c[P].change-=C-C/L}}function _(O){for(var P=0,N=0,C=0;C<O.cs;C++)P+=O.c[C].shift,N+=P+O.c[C].change,O.c[C].mod+=N}function k(O,P,N){for(;N!==null&&O>=N.low;)N=N.nxt;return{low:O,index:P,nxt:N}}a(s,l);var T=r.fromNode(s,l);return u(T),w(T,0),i(T,s,l),n(s,l),s},kd}var Od,Zw;function JA(){if(Zw)return Od;Zw=1;var r=ZA();return Od=function(t,e){for(var n=r(t.data,e,!0),i=r(t.data,e,!0),a=t.children.length,s=Math.round(a/2),o=e.getSide||function(h,d){return d<s?"right":"left"},l=0;l<a;l++){var u=t.children[l],c=o(u,l);c==="right"?i.children.push(u):n.children.push(u)}return n.eachNode(function(h){h.isRoot()||(h.side="left")}),i.eachNode(function(h){h.isRoot()||(h.side="right")}),{left:n,right:i}},Od}var Td,Jw;function x1(){if(Jw)return Td;Jw=1;var r=JA(),t=["LR","RL","TB","BT","H","V"],e=["LR","RL","H"],n=function(o){return e.indexOf(o)>-1},i=t[0];Td=function(s,o,l){var u=o.direction||i;if(o.isHorizontal=n(u),t.indexOf(u)===-1)throw new TypeError("Invalid direction: "+u);if(u===t[0])l(s,o);else if(u===t[1])l(s,o),s.right2left();else if(u===t[2])l(s,o);else if(u===t[3])l(s,o),s.bottom2top();else if(u===t[4]||u===t[5]){var c=r(s,o),h=c.left,d=c.right;l(h,o),l(d,o),o.isHorizontal?h.right2left():h.bottom2top(),d.translate(h.x-d.x,h.y-d.y),s.x=h.x,s.y=d.y;var f=s.getBoundingBox();o.isHorizontal?f.top<0&&s.translate(0,-f.top):f.left<0&&s.translate(-f.left,0)}var v=o.fixedRoot;return v===void 0&&(v=!0),v&&s.translate(-(s.x+s.width/2+s.hgap),-(s.y+s.height/2+s.vgap)),a(s,o),s};function a(s,o){if(o.radial){var l=o.isHorizontal?["x","y"]:["y","x"],u=l[0],c=l[1],h={x:1/0,y:1/0},d={x:-1/0,y:-1/0},f=0;s.DFTraverse(function(g){f++;var y=g.x,m=g.y;h.x=Math.min(h.x,y),h.y=Math.min(h.y,m),d.x=Math.max(d.x,y),d.y=Math.max(d.y,m)});var v=d[c]-h[c];if(v===0)return;var p=Math.PI*2/f;s.DFTraverse(function(g){var y=(g[c]-h[c])/v*(Math.PI*2-p)+p,m=g[u]-s[u];g.x=Math.cos(y)*m,g.y=Math.sin(y)*m})}}return Td}var Ad,Qw;function uz(){if(Qw)return Ad;Qw=1;function r(u,c){u.prototype=Object.create(c.prototype),u.prototype.constructor=u,t(u,c)}function t(u,c){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,d){return h.__proto__=d,h},t(u,c)}var e=qc(),n=lz(),i=x1(),a=ca(),s=function(u){function c(){return u.apply(this,arguments)||this}r(c,u);var h=c.prototype;return h.execute=function(){var f=this;return i(f.rootNode,f.options,n)},c}(e),o={};function l(u,c){return c=a.assign({},o,c),new s(u,c).execute()}return Ad=l,Ad}var Pd,tx;function cz(){if(tx)return Pd;tx=1;var r=ca();function t(i,a){a===void 0&&(a=[]);var s=this;s.x=s.y=0,s.leftChild=s.rightChild=null,s.height=0,s.children=a}var e={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function n(i,a,s){s?(a.x=i.x,a.y=i.y):(a.x=i.y,a.y=i.x),i.children.forEach(function(o,l){n(o,a.children[l],s)})}return Pd=function(i,a){a===void 0&&(a={}),a=r.assign({},e,a);var s=0;function o(d){if(!d)return null;d.width=0,d.depth&&d.depth>s&&(s=d.depth);var f=d.children,v=f.length,p=new t(d.height,[]);return f.forEach(function(g,y){var m=o(g);p.children.push(m),y===0&&(p.leftChild=m),y===v-1&&(p.rightChild=m)}),p.originNode=d,p.isLeaf=d.isLeaf(),p}function l(d){if(d.isLeaf||d.children.length===0)d.drawingDepth=s;else{var f=d.children.map(function(p){return l(p)}),v=Math.min.apply(null,f);d.drawingDepth=v-1}return d.drawingDepth}var u;function c(d){d.x=d.drawingDepth*a.rankSep,d.isLeaf?(d.y=0,u&&(d.y=u.y+u.height+a.nodeSep,d.originNode.parent!==u.originNode.parent&&(d.y+=a.subTreeSep)),u=d):(d.children.forEach(function(f){c(f)}),d.y=(d.leftChild.y+d.rightChild.y)/2)}var h=o(i);return l(h),c(h),n(h,i,a.isHorizontal),i},Pd}var Nd,ex;function hz(){if(ex)return Nd;ex=1;function r(u,c){u.prototype=Object.create(c.prototype),u.prototype.constructor=u,t(u,c)}function t(u,c){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,d){return h.__proto__=d,h},t(u,c)}var e=qc(),n=cz(),i=x1(),a=ca(),s=function(u){function c(){return u.apply(this,arguments)||this}r(c,u);var h=c.prototype;return h.execute=function(){var f=this;return f.rootNode.width=0,i(f.rootNode,f.options,n)},c}(e),o={};function l(u,c){return c=a.assign({},o,c),new s(u,c).execute()}return Nd=l,Nd}var Cd,nx;function dz(){if(nx)return Cd;nx=1;var r=ca();function t(e,n,i,a,s){var o=(typeof i=="function"?i(e):i)*e.depth;if(!a)try{if(e.id===e.parent.children[0].id){e.x+=o,e.y=n?n.y:0;return}}catch{}if(e.x+=o,n){if(e.y=n.y+r.getHeight(n,e,s),n.parent&&e.parent.id!==n.parent.id){var l=n.parent,u=l.y+r.getHeight(l,e,s);e.y=u>e.y?u:e.y}}else e.y=0}return Cd=function(e,n,i,a){var s=null;e.eachNode(function(o){t(o,s,n,i,a),s=o})},Cd}var Rd,rx;function fz(){if(rx)return Rd;rx=1;function r(h,d){h.prototype=Object.create(d.prototype),h.prototype.constructor=h,t(h,d)}function t(h,d){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,v){return f.__proto__=v,f},t(h,d)}var e=qc(),n=dz(),i=JA(),a=ca(),s=["LR","RL","H"],o=s[0],l=function(h){function d(){return h.apply(this,arguments)||this}r(d,h);var f=d.prototype;return f.execute=function(){var p=this,g=p.options,y=p.rootNode;g.isHorizontal=!0;var m=g.indent,w=m===void 0?20:m,E=g.dropCap,_=E===void 0?!0:E,k=g.direction,T=k===void 0?o:k,O=g.align;if(T&&s.indexOf(T)===-1)throw new TypeError("Invalid direction: "+T);if(T===s[0])n(y,w,_,O);else if(T===s[1])n(y,w,_,O),y.right2left();else if(T===s[2]){var P=i(y,g),N=P.left,C=P.right;n(N,w,_,O),N.right2left(),n(C,w,_,O);var L=N.getBoundingBox();C.translate(L.width,0),y.x=C.x-y.width/2}return y},d}(e),u={};function c(h,d){return d=a.assign({},u,d),new l(h,d).execute()}return Rd=c,Rd}var Ld,ix;function gz(){if(ix)return Ld;ix=1;var r=ca();function t(i,a){var s=0;return i.children.length?i.children.forEach(function(o){s+=t(o,a)}):s=i.height,i._subTreeSep=a.getSubTreeSep(i.data),i.totalHeight=Math.max(i.height,s)+2*i._subTreeSep,i.totalHeight}function e(i){var a=i.children,s=a.length;if(s){a.forEach(function(d){e(d)});var o=a[0],l=a[s-1],u=l.y-o.y+l.height,c=0;if(a.forEach(function(d){c+=d.totalHeight}),u>i.height)i.y=o.y+u/2-i.height/2;else if(a.length!==1||i.height>c){var h=i.y+(i.height-u)/2-o.y;a.forEach(function(d){d.translate(0,h)})}else i.y=(o.y+o.height/2+l.y+l.height/2)/2-i.height/2}}var n={getSubTreeSep:function(){return 0}};return Ld=function(i,a){a===void 0&&(a={}),a=r.assign({},n,a),i.parent={x:0,width:0,height:0,y:0},i.BFTraverse(function(s){s.x=s.parent.x+s.parent.width}),i.parent=null,t(i,a),i.startY=0,i.y=i.totalHeight/2-i.height/2,i.eachNode(function(s){var o=s.children,l=o.length;if(l){var u=o[0];if(u.startY=s.startY+s._subTreeSep,l===1)u.y=s.y+s.height/2-u.height/2;else{u.y=u.startY+u.totalHeight/2-u.height/2;for(var c=1;c<l;c++){var h=o[c];h.startY=o[c-1].startY+o[c-1].totalHeight,h.y=h.startY+h.totalHeight/2-h.height/2}}}}),e(i)},Ld}var Id,ax;function vz(){if(ax)return Id;ax=1;function r(u,c){u.prototype=Object.create(c.prototype),u.prototype.constructor=u,t(u,c)}function t(u,c){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,d){return h.__proto__=d,h},t(u,c)}var e=qc(),n=gz(),i=x1(),a=ca(),s=function(u){function c(){return u.apply(this,arguments)||this}r(c,u);var h=c.prototype;return h.execute=function(){var f=this;return i(f.rootNode,f.options,n)},c}(e),o={};function l(u,c){return c=a.assign({},o,c),new s(u,c).execute()}return Id=l,Id}var Dd,sx;function pz(){if(sx)return Dd;sx=1;var r={compactBox:uz(),dendrogram:hz(),indented:fz(),mindmap:vz()};return Dd=r,Dd}var iu=pz();const yz=(r,t)=>{if(r!=="next"&&r!=="prev")return t},ox=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};let mz=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return ox(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&ox(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,yz)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}};class bz extends mz{}const wz=()=>1,xz=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=Sz(r,t||wz);return(e=Ez(n.graph,n.buckets,n.zeroIdx).map(a=>r.getRelatedEdges(a.v,"out").filter(({target:s})=>s===a.w)))===null||e===void 0?void 0:e.flat()},Ez=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)Bd(r,t,e,s);for(;s=i.dequeue();)Bd(r,t,e,s);if(r.getAllNodes().length){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(Bd(r,t,e,s,!0));break}}}return n},Bd=(r,t,e,n,i)=>{var a,s;const o=[];return r.hasNode(n.v)&&((a=r.getRelatedEdges(n.v,"in"))===null||a===void 0||a.forEach(l=>{const u=l.data.weight,c=r.getNode(l.source);i&&o.push({v:l.source,w:l.target,in:0,out:0}),c.data.out===void 0&&(c.data.out=0),c.data.out-=u,ym(t,e,Object.assign({v:c.id},c.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(l=>{const u=l.data.weight,c=l.target,h=r.getNode(c);h.data.in===void 0&&(h.data.in=0),h.data.in-=u,ym(t,e,Object.assign({v:h.id},h.data))}),r.removeNode(n.v)),i?o:void 0},Sz=(r,t)=>{const e=new ln;let n=0,i=0;r.getAllNodes().forEach(l=>{e.addNode({id:l.id,data:{v:l.id,in:0,out:0}})}),r.getAllEdges().forEach(l=>{const u=e.getRelatedEdges(l.source,"out").find(h=>h.target===l.target),c=(t==null?void 0:t(l))||1;u?e.updateEdgeData(u==null?void 0:u.id,Object.assign(Object.assign({},u.data),{weight:u.data.weight+c})):e.addEdge({id:l.id,source:l.source,target:l.target,data:{weight:c}}),i=Math.max(i,e.getNode(l.source).data.out+=c),n=Math.max(n,e.getNode(l.target).data.in+=c)});const a=[],s=i+n+3;for(let l=0;l<s;l++)a.push(new bz);const o=n+1;return e.getAllNodes().forEach(l=>{ym(a,o,Object.assign({v:l.id},e.getNode(l.id).data))}),{buckets:a,zeroIdx:o,graph:e}},ym=(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)},_z=(r,t)=>{const n=xz(r,(i=>a=>a.data.weight||1)());n==null||n.forEach(i=>{const a=i.data;r.removeEdge(i.id),a.forwardName=i.data.name,a.reversed=!0,r.addEdge({id:i.id,source:i.target,target:i.source,data:Object.assign({},a)})})},Mz=r=>{r.getAllEdges().forEach(t=>{const e=t.data;if(e.reversed){r.removeEdge(t.id);const n=e.forwardName;delete e.reversed,delete e.forwardName,r.addEdge({id:t.id,source:t.target,target:t.source,data:Object.assign(Object.assign({},e),{forwardName:n})})}})},kz=(r,t)=>Number(r)-Number(t),Ds=(r,t,e,n)=>{let i;do i=`${n}${Math.random()}`;while(r.hasNode(i));return e.dummy=t,r.addNode({id:i,data:e}),i},Oz=r=>{const t=new ln;return r.getAllNodes().forEach(e=>{t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{const n=t.getRelatedEdges(e.source,"out").find(i=>i.target===e.target);n?t.updateEdgeData(n==null?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+e.data.weight||0,minlen:Math.max(n.data.minlen,e.data.minlen||1)})):t.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),t},QA=r=>{const t=new ln;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},Tz=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),lx=(r,t)=>{const e=Number(r.x),n=Number(r.y),i=Number(t.x)-e,a=Number(t.y)-n;let s=Number(r.width)/2,o=Number(r.height)/2;if(!i&&!a)return{x:0,y:0};let l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:e+l,y:n+u}},Do=r=>{const t=[],e=tP(r)+1;for(let n=0;n<e;n++)t.push([]);r.getAllNodes().forEach(n=>{const i=n.data.rank;i!==void 0&&t[i]&&t[i].push(n.id)});for(let n=0;n<e;n++)t[n]=t[n].sort((i,a)=>kz(r.getNode(i).data.order,r.getNode(a).data.order));return t},Az=r=>{const t=r.getAllNodes().filter(n=>n.data.rank!==void 0).map(n=>n.data.rank),e=Math.min(...t);r.getAllNodes().forEach(n=>{n.data.hasOwnProperty("rank")&&e!==1/0&&(n.data.rank-=e)})},Pz=(r,t=0)=>{const e=r.getAllNodes(),n=e.filter(o=>o.data.rank!==void 0).map(o=>o.data.rank),i=Math.min(...n),a=[];e.forEach(o=>{const l=(o.data.rank||0)-i;a[l]||(a[l]=[]),a[l].push(o.id)});let s=0;for(let o=0;o<a.length;o++){const l=a[o];l===void 0?o%t!==0&&(s-=1):s&&(l==null||l.forEach(u=>{const c=r.getNode(u);c&&(c.data.rank=c.data.rank||0,c.data.rank+=s)}))}},ux=(r,t,e,n)=>{const i={width:0,height:0};return St(e)&&St(n)&&(i.rank=e,i.order=n),Ds(r,"border",i,t)},tP=r=>{let t;return r.getAllNodes().forEach(e=>{const n=e.data.rank;n!==void 0&&(t===void 0||n>t)&&(t=n)}),t||(t=0),t},Nz=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},E1=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),eP=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>eP(r,s,e,n,i,a)),e&&a.push(t.id))},nP=(r,t,e,n)=>{const i=Array.isArray(t)?t:[t],a=l=>r.getNeighbors(l),s=[],o=[];return i.forEach(l=>{if(r.hasNode(l.id))eP(r,l,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${l}`)}),s},Cz=r=>{const t=e=>{const n=r.getChildren(e),i=r.getNode(e);if(n!=null&&n.length&&n.forEach(a=>t(a.id)),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let a=i.data.minRank,s=i.data.maxRank+1;a<s;a+=1)cx(r,"borderLeft","_bl",e,i,a),cx(r,"borderRight","_br",e,i,a)}};r.getRoots().forEach(e=>t(e.id))},cx=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],l=Ds(r,"border",s,e);i.data[t][a]=l,r.setParent(l,n),o&&r.addEdge({id:`e${Math.random()}`,source:o,target:l,data:{weight:1}})},Rz=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&rP(r)},Lz=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&Iz(r),(e==="lr"||e==="rl")&&(Dz(r),rP(r))},rP=r=>{r.getAllNodes().forEach(t=>{hx(t)}),r.getAllEdges().forEach(t=>{hx(t)})},hx=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},Iz=r=>{r.getAllNodes().forEach(t=>{Fd(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Fd(n)),t.data.hasOwnProperty("y")&&Fd(t.data)})},Fd=r=>{r!=null&&r.y&&(r.y=-r.y)},Dz=r=>{r.getAllNodes().forEach(t=>{zd(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>zd(n)),t.data.hasOwnProperty("x")&&zd(t.data)})},zd=r=>{const t=r.x;r.x=r.y,r.y=t},Bz=r=>{const t=Ds(r,"root",{},"_root"),e=Fz(r);let n=Math.max(...Object.values(e));Math.abs(n)===1/0&&(n=1);const i=n-1,a=2*i+1;r.getAllEdges().forEach(o=>{o.data.minlen*=a});const s=zz(r)+1;return r.getRoots().forEach(o=>{iP(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},iP=(r,t,e,n,i,a,s)=>{const o=r.getChildren(s);if(!(o!=null&&o.length)){s!==t&&r.addEdge({id:`e${Math.random()}`,source:t,target:s,data:{weight:0,minlen:e}});return}const l=ux(r,"_bt"),u=ux(r,"_bb"),c=r.getNode(s);r.setParent(l,s),c.data.borderTop=l,r.setParent(u,s),c.data.borderBottom=u,o==null||o.forEach(h=>{iP(r,t,e,n,i,a,h.id);const d=h.data.borderTop?h.data.borderTop:h.id,f=h.data.borderBottom?h.data.borderBottom:h.id,v=h.data.borderTop?n:2*n,p=d!==f?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:l,target:d,data:{minlen:p,weight:v,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:f,target:u,data:{minlen:p,weight:v,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:l,data:{weight:0,minlen:i+a[s]}})},Fz=r=>{const t={},e=(n,i)=>{const a=r.getChildren(n);a==null||a.forEach(s=>e(s.id,i+1)),t[n]=i};return r.getRoots().forEach(n=>e(n.id,1)),t},zz=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},jz=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},qz="edge",aP="edge-label",$z=(r,t)=>{r.getAllEdges().forEach(e=>Gz(r,e,t))},Gz=(r,t,e)=>{let n=t.source,i=r.getNode(n).data.rank;const a=t.target,s=r.getNode(a).data.rank,o=t.data.labelRank;if(s===i+1)return;r.removeEdge(t.id);let l,u,c;for(c=0,++i;i<s;++c,++i)t.data.points=[],u={originalEdge:t,width:0,height:0,rank:i},l=Ds(r,qz,u,"_d"),i===o&&(u.width=t.data.width,u.height=t.data.height,u.dummy=aP,u.labelpos=t.data.labelpos),r.addEdge({id:`e${Math.random()}`,source:n,target:l,data:{weight:t.data.weight}}),c===0&&e.push(l),n=l;r.addEdge({id:`e${Math.random()}`,source:n,target:a,data:{weight:t.data.weight}})},Wz=(r,t)=>{t.forEach(e=>{let n=r.getNode(e);const{data:i}=n,a=i.originalEdge;let s;a&&r.addEdge(a);let o=e;for(;n.data.dummy;)s=r.getSuccessors(o)[0],r.removeNode(o),a.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===aP&&(a.data.x=n.data.x,a.data.y=n.data.y,a.data.width=n.data.width,a.data.height=n.data.height),o=s.id,n=r.getNode(o)})},Vz=(r,t,e)=>{const n={};let i;e==null||e.forEach(a=>{let s=r.getParent(a),o,l;for(;s;){if(o=r.getParent(s.id),o?(l=n[o.id],n[o.id]=s.id):(l=i,i=s.id),l&&l!==s.id){t.hasNode(l)||t.addNode({id:l,data:{}}),t.hasNode(s.id)||t.addNode({id:s.id,data:{}}),t.hasEdge(`e${l}-${s.id}`)||t.addEdge({id:`e${l}-${s.id}`,source:l,target:s.id,data:{}});return}s=o}})},Uz=(r,t,e)=>{const n=Yz(r),i=new ln({tree:[{id:n,children:[],data:{}}]});return r.getAllNodes().forEach(a=>{const s=r.getParent(a.id);(a.data.rank===t||a.data.minRank<=t&&t<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(Object.assign({},a)),s!=null&&s.id&&!i.hasNode(s==null?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(a.id,(s==null?void 0:s.id)||n),r.getRelatedEdges(a.id,e).forEach(o=>{const l=o.source===a.id?o.target:o.source;i.hasNode(l)||i.addNode(Object.assign({},r.getNode(l)));const u=i.getRelatedEdges(l,"out").find(({target:h})=>h===a.id),c=u!==void 0?u.data.weight:0;u?i.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:o.data.weight+c})):i.addEdge({id:o.id,source:l,target:a.id,data:{weight:o.data.weight+c}})}),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,Object.assign(Object.assign({},a.data),{borderLeft:a.data.borderLeft[t],borderRight:a.data.borderRight[t]})))}),i},Yz=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},Hz=(r,t,e)=>{const n=Tz(e,e.map((c,h)=>h)),a=t.map(c=>{const h=r.getRelatedEdges(c,"out").map(d=>({pos:n[d.target]||0,weight:d.data.weight}));return h==null?void 0:h.sort((d,f)=>d.pos-f.pos)}).flat().filter(c=>c!==void 0);let s=1;for(;s<e.length;)s<<=1;const o=2*s-1;s-=1;const l=Array(o).fill(0,0,o);let u=0;return a==null||a.forEach(c=>{if(c){let h=c.pos+s;l[h]+=c.weight;let d=0;for(;h>0;)h%2&&(d+=l[h+1]),h=h-1>>1,l[h]+=c.weight;u+=c.weight*d}}),u},dx=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=Hz(r,t[n-1],t[n]);return e},fx=r=>{const t={},e=r.getAllNodes(),n=e.map(u=>{var c;return(c=u.data.rank)!==null&&c!==void 0?c:-1/0}),i=Math.max(...n),a=[];for(let u=0;u<i+1;u++)a.push([]);const s=e.sort((u,c)=>r.getNode(u.id).data.rank-r.getNode(c.id).data.rank),l=s.filter(u=>r.getNode(u.id).data.fixorder!==void 0).sort((u,c)=>r.getNode(u.id).data.fixorder-r.getNode(c.id).data.fixorder);return l==null||l.forEach(u=>{isNaN(r.getNode(u.id).data.rank)||a[r.getNode(u.id).data.rank].push(u.id),t[u.id]=!0}),s==null||s.forEach(u=>r.dfsTree(u.id,c=>{if(t.hasOwnProperty(c.id))return!0;t[c.id]=!0,isNaN(c.data.rank)||a[c.data.rank].push(c.id)})),a},Xz=(r,t)=>t.map(e=>{const n=r.getRelatedEdges(e,"in");if(!(n!=null&&n.length))return{v:e};const i={sum:0,weight:0};return n==null||n.forEach(a=>{const s=r.getNode(a.source);i.sum+=a.data.weight*s.data.order,i.weight+=a.data.weight}),{v:e,barycenter:i.sum/i.weight,weight:i.weight}}),Kz=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,l)=>{a[o.v]={i:l,indegree:0,in:[],out:[],vs:[o.v]};const u=a[o.v];o.barycenter!==void 0&&(u.barycenter=o.barycenter,u.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const l=a[o.source],u=a[o.target];l!==void 0&&u!==void 0&&(u.indegree++,l.out.push(a[o.target]))});const s=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return Zz(s)},Zz=r=>{var t,e;const n=[],i=l=>u=>{u.merged||(u.barycenter===void 0||l.barycenter===void 0||u.barycenter>=l.barycenter)&&Jz(l,u)},a=l=>u=>{u.in.push(l),--u.indegree===0&&r.push(u)};for(;r!=null&&r.length;){const l=r.pop();n.push(l),(t=l.in.reverse())===null||t===void 0||t.forEach(u=>i(l)(u)),(e=l.out)===null||e===void 0||e.forEach(u=>a(l)(u))}const s=n.filter(l=>!l.merged),o=["vs","i","barycenter","weight"];return s.map(l=>{const u={};return o==null||o.forEach(c=>{l[c]!==void 0&&(u[c]=l[c])}),u})},Jz=(r,t)=>{var e;let 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},Qz=(r,t,e,n)=>{const i=Nz(r,d=>{const f=d.hasOwnProperty("fixorder")&&!isNaN(d.fixorder);return n?!f&&d.hasOwnProperty("barycenter"):f||d.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((d,f)=>-d.i- -f.i),o=[];let l=0,u=0,c=0;a==null||a.sort(tj(!!t,!!e)),c=gx(o,s,c),a==null||a.forEach(d=>{var f;c+=(f=d.vs)===null||f===void 0?void 0:f.length,o.push(d.vs),l+=d.barycenter*d.weight,u+=d.weight,c=gx(o,s,c)});const h={vs:o.flat()};return u&&(h.barycenter=l/u,h.weight=u),h},gx=(r,t,e)=>{let n=e,i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),r==null||r.push(i.vs),n++;return n},tj=(r,t)=>(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},sP=(r,t,e,n,i,a)=>{var s,o,l,u;let c=r.getChildren(t).map(m=>m.id);const h=r.getNode(t),d=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,v={};d&&(c=c==null?void 0:c.filter(m=>m!==d&&m!==f));const p=Xz(r,c||[]);p==null||p.forEach(m=>{var w;if(!((w=r.getChildren(m.v))===null||w===void 0)&&w.length){const E=sP(r,m.v,e,n,a);v[m.v]=E,E.hasOwnProperty("barycenter")&&nj(m,E)}});const g=Kz(p,e);ej(g,v),(s=g.filter(m=>m.vs.length>0))===null||s===void 0||s.forEach(m=>{const w=r.getNode(m.vs[0]);w&&(m.fixorder=w.data.fixorder,m.order=w.data.order)});const y=Qz(g,n,i,a);if(d&&(y.vs=[d,y.vs,f].flat(),!((o=r.getPredecessors(d))===null||o===void 0)&&o.length)){const m=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||""),w=r.getNode(((u=r.getPredecessors(f))===null||u===void 0?void 0:u[0].id)||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.data.order+w.data.order)/(y.weight+2),y.weight+=2}return y},ej=(r,t)=>{r==null||r.forEach(e=>{var n;const i=(n=e.vs)===null||n===void 0?void 0:n.map(a=>t[a]?t[a].vs:a);e.vs=i.flat()})},nj=(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)},rj=(r,t)=>{const e=tP(r),n=[],i=[];for(let c=1;c<e+1;c++)n.push(c);for(let c=e-1;c>-1;c--)i.push(c);const a=vx(r,n,"in"),s=vx(r,i,"out");let o=fx(r);jd(r,o);let l=Number.POSITIVE_INFINITY,u;for(let c=0,h=0;h<4;++c,++h){px(c%2?a:s,c%4>=2,!1,t),o=Do(r);const d=dx(r,o);d<l&&(h=0,u=ea(o),l=d)}o=fx(r),jd(r,o);for(let c=0,h=0;h<4;++c,++h){px(c%2?a:s,c%4>=2,!0,t),o=Do(r);const d=dx(r,o);d<l&&(h=0,u=ea(o),l=d)}jd(r,u)},vx=(r,t,e)=>t.map(n=>Uz(r,n,e)),px=(r,t,e,n)=>{const i=new ln;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,l=sP(a,o,i,t,e,n);for(let u=0;u<((s=l.vs)===null||s===void 0?void 0:s.length);u++){const c=a.getNode(l.vs[u]);c&&(c.data.order=u)}Vz(a,i,l.vs)})},jd=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},ij=(r,t)=>{const n=r.getAllNodes().filter(s=>{var o;return!(!((o=r.getChildren(s.id))===null||o===void 0)&&o.length)}).map(s=>s.data.rank),i=Math.max(...n),a=[];for(let s=0;s<i+1;s++)a[s]=[];t==null||t.forEach(s=>{const o=r.getNode(s);!o||o.data.dummy||isNaN(o.data.rank)||(o.data.fixorder=a[o.data.rank].length,a[o.data.rank].push(s))})},aj=r=>{const t={};let e=0;const n=i=>{const a=e;r.getChildren(i).forEach(s=>n(s.id)),t[i]={low:a,lim:e++}};return r.getRoots().forEach(i=>n(i.id)),t},sj=(r,t,e,n)=>{var i,a;const s=[],o=[],l=Math.min(t[e].low,t[n].low),u=Math.max(t[e].lim,t[n].lim);let c,h;c=e;do c=(i=r.getParent(c))===null||i===void 0?void 0:i.id,s.push(c);while(c&&(t[c].low>l||u>t[c].lim));for(h=c,c=n;c&&c!==h;)o.push(c),c=(a=r.getParent(c))===null||a===void 0?void 0:a.id;return{lca:h,path:s.concat(o.reverse())}},oj=(r,t)=>{const e=aj(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const l=o.data.originalEdge;if(!l)return;const u=sj(r,e,l.source,l.target),c=u.path,h=u.lca;let d=0,f=c[d],v=!0;for(;s!==l.target;){if(o=r.getNode(s),v){for(;f!==h&&((i=r.getNode(f))===null||i===void 0?void 0:i.data.maxRank)<o.data.rank;)d++,f=c[d];f===h&&(v=!1)}if(!v){for(;d<c.length-1&&((a=r.getNode(c[d+1]))===null||a===void 0?void 0:a.data.minRank)<=o.data.rank;)d++;f=c[d]}r.hasNode(f)&&r.setParent(s,f),s=r.getSuccessors(s)[0].id}})},lj=(r,t)=>{const e={},n=(i,a)=>{let s=0,o=0;const l=i.length,u=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((c,h)=>{var d;const f=cj(r,c),v=f?r.getNode(f.id).data.order:l;(f||c===u)&&((d=a.slice(o,h+1))===null||d===void 0||d.forEach(p=>{var g;(g=r.getPredecessors(p))===null||g===void 0||g.forEach(y=>{var m;const w=r.getNode(y.id),E=w.data.order;(E<s||v<E)&&!(w.data.dummy&&(!((m=r.getNode(p))===null||m===void 0)&&m.data.dummy))&&oP(e,y.id,p)})}),o=h+1,s=v)}),a};return t!=null&&t.length&&t.reduce(n),e},uj=(r,t)=>{const e={};function n(o,l,u,c,h){var d,f;let v;for(let p=l;p<u;p++)v=o[p],!((d=r.getNode(v))===null||d===void 0)&&d.data.dummy&&((f=r.getPredecessors(v))===null||f===void 0||f.forEach(g=>{const y=r.getNode(g.id);y.data.dummy&&(y.data.order<c||y.data.order>h)&&oP(e,g.id,v)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,l){const u=i(o);l.get(u)||(n(...o),l.set(u,!0))}const s=(o,l)=>{let u=-1,c,h=0;const d=new Map;return l==null||l.forEach((f,v)=>{var p;if(((p=r.getNode(f))===null||p===void 0?void 0:p.data.dummy)==="border"){const g=r.getPredecessors(f)||[];g.length&&(c=r.getNode(g[0].id).data.order,a([l,h,v,u,c],d),h=v,u=c)}a([l,h,l.length,c,o.length],d)}),l};return t!=null&&t.length&&t.reduce(s),e},cj=(r,t)=>{var e,n;if(!((e=r.getNode(t))===null||e===void 0)&&e.data.dummy)return(n=r.getPredecessors(t))===null||n===void 0?void 0:n.find(i=>r.getNode(i.id).data.dummy)},oP=(r,t,e)=>{let n=t,i=e;if(n>i){const s=n;n=i,i=s}let a=r[n];a||(r[n]=a={}),a[i]=!0},hj=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},dj=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((l,u)=>{i[l]=l,a[l]=l,s[l]=u})}),t==null||t.forEach(o=>{let l=-1;o==null||o.forEach(u=>{let c=n(u).map(h=>h.id);if(c.length){c=c.sort((d,f)=>s[d]-s[f]);const h=(c.length-1)/2;for(let d=Math.floor(h),f=Math.ceil(h);d<=f;++d){const v=c[d];a[u]===u&&l<s[v]&&!hj(e,u,v)&&(a[v]=u,a[u]=i[u]=i[v],l=s[v])}}})}),{root:i,align:a}},fj=(r,t,e,n,i,a,s)=>{var o;const l={},u=gj(r,t,e,i,a,s),c=s?"borderLeft":"borderRight",h=(v,p)=>{let g=u.getAllNodes(),y=g.pop();const m={};for(;y;)m[y.id]?v(y.id):(m[y.id]=!0,g.push(y),g=g.concat(p(y.id))),y=g.pop()},d=v=>{l[v]=(u.getRelatedEdges(v,"in")||[]).reduce((p,g)=>Math.max(p,(l[g.source]||0)+g.data.weight),0)},f=v=>{const p=(u.getRelatedEdges(v,"out")||[]).reduce((y,m)=>Math.min(y,(l[m.target]||0)-m.data.weight),Number.POSITIVE_INFINITY),g=r.getNode(v);p!==Number.POSITIVE_INFINITY&&g.data.borderType!==c&&(l[v]=Math.max(l[v],p))};return h(d,u.getPredecessors.bind(u)),h(f,u.getSuccessors.bind(u)),(o=Object.values(n))===null||o===void 0||o.forEach(v=>{l[v]=l[e[v]]}),l},gj=(r,t,e,n,i,a)=>{const s=new ln,o=mj(n,i,a);return t==null||t.forEach(l=>{let u;l==null||l.forEach(c=>{const h=e[c];if(s.hasNode(h)||s.addNode({id:h,data:{}}),u){const d=e[u],f=s.getRelatedEdges(d,"out").find(v=>v.target===h);f?s.updateEdgeData(f.id,Object.assign(Object.assign({},f.data),{weight:Math.max(o(r,c,u),f.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:d,target:h,data:{weight:Math.max(o(r,c,u),0)}})}u=c})}),s},vj=(r,t)=>E1(Object.values(t),e=>{var n;let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return(n=Object.keys(e))===null||n===void 0||n.forEach(s=>{const o=e[s],l=bj(r,s)/2;i=Math.max(o+l,i),a=Math.min(o-l,a)}),i-a});function pj(r,t){const e=Object.values(t),n=Math.min(...e),i=Math.max(...e);["u","d"].forEach(a=>{["l","r"].forEach(s=>{const o=a+s,l=r[o];let u;if(l===t)return;const c=Object.values(l);u=s==="l"?n-Math.min(...c):i-Math.max(...c),u&&(r[o]={},Object.keys(l).forEach(h=>{r[o][h]=l[h]+u}))})})}const yj=(r,t)=>{const e={};return Object.keys(r.ul).forEach(n=>{if(t)e[n]=r[t.toLowerCase()][n];else{const i=Object.values(r).map(a=>a[n]);e[n]=(i[0]+i[1])/2}}),e},mj=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let l=0,u=0;if(l+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":u=-s.data.width/2;break;case"r":u=s.data.width/2;break}if(u&&(l+=e?u:-u),u=0,l+=(s.data.dummy?t:r)/2,l+=(o.data.dummy?t:r)/2,l+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":u=o.data.width/2;break;case"r":u=-o.data.width/2;break}return u&&(l+=e?u:-u),u=0,l},bj=(r,t)=>r.getNode(t).data.width||0,wj=(r,t)=>{const{ranksep:e=0}=t||{},n=Do(r);let i=0;n==null||n.forEach(a=>{const s=a.map(l=>r.getNode(l).data.height),o=Math.max(...s,0);a==null||a.forEach(l=>{r.getNode(l).data.y=i+o/2}),i+=o+e})},xj=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=Do(r),s=Object.assign(lj(r,a),uj(r,a)),o={};let l=[];["u","d"].forEach(c=>{l=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(p=>Object.values(p).reverse()));const d=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),f=dj(r,l,s,d),v=fj(r,l,f.root,f.align,n,i,h==="r");h==="r"&&Object.keys(v).forEach(p=>v[p]=-v[p]),o[c+h]=v})});const u=vj(r,o);return u&&pj(o,u),yj(o,e)},Ej=(r,t)=>{var e;const n=QA(r);wj(n,t);const i=xj(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},lP=r=>{const t={},e=n=>{var i;const a=r.getNode(n);if(!a)return 0;if(t[n])return a.data.rank;t[n]=!0;let s;return(i=r.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const l=e(o.target),u=o.data.minlen,c=l-u;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),a.data.rank=s,s};r.getAllNodes().filter(n=>r.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},Sj=r=>{const t={};let e;const n=s=>{var o;const l=r.getNode(s);if(!l)return 0;if(t[s])return l.data.rank;t[s]=!0;let u;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(c=>{const h=n(c.target),d=c.data.minlen,f=h-d;f&&(u===void 0||f<u)&&(u=f)}),u||(u=0),(e===void 0||u<e)&&(e=u),l.data.rank=u,u};r.getAllNodes().filter(s=>r.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var l;const u=r.getNode(s),c=isNaN(u.data.layer)?o:u.data.layer;(u.data.rank===void 0||u.data.rank<c)&&(u.data.rank=c),!i[s]&&(i[s]=!0,(l=r.getRelatedEdges(s,"out"))===null||l===void 0||l.forEach(h=>{a(h.target,c+h.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},ia=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,_j=r=>{const t=new ln({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Mj(t,r)<n;)i=uP(t,r),a=t.hasNode(i.source)?ia(r,i):-ia(r,i),cP(t,r,a);return t},Mj=(r,t)=>{const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!ia(t,i)&&(r.addNode({id:s,data:{}}),r.addEdge({id:i.id,source:n,target:s,data:{}}),e(s))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},kj=r=>{const t=new ln({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Oj(t,r)<n;)i=uP(t,r),a=t.hasNode(i.source)?ia(r,i):-ia(r,i),cP(t,r,a);return t},Oj=(r,t)=>{const e=n=>{var i;(i=t.getRelatedEdges(n,"both"))===null||i===void 0||i.forEach(a=>{const s=a.source,o=n===s?a.target:s;!r.hasNode(o)&&(t.getNode(o).data.layer!==void 0||!ia(t,a))&&(r.addNode({id:o,data:{}}),r.addEdge({id:a.id,source:n,target:o,data:{}}),e(o))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},uP=(r,t)=>E1(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?ia(t,e):1/0),cP=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},Tj=r=>{const t=Oz(r);lP(t);const e=_j(t);dP(e),hP(e,t);let n,i;for(;n=Nj(e);)i=Cj(e,t,n),Rj(e,t,n,i)},hP=(r,t)=>{let e=nP(r,r.getAllNodes(),"post");e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{Aj(r,t,n)})},Aj=(r,t,e)=>{const i=r.getNode(e).data.parent,a=r.getRelatedEdges(e,"both").find(s=>s.target===i||s.source===i);a.data.cutvalue=Pj(r,t,e)},Pj=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(l=>l.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(l=>l.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(l=>{const u=l.source===e,c=u?l.target:l.source;if(c!==i){const h=u===a,d=l.data.weight;if(o+=h?d:-d,Ij(r,e,c)){const f=r.getRelatedEdges(e,"both").find(v=>v.source===c||v.target===c).data.cutvalue;o+=h?-f:f}}}),o},dP=(r,t=r.getAllNodes()[0].id)=>{fP(r,{},1,t)},fP=(r,t,e,n,i)=>{var a;const s=e;let o=e;const l=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(u=>{t[u.id]||(o=fP(r,t,o,u.id,n))}),l.data.low=s,l.data.lim=o++,i?l.data.parent=i:delete l.data.parent,o},Nj=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),Cj=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(c=>c.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,l=!1;a.data.lim>s.data.lim&&(o=s,l=!0);const u=t.getAllEdges().filter(c=>l===yx(r.getNode(c.source),o)&&l!==yx(r.getNode(c.target),o));return E1(u,c=>ia(t,c))},Rj=(r,t,e,n)=>{const i=r.getRelatedEdges(e.source,"both").find(a=>a.source===e.target||a.target===e.target);i&&r.removeEdge(i.id),r.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),dP(r),hP(r,t),Lj(r,t)},Lj=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=nP(r,e,"pre");n=n.slice(1),n.forEach(i=>{const a=r.getNode(i).data.parent;let s=t.getRelatedEdges(i,"out").find(l=>l.target===a),o=!1;!s&&t.hasNode(a)&&(s=t.getRelatedEdges(a,"out").find(l=>l.target===i),o=!0),t.getNode(i).data.rank=(t.hasNode(a)&&t.getNode(a).data.rank||0)+(o?s==null?void 0:s.data.minlen:-(s==null?void 0:s.data.minlen))})},Ij=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),yx=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,Dj=(r,t)=>{switch(t){case"network-simplex":Fj(r);break;case"tight-tree":mx(r);break;case"longest-path":Bj(r);break;default:mx(r)}},Bj=lP,mx=r=>{Sj(r),kj(r)},Fj=r=>{Tj(r)},zj=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&qj(r,i);const o=Yj(r);e&&(t.ranksep=Hj(o,{rankdir:a,ranksep:s}));let l;try{l=jj(o,t)}catch(u){if(u.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:
6
- `,u);return}throw u}return $j(r,o),l},jj=(r,t)=>{const{ranker:e,rankdir:n="tb",nodeOrder:i,keepNodeOrder:a,align:s,nodesep:o=50,edgesep:l=20,ranksep:u=50}=t;r8(r),_z(r);const{nestingRoot:c,nodeRankFactor:h}=Bz(r);Dj(QA(r),e),Xj(r),Pz(r,h),jz(r,c),Az(r),Kj(r),Zj(r);const d=[];$z(r,d),oj(r,d),Cz(r),a&&ij(r,i),rj(r,a),i8(r),Rz(r,n),Ej(r,{align:s,nodesep:o,edgesep:l,ranksep:u}),a8(r),n8(r),Wz(r,d),t8(r),Lz(r,n);const{width:f,height:v}=Jj(r);return Qj(r),e8(r),Mz(r),{width:f,height:v}},qj=(r,t)=>{r.getAllNodes().forEach(e=>{const n=r.getNode(e.id);if(t.hasNode(e.id)){const i=t.getNode(e.id);n.data.fixorder=i.data._order,delete i.data._order}else delete n.data.fixorder})},$j=(r,t)=>{r.getAllNodes().forEach(e=>{var n;const i=r.getNode(e.id);if(i){const a=t.getNode(e.id);i.data.x=a.data.x,i.data.y=a.data.y,i.data._order=a.data.order,i.data._rank=a.data.rank,!((n=t.getChildren(e.id))===null||n===void 0)&&n.length&&(i.data.width=a.data.width,i.data.height=a.data.height)}}),r.getAllEdges().forEach(e=>{const n=r.getEdge(e.id),i=t.getEdge(e.id);n.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(n.data.x=i.data.x,n.data.y=i.data.y)})},Gj=["width","height","layer","fixorder"],Wj={width:0,height:0},Vj=["minlen","weight","width","height","labeloffset"],Uj={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},qd=["labelpos"],Yj=r=>{const t=new ln({tree:[]});return r.getAllNodes().forEach(e=>{const n=wx(r.getNode(e.id).data),i=Object.assign(Object.assign({},Wj),n),a=bx(i,Gj);t.hasNode(e.id)||t.addNode({id:e.id,data:Object.assign({},a)});const s=r.hasTreeStructure("combo")?r.getParent(e.id,"combo"):r.getParent(e.id);Rt(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=wx(r.getEdge(e.id).data),i={};qd==null||qd.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},Uj,bx(n,Vj),i)})}),t},Hj=(r,t)=>{const{ranksep:e=0,rankdir:n}=t;return r.getAllNodes().forEach(i=>{isNaN(i.data.layer)||i.data.layer||(i.data.layer=0)}),r.getAllEdges().forEach(i=>{var a;i.data.minlen*=2,((a=i.data.labelpos)===null||a===void 0?void 0:a.toLowerCase())!=="c"&&(n==="TB"||n==="BT"?i.data.width+=i.data.labeloffset:i.data.height+=i.data.labeloffset)}),e/2},Xj=r=>{r.getAllEdges().forEach(t=>{if(t.data.width&&t.data.height){const e=r.getNode(t.source),n=r.getNode(t.target),i={e:t,rank:(n.data.rank-e.data.rank)/2+e.data.rank};Ds(r,"edge-proxy",i,"_ep")}})},Kj=r=>{let t=0;return r.getAllNodes().forEach(e=>{var n,i;e.data.borderTop&&(e.data.minRank=(n=r.getNode(e.data.borderTop))===null||n===void 0?void 0:n.data.rank,e.data.maxRank=(i=r.getNode(e.data.borderBottom))===null||i===void 0?void 0:i.data.rank,t=Math.max(t,e.data.maxRank||-1/0))}),t},Zj=r=>{r.getAllNodes().forEach(t=>{t.data.dummy==="edge-proxy"&&(r.getEdge(t.data.e.id).data.labelRank=t.data.rank,r.removeNode(t.id))})},Jj=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}={},l=u=>{if(!u.data)return;const c=u.data.x,h=u.data.y,d=u.data.width,f=u.data.height;!isNaN(c)&&!isNaN(d)&&(e===void 0&&(e=c-d/2),e=Math.min(e,c-d/2),n=Math.max(n,c+d/2)),!isNaN(h)&&!isNaN(f)&&(i===void 0&&(i=h-f/2),i=Math.min(i,h-f/2),a=Math.max(a,h+f/2))};return r.getAllNodes().forEach(u=>{l(u)}),r.getAllEdges().forEach(u=>{u!=null&&u.data.hasOwnProperty("x")&&l(u)}),e-=s,i-=o,r.getAllNodes().forEach(u=>{u.data.x-=e,u.data.y-=i}),r.getAllEdges().forEach(u=>{var c;(c=u.data.points)===null||c===void 0||c.forEach(h=>{h.x-=e,h.y-=i}),u.data.hasOwnProperty("x")&&(u.data.x-=e),u.data.hasOwnProperty("y")&&(u.data.y-=i)}),{width:n-e+s,height:a-i+o}},Qj=r=>{r.getAllEdges().forEach(t=>{const e=r.getNode(t.source),n=r.getNode(t.target);let i,a;t.data.points?(i=t.data.points[0],a=t.data.points[t.data.points.length-1]):(t.data.points=[],i={x:n.data.x,y:n.data.y},a={x:e.data.x,y:e.data.y}),t.data.points.unshift(lx(e.data,i)),t.data.points.push(lx(n.data,a))})},t8=r=>{r.getAllEdges().forEach(t=>{if(t.data.hasOwnProperty("x"))switch((t.data.labelpos==="l"||t.data.labelpos==="r")&&(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset;break}})},e8=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},n8=r=>{r.getAllNodes().forEach(t=>{var e,n,i;if(!((e=r.getChildren(t.id))===null||e===void 0)&&e.length){const a=r.getNode(t.id),s=r.getNode(a.data.borderTop),o=r.getNode(a.data.borderBottom),l=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),u=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((u==null?void 0:u.data.x)-(l==null?void 0:l.data.x))||10,a.data.height=Math.abs((o==null?void 0:o.data.y)-(s==null?void 0:s.data.y))||10,a.data.x=((l==null?void 0:l.data.x)||0)+a.data.width/2,a.data.y=((s==null?void 0:s.data.y)||0)+a.data.height/2}}),r.getAllNodes().forEach(t=>{t.data.dummy==="border"&&r.removeNode(t.id)})},r8=r=>{r.getAllEdges().forEach(t=>{if(t.source===t.target){const e=r.getNode(t.source);e.data.selfEdges||(e.data.selfEdges=[]),e.data.selfEdges.push(t),r.removeEdge(t.id)}})},i8=r=>{const t=Do(r);t==null||t.forEach(e=>{let n=0;e==null||e.forEach((i,a)=>{var s;const o=r.getNode(i);o.data.order=a+n,(s=o.data.selfEdges)===null||s===void 0||s.forEach(l=>{Ds(r,"selfedge",{width:l.data.width,height:l.data.height,rank:o.data.rank,order:a+ ++n,e:l},"_se")}),delete o.data.selfEdges})})},a8=r=>{r.getAllNodes().forEach(t=>{const e=r.getNode(t.id);if(e.data.dummy==="selfedge"){const n=r.getNode(e.data.e.source),i=n.data.x+n.data.width/2,a=n.data.y,s=e.data.x-i,o=n.data.height/2;r.hasEdge(e.data.e.id)?r.updateEdgeData(e.data.e.id,e.data.e.data):r.addEdge({id:e.data.e.id,source:e.data.e.source,target:e.data.e.target,data:e.data.e.data}),r.removeNode(t.id),e.data.e.data.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{y:a,x:i+s},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],e.data.e.data.x=e.data.x,e.data.e.data.y=e.data.y}})},bx=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},wx=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t},yi=Array.isArray,gP=r=>{const t=[],e=r.length;for(let n=0;n<e;n+=1){t[n]=[];for(let i=0;i<e;i+=1)n===i?t[n][i]=0:r[n][i]===0||!r[n][i]?t[n][i]=1/0:t[n][i]=r[n][i]}for(let n=0;n<e;n+=1)for(let i=0;i<e;i+=1)for(let a=0;a<e;a+=1)t[i][a]>t[i][n]+t[n][a]&&(t[i][a]=t[i][n]+t[n][a]);return t},vP=(r,t)=>{const{nodes:e,edges:n}=r,i=[],a={};if(!e)throw new Error("invalid nodes data!");return e&&e.forEach((s,o)=>{a[s.id]=o;const l=[];i.push(l)}),n==null||n.forEach(s=>{const{source:o,target:l}=s,u=a[o],c=a[l];u===void 0||c===void 0||(i[u][c]=1,i[c][u]=1)}),i},s8=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},o8=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;yi(s)?s.length===1&&(s=[s[0],s[0]]):St(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],l=a.data.x-o[0],u=a.data.x+o[0],c=a.data.y-o[1],h=a.data.y+o[1];t>l&&(t=l),e>c&&(e=c),n<u&&(n=u),i<h&&(i=h)}),{minX:t,minY:e,maxX:n,maxY:i}},xx=(r,t)=>Math.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),mm=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let l=0;l<t.length;l++){const u=t[l];if(r.hasNode(u.id)&&!(s!=null&&s(u))){if(o!=null&&o(u))return;n==="TB"&&e(u),mm(r,r.getChildren(u.id,i),e,n,i,a),n!=="TB"&&e(u)}}},bm=r=>{if(r===null)return r;if(r instanceof Date)return new Date(r.getTime());if(r instanceof Array){const t=[];return r.forEach(e=>{t.push(e)}),t.map(e=>bm(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=bm(r[e])}),t}return r},ir=(r,t)=>{const e=bm(r);return e.data=e.data||{},t&&(St(e.data.x)||(e.data.x=Math.random()*t[0]),St(e.data.y)||(e.data.y=Math.random()*t[1])),e};function al(r){if(!r)return[0,0,0];if(St(r))return[r,r,r];if(r.length===0)return[0,0,0];const[t,e=t,n=t]=r;return[t,e,n]}function Pa(r,t){let e;return Ot(t)?e=t:St(t)?e=()=>t:e=()=>r,e}function S1(r,t,e=!0){return!t&&t!==0?n=>{const{size:i}=n.data||{};return i?Array.isArray(i)?e?Math.max(...i)||r:i:Ve(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:Ot(t)?t:St(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:Ve(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const _1=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:Ot(r)?n=r:n=s=>r:n=s=>{var o,l,u;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(l=s.data)===null||l===void 0?void 0:l.bboxSize;if(!((u=s.data)===null||u===void 0)&&u.size){const c=s.data.size;return Array.isArray(c)?c:Ve(c)?[c.width,c.height]:c}return e},s=>{const o=n(s),l=i(s);return Math.max(...al(o))+l}},l8={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class u8{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},l8),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:l,nodesep:u,ranksepFunc:c,nodesepFunc:h,edgeLabelSpace:d,ranker:f,nodeOrder:v,begin:p,controlPoints:g,radial:y,sortByCombo:m,preset:w}=i,E=new ln({tree:[]}),_=Pa(l||50,c),k=Pa(u||50,h);let T=k,O=_;(o==="LR"||o==="RL")&&(T=_,O=k);const P=S1(10,a,!1),N=e.getAllNodes(),C=e.getAllEdges();N.forEach(j=>{const Z=al(P(j)),nt=O(j),st=T(j),ot=Z[0]+2*st,Pt=Z[1]+2*nt,K=j.data.layer;St(K)?E.addNode({id:j.id,data:{width:ot,height:Pt,layer:K}}):E.addNode({id:j.id,data:{width:ot,height:Pt}})}),m&&(E.attachTreeStructure("combo"),N.forEach(j=>{const{parentId:Z}=j.data;Z!==void 0&&E.hasNode(Z)&&E.setParent(j.id,Z,"combo")})),C.forEach(j=>{E.addEdge({id:j.id,source:j.source,target:j.target,data:{weight:j.data.weight||1}})});let L;w!=null&&w.length&&(L=new ln({nodes:w})),zj(E,{prevGraph:L,edgeLabelSpace:d,keepNodeOrder:!!v,nodeOrder:v||[],acyclicer:"greedy",ranker:f,rankdir:o,nodesep:u,align:s});const B=[0,0];if(p){let j=1/0,Z=1/0;E.getAllNodes().forEach(nt=>{j>nt.data.x&&(j=nt.data.x),Z>nt.data.y&&(Z=nt.data.y)}),E.getAllEdges().forEach(nt=>{var st;(st=nt.data.points)===null||st===void 0||st.forEach(ot=>{j>ot.x&&(j=ot.x),Z>ot.y&&(Z=ot.y)})}),B[0]=p[0]-j,B[1]=p[1]-Z}const G=o==="LR"||o==="RL";if(!y){const j=new Set,nt=o==="BT"||o==="RL"?(K,W)=>W-K:(K,W)=>K-W;E.getAllNodes().forEach(K=>{K.data.x=K.data.x+B[0],K.data.y=K.data.y+B[1],j.add(G?K.data.x:K.data.y)});const st=Array.from(j).sort(nt),ot=G?(K,W)=>K.x!==W.x:(K,W)=>K.y!==W.y,Pt=G?(K,W,tt)=>{const ct=Math.max(W.y,tt.y),Et=Math.min(W.y,tt.y);return K.filter(Nt=>Nt.y<=ct&&Nt.y>=Et)}:(K,W,tt)=>{const ct=Math.max(W.x,tt.x),Et=Math.min(W.x,tt.x);return K.filter(Nt=>Nt.x<=ct&&Nt.x>=Et)};E.getAllEdges().forEach((K,W)=>{var tt;d&&g&&K.data.type!=="loop"&&(K.data.controlPoints=c8((tt=K.data.points)===null||tt===void 0?void 0:tt.map(({x:ct,y:Et})=>({x:ct+B[0],y:Et+B[1]})),E.getNode(K.source),E.getNode(K.target),st,G,ot,Pt))})}let V=[];V=E.getAllNodes().map(j=>ir(j));const U=E.getAllEdges();return t&&(V.forEach(j=>{e.mergeNodeData(j.id,{x:j.data.x,y:j.data.y})}),U.forEach(j=>{e.mergeEdgeData(j.id,{controlPoints:j.data.controlPoints})})),{nodes:V,edges:U}})}}const c8=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:l,y:u}=t.data,{x:c,y:h}=e.data;if(i&&(l=t.data.y,u=t.data.x,c=e.data.y,h=e.data.x),h!==u&&l!==c){const d=n.indexOf(u),f=n[d+1];if(f){const g=o[0],y=i?{x:(u+f)/2,y:(g==null?void 0:g.y)||c}:{x:(g==null?void 0:g.x)||c,y:(u+f)/2};(!g||a(g,y))&&o.unshift(y)}const v=n.indexOf(h),p=Math.abs(v-d);if(p===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(u+h)/2,y:l}:{x:l,y:(u+h)/2});else if(p>1){const g=n[v-1];if(g){const y=o[o.length-1],m=i?{x:(h+g)/2,y:(y==null?void 0:y.y)||c}:{x:(y==null?void 0:y.x)||l,y:(h+g)/2};(!y||a(y,m))&&o.push(m)}}}}return o},Ua=(r,t,e)=>{const n=r.getAllNodes(),i=r.getAllEdges();if(!(n!=null&&n.length))return{nodes:[],edges:i};if(n.length===1)return t&&r.mergeNodeData(n[0].id,{x:e[0],y:e[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:e[0],y:e[1]})})],edges:i}},h8={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class d8{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},h8),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:l,startAngle:u=0,endAngle:c=2*Math.PI,angleRatio:h,ordering:d,clockwise:f,nodeSpacing:v,nodeSize:p}=i,g=e.getAllNodes(),y=e.getAllEdges(),[m,w,E]=g8(a,s,o),_=g==null?void 0:g.length;if(!_||_===1)return Ua(e,t,E);const k=(c-u)/_;let{radius:T,startRadius:O,endRadius:P}=i;if(v){const G=Pa(10,v),V=S1(10,p);let U=-1/0;g.forEach(j=>{const Z=V(j);U<Z&&(U=Z)});let $=0;g.forEach((j,Z)=>{Z===0?$+=U||10:$+=(G(j)||0)+(U||10)}),T=$/(2*Math.PI)}else!T&&!O&&!P?T=Math.min(w,m)/2:!O&&P?O=P:O&&!P&&(P=O);const N=k*h;let C=[];d==="topology"?C=Ex(e,g):d==="topology-directed"?C=Ex(e,g,!0):d==="degree"?C=f8(e,g):C=g.map(G=>ir(G));const L=Math.ceil(_/l);for(let G=0;G<_;++G){let V=T;!V&&O!==null&&P!==null&&(V=O+G*(P-O)/(_-1)),V||(V=10+G*100/(_-1));let U=u+G%L*N+2*Math.PI/l*Math.floor(G/L);f||(U=c-G%L*N-2*Math.PI/l*Math.floor(G/L)),C[G].data.x=E[0]+Math.cos(U)*V,C[G].data.y=E[1]+Math.sin(U)*V}return t&&C.forEach(G=>{e.mergeNodeData(G.id,{x:G.data.x,y:G.data.y})}),{nodes:C,edges:y}})}}const Ex=(r,t,e=!1)=>{const n=[ir(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,l)=>{if(l!==0)if((l===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[l+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(ir(o)),i[o.id]=!0,s++;else{const u=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let c=!1;for(let d=0;d<u.length;d++){const f=u[d];if(r.getDegree(f.id)===r.getDegree(o.id)&&!i[f.id]){n.push(ir(f)),i[f.id]=!0,c=!0;break}}let h=0;for(;!c&&(i[t[h].id]||(n.push(ir(t[h])),i[t[h].id]=!0,c=!0),h++,h!==a););}}),n};function f8(r,t){const e=[];return t.forEach((n,i)=>{e.push(ir(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const g8=(r,t,e)=>{let n=r,i=t,a=e;return!n&&typeof window<"u"&&(n=window.innerWidth),!i&&typeof window<"u"&&(i=window.innerHeight),a||(a=[n/2,i/2]),[n,i,a]},v8={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class wm{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},v8),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:l,maxLevelDiff:u,sweep:c,clockwise:h,equidistant:d,preventOverlap:f,startAngle:v=3/2*Math.PI,nodeSize:p,nodeSpacing:g}=i,y=e.getAllNodes(),m=e.getAllEdges(),w=!s&&typeof window<"u"?window.innerWidth:s,E=!o&&typeof window<"u"?window.innerHeight:o,_=a||[w/2,E/2];if(!(y!=null&&y.length)||y.length===1)return Ua(e,t,_);const k=[];let T,O=0;yi(p)?T=Math.max(p[0],p[1]):Ot(p)?(T=-1/0,y.forEach(j=>{const Z=Math.max(...al(p(j)));Z>T&&(T=Z)})):T=p,yi(g)?O=Math.max(g[0],g[1]):St(g)&&(O=g),y.forEach(j=>{const Z=ir(j);k.push(Z);let nt=T;const{data:st}=Z;yi(st.size)?nt=Math.max(st.size[0],st.size[1]):St(st.size)?nt=st.size:Ve(st.size)&&(nt=Math.max(st.size.width,st.size.height)),T=Math.max(T,nt),Ot(g)&&(O=Math.max(g(j),O))});const P={};k.forEach((j,Z)=>{P[j.id]=Z});let N=l;(!ee(N)||k[0].data[N]===void 0)&&(N="degree"),N==="degree"?k.sort((j,Z)=>e.getDegree(Z.id,"both")-e.getDegree(j.id,"both")):k.sort((j,Z)=>Z.data[N]-j.data[N]);const C=k[0],L=(u||(N==="degree"?e.getDegree(C.id,"both"):C.data[N]))/4,B=[{nodes:[]}];let G=B[0];k.forEach(j=>{if(G.nodes.length>0){const Z=Math.abs(N==="degree"?e.getDegree(G.nodes[0].id,"both")-e.getDegree(j.id,"both"):G.nodes[0].data[N]-j.data[N]);L&&Z>=L&&(G={nodes:[]},B.push(G))}G.nodes.push(j)});let V=T+O;if(!f){const j=B.length>0&&B[0].nodes.length>1,nt=(Math.min(w,E)/2-V)/(B.length+(j?1:0));V=Math.min(V,nt)}let U=0;if(B.forEach(j=>{const Z=c===void 0?2*Math.PI-2*Math.PI/j.nodes.length:c;if(j.dTheta=Z/Math.max(1,j.nodes.length-1),j.nodes.length>1&&f){const nt=Math.cos(j.dTheta)-Math.cos(0),st=Math.sin(j.dTheta)-Math.sin(0),ot=Math.sqrt(V*V/(nt*nt+st*st));U=Math.max(ot,U)}j.r=U,U+=V}),d){let j=0,Z=0;for(let nt=0;nt<B.length;nt++){const ot=(B[nt].r||0)-Z;j=Math.max(j,ot)}Z=0,B.forEach((nt,st)=>{st===0&&(Z=nt.r||0),nt.r=Z,Z+=j})}return B.forEach(j=>{const Z=j.dTheta||0,nt=j.r||0;j.nodes.forEach((st,ot)=>{const Pt=v+(h?1:-1)*Z*ot;st.data.x=_[0]+nt*Math.cos(Pt),st.data.y=_[1]+nt*Math.sin(Pt)})}),t&&k.forEach(j=>e.mergeNodeData(j.id,{x:j.data.x,y:j.data.y})),{nodes:k,edges:m}})}}function p8(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return pP(this.cover(t,e),t,e,r)}function pP(r,t,e,n){if(isNaN(t)||isNaN(e))return r;var i,a=r._root,s={data:n},o=r._x0,l=r._y0,u=r._x1,c=r._y1,h,d,f,v,p,g,y,m;if(!a)return r._root=s,r;for(;a.length;)if((p=t>=(h=(o+u)/2))?o=h:u=h,(g=e>=(d=(l+c)/2))?l=d:c=d,i=a,!(a=a[y=g<<1|p]))return i[y]=s,r;if(f=+r._x.call(null,a.data),v=+r._y.call(null,a.data),t===f&&e===v)return s.next=a,i?i[y]=s:r._root=s,r;do i=i?i[y]=new Array(4):r._root=new Array(4),(p=t>=(h=(o+u)/2))?o=h:u=h,(g=e>=(d=(l+c)/2))?l=d:c=d;while((y=g<<1|p)===(m=(v>=d)<<1|f>=h));return i[m]=a,i[y]=s,r}function y8(r){var t,e,n=r.length,i,a,s=new Array(n),o=new Array(n),l=1/0,u=1/0,c=-1/0,h=-1/0;for(e=0;e<n;++e)isNaN(i=+this._x.call(null,t=r[e]))||isNaN(a=+this._y.call(null,t))||(s[e]=i,o[e]=a,i<l&&(l=i),i>c&&(c=i),a<u&&(u=a),a>h&&(h=a));if(l>c||u>h)return this;for(this.cover(l,u).cover(c,h),e=0;e<n;++e)pP(this,s[e],o[e],r[e]);return this}function m8(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 s=i-e||1,o=this._root,l,u;e>r||r>=i||n>t||t>=a;)switch(u=(t<n)<<1|r<e,l=new Array(4),l[u]=o,o=l,s*=2,u){case 0:i=e+s,a=n+s;break;case 1:e=i-s,a=n+s;break;case 2:i=e+s,n=a-s;break;case 3:e=i-s,n=a-s;break}this._root&&this._root.length&&(this._root=o)}return this._x0=e,this._y0=n,this._x1=i,this._y1=a,this}function b8(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function w8(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 x8(r,t,e){var n,i=this._x0,a=this._y0,s,o,l,u,c=this._x1,h=this._y1,d=[],f=this._root,v,p;for(f&&d.push(new Ln(f,i,a,c,h)),e==null?e=1/0:(i=r-e,a=t-e,c=r+e,h=t+e,e*=e);v=d.pop();)if(!(!(f=v.node)||(s=v.x0)>c||(o=v.y0)>h||(l=v.x1)<i||(u=v.y1)<a))if(f.length){var g=(s+l)/2,y=(o+u)/2;d.push(new Ln(f[3],g,y,l,u),new Ln(f[2],s,y,g,u),new Ln(f[1],g,o,l,y),new Ln(f[0],s,o,g,y)),(p=(t>=y)<<1|r>=g)&&(v=d[d.length-1],d[d.length-1]=d[d.length-1-p],d[d.length-1-p]=v)}else{var m=r-+this._x.call(null,f.data),w=t-+this._y.call(null,f.data),E=m*m+w*w;if(E<e){var _=Math.sqrt(e=E);i=r-_,a=t-_,c=r+_,h=t+_,n=f.data}}return n}function E8(r){if(isNaN(c=+this._x.call(null,r))||isNaN(h=+this._y.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._x1,u=this._y1,c,h,d,f,v,p,g,y;if(!e)return this;if(e.length)for(;;){if((v=c>=(d=(s+l)/2))?s=d:l=d,(p=h>=(f=(o+u)/2))?o=f:u=f,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 S8(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function _8(){return this._root}function M8(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function k8(r){var t=[],e,n=this._root,i,a,s,o,l;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,s=e.y0,o=e.x1,l=e.y1)&&n.length){var u=(a+o)/2,c=(s+l)/2;(i=n[3])&&t.push(new Ln(i,u,c,o,l)),(i=n[2])&&t.push(new Ln(i,a,c,u,l)),(i=n[1])&&t.push(new Ln(i,u,s,o,c)),(i=n[0])&&t.push(new Ln(i,a,s,u,c))}return this}function O8(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,s=n.x0,o=n.y0,l=n.x1,u=n.y1,c=(s+l)/2,h=(o+u)/2;(a=i[0])&&t.push(new Ln(a,s,o,c,h)),(a=i[1])&&t.push(new Ln(a,c,o,l,h)),(a=i[2])&&t.push(new Ln(a,s,h,c,u)),(a=i[3])&&t.push(new Ln(a,c,h,l,u))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function T8(r){return r[0]}function A8(r){return arguments.length?(this._x=r,this):this._x}function P8(r){return r[1]}function N8(r){return arguments.length?(this._y=r,this):this._y}function $c(r,t,e){var n=new M1(t==null?T8:t,e==null?P8:e,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function M1(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 Sx(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var Fn=$c.prototype=M1.prototype;Fn.copy=function(){var r=new M1(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=Sx(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]=Sx(n));return r};Fn.add=p8;Fn.addAll=y8;Fn.cover=m8;Fn.data=b8;Fn.extent=w8;Fn.find=x8;Fn.remove=E8;Fn.removeAll=S8;Fn.root=_8;Fn.size=M8;Fn.visit=k8;Fn.visitAfter=O8;Fn.x=A8;Fn.y=N8;function C8(r){const t=+this._x.call(null,r),e=+this._y.call(null,r),n=+this._z.call(null,r);return yP(this.cover(t,e,n),t,e,n,r)}function yP(r,t,e,n,i){if(isNaN(t)||isNaN(e)||isNaN(n))return r;var a,s=r._root,o={data:i},l=r._x0,u=r._y0,c=r._z0,h=r._x1,d=r._y1,f=r._z1,v,p,g,y,m,w,E,_,k,T,O;if(!s)return r._root=o,r;for(;s.length;)if((E=t>=(v=(l+h)/2))?l=v:h=v,(_=e>=(p=(u+d)/2))?u=p:d=p,(k=n>=(g=(c+f)/2))?c=g:f=g,a=s,!(s=s[T=k<<2|_<<1|E]))return a[T]=o,r;if(y=+r._x.call(null,s.data),m=+r._y.call(null,s.data),w=+r._z.call(null,s.data),t===y&&e===m&&n===w)return o.next=s,a?a[T]=o:r._root=o,r;do a=a?a[T]=new Array(8):r._root=new Array(8),(E=t>=(v=(l+h)/2))?l=v:h=v,(_=e>=(p=(u+d)/2))?u=p:d=p,(k=n>=(g=(c+f)/2))?c=g:f=g;while((T=k<<2|_<<1|E)===(O=(w>=g)<<2|(m>=p)<<1|y>=v));return a[O]=s,a[T]=o,r}function R8(r){Array.isArray(r)||(r=Array.from(r));const t=r.length,e=new Float64Array(t),n=new Float64Array(t),i=new Float64Array(t);let a=1/0,s=1/0,o=1/0,l=-1/0,u=-1/0,c=-1/0;for(let h=0,d,f,v,p;h<t;++h)isNaN(f=+this._x.call(null,d=r[h]))||isNaN(v=+this._y.call(null,d))||isNaN(p=+this._z.call(null,d))||(e[h]=f,n[h]=v,i[h]=p,f<a&&(a=f),f>l&&(l=f),v<s&&(s=v),v>u&&(u=v),p<o&&(o=p),p>c&&(c=p));if(a>l||s>u||o>c)return this;this.cover(a,s,o).cover(l,u,c);for(let h=0;h<t;++h)yP(this,e[h],n[h],i[h],r[h]);return this}function L8(r,t,e){if(isNaN(r=+r)||isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,a=this._z0,s=this._x1,o=this._y1,l=this._z1;if(isNaN(n))s=(n=Math.floor(r))+1,o=(i=Math.floor(t))+1,l=(a=Math.floor(e))+1;else{for(var u=s-n||1,c=this._root,h,d;n>r||r>=s||i>t||t>=o||a>e||e>=l;)switch(d=(e<a)<<2|(t<i)<<1|r<n,h=new Array(8),h[d]=c,c=h,u*=2,d){case 0:s=n+u,o=i+u,l=a+u;break;case 1:n=s-u,o=i+u,l=a+u;break;case 2:s=n+u,i=o-u,l=a+u;break;case 3:n=s-u,i=o-u,l=a+u;break;case 4:s=n+u,o=i+u,a=l-u;break;case 5:n=s-u,o=i+u,a=l-u;break;case 6:s=n+u,i=o-u,a=l-u;break;case 7:n=s-u,i=o-u,a=l-u;break}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this}function I8(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function D8(r){return arguments.length?this.cover(+r[0][0],+r[0][1],+r[0][2]).cover(+r[1][0],+r[1][1],+r[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ve(r,t,e,n,i,a,s){this.node=r,this.x0=t,this.y0=e,this.z0=n,this.x1=i,this.y1=a,this.z1=s}function B8(r,t,e,n){var i,a=this._x0,s=this._y0,o=this._z0,l,u,c,h,d,f,v=this._x1,p=this._y1,g=this._z1,y=[],m=this._root,w,E;for(m&&y.push(new ve(m,a,s,o,v,p,g)),n==null?n=1/0:(a=r-n,s=t-n,o=e-n,v=r+n,p=t+n,g=e+n,n*=n);w=y.pop();)if(!(!(m=w.node)||(l=w.x0)>v||(u=w.y0)>p||(c=w.z0)>g||(h=w.x1)<a||(d=w.y1)<s||(f=w.z1)<o))if(m.length){var _=(l+h)/2,k=(u+d)/2,T=(c+f)/2;y.push(new ve(m[7],_,k,T,h,d,f),new ve(m[6],l,k,T,_,d,f),new ve(m[5],_,u,T,h,k,f),new ve(m[4],l,u,T,_,k,f),new ve(m[3],_,k,c,h,d,T),new ve(m[2],l,k,c,_,d,T),new ve(m[1],_,u,c,h,k,T),new ve(m[0],l,u,c,_,k,T)),(E=(e>=T)<<2|(t>=k)<<1|r>=_)&&(w=y[y.length-1],y[y.length-1]=y[y.length-1-E],y[y.length-1-E]=w)}else{var O=r-+this._x.call(null,m.data),P=t-+this._y.call(null,m.data),N=e-+this._z.call(null,m.data),C=O*O+P*P+N*N;if(C<n){var L=Math.sqrt(n=C);a=r-L,s=t-L,o=e-L,v=r+L,p=t+L,g=e+L,i=m.data}}return i}const F8=(r,t,e,n,i,a)=>Math.sqrt((r-n)**2+(t-i)**2+(e-a)**2);function z8(r,t,e,n){const i=[],a=r-n,s=t-n,o=e-n,l=r+n,u=t+n,c=e+n;return this.visit((h,d,f,v,p,g,y)=>{if(!h.length)do{const m=h.data;F8(r,t,e,this._x(m),this._y(m),this._z(m))<=n&&i.push(m)}while(h=h.next);return d>l||f>u||v>c||p<a||g<s||y<o}),i}function j8(r){if(isNaN(d=+this._x.call(null,r))||isNaN(f=+this._y.call(null,r))||isNaN(v=+this._z.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._z0,u=this._x1,c=this._y1,h=this._z1,d,f,v,p,g,y,m,w,E,_,k;if(!e)return this;if(e.length)for(;;){if((m=d>=(p=(s+u)/2))?s=p:u=p,(w=f>=(g=(o+c)/2))?o=g:c=g,(E=v>=(y=(l+h)/2))?l=y:h=y,t=e,!(e=e[_=E<<2|w<<1|m]))return this;if(!e.length)break;(t[_+1&7]||t[_+2&7]||t[_+3&7]||t[_+4&7]||t[_+5&7]||t[_+6&7]||t[_+7&7])&&(n=t,k=_)}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[_]=a:delete t[_],(e=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&e===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[k]=e:this._root=e),this):(this._root=a,this)}function q8(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function $8(){return this._root}function G8(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function W8(r){var t=[],e,n=this._root,i,a,s,o,l,u,c;for(n&&t.push(new ve(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=t.pop();)if(!r(n=e.node,a=e.x0,s=e.y0,o=e.z0,l=e.x1,u=e.y1,c=e.z1)&&n.length){var h=(a+l)/2,d=(s+u)/2,f=(o+c)/2;(i=n[7])&&t.push(new ve(i,h,d,f,l,u,c)),(i=n[6])&&t.push(new ve(i,a,d,f,h,u,c)),(i=n[5])&&t.push(new ve(i,h,s,f,l,d,c)),(i=n[4])&&t.push(new ve(i,a,s,f,h,d,c)),(i=n[3])&&t.push(new ve(i,h,d,o,l,u,f)),(i=n[2])&&t.push(new ve(i,a,d,o,h,u,f)),(i=n[1])&&t.push(new ve(i,h,s,o,l,d,f)),(i=n[0])&&t.push(new ve(i,a,s,o,h,d,f))}return this}function V8(r){var t=[],e=[],n;for(this._root&&t.push(new ve(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();){var i=n.node;if(i.length){var a,s=n.x0,o=n.y0,l=n.z0,u=n.x1,c=n.y1,h=n.z1,d=(s+u)/2,f=(o+c)/2,v=(l+h)/2;(a=i[0])&&t.push(new ve(a,s,o,l,d,f,v)),(a=i[1])&&t.push(new ve(a,d,o,l,u,f,v)),(a=i[2])&&t.push(new ve(a,s,f,l,d,c,v)),(a=i[3])&&t.push(new ve(a,d,f,l,u,c,v)),(a=i[4])&&t.push(new ve(a,s,o,v,d,f,h)),(a=i[5])&&t.push(new ve(a,d,o,v,u,f,h)),(a=i[6])&&t.push(new ve(a,s,f,v,d,c,h)),(a=i[7])&&t.push(new ve(a,d,f,v,u,c,h))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function U8(r){return r[0]}function Y8(r){return arguments.length?(this._x=r,this):this._x}function H8(r){return r[1]}function X8(r){return arguments.length?(this._y=r,this):this._y}function K8(r){return r[2]}function Z8(r){return arguments.length?(this._z=r,this):this._z}function mP(r,t,e,n){var i=new k1(t==null?U8:t,e==null?H8:e,n==null?K8:n,NaN,NaN,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function k1(r,t,e,n,i,a,s,o,l){this._x=r,this._y=t,this._z=e,this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this._root=void 0}function _x(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var Sn=mP.prototype=k1.prototype;Sn.copy=function(){var r=new k1(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,e,n;if(!t)return r;if(!t.length)return r._root=_x(t),r;for(e=[{source:t,target:r._root=new Array(8)}];t=e.pop();)for(var i=0;i<8;++i)(n=t.source[i])&&(n.length?e.push({source:n,target:t.target[i]=new Array(8)}):t.target[i]=_x(n));return r};Sn.add=C8;Sn.addAll=R8;Sn.cover=L8;Sn.data=I8;Sn.extent=D8;Sn.find=B8;Sn.findAllWithinRadius=z8;Sn.remove=j8;Sn.removeAll=q8;Sn.root=$8;Sn.size=G8;Sn.visit=W8;Sn.visitAfter=V8;Sn.x=Y8;Sn.y=X8;Sn.z=Z8;const J8=.81,$d=.1;function Q8(r,t,e,n,i=2){const a=t/e,s=r.getAllNodes(),o=s.map((c,h)=>{const{nodeStrength:d,x:f,y:v,z:p,size:g}=c.data;return{x:f,y:v,z:p,size:g,index:h,id:c.id,vx:0,vy:0,vz:0,weight:a*d}}),l=(i===2?$c(o,c=>c.x,c=>c.y):mP(o,c=>c.x,c=>c.y,c=>c.z)).visitAfter(t9),u=new Map;return o.forEach(c=>{u.set(c.id,c),n9(c,l,i)}),o.map((c,h)=>{const{id:d,data:f}=s[h],{mass:v=1}=f;n[d]={x:c.vx/v,y:c.vy/v,z:c.vz/v}}),n}function t9(r){let t=0,e=0,n=0,i=0,a=0;const s=r.length;if(s){for(let o=0;o<s;o++){const l=r[o];l&&l.weight&&(t+=l.weight,e+=l.x*l.weight,n+=l.y*l.weight,i+=l.z*l.weight,a+=l.size*l.weight)}r.x=e/t,r.y=n/t,r.z=i/t,r.size=a/t,r.weight=t}else{const o=r;r.x=o.data.x,r.y=o.data.y,r.z=o.data.z,r.size=o.data.size,r.weight=o.data.weight}}const e9=(r,t,e,n,i,a,s)=>{var o;if(((o=r.data)===null||o===void 0?void 0:o.id)===a.id)return;const l=[e,n,i][s-1],u=a.x-r.x||$d,c=a.y-r.y||$d,h=a.z-r.z||$d,d=[u,c,h],f=l-t;let v=0;for(let y=0;y<s;y++)v+=d[y]*d[y];const g=Math.sqrt(v)*v;if(f*f*J8<v){const y=r.weight/g;return a.vx+=u*y,a.vy+=c*y,a.vz+=h*y,!0}if(r.length)return!1;if(r.data!==a){const y=r.data.weight/g;a.vx+=u*y,a.vy+=c*y,a.vz+=h*y}};function n9(r,t,e){t.visit((n,i,a,s,o)=>e9(n,i,a,s,o,r,e))}const r9={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class bP{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},r9),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&n<t;n++)this.runOneStep(this.lastCalcGraph,this.lastGraph,n,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericForceLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),a=e.getAllNodes(),s=e.getAllEdges(),o=this.formatOptions(i,e),{dimensions:l,width:u,height:c,nodeSize:h,getMass:d,nodeStrength:f,edgeStrength:v,linkDistance:p}=o,g=a.map((O,P)=>Object.assign(Object.assign({},O),{data:Object.assign(Object.assign({},O.data),{x:St(O.data.x)?O.data.x:Math.random()*u,y:St(O.data.y)?O.data.y:Math.random()*c,z:St(O.data.z)?O.data.z:Math.random()*Math.sqrt(u*c),size:h(O)||30,mass:d(O),nodeStrength:f(O)})})),y=s.map(O=>Object.assign(Object.assign({},O),{data:Object.assign(Object.assign({},O.data),{edgeStrength:v(O),linkDistance:p(O,e.getNode(O.source),e.getNode(O.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const m={};a.forEach((O,P)=>{m[O.id]={x:0,y:0,z:0}});const w=new ln({nodes:g,edges:y});this.formatCentripetal(o,w);const{maxIteration:E,minMovement:_,onTick:k}=o;if(this.lastLayoutNodes=g,this.lastLayoutEdges=y,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=w,this.lastOptions=o,this.lastVelMap=m,typeof window>"u")return;let T=0;return new Promise(O=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&O({nodes:Gd(e,g),edges:s}),this.runOneStep(w,e,T,m,o),this.updatePosition(e,w,m,o),t&&g.forEach(P=>e.mergeNodeData(P.id,{x:P.data.x,y:P.data.y,z:l===3?P.data.z:void 0})),k==null||k({nodes:Gd(e,g),edges:s}),T++,(T>=E||this.judgingDistance<_)&&(window.clearInterval(this.timeInterval),O({nodes:Gd(e,g),edges:s}))},0),this.running=!0})})}formatOptions(t,e){const n=Object.assign({},t),{width:i,height:a,getMass:s}=t;n.width=!i&&typeof window<"u"?window.innerWidth:i,n.height=!a&&typeof window<"u"?window.innerHeight:a,t.center||(n.center=[n.width/2,n.height/2]),s||(n.getMass=l=>{let u=1;St(l==null?void 0:l.data.mass)&&(u=l==null?void 0:l.data.mass);const c=e.getDegree(l.id,"both");return!c||c<5?u:c*5*u}),n.nodeSize=_1(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Pa(1,t.linkDistance):l=>1+n.nodeSize(e.getNode(l.source))+n.nodeSize(e.getNode(l.target));return n.linkDistance=o,n.nodeStrength=Pa(1,t.nodeStrength),n.edgeStrength=Pa(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:l,nodeClusterBy:u}=t,c=e.getAllNodes(),h=i||{leaf:2,single:2,others:1,center:y=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=y=>s);let d,f;if(o&&u&&(d=Mx(e,u),f=Array.from(new Set(c==null?void 0:c.map(y=>y.data[u])))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:y=>{const{siblingLeaves:m,sameTypeLeaves:w}=d[y.id]||{};return(w==null?void 0:w.length)===(m==null?void 0:m.length)||(f==null?void 0:f.length)===1?1:t.clusterNodeStrength(y)},others:1,center:y=>{const m=e.getDegree(y.id,"both");if(!m)return{x:100,y:100,z:0};let w;if(m===1){const{sameTypeLeaves:E=[]}=d[y.id]||{};E.length===1?w=void 0:E.length>1&&(w=kx(E))}else w=void 0;return{x:w==null?void 0:w.x,y:w==null?void 0:w.y,z:w==null?void 0:w.z}}})),l&&u){d||(d=Mx(e,u)),f||(f=Array.from(new Set(c.map(m=>m.data[u])))),f=f.filter(m=>m!==void 0);const y={};f.forEach(m=>{const w=c.filter(E=>E.data[u]===m).map(E=>e.getNode(E.id));y[m]=kx(w)}),t.centripetalOptions=Object.assign(h,{single:m=>t.clusterNodeStrength(m),leaf:m=>t.clusterNodeStrength(m),others:m=>t.clusterNodeStrength(m),center:m=>{const w=y[m.data[u]];return{x:w==null?void 0:w.x,y:w==null?void 0:w.y,z:w==null?void 0:w.z}}})}const{leaf:v,single:p,others:g}=t.centripetalOptions||{};v&&typeof v!="function"&&(t.centripetalOptions.leaf=()=>v),p&&typeof p!="function"&&(t.centripetalOptions.single=()=>p),g&&typeof g!="function"&&(t.centripetalOptions.others=()=>g)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),l=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:u}=a;if(this.calRepulsive(t,s,a),l&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),u){const c=this.calTotalEnergy(s,o);u({energy:c,nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(e!=null&&e.length))return 0;let n=0;return e.forEach((i,a)=>{const s=t[i.id].x,o=t[i.id].y,l=this.options.dimensions===3?t[i.id].z:0,u=s*s+o*o+l*l,{mass:c=1}=i.data;n+=c*u*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;Q8(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:l,target:u}=s,c=t.getNode(l),h=t.getNode(u);if(!c||!h)return;let d=h.data.x-c.data.x,f=h.data.y-c.data.y,v=i===3?h.data.z-c.data.z:0;!d&&!f&&(d=Math.random()*.01,f=Math.random()*.01,i===3&&!v&&(v=Math.random()*.01));const p=Math.sqrt(d*d+f*f+v*v);if(p<a(c)+a(h))return;const g=d/p,y=f/p,m=v/p,{linkDistance:w=200,edgeStrength:E=200}=s.data||{},k=(w-p)*E,T=c.data.mass||1,O=h.data.mass||1,P=1/T,N=1/O,C=g*k,L=y*k,B=m*k;e[l].x-=C*P,e[l].y-=L*P,e[l].z-=B*P,e[u].x+=C*N,e[u].y+=L*N,e[u].z+=B*N})}calGravity(t,e,n,i){const{getCenter:a}=i,s=t.getAllNodes(),o=e.getAllNodes(),l=e.getAllEdges(),{width:u,height:c,center:h,gravity:d,centripetalOptions:f}=i;s&&s.forEach(v=>{const{id:p,data:g}=v,{mass:y,x:m,y:w,z:E}=g,_=e.getNode(p);let k=0,T=0,O=0,P=d;const N=t.getDegree(p,"in"),C=t.getDegree(p,"out"),L=t.getDegree(p,"both"),B=a==null?void 0:a(_,L);if(B){const[G,V,U]=B;k=m-G,T=w-V,P=U}else k=m-h[0],T=w-h[1],O=E-h[2];if(P&&(n[p].x-=P*k/y,n[p].y-=P*T/y,n[p].z-=P*O/y),f){const{leaf:G,single:V,others:U,center:$}=f,{x:j,y:Z,z:nt,centerStrength:st}=($==null?void 0:$(_,o,l,u,c))||{x:0,y:0,z:0,centerStrength:0};if(!St(j)||!St(Z))return;const ot=(m-j)/y,Pt=(w-Z)/y,K=(E-nt)/y;if(st&&(n[p].x-=st*ot,n[p].y-=st*Pt,n[p].z-=st*K),L===0){const tt=V(_);if(!tt)return;n[p].x-=tt*ot,n[p].y-=tt*Pt,n[p].z-=tt*K;return}if(N===0||C===0){const tt=G(_,o,l);if(!tt)return;n[p].x-=tt*ot,n[p].y-=tt*Pt,n[p].z-=tt*K;return}const W=U(_);if(!W)return;n[p].x-=W*ot,n[p].y-=W*Pt,n[p].z-=W*K}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:l}=i,u=t.getAllNodes();u!=null&&u.length&&u.forEach(c=>{const{id:h}=c;let d=(n[h].x+e[h].x*o)*a||.01,f=(n[h].y+e[h].y*o)*a||.01,v=l===3?(n[h].z+e[h].z*o)*a||.01:0;const p=Math.sqrt(d*d+f*f+v*v);if(p>s){const g=s/p;d=g*d,f=g*f,v=g*v}n[h]={x:d,y:f,z:v}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,l=e.getAllNodes();if(!(l!=null&&l.length)){this.judgingDistance=0;return}let u=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),l.forEach(c=>{const{id:h}=c,d=t.getNode(h);if(St(d.data.fx)&&St(d.data.fy)){e.mergeNodeData(h,{x:d.data.fx,y:d.data.fy,z:o===3?d.data.fz:void 0});return}const f=n[h].x*s,v=n[h].y*s,p=o===3?n[h].z*s:0;e.mergeNodeData(h,{x:c.data.x+f,y:c.data.y+v,z:c.data.z+p});const g=Math.sqrt(f*f+v*v+p*p);switch(a){case"max":this.judgingDistance<g&&(this.judgingDistance=g);break;case"min":this.judgingDistance>g&&(this.judgingDistance=g);break;default:u=u+g;break}}),(!a||a==="mean")&&(this.judgingDistance=u/l.length)}}const Mx=(r,t)=>{const e=r.getAllNodes();if(!(e!=null&&e.length))return{};const n={};return e.forEach((i,a)=>{r.getDegree(i.id,"both")===1&&(n[i.id]=i9(r,"leaf",i,t))}),n},i9=(r,t,e,n)=>{const i=r.getDegree(e.id,"in"),a=r.getDegree(e.id,"out");let s=e,o=[];i===0?(s=r.getSuccessors(e.id)[0],o=r.getNeighbors(s.id)):a===0&&(s=r.getPredecessors(e.id)[0],o=r.getNeighbors(s.id)),o=o.filter(u=>r.getDegree(u.id,"in")===0||r.getDegree(u.id,"out")===0);const l=a9(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:l}},a9=(r,t,e,n,i)=>{const a=n.data[e]||"";let s=(i==null?void 0:i.filter(o=>o.data[e]===a))||[];return s=s.filter(o=>r.getDegree(o.id,"in")===0||r.getDegree(o.id,"out")===0),s},kx=r=>{const t={x:0,y:0};r.forEach(n=>{const{x:i,y:a}=n.data;t.x+=i||0,t.y+=a||0});const e=r.length||1;return{x:t.x/e,y:t.y/e}},Gd=(r,t)=>t.map(e=>{const{id:n,data:i}=e,a=r.getNode(n);return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign({},a.data),{x:i.x,y:i.y,z:i.z})})});var Kt={};const s9=Object.prototype.toString;function Bo(r){const t=s9.call(r);return t.endsWith("Array]")&&!t.includes("Big")}const o9=Object.freeze(Object.defineProperty({__proto__:null,isAnyArray:Bo},Symbol.toStringTag,{value:"Module"})),l9=SO(o9);function u9(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Bo(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 s=r[n],o=n+1;o<a;o++)r[o]>s&&(s=r[o]);return s}function c9(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Bo(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 s=r[n],o=n+1;o<a;o++)r[o]<s&&(s=r[o]);return s}function h9(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Bo(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(!Bo(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(r.length);var n=c9(r),i=u9(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=t.min,s=a===void 0?t.autoMinMax?n:0:a,o=t.max,l=o===void 0?t.autoMinMax?i:1:o;if(s>=l)throw new RangeError("min option must be smaller than max option");for(var u=(l-s)/(i-n),c=0;c<r.length;c++)e[c]=(r[c]-n)*u+s;return e}const d9=Object.freeze(Object.defineProperty({__proto__:null,default:h9},Symbol.toStringTag,{value:"Module"})),f9=SO(d9);var Ox;function g9(){var Vs,xm,Mn;if(Ox)return Kt;Ox=1,Object.defineProperty(Kt,"__esModule",{value:!0});var r=l9,t=f9;const e=" ".repeat(2),n=" ".repeat(4);function i(){return a(this)}function a(R,M={}){const{maxRows:x=15,maxColumns:b=10,maxNumSize:S=8,padMinus:A="auto"}=M;return`${R.constructor.name} {
7
- ${e}[
8
- ${n}${s(R,x,b,S,A)}
9
- ${e}]
10
- ${e}rows: ${R.rows}
11
- ${e}columns: ${R.columns}
12
- }`}function s(R,M,x,b,S){const{rows:A,columns:I}=R,D=Math.min(A,M),F=Math.min(I,x),z=[];if(S==="auto"){S=!1;t:for(let Q=0;Q<D;Q++)for(let Y=0;Y<F;Y++)if(R.get(Q,Y)<0){S=!0;break t}}for(let Q=0;Q<D;Q++){let Y=[];for(let at=0;at<F;at++)Y.push(o(R.get(Q,at),b,S));z.push(`${Y.join(" ")}`)}return F!==I&&(z[z.length-1]+=` ... ${I-x} more columns`),D!==A&&z.push(`... ${A-M} more rows`),z.join(`
13
- ${n}`)}function o(R,M,x){return(R>=0&&x?` ${l(R,M-1)}`:l(R,M)).padEnd(M)}function l(R,M){let x=R.toString();if(x.length<=M)return x;let b=R.toFixed(M);if(b.length>M&&(b=R.toFixed(Math.max(0,M-(b.length-M)))),b.length<=M&&!b.startsWith("0.000")&&!b.startsWith("-0.000"))return b;let S=R.toExponential(M);return S.length>M&&(S=R.toExponential(Math.max(0,M-(S.length-M)))),S.slice(0)}function u(R,M){R.prototype.add=function(b){return typeof b=="number"?this.addS(b):this.addM(b)},R.prototype.addS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)+b);return this},R.prototype.addM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)+b.get(S,A));return this},R.add=function(b,S){return new M(b).add(S)},R.prototype.sub=function(b){return typeof b=="number"?this.subS(b):this.subM(b)},R.prototype.subS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)-b);return this},R.prototype.subM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)-b.get(S,A));return this},R.sub=function(b,S){return new M(b).sub(S)},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(b){return typeof b=="number"?this.mulS(b):this.mulM(b)},R.prototype.mulS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)*b);return this},R.prototype.mulM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)*b.get(S,A));return this},R.mul=function(b,S){return new M(b).mul(S)},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(b){return typeof b=="number"?this.divS(b):this.divM(b)},R.prototype.divS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)/b);return this},R.prototype.divM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)/b.get(S,A));return this},R.div=function(b,S){return new M(b).div(S)},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(b){return typeof b=="number"?this.modS(b):this.modM(b)},R.prototype.modS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)%b);return this},R.prototype.modM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)%b.get(S,A));return this},R.mod=function(b,S){return new M(b).mod(S)},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(b){return typeof b=="number"?this.andS(b):this.andM(b)},R.prototype.andS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)&b);return this},R.prototype.andM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)&b.get(S,A));return this},R.and=function(b,S){return new M(b).and(S)},R.prototype.or=function(b){return typeof b=="number"?this.orS(b):this.orM(b)},R.prototype.orS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)|b);return this},R.prototype.orM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)|b.get(S,A));return this},R.or=function(b,S){return new M(b).or(S)},R.prototype.xor=function(b){return typeof b=="number"?this.xorS(b):this.xorM(b)},R.prototype.xorS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)^b);return this},R.prototype.xorM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)^b.get(S,A));return this},R.xor=function(b,S){return new M(b).xor(S)},R.prototype.leftShift=function(b){return typeof b=="number"?this.leftShiftS(b):this.leftShiftM(b)},R.prototype.leftShiftS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)<<b);return this},R.prototype.leftShiftM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)<<b.get(S,A));return this},R.leftShift=function(b,S){return new M(b).leftShift(S)},R.prototype.signPropagatingRightShift=function(b){return typeof b=="number"?this.signPropagatingRightShiftS(b):this.signPropagatingRightShiftM(b)},R.prototype.signPropagatingRightShiftS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)>>b);return this},R.prototype.signPropagatingRightShiftM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)>>b.get(S,A));return this},R.signPropagatingRightShift=function(b,S){return new M(b).signPropagatingRightShift(S)},R.prototype.rightShift=function(b){return typeof b=="number"?this.rightShiftS(b):this.rightShiftM(b)},R.prototype.rightShiftS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)>>>b);return this},R.prototype.rightShiftM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)>>>b.get(S,A));return this},R.rightShift=function(b,S){return new M(b).rightShift(S)},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 b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,~this.get(b,S));return this},R.not=function(b){return new M(b).not()},R.prototype.abs=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.abs(this.get(b,S)));return this},R.abs=function(b){return new M(b).abs()},R.prototype.acos=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.acos(this.get(b,S)));return this},R.acos=function(b){return new M(b).acos()},R.prototype.acosh=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.acosh(this.get(b,S)));return this},R.acosh=function(b){return new M(b).acosh()},R.prototype.asin=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.asin(this.get(b,S)));return this},R.asin=function(b){return new M(b).asin()},R.prototype.asinh=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.asinh(this.get(b,S)));return this},R.asinh=function(b){return new M(b).asinh()},R.prototype.atan=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.atan(this.get(b,S)));return this},R.atan=function(b){return new M(b).atan()},R.prototype.atanh=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.atanh(this.get(b,S)));return this},R.atanh=function(b){return new M(b).atanh()},R.prototype.cbrt=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.cbrt(this.get(b,S)));return this},R.cbrt=function(b){return new M(b).cbrt()},R.prototype.ceil=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.ceil(this.get(b,S)));return this},R.ceil=function(b){return new M(b).ceil()},R.prototype.clz32=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.clz32(this.get(b,S)));return this},R.clz32=function(b){return new M(b).clz32()},R.prototype.cos=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.cos(this.get(b,S)));return this},R.cos=function(b){return new M(b).cos()},R.prototype.cosh=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.cosh(this.get(b,S)));return this},R.cosh=function(b){return new M(b).cosh()},R.prototype.exp=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.exp(this.get(b,S)));return this},R.exp=function(b){return new M(b).exp()},R.prototype.expm1=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.expm1(this.get(b,S)));return this},R.expm1=function(b){return new M(b).expm1()},R.prototype.floor=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.floor(this.get(b,S)));return this},R.floor=function(b){return new M(b).floor()},R.prototype.fround=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.fround(this.get(b,S)));return this},R.fround=function(b){return new M(b).fround()},R.prototype.log=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.log(this.get(b,S)));return this},R.log=function(b){return new M(b).log()},R.prototype.log1p=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.log1p(this.get(b,S)));return this},R.log1p=function(b){return new M(b).log1p()},R.prototype.log10=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.log10(this.get(b,S)));return this},R.log10=function(b){return new M(b).log10()},R.prototype.log2=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.log2(this.get(b,S)));return this},R.log2=function(b){return new M(b).log2()},R.prototype.round=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.round(this.get(b,S)));return this},R.round=function(b){return new M(b).round()},R.prototype.sign=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.sign(this.get(b,S)));return this},R.sign=function(b){return new M(b).sign()},R.prototype.sin=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.sin(this.get(b,S)));return this},R.sin=function(b){return new M(b).sin()},R.prototype.sinh=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.sinh(this.get(b,S)));return this},R.sinh=function(b){return new M(b).sinh()},R.prototype.sqrt=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.sqrt(this.get(b,S)));return this},R.sqrt=function(b){return new M(b).sqrt()},R.prototype.tan=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.tan(this.get(b,S)));return this},R.tan=function(b){return new M(b).tan()},R.prototype.tanh=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.tanh(this.get(b,S)));return this},R.tanh=function(b){return new M(b).tanh()},R.prototype.trunc=function(){for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.set(b,S,Math.trunc(this.get(b,S)));return this},R.trunc=function(b){return new M(b).trunc()},R.pow=function(b,S){return new M(b).pow(S)},R.prototype.pow=function(b){return typeof b=="number"?this.powS(b):this.powM(b)},R.prototype.powS=function(b){for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)**b);return this},R.prototype.powM=function(b){if(b=M.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(let S=0;S<this.rows;S++)for(let A=0;A<this.columns;A++)this.set(S,A,this.get(S,A)**b.get(S,A));return this}}function c(R,M,x){let b=x?R.rows:R.rows-1;if(M<0||M>b)throw new RangeError("Row index out of range")}function h(R,M,x){let b=x?R.columns:R.columns-1;if(M<0||M>b)throw new RangeError("Column index out of range")}function d(R,M){if(M.to1DArray&&(M=M.to1DArray()),M.length!==R.columns)throw new RangeError("vector size must be the same as the number of columns");return M}function f(R,M){if(M.to1DArray&&(M=M.to1DArray()),M.length!==R.rows)throw new RangeError("vector size must be the same as the number of rows");return M}function v(R,M){if(!r.isAnyArray(M))throw new TypeError("row indices must be an array");for(let x=0;x<M.length;x++)if(M[x]<0||M[x]>=R.rows)throw new RangeError("row indices are out of range")}function p(R,M){if(!r.isAnyArray(M))throw new TypeError("column indices must be an array");for(let x=0;x<M.length;x++)if(M[x]<0||M[x]>=R.columns)throw new RangeError("column indices are out of range")}function g(R,M,x,b,S){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(m("startRow",M),m("endRow",x),m("startColumn",b),m("endColumn",S),M>x||b>S||M<0||M>=R.rows||x<0||x>=R.rows||b<0||b>=R.columns||S<0||S>=R.columns)throw new RangeError("Submatrix indices are out of range")}function y(R,M=0){let x=[];for(let b=0;b<R;b++)x.push(M);return x}function m(R,M){if(typeof M!="number")throw new TypeError(`${R} must be a number`)}function w(R){if(R.isEmpty())throw new Error("Empty matrix has no elements to index")}function E(R){let M=y(R.rows);for(let x=0;x<R.rows;++x)for(let b=0;b<R.columns;++b)M[x]+=R.get(x,b);return M}function _(R){let M=y(R.columns);for(let x=0;x<R.rows;++x)for(let b=0;b<R.columns;++b)M[b]+=R.get(x,b);return M}function k(R){let M=0;for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)M+=R.get(x,b);return M}function T(R){let M=y(R.rows,1);for(let x=0;x<R.rows;++x)for(let b=0;b<R.columns;++b)M[x]*=R.get(x,b);return M}function O(R){let M=y(R.columns,1);for(let x=0;x<R.rows;++x)for(let b=0;b<R.columns;++b)M[b]*=R.get(x,b);return M}function P(R){let M=1;for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)M*=R.get(x,b);return M}function N(R,M,x){const b=R.rows,S=R.columns,A=[];for(let I=0;I<b;I++){let D=0,F=0,z=0;for(let Q=0;Q<S;Q++)z=R.get(I,Q)-x[I],D+=z,F+=z*z;M?A.push((F-D*D/S)/(S-1)):A.push((F-D*D/S)/S)}return A}function C(R,M,x){const b=R.rows,S=R.columns,A=[];for(let I=0;I<S;I++){let D=0,F=0,z=0;for(let Q=0;Q<b;Q++)z=R.get(Q,I)-x[I],D+=z,F+=z*z;M?A.push((F-D*D/b)/(b-1)):A.push((F-D*D/b)/b)}return A}function L(R,M,x){const b=R.rows,S=R.columns,A=b*S;let I=0,D=0,F=0;for(let z=0;z<b;z++)for(let Q=0;Q<S;Q++)F=R.get(z,Q)-x,I+=F,D+=F*F;return M?(D-I*I/A)/(A-1):(D-I*I/A)/A}function B(R,M){for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)R.set(x,b,R.get(x,b)-M[x])}function G(R,M){for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)R.set(x,b,R.get(x,b)-M[b])}function V(R,M){for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)R.set(x,b,R.get(x,b)-M)}function U(R){const M=[];for(let x=0;x<R.rows;x++){let b=0;for(let S=0;S<R.columns;S++)b+=R.get(x,S)**2/(R.columns-1);M.push(Math.sqrt(b))}return M}function $(R,M){for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)R.set(x,b,R.get(x,b)/M[x])}function j(R){const M=[];for(let x=0;x<R.columns;x++){let b=0;for(let S=0;S<R.rows;S++)b+=R.get(S,x)**2/(R.rows-1);M.push(Math.sqrt(b))}return M}function Z(R,M){for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)R.set(x,b,R.get(x,b)/M[b])}function nt(R){const M=R.size-1;let x=0;for(let b=0;b<R.columns;b++)for(let S=0;S<R.rows;S++)x+=R.get(S,b)**2/M;return Math.sqrt(x)}function st(R,M){for(let x=0;x<R.rows;x++)for(let b=0;b<R.columns;b++)R.set(x,b,R.get(x,b)/M)}class ot{static from1DArray(M,x,b){if(M*x!==b.length)throw new RangeError("data length does not match given dimensions");let A=new W(M,x);for(let I=0;I<M;I++)for(let D=0;D<x;D++)A.set(I,D,b[I*x+D]);return A}static rowVector(M){let x=new W(1,M.length);for(let b=0;b<M.length;b++)x.set(0,b,M[b]);return x}static columnVector(M){let x=new W(M.length,1);for(let b=0;b<M.length;b++)x.set(b,0,M[b]);return x}static zeros(M,x){return new W(M,x)}static ones(M,x){return new W(M,x).fill(1)}static rand(M,x,b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{random:S=Math.random}=b;let A=new W(M,x);for(let I=0;I<M;I++)for(let D=0;D<x;D++)A.set(I,D,S());return A}static randInt(M,x,b={}){if(typeof b!="object")throw new TypeError("options must be an object");const{min:S=0,max:A=1e3,random:I=Math.random}=b;if(!Number.isInteger(S))throw new TypeError("min must be an integer");if(!Number.isInteger(A))throw new TypeError("max must be an integer");if(S>=A)throw new RangeError("min must be smaller than max");let D=A-S,F=new W(M,x);for(let z=0;z<M;z++)for(let Q=0;Q<x;Q++){let Y=S+Math.round(I()*D);F.set(z,Q,Y)}return F}static eye(M,x,b){x===void 0&&(x=M),b===void 0&&(b=1);let S=Math.min(M,x),A=this.zeros(M,x);for(let I=0;I<S;I++)A.set(I,I,b);return A}static diag(M,x,b){let S=M.length;x===void 0&&(x=S),b===void 0&&(b=x);let A=Math.min(S,x,b),I=this.zeros(x,b);for(let D=0;D<A;D++)I.set(D,D,M[D]);return I}static min(M,x){M=this.checkMatrix(M),x=this.checkMatrix(x);let b=M.rows,S=M.columns,A=new W(b,S);for(let I=0;I<b;I++)for(let D=0;D<S;D++)A.set(I,D,Math.min(M.get(I,D),x.get(I,D)));return A}static max(M,x){M=this.checkMatrix(M),x=this.checkMatrix(x);let b=M.rows,S=M.columns,A=new this(b,S);for(let I=0;I<b;I++)for(let D=0;D<S;D++)A.set(I,D,Math.max(M.get(I,D),x.get(I,D)));return A}static checkMatrix(M){return ot.isMatrix(M)?M:new W(M)}static isMatrix(M){return M!=null&&M.klass==="Matrix"}get size(){return this.rows*this.columns}apply(M){if(typeof M!="function")throw new TypeError("callback must be a function");for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)M.call(this,x,b);return this}to1DArray(){let M=[];for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)M.push(this.get(x,b));return M}to2DArray(){let M=[];for(let x=0;x<this.rows;x++){M.push([]);for(let b=0;b<this.columns;b++)M[x].push(this.get(x,b))}return M}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let M=0;M<this.rows;M++)for(let x=0;x<=M;x++)if(this.get(M,x)!==this.get(x,M))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let M=0;M<this.rows;M++)if(this.get(M,M)!==0)return!1;return!0}isEchelonForm(){let M=0,x=0,b=-1,S=!0,A=!1;for(;M<this.rows&&S;){for(x=0,A=!1;x<this.columns&&A===!1;)this.get(M,x)===0?x++:this.get(M,x)===1&&x>b?(A=!0,b=x):(S=!1,A=!0);M++}return S}isReducedEchelonForm(){let M=0,x=0,b=-1,S=!0,A=!1;for(;M<this.rows&&S;){for(x=0,A=!1;x<this.columns&&A===!1;)this.get(M,x)===0?x++:this.get(M,x)===1&&x>b?(A=!0,b=x):(S=!1,A=!0);for(let I=x+1;I<this.rows;I++)this.get(M,I)!==0&&(S=!1);M++}return S}echelonForm(){let M=this.clone(),x=0,b=0;for(;x<M.rows&&b<M.columns;){let S=x;for(let A=x;A<M.rows;A++)M.get(A,b)>M.get(S,b)&&(S=A);if(M.get(S,b)===0)b++;else{M.swapRows(x,S);let A=M.get(x,b);for(let I=b;I<M.columns;I++)M.set(x,I,M.get(x,I)/A);for(let I=x+1;I<M.rows;I++){let D=M.get(I,b)/M.get(x,b);M.set(I,b,0);for(let F=b+1;F<M.columns;F++)M.set(I,F,M.get(I,F)-M.get(x,F)*D)}x++,b++}}return M}reducedEchelonForm(){let M=this.echelonForm(),x=M.columns,b=M.rows,S=b-1;for(;S>=0;)if(M.maxRow(S)===0)S--;else{let A=0,I=!1;for(;A<b&&I===!1;)M.get(S,A)===1?I=!0:A++;for(let D=0;D<S;D++){let F=M.get(D,A);for(let z=A;z<x;z++){let Q=M.get(D,z)-F*M.get(S,z);M.set(D,z,Q)}}S--}return M}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(M={}){if(typeof M!="object")throw new TypeError("options must be an object");const{rows:x=1,columns:b=1}=M;if(!Number.isInteger(x)||x<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(b)||b<=0)throw new TypeError("columns must be a positive integer");let S=new W(this.rows*x,this.columns*b);for(let A=0;A<x;A++)for(let I=0;I<b;I++)S.setSubMatrix(this,this.rows*A,this.columns*I);return S}fill(M){for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,M);return this}neg(){return this.mulS(-1)}getRow(M){c(this,M);let x=[];for(let b=0;b<this.columns;b++)x.push(this.get(M,b));return x}getRowVector(M){return W.rowVector(this.getRow(M))}setRow(M,x){c(this,M),x=d(this,x);for(let b=0;b<this.columns;b++)this.set(M,b,x[b]);return this}swapRows(M,x){c(this,M),c(this,x);for(let b=0;b<this.columns;b++){let S=this.get(M,b);this.set(M,b,this.get(x,b)),this.set(x,b,S)}return this}getColumn(M){h(this,M);let x=[];for(let b=0;b<this.rows;b++)x.push(this.get(b,M));return x}getColumnVector(M){return W.columnVector(this.getColumn(M))}setColumn(M,x){h(this,M),x=f(this,x);for(let b=0;b<this.rows;b++)this.set(b,M,x[b]);return this}swapColumns(M,x){h(this,M),h(this,x);for(let b=0;b<this.rows;b++){let S=this.get(b,M);this.set(b,M,this.get(b,x)),this.set(b,x,S)}return this}addRowVector(M){M=d(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)+M[b]);return this}subRowVector(M){M=d(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)-M[b]);return this}mulRowVector(M){M=d(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)*M[b]);return this}divRowVector(M){M=d(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)/M[b]);return this}addColumnVector(M){M=f(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)+M[x]);return this}subColumnVector(M){M=f(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)-M[x]);return this}mulColumnVector(M){M=f(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)*M[x]);return this}divColumnVector(M){M=f(this,M);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)this.set(x,b,this.get(x,b)/M[x]);return this}mulRow(M,x){c(this,M);for(let b=0;b<this.columns;b++)this.set(M,b,this.get(M,b)*x);return this}mulColumn(M,x){h(this,M);for(let b=0;b<this.rows;b++)this.set(b,M,this.get(b,M)*x);return this}max(M){if(this.isEmpty())return NaN;switch(M){case"row":{const x=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)>x[b]&&(x[b]=this.get(b,S));return x}case"column":{const x=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)>x[S]&&(x[S]=this.get(b,S));return x}case void 0:{let x=this.get(0,0);for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)>x&&(x=this.get(b,S));return x}default:throw new Error(`invalid option: ${M}`)}}maxIndex(){w(this);let M=this.get(0,0),x=[0,0];for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)>M&&(M=this.get(b,S),x[0]=b,x[1]=S);return x}min(M){if(this.isEmpty())return NaN;switch(M){case"row":{const x=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)<x[b]&&(x[b]=this.get(b,S));return x}case"column":{const x=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)<x[S]&&(x[S]=this.get(b,S));return x}case void 0:{let x=this.get(0,0);for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)<x&&(x=this.get(b,S));return x}default:throw new Error(`invalid option: ${M}`)}}minIndex(){w(this);let M=this.get(0,0),x=[0,0];for(let b=0;b<this.rows;b++)for(let S=0;S<this.columns;S++)this.get(b,S)<M&&(M=this.get(b,S),x[0]=b,x[1]=S);return x}maxRow(M){if(c(this,M),this.isEmpty())return NaN;let x=this.get(M,0);for(let b=1;b<this.columns;b++)this.get(M,b)>x&&(x=this.get(M,b));return x}maxRowIndex(M){c(this,M),w(this);let x=this.get(M,0),b=[M,0];for(let S=1;S<this.columns;S++)this.get(M,S)>x&&(x=this.get(M,S),b[1]=S);return b}minRow(M){if(c(this,M),this.isEmpty())return NaN;let x=this.get(M,0);for(let b=1;b<this.columns;b++)this.get(M,b)<x&&(x=this.get(M,b));return x}minRowIndex(M){c(this,M),w(this);let x=this.get(M,0),b=[M,0];for(let S=1;S<this.columns;S++)this.get(M,S)<x&&(x=this.get(M,S),b[1]=S);return b}maxColumn(M){if(h(this,M),this.isEmpty())return NaN;let x=this.get(0,M);for(let b=1;b<this.rows;b++)this.get(b,M)>x&&(x=this.get(b,M));return x}maxColumnIndex(M){h(this,M),w(this);let x=this.get(0,M),b=[0,M];for(let S=1;S<this.rows;S++)this.get(S,M)>x&&(x=this.get(S,M),b[0]=S);return b}minColumn(M){if(h(this,M),this.isEmpty())return NaN;let x=this.get(0,M);for(let b=1;b<this.rows;b++)this.get(b,M)<x&&(x=this.get(b,M));return x}minColumnIndex(M){h(this,M),w(this);let x=this.get(0,M),b=[0,M];for(let S=1;S<this.rows;S++)this.get(S,M)<x&&(x=this.get(S,M),b[0]=S);return b}diag(){let M=Math.min(this.rows,this.columns),x=[];for(let b=0;b<M;b++)x.push(this.get(b,b));return x}norm(M="frobenius"){switch(M){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${M}`)}}cumulativeSum(){let M=0;for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)M+=this.get(x,b),this.set(x,b,M);return this}dot(M){ot.isMatrix(M)&&(M=M.to1DArray());let x=this.to1DArray();if(x.length!==M.length)throw new RangeError("vectors do not have the same size");let b=0;for(let S=0;S<x.length;S++)b+=x[S]*M[S];return b}mmul(M){M=W.checkMatrix(M);let x=this.rows,b=this.columns,S=M.columns,A=new W(x,S),I=new Float64Array(b);for(let D=0;D<S;D++){for(let F=0;F<b;F++)I[F]=M.get(F,D);for(let F=0;F<x;F++){let z=0;for(let Q=0;Q<b;Q++)z+=this.get(F,Q)*I[Q];A.set(F,D,z)}}return A}strassen2x2(M){M=W.checkMatrix(M);let x=new W(2,2);const b=this.get(0,0),S=M.get(0,0),A=this.get(0,1),I=M.get(0,1),D=this.get(1,0),F=M.get(1,0),z=this.get(1,1),Q=M.get(1,1),Y=(b+z)*(S+Q),at=(D+z)*S,mt=b*(I-Q),et=z*(F-S),lt=(b+A)*Q,Mt=(D-b)*(S+I),H=(A-z)*(F+Q),yt=Y+et-lt+H,At=mt+lt,Dt=at+et,zt=Y-at+mt+Mt;return x.set(0,0,yt),x.set(0,1,At),x.set(1,0,Dt),x.set(1,1,zt),x}strassen3x3(M){M=W.checkMatrix(M);let x=new W(3,3);const b=this.get(0,0),S=this.get(0,1),A=this.get(0,2),I=this.get(1,0),D=this.get(1,1),F=this.get(1,2),z=this.get(2,0),Q=this.get(2,1),Y=this.get(2,2),at=M.get(0,0),mt=M.get(0,1),et=M.get(0,2),lt=M.get(1,0),Mt=M.get(1,1),H=M.get(1,2),yt=M.get(2,0),At=M.get(2,1),Dt=M.get(2,2),zt=(b+S+A-I-D-Q-Y)*Mt,Te=(b-I)*(-mt+Mt),Ct=D*(-at+mt+lt-Mt-H-yt+Dt),Lt=(-b+I+D)*(at-mt+Mt),ce=(I+D)*(-at+mt),X=b*at,gt=(-b+z+Q)*(at-et+H),kt=(-b+z)*(et-H),vt=(z+Q)*(-at+et),Ae=(b+S+A-D-F-z-Q)*H,ne=Q*(-at+et+lt-Mt-H-yt+At),xe=(-A+Q+Y)*(Mt+yt-At),Pe=(A-Y)*(Mt-At),vn=A*yt,Mr=(Q+Y)*(-yt+At),tn=(-A+D+F)*(H+yt-Dt),Vr=(A-F)*(H-Dt),hi=(D+F)*(-yt+Dt),Qt=S*lt,pn=F*At,Kn=I*et,Zn=z*mt,en=Y*Dt,DC=X+vn+Qt,BC=zt+Lt+ce+X+xe+vn+Mr,FC=X+gt+vt+Ae+vn+tn+hi,zC=Te+Ct+Lt+X+vn+tn+Vr,jC=Te+Lt+ce+X+pn,qC=vn+tn+Vr+hi+Kn,$C=X+gt+kt+ne+xe+Pe+vn,GC=xe+Pe+vn+Mr+Zn,WC=X+gt+kt+vt+en;return x.set(0,0,DC),x.set(0,1,BC),x.set(0,2,FC),x.set(1,0,zC),x.set(1,1,jC),x.set(1,2,qC),x.set(2,0,$C),x.set(2,1,GC),x.set(2,2,WC),x}mmulStrassen(M){M=W.checkMatrix(M);let x=this.clone(),b=x.rows,S=x.columns,A=M.rows,I=M.columns;S!==A&&console.warn(`Multiplying ${b} x ${S} and ${A} x ${I} matrix: dimensions do not match.`);function D(Y,at,mt){let et=Y.rows,lt=Y.columns;if(et===at&&lt===mt)return Y;{let Mt=ot.zeros(at,mt);return Mt=Mt.setSubMatrix(Y,0,0),Mt}}let F=Math.max(b,A),z=Math.max(S,I);x=D(x,F,z),M=D(M,F,z);function Q(Y,at,mt,et){if(mt<=512||et<=512)return Y.mmul(at);mt%2===1&&et%2===1?(Y=D(Y,mt+1,et+1),at=D(at,mt+1,et+1)):mt%2===1?(Y=D(Y,mt+1,et),at=D(at,mt+1,et)):et%2===1&&(Y=D(Y,mt,et+1),at=D(at,mt,et+1));let lt=parseInt(Y.rows/2,10),Mt=parseInt(Y.columns/2,10),H=Y.subMatrix(0,lt-1,0,Mt-1),yt=at.subMatrix(0,lt-1,0,Mt-1),At=Y.subMatrix(0,lt-1,Mt,Y.columns-1),Dt=at.subMatrix(0,lt-1,Mt,at.columns-1),zt=Y.subMatrix(lt,Y.rows-1,0,Mt-1),Te=at.subMatrix(lt,at.rows-1,0,Mt-1),Ct=Y.subMatrix(lt,Y.rows-1,Mt,Y.columns-1),Lt=at.subMatrix(lt,at.rows-1,Mt,at.columns-1),ce=Q(ot.add(H,Ct),ot.add(yt,Lt),lt,Mt),X=Q(ot.add(zt,Ct),yt,lt,Mt),gt=Q(H,ot.sub(Dt,Lt),lt,Mt),kt=Q(Ct,ot.sub(Te,yt),lt,Mt),vt=Q(ot.add(H,At),Lt,lt,Mt),Ae=Q(ot.sub(zt,H),ot.add(yt,Dt),lt,Mt),ne=Q(ot.sub(At,Ct),ot.add(Te,Lt),lt,Mt),xe=ot.add(ce,kt);xe.sub(vt),xe.add(ne);let Pe=ot.add(gt,vt),vn=ot.add(X,kt),Mr=ot.sub(ce,X);Mr.add(gt),Mr.add(Ae);let tn=ot.zeros(2*xe.rows,2*xe.columns);return tn=tn.setSubMatrix(xe,0,0),tn=tn.setSubMatrix(Pe,xe.rows,0),tn=tn.setSubMatrix(vn,0,xe.columns),tn=tn.setSubMatrix(Mr,xe.rows,xe.columns),tn.subMatrix(0,mt-1,0,et-1)}return Q(x,M,F,z)}scaleRows(M={}){if(typeof M!="object")throw new TypeError("options must be an object");const{min:x=0,max:b=1}=M;if(!Number.isFinite(x))throw new TypeError("min must be a number");if(!Number.isFinite(b))throw new TypeError("max must be a number");if(x>=b)throw new RangeError("min must be smaller than max");let S=new W(this.rows,this.columns);for(let A=0;A<this.rows;A++){const I=this.getRow(A);I.length>0&&t(I,{min:x,max:b,output:I}),S.setRow(A,I)}return S}scaleColumns(M={}){if(typeof M!="object")throw new TypeError("options must be an object");const{min:x=0,max:b=1}=M;if(!Number.isFinite(x))throw new TypeError("min must be a number");if(!Number.isFinite(b))throw new TypeError("max must be a number");if(x>=b)throw new RangeError("min must be smaller than max");let S=new W(this.rows,this.columns);for(let A=0;A<this.columns;A++){const I=this.getColumn(A);I.length&&t(I,{min:x,max:b,output:I}),S.setColumn(A,I)}return S}flipRows(){const M=Math.ceil(this.columns/2);for(let x=0;x<this.rows;x++)for(let b=0;b<M;b++){let S=this.get(x,b),A=this.get(x,this.columns-1-b);this.set(x,b,A),this.set(x,this.columns-1-b,S)}return this}flipColumns(){const M=Math.ceil(this.rows/2);for(let x=0;x<this.columns;x++)for(let b=0;b<M;b++){let S=this.get(b,x),A=this.get(this.rows-1-b,x);this.set(b,x,A),this.set(this.rows-1-b,x,S)}return this}kroneckerProduct(M){M=W.checkMatrix(M);let x=this.rows,b=this.columns,S=M.rows,A=M.columns,I=new W(x*S,b*A);for(let D=0;D<x;D++)for(let F=0;F<b;F++)for(let z=0;z<S;z++)for(let Q=0;Q<A;Q++)I.set(S*D+z,A*F+Q,this.get(D,F)*M.get(z,Q));return I}kroneckerSum(M){if(M=W.checkMatrix(M),!this.isSquare()||!M.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let x=this.rows,b=M.rows,S=this.kroneckerProduct(W.eye(b,b)),A=W.eye(x,x).kroneckerProduct(M);return S.add(A)}transpose(){let M=new W(this.columns,this.rows);for(let x=0;x<this.rows;x++)for(let b=0;b<this.columns;b++)M.set(b,x,this.get(x,b));return M}sortRows(M=Pt){for(let x=0;x<this.rows;x++)this.setRow(x,this.getRow(x).sort(M));return this}sortColumns(M=Pt){for(let x=0;x<this.columns;x++)this.setColumn(x,this.getColumn(x).sort(M));return this}subMatrix(M,x,b,S){g(this,M,x,b,S);let A=new W(x-M+1,S-b+1);for(let I=M;I<=x;I++)for(let D=b;D<=S;D++)A.set(I-M,D-b,this.get(I,D));return A}subMatrixRow(M,x,b){if(x===void 0&&(x=0),b===void 0&&(b=this.columns-1),x>b||x<0||x>=this.columns||b<0||b>=this.columns)throw new RangeError("Argument out of range");let S=new W(M.length,b-x+1);for(let A=0;A<M.length;A++)for(let I=x;I<=b;I++){if(M[A]<0||M[A]>=this.rows)throw new RangeError(`Row index out of range: ${M[A]}`);S.set(A,I-x,this.get(M[A],I))}return S}subMatrixColumn(M,x,b){if(x===void 0&&(x=0),b===void 0&&(b=this.rows-1),x>b||x<0||x>=this.rows||b<0||b>=this.rows)throw new RangeError("Argument out of range");let S=new W(b-x+1,M.length);for(let A=0;A<M.length;A++)for(let I=x;I<=b;I++){if(M[A]<0||M[A]>=this.columns)throw new RangeError(`Column index out of range: ${M[A]}`);S.set(I-x,A,this.get(I,M[A]))}return S}setSubMatrix(M,x,b){if(M=W.checkMatrix(M),M.isEmpty())return this;let S=x+M.rows-1,A=b+M.columns-1;g(this,x,S,b,A);for(let I=0;I<M.rows;I++)for(let D=0;D<M.columns;D++)this.set(x+I,b+D,M.get(I,D));return this}selection(M,x){v(this,M),p(this,x);let b=new W(M.length,x.length);for(let S=0;S<M.length;S++){let A=M[S];for(let I=0;I<x.length;I++){let D=x[I];b.set(S,I,this.get(A,D))}}return b}trace(){let M=Math.min(this.rows,this.columns),x=0;for(let b=0;b<M;b++)x+=this.get(b,b);return x}clone(){return this.constructor.copy(this,new W(this.rows,this.columns))}static copy(M,x){for(const[b,S,A]of M.entries())x.set(b,S,A);return x}sum(M){switch(M){case"row":return E(this);case"column":return _(this);case void 0:return k(this);default:throw new Error(`invalid option: ${M}`)}}product(M){switch(M){case"row":return T(this);case"column":return O(this);case void 0:return P(this);default:throw new Error(`invalid option: ${M}`)}}mean(M){const x=this.sum(M);switch(M){case"row":{for(let b=0;b<this.rows;b++)x[b]/=this.columns;return x}case"column":{for(let b=0;b<this.columns;b++)x[b]/=this.rows;return x}case void 0:return x/this.size;default:throw new Error(`invalid option: ${M}`)}}variance(M,x={}){if(typeof M=="object"&&(x=M,M=void 0),typeof x!="object")throw new TypeError("options must be an object");const{unbiased:b=!0,mean:S=this.mean(M)}=x;if(typeof b!="boolean")throw new TypeError("unbiased must be a boolean");switch(M){case"row":{if(!r.isAnyArray(S))throw new TypeError("mean must be an array");return N(this,b,S)}case"column":{if(!r.isAnyArray(S))throw new TypeError("mean must be an array");return C(this,b,S)}case void 0:{if(typeof S!="number")throw new TypeError("mean must be a number");return L(this,b,S)}default:throw new Error(`invalid option: ${M}`)}}standardDeviation(M,x){typeof M=="object"&&(x=M,M=void 0);const b=this.variance(M,x);if(M===void 0)return Math.sqrt(b);for(let S=0;S<b.length;S++)b[S]=Math.sqrt(b[S]);return b}center(M,x={}){if(typeof M=="object"&&(x=M,M=void 0),typeof x!="object")throw new TypeError("options must be an object");const{center:b=this.mean(M)}=x;switch(M){case"row":{if(!r.isAnyArray(b))throw new TypeError("center must be an array");return B(this,b),this}case"column":{if(!r.isAnyArray(b))throw new TypeError("center must be an array");return G(this,b),this}case void 0:{if(typeof b!="number")throw new TypeError("center must be a number");return V(this,b),this}default:throw new Error(`invalid option: ${M}`)}}scale(M,x={}){if(typeof M=="object"&&(x=M,M=void 0),typeof x!="object")throw new TypeError("options must be an object");let b=x.scale;switch(M){case"row":{if(b===void 0)b=U(this);else if(!r.isAnyArray(b))throw new TypeError("scale must be an array");return $(this,b),this}case"column":{if(b===void 0)b=j(this);else if(!r.isAnyArray(b))throw new TypeError("scale must be an array");return Z(this,b),this}case void 0:{if(b===void 0)b=nt(this);else if(typeof b!="number")throw new TypeError("scale must be a number");return st(this,b),this}default:throw new Error(`invalid option: ${M}`)}}toString(M){return a(this,M)}[Symbol.iterator](){return this.entries()}*entries(){for(let M=0;M<this.rows;M++)for(let x=0;x<this.columns;x++)yield[M,x,this.get(M,x)]}*values(){for(let M=0;M<this.rows;M++)for(let x=0;x<this.columns;x++)yield this.get(M,x)}}ot.prototype.klass="Matrix",typeof Symbol<"u"&&(ot.prototype[Symbol.for("nodejs.util.inspect.custom")]=i);function Pt(R,M){return R-M}function K(R){return R.every(M=>typeof M=="number")}ot.random=ot.rand,ot.randomInt=ot.randInt,ot.diagonal=ot.diag,ot.prototype.diagonal=ot.prototype.diag,ot.identity=ot.eye,ot.prototype.negate=ot.prototype.neg,ot.prototype.tensorProduct=ot.prototype.kroneckerProduct;const vl=class vl extends ot{constructor(x,b){super();$h(this,Vs);he(this,"data");if(vl.isMatrix(x))Gh(this,Vs,xm).call(this,x.rows,x.columns),vl.copy(x,this);else if(Number.isInteger(x)&&x>=0)Gh(this,Vs,xm).call(this,x,b);else if(r.isAnyArray(x)){const S=x;if(x=S.length,b=x?S[0].length:0,typeof b!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let A=0;A<x;A++){if(S[A].length!==b)throw new RangeError("Inconsistent array dimensions");if(!K(S[A]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(S[A]))}this.rows=x,this.columns=b}else throw new TypeError("First argument must be a positive number or an array")}set(x,b,S){return this.data[x][b]=S,this}get(x,b){return this.data[x][b]}removeRow(x){return c(this,x),this.data.splice(x,1),this.rows-=1,this}addRow(x,b){return b===void 0&&(b=x,x=this.rows),c(this,x,!0),b=Float64Array.from(d(this,b)),this.data.splice(x,0,b),this.rows+=1,this}removeColumn(x){h(this,x);for(let b=0;b<this.rows;b++){const S=new Float64Array(this.columns-1);for(let A=0;A<x;A++)S[A]=this.data[b][A];for(let A=x+1;A<this.columns;A++)S[A-1]=this.data[b][A];this.data[b]=S}return this.columns-=1,this}addColumn(x,b){typeof b>"u"&&(b=x,x=this.columns),h(this,x,!0),b=f(this,b);for(let S=0;S<this.rows;S++){const A=new Float64Array(this.columns+1);let I=0;for(;I<x;I++)A[I]=this.data[S][I];for(A[I++]=b[S];I<this.columns+1;I++)A[I]=this.data[S][I-1];this.data[S]=A}return this.columns+=1,this}};Vs=new WeakSet,xm=function(x,b){if(this.data=[],Number.isInteger(b)&&b>=0)for(let S=0;S<x;S++)this.data.push(new Float64Array(b));else throw new TypeError("nColumns must be a positive integer");this.rows=x,this.columns=b};let W=vl;u(ot,W);const pl=class pl extends ot{constructor(x){super();$h(this,Mn);if(W.isMatrix(x)){if(!x.isSymmetric())throw new TypeError("not symmetric data");yl(this,Mn,W.copy(x,new W(x.rows,x.rows)))}else if(Number.isInteger(x)&&x>=0)yl(this,Mn,new W(x,x));else if(yl(this,Mn,new W(x)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return kr(this,Mn).size}get rows(){return kr(this,Mn).rows}get columns(){return kr(this,Mn).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(x){return W.isMatrix(x)&&x.klassType==="SymmetricMatrix"}static zeros(x){return new this(x)}static ones(x){return new this(x).fill(1)}clone(){const x=new pl(this.diagonalSize);for(const[b,S,A]of this.upperRightEntries())x.set(b,S,A);return x}toMatrix(){return new W(this)}get(x,b){return kr(this,Mn).get(x,b)}set(x,b,S){return kr(this,Mn).set(x,b,S),kr(this,Mn).set(b,x,S),this}removeCross(x){return kr(this,Mn).removeRow(x),kr(this,Mn).removeColumn(x),this}addCross(x,b){b===void 0&&(b=x,x=this.diagonalSize);const S=b.slice();return S.splice(x,1),kr(this,Mn).addRow(x,S),kr(this,Mn).addColumn(x,b),this}applyMask(x){if(x.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const b=[];for(const[S,A]of x.entries())A||b.push(S);b.reverse();for(const S of b)this.removeCross(S);return this}toCompact(){const{diagonalSize:x}=this,b=new Array(x*(x+1)/2);for(let S=0,A=0,I=0;I<b.length;I++)b[I]=this.get(A,S),++S>=x&&(S=++A);return b}static fromCompact(x){const b=x.length,S=(Math.sqrt(8*b+1)-1)/2;if(!Number.isInteger(S))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(x)}`);const A=new pl(S);for(let I=0,D=0,F=0;F<b;F++)A.set(I,D,x[F]),++I>=S&&(I=++D);return A}*upperRightEntries(){for(let x=0,b=0;x<this.diagonalSize;void 0){const S=this.get(x,b);yield[x,b,S],++b>=this.diagonalSize&&(b=++x)}}*upperRightValues(){for(let x=0,b=0;x<this.diagonalSize;void 0)yield this.get(x,b),++b>=this.diagonalSize&&(b=++x)}};Mn=new WeakMap;let tt=pl;tt.prototype.klassType="SymmetricMatrix";class ct extends tt{static isDistanceMatrix(M){return tt.isSymmetricMatrix(M)&&M.klassSubType==="DistanceMatrix"}constructor(M){if(super(M),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(M,x,b){return M===x&&(b=0),super.set(M,x,b)}addCross(M,x){return x===void 0&&(x=M,M=this.diagonalSize),x=x.slice(),x[M]=0,super.addCross(M,x)}toSymmetricMatrix(){return new tt(this)}clone(){const M=new ct(this.diagonalSize);for(const[x,b,S]of this.upperRightEntries())x!==b&&M.set(x,b,S);return M}toCompact(){const{diagonalSize:M}=this,x=(M-1)*M/2,b=new Array(x);for(let S=1,A=0,I=0;I<b.length;I++)b[I]=this.get(A,S),++S>=M&&(S=++A+1);return b}static fromCompact(M){const x=M.length;if(x===0)return new this(0);const b=(Math.sqrt(8*x+1)+1)/2;if(!Number.isInteger(b))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(M)}`);const S=new this(b);for(let A=1,I=0,D=0;D<x;D++)S.set(A,I,M[D]),++A>=b&&(A=++I+1);return S}}ct.prototype.klassSubType="DistanceMatrix";class Et extends ot{constructor(M,x,b){super(),this.matrix=M,this.rows=x,this.columns=b}}class Nt extends Et{constructor(M,x){h(M,x),super(M,M.rows,1),this.column=x}set(M,x,b){return this.matrix.set(M,this.column,b),this}get(M){return this.matrix.get(M,this.column)}}class Vt extends Et{constructor(M,x){p(M,x),super(M,M.rows,x.length),this.columnIndices=x}set(M,x,b){return this.matrix.set(M,this.columnIndices[x],b),this}get(M,x){return this.matrix.get(M,this.columnIndices[x])}}class ke extends Et{constructor(M){super(M,M.rows,M.columns)}set(M,x,b){return this.matrix.set(M,this.columns-x-1,b),this}get(M,x){return this.matrix.get(M,this.columns-x-1)}}class un extends Et{constructor(M){super(M,M.rows,M.columns)}set(M,x,b){return this.matrix.set(this.rows-M-1,x,b),this}get(M,x){return this.matrix.get(this.rows-M-1,x)}}class Oe extends Et{constructor(M,x){c(M,x),super(M,1,M.columns),this.row=x}set(M,x,b){return this.matrix.set(this.row,x,b),this}get(M,x){return this.matrix.get(this.row,x)}}class Ue extends Et{constructor(M,x){v(M,x),super(M,x.length,M.columns),this.rowIndices=x}set(M,x,b){return this.matrix.set(this.rowIndices[M],x,b),this}get(M,x){return this.matrix.get(this.rowIndices[M],x)}}class Xt extends Et{constructor(M,x,b){v(M,x),p(M,b),super(M,x.length,b.length),this.rowIndices=x,this.columnIndices=b}set(M,x,b){return this.matrix.set(this.rowIndices[M],this.columnIndices[x],b),this}get(M,x){return this.matrix.get(this.rowIndices[M],this.columnIndices[x])}}class cr extends Et{constructor(M,x,b,S,A){g(M,x,b,S,A),super(M,b-x+1,A-S+1),this.startRow=x,this.startColumn=S}set(M,x,b){return this.matrix.set(this.startRow+M,this.startColumn+x,b),this}get(M,x){return this.matrix.get(this.startRow+M,this.startColumn+x)}}class Jt extends Et{constructor(M){super(M,M.columns,M.rows)}set(M,x,b){return this.matrix.set(x,M,b),this}get(M,x){return this.matrix.get(x,M)}}class hr extends ot{constructor(M,x={}){const{rows:b=1}=x;if(M.length%b!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=b,this.columns=M.length/b,this.data=M}set(M,x,b){let S=this._calculateIndex(M,x);return this.data[S]=b,this}get(M,x){let b=this._calculateIndex(M,x);return this.data[b]}_calculateIndex(M,x){return M*this.columns+x}}class we extends ot{constructor(M){super(),this.data=M,this.rows=M.length,this.columns=M[0].length}set(M,x,b){return this.data[M][x]=b,this}get(M,x){return this.data[M][x]}}function Za(R,M){if(r.isAnyArray(R))return R[0]&&r.isAnyArray(R[0])?new we(R):new hr(R,M);throw new Error("the argument is not an array")}class dr{constructor(M){M=we.checkMatrix(M);let x=M.clone(),b=x.rows,S=x.columns,A=new Float64Array(b),I=1,D,F,z,Q,Y,at,mt,et,lt;for(D=0;D<b;D++)A[D]=D;for(et=new Float64Array(b),F=0;F<S;F++){for(D=0;D<b;D++)et[D]=x.get(D,F);for(D=0;D<b;D++){for(lt=Math.min(D,F),Y=0,z=0;z<lt;z++)Y+=x.get(D,z)*et[z];et[D]-=Y,x.set(D,F,et[D])}for(Q=F,D=F+1;D<b;D++)Math.abs(et[D])>Math.abs(et[Q])&&(Q=D);if(Q!==F){for(z=0;z<S;z++)at=x.get(Q,z),x.set(Q,z,x.get(F,z)),x.set(F,z,at);mt=A[Q],A[Q]=A[F],A[F]=mt,I=-I}if(F<b&&x.get(F,F)!==0)for(D=F+1;D<b;D++)x.set(D,F,x.get(D,F)/x.get(F,F))}this.LU=x,this.pivotVector=A,this.pivotSign=I}isSingular(){let M=this.LU,x=M.columns;for(let b=0;b<x;b++)if(M.get(b,b)===0)return!0;return!1}solve(M){M=W.checkMatrix(M);let x=this.LU;if(x.rows!==M.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let S=M.columns,A=M.subMatrixRow(this.pivotVector,0,S-1),I=x.columns,D,F,z;for(z=0;z<I;z++)for(D=z+1;D<I;D++)for(F=0;F<S;F++)A.set(D,F,A.get(D,F)-A.get(z,F)*x.get(D,z));for(z=I-1;z>=0;z--){for(F=0;F<S;F++)A.set(z,F,A.get(z,F)/x.get(z,z));for(D=0;D<z;D++)for(F=0;F<S;F++)A.set(D,F,A.get(D,F)-A.get(z,F)*x.get(D,z))}return A}get determinant(){let M=this.LU;if(!M.isSquare())throw new Error("Matrix must be square");let x=this.pivotSign,b=M.columns;for(let S=0;S<b;S++)x*=M.get(S,S);return x}get lowerTriangularMatrix(){let M=this.LU,x=M.rows,b=M.columns,S=new W(x,b);for(let A=0;A<x;A++)for(let I=0;I<b;I++)A>I?S.set(A,I,M.get(A,I)):A===I?S.set(A,I,1):S.set(A,I,0);return S}get upperTriangularMatrix(){let M=this.LU,x=M.rows,b=M.columns,S=new W(x,b);for(let A=0;A<x;A++)for(let I=0;I<b;I++)A<=I?S.set(A,I,M.get(A,I)):S.set(A,I,0);return S}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function $e(R,M){let x=0;return Math.abs(R)>Math.abs(M)?(x=M/R,Math.abs(R)*Math.sqrt(1+x*x)):M!==0?(x=R/M,Math.abs(M)*Math.sqrt(1+x*x)):0}class Re{constructor(M){M=we.checkMatrix(M);let x=M.clone(),b=M.rows,S=M.columns,A=new Float64Array(S),I,D,F,z;for(F=0;F<S;F++){let Q=0;for(I=F;I<b;I++)Q=$e(Q,x.get(I,F));if(Q!==0){for(x.get(F,F)<0&&(Q=-Q),I=F;I<b;I++)x.set(I,F,x.get(I,F)/Q);for(x.set(F,F,x.get(F,F)+1),D=F+1;D<S;D++){for(z=0,I=F;I<b;I++)z+=x.get(I,F)*x.get(I,D);for(z=-z/x.get(F,F),I=F;I<b;I++)x.set(I,D,x.get(I,D)+z*x.get(I,F))}}A[F]=-Q}this.QR=x,this.Rdiag=A}solve(M){M=W.checkMatrix(M);let x=this.QR,b=x.rows;if(M.rows!==b)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let S=M.columns,A=M.clone(),I=x.columns,D,F,z,Q;for(z=0;z<I;z++)for(F=0;F<S;F++){for(Q=0,D=z;D<b;D++)Q+=x.get(D,z)*A.get(D,F);for(Q=-Q/x.get(z,z),D=z;D<b;D++)A.set(D,F,A.get(D,F)+Q*x.get(D,z))}for(z=I-1;z>=0;z--){for(F=0;F<S;F++)A.set(z,F,A.get(z,F)/this.Rdiag[z]);for(D=0;D<z;D++)for(F=0;F<S;F++)A.set(D,F,A.get(D,F)-A.get(z,F)*x.get(D,z))}return A.subMatrix(0,I-1,0,S-1)}isFullRank(){let M=this.QR.columns;for(let x=0;x<M;x++)if(this.Rdiag[x]===0)return!1;return!0}get upperTriangularMatrix(){let M=this.QR,x=M.columns,b=new W(x,x),S,A;for(S=0;S<x;S++)for(A=0;A<x;A++)S<A?b.set(S,A,M.get(S,A)):S===A?b.set(S,A,this.Rdiag[S]):b.set(S,A,0);return b}get orthogonalMatrix(){let M=this.QR,x=M.rows,b=M.columns,S=new W(x,b),A,I,D,F;for(D=b-1;D>=0;D--){for(A=0;A<x;A++)S.set(A,D,0);for(S.set(D,D,1),I=D;I<b;I++)if(M.get(D,D)!==0){for(F=0,A=D;A<x;A++)F+=M.get(A,D)*S.get(A,I);for(F=-F/M.get(D,D),A=D;A<x;A++)S.set(A,I,S.get(A,I)+F*M.get(A,D))}}return S}}class zn{constructor(M,x={}){if(M=we.checkMatrix(M),M.isEmpty())throw new Error("Matrix must be non-empty");let b=M.rows,S=M.columns;const{computeLeftSingularVectors:A=!0,computeRightSingularVectors:I=!0,autoTranspose:D=!1}=x;let F=!!A,z=!!I,Q=!1,Y;if(b<S)if(!D)Y=M.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{Y=M.transpose(),b=Y.rows,S=Y.columns,Q=!0;let X=F;F=z,z=X}else Y=M.clone();let at=Math.min(b,S),mt=Math.min(b+1,S),et=new Float64Array(mt),lt=new W(b,at),Mt=new W(S,S),H=new Float64Array(S),yt=new Float64Array(b),At=new Float64Array(mt);for(let X=0;X<mt;X++)At[X]=X;let Dt=Math.min(b-1,S),zt=Math.max(0,Math.min(S-2,b)),Te=Math.max(Dt,zt);for(let X=0;X<Te;X++){if(X<Dt){et[X]=0;for(let gt=X;gt<b;gt++)et[X]=$e(et[X],Y.get(gt,X));if(et[X]!==0){Y.get(X,X)<0&&(et[X]=-et[X]);for(let gt=X;gt<b;gt++)Y.set(gt,X,Y.get(gt,X)/et[X]);Y.set(X,X,Y.get(X,X)+1)}et[X]=-et[X]}for(let gt=X+1;gt<S;gt++){if(X<Dt&&et[X]!==0){let kt=0;for(let vt=X;vt<b;vt++)kt+=Y.get(vt,X)*Y.get(vt,gt);kt=-kt/Y.get(X,X);for(let vt=X;vt<b;vt++)Y.set(vt,gt,Y.get(vt,gt)+kt*Y.get(vt,X))}H[gt]=Y.get(X,gt)}if(F&&X<Dt)for(let gt=X;gt<b;gt++)lt.set(gt,X,Y.get(gt,X));if(X<zt){H[X]=0;for(let gt=X+1;gt<S;gt++)H[X]=$e(H[X],H[gt]);if(H[X]!==0){H[X+1]<0&&(H[X]=0-H[X]);for(let gt=X+1;gt<S;gt++)H[gt]/=H[X];H[X+1]+=1}if(H[X]=-H[X],X+1<b&&H[X]!==0){for(let gt=X+1;gt<b;gt++)yt[gt]=0;for(let gt=X+1;gt<b;gt++)for(let kt=X+1;kt<S;kt++)yt[gt]+=H[kt]*Y.get(gt,kt);for(let gt=X+1;gt<S;gt++){let kt=-H[gt]/H[X+1];for(let vt=X+1;vt<b;vt++)Y.set(vt,gt,Y.get(vt,gt)+kt*yt[vt])}}if(z)for(let gt=X+1;gt<S;gt++)Mt.set(gt,X,H[gt])}}let Ct=Math.min(S,b+1);if(Dt<S&&(et[Dt]=Y.get(Dt,Dt)),b<Ct&&(et[Ct-1]=0),zt+1<Ct&&(H[zt]=Y.get(zt,Ct-1)),H[Ct-1]=0,F){for(let X=Dt;X<at;X++){for(let gt=0;gt<b;gt++)lt.set(gt,X,0);lt.set(X,X,1)}for(let X=Dt-1;X>=0;X--)if(et[X]!==0){for(let gt=X+1;gt<at;gt++){let kt=0;for(let vt=X;vt<b;vt++)kt+=lt.get(vt,X)*lt.get(vt,gt);kt=-kt/lt.get(X,X);for(let vt=X;vt<b;vt++)lt.set(vt,gt,lt.get(vt,gt)+kt*lt.get(vt,X))}for(let gt=X;gt<b;gt++)lt.set(gt,X,-lt.get(gt,X));lt.set(X,X,1+lt.get(X,X));for(let gt=0;gt<X-1;gt++)lt.set(gt,X,0)}else{for(let gt=0;gt<b;gt++)lt.set(gt,X,0);lt.set(X,X,1)}}if(z)for(let X=S-1;X>=0;X--){if(X<zt&&H[X]!==0)for(let gt=X+1;gt<S;gt++){let kt=0;for(let vt=X+1;vt<S;vt++)kt+=Mt.get(vt,X)*Mt.get(vt,gt);kt=-kt/Mt.get(X+1,X);for(let vt=X+1;vt<S;vt++)Mt.set(vt,gt,Mt.get(vt,gt)+kt*Mt.get(vt,X))}for(let gt=0;gt<S;gt++)Mt.set(gt,X,0);Mt.set(X,X,1)}let Lt=Ct-1,ce=Number.EPSILON;for(;Ct>0;){let X,gt;for(X=Ct-2;X>=-1&&X!==-1;X--){const kt=Number.MIN_VALUE+ce*Math.abs(et[X]+Math.abs(et[X+1]));if(Math.abs(H[X])<=kt||Number.isNaN(H[X])){H[X]=0;break}}if(X===Ct-2)gt=4;else{let kt;for(kt=Ct-1;kt>=X&&kt!==X;kt--){let vt=(kt!==Ct?Math.abs(H[kt]):0)+(kt!==X+1?Math.abs(H[kt-1]):0);if(Math.abs(et[kt])<=ce*vt){et[kt]=0;break}}kt===X?gt=3:kt===Ct-1?gt=1:(gt=2,X=kt)}switch(X++,gt){case 1:{let kt=H[Ct-2];H[Ct-2]=0;for(let vt=Ct-2;vt>=X;vt--){let Ae=$e(et[vt],kt),ne=et[vt]/Ae,xe=kt/Ae;if(et[vt]=Ae,vt!==X&&(kt=-xe*H[vt-1],H[vt-1]=ne*H[vt-1]),z)for(let Pe=0;Pe<S;Pe++)Ae=ne*Mt.get(Pe,vt)+xe*Mt.get(Pe,Ct-1),Mt.set(Pe,Ct-1,-xe*Mt.get(Pe,vt)+ne*Mt.get(Pe,Ct-1)),Mt.set(Pe,vt,Ae)}break}case 2:{let kt=H[X-1];H[X-1]=0;for(let vt=X;vt<Ct;vt++){let Ae=$e(et[vt],kt),ne=et[vt]/Ae,xe=kt/Ae;if(et[vt]=Ae,kt=-xe*H[vt],H[vt]=ne*H[vt],F)for(let Pe=0;Pe<b;Pe++)Ae=ne*lt.get(Pe,vt)+xe*lt.get(Pe,X-1),lt.set(Pe,X-1,-xe*lt.get(Pe,vt)+ne*lt.get(Pe,X-1)),lt.set(Pe,vt,Ae)}break}case 3:{const kt=Math.max(Math.abs(et[Ct-1]),Math.abs(et[Ct-2]),Math.abs(H[Ct-2]),Math.abs(et[X]),Math.abs(H[X])),vt=et[Ct-1]/kt,Ae=et[Ct-2]/kt,ne=H[Ct-2]/kt,xe=et[X]/kt,Pe=H[X]/kt,vn=((Ae+vt)*(Ae-vt)+ne*ne)/2,Mr=vt*ne*(vt*ne);let tn=0;(vn!==0||Mr!==0)&&(vn<0?tn=0-Math.sqrt(vn*vn+Mr):tn=Math.sqrt(vn*vn+Mr),tn=Mr/(vn+tn));let Vr=(xe+vt)*(xe-vt)+tn,hi=xe*Pe;for(let Qt=X;Qt<Ct-1;Qt++){let pn=$e(Vr,hi);pn===0&&(pn=Number.MIN_VALUE);let Kn=Vr/pn,Zn=hi/pn;if(Qt!==X&&(H[Qt-1]=pn),Vr=Kn*et[Qt]+Zn*H[Qt],H[Qt]=Kn*H[Qt]-Zn*et[Qt],hi=Zn*et[Qt+1],et[Qt+1]=Kn*et[Qt+1],z)for(let en=0;en<S;en++)pn=Kn*Mt.get(en,Qt)+Zn*Mt.get(en,Qt+1),Mt.set(en,Qt+1,-Zn*Mt.get(en,Qt)+Kn*Mt.get(en,Qt+1)),Mt.set(en,Qt,pn);if(pn=$e(Vr,hi),pn===0&&(pn=Number.MIN_VALUE),Kn=Vr/pn,Zn=hi/pn,et[Qt]=pn,Vr=Kn*H[Qt]+Zn*et[Qt+1],et[Qt+1]=-Zn*H[Qt]+Kn*et[Qt+1],hi=Zn*H[Qt+1],H[Qt+1]=Kn*H[Qt+1],F&&Qt<b-1)for(let en=0;en<b;en++)pn=Kn*lt.get(en,Qt)+Zn*lt.get(en,Qt+1),lt.set(en,Qt+1,-Zn*lt.get(en,Qt)+Kn*lt.get(en,Qt+1)),lt.set(en,Qt,pn)}H[Ct-2]=Vr;break}case 4:{if(et[X]<=0&&(et[X]=et[X]<0?-et[X]:0,z))for(let kt=0;kt<=Lt;kt++)Mt.set(kt,X,-Mt.get(kt,X));for(;X<Lt&&!(et[X]>=et[X+1]);){let kt=et[X];if(et[X]=et[X+1],et[X+1]=kt,z&&X<S-1)for(let vt=0;vt<S;vt++)kt=Mt.get(vt,X+1),Mt.set(vt,X+1,Mt.get(vt,X)),Mt.set(vt,X,kt);if(F&&X<b-1)for(let vt=0;vt<b;vt++)kt=lt.get(vt,X+1),lt.set(vt,X+1,lt.get(vt,X)),lt.set(vt,X,kt);X++}Ct--;break}}}if(Q){let X=Mt;Mt=lt,lt=X}this.m=b,this.n=S,this.s=et,this.U=lt,this.V=Mt}solve(M){let x=M,b=this.threshold,S=this.s.length,A=W.zeros(S,S);for(let at=0;at<S;at++)Math.abs(this.s[at])<=b?A.set(at,at,0):A.set(at,at,1/this.s[at]);let I=this.U,D=this.rightSingularVectors,F=D.mmul(A),z=D.rows,Q=I.rows,Y=W.zeros(z,Q);for(let at=0;at<z;at++)for(let mt=0;mt<Q;mt++){let et=0;for(let lt=0;lt<S;lt++)et+=F.get(at,lt)*I.get(mt,lt);Y.set(at,mt,et)}return Y.mmul(x)}solveForDiagonal(M){return this.solve(W.diag(M))}inverse(){let M=this.V,x=this.threshold,b=M.rows,S=M.columns,A=new W(b,this.s.length);for(let Q=0;Q<b;Q++)for(let Y=0;Y<S;Y++)Math.abs(this.s[Y])>x&&A.set(Q,Y,M.get(Q,Y)/this.s[Y]);let I=this.U,D=I.rows,F=I.columns,z=new W(b,D);for(let Q=0;Q<b;Q++)for(let Y=0;Y<D;Y++){let at=0;for(let mt=0;mt<F;mt++)at+=A.get(Q,mt)*I.get(Y,mt);z.set(Q,Y,at)}return z}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let M=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,x=0,b=this.s;for(let S=0,A=b.length;S<A;S++)b[S]>M&&x++;return x}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 W.diag(this.s)}}function jn(R,M=!1){return R=we.checkMatrix(R),M?new zn(R).inverse():fr(R,W.eye(R.rows))}function fr(R,M,x=!1){return R=we.checkMatrix(R),M=we.checkMatrix(M),x?new zn(R).solve(M):R.isSquare()?new dr(R).solve(M):new Re(R).solve(M)}function ci(R){if(R=W.checkMatrix(R),R.isSquare()){if(R.columns===0)return 1;let M,x,b,S;if(R.columns===2)return M=R.get(0,0),x=R.get(0,1),b=R.get(1,0),S=R.get(1,1),M*S-x*b;if(R.columns===3){let A,I,D;return A=new Xt(R,[1,2],[1,2]),I=new Xt(R,[1,2],[0,2]),D=new Xt(R,[1,2],[0,1]),M=R.get(0,0),x=R.get(0,1),b=R.get(0,2),M*ci(A)-x*ci(I)+b*ci(D)}else return new dr(R).determinant}else throw Error("determinant can only be calculated for a square matrix")}function $r(R,M){let x=[];for(let b=0;b<R;b++)b!==M&&x.push(b);return x}function Ja(R,M,x,b=1e-9,S=1e-9){if(R>S)return new Array(M.rows+1).fill(0);{let A=M.addRow(x,[0]);for(let I=0;I<A.rows;I++)Math.abs(A.get(I,0))<b&&A.set(I,0,0);return A.to1DArray()}}function Qa(R,M={}){const{thresholdValue:x=1e-9,thresholdError:b=1e-9}=M;R=W.checkMatrix(R);let S=R.rows,A=new W(S,S);for(let I=0;I<S;I++){let D=W.columnVector(R.getRow(I)),F=R.subMatrixRow($r(S,I)).transpose(),Q=new zn(F).solve(D),Y=W.sub(D,F.mmul(Q)).abs().max();A.setRow(I,Ja(Y,Q,I,x,b))}return A}function jh(R,M=Number.EPSILON){if(R=W.checkMatrix(R),R.isEmpty())return R.transpose();let x=new zn(R,{autoTranspose:!0}),b=x.leftSingularVectors,S=x.rightSingularVectors,A=x.diagonal;for(let I=0;I<A.length;I++)Math.abs(A[I])>M?A[I]=1/A[I]:A[I]=0;return S.mmul(W.diag(A).mmul(b.transpose()))}function fl(R,M=R,x={}){R=new W(R);let b=!1;if(typeof M=="object"&&!W.isMatrix(M)&&!r.isAnyArray(M)?(x=M,M=R,b=!0):M=new W(M),R.rows!==M.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:S=!0}=x;S&&(R=R.center("column"),b||(M=M.center("column")));const A=R.transpose().mmul(M);for(let I=0;I<A.rows;I++)for(let D=0;D<A.columns;D++)A.set(I,D,A.get(I,D)*(1/(R.rows-1)));return A}function Gr(R,M=R,x={}){R=new W(R);let b=!1;if(typeof M=="object"&&!W.isMatrix(M)&&!r.isAnyArray(M)?(x=M,M=R,b=!0):M=new W(M),R.rows!==M.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:S=!0,scale:A=!0}=x;S&&(R.center("column"),b||M.center("column")),A&&(R.scale("column"),b||M.scale("column"));const I=R.standardDeviation("column",{unbiased:!0}),D=b?I:M.standardDeviation("column",{unbiased:!0}),F=R.transpose().mmul(M);for(let z=0;z<F.rows;z++)for(let Q=0;Q<F.columns;Q++)F.set(z,Q,F.get(z,Q)*(1/(I[z]*D[Q]))*(1/(R.rows-1)));return F}class Wr{constructor(M,x={}){const{assumeSymmetric:b=!1}=x;if(M=we.checkMatrix(M),!M.isSquare())throw new Error("Matrix is not a square matrix");if(M.isEmpty())throw new Error("Matrix must be non-empty");let S=M.columns,A=new W(S,S),I=new Float64Array(S),D=new Float64Array(S),F=M,z,Q,Y=!1;if(b?Y=!0:Y=M.isSymmetric(),Y){for(z=0;z<S;z++)for(Q=0;Q<S;Q++)A.set(z,Q,F.get(z,Q));CC(S,D,I,A),RC(S,D,I,A)}else{let at=new W(S,S),mt=new Float64Array(S);for(Q=0;Q<S;Q++)for(z=0;z<S;z++)at.set(z,Q,F.get(z,Q));LC(S,at,mt,A),IC(S,D,I,A,at)}this.n=S,this.e=D,this.d=I,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 M=this.n,x=this.e,b=this.d,S=new W(M,M),A,I;for(A=0;A<M;A++){for(I=0;I<M;I++)S.set(A,I,0);S.set(A,A,b[A]),x[A]>0?S.set(A,A+1,x[A]):x[A]<0&&S.set(A,A-1,x[A])}return S}}function CC(R,M,x,b){let S,A,I,D,F,z,Q,Y;for(F=0;F<R;F++)x[F]=b.get(R-1,F);for(D=R-1;D>0;D--){for(Y=0,I=0,z=0;z<D;z++)Y=Y+Math.abs(x[z]);if(Y===0)for(M[D]=x[D-1],F=0;F<D;F++)x[F]=b.get(D-1,F),b.set(D,F,0),b.set(F,D,0);else{for(z=0;z<D;z++)x[z]/=Y,I+=x[z]*x[z];for(S=x[D-1],A=Math.sqrt(I),S>0&&(A=-A),M[D]=Y*A,I=I-S*A,x[D-1]=S-A,F=0;F<D;F++)M[F]=0;for(F=0;F<D;F++){for(S=x[F],b.set(F,D,S),A=M[F]+b.get(F,F)*S,z=F+1;z<=D-1;z++)A+=b.get(z,F)*x[z],M[z]+=b.get(z,F)*S;M[F]=A}for(S=0,F=0;F<D;F++)M[F]/=I,S+=M[F]*x[F];for(Q=S/(I+I),F=0;F<D;F++)M[F]-=Q*x[F];for(F=0;F<D;F++){for(S=x[F],A=M[F],z=F;z<=D-1;z++)b.set(z,F,b.get(z,F)-(S*M[z]+A*x[z]));x[F]=b.get(D-1,F),b.set(D,F,0)}}x[D]=I}for(D=0;D<R-1;D++){if(b.set(R-1,D,b.get(D,D)),b.set(D,D,1),I=x[D+1],I!==0){for(z=0;z<=D;z++)x[z]=b.get(z,D+1)/I;for(F=0;F<=D;F++){for(A=0,z=0;z<=D;z++)A+=b.get(z,D+1)*b.get(z,F);for(z=0;z<=D;z++)b.set(z,F,b.get(z,F)-A*x[z])}}for(z=0;z<=D;z++)b.set(z,D+1,0)}for(F=0;F<R;F++)x[F]=b.get(R-1,F),b.set(R-1,F,0);b.set(R-1,R-1,1),M[0]=0}function RC(R,M,x,b){let S,A,I,D,F,z,Q,Y,at,mt,et,lt,Mt,H,yt,At;for(I=1;I<R;I++)M[I-1]=M[I];M[R-1]=0;let Dt=0,zt=0,Te=Number.EPSILON;for(z=0;z<R;z++){for(zt=Math.max(zt,Math.abs(x[z])+Math.abs(M[z])),Q=z;Q<R&&!(Math.abs(M[Q])<=Te*zt);)Q++;if(Q>z)do{for(S=x[z],Y=(x[z+1]-S)/(2*M[z]),at=$e(Y,1),Y<0&&(at=-at),x[z]=M[z]/(Y+at),x[z+1]=M[z]*(Y+at),mt=x[z+1],A=S-x[z],I=z+2;I<R;I++)x[I]-=A;for(Dt=Dt+A,Y=x[Q],et=1,lt=et,Mt=et,H=M[z+1],yt=0,At=0,I=Q-1;I>=z;I--)for(Mt=lt,lt=et,At=yt,S=et*M[I],A=et*Y,at=$e(Y,M[I]),M[I+1]=yt*at,yt=M[I]/at,et=Y/at,Y=et*x[I]-yt*S,x[I+1]=A+yt*(et*S+yt*x[I]),F=0;F<R;F++)A=b.get(F,I+1),b.set(F,I+1,yt*b.get(F,I)+et*A),b.set(F,I,et*b.get(F,I)-yt*A);Y=-yt*At*Mt*H*M[z]/mt,M[z]=yt*Y,x[z]=et*Y}while(Math.abs(M[z])>Te*zt);x[z]=x[z]+Dt,M[z]=0}for(I=0;I<R-1;I++){for(F=I,Y=x[I],D=I+1;D<R;D++)x[D]<Y&&(F=D,Y=x[D]);if(F!==I)for(x[F]=x[I],x[I]=Y,D=0;D<R;D++)Y=b.get(D,I),b.set(D,I,b.get(D,F)),b.set(D,F,Y)}}function LC(R,M,x,b){let S=0,A=R-1,I,D,F,z,Q,Y,at;for(Y=S+1;Y<=A-1;Y++){for(at=0,z=Y;z<=A;z++)at=at+Math.abs(M.get(z,Y-1));if(at!==0){for(F=0,z=A;z>=Y;z--)x[z]=M.get(z,Y-1)/at,F+=x[z]*x[z];for(D=Math.sqrt(F),x[Y]>0&&(D=-D),F=F-x[Y]*D,x[Y]=x[Y]-D,Q=Y;Q<R;Q++){for(I=0,z=A;z>=Y;z--)I+=x[z]*M.get(z,Q);for(I=I/F,z=Y;z<=A;z++)M.set(z,Q,M.get(z,Q)-I*x[z])}for(z=0;z<=A;z++){for(I=0,Q=A;Q>=Y;Q--)I+=x[Q]*M.get(z,Q);for(I=I/F,Q=Y;Q<=A;Q++)M.set(z,Q,M.get(z,Q)-I*x[Q])}x[Y]=at*x[Y],M.set(Y,Y-1,at*D)}}for(z=0;z<R;z++)for(Q=0;Q<R;Q++)b.set(z,Q,z===Q?1:0);for(Y=A-1;Y>=S+1;Y--)if(M.get(Y,Y-1)!==0){for(z=Y+1;z<=A;z++)x[z]=M.get(z,Y-1);for(Q=Y;Q<=A;Q++){for(D=0,z=Y;z<=A;z++)D+=x[z]*b.get(z,Q);for(D=D/x[Y]/M.get(Y,Y-1),z=Y;z<=A;z++)b.set(z,Q,b.get(z,Q)+D*x[z])}}}function IC(R,M,x,b,S){let A=R-1,I=0,D=R-1,F=Number.EPSILON,z=0,Q=0,Y=0,at=0,mt=0,et=0,lt=0,Mt=0,H,yt,At,Dt,zt,Te,Ct,Lt,ce,X,gt,kt,vt,Ae,ne;for(H=0;H<R;H++)for((H<I||H>D)&&(x[H]=S.get(H,H),M[H]=0),yt=Math.max(H-1,0);yt<R;yt++)Q=Q+Math.abs(S.get(H,yt));for(;A>=I;){for(Dt=A;Dt>I&&(et=Math.abs(S.get(Dt-1,Dt-1))+Math.abs(S.get(Dt,Dt)),et===0&&(et=Q),!(Math.abs(S.get(Dt,Dt-1))<F*et));)Dt--;if(Dt===A)S.set(A,A,S.get(A,A)+z),x[A]=S.get(A,A),M[A]=0,A--,Mt=0;else if(Dt===A-1){if(Ct=S.get(A,A-1)*S.get(A-1,A),Y=(S.get(A-1,A-1)-S.get(A,A))/2,at=Y*Y+Ct,lt=Math.sqrt(Math.abs(at)),S.set(A,A,S.get(A,A)+z),S.set(A-1,A-1,S.get(A-1,A-1)+z),Lt=S.get(A,A),at>=0){for(lt=Y>=0?Y+lt:Y-lt,x[A-1]=Lt+lt,x[A]=x[A-1],lt!==0&&(x[A]=Lt-Ct/lt),M[A-1]=0,M[A]=0,Lt=S.get(A,A-1),et=Math.abs(Lt)+Math.abs(lt),Y=Lt/et,at=lt/et,mt=Math.sqrt(Y*Y+at*at),Y=Y/mt,at=at/mt,yt=A-1;yt<R;yt++)lt=S.get(A-1,yt),S.set(A-1,yt,at*lt+Y*S.get(A,yt)),S.set(A,yt,at*S.get(A,yt)-Y*lt);for(H=0;H<=A;H++)lt=S.get(H,A-1),S.set(H,A-1,at*lt+Y*S.get(H,A)),S.set(H,A,at*S.get(H,A)-Y*lt);for(H=I;H<=D;H++)lt=b.get(H,A-1),b.set(H,A-1,at*lt+Y*b.get(H,A)),b.set(H,A,at*b.get(H,A)-Y*lt)}else x[A-1]=Lt+Y,x[A]=Lt+Y,M[A-1]=lt,M[A]=-lt;A=A-2,Mt=0}else{if(Lt=S.get(A,A),ce=0,Ct=0,Dt<A&&(ce=S.get(A-1,A-1),Ct=S.get(A,A-1)*S.get(A-1,A)),Mt===10){for(z+=Lt,H=I;H<=A;H++)S.set(H,H,S.get(H,H)-Lt);et=Math.abs(S.get(A,A-1))+Math.abs(S.get(A-1,A-2)),Lt=ce=.75*et,Ct=-.4375*et*et}if(Mt===30&&(et=(ce-Lt)/2,et=et*et+Ct,et>0)){for(et=Math.sqrt(et),ce<Lt&&(et=-et),et=Lt-Ct/((ce-Lt)/2+et),H=I;H<=A;H++)S.set(H,H,S.get(H,H)-et);z+=et,Lt=ce=Ct=.964}for(Mt=Mt+1,zt=A-2;zt>=Dt&&(lt=S.get(zt,zt),mt=Lt-lt,et=ce-lt,Y=(mt*et-Ct)/S.get(zt+1,zt)+S.get(zt,zt+1),at=S.get(zt+1,zt+1)-lt-mt-et,mt=S.get(zt+2,zt+1),et=Math.abs(Y)+Math.abs(at)+Math.abs(mt),Y=Y/et,at=at/et,mt=mt/et,!(zt===Dt||Math.abs(S.get(zt,zt-1))*(Math.abs(at)+Math.abs(mt))<F*(Math.abs(Y)*(Math.abs(S.get(zt-1,zt-1))+Math.abs(lt)+Math.abs(S.get(zt+1,zt+1))))));)zt--;for(H=zt+2;H<=A;H++)S.set(H,H-2,0),H>zt+2&&S.set(H,H-3,0);for(At=zt;At<=A-1&&(Ae=At!==A-1,At!==zt&&(Y=S.get(At,At-1),at=S.get(At+1,At-1),mt=Ae?S.get(At+2,At-1):0,Lt=Math.abs(Y)+Math.abs(at)+Math.abs(mt),Lt!==0&&(Y=Y/Lt,at=at/Lt,mt=mt/Lt)),Lt!==0);At++)if(et=Math.sqrt(Y*Y+at*at+mt*mt),Y<0&&(et=-et),et!==0){for(At!==zt?S.set(At,At-1,-et*Lt):Dt!==zt&&S.set(At,At-1,-S.get(At,At-1)),Y=Y+et,Lt=Y/et,ce=at/et,lt=mt/et,at=at/Y,mt=mt/Y,yt=At;yt<R;yt++)Y=S.get(At,yt)+at*S.get(At+1,yt),Ae&&(Y=Y+mt*S.get(At+2,yt),S.set(At+2,yt,S.get(At+2,yt)-Y*lt)),S.set(At,yt,S.get(At,yt)-Y*Lt),S.set(At+1,yt,S.get(At+1,yt)-Y*ce);for(H=0;H<=Math.min(A,At+3);H++)Y=Lt*S.get(H,At)+ce*S.get(H,At+1),Ae&&(Y=Y+lt*S.get(H,At+2),S.set(H,At+2,S.get(H,At+2)-Y*mt)),S.set(H,At,S.get(H,At)-Y),S.set(H,At+1,S.get(H,At+1)-Y*at);for(H=I;H<=D;H++)Y=Lt*b.get(H,At)+ce*b.get(H,At+1),Ae&&(Y=Y+lt*b.get(H,At+2),b.set(H,At+2,b.get(H,At+2)-Y*mt)),b.set(H,At,b.get(H,At)-Y),b.set(H,At+1,b.get(H,At+1)-Y*at)}}}if(Q!==0){for(A=R-1;A>=0;A--)if(Y=x[A],at=M[A],at===0)for(Dt=A,S.set(A,A,1),H=A-1;H>=0;H--){for(Ct=S.get(H,H)-Y,mt=0,yt=Dt;yt<=A;yt++)mt=mt+S.get(H,yt)*S.get(yt,A);if(M[H]<0)lt=Ct,et=mt;else if(Dt=H,M[H]===0?S.set(H,A,Ct!==0?-mt/Ct:-mt/(F*Q)):(Lt=S.get(H,H+1),ce=S.get(H+1,H),at=(x[H]-Y)*(x[H]-Y)+M[H]*M[H],Te=(Lt*et-lt*mt)/at,S.set(H,A,Te),S.set(H+1,A,Math.abs(Lt)>Math.abs(lt)?(-mt-Ct*Te)/Lt:(-et-ce*Te)/lt)),Te=Math.abs(S.get(H,A)),F*Te*Te>1)for(yt=H;yt<=A;yt++)S.set(yt,A,S.get(yt,A)/Te)}else if(at<0)for(Dt=A-1,Math.abs(S.get(A,A-1))>Math.abs(S.get(A-1,A))?(S.set(A-1,A-1,at/S.get(A,A-1)),S.set(A-1,A,-(S.get(A,A)-Y)/S.get(A,A-1))):(ne=gl(0,-S.get(A-1,A),S.get(A-1,A-1)-Y,at),S.set(A-1,A-1,ne[0]),S.set(A-1,A,ne[1])),S.set(A,A-1,0),S.set(A,A,1),H=A-2;H>=0;H--){for(X=0,gt=0,yt=Dt;yt<=A;yt++)X=X+S.get(H,yt)*S.get(yt,A-1),gt=gt+S.get(H,yt)*S.get(yt,A);if(Ct=S.get(H,H)-Y,M[H]<0)lt=Ct,mt=X,et=gt;else if(Dt=H,M[H]===0?(ne=gl(-X,-gt,Ct,at),S.set(H,A-1,ne[0]),S.set(H,A,ne[1])):(Lt=S.get(H,H+1),ce=S.get(H+1,H),kt=(x[H]-Y)*(x[H]-Y)+M[H]*M[H]-at*at,vt=(x[H]-Y)*2*at,kt===0&&vt===0&&(kt=F*Q*(Math.abs(Ct)+Math.abs(at)+Math.abs(Lt)+Math.abs(ce)+Math.abs(lt))),ne=gl(Lt*mt-lt*X+at*gt,Lt*et-lt*gt-at*X,kt,vt),S.set(H,A-1,ne[0]),S.set(H,A,ne[1]),Math.abs(Lt)>Math.abs(lt)+Math.abs(at)?(S.set(H+1,A-1,(-X-Ct*S.get(H,A-1)+at*S.get(H,A))/Lt),S.set(H+1,A,(-gt-Ct*S.get(H,A)-at*S.get(H,A-1))/Lt)):(ne=gl(-mt-ce*S.get(H,A-1),-et-ce*S.get(H,A),lt,at),S.set(H+1,A-1,ne[0]),S.set(H+1,A,ne[1]))),Te=Math.max(Math.abs(S.get(H,A-1)),Math.abs(S.get(H,A))),F*Te*Te>1)for(yt=H;yt<=A;yt++)S.set(yt,A-1,S.get(yt,A-1)/Te),S.set(yt,A,S.get(yt,A)/Te)}for(H=0;H<R;H++)if(H<I||H>D)for(yt=H;yt<R;yt++)b.set(H,yt,S.get(H,yt));for(yt=R-1;yt>=I;yt--)for(H=I;H<=D;H++){for(lt=0,At=I;At<=Math.min(yt,D);At++)lt=lt+b.get(H,At)*S.get(At,yt);b.set(H,yt,lt)}}}function gl(R,M,x,b){let S,A;return Math.abs(x)>Math.abs(b)?(S=b/x,A=x+S*b,[(R+S*M)/A,(M-S*R)/A]):(S=x/b,A=b+S*x,[(S*R+M)/A,(S*M-R)/A])}class lb{constructor(M){if(M=we.checkMatrix(M),!M.isSymmetric())throw new Error("Matrix is not symmetric");let x=M,b=x.rows,S=new W(b,b),A=!0,I,D,F;for(D=0;D<b;D++){let z=0;for(F=0;F<D;F++){let Q=0;for(I=0;I<F;I++)Q+=S.get(F,I)*S.get(D,I);Q=(x.get(D,F)-Q)/S.get(F,F),S.set(D,F,Q),z=z+Q*Q}for(z=x.get(D,D)-z,A&=z>0,S.set(D,D,Math.sqrt(Math.max(z,0))),F=D+1;F<b;F++)S.set(D,F,0)}this.L=S,this.positiveDefinite=!!A}isPositiveDefinite(){return this.positiveDefinite}solve(M){M=we.checkMatrix(M);let x=this.L,b=x.rows;if(M.rows!==b)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let S=M.columns,A=M.clone(),I,D,F;for(F=0;F<b;F++)for(D=0;D<S;D++){for(I=0;I<F;I++)A.set(F,D,A.get(F,D)-A.get(I,D)*x.get(F,I));A.set(F,D,A.get(F,D)/x.get(F,F))}for(F=b-1;F>=0;F--)for(D=0;D<S;D++){for(I=F+1;I<b;I++)A.set(F,D,A.get(F,D)-A.get(I,D)*x.get(I,F));A.set(F,D,A.get(F,D)/x.get(F,F))}return A}get lowerTriangularMatrix(){return this.L}}class ub{constructor(M,x={}){M=we.checkMatrix(M);let{Y:b}=x;const{scaleScores:S=!1,maxIterations:A=1e3,terminationCriteria:I=1e-10}=x;let D;if(b){if(r.isAnyArray(b)&&typeof b[0]=="number"?b=W.columnVector(b):b=we.checkMatrix(b),b.rows!==M.rows)throw new Error("Y should have the same number of rows as X");D=b.getColumnVector(0)}else D=M.getColumnVector(0);let F=1,z,Q,Y,at;for(let mt=0;mt<A&&F>I;mt++)Y=M.transpose().mmul(D).div(D.transpose().mmul(D).get(0,0)),Y=Y.div(Y.norm()),z=M.mmul(Y).div(Y.transpose().mmul(Y).get(0,0)),mt>0&&(F=z.clone().sub(at).pow(2).sum()),at=z.clone(),b?(Q=b.transpose().mmul(z).div(z.transpose().mmul(z).get(0,0)),Q=Q.div(Q.norm()),D=b.mmul(Q).div(Q.transpose().mmul(Q).get(0,0))):D=z;if(b){let mt=M.transpose().mmul(z).div(z.transpose().mmul(z).get(0,0));mt=mt.div(mt.norm());let et=M.clone().sub(z.clone().mmul(mt.transpose())),lt=D.transpose().mmul(z).div(z.transpose().mmul(z).get(0,0)),Mt=b.clone().sub(z.clone().mulS(lt.get(0,0)).mmul(Q.transpose()));this.t=z,this.p=mt.transpose(),this.w=Y.transpose(),this.q=Q,this.u=D,this.s=z.transpose().mmul(z),this.xResidual=et,this.yResidual=Mt,this.betas=lt}else this.w=Y.transpose(),this.s=z.transpose().mmul(z).sqrt(),S?this.t=z.clone().div(this.s.get(0,0)):this.t=z,this.xResidual=M.sub(z.mmul(Y.transpose()))}}return Kt.AbstractMatrix=ot,Kt.CHO=lb,Kt.CholeskyDecomposition=lb,Kt.DistanceMatrix=ct,Kt.EVD=Wr,Kt.EigenvalueDecomposition=Wr,Kt.LU=dr,Kt.LuDecomposition=dr,Kt.Matrix=W,Kt.MatrixColumnSelectionView=Vt,Kt.MatrixColumnView=Nt,Kt.MatrixFlipColumnView=ke,Kt.MatrixFlipRowView=un,Kt.MatrixRowSelectionView=Ue,Kt.MatrixRowView=Oe,Kt.MatrixSelectionView=Xt,Kt.MatrixSubView=cr,Kt.MatrixTransposeView=Jt,Kt.NIPALS=ub,Kt.Nipals=ub,Kt.QR=Re,Kt.QrDecomposition=Re,Kt.SVD=zn,Kt.SingularValueDecomposition=zn,Kt.SymmetricMatrix=tt,Kt.WrapperMatrix1D=hr,Kt.WrapperMatrix2D=we,Kt.correlation=Gr,Kt.covariance=fl,Kt.default=W,Kt.determinant=ci,Kt.inverse=jn,Kt.linearDependencies=Qa,Kt.pseudoInverse=jh,Kt.solve=fr,Kt.wrap=Za,Kt}var Gc=g9();const Tx=Go(Gc),Ui=Gc.Matrix,wP=Gc.SingularValueDecomposition;Tx.Matrix?Tx.Matrix:Gc.Matrix;const v9={center:[0,0],linkDistance:50};class xP{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},v9),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a=[0,0],linkDistance:s=50}=i,o=e.getAllNodes(),l=e.getAllEdges();if(!(o!=null&&o.length)||o.length===1)return Ua(e,t,a);const u=vP({nodes:o,edges:l}),c=gP(u);p9(c);const h=s8(c,s),d=y9(h),f=[];return d.forEach((p,g)=>{const y=ir(o[g]);y.data.x=p[0]+a[0],y.data.y=p[1]+a[1],f.push(y)}),t&&f.forEach(p=>e.mergeNodeData(p.id,{x:p.data.x,y:p.data.y})),{nodes:f,edges:l}})}}const p9=r=>{let t=-999999;r.forEach(e=>{e.forEach(n=>{n!==1/0&&t<n&&(t=n)})}),r.forEach((e,n)=>{e.forEach((i,a)=>{i===1/0&&(r[n][a]=t)})})},y9=r=>{const e=Ui.mul(Ui.pow(r,2),-.5),n=e.mean("row"),i=e.mean("column"),a=e.mean();e.add(a).subRowVector(n).subColumnVector(i);const s=new wP(e),o=Ui.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(l=>Ui.mul([l],[o]).toJSON()[0].splice(0,2))};function Em(r){return!!r.tick&&!!r.stop}const m9={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},b9={center:[0,0],comboPadding:10,treeKey:"combo"};class w9{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},b9),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,l=e.getAllNodes().filter(O=>!O.data._isCombo),u=e.getAllNodes().filter(O=>O.data._isCombo),c=e.getAllEdges(),h=l==null?void 0:l.length;if(!h||h===1)return Ua(e,t,a);const d=[],f=new Map;l.forEach(O=>{f.set(O.id,O)});const v=new Map;u.forEach(O=>{v.set(O.id,O)});const p=new Map,g=this.getInnerGraphs(e,s,f,v,c,i,p);yield Promise.all(g);const y=new Map,m=[],w=new Map;let E=!0;e.getRoots(s).forEach(O=>{const P=p.get(O.id),N=v.get(O.id)||f.get(O.id),C={id:O.id,data:Object.assign(Object.assign({},O.data),{x:P.data.x||N.data.x,y:P.data.y||N.data.y,fx:P.data.fx||N.data.fx,fy:P.data.fy||N.data.fy,mass:P.data.mass||N.data.mass,size:P.data.size})};m.push(C),y.set(O.id,!0),!isNaN(C.data.x)&&C.data.x!==0&&!isNaN(C.data.y)&&C.data.y!==0?E=!1:(C.data.x=Math.random()*100,C.data.y=Math.random()*100),mm(e,[O],L=>{L.id!==O.id&&w.set(L.id,O.id)},"TB",s)});const _=[];c.forEach(O=>{const P=w.get(O.source)||O.source,N=w.get(O.target)||O.target;P!==N&&y.has(P)&&y.has(N)&&_.push({id:O.id,source:P,target:N,data:{}})});let k;if(m!=null&&m.length){if(m.length===1)m[0].data.x=a[0],m[0].data.y=a[1];else{const O=new ln({nodes:m,edges:_}),P=o||new bP;E&&m9[P.id]&&(yield(m.length<100?new xP:new wm).assign(O));const N=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},P.id==="force"?{gravity:1,factor:4,linkDistance:(C,L,B)=>{const G=Math.max(...L.data.size)||32,V=Math.max(...B.data.size)||32;return G/2+V/2+200}}:{});k=yield Ax(P,O,N)}p.forEach(O=>{var P;const N=k.nodes.find(B=>B.id===O.id);if(N){const{x:B,y:G}=N.data;O.data.visited=!0,O.data.x=B,O.data.y=G,d.push({id:O.id,data:{x:B,y:G}})}const{x:C,y:L}=O.data;(P=O.data.nodes)===null||P===void 0||P.forEach(B=>{d.push({id:B.id,data:{x:B.data.x+C,y:B.data.y+L}})})}),p.forEach(({data:O})=>{const{x:P,y:N,visited:C,nodes:L}=O;L==null||L.forEach(B=>{if(!C){const G=d.find(V=>V.id===B.id);G.data.x+=P||0,G.data.y+=N||0}})})}return t&&d.forEach(O=>{e.mergeNodeData(O.id,{x:O.data.x,y:O.data.y})}),{nodes:d,edges:c}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(St(i)?o=()=>i:Ot(i)?o=i:o=()=>0,e.spacing=o,!n)s=u=>{const c=o(u);return u.size?yi(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+c)/2:Ve(u.size)?((u.size.width>u.size.height?u.size.width:u.size.height)+c)/2:(u.size+c)/2:32+c/2};else if(Ot(n))s=u=>{const c=n(u),h=o(u);return yi(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+h)/2:((c||32)+h)/2};else if(yi(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=h=>c+o(h)/2}else{const u=n/2;s=c=>u+o(c)/2}e.nodeSize=s;let l;return St(a)?l=()=>a:yi(a)?l=()=>Math.max.apply(null,a):Ot(a)?l=a:l=()=>0,e.comboPadding=l,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:l,comboPadding:u,spacing:c,innerLayout:h}=s,d=h||new wm({}),f={center:[0,0],preventOverlap:!0,nodeSpacing:c},v=[],p=g=>{let y=(u==null?void 0:u(g))||10;return yi(y)&&(y=Math.max(...y)),{size:y?[y*2,y*2]:[30,30],padding:y}};return t.getRoots(e).forEach(g=>{o.set(g.id,{id:g.id,data:{nodes:[],size:p(g).size}});let y=Promise.resolve();mm(t,[g],m=>{var w;if(!m.data._isCombo)return;const{size:E,padding:_}=p(m);if(!(!((w=t.getChildren(m.id,e))===null||w===void 0)&&w.length))o.set(m.id,{id:m.id,data:Object.assign(Object.assign({},m.data),{size:E})});else{const k=o.get(m.id);o.set(m.id,{id:m.id,data:Object.assign({nodes:[]},k==null?void 0:k.data)});const T=new Map,O=t.getChildren(m.id,e).map(C=>{if(C.data._isCombo)return o.has(C.id)||o.set(C.id,{id:C.id,data:Object.assign({},C.data)}),T.set(C.id,!0),o.get(C.id);const L=n.get(C.id)||i.get(C.id);return T.set(C.id,!0),{id:C.id,data:Object.assign(Object.assign({},L.data),C.data)}}),P={nodes:O,edges:a.filter(C=>T.has(C.source)&&T.has(C.target))};let N=1/0;O.forEach(C=>{var L;let{size:B}=C.data;B||(B=((L=o.get(C.id))===null||L===void 0?void 0:L.data.size)||(l==null?void 0:l(C))||[30,30]),St(B)&&(B=[B,B]);const[G,V]=B;N>G&&(N=G),N>V&&(N=V),C.data.size=B}),y=y.then(()=>Ut(this,void 0,void 0,function*(){const C=new ln(P);yield Ax(d,C,f,!0);const{minX:L,minY:B,maxX:G,maxY:V}=o8(O),U={x:(G+L)/2,y:(V+B)/2};P.nodes.forEach(j=>{j.data.x-=U.x,j.data.y-=U.y});const $=[Math.max(G-L,N)+_*2,Math.max(V-B,N)+_*2];o.get(m.id).data.size=$,o.get(m.id).data.nodes=O}))}return!0},"BT",e),v.push(y)}),v}}function Ax(r,t,e,n){var i;return Ut(this,void 0,void 0,function*(){return Em(r)?(r.execute(t,e),r.stop(),r.tick((i=e.iterations)!==null&&i!==void 0?i:300)):n?yield r.assign(t,e):yield r.execute(t,e)})}function x9(r,t){var e,n=1;r==null&&(r=0),t==null&&(t=0);function i(){var a,s=e.length,o,l=0,u=0;for(a=0;a<s;++a)o=e[a],l+=o.x,u+=o.y;for(l=(l/s-r)*n,u=(u/s-t)*n,a=0;a<s;++a)o=e[a],o.x-=l,o.y-=u}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 sn(r){return function(){return r}}function Yi(r){return(r()-.5)*1e-6}function E9(r){return r.x+r.vx}function S9(r){return r.y+r.vy}function _9(r){var t,e,n,i=1,a=1;typeof r!="function"&&(r=sn(r==null?1:+r));function s(){for(var u,c=t.length,h,d,f,v,p,g,y=0;y<a;++y)for(h=$c(t,E9,S9).visitAfter(o),u=0;u<c;++u)d=t[u],p=e[d.index],g=p*p,f=d.x+d.vx,v=d.y+d.vy,h.visit(m);function m(w,E,_,k,T){var O=w.data,P=w.r,N=p+P;if(O){if(O.index>d.index){var C=f-O.x-O.vx,L=v-O.y-O.vy,B=C*C+L*L;B<N*N&&(C===0&&(C=Yi(n),B+=C*C),L===0&&(L=Yi(n),B+=L*L),B=(N-(B=Math.sqrt(B)))/B*i,d.vx+=(C*=B)*(N=(P*=P)/(g+P)),d.vy+=(L*=B)*N,O.vx-=C*(N=1-N),O.vy-=L*N)}return}return E>f+N||k<f-N||_>v+N||T<v-N}}function o(u){if(u.data)return u.r=e[u.data.index];for(var c=u.r=0;c<4;++c)u[c]&&u[c].r>u.r&&(u.r=u[c].r)}function l(){if(t){var u,c=t.length,h;for(e=new Array(c),u=0;u<c;++u)h=t[u],e[h.index]=+r(h,u,t)}}return s.initialize=function(u,c){t=u,n=c,l()},s.iterations=function(u){return arguments.length?(a=+u,s):a},s.strength=function(u){return arguments.length?(i=+u,s):i},s.radius=function(u){return arguments.length?(r=typeof u=="function"?u:sn(+u),l(),s):r},s}function M9(r){return r.index}function Px(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function k9(r){var t=M9,e=h,n,i=sn(30),a,s,o,l,u,c=1;r==null&&(r=[]);function h(g){return 1/Math.min(o[g.source.index],o[g.target.index])}function d(g){for(var y=0,m=r.length;y<c;++y)for(var w=0,E,_,k,T,O,P,N;w<m;++w)E=r[w],_=E.source,k=E.target,T=k.x+k.vx-_.x-_.vx||Yi(u),O=k.y+k.vy-_.y-_.vy||Yi(u),P=Math.sqrt(T*T+O*O),P=(P-a[w])/P*g*n[w],T*=P,O*=P,k.vx-=T*(N=l[w]),k.vy-=O*N,_.vx+=T*(N=1-N),_.vy+=O*N}function f(){if(s){var g,y=s.length,m=r.length,w=new Map(s.map((_,k)=>[t(_,k,s),_])),E;for(g=0,o=new Array(y);g<m;++g)E=r[g],E.index=g,typeof E.source!="object"&&(E.source=Px(w,E.source)),typeof E.target!="object"&&(E.target=Px(w,E.target)),o[E.source.index]=(o[E.source.index]||0)+1,o[E.target.index]=(o[E.target.index]||0)+1;for(g=0,l=new Array(m);g<m;++g)E=r[g],l[g]=o[E.source.index]/(o[E.source.index]+o[E.target.index]);n=new Array(m),v(),a=new Array(m),p()}}function v(){if(s)for(var g=0,y=r.length;g<y;++g)n[g]=+e(r[g],g,r)}function p(){if(s)for(var g=0,y=r.length;g<y;++g)a[g]=+i(r[g],g,r)}return d.initialize=function(g,y){s=g,u=y,f()},d.links=function(g){return arguments.length?(r=g,f(),d):r},d.id=function(g){return arguments.length?(t=g,d):t},d.iterations=function(g){return arguments.length?(c=+g,d):c},d.strength=function(g){return arguments.length?(e=typeof g=="function"?g:sn(+g),v(),d):e},d.distance=function(g){return arguments.length?(i=typeof g=="function"?g:sn(+g),p(),d):i},d}var O9={value:()=>{}};function EP(){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 Eu(e)}function Eu(r){this._=r}function T9(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}})}Eu.prototype=EP.prototype={constructor:Eu,on:function(r,t){var e=this._,n=T9(r+"",e),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(r=n[a]).type)&&(i=A9(e[i],r.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<s;)if(i=(r=n[a]).type)e[i]=Nx(e[i],r.name,t);else if(t==null)for(i in e)e[i]=Nx(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 Eu(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 A9(r,t){for(var e=0,n=r.length,i;e<n;++e)if((i=r[e]).name===t)return i.value}function Nx(r,t,e){for(var n=0,i=r.length;n<i;++n)if(r[n].name===t){r[n]=O9,r=r.slice(0,n).concat(r.slice(n+1));break}return e!=null&&r.push({name:t,value:e}),r}var Ps=0,lo=0,Qs=0,SP=1e3,tc,uo,ec=0,ja=0,Wc=0,Fo=typeof performance=="object"&&performance.now?performance:Date,_P=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function MP(){return ja||(_P(P9),ja=Fo.now()+Wc)}function P9(){ja=0}function Sm(){this._call=this._time=this._next=null}Sm.prototype=kP.prototype={constructor:Sm,restart:function(r,t,e){if(typeof r!="function")throw new TypeError("callback is not a function");e=(e==null?MP():+e)+(t==null?0:+t),!this._next&&uo!==this&&(uo?uo._next=this:tc=this,uo=this),this._call=r,this._time=e,_m()},stop:function(){this._call&&(this._call=null,this._time=1/0,_m())}};function kP(r,t,e){var n=new Sm;return n.restart(r,t,e),n}function N9(){MP(),++Ps;for(var r=tc,t;r;)(t=ja-r._time)>=0&&r._call.call(void 0,t),r=r._next;--Ps}function Cx(){ja=(ec=Fo.now())+Wc,Ps=lo=0;try{N9()}finally{Ps=0,R9(),ja=0}}function C9(){var r=Fo.now(),t=r-ec;t>SP&&(Wc-=t,ec=r)}function R9(){for(var r,t=tc,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:tc=e);uo=r,_m(n)}function _m(r){if(!Ps){lo&&(lo=clearTimeout(lo));var t=r-ja;t>24?(r<1/0&&(lo=setTimeout(Cx,r-Fo.now()-Wc)),Qs&&(Qs=clearInterval(Qs))):(Qs||(ec=Fo.now(),Qs=setInterval(C9,SP)),Ps=1,_P(Cx))}}const L9=1664525,I9=1013904223,Rx=4294967296;function D9(){let r=1;return()=>(r=(L9*r+I9)%Rx)/Rx}function B9(r){return r.x}function F9(r){return r.y}var z9=10,j9=Math.PI*(3-Math.sqrt(5));function q9(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=kP(h),u=EP("tick","end"),c=D9();r==null&&(r=[]);function h(){d(),u.call("tick",t),e<n&&(l.stop(),u.call("end",t))}function d(p){var g,y=r.length,m;p===void 0&&(p=1);for(var w=0;w<p;++w)for(e+=(a-e)*i,o.forEach(function(E){E(e)}),g=0;g<y;++g)m=r[g],m.fx==null?m.x+=m.vx*=s:(m.x=m.fx,m.vx=0),m.fy==null?m.y+=m.vy*=s:(m.y=m.fy,m.vy=0);return t}function f(){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=z9*Math.sqrt(.5+p),w=p*j9;y.x=m*Math.cos(w),y.y=m*Math.sin(w)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function v(p){return p.initialize&&p.initialize(r,c),p}return f(),t={tick:d,restart:function(){return l.restart(h),t},stop:function(){return l.stop(),t},nodes:function(p){return arguments.length?(r=p,f(),o.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?(s=1-p,t):1-s},randomSource:function(p){return arguments.length?(c=p,o.forEach(v),t):c},force:function(p,g){return arguments.length>1?(g==null?o.delete(p):o.set(p,v(g)),t):o.get(p)},find:function(p,g,y){var m=0,w=r.length,E,_,k,T,O;for(y==null?y=1/0:y*=y,m=0;m<w;++m)T=r[m],E=p-T.x,_=g-T.y,k=E*E+_*_,k<y&&(O=T,y=k);return O},on:function(p,g){return arguments.length>1?(u.on(p,g),t):u.on(p)}}}function $9(){var r,t,e,n,i=sn(-30),a,s=1,o=1/0,l=.81;function u(f){var v,p=r.length,g=$c(r,B9,F9).visitAfter(h);for(n=f,v=0;v<p;++v)t=r[v],g.visit(d)}function c(){if(r){var f,v=r.length,p;for(a=new Array(v),f=0;f<v;++f)p=r[f],a[p.index]=+i(p,f,r)}}function h(f){var v=0,p,g,y=0,m,w,E;if(f.length){for(m=w=E=0;E<4;++E)(p=f[E])&&(g=Math.abs(p.value))&&(v+=p.value,y+=g,m+=g*p.x,w+=g*p.y);f.x=m/y,f.y=w/y}else{p=f,p.x=p.data.x,p.y=p.data.y;do v+=a[p.data.index];while(p=p.next)}f.value=v}function d(f,v,p,g){if(!f.value)return!0;var y=f.x-t.x,m=f.y-t.y,w=g-v,E=y*y+m*m;if(w*w/l<E)return E<o&&(y===0&&(y=Yi(e),E+=y*y),m===0&&(m=Yi(e),E+=m*m),E<s&&(E=Math.sqrt(s*E)),t.vx+=y*f.value*n/E,t.vy+=m*f.value*n/E),!0;if(f.length||E>=o)return;(f.data!==t||f.next)&&(y===0&&(y=Yi(e),E+=y*y),m===0&&(m=Yi(e),E+=m*m),E<s&&(E=Math.sqrt(s*E)));do f.data!==t&&(w=a[f.data.index]*n/E,t.vx+=y*w,t.vy+=m*w);while(f=f.next)}return u.initialize=function(f,v){r=f,e=v,c()},u.strength=function(f){return arguments.length?(i=typeof f=="function"?f:sn(+f),c(),u):i},u.distanceMin=function(f){return arguments.length?(s=f*f,u):Math.sqrt(s)},u.distanceMax=function(f){return arguments.length?(o=f*f,u):Math.sqrt(o)},u.theta=function(f){return arguments.length?(l=f*f,u):Math.sqrt(l)},u}function G9(r,t,e){var n,i=sn(.1),a,s;typeof r!="function"&&(r=sn(+r)),t==null&&(t=0),e==null&&(e=0);function o(u){for(var c=0,h=n.length;c<h;++c){var d=n[c],f=d.x-t||1e-6,v=d.y-e||1e-6,p=Math.sqrt(f*f+v*v),g=(s[c]-p)*a[c]*u/p;d.vx+=f*g,d.vy+=v*g}}function l(){if(n){var u,c=n.length;for(a=new Array(c),s=new Array(c),u=0;u<c;++u)s[u]=+r(n[u],u,n),a[u]=isNaN(s[u])?0:+i(n[u],u,n)}}return o.initialize=function(u){n=u,l()},o.strength=function(u){return arguments.length?(i=typeof u=="function"?u:sn(+u),l(),o):i},o.radius=function(u){return arguments.length?(r=typeof u=="function"?u:sn(+u),l(),o):r},o.x=function(u){return arguments.length?(t=+u,o):t},o.y=function(u){return arguments.length?(e=+u,o):e},o}function W9(r){var t=sn(.1),e,n,i;typeof r!="function"&&(r=sn(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vx+=(i[l]-c.x)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:sn(+o),s(),a):t},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:sn(+o),s(),a):r},a}function V9(r){var t=sn(.1),e,n,i;typeof r!="function"&&(r=sn(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vy+=(i[l]-c.y)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:sn(+o),s(),a):t},a.y=function(o){return arguments.length?(r=typeof o=="function"?o:sn(+o),s(),a):r},a}class U9{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:k9,manyBody:$9,center:x9,collide:_9,radial:G9,x:W9,y:V9},this.options={link:{id:e=>e.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},Bn(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find(i=>i.id===t);n&&e.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(t){var e,n;const i=Bn({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,n){var i;return Ut(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:c,data:h})=>Object.assign(Object.assign({id:c},h),Ra(h.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const l=new Promise(c=>{this.resolver=c}),u=this.setSimulation(a);return u.nodes(s),(i=u.force("link"))===null||i===void 0||i.links(o),l})}getResult(){const{assign:t,nodes:e,edges:n,graph:i}=this.context,a=e.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),Ra(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:l,target:u,data:c})=>({id:o,source:typeof l=="object"?l.id:l,target:typeof u=="object"?u.id:u,data:c}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return q9()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var n;return(n=t.onTick)===null||n===void 0?void 0:n.call(t,this.getResult())}).on("end",()=>{var n;return(n=this.resolver)===null||n===void 0?void 0:n.call(this,this.getResult())})),Lx(e,this.config.simulationAttrs.map(n=>[n,t[n]])),Object.entries(this.forceMap).forEach(([n,i])=>{const a=n;if(t[n]){let s=e.force(a);s||(s=i(),e.force(a,s)),Lx(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const Lx=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var Wd,Ix;function Y9(){if(Ix)return Wd;Ix=1;function r(){this.__data__=[],this.size=0}return Wd=r,Wd}var Vd,Dx;function Bs(){if(Dx)return Vd;Dx=1;function r(t,e){return t===e||t!==t&&e!==e}return Vd=r,Vd}var Ud,Bx;function Vc(){if(Bx)return Ud;Bx=1;var r=Bs();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return Ud=t,Ud}var Yd,Fx;function H9(){if(Fx)return Yd;Fx=1;var r=Vc(),t=Array.prototype,e=t.splice;function n(i){var a=this.__data__,s=r(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():e.call(a,s,1),--this.size,!0}return Yd=n,Yd}var Hd,zx;function X9(){if(zx)return Hd;zx=1;var r=Vc();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return Hd=t,Hd}var Xd,jx;function K9(){if(jx)return Xd;jx=1;var r=Vc();function t(e){return r(this.__data__,e)>-1}return Xd=t,Xd}var Kd,qx;function Z9(){if(qx)return Kd;qx=1;var r=Vc();function t(e,n){var i=this.__data__,a=r(i,e);return a<0?(++this.size,i.push([e,n])):i[a][1]=n,this}return Kd=t,Kd}var Zd,$x;function Uc(){if($x)return Zd;$x=1;var r=Y9(),t=H9(),e=X9(),n=K9(),i=Z9();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Zd=a,Zd}var Jd,Gx;function J9(){if(Gx)return Jd;Gx=1;var r=Uc();function t(){this.__data__=new r,this.size=0}return Jd=t,Jd}var Qd,Wx;function Q9(){if(Wx)return Qd;Wx=1;function r(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}return Qd=r,Qd}var tf,Vx;function tq(){if(Vx)return tf;Vx=1;function r(t){return this.__data__.get(t)}return tf=r,tf}var ef,Ux;function eq(){if(Ux)return ef;Ux=1;function r(t){return this.__data__.has(t)}return ef=r,ef}var nf,Yx;function OP(){if(Yx)return nf;Yx=1;var r=typeof ml=="object"&&ml&&ml.Object===Object&&ml;return nf=r,nf}var rf,Hx;function zr(){if(Hx)return rf;Hx=1;var r=OP(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return rf=e,rf}var af,Xx;function Fs(){if(Xx)return af;Xx=1;var r=zr(),t=r.Symbol;return af=t,af}var sf,Kx;function nq(){if(Kx)return sf;Kx=1;var r=Fs(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function a(s){var o=e.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var c=n.call(s);return u&&(o?s[i]=l:delete s[i]),c}return sf=a,sf}var of,Zx;function rq(){if(Zx)return of;Zx=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return of=e,of}var lf,Jx;function Ya(){if(Jx)return lf;Jx=1;var r=Fs(),t=nq(),e=rq(),n="[object Null]",i="[object Undefined]",a=r?r.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?t(o):e(o)}return lf=s,lf}var uf,Qx;function Sr(){if(Qx)return uf;Qx=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return uf=r,uf}var cf,tE;function sl(){if(tE)return cf;tE=1;var r=Ya(),t=Sr(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=r(o);return l==n||l==i||l==e||l==a}return cf=s,cf}var hf,eE;function iq(){if(eE)return hf;eE=1;var r=zr(),t=r["__core-js_shared__"];return hf=t,hf}var df,nE;function aq(){if(nE)return df;nE=1;var r=iq(),t=function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function e(n){return!!t&&t in n}return df=e,df}var ff,rE;function TP(){if(rE)return ff;rE=1;var r=Function.prototype,t=r.toString;function e(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return ff=e,ff}var gf,iE;function sq(){if(iE)return gf;iE=1;var r=sl(),t=aq(),e=Sr(),n=TP(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,c=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(d){if(!e(d)||t(d))return!1;var f=r(d)?c:a;return f.test(n(d))}return gf=h,gf}var vf,aE;function oq(){if(aE)return vf;aE=1;function r(t,e){return t==null?void 0:t[e]}return vf=r,vf}var pf,sE;function Ha(){if(sE)return pf;sE=1;var r=sq(),t=oq();function e(n,i){var a=t(n,i);return r(a)?a:void 0}return pf=e,pf}var yf,oE;function O1(){if(oE)return yf;oE=1;var r=Ha(),t=zr(),e=r(t,"Map");return yf=e,yf}var mf,lE;function Yc(){if(lE)return mf;lE=1;var r=Ha(),t=r(Object,"create");return mf=t,mf}var bf,uE;function lq(){if(uE)return bf;uE=1;var r=Yc();function t(){this.__data__=r?r(null):{},this.size=0}return bf=t,bf}var wf,cE;function uq(){if(cE)return wf;cE=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return wf=r,wf}var xf,hE;function cq(){if(hE)return xf;hE=1;var r=Yc(),t="__lodash_hash_undefined__",e=Object.prototype,n=e.hasOwnProperty;function i(a){var s=this.__data__;if(r){var o=s[a];return o===t?void 0:o}return n.call(s,a)?s[a]:void 0}return xf=i,xf}var Ef,dE;function hq(){if(dE)return Ef;dE=1;var r=Yc(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:e.call(a,i)}return Ef=n,Ef}var Sf,fE;function dq(){if(fE)return Sf;fE=1;var r=Yc(),t="__lodash_hash_undefined__";function e(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=r&&i===void 0?t:i,this}return Sf=e,Sf}var _f,gE;function fq(){if(gE)return _f;gE=1;var r=lq(),t=uq(),e=cq(),n=hq(),i=dq();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,_f=a,_f}var Mf,vE;function gq(){if(vE)return Mf;vE=1;var r=fq(),t=Uc(),e=O1();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return Mf=n,Mf}var kf,pE;function vq(){if(pE)return kf;pE=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return kf=r,kf}var Of,yE;function Hc(){if(yE)return Of;yE=1;var r=vq();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Of=t,Of}var Tf,mE;function pq(){if(mE)return Tf;mE=1;var r=Hc();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return Tf=t,Tf}var Af,bE;function yq(){if(bE)return Af;bE=1;var r=Hc();function t(e){return r(this,e).get(e)}return Af=t,Af}var Pf,wE;function mq(){if(wE)return Pf;wE=1;var r=Hc();function t(e){return r(this,e).has(e)}return Pf=t,Pf}var Nf,xE;function bq(){if(xE)return Nf;xE=1;var r=Hc();function t(e,n){var i=r(this,e),a=i.size;return i.set(e,n),this.size+=i.size==a?0:1,this}return Nf=t,Nf}var Cf,EE;function T1(){if(EE)return Cf;EE=1;var r=gq(),t=pq(),e=yq(),n=mq(),i=bq();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Cf=a,Cf}var Rf,SE;function wq(){if(SE)return Rf;SE=1;var r=Uc(),t=O1(),e=T1(),n=200;function i(a,s){var o=this.__data__;if(o instanceof r){var l=o.__data__;if(!t||l.length<n-1)return l.push([a,s]),this.size=++o.size,this;o=this.__data__=new e(l)}return o.set(a,s),this.size=o.size,this}return Rf=i,Rf}var Lf,_E;function Xc(){if(_E)return Lf;_E=1;var r=Uc(),t=J9(),e=Q9(),n=tq(),i=eq(),a=wq();function s(o){var l=this.__data__=new r(o);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=a,Lf=s,Lf}var If,ME;function A1(){if(ME)return If;ME=1;function r(t,e){for(var n=-1,i=t==null?0:t.length;++n<i&&e(t[n],n,t)!==!1;);return t}return If=r,If}var Df,kE;function AP(){if(kE)return Df;kE=1;var r=Ha(),t=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch{}}();return Df=t,Df}var Bf,OE;function Kc(){if(OE)return Bf;OE=1;var r=AP();function t(e,n,i){n=="__proto__"&&r?r(e,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[n]=i}return Bf=t,Bf}var Ff,TE;function Zc(){if(TE)return Ff;TE=1;var r=Kc(),t=Bs(),e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o){var l=a[s];(!(n.call(a,s)&&t(l,o))||o===void 0&&!(s in a))&&r(a,s,o)}return Ff=i,Ff}var zf,AE;function ol(){if(AE)return zf;AE=1;var r=Zc(),t=Kc();function e(n,i,a,s){var o=!a;a||(a={});for(var l=-1,u=i.length;++l<u;){var c=i[l],h=s?s(a[c],n[c],c,a,n):void 0;h===void 0&&(h=n[c]),o?t(a,c,h):r(a,c,h)}return a}return zf=e,zf}var jf,PE;function xq(){if(PE)return jf;PE=1;function r(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}return jf=r,jf}var qf,NE;function ui(){if(NE)return qf;NE=1;function r(t){return t!=null&&typeof t=="object"}return qf=r,qf}var $f,CE;function Eq(){if(CE)return $f;CE=1;var r=Ya(),t=ui(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return $f=n,$f}var Gf,RE;function ll(){if(RE)return Gf;RE=1;var r=Eq(),t=ui(),e=Object.prototype,n=e.hasOwnProperty,i=e.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(s){return t(s)&&n.call(s,"callee")&&!i.call(s,"callee")};return Gf=a,Gf}var Wf,LE;function Qe(){if(LE)return Wf;LE=1;var r=Array.isArray;return Wf=r,Wf}var co={exports:{}},Vf,IE;function Sq(){if(IE)return Vf;IE=1;function r(){return!1}return Vf=r,Vf}co.exports;var DE;function zs(){return DE||(DE=1,function(r,t){var e=zr(),n=Sq(),i=t&&!t.nodeType&&t,a=i&&!0&&r&&!r.nodeType&&r,s=a&&a.exports===i,o=s?e.Buffer:void 0,l=o?o.isBuffer:void 0,u=l||n;r.exports=u}(co,co.exports)),co.exports}var Uf,BE;function Jc(){if(BE)return Uf;BE=1;var r=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(n,i){var a=typeof n;return i=i==null?r:i,!!i&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Uf=e,Uf}var Yf,FE;function P1(){if(FE)return Yf;FE=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Yf=t,Yf}var Hf,zE;function _q(){if(zE)return Hf;zE=1;var r=Ya(),t=P1(),e=ui(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",u="[object Map]",c="[object Number]",h="[object Object]",d="[object RegExp]",f="[object Set]",v="[object String]",p="[object WeakMap]",g="[object ArrayBuffer]",y="[object DataView]",m="[object Float32Array]",w="[object Float64Array]",E="[object Int8Array]",_="[object Int16Array]",k="[object Int32Array]",T="[object Uint8Array]",O="[object Uint8ClampedArray]",P="[object Uint16Array]",N="[object Uint32Array]",C={};C[m]=C[w]=C[E]=C[_]=C[k]=C[T]=C[O]=C[P]=C[N]=!0,C[n]=C[i]=C[g]=C[a]=C[y]=C[s]=C[o]=C[l]=C[u]=C[c]=C[h]=C[d]=C[f]=C[v]=C[p]=!1;function L(B){return e(B)&&t(B.length)&&!!C[r(B)]}return Hf=L,Hf}var Xf,jE;function Qc(){if(jE)return Xf;jE=1;function r(t){return function(e){return t(e)}}return Xf=r,Xf}var ho={exports:{}};ho.exports;var qE;function N1(){return qE||(qE=1,function(r,t){var e=OP(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a&&e.process,o=function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}}();r.exports=o}(ho,ho.exports)),ho.exports}var Kf,$E;function ul(){if($E)return Kf;$E=1;var r=_q(),t=Qc(),e=N1(),n=e&&e.isTypedArray,i=n?t(n):r;return Kf=i,Kf}var Zf,GE;function PP(){if(GE)return Zf;GE=1;var r=xq(),t=ll(),e=Qe(),n=zs(),i=Jc(),a=ul(),s=Object.prototype,o=s.hasOwnProperty;function l(u,c){var h=e(u),d=!h&&t(u),f=!h&&!d&&n(u),v=!h&&!d&&!f&&a(u),p=h||d||f||v,g=p?r(u.length,String):[],y=g.length;for(var m in u)(c||o.call(u,m))&&!(p&&(m=="length"||f&&(m=="offset"||m=="parent")||v&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||i(m,y)))&&g.push(m);return g}return Zf=l,Zf}var Jf,WE;function th(){if(WE)return Jf;WE=1;var r=Object.prototype;function t(e){var n=e&&e.constructor,i=typeof n=="function"&&n.prototype||r;return e===i}return Jf=t,Jf}var Qf,VE;function NP(){if(VE)return Qf;VE=1;function r(t,e){return function(n){return t(e(n))}}return Qf=r,Qf}var tg,UE;function Mq(){if(UE)return tg;UE=1;var r=NP(),t=r(Object.keys,Object);return tg=t,tg}var eg,YE;function C1(){if(YE)return eg;YE=1;var r=th(),t=Mq(),e=Object.prototype,n=e.hasOwnProperty;function i(a){if(!r(a))return t(a);var s=[];for(var o in Object(a))n.call(a,o)&&o!="constructor"&&s.push(o);return s}return eg=i,eg}var ng,HE;function Ai(){if(HE)return ng;HE=1;var r=sl(),t=P1();function e(n){return n!=null&&t(n.length)&&!r(n)}return ng=e,ng}var rg,XE;function ha(){if(XE)return rg;XE=1;var r=PP(),t=C1(),e=Ai();function n(i){return e(i)?r(i):t(i)}return rg=n,rg}var ig,KE;function kq(){if(KE)return ig;KE=1;var r=ol(),t=ha();function e(n,i){return n&&r(i,t(i),n)}return ig=e,ig}var ag,ZE;function Oq(){if(ZE)return ag;ZE=1;function r(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}return ag=r,ag}var sg,JE;function Tq(){if(JE)return sg;JE=1;var r=Sr(),t=th(),e=Oq(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return e(s);var o=t(s),l=[];for(var u in s)u=="constructor"&&(o||!i.call(s,u))||l.push(u);return l}return sg=a,sg}var og,QE;function Xa(){if(QE)return og;QE=1;var r=PP(),t=Tq(),e=Ai();function n(i){return e(i)?r(i,!0):t(i)}return og=n,og}var lg,t2;function Aq(){if(t2)return lg;t2=1;var r=ol(),t=Xa();function e(n,i){return n&&r(i,t(i),n)}return lg=e,lg}var fo={exports:{}};fo.exports;var e2;function CP(){return e2||(e2=1,function(r,t){var e=zr(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a?e.Buffer:void 0,o=s?s.allocUnsafe:void 0;function l(u,c){if(c)return u.slice();var h=u.length,d=o?o(h):new u.constructor(h);return u.copy(d),d}r.exports=l}(fo,fo.exports)),fo.exports}var ug,n2;function RP(){if(n2)return ug;n2=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}return ug=r,ug}var cg,r2;function LP(){if(r2)return cg;r2=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,a=0,s=[];++n<i;){var o=t[n];e(o,n,t)&&(s[a++]=o)}return s}return cg=r,cg}var hg,i2;function IP(){if(i2)return hg;i2=1;function r(){return[]}return hg=r,hg}var dg,a2;function R1(){if(a2)return dg;a2=1;var r=LP(),t=IP(),e=Object.prototype,n=e.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),r(i(s),function(o){return n.call(s,o)}))}:t;return dg=a,dg}var fg,s2;function Pq(){if(s2)return fg;s2=1;var r=ol(),t=R1();function e(n,i){return r(n,t(n),i)}return fg=e,fg}var gg,o2;function L1(){if(o2)return gg;o2=1;function r(t,e){for(var n=-1,i=e.length,a=t.length;++n<i;)t[a+n]=e[n];return t}return gg=r,gg}var vg,l2;function eh(){if(l2)return vg;l2=1;var r=NP(),t=r(Object.getPrototypeOf,Object);return vg=t,vg}var pg,u2;function DP(){if(u2)return pg;u2=1;var r=L1(),t=eh(),e=R1(),n=IP(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var o=[];s;)r(o,e(s)),s=t(s);return o}:n;return pg=a,pg}var yg,c2;function Nq(){if(c2)return yg;c2=1;var r=ol(),t=DP();function e(n,i){return r(n,t(n),i)}return yg=e,yg}var mg,h2;function BP(){if(h2)return mg;h2=1;var r=L1(),t=Qe();function e(n,i,a){var s=i(n);return t(n)?s:r(s,a(n))}return mg=e,mg}var bg,d2;function FP(){if(d2)return bg;d2=1;var r=BP(),t=R1(),e=ha();function n(i){return r(i,e,t)}return bg=n,bg}var wg,f2;function Cq(){if(f2)return wg;f2=1;var r=BP(),t=DP(),e=Xa();function n(i){return r(i,e,t)}return wg=n,wg}var xg,g2;function Rq(){if(g2)return xg;g2=1;var r=Ha(),t=zr(),e=r(t,"DataView");return xg=e,xg}var Eg,v2;function Lq(){if(v2)return Eg;v2=1;var r=Ha(),t=zr(),e=r(t,"Promise");return Eg=e,Eg}var Sg,p2;function zP(){if(p2)return Sg;p2=1;var r=Ha(),t=zr(),e=r(t,"Set");return Sg=e,Sg}var _g,y2;function Iq(){if(y2)return _g;y2=1;var r=Ha(),t=zr(),e=r(t,"WeakMap");return _g=e,_g}var Mg,m2;function js(){if(m2)return Mg;m2=1;var r=Rq(),t=O1(),e=Lq(),n=zP(),i=Iq(),a=Ya(),s=TP(),o="[object Map]",l="[object Object]",u="[object Promise]",c="[object Set]",h="[object WeakMap]",d="[object DataView]",f=s(r),v=s(t),p=s(e),g=s(n),y=s(i),m=a;return(r&&m(new r(new ArrayBuffer(1)))!=d||t&&m(new t)!=o||e&&m(e.resolve())!=u||n&&m(new n)!=c||i&&m(new i)!=h)&&(m=function(w){var E=a(w),_=E==l?w.constructor:void 0,k=_?s(_):"";if(k)switch(k){case f:return d;case v:return o;case p:return u;case g:return c;case y:return h}return E}),Mg=m,Mg}var kg,b2;function Dq(){if(b2)return kg;b2=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&t.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return kg=e,kg}var Og,w2;function jP(){if(w2)return Og;w2=1;var r=zr(),t=r.Uint8Array;return Og=t,Og}var Tg,x2;function I1(){if(x2)return Tg;x2=1;var r=jP();function t(e){var n=new e.constructor(e.byteLength);return new r(n).set(new r(e)),n}return Tg=t,Tg}var Ag,E2;function Bq(){if(E2)return Ag;E2=1;var r=I1();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}return Ag=t,Ag}var Pg,S2;function Fq(){if(S2)return Pg;S2=1;var r=/\w*$/;function t(e){var n=new e.constructor(e.source,r.exec(e));return n.lastIndex=e.lastIndex,n}return Pg=t,Pg}var Ng,_2;function zq(){if(_2)return Ng;_2=1;var r=Fs(),t=r?r.prototype:void 0,e=t?t.valueOf:void 0;function n(i){return e?Object(e.call(i)):{}}return Ng=n,Ng}var Cg,M2;function qP(){if(M2)return Cg;M2=1;var r=I1();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}return Cg=t,Cg}var Rg,k2;function jq(){if(k2)return Rg;k2=1;var r=I1(),t=Bq(),e=Fq(),n=zq(),i=qP(),a="[object Boolean]",s="[object Date]",o="[object Map]",l="[object Number]",u="[object RegExp]",c="[object Set]",h="[object String]",d="[object Symbol]",f="[object ArrayBuffer]",v="[object DataView]",p="[object Float32Array]",g="[object Float64Array]",y="[object Int8Array]",m="[object Int16Array]",w="[object Int32Array]",E="[object Uint8Array]",_="[object Uint8ClampedArray]",k="[object Uint16Array]",T="[object Uint32Array]";function O(P,N,C){var L=P.constructor;switch(N){case f:return r(P);case a:case s:return new L(+P);case v:return t(P,C);case p:case g:case y:case m:case w:case E:case _:case k:case T:return i(P,C);case o:return new L;case l:case h:return new L(P);case u:return e(P);case c:return new L;case d:return n(P)}}return Rg=O,Rg}var Lg,O2;function $P(){if(O2)return Lg;O2=1;var r=Sr(),t=Object.create,e=function(){function n(){}return function(i){if(!r(i))return{};if(t)return t(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}}();return Lg=e,Lg}var Ig,T2;function GP(){if(T2)return Ig;T2=1;var r=$P(),t=eh(),e=th();function n(i){return typeof i.constructor=="function"&&!e(i)?r(t(i)):{}}return Ig=n,Ig}var Dg,A2;function qq(){if(A2)return Dg;A2=1;var r=js(),t=ui(),e="[object Map]";function n(i){return t(i)&&r(i)==e}return Dg=n,Dg}var Bg,P2;function $q(){if(P2)return Bg;P2=1;var r=qq(),t=Qc(),e=N1(),n=e&&e.isMap,i=n?t(n):r;return Bg=i,Bg}var Fg,N2;function Gq(){if(N2)return Fg;N2=1;var r=js(),t=ui(),e="[object Set]";function n(i){return t(i)&&r(i)==e}return Fg=n,Fg}var zg,C2;function Wq(){if(C2)return zg;C2=1;var r=Gq(),t=Qc(),e=N1(),n=e&&e.isSet,i=n?t(n):r;return zg=i,zg}var jg,R2;function WP(){if(R2)return jg;R2=1;var r=Xc(),t=A1(),e=Zc(),n=kq(),i=Aq(),a=CP(),s=RP(),o=Pq(),l=Nq(),u=FP(),c=Cq(),h=js(),d=Dq(),f=jq(),v=GP(),p=Qe(),g=zs(),y=$q(),m=Sr(),w=Wq(),E=ha(),_=Xa(),k=1,T=2,O=4,P="[object Arguments]",N="[object Array]",C="[object Boolean]",L="[object Date]",B="[object Error]",G="[object Function]",V="[object GeneratorFunction]",U="[object Map]",$="[object Number]",j="[object Object]",Z="[object RegExp]",nt="[object Set]",st="[object String]",ot="[object Symbol]",Pt="[object WeakMap]",K="[object ArrayBuffer]",W="[object DataView]",tt="[object Float32Array]",ct="[object Float64Array]",Et="[object Int8Array]",Nt="[object Int16Array]",Vt="[object Int32Array]",ke="[object Uint8Array]",un="[object Uint8ClampedArray]",Oe="[object Uint16Array]",Ue="[object Uint32Array]",Xt={};Xt[P]=Xt[N]=Xt[K]=Xt[W]=Xt[C]=Xt[L]=Xt[tt]=Xt[ct]=Xt[Et]=Xt[Nt]=Xt[Vt]=Xt[U]=Xt[$]=Xt[j]=Xt[Z]=Xt[nt]=Xt[st]=Xt[ot]=Xt[ke]=Xt[un]=Xt[Oe]=Xt[Ue]=!0,Xt[B]=Xt[G]=Xt[Pt]=!1;function cr(Jt,hr,we,Za,dr,$e){var Re,zn=hr&k,jn=hr&T,fr=hr&O;if(we&&(Re=dr?we(Jt,Za,dr,$e):we(Jt)),Re!==void 0)return Re;if(!m(Jt))return Jt;var ci=p(Jt);if(ci){if(Re=d(Jt),!zn)return s(Jt,Re)}else{var $r=h(Jt),Ja=$r==G||$r==V;if(g(Jt))return a(Jt,zn);if($r==j||$r==P||Ja&&!dr){if(Re=jn||Ja?{}:v(Jt),!zn)return jn?l(Jt,i(Re,Jt)):o(Jt,n(Re,Jt))}else{if(!Xt[$r])return dr?Jt:{};Re=f(Jt,$r,zn)}}$e||($e=new r);var Qa=$e.get(Jt);if(Qa)return Qa;$e.set(Jt,Re),w(Jt)?Jt.forEach(function(Gr){Re.add(cr(Gr,hr,we,Gr,Jt,$e))}):y(Jt)&&Jt.forEach(function(Gr,Wr){Re.set(Wr,cr(Gr,hr,we,Wr,Jt,$e))});var jh=fr?jn?c:u:jn?_:E,fl=ci?void 0:jh(Jt);return t(fl||Jt,function(Gr,Wr){fl&&(Wr=Gr,Gr=Jt[Wr]),e(Re,Wr,cr(Gr,hr,we,Wr,Jt,$e))}),Re}return jg=cr,jg}var qg,L2;function Vq(){if(L2)return qg;L2=1;var r=WP(),t=4;function e(n){return r(n,t)}return qg=e,qg}var $g,I2;function D1(){if(I2)return $g;I2=1;function r(t){return function(){return t}}return $g=r,$g}var Gg,D2;function Uq(){if(D2)return Gg;D2=1;function r(t){return function(e,n,i){for(var a=-1,s=Object(e),o=i(e),l=o.length;l--;){var u=o[t?l:++a];if(n(s[u],u,s)===!1)break}return e}}return Gg=r,Gg}var Wg,B2;function B1(){if(B2)return Wg;B2=1;var r=Uq(),t=r();return Wg=t,Wg}var Vg,F2;function F1(){if(F2)return Vg;F2=1;var r=B1(),t=ha();function e(n,i){return n&&r(n,i,t)}return Vg=e,Vg}var Ug,z2;function Yq(){if(z2)return Ug;z2=1;var r=Ai();function t(e,n){return function(i,a){if(i==null)return i;if(!r(i))return e(i,a);for(var s=i.length,o=n?s:-1,l=Object(i);(n?o--:++o<s)&&a(l[o],o,l)!==!1;);return i}}return Ug=t,Ug}var Yg,j2;function nh(){if(j2)return Yg;j2=1;var r=F1(),t=Yq(),e=t(r);return Yg=e,Yg}var Hg,q2;function Ka(){if(q2)return Hg;q2=1;function r(t){return t}return Hg=r,Hg}var Xg,$2;function VP(){if($2)return Xg;$2=1;var r=Ka();function t(e){return typeof e=="function"?e:r}return Xg=t,Xg}var Kg,G2;function UP(){if(G2)return Kg;G2=1;var r=A1(),t=nh(),e=VP(),n=Qe();function i(a,s){var o=n(a)?r:t;return o(a,e(s))}return Kg=i,Kg}var Zg,W2;function YP(){return W2||(W2=1,Zg=UP()),Zg}var Jg,V2;function Hq(){if(V2)return Jg;V2=1;var r=nh();function t(e,n){var i=[];return r(e,function(a,s,o){n(a,s,o)&&i.push(a)}),i}return Jg=t,Jg}var Qg,U2;function Xq(){if(U2)return Qg;U2=1;var r="__lodash_hash_undefined__";function t(e){return this.__data__.set(e,r),this}return Qg=t,Qg}var tv,Y2;function Kq(){if(Y2)return tv;Y2=1;function r(t){return this.__data__.has(t)}return tv=r,tv}var ev,H2;function HP(){if(H2)return ev;H2=1;var r=T1(),t=Xq(),e=Kq();function n(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new r;++a<s;)this.add(i[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=e,ev=n,ev}var nv,X2;function Zq(){if(X2)return nv;X2=1;function r(t,e){for(var n=-1,i=t==null?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1}return nv=r,nv}var rv,K2;function XP(){if(K2)return rv;K2=1;function r(t,e){return t.has(e)}return rv=r,rv}var iv,Z2;function KP(){if(Z2)return iv;Z2=1;var r=HP(),t=Zq(),e=XP(),n=1,i=2;function a(s,o,l,u,c,h){var d=l&n,f=s.length,v=o.length;if(f!=v&&!(d&&v>f))return!1;var p=h.get(s),g=h.get(o);if(p&&g)return p==o&&g==s;var y=-1,m=!0,w=l&i?new r:void 0;for(h.set(s,o),h.set(o,s);++y<f;){var E=s[y],_=o[y];if(u)var k=d?u(_,E,y,o,s,h):u(E,_,y,s,o,h);if(k!==void 0){if(k)continue;m=!1;break}if(w){if(!t(o,function(T,O){if(!e(w,O)&&(E===T||c(E,T,l,u,h)))return w.push(O)})){m=!1;break}}else if(!(E===_||c(E,_,l,u,h))){m=!1;break}}return h.delete(s),h.delete(o),m}return iv=a,iv}var av,J2;function Jq(){if(J2)return av;J2=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i,a){n[++e]=[a,i]}),n}return av=r,av}var sv,Q2;function z1(){if(Q2)return sv;Q2=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i){n[++e]=i}),n}return sv=r,sv}var ov,tS;function Qq(){if(tS)return ov;tS=1;var r=Fs(),t=jP(),e=Bs(),n=KP(),i=Jq(),a=z1(),s=1,o=2,l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Map]",d="[object Number]",f="[object RegExp]",v="[object Set]",p="[object String]",g="[object Symbol]",y="[object ArrayBuffer]",m="[object DataView]",w=r?r.prototype:void 0,E=w?w.valueOf:void 0;function _(k,T,O,P,N,C,L){switch(O){case m:if(k.byteLength!=T.byteLength||k.byteOffset!=T.byteOffset)return!1;k=k.buffer,T=T.buffer;case y:return!(k.byteLength!=T.byteLength||!C(new t(k),new t(T)));case l:case u:case d:return e(+k,+T);case c:return k.name==T.name&&k.message==T.message;case f:case p:return k==T+"";case h:var B=i;case v:var G=P&s;if(B||(B=a),k.size!=T.size&&!G)return!1;var V=L.get(k);if(V)return V==T;P|=o,L.set(k,T);var U=n(B(k),B(T),P,N,C,L);return L.delete(k),U;case g:if(E)return E.call(k)==E.call(T)}return!1}return ov=_,ov}var lv,eS;function t$(){if(eS)return lv;eS=1;var r=FP(),t=1,e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o,l,u,c){var h=o&t,d=r(a),f=d.length,v=r(s),p=v.length;if(f!=p&&!h)return!1;for(var g=f;g--;){var y=d[g];if(!(h?y in s:n.call(s,y)))return!1}var m=c.get(a),w=c.get(s);if(m&&w)return m==s&&w==a;var E=!0;c.set(a,s),c.set(s,a);for(var _=h;++g<f;){y=d[g];var k=a[y],T=s[y];if(l)var O=h?l(T,k,y,s,a,c):l(k,T,y,a,s,c);if(!(O===void 0?k===T||u(k,T,o,l,c):O)){E=!1;break}_||(_=y=="constructor")}if(E&&!_){var P=a.constructor,N=s.constructor;P!=N&&"constructor"in a&&"constructor"in s&&!(typeof P=="function"&&P instanceof P&&typeof N=="function"&&N instanceof N)&&(E=!1)}return c.delete(a),c.delete(s),E}return lv=i,lv}var uv,nS;function e$(){if(nS)return uv;nS=1;var r=Xc(),t=KP(),e=Qq(),n=t$(),i=js(),a=Qe(),s=zs(),o=ul(),l=1,u="[object Arguments]",c="[object Array]",h="[object Object]",d=Object.prototype,f=d.hasOwnProperty;function v(p,g,y,m,w,E){var _=a(p),k=a(g),T=_?c:i(p),O=k?c:i(g);T=T==u?h:T,O=O==u?h:O;var P=T==h,N=O==h,C=T==O;if(C&&s(p)){if(!s(g))return!1;_=!0,P=!1}if(C&&!P)return E||(E=new r),_||o(p)?t(p,g,y,m,w,E):e(p,g,T,y,m,w,E);if(!(y&l)){var L=P&&f.call(p,"__wrapped__"),B=N&&f.call(g,"__wrapped__");if(L||B){var G=L?p.value():p,V=B?g.value():g;return E||(E=new r),w(G,V,y,m,E)}}return C?(E||(E=new r),n(p,g,y,m,w,E)):!1}return uv=v,uv}var cv,rS;function ZP(){if(rS)return cv;rS=1;var r=e$(),t=ui();function e(n,i,a,s,o){return n===i?!0:n==null||i==null||!t(n)&&!t(i)?n!==n&&i!==i:r(n,i,a,s,e,o)}return cv=e,cv}var hv,iS;function n$(){if(iS)return hv;iS=1;var r=Xc(),t=ZP(),e=1,n=2;function i(a,s,o,l){var u=o.length,c=u,h=!l;if(a==null)return!c;for(a=Object(a);u--;){var d=o[u];if(h&&d[2]?d[1]!==a[d[0]]:!(d[0]in a))return!1}for(;++u<c;){d=o[u];var f=d[0],v=a[f],p=d[1];if(h&&d[2]){if(v===void 0&&!(f in a))return!1}else{var g=new r;if(l)var y=l(v,p,f,a,s,g);if(!(y===void 0?t(p,v,e|n,l,g):y))return!1}}return!0}return hv=i,hv}var dv,aS;function JP(){if(aS)return dv;aS=1;var r=Sr();function t(e){return e===e&&!r(e)}return dv=t,dv}var fv,sS;function r$(){if(sS)return fv;sS=1;var r=JP(),t=ha();function e(n){for(var i=t(n),a=i.length;a--;){var s=i[a],o=n[s];i[a]=[s,o,r(o)]}return i}return fv=e,fv}var gv,oS;function QP(){if(oS)return gv;oS=1;function r(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}return gv=r,gv}var vv,lS;function i$(){if(lS)return vv;lS=1;var r=n$(),t=r$(),e=QP();function n(i){var a=t(i);return a.length==1&&a[0][2]?e(a[0][0],a[0][1]):function(s){return s===i||r(s,i,a)}}return vv=n,vv}var pv,uS;function qs(){if(uS)return pv;uS=1;var r=Ya(),t=ui(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return pv=n,pv}var yv,cS;function j1(){if(cS)return yv;cS=1;var r=Qe(),t=qs(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(r(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:n.test(a)||!e.test(a)||s!=null&&a in Object(s)}return yv=i,yv}var mv,hS;function a$(){if(hS)return mv;hS=1;var r=T1(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=n.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(e.Cache||r),a}return e.Cache=r,mv=e,mv}var bv,dS;function s$(){if(dS)return bv;dS=1;var r=a$(),t=500;function e(n){var i=r(n,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return bv=e,bv}var wv,fS;function o$(){if(fS)return wv;fS=1;var r=s$(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(e,"$1"):o||s)}),a});return wv=n,wv}var xv,gS;function rh(){if(gS)return xv;gS=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=e(t[n],n,t);return a}return xv=r,xv}var Ev,vS;function l$(){if(vS)return Ev;vS=1;var r=Fs(),t=rh(),e=Qe(),n=qs(),i=r?r.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(e(o))return t(o,s)+"";if(n(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return Ev=s,Ev}var Sv,pS;function tN(){if(pS)return Sv;pS=1;var r=l$();function t(e){return e==null?"":r(e)}return Sv=t,Sv}var _v,yS;function ih(){if(yS)return _v;yS=1;var r=Qe(),t=j1(),e=o$(),n=tN();function i(a,s){return r(a)?a:t(a,s)?[a]:e(n(a))}return _v=i,_v}var Mv,mS;function cl(){if(mS)return Mv;mS=1;var r=qs();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return Mv=t,Mv}var kv,bS;function ah(){if(bS)return kv;bS=1;var r=ih(),t=cl();function e(n,i){i=r(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[t(i[a++])];return a&&a==s?n:void 0}return kv=e,kv}var Ov,wS;function u$(){if(wS)return Ov;wS=1;var r=ah();function t(e,n,i){var a=e==null?void 0:r(e,n);return a===void 0?i:a}return Ov=t,Ov}var Tv,xS;function c$(){if(xS)return Tv;xS=1;function r(t,e){return t!=null&&e in Object(t)}return Tv=r,Tv}var Av,ES;function eN(){if(ES)return Av;ES=1;var r=ih(),t=ll(),e=Qe(),n=Jc(),i=P1(),a=cl();function s(o,l,u){l=r(l,o);for(var c=-1,h=l.length,d=!1;++c<h;){var f=a(l[c]);if(!(d=o!=null&&u(o,f)))break;o=o[f]}return d||++c!=h?d:(h=o==null?0:o.length,!!h&&i(h)&&n(f,h)&&(e(o)||t(o)))}return Av=s,Av}var Pv,SS;function nN(){if(SS)return Pv;SS=1;var r=c$(),t=eN();function e(n,i){return n!=null&&t(n,i,r)}return Pv=e,Pv}var Nv,_S;function h$(){if(_S)return Nv;_S=1;var r=ZP(),t=u$(),e=nN(),n=j1(),i=JP(),a=QP(),s=cl(),o=1,l=2;function u(c,h){return n(c)&&i(h)?a(s(c),h):function(d){var f=t(d,c);return f===void 0&&f===h?e(d,c):r(h,f,o|l)}}return Nv=u,Nv}var Cv,MS;function rN(){if(MS)return Cv;MS=1;function r(t){return function(e){return e==null?void 0:e[t]}}return Cv=r,Cv}var Rv,kS;function d$(){if(kS)return Rv;kS=1;var r=ah();function t(e){return function(n){return r(n,e)}}return Rv=t,Rv}var Lv,OS;function f$(){if(OS)return Lv;OS=1;var r=rN(),t=d$(),e=j1(),n=cl();function i(a){return e(a)?r(n(a)):t(a)}return Lv=i,Lv}var Iv,TS;function Pi(){if(TS)return Iv;TS=1;var r=i$(),t=h$(),e=Ka(),n=Qe(),i=f$();function a(s){return typeof s=="function"?s:s==null?e:typeof s=="object"?n(s)?t(s[0],s[1]):r(s):i(s)}return Iv=a,Iv}var Dv,AS;function iN(){if(AS)return Dv;AS=1;var r=LP(),t=Hq(),e=Pi(),n=Qe();function i(a,s){var o=n(a)?r:t;return o(a,e(s,3))}return Dv=i,Dv}var Bv,PS;function g$(){if(PS)return Bv;PS=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n,i){return n!=null&&t.call(n,i)}return Bv=e,Bv}var Fv,NS;function aN(){if(NS)return Fv;NS=1;var r=g$(),t=eN();function e(n,i){return n!=null&&t(n,i,r)}return Fv=e,Fv}var zv,CS;function v$(){if(CS)return zv;CS=1;var r=C1(),t=js(),e=ll(),n=Qe(),i=Ai(),a=zs(),s=th(),o=ul(),l="[object Map]",u="[object Set]",c=Object.prototype,h=c.hasOwnProperty;function d(f){if(f==null)return!0;if(i(f)&&(n(f)||typeof f=="string"||typeof f.splice=="function"||a(f)||o(f)||e(f)))return!f.length;var v=t(f);if(v==l||v==u)return!f.size;if(s(f))return!r(f).length;for(var p in f)if(h.call(f,p))return!1;return!0}return zv=d,zv}var jv,RS;function sN(){if(RS)return jv;RS=1;function r(t){return t===void 0}return jv=r,jv}var qv,LS;function oN(){if(LS)return qv;LS=1;var r=nh(),t=Ai();function e(n,i){var a=-1,s=t(n)?Array(n.length):[];return r(n,function(o,l,u){s[++a]=i(o,l,u)}),s}return qv=e,qv}var $v,IS;function lN(){if(IS)return $v;IS=1;var r=rh(),t=Pi(),e=oN(),n=Qe();function i(a,s){var o=n(a)?r:e;return o(a,t(s,3))}return $v=i,$v}var Gv,DS;function p$(){if(DS)return Gv;DS=1;function r(t,e,n,i){var a=-1,s=t==null?0:t.length;for(i&&s&&(n=t[++a]);++a<s;)n=e(n,t[a],a,t);return n}return Gv=r,Gv}var Wv,BS;function y$(){if(BS)return Wv;BS=1;function r(t,e,n,i,a){return a(t,function(s,o,l){n=i?(i=!1,s):e(n,s,o,l)}),n}return Wv=r,Wv}var Vv,FS;function uN(){if(FS)return Vv;FS=1;var r=p$(),t=nh(),e=Pi(),n=y$(),i=Qe();function a(s,o,l){var u=i(s)?r:n,c=arguments.length<3;return u(s,e(o,4),l,c,t)}return Vv=a,Vv}var Uv,zS;function m$(){if(zS)return Uv;zS=1;var r=Ya(),t=Qe(),e=ui(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&e(a)&&r(a)==n}return Uv=i,Uv}var Yv,jS;function b$(){if(jS)return Yv;jS=1;var r=rN(),t=r("length");return Yv=t,Yv}var Hv,qS;function w$(){if(qS)return Hv;qS=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+r+i+a+"]");function l(u){return o.test(u)}return Hv=l,Hv}var Xv,$S;function x$(){if($S)return Xv;$S=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="["+r+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",f="\\u200d",v=u+"?",p="["+a+"]?",g="(?:"+f+"(?:"+[c,h,d].join("|")+")"+p+v+")*",y=p+v+g,m="(?:"+[c+o+"?",o,h,d,s].join("|")+")",w=RegExp(l+"(?="+l+")|"+m+y,"g");function E(_){for(var k=w.lastIndex=0;w.test(_);)++k;return k}return Xv=E,Xv}var Kv,GS;function E$(){if(GS)return Kv;GS=1;var r=b$(),t=w$(),e=x$();function n(i){return t(i)?e(i):r(i)}return Kv=n,Kv}var Zv,WS;function S$(){if(WS)return Zv;WS=1;var r=C1(),t=js(),e=Ai(),n=m$(),i=E$(),a="[object Map]",s="[object Set]";function o(l){if(l==null)return 0;if(e(l))return n(l)?i(l):l.length;var u=t(l);return u==a||u==s?l.size:r(l).length}return Zv=o,Zv}var Jv,VS;function _$(){if(VS)return Jv;VS=1;var r=A1(),t=$P(),e=F1(),n=Pi(),i=eh(),a=Qe(),s=zs(),o=sl(),l=Sr(),u=ul();function c(h,d,f){var v=a(h),p=v||s(h)||u(h);if(d=n(d,4),f==null){var g=h&&h.constructor;p?f=v?new g:[]:l(h)?f=o(g)?t(i(h)):{}:f={}}return(p?r:e)(h,function(y,m,w){return d(f,y,m,w)}),f}return Jv=c,Jv}var Qv,US;function M$(){if(US)return Qv;US=1;var r=Fs(),t=ll(),e=Qe(),n=r?r.isConcatSpreadable:void 0;function i(a){return e(a)||t(a)||!!(n&&a&&a[n])}return Qv=i,Qv}var tp,YS;function q1(){if(YS)return tp;YS=1;var r=L1(),t=M$();function e(n,i,a,s,o){var l=-1,u=n.length;for(a||(a=t),o||(o=[]);++l<u;){var c=n[l];i>0&&a(c)?i>1?e(c,i-1,a,s,o):r(o,c):s||(o[o.length]=c)}return o}return tp=e,tp}var ep,HS;function k$(){if(HS)return ep;HS=1;function r(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}return ep=r,ep}var np,XS;function cN(){if(XS)return np;XS=1;var r=k$(),t=Math.max;function e(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),u=Array(l);++o<l;)u[o]=s[i+o];o=-1;for(var c=Array(i+1);++o<i;)c[o]=s[o];return c[i]=a(u),r(n,this,c)}}return np=e,np}var rp,KS;function O$(){if(KS)return rp;KS=1;var r=D1(),t=AP(),e=Ka(),n=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:r(a),writable:!0})}:e;return rp=n,rp}var ip,ZS;function T$(){if(ZS)return ip;ZS=1;var r=800,t=16,e=Date.now;function n(i){var a=0,s=0;return function(){var o=e(),l=t-(o-s);if(s=o,l>0){if(++a>=r)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return ip=n,ip}var ap,JS;function hN(){if(JS)return ap;JS=1;var r=O$(),t=T$(),e=t(r);return ap=e,ap}var sp,QS;function sh(){if(QS)return sp;QS=1;var r=Ka(),t=cN(),e=hN();function n(i,a){return e(t(i,a,r),i+"")}return sp=n,sp}var op,t_;function dN(){if(t_)return op;t_=1;function r(t,e,n,i){for(var a=t.length,s=n+(i?1:-1);i?s--:++s<a;)if(e(t[s],s,t))return s;return-1}return op=r,op}var lp,e_;function A$(){if(e_)return lp;e_=1;function r(t){return t!==t}return lp=r,lp}var up,n_;function P$(){if(n_)return up;n_=1;function r(t,e,n){for(var i=n-1,a=t.length;++i<a;)if(t[i]===e)return i;return-1}return up=r,up}var cp,r_;function N$(){if(r_)return cp;r_=1;var r=dN(),t=A$(),e=P$();function n(i,a,s){return a===a?e(i,a,s):r(i,t,s)}return cp=n,cp}var hp,i_;function C$(){if(i_)return hp;i_=1;var r=N$();function t(e,n){var i=e==null?0:e.length;return!!i&&r(e,n,0)>-1}return hp=t,hp}var dp,a_;function R$(){if(a_)return dp;a_=1;function r(t,e,n){for(var i=-1,a=t==null?0:t.length;++i<a;)if(n(e,t[i]))return!0;return!1}return dp=r,dp}var fp,s_;function L$(){if(s_)return fp;s_=1;function r(){}return fp=r,fp}var gp,o_;function I$(){if(o_)return gp;o_=1;var r=zP(),t=L$(),e=z1(),n=1/0,i=r&&1/e(new r([,-0]))[1]==n?function(a){return new r(a)}:t;return gp=i,gp}var vp,l_;function D$(){if(l_)return vp;l_=1;var r=HP(),t=C$(),e=R$(),n=XP(),i=I$(),a=z1(),s=200;function o(l,u,c){var h=-1,d=t,f=l.length,v=!0,p=[],g=p;if(c)v=!1,d=e;else if(f>=s){var y=u?null:i(l);if(y)return a(y);v=!1,d=n,g=new r}else g=u?[]:p;t:for(;++h<f;){var m=l[h],w=u?u(m):m;if(m=c||m!==0?m:0,v&&w===w){for(var E=g.length;E--;)if(g[E]===w)continue t;u&&g.push(w),p.push(m)}else d(g,w,c)||(g!==p&&g.push(w),p.push(m))}return p}return vp=o,vp}var pp,u_;function fN(){if(u_)return pp;u_=1;var r=Ai(),t=ui();function e(n){return t(n)&&r(n)}return pp=e,pp}var yp,c_;function B$(){if(c_)return yp;c_=1;var r=q1(),t=sh(),e=D$(),n=fN(),i=t(function(a){return e(r(a,1,n,!0))});return yp=i,yp}var mp,h_;function F$(){if(h_)return mp;h_=1;var r=rh();function t(e,n){return r(n,function(i){return e[i]})}return mp=t,mp}var bp,d_;function gN(){if(d_)return bp;d_=1;var r=F$(),t=ha();function e(n){return n==null?[]:r(n,t(n))}return bp=e,bp}var wp,f_;function _r(){if(f_)return wp;f_=1;var r;if(typeof jm=="function")try{r={clone:Vq(),constant:D1(),each:YP(),filter:iN(),has:aN(),isArray:Qe(),isEmpty:v$(),isFunction:sl(),isUndefined:sN(),keys:ha(),map:lN(),reduce:uN(),size:S$(),transform:_$(),union:B$(),values:gN()}}catch{}return r||(r=window._),wp=r,wp}var xp,g_;function $1(){if(g_)return xp;g_=1;var r=_r();xp=i;var t="\0",e="\0",n="";function i(c){this._isDirected=r.has(c,"directed")?c.directed:!0,this._isMultigraph=r.has(c,"multigraph")?c.multigraph:!1,this._isCompound=r.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._in[h])})},i.prototype.sinks=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._out[h])})},i.prototype.setNodes=function(c,h){var d=arguments,f=this;return r.each(c,function(v){d.length>1?f.setNode(v,h):f.setNode(v)}),this},i.prototype.setNode=function(c,h){return r.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=h),this):(this._nodes[c]=arguments.length>1?h:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=e,this._children[c]={},this._children[e][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return r.has(this._nodes,c)},i.prototype.removeNode=function(c){var h=this;if(r.has(this._nodes,c)){var d=function(f){h.removeEdge(h._edgeObjs[f])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],r.each(this.children(c),function(f){h.setParent(f)}),delete this._children[c]),r.each(r.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],r.each(r.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(h))h=e;else{h+="";for(var d=h;!r.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+h+" as parent of "+c+" would create a cycle");this.setNode(h)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=h,this._children[h][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var h=this._parent[c];if(h!==e)return h}},i.prototype.children=function(c){if(r.isUndefined(c)&&(c=e),this._isCompound){var h=this._children[c];if(h)return r.keys(h)}else{if(c===e)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var h=this._preds[c];if(h)return r.keys(h)},i.prototype.successors=function(c){var h=this._sucs[c];if(h)return r.keys(h)},i.prototype.neighbors=function(c){var h=this.predecessors(c);if(h)return r.union(h,this.successors(c))},i.prototype.isLeaf=function(c){var h;return this.isDirected()?h=this.successors(c):h=this.neighbors(c),h.length===0},i.prototype.filterNodes=function(c){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var d=this;r.each(this._nodes,function(p,g){c(g)&&h.setNode(g,p)}),r.each(this._edgeObjs,function(p){h.hasNode(p.v)&&h.hasNode(p.w)&&h.setEdge(p,d.edge(p))});var f={};function v(p){var g=d.parent(p);return g===void 0||h.hasNode(g)?(f[p]=g,g):g in f?f[g]:v(g)}return this._isCompound&&r.each(h.nodes(),function(p){h.setParent(p,v(p))}),h},i.prototype.setDefaultEdgeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(c,h){var d=this,f=arguments;return r.reduce(c,function(v,p){return f.length>1?d.setEdge(v,p,h):d.setEdge(v,p),p}),this},i.prototype.setEdge=function(){var c,h,d,f,v=!1,p=arguments[0];typeof p=="object"&&p!==null&&"v"in p?(c=p.v,h=p.w,d=p.name,arguments.length===2&&(f=arguments[1],v=!0)):(c=p,h=arguments[1],d=arguments[3],arguments.length>2&&(f=arguments[2],v=!0)),c=""+c,h=""+h,r.isUndefined(d)||(d=""+d);var g=o(this._isDirected,c,h,d);if(r.has(this._edgeLabels,g))return v&&(this._edgeLabels[g]=f),this;if(!r.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(h),this._edgeLabels[g]=v?f:this._defaultEdgeLabelFn(c,h,d);var y=l(this._isDirected,c,h,d);return c=y.v,h=y.w,Object.freeze(y),this._edgeObjs[g]=y,a(this._preds[h],c),a(this._sucs[c],h),this._in[h][g]=y,this._out[c][g]=y,this._edgeCount++,this},i.prototype.edge=function(c,h,d){var f=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return this._edgeLabels[f]},i.prototype.hasEdge=function(c,h,d){var f=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return r.has(this._edgeLabels,f)},i.prototype.removeEdge=function(c,h,d){var f=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d),v=this._edgeObjs[f];return v&&(c=v.v,h=v.w,delete this._edgeLabels[f],delete this._edgeObjs[f],s(this._preds[h],c),s(this._sucs[c],h),delete this._in[h][f],delete this._out[c][f],this._edgeCount--),this},i.prototype.inEdges=function(c,h){var d=this._in[c];if(d){var f=r.values(d);return h?r.filter(f,function(v){return v.v===h}):f}},i.prototype.outEdges=function(c,h){var d=this._out[c];if(d){var f=r.values(d);return h?r.filter(f,function(v){return v.w===h}):f}},i.prototype.nodeEdges=function(c,h){var d=this.inEdges(c,h);if(d)return d.concat(this.outEdges(c,h))};function a(c,h){c[h]?c[h]++:c[h]=1}function s(c,h){--c[h]||delete c[h]}function o(c,h,d,f){var v=""+h,p=""+d;if(!c&&v>p){var g=v;v=p,p=g}return v+n+p+n+(r.isUndefined(f)?t:f)}function l(c,h,d,f){var v=""+h,p=""+d;if(!c&&v>p){var g=v;v=p,p=g}var y={v,w:p};return f&&(y.name=f),y}function u(c,h){return o(c,h.v,h.w,h.name)}return xp}var Ep,v_;function z$(){return v_||(v_=1,Ep="2.1.8"),Ep}var Sp,p_;function j$(){return p_||(p_=1,Sp={Graph:$1(),version:z$()}),Sp}var _p,y_;function q$(){if(y_)return _p;y_=1;var r=_r(),t=$1();_p={write:e,read:a};function e(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return r.isUndefined(s.graph())||(o.value=r.clone(s.graph())),o}function n(s){return r.map(s.nodes(),function(o){var l=s.node(o),u=s.parent(o),c={v:o};return r.isUndefined(l)||(c.value=l),r.isUndefined(u)||(c.parent=u),c})}function i(s){return r.map(s.edges(),function(o){var l=s.edge(o),u={v:o.v,w:o.w};return r.isUndefined(o.name)||(u.name=o.name),r.isUndefined(l)||(u.value=l),u})}function a(s){var o=new t(s.options).setGraph(s.value);return r.each(s.nodes,function(l){o.setNode(l.v,l.value),l.parent&&o.setParent(l.v,l.parent)}),r.each(s.edges,function(l){o.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),o}return _p}var Mp,m_;function $$(){if(m_)return Mp;m_=1;var r=_r();Mp=t;function t(e){var n={},i=[],a;function s(o){r.has(n,o)||(n[o]=!0,a.push(o),r.each(e.successors(o),s),r.each(e.predecessors(o),s))}return r.each(e.nodes(),function(o){a=[],s(o),a.length&&i.push(a)}),i}return Mp}var kp,b_;function vN(){if(b_)return kp;b_=1;var r=_r();kp=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(e){return e.key})},t.prototype.has=function(e){return r.has(this._keyIndices,e)},t.prototype.priority=function(e){var n=this._keyIndices[e];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(e,n){var i=this._keyIndices;if(e=String(e),!r.has(i,e)){var a=this._arr,s=a.length;return i[e]=s,a.push({key:e,priority:n}),this._decrease(s),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},t.prototype.decrease=function(e,n){var i=this._keyIndices[e];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(e){var n=this._arr,i=2*e,a=i+1,s=e;i<n.length&&(s=n[i].priority<n[s].priority?i:s,a<n.length&&(s=n[a].priority<n[s].priority?a:s),s!==e&&(this._swap(e,s),this._heapify(s)))},t.prototype._decrease=function(e){for(var n=this._arr,i=n[e].priority,a;e!==0&&(a=e>>1,!(n[a].priority<i));)this._swap(e,a),e=a},t.prototype._swap=function(e,n){var i=this._arr,a=this._keyIndices,s=i[e],o=i[n];i[e]=o,i[n]=s,a[o.key]=e,a[s.key]=n},kp}var Op,w_;function pN(){if(w_)return Op;w_=1;var r=_r(),t=vN();Op=n;var e=r.constant(1);function n(a,s,o,l){return i(a,String(s),o||e,l||function(u){return a.outEdges(u)})}function i(a,s,o,l){var u={},c=new t,h,d,f=function(v){var p=v.v!==h?v.v:v.w,g=u[p],y=o(v),m=d.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+y);m<g.distance&&(g.distance=m,g.predecessor=h,c.decrease(p,m))};for(a.nodes().forEach(function(v){var p=v===s?0:Number.POSITIVE_INFINITY;u[v]={distance:p},c.add(v,p)});c.size()>0&&(h=c.removeMin(),d=u[h],d.distance!==Number.POSITIVE_INFINITY);)l(h).forEach(f);return u}return Op}var Tp,x_;function G$(){if(x_)return Tp;x_=1;var r=pN(),t=_r();Tp=e;function e(n,i,a){return t.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return Tp}var Ap,E_;function yN(){if(E_)return Ap;E_=1;var r=_r();Ap=t;function t(e){var n=0,i=[],a={},s=[];function o(l){var u=a[l]={onStack:!0,lowlink:n,index:n++};if(i.push(l),e.successors(l).forEach(function(d){r.has(a,d)?a[d].onStack&&(u.lowlink=Math.min(u.lowlink,a[d].index)):(o(d),u.lowlink=Math.min(u.lowlink,a[d].lowlink))}),u.lowlink===u.index){var c=[],h;do h=i.pop(),a[h].onStack=!1,c.push(h);while(l!==h);s.push(c)}}return e.nodes().forEach(function(l){r.has(a,l)||o(l)}),s}return Ap}var Pp,S_;function W$(){if(S_)return Pp;S_=1;var r=_r(),t=yN();Pp=e;function e(n){return r.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return Pp}var Np,__;function V$(){if(__)return Np;__=1;var r=_r();Np=e;var t=r.constant(1);function e(i,a,s){return n(i,a||t,s||function(o){return i.outEdges(o)})}function n(i,a,s){var o={},l=i.nodes();return l.forEach(function(u){o[u]={},o[u][u]={distance:0},l.forEach(function(c){u!==c&&(o[u][c]={distance:Number.POSITIVE_INFINITY})}),s(u).forEach(function(c){var h=c.v===u?c.w:c.v,d=a(c);o[u][h]={distance:d,predecessor:u}})}),l.forEach(function(u){var c=o[u];l.forEach(function(h){var d=o[h];l.forEach(function(f){var v=d[u],p=c[f],g=d[f],y=v.distance+p.distance;y<g.distance&&(g.distance=y,g.predecessor=p.predecessor)})})}),o}return Np}var Cp,M_;function mN(){if(M_)return Cp;M_=1;var r=_r();Cp=t,t.CycleException=e;function t(n){var i={},a={},s=[];function o(l){if(r.has(a,l))throw new e;r.has(i,l)||(a[l]=!0,i[l]=!0,r.each(n.predecessors(l),o),delete a[l],s.push(l))}if(r.each(n.sinks(),o),r.size(i)!==n.nodeCount())throw new e;return s}function e(){}return e.prototype=new Error,Cp}var Rp,k_;function U$(){if(k_)return Rp;k_=1;var r=mN();Rp=t;function t(e){try{r(e)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return Rp}var Lp,O_;function bN(){if(O_)return Lp;O_=1;var r=_r();Lp=t;function t(n,i,a){r.isArray(i)||(i=[i]);var s=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],l={};return r.each(i,function(u){if(!n.hasNode(u))throw new Error("Graph does not have node: "+u);e(n,u,a==="post",l,s,o)}),o}function e(n,i,a,s,o,l){r.has(s,i)||(s[i]=!0,a||l.push(i),r.each(o(i),function(u){e(n,u,a,s,o,l)}),a&&l.push(i))}return Lp}var Ip,T_;function Y$(){if(T_)return Ip;T_=1;var r=bN();Ip=t;function t(e,n){return r(e,n,"post")}return Ip}var Dp,A_;function H$(){if(A_)return Dp;A_=1;var r=bN();Dp=t;function t(e,n){return r(e,n,"pre")}return Dp}var Bp,P_;function X$(){if(P_)return Bp;P_=1;var r=_r(),t=$1(),e=vN();Bp=n;function n(i,a){var s=new t,o={},l=new e,u;function c(d){var f=d.v===u?d.w:d.v,v=l.priority(f);if(v!==void 0){var p=a(d);p<v&&(o[f]=u,l.decrease(f,p))}}if(i.nodeCount()===0)return s;r.each(i.nodes(),function(d){l.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),l.decrease(i.nodes()[0],0);for(var h=!1;l.size()>0;){if(u=l.removeMin(),r.has(o,u))s.setEdge(u,o[u]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(u).forEach(c)}return s}return Bp}var Fp,N_;function K$(){return N_||(N_=1,Fp={components:$$(),dijkstra:pN(),dijkstraAll:G$(),findCycles:W$(),floydWarshall:V$(),isAcyclic:U$(),postorder:Y$(),preorder:H$(),prim:X$(),tarjan:yN(),topsort:mN()}),Fp}var zp,C_;function Z$(){if(C_)return zp;C_=1;var r=j$();return zp={Graph:r.Graph,json:q$(),alg:K$(),version:r.version},zp}var jp,R_;function Br(){if(R_)return jp;R_=1;var r;if(typeof jm=="function")try{r=Z$()}catch{}return r||(r=window.graphlib),jp=r,jp}var qp,L_;function J$(){if(L_)return qp;L_=1;var r=WP(),t=1,e=4;function n(i){return r(i,t|e)}return qp=n,qp}var $p,I_;function oh(){if(I_)return $p;I_=1;var r=Bs(),t=Ai(),e=Jc(),n=Sr();function i(a,s,o){if(!n(o))return!1;var l=typeof s;return(l=="number"?t(o)&&e(s,o.length):l=="string"&&s in o)?r(o[s],a):!1}return $p=i,$p}var Gp,D_;function Q$(){if(D_)return Gp;D_=1;var r=sh(),t=Bs(),e=oh(),n=Xa(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,l){o=Object(o);var u=-1,c=l.length,h=c>2?l[2]:void 0;for(h&&e(l[0],l[1],h)&&(c=1);++u<c;)for(var d=l[u],f=n(d),v=-1,p=f.length;++v<p;){var g=f[v],y=o[g];(y===void 0||t(y,i[g])&&!a.call(o,g))&&(o[g]=d[g])}return o});return Gp=s,Gp}var Wp,B_;function tG(){if(B_)return Wp;B_=1;var r=Pi(),t=Ai(),e=ha();function n(i){return function(a,s,o){var l=Object(a);if(!t(a)){var u=r(s,3);a=e(a),s=function(h){return u(l[h],h,l)}}var c=i(a,s,o);return c>-1?l[u?a[c]:c]:void 0}}return Wp=n,Wp}var Vp,F_;function eG(){if(F_)return Vp;F_=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return Vp=t,Vp}var Up,z_;function nG(){if(z_)return Up;z_=1;var r=eG(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Up=e,Up}var Yp,j_;function rG(){if(j_)return Yp;j_=1;var r=nG(),t=Sr(),e=qs(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(e(u))return n;if(t(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=t(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=r(u);var h=a.test(u);return h||s.test(u)?o(u.slice(2),h?2:8):i.test(u)?n:+u}return Yp=l,Yp}var Hp,q_;function wN(){if(q_)return Hp;q_=1;var r=rG(),t=1/0,e=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===t||i===-1/0){var a=i<0?-1:1;return a*e}return i===i?i:0}return Hp=n,Hp}var Xp,$_;function iG(){if($_)return Xp;$_=1;var r=wN();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return Xp=t,Xp}var Kp,G_;function aG(){if(G_)return Kp;G_=1;var r=dN(),t=Pi(),e=iG(),n=Math.max;function i(a,s,o){var l=a==null?0:a.length;if(!l)return-1;var u=o==null?0:e(o);return u<0&&(u=n(l+u,0)),r(a,t(s,3),u)}return Kp=i,Kp}var Zp,W_;function sG(){if(W_)return Zp;W_=1;var r=tG(),t=aG(),e=r(t);return Zp=e,Zp}var Jp,V_;function xN(){if(V_)return Jp;V_=1;var r=q1();function t(e){var n=e==null?0:e.length;return n?r(e,1):[]}return Jp=t,Jp}var Qp,U_;function oG(){if(U_)return Qp;U_=1;var r=B1(),t=VP(),e=Xa();function n(i,a){return i==null?i:r(i,t(a),e)}return Qp=n,Qp}var t0,Y_;function lG(){if(Y_)return t0;Y_=1;function r(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return t0=r,t0}var e0,H_;function uG(){if(H_)return e0;H_=1;var r=Kc(),t=F1(),e=Pi();function n(i,a){var s={};return a=e(a,3),t(i,function(o,l,u){r(s,l,a(o,l,u))}),s}return e0=n,e0}var n0,X_;function G1(){if(X_)return n0;X_=1;var r=qs();function t(e,n,i){for(var a=-1,s=e.length;++a<s;){var o=e[a],l=n(o);if(l!=null&&(u===void 0?l===l&&!r(l):i(l,u)))var u=l,c=o}return c}return n0=t,n0}var r0,K_;function cG(){if(K_)return r0;K_=1;function r(t,e){return t>e}return r0=r,r0}var i0,Z_;function hG(){if(Z_)return i0;Z_=1;var r=G1(),t=cG(),e=Ka();function n(i){return i&&i.length?r(i,e,t):void 0}return i0=n,i0}var a0,J_;function EN(){if(J_)return a0;J_=1;var r=Kc(),t=Bs();function e(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return a0=e,a0}var s0,Q_;function dG(){if(Q_)return s0;Q_=1;var r=Ya(),t=eh(),e=ui(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,l=s.call(Object);function u(c){if(!e(c)||r(c)!=n)return!1;var h=t(c);if(h===null)return!0;var d=o.call(h,"constructor")&&h.constructor;return typeof d=="function"&&d instanceof d&&s.call(d)==l}return s0=u,s0}var o0,tM;function SN(){if(tM)return o0;tM=1;function r(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return o0=r,o0}var l0,eM;function fG(){if(eM)return l0;eM=1;var r=ol(),t=Xa();function e(n){return r(n,t(n))}return l0=e,l0}var u0,nM;function gG(){if(nM)return u0;nM=1;var r=EN(),t=CP(),e=qP(),n=RP(),i=GP(),a=ll(),s=Qe(),o=fN(),l=zs(),u=sl(),c=Sr(),h=dG(),d=ul(),f=SN(),v=fG();function p(g,y,m,w,E,_,k){var T=f(g,m),O=f(y,m),P=k.get(O);if(P){r(g,m,P);return}var N=_?_(T,O,m+"",g,y,k):void 0,C=N===void 0;if(C){var L=s(O),B=!L&&l(O),G=!L&&!B&&d(O);N=O,L||B||G?s(T)?N=T:o(T)?N=n(T):B?(C=!1,N=t(O,!0)):G?(C=!1,N=e(O,!0)):N=[]:h(O)||a(O)?(N=T,a(T)?N=v(T):(!c(T)||u(T))&&(N=i(O))):C=!1}C&&(k.set(O,N),E(N,O,w,_,k),k.delete(O)),r(g,m,N)}return u0=p,u0}var c0,rM;function vG(){if(rM)return c0;rM=1;var r=Xc(),t=EN(),e=B1(),n=gG(),i=Sr(),a=Xa(),s=SN();function o(l,u,c,h,d){l!==u&&e(u,function(f,v){if(d||(d=new r),i(f))n(l,u,v,c,o,h,d);else{var p=h?h(s(l,v),f,v+"",l,u,d):void 0;p===void 0&&(p=f),t(l,v,p)}},a)}return c0=o,c0}var h0,iM;function pG(){if(iM)return h0;iM=1;var r=sh(),t=oh();function e(n){return r(function(i,a){var s=-1,o=a.length,l=o>1?a[o-1]:void 0,u=o>2?a[2]:void 0;for(l=n.length>3&&typeof l=="function"?(o--,l):void 0,u&&t(a[0],a[1],u)&&(l=o<3?void 0:l,o=1),i=Object(i);++s<o;){var c=a[s];c&&n(i,c,s,l)}return i})}return h0=e,h0}var d0,aM;function yG(){if(aM)return d0;aM=1;var r=vG(),t=pG(),e=t(function(n,i,a){r(n,i,a)});return d0=e,d0}var f0,sM;function _N(){if(sM)return f0;sM=1;function r(t,e){return t<e}return f0=r,f0}var g0,oM;function mG(){if(oM)return g0;oM=1;var r=G1(),t=_N(),e=Ka();function n(i){return i&&i.length?r(i,e,t):void 0}return g0=n,g0}var v0,lM;function bG(){if(lM)return v0;lM=1;var r=G1(),t=Pi(),e=_N();function n(i,a){return i&&i.length?r(i,t(a,2),e):void 0}return v0=n,v0}var p0,uM;function wG(){if(uM)return p0;uM=1;var r=zr(),t=function(){return r.Date.now()};return p0=t,p0}var y0,cM;function xG(){if(cM)return y0;cM=1;var r=Zc(),t=ih(),e=Jc(),n=Sr(),i=cl();function a(s,o,l,u){if(!n(s))return s;o=t(o,s);for(var c=-1,h=o.length,d=h-1,f=s;f!=null&&++c<h;){var v=i(o[c]),p=l;if(v==="__proto__"||v==="constructor"||v==="prototype")return s;if(c!=d){var g=f[v];p=u?u(g,v,f):void 0,p===void 0&&(p=n(g)?g:e(o[c+1])?[]:{})}r(f,v,p),f=f[v]}return s}return y0=a,y0}var m0,hM;function EG(){if(hM)return m0;hM=1;var r=ah(),t=xG(),e=ih();function n(i,a,s){for(var o=-1,l=a.length,u={};++o<l;){var c=a[o],h=r(i,c);s(h,c)&&t(u,e(c,i),h)}return u}return m0=n,m0}var b0,dM;function SG(){if(dM)return b0;dM=1;var r=EG(),t=nN();function e(n,i){return r(n,i,function(a,s){return t(n,s)})}return b0=e,b0}var w0,fM;function _G(){if(fM)return w0;fM=1;var r=xN(),t=cN(),e=hN();function n(i){return e(t(i,void 0,r),i+"")}return w0=n,w0}var x0,gM;function MG(){if(gM)return x0;gM=1;var r=SG(),t=_G(),e=t(function(n,i){return n==null?{}:r(n,i)});return x0=e,x0}var E0,vM;function kG(){if(vM)return E0;vM=1;var r=Math.ceil,t=Math.max;function e(n,i,a,s){for(var o=-1,l=t(r((i-n)/(a||1)),0),u=Array(l);l--;)u[s?l:++o]=n,n+=a;return u}return E0=e,E0}var S0,pM;function OG(){if(pM)return S0;pM=1;var r=kG(),t=oh(),e=wN();function n(i){return function(a,s,o){return o&&typeof o!="number"&&t(a,s,o)&&(s=o=void 0),a=e(a),s===void 0?(s=a,a=0):s=e(s),o=o===void 0?a<s?1:-1:e(o),r(a,s,o,i)}}return S0=n,S0}var _0,yM;function TG(){if(yM)return _0;yM=1;var r=OG(),t=r();return _0=t,_0}var M0,mM;function AG(){if(mM)return M0;mM=1;function r(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}return M0=r,M0}var k0,bM;function PG(){if(bM)return k0;bM=1;var r=qs();function t(e,n){if(e!==n){var i=e!==void 0,a=e===null,s=e===e,o=r(e),l=n!==void 0,u=n===null,c=n===n,h=r(n);if(!u&&!h&&!o&&e>n||o&&l&&c&&!u&&!h||a&&l&&c||!i&&c||!s)return 1;if(!a&&!o&&!h&&e<n||h&&i&&s&&!a&&!o||u&&i&&s||!l&&s||!c)return-1}return 0}return k0=t,k0}var O0,wM;function NG(){if(wM)return O0;wM=1;var r=PG();function t(e,n,i){for(var a=-1,s=e.criteria,o=n.criteria,l=s.length,u=i.length;++a<l;){var c=r(s[a],o[a]);if(c){if(a>=u)return c;var h=i[a];return c*(h=="desc"?-1:1)}}return e.index-n.index}return O0=t,O0}var T0,xM;function CG(){if(xM)return T0;xM=1;var r=rh(),t=ah(),e=Pi(),n=oN(),i=AG(),a=Qc(),s=NG(),o=Ka(),l=Qe();function u(c,h,d){h.length?h=r(h,function(p){return l(p)?function(g){return t(g,p.length===1?p[0]:p)}:p}):h=[o];var f=-1;h=r(h,a(e));var v=n(c,function(p,g,y){var m=r(h,function(w){return w(p)});return{criteria:m,index:++f,value:p}});return i(v,function(p,g){return s(p,g,d)})}return T0=u,T0}var A0,EM;function RG(){if(EM)return A0;EM=1;var r=q1(),t=CG(),e=sh(),n=oh(),i=e(function(a,s){if(a==null)return[];var o=s.length;return o>1&&n(a,s[0],s[1])?s=[]:o>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(a,r(s,1),[])});return A0=i,A0}var P0,SM;function LG(){if(SM)return P0;SM=1;var r=tN(),t=0;function e(n){var i=++t;return r(n)+i}return P0=e,P0}var N0,_M;function IG(){if(_M)return N0;_M=1;function r(t,e,n){for(var i=-1,a=t.length,s=e.length,o={};++i<a;){var l=i<s?e[i]:void 0;n(o,t[i],l)}return o}return N0=r,N0}var C0,MM;function DG(){if(MM)return C0;MM=1;var r=Zc(),t=IG();function e(n,i){return t(n||[],i||[],r)}return C0=e,C0}var R0,kM;function Ce(){if(kM)return R0;kM=1;var r;if(typeof jm=="function")try{r={cloneDeep:J$(),constant:D1(),defaults:Q$(),each:YP(),filter:iN(),find:sG(),flatten:xN(),forEach:UP(),forIn:oG(),has:aN(),isUndefined:sN(),last:lG(),map:lN(),mapValues:uG(),max:hG(),merge:yG(),min:mG(),minBy:bG(),now:wG(),pick:MG(),range:TG(),reduce:uN(),sortBy:RG(),uniqueId:LG(),values:gN(),zipObject:DG()}}catch{}return r||(r=window._),R0=r,R0}var L0,OM;function BG(){if(OM)return L0;OM=1,L0=r;function r(){var n={};n._next=n._prev=n,this._sentinel=n}r.prototype.dequeue=function(){var n=this._sentinel,i=n._prev;if(i!==n)return t(i),i},r.prototype.enqueue=function(n){var i=this._sentinel;n._prev&&n._next&&t(n),n._next=i._next,i._next._prev=n,i._next=n,n._prev=i},r.prototype.toString=function(){for(var n=[],i=this._sentinel,a=i._prev;a!==i;)n.push(JSON.stringify(a,e)),a=a._prev;return"["+n.join(", ")+"]"};function t(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function e(n,i){if(n!=="_next"&&n!=="_prev")return i}return L0}var I0,TM;function FG(){if(TM)return I0;TM=1;var r=Ce(),t=Br().Graph,e=BG();I0=i;var n=r.constant(1);function i(u,c){if(u.nodeCount()<=1)return[];var h=o(u,c||n),d=a(h.graph,h.buckets,h.zeroIdx);return r.flatten(r.map(d,function(f){return u.outEdges(f.v,f.w)}),!0)}function a(u,c,h){for(var d=[],f=c[c.length-1],v=c[0],p;u.nodeCount();){for(;p=v.dequeue();)s(u,c,h,p);for(;p=f.dequeue();)s(u,c,h,p);if(u.nodeCount()){for(var g=c.length-2;g>0;--g)if(p=c[g].dequeue(),p){d=d.concat(s(u,c,h,p,!0));break}}}return d}function s(u,c,h,d,f){var v=f?[]:void 0;return r.forEach(u.inEdges(d.v),function(p){var g=u.edge(p),y=u.node(p.v);f&&v.push({v:p.v,w:p.w}),y.out-=g,l(c,h,y)}),r.forEach(u.outEdges(d.v),function(p){var g=u.edge(p),y=p.w,m=u.node(y);m.in-=g,l(c,h,m)}),u.removeNode(d.v),v}function o(u,c){var h=new t,d=0,f=0;r.forEach(u.nodes(),function(g){h.setNode(g,{v:g,in:0,out:0})}),r.forEach(u.edges(),function(g){var y=h.edge(g.v,g.w)||0,m=c(g),w=y+m;h.setEdge(g.v,g.w,w),f=Math.max(f,h.node(g.v).out+=m),d=Math.max(d,h.node(g.w).in+=m)});var v=r.range(f+d+3).map(function(){return new e}),p=d+1;return r.forEach(h.nodes(),function(g){l(v,p,h.node(g))}),{graph:h,buckets:v,zeroIdx:p}}function l(u,c,h){h.out?h.in?u[h.out-h.in+c].enqueue(h):u[u.length-1].enqueue(h):u[0].enqueue(h)}return I0}var D0,AM;function zG(){if(AM)return D0;AM=1;var r=Ce(),t=FG();D0={run:e,undo:i};function e(a){var s=a.graph().acyclicer==="greedy"?t(a,o(a)):n(a);r.forEach(s,function(l){var u=a.edge(l);a.removeEdge(l),u.forwardName=l.name,u.reversed=!0,a.setEdge(l.w,l.v,u,r.uniqueId("rev"))});function o(l){return function(u){return l.edge(u).weight}}}function n(a){var s=[],o={},l={};function u(c){r.has(l,c)||(l[c]=!0,o[c]=!0,r.forEach(a.outEdges(c),function(h){r.has(o,h.w)?s.push(h):u(h.w)}),delete o[c])}return r.forEach(a.nodes(),u),s}function i(a){r.forEach(a.edges(),function(s){var o=a.edge(s);if(o.reversed){a.removeEdge(s);var l=o.forwardName;delete o.reversed,delete o.forwardName,a.setEdge(s.w,s.v,o,l)}})}return D0}var B0,PM;function Xn(){if(PM)return B0;PM=1;var r=Ce(),t=Br().Graph;B0={addDummyNode:e,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:s,intersectRect:o,buildLayerMatrix:l,normalizeRanks:u,removeEmptyRanks:c,addBorderNode:h,maxRank:d,partition:f,time:v,notime:p};function e(g,y,m,w){var E;do E=r.uniqueId(w);while(g.hasNode(E));return m.dummy=y,g.setNode(E,m),E}function n(g){var y=new t().setGraph(g.graph());return r.forEach(g.nodes(),function(m){y.setNode(m,g.node(m))}),r.forEach(g.edges(),function(m){var w=y.edge(m.v,m.w)||{weight:0,minlen:1},E=g.edge(m);y.setEdge(m.v,m.w,{weight:w.weight+E.weight,minlen:Math.max(w.minlen,E.minlen)})}),y}function i(g){var y=new t({multigraph:g.isMultigraph()}).setGraph(g.graph());return r.forEach(g.nodes(),function(m){g.children(m).length||y.setNode(m,g.node(m))}),r.forEach(g.edges(),function(m){y.setEdge(m,g.edge(m))}),y}function a(g){var y=r.map(g.nodes(),function(m){var w={};return r.forEach(g.outEdges(m),function(E){w[E.w]=(w[E.w]||0)+g.edge(E).weight}),w});return r.zipObject(g.nodes(),y)}function s(g){var y=r.map(g.nodes(),function(m){var w={};return r.forEach(g.inEdges(m),function(E){w[E.v]=(w[E.v]||0)+g.edge(E).weight}),w});return r.zipObject(g.nodes(),y)}function o(g,y){var m=g.x,w=g.y,E=y.x-m,_=y.y-w,k=g.width/2,T=g.height/2;if(!E&&!_)throw new Error("Not possible to find intersection inside of the rectangle");var O,P;return Math.abs(_)*k>Math.abs(E)*T?(_<0&&(T=-T),O=T*E/_,P=T):(E<0&&(k=-k),O=k,P=k*_/E),{x:m+O,y:w+P}}function l(g){var y=r.map(r.range(d(g)+1),function(){return[]});return r.forEach(g.nodes(),function(m){var w=g.node(m),E=w.rank;r.isUndefined(E)||(y[E][w.order]=m)}),y}function u(g){var y=r.min(r.map(g.nodes(),function(m){return g.node(m).rank}));r.forEach(g.nodes(),function(m){var w=g.node(m);r.has(w,"rank")&&(w.rank-=y)})}function c(g){var y=r.min(r.map(g.nodes(),function(_){return g.node(_).rank})),m=[];r.forEach(g.nodes(),function(_){var k=g.node(_).rank-y;m[k]||(m[k]=[]),m[k].push(_)});var w=0,E=g.graph().nodeRankFactor;r.forEach(m,function(_,k){r.isUndefined(_)&&k%E!==0?--w:w&&r.forEach(_,function(T){g.node(T).rank+=w})})}function h(g,y,m,w){var E={width:0,height:0};return arguments.length>=4&&(E.rank=m,E.order=w),e(g,"border",E,y)}function d(g){return r.max(r.map(g.nodes(),function(y){var m=g.node(y).rank;if(!r.isUndefined(m))return m}))}function f(g,y){var m={lhs:[],rhs:[]};return r.forEach(g,function(w){y(w)?m.lhs.push(w):m.rhs.push(w)}),m}function v(g,y){var m=r.now();try{return y()}finally{console.log(g+" time: "+(r.now()-m)+"ms")}}function p(g,y){return y()}return B0}var F0,NM;function jG(){if(NM)return F0;NM=1;var r=Ce(),t=Xn();F0={run:e,undo:i};function e(a){a.graph().dummyChains=[],r.forEach(a.edges(),function(s){n(a,s)})}function n(a,s){var o=s.v,l=a.node(o).rank,u=s.w,c=a.node(u).rank,h=s.name,d=a.edge(s),f=d.labelRank;if(c!==l+1){a.removeEdge(s);var v,p,g;for(g=0,++l;l<c;++g,++l)d.points=[],p={width:0,height:0,edgeLabel:d,edgeObj:s,rank:l},v=t.addDummyNode(a,"edge",p,"_d"),l===f&&(p.width=d.width,p.height=d.height,p.dummy="edge-label",p.labelpos=d.labelpos),a.setEdge(o,v,{weight:d.weight},h),g===0&&a.graph().dummyChains.push(v),o=v;a.setEdge(o,u,{weight:d.weight},h)}}function i(a){r.forEach(a.graph().dummyChains,function(s){var o=a.node(s),l=o.edgeLabel,u;for(a.setEdge(o.edgeObj,l);o.dummy;)u=a.successors(s)[0],a.removeNode(s),l.points.push({x:o.x,y:o.y}),o.dummy==="edge-label"&&(l.x=o.x,l.y=o.y,l.width=o.width,l.height=o.height),s=u,o=a.node(s)})}return F0}var z0,CM;function nc(){if(CM)return z0;CM=1;var r=Ce();z0={longestPath:t,slack:e};function t(n){var i={};function a(s){var o=n.node(s);if(r.has(i,s))return o.rank;i[s]=!0;var l=r.min(r.map(n.outEdges(s),function(u){return a(u.w)-n.edge(u).minlen}));return(l===Number.POSITIVE_INFINITY||l===void 0||l===null)&&(l=0),o.rank=l}r.forEach(n.sources(),a)}function e(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen}return z0}var j0,RM;function MN(){if(RM)return j0;RM=1;var r=Ce(),t=Br().Graph,e=nc().slack;j0=n;function n(o){var l=new t({directed:!1}),u=o.nodes()[0],c=o.nodeCount();l.setNode(u,{});for(var h,d;i(l,o)<c;)h=a(l,o),d=l.hasNode(h.v)?e(o,h):-e(o,h),s(l,o,d);return l}function i(o,l){function u(c){r.forEach(l.nodeEdges(c),function(h){var d=h.v,f=c===d?h.w:d;!o.hasNode(f)&&!e(l,h)&&(o.setNode(f,{}),o.setEdge(c,f,{}),u(f))})}return r.forEach(o.nodes(),u),o.nodeCount()}function a(o,l){return r.minBy(l.edges(),function(u){if(o.hasNode(u.v)!==o.hasNode(u.w))return e(l,u)})}function s(o,l,u){r.forEach(o.nodes(),function(c){l.node(c).rank+=u})}return j0}var q0,LM;function qG(){if(LM)return q0;LM=1;var r=Ce(),t=MN(),e=nc().slack,n=nc().longestPath,i=Br().alg.preorder,a=Br().alg.postorder,s=Xn().simplify;q0=o,o.initLowLimValues=h,o.initCutValues=l,o.calcCutValue=c,o.leaveEdge=f,o.enterEdge=v,o.exchangeEdges=p;function o(w){w=s(w),n(w);var E=t(w);h(E),l(E,w);for(var _,k;_=f(E);)k=v(E,w,_),p(E,w,_,k)}function l(w,E){var _=a(w,w.nodes());_=_.slice(0,_.length-1),r.forEach(_,function(k){u(w,E,k)})}function u(w,E,_){var k=w.node(_),T=k.parent;w.edge(_,T).cutvalue=c(w,E,_)}function c(w,E,_){var k=w.node(_),T=k.parent,O=!0,P=E.edge(_,T),N=0;return P||(O=!1,P=E.edge(T,_)),N=P.weight,r.forEach(E.nodeEdges(_),function(C){var L=C.v===_,B=L?C.w:C.v;if(B!==T){var G=L===O,V=E.edge(C).weight;if(N+=G?V:-V,y(w,_,B)){var U=w.edge(_,B).cutvalue;N+=G?-U:U}}}),N}function h(w,E){arguments.length<2&&(E=w.nodes()[0]),d(w,{},1,E)}function d(w,E,_,k,T){var O=_,P=w.node(k);return E[k]=!0,r.forEach(w.neighbors(k),function(N){r.has(E,N)||(_=d(w,E,_,N,k))}),P.low=O,P.lim=_++,T?P.parent=T:delete P.parent,_}function f(w){return r.find(w.edges(),function(E){return w.edge(E).cutvalue<0})}function v(w,E,_){var k=_.v,T=_.w;E.hasEdge(k,T)||(k=_.w,T=_.v);var O=w.node(k),P=w.node(T),N=O,C=!1;O.lim>P.lim&&(N=P,C=!0);var L=r.filter(E.edges(),function(B){return C===m(w,w.node(B.v),N)&&C!==m(w,w.node(B.w),N)});return r.minBy(L,function(B){return e(E,B)})}function p(w,E,_,k){var T=_.v,O=_.w;w.removeEdge(T,O),w.setEdge(k.v,k.w,{}),h(w),l(w,E),g(w,E)}function g(w,E){var _=r.find(w.nodes(),function(T){return!E.node(T).parent}),k=i(w,_);k=k.slice(1),r.forEach(k,function(T){var O=w.node(T).parent,P=E.edge(T,O),N=!1;P||(P=E.edge(O,T),N=!0),E.node(T).rank=E.node(O).rank+(N?P.minlen:-P.minlen)})}function y(w,E,_){return w.hasEdge(E,_)}function m(w,E,_){return _.low<=E.lim&&E.lim<=_.lim}return q0}var $0,IM;function $G(){if(IM)return $0;IM=1;var r=nc(),t=r.longestPath,e=MN(),n=qG();$0=i;function i(l){switch(l.graph().ranker){case"network-simplex":o(l);break;case"tight-tree":s(l);break;case"longest-path":a(l);break;default:o(l)}}var a=t;function s(l){t(l),e(l)}function o(l){n(l)}return $0}var G0,DM;function GG(){if(DM)return G0;DM=1;var r=Ce();G0=t;function t(i){var a=n(i);r.forEach(i.graph().dummyChains,function(s){for(var o=i.node(s),l=o.edgeObj,u=e(i,a,l.v,l.w),c=u.path,h=u.lca,d=0,f=c[d],v=!0;s!==l.w;){if(o=i.node(s),v){for(;(f=c[d])!==h&&i.node(f).maxRank<o.rank;)d++;f===h&&(v=!1)}if(!v){for(;d<c.length-1&&i.node(f=c[d+1]).minRank<=o.rank;)d++;f=c[d]}i.setParent(s,f),s=i.successors(s)[0]}})}function e(i,a,s,o){var l=[],u=[],c=Math.min(a[s].low,a[o].low),h=Math.max(a[s].lim,a[o].lim),d,f;d=s;do d=i.parent(d),l.push(d);while(d&&(a[d].low>c||h>a[d].lim));for(f=d,d=o;(d=i.parent(d))!==f;)u.push(d);return{path:l.concat(u.reverse()),lca:f}}function n(i){var a={},s=0;function o(l){var u=s;r.forEach(i.children(l),o),a[l]={low:u,lim:s++}}return r.forEach(i.children(),o),a}return G0}var W0,BM;function WG(){if(BM)return W0;BM=1;var r=Ce(),t=Xn();W0={run:e,cleanup:s};function e(o){var l=t.addDummyNode(o,"root",{},"_root"),u=i(o),c=r.max(r.values(u))-1,h=2*c+1;o.graph().nestingRoot=l,r.forEach(o.edges(),function(f){o.edge(f).minlen*=h});var d=a(o)+1;r.forEach(o.children(),function(f){n(o,l,h,d,c,u,f)}),o.graph().nodeRankFactor=h}function n(o,l,u,c,h,d,f){var v=o.children(f);if(!v.length){f!==l&&o.setEdge(l,f,{weight:0,minlen:u});return}var p=t.addBorderNode(o,"_bt"),g=t.addBorderNode(o,"_bb"),y=o.node(f);o.setParent(p,f),y.borderTop=p,o.setParent(g,f),y.borderBottom=g,r.forEach(v,function(m){n(o,l,u,c,h,d,m);var w=o.node(m),E=w.borderTop?w.borderTop:m,_=w.borderBottom?w.borderBottom:m,k=w.borderTop?c:2*c,T=E!==_?1:h-d[f]+1;o.setEdge(p,E,{weight:k,minlen:T,nestingEdge:!0}),o.setEdge(_,g,{weight:k,minlen:T,nestingEdge:!0})}),o.parent(f)||o.setEdge(l,p,{weight:0,minlen:h+d[f]})}function i(o){var l={};function u(c,h){var d=o.children(c);d&&d.length&&r.forEach(d,function(f){u(f,h+1)}),l[c]=h}return r.forEach(o.children(),function(c){u(c,1)}),l}function a(o){return r.reduce(o.edges(),function(l,u){return l+o.edge(u).weight},0)}function s(o){var l=o.graph();o.removeNode(l.nestingRoot),delete l.nestingRoot,r.forEach(o.edges(),function(u){var c=o.edge(u);c.nestingEdge&&o.removeEdge(u)})}return W0}var V0,FM;function VG(){if(FM)return V0;FM=1;var r=Ce(),t=Xn();V0=e;function e(i){function a(s){var o=i.children(s),l=i.node(s);if(o.length&&r.forEach(o,a),r.has(l,"minRank")){l.borderLeft=[],l.borderRight=[];for(var u=l.minRank,c=l.maxRank+1;u<c;++u)n(i,"borderLeft","_bl",s,l,u),n(i,"borderRight","_br",s,l,u)}}r.forEach(i.children(),a)}function n(i,a,s,o,l,u){var c={width:0,height:0,rank:u,borderType:a},h=l[a][u-1],d=t.addDummyNode(i,"border",c,s);l[a][u]=d,i.setParent(d,o),h&&i.setEdge(h,d,{weight:1})}return V0}var U0,zM;function UG(){if(zM)return U0;zM=1;var r=Ce();U0={adjust:t,undo:e};function t(u){var c=u.graph().rankdir.toLowerCase();(c==="lr"||c==="rl")&&n(u)}function e(u){var c=u.graph().rankdir.toLowerCase();(c==="bt"||c==="rl")&&a(u),(c==="lr"||c==="rl")&&(o(u),n(u))}function n(u){r.forEach(u.nodes(),function(c){i(u.node(c))}),r.forEach(u.edges(),function(c){i(u.edge(c))})}function i(u){var c=u.width;u.width=u.height,u.height=c}function a(u){r.forEach(u.nodes(),function(c){s(u.node(c))}),r.forEach(u.edges(),function(c){var h=u.edge(c);r.forEach(h.points,s),r.has(h,"y")&&s(h)})}function s(u){u.y=-u.y}function o(u){r.forEach(u.nodes(),function(c){l(u.node(c))}),r.forEach(u.edges(),function(c){var h=u.edge(c);r.forEach(h.points,l),r.has(h,"x")&&l(h)})}function l(u){var c=u.x;u.x=u.y,u.y=c}return U0}var Y0,jM;function YG(){if(jM)return Y0;jM=1;var r=Ce();Y0=t;function t(e){var n={},i=r.filter(e.nodes(),function(u){return!e.children(u).length}),a=r.max(r.map(i,function(u){return e.node(u).rank})),s=r.map(r.range(a+1),function(){return[]});function o(u){if(!r.has(n,u)){n[u]=!0;var c=e.node(u);s[c.rank].push(u),r.forEach(e.successors(u),o)}}var l=r.sortBy(i,function(u){return e.node(u).rank});return r.forEach(l,o),s}return Y0}var H0,qM;function HG(){if(qM)return H0;qM=1;var r=Ce();H0=t;function t(n,i){for(var a=0,s=1;s<i.length;++s)a+=e(n,i[s-1],i[s]);return a}function e(n,i,a){for(var s=r.zipObject(a,r.map(a,function(d,f){return f})),o=r.flatten(r.map(i,function(d){return r.sortBy(r.map(n.outEdges(d),function(f){return{pos:s[f.w],weight:n.edge(f).weight}}),"pos")}),!0),l=1;l<a.length;)l<<=1;var u=2*l-1;l-=1;var c=r.map(new Array(u),function(){return 0}),h=0;return r.forEach(o.forEach(function(d){var f=d.pos+l;c[f]+=d.weight;for(var v=0;f>0;)f%2&&(v+=c[f+1]),f=f-1>>1,c[f]+=d.weight;h+=d.weight*v})),h}return H0}var X0,$M;function XG(){if($M)return X0;$M=1;var r=Ce();X0=t;function t(e,n){return r.map(n,function(i){var a=e.inEdges(i);if(a.length){var s=r.reduce(a,function(o,l){var u=e.edge(l),c=e.node(l.v);return{sum:o.sum+u.weight*c.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:i,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:i}})}return X0}var K0,GM;function KG(){if(GM)return K0;GM=1;var r=Ce();K0=t;function t(i,a){var s={};r.forEach(i,function(l,u){var c=s[l.v]={indegree:0,in:[],out:[],vs:[l.v],i:u};r.isUndefined(l.barycenter)||(c.barycenter=l.barycenter,c.weight=l.weight)}),r.forEach(a.edges(),function(l){var u=s[l.v],c=s[l.w];!r.isUndefined(u)&&!r.isUndefined(c)&&(c.indegree++,u.out.push(s[l.w]))});var o=r.filter(s,function(l){return!l.indegree});return e(o)}function e(i){var a=[];function s(u){return function(c){c.merged||(r.isUndefined(c.barycenter)||r.isUndefined(u.barycenter)||c.barycenter>=u.barycenter)&&n(u,c)}}function o(u){return function(c){c.in.push(u),--c.indegree===0&&i.push(c)}}for(;i.length;){var l=i.pop();a.push(l),r.forEach(l.in.reverse(),s(l)),r.forEach(l.out,o(l))}return r.map(r.filter(a,function(u){return!u.merged}),function(u){return r.pick(u,["vs","i","barycenter","weight"])})}function n(i,a){var s=0,o=0;i.weight&&(s+=i.barycenter*i.weight,o+=i.weight),a.weight&&(s+=a.barycenter*a.weight,o+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=s/o,i.weight=o,i.i=Math.min(a.i,i.i),a.merged=!0}return K0}var Z0,WM;function ZG(){if(WM)return Z0;WM=1;var r=Ce(),t=Xn();Z0=e;function e(a,s){var o=t.partition(a,function(p){return r.has(p,"barycenter")}),l=o.lhs,u=r.sortBy(o.rhs,function(p){return-p.i}),c=[],h=0,d=0,f=0;l.sort(i(!!s)),f=n(c,u,f),r.forEach(l,function(p){f+=p.vs.length,c.push(p.vs),h+=p.barycenter*p.weight,d+=p.weight,f=n(c,u,f)});var v={vs:r.flatten(c,!0)};return d&&(v.barycenter=h/d,v.weight=d),v}function n(a,s,o){for(var l;s.length&&(l=r.last(s)).i<=o;)s.pop(),a.push(l.vs),o++;return o}function i(a){return function(s,o){return s.barycenter<o.barycenter?-1:s.barycenter>o.barycenter?1:a?o.i-s.i:s.i-o.i}}return Z0}var J0,VM;function JG(){if(VM)return J0;VM=1;var r=Ce(),t=XG(),e=KG(),n=ZG();J0=i;function i(o,l,u,c){var h=o.children(l),d=o.node(l),f=d?d.borderLeft:void 0,v=d?d.borderRight:void 0,p={};f&&(h=r.filter(h,function(_){return _!==f&&_!==v}));var g=t(o,h);r.forEach(g,function(_){if(o.children(_.v).length){var k=i(o,_.v,u,c);p[_.v]=k,r.has(k,"barycenter")&&s(_,k)}});var y=e(g,u);a(y,p);var m=n(y,c);if(f&&(m.vs=r.flatten([f,m.vs,v],!0),o.predecessors(f).length)){var w=o.node(o.predecessors(f)[0]),E=o.node(o.predecessors(v)[0]);r.has(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+w.order+E.order)/(m.weight+2),m.weight+=2}return m}function a(o,l){r.forEach(o,function(u){u.vs=r.flatten(u.vs.map(function(c){return l[c]?l[c].vs:c}),!0)})}function s(o,l){r.isUndefined(o.barycenter)?(o.barycenter=l.barycenter,o.weight=l.weight):(o.barycenter=(o.barycenter*o.weight+l.barycenter*l.weight)/(o.weight+l.weight),o.weight+=l.weight)}return J0}var Q0,UM;function QG(){if(UM)return Q0;UM=1;var r=Ce(),t=Br().Graph;Q0=e;function e(i,a,s){var o=n(i),l=new t({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(u){return i.node(u)});return r.forEach(i.nodes(),function(u){var c=i.node(u),h=i.parent(u);(c.rank===a||c.minRank<=a&&a<=c.maxRank)&&(l.setNode(u),l.setParent(u,h||o),r.forEach(i[s](u),function(d){var f=d.v===u?d.w:d.v,v=l.edge(f,u),p=r.isUndefined(v)?0:v.weight;l.setEdge(f,u,{weight:i.edge(d).weight+p})}),r.has(c,"minRank")&&l.setNode(u,{borderLeft:c.borderLeft[a],borderRight:c.borderRight[a]}))}),l}function n(i){for(var a;i.hasNode(a=r.uniqueId("_root")););return a}return Q0}var ty,YM;function tW(){if(YM)return ty;YM=1;var r=Ce();ty=t;function t(e,n,i){var a={},s;r.forEach(i,function(o){for(var l=e.parent(o),u,c;l;){if(u=e.parent(l),u?(c=a[u],a[u]=l):(c=s,s=l),c&&c!==l){n.setEdge(c,l);return}l=u}})}return ty}var ey,HM;function eW(){if(HM)return ey;HM=1;var r=Ce(),t=YG(),e=HG(),n=JG(),i=QG(),a=tW(),s=Br().Graph,o=Xn();ey=l;function l(d){var f=o.maxRank(d),v=u(d,r.range(1,f+1),"inEdges"),p=u(d,r.range(f-1,-1,-1),"outEdges"),g=t(d);h(d,g);for(var y=Number.POSITIVE_INFINITY,m,w=0,E=0;E<4;++w,++E){c(w%2?v:p,w%4>=2),g=o.buildLayerMatrix(d);var _=e(d,g);_<y&&(E=0,m=r.cloneDeep(g),y=_)}h(d,m)}function u(d,f,v){return r.map(f,function(p){return i(d,p,v)})}function c(d,f){var v=new s;r.forEach(d,function(p){var g=p.graph().root,y=n(p,g,v,f);r.forEach(y.vs,function(m,w){p.node(m).order=w}),a(p,v,y.vs)})}function h(d,f){r.forEach(f,function(v){r.forEach(v,function(p,g){d.node(p).order=g})})}return ey}var ny,XM;function nW(){if(XM)return ny;XM=1;var r=Ce(),t=Br().Graph,e=Xn();ny={positionX:v,findType1Conflicts:n,findType2Conflicts:i,addConflict:s,hasConflict:o,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:d,findSmallestWidthAlignment:h,balance:f};function n(y,m){var w={};function E(_,k){var T=0,O=0,P=_.length,N=r.last(k);return r.forEach(k,function(C,L){var B=a(y,C),G=B?y.node(B).order:P;(B||C===N)&&(r.forEach(k.slice(O,L+1),function(V){r.forEach(y.predecessors(V),function(U){var $=y.node(U),j=$.order;(j<T||G<j)&&!($.dummy&&y.node(V).dummy)&&s(w,U,V)})}),O=L+1,T=G)}),k}return r.reduce(m,E),w}function i(y,m){var w={};function E(k,T,O,P,N){var C;r.forEach(r.range(T,O),function(L){C=k[L],y.node(C).dummy&&r.forEach(y.predecessors(C),function(B){var G=y.node(B);G.dummy&&(G.order<P||G.order>N)&&s(w,B,C)})})}function _(k,T){var O=-1,P,N=0;return r.forEach(T,function(C,L){if(y.node(C).dummy==="border"){var B=y.predecessors(C);B.length&&(P=y.node(B[0]).order,E(T,N,L,O,P),N=L,O=P)}E(T,N,T.length,P,k.length)}),T}return r.reduce(m,_),w}function a(y,m){if(y.node(m).dummy)return r.find(y.predecessors(m),function(w){return y.node(w).dummy})}function s(y,m,w){if(m>w){var E=m;m=w,w=E}var _=y[m];_||(y[m]=_={}),_[w]=!0}function o(y,m,w){if(m>w){var E=m;m=w,w=E}return r.has(y[m],w)}function l(y,m,w,E){var _={},k={},T={};return r.forEach(m,function(O){r.forEach(O,function(P,N){_[P]=P,k[P]=P,T[P]=N})}),r.forEach(m,function(O){var P=-1;r.forEach(O,function(N){var C=E(N);if(C.length){C=r.sortBy(C,function(U){return T[U]});for(var L=(C.length-1)/2,B=Math.floor(L),G=Math.ceil(L);B<=G;++B){var V=C[B];k[N]===N&&P<T[V]&&!o(w,N,V)&&(k[V]=N,k[N]=_[N]=_[V],P=T[V])}}})}),{root:_,align:k}}function u(y,m,w,E,_){var k={},T=c(y,m,w,_),O=_?"borderLeft":"borderRight";function P(L,B){for(var G=T.nodes(),V=G.pop(),U={};V;)U[V]?L(V):(U[V]=!0,G.push(V),G=G.concat(B(V))),V=G.pop()}function N(L){k[L]=T.inEdges(L).reduce(function(B,G){return Math.max(B,k[G.v]+T.edge(G))},0)}function C(L){var B=T.outEdges(L).reduce(function(V,U){return Math.min(V,k[U.w]-T.edge(U))},Number.POSITIVE_INFINITY),G=y.node(L);B!==Number.POSITIVE_INFINITY&&G.borderType!==O&&(k[L]=Math.max(k[L],B))}return P(N,T.predecessors.bind(T)),P(C,T.successors.bind(T)),r.forEach(E,function(L){k[L]=k[w[L]]}),k}function c(y,m,w,E){var _=new t,k=y.graph(),T=p(k.nodesep,k.edgesep,E);return r.forEach(m,function(O){var P;r.forEach(O,function(N){var C=w[N];if(_.setNode(C),P){var L=w[P],B=_.edge(L,C);_.setEdge(L,C,Math.max(T(y,N,P),B||0))}P=N})}),_}function h(y,m){return r.minBy(r.values(m),function(w){var E=Number.NEGATIVE_INFINITY,_=Number.POSITIVE_INFINITY;return r.forIn(w,function(k,T){var O=g(y,T)/2;E=Math.max(k+O,E),_=Math.min(k-O,_)}),E-_})}function d(y,m){var w=r.values(m),E=r.min(w),_=r.max(w);r.forEach(["u","d"],function(k){r.forEach(["l","r"],function(T){var O=k+T,P=y[O],N;if(P!==m){var C=r.values(P);N=T==="l"?E-r.min(C):_-r.max(C),N&&(y[O]=r.mapValues(P,function(L){return L+N}))}})})}function f(y,m){return r.mapValues(y.ul,function(w,E){if(m)return y[m.toLowerCase()][E];var _=r.sortBy(r.map(y,E));return(_[1]+_[2])/2})}function v(y){var m=e.buildLayerMatrix(y),w=r.merge(n(y,m),i(y,m)),E={},_;r.forEach(["u","d"],function(T){_=T==="u"?m:r.values(m).reverse(),r.forEach(["l","r"],function(O){O==="r"&&(_=r.map(_,function(L){return r.values(L).reverse()}));var P=(T==="u"?y.predecessors:y.successors).bind(y),N=l(y,_,w,P),C=u(y,_,N.root,N.align,O==="r");O==="r"&&(C=r.mapValues(C,function(L){return-L})),E[T+O]=C})});var k=h(y,E);return d(E,k),f(E,y.graph().align)}function p(y,m,w){return function(E,_,k){var T=E.node(_),O=E.node(k),P=0,N;if(P+=T.width/2,r.has(T,"labelpos"))switch(T.labelpos.toLowerCase()){case"l":N=-T.width/2;break;case"r":N=T.width/2;break}if(N&&(P+=w?N:-N),N=0,P+=(T.dummy?m:y)/2,P+=(O.dummy?m:y)/2,P+=O.width/2,r.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":N=O.width/2;break;case"r":N=-O.width/2;break}return N&&(P+=w?N:-N),N=0,P}}function g(y,m){return y.node(m).width}return ny}var ry,KM;function rW(){if(KM)return ry;KM=1;var r=Ce(),t=Xn(),e=nW().positionX;ry=n;function n(a){a=t.asNonCompoundGraph(a),i(a),r.forEach(e(a),function(s,o){a.node(o).x=s})}function i(a){var s=t.buildLayerMatrix(a),o=a.graph().ranksep,l=0;r.forEach(s,function(u){var c=r.max(r.map(u,function(h){return a.node(h).height}));r.forEach(u,function(h){a.node(h).y=l+c/2}),l+=c+o})}return ry}var iy,ZM;function iW(){if(ZM)return iy;ZM=1;var r=Ce(),t=zG(),e=jG(),n=$G(),i=Xn().normalizeRanks,a=GG(),s=Xn().removeEmptyRanks,o=WG(),l=VG(),u=UG(),c=eW(),h=rW(),d=Xn(),f=Br().Graph;iy=v;function v(K,W){var tt=W&&W.debugTiming?d.time:d.notime;tt("layout",function(){var ct=tt(" buildLayoutGraph",function(){return P(K)});tt(" runLayout",function(){p(ct,tt)}),tt(" updateInputGraph",function(){g(K,ct)})})}function p(K,W){W(" makeSpaceForEdgeLabels",function(){N(K)}),W(" removeSelfEdges",function(){Z(K)}),W(" acyclic",function(){t.run(K)}),W(" nestingGraph.run",function(){o.run(K)}),W(" rank",function(){n(d.asNonCompoundGraph(K))}),W(" injectEdgeLabelProxies",function(){C(K)}),W(" removeEmptyRanks",function(){s(K)}),W(" nestingGraph.cleanup",function(){o.cleanup(K)}),W(" normalizeRanks",function(){i(K)}),W(" assignRankMinMax",function(){L(K)}),W(" removeEdgeLabelProxies",function(){B(K)}),W(" normalize.run",function(){e.run(K)}),W(" parentDummyChains",function(){a(K)}),W(" addBorderSegments",function(){l(K)}),W(" order",function(){c(K)}),W(" insertSelfEdges",function(){nt(K)}),W(" adjustCoordinateSystem",function(){u.adjust(K)}),W(" position",function(){h(K)}),W(" positionSelfEdges",function(){st(K)}),W(" removeBorderNodes",function(){j(K)}),W(" normalize.undo",function(){e.undo(K)}),W(" fixupEdgeLabelCoords",function(){U(K)}),W(" undoCoordinateSystem",function(){u.undo(K)}),W(" translateGraph",function(){G(K)}),W(" assignNodeIntersects",function(){V(K)}),W(" reversePoints",function(){$(K)}),W(" acyclic.undo",function(){t.undo(K)})}function g(K,W){r.forEach(K.nodes(),function(tt){var ct=K.node(tt),Et=W.node(tt);ct&&(ct.x=Et.x,ct.y=Et.y,W.children(tt).length&&(ct.width=Et.width,ct.height=Et.height))}),r.forEach(K.edges(),function(tt){var ct=K.edge(tt),Et=W.edge(tt);ct.points=Et.points,r.has(Et,"x")&&(ct.x=Et.x,ct.y=Et.y)}),K.graph().width=W.graph().width,K.graph().height=W.graph().height}var y=["nodesep","edgesep","ranksep","marginx","marginy"],m={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],E=["width","height"],_={width:0,height:0},k=["minlen","weight","width","height","labeloffset"],T={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},O=["labelpos"];function P(K){var W=new f({multigraph:!0,compound:!0}),tt=Pt(K.graph());return W.setGraph(r.merge({},m,ot(tt,y),r.pick(tt,w))),r.forEach(K.nodes(),function(ct){var Et=Pt(K.node(ct));W.setNode(ct,r.defaults(ot(Et,E),_)),W.setParent(ct,K.parent(ct))}),r.forEach(K.edges(),function(ct){var Et=Pt(K.edge(ct));W.setEdge(ct,r.merge({},T,ot(Et,k),r.pick(Et,O)))}),W}function N(K){var W=K.graph();W.ranksep/=2,r.forEach(K.edges(),function(tt){var ct=K.edge(tt);ct.minlen*=2,ct.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?ct.width+=ct.labeloffset:ct.height+=ct.labeloffset)})}function C(K){r.forEach(K.edges(),function(W){var tt=K.edge(W);if(tt.width&&tt.height){var ct=K.node(W.v),Et=K.node(W.w),Nt={rank:(Et.rank-ct.rank)/2+ct.rank,e:W};d.addDummyNode(K,"edge-proxy",Nt,"_ep")}})}function L(K){var W=0;r.forEach(K.nodes(),function(tt){var ct=K.node(tt);ct.borderTop&&(ct.minRank=K.node(ct.borderTop).rank,ct.maxRank=K.node(ct.borderBottom).rank,W=r.max(W,ct.maxRank))}),K.graph().maxRank=W}function B(K){r.forEach(K.nodes(),function(W){var tt=K.node(W);tt.dummy==="edge-proxy"&&(K.edge(tt.e).labelRank=tt.rank,K.removeNode(W))})}function G(K){var W=Number.POSITIVE_INFINITY,tt=0,ct=Number.POSITIVE_INFINITY,Et=0,Nt=K.graph(),Vt=Nt.marginx||0,ke=Nt.marginy||0;function un(Oe){var Ue=Oe.x,Xt=Oe.y,cr=Oe.width,Jt=Oe.height;W=Math.min(W,Ue-cr/2),tt=Math.max(tt,Ue+cr/2),ct=Math.min(ct,Xt-Jt/2),Et=Math.max(Et,Xt+Jt/2)}r.forEach(K.nodes(),function(Oe){un(K.node(Oe))}),r.forEach(K.edges(),function(Oe){var Ue=K.edge(Oe);r.has(Ue,"x")&&un(Ue)}),W-=Vt,ct-=ke,r.forEach(K.nodes(),function(Oe){var Ue=K.node(Oe);Ue.x-=W,Ue.y-=ct}),r.forEach(K.edges(),function(Oe){var Ue=K.edge(Oe);r.forEach(Ue.points,function(Xt){Xt.x-=W,Xt.y-=ct}),r.has(Ue,"x")&&(Ue.x-=W),r.has(Ue,"y")&&(Ue.y-=ct)}),Nt.width=tt-W+Vt,Nt.height=Et-ct+ke}function V(K){r.forEach(K.edges(),function(W){var tt=K.edge(W),ct=K.node(W.v),Et=K.node(W.w),Nt,Vt;tt.points?(Nt=tt.points[0],Vt=tt.points[tt.points.length-1]):(tt.points=[],Nt=Et,Vt=ct),tt.points.unshift(d.intersectRect(ct,Nt)),tt.points.push(d.intersectRect(Et,Vt))})}function U(K){r.forEach(K.edges(),function(W){var tt=K.edge(W);if(r.has(tt,"x"))switch((tt.labelpos==="l"||tt.labelpos==="r")&&(tt.width-=tt.labeloffset),tt.labelpos){case"l":tt.x-=tt.width/2+tt.labeloffset;break;case"r":tt.x+=tt.width/2+tt.labeloffset;break}})}function $(K){r.forEach(K.edges(),function(W){var tt=K.edge(W);tt.reversed&&tt.points.reverse()})}function j(K){r.forEach(K.nodes(),function(W){if(K.children(W).length){var tt=K.node(W),ct=K.node(tt.borderTop),Et=K.node(tt.borderBottom),Nt=K.node(r.last(tt.borderLeft)),Vt=K.node(r.last(tt.borderRight));tt.width=Math.abs(Vt.x-Nt.x),tt.height=Math.abs(Et.y-ct.y),tt.x=Nt.x+tt.width/2,tt.y=ct.y+tt.height/2}}),r.forEach(K.nodes(),function(W){K.node(W).dummy==="border"&&K.removeNode(W)})}function Z(K){r.forEach(K.edges(),function(W){if(W.v===W.w){var tt=K.node(W.v);tt.selfEdges||(tt.selfEdges=[]),tt.selfEdges.push({e:W,label:K.edge(W)}),K.removeEdge(W)}})}function nt(K){var W=d.buildLayerMatrix(K);r.forEach(W,function(tt){var ct=0;r.forEach(tt,function(Et,Nt){var Vt=K.node(Et);Vt.order=Nt+ct,r.forEach(Vt.selfEdges,function(ke){d.addDummyNode(K,"selfedge",{width:ke.label.width,height:ke.label.height,rank:Vt.rank,order:Nt+ ++ct,e:ke.e,label:ke.label},"_se")}),delete Vt.selfEdges})})}function st(K){r.forEach(K.nodes(),function(W){var tt=K.node(W);if(tt.dummy==="selfedge"){var ct=K.node(tt.e.v),Et=ct.x+ct.width/2,Nt=ct.y,Vt=tt.x-Et,ke=ct.height/2;K.setEdge(tt.e,tt.label),K.removeNode(W),tt.label.points=[{x:Et+2*Vt/3,y:Nt-ke},{x:Et+5*Vt/6,y:Nt-ke},{x:Et+Vt,y:Nt},{x:Et+5*Vt/6,y:Nt+ke},{x:Et+2*Vt/3,y:Nt+ke}],tt.label.x=tt.x,tt.label.y=tt.y}})}function ot(K,W){return r.mapValues(r.pick(K,W),Number)}function Pt(K){var W={};return r.forEach(K,function(tt,ct){W[ct.toLowerCase()]=tt}),W}return iy}var ay,JM;function aW(){if(JM)return ay;JM=1;var r=Ce(),t=Xn(),e=Br().Graph;ay={debugOrdering:n};function n(i){var a=t.buildLayerMatrix(i),s=new e({compound:!0,multigraph:!0}).setGraph({});return r.forEach(i.nodes(),function(o){s.setNode(o,{label:o}),s.setParent(o,"layer"+i.node(o).rank)}),r.forEach(i.edges(),function(o){s.setEdge(o.v,o.w,{},o.name)}),r.forEach(a,function(o,l){var u="layer"+l;s.setNode(u,{rank:"same"}),r.reduce(o,function(c,h){return s.setEdge(c,h,{style:"invis"}),h})}),s}return ay}var sy,QM;function sW(){return QM||(QM=1,sy="0.8.5"),sy}var oy,tk;function oW(){return tk||(tk=1,oy={graphlib:Br(),layout:iW(),debug:aW(),util:{time:Xn().time,notime:Xn().notime},version:sW()}),oy}var kN=oW();const lW=Go(kN);class lh{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,lh.defaultOptions,t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new kN.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:u})=>St(u))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(u=>{const{id:c}=u,h=Object.assign({},u.data);if(i!==void 0){const[d,f]=al(Ot(i)?i(u):i);Object.assign(h,{width:d,height:f})}a.setNode(c.toString(),h)}),e.getAllEdges().forEach(({id:u,source:c,target:h})=>{a.setEdge(c.toString(),h.toString(),{id:u})}),lW.layout(a);const l={nodes:[],edges:[]};return a.nodes().forEach(u=>{const c=a.node(u);l.nodes.push({id:u,data:c}),t&&e.mergeNodeData(u,c)}),a.edges().forEach(u=>{const c=a.edge(u),{id:h}=c,d=je(c,["id"]),{v:f,w:v}=u;l.edges.push({id:h,source:f,target:v,data:d}),t&&e.mergeEdgeData(h,d)}),l})}}lh.defaultOptions={};class W1{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let i=Math.hypot(e,n);i=i<1e-4?1e-4:i;const a=this.g*(this.degree+1)*(t.degree+1)/i;this.fx+=a*e/i,this.fy+=a*n/i}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,i=(this.ry*this.mass+t.ry*t.mass)/e,a=this.degree+t.degree,s={rx:n,ry:i,mass:e,degree:a};return new W1(s)}}class vs{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new vs(i)}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new vs(i)}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new vs(i)}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new vs(i)}}class ps{constructor(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)}insert(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new ps(this.quad.NW()),this.NE=new ps(this.quad.NE()),this.SW=new ps(this.quad.SW()),this.SE=new ps(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))}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{const 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))}}}const uW={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class cW{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},uW),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=e.getAllEdges(),a=e.getAllNodes(),s=this.formatOptions(n,a.length),{width:o,height:l,prune:u,maxIteration:c,nodeSize:h,center:d}=s;if(!(a!=null&&a.length)||a.length===1)return Ua(e,t,d);const f=a.map(y=>ir(y,[o,l])),v=i.filter(y=>{const{source:m,target:w}=y;return m!==w}),p=new ln({nodes:f,edges:v}),g=this.getSizes(p,h);if(this.run(p,e,c,g,t,s),u){for(let m=0;m<v.length;m+=1){const{source:w,target:E}=v[m],_=p.getDegree(w),k=p.getDegree(w);if(_<=1){const T=p.getNode(E);p.mergeNodeData(w,{x:T.data.x,y:T.data.y})}else if(k<=1){const T=p.getNode(w);p.mergeNodeData(E,{x:T.data.x,y:T.data.y})}}const y=Object.assign(Object.assign({},s),{prune:!1,barnesHut:!1});this.run(p,e,100,g,t,y)}return{nodes:f,edges:i}})}getSizes(t,e){const n=t.getAllNodes(),i={};for(let a=0;a<n.length;a+=1){const s=n[a];i[s.id]=_1(e,void 0)(s)}return i}formatOptions(t={},e){const n=Object.assign(Object.assign({},this.options),t),{center:i,width:a,height:s,barnesHut:o,prune:l,maxIteration:u,kr:c,kg:h}=n;return n.width=!a&&typeof window<"u"?window.innerWidth:a,n.height=!s&&typeof window<"u"?window.innerHeight:s,n.center=i||[n.width/2,n.height/2],o===void 0&&e>250&&(n.barnesHut=!0),l===void 0&&e>100&&(n.prune=!0),u===0&&!l?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):u===0&&l&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),h||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,i,a,s){const{kr:o,barnesHut:l,onTick:u}=s,c=t.getAllNodes();let h=0,d=n;const f={},v={},p={};for(let g=0;g<c.length;g+=1){const{data:y,id:m}=c[g];if(f[m]=[0,0],l){const w={id:g,rx:y.x,ry:y.y,mass:1,g:o,degree:t.getDegree(m)};p[m]=new W1(w)}}for(;d>0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:f,preForces:v,bodies:p,sizes:i},s),d--,u==null||u({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:l,bodies:u,sizes:c}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:f}=n,v=t.getAllNodes();for(let p=0;p<v.length;p+=1){const{id:g}=v[p];l[g]=[...h[g]],h[g]=[0,0]}return h=this.getAttrForces(t,i,a,c,h,n),f&&(d&&i>a||!d)?h=this.getOptRepGraForces(t,h,u,n):h=this.getRepGraForces(t,i,a,h,s,c,n),this.updatePos(t,h,l,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:l,mode:u,prune:c}=s,h=t.getAllEdges();for(let d=0;d<h.length;d+=1){const{source:f,target:v}=h[d],p=t.getNode(f),g=t.getNode(v),y=t.getDegree(f),m=t.getDegree(v);if(c&&(y<=1||m<=1))continue;const w=[g.data.x-p.data.x,g.data.y-p.data.y];let E=Math.hypot(w[0],w[1]);E=E<1e-4?1e-4:E,w[0]=w[0]/E,w[1]=w[1]/E,o&&e<n&&(E=E-i[f]-i[v]);let _=E,k=_;u==="linlog"&&(_=Math.log(1+E),k=_),l&&(_=E/y,k=E/m),o&&e<n&&E<=0?(_=0,k=0):o&&e<n&&E>0&&(_=E,k=E),a[f][0]+=_*w[0],a[v][0]-=k*w[0],a[f][1]+=_*w[1],a[v][1]-=k*w[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,l=t.getAllNodes(),u=l.length;let c=9e10,h=-9e10,d=9e10,f=-9e10;for(let m=0;m<u;m+=1){const{id:w,data:E}=l[m];o&&t.getDegree(w)<=1||(n[w].setPos(E.x,E.y),E.x>=h&&(h=E.x),E.x<=c&&(c=E.x),E.y>=f&&(f=E.y),E.y<=d&&(d=E.y))}const v=Math.max(h-c,f-d),p={xmid:(h+c)/2,ymid:(f+d)/2,length:v,massCenter:s,mass:u},g=new vs(p),y=new ps(g);for(let m=0;m<u;m+=1){const{id:w}=l[m];o&&t.getDegree(w)<=1||n[w].in(g)&&y.insert(n[w])}for(let m=0;m<u;m+=1){const{id:w,data:E}=l[m],_=t.getDegree(w);if(o&&_<=1)continue;n[w].resetForce(),y.updateForce(n[w]),e[w][0]-=n[w].fx,e[w][1]-=n[w].fy;const k=[E.x-s[0],E.y-s[1]];let T=Math.hypot(k[0],k[1]);T=T<1e-4?1e-4:T,k[0]=k[0]/T,k[1]=k[1]/T;const O=a*(_+1);e[w][0]-=O*k[0],e[w][1]-=O*k[1]}return e}getRepGraForces(t,e,n,i,a,s,o){const{preventOverlap:l,kr:u,kg:c,center:h,prune:d}=o,f=t.getAllNodes(),v=f.length;for(let p=0;p<v;p+=1){const g=f[p],y=t.getDegree(g.id);for(let _=p+1;_<v;_+=1){const k=f[_],T=t.getDegree(k.id);if(d&&(y<=1||T<=1))continue;const O=[k.data.x-g.data.x,k.data.y-g.data.y];let P=Math.hypot(O[0],O[1]);P=P<1e-4?1e-4:P,O[0]=O[0]/P,O[1]=O[1]/P,l&&e<n&&(P=P-s[g.id]-s[k.id]);let N=u*(y+1)*(T+1)/P;l&&e<n&&P<0?N=a*(y+1)*(T+1):l&&e<n&&P===0?N=0:l&&e<n&&P>0&&(N=u*(y+1)*(T+1)/P),i[g.id][0]-=N*O[0],i[k.id][0]+=N*O[0],i[g.id][1]-=N*O[1],i[k.id][1]+=N*O[1]}const m=[g.data.x-h[0],g.data.y-h[1]],w=Math.hypot(m[0],m[1]);m[0]=m[0]/w,m[1]=m[1]/w;const E=c*(y+1);i[g.id][0]-=E*m[0],i[g.id][1]-=E*m[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:l,ksmax:u}=a,c=t.getAllNodes(),h=c.length,d=[],f=[];let v=0,p=0,g=i;for(let m=0;m<h;m+=1){const{id:w}=c[m],E=t.getDegree(w);if(l&&E<=1)continue;const _=[e[w][0]-n[w][0],e[w][1]-n[w][1]],k=Math.hypot(_[0],_[1]),T=[e[w][0]+n[w][0],e[w][1]+n[w][1]],O=Math.hypot(T[0],T[1]);d[m]=k,f[m]=O/2,v+=(E+1)*d[m],p+=(E+1)*f[m]}const y=g;g=o*p/v,y!==0&&(g=g>1.5*y?1.5*y:g);for(let m=0;m<h;m+=1){const{id:w,data:E}=c[m],_=t.getDegree(w);if(l&&_<=1||St(E.fx)&&St(E.fy))continue;let k=s*g/(1+g*Math.sqrt(d[m])),T=Math.hypot(e[w][0],e[w][1]);T=T<1e-4?1e-4:T;const O=u/T;k=k>O?O:k;const P=k*e[w][0],N=k*e[w][1];t.mergeNodeData(w,{x:E.x+P,y:E.y+N})}return g}}const hW={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},dW=800;class fW{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},hW),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;n<t;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericFruchtermanLayout(t,e,n){return Ut(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:l,clustering:u,nodeClusterBy:c,maxIteration:h,onTick:d}=i,f=e.getAllNodes(),v=e.getAllEdges();if(!(f!=null&&f.length)){const w={nodes:[],edges:v};return this.lastResult=w,w}if(f.length===1){t&&e.mergeNodeData(f[0].id,{x:l[0],y:l[1],z:a===3?l[2]:void 0});const w={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:l[0],y:l[1],z:a===3?l[2]:void 0})})],edges:v};return this.lastResult=w,w}const p=f.map(w=>ir(w,[s,o])),g=new ln({nodes:p,edges:v}),y={};if(u&&p.forEach(w=>{const E=w.data[c];y[E]||(y[E]={name:E,cx:0,cy:0,count:0})}),this.lastLayoutNodes=p,this.lastLayoutEdges=v,this.lastAssign=t,this.lastGraph=g,this.lastOptions=i,this.lastClusterMap=y,typeof window>"u")return;let m=0;return new Promise(w=>{this.timeInterval=window.setInterval(()=>{if(!this.running){w({nodes:p,edges:v});return}this.runOneStep(g,y,i),t&&p.forEach(({id:E,data:_})=>e.mergeNodeData(E,{x:_.x,y:_.y,z:a===3?_.z:void 0})),d==null||d({nodes:p,edges:v}),m++,m>=h&&(window.clearInterval(this.timeInterval),w({nodes:p,edges:v}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:i}=e,{center:a,width:s,height:o}=e;return e.width=!s&&typeof window<"u"?window.innerWidth:s,e.height=!o&&typeof window<"u"?window.innerHeight:o,e.center=a||[e.width/2,e.height/2],e.clustering=n&&!!i,e}runOneStep(t,e,n){const{dimensions:i,height:a,width:s,gravity:o,center:l,speed:u,clustering:c,nodeClusterBy:h,clusterGravity:d}=n,f=a*s,v=Math.sqrt(f)/10,p=t.getAllNodes(),g=f/(p.length+1),y=Math.sqrt(g),m={};if(this.applyCalculate(t,m,y,g),c){for(const E in e)e[E].cx=0,e[E].cy=0,e[E].count=0;p.forEach(E=>{const{data:_}=E,k=e[_[h]];St(_.x)&&(k.cx+=_.x),St(_.y)&&(k.cy+=_.y),k.count++});for(const E in e)e[E].cx/=e[E].count,e[E].cy/=e[E].count;const w=d||o;p.forEach((E,_)=>{const{id:k,data:T}=E;if(!St(T.x)||!St(T.y))return;const O=e[T[h]],P=Math.sqrt((T.x-O.cx)*(T.x-O.cx)+(T.y-O.cy)*(T.y-O.cy)),N=y*w;m[k].x-=N*(T.x-O.cx)/P,m[k].y-=N*(T.y-O.cy)/P})}p.forEach((w,E)=>{const{id:_,data:k}=w;if(!St(k.x)||!St(k.y))return;const T=.01*y*o;m[_].x-=T*(k.x-l[0]),m[_].y-=T*(k.y-l[1]),i===3&&(m[_].z-=T*(k.z-l[2]))}),p.forEach((w,E)=>{const{id:_,data:k}=w;if(St(k.fx)&&St(k.fy)){k.x=k.fx,k.y=k.fy,i===3&&(k.z=k.fz);return}if(!St(k.x)||!St(k.y))return;const T=Math.sqrt(m[_].x*m[_].x+m[_].y*m[_].y+(i===3?m[_].z*m[_].z:0));if(T>0){const O=Math.min(v*(u/dW),T);t.mergeNodeData(_,{x:k.x+m[_].x/T*O,y:k.y+m[_].y/T*O,z:i===3?k.z+m[_].z/T*O:void 0})}})}applyCalculate(t,e,n,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const i=t.getAllNodes();i.forEach(({data:a,id:s},o)=>{e[s]={x:0,y:0,z:0},i.forEach(({data:l,id:u},c)=>{if(o<=c||!St(a.x)||!St(l.x)||!St(a.y)||!St(l.y))return;let h=a.x-l.x,d=a.y-l.y,f=this.options.dimensions===3?a.z-l.z:0,v=h*h+d*d+f*f;v===0&&(v=1,h=.01,d=.01,f=.01);const p=n/v,g=h*p,y=d*p,m=f*p;e[s].x+=g,e[s].y+=y,e[u].x-=g,e[u].y-=y,this.options.dimensions===3&&(e[s].z+=m,e[u].z-=m)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:l}=t.getNode(s),{data:u}=t.getNode(o);if(!St(u.x)||!St(l.x)||!St(u.y)||!St(l.y))return;const c=u.x-l.x,h=u.y-l.y,d=this.options.dimensions===3?u.z-l.z:0,f=Math.sqrt(c*c+h*h+d*d)/n,v=c*f,p=h*f,g=d*f;e[s].x+=v,e[s].y+=p,e[o].x-=v,e[o].y-=p,this.options.dimensions===3&&(e[s].z+=g,e[o].z-=g)})}}const gW={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class vW{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},gW),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:l,rows:u,cols:c,nodeSpacing:h,nodeSize:d,width:f,height:v,position:p}=i;let{sortBy:g}=i;const y=e.getAllNodes(),m=e.getAllEdges(),w=y==null?void 0:y.length;if(!w||w===1)return Ua(e,t,a);const E=y.map(V=>ir(V));g!=="id"&&(!ee(g)||E[0].data[g]===void 0)&&(g="degree"),g==="degree"?E.sort((V,U)=>e.getDegree(U.id,"both")-e.getDegree(V.id,"both")):g==="id"?E.sort((V,U)=>St(U.id)&&St(V.id)?U.id-V.id:`${V.id}`.localeCompare(`${U.id}`)):E.sort((V,U)=>U.data[g]-V.data[g]);const _=!f&&typeof window<"u"?window.innerWidth:f,k=!v&&typeof window<"u"?window.innerHeight:v,T=w,O={rows:u,cols:c};if(u!=null&&c!=null)O.rows=u,O.cols=c;else if(u!=null&&c==null)O.rows=u,O.cols=Math.ceil(T/O.rows);else if(u==null&&c!=null)O.cols=c,O.rows=Math.ceil(T/O.cols);else{const V=Math.sqrt(T*k/_);O.rows=Math.round(V),O.cols=Math.round(_/k*V)}if(O.rows=Math.max(O.rows,1),O.cols=Math.max(O.cols,1),O.cols*O.rows>T){const V=au(O),U=su(O);(V-1)*U>=T?au(O,V-1):(U-1)*V>=T&&su(O,U-1)}else for(;O.cols*O.rows<T;){const V=au(O),U=su(O);(U+1)*V>=T?su(O,U+1):au(O,V+1)}let P=s?0:_/O.cols,N=s?0:k/O.rows;if(l||h){const V=Pa(10,h),U=S1(30,d,!1);E.forEach($=>{(!$.data.x||!$.data.y)&&($.data.x=0,$.data.y=0);const j=e.getNode($.id),[Z,nt]=al(U(j)||30),st=V!==void 0?V($):o,ot=Z+st,Pt=nt+st;P=Math.max(P,ot),N=Math.max(N,Pt)})}const C={},L={row:0,col:0},B={};for(let V=0;V<E.length;V++){const U=E[V];let $;if(p&&($=p(e.getNode(U.id))),$&&($.row!==void 0||$.col!==void 0)){const j={row:$.row,col:$.col};if(j.col===void 0)for(j.col=0;Mm(C,j);)j.col++;else if(j.row===void 0)for(j.row=0;Mm(C,j);)j.row++;B[U.id]=j,ON(C,j)}pW(U,a,P,N,B,O,L,C)}const G={nodes:E,edges:m};return t&&E.forEach(V=>{e.mergeNodeData(V.id,{x:V.data.x,y:V.data.y})}),G})}}const au=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.min(n,i):Math.min(n,i)===r.rows?r.rows=t:r.cols=t,e},su=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.max(n,i):Math.max(n,i)===r.rows?r.rows=t:r.cols=t,e},Mm=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,ON=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,ek=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},pW=(r,t,e,n,i,a,s,o)=>{let l,u;const c=i[r.id];if(c)l=c.col*e+e/2+t[0],u=c.row*n+n/2+t[1];else{for(;Mm(o,s);)ek(a,s);l=s.col*e+e/2+t[0],u=s.row*n+n/2+t[1],ON(o,s),ek(a,s)}r.data.x=l,r.data.y=u},yW=(r,t,e)=>{try{const n=Ui.mul(Ui.pow(t,2),-.5),i=n.mean("row"),a=n.mean("column"),s=n.mean();n.add(s).subRowVector(i).subColumnVector(a);const o=new wP(n),l=Ui.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(u=>Ui.mul([u],[l]).toJSON()[0].splice(0,r))}catch{const i=[];for(let a=0;a<t.length;a++){const s=Math.random()*e,o=Math.random()*e;i.push([s,o])}return i}},mW=800,bW={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},wW=(r,t)=>{const e=Object.assign(Object.assign({},bW),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:l,focusIdx:u,radii:c=[],nodeSizeFunc:h}=e,d=r.getAllNodes(),f=[],v=a/10;for(let p=0;p<i;p++)n.forEach((g,y)=>{f[y]={x:0,y:0}}),xW(d,n,f,s,c,h),EW(n,f,o,l,u,v,a,c);return n},xW=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((l,u)=>{if(o===u||i[o]!==i[u])return;let c=s.x-l.x,h=s.y-l.y,d=Math.sqrt(c*c+h*h);if(d===0){d=1;const f=o>u?1:-1;c=.01*f,h=.01*f}if(d<a(r[o])/2+a(r[u])/2){const f=n*n/d;e[o].x+=c/d*f,e[o].y+=h/d*f}})})},EW=(r,t,e,n,i,a,s,o)=>{const l=a||s/10;return n&&t.forEach((u,c)=>{const h=r[c].x-r[i].x,d=r[c].y-r[i].y,f=Math.sqrt(h*h+d*d);let v=d/f,p=-h/f;const g=Math.sqrt(u.x*u.x+u.y*u.y);let y=Math.acos((v*u.x+p*u.y)/g);y>Math.PI/2&&(y-=Math.PI/2,v*=-1,p*=-1);const m=Math.cos(y)*g;u.x=v*m,u.y=p*m}),r.forEach((u,c)=>{if(c===i)return;const h=Math.sqrt(t[c].x*t[c].x+t[c].y*t[c].y);if(h>0&&c!==i){const d=Math.min(l*(e/mW),h);if(u.x+=t[c].x/h*d,u.y+=t[c].y/h*d,n){let f=u.x-r[i].x,v=u.y-r[i].y;const p=Math.sqrt(f*f+v*v);f=f/p*o[c],v=v/p*o[c],u.x=r[i].x+f,u.y=r[i].y+v}}}),r},SW={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class _W{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},SW),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:l,unitRadius:u,nodeSize:c,nodeSpacing:h,strictRadial:d,preventOverlap:f,maxPreventOverlapIteration:v,sortBy:p,linkDistance:g=50,sortStrength:y=10,maxIteration:m=1e3}=i,w=e.getAllNodes(),E=e.getAllEdges(),_=!a&&typeof window<"u"?window.innerWidth:a,k=!s&&typeof window<"u"?window.innerHeight:s,T=o||[_/2,k/2];if(!(w!=null&&w.length)||w.length===1)return Ua(e,t,T);let O=w[0];if(ee(l)){for(let ct=0;ct<w.length;ct++)if(w[ct].id===l){O=w[ct];break}}else O=l||w[0];const P=OW(w,O.id),N=vP({nodes:w,edges:E}),C=gP(N),L=AW(C,P);TW(C,P,L+1);const B=C[P];let G=_-T[0]>T[0]?T[0]:_-T[0],V=k-T[1]>T[1]?T[1]:k-T[1];G===0&&(G=_/2),V===0&&(V=k/2);const U=Math.min(G,V),$=Math.max(...B),j=[],Z=u||U/$;B.forEach((ct,Et)=>{j[Et]=ct*Z});const nt=MW(w,C,g,j,Z,p,y),st=kW(nt),ot=yW(g,nt,g);let Pt=ot.map(([ct,Et])=>({x:(isNaN(ct)?Math.random()*g:ct)-ot[P][0],y:(isNaN(Et)?Math.random()*g:Et)-ot[P][1]}));this.run(m,Pt,st,nt,j,P);let K;if(f){K=_1(c,h);const ct={nodes:w,nodeSizeFunc:K,positions:Pt,radii:j,height:k,width:_,strictRadial:!!d,focusIdx:P,iterations:v||200,k:Pt.length/4.5};Pt=wW(e,ct)}const W=[];return Pt.forEach((ct,Et)=>{const Nt=ir(w[Et]);Nt.data.x=ct.x+T[0],Nt.data.y=ct.y+T[1],W.push(Nt)}),t&&W.forEach(ct=>e.mergeNodeData(ct.id,{x:ct.data.x,y:ct.data.y})),{nodes:W,edges:E}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const l=o/t;this.oneIteration(l,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((l,u)=>{const c=xx(l,{x:0,y:0}),h=c===0?0:1/c;if(u===s)return;let d=0,f=0,v=0;e.forEach((g,y)=>{if(u===y)return;const m=xx(l,g),w=m===0?0:1/m,E=i[y][u];v+=a[u][y],d+=a[u][y]*(g.x+E*(l.x-g.x)*w),f+=a[u][y]*(g.y+E*(l.y-g.y)*w)});const p=n[u]===0?0:1/n[u];v*=o,v+=t*p*p,d*=o,d+=t*p*l.x*h,l.x=d/v,f*=o,f+=t*p*l.y*h,l.y=f/v})}}const MW=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const l={};t.forEach((u,c)=>{const h=[];u.forEach((d,f)=>{var v,p;if(c===f)h.push(0);else if(n[c]===n[f])if(a==="data")h.push(d*(Math.abs(c-f)*s)/(n[c]/i));else if(a){let g,y;if(l[r[c].id])g=l[r[c].id];else{const m=(a==="id"?r[c].id:(v=r[c].data)===null||v===void 0?void 0:v[a])||0;ee(m)?g=m.charCodeAt(0):g=m,l[r[c].id]=g}if(l[r[f].id])y=l[r[f].id];else{const m=(a==="id"?r[f].id:(p=r[f].data)===null||p===void 0?void 0:p[a])||0;ee(m)?y=m.charCodeAt(0):y=m,l[r[f].id]=y}h.push(d*(Math.abs(g-y)*s)/(n[c]/i))}else h.push(d*e/(n[c]/i));else{const g=(e+i)/2;h.push(d*g)}}),o.push(h)})}return o},kW=r=>{const t=r.length,e=r[0].length,n=[];for(let i=0;i<t;i++){const a=[];for(let s=0;s<e;s++)r[i][s]!==0?a.push(1/(r[i][s]*r[i][s])):a.push(0);n.push(a)}return n},OW=(r,t)=>{let e=-1;return r.forEach((n,i)=>{n.id===t&&(e=i)}),Math.max(e,0)},TW=(r,t,e)=>{const n=r.length;for(let i=0;i<n;i++)if(r[t][i]===1/0){r[t][i]=e,r[i][t]=e;for(let a=0;a<n;a++)r[i][a]!==1/0&&r[t][a]===1/0&&(r[t][a]=e+r[i][a],r[a][t]=e+r[i][a])}for(let i=0;i<n;i++)if(i!==t){for(let a=0;a<n;a++)if(r[i][a]===1/0){let s=Math.abs(r[t][i]-r[t][a]);s=s===0?1:s,r[i][a]=s}}},AW=(r,t)=>{let e=0;for(let n=0;n<r[t].length;n++)r[t][n]!==1/0&&(e=r[t][n]>e?r[t][n]:e);return e},PW={center:[0,0],width:300,height:300};class NW{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},PW),t)}execute(t,e){return Ut(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return Ut(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return Ut(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,l=e.getAllNodes(),u=.9,c=!s&&typeof window<"u"?window.innerWidth:s,h=!o&&typeof window<"u"?window.innerHeight:o,d=a||[c/2,h/2],f=[];return l&&l.forEach(p=>{f.push({id:p.id,data:{x:(Math.random()-.5)*u*c+d[0],y:(Math.random()-.5)*u*h+d[1]}})}),t&&f.forEach(p=>e.mergeNodeData(p.id,{x:p.data.x,y:p.data.y})),{nodes:f,edges:e.getAllEdges()}})}}const TN=Symbol("Comlink.proxy"),CW=Symbol("Comlink.endpoint"),AN=Symbol("Comlink.releaseProxy"),ly=Symbol("Comlink.finalizer"),Su=Symbol("Comlink.thrown"),PN=r=>typeof r=="object"&&r!==null||typeof r=="function",RW={canHandle:r=>PN(r)&&r[TN],serialize(r){const{port1:t,port2:e}=new MessageChannel;return CN(r,t),[e,[e]]},deserialize(r){return r.start(),LN(r)}},LW={canHandle:r=>PN(r)&&Su in r,serialize({value:r}){let t;return r instanceof Error?t={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:t={isError:!1,value:r},[t,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},NN=new Map([["proxy",RW],["throw",LW]]);function IW(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function CN(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!IW(e,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(xa);let u;try{const c=o.slice(0,-1).reduce((d,f)=>d[f],r),h=o.reduce((d,f)=>d[f],r);switch(s){case"GET":u=h;break;case"SET":c[o.slice(-1)[0]]=xa(i.data.value),u=!0;break;case"APPLY":u=h.apply(c,l);break;case"CONSTRUCT":{const d=new h(...l);u=qW(d)}break;case"ENDPOINT":{const{port1:d,port2:f}=new MessageChannel;CN(r,f),u=jW(d,[d])}break;case"RELEASE":u=void 0;break;default:return}}catch(c){u={value:c,[Su]:0}}Promise.resolve(u).catch(c=>({value:c,[Su]:0})).then(c=>{const[h,d]=ac(c);t.postMessage(Object.assign(Object.assign({},h),{id:a}),d),s==="RELEASE"&&(t.removeEventListener("message",n),RN(t),ly in r&&typeof r[ly]=="function"&&r[ly]())}).catch(c=>{const[h,d]=ac({value:new TypeError("Unserializable return value"),[Su]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),d)})}),t.start&&t.start()}function DW(r){return r.constructor.name==="MessagePort"}function RN(r){DW(r)&&r.close()}function LN(r,t){const e=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=e.get(a.id);if(s)try{s(a)}finally{e.delete(a.id)}}),km(r,e,[],t)}function ou(r){if(r)throw new Error("Proxy has been released and is not useable")}function IN(r){return ds(r,new Map,{type:"RELEASE"}).then(()=>{RN(r)})}const rc=new WeakMap,ic="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(rc.get(r)||0)-1;rc.set(r,t),t===0&&IN(r)});function BW(r,t){const e=(rc.get(t)||0)+1;rc.set(t,e),ic&&ic.register(r,t,r)}function FW(r){ic&&ic.unregister(r)}function km(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(ou(i),o===AN)return()=>{FW(a),IN(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const l=ds(r,t,{type:"GET",path:e.map(u=>u.toString())}).then(xa);return l.then.bind(l)}return km(r,t,[...e,o])},set(s,o,l){ou(i);const[u,c]=ac(l);return ds(r,t,{type:"SET",path:[...e,o].map(h=>h.toString()),value:u},c).then(xa)},apply(s,o,l){ou(i);const u=e[e.length-1];if(u===CW)return ds(r,t,{type:"ENDPOINT"}).then(xa);if(u==="bind")return km(r,t,e.slice(0,-1));const[c,h]=nk(l);return ds(r,t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:c},h).then(xa)},construct(s,o){ou(i);const[l,u]=nk(o);return ds(r,t,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:l},u).then(xa)}});return BW(a,r),a}function zW(r){return Array.prototype.concat.apply([],r)}function nk(r){const t=r.map(ac);return[t.map(e=>e[0]),zW(t.map(e=>e[1]))]}const DN=new WeakMap;function jW(r,t){return DN.set(r,t),r}function qW(r){return Object.assign(r,{[TN]:!0})}function ac(r){for(const[t,e]of NN)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},DN.get(r)||[]]}function xa(r){switch(r.type){case"HANDLER":return NN.get(r.name).deserialize(r.value);case"RAW":return r.value}}function ds(r,t,e,n){return new Promise(i=>{const a=$W();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function $W(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class GW extends Rc{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=LN(new Worker(new URL("/assets/worker-lNTWuAmw.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return Ut(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,i=je(e,["onTick"]),a={};Object.keys(i).forEach(u=>{Ot(i[u])||(a[u]=i[u])});const s={layout:{id:this.layout.id,options:a,iterations:(t=this.options)===null||t===void 0?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[l]=yield this.proxy.calculateLayout(s,[o]);return l})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[AN]()}isRunning(){return this.running}}var WW=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class uh extends Lc{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Kr(t)||t.length>2))return t[0]}formatSize(t){const e=typeof t=="function"?t:()=>t;return n=>sr(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:l}=this.context,u=this.formatSize(s);let c=u(t)[0]+i(t);const h=(w,E=0)=>{var _;return E+=n*((w.children||[]).length+1),(_=w.children)===null||_===void 0||_.forEach(k=>{var T;(T=l.getNodeLikeDatum(k).children)===null||T===void 0||T.forEach(P=>{const N=l.getNodeLikeDatum(P);E=h(N,E)})}),E},d=w=>{if(w.depth===1)return c;const E=l.getParentData(w.id,"tree");if(as(w)){const _=l.getParentData(E.id,"tree"),k=p(w)-p(_);return d(E)+k*n/a}else{const _=(E.children||[]).indexOf(w.id),k=l.getNodeData((E.children||[]).slice(_));return f(E)-k.reduce((T,O)=>T+h(O),0)-u(E)[0]/2}},f=By(w=>{if(uy(w))return u(w)[0]/2;const E=l.getParentData(w.id,"tree");if(as(w))return d(w)+h(w)+u(w)[0]/2;{const _=p(w)-p(E),k=n/a;return d(w)+_*k}},w=>w.id),v=w=>p(l.getParentData(w,"tree")),p=By(w=>{if(uy(w))return o/2;if(as(w)){const E=l.getParentData(w.id,"tree"),_=E.children.indexOf(w.id);if(_===0)return v(E.id)+a;const k=l.getNodeLikeDatum(E.children[_-1]);if(Kr(k.children))return p(k)+a;const T=l.getDescendantsData(k.id);return Math.max(...T.map(O=>as(O)?v(O.id):p(O)))+a}else{if(Kr(w.children))return v(w.id)+a;const E=l.getNodeLikeDatum(w.children.slice(-1)[0]);if(Kr(E.children))return p(E)+a;const _=l.getDescendantsData(w.id).slice(-1)[0];return(as(_)?v(_.id):p(_))+a}},w=>w.id);let g=0;const y={nodes:[],edges:[]},m=w=>{var E;(E=w.children)===null||E===void 0||E.forEach(P=>m(l.getNodeLikeDatum(P)));const _=p(w),k=f(w);if(y.nodes.push({id:w.id,x:k,y:_}),uy(w))return;const T=l.getRelatedEdgesData(w.id,"in")[0],O=[d(w),as(w)?_:v(w.id)];y.edges.push({id:J(T),controlPoints:[O],relatedNodeId:w.id}),g=Math.max(g,k+i(w)),w.depth===1&&(c=g)};return m(t),y}placeAlterative(t,e){const n=(e.children||[]).filter((o,l)=>l%2!==0);if(n.length===0)return t;const{model:i}=this.context,a=t.nodes.find(o=>o.id===e.id).y,s=o=>{const l=i.getAncestorsData(o,"tree");if(Kr(l))return!1;const u=l.length===1?o:l[l.length-2].id;return n.includes(u)};t.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),t.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(l=>[l[0],2*a-l[1]]))})}rightToLeft(t,e){return t.nodes.forEach(n=>n.x=e.width-n.x),t.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[e.width-i[0],i[1]])}),t}execute(t,e){return WW(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},uh.defaultOptions),this.options),e),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return t;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(d=>o(d)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(d=>o(d)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:u}=this.context,c=[],h=[];return l.nodes.forEach(d=>{const{id:f,x:v,y:p}=d,g=u.getNodeLikeDatum(f);c.push(rk(g,{x:v,y:p}))}),l.edges.forEach(d=>{const{id:f,controlPoints:v}=d,p=u.getEdgeDatum(f);h.push(rk(p,{controlPoints:v}))}),{nodes:c,edges:h}})}}uh.defaultOptions={direction:"RL",getRibSep:()=>60};const rk=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),uy=r=>r.depth===0,as=r=>(r.depth||(r.depth=0))%2===0;var VW=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class ch extends Lc{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=sr(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,i={},a={},s={};e.forEach(d=>{i[d.id]=0,a[d.id]=0,s[d.id]=[]}),n.forEach(d=>{i[d.target]++,a[d.source]++,s[d.source].push(d.target)});const o=new Set,l=d=>{o.has(d)||(o.add(d),s[d].forEach(l))};if(l(e[0].id),o.size!==e.length)return!1;const u=e.filter(d=>i[d.id]===0),c=e.filter(d=>a[d.id]===0);return!(u.length!==1||c.length!==1||e.filter(d=>i[d.id]===1&&a[d.id]===1).length!==e.length-2)}execute(t,e){return VW(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:u,clockwise:c,width:h,height:d}=Object.assign({},ch.defaultOptions,this.options,e),[f,v,p,g]=si(a),y=this.formatSize(t.nodes||[],i),m=Math.ceil((t.nodes||[]).length/o);let w=l||(h-g-v-o*y[0])/(o-1),E=u||(d-f-p-m*y[1])/(m-1);return(E===1/0||E<0)&&(E=0),(w===1/0||w<0)&&(w=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):UW(t))||[]).map((T,O)=>{const P=Math.floor(O/o),N=O%o,C=c?P%2===0?N:o-1-N:P%2===0?o-1-N:N,L=g+C*(y[0]+w)+y[0]/2,B=f+P*(y[1]+E)+y[1]/2;return{id:T.id,style:{x:L,y:B}}})}})}}ch.defaultOptions={padding:0,cols:5,clockwise:!0};function UW(r){const{nodes:t=[],edges:e=[]}=r,n={},i={};t.forEach(o=>{n[o.id]=0,i[o.id]=[]}),e.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(t.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),l=t.find(u=>u.id===o);s.push(l),i[o].forEach(u=>{n[u]--,n[u]===0&&a.push(u)})}return s}const YW=["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],HW=["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],XW=["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],KW=["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],ZW=["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"];class _n extends l1{}function $s(r,t=!0,e){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),t&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),e&&Object.assign(n.style,e),n}function Om(r,t="div",e={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(t);return s.innerHTML=n,s.id=r,Object.assign(s.style,e),i.appendChild(s),s}var JW=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class hh extends _n{constructor(t,e){super(t,Object.assign({},hh.defaultOptions,e)),this.$element=$s("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return JW(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Wm(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}hh.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function V1(r,t,e,n,i,a){const s=r,o=t,l=e-s,u=n-o;let c=i-s,h=a-o,d=c*l+h*u,f=0;d<=0?f=0:(c=l-c,h=u-h,d=c*l+h*u,d<=0?f=0:f=d*d/(l*l+u*u));const v=c*c+h*h-f;return v<0?0:v}function Hi(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function ik(r,t,e,n,i){return Hi(r,t,e,n)<i*i}function QW(r){if(!Number.isFinite(r))return e=>e;if(r===0)return Math.round;const t=Math.pow(10,r);return e=>Math.round(e*t)/t}function BN(r){const t=Math.min(r.x1,r.x2),e=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:t,y:n,x2:e,y2:i,width:e-t,height:i-n}}class dn{constructor(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new dn(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2||e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2||t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;const n=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return t<=n}distSquare(t,e){return V1(this.x1,this.y1,this.x2,this.y2,t,e)}ptClose(t,e,n){if(this.x1<this.x2){if(t<this.x1-n||t>this.x2+n)return!1}else if(t<this.x2-n||t>this.x1+n)return!1;if(this.y1<this.y2){if(e<this.y1-n||e>this.y2+n)return!1}else if(e<this.y2-n||e>this.y1+n)return!1;return!0}}var Fe;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Fe||(Fe={}));class cy{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function lu(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new cy(Fe.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new cy(Fe.NONE)}return new cy(e===0||n===0?Fe.COINCIDENT:Fe.PARALLEL)}function FN(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function t7(r,t){function e(i,a,s,o){let l=FN(t,new dn(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=1?1:0}let n=e(r.x,r.y,r.x2,r.y);return n+=e(r.x,r.y,r.x,r.y2),n>1||(n+=e(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=e(r.x2,r.y,r.x2,r.y2),n>0)}var ze;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(ze||(ze={}));function _u(r,t,e){const n=new Set;return r.width<=0?(n.add(ze.LEFT),n.add(ze.RIGHT)):t<r.x?n.add(ze.LEFT):t>r.x+r.width&&n.add(ze.RIGHT),r.height<=0?(n.add(ze.TOP),n.add(ze.BOTTOM)):e<r.y?n.add(ze.TOP):e>r.y+r.height&&n.add(ze.BOTTOM),n}function zN(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(_u(r,i,a));if(s.length===0)return!0;let o=_u(r,e,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(ze.RIGHT)||o.has(ze.LEFT)){let l=r.x;o.has(ze.RIGHT)&&(l+=r.width),n=n+(l-e)*(a-n)/(i-e),e=l}else{let l=r.y;o.has(ze.BOTTOM)&&(l+=r.height),e=e+(l-n)*(i-e)/(a-n),n=l}o=_u(r,e,n)}return!0}function e7(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let u=FN(t,new dn(a,s,o,l));u=Math.abs(u-.5),u>=0&&u<=1&&(n++,u<e&&(e=u))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?e:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:e)}function n7(r,t){let e=0;const n=lu(r,new dn(t.x,t.y,t.x2,t.y));e+=n.state===Fe.POINT?1:0;const i=lu(r,new dn(t.x,t.y,t.x,t.y2));e+=i.state===Fe.POINT?1:0;const a=lu(r,new dn(t.x,t.y2,t.x2,t.y2));e+=a.state===Fe.POINT?1:0;const s=lu(r,new dn(t.x2,t.y,t.x2,t.y2));return e+=s.state===Fe.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class On{constructor(t,e,n,i){this.x=t,this.y=e,this.width=n,this.height=i}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new On(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new On(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x+t.width),a=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=i-e,this.height=a-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x),a=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=i-e,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return this.area<=0||t.width<=0||t.height<=0?!1:t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=_u(this,t,e);return n.has(ze.TOP)?n.has(ze.LEFT)?Hi(t,e,this.x,this.y):n.has(ze.RIGHT)?Hi(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(ze.BOTTOM)?n.has(ze.LEFT)?Hi(t,e,this.x,this.y2):n.has(ze.RIGHT)?Hi(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(ze.LEFT)?(this.x-t)*(this.x-t):n.has(ze.RIGHT)?(t-this.x2)*(t-this.x2):0}}function r7(r){if(r.length===0)return null;const t=r[0],e=new On(t.x,t.y,0,0);for(const n of r)e.addPoint(n);return e}class sc{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(t){return new sc(t.cx,t.cy,t.radius)}containsPt(t,e){return Hi(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=Hi(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const i=Math.sqrt(n)-this.radius;return i*i}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class Na{constructor(t,e=0,n=0,i=0,a=0,s=10,o=10,l=new Float32Array(Math.max(0,s*o)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=i,this.pixelY=a,this.width=s,this.height=o,this.area=l}createSub(t,e){return new Na(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new Na(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new Na(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),i=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup)),s=i-e,o=a-n;return new On(e,n,s,o)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),i=this.boundX(t.x-n),a=this.boundY(t.y-n),s=this.boundX(t.x2+n),o=this.boundY(t.y2+n),l=s-i,u=o-a;return new On(i,a,l,u)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||e===0)return;const n=this.width,i=t.width,a=Math.max(0,t.i),s=Math.max(0,t.j),o=Math.min(t.i+t.width,n),l=Math.min(t.j+t.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let u=s;u<l;u++){const c=(u-t.j)*i,h=u*n;for(let d=a;d<o;d++){const f=t.area[d-t.i+c];f!==0&&(this.area[d+h]+=e*f)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let i=0;i<t.height;i++){const a=n+i*this.width;this.area.fill(e,a,a+t.width)}}fillHorizontalLine(t,e,n,i){const a=t+e*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(t,e,n,i){const a=t+e*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];t+=a.toFixed(1).padStart(6),t+=" "}t+=`
14
- `}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce((s,o)=>Math.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);t.scale(this.pixelGroup,this.pixelGroup);for(let s=0;s<this.width;s++)for(let o=0;o<this.height;o++){const l=this.area[s+o*this.width];t.fillStyle=`rgba(0, 0, 0, ${a(l)})`,t.fillRect(s,o,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let i=0;i<this.width;i++)for(let a=0;a<this.height;a++){const s=this.area[i+a*this.width];t.fillStyle=s>e?"black":"white",t.fillRect(i,a,1,1)}t.restore()}}}function jN(r,t){const e=n=>({x:n.x-t,y:n.y-t,width:n.width+2*t,height:n.height+2*t});return Array.isArray(r)?r.map(e):e(r)}function ak(r,t,e){return qN(Object.assign(BN(r),{distSquare:(n,i)=>V1(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function qN(r,t,e){const n=jN(r,e),i=t.scale(n),a=t.createSub(i,n);return i7(a,t,e,(s,o)=>r.distSquare(s,o)),a}function i7(r,t,e,n){const i=e*e;for(let a=0;a<r.height;a++)for(let s=0;s<r.width;s++){const o=t.invertScaleX(r.i+s),l=t.invertScaleY(r.j+a),u=n(o,l);if(u===0){r.set(s,a,i);continue}if(u<i){const c=e-Math.sqrt(u);r.set(s,a,c*c)}}return r}function a7(r,t,e){const n=t.scale(r),i=t.addPadding(n,e),a=t.createSub(i,{x:r.x-e,y:r.y-e}),s=n.x-i.x,o=n.y-i.y,l=i.x2-n.x2,u=i.y2-n.y2,c=i.width-s-l,h=i.height-o-u,d=e*e;a.fillArea({x:s,y:o,width:c+1,height:h+1},d);const f=[0],v=Math.max(o,s,l,u);{const m=t.invertScaleX(n.x+n.width/2);for(let w=1;w<v;w++){const E=t.invertScaleY(n.y-w),_=r.distSquare(m,E);if(_<d){const k=e-Math.sqrt(_);f.push(k*k)}else break}}const p=[],g=Math.max(s,l),y=Math.max(o,l);for(let m=1;m<g;m++){const w=t.invertScaleX(n.x-m),E=[];for(let _=1;_<y;_++){const k=t.invertScaleY(n.y-_),T=r.distSquare(w,k);if(T<d){const O=e-Math.sqrt(T);E.push(O*O)}else E.push(0)}p.push(E)}for(let m=1;m<Math.min(o,f.length);m++){const w=f[m];a.fillHorizontalLine(s,o-m,c+1,w)}for(let m=1;m<Math.min(u,f.length);m++){const w=f[m];a.fillHorizontalLine(s,o+h+m,c+1,w)}for(let m=1;m<Math.min(s,f.length);m++){const w=f[m];a.fillVerticalLine(s-m,o,h+1,w)}for(let m=1;m<Math.min(u,f.length);m++){const w=f[m];a.fillVerticalLine(s+c+m,o,h+1,w)}for(let m=1;m<s;m++){const w=p[m-1],E=s-m;for(let _=1;_<o;_++)a.set(E,o-_,w[_-1]);for(let _=1;_<u;_++)a.set(E,o+h+_,w[_-1])}for(let m=1;m<l;m++){const w=p[m-1],E=s+c+m;for(let _=1;_<o;_++)a.set(E,o-_,w[_-1]);for(let _=1;_<u;_++)a.set(E,o+h+_,w[_-1])}return a}function Ee(r,t){return{x:r,y:t}}function s7(r,t,e,n){if(r.length===0)return[];const i=h7(r);return i.map((a,s)=>{const o=i.slice(0,s);return o7(t,a,o,e,n)}).flat()}function o7(r,t,e,n,i){const a=Ee(t.cx,t.cy),s=c7(a,e,r);if(s==null)return[];const o=new dn(a.x,a.y,s.cx,s.cy),l=l7(o,r,n,i);return u7(l,r)}function l7(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o<e&&s;o++)for(s=!1;!s&&a.length>0;){const l=a.pop(),u=$N(t,l),c=u?n7(l,u):null;if(!u||!c||c.count!==2){s||i.push(l);continue}let h=n,d=cu(u,h,c,!0),f=Ri(d,a)||Ri(d,i),v=uu(d,t);for(;!f&&v&&h>=1;)h/=1.5,d=cu(u,h,c,!0),f=Ri(d,a)||Ri(d,i),v=uu(d,t);if(d&&!f&&!v&&(a.push(new dn(l.x1,l.y1,d.x,d.y)),a.push(new dn(d.x,d.y,l.x2,l.y2)),s=!0),s)continue;h=n,d=cu(u,h,c,!1);let p=Ri(d,a)||Ri(d,i);for(v=uu(d,t);!p&&v&&h>=1;)h/=1.5,d=cu(u,h,c,!1),p=Ri(d,a)||Ri(d,i),v=uu(d,t);d&&!p&&(a.push(new dn(l.x1,l.y1,d.x,d.y)),a.push(new dn(d.x,d.y,l.x2,l.y2)),s=!0),s||i.push(l)}for(;a.length>0;)i.push(a.pop());return i}function u7(r,t){const e=[];for(;r.length>0;){const n=r.pop();if(r.length===0){e.push(n);break}const i=r.pop(),a=new dn(n.x1,n.y1,i.x2,i.y2);$N(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function c7(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=Hi(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new dn(r.x,r.y,a.cx,a.cy),l=d7(e,o);return s*(l+1)*(l+1)<n&&(i=a,n=s*(l+1)*(l+1)),i},null)}function h7(r){if(r.length<2)return r;let t=0,e=0;return r.forEach(n=>{t+=n.cx,e+=n.cy}),t/=r.length,e/=r.length,r.map(n=>{const i=t-n.cx,a=e-n.cy,s=i*i+a*a;return[n,s]}).sort((n,i)=>n[1]-i[1]).map(n=>n[0])}function uu(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function Ri(r,t){return t.some(e=>!!(ik(e.x1,e.y1,r.x,r.y,.001)||ik(e.x2,e.y2,r.x,r.y,.001)))}function $N(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!zN(i,t))continue;const a=e7(i,t);a>=0&&a<e&&(n=i,e=a)}return n}function d7(r,t){return r.reduce((e,n)=>zN(n,t)&&t7(n,t)?e+1:e,0)}function cu(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===Fe.POINT){if(i.state===Fe.POINT)return Ee(r.x-t,r.y-t);if(s.state===Fe.POINT)return Ee(r.x-t,r.y2+t);const d=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)<d*.5?a.y>o.y?Ee(r.x-t,r.y-t):Ee(r.x2+t,r.y-t):a.y<o.y?Ee(r.x-t,r.y2+t):Ee(r.x2+t,r.y2+t)}if(o.state===Fe.POINT){if(i.state===Fe.POINT)return Ee(r.x2+t,r.y-t);if(s.state===Fe.POINT)return Ee(r.x2+t,r.y2+t)}const c=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<c*.5?i.x>s.x?Ee(r.x-t,r.y-t):Ee(r.x-t,r.y2+t):i.x<s.x?Ee(r.x2+t,r.y-t):Ee(r.x2+t,r.y2+t)}if(a.state===Fe.POINT){if(i.state===Fe.POINT)return Ee(r.x2+t,r.y2+t);if(s.state===Fe.POINT)return Ee(r.x2+t,r.y-t);const c=r.height*r.width;return r.width*((a.y-r.y+(o.y-r.y))*.5)<c*.5?a.y>o.y?Ee(r.x2+t,r.y2+t):Ee(r.x-t,r.y2+t):a.y<o.y?Ee(r.x2+t,r.y-t):Ee(r.x-t,r.y-t)}if(o.state===Fe.POINT){if(i.state===Fe.POINT)return Ee(r.x-t,r.y2+t);if(s.state===Fe.POINT)return Ee(r.x-t,r.y-t)}const l=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<l*.5?i.x>s.x?Ee(r.x2+t,r.y2+t):Ee(r.x2+t,r.y-t):i.x<s.x?Ee(r.x-t,r.y2+t):Ee(r.x-t,r.y-t)}function f7(r,t,e,n){if(!(r.closed?e<r.length:e<r.length-1))return!1;const a=r.get(t),s=r.get(e+1);for(let o=t+1;o<=e;o++){const l=r.get(o);if(V1(a.x,a.y,s.x,s.y,l.x,l.y)>n)return!1}return!0}function g7(r=0){return t=>{if(r<0||t.length<3)return t;const e=[];let n=0;const i=r*r;for(;n<t.length;){let a=n+1;for(;f7(t,n,a,i);)a++;e.push(t.get(n)),n=a}return new Gs(e)}}function v7(r,t){switch(r){case-2:return(((-t+3)*t-3)*t+1)/6;case-1:return((3*t-6)*t*t+4)/6;case 0:return(((-3*t+3)*t+3)*t+1)/6;case 1:return t*t*t/6;default:throw new Error("unknown error")}}function p7(r=6){function a(s,o,l){let u=0,c=0;for(let h=-2;h<=1;h++){const d=s.get(o+h),f=v7(h,l);u+=f*d.x,c+=f*d.y}return{x:u,y:c}}return s=>{if(s.length<3)return s;const o=[],l=s.closed,u=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let c=2-(l?0:2);c<u;c++)for(let h=1;h<=r;h++)o.push(a(s,c,h/r));return new Gs(o)}}function y7(r=8){return t=>{let e=r,n=t.length;if(e>1)for(n=Math.floor(t.length/e);n<3&&e>1;)e-=1,n=Math.floor(t.length/e);const i=[];for(let a=0,s=0;s<n;s++,a+=e)i.push(t.get(a));return new Gs(i)}}class Gs{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(e.length===0)return"";const n=typeof t=="function"?t:QW(t);let i="M";for(const a of e)i+=`${n(a.x)},${n(a.y)} L`;return i=i.slice(0,-1),this.closed&&(i+=" Z"),i}draw(t){const e=this.points;if(e.length!==0){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return y7(t)(this)}simplify(t){return g7(t)(this)}bSplines(t){return p7(t)(this)}apply(t){return t(this)}containsElements(t){const e=r7(this.points);return e?t.every(n=>e.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(t,e){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new dn(i.x,i.y,i.x,i.y);for(let s=1;s<this.points.length;s++){const o=this.points[s];a.x1=a.x2,a.y1=a.y2,a.x2=o.x,a.y2=o.y,a.cuts(t,e)&&n++}return a.x1=a.x2,a.y1=a.y2,a.x2=i.x,a.y2=i.y,a.cuts(t,e)&&n++,n%2===1}}class m7{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(this.count===0)return!1;const e=this.arr[0];return e!=null&&e.x===t.x&&e.y===t.y}path(){return new Gs(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}const to=0,hu=1,du=2,hy=3;function b7(r,t){const e=(Math.floor(r.width)+Math.floor(r.height))*2,n=new m7(e);function i(l,u,c,h){const d=r.get(l,u);return Number.isNaN(d)?Number.NaN:d>t?c+h:c}function a(l,u){let c=to;return c=i(l,u,c,1),c=i(l+1,u,c,2),c=i(l,u+1,c,4),c=i(l+1,u+1,c,8),Number.isNaN(c)?-1:c}let s=hu;function o(l,u){let c=l,h=u,d=r.invertScaleX(c),f=r.invertScaleY(h);for(let v=0;v<r.width*r.height;v++){const p={x:d,y:f};if(n.contains(p)){if(n.isFirst(p))return!0}else n.add(p);const g=a(c,h);switch(g){case-1:return!0;case 0:case 3:case 2:case 7:s=du;break;case 12:case 14:case 4:s=hy;break;case 6:s=s===to?hy:du;break;case 1:case 13:case 5:s=to;break;case 9:s=s===du?to:hu;break;case 10:case 8:case 11:s=hu;break;default:return console.warn("Marching squares invalid state: "+g),!0}switch(s){case to:h--,f-=r.pixelGroup;break;case hu:h++,f+=r.pixelGroup;break;case hy:c--,d-=r.pixelGroup;break;case du:c++,d+=r.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+g),!0}}return!0}for(let l=0;l<r.width;l++)for(let u=0;u<r.height;u++){if(r.get(l,u)<=t)continue;const c=a(l,u);if(!(c<0||c===15)&&o(l,u))return n.path()}return null}const dh={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function Eo(r){return r!=null&&typeof r.radius=="number"}function sk(r,t){if(Eo(r)!==Eo(t))return!1;if(Eo(r)){const n=t;return r.cx===n.cx&&r.cy===n.cy&&r.radius===n.radius}const e=t;return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}var Ar;(function(r){r[r.MEMBERS=0]="MEMBERS",r[r.NON_MEMBERS=1]="NON_MEMBERS",r[r.EDGES=2]="EDGES"})(Ar||(Ar={}));let ok=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new On(0,0,0,0),this.potentialArea=new Na(1,0,0,0,0,0,0),this.o=Object.assign({},dh,t)}pushMember(...t){if(t.length!==0){this.dirty.add(Ar.MEMBERS);for(const e of t)this.members.push({raw:e,obj:Eo(e)?sc.from(e):On.from(e),area:null})}}removeMember(t){const e=this.members.findIndex(n=>sk(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(Ar.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>sk(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(Ar.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex(n=>n.obj.equals(t));return e<0?!1:(this.edges.splice(e,1),this.dirty.add(Ar.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(Ar.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:Eo(e)?sc.from(e):On.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(Ar.EDGES);for(const e of t)this.edges.push({raw:e,obj:dn.from(e),area:null})}}update(){const t=this.dirty.has(Ar.MEMBERS),e=this.dirty.has(Ar.NON_MEMBERS);let n=this.dirty.has(Ar.EDGES);this.dirty.clear();const i=this.members.map(u=>u.obj);if(this.o.virtualEdges&&(t||e)){const u=this.nonMembers.map(d=>d.obj),c=s7(i,u,this.o.maxRoutingIterations,this.o.morphBuffer),h=new Map(this.virtualEdges.map(d=>[d.obj.toString(),d.area]));this.virtualEdges=c.map(d=>{var f;return{raw:d,obj:d,area:(f=h.get(d.toString()))!==null&&f!==void 0?f:null}}),n=!0}let a=!1;if(t||n){const u=this.virtualEdges.concat(this.edges).map(f=>f.obj),c=x7(i,u),h=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,d=On.from(jN(c,h));d.equals(this.activeRegion)||(a=!0,this.activeRegion=d)}if(a){const u=Math.ceil(this.activeRegion.width/this.o.pixelGroup),c=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Na.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(h=>h.area=null),this.nonMembers.forEach(h=>h.area=null),this.edges.forEach(h=>h.area=null),this.virtualEdges.forEach(h=>h.area=null)):(u!==this.potentialArea.width||c!==this.potentialArea.height)&&(this.potentialArea=Na.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=u=>{if(u.area){const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof On?"R":"C"}`;s.set(c,u.area)}},l=u=>{if(u.area)return;const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof On?"R":"C"}`;if(s.has(c)){const d=s.get(c);u.area=this.potentialArea.copy(d,{x:u.obj.x-this.o.nodeR1,y:u.obj.y-this.o.nodeR1});return}const h=u.obj instanceof On?a7(u.obj,this.potentialArea,this.o.nodeR1):qN(u.obj,this.potentialArea,this.o.nodeR1);u.area=h,s.set(c,h)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(l),this.nonMembers.forEach(u=>{this.activeRegion.intersects(u.obj)?l(u):u.area=null}),this.edges.forEach(u=>{u.area||(u.area=ak(u.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(u=>{u.area||(u.area=ak(u.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(this.members.length===0)return new Gs([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map(o=>o.area),i=this.virtualEdges.concat(this.edges).map(o=>o.area),a=this.nonMembers.filter(o=>o.area!=null).map(o=>o.area),s=this.members.map(o=>o.obj);return w7(e,n,i,a,o=>o.containsElements(s),t)}};function w7(r,t,e,n,i,a={}){const s=Object.assign({},dh,a);let o=s.threshold,l=s.memberInfluenceFactor,u=s.edgeInfluenceFactor,c=s.nonMemberInfluenceFactor;const h=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),d=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let f=0;f<s.maxMarchingIterations;f++){if(r.clear(),l!==0){const p=l/h;for(const g of t)r.incArea(g,p)}if(u!==0){const p=u/d;for(const g of e)r.incArea(g,p)}if(c!==0){const p=c/h;for(const g of n)r.incArea(g,p)}const v=b7(r,o);if(v&&i(v))return v;if(o*=.95,f<=s.maxMarchingIterations*.5)l*=1.2,u*=1.2;else if(c!==0&&n.length>0)c*=.8;else break}return new Gs([])}function x7(r,t){if(r.length===0)return new On(0,0,0,0);const e=On.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(BN(n));return e}var E7=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};class fh extends _n{constructor(t,e){super(t,Bn({},fh.defaultOptions,e)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:n,bubbleSetOptions:i}=this.parseOptions();Be(this.bubbleSetOptions,i)||this.init(),this.bubbleSetOptions=Object.assign({},i);const a=Object.assign(Object.assign({},n),{d:this.getPath()});this.shape?this.shape.update(a):(this.shape=new tl({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=J(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,l=[...this.avoidMembers.keys()];if(!n&&Be(a,s)&&Be(o,l))return this.path;const{enter:u=[],exit:c=[]}=Zi(s,a,g=>g),{enter:h=[],exit:d=[]}=Zi(l,o,g=>g);n&&(c.push(n),u.push(n));const f=(g,y,m)=>{g.forEach(w=>{const E=m?this.members:this.avoidMembers,_=m?"pushMember":"pushNonMember",k=m?"removeMember":"removeNonMember";if(y){let T;i.getElementType(w)==="edge"?([T]=_7(i,w),this.bubbleSets.pushEdge(T)):([T]=S7(i,w),this.bubbleSets[_](T)),E.set(w,T)}else{const T=E.get(w);T&&(i.getElementType(w)==="edge"?this.bubbleSets.removeEdge(T):this.bubbleSets[k](T),E.delete(w))}})};f(c,!1,!0),f(u,!0,!0),f(d,!1,!1),f(h,!0,!1);const p=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=kA(p.points.map(bn)),this.path},this.bindEvents(),this.bubbleSets=new ok(this.options)}bindEvents(){this.context.graph.on(pt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(pt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new ok(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const t=this.options,{type:e,key:n,members:i,avoidMembers:a}=t,s=E7(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,u)=>(u in dh?l.bubbleSetOptions[u]=s[u]:l.style[u]=s[u],l),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:i,avoidMembers:a},o)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),this.drawBubbleSets()}updateMember(t){this.options.members=Ot(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!e.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(n=>e.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(pt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(pt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}fh.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},dh);const S7=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new On(i.min[0],i.min[1],oi(i),li(i))}),_7=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return dn.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function M7(r){return`
15
- <ul class="g6-contextmenu-ul">
16
- ${r.map(t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`).join("")}
17
- </ul>
18
- `}const k7=`
19
- .g6-contextmenu {
20
- font-size: 12px;
21
- background-color: rgba(255, 255, 255, 0.96);
22
- border-radius: 4px;
23
- overflow: hidden;
24
- box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;
25
- transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;
26
- }
27
-
28
- .g6-contextmenu-ul {
29
- max-width: 256px;
30
- min-width: 96px;
31
- list-style: none;
32
- padding: 0;
33
- margin: 0;
34
- }
35
-
36
- .g6-contextmenu-li {
37
- padding: 8px 12px;
38
- cursor: pointer;
39
- user-select: none;
40
- }
41
-
42
- .g6-contextmenu-li:hover {
43
- background-color: #f5f5f5;
44
- cursor: pointer;
45
- }
46
- `;var lk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class gh extends _n{constructor(t,e){super(t,Object.assign({},gh.defaultOptions,e)),this.targetElement=null,this.onTriggerEvent=n=>{var i;(i=n.preventDefault)===null||i===void 0||i.call(n),this.show(n)},this.onMenuItemClick=n=>{const{onClick:i,trigger:a}=this.options;if(n.target instanceof HTMLElement&&n.target.className.includes("g6-contextmenu-li")){const s=n.target.getAttribute("value");i==null||i(s,n.target,this.targetElement),this.hide()}a!=="click"&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=$s("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),Om("g6-contextmenu-css","style",{},k7,document.head)}show(t){return lk(this,void 0,void 0,function*(){const{enable:e,offset:n}=this.options;if(typeof e=="function"&&!e(t)||!e){this.hide();return}const i=yield this.getDOMContent(t);i instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(i)):this.$element.innerHTML=i;const a=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-a.left+n[0]}px`,this.$element.style.top=`${t.client.y-a.top+n[1]}px`,this.$element.style.display="block",this.targetElement=t.target})}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return lk(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?M7(yield n(t)):yield e(t)})}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}}gh.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class vh extends _n{constructor(t,e){super(t,Object.assign({},vh.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:n,element:i}=this.context,a=n.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:s,iterRate:o,divRate:l}=this.options;let{lambda:u,divisions:c,iterations:h}=this.options;for(let d=0;d<s;d++){for(let f=0;f<h;f++){const v={};a.forEach(p=>{var g;if(p.source===p.target)return;const y=J(p);v[y]=this.getEdgeForces(p,c,u);for(let m=0;m<c+1;m++)(g=this.edgePoints)[y]||(g[y]=[]),this.edgePoints[y][m]=qt(this.edgePoints[y][m],v[y][m])})}u/=2,c*=l,h*=o,this.divideEdges(c)}a.forEach(d=>{const f=J(d),v=i.getElement(f);v==null||v.update({d:y1(this.edgePoints[f])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[J(e),Fa(an(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=J(n);(i=this.edgePoints)[a]||(i[a]=[]);const s=this.nodeMap[n.source],o=this.nodeMap[n.target];if(t===1)this.edgePoints[a].push(s),this.edgePoints[a].push(Dr(qt(s,o),2)),this.edgePoints[a].push(o);else{const u=(this.edgePoints[a].length===0?me(s,o):N7(this.edgePoints[a]))/(t+1);let c=u;const h=[s];for(let d=1;d<this.edgePoints[a].length;d++){const f=this.edgePoints[a][d-1],v=this.edgePoints[a][d];let p=me(v,f);for(;p>c;){const g=c/p,y=qt(f,vi(oe(v,f),g));h.push(y),p-=c,c=u}c-=p}h.push(o),this.edgePoints[a]=h}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=oe(n,e),s=me(e,n);return{source:e,target:n,vx:i,vy:a,length:s}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),i=this.getVectorPosition(e),a=O7(n,i),s=T7(n,i),o=A7(n,i),l=P7(n,i);return a*s*o*l}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var l,u;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[l=J(i)]||(t[l]=[]),t[J(i)].push(s),t[u=J(s)]||(t[u]=[]),t[J(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return vi(oe(qt(n,a),vi(i,2)),e)}getElectrostaticForce(t,e){Kr(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[J(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[J(a)][t],o=this.edgePoints[J(e)][t],l=oe(s,o),u=me(s,o);i=qt(i,vi(l,1/u))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(me(i,a)*(e+1)),o=[[0,0]],l=J(t);for(let u=1;u<e;u++){const c=this.getSpringForce({pre:this.edgePoints[l][u-1],cur:this.edgePoints[l][u],next:this.edgePoints[l][u+1]||[0,0]},s),h=this.getElectrostaticForce(u,t);o.push(vi(qt(c,h),n))}return o.push([0,0]),o}bindEvents(){const{graph:t}=this.context;t.on(pt.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:t}=this.context;t.off(pt.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}vh.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const O7=(r,t)=>Math.abs(PF([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),T7=(r,t)=>{const e=(r.length+t.length)/2;return 2/(e/Math.min(r.length,t.length)+Math.max(r.length,t.length)/e)},A7=(r,t)=>{const e=(r.length+t.length)/2,n=Dr(qt(r.source,r.target),2),i=Dr(qt(t.source,t.target),2);return e/(e+me(n,i))},uk=(r,t)=>{if(t.source[0]===t.target[0])return[t.source[0],r[1]];if(t.source[1]===t.target[1])return[r[0],t.source[1]];const e=(t.source[1]-t.target[1])/(t.source[0]-t.target[0]),n=(e*e*t.source[0]+e*(r[1]-t.source[1])+r[0])/(e*e+1),i=e*(n-t.source[0])+t.source[1];return[n,i]},ck=(r,t)=>{const e=uk(t.source,r),n=uk(t.target,r),i=Dr(qt(e,n),2),a=Dr(qt(r.source,r.target),2);return me(e,n)===0?0:Math.max(0,1-2*me(a,i)/me(e,n))},P7=(r,t)=>Math.min(ck(r,t),ck(t,r)),N7=r=>{let t=0;for(let e=1;e<r.length;e++)t+=me(r[e],r[e-1]);return t},C7={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0},hk=.05;class ph extends _n{constructor(t,e){super(t,Object.assign({},ph.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=bn(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},C7,this.options.style);this.isLensOn||(this.lens=new el({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Cr(n),{size:this.r*2}),this.lens.update(i)},this.getFilterData=()=>{const{filter:n}=this.options,{model:i}=this.context,a=i.getData();if(!n)return a;const{nodes:s,edges:o,combos:l}=a;return{nodes:s.filter(u=>n(J(u),"node")),edges:o.filter(u=>n(J(u),"edge")),combos:l.filter(u=>n(J(u),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(u=>me(an(u),n)<this.r),o=s.map(u=>J(u)),l=a.filter(u=>{const{source:c,target:h}=u,d=o.includes(c),f=o.includes(h);switch(this.options.nodeType){case"both":return d&&f;case"either":return d!==f;case"source":return d&&!f;case"target":return!d&&f;default:return!1}});return{nodes:s,edges:l}},this.renderFocusElements=()=>{const{element:n,graph:i}=this.context;if(!this.isLensOn)return;const a=this.lens.getCenter(),{nodes:s,edges:o}=this.getFocusElements(a),l=new Set,u=c=>{const h=J(c);l.add(h);const d=n.getElement(h);if(!d)return;const f=this.shapes.get(h)||d.cloneNode();f.setPosition(d.getPosition()),f.id=d.id,this.shapes.has(h)?Object.entries(d.attributes).forEach(([g,y])=>{f.style[g]!==y&&(f.style[g]=y)}):(this.canvas.appendChild(f),this.shapes.set(h,f));const v=i.getElementType(h),p=this.getElementStyle(v,c);f.update(p)};s.forEach(u),o.forEach(u),this.shapes.forEach((c,h)=>{l.has(h)||(c.destroy(),this.shapes.delete(h))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:l}=n,{graph:u,canvas:c}=this.context,h=u.getCanvasByClient([a,s]),d=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||me(h,d)>this.r)return;const{maxR:f,minR:v}=this.options,p=o+l>0?1/(1-hk):1-hk,g=Math.min(...c.getSize())/2;this.r=Math.max(v||0,Math.min(f||g,this.r*p)),this.renderLens(d),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=bn(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||me(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=bn(n.canvas);this.renderLens(i),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n=t==="node"?this.options.nodeStyle:this.options.edgeStyle;return typeof n=="function"?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.addEventListener(it.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(it.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(it.DRAG_START,this.onDragStart),a.addEventListener(it.DRAG,this.onDrag),a.addEventListener(it.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(it.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.removeEventListener(it.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(it.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(it.DRAG_START,this.onDragStart),a.removeEventListener(it.DRAG,this.onDrag),a.removeEventListener(it.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(it.WHEEL,this.scaleRByWheel))}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}ph.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const R7={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},dk=.05,fk=.1;class yh extends _n{constructor(t,e){super(t,Object.assign({},yh.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=bn(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},R7,this.options.style);this.isLensOn||(this.lens=new el({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Cr(n),{size:this.r*2,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(i)},this.getDPercent=()=>{const{minD:n,maxD:i}=this.options;return`${Math.round((this.d-n)/(i-n)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:n}=this.context,i=this.lens.getCenter(),a=(this.d+1)*this.r,s=new Map,o=new Map;n.getNodeData().forEach(u=>{const c=an(u),h=me(c,i);if(h>this.r)return;const d=a*h/(this.d*h+this.r),[f,v]=c,[p,g]=i,y=(f-p)/h,m=(v-g)/h,w=[p+d*y,g+d*m],E=J(u),_=this.getNodeStyle(u),k=Ra(n.getElementRenderStyle(E),Object.keys(_));s.set(E,Object.assign(Object.assign({},Cr(w)),_)),o.set(E,Object.assign(Object.assign({},Cr(c)),k))}),this.updateStyle(s,o)},this.getNodeStyle=n=>{const{nodeStyle:i}=this.options;return typeof i=="function"?i(n):i},this.updateStyle=(n,i)=>{const{graph:a,element:s}=this.context,{enter:o,exit:l,keep:u}=Zi(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),d=>d),c=new Set,h=(d,f)=>{const v=s.getElement(d);v==null||v.update(f),a.getRelatedEdgesData(d).forEach(p=>{c.add(J(p))})};[...o,...u].forEach(d=>{h(d,n.get(d))}),l.forEach(d=>{h(d,this.prevOriginStyleMap.get(d)),this.prevOriginStyleMap.delete(d)}),c.forEach(d=>{const f=s.getElement(d);f==null||f.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((d,f)=>{this.prevOriginStyleMap.has(f)||this.prevOriginStyleMap.set(f,d)})},this.isWheelValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const{clientX:i,clientY:a}=n,s=this.context.graph.getCanvasByClient([i,a]),o=this.lens.getCenter();return!(me(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-dk):1-dk,o=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(a||0,Math.min(i||o,this.r*s))},this.scaleD=n=>{const{maxD:i,minD:a}=this.options,s=n?this.d+fk:this.d-fk;this.d=Math.max(a,Math.min(i,s))},this.scaleRByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleR(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleD(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.isDragValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const i=bn(n.canvas),a=this.lens.getCenter();return!(me(i,a)>this.r)},this.isLensDragging=!1,this.onDragStart=n=>{this.isDragValid(n)&&(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=bn(n.canvas);this.onMagnify(i)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleR(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleD(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.addEventListener(it.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(it.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(it.DRAG_START,this.onDragStart),s.addEventListener(it.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(it.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(it.WHEEL,o,{passive:!1})}}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.removeEventListener(it.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(it.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(it.DRAG_START,this.onDragStart),s.removeEventListener(it.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(it.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(it.WHEEL,o)}}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&((t=this.lens)===null||t===void 0||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}yh.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class mh extends _n{constructor(t,e){super(t,Object.assign({},mh.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var n,i,a,s;const o=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(o),o?(i=(n=this.options).onEnter)===null||i===void 0||i.call(n):(s=(a=this.options).onExit)===null||s===void 0||s.call(a)},this.shortcut=new Rs(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML=`
47
- :not(:root):fullscreen::backdrop {
48
- background: transparent;
49
- }
50
- `}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit),["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(i=>{document.addEventListener(i,this.onFullscreenChange,!1)})}unbindEvents(){this.shortcut.unbindAll(),["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(e=>{document.removeEventListener(e,this.onFullscreenChange,!1)})}setGraphSize(t=!0){var e,n;let i,a;t?(i=((e=globalThis.screen)===null||e===void 0?void 0:e.width)||0,a=((n=globalThis.screen)===null||n===void 0?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[i,a]=this.graphSize,this.context.graph.setSize(i,a),this.context.graph.render()}request(){document.fullscreenElement||!L7()||this.$el.requestFullscreen().catch(t=>{ai.warn(`Error attempting to enable full-screen: ${t.message} (${t.name})`)})}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.exit(),this.style.remove(),super.destroy()}}mh.defaultOptions={trigger:{},autoFit:!0};function L7(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class bh extends _n{constructor(t,e){super(t,Object.assign({},bh.defaultOptions,e)),this.$element=$s("grid-line",!0),this.offset=[0,0],this.onTransform=i=>{if(!this.options.follow)return;const{data:{translate:a}}=i;a&&this.updateOffset(a)},this.context.canvas.getContainer().prepend(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:t}=this.context;t.on(pt.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:i,borderLineWidth:a,borderStroke:s,borderStyle:o}=this.options;Object.assign(this.$element.style,{border:i?`${a}px ${o} ${s}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`,backgroundRepeat:"repeat"})}updateOffset(t){this.offset=CF(qt(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(pt.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}bh.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function U1(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=J(i);if(n==="NodeAdded"||n==="EdgeAdded"||n==="ComboAdded")t.Added.set(a,e);else if(n==="NodeUpdated"||n==="EdgeUpdated"||n==="ComboUpdated")if(t.Added.has(a))t.Added.set(a,{type:n.replace("Updated","Added"),value:i});else if(t.Updated.has(a)){const{original:s}=t.Updated.get(a);t.Updated.set(a,{type:n,value:i,original:s})}else t.Removed.has(a)||t.Updated.set(a,e);else(n==="NodeRemoved"||n==="EdgeRemoved"||n==="ComboRemoved")&&(t.Added.has(a)?t.Added.delete(a):(t.Updated.has(a)&&t.Updated.delete(a),t.Removed.set(a,e)))}),[...Array.from(t.Added.values()),...Array.from(t.Updated.values()),...Array.from(t.Removed.values())]}function GN(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:l=[],ComboRemoved:u=[]}=cc(r,c=>c.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:l},remove:{nodes:n,edges:s,combos:u}}}function WN(r,t){for(const e in r)Ve(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),WN(r[e],t[e])):t[e]===void 0&&(t[e]=No(e))}function I7(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=GN(U1(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);let d=Object.assign({},l.original);if(e){const f=e.graph.getElementType(J(l.original)),v=f==="edge"?"stroke":"fill",p=e.element.getElementComputedStyle(f,l.original);d=Object.assign(Object.assign({},l.original),{style:Object.assign({[v]:p[v]},l.original.style)})}WN(h,d),(u=n.current.update)[o]||(u[o]=[]),n.current.update[o].push(h),(c=n.original.update)[o]||(c[o]=[]),n.original.update[o].push(d)}),i[o]&&i[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.add)[o]||(u[o]=[]),n.current.add[o].push(h),(c=n.original.remove)[o]||(c[o]=[]),n.original.remove[o].push(h)}),s[o]&&s[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.remove)[o]||(u[o]=[]),n.current.remove[o].push(h),(c=n.original.add)[o]||(c[o]=[]),n.original.add[o].push(h)})}),n}class wh extends _n{constructor(t,e){super(t,Object.assign({},wh.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,l;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const u=a?i.original:i.current;this.context.graph.addData(u.add),this.context.graph.updateData(u.update),this.context.graph.removeData(cA(u.remove,!1)),(l=this.context.element)===null||l===void 0||l.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===pt.AFTER_DRAW){const{dataChanges:s=[],animation:o=!0}=i.data;if(!((a=this.context.batch)===null||a===void 0)&&a.isBatching){if(!this.batchChanges)return;this.batchChanges.push(s),this.batchAnimation&&(this.batchAnimation=o);return}this.batchChanges=[s],this.batchAnimation=o}this.undoStackPush(I7(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(Fi.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=i=>{const{initiate:a}=i.data;this.batchAnimation=!1,a?this.batchChanges=[]:this.undoStack.pop()||(this.batchChanges=null)},this.emitter=new Rc;const{graph:n}=this.context;n.on(pt.AFTER_DRAW,this.addCommand),n.on(pt.BATCH_START,this.initBatchCommand),n.on(pt.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var t,e,n,i;const a=this.undoStack.pop();if(a){if(this.executeCommand(a),((e=(t=this.options).beforeAddCommand)===null||e===void 0?void 0:e.call(t,a,!1))===!1)return;this.redoStack.push(a),(i=(n=this.options).afterAddCommand)===null||i===void 0||i.call(n,a,!1),this.notify(Fi.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(Fi.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(Fi.CANCEL,t)),this}undoStackPush(t){var e,n,i,a;const{stackSize:s}=this.options;s!==0&&this.undoStack.length>=s&&this.undoStack.shift(),((n=(e=this.options).beforeAddCommand)===null||n===void 0?void 0:n.call(e,t,!0))!==!1&&(this.undoStack.push(t),(a=(i=this.options).afterAddCommand)===null||a===void 0||a.call(i,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(Fi.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(Fi.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(pt.AFTER_DRAW,this.addCommand),t.off(pt.BATCH_START,this.initBatchCommand),t.off(pt.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}wh.defaultOptions={stackSize:0};var dy,gk;function D7(){if(gk)return dy;gk=1;function r(e,n,i,a,s,o){const l=(o-n)*(i-e)-(a-n)*(s-e);return l>0?!0:!(l<0)}function t(e,n){const i=e[0][0],a=e[0][1],s=e[1][0],o=e[1][1],l=n[0][0],u=n[0][1],c=n[1][0],h=n[1][1];return r(i,a,l,u,c,h)!==r(s,o,l,u,c,h)&&r(i,a,s,o,l,u)!==r(i,a,s,o,c,h)}return dy=t,dy}var fy,vk;function B7(){if(vk)return fy;vk=1;function r(e,n){this._cells=[],this._cellSize=n,this._reverseCellSize=1/n;for(let i=0;i<e.length;i++){const a=e[i],s=this.coordToCellNum(a[0]),o=this.coordToCellNum(a[1]);if(this._cells[s])this._cells[s][o]?this._cells[s][o].push(a):this._cells[s][o]=[a];else{const l=[];l[o]=[a],this._cells[s]=l}}}r.prototype={cellPoints:function(e,n){return this._cells[e]!==void 0&&this._cells[e][n]!==void 0?this._cells[e][n]:[]},rangePoints:function(e){const n=this.coordToCellNum(e[0]),i=this.coordToCellNum(e[1]),a=this.coordToCellNum(e[2]),s=this.coordToCellNum(e[3]),o=[];for(let l=n;l<=a;l++)for(let u=i;u<=s;u++)for(let c=0;c<this.cellPoints(l,u).length;c++)o.push(this.cellPoints(l,u)[c]);return o},removePoint:function(e){const n=this.coordToCellNum(e[0]),i=this.coordToCellNum(e[1]),a=this._cells[n][i];let s;for(let o=0;o<a.length;o++)if(a[o][0]===e[0]&&a[o][1]===e[1]){s=o;break}return a.splice(s,1),a},trunc:Math.trunc||function(e){return e-e%1},coordToCellNum:function(e){return this.trunc(e*this._reverseCellSize)},extendBbox:function(e,n){return[e[0]-n*this._cellSize,e[1]-n*this._cellSize,e[2]+n*this._cellSize,e[3]+n*this._cellSize]}};function t(e,n){return new r(e,n)}return fy=t,fy}var gy,pk;function F7(){return pk||(pk=1,gy={toXy:function(r,t){return t===void 0?r.slice():r.map(function(e){return new Function("pt","return [pt"+t[0]+",pt"+t[1]+"];")(e)})},fromXy:function(r,t){return t===void 0?r.slice():r.map(function(e){return new Function("pt","const o = {}; o"+t[0]+"= pt[0]; o"+t[1]+"= pt[1]; return o;")(e)})}}),gy}var vy,yk;function z7(){if(yk)return vy;yk=1;function r(i,a,s){return(a[0]-i[0])*(s[1]-i[1])-(a[1]-i[1])*(s[0]-i[0])}function t(i){const a=[];for(let s=0;s<i.length;s++){for(;a.length>=2&&r(a[a.length-2],a[a.length-1],i[s])<=0;)a.pop();a.push(i[s])}return a.pop(),a}function e(i){const a=i.reverse(),s=[];for(let o=0;o<a.length;o++){for(;s.length>=2&&r(s[s.length-2],s[s.length-1],a[o])<=0;)s.pop();s.push(a[o])}return s.pop(),s}function n(i){const a=t(i),o=e(i).concat(a);return o.push(i[0]),o}return vy=n,vy}var py,mk;function j7(){if(mk)return py;mk=1;const r=D7(),t=B7(),e=F7(),n=z7();function i(g){const y=[g[0]];let m=g[0];for(let w=1;w<g.length;w++){const E=g[w];(m[0]!==E[0]||m[1]!==E[1])&&y.push(E),m=E}return y}function a(g){return g.sort(function(y,m){return y[0]-m[0]||y[1]-m[1]})}function s(g,y){return Math.pow(y[0]-g[0],2)+Math.pow(y[1]-g[1],2)}function o(g,y,m){const w=[y[0]-g[0],y[1]-g[1]],E=[m[0]-g[0],m[1]-g[1]],_=s(g,y),k=s(g,m);return(w[0]*E[0]+w[1]*E[1])/Math.sqrt(_*k)}function l(g,y){for(let m=0;m<y.length-1;m++){const w=[y[m],y[m+1]];if(!(g[0][0]===w[0][0]&&g[0][1]===w[0][1]||g[0][0]===w[1][0]&&g[0][1]===w[1][1])&&r(g,w))return!0}return!1}function u(g){let y=1/0,m=1/0,w=-1/0,E=-1/0;for(let _=g.length-1;_>=0;_--)g[_][0]<y&&(y=g[_][0]),g[_][1]<m&&(m=g[_][1]),g[_][0]>w&&(w=g[_][0]),g[_][1]>E&&(E=g[_][1]);return[w-y,E-m]}function c(g){return[Math.min(g[0][0],g[1][0]),Math.min(g[0][1],g[1][1]),Math.max(g[0][0],g[1][0]),Math.max(g[0][1],g[1][1])]}function h(g,y,m){let w=null,E=v,_=v,k,T;for(let O=0;O<y.length;O++)k=o(g[0],g[1],y[O]),T=o(g[1],g[0],y[O]),k>E&&T>_&&!l([g[0],y[O]],m)&&!l([g[1],y[O]],m)&&(E=k,_=T,w=y[O]);return w}function d(g,y,m,w,E){let _=!1;for(let k=0;k<g.length-1;k++){const T=[g[k],g[k+1]],O=T[0][0]+","+T[0][1]+","+T[1][0]+","+T[1][1];if(s(T[0],T[1])<y||E.has(O))continue;let P=0,N=c(T),C,L,B;do N=w.extendBbox(N,P),C=N[2]-N[0],L=N[3]-N[1],B=h(T,w.rangePoints(N),g),P++;while(B===null&&(m[0]>C||m[1]>L));C>=m[0]&&L>=m[1]&&E.add(O),B!==null&&(g.splice(k+1,0,B),w.removePoint(B),_=!0)}return _?d(g,y,m,w,E):g}function f(g,y,m){let w=y||20;const E=i(a(e.toXy(g,m)));if(E.length<4){const C=E.concat([E[0]]);return m?e.fromXy(C,m):C}const _=u(E),k=[_[0]*p,_[1]*p],T=n(E),O=E.filter(function(C){return T.indexOf(C)<0}),P=Math.ceil(1/(E.length/(_[0]*_[1]))),N=d(T,Math.pow(w,2),k,t(O,P),new Set);return m?e.fromXy(N,m):N}const v=Math.cos(90/(180/Math.PI)),p=.6;return py=f,py}var q7=j7();const $7=Go(q7);function G7(r,t,e){if(r.length===1)return W7(r[0],t,e);if(r.length===2)return bk(r,t,e);if(r.length===3){const[n,i,a]=h1(r);if(yA(n,i,a))return bk([n,a],t,e)}switch(e){case"smooth":return U7(r,t);case"sharp":return Y7(r,t);case"rounded":default:return V7(r,t)}}const W7=(r,t,e)=>{if(e==="sharp")return[["M",r[0]-t,r[1]-t],["L",r[0]+t,r[1]-t],["L",r[0]+t,r[1]+t],["L",r[0]-t,r[1]+t],["Z"]];const n=[t,t,0,0,0];return[["M",r[0],r[1]-t],["A",...n,r[0],r[1]+t],["A",...n,r[0],r[1]-t]]},bk=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?qt(r[0],Wi(Ei(oe(r[0],r[1])),t)):r[0],a=e==="sharp"?qt(r[1],Wi(Ei(oe(r[1],r[0])),t)):r[1],s=Wi(Ei(yc(oe(i,a),!1)),t),o=Wi(s,-1),l=qt(i,s),u=qt(a,s),c=qt(a,o),h=qt(i,o);return e==="sharp"?[["M",l[0],l[1]],["L",u[0],u[1]],["L",c[0],c[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",u[0],u[1]],["A",...n,c[0],c[1]],["L",h[0],h[1]],["A",...n,l[0],l[1]]]},V7=(r,t)=>{const e=h1(r).map((o,l)=>{const u=(l-2+r.length)%r.length,c=(l-1+r.length)%r.length,h=(l+1)%r.length,d=r[u],f=r[c],v=r[h],p=oe(d,f),g=oe(f,o),y=oe(o,v),m=(T,O)=>u1(T,O,!0)<Math.PI,w=m(p,g),E=m(g,y),_=T=>Wi(Ei(yc(T,!1)),t),k=_(g);return[{p:Fa(w?qt(f,_(p)):qt(f,k)),concave:w&&f},{p:Fa(E?qt(o,_(y)):qt(o,k)),concave:E&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,l)=>!e[(l-1+e.length)%e.length][0].concave&&!e[(l-1+e.length)%e.length][1].concave&&!o[0].concave&&!o[0].concave&&!o[1].concave),a=e.slice(i).concat(e.slice(0,i));let s=[];return a.flatMap((o,l)=>{const u=[],c=a[e.length-1];return l===0&&u.push(["M",...c[1].p]),o[0].concave?s.push(o[0].p,o[1].p):u.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):u.push(["L",...o[1].p]),s.length===3&&(u.pop(),u.push(["C",...s.flat()]),s=[]),u})},U7=(r,t)=>{const e=h1(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:Ei(oe(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=Ei(qt(s,Wi(n.v,u1(s,n.v,!0)<Math.PI?1:-1)));n.p=qt(n.p,Wi(o,t))}),kA(e.map(n=>n.p))},Y7=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],l=Co(Wi(Ei(yc(oe(o,a),!1)),t));return[qt(o,l),qt(a,l)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],l=[n[(s+1)%n.length],n[(s+2)%n.length]];return c1(o,l,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var H7=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};class xh extends _n{constructor(t,e){super(t,Object.assign({},xh.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(!this.shape)this.shape=new tl({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!Be(this.optionsCache,this.options);this.shape.update(this.getHullStyle(n))}this.optionsCache=Object.assign({},this.options)},this.updateHullPath=n=>{this.shape&&this.options.members.includes(J(n.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(n=!1)=>{const{graph:i}=this.context,a=this.getMember();if(a.length===0)return"";const s=a.map(u=>i.getNodeData(u)),o=$7(s.map(an),this.options.concavity).slice(1).reverse(),l=o.flatMap(u=>s.filter(c=>Be(an(c),u)).map(J));return Be(l,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=l,this.path=G7(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(pt.AFTER_RENDER,this.drawHull),this.context.graph.on(pt.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=H7(e,["members","padding","corner"]);return Object.assign(Object.assign({},s),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context;return this.hullMemberIds.reduce((n,i)=>{const{halfExtents:a}=t.getElementRenderBounds(i),s=Math.max(a[0],a[1]);return Math.max(n,s)},0)+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),e.some(n=>this.hullMemberIds.includes(n))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Ot(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(pt.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}xh.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function VN(r,t){t(r),r.children&&r.children.forEach(function(e){e&&VN(e,t)})}function hl(r){Eh(r,!0)}function Rr(r){Eh(r,!1)}function Eh(r,t){var e=t?"visible":"hidden";VN(r,function(n){n.attr("visibility",e)})}var X7=function(r){Yt(t,r);function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=r.apply(this,xt([],q(e),!1))||this;return i.isMutationObserved=!0,i.addEventListener(Ht.INSERTED,function(){Rr(i)}),i}return t}(on);function UN(r){var t=r.appendChild(new X7({class:"offscreen"}));return Rr(t),t}function K7(r){for(var t=r;t;){if(t.className==="offscreen")return!0;t=t.parent}return!1}var Y1=function(r){Yt(t,r);function t(e){e===void 0&&(e={});var n=e.style,i=je(e,["style"]);return r.call(this,ut({style:ut({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},i))||this}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=UN(this)),this._offscreen},enumerable:!1,configurable:!0}),t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t}(Wa);function Ns(r){return r*Math.PI/180}function YN(r){return Number((r*180/Math.PI).toPrecision(5))}var Dn=function(){function r(t,e,n,i){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=i}return Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),r.fromRect=function(t){return new r(t.x,t.y,t.width,t.height)},r.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},r.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function xr(r,t){return Ot(r)?r.apply(void 0,xt([],q(t),!1)):r}var jr=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=q(i,2),s=a[0],o=a[1],l=e(o);return[s,{name:l,class:".".concat(l),id:"#".concat(l),toString:function(){return l}}]}));return Object.assign(n,{prefix:e}),n},Z7=5,HN=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=Z7),Object.entries(t).forEach(function(i){var a=q(i,2),s=a[0],o=a[1],l=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?Ms(o)?(Ms(r[s])||(l[s]={}),e<n?HN(r[s],o,e+1,n):l[s]=t[s]):lr(o)?(l[s]=[],l[s]=l[s].concat(o)):l[s]=o:l[s]=o)})},fn=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)HN(r,t[n]);return r},XN=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},fu,J7=By(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return fu||(fu=ft.offscreenCanvasCreator.getOrCreateContext(void 0)),fu.font=[a,s,i,"".concat(e,"px"),n].join(" "),fu.measureText(r).width},function(r,t){return[r,Object.values(t||KN(r)).join()].join("")},4096),KN=function(r){var t=r.style.fontFamily||"sans-serif",e=r.style.fontWeight||"normal",n=r.style.fontStyle||"normal",i=r.style.fontVariant,a=r.style.fontSize;return a=typeof a=="object"?a.value:a,{fontSize:a,fontFamily:t,fontWeight:e,fontStyle:n,fontVariant:i}};function ZN(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function JN(r,t){var e=ZN(r);e&&e.attr(t)}function Tm(r,t,e){e===void 0&&(e="..."),JN(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function Q7(r,t,e,n){e===void 0&&(e=2),n===void 0&&(n="top"),JN(r,{wordWrap:!0,wordWrapWidth:t,maxLines:e,textBaseline:n})}function wk(r){var t=r.canvas,e=r.touches,n=r.offsetX,i=r.offsetY;if(t){var a=t.x,s=t.y;return[a,s]}if(e){var o=e[0],l=o.clientX,u=o.clientY;return[l,u]}return n&&i?[n,i]:[0,0]}function ki(r){return typeof r=="function"?r():ee(r)||St(r)?new Y1({style:{text:String(r)}}):r}function tV(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function or(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=function(a){a.node().removeChildren()}),r?e(t):(n&&i(t),null)}function yn(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=!1),n&&r===t||i&&r===e?!0:r>t&&r<e}var eV=function(r,t){return function(e){return r*(1-e)+t*e}};function nV(r,t){var e=t?t.length:0,n=r?Math.min(e,r.length):0;return function(i){var a=new Array(n),s=new Array(e),o=0;for(o=0;o<n;++o)a[o]=H1(r[o],t[o]);for(;o<e;++o)s[o]=t[o];for(o=0;o<n;++o)s[o]=a[o](i);return s}}function rV(r,t){r===void 0&&(r={}),t===void 0&&(t={});var e={},n={};return Object.entries(t).forEach(function(i){var a=q(i,2),s=a[0],o=a[1];s in r?e[s]=H1(r[s],o):n[s]=o}),function(i){return Object.entries(e).forEach(function(a){var s=q(a,2),o=s[0],l=s[1];return n[o]=l(i)}),n}}function H1(r,t){return typeof r=="number"&&typeof t=="number"?eV(r,t):Array.isArray(r)&&Array.isArray(t)?nV(r,t):typeof r=="object"&&typeof t=="object"?rV(r,t):function(e){return r}}function iV(r,t,e,n){if(!n)return r.attr("__keyframe_data__",e),null;var i=n.duration,a=i===void 0?0:i,s=H1(t,e),o=Math.ceil(+a/16),l=new Array(o).fill(0).map(function(u,c,h){return{__keyframe_data__:s(c/(h.length-1))}});return r.animate(l,ut({fill:"both"},n))}function mi(r,t){return[r[0]*t,r[1]*t]}function go(r,t){return[r[0]+t[0],r[1]+t[1]]}function yy(r,t){return[r[0]-t[0],r[1]-t[1]]}function pa(r,t){return[Math.min(r[0],t[0]),Math.min(r[1],t[1])]}function ya(r,t){return[Math.max(r[0],t[0]),Math.max(r[1],t[1])]}function zo(r,t){return Math.sqrt(Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2))}function QN(r){if(r[0]===0&&r[1]===0)return[0,0];var t=Math.sqrt(Math.pow(r[0],2)+Math.pow(r[1],2));return[r[0]/t,r[1]/t]}function aV(r,t){return t?[r[1],-r[0]]:[-r[1],r[0]]}function xk(r,t){return+r.toPrecision(t)}function Ek(r,t){var e={},n=Array.isArray(t)?t:[t];for(var i in r)n.includes(i)||(e[i]=r[i]);return e}function sV(r,t,e,n){var i,a=[],s=!!n,o,l,u=[1/0,1/0],c=[-1/0,-1/0],h,d,f;if(s){i=q(n,2),u=i[0],c=i[1];for(var v=0,p=r.length;v<p;v+=1){var g=r[v];u=pa(u,g),c=ya(c,g)}}for(var v=0,y=r.length;v<y;v+=1){var g=r[v];if(v===0)f=g;else if(v===y-1)d=g,a.push(f),a.push(d);else{var m=[v?v-1:y-1,v-1][1];o=r[m],l=r[v+1];var w=[0,0];w=yy(l,o),w=mi(w,t);var E=zo(g,o),_=zo(g,l),k=E+_;k!==0&&(E/=k,_/=k);var T=mi(w,-E),O=mi(w,_);d=go(g,T),h=go(g,O),h=pa(h,ya(l,g)),h=ya(h,pa(l,g)),T=yy(h,g),T=mi(T,-E/_),d=go(g,T),d=pa(d,ya(o,g)),d=ya(d,pa(o,g)),O=yy(g,d),O=mi(O,_/E),h=go(g,O),s&&(d=ya(d,u),d=pa(d,c),h=ya(h,u),h=pa(h,c)),a.push(f),a.push(d),f=h}}return a}function oV(r,t,e){e===void 0&&(e=[[0,0],[1,1]]);for(var n=!1,i=[],a=0,s=r.length;a<s;a+=2)i.push([r[a],r[a+1]]);for(var o=sV(i,.4,n,e),l=i.length,u=[],c,h,d,a=0;a<l-1;a+=1)c=o[a*2],h=o[a*2+1],d=i[a+1],u.push(["C",c[0],c[1],h[0],h[1],d[0],d[1]]);return u}var lV=["$el","cx","cy","d","dx","dy","fill","fillOpacity","filter","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","height","img","increasedLineWidthForHitTesting","innerHTML","isBillboard","billboardRotation","isSizeAttenuation","isClosed","isOverflowing","leading","letterSpacing","lineDash","lineHeight","lineWidth","markerEnd","markerEndOffset","markerMid","markerStart","markerStartOffset","maxLines","metrics","miterLimit","offsetX","offsetY","opacity","path","points","r","radius","rx","ry","shadowColor","src","stroke","strokeOpacity","text","textAlign","textBaseline","textDecorationColor","textDecorationLine","textDecorationStyle","textOverflow","textPath","textPathSide","textPathStartOffset","transform","transformOrigin","visibility","width","wordWrap","wordWrapWidth","x","x1","x2","y","y1","y2","z1","z2","zIndex"];function uV(r){return lV.includes(r)}function Sk(r){var t={};for(var e in r)uV(e)&&(t[e]=r[e]);return t}function cV(r,t){if(r.length<=t)return r;for(var e=Math.floor(r.length/t),n=[],i=0;i<r.length;i+=e)n.push(r[i]);return n}function X1(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=t/Math.max(i,a);return r.style.transform="scale(".concat(s,")"),s}function hV(r,t){var e=new Map;return r.forEach(function(n){var i=t(n);e.has(i)||e.set(i,[]),e.get(i).push(n)}),e}function dV(r){throw new Error(r)}var fV=function(){function r(i,a,s,o,l,u,c){i===void 0&&(i=null),a===void 0&&(a=null),s===void 0&&(s=null),o===void 0&&(o=null),l===void 0&&(l=[null,null,null,null,null]),u===void 0&&(u=[]),c===void 0&&(c=[]),t.add(this),this._elements=Array.from(i),this._data=a,this._parent=s,this._document=o,this._enter=l[0],this._update=l[1],this._exit=l[2],this._merge=l[3],this._split=l[4],this._transitions=u,this._facetElements=c}r.prototype.selectAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(a,null,this._elements[0],this._document)},r.prototype.selectFacetAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(this._elements,null,this._parent,this._document,void 0,void 0,a)},r.prototype.select=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i)[0]||null:i;return new e([a],null,a,this._document)},r.prototype.append=function(i){var a=this,s=typeof i=="function"?i:function(){return a.createElement(i)},o=[];if(this._data!==null){for(var l=0;l<this._data.length;l++){var u=this._data[l],c=q(Array.isArray(u)?u:[u,null],2),h=c[0],d=c[1],f=s(h,l);f.__data__=h,d!==null&&(f.__fromElements__=d),this._parent.appendChild(f),o.push(f)}return new e(o,null,this._parent,this._document)}for(var l=0;l<this._elements.length;l++){var v=this._elements[l],h=v.__data__,f=s(h,l);v.appendChild(f),o.push(f)}return new e(o,null,o[0],this._document)},r.prototype.maybeAppend=function(i,a){var s=Kh(this,t,"m",n).call(this,i[0]==="#"?i:"#".concat(i),a);return s.attr("id",i),s},r.prototype.maybeAppendByClassName=function(i,a){var s=i.toString(),o=Kh(this,t,"m",n).call(this,s[0]==="."?s:".".concat(s),a);return o.attr("className",s),o},r.prototype.maybeAppendByName=function(i,a){var s=Kh(this,t,"m",n).call(this,'[name="'.concat(i,'"]'),a);return s.attr("name",i),s},r.prototype.data=function(i,a,s){var o,l;a===void 0&&(a=function(N){return N}),s===void 0&&(s=function(){return null});for(var u=[],c=[],h=new Set(this._elements),d=[],f=new Set,v=new Map(this._elements.map(function(N,C){return[a(N.__data__,C),N]})),p=new Map(this._facetElements.map(function(N,C){return[a(N.__data__,C),N]})),g=hV(this._elements,function(N){return s(N.__data__)}),y=0;y<i.length;y++){var m=i[y],w=a(m,y),E=s(m,y);if(v.has(w)){var _=v.get(w);_.__data__=m,_.__facet__=!1,c.push(_),h.delete(_),v.delete(w)}else if(p.has(w)){var _=p.get(w);_.__data__=m,_.__facet__=!0,c.push(_),p.delete(w)}else if(g.has(w)){var k=g.get(w);d.push([m,k]);try{for(var T=(o=void 0,Vo(k)),O=T.next();!O.done;O=T.next()){var _=O.value;h.delete(_)}}catch(N){o={error:N}}finally{try{O&&!O.done&&(l=T.return)&&l.call(T)}finally{if(o)throw o.error}}g.delete(w)}else if(v.has(E)){var _=v.get(E);_.__toData__?_.__toData__.push(m):_.__toData__=[m],f.add(_),h.delete(_)}else u.push(m)}var P=[new e([],u,this._parent,this._document),new e(c,null,this._parent,this._document),new e(h,null,this._parent,this._document),new e([],d,this._parent,this._document),new e(f,null,this._parent,this._document)];return new e(this._elements,null,this._parent,this._document,P)},r.prototype.merge=function(i){var a=xt(xt([],q(this._elements),!1),q(i._elements),!1),s=xt(xt([],q(this._transitions),!1),q(i._transitions),!1);return new e(a,null,this._parent,this._document,void 0,s)},r.prototype.createElement=function(i){if(this._document)return this._document.createElement(i,{});var a=e.registry[i];return a?new a:dV("Unknown node type: ".concat(i))},r.prototype.join=function(i,a,s,o,l){i===void 0&&(i=function(v){return v}),a===void 0&&(a=function(v){return v}),s===void 0&&(s=function(v){return v.remove()}),o===void 0&&(o=function(v){return v}),l===void 0&&(l=function(v){return v.remove()});var u=i(this._enter),c=a(this._update),h=s(this._exit),d=o(this._merge),f=l(this._split);return c.merge(u).merge(h).merge(d).merge(f)},r.prototype.remove=function(){for(var i=function(o){var l=a._elements[o],u=a._transitions[o];u?u.then(function(){return l.remove()}):l.remove()},a=this,s=0;s<this._elements.length;s++)i(s);return new e([],null,this._parent,this._document,void 0,this._transitions)},r.prototype.each=function(i){for(var a=0;a<this._elements.length;a++){var s=this._elements[a],o=s.__data__;i.call(s,o,a)}return this},r.prototype.attr=function(i,a){var s=typeof a!="function"?function(){return a}:a;return this.each(function(o,l){a!==void 0&&(this[i]=s.call(this,o,l))})},r.prototype.style=function(i,a,s){s===void 0&&(s=!0);var o=typeof a!="function"||!s?function(){return a}:a;return this.each(function(l,u){a!==void 0&&(this.style[i]=o.call(this,l,u))})},r.prototype.styles=function(i,a){return i===void 0&&(i={}),a===void 0&&(a=!0),this.each(function(s,o){var l=this;Object.entries(i).forEach(function(u){var c=q(u,2),h=c[0],d=c[1],f=typeof d!="function"||!a?function(){return d}:d;d!==void 0&&l.attr(h,f.call(l,s,o))})})},r.prototype.update=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.maybeUpdate=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.transition=function(i){var a=this._transitions;return this.each(function(s,o){a[o]=i.call(this,s,o)})},r.prototype.on=function(i,a){return this.each(function(){this.addEventListener(i,a)}),this},r.prototype.call=function(i){for(var a=[],s=1;s<arguments.length;s++)a[s-1]=arguments[s];return i.call.apply(i,xt([this._parent,this],q(a),!1)),this},r.prototype.node=function(){return this._elements[0]},r.prototype.nodes=function(){return this._elements},r.prototype.transitions=function(){return this._transitions.filter(function(i){return!!i})},r.prototype.parent=function(){return this._parent};var t,e,n;return e=r,t=new WeakSet,n=function(a,s){var o=this._elements[0],l=o.querySelector(a);if(l)return new e([l],null,this._parent,this._document);var u=typeof s=="string"?this.createElement(s):s();return o.appendChild(u),new e([u],null,this._parent,this._document)},r.registry={g:on,rect:xn,circle:Ti,path:rr,text:Y1,ellipse:Ho,image:Ko,line:Da,polygon:Ga,polyline:gc,html:Xo},r}();function Tt(r){return new fV([r],null,r,r.ownerDocument)}function gV(r,t,e){return r.querySelector(t)?Tt(r).select(t):Tt(r).append(e)}function En(r){if(St(r))return[r,r,r,r];if(lr(r)){var t=r.length;if(t===1)return[r[0],r[0],r[0],r[0]];if(t===2)return[r[0],r[1],r[0],r[1]];if(t===3)return[r[0],r[1],r[2],r[1]];if(t===4)return r}return[0,0,0,0]}function _k(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=q([e,n],2),a=q(i[0],2),s=a[0],o=a[1],l=q(i[1],2),u=l[0],c=l[1];return{x:s,y:o,width:u-s,height:c-o,left:s,bottom:c,top:o,right:u}}function vV(r,t){var e=q(r,2),n=e[0],i=e[1],a=q(t,2),s=a[0],o=a[1];return n!==s&&i===o}function pV(r,t){var e,n,i=t.attributes;try{for(var a=Vo(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=q(s.value,2),l=o[0],u=o[1];l!=="id"&&l!=="className"&&r.attr(l,u)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function K1(r){return r.toString().charAt(0).toUpperCase()+r.toString().slice(1)}function yV(r){return r.toString().charAt(0).toLowerCase()+r.toString().slice(1)}function mV(r,t){return"".concat(t).concat(K1(r))}function Mk(r,t,e){var n;e===void 0&&(e=!0);var i=t||((n=r.match(/^([a-z][a-z0-9]+)/))===null||n===void 0?void 0:n[0])||"",a=r.replace(new RegExp("^(".concat(i,")")),"");return e?yV(a):a}function bV(r,t){Object.entries(t).forEach(function(e){var n=q(e,2),i=n[0],a=n[1];xt([r],q(r.querySelectorAll(i)),!1).filter(function(s){return s.matches(i)}).forEach(function(s){if(s){var o=s;o.style.cssText+=Object.entries(a).reduce(function(l,u){return"".concat(l).concat(u.join(":"),";")},"")}})})}var gu=function(r,t){if(!(r!=null&&r.startsWith(t)))return!1;var e=r[t.length];return e>="A"&&e<="Z"};function Ft(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=q(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(gu(s,"show")&&gu(Mk(s,"show"),t)!==e)s===mV(t,"show")?n[s]=o:n[s.replace(new RegExp(K1(t)),"")]=o;else if(!gu(s,"show")&&gu(s,t)!==e){var l=Mk(s,t);l==="filter"&&typeof o=="function"||(n[l]=o)}}}),n}function fs(r,t){return Object.entries(r).reduce(function(e,n){var i=q(n,2),a=i[0],s=i[1];return a.startsWith("show")?e["show".concat(t).concat(a.slice(4))]=s:e["".concat(t).concat(K1(a))]=s,e},{})}function Oi(r,t){t===void 0&&(t=["x","y","class","className"]);var e=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],n={},i={};return Object.entries(r).forEach(function(a){var s=q(a,2),o=s[0],l=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=l:n[o]=l)}),[n,i]}function $n(r,t){var e={YYYY:r.getFullYear(),MM:r.getMonth()+1,DD:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds()},n=t;return Object.keys(e).forEach(function(i){var a=e[i];n=n.replace(i,i==="YYYY"?"".concat(a):"".concat(a).padStart(2,"0"))}),n}function wV(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=q([t,e].map(function(u,c){var h;return u.includes("%")?parseFloat(((h=u.match(/[+-]?([0-9]*[.])?[0-9]+/))===null||h===void 0?void 0:h[0])||"0")/100*(c===0?i:a):u}),2),o=s[0],l=s[1];return[o,l]}function tC(r,t){if(t)try{var e=/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,n=t.replace(e,function(i,a,s){return"translate(".concat(wV(r,a,s),")")});r.attr("transform",n)}catch{}}function xV(r){var t;return((t=r[0])===null||t===void 0?void 0:t.map(function(e,n){return r.map(function(i){return i[n]})}))||[]}var kk=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,xt([],q(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function EV(){Eh(this,this.attributes.visibility!=="hidden")}var qe=function(r){Yt(t,r);function t(e,n){n===void 0&&(n={});var i=r.call(this,fn({},{style:n},e))||this;return i.initialized=!1,i._defaultOptions=n,i}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=UN(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),t.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t.prototype.attributeChangedCallback=function(e){e==="visibility"&&EV.call(this)},t.prototype.update=function(e,n){var i;return this.attr(fn({},this.attributes,e||{})),(i=this.render)===null||i===void 0?void 0:i.call(this,this.attributes,this,n)},t.prototype.clear=function(){this.removeChildren()},t.prototype.bindEvents=function(e,n){},t.prototype.getSubShapeStyle=function(e){e.x,e.y,e.transform,e.transformOrigin,e.class,e.className,e.zIndex;var n=je(e,["x","y","transform","transformOrigin","class","className","zIndex"]);return n},t}(t1),eC=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],["Z"]]},SV=eC,_V=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"]]},MV=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},kV=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"]]},OV=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"]]},TV=function(r,t,e){var n=e/2*Math.sqrt(3);return[["M",r,t-e],["L",r+n,t-e/2],["L",r+n,t+e/2],["L",r,t+e],["L",r-n,t+e/2],["L",r-n,t-e/2],["Z"]]},AV=function(r,t,e){var n=e-1.5;return[["M",r-e,t-n],["L",r+e,t+n],["L",r+e,t-n],["L",r-e,t+n],["Z"]]},nC=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},PV=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t+e],["M",r+e,t-e],["L",r-e,t+e]]},NV=function(r,t,e){return[["M",r-e/2,t-e],["L",r+e/2,t-e],["M",r,t-e],["L",r,t+e],["M",r-e/2,t+e],["L",r+e/2,t+e]]},CV=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},RV=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},rC=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},LV=rC,IV=function(r,t,e){return[["M",r-e,t],["A",e/2,e/2,0,1,1,r,t],["A",e/2,e/2,0,1,0,r+e,t]]},DV=function(r,t,e){return[["M",r-e-1,t-2.5],["L",r,t-2.5],["L",r,t+2.5],["L",r+e+1,t+2.5]]},BV=function(r,t,e){return[["M",r-e-1,t+2.5],["L",r,t+2.5],["L",r,t-2.5],["L",r+e+1,t-2.5]]},FV=function(r,t,e){return[["M",r-(e+1),t+2.5],["L",r-e/2,t+2.5],["L",r-e/2,t-2.5],["L",r+e/2,t-2.5],["L",r+e/2,t+2.5],["L",r+e+1,t+2.5]]};function zV(r,t){return[["M",r-5,t+2.5],["L",r-5,t],["L",r,t],["L",r,t-3],["L",r,t+3],["L",r+6.5,t+3]]}var jV=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]};function qV(r){var t="default";if(Ve(r)&&r instanceof Image)t="image";else if(Ot(r))t="symbol";else if(ee(r)){var e=new RegExp("data:(image|text)");r.match(e)?t="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(r)?t="url":t="symbol"}return t}function $V(r){var t=qV(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var ue=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=this.getSubShapeStyle(e),u=l.symbol,c=l.size,h=c===void 0?16:c,d=je(l,["symbol","size"]),f=$V(u);or(!!f,Tt(n),function(v){v.maybeAppendByClassName("marker",f).attr("className","marker ".concat(f,"-marker")).call(function(p){if(f==="image"){var g=h*2;p.styles({img:u,width:g,height:g,x:a-h,y:o-h})}else{var g=h/2,y=Ot(u)?u:t.getSymbol(u);p.styles(ut({d:y==null?void 0:y(a,o,g)},d))}})})},t.MARKER_SYMBOL_MAP=new Map,t.registerSymbol=function(e,n){t.MARKER_SYMBOL_MAP.set(e,n)},t.getSymbol=function(e){return t.MARKER_SYMBOL_MAP.get(e)},t.getSymbols=function(){return Array.from(t.MARKER_SYMBOL_MAP.keys())},t}(qe);ue.registerSymbol("cross",PV);ue.registerSymbol("hyphen",RV);ue.registerSymbol("line",nC);ue.registerSymbol("plus",CV);ue.registerSymbol("tick",NV);ue.registerSymbol("circle",eC);ue.registerSymbol("point",SV);ue.registerSymbol("bowtie",AV);ue.registerSymbol("hexagon",TV);ue.registerSymbol("square",_V);ue.registerSymbol("diamond",MV);ue.registerSymbol("triangle",kV);ue.registerSymbol("triangle-down",OV);ue.registerSymbol("line",nC);ue.registerSymbol("dot",rC);ue.registerSymbol("dash",LV);ue.registerSymbol("smooth",IV);ue.registerSymbol("hv",DV);ue.registerSymbol("vh",BV);ue.registerSymbol("hvh",FV);ue.registerSymbol("vhv",zV);function oc(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function Am(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function GV(r,t){const e=t<r?t:r,n=r>t?r:t;return i=>Math.min(Math.max(e,i),n)}function WV(r,t,e,n,i){let a=e,s=n||r.length;const o=l=>l;for(;a<s;){const l=Math.floor((a+s)/2);o(r[l])>t?s=l:a=l+1}return a}const Ok=Math.sqrt(50),Tk=Math.sqrt(10),Ak=Math.sqrt(2);function Mu(r,t,e){const n=(t-r)/Math.max(0,e),i=Math.floor(Math.log(n)/Math.LN10),a=n/10**i;return i>=0?(a>=Ok?10:a>=Tk?5:a>=Ak?2:1)*10**i:-(10**-i)/(a>=Ok?10:a>=Tk?5:a>=Ak?2:1)}const VV=(r,t,e=5)=>{const n=[r,t];let i=0,a=n.length-1,s=n[i],o=n[a],l;return o<s&&([s,o]=[o,s],[i,a]=[a,i]),l=Mu(s,o,e),l>0?(s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l,l=Mu(s,o,e)):l<0&&(s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l,l=Mu(s,o,e)),l>0?(n[i]=Math.floor(s/l)*l,n[a]=Math.ceil(o/l)*l):l<0&&(n[i]=Math.ceil(s*l)/l,n[a]=Math.floor(o*l)/l),n};function Pk(r){return!Bt(r)&&!M3(r)&&!Number.isNaN(r)}var my={exports:{}},by,Nk;function UV(){return Nk||(Nk=1,by={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]}),by}var wy={exports:{}},xy,Ck;function YV(){return Ck||(Ck=1,xy=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")}),xy}var Rk;function HV(){if(Rk)return wy.exports;Rk=1;var r=YV(),t=Array.prototype.concat,e=Array.prototype.slice,n=wy.exports=function(a){for(var s=[],o=0,l=a.length;o<l;o++){var u=a[o];r(u)?s=t.call(s,e.call(u)):s.push(u)}return s};return n.wrap=function(i){return function(){return i(n(arguments))}},wy.exports}var Lk;function XV(){if(Lk)return my.exports;Lk=1;var r=UV(),t=HV(),e=Object.hasOwnProperty,n=Object.create(null);for(var i in r)e.call(r,i)&&(n[r[i]]=i);var a=my.exports={to:{},get:{}};a.get=function(l){var u=l.substring(0,3).toLowerCase(),c,h;switch(u){case"hsl":c=a.get.hsl(l),h="hsl";break;case"hwb":c=a.get.hwb(l),h="hwb";break;default:c=a.get.rgb(l),h="rgb";break}return c?{model:h,value:c}:null},a.get.rgb=function(l){if(!l)return null;var u=/^#([a-f0-9]{3,4})$/i,c=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,h=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,d=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,f=/^(\w+)$/,v=[0,0,0,1],p,g,y;if(p=l.match(c)){for(y=p[2],p=p[1],g=0;g<3;g++){var m=g*2;v[g]=parseInt(p.slice(m,m+2),16)}y&&(v[3]=parseInt(y,16)/255)}else if(p=l.match(u)){for(p=p[1],y=p[3],g=0;g<3;g++)v[g]=parseInt(p[g]+p[g],16);y&&(v[3]=parseInt(y+y,16)/255)}else if(p=l.match(h)){for(g=0;g<3;g++)v[g]=parseInt(p[g+1],0);p[4]&&(p[5]?v[3]=parseFloat(p[4])*.01:v[3]=parseFloat(p[4]))}else if(p=l.match(d)){for(g=0;g<3;g++)v[g]=Math.round(parseFloat(p[g+1])*2.55);p[4]&&(p[5]?v[3]=parseFloat(p[4])*.01:v[3]=parseFloat(p[4]))}else return(p=l.match(f))?p[1]==="transparent"?[0,0,0,0]:e.call(r,p[1])?(v=r[p[1]],v[3]=1,v):null:null;for(g=0;g<3;g++)v[g]=s(v[g],0,255);return v[3]=s(v[3],0,1),v},a.get.hsl=function(l){if(!l)return null;var u=/^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*)?\)$/,c=l.match(u);if(c){var h=parseFloat(c[4]),d=(parseFloat(c[1])%360+360)%360,f=s(parseFloat(c[2]),0,100),v=s(parseFloat(c[3]),0,100),p=s(isNaN(h)?1:h,0,1);return[d,f,v,p]}return null},a.get.hwb=function(l){if(!l)return null;var u=/^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*)?\)$/,c=l.match(u);if(c){var h=parseFloat(c[4]),d=(parseFloat(c[1])%360+360)%360,f=s(parseFloat(c[2]),0,100),v=s(parseFloat(c[3]),0,100),p=s(isNaN(h)?1:h,0,1);return[d,f,v,p]}return null},a.to.hex=function(){var l=t(arguments);return"#"+o(l[0])+o(l[1])+o(l[2])+(l[3]<1?o(Math.round(l[3]*255)):"")},a.to.rgb=function(){var l=t(arguments);return l.length<4||l[3]===1?"rgb("+Math.round(l[0])+", "+Math.round(l[1])+", "+Math.round(l[2])+")":"rgba("+Math.round(l[0])+", "+Math.round(l[1])+", "+Math.round(l[2])+", "+l[3]+")"},a.to.rgb.percent=function(){var l=t(arguments),u=Math.round(l[0]/255*100),c=Math.round(l[1]/255*100),h=Math.round(l[2]/255*100);return l.length<4||l[3]===1?"rgb("+u+"%, "+c+"%, "+h+"%)":"rgba("+u+"%, "+c+"%, "+h+"%, "+l[3]+")"},a.to.hsl=function(){var l=t(arguments);return l.length<4||l[3]===1?"hsl("+l[0]+", "+l[1]+"%, "+l[2]+"%)":"hsla("+l[0]+", "+l[1]+"%, "+l[2]+"%, "+l[3]+")"},a.to.hwb=function(){var l=t(arguments),u="";return l.length>=4&&l[3]!==1&&(u=", "+l[3]),"hwb("+l[0]+", "+l[1]+"%, "+l[2]+"%"+u+")"},a.to.keyword=function(l){return n[l.slice(0,3)]};function s(l,u,c){return Math.min(Math.max(u,l),c)}function o(l){var u=Math.round(l).toString(16).toUpperCase();return u.length<2?"0"+u:u}return my.exports}var KV=XV();const ZV=Go(KV);function Ey(r,t,e){let n=e;return n<0&&(n+=1),n>1&&(n-=1),n<1/6?r+(t-r)*6*n:n<1/2?t:n<2/3?r+(t-r)*(2/3-n)*6:r}function JV(r){const t=r[0]/360,e=r[1]/100,n=r[2]/100,i=r[3];if(e===0)return[n*255,n*255,n*255,i];const a=n<.5?n*(1+e):n+e-n*e,s=2*n-a,o=Ey(s,a,t+1/3),l=Ey(s,a,t),u=Ey(s,a,t-1/3);return[o*255,l*255,u*255,i]}function Ik(r){const t=ZV.get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?JV(n):null}const lc=(r,t)=>e=>r*(1-e)+t*e,QV=(r,t)=>{const e=Ik(r),n=Ik(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let c=0;c<4;c+=1){const h=e[c],d=n[c];a[c]=h*(1-i)+d*i}const[s,o,l,u]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(l)}, ${u})`}},tU=(r,t)=>typeof r=="number"&&typeof t=="number"?lc(r,t):typeof r=="string"&&typeof t=="string"?QV(r,t):()=>r,eU=(r,t)=>{const e=lc(r,t);return n=>Math.round(e(n))};function Dk({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):e}function nU({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):(r.set(n,e),e)}function rU({map:r,initKey:t},e){const n=t(e);return r.has(n)&&(e=r.get(n),r.delete(n)),e}function iU(r){return typeof r=="object"?r.valueOf():r}class Bk extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=iU,t!==null)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(Dk({map:this.map,initKey:this.initKey},t))}has(t){return super.has(Dk({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(nU({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(rU({map:this.map,initKey:this.initKey},t))}}class iC{constructor(t){this.options=Bn({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=Bn({},this.options,t),this.rescale(t)}rescale(t){}}const Z1=Symbol("defaultUnknown");function Fk(r,t,e){for(let n=0;n<t.length;n+=1)r.has(t[n])||r.set(e(t[n]),n)}function zk(r){const{value:t,from:e,to:n,mapper:i,notFoundReturn:a}=r;let s=i.get(t);if(s===void 0){if(a!==Z1)return a;s=e.push(t)-1,i.set(t,s)}return n[s%n.length]}function jk(r){return r instanceof Date?t=>`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class J1 extends iC{getDefaultOptions(){return{domain:[],range:[],unknown:Z1}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&Fk(this.domainIndexMap,this.getDomain(),this.domainKey),zk({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&Fk(this.rangeIndexMap,this.getRange(),this.rangeKey),zk({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){const[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=jk(e),this.rangeKey=jk(n),!this.rangeIndexMap){this.rangeIndexMap=new Map,this.domainIndexMap=new Map;return}(!t||t.range)&&this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new J1(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function aU(r){const t=Math.min(...r);return r.map(e=>e/t)}function sU(r,t){const e=r.length,n=t-e;return n>0?[...r,...new Array(n).fill(1)]:n<0?r.slice(0,t):r}function oU(r){return Math.round(r*1e12)/1e12}function lU(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,l=t.length,u=sU(a,l),[c,h]=e,d=h-c,f=2/l*n+1-1/l*i,v=d/f,p=v*i/l,g=v-l*p,y=aU(u),m=y.reduce((L,B)=>L+B),w=g/m,E=new Bk(t.map((L,B)=>{const G=y[B]*w;return[L,s?Math.floor(G):G]})),_=new Bk(t.map((L,B)=>{const V=y[B]*w+p;return[L,s?Math.floor(V):V]})),k=Array.from(_.values()).reduce((L,B)=>L+B),O=(d-(k-k/l*i))*o,P=c+O;let N=s?Math.round(P):P;const C=new Array(l);for(let L=0;L<l;L+=1){C[L]=oU(N);const B=t[L];N+=_.get(B)}return{valueBandWidth:E,valueStep:_,adjustedRange:C}}function uU(r){var t;const{domain:e}=r,n=e.length;if(n===0)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(!!(!((t=r.flex)===null||t===void 0)&&t.length))return lU(r);const{range:a,paddingOuter:s,paddingInner:o,round:l,align:u}=r;let c,h,d=a[0];const v=a[1]-d,p=s*2,g=n-o;c=v/Math.max(1,p+g),l&&(c=Math.floor(c)),d+=(v-c*(n-o))*u,h=c*(1-o),l&&(d=Math.round(d),h=Math.round(h));const y=new Array(n).fill(0).map((m,w)=>d+w*c);return{valueStep:c,valueBandWidth:h,adjustedRange:y}}class Q1 extends J1{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:Z1,flex:[]}}constructor(t){super(t)}clone(){return new Q1(this.options)}getStep(t){return this.valueStep===void 0?1:typeof this.valueStep=="number"?this.valueStep:t===void 0?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return this.valueBandWidth===void 0?1:typeof this.valueBandWidth=="number"?this.valueBandWidth:t===void 0?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:i,flex:a}=this.options,{adjustedRange:s,valueBandWidth:o,valueStep:l}=uU({align:t,range:n,round:i,flex:a,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=l,this.valueBandWidth=o,this.adjustedRange=s}}const cU=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=Mu(a,s,e);if(o===0||!Number.isFinite(o))return[];if(o>0){a=Math.ceil(a/o),s=Math.floor(s/o),i=new Array(n=Math.ceil(s-a+1));for(let l=0;l<n;l+=1)i[l]=(a+l)*o}else{o=-o,a=Math.ceil(a*o),s=Math.floor(s*o),i=new Array(n=Math.ceil(s-a+1));for(let l=0;l<n;l+=1)i[l]=(a+l)/o}return i},hU=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,l;return n<i?(o=Am(n,i),l=e(a,s)):(o=Am(i,n),l=e(s,a)),oc(l,o)},dU=(r,t,e)=>{const n=Math.min(r.length,t.length)-1,i=new Array(n),a=new Array(n),s=r[0]>r[n],o=s?[...r].reverse():r,l=s?[...t].reverse():t;for(let u=0;u<n;u+=1)i[u]=Am(o[u],o[u+1]),a[u]=e(l[u],l[u+1]);return u=>{const c=WV(r,u,1,n)-1,h=i[c],d=a[c];return oc(d,h)(u)}},qk=(r,t,e,n)=>(Math.min(r.length,t.length)>2?dU:hU)(r,t,n?eU:e);class fU extends iC{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:lc,tickCount:5}}map(t){return Pk(t)?this.output(t):this.options.unknown}invert(t){return Pk(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...i]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...i)}getTicks(){const{tickMethod:t}=this.options,[e,n,i,...a]=this.getTickMethodOptions();return t(e,n,i,...a)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options,n=t[0],i=t[t.length-1];return[n,i,e]}chooseNice(){return VV}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,i=this.options.domain.map(t),a=Math.min(i.length,n.length);return e?GV(i[0],i[a-1]):Fy}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=qk(n.map(t),i,s,a);this.output=oc(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=qk(a,i.map(t),lc);this.input=oc(e,n,s)}}class So extends fU{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:tU,tickMethod:cU,tickCount:5}}chooseTransforms(){return[Fy,Fy]}clone(){return new So(this.options)}}var gU=function(r){Yt(t,r);function t(e){var n=this,i=e.style,a=je(e,["style"]);return n=r.call(this,Bn({},{type:"column"},ut({style:i},a)))||this,n.columnsGroup=new on({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.columns,i=e.x,a=e.y;this.columnsGroup.style.transform="translate(".concat(i,", ").concat(a,")"),Tt(this.columnsGroup).selectAll(".column").data(n.flat()).join(function(s){return s.append("rect").attr("className","column").each(function(o){this.attr(o)})},function(s){return s.each(function(o){this.attr(o)})},function(s){return s.remove()})},t.prototype.update=function(e){this.attr(fn({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(be),vU=function(r){Yt(t,r);function t(e){var n=this,i=e.style,a=je(e,["style"]);return n=r.call(this,Bn({},{type:"lines"},ut({style:i},a)))||this,n.linesGroup=n.appendChild(new on),n.areasGroup=n.appendChild(new on),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.lines,i=e.areas,a=e.x,s=e.y;this.style.transform="translate(".concat(a,", ").concat(s,")"),n&&this.renderLines(n),i&&this.renderAreas(i)},t.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},t.prototype.update=function(e){this.attr(fn({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){Tt(this.linesGroup).selectAll(".line").data(e).join(function(n){return n.append("path").attr("className","line").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.attr(i)})},function(n){return n.remove()})},t.prototype.renderAreas=function(e){Tt(this.linesGroup).selectAll(".area").data(e).join(function(n){return n.append("path").attr("className","area").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.style(i)})},function(n){return n.remove()})},t}(be);function pU(r,t){var e,n=t.x,i=t.y,a=q(i.getOptions().range||[0,0],2),s=a[0],o=a[1];return o>s&&(e=q([s,o],2),o=e[0],s=e[1]),r.map(function(l){var u=l.map(function(c,h){return[n.map(h),De(i.map(c),o,s)]});return u})}function jo(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return xt([a===e?"M":"L"],q(i),!1)});return t?n.reverse():n}function uc(r,t){if(t===void 0&&(t=!1),r.length<=2)return jo(r);for(var e=[],n=r.length,i=0;i<n;i+=1){var a=t?r[n-i-1]:r[i];Be(a,e.slice(-2))||e.push.apply(e,xt([],q(a),!1))}var s=oV(e);return t?s.unshift(xt(["M"],q(r[n-1]),!1)):s.unshift(xt(["M"],q(r[0]),!1)),s}function tb(r,t,e){var n=ea(r);return n.push(["L",t,e],["L",0,e],["Z"]),n}function yU(r,t,e,n){return r.map(function(i){return tb(t?uc(i):jo(i),e,n)})}function mU(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=jo(a),o=void 0;if(i===0)o=tb(s,t,e);else{var l=r[i-1],u=jo(l,!0);u[0][0]="L",o=xt(xt(xt([],q(s),!1),q(u),!1),[["Z"]],!1)}n.push(o)}return n}function bU(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=uc(a),o=void 0;if(i===0)o=tb(s,t,e);else{var l=r[i-1],u=uc(l,!0),c=a[0];u[0][0]="L",o=xt(xt(xt([],q(s),!1),q(u),!1),[xt(["M"],q(c),!1),["Z"]],!1)}n.push(o)}return n}function $k(r){return r.length===0?[0,0]:[Cu(b3(r,function(t){return Cu(t)||0})),Nu(m3(r,function(t){return Nu(t)||0}))]}function Gk(r){for(var t=ea(r),e=t[0].length,n=q([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s<t.length;s+=1)for(var o=t[s],l=0;l<e;l+=1)o[l]>=0?(o[l]+=i[l],i[l]=o[l]):(o[l]+=a[l],a[l]=o[l]);return t}var wU=function(r){Yt(t,r);function t(e){return r.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Object.defineProperty(t.prototype,"rawData",{get:function(){var e=this.attributes.data;if(!e||(e==null?void 0:e.length)===0)return[[]];var n=ea(e);return St(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?Gk(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseline",{get:function(){var e=this.scales.y,n=q(e.getOptions().domain||[0,0],2),i=n[0],a=n[1];return a<0?e.map(a):e.map(i<0?0:i)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"containerShape",{get:function(){var e=this.attributes,n=e.width,i=e.height;return{width:n,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linesStyle",{get:function(){var e=this,n=this.attributes,i=n.type,a=n.isStack,s=n.smooth;if(i!=="line")throw new Error("linesStyle can only be used in line type");var o=Ft(this.attributes,"area"),l=Ft(this.attributes,"line"),u=this.containerShape.width,c=this.data;if(c[0].length===0)return{lines:[],areas:[]};var h=this.scales,d=h.x,f=h.y,v=pU(c,{x:d,y:f}),p=[];if(o){var g=this.baseline;a?p=s?bU(v,u,g):mU(v,u,g):p=yU(v,s,u,g)}return{lines:v.map(function(y,m){return ut({stroke:e.getColor(m),d:s?uc(y):jo(y)},l)}),areas:p.map(function(y,m){return ut({d:y,fill:e.getColor(m)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=Ft(this.attributes,"column"),i=this.attributes,a=i.isStack,s=i.type,o=i.scale;if(s!=="column")throw new Error("columnsStyle can only be used in column type");var l=this.containerShape.height,u=this.rawData;if(!u)return{columns:[]};a&&(u=Gk(u));var c=this.createScales(u),h=c.x,d=c.y,f=q($k(u),2),v=f[0],p=f[1],g=new So({domain:[0,p-(v>0?0:v)],range:[0,l*o]}),y=h.getBandWidth(),m=this.rawData;return{columns:u.map(function(w,E){return w.map(function(_,k){var T=y/u.length,O=function(){return{x:h.map(k)+T*E,y:_>=0?d.map(_):d.map(0),width:T,height:g.map(Math.abs(_))}},P=function(){return{x:h.map(k),y:d.map(_),width:y,height:g.map(m[E][k])}};return ut(ut({fill:e.getColor(E)},n),a?P():O())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){gV(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),l=ut({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);Tt(n).selectAll(".spark").data([i]).join(function(u){return u.append(function(c){return c==="line"?new vU({className:o,style:l}):new gU({className:o,style:l})}).attr("className","spark ".concat(o))},function(u){return u.update(l)},function(u){return u.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return lr(n)?n[e%n.length]:Ot(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,l=a.range,u=l===void 0?[]:l,c=a.spacing,h=this.containerShape,d=h.width,f=h.height,v=q($k(e),2),p=v[0],g=v[1],y=new So({domain:[(n=u[0])!==null&&n!==void 0?n:p,(i=u[1])!==null&&i!==void 0?i:g],range:[f,f*(1-o)]});return s==="line"?{type:s,x:new So({domain:[0,e[0].length-1],range:[0,d]}),y}:{type:s,x:new Q1({domain:e[0].map(function(m,w){return w}),range:[0,d],paddingInner:c,paddingOuter:c/2,align:.5}),y}},t.tag="sparkline",t}(qe);function xU(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function Wk(r){if(!r)return{enter:!1,update:!1,exit:!1};var t=["enter","update","exit"],e=Object.fromEntries(Object.entries(r).filter(function(n){var i=q(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return xU(r)?r[n]===!1?[n,!1]:[n,ut(ut({},r[n]),e)]:[n,e]}))}function Ws(r,t){r?r.finished.then(t):t()}function EU(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function aC(r,t){"update"in r?r.update(t):r.attr(t)}function sC(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return aC(r,{style:n}),null}return r.animate(t,e)}function SU(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function _U(r,t,e,n){if(n===void 0&&(n="destroy"),SU(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&Rr(r),t.isVisible()&&hl(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,l=o===void 0?0:o,u=Math.ceil(+s/2),c=+s/4,h=q(r.getGeometryBounds().center,2),d=h[0],f=h[1],v=q(t.getGeometryBounds().center,2),p=v[0],g=v[1],y=q([(d+p)/2-d,(f+g)/2-f],2),m=y[0],w=y[1],E=r.style.opacity,_=E===void 0?1:E,k=t.style.opacity,T=k===void 0?1:k,O=r.style.transform||"",P=t.style.transform||"",N=r.animate([{opacity:_,transform:"translate(0, 0) ".concat(O)},{opacity:0,transform:"translate(".concat(m,", ").concat(w,") ").concat(O)}],ut(ut({fill:"both"},e),{duration:l+u+c})),C=t.animate([{opacity:0,transform:"translate(".concat(-m,", ").concat(-w,") ").concat(P),offset:.01},{opacity:T,transform:"translate(0, 0) ".concat(P)}],ut(ut({fill:"both"},e),{duration:u+c,delay:l+u-c}));return Ws(C,i),[N,C]}function Lr(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=q(a,2),o=s[0],l=s[1];if(!Rt(l)){var u=r.style[o]||r.parsedStyle[o]||0;u!==l&&(n[o]=u,i[o]=l)}}),e?sC(r,[n,i],ut({fill:"both"},e)):(aC(r,i),null)}function Sh(r,t){return r.style.opacity||(r.style.opacity=1),Lr(r,{opacity:0},t)}var oC={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},lC={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},uC={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},Hr=jr({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),ji=jr({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),MU=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=e.y,s=e.size,o=s===void 0?10:s,l=e.radius,u=l===void 0?o/4:l,c=e.orientation,h=je(e,["x","y","size","radius","orientation"]),d=o,f=d*2.4,v=Tt(n).maybeAppendByClassName(ji.iconRect,"rect").styles(ut(ut({},h),{width:d,height:f,radius:u,x:i-d/2,y:a-f/2,transformOrigin:"center"})),p=i+1/3*d-d/2,g=i+2/3*d-d/2,y=a+1/4*f-f/2,m=a+3/4*f-f/2;v.maybeAppendByClassName("".concat(ji.iconLine,"-1"),"line").styles(ut({x1:p,x2:p,y1:y,y2:m},h)),v.maybeAppendByClassName("".concat(ji.iconLine,"-2"),"line").styles(ut({x1:g,x2:g,y1:y,y2:m},h)),c==="vertical"&&(v.node().style.transform="rotate(90)")},t}(qe),kU=function(r){Yt(t,r);function t(e){return r.call(this,e,uC)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,l=Ft(this.attributes,"label"),u=l.x,c=u===void 0?0:u,h=l.y,d=h===void 0?0:h,f=l.transform,v=l.transformOrigin,p=je(l,["x","y","transform","transformOrigin"]),g=q(Oi(p,[]),2),y=g[0],m=g[1],w=Tt(e).maybeAppendByClassName(ji.labelGroup,"g").styles(m),E=ut(ut({},lC),y),_=E.text,k=je(E,["text"]);or(!!o,w,function(T){n.label=T.maybeAppendByClassName(ji.label,"text").styles(ut(ut({},k),{x:a+c,y:s+d,transform:f,transformOrigin:v,text:"".concat(_)})),n.label.on("mousedown",function(O){O.stopPropagation()}),n.label.on("touchstart",function(O){O.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,l=ut(ut({x:i,y:a,orientation:s},oC),Ft(this.attributes,"icon")),u=this.attributes.iconShape,c=u===void 0?function(){return new MU({style:l})}:u,h=Tt(e).maybeAppendByClassName(ji.iconGroup,"g");h.selectAll(ji.icon.class).data([c]).join(function(d){return d.append(typeof c=="string"?c:function(){return c(o)}).attr("className",ji.icon.name)},function(d){return d.update(l)},function(d){return d.remove()})},t.prototype.render=function(e,n){this.renderIcon(n),this.renderLabel(n)},t}(qe),OU=function(r){Yt(t,r);function t(e){var n=r.call(this,e,ut(ut(ut({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(i){return i.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},fs(uC,"handle")),fs(oC,"handleIcon")),fs(lC,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(wk(a));var s=n.availableSpace,o=s.x,l=s.y,u=n.getBBox(),c=u.x,h=u.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,l])-n.getOrientVal([+c,+h])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(i){var a=n.attributes,s=a.slidable,o=a.brushable,l=a.type;i.stopPropagation();var u=n.getOrientVal(wk(i)),c=u-n.prevPos;if(c){var h=n.getRatio(c);switch(n.target){case"start":s&&n.setValuesOffset(h);break;case"end":s&&n.setValuesOffset(0,h);break;case"selection":s&&n.setValuesOffset(h,h);break;case"track":if(!o)return;n.selectionWidth+=h,l==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break}n.prevPos=u}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(i){var a=n.attributes,s=a.onChange,o=a.type,l=o==="range"?i:i[1],u=o==="range"?n.getValues():n.getValues()[1],c=new He("valuechange",{detail:{oldValue:l,value:u}});n.dispatchEvent(c),s==null||s(u)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Object.defineProperty(t.prototype,"values",{get:function(){return this.attributes.values},set:function(e){this.attributes.values=this.clampValues(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sparklineStyle",{get:function(){var e=this.attributes.orientation;if(e!=="horizontal")return null;var n=Ft(this.attributes,"sparkline");return ut(ut({zIndex:0},this.availableSpace),n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e=this.attributes,n=e.trackLength,i=e.trackSize,a=q(this.getOrientVal([[n,i],[i,n]]),2),s=a[0],o=a[1];return{width:s,height:o}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes;e.x,e.y;var n=e.padding,i=q(En(n),4),a=i[0],s=i[1],o=i[2],l=i[3],u=this.shape,c=u.width,h=u.height;return{x:l,y:a,width:c-(l+s),height:h-(a+o)}},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.values},t.prototype.setValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1),this.attributes.values=e;var i=n===!1?!1:this.attributes.animate;this.updateSelectionArea(i),this.updateHandlesPosition(i)},t.prototype.updateSelectionArea=function(e){var n=this.calcSelectionArea();this.foregroundGroup.selectAll(Hr.selection.class).each(function(i,a){Lr(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&Lr(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&Lr(this.endHandle,this.getHandleStyle("end"),e))},t.prototype.innerSetValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1);var i=this.values,a=this.clampValues(e);this.attributes.values=a,this.setValues(a),n&&this.onValueChange(i)},t.prototype.renderTrack=function(e){var n=this.attributes,i=n.x,a=n.y,s=Ft(this.attributes,"track");this.trackShape=Tt(e).maybeAppendByClassName(Hr.track,"rect").styles(ut(ut({x:i,y:a},this.shape),s))},t.prototype.renderBrushArea=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.brushable;this.brushArea=Tt(e).maybeAppendByClassName(Hr.brushArea,"rect").styles(ut({x:i,y:a,fill:"transparent",cursor:s?"crosshair":"default"},this.shape))},t.prototype.renderSparkline=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.orientation,l=Tt(e).maybeAppendByClassName(Hr.sparklineGroup,"g");or(o==="horizontal",l,function(u){var c=ut(ut({},n.sparklineStyle),{x:a,y:s});u.maybeAppendByClassName(Hr.sparkline,function(){return new wU({style:c})}).update(c)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],l=a?o:[],u=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(Hr.handle.class).data(l.map(function(c){return{type:c}}),function(c){return c.type}).join(function(c){return c.append(function(h){var d=h.type;return new kU({style:e.getHandleStyle(d)})}).each(function(h){var d=h.type;this.attr("class","".concat(Hr.handle.name," ").concat(d,"-handle"));var f="".concat(d,"Handle");u[f]=this,this.addEventListener("pointerdown",u.onDragStart(d))})},function(c){return c.each(function(h){var d=h.type;this.update(u.getHandleStyle(d))})},function(c){return c.each(function(h){var d=h.type,f="".concat(d,"Handle");u[f]=void 0}).remove()})},t.prototype.renderSelection=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.type,o=n.selectionType;this.foregroundGroup=Tt(e).maybeAppendByClassName(Hr.foreground,"g");var l=Ft(this.attributes,"selection"),u=function(h){return h.style("visibility",function(d){return d.show?"visible":"hidden"}).style("cursor",function(d){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles(ut(ut({},l),{transform:"translate(".concat(i,", ").concat(a,")")}))},c=this;this.foregroundGroup.selectAll(Hr.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(h,d){return{style:ut({},h),index:d,show:o==="select"?d===1:d!==1}}),function(h){return h.index}).join(function(h){return h.append("rect").attr("className",Hr.selection.name).call(u).each(function(d,f){var v=this;f===1?(c.selectionShape=Tt(this),this.on("pointerdown",function(p){v.attr("cursor","grabbing"),c.onDragStart("selection")(p)}),c.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),c.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),c.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){v.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){v.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){v.attr("cursor","pointer")})):this.on("pointerdown",c.onDragStart("track"))})},function(h){return h.call(u)},function(h){return h.remove()}),this.updateSelectionArea(!1),this.renderHandles()},t.prototype.render=function(e,n){this.renderTrack(n),this.renderSparkline(n),this.renderBrushArea(n),this.renderSelection(n)},t.prototype.clampValues=function(e,n){var i;n===void 0&&(n=4);var a=q(this.range,2),s=a[0],o=a[1],l=q(this.getValues().map(function(g){return xk(g,n)}),2),u=l[0],c=l[1],h=Array.isArray(e)?e:[u,e!=null?e:c],d=q((h||[u,c]).map(function(g){return xk(g,n)}),2),f=d[0],v=d[1];if(this.attributes.type==="value")return[0,De(v,s,o)];f>v&&(i=q([v,f],2),f=i[0],v=i[1]);var p=v-f;return p>o-s?[s,o]:f<s?u===s&&c===v?[s,v]:[s,p+s]:v>o?c===o&&u===f?[f,o]:[o-p,o]:[f,v]},t.prototype.calcSelectionArea=function(e){var n=q(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,l=s.y,u=s.width,c=s.height;return this.getOrientVal([[{y:l,height:c,x:o,width:i*u},{y:l,height:c,x:i*u+o,width:(a-i)*u},{y:l,height:c,x:a*u,width:(1-a)*u}],[{x:o,width:u,y:l,height:i*c},{x:o,width:u,y:i*c+l,height:(a-i)*c},{x:o,width:u,y:a*c,height:(1-a)*c}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,l=i.height,u=q(this.clampValues(),2),c=u[0],h=u[1],d=e==="start"?-n:n,f=(e==="start"?c:h)*this.getOrientVal([o,l])+d;return{x:a+this.getOrientVal([f,o/2]),y:s+this.getOrientVal([l/2,f])}},t.prototype.inferTextStyle=function(e){var n=this.attributes.orientation;return n==="horizontal"?{}:e==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:e==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},t.prototype.calcHandleText=function(e){var n,i=this.attributes,a=i.type,s=i.orientation,o=i.formatter,l=i.autoFitLabel,u=Ft(this.attributes,"handle"),c=Ft(u,"label"),h=u.spacing,d=this.getHandleSize(),f=this.clampValues(),v=e==="start"?f[0]:f[1],p=o(v),g=new Y1({style:ut(ut(ut({},c),this.inferTextStyle(e)),{text:p})}),y=g.getBBox(),m=y.width,w=y.height;if(g.destroy(),!l){if(a==="value")return{text:p,x:0,y:-w-h};var E=h+d+(s==="horizontal"?m/2:0);return n={text:p},n[s==="horizontal"?"x":"y"]=e==="start"?-E:E,n}var _=0,k=0,T=this.availableSpace,O=T.width,P=T.height,N=this.calcSelectionArea()[1],C=N.x,L=N.y,B=N.width,G=N.height,V=h+d;if(s==="horizontal"){var U=V+m/2;if(e==="start"){var $=C-V-m;_=$>0?-U:U}else{var j=O-C-B-V>m;_=j?U:-U}}else{var Z=V,nt=w+V;e==="start"?k=L-d>w?-nt:Z:k=P-(L+G)-d>w?nt:-Z}return{x:_,y:k,text:p}},t.prototype.getHandleLabelStyle=function(e){var n=Ft(this.attributes,"handleLabel");return ut(ut(ut({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=Ft(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return ut({cursor:i,shape:e,size:a},n)},t.prototype.getHandleStyle=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.showLabel,o=n.showLabelOnInteraction,l=n.orientation,u=this.calcHandlePosition(e),c=u.x,h=u.y,d=this.calcHandleText(e),f=s;return!s&&o&&(this.target?f=!0:f=!1),ut(ut(ut({},fs(this.getHandleIconStyle(),"icon")),fs(ut(ut({},this.getHandleLabelStyle(e)),d),"label")),{transform:"translate(".concat(c+i,", ").concat(h+a,")"),orientation:l,showLabel:f,type:e,zIndex:3})},t.prototype.getHandleSize=function(){var e=this.attributes,n=e.handleIconSize,i=e.width,a=e.height;return n||Math.floor((this.getOrientVal([+a,+i])+4)/2.4)},t.prototype.getOrientVal=function(e){var n=q(e,2),i=n[0],a=n[1],s=this.attributes.orientation;return s==="horizontal"?i:a},t.prototype.setValuesOffset=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var a=this.attributes.type,s=q(this.getValues(),2),o=s[0],l=s[1],u=a==="range"?e:0,c=[o+u,l+n].sort();i?this.setValues(c):this.innerSetValues(c,!0)},t.prototype.getRatio=function(e){var n=this.availableSpace,i=n.width,a=n.height;return e/this.getOrientVal([i,a])},t.prototype.dispatchCustomEvent=function(e,n,i){var a=this;e.on(n,function(s){s.stopPropagation(),a.dispatchEvent(new He(i,{detail:s}))})},t.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var e=this.brushArea;this.dispatchCustomEvent(e,"click","trackClick"),this.dispatchCustomEvent(e,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(e,"pointerleave","trackMouseleave"),e.on("pointerdown",this.onDragStart("track"))},t.prototype.onScroll=function(e){var n=this.attributes.scrollable;if(n){var i=e.deltaX,a=e.deltaY,s=a||i,o=this.getRatio(s);this.setValuesOffset(o,o,!0)}},t.tag="slider",t}(qe),eb={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new rr({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};Bn({},eb,{style:{type:"arc"}});Bn({},eb,{style:{}});var se=jr({mainGroup:"main-group",gridGroup:"grid-group",grid:"grid",lineGroup:"line-group",line:"line",tickGroup:"tick-group",tick:"tick",tickItem:"tick-item",labelGroup:"label-group",label:"label",labelItem:"label-item",titleGroup:"title-group",title:"title",lineFirst:"line-first",lineSecond:"line-second"},"axis"),Cs=jr({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function cC(r){return r.reduce(function(t,e,n){return t.push(xt([n===0?"M":"L"],q(e),!1)),t},[])}function TU(r,t,e){var n=t.connect,i=n===void 0?"line":n,a=t.center;if(i==="line")return cC(r);if(!a)return[];var s=zo(r[0],a),o=e?0:1;return r.reduce(function(l,u,c){return c===0?l.push(xt(["M"],q(u),!1)):l.push(xt(["A",s,s,0,0,o],q(u),!1)),l},[])}function Pm(r,t,e){return t.type==="surround"?TU(r,t,e):cC(r)}function AU(r,t,e){var n=e.type,i=e.connect,a=e.center,s=e.closed,o=s?[["Z"]]:[],l=q([Pm(r,e),Pm(t.slice().reverse(),e,!0)],2),u=l[0],c=l[1],h=q([r[0],t.slice(-1)[0]],2),d=h[0],f=h[1],v=function(m,w){return[u,m,c,w,o].flat()};if(i==="line"||n==="surround")return v([xt(["L"],q(f),!1)],[xt(["L"],q(d),!1)]);if(!a)throw new Error("Arc grid need to specified center");var p=q([zo(f,a),zo(d,a)],2),g=p[0],y=p[1];return v([xt(["A",g,g,0,0,1],q(f),!1),xt(["L"],q(f),!1)],[xt(["A",y,y,0,0,0],q(d),!1),xt(["L"],q(d),!1)])}function PU(r,t,e,n){var i=e.animate,a=e.isBillboard,s=t.map(function(o,l){return{id:o.id||"grid-line-".concat(l),d:Pm(o.points,e)}});return r.selectAll(Cs.line.class).data(s,function(o){return o.id}).join(function(o){return o.append("path").each(function(l,u){var c=xr(Sk(ut({d:l.d},n)),[l,u,s]);this.attr(ut({class:Cs.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},c))})},function(o){return o.transition(function(l,u){var c=xr(Sk(ut({d:l.d},n)),[l,u,s]);return Lr(this,c,i.update)})},function(o){return o.transition(function(){var l=this,u=Sh(this,i.exit);return Ws(u,function(){return l.remove()}),u})}).transitions()}function NU(r,t,e){var n=e.animate,i=e.connect,a=e.areaFill;if(t.length<2||!a||!i)return[];for(var s=Array.isArray(a)?a:[a,"transparent"],o=function(v){return s[v%s.length]},l=[],u=0;u<t.length-1;u++){var c=q([t[u].points,t[u+1].points],2),h=c[0],d=c[1],f=AU(h,d,e);l.push({d:f,fill:o(u)})}return r.selectAll(Cs.region.class).data(l,function(v,p){return p}).join(function(v){return v.append("path").each(function(p,g){var y=xr(p,[p,g,l]);this.attr(y)}).attr("className",Cs.region.name)},function(v){return v.transition(function(p,g){var y=xr(p,[p,g,l]);return Lr(this,y,n.update)})},function(v){return v.transition(function(){var p=this,g=Sh(this,n.exit);return Ws(g,function(){return p.remove()}),g})}).transitions()}function CU(r){var t=r.data,e=t===void 0?[]:t,n=r.closed;return n?e.map(function(i){var a=i.points,s=q(a,1),o=s[0];return ut(ut({},i),{points:xt(xt([],q(a),!1),[o],!1)})}):e}var RU=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){e.type,e.center,e.areaFill,e.closed;var i=je(e,["type","center","areaFill","closed"]),a=CU(e),s=Tt(n).maybeAppendByClassName(Cs.lineGroup,"g"),o=Tt(n).maybeAppendByClassName(Cs.regionGroup,"g"),l=PU(s,a,e,i),u=NU(o,a,e);return xt(xt([],q(l),!1),q(u),!1)},t}(qe);function hC(r,t){return Object.fromEntries(Object.entries(r).map(function(e){var n=q(e,2),i=n[0],a=n[1];return[i,xr(a,t)]}))}function nb(r,t){return t&&Ot(t)?r.filter(t):r}function dC(r,t){var e=t.startAngle,n=t.endAngle;return(n-e)*r+e}function _h(r,t){if(t.type==="linear"){var e=q(t.startPos,2),n=e[0],i=e[1],a=q(t.endPos,2),s=a[0],o=a[1],l=q([s-n,o-i],2),u=l[0],c=l[1];return QN([u,c])}var h=Ns(dC(r,t));return[-Math.sin(h),Math.cos(h)]}function rb(r,t,e){var n=_h(r,e);return aV(n,t!=="positive")}function dl(r,t){return rb(r,t.labelDirection,t)}function LU(r,t){var e=q(t.startPos,2),n=e[0],i=e[1],a=q(t.endPos,2),s=a[0],o=a[1],l=q([s-n,o-i],2),u=l[0],c=l[1];return[n+u*r,i+c*r]}function IU(r,t){var e=t.radius,n=q(t.center,2),i=n[0],a=n[1],s=Ns(dC(r,t));return[i+e*Math.cos(s),a+e*Math.sin(s)]}function Mh(r,t){return t.type==="linear"?LU(r,t):IU(r,t)}function fC(r){return _h(0,r)[1]===0}function gC(r){return _h(0,r)[0]===0}function vC(r,t){return t-r===360}function Vk(r,t,e,n,i){var a=t-r,s=q([i,i],2),o=s[0],l=s[1],u=q([Ns(r),Ns(t)],2),c=u[0],h=u[1],d=function(P){return[e+i*Math.cos(P),n+i*Math.sin(P)]},f=q(d(c),2),v=f[0],p=f[1],g=q(d(h),2),y=g[0],m=g[1];if(vC(r,t)){var w=(h+c)/2,E=q(d(w),2),_=E[0],k=E[1];return[["M",v,p],["A",o,l,0,1,0,_,k],["A",o,l,0,1,0,y,m]]}var T=a>180?1:0,O=r>t?0:1;return"M".concat(v,",").concat(p,",A").concat(o,",").concat(l,",0,").concat(T,",").concat(O,",").concat(y,",").concat(m)}function DU(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return xt(xt([e,n],q(i),!1),[a],!1)}function BU(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius;return r.selectAll(se.line.class).data([{d:Vk.apply(void 0,xt(xt([i,a],q(s),!1),[o],!1))}],function(l,u){return u}).join(function(l){return l.append("path").attr("className",se.line.name).styles(t).styles({d:function(u){return u.d}})},function(l){return l.transition(function(){var u=this,c=iV(this,DU(this),xt(xt([i,a],q(s),!1),[o],!1),n.update);if(c){var h=function(){var d=Rn(u.attributes,"__keyframe_data__");u.style.d=Vk.apply(void 0,xt([],q(d),!1))};c.onframe=h,c.onfinish=h}return c}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function FU(r,t){t.truncRange,t.truncShape,t.lineExtension}function zU(r,t,e){e===void 0&&(e=[0,0]);var n=q([r,t,e],3),i=q(n[0],2),a=i[0],s=i[1],o=q(n[1],2),l=o[0],u=o[1],c=q(n[2],2),h=c[0],d=c[1],f=q([l-a,u-s],2),v=f[0],p=f[1],g=Math.sqrt(Math.pow(v,2)+Math.pow(p,2)),y=q([-h/g,d/g],2),m=y[0],w=y[1];return[m*v,m*p,w*v,w*p]}function Uk(r){var t=q(r,2),e=q(t[0],2),n=e[0],i=e[1],a=q(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function jU(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,l=t.lineExtension,u=q([a,s],2),c=q(u[0],2),h=c[0],d=c[1],f=q(u[1],2),v=f[0],p=f[1],g=q(l?zU(a,s,l):new Array(4).fill(0),4),y=g[0],m=g[1],w=g[2],E=g[3],_=function(j){return r.selectAll(se.line.class).data(j,function(Z,nt){return nt}).join(function(Z){return Z.append("line").attr("className",function(nt){return"".concat(se.line.name," ").concat(nt.className)}).styles(e).transition(function(nt){return Lr(this,Uk(nt.line),!1)})},function(Z){return Z.styles(e).transition(function(nt){var st=nt.line;return Lr(this,Uk(st),n.update)})},function(Z){return Z.remove()}).transitions()};if(!i||!o)return _([{line:[[h+y,d+m],[v+w,p+E]],className:se.line.name}]);var k=q(o,2),T=k[0],O=k[1],P=v-h,N=p-d,C=q([h+P*T,d+N*T],2),L=C[0],B=C[1],G=q([h+P*O,d+N*O],2),V=G[0],U=G[1],$=_([{line:[[h+y,d+m],[L,B]],className:se.lineFirst.name},{line:[[V,U],[v+w,p+E]],className:se.lineSecond.name}]);return FU(r,t),$}function qU(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,l=e.lineArrowSize,u;if(t==="arc"?u=r.select(se.line.class):a?u=r.select(se.lineSecond.class):u=r.select(se.line.class),!i||!s||e.type==="arc"&&vC(e.startAngle,e.endAngle)){var c=u.node();c&&(c.style.markerEnd=void 0);return}var h=ki(s);h.attr(n),X1(h,l),u.style("markerEnd",h).style("markerEndOffset",-o)}function $U(r,t,e){var n=t.type,i,a=Ft(t,"line");return n==="linear"?i=jU(r,t,Ek(a,"arrow"),e):i=BU(r,t,Ek(a,"arrow"),e),qU(r,n,t,a),i}function GU(r,t){return rb(r,t.gridDirection,t)}function pC(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function WU(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=q(Mh(a,t),2),o=s[0],l=s[1],u=q(mi(GU(a,t),e),2),c=u[0],h=u[1];return{id:i,points:[[o,l],[o+c,l+h]]}})}function VU(r,t){var e=t.gridControlAngles,n=pC(t);if(!n)throw new Error("grid center is not provide");if(r.length<2)throw new Error("Invalid grid data");if(!e||e.length===0)throw new Error("Invalid gridControlAngles");var i=q(n,2),a=i[0],s=i[1];return r.map(function(o,l){var u=o.value,c=q(Mh(u,t),2),h=c[0],d=c[1],f=q([h-a,d-s],2),v=f[0],p=f[1],g=[];return e.forEach(function(y){var m=Ns(y),w=q([Math.cos(m),Math.sin(m)],2),E=w[0],_=w[1],k=v*E-p*_+a,T=v*_+p*E+s;g.push([k,T])}),{points:g,id:l}})}function UU(r,t,e,n){var i=Ft(e,"grid"),a=i.type,s=i.areaFill,o=pC(e),l=nb(t,e.gridFilter),u=a==="segment"?WU(l,e):VU(l,e),c=ut(ut({},i),{center:o,areaFill:Ot(s)?l.map(function(h,d){return xr(s,[h,d,l])}):s,animate:n,data:u});return r.selectAll(se.grid.class).data([1]).join(function(h){return h.append(function(){return new RU({style:c})}).attr("className",se.grid.name)},function(h){return h.transition(function(){return this.update(c)})},function(h){return h.remove()}).transitions()}var Nm=function(){function r(t,e,n,i){this.set(t,e,n,i)}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),r.prototype.rotatedPoints=function(t,e,n){var i=this,a=i.x1,s=i.y1,o=i.x2,l=i.y2,u=Math.cos(t),c=Math.sin(t),h=e-e*u+n*c,d=n-e*c-n*u,f=[[u*a-c*l+h,c*a+u*l+d],[u*o-c*l+h,c*o+u*l+d],[u*a-c*s+h,c*a+u*s+d],[u*o-c*s+h,c*o+u*s+d]];return f},r.prototype.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},r.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},r}();function Cm(r,t){var e=r.getEulerAngles()||0;r.setEulerAngles(0);var n=r.getBounds(),i=q(n.min,2),a=i[0],s=i[1],o=q(n.max,2),l=o[0],u=o[1],c=r.getBBox(),h=c.width,d=c.height,f=d,v=0,p=0,g=a,y=s,m=ZN(r);if(m){f-=1.5;var w=m.style.textAlign,E=m.style.textBaseline;w==="center"?g=(a+l)/2:(w==="right"||w==="end")&&(g=l),E==="middle"?y=(s+u)/2:E==="bottom"&&(y=u)}var _=q(En(t),4),k=_[0],T=k===void 0?0:k,O=_[1],P=O===void 0?0:O,N=_[2],C=N===void 0?T:N,L=_[3],B=L===void 0?P:L,G=new Nm((v+=a)-B,(p+=s)-T,v+h+P,p+f+C);return r.setEulerAngles(e),G.rotatedPoints(Ns(e),g,y)}function vo(r,t){return t[0]<=Math.max(r[0][0],r[1][0])&&t[0]<=Math.min(r[0][0],r[1][0])&&t[1]<=Math.max(r[0][1],r[1][1])&&t[1]<=Math.min(r[0][1],r[1][1])}function po(r,t,e){var n=(t[1]-r[1])*(e[0]-t[0])-(t[0]-r[0])*(e[1]-t[1]);return n===0?0:n<0?2:1}function YU(r,t){var e=po(r[0],r[1],t[0]),n=po(r[0],r[1],t[1]),i=po(t[0],t[1],r[0]),a=po(t[0],t[1],r[1]);return!!(e!==n&&i!==a||e===0&&vo(r,t[0])||n===0&&vo(r,t[1])||i===0&&vo(t,r[0])||a===0&&vo(t,r[1]))}function HU(r,t){var e=r.length;if(e<3)return!1;var n=[t,[9999,t[1]]],i=0,a=0;do{var s=[r[a],r[(a+1)%e]];if(YU(s,n)){if(po(s[0],t,s[1])===0)return vo(s,t);i++}a=(a+1)%e}while(a!==0);return!!(i&1)}function XU(r,t){return t.every(function(e){return HU(r,e)})}function KU(r,t,e){var n=r.x1,i=r.x2,a=r.y1,s=r.y2,o=[[n,a],[i,a],[i,s],[n,s]],l=Cm(t,e);return XU(o,l)}function ZU(r,t){var e=q(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=q(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=a-n,f=s-i,v=c-l,p=h-u,g=d*p-v*f;if(g===0)return!1;var y=g>0,m=n-l,w=i-u,E=d*w-f*m;if(E<0===y)return!1;var _=v*w-p*m;return!(_<0===y||E>g===y||_>g===y)}function JU(r,t){var e=[[r[0],r[1],r[2],r[3]],[r[2],r[3],r[4],r[5]],[r[4],r[5],r[6],r[7]],[r[6],r[7],r[0],r[1]]];return e.some(function(n){return ZU(t,n)})}function QU(r,t,e){var n,i,a=Cm(r,e).flat(1),s=Cm(t,e).flat(1),o=[[a[0],a[1],a[2],a[3]],[a[0],a[1],a[4],a[5]],[a[4],a[5],a[6],a[7]],[a[2],a[3],a[6],a[7]]];try{for(var l=Vo(o),u=l.next();!u.done;u=l.next()){var c=u.value;if(JU(s,c))return!0}}catch(h){n={error:h}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return!1}function tY(r,t){var e=r.type,n=r.labelDirection,i=r.crossSize;if(!i)return!1;if(e==="arc"){var a=r.center,s=r.radius,o=q(a,2),l=o[0],u=o[1],c=n==="negative"?0:i,h=-s-c,d=s+c,f=q(En(t),4),v=f[0],p=f[1],g=f[2],y=f[3];return new Nm(l+h-y,u+h-v,l+d+p,u+d+g)}var m=q(r.startPos,2),w=m[0],E=m[1],_=q(r.endPos,2),k=_[0],T=_[1],O=q(gC(r)?[-t,0,t,0]:[0,t,0,-t],4),P=O[0],N=O[1],C=O[2],L=O[3],B=dl(0,r),G=mi(B,i),V=new Nm(w,E,k,T);return V.x1+=L,V.y1+=P,V.x2+=N+G[0],V.y2+=C+G[1],V}function kh(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,l=tY(t,a),u=function(v){return l?KU(l,v):!0},c=function(v,p){return!v||!v.firstChild?!0:!QU(v.firstChild,p.firstChild,En(e))};try{for(var h=Vo(r),d=h.next();!d.done;d=h.next()){var f=d.value;u(f)?!o||c(o,f)?o=f:(s.add(o),s.add(f)):s.add(f)}}catch(v){n={error:v}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return Array.from(s)}function Sy(r,t){return t===void 0&&(t={}),Rt(r)?0:typeof r=="number"?r:Math.floor(J7(r,t))}function eY(r,t,e,n){if(!(r.length<=1)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,l=o===void 0?1/0:o,u=t.step,c=u===void 0?" ":u,h=t.margin,d=h===void 0?[0,0,0,0]:h,f=KN(n.getTextShape(r[0])),v=Sy(c,f),p=s?Sy(s,f):v,g=Sy(l,f);(Rt(g)||g===1/0)&&(g=Math.max.apply(null,r.map(function(k){return k.getBBox().width})));var y=r.slice(),m=q(d,4);m[0],m[1],m[2],m[3];for(var w=function(k){if(y.forEach(function(T){n.ellipsis(n.getTextShape(T),k,a)}),y=kh(r,e,d),y.length<1)return{value:void 0}},E=g;E>p+v;E-=v){var _=w(E);if(typeof _=="object")return _.value}}}var nY={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(Rr(i),!1):!0})}},rY=function(r){return r.filter(XN)};function iY(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=nY.parity,l=function(w){return w.forEach(n.show),w},u=2,c=r.slice(),h=r.slice(),d=Math.min.apply(Math,xt([1],q(r.map(function(w){return w.getBBox().width})),!1));if(e.type==="linear"&&(fC(e)||gC(e))){var f=_k(r[0]).left,v=_k(r[i-1]).right,p=Math.abs(v-f)||1;u=Math.max(Math.floor(i*d/p),u)}var g,y;for(a&&(g=c.splice(0,1)[0]),s&&(y=c.splice(-1,1)[0],c.reverse()),l(c);u<r.length&&kh(rY(y?xt(xt([y],q(h),!1),[g],!1):xt([g],q(h),!1)),e,t==null?void 0:t.margin).length;){if(y&&!g&&u%2===0){var m=c.splice(0,1);m.forEach(n.hide)}else if(y&&g){var m=c.splice(0,1);m.forEach(n.hide)}h=o(l(c),{seq:u}),u++}}}function aY(r,t,e,n){var i,a,s=t.optionalAngles,o=s===void 0?[0,45,90]:s,l=t.margin,u=t.recoverWhenFailed,c=u===void 0?!0:u,h=r.map(function(y){return y.getLocalEulerAngles()}),d=function(){return kh(r,e,l).length<1},f=function(y){return r.forEach(function(m,w){var E=Array.isArray(y)?y[w]:y;n.rotate(m,+E)})};try{for(var v=Vo(o),p=v.next();!p.done;p=v.next()){var g=p.value;if(f(g),d())return}}catch(y){i={error:y}}finally{try{p&&!p.done&&(a=v.return)&&a.call(v)}finally{if(i)throw i.error}}c&&f(h)}function sY(r){var t=r.type,e=r.labelDirection;return t==="linear"&&fC(r)?e==="negative"?"bottom":"top":"middle"}function oY(r,t,e,n){var i=t.wordWrapWidth,a=i===void 0?50:i,s=t.maxLines,o=s===void 0?3:s,l=t.recoverWhenFailed,u=l===void 0?!0:l,c=t.margin,h=c===void 0?[0,0,0,0]:c,d=r.map(function(m){return m.attr("maxLines")||1}),f=Math.min.apply(Math,xt([],q(d),!1)),v=function(){return kh(r,e,h).length<1},p=sY(e),g=function(m){return r.forEach(function(w,E){var _=Array.isArray(m)?m[E]:m;n.wrap(w,a,_,p)})};if(!(f>o)){for(var y=f;y<=o;y++)if(g(y),v())return;u&&g(d)}}var lY=new Map([["hide",iY],["rotate",aY],["ellipsis",eY],["wrap",oY]]);function uY(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!K7(r[0]):e==="rotate"?!r.some(function(n){var i;return!!(!((i=n.attr("transform"))===null||i===void 0)&&i.includes("rotate"))}):e==="ellipsis"||e==="wrap"?r.filter(function(n){return n.querySelector("text")}).length>1:!0}function cY(r,t,e){var n=t.labelOverlap,i=n===void 0?[]:n;i.length&&i.forEach(function(a){var s=a.type,o=lY.get(s);uY(r,t,s)&&(o==null||o(r,a,t,e))})}function hY(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=function(n){return n==="positive"?-1:1};return r.reduce(function(n,i){return n*e(i)},1)}function Yk(r){for(var t=r;t<0;)t+=360;return Math.round(t%360)}function Rm(r,t){var e=q(r,2),n=e[0],i=e[1],a=q(t,2),s=a[0],o=a[1],l=q([n*s+i*o,n*o-i*s],2),u=l[0],c=l[1];return Math.atan2(c,u)}function dY(r){var t=(r+360)%180;return yn(t,-90,90)||(t+=180),t}function fY(r,t,e){var n,i=e.labelAlign,a=(n=t.style.transform)===null||n===void 0?void 0:n.includes("rotate");if(a)return t.getLocalEulerAngles();var s=0,o=dl(r.value,e),l=_h(r.value,e);return i==="horizontal"?0:(i==="perpendicular"?s=Rm([1,0],o):s=Rm([l[0]<0?-1:1,0],l),dY(YN(s)))}function yC(r,t,e){var n=e.type,i=e.labelAlign,a=dl(r,e),s=Yk(t),o=Yk(YN(Rm([1,0],a))),l="center",u="middle";return n==="linear"?[90,270].includes(o)&&s===0?(l="center",u=a[1]===1?"top":"bottom"):!(o%180)&&[90,270].includes(s)?l="center":o===0?(yn(s,0,90,!1,!0)||yn(s,0,90)||yn(s,270,360))&&(l="start"):o===90?yn(s,0,90,!1,!0)?l="start":(yn(s,90,180)||yn(s,270,360))&&(l="end"):o===270?yn(s,0,90,!1,!0)?l="end":(yn(s,90,180)||yn(s,270,360))&&(l="start"):o===180&&(s===90?l="start":(yn(s,0,90)||yn(s,270,360))&&(l="end")):i==="parallel"?yn(o,0,180,!0)?u="top":u="bottom":i==="horizontal"?yn(o,90,270,!1)?l="end":(yn(o,270,360,!1)||yn(o,0,90))&&(l="start"):i==="perpendicular"&&(yn(o,90,270)?l="end":l="start"),{textAlign:l,textBaseline:u}}function gY(r,t,e){t.setLocalEulerAngles(r);var n=t.__data__.value,i=yC(n,r,e),a=t.querySelector(se.labelItem.class);a&&mC(a,i)}function Hk(r,t,e){var n=e.showTick,i=e.tickLength,a=e.tickDirection,s=e.labelDirection,o=e.labelSpacing,l=t.indexOf(r),u=xr(o,[r,l,t]),c=q([dl(r.value,e),hY(s,a)],2),h=c[0],d=c[1],f=d===1?xr(n?i:0,[r,l,t]):0,v=q(go(mi(h,u+f),Mh(r.value,e)),2),p=v[0],g=v[1];return{x:p,y:g}}function vY(r,t,e,n){var i=n.labelFormatter,a=Ot(i)?function(){return ki(xr(i,[r,t,e,dl(r.value,n)]))}:function(){return ki(r.label||"")};return a}function mC(r,t){r.nodeName==="text"&&r.attr(t)}function Xk(r){cY(this.node().childNodes,r,{hide:Rr,show:hl,rotate:function(t,e){gY(+e,t,r)},ellipsis:function(t,e,n){t&&Tm(t,e||1/0,n)},wrap:function(t,e,n){t&&Q7(t,e,n)},getTextShape:function(t){return t.querySelector("text")}})}function Kk(r,t,e,n,i){var a=e.indexOf(t),s=Tt(r).append(vY(t,a,e,i)).attr("className",se.labelItem.name).node(),o=q(Oi(hC(n,[t,a,e])),2),l=o[0],u=o[1],c=u.transform,h=je(u,["transform"]);tC(s,c);var d=fY(t,s,i);return s.getLocalEulerAngles()||s.setLocalEulerAngles(d),mC(s,ut(ut({},yC(t.value,d,i)),l)),r.attr(h),s}function pY(r,t,e,n){var i=nb(t,e.labelFilter),a=Ft(e,"label");return r.selectAll(se.label.class).data(i,function(s,o){return o}).join(function(s){return s.append("g").attr("className",se.label.name).transition(function(o){Kk(this,o,t,a,e);var l=Hk(o,t,e),u=l.x,c=l.y;return this.style.transform="translate(".concat(u,", ").concat(c,")"),null}).call(function(){Xk.call(r,e)})},function(s){return s.transition(function(o){var l=this.querySelector(se.labelItem.class),u=Kk(this,o,t,a,e),c=_U(l,u,n.update),h=Hk(o,t,e),d=h.x,f=h.y,v=Lr(this,{transform:"translate(".concat(d,", ").concat(f,")")},n.update);return xt(xt([],q(c),!1),[v],!1)}).call(function(o){var l=Rn(o,"_transitions").flat().filter(XN);EU(l,function(){Xk.call(r,e)})})},function(s){return s.transition(function(){var o=this,l=Sh(this.childNodes[0],n.exit);return Ws(l,function(){return Tt(o).remove()}),l})}).transitions()}function bC(r,t){return rb(r,t.tickDirection,t)}function yY(r,t){var e=q(r,2),n=e[0],i=e[1];return[[0,0],[n*t,i*t]]}function mY(r,t,e,n,i){var a=i.tickLength,s=q(yY(n,xr(a,[r,t,e])),2),o=q(s[0],2),l=o[0],u=o[1],c=q(s[1],2),h=c[0],d=c[1];return{x1:l,x2:h,y1:u,y2:d}}function bY(r,t,e,n,i){var a=i.tickFormatter,s=bC(t.value,i),o="line";return Ot(a)&&(o=function(){return xr(a,[t,e,n,s])}),r.append(o).attr("className",se.tickItem.name)}function wY(r,t,e,n,i,a,s){var o=bC(r.value,a),l=mY(r,t,e,o,a),u=l.x1,c=l.x2,h=l.y1,d=l.y2,f=q(Oi(hC(s,[r,t,e,o])),2),v=f[0],p=f[1];n.node().nodeName==="line"&&n.styles(ut({x1:u,x2:c,y1:h,y2:d},v)),i.attr(p),n.styles(v)}function Zk(r,t,e,n,i,a){var s=bY(Tt(this),r,t,e,n);wY(r,t,e,s,this,n,i);var o=q(Mh(r.value,n),2),l=o[0],u=o[1];return Lr(this,{transform:"translate(".concat(l,", ").concat(u,")")},a)}function xY(r,t,e,n){var i=nb(t,e.tickFilter),a=Ft(e,"tick");return r.selectAll(se.tick.class).data(i,function(s){return s.id||s.label}).join(function(s){return s.append("g").attr("className",se.tick.name).transition(function(o,l){return Zk.call(this,o,l,i,e,a,!1)})},function(s){return s.transition(function(o,l){return this.removeChildren(),Zk.call(this,o,l,i,e,a,n.update)})},function(s){return s.transition(function(){var o=this,l=Sh(this.childNodes[0],n.exit);return Ws(l,function(){return o.remove()}),l})}).transitions()}var Jk=jr({text:"text"},"title");function Oh(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function EY(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),l=t.getBBox(),u=Oh(n),c=q(En(s?i:0),4),h=c[0],d=c[1],f=c[2],v=c[3],p=q(En(a),4),g=p[0],y=p[1],m=p[2],w=p[3],E=q([v+d,h+f],2),_=E[0],k=E[1],T=q([w+y,g+m],2),O=T[0],P=T[1];if(u[0]==="l")return new Dn(o.x,o.y,l.width+o.width+_+O,Math.max(l.height+P,o.height));if(u[0]==="t")return new Dn(o.x,o.y,Math.max(l.width+O,o.width),l.height+o.height+k+P);var N=q([t.attributes.width||l.width,t.attributes.height||l.height],2),C=N[0],L=N[1];return new Dn(l.x,l.y,C+o.width+_+O,L+o.height+k+P)}function SY(r,t){var e=Object.entries(t).reduce(function(n,i){var a=q(i,2),s=a[0],o=a[1],l=r.node().attr(s);return l||(n[s]=o),n},{});r.styles(e)}function _Y(r){var t,e,n,i,a=r,s=a.width,o=a.height,l=a.position,u=q([+s/2,+o/2],2),c=u[0],h=u[1],d=q([+c,+h,"center","middle"],4),f=d[0],v=d[1],p=d[2],g=d[3],y=Oh(l);return y.includes("l")&&(t=q([0,"start"],2),f=t[0],p=t[1]),y.includes("r")&&(e=q([+s,"end"],2),f=e[0],p=e[1]),y.includes("t")&&(n=q([0,"top"],2),v=n[0],g=n[1]),y.includes("b")&&(i=q([+o,"bottom"],2),v=i[0],g=i[1]),{x:f,y:v,textAlign:p,textBaseline:g}}var MY=function(r){Yt(t,r);function t(e){return r.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return t.prototype.getAvailableSpace=function(){var e=this,n=this.attributes,i=n.width,a=n.height,s=n.position,o=n.spacing,l=n.inset,u=e.querySelector(Jk.text.class);if(!u)return new Dn(0,0,+i,+a);var c=u.getBBox(),h=c.width,d=c.height,f=q(En(o),4),v=f[0],p=f[1],g=f[2],y=f[3],m=q([0,0,+i,+a],4),w=m[0],E=m[1],_=m[2],k=m[3],T=Oh(s);if(T.includes("i"))return new Dn(w,E,_,k);T.forEach(function(U,$){var j,Z,nt,st;U==="t"&&(j=q($===0?[d+g,+a-d-g]:[0,+a],2),E=j[0],k=j[1]),U==="r"&&(Z=q([+i-h-y],1),_=Z[0]),U==="b"&&(nt=q([+a-d-v],1),k=nt[0]),U==="l"&&(st=q($===0?[h+p,+i-h-p]:[0,+i],2),w=st[0],_=st[1])});var O=q(En(l),4),P=O[0],N=O[1],C=O[2],L=O[3],B=q([L+N,P+C],2),G=B[0],V=B[1];return new Dn(w+L,E+P,_-G,k-V)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new Dn(0,0,0,0)},t.prototype.render=function(e,n){var i=this;e.width,e.height,e.position,e.spacing;var a=je(e,["width","height","position","spacing"]),s=q(Oi(a),1),o=s[0],l=_Y(e),u=l.x,c=l.y,h=l.textAlign,d=l.textBaseline;or(!!a.text,Tt(n),function(f){i.title=f.maybeAppendByClassName(Jk.text,"text").styles(o).call(SY,{x:u,y:c,textAlign:h,textBaseline:d}).node()})},t}(qe);function kY(r,t,e){var n=e.titlePosition,i=n===void 0?"lb":n,a=e.titleSpacing,s=Oh(i),o=r.node().getLocalBounds(),l=q(o.min,2),u=l[0],c=l[1],h=q(o.halfExtents,2),d=h[0],f=h[1],v=q(t.node().getLocalBounds().halfExtents,2),p=v[0],g=v[1],y=q([u+d,c+f],2),m=y[0],w=y[1],E=q(En(a),4),_=E[0],k=E[1],T=E[2],O=E[3];if(["start","end"].includes(i)&&e.type==="linear"){var P=e.startPos,N=e.endPos,C=q(i==="start"?[P,N]:[N,P],2),L=C[0],B=C[1],G=QN([-B[0]+L[0],-B[1]+L[1]]),V=q(mi(G,_),2),U=V[0],$=V[1];return{x:L[0]+U,y:L[1]+$}}return s.includes("t")&&(w-=f+g+_),s.includes("r")&&(m+=d+p+k),s.includes("l")&&(m-=d+p+O),s.includes("b")&&(w+=f+g+T),{x:m,y:w}}function OY(r,t,e){var n=r.getGeometryBounds().halfExtents,i=n[1]*2;if(t==="vertical"){if(e==="left")return"rotate(-90) translate(0, ".concat(i/2,")");if(e==="right")return"rotate(-90) translate(0, -".concat(i/2,")")}return""}function Qk(r,t,e,n,i){var a=Ft(n,"title"),s=q(Oi(a),2),o=s[0],l=s[1],u=l.transform,c=l.transformOrigin,h=je(l,["transform","transformOrigin"]);t.styles(h);var d=u||OY(r.node(),o.direction,o.position);r.styles(ut(ut({},o),{transformOrigin:c})),tC(r.node(),d);var f=kY(Tt(e._offscreen||e.querySelector(se.mainGroup.class)),t,n),v=f.x,p=f.y,g=Lr(t.node(),{transform:"translate(".concat(v,", ").concat(p,")")},i);return g}function TY(r,t,e,n){var i=e.titleText;return r.selectAll(se.title.class).data([{title:i}].filter(function(a){return!!a.title}),function(a,s){return a.title}).join(function(a){return a.append(function(){return ki(i)}).attr("className",se.title.name).transition(function(){return Qk(Tt(this),r,t,e,n.enter)})},function(a){return a.transition(function(){return Qk(Tt(this),r,t,e,n.update)})},function(a){return a.remove()}).transitions()}function tO(r,t,e,n){var i=r.showLine,a=r.showTick,s=r.showLabel,o=t.maybeAppendByClassName(se.lineGroup,"g"),l=or(i,o,function(f){return $U(f,r,n)})||[],u=t.maybeAppendByClassName(se.tickGroup,"g"),c=or(a,u,function(f){return xY(f,e,r,n)})||[],h=t.maybeAppendByClassName(se.labelGroup,"g"),d=or(s,h,function(f){return pY(f,e,r,n)})||[];return xt(xt(xt([],q(l),!1),q(c),!1),q(d),!1).filter(function(f){return!!f})}var AY=function(r){Yt(t,r);function t(e){return r.call(this,e,eb)||this}return t.prototype.render=function(e,n,i){var a=this,s=e.titleText,o=e.data,l=e.animate,u=e.showTitle,c=e.showGrid,h=e.dataThreshold,d=e.truncRange,f=cV(o,h).filter(function(_){var k=_.value;return!(d&&k>d[0]&&k<d[1])}),v=Wk(i===void 0?l:i),p=Tt(n).maybeAppendByClassName(se.gridGroup,"g"),g=or(c,p,function(_){return UU(_,f,e,v)})||[],y=Tt(n).maybeAppendByClassName(se.mainGroup,"g");s&&(!this.initialized&&v.enter||this.initialized&&v.update)&&tO(e,Tt(this.offscreenGroup),f,Wk(!1));var m=tO(e,Tt(y.node()),f,v),w=Tt(n).maybeAppendByClassName(se.titleGroup,"g"),E=or(u,w,function(_){return TY(_,a,e,v)})||[];return xt(xt(xt([],q(g),!1),q(m),!1),q(E),!1).flat().filter(function(_){return!!_})},t}(qe),yr=jr({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),PY=function(r){Yt(t,r);function t(e){var n=r.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:jV(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(i,a){return"".concat(i,"/").concat(a)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new on({class:yr.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new on({class:yr.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return De(e,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageShape",{get:function(){var e=this.pageViews,n=q(xV(e.map(function(h){var d=h.getBBox(),f=d.width,v=d.height;return[f,v]})).map(function(h){return Math.max.apply(Math,xt([],q(h),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,l=o===void 0?i:o,u=s.pageHeight,c=u===void 0?a:u;return{pageWidth:l,pageHeight:c}},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e=r.prototype.getBBox.call(this),n=e.x,i=e.y,a=this.controllerShape,s=this.pageShape,o=s.pageWidth,l=s.pageHeight;return new Dn(n,i,o+a.width,l)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,l=a.playWindow,u=a.pageViews;if(o!=="idle"||e<0||u.length<=0||e>=u.length)return null;u[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var c=q(this.getFollowingPageDiff(e),2),h=c[0],d=c[1];this.playState="running";var f=sC(l,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-h,", ").concat(-d,")")}],i);return Ws(f,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),f},t.prototype.prev=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i<=0)return null;var a=e?(i-1+n)%n:De(i-1,0,n);return this.goTo(a)},t.prototype.next=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i>=n-1)return null;var a=e?(i+1)%n:De(i+1,0,n);return this.goTo(a)},t.prototype.renderClipPath=function(e){var n=this.pageShape,i=n.pageWidth,a=n.pageHeight;if(!i||!a){this.contentGroup.style.clipPath=void 0;return}this.clipPath=e.maybeAppendByClassName(yr.clipPath,"rect").styles({width:i,height:a}),this.contentGroup.attr("clipPath",this.clipPath.node())},t.prototype.setVisiblePages=function(e){this.playWindow.children.forEach(function(n,i){e.includes(i)?hl(n):Rr(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,l=s.controllerPadding,u=a.getBBox(),c=u.width;u.height;var h=q(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],f=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(f);var v=n.getBBox(),p=v.width,g=v.height,y=i.getBBox(),m=y.width,w=y.height,E=Math.max(p,c,m),_=o==="horizontal"?{offset:[[0,0],[p/2+l,0],[p+c+l*2,0]],textAlign:"start"}:{offset:[[E/2,-g-l],[E/2,0],[E/2,w+l]],textAlign:"center"},k=q(_.offset,3),T=q(k[0],2),O=T[0],P=T[1],N=q(k[1],2),C=N[0],L=N[1],B=q(k[2],2),G=B[0],V=B[1],U=_.textAlign,$=a.querySelector("text");$&&($.style.textAlign=U),n.setLocalPosition(O,P),a.setLocalPosition(C,L),i.setLocalPosition(G,V)},t.prototype.updatePageInfo=function(){var e,n=this,i=n.currPage,a=n.pageViews,s=n.attributes.formatter;a.length<2||((e=this.pageInfoGroup.querySelector(yr.pageInfo.class))===null||e===void 0||e.attr("text",s(i+1,a.length)),this.adjustControllerLayout())},t.prototype.getFollowingPageDiff=function(e){var n=this.currPage;if(n===e)return[0,0];var i=this.attributes.orientation,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=e<n?-1:1;return i==="horizontal"?[l*s,0]:[0,l*o]},t.prototype.prepareFollowingPage=function(e){var n=this,i=n.currPage,a=n.pageViews;if(this.setVisiblePages([e,i]),e!==i){var s=q(this.getFollowingPageDiff(e),2),o=s[0],l=s[1];a[e].setLocalPosition(o,l)}},t.prototype.renderController=function(e){var n=this,i=this.attributes.controllerSpacing,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=this.pageViews.length>=2,u=e.maybeAppendByClassName(yr.controller,"g");if(Eh(u.node(),l),!!l){var c=Ft(this.attributes,"button"),h=Ft(this.attributes,"pageNum"),d=q(Oi(c),2),f=d[0],v=d[1],p=f.size,g=je(f,["size"]),y=!u.select(yr.prevBtnGroup.class).node(),m=u.maybeAppendByClassName(yr.prevBtnGroup,"g").styles(v);this.prevBtnGroup=m.node();var w=m.maybeAppendByClassName(yr.prevBtn,"path"),E=u.maybeAppendByClassName(yr.nextBtnGroup,"g").styles(v);this.nextBtnGroup=E.node();var _=E.maybeAppendByClassName(yr.nextBtn,"path");[w,_].forEach(function(T){T.styles(ut(ut({},g),{transformOrigin:"center"})),X1(T.node(),p)});var k=u.maybeAppendByClassName(yr.pageInfoGroup,"g");this.pageInfoGroup=k.node(),k.maybeAppendByClassName(yr.pageInfo,"text").styles(h),this.updatePageInfo(),u.node().setLocalPosition(s+i,o/2),y&&(this.prevBtnGroup.addEventListener("click",function(){n.prev()}),this.nextBtnGroup.addEventListener("click",function(){n.next()}))}},t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s;this.attr("transform","translate(".concat(a,", ").concat(o,")"));var l=Tt(n);this.renderClipPath(l),this.renderController(l),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Wo(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(Ht.INSERTED,n),this.playWindow.addEventListener(Ht.REMOVED,n)},t}(qe);function NY(r,t,e){var n=1.4,i=n*e;return[["M",r-e,t-i],["L",r+e,t-i],["L",r+e,t+i],["L",r-e,t+i],["Z"]]}var wC=1.4,xC=.4;function CY(r,t,e){var n=e,i=n*wC,a=n/2,s=n/6,o=r+i*xC;return[["M",r,t],["L",o,t+a],["L",r+i,t+a],["L",r+i,t-a],["L",o,t-a],["Z"],["M",o,t+s],["L",r+i-2,t+s],["M",o,t-s],["L",r+i-2,t-s]]}function RY(r,t,e){var n=e,i=n*wC,a=n/2,s=n/6,o=t+i*xC;return[["M",r,t],["L",r-a,o],["L",r-a,t+i],["L",r+a,t+i],["L",r+a,o],["Z"],["M",r-s,o],["L",r-s,t+i-2],["M",r+s,o],["L",r+s,t+i-2]]}ue.registerSymbol("hiddenHandle",NY);ue.registerSymbol("verticalHandle",CY);ue.registerSymbol("horizontalHandle",RY);function Lm(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}var Qn=jr({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");function LY(r){var t=r.querySelector(Qn.marker.class);return t?t.style:{}}var IY=function(r){Yt(t,r);function t(e){return r.call(this,e,{span:[1,1],marker:function(){return new Ti({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return Object.defineProperty(t.prototype,"showValue",{get:function(){var e=this.attributes.valueText;return e?typeof e=="string"||typeof e=="number"?e!=="":typeof e=="function"?!0:e.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actualSpace",{get:function(){var e=this.labelGroup,n=this.valueGroup,i=this.attributes.markerSize,a=e.node().getBBox(),s=a.width,o=a.height,l=n.node().getBBox(),u=l.width,c=l.height;return{markerWidth:i,labelWidth:s,valueWidth:u,height:Math.max(i,o,c)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=q(En(e),2),i=n[0],a=n[1],s=this.showValue?a:0,o=i+s;return[i/o,s/o]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e,n=this.attributes,i=n.markerSize,a=n.width,s=this.actualSpace,o=s.markerWidth,l=s.height,u=this.actualSpace,c=u.labelWidth,h=u.valueWidth,d=q(this.spacing,2),f=d[0],v=d[1];if(a){var p=a-i-f-v,g=q(this.span,2),y=g[0],m=g[1];e=q([y*p,m*p],2),c=e[0],h=e[1]}var w=o+c+h+f+v;return{width:w,height:l,markerWidth:o,labelWidth:c,valueWidth:h}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){var e=this.attributes.spacing;if(!e)return[0,0];var n=q(En(e),2),i=n[0],a=n[1];return this.showValue?[i,a]:[i,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){var e=this.shape,n=e.markerWidth,i=e.labelWidth,a=e.valueWidth,s=e.width,o=e.height,l=q(this.spacing,2),u=l[0],c=l[1];return{height:o,width:s,markerWidth:n,labelWidth:i,valueWidth:a,position:[n/2,n+u,n+i+u+c]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=LY(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,l=o===void 0?e.lineWidth:o,u=n.markerStroke,c=u===void 0?e.stroke:u,h=+(s||l||(c?1:0))*Math.sqrt(2),d=this.markerGroup.node().getBBox(),f=d.width,v=d.height;return(1-h/Math.max(f,v))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes.marker,a=Ft(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Qn.markerGroup,"g").style("zIndex",0),or(!!i,this.markerGroup,function(){var s,o=n.markerGroup.node(),l=(s=o.childNodes)===null||s===void 0?void 0:s[0],u=typeof i=="string"?new ue({style:{symbol:i},className:Qn.marker.name}):i();l?u.nodeName===l.nodeName?l instanceof ue?l.update(ut(ut({},a),{symbol:i})):(pV(l,u),Tt(l).styles(a)):(l.remove(),Tt(u).attr("className",Qn.marker.name).styles(a),o.appendChild(u)):(u instanceof ue||Tt(u).attr("className",Qn.marker.name).styles(a),o.appendChild(u)),n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var c=X1(n.markerGroup.node(),n.scaleSize);n.markerGroup.node().style._transform="scale(".concat(c,")")})},t.prototype.renderLabel=function(e){var n=Ft(this.attributes,"label"),i=n.text,a=je(n,["text"]);this.labelGroup=e.maybeAppendByClassName(Qn.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(Qn.label,function(){return ki(i)}).styles(a)},t.prototype.renderValue=function(e){var n=this,i=Ft(this.attributes,"value"),a=i.text,s=je(i,["text"]);this.valueGroup=e.maybeAppendByClassName(Qn.valueGroup,"g").style("zIndex",0),or(this.showValue,this.valueGroup,function(){n.valueGroup.maybeAppendByClassName(Qn.value,function(){return ki(a)}).styles(s)})},t.prototype.renderBackground=function(e){var n=this.shape,i=n.width,a=n.height,s=Ft(this.attributes,"background");this.background=e.maybeAppendByClassName(Qn.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(Qn.background,"rect").styles(ut({width:i,height:a},s))},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=q(e.position,3),o=s[0],l=s[1],u=s[2],c=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(l,", ").concat(c,")")}),Tm(this.labelGroup.select(Qn.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(u,", ").concat(c,")")}),Tm(this.valueGroup.select(Qn.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=Tt(n),a=e.x,s=a===void 0?0:a,o=e.y,l=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(l,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.adjustLayout()},t}(qe),ma=jr({page:"item-page",navigator:"navigator",item:"item"},"items"),eO=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},DY=function(r){Yt(t,r);function t(e){var n=r.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:Xh,mouseenter:Xh,mouseleave:Xh})||this;return n.navigatorShape=[0,0],n}return Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grid",{get:function(){var e=this.attributes,n=e.gridRow,i=e.gridCol,a=e.data;if(!n&&!i)throw new Error("gridRow and gridCol can not be set null at the same time");return n&&i?[n,i]:n?[n,a.length]:[a.length,i]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderData",{get:function(){var e=this.attributes,n=e.data,i=e.layout,a=Ft(this.attributes,"item"),s=n.map(function(o,l){var u=o.id,c=u===void 0?l:u,h=o.label,d=o.value;return{id:"".concat(c),index:l,style:ut({layout:i,labelText:h,valueText:d},Object.fromEntries(Object.entries(a).map(function(f){var v=q(f,2),p=v[0],g=v[1];return[p,xr(g,[o,l,n])]})))}});return s},enumerable:!1,configurable:!0}),t.prototype.getGridLayout=function(){var e=this,n=this.attributes,i=n.orientation,a=n.width,s=n.rowPadding,o=n.colPadding,l=q(this.navigatorShape,1),u=l[0],c=q(this.grid,2),h=c[0],d=c[1],f=d*h,v=0;return this.pageViews.children.map(function(p,g){var y,m,w=Math.floor(g/f),E=g%f,_=e.ifHorizontal(d,h),k=[Math.floor(E/_),E%_];i==="vertical"&&k.reverse();var T=q(k,2),O=T[0],P=T[1],N=(a-u-(d-1)*o)/d,C=p.getBBox().height,L=q([0,0],2),B=L[0],G=L[1];return i==="horizontal"?(y=q([v,O*(C+s)],2),B=y[0],G=y[1],v=P===d-1?0:v+N+o):(m=q([P*(N+o),v],2),B=m[0],G=m[1],v=O===h-1?0:v+C+s),{page:w,index:g,row:O,col:P,pageIndex:E,width:N,height:C,x:B,y:G}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=q(this.navigatorShape,1),l=o[0],u=q(this.grid,2),c=u[0],h=u[1],d=q([n-l,i],2),f=d[0],v=d[1],p=q([0,0,0,0,0,0,0,0],8),g=p[0],y=p[1],m=p[2],w=p[3],E=p[4],_=p[5],k=p[6],T=p[7];return this.pageViews.children.map(function(O,P){var N,C,L,B,G=O.getBBox(),V=G.width,U=G.height,$=k===0?0:s,j=k+$+V;if(j<=f&&eO(E,function(nt){return nt<h}))return N=q([k+$,T,j],3),g=N[0],y=N[1],k=N[2],{width:V,height:U,x:g,y,page:m,index:P,pageIndex:w++,row:_,col:E++};C=q([_+1,0,0,T+U+a],4),_=C[0],E=C[1],k=C[2],T=C[3];var Z=T+U;return Z<=v&&eO(_,function(nt){return nt<c})?(L=q([k,T,V],3),g=L[0],y=L[1],k=L[2],{width:V,height:U,x:g,y,page:m,index:P,pageIndex:w++,row:_,col:E++}):(B=q([0,0,V,0,m+1,0,0,0],8),g=B[0],y=B[1],k=B[2],T=B[3],m=B[4],w=B[5],_=B[6],E=B[7],{width:V,height:U,x:g,y,page:m,index:P,pageIndex:w++,row:_,col:E++})})},Object.defineProperty(t.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var e=this.attributes.layout==="grid"?this.getGridLayout:this.getFlexLayout,n=e.call(this);return n.slice(-1)[0].page>0?(this.navigatorShape=[55,0],e.call(this)):n},enumerable:!1,configurable:!0}),t.prototype.ifHorizontal=function(e,n){var i=this.attributes.orientation;return Lm(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(ma.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(ma.page.class).forEach(function(n){var i=e.removeChild(n);i.destroy()})},t.prototype.renderItems=function(e){var n=this.attributes,i=n.click,a=n.mouseenter,s=n.mouseleave;this.flattenPage(e);var o=this.dispatchCustomEvent.bind(this);Tt(e).selectAll(ma.item.class).data(this.renderData,function(l){return l.id}).join(function(l){return l.append(function(u){var c=u.style;return new IY({style:c})}).attr("className",ma.item.name).on("click",function(){i==null||i(this),o("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),o("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),o("itemMouseleave",{item:this})})},function(l){return l.each(function(u){var c=u.style;this.update(c)})},function(l){return l.remove()})},t.prototype.relayoutNavigator=function(){var e,n=this.attributes,i=n.layout,a=n.width,s=((e=this.pageViews.children[0])===null||e===void 0?void 0:e.getBBox().height)||0,o=q(this.navigatorShape,2),l=o[0],u=o[1];this.navigator.update(i==="grid"?{pageWidth:a-l,pageHeight:s-u}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries(tV(this.itemsLayout,"page")).map(function(a){var s=q(a,2),o=s[0],l=s[1];return{page:o,layouts:l}}),i=xt([],q(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new on({className:ma.page.name}));s.forEach(function(l){var u=l.x,c=l.y,h=l.index,d=l.width,f=l.height,v=i[h];o.appendChild(v),Oo(v,"__layout__",l),v.update({x:u,y:c,width:d,height:f})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes.orientation,i=Ft(this.attributes,"nav"),a=fn({orientation:n},i),s=this;return e.selectAll(ma.navigator.class).data(["nav"]).join(function(o){return o.append(function(){return new PY({style:a})}).attr("className",ma.navigator.name).each(function(){s.navigator=this})},function(o){return o.each(function(){this.update(a)})},function(o){return o.remove()}),this.navigator},t.prototype.getBBox=function(){return this.navigator.getBBox()},t.prototype.render=function(e,n){var i=this.attributes.data;if(!(!i||i.length===0)){var a=this.renderNavigator(Tt(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new He(e,{detail:n});this.dispatchEvent(i)},t}(qe),eo=jr({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),EC={showLabel:!0,formatter:function(r){return r.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};(function(r){Yt(t,r);function t(e){return r.call(this,e,EC)||this}return t.prototype.render=function(e,n){var i=Tt(n).maybeAppendByClassName(eo.markerGroup,"g");this.renderMarker(i);var a=Tt(n).maybeAppendByClassName(eo.labelGroup,"g");this.renderLabel(a)},t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.orientation,s=i.markerSymbol,o=s===void 0?Lm(a,"horizontalHandle","verticalHandle"):s;or(!!o,e,function(l){var u=Ft(n.attributes,"marker"),c=ut({symbol:o},u);n.marker=l.maybeAppendByClassName(eo.marker,function(){return new ue({style:c})}).update(c)})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,l=o===void 0?0:o,u=i.formatter;or(a,e,function(c){var h,d=Ft(n.attributes,"label"),f=d.text,v=je(d,["text"]),p=((h=c.select(eo.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},g=p.width,y=g===void 0?0:g,m=p.height,w=m===void 0?0:m,E=q(Lm(s,[0,w+l,"center","top"],[y+l,0,"start","middle"]),4),_=E[0],k=E[1],T=E[2],O=E[3];c.maybeAppendByClassName(eo.label,"text").styles(ut(ut({},v),{x:_,y:k,text:u(f).toString(),textAlign:T,textBaseline:O}))})},t})(qe);var SC={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},BY=fn({},SC,{});fn({},SC,fs(EC,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var no=jr({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),FY=function(r){Yt(t,r);function t(e){return r.call(this,e,BY)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,l=Ft(this.attributes,"title"),u=q(Oi(l),2),c=u[0],h=u[1];this.titleGroup=e.maybeAppendByClassName(no.titleGroup,"g").styles(h);var d=ut(ut({width:n,height:i},c),{text:s?o:""});this.title=this.titleGroup.maybeAppendByClassName(no.title,function(){return new MY({style:d})}).update(d)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,l=Ft(this.attributes,"title",!0),u=q(Oi(l),2),c=u[0],h=u[1],d=ut(ut({},c),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(no.itemsGroup,"g").styles(ut(ut({},h),{transform:"translate(".concat(i,", ").concat(a,")")}));var f=this;this.itemsGroup.selectAll(no.items.class).data(["items"]).join(function(v){return v.append(function(){return new DY({style:d})}).attr("className",no.items.name).each(function(){f.items=Tt(this)})},function(v){return v.update(d)},function(v){return v.remove()})},t.prototype.adjustLayout=function(){var e=this.attributes.showTitle;if(e){var n=this.title.node().getAvailableSpace(),i=n.x,a=n.y;this.itemsGroup.node().style.transform="translate(".concat(i,", ").concat(a,")")}},Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.showTitle,i=e.width,a=e.height;return n?this.title.node().getAvailableSpace():new Dn(0,0,i,a)},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e,n,i=(e=this.title)===null||e===void 0?void 0:e.node(),a=(n=this.items)===null||n===void 0?void 0:n.node();return!i||!a?r.prototype.getBBox.call(this):EY(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,l=o===void 0?0:o,u=i.y,c=u===void 0?0:u,h=Tt(n);n.style.transform="translate(".concat(l,", ").concat(c,")"),this.renderTitle(h,a,s),this.renderItems(h,this.availableSpace),this.adjustLayout()},t}(qe),zY={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(r){return r.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},_y=jr({background:"background",labelGroup:"label-group",label:"label"},"indicator"),jY=function(r){Yt(t,r);function t(e){var n=r.call(this,e,zY)||this;return n.point=[0,0],n.group=n.appendChild(new on({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=q(En(i),4),s=a[0],o=a[1],l=a[2],u=a[3],c=this.label.node().getLocalBounds(),h=c.min,d=c.max,f=new Dn(h[0]-u,h[1]-s,d[0]+o-h[0]+u,d[1]+l-h[1]+s),v=this.getPath(n,f),p=Ft(this.attributes,"background");this.background=Tt(this.group).maybeAppendByClassName(_y.background,"path").styles(ut(ut({},p),{d:v})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=Ft(this.attributes,"label"),s=q(Oi(a),2),o=s[0],l=s[1];o.text;var u=je(o,["text"]);if(this.label=Tt(this.group).maybeAppendByClassName(_y.labelGroup,"g").styles(l),!!i){var c=this.label.maybeAppendByClassName(_y.label,function(){return ki(n(i))}).style("text",n(i).toString());c.selectAll("text").styles(u)}},t.prototype.adjustLayout=function(){var e=q(this.point,2),n=e[0],i=e[1],a=this.attributes,s=a.x,o=a.y;this.group.attr("transform","translate(".concat(s-n,", ").concat(o-i,")"))},t.prototype.getPath=function(e,n){var i=this.attributes.radius,a=n.x,s=n.y,o=n.width,l=n.height,u=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+l-i],["A",i,i,0,0,1,a+o-i,s+l],["L",a+i,s+l],["A",i,i,0,0,1,a,s+l-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],c={top:4,right:6,bottom:0,left:2},h=c[e],d=this.createCorner([u[h].slice(-2),u[h+1].slice(-2)]);return u.splice.apply(u,xt([h+1,1],q(d),!1)),u[0][0]="M",u},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=vV.apply(void 0,xt([],q(e),!1)),s=q(e,2),o=q(s[0],2),l=o[0],u=o[1],c=q(s[1],2),h=c[0],d=c[1],f=q(a?[h-l,[l,h]]:[d-u,[u,d]],2),v=f[0],p=q(f[1],2),g=p[0],y=p[1],m=v/2,w=v/Math.abs(v),E=n*w,_=E/2,k=E*Math.sqrt(3)/2*i,T=q([g,g+m-_,g+m,g+m+_,y],5),O=T[0],P=T[1],N=T[2],C=T[3],L=T[4];return a?(this.point=[N,u-k],[["L",O,u],["L",P,u],["L",N,u-k],["L",C,u],["L",L,u]]):(this.point=[l+k,N],[["L",l,O],["L",l,P],["L",l+k,N],["L",l,C],["L",l,L]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?Rr(this):hl(this)},t.prototype.bindEvents=function(){this.label.on(Ht.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(qe);function Im(r){return r===void 0&&(r=""),{CONTAINER:"".concat(r,"tooltip"),TITLE:"".concat(r,"tooltip-title"),LIST:"".concat(r,"tooltip-list"),LIST_ITEM:"".concat(r,"tooltip-list-item"),NAME:"".concat(r,"tooltip-list-item-name"),MARKER:"".concat(r,"tooltip-list-item-marker"),NAME_LABEL:"".concat(r,"tooltip-list-item-name-label"),VALUE:"".concat(r,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(r,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(r,"tooltip-crosshair-y")}}var nO={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function qY(r){var t;r===void 0&&(r="");var e=Im(r);return t={},t[".".concat(e.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},t[".".concat(e.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},t[".".concat(e.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},t[".".concat(e.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},t[".".concat(e.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},t[".".concat(e.NAME)]={display:"flex","align-items":"center","max-width":"216px"},t[".".concat(e.NAME_LABEL)]=ut({flex:1},nO),t[".".concat(e.VALUE)]=ut({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},nO),t[".".concat(e.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t[".".concat(e.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t}var $Y=function(r){Yt(t,r);function t(e){var n=this,i,a,s=(a=(i=e.style)===null||i===void 0?void 0:i.template)===null||a===void 0?void 0:a.prefixCls,o=Im(s);return n=r.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(o.CONTAINER,'"></div>'),title:'<div class="'.concat(o.TITLE,'"></div>'),item:'<li class="'.concat(o.LIST_ITEM,`" data-index={index}>
51
- <span class="`).concat(o.NAME,`">
52
- <span class="`).concat(o.MARKER,`" style="background:{color}"></span>
53
- <span class="`).concat(o.NAME_LABEL,`" title="{name}">{name}</span>
54
- </span>
55
- <span class="`).concat(o.VALUE,`" title="{value}">{value}</span>
56
- </li>`)},style:qY(s)})||this,n.timestamp=-1,n.prevCustomContentKey=n.attributes.contentKey,n.initShape(),n.render(n.attributes,n),n}return Object.defineProperty(t.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.element},Object.defineProperty(t.prototype,"elementSize",{get:function(){var e=this.element.offsetWidth,n=this.element.offsetHeight;return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HTMLTooltipItemsElements",{get:function(){var e=this.attributes,n=e.data,i=e.template;return n.map(function(a,s){var o=a.name,l=o===void 0?"":o,u=a.color,c=u===void 0?"black":u,h=a.index,d=je(a,["name","color","index"]),f=ut({name:l,color:c,index:h!=null?h:s},d);return $y(x3(i.item,f))})},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){this.renderHTMLTooltipElement(),this.updatePosition()},t.prototype.destroy=function(){var e;(e=this.element)===null||e===void 0||e.remove(),r.prototype.destroy.call(this)},t.prototype.show=function(e,n){var i=this;if(e!==void 0&&n!==void 0){var a=this.element.style.visibility==="hidden",s=function(){i.attributes.x=e!=null?e:i.attributes.x,i.attributes.y=n!=null?n:i.attributes.y,i.updatePosition()};a?this.closeTransition(s):s()}this.element.style.visibility="visible"},t.prototype.hide=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.attributes.enterable;i&&this.isCursorEntered(e,n)||(this.element.style.visibility="hidden")},t.prototype.initShape=function(){var e=this.attributes.template;this.element=$y(e.container),this.id&&this.element.setAttribute("id",this.id)},t.prototype.renderCustomContent=function(){if(!(this.prevCustomContentKey!==void 0&&this.prevCustomContentKey===this.attributes.contentKey)){this.prevCustomContentKey=this.attributes.contentKey;var e=this.attributes.content;e&&(typeof e=="string"?this.element.innerHTML=e:kk(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,l=i.style,u=i.content,c=Im(a.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",u)this.renderCustomContent();else{s?(h.innerHTML=a.title,h.getElementsByClassName(c.TITLE)[0].innerHTML=s):(n=(e=h.getElementsByClassName(c.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=c.LIST,kk(f,d);var v=this.element.querySelector(".".concat(c.LIST));v?v.replaceWith(f):h.appendChild(f)}bV(h,l)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),l={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},u=this.elementSize,c=u.width,h=u.height,d=[-c/2,-h/2];return o.forEach(function(f){var v=q(d,2),p=v[0],g=v[1],y=q(l[f],2),m=y[0],w=y[1];d=[p+(c/2+a[0])*m,g+(h/2+a[1])*w]}),d},t.prototype.setOffsetPosition=function(e){var n=q(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=o===void 0?0:o,u=s.y,c=u===void 0?0:u,h=s.container,d=h.x,f=h.y;this.element.style.left="".concat(+l+d+i,"px"),this.element.style.top="".concat(+c+f+a,"px")},t.prototype.updatePosition=function(){var e=this.attributes.showDelay,n=e===void 0?60:e,i=Date.now();this.timestamp>0&&i-this.timestamp<n||(this.timestamp=i,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},t.prototype.autoPosition=function(e){var n=q(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=s.y,u=s.bounding,c=s.position;if(!u)return[i,a];var h=this.element,d=h.offsetWidth,f=h.offsetHeight,v=q([+o+i,+l+a],2),p=v[0],g=v[1],y={left:"right",right:"left",top:"bottom",bottom:"top"},m=u.x,w=u.y,E=u.width,_=u.height,k={left:p<m,right:p+d>m+E,top:g<w,bottom:g+f>w+_},T=[];c.split("-").forEach(function(P){k[P]?T.push(y[P]):T.push(P)});var O=T.join("-");return this.getRelativeOffsetFromCursor(O)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,l=i.height;return new Dn(a,s,o,l).isPointIn(e,n)}return!1},t.prototype.closeTransition=function(e){var n=this,i=this.element.style.transition;this.element.style.transition="none",e(),setTimeout(function(){n.element.style.transition=i},10)},t.tag="tooltip",t}(qe),GY=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new xn({})),n.label=n.background.appendChild(new on({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return En(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=Ft(this.attributes,"label");Tt(this.label).maybeAppend(".label",function(){return ki(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=q(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],l=e.width,u=e.height,c=l+o+a,h=u+i+s,d=Ft(this.attributes,"background"),f=this.style,v=f.width,p=v===void 0?0:v,g=f.height,y=g===void 0?0:g,m=f.selected;this.background.attr(ut(ut({},d),{width:Math.max(c,p),height:Math.max(h,y),fill:m?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((h-u)/2,")")})},t.prototype.render=function(){this.renderLabel(),this.renderBackground()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("pointerenter",function(){e.style.selected||e.background.attr("fill",e.hoverColor)}),this.addEventListener("pointerleave",function(){e.style.selected||e.background.attr("fill",e.style.backgroundFill)});var n=this;this.addEventListener("click",function(){var i=e.style,a=i.label,s=i.value,o=i.onClick;o==null||o(s,{label:a,value:s},n)})},t.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},t}(qe),WY=function(r){Yt(t,r);function t(e){var n,i,a=r.call(this,fn({},t.defaultOptions,e))||this;a.currentValue=(n=t.defaultOptions.style)===null||n===void 0?void 0:n.defaultValue,a.isPointerInSelect=!1,a.select=a.appendChild(new xn({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new xn({className:"dropdown"}));var s=a.style.defaultValue;return s&&(!((i=a.style.options)===null||i===void 0)&&i.some(function(o){return o.value===s}))&&(a.currentValue=s),a}return t.prototype.setValue=function(e){this.currentValue=e,this.render()},t.prototype.getValue=function(){return this.currentValue},Object.defineProperty(t.prototype,"dropdownPadding",{get:function(){return En(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),t.prototype.renderSelect=function(){var e=this,n,i=this.style,a=i.x,s=i.y,o=i.width,l=i.height,u=i.bordered,c=i.showDropdownIcon,h=Ft(this.attributes,"select"),d=Ft(this.attributes,"placeholder");this.select.attr(ut(ut({x:a,y:s,width:o,height:l},h),{fill:"#fff",strokeWidth:u?1:0}));var f=this.dropdownPadding,v=10;c&&Tt(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-v-f[1]-f[3],", ").concat(s+l/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var p=(n=this.style.options)===null||n===void 0?void 0:n.find(function(w){return w.value===e.currentValue}),g=ut({x:a+f[3]},d);Tt(this.select).selectAll(".placeholder").data(p?[]:[1]).join(function(w){return w.append("text").attr("className","placeholder").styles(g).style("y",function(){var E=this.getBBox();return s+(l-E.height)/2})},function(w){return w.styles(g)},function(w){return w.remove()});var y=Ft(this.attributes,"optionLabel"),m=ut({x:a+f[3]},y);Tt(this.select).selectAll(".value").data(p?[p]:[]).join(function(w){return w.append(function(E){return ki(E.label)}).attr("className","value").styles(m).style("y",function(){var E=this.getBBox();return s+(l-E.height)/2})},function(w){return w.styles(m)},function(w){return w.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,l=a.width,u=a.height,c=a.options,h=a.onSelect,d=a.open,f=Ft(this.attributes,"dropdown"),v=Ft(this.attributes,"option"),p=this.dropdownPadding;Tt(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(c,function(m){return m.value}).join(function(m){return m.append(function(w){return new GY({className:"dropdown-item",style:ut(ut(ut({},w),v),{width:l-p[1]-p[3],selected:w.value===e.currentValue,onClick:function(E,_,k){e.setValue(E),h==null||h(E,_,k),e.dispatchEvent(new He("change",{detail:{value:E,option:_,item:k}})),Rr(e.dropdown)}})})}).each(function(w,E){var _,k=(_=this.parentNode)===null||_===void 0?void 0:_.children,T=k.reduce(function(O,P,N){return N<E&&(O+=P.getBBox().height),O},0);this.attr("transform","translate(".concat(p[3],", ").concat(p[0]+T,")"))})},function(m){return m.update(function(w){return{selected:w.value===e.currentValue}})},function(m){return m.remove()});var g=(i=(n=this.dropdown.getElementsByClassName("dropdown-container"))===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.getBBox(),y=f.spacing;this.dropdown.attr(ut({transform:"translate(".concat(s,", ").concat(o+u+y,")"),width:g.width+p[1]+p[3],height:g.height+p[0]+p[2]},f)),!d&&Rr(this.dropdown)},t.prototype.render=function(){this.renderSelect(),this.renderDropdown()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("click",function(n){n.stopPropagation()}),this.select.addEventListener("click",function(){e.dropdown.style.visibility==="visible"?Rr(e.dropdown):hl(e.dropdown)}),this.addEventListener("pointerenter",function(){e.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){e.isPointerInSelect=!1}),document==null||document.addEventListener("click",function(){e.isPointerInSelect||Rr(e.dropdown)})},t.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},t}(qe),qr=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},{style:{backgroundOpacity:t.backgroundOpacities.default}},t.defaultOptions,e))||this;return n.showBackground=!0,n.background=n.appendChild(new xn({})),n.icon=n.appendChild(new on({})),n}return Object.defineProperty(t.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return En(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconSize",{get:function(){var e=this.attributes.size,n=q(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3];return Math.max(e-Math.max(o+a,i+s),this.lineWidth*2+1)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.size,s=a/2,o=Ft(this.attributes,"background");this.background.attr(ut({x:n-s,y:i-s,width:a,height:a},o))},t.prototype.showIndicator=function(){if(this.label){var e=this.attributes.size,n=this.background.getBBox(),i=n.x,a=n.y;this.indicator.update({x:i+e/2,y:a-5,labelText:this.label,visibility:"visible"})}},t.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},t.prototype.connectedCallback=function(){var e;r.prototype.connectedCallback.call(this);var n=this.attributes.size,i=this.background.getBBox(),a=i.x,s=i.y,o=(e=this.ownerDocument)===null||e===void 0?void 0:e.defaultView;o&&(this.indicator=o.appendChild(new jY({style:{x:a+n/2,y:s-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},t.prototype.disconnectedCallback=function(){this.indicator.destroy()},t.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onClick;if(this.addEventListener("click",function(){n==null||n(e)}),this.showBackground){var i=function(){return e.background.attr({opacity:t.backgroundOpacities.default})},a=function(){return e.background.attr({opacity:t.backgroundOpacities.hover})},s=function(){return e.background.attr({opacity:t.backgroundOpacities.active})};this.addEventListener("pointerenter",function(){a(),e.showIndicator()}),this.addEventListener("pointerleave",function(){i(),e.hideIndicator()}),this.addEventListener("pointerdown",function(){s()}),this.addEventListener("pointerup",function(){i()})}},t.tag="IconBase",t.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},t.backgroundOpacities={default:0,hover:.8,active:1},t}(qe),qo=function(r,t){return t===void 0&&(t="#565758"),new rr({style:{fill:t,d:"M ".concat(r,",").concat(r," L -").concat(r,",0 L ").concat(r,",-").concat(r," Z"),transformOrigin:"center"}})},VY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.arcPath=function(e,n,i){var a=q([i,i],2),s=a[0],o=a[1],l=function(p){return[e+i*Math.cos(p),n+i*Math.sin(p)]},u=q(l(-5/4*Math.PI),2),c=u[0],h=u[1],d=q(l(1/4*Math.PI),2),f=d[0],v=d[1];return"M".concat(c,",").concat(h,",A").concat(s,",").concat(o,",0,1,1,").concat(f,",").concat(v)},Object.defineProperty(t.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=this.lineWidth,l=o+.5;Tt(this.icon).maybeAppend(".reset","path").styles({stroke:a,lineWidth:o,d:this.arcPath(n,i,s/2-o),markerStart:qo(l,a)})},t}(qr),UY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n-o,i],[n,i+l],[n,i],[n+o,i-l],[n+o,i+l],[n,i]];Tt(this.icon).maybeAppend(".backward","polygon").styles({points:u,fill:a})},t}(qr),YY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n+o,i],[n,i+l],[n,i],[n-o,i-l],[n-o,i+l],[n,i]];Tt(this.icon).maybeAppend(".forward","polygon").styles({points:u,fill:a})},t}(qr),HY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3*Math.pow(3,.5)*.8,l=[[n+o,i],[n-o/2,i-s/2*.8],[n-o/2,i+s/2*.8],[n+o,i]];Tt(this.icon).maybeAppend(".play","polygon").styles({points:l,fill:a})},t}(qr),XY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3,l=[[n-o,i-s/2],[n-o,i+s/2],[n-o/2,i+s/2],[n-o/2,i-s/2],[n-o,i-s/2],[n+o/2,i-s/2],[n+o/2,i+s/2],[n+o,i+s/2],[n+o,i-s/2]];Tt(this.icon).maybeAppend(".pause","polygon").styles({points:l,fill:a})},t}(qr),KY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l;Tt(this.icon).maybeAppend(".left-line","line").styles({x1:n-o/2,y1:i-o/2,x2:n-o/2,y2:i+o/2,stroke:a,lineWidth:l}),Tt(this.icon).maybeAppend(".right-line","line").styles({x1:n+o/2,y1:i-o/2,x2:n+o/2,y2:i+o/2,stroke:a,lineWidth:l}),Tt(this.icon).maybeAppend(".left-arrow","line").styles({x1:n,y1:i,x2:n-o/2+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:qo(l*2,a)}),Tt(this.icon).maybeAppend(".right-arrow","line").styles({x1:n,y1:i,x2:n+o/2-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:qo(l*2,a)})},t}(qr),ZY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;Tt(this.icon).maybeAppend(".line","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l});var u=l;Tt(this.icon).maybeAppend(".left-arrow","line").styles({x1:n-o/2-u*2,y1:i,x2:n-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:qo(l*2,a)}),Tt(this.icon).maybeAppend(".right-arrow","line").styles({x1:n+o/2+u*2,y1:i,x2:n+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:qo(l*2,a)})},t}(qr),_C=function(r){return[[-r/2,-r/2],[-r/2,r/2],[r/2,r/2]]},JY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l,c=(o-u*2-l)/4,h=(o-u*2-l)/2,d=q([n-o/2+u,i+o/2-u*2],2),f=d[0],v=d[1];Tt(this.icon).maybeAppend(".coordinate","polyline").styles({points:_C(o).map(function(p){var g=q(p,2),y=g[0],m=g[1];return[y+n,m+i]}),stroke:a,lineWidth:l}),Tt(this.icon).maybeAppend(".line","polyline").styles({points:[[f,v],[f+c,v-h],[f+c*2,v],[f+c*4,v-h*2]],stroke:a,lineWidth:l})},t}(qr),QY=function(r){Yt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.data,n=this.attributes,i=n.x,a=n.y,s=n.color,o=this,l=o.iconSize,u=o.lineWidth,c=u,h=(l-c)/e.length,d=(l-c*2)/4,f=q([i-l/2+c*2,a+l/2-c],2),v=f[0],p=f[1];Tt(this.icon).maybeAppend(".coordinate","polyline").styles({points:_C(l).map(function(g){var y=q(g,2),m=y[0],w=y[1];return[m+i,w+a]}),stroke:s,lineWidth:u}),Tt(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(g,y){return{value:g,index:y}})).join(function(g){return g.append("line").attr("className","column").style("x1",function(y){var m=y.index;return v+h*m}).style("y1",p).style("x2",function(y){var m=y.index;return v+h*m}).style("y2",function(y){var m=y.value;return p-d*m}).styles({y1:p,stroke:s,lineWidth:u})})},t}(qr),tH=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;Tt(this.icon).maybeAppend(".split","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l})},t}(qr),Dm=function(r){Yt(t,r);function t(){var e=r.apply(this,xt([],q(arguments),!1))||this;return e.showBackground=!1,e}return Object.defineProperty(t.prototype,"padding",{get:function(){return En(0)},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.iconSize,n=this.attributes,i=n.x,a=n.y,s=n.speed,o=s===void 0?1:s,l=Wm(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),u=De(e,20,1/0),c=20,h=ut(ut({},l),{x:i-u/2,y:a-c/2,width:u,height:c,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:e/5,placeholderFontSize:e/2,optionPadding:0,optionLabelFontSize:e/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});Tt(this.icon).maybeAppend(".speed",function(){return new WY({style:h})}).attr("className","speed").each(function(){this.update(h)})},t.tag="SpeedSelect",t}(qr),ib=function(r){Yt(t,r);function t(e){var n=r.call(this,e)||this;return n.icon=n.appendChild(new on({})),n.currentType=n.attributes.type,n}return t.prototype.getType=function(){return this.currentType},t.prototype.render=function(){var e=this,n=this.attributes;n.onChange;var i=je(n,["onChange"]);Tt(this.icon).selectAll(".icon").data([this.currentType]).join(function(a){return a.append(function(s){var o,l=(o=e.toggles.find(function(u){var c=q(u,1),h=c[0];return h===s}))===null||o===void 0?void 0:o[1];if(!l)throw new Error("Invalid type: ".concat(s));return new l({})}).attr("className","icon").styles(i,!1).update({})},function(a){return a.styles({restStyles:i}).update({})},function(a){return a.remove()})},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onChange;this.addEventListener("click",function(i){i.preventDefault(),i.stopPropagation();var a=(e.toggles.findIndex(function(o){var l=q(o,1),u=l[0];return u===e.currentType})+1)%e.toggles.length,s=e.toggles[a][0];n==null||n(e.currentType),e.currentType=s,e.render()})},t.tag="ToggleIcon",t}(qe),Bm=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},{style:{type:"play"}},e))||this;return n.toggles=[["play",HY],["pause",XY]],n}return t}(ib),Fm=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},{style:{type:"range"}},e))||this;return n.toggles=[["range",KY],["value",ZY]],n}return t}(ib),zm=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},{style:{type:"column"}},e))||this;return n.toggles=[["line",JY],["column",QY]],n}return t}(ib),eH={reset:VY,speed:Dm,backward:UY,playPause:Bm,forward:YY,selectionType:Fm,chartType:zm,split:tH},nH=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},t.defaultOptions,e))||this;return n.background=n.appendChild(new xn({})),n.functions=n.appendChild(new on({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return En(this.attributes.padding)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.style,n=e.x,i=e.y,a=e.width,s=e.height,o=Ft(this.attributes,"background");this.background.attr(ut({x:n,y:i,width:a,height:s},o))},t.prototype.renderFunctions=function(){var e=this,n,i=this.attributes,a=i.functions,s=i.iconSize,o=i.iconSpacing,l=i.x,u=i.y,c=i.width,h=i.height,d=i.align,f=q(this.padding,4),v=f[1],p=f[3],g=a.reduce(function(w,E){return w.length&&E.length?w.concat.apply(w,xt(["split"],q(E),!1)):w.concat.apply(w,xt([],q(E),!1))},[]),y=g.length*(s+o)-o,m={left:p+s/2,center:(c-y)/2+s/2,right:c-y-p-v+s/2}[d]||0;(n=this.speedSelect)===null||n===void 0||n.destroy(),this.functions.removeChildren(),g.forEach(function(w,E){var _,k=eH[w],T={x:l+E*(s+o)+m,y:u+h/2,size:s};if(k===Dm?(T.speed=e.attributes.speed,T.onSelect=function(P){return e.handleFunctionChange(w,{value:P})}):[Bm,Fm,zm].includes(k)?(T.onChange=function(P){return e.handleFunctionChange(w,{value:P})},k===Bm&&(T.type=e.attributes.state==="play"?"pause":"play"),k===Fm&&(T.type=e.attributes.selectionType==="range"?"value":"range"),k===zm&&(T.type=e.attributes.chartType==="line"?"column":"line")):T.onClick=function(){return e.handleFunctionChange(w,{value:w})},k===Dm){var O=(_=e.ownerDocument)===null||_===void 0?void 0:_.defaultView;O&&(e.speedSelect=new k({style:ut(ut({},T),{zIndex:100})}),O.appendChild(e.speedSelect))}else e.functions.appendChild(new k({style:T}))})},t.prototype.disconnectedCallback=function(){var e;r.prototype.disconnectedCallback.call(this),(e=this.speedSelect)===null||e===void 0||e.destroy()},t.prototype.render=function(){this.renderBackground(),this.renderFunctions()},t.prototype.handleFunctionChange=function(e,n){var i=this.attributes.onChange;i==null||i(e,n)},t.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},t}(qe),rH=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},t.defaultOptions,e))||this;return n.bindEvents(),n}return t.prototype.bindEvents=function(){var e=this;this.addEventListener("mouseenter",function(){e.attr("lineWidth",Math.ceil(+(e.style.r||0)/2))}),this.addEventListener("mouseleave",function(){e.attr("lineWidth",0)})},t.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},t}(Ti),iH=function(r){Yt(t,r);function t(e){return r.call(this,fn({},t.defaultOptions,e))||this}return t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=Ft(this.attributes,"background");Tt(this).maybeAppend("background","rect").attr("className","background").styles(ut({x:n-a/2,y:i-s/2,width:a,height:s},o))},t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.iconSize,s=Ft(this.attributes,"icon"),o=1,l=a/2;Tt(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(ut({x1:n-o,y1:i-l,x2:n-o,y2:i+l},s)),Tt(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(ut({x1:n+o,y1:i-l,x2:n+o,y2:i+l},s))},t.prototype.renderBorder=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=Ft(this.attributes,"border"),u=o==="start"?+a/2:-a/2;Tt(this).maybeAppend("border","line").attr("className","border").styles(ut({x1:u+n,y1:i-s/2,x2:u+n,y2:i+s/2},l))},t.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},t.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},t}(qe);function aH(r,t){return typeof r=="number"?MC(r):sH(r,t)}function sH(r,t){var e=new Date(r);switch(t){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(e.getHours())&&e.getMinutes()===0?$n(e,`HH:mm
57
- YYYY-MM-DD`):$n(e,"HH:mm");case"half-day":return e.getHours()<12?`AM
58
- `.concat($n(e,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(e.getDate())?$n(e,`DD
59
- YYYY-MM`):$n(e,"DD");case"week":return e.getDate()<=7?$n(e,`DD
60
- YYYY-MM`):$n(e,"DD");case"month":return[0,6].includes(e.getMonth())?$n(e,`MM月
61
- YYYY`):$n(e,"MM月");case"season":return[0].includes(e.getMonth())?$n(e,`MM月
62
- YYYY`):$n(e,"MM月");case"year":return $n(e,"YYYY");default:return $n(e,"YYYY-MM-DD HH:mm")}}function MC(r){var t=String(Math.floor(r/3600)).padStart(2,"0"),e=String(Math.floor(r%3600/60)).padStart(2,"0"),n=String(Math.floor(r%60)).padStart(2,"0");return r<3600?"".concat(e,":").concat(n):"".concat(t,":").concat(e,":").concat(n)}var oH=function(r){Yt(t,r);function t(e){var n=r.call(this,fn({},t.defaultOptions,e))||this;n.axis=n.appendChild(new AY({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),n.timeline=n.appendChild(new OU({style:{onChange:function(h){n.handleSliderChange(h)}}})),n.controller=n.appendChild(new nH({})),n.states={},n.handleSliderChange=function(h){var d=function(){var f=n.states.values;return Array.isArray(f)?xt([],q(f),!1):f}();n.setBySliderValues(h),n.dispatchOnChange(d)};var i=n.attributes,a=i.selectionType,s=i.chartType,o=i.speed,l=i.state,u=i.playMode,c=i.values;return n.states={chartType:s,playMode:u,selectionType:a,speed:o,state:l},n.setByTimebarValues(c),n}return Object.defineProperty(t.prototype,"data",{get:function(){var e=this.attributes.data,n=function(i,a){return i.time<a.time?-1:i.time>a.time?1:0};return e.sort(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"space",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=e.controllerHeight,u=De(+s-l,0,+s),c=new Dn(n,i+ +s-l,+a,l),h,d=0;o==="chart"?(d=35,h=new Dn(n,i+u-d,+a,d)):h=new Dn;var f=o==="time"?10:u,v=new Dn(n,i+(o==="time"?u:u-f),+a,f-d);return{axisBBox:h,controllerBBox:c,timelineBBox:v}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=q(Array.isArray(e)?e:[0,e],2),o=s[0],l=s[1],u=a.length,c=a[Math.floor(o*u)],h=a[Math.ceil(l*u)-(Array.isArray(e)?0:1)];this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:a[0].time,(i=h==null?void 0:h.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=q(Array.isArray(e)?e:[void 0,e],2),l=o[0],u=o[1],c=s.find(function(d){var f=d.time;return f===l}),h=s.find(function(d){var f=d.time;return f===u});this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=h==null?void 0:h.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,l=q(e,2),u=l[0],c=l[1];this.states.values=[(i=(n=o[u])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[c])===null||a===void 0?void 0:a.time)!==null&&s!==void 0?s:1/0]},Object.defineProperty(t.prototype,"sliderValues",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=q(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],l=this.data,u=l.length,c=i==="value",h=function(){var f=l.findIndex(function(v){var p=v.time;return p===s});return c?0:f>-1?f/u:0},d=function(){if(o===1/0)return 1;var f=l.findIndex(function(v){var p=v.time;return p===o});return f>-1?f/u:c?.5:1};return[h(),d()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=q(Array.isArray(n)?n:[this.data[0].time,n],2),s=a[0],o=a[1];return i==="value"?o:[s,o]},enumerable:!1,configurable:!0}),t.prototype.getDatumByRatio=function(e){var n=this.data,i=n.length,a=Math.floor(e*(i-1));return n[a]},Object.defineProperty(t.prototype,"chartHandleIconShape",{get:function(){var e=this.states.selectionType,n=this.space.timelineBBox.height;return e==="range"?function(i){return new iH({style:{type:i,height:n,iconSize:n/6}})}:function(){return new Da({style:{x1:0,y1:-n/2,x2:0,y2:n/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),t.prototype.getChartStyle=function(e){var n=this,i=e.x,a=e.y,s=e.width,o=e.height,l=this.states,u=l.selectionType,c=l.chartType,h=this.data,d=this.attributes,f=d.type,v=d.labelFormatter,p=Ft(this.attributes,"chart");p.type;var g=je(p,["type"]),y=u==="range";if(f==="time")return ut({handleIconShape:function(){return new rH({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:y?-15:0,autoFitLabel:y,handleSpacing:y?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:u,values:this.sliderValues,formatter:function(E){if(v)return v(E);var _=n.getDatumByRatio(E).time;return typeof _=="number"?MC(_):$n(_,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},g);var m=u==="range"?5:0,w=h.map(function(E){var _=E.value;return _});return ut({handleIconOffset:m,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:w,sparklineType:c,sparklineScale:.8,trackLength:s,trackSize:o,type:u,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},g)},t.prototype.renderChart=function(e){e===void 0&&(e=this.space.timelineBBox),this.timeline.update(this.getChartStyle(e))},t.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},t.prototype.getAxisStyle=function(e){var n=this.data,i=this.attributes,a=i.interval,s=i.labelFormatter,o=Ft(this.attributes,"axis"),l=e.x,u=e.y,c=e.width,h=xt(xt([],q(n),!1),[{time:0}],!1).map(function(f,v,p){var g=f.time;return{label:"".concat(g),value:v/(p.length-1),time:g}}),d=ut({startPos:[l,u],endPos:[l+c,u],data:h,labelFilter:function(f,v){return v<h.length-1},labelFormatter:function(f){var v=f.time;return s?s(v):aH(v,a)}},o);return d},t.prototype.renderAxis=function(e){e===void 0&&(e=this.space.axisBBox);var n=this.attributes.type;n==="chart"&&this.axis.update(this.getAxisStyle(e))},t.prototype.renderController=function(e){e===void 0&&(e=this.space.controllerBBox);var n=this.attributes.type,i=this.states,a=i.state,s=i.speed,o=i.selectionType,l=i.chartType,u=Ft(this.attributes,"controller"),c=this,h=ut(ut(ut({},e),{iconSize:20,speed:s,state:a,selectionType:o,chartType:l,onChange:function(d,f){var v=f.value;switch(d){case"reset":c.internalReset();break;case"speed":c.handleSpeedChange(v);break;case"backward":c.internalBackward();break;case"playPause":v==="play"?c.internalPlay():c.internalPause();break;case"forward":c.internalForward();break;case"selectionType":c.handleSelectionTypeChange(v);break;case"chartType":c.handleChartTypeChange(v);break}}}),u);n==="time"&&(h.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(h)},t.prototype.dispatchOnChange=function(e){var n=this.data,i=this.attributes.onChange,a=this.states,s=a.values,o=a.selectionType,l=q(s,2),u=l[0],c=l[1],h=c===1/0?n.at(-1).time:c,d=o==="range"?[u,h]:h,f=function(v,p){return Array.isArray(v)?Array.isArray(p)?v[0]===p[0]&&(v[1]===p[1]||v[1]===1/0||p[1]===1/0):!1:Array.isArray(p)?!1:v===p};(!e||!f(e,d))&&(i==null||i(o==="range"?[u,h]:h))},t.prototype.internalReset=function(e){var n,i,a=this.states.selectionType;this.internalPause(),this.setBySliderValues(a==="range"?[0,1]:[0,0]),this.renderController(),this.updateSelection(),e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onReset)===null||i===void 0||i.call(n),this.dispatchOnChange())},t.prototype.reset=function(){this.internalReset()},t.prototype.moveSelection=function(e,n){var i=this.data,a=i.length,s=this.states,o=s.values,l=s.selectionType,u=s.playMode,c=q(o,2),h=c[0],d=c[1],f=i.findIndex(function(w){var E=w.time;return E===h}),v=i.findIndex(function(w){var E=w.time;return E===d});v===-1&&(v=a);var p=e==="backward"?-1:1,g;l==="range"?u==="acc"?(g=[f,v+p],p===-1&&f===v&&(g=[f,a])):g=[f+p,v+p]:g=[f,v+p];var y=function(w){var E=q(w.sort(function(O,P){return O-P}),2),_=E[0],k=E[1],T=function(O){return De(O,0,a)};return k>a?l==="value"?[0,0]:u==="acc"?[T(_),T(_)]:[0,T(k-_)]:_<0?u==="acc"?[0,T(k)]:[T(_+a-k),a]:[T(_),T(k)]},m=y(g);return this.setByIndex(m),this.updateSelection(),m},t.prototype.internalBackward=function(e){var n,i,a=this.moveSelection("backward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onBackward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.backward=function(){this.internalBackward()},t.prototype.internalPlay=function(e){var n=this,i,a,s=this.data,o=this.attributes.loop,l=this.states.speed,u=l===void 0?1:l;this.playInterval=window.setInterval(function(){var c=n.internalForward();c[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/u),this.states.state="play",!e&&((a=(i=this.attributes)===null||i===void 0?void 0:i.onPlay)===null||a===void 0||a.call(i))},t.prototype.play=function(){this.internalPlay()},t.prototype.internalPause=function(e){var n,i;clearInterval(this.playInterval),this.states.state="pause",!e&&((i=(n=this.attributes)===null||n===void 0?void 0:n.onPause)===null||i===void 0||i.call(n))},t.prototype.pause=function(){this.internalPause()},t.prototype.internalForward=function(e){var n,i,a=this.moveSelection("forward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onForward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.forward=function(){this.internalForward()},t.prototype.handleSpeedChange=function(e){var n,i;this.states.speed=e;var a=this.states.state;a==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSpeedChange)===null||i===void 0||i.call(n,e)},t.prototype.handleSelectionTypeChange=function(e){var n,i;this.states.selectionType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSelectionTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.handleChartTypeChange=function(e){var n,i;this.states.chartType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onChartTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.render=function(){var e=this.space,n=e.axisBBox,i=e.controllerBBox,a=e.timelineBBox;this.renderController(i),this.renderAxis(n),this.renderChart(a),this.states.state==="play"&&this.internalPlay()},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.internalPause(!0)},t.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},t}(qe);function ab(r){const{width:t,height:e,renderer:n}=r,i=lH(r),a=new im({width:t,height:e,container:i,renderer:n||new Ro});return[i,a]}function lH(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=$s(n,!1),{width:s,height:o,containerStyle:l}=r,[u,c]=uH(r);return Object.assign(a.style,Object.assign({position:"absolute",left:u+"px",top:c+"px",width:s+"px",height:o+"px"},l)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function uH(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,l]=vA(n);return[o*(a-t),l*(s-e)]}var cH=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};class Th extends _n{constructor(t,e){super(t,Object.assign({},Th.defaultOptions,e)),this.typePrefix="__data__",this.draw=!1,this.fieldMap={node:new Map,edge:new Map,combo:new Map},this.selectedItems=[],this.bindEvents=()=>{const{graph:n}=this.context;n.on(pt.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=Rn(n,[s,"id"]),l=Rn(n,[s,"style","labelText"]),[u]=o.split("__"),c=this.fieldMap[u].get(l)||[];a.setElementState(Object.fromEntries(c==null?void 0:c.map(h=>[h,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=Rn(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?(this.selectedItems=this.selectedItems.filter(a=>a!==i),this.changeState(n,[])):(this.selectedItems.push(i),this.changeState(n,"selected"))},this.mouseleave=n=>{this.options.trigger!=="click"&&(this.selectedItems=[],this.changeState(n,[]))},this.mouseenter=n=>{if(this.options.trigger==="click")return;const i=Rn(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?this.selectedItems=this.selectedItems.filter(a=>a!==i):(this.selectedItems.push(i),this.changeState(n,"active"))},this.setFieldMap=(n,i,a)=>{if(!n)return;const s=this.fieldMap[a];if(s)if(!s.has(n))s.set(n,[i]);else{const o=s.get(n);o&&(o.push(i),s.set(n,o))}},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(n,i)=>{if(!n)return[];const{model:a,element:s}=this.context,{nodes:o,edges:l,combos:u}=a.getData(),c={},h=g=>Ot(n)?n(g):n,d={node:"circle",edge:"line",combo:"rect"},f={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},v=(g,y)=>s==null?void 0:s.getElementComputedStyle(g,y),p=(g,y)=>{g.forEach(m=>{const{id:w}=m,E=Rn(m,["data",h(m)]),_=(s==null?void 0:s.getElementType(y,m))||"circle",k=v(y,m),T=(y==="edge"?k==null?void 0:k.stroke:k==null?void 0:k.fill)||"#1783ff";w&&E&&E.replace(/\s+/g,"")&&(this.setFieldMap(E,w,y),c[E]||(c[E]={id:`${y}__${w}`,label:E,marker:f[_]||d[y],elementType:y,lineWidth:1,stroke:T,fill:T}))})};switch(i){case"node":p(o,"node");break;case"edge":p(l,"edge");break;case"combo":p(u,"combo");break;default:return[]}return Object.values(c)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:l,trigger:u,position:c,container:h,containerStyle:d,className:f}=n,v=cH(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),p=this.getMarkerData(s,"node"),g=this.getMarkerData(o,"edge"),y=this.getMarkerData(l,"combo"),m=[...p,...y,...g],w=Object.assign({width:i,height:a,data:m,itemMarkerLineWidth:({lineWidth:k})=>k,itemMarker:({marker:k})=>k,itemMarkerStroke:({stroke:k})=>k,itemMarkerFill:({fill:k})=>k,gridCol:p.length},v,this.getEvents()),E=new FY({className:"legend",style:w});this.category=E,this.upsertCanvas().appendChild(E),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:i=e,height:a=n,position:s,container:o,containerStyle:l,className:u}=this.options,[c,h]=ab({width:i,height:a,graphCanvas:t,container:o,containerStyle:l,placement:s,className:"legend"});return this.container=c,u&&c.classList.add(u),this.canvas=h,this.canvas}destroy(){this.clear(),this.context.graph.off(pt.AFTER_DRAW,this.createElement),super.destroy()}}Th.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class Ah extends _n{constructor(t,e){super(t,Object.assign({},Ah.defaultOptions,e)),this.onDraw=n=>{var i;!((i=n==null?void 0:n.data)===null||i===void 0)&&i.render||this.onRender()},this.shapes=new Map,this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=n=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(n.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=n=>{if(!this.mask||!this.isMaskDragging)return;const{size:[i,a]}=this.options,{movementX:s,movementY:o}=n,{left:l,top:u,width:c,height:h}=this.mask.style,[,,d,f]=this.maskBBox;let v=parseInt(l)+s,p=parseInt(u)+o,g=parseInt(c),y=parseInt(h);v<0&&(v=0),p<0&&(p=0),v+g>i&&(v=Ii(i-g,0)),p+y>a&&(p=Ii(a-y,0)),g<d&&(s>0?(v=Ii(v-s,0),g=Li(g+s,i)):s<0&&(g=Li(g-s,i))),y<f&&(o>0?(p=Ii(p-o,0),y=Li(y+o,a)):o<0&&(y=Li(y-o,a))),Object.assign(this.mask.style,{left:v+"px",top:p+"px",width:g+"px",height:y+"px"});const m=parseInt(l)-v,w=parseInt(u)-p;if(m===0&&w===0)return;const E=this.context.canvas.getCamera().getZoom(),_=this.canvas.getCamera().getZoom(),k=E/_;this.context.graph.translateBy([m*k,w*k],!1)},this.onMaskDragEnd=n=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(n.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=JO(()=>{this.isMaskDragging||(this.updateMask(),this.setCamera())},32,{leading:!0}),this.setOnRender(),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),"delay"in t&&this.setOnRender(),this.bindEvents()}setOnRender(){this.onRender=Wo(()=>{this.renderMinimap(),this.renderMask()},this.options.delay,!0)}bindEvents(){const{graph:t}=this.context;t.on(pt.AFTER_DRAW,this.onDraw),t.on(pt.AFTER_RENDER,this.onRender),t.on(pt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(pt.AFTER_DRAW,this.onDraw),t.off(pt.AFTER_RENDER,this.onRender),t.off(pt.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:i,edges:a,combos:s}=n;return{nodes:i.filter(o=>t(J(o),"node")),edges:a.filter(o=>t(J(o),"edge")),combos:s.filter(o=>t(J(o),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context;if(s==="key"){const u=new Set,c=h=>{const d=J(h);u.add(d);const f=o.getElement(d);if(!f)return;const v=f.getShape("key"),p=this.shapes.get(d)||v.cloneNode();p.setPosition(v.getPosition()),f.style.zIndex&&(p.style.zIndex=f.style.zIndex),p.id=f.id,this.shapes.has(d)?Object.entries(v.attributes).forEach(([g,y])=>{p.style[g]!==y&&(p.style[g]=y)}):(t.appendChild(p),this.shapes.set(d,p))};i.forEach(c),a.forEach(c),n.forEach(c),this.shapes.forEach((h,d)=>{u.has(d)||(t.removeChild(h),this.shapes.delete(d))});return}const l=(u,c)=>{const d=o.getElement(u).getPosition();return c.setPosition(d),c};t.removeChildren(),i.forEach(u=>t.appendChild(s(J(u),"edge"))),a.forEach(u=>{t.appendChild(l(J(u),s(J(u),"combo")))}),n.forEach(u=>{t.appendChild(l(J(u),s(J(u),"node")))})}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:i,height:a}=this.canvas.getConfig();(e!==i||n!==a)&&this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:i,position:a,container:s,containerStyle:o}=this.options,[l,u]=ab({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&l.classList.add(i),this.container=l,this.canvas=u}return this.setCamera(),this.canvas}createLandmark(t,e,n){const i=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(i))return this.landmarkMap.get(i);const s=this.canvas.getCamera().createLandmark(i,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(i,s),s}setCamera(){var t;const{canvas:e}=this.context,n=(t=this.canvas)===null||t===void 0?void 0:t.getCamera();if(!n)return;const{size:[i,a],padding:s}=this.options,[o,l,u,c]=si(s),{min:h,max:d,center:f}=e.getBounds("elements"),v=d[0]-h[0],p=d[1]-h[1],g=i-c-l,y=a-o-u,m=g/v,w=y/p,E=Math.min(m,w),_=this.createLandmark(f,f,E);n.gotoLandmark(_,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(Cr(n)),s=this.canvas.canvas2Viewport(Cr(i)),o=s.x-a.x,l=s.y-a.y;return[a.x,a.y,o,l]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=Li(a+n,t),n=0),i<0&&(s=Li(s+i,e),i=0),n+a>t&&(a=Ii(t-n,0)),i+s>e&&(s=Ii(e-i,0)),[Li(n,t),Li(i,e),Ii(a,0),Ii(s,0)]}renderMask(){const{maskStyle:t}=this.options;this.mask||(this.mask=document.createElement("div"),this.mask.addEventListener("pointerdown",this.onMaskDragStart)),this.container.appendChild(this.mask),Object.assign(this.mask.style,Object.assign(Object.assign({},t),{cursor:"move",position:"absolute",pointerEvents:"auto"})),this.updateMask()}updateMask(){if(!this.mask)return;const[t,e,n,i]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:i+"px"})}destroy(){var t;this.unbindEvents(),this.canvas.destroy(),(t=this.mask)===null||t===void 0||t.remove(),super.destroy()}}Ah.defaultOptions={size:[240,160],shape:"key",padding:10,position:"right-bottom",maskStyle:{border:"1px solid #ddd",background:"rgba(0, 0, 0, 0.1)"},containerStyle:{border:"1px solid #ddd",background:"#fff"},delay:128};const Li=(r,t)=>Math.min(r,t),Ii=(r,t)=>Math.max(r,t);var My=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const ky={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class Ph extends _n{constructor(t,e){super(t,Object.assign({},Ph.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new Da({style:Object.assign(Object.assign({},ky),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new Da({style:Object.assign(Object.assign({},ky),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>My(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:l}=this.options,{min:[u,c],max:[h,d],center:[f,v]}=i;let p=0,g=0;s!==null&&(kn(h,s)<l&&(p=s-h),kn(u,s)<l&&(p=s-u),kn(f,s)<l&&(p=s-f),p!==0&&(this.isVerticalSticking=!0)),o!==null&&(kn(d,o)<l&&(g=o-d),kn(c,o)<l&&(g=o-c),kn(v,o)<l&&(g=o-v),g!==0&&(this.isHorizontalSticking=!0)),(p!==0||g!==0)&&(yield this.context.graph.translateElementBy({[n]:[p,g]},!1))}),this.enableSnap=n=>{const{target:i}=n,a=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[s,o]=this.getDelta(n);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(s)<=a&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,-o]},!1),!1;if(this.isHorizontalSticking&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[0,-o]},!1),!1;if(this.isVerticalSticking&&Math.abs(s)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(n,i)=>{const{tolerance:a,shape:s}=this.options,{min:[o,l],max:[u,c],center:[h,d]}=i;let f=null,v=null,p=null,g=null,y=null,m=null;return this.getNodes().some(w=>{if(Be(n.id,w.id))return!1;const E=rO(w,s).getRenderBounds(),{min:[_,k],max:[T,O],center:[P,N]}=E;return f===null&&(kn(P,h)<a?f=P:kn(_,o)<a||kn(_,u)<a?f=_:(kn(T,u)<a||kn(T,o)<a)&&(f=T),f!==null&&(v=Math.min(k,l),p=Math.max(O,c))),g===null&&(kn(N,d)<a?g=N:kn(k,l)<a||kn(k,c)<a?g=k:(kn(O,c)<a||kn(O,l)<a)&&(g=O),g!==null&&(y=Math.min(_,o),m=Math.max(T,u))),f!==null&&g!==null}),{verticalX:f,verticalMinY:v,verticalMaxY:p,horizontalY:g,horizontalMinX:y,horizontalMaxX:m}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=n=>My(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=rO(i,this.options.shape).getRenderBounds(),s=this.calcSnaplineMetadata(i,a);this.hideSnapline(),(s.verticalX!==null||s.horizontalY!==null)&&this.updateSnapline(s),this.options.autoSnap&&(yield this.autoSnapToLine(i.id,a,s))}),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,i=(((t=this.context.element)===null||t===void 0?void 0:t.getNodes())||[]).filter(a=>{var s;return V4(a)&&((s=this.context.viewport)===null||s===void 0?void 0:s.isInViewport(a.getRenderBounds()))});return e?i.filter(a=>e(a)):i}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||ky.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[l,u]=this.context.canvas.getSize(),{offset:c}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:s-c,y1:a,x2:c===1/0?l:o+c,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?u:i+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return Dr([t.dx,t.dy],e)}bindEvents(){return My(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(wr.DRAG_START,this.onDragStart),t.on(wr.DRAG,this.onDrag),t.on(wr.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(wr.DRAG_START,this.onDragStart),t.off(wr.DRAG,this.onDrag),t.off(wr.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;(t=this.horizontalLine)===null||t===void 0||t.destroy(),(e=this.verticalLine)===null||e===void 0||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}Ph.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const kn=(r,t)=>Math.abs(r-t),rO=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var hH=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},dH=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};const fH=["timestamp","time","date","datetime"];class Nh extends _n{get padding(){return si(this.options.padding)}constructor(t,e){super(t,Object.assign({},Nh.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){var t;(t=this.timebar)===null||t===void 0||t.play()}pause(){var t;(t=this.timebar)===null||t===void 0||t.pause()}forward(){var t;(t=this.timebar)===null||t===void 0||t.forward()}backward(){var t;(t=this.timebar)===null||t===void 0||t.backward()}reset(){var t;(t=this.timebar)===null||t===void 0||t.reset()}update(t){super.update(t),this.backup(),this.upsertTimebar()}backup(){this.originalData=iO(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:i,data:a,x:s,y:o,width:l,height:u,mode:c}=e,h=dH(e,["onChange","timebarType","data","x","y","width","height","mode"]),d=t.getSize(),[f]=this.padding;this.upsertCanvas().ready.then(()=>{var v;const p=Object.assign(Object.assign({x:d[0]/2-l/2,y:f,onChange:g=>{const y=(lr(g)?g:[g,g]).map(m=>_3(m)?m.getTime():m);this.options.mode==="modify"?this.filterElements(y):this.hiddenElements(y),n==null||n(y)}},h),{data:a.map(g=>St(g)?{time:g,value:0}:g),width:l,height:u,type:i});this.timebar?this.timebar.update(p):(this.timebar=new oH({style:p}),(v=this.canvas)===null||v===void 0||v.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,i=this.context.canvas,[a]=i.getSize(),[s,,o]=this.padding,[l,u]=ab({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=l,t&&l.classList.add(t),this.canvas=u,this.canvas}filterElements(t){return hH(this,void 0,void 0,function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:i}=this.options,{graph:a,element:s}=this.context,o=iO(this.originalData);n.forEach(u=>{const c=`${u}s`;o[c]=(this.originalData[c]||[]).filter(h=>{const d=i(h);return!!aO(d,t)})});const l=[...o.nodes,...o.combos].map(u=>J(u));o.edges=o.edges.filter(u=>{const c=u.source,h=u.target;return l.includes(c)&&l.includes(h)}),a.setData(o),yield(e=s.draw({animation:!1,silence:!0}))===null||e===void 0?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:i}=this.options,a=[],s=[];n.forEach(o=>{var l;const u=`${o}s`;(((l=this.originalData)===null||l===void 0?void 0:l[u])||[]).forEach(h=>{const d=J(h),f=i(h);aO(f,t)?s.push(d):a.push(d)})}),e.hideElement(a,!1),e.showElement(s,!1)}destroy(){var t,e,n;const{graph:i}=this.context;this.originalData&&i.setData(Object.assign({},this.originalData)),(t=this.timebar)===null||t===void 0||t.destroy(),(e=this.canvas)===null||e===void 0||e.destroy(),(n=this.container)===null||n===void 0||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}Nh.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>gH(r,fH,void 0),loop:!1};const iO=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},aO=(r,t)=>{if(St(t))return r===t;const[e,n]=t;return r>=e&&r<=n},gH=(r,t,e)=>{var n;for(let i=0;i<t.length;i++){const a=t[i],s=(n=r.data)===null||n===void 0?void 0:n[a];if(s)return s}return e};function vH(r){const t={top:"unset",right:"unset",bottom:"unset",left:"unset"};return r.split("-").forEach(n=>{t[n]="8px"}),t.flexDirection=r.startsWith("top")||r.startsWith("bottom")?"row":"column",t}const pH=`
63
- .g6-toolbar {
64
- position: absolute;
65
- z-index: 100;
66
- display: flex;
67
- flex-direction: row;
68
- align-items: center;
69
- justify-content: center;
70
- border-radius: 4px;
71
- box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
72
- opacity: 0.65;
73
- }
74
- .g6-toolbar .g6-toolbar-item {
75
- display: inline-block;
76
- width: 16px;
77
- height: 16px;
78
- padding: 4px;
79
- cursor: pointer;
80
- box-sizing: content-box;
81
- }
82
-
83
- .g6-toolbar .g6-toolbar-item:hover {
84
- background-color: #f0f0f0;
85
- }
86
-
87
- .g6-toolbar .g6-toolbar-item svg {
88
- display: inline-block;
89
- width: 100%;
90
- height: 100%;
91
- pointer-events: none;
92
- }
93
- `,yH=`
94
- <svg>
95
- <symbol id="zoom-in" viewBox="64 64 896 896">
96
- <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>
97
- </symbol>
98
- <symbol id="zoom-out" viewBox="64 64 896 896">
99
- <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>
100
- </symbol>
101
- <symbol id="edit" viewBox="64 64 896 896">
102
- <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>
103
- </symbol>
104
- <symbol id="delete" viewBox="64 64 896 896">
105
- <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>
106
- </symbol>
107
- <symbol id="redo" viewBox="64 64 896 896">
108
- <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>
109
- </symbol>
110
- <symbol id="undo" viewBox="64 64 896 896">
111
- <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>
112
- </symbol>
113
- <symbol id="export" viewBox="64 64 896 896">
114
- <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>
115
- </symbol>
116
- <symbol id="auto-fit" viewBox="64 64 896 896">
117
- <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>
118
- <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>
119
- </symbol>
120
- <symbol id="reset" viewBox="64 64 896 896">
121
- <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>
122
- </symbol>
123
- <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">
124
- <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>
125
- <symbol id="request-fullscreen" viewBox="0 0 1024 1024">
126
- <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>
127
- </svg>
128
- `;var sO=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Ch extends _n{constructor(t,e){super(t,Object.assign({},Ch.defaultOptions,e)),this.$element=$s("toolbar",!1),this.onToolbarItemClick=i=>{const{onClick:a}=this.options;if(i.target instanceof Element&&i.target.className.includes("g6-toolbar-item")){const s=i.target.getAttribute("value");a==null||a(s,i.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),Om("g6-toolbar-css","style",{},pH,document.head),Om("g6-toolbar-svgicon","div",{display:"none"},yH),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return sO(this,void 0,void 0,function*(){e.update.call(this,t);const{className:n,position:i,style:a}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,a,vH(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return sO(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(e=>`
129
- <div class="g6-toolbar-item" value="${e.value}">
130
- <svg aria-hidden="true" focusable="false">
131
- <use xlink:href="#${e.id}"></use>
132
- </svg>
133
- </div>`).join("")})}}Ch.defaultOptions={position:"top-left"};var oO=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Rh extends _n{constructor(t,e){super(t,Object.assign({},Rh.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=(n,i)=>{const{enable:a}=this.options;return typeof a=="function"?a(n,i):a},this.onClick=n=>{const{target:{id:i}}=n;this.currentTarget===i?this.hide(n):this.show(n)},this.onPointerMove=n=>{const{target:i}=n;!this.currentTarget||i.id===this.currentTarget||this.show(n)},this.onPointerLeave=n=>{this.hide(n)},this.onCanvasMove=n=>{this.hide(n)},this.onPointerEnter=n=>{this.show(n)},this.showById=n=>oO(this,void 0,void 0,function*(){const i={target:{id:n}};yield this.show(i)}),this.getElementData=(n,i)=>{const{model:a}=this.context;switch(i){case"node":return a.getNodeData([n]);case"edge":return a.getEdgeData([n]);case"combo":return a.getComboData([n]);default:return[]}},this.show=n=>oO(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(Ac(n.target))return;const l=this.context.graph.getElementType(o),{getContent:u,title:c}=this.options,h=this.getElementData(o,l);if(!this.tooltipElement||!this.isEnable(n,h))return;let d={};if(u){if(d.content=yield u(n,h),!d.content)return}else{const p=this.context.graph.getElementRenderStyle(o),g=l==="node"?p.fill:p.stroke;d={title:c||l,data:h.map(y=>({name:"ID",value:y.id||`${y.source} -> ${y.target}`,color:g}))}}this.currentTarget=o;let f,v;if(s)f=s.x,v=s.y;else{const p=Rn(h,"0.style",{x:0,y:0});f=p.x,v=p.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:f,y:v,style:{".tooltip":{visibility:"visible"}}}),d))}),this.hide=n=>{var i,a,s,o,l;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:u,y:c}}=n;(l=(o=this.options).onOpenChange)===null||l===void 0||l.call(o,!1),this.tooltipElement.hide(u,c),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new $Y({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&((e=this.container)===null||e===void 0||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:l,container:u={x:-a,y:-i},title:c,offset:h}=this.options,[d,f]=e,[v,p]=t.getSize();return{x:d,y:f,container:u,title:c,bounding:{x:0,y:0,width:v,height:p},position:o,enterable:l,offset:h,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}Rh.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var kC=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};let ss;function OC(r,t){return ss||(ss=document.createElement("canvas")),ss.width=r,ss.height=t,ss.getContext("2d").clearRect(0,0,r,t),ss}function mH(r,t,e,n){return kC(this,void 0,void 0,function*(){const i=OC(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:l,textFontSize:u,textFontFamily:c,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:v}=n;return a.textAlign=f,a.textBaseline=v,a.translate(r/2,t/2),a.font=`${u}px ${c} ${h} ${d}`,s&&a.rotate(s),o&&(a.globalAlpha=o),l&&(a.fillStyle=l,a.fillText(`${e}`,0,0)),i.toDataURL()})}function bH(r,t,e,n){return kC(this,void 0,void 0,function*(){const i=OC(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const l=new Image;return l.crossOrigin="anonymous",l.src=e,new Promise(u=>{l.onload=function(){const c=r>l.width?(r-l.width)/2:0,h=t>l.height?(t-l.height)/2:0;a.drawImage(l,0,0,l.width,l.height,c,h,r-c*2,t-h*2),u(i.toDataURL())}})})}var wH=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},xH=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};class Lh extends _n{constructor(t,e){super(t,Object.assign({},Lh.defaultOptions,e)),this.$element=$s("watermark"),this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return wH(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:i,height:a,text:s,imageURL:o}=n,l=xH(n,["width","height","text","imageURL"]);Object.keys(l).forEach(c=>{c.startsWith("background")&&(this.$element.style[c]=t[c])});const u=o?yield bH(i,a,o,l):yield mH(i,a,s,l);this.$element.style.backgroundImage=`url(${u})`})}destroy(){super.destroy(),this.$element.remove()}}Lh.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const EH=["#7E92B5","#F4664A","#FFBE3A"],SH={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},_H={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function TC(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:h=EH,nodePaletteOptions:d=SH,edgeColor:f,edgeColorDisabled:v,edgePaletteOptions:p=_H,comboColor:g,comboColorDisabled:y,comboStroke:m,comboStrokeDisabled:w,edgeColorInactive:E}=r;return{background:t,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:e,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:u,labelFill:e,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:l}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:p,style:{badgeBackgroundFill:f,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:f,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:E,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:v,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:t,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:g,halo:!1,haloLineWidth:12,haloStroke:m,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:m},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:y,fillOpacity:.25,labelOpacity:.25,stroke:w,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const MH={type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},kH={bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:MH,nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"},OH=TC(kH),TH={bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"},AH=TC(TH);class da extends l1{beforeDraw(t,e){return t}afterLayout(t,e){}}class PH extends da{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,l)=>{const c=e.getAncestorsData(l,"combo").map(h=>J(h)).reverse();s.push([l,o,c.length])}),new Map(s.sort(([,,o],[,,l])=>l-o).map(([o,l])=>[o,l]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function ar(r,t,e,n,i){const a=J(n),s=`${e}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([l,u])=>{t===l?u[s].set(a,o):u[s].delete(a)})}function ku(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class NH extends da{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(le))return t;const{model:n}=this.context,{add:i,update:a}=t,s=[...t.update.combos.entries(),...t.add.combos.entries()];for(;s.length;){const[o,l]=s.pop();if(Yn(l)){const u=n.getDescendantsData(o),c=u.map(J),{internal:h,external:d}=fm(c,f=>n.getRelatedEdgesData(f));u.forEach(f=>{const v=J(f),p=s.findIndex(([y])=>y===v);p!==-1&&s.splice(p,1);const g=n.getElementType(v);ar(t,"remove",g,f)}),h.forEach(f=>ar(t,"remove","edge",f)),d.forEach(f=>{var v;const p=J(f);((v=this.context.element)===null||v===void 0?void 0:v.getElement(p))?a.edges.set(p,f):i.edges.set(p,f)})}else{const u=n.getChildrenData(o),c=u.map(J),{edges:h}=fm(c,d=>n.getRelatedEdgesData(d));[...u,...h].forEach(d=>{var f;const v=J(d),p=n.getElementType(v);((f=this.context.element)===null||f===void 0?void 0:f.getElement(v))?ar(t,"update",p,d):ar(t,"add",p,d),p==="combo"&&s.push([v,d])})}}return t}}const lO=(r,t,e,n)=>{const i=`${e}s`,a=J(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(J(n),n)};class CH extends da{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(lO(e,"add","node",t),Yn(t))return;const n=J(t);lO(e,"add","node",t),this.context.model.getRelatedEdgesData(n,"out").forEach(s=>{ar(e,"add","edge",s)}),this.context.model.getChildrenData(n).forEach(s=>{this.handleExpand(s,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(nr))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,l=new Map;i.forEach((c,h)=>{Yn(c)&&o.set(h,c)}),a.forEach(c=>{if(e.getElementType(c.source)!=="node")return;const h=e.getNodeData(c.source);Yn(h)&&o.set(c.source,h)}),s.forEach((c,h)=>{const d=this.getElement(h);if(!d)return;const f=d.attributes.collapsed;Yn(c)?f||o.set(h,c):f&&l.set(h,c)});const u=new Set;return o.forEach((c,h)=>{n.getDescendantsData(h).forEach(f=>{const v=J(f);if(u.has(v))return;ar(t,"remove","node",f),n.getRelatedEdgesData(v).forEach(g=>{ar(t,"remove","edge",g)}),u.add(v)})}),l.forEach((c,h)=>{if(n.getAncestorsData(h,nr).some(Yn)){ar(t,"remove","node",c);return}this.handleExpand(c,t)}),t}}function AC(r,t,e,n=!1){const i=am[r][t];!n&&i?i!==e&&ai.warn(`The extension ${t} of ${r} has been registered before.`):Object.assign(am[r],{[t]:e})}var PC=function(){function r(t){ht(this,r),this.dragndropPluginOptions=t}return dt(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(c){var h=c.target,d=h===s,f=d&&n.dragndropPluginOptions.isDocumentDraggable?s:h.closest&&h.closest("[draggable=true]");if(f){var v=!1,p=c.timeStamp,g=[c.clientX,c.clientY],y=null,m=[c.clientX,c.clientY],w=function(){var _=na(wn().mark(function k(T){var O,P,N,C,L,B;return wn().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(v){V.next=8;break}if(O=T.timeStamp-p,P=Wn([T.clientX,T.clientY],g),!(O<=n.dragndropPluginOptions.dragstartTimeThreshold||P<=n.dragndropPluginOptions.dragstartDistanceThreshold)){V.next=5;break}return V.abrupt("return");case 5:T.type="dragstart",f.dispatchEvent(T),v=!0;case 8:if(T.type="drag",T.dx=T.clientX-m[0],T.dy=T.clientY-m[1],f.dispatchEvent(T),m=[T.clientX,T.clientY],d){V.next=21;break}return N=n.dragndropPluginOptions.overlap==="pointer"?[T.canvasX,T.canvasY]:h.getBounds().center,V.next=17,s.elementsFromPoint(N[0],N[1]);case 17:C=V.sent,L=C[C.indexOf(h)+1],B=(L==null?void 0:L.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),y!==B&&(y&&(T.type="dragleave",T.target=y,y.dispatchEvent(T)),B&&(T.type="dragenter",T.target=B,B.dispatchEvent(T)),y=B,y&&(T.type="dragover",T.target=y,y.dispatchEvent(T)));case 21:case"end":return V.stop()}},k)}));return function(T){return _.apply(this,arguments)}}();o.addEventListener("pointermove",w);var E=function(k){if(v){k.detail={preventClick:!0};var T=k.clone();y&&(T.type="drop",T.target=y,y.dispatchEvent(T)),T.type="dragend",f.dispatchEvent(T),v=!1}o.removeEventListener("pointermove",w)};h.addEventListener("pointerup",E,{once:!0}),h.addEventListener("pointerupoutside",E,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",l)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",l)})}}])}();PC.tag="Dragndrop";var RH=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ht(this,t),e=Gt(this,t),e.name="dragndrop",e.options=n,e}return Wt(t,r),dt(t,[{key:"init",value:function(){this.addRenderingPlugin(new PC($t({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(n){Object.assign(this.plugins[0].dragndropPluginOptions,n)}}])}(aa),uO=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},cO=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};const hO=["main"],dO=["background","main","label","transient"];function LH(r){return r.main}class fO{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||LH(this.getLayers())}getLayers(){return this.extends.layers}getRenderer(t){return this.extends.renderers[t]}getCamera(t="main"){return this.getLayer(t).getCamera()}getRoot(t="main"){return this.getLayer(t).getRoot()}getContextService(t="main"){return this.getLayer(t).getContextService()}setCursor(t){this.config.cursor=t,this.getLayer().setCursor(t)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(t){this.config={enableMultiLayer:!0},Object.assign(this.config,t);const e=this.config,{renderer:n,background:i,cursor:a,enableMultiLayer:s}=e,o=cO(e,["renderer","background","cursor","enableMultiLayer"]),l=s?dO:hO,u=gO(n,l),c=Object.fromEntries(l.map(h=>{const d=new im(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:u[h],background:s?h==="background"?i:void 0:i}));return[h,d]}));vO(c),this.extends={config:this.config,renderer:n,renderers:u,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(t,e),i.setPosition(a),i.setFocalPoint(s)})}getBounds(t){return Zo(Object.values(this.getLayers()).map(e=>t?e.getRoot().childNodes.find(i=>i.classList.includes(t)):e.getRoot()).filter(e=>(e==null?void 0:e.childNodes.length)>0).map(e=>e.getBounds()))}getContainer(){const t=this.extends.config.container;return typeof t=="string"?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const i=((n=t.style)===null||n===void 0?void 0:n.$layer)||"main";return this.getLayer(i).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=gO(t,this.config.enableMultiLayer?dO:hO);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),vO(this.getLayers())}getCanvasByViewport(t){return bn(this.getLayer().viewport2Canvas(Cr(t)))}getViewportByCanvas(t){return bn(this.getLayer().canvas2Viewport(Cr(t)))}getViewportByClient(t){return bn(this.getLayer().client2Viewport(Cr(t)))}getClientByViewport(t){return bn(this.getLayer().viewport2Client(Cr(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(Cr(t));return bn(e.viewport2Canvas(n))}toDataURL(){return uO(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=cO(t,["mode"]);let[a,s,o,l]=[0,0,0,0];if(n==="viewport")[o,l]=this.getSize();else if(n==="overall"){const y=this.getBounds(),m=sa(y);[a,s]=y.min,[o,l]=m}const u=$y('<div id="virtual-image"></div>'),c=new im({width:o,height:l,renderer:new Ro,devicePixelRatio:e,container:u,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const h=this.getLayer("label").getRoot().cloneNode(!0),d=c.viewport2Canvas({x:0,y:0}),f=this.getCanvasByViewport([0,0]);h.translate([f[0]-d.x,f[1]-d.y]),h.scale(1/this.getCamera().getZoom()),c.appendChild(h),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const v=this.getCamera(),p=c.getCamera();if(n==="viewport")p.setZoom(v.getZoom()),p.setPosition(v.getPosition()),p.setFocalPoint(v.getFocalPoint());else if(n==="overall"){const[y,m,w]=p.getPosition(),[E,_,k]=p.getFocalPoint();p.setPosition([y+a,m+s,w]),p.setFocalPoint([E+a,_+s,k])}const g=c.getContextService();return new Promise(y=>{c.addEventListener(er.RERENDER,()=>uO(this,void 0,void 0,function*(){yield new Promise(w=>setTimeout(w,300));const m=yield g.toDataURL(i);y(m)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function gO(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new Ro;return n instanceof Ro&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new RH({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function vO(r){Object.entries(r).forEach(([t,e])=>{const n=e.getContextService().getDomElement();n!=null&&n.style&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,t!=="main"&&(n.style.pointerEvents="none")),n!=null&&n.parentElement&&(n.parentElement.style.display="grid")})}const os=r=>r?parseInt(r):0;function IH(r){const t=getComputedStyle(r),e=r.clientWidth||os(t.width),n=r.clientHeight||os(t.height),i=os(t.paddingLeft)+os(t.paddingRight),a=os(t.paddingTop)+os(t.paddingBottom);return[e-i,n-a]}function pO(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=IH(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(St(t)?t:a,a),Math.max(St(e)?e:s,s)]}class Ih{constructor(t){this.type=t}}class Xe extends Ih{constructor(t,e){super(t),this.data=e}}class br extends Ih{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class ls extends Ih{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class vu extends Ih{constructor(t,e){super(t),this.data=e}}function rn(r,t){r.emit(t.type,t)}function DH(r){if(!r)return null;if(r instanceof qT)return{type:"canvas",element:r};let t=r;for(;t;){if(rl(t))return{type:"node",element:t};if(HA(t))return{type:"edge",element:t};if(m1(t))return{type:"combo",element:t};t=t.parentElement}return null}function yO(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const _o="cachedStyle",sb=r=>`__${r}__`;function BH(r,t){const e=Array.isArray(t)?t:[t];Rn(r,_o)||Oo(r,_o,{}),e.forEach(n=>{Oo(Rn(r,_o),sb(n),r.attributes[n])})}function mO(r,t){return Rn(r,[_o,sb(t)])}function FH(r,t){return sb(t)in(Rn(r,_o)||{})}class zH{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var i,a,s;(i=e==null?void 0:e.before)===null||i===void 0||i.call(e);const o=this.getTasks().map(([u,c])=>{var h,d,f;const{element:v,elementType:p,stage:g}=u,y=UB(this.context.options,p,g,t);(h=c==null?void 0:c.before)===null||h===void 0||h.call(c);const m=y.length?HB(v,this.inferStyle(u,n),y):null;return m?((d=c==null?void 0:c.beforeAnimate)===null||d===void 0||d.call(c,m),m.finished.then(()=>{var w,E;(w=c==null?void 0:c.afterAnimate)===null||w===void 0||w.call(c,m),(E=c==null?void 0:c.after)===null||E===void 0||E.call(c),this.animations.delete(m)})):(f=c==null?void 0:c.after)===null||f===void 0||f.call(c),m}).filter(Boolean);o.forEach(u=>this.animations.add(u));const l=i1(o);return l?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,l),l.finished.then(()=>{var u,c;(u=e==null?void 0:e.afterAnimate)===null||u===void 0||u.call(e,l),(c=e==null?void 0:e.after)===null||c===void 0||c.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),l}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:u={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},l),u));const{modifiedStyle:c}=t,h={},d={};if(o==="enter")Object.assign(h,{opacity:0});else if(o==="exit")Object.assign(d,{opacity:0});else if(o==="show")Object.assign(h,{opacity:0}),Object.assign(d,{opacity:(n=mO(a,"opacity"))!==null&&n!==void 0?n:No("opacity")});else if(o==="hide")Object.assign(h,{opacity:(i=mO(a,"opacity"))!==null&&i!==void 0?i:No("opacity")}),Object.assign(d,{opacity:0});else if(o==="collapse"){const{collapse:f}=e||{},{target:v,descendants:p,position:g}=f;if(s==="node"){if(p.includes(a.id)){const[y,m,w]=g;Object.assign(d,{x:y,y:m,z:w})}}else if(s==="combo"){if(a.id===v||p.includes(a.id)){const[y,m]=g;Object.assign(d,{x:y,y:m,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if(o==="expand"){const{expand:f}=e||{},{target:v,descendants:p,position:g}=f;if(s==="node"){if(a.id===v||p.includes(a.id)){const[y,m,w]=g;Object.assign(h,{x:y,y:m,z:w})}}else if(s==="combo"){if(a.id===v||p.includes(a.id)){const[y,m,w]=g;Object.assign(h,{x:y,y:m,z:w,childrenNode:c.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(h).length>0?Object.assign({},l,h):l,Object.keys(d).length>0?Object.assign({},c,d):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,i=(e=(t=n.document)===null||t===void 0?void 0:t.timeline)===null||e===void 0?void 0:e.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class jH{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(t=!0){this.batchCount++,this.batchCount===1&&this.emit(new Xe(pt.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new Xe(pt.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class qH extends o1{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=DH(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(Ac(l)||l.destroyed))return;const{type:u,detail:c,button:h}=e,d=Object.assign(Object.assign({},e),{target:l,targetType:o,originalTarget:n});u===it.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${it.POINTER_LEAVE}`,Object.assign(Object.assign({},d),{type:it.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(d,{type:it.POINTER_ENTER}),a.emit(`${o}:${it.POINTER_ENTER}`,d))),this.currentTarget=l,this.currentTargetType=o),u===it.CLICK&&h===2||(a.emit(`${o}:${u}`,d),a.emit(u,d)),u===it.CLICK&&c===2&&(Object.assign(d,{type:it.DBLCLICK}),a.emit(`${o}:${it.DBLCLICK}`,d),a.emit(it.DBLCLICK,d)),u===it.POINTER_DOWN&&h===2&&(Object.assign(d,{type:it.CONTEXT_MENU,preventDefault:()=>{var f;(f=s.getContainer())===null||f===void 0||f.addEventListener(it.CONTEXT_MENU,v=>v.preventDefault(),{once:!0})}}),a.emit(`${o}:${it.CONTEXT_MENU}`,d),a.emit(it.CONTEXT_MENU,d))},this.forwardContainerEvents=e=>{this.context.graph.emit(e.type,e)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const t=this.context.canvas.getContainer();t&&[gs.KEY_DOWN,gs.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[it.CLICK,it.DBLCLICK,it.POINTER_OVER,it.POINTER_LEAVE,it.POINTER_ENTER,it.POINTER_MOVE,it.POINTER_OUT,it.POINTER_DOWN,it.POINTER_UP,it.CONTEXT_MENU,it.DRAG_START,it.DRAG,it.DRAG_END,it.DRAG_ENTER,it.DRAG_OVER,it.DRAG_LEAVE,it.DROP,it.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[gs.KEY_DOWN,gs.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var $o=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};function Di(r,t){const{data:e,style:n}=r,i=$o(r,["data","style"]),{data:a,style:s}=t,o=$o(t,["data","style"]),l=Object.assign(Object.assign({},i),o);return(e||a)&&Object.assign(l,{data:Object.assign(Object.assign({},e),a)}),(n||s)&&Object.assign(l,{style:Object.assign(Object.assign({},n),s)}),l}function Oy(r){const{data:t,style:e}=r,i=$o(r,["data","style"]);return t&&(i.data=Object.assign({},t)),e&&(i.style=Object.assign({},e)),i}function us(r={},t={}){const{states:e=[],data:n={},style:i={},children:a=[]}=r,s=$o(r,["states","data","style","children"]),{states:o=[],data:l={},style:u={},children:c=[]}=t,h=$o(t,["states","data","style","children"]),d=(v,p)=>v.length!==p.length?!1:v.every((g,y)=>g===p[y]),f=(v,p)=>{const g=Object.keys(v),y=Object.keys(p);return g.length!==y.length?!1:g.every(m=>v[m]===p[m])};return!(!f(s,h)||!d(a,c)||!d(e,o)||!f(n,l)||!f(i,u))}var $H=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};function Ty(r){const{id:t=J(r),style:e,data:n}=r,i=$H(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},e),data:Object.assign({},n)});return tF(r)?Object.assign({id:t,data:a},i):{id:t,data:a}}function cn(r){return r.data}function GH(r){if(r.hasTreeStructure(nr))return;r.attachTreeStructure(nr);const t=r.getAllEdges();for(const e of t){const{source:n,target:i}=e;r.setParent(i,n,nr)}}class WH{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new ln}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Se.NodeUpdated||e===Se.EdgeUpdated||e===Se.ComboUpdated){const{value:n,original:i}=t;this.changes.push({value:Oy(n),original:Oy(i),type:e})}else this.changes.push({value:Oy(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}isBatching(){return this.batchCount>0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=cn(n);return this.isCombo(J(i))||(t===void 0||t.includes(J(i)))&&e.push(i),e},[])}getEdgeDatum(t){return cn(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=cn(n);return(t===void 0||t.includes(J(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=cn(n);return this.isCombo(J(i))&&(t===void 0||t.includes(J(i)))&&e.push(i),e},[])}getRootsData(t=nr){return this.model.getRoots(t).map(cn)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(cn)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Aa(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(J(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){ai.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const i=n.getParent(t,e);return i?cn(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?nr:le,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(cn)}getElementsDataByType(t){return t==="node"?this.getNodeData():t==="edge"?this.getEdgeData():t==="combo"?this.getComboData():[]}getElementDataById(t){return this.getElementType(t)==="edge"?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){const e=this.model.getNode(t);return cn(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=cn(n);return t?t.includes(J(i))&&e.push(i):e.push(i),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(e)})}getElementState(t){var e;return((e=this.getElementDataById(t))===null||e===void 0?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(cn)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(cn)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),l=Zi(a,e,h=>J(h),us),u=Zi(s,n,h=>J(h),us),c=Zi(o,i,h=>J(h),us);this.batch(()=>{const h={nodes:l.enter,edges:u.enter,combos:c.enter};this.addData(h),this.computeZIndex(h,"add",!0);const d={nodes:l.update,edges:u.update,combos:c.update};this.updateData(d),this.computeZIndex(d,"update",!0);const f={nodes:l.exit.map(J),edges:u.exit.map(J),combos:c.exit.map(J)};this.removeData(f)})}addData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.addComboData(i),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(e=>(this.pushChange({value:e,type:Se.NodeAdded}),Ty(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:Se.EdgeAdded}),Ty(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(le)||e.attachTreeStructure(le),e.addNodes(t.map(n=>(this.comboIds.add(J(n)),this.pushChange({value:n,type:Se.ComboAdded}),Ty(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(J);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:t,target:a})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=t;s.forEach(o=>{var l,u,c;const h=J(o);if(e==="add"&&St((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o))return;const d=this.getParentData(h,le),f=d?((c=(u=d.style)===null||u===void 0?void 0:u.zIndex)!==null&&c!==void 0?c:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:h,style:{zIndex:f}}])})}),i.forEach(o=>{var l,u,c;const h=J(o);if(e==="add"&&St((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let d=0;const f=this.getParentData(h,le);if(f)d=(((u=f.style)===null||u===void 0?void 0:u.zIndex)||0)+1;else{const v=this.getParentData(h,nr);v&&(d=((c=v==null?void 0:v.style)===null||c===void 0?void 0:c.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:h,style:{zIndex:d}}])})}),a.forEach(o=>{var l,u,c,h,d;if(St((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:f,source:v,target:p}=o;if(!f)f=J(o);else{const m=this.getEdgeDatum(f);v=m.source,p=m.target}if(!v||!p)return;const g=((c=(u=this.getNodeLikeDatum(v))===null||u===void 0?void 0:u.style)===null||c===void 0?void 0:c.zIndex)||0,y=((d=(h=this.getNodeLikeDatum(p))===null||h===void 0?void 0:h.style)===null||d===void 0?void 0:d.zIndex)||0;this.updateEdgeData([{id:J(o),style:{zIndex:Math.max(g,y)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),i=this.getElementDataById(t),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>J(s)!==t)}),n==="combo"&&!Yn(i)){const s=new Set(this.getAncestorsData(t,le).map(J));a.nodes=a.nodes.filter(o=>!s.has(J(o))),a.combos=a.combos.filter(o=>!s.has(J(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}return Math.max(((e=i.style)===null||e===void 0?void 0:e.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(n=>{const i=J(n),a=Yl(n);a!==void 0&&(e.hasTreeStructure(le)||e.attachTreeStructure(le),a===null&&this.refreshComboData(i),this.setParent(i,Yl(n),le));const s=n.children||[];if(s.length){e.hasTreeStructure(nr)||e.attachTreeStructure(nr);const o=s.filter(l=>e.hasNode(l));o.forEach(l=>this.setParent(l,i,nr)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(i=>{const a=J(i),s=cn(e.getNode(a));if(us(s,i))return;const o=Di(s,i);this.pushChange({value:o,original:s,type:Se.NodeUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach(i=>{this.pushChange({value:i,original:i,type:Se.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:Se.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Se.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=J(t);if(!e.hasNode(n))return;const i=cn(e.getNode(n)),a=Di(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=J(t);if(!e.hasEdge(n))return;const i=cn(e.getEdge(n)),a=Di(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=J(n),a=cn(e.getEdge(i));if(us(a,n))return;n.source&&a.source!==n.source&&e.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&e.updateEdgeTarget(i,n.target);const s=Di(a,n);this.pushChange({value:s,original:a,type:Se.EdgeUpdated}),e.mergeEdgeData(i,s)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(i=>{const a=J(i),s=cn(e.getNode(a));if(us(s,i))return;const o=Di(s,i);this.pushChange({value:o,original:s,type:Se.ComboUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:t},"update")}setParent(t,e,n,i=!0){if(t===e)return;const a=this.getNodeLikeDatum(t),s=Yl(a);if(s!==e&&n===le){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===le&&v3([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,le);e&&this.pushChange({value:e,original:e,type:Se.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Se.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return an(e)}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=this.getElementPosition(t),i=qt(n,[...e,0].slice(0,3));this.translateNodeTo(t,i)}translateNodeTo(t,e){const[n=0,i=0,a=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:i,z:a}}])})}translateComboBy(t,e){const[n=0,i=0,a=0]=e;if([n,i,a].some(isNaN)||[n,i,a].every(l=>l===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;Aa(s,l=>{const u=J(l);if(o.has(u))return;o.add(u);const[c,h,d]=an(l),f=Di(l,{style:{x:c+n,y:h+i,z:d+a}});this.pushChange({value:f,original:l,type:this.isCombo(u)?Se.ComboUpdated:Se.NodeUpdated}),this.model.mergeNodeData(u,f)},l=>this.getChildrenData(J(l)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[i=0,a=0,s=0]=e,o=(n=this.getComboData([t]))===null||n===void 0?void 0:n[0];if(!o)return;const[l,u,c]=an(o),h=i-l,d=a-u,f=s-c;Aa(o,v=>{const p=J(v),[g,y,m]=an(v),w=Di(v,{style:{x:g+h,y:y+d,z:m+f}});this.pushChange({value:w,original:v,type:this.isCombo(p)?Se.ComboUpdated:Se.NodeUpdated}),this.model.mergeNodeData(p,w)},v=>this.getChildrenData(J(v)),"BT")}removeData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.removeEdgeData(this.getRelatedEdgesData(e).map(J)),this.pushChange({value:this.getNodeData([e])[0],type:Se.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:Se.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:Se.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(le)){const e=Yl(this.getNodeLikeDatum(t));this.setParent(t,void 0,le,!1),this.model.getChildren(t,le).forEach(n=>{const i=cn(n),a=J(i);this.setParent(J(i),e,le,!1);const s=Di(i,{id:J(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?Se.ComboUpdated:Se.NodeUpdated}),this.model.mergeNodeData(J(i),s)}),Rt(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(wi(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map(i=>i.id)),t.removeNodes(e.map(i=>i.id)),this.context={}}}var ro=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class VH{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new on({className:"elements"}))}}emit(t,e){e.silence||rn(this.context.graph,t)}forEachElementData(t){za.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:i,graph:a}=this.context,s=((n=i[t])===null||n===void 0?void 0:n.type)||e.type;return s?typeof s=="string"?s:s.call(a,e):t==="edge"?"line":"circle"}getTheme(t){return QT(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map(i=>n[i]||{}))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData((e,n)=>{var i,a;const s=Object.assign({},xw((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),xw((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,KF(n,s))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?t==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:i}=this.context,a=((n=i[t])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[J(e.datum)]=ww(a,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];(t===void 0||t.includes(J(o)))&&this.computeElementDefaultStyle(n,{datum:o,graph:e})}})}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}getElementStateStyle(t,e,n){var i,a;const{options:s}=this.context,o=((a=(i=s[t])===null||i===void 0?void 0:i.state)===null||a===void 0?void 0:a[e])||{};return ww(o,n)}computeElementStatesStyle(t,e,n){this.stateStyle[J(n.datum)]=Object.assign({},...e.map(i=>this.getElementStateStyle(t,i,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];if(t===void 0||t.includes(J(o))){const l=this.getElementState(J(o));this.computeElementStatesStyle(n,l,{datum:o,graph:e})}}})}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getNodes(){return this.context.model.getNodeData().map(({id:t})=>this.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[J(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=J(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(t,this.getElementState(n)),u=this.getStateStyle(n),c=Object.assign({},i,a,s,o,l,u);if(t==="combo"){const h=this.context.model.getChildrenData(n),f=!!c.collapsed?[]:h.map(J).filter(v=>this.getElement(v));Object.assign(c,{childrenNode:f,childrenData:h})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:i=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(i),{type:n,stage:i,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:i,remove:a}}}=e;return this.destroyElements(a,t),this.createElements(n,t),this.updateElements(i,t),this.setAnimationTask(t,e)}preLayoutDraw(){return ro(this,arguments,void 0,function*(t={animation:!0}){var e,n;const i=this.getDrawData(t);if(!i)return;const{data:{drawData:a}}=i;yield(n=(e=this.context.layout)===null||e===void 0?void 0:e.preLayout)===null||n===void 0?void 0:n.call(e,a);const{add:s,update:o,remove:l}=a;return this.destroyElements(l,t),this.createElements(s,t),this.updateElements(o,t),this.setAnimationTask(t,i)})}setAnimationTask(t,e){const{animation:n,silence:i}=t,{data:{dataChanges:a,drawData:s},stage:o,type:l}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new Xe(pt.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),t),beforeAnimate:u=>this.emit(new br(pt.BEFORE_ANIMATE,Gn.DRAW,u,s),t),afterAnimate:u=>this.emit(new br(pt.AFTER_ANIMATE,Gn.DRAW,u,s),t),after:()=>this.emit(new Xe(pt.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render",firstRender:this.context.graph.rendered===!1}),t)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),i=U1(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:u=[],EdgeRemoved:c=[],ComboAdded:h=[],ComboUpdated:d=[],ComboRemoved:f=[]}=cc(i,y=>y.type),v=y=>new Map(y.map(m=>{const w=m.value;return[J(w),w]})),p={add:{nodes:v(a),edges:v(l),combos:v(h)},update:{nodes:v(s),edges:v(u),combos:v(d)},remove:{nodes:v(o),edges:v(c),combos:v(f)}},g=this.transformData(p,t);return e.clearChanges(),{dataChanges:n,drawData:g}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,e),t)}createElement(t,e,n){var i;const a=J(e);if(this.getElement(a))return;const o=this.getElementType(t,e),l=this.getElementComputedStyle(t,e),u=_i(t,o);if(!u)return ai.warn(`The element ${o} of ${t} is not registered.`);this.emit(new ls(pt.BEFORE_ELEMENT_CREATE,t,e),n);const c=this.container.appendChild(new u({id:a,context:this.context,style:l}));this.shapeTypeMap[a]=o,this.elementMap[a]=c;const{stage:h="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:c,elementType:t,stage:h,originalStyle:Object.assign({},c.attributes),updatedStyle:l},{after:()=>{var d;this.emit(new ls(pt.AFTER_ELEMENT_CREATE,t,e),n),(d=c.onCreate)===null||d===void 0||d.call(c)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.createElement(o,u,e))})}getUpdateStageStyle(t,e,n){const{stage:i="update"}=n;if(i==="translate")if(t==="node"||t==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=e;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(t,e)}updateElement(t,e,n){var i;const a=J(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new ls(pt.BEFORE_ELEMENT_UPDATE,t,e),n);const l=this.getElementType(t,e),u=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const c=s!=="visibility"?s:u.visibility==="hidden"?"hide":"show";c==="hide"&&delete u.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:c,originalStyle:Object.assign({},o.attributes),updatedStyle:u},{before:()=>{const h=this.elementMap[a];s!=="collapse"&&vm(h,u),s==="visibility"&&(FH(h,"opacity")||BH(h,"opacity"),this.visibilityCache.set(h,c==="show"?"visible":"hidden"),c==="show"&&Ba(h,"visible"))},after:()=>{var h;const d=this.elementMap[a];s==="collapse"&&vm(d,u),c==="hide"&&Ba(d,this.visibilityCache.get(d)),this.emit(new ls(pt.AFTER_ELEMENT_UPDATE,t,e),n),(h=d.onUpdate)===null||h===void 0||h.call(d)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.updateElement(o,u,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=J(n),a=this.getElement(i);a&&H4(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=J(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new ls(pt.BEFORE_ELEMENT_DESTROY,t,e),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:a,originalStyle:Object.assign({},o.attributes),updatedStyle:{}},{after:()=>{var l;this.clearElement(s),o.destroy(),(l=o.onDestroy)===null||l===void 0||l.call(o),this.emit(new ls(pt.AFTER_ELEMENT_DESTROY,t,e),n)}})}destroyElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["combo",a],["edge",i],["node",n]].forEach(([o,l])=>{l.forEach(u=>this.destroyElement(o,u,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,i;const a=(n=t.nodes)===null||n===void 0?void 0:n.find(s=>J(s)===e);if(a){const s=an(this.context.model.getNodeLikeDatum(e)),o=an(a),l=oe(s,o);(i=t.nodes)===null||i===void 0||i.forEach(u=>{var c,h,d;!((c=u.style)===null||c===void 0)&&c.x&&(u.style.x+=l[0]),!((h=u.style)===null||h===void 0)&&h.y&&(u.style.y+=l[1]),!((d=u.style)===null||d===void 0)&&d.z&&(u.style.z+=l[2]||0)})}}collapseNode(t,e){return ro(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=e,{model:s,layout:o}=this.context,l=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!l)return;this.markDestroyElement(l.drawData);const u=yield o.simulate();a&&this.alignLayoutResultToElement(u,t),s.updateData(u);const c=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!c)return;const{drawData:h}=c,{add:d,remove:f,update:v}=h;this.markDestroyElement(h);const p={animation:i,stage:"collapse",data:h};this.destroyElements(f,p),this.createElements(d,p),this.updateElements(v,p),yield(n=this.context.animation.animate(i,{beforeAnimate:g=>this.emit(new br(pt.BEFORE_ANIMATE,Gn.COLLAPSE,g,h),p),afterAnimate:g=>this.emit(new br(pt.AFTER_ANIMATE,Gn.COLLAPSE,g,h),p)},{collapse:{target:t,descendants:Array.from(f.nodes).map(([,g])=>J(g)),position:an(v.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return ro(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=e,l=an(i.getNodeData([t])[0]),u=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!u)return;const{drawData:{add:c}}=u;this.createElements(c,{animation:!1,stage:"expand",target:t}),this.context.animation.clear();const h=yield a.simulate();o&&this.alignLayoutResultToElement(h,t),i.updateData(h),this.computeStyle("expand");const d=this.computeChangesAndDrawData({stage:"collapse",animation:s});if(!d)return;const{drawData:f}=d,{update:v}=f,p={animation:s,stage:"expand",data:f};c.edges.forEach(g=>v.edges.set(J(g),g)),c.nodes.forEach(g=>v.nodes.set(J(g),g)),this.updateElements(v,p),yield(n=this.context.animation.animate(s,{beforeAnimate:g=>this.emit(new br(pt.BEFORE_ANIMATE,Gn.EXPAND,g,f),p),afterAnimate:g=>this.emit(new br(pt.AFTER_ANIMATE,Gn.EXPAND,g,f),p)},{expand:{target:t,descendants:Array.from(c.nodes).map(([,g])=>J(g)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return ro(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,le).some(p=>Yn(p)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!l)return;const{dataChanges:u,drawData:c}=l;this.markDestroyElement(c);const{update:h,remove:d}=c,f={animation:e,stage:"collapse",data:c};this.destroyElements(d,f),this.updateElements(h,f);const v=p=>Array.from(p).map(([,g])=>J(g));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new Xe(pt.BEFORE_DRAW,{dataChanges:u,animation:e}),f),beforeAnimate:p=>this.emit(new br(pt.BEFORE_ANIMATE,Gn.COLLAPSE,p,c),f),afterAnimate:p=>this.emit(new br(pt.AFTER_ANIMATE,Gn.COLLAPSE,p,c),f),after:()=>this.emit(new Xe(pt.AFTER_DRAW,{dataChanges:u,animation:e}),f)},{collapse:{target:t,descendants:[...v(d.nodes),...v(d.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return ro(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=an(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:u,update:c}=l,h={animation:e,stage:"expand",data:l,target:t};this.createElements(u,h),this.updateElements(c,h);const d=f=>Array.from(f).map(([,v])=>J(v));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new Xe(pt.BEFORE_DRAW,{dataChanges:o,animation:e}),h),beforeAnimate:f=>this.emit(new br(pt.BEFORE_ANIMATE,Gn.EXPAND,f,l),h),afterAnimate:f=>this.emit(new br(pt.AFTER_ANIMATE,Gn.EXPAND,f,l),h),after:()=>this.emit(new Xe(pt.AFTER_DRAW,{dataChanges:o,animation:e}),h)},{expand:{target:t,descendants:[...d(u.nodes),...d(u.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}var cs=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},UH=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};class YH{get presetOptions(){return{animation:!!tA(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.instances=[],this.context=t}getLayoutInstance(){return this.instances}preLayout(t){return cs(this,void 0,void 0,function*(){var e,n,i,a;const{graph:s,model:o}=this.context,{add:l}=t;rn(s,new Xe(pt.BEFORE_LAYOUT,{type:"pre"}));const u=yield(e=this.context.layout)===null||e===void 0?void 0:e.simulate();(n=u==null?void 0:u.nodes)===null||n===void 0||n.forEach(c=>{const h=J(c),d=l.nodes.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),(i=u==null?void 0:u.edges)===null||i===void 0||i.forEach(c=>{const h=J(c),d=l.edges.get(h);o.syncEdgeDatum(c),d&&Object.assign(d.style,c.style)}),(a=u==null?void 0:u.combos)===null||a===void 0||a.forEach(c=>{const h=J(c),d=l.combos.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),rn(s,new Xe(pt.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return cs(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;rn(n,new Xe(pt.BEFORE_LAYOUT,{type:"post"}));for(const i of e){const a=e.indexOf(i),s=this.getLayoutData(i),o=Object.assign(Object.assign({},this.presetOptions),i);rn(n,new Xe(pt.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);rn(n,new Xe(pt.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}rn(n,new Xe(pt.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(t,e){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(i=>i.afterLayout(t,e))}simulate(){return cs(this,void 0,void 0,function*(){if(!this.options)return{};const t=Array.isArray(this.options)?this.options:[this.options];let e={};for(const n of t){const i=t.indexOf(n),a=this.getLayoutData(n);e=yield this.stepLayout(a,Object.assign(Object.assign(Object.assign({},this.presetOptions),n),{animation:!1}),i)}return e})}stepLayout(t,e,n){return cs(this,void 0,void 0,function*(){return ez(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return cs(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=e,o=this.initGraphLayout(e);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const u=o;return this.supervisor=new GW(u.graphData2LayoutModel(t),u.instance,{iterations:s}),xu(yield this.supervisor.execute())}if(Em(o))return i?yield o.execute(t,{onTick:u=>{this.updateElementPosition(u,!1)}}):(o.execute(t),o.stop(),o.tick(s));const l=yield o.execute(t);if(i){const u=this.updateElementPosition(l,i);yield u==null?void 0:u.finished}return l})}treeLayout(t,e,n){return cs(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=_i("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=t,u=new ln({nodes:o.map(v=>({id:J(v),data:v.data||{}})),edges:l.map(v=>({id:J(v),source:v.source,target:v.target,data:v.data||{}}))});GH(u);const c={nodes:[],edges:[]},h={nodes:[],edges:[]};u.getRoots(nr).forEach(v=>{Aa(v,w=>{w.children=u.getSuccessors(w.id)},w=>u.getSuccessors(w.id),"TB");const p=s(v,e),{x:g,y,z:m=0}=p;Aa(p,w=>{const{id:E,x:_,y:k,z:T=0}=w;c.nodes.push({id:E,style:{x:g,y,z:m}}),h.nodes.push({id:E,style:{x:_,y:k,z:T}})},w=>w.children,"TB")});const f=this.inferTreeLayoutOffset(h);if(bO(h,f),a){bO(c,f),this.updateElementPosition(c,!1);const v=this.updateElementPosition(h,a);yield v==null?void 0:v.finished}return h})}inferTreeLayoutOffset(t){var e;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(e=t.nodes)===null||e===void 0||e.forEach(p=>{const{x:g=0,y=0}=p.style||{};n=Math.min(n,g),i=Math.max(i,g),a=Math.min(a,y),s=Math.max(s,y)});const{canvas:o}=this.context,l=o.getSize(),[u,c]=o.getCanvasByViewport([0,0]),[h,d]=o.getCanvasByViewport(l);if(n>=u&&i<=h&&a>=c&&s<=d)return[0,0];const f=(u+h)/2,v=(c+d)/2;return[f-(n+i)/2,v-(a+s)/2]}stopLayout(){this.instance&&Em(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=()=>!0,preLayout:n=!1,isLayoutInvisibleNodes:i=!1}=t,{nodes:a,edges:s,combos:o}=this.context.model.getData(),{element:l,model:u}=this.context,c=p=>l.getElement(p),h=n?p=>{var g;return!i&&(((g=p.style)===null||g===void 0?void 0:g.visibility)==="hidden"||u.getAncestorsData(p.id,nr).some(Yn)||u.getAncestorsData(p.id,le).some(Yn))?!1:e(p)}:p=>{const g=J(p),y=c(g);return!y||Ac(y)?!1:e(p)},d=a.filter(h),f=new Map(d.map(p=>[J(p),p]));o.forEach(p=>f.set(J(p),p));const v=s.filter(({source:p,target:g})=>f.has(p)&&f.has(g));return{nodes:d,edges:v,combos:o}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=t,u=UH(t,["type","enableWorker","animation","iterations"]),[c,h]=i.getCanvasSize(),d=[c/2,h/2],f=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:m=>{const w=n==null?void 0:n.getElement(m.id);return w?w.attributes.size:n==null?void 0:n.getElementComputedStyle("node",m).size},v=_i("layout",a);if(!v)return ai.warn(`The layout of ${a} is not registered.`);const p=Object.getPrototypeOf(v.prototype)===Lc.prototype?v:rz(v,this.context),g=new p(this.context),y={nodeSize:f,width:c,height:h,center:d};switch(g.id){case"d3-force":case"d3-force-3d":Object.assign(y,{center:{x:c/2,y:h/2,z:0}});break}return Bn(g.options,y,u),g}updateElementPosition(t,e){const{model:n,element:i}=this.context;return i?(n.updateData(t),i.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},(t=this.supervisor)===null||t===void 0||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const bO=(r,t)=>{var e;const[n,i]=t;(e=r.nodes)===null||e===void 0||e.forEach(a=>{if(a.style){const{x:s=0,y:o=0}=a.style;a.style.x=s+n,a.style.y=o+i}else a.style={x:n,y:i}})};function HH(r){return[XH].reduce((e,n)=>n(e),r)}function XH(r){return!r.layout||Array.isArray(r.layout)||"preLayout"in r.layout||["antv-dagre","combo-combined","compact-box","circular","concentric","dagre","fishbone","grid","indented","mds","radial","random","snake","dendrogram","mindmap"].includes(r.layout.type)&&(r.layout.preLayout=!0),r}class KH extends o1{constructor(t){super(t),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){const e=this.extensionMap[t];if(e)return e;ai.warn(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===t);if(n)return this.extensionMap[n.key]}}const pu=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class ZH extends o1{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...pu.slice(0,pu.length-1),...t,pu[pu.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var io=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class JH{get padding(){return si(this.context.options.padding)}get paddingOffset(){const[t,e,n,i]=this.padding,[a,s,o]=[(i-e)/2,(t-n)/2,0];return[a,s,o]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=e,y:o=n}=t.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const a=Object.entries(t.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=e[n];if(typeof s=="function")return(...o)=>{const l=s.apply(e,o);return a.forEach(u=>{u[n].apply(u,o)}),l}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=tA(this.context.options,t);return e?Ra(Object.assign({},e),["easing","duration"]):!1}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:i=[]}=t,a=this.getZoom(),s=e.getPosition(),o=e.getFocalPoint(),[l,u]=this.getCanvasCenter(),[c=0,h=0,d=0]=i,f=Dr([-c,-h,-d],a);return n==="relative"?{position:qt(s,f),focalPoint:qt(o,f)}:{position:qt([l,u,s[2]],f),focalPoint:qt([l,u,o[2]],f)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:e==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=t;return De(i==="relative"?n*a:a,...e)}transform(t,e){return io(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const l=this.getAnimation(e);if(rn(n,new vu(pt.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),rn(n,new vu(pt.AFTER_TRANSFORM,t));return}const u={};if(i&&Object.assign(u,this.getTranslateOptions(t)),St(a)&&Object.assign(u,this.getRotateOptions(t)),St(s)&&Object.assign(u,{zoom:this.getZoomOptions(t)}),l)return rn(n,new br(pt.BEFORE_ANIMATE,Gn.TRANSFORM,null,t)),new Promise(c=>{this.transformResolver=c,this.camera.gotoLandmark(this.createLandmark(u),Object.assign(Object.assign({},l),{onfinish:()=>{rn(n,new br(pt.AFTER_ANIMATE,Gn.TRANSFORM,null,t)),rn(n,new vu(pt.AFTER_TRANSFORM,t)),this.transformResolver=void 0,c()}}))});this.camera.gotoLandmark(this.createLandmark(u),{duration:0}),rn(n,new vu(pt.AFTER_TRANSFORM,t))})}fitView(t,e){return io(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=t||{},[u,c]=this.context.canvas.getSize(),h=u-s-i,d=c-n-a,f=this.context.canvas.getBounds(),v=this.getBBoxInViewport(f),[p,g]=sa(v),y=l==="x"&&p>=h||l==="y"&&g>=d||l==="both"&&p>=h&&g>=d;if(o==="overflow"&&!y)return yield this.fitCenter({animation:e});const m=h/p,w=d/g,E=l==="x"?m:l==="y"?w:Math.min(m,w),_=this.getAnimation(e);yield this.transform({mode:"relative",scale:E,translate:qt(oe(this.getCanvasCenter(),this.getBBoxInViewport(f).center),Dr(this.paddingOffset,E))},_)})}fitCenter(t){return io(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return io(this,arguments,void 0,function*(e,n={}){const{element:i}=this.context;if(!i)return;const a=o=>n.shapes?o.getShape(n.shapes).getRenderBounds():o.getRenderBounds(),s=Zo(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return io(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=oe(i,n);yield this.transform({mode:"relative",translate:qt(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,l]=i.getViewportByCanvas(n),u=new ge;return u.setMinMax([a,s,0],[o,l,0]),u}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[l,u]=i.getCanvasByViewport(a);let c=new ge;return c.setMinMax([s,o,0],[l,u,0]),n&&(c=oa(c,n)),As(t)?Ir(t,c):e?rF(t,c):c.intersects(t)}cancelAnimation(){var t,e;!((t=this.camera.landmarks)===null||t===void 0)&&t.length&&this.camera.cancelLandmarkAnimation(),(e=this.transformResolver)===null||e===void 0||e.call(this)}}var de=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Dh extends Rc{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new WH},this.isCollapsingExpanding=!1,this.onResize=Wo(()=>{this.resize()},300),this._setOptions(Object.assign({},Dh.defaultOptions,t),!0),this.context.graph=this,this.options.autoResize&&((e=globalThis.addEventListener)===null||e===void 0||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),Object.assign(this.options,HH(t)),e){const{data:d}=t;d&&this.addData(d);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:u,theme:c,transforms:h}=t;n&&this.setBehaviors(n),a&&this.setData(a),l&&this.setNode(l),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),c&&this.setTheme(c),u&&this.setPlugins(u),h&&this.setTransforms(h)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Ot(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Ot(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Ot(t)?t(this.getBehaviors()):t,(e=this.context.behavior)===null||e===void 0||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Ot(t)?t(this.getPlugins()):t,(e=this.context.plugin)===null||e===void 0||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Ot(t)?t(this.getTransforms()):t,(e=this.context.transform)===null||e===void 0||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map(e=>this.context.model.getElementDataById(e)):this.context.model.getElementDataById(t)}getNodeData(t){var e;return t===void 0?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):(e=this.context.model.getNodeData([t]))===null||e===void 0?void 0:e[0]}getEdgeData(t){var e;return t===void 0?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):(e=this.context.model.getEdgeData([t]))===null||e===void 0?void 0:e[0]}getComboData(t){var e;return t===void 0?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):(e=this.context.model.getComboData([t]))===null||e===void 0?void 0:e[0]}setData(t){this.context.model.setData(Ot(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Ot(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Ot(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Ot(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Ot(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Ot(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Ot(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Ot(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Ot(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Ot(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Ot(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Ot(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Ot(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return de(this,void 0,void 0,function*(){var t;if(this.context.canvas)return yield this.context.canvas.ready;const{container:e="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:l,devicePixelRatio:u=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof fO)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const c=ee(e)?document.getElementById(e):e,h=pO(c);this.emit(pt.BEFORE_CANVAS_INIT,{container:c,width:n,height:i});const d=Object.assign(Object.assign({},l),{container:c,width:n||h[0],height:i||h[1],background:o,renderer:a,cursor:s,devicePixelRatio:u}),f=new fO(d);this.context.canvas=f,yield f.ready,this.emit(pt.AFTER_CANVAS_INIT,{canvas:f})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,l=this.context.canvas;l&&(i&&(this.emit(pt.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(pt.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(St(o)||St(s))&&this.setSize((e=o!=null?o:this.options.width)!==null&&e!==void 0?e:0,(n=s!=null?s:this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new jH(this.context)),this.context.plugin||(this.context.plugin=new KH(this.context)),this.context.viewport||(this.context.viewport=new JH(this.context)),this.context.transform||(this.context.transform=new ZH(this.context)),this.context.element||(this.context.element=new VH(this.context)),this.context.animation||(this.context.animation=new zH(this.context)),this.context.layout||(this.context.layout=new YH(this.context)),this.context.behavior||(this.context.behavior=new qH(this.context))}prepare(){return de(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(wi("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return de(this,void 0,void 0,function*(){if(yield this.prepare(),rn(this,new Xe(pt.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&nz(this.options.layout)){const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}this.rendered=!0,rn(this,new Xe(pt.AFTER_RENDER))})}draw(){return de(this,void 0,void 0,function*(){var t;yield this.prepare(),yield(t=this.context.element.draw())===null||t===void 0?void 0:t.finished})}layout(t){return de(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return de(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;rn(this,new Xe(pt.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.destroy(),o==null||o.destroy(),e==null||e.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(t=globalThis.removeEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize),this.destroyed=!0,rn(this,new Xe(pt.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=pO((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[t||i[0],e||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();Be(a,s)||(rn(this,new Xe(pt.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),rn(this,new Xe(pt.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return de(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(t,e)})}fitCenter(t){return de(this,void 0,void 0,function*(){var e;yield(e=this.context.viewport)===null||e===void 0?void 0:e.fitCenter({animation:t})})}autoFit(){return de(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(ee(t))t==="view"?yield this.fitView():t==="center"&&(yield this.fitCenter());else{const{type:e,animation:n}=t;e==="view"?yield this.fitView(t.options,n):e==="center"&&(yield this.fitCenter(n))}})}focusElement(t,e){return de(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return de(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return de(this,void 0,void 0,function*(){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return de(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return de(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return de(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return de(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return oe([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return de(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=Ve(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeBy(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return de(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=Ve(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeTo(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Wm(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return de(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=Ve(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([f,v])=>{const p=this.getElementType(f);c[`${p}s`].push({id:f,style:{visibility:v}})});const{model:h,element:d}=this.context;h.preventUpdateNodeLikeHierarchy(()=>{h.updateData(c)}),yield(o=d.draw({animation:u,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return de(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),e)})}hideElement(t,e){return de(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),e)})}getElementVisibility(t){var e,n;const i=this.context.element.getElement(t);return(n=(e=i==null?void 0:i.style)===null||e===void 0?void 0:e.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(t,e){return de(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=Ve(t)?t:{[t]:e};Object.entries(a).forEach(([l,u])=>{const c=this.getElementType(l);i[`${c}s`].push({id:l,style:{zIndex:u}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(t){return de(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,i={};e.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const l=n.getAncestorsData(a,le).at(-1)||this.getComboData(a),u=[l,...n.getDescendantsData(J(l))],c=s-yO(l);u.forEach(d=>{i[J(d)]=this.getElementZIndex(J(d))+c});const{internal:h}=fm(u.map(J),d=>n.getRelatedEdgesData(d));h.forEach(d=>{const f=J(d);i[f]=this.getElementZIndex(f)+c})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return yO(this.context.model.getElementDataById(t))}setElementState(t,e){return de(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=Ve(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c=d=>d?Array.isArray(d)?d:[d]:[],h={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([d,f])=>{const v=this.getElementType(d);h[`${v}s`].push({id:d,states:c(f)})}),this.updateData(h),yield(o=this.context.element.draw({animation:u,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return de(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(Yn(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);yield this.frontElement(e),this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!0),s==="node"?yield a.collapseNode(e,n):s==="combo"&&(yield a.collapseCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return de(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!Yn(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!1),s==="node"?yield a.expandNode(e,n):s==="combo"&&(yield a.expandCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);n==="node"?this.updateNodeData([{id:t,style:{collapsed:e}}]):n==="combo"&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return de(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}Dh.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var QH=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};function tX(r,t){const{getNodeData:e=(o,l)=>{if(o.depth=l,!o.children)return o;const{children:u}=o,c=QH(o,["children"]);return Object.assign(Object.assign({},c),{children:u.map(h=>h.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return Aa(r,(o,l)=>{a.push(e(o,l));const u=i(o);for(const c of u)s.push(n(o,c))},o=>i(o),"TB"),{nodes:a,edges:s}}class eX extends da{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{NC(i,a)}),t}}const NC=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=Rw(i,h=>r.getParentData(h,le)),o=Rw(a,h=>r.getParentData(h,le)),l=J(s),u=J(o),c={sourceNode:l,targetNode:u};return t.style?Object.assign(t.style,c):t.style=c,t},nX=(r,t,e)=>{const[n,i]=t,[a,s]=e;if(i===n)return a;const o=(r-n)/(i-n);return a+o*(s-a)},rX=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.log(r-n+1)/Math.log(i-n+1);return a+o*(s-a)},iX=(r,t,e,n=2)=>{const[i,a]=t,[s,o]=e,l=Math.pow((r-i)/(a-i),n);return s+l*(o-s)},aX=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class Bh extends da{constructor(t,e){super(t,Bn({},Bh.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const u=[i,a],c=[s[0],o[0]],h=[s[1],o[1]],d=[s[2],o[2]],f=(v,p)=>{if(typeof l=="function")return l(v,u,p);switch(l){case"linear":return nX(v,u,p);case"log":return rX(v,u,p);case"pow":return iX(v,u,p,2);case"sqrt":return aX(v,u,p);default:return p[0]}};return[f(n,c),f(n,h),f(n,d)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=sr(this.options.maxSize),a=sr(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,l=s.size>0?Math.min(...s.values()):0;return n.forEach(u=>{var c;const h=this.assignSizeByCentrality(s.get(J(u))||0,l,o,a,i,this.options.scale),d=(c=this.context.element)===null||c===void 0?void 0:c.getElement(J(u)),f={size:h};this.assignLabelStyle(f,h,u,d),(!d||!ku(f,d.attributes))&&ar(t,d?"update":"add","node",Bn(u,{style:f}),!0)}),t}assignLabelStyle(t,e,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(t,Ra(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+nF(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const i=Math.min(...t)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(s,Math.max(i,a))}getCentralities(t){const{model:e}=this.context,n=e.getData();if(typeof t=="function")return t(n);const i=e.getRelatedEdgesData.bind(e);return hA(n,i,t)}}Bh.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class Fh extends da{constructor(t,e){super(t,Object.assign({},Fh.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=an(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(J(s)===J(this.ref))return;const l=fA(oe(an(s),e)),u=Math.abs(l)>Math.PI/2,c=!s.children||s.children.length===0,h=J(s),d=(o=this.context.element)===null||o===void 0?void 0:o.getElement(h);if(!d||!d.isVisible())return;const f=sr(n.getElementRenderStyle(h).size)[0]/2,v=(c?1:-1)*(f+this.options.offset),p=[["translate",v*Math.cos(l),v*Math.sin(l)],["rotate",u?Vn(l)+180:Vn(l)]];i.updateNodeData([{id:J(s),style:{labelTextAlign:u===c?"right":"left",labelTextBaseline:"middle",labelTransform:p}}])}),n.draw()}}Fh.defaultOptions={offset:5};const sX="quadratic",wO=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class zh extends da{constructor(t,e){super(t,Object.assign({},zh.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:l}}=n,{model:u}=this.context,c=new Map,h=(v,p)=>{u.getRelatedEdgesData(p).forEach(y=>!c.has(J(y))&&c.set(J(y),y))};a.forEach(h),o.forEach(h);const d=v=>{const p=u.getEdgeData().map(y=>NC(u,y));oX(v,p).forEach(y=>!c.has(J(y))&&c.set(J(y),y))};if(l.size&&l.forEach(d),i.size&&i.forEach(d),s.size){const v=GN(U1(u.getChanges())).update.edges;s.forEach(p=>{var g;d(p);const y=(g=v.find(m=>J(m.value)===J(p)))===null||g===void 0?void 0:g.original;y&&!ob(p,y)&&d(y)})}Kr(this.options.edges)||c.forEach((v,p)=>!this.options.edges.includes(p)&&c.delete(p));const f=u.getEdgeData().map(J);return new Map([...c].sort((v,p)=>f.indexOf(v[0])-f.indexOf(p[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=xO(i);s.forEach(l=>{l.forEach((u,c,h)=>{var d;const f=h.length,v=u.style||{};if(u.source===u.target){const y=wO.length;v.loopPlacement=wO[c%y],v.loopDist=Math.floor(c/y)*a+50}else if(f===1)v.curveOffset=0;else{const y=(c%2===0?1:-1)*(o[`${u.source}|${u.target}|${c}`]?-1:1);v.curveOffset=f%2===1?y*Math.ceil(c/2)*a*2:y*(Math.floor(c/2)*a*2+a)}const p=Object.assign(u,{type:sX,style:v}),g=(d=this.context.element)===null||d===void 0?void 0:d.getElement(J(u));(!g||!ku(p.style,g.attributes))&&ar(n,g?"update":"add","edge",p,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(J(n))||{};return Object.keys(a).forEach(s=>{Be(i[s],a[s])&&(n[s]?i[s]=n[s]:delete i[s])}),Object.assign(n,{style:i})},this.applyMergingStyle=(n,i)=>{const{edgeMap:a,reverses:s}=xO(i);a.forEach(o=>{var l;if(o.length===1){const c=o[0],h=(l=this.context.element)===null||l===void 0?void 0:l.getElement(J(c)),d=this.resetEdgeStyle(c);(!h||!ku(d,h.attributes))&&ar(n,h?"update":"add","edge",d);return}const u=o.map(({source:c,target:h,style:d={}},f)=>{const{startArrow:v,endArrow:p}=d,g={},[y,m]=s[`${c}|${h}|${f}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return Lu(v)&&(g[y]=v),Lu(p)&&(g[m]=p),g}).reduce((c,h)=>Object.assign(Object.assign({},c),h),{});o.forEach((c,h,d)=>{var f;if(h!==0){ar(n,"remove","edge",c);return}const v=Object.assign({},Ot(this.options.style)?this.options.style(d):this.options.style,{childrenData:d});this.cacheMergeStyle.set(J(c),v);const p=Object.assign(Object.assign({},c),{type:"line",style:Object.assign(Object.assign(Object.assign({},c.style),u),v)}),g=(f=this.context.element)===null||f===void 0?void 0:f.getElement(J(c));(!g||!ku(p.style,g.attributes))&&ar(n,g?"update":"add","edge",p,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return e.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}zh.defaultOptions={mode:"bundle",distance:15};const xO=r=>{const t=new Map,e=new Set,n={};for(const[i,a]of r){if(e.has(i))continue;const{source:s,target:o}=a,l=`${s}-${o}`;t.has(l)||t.set(l,[]),t.get(l).push(a),e.add(i);for(const[u,c]of r)e.has(u)||ob(a,c)&&(t.get(l).push(c),e.add(u),s===c.target&&o===c.source&&(n[`${c.source}|${c.target}|${t.get(l).length-1}`]=!0))}return{edgeMap:t,reverses:n}},oX=(r,t,e)=>t.filter(n=>ob(n,r)),ob=(r,t)=>{const{sourceNode:e,targetNode:n}=r.style||{},{sourceNode:i,targetNode:a}=t.style||{};return e===i&&n===a||e===a&&n===i};class lX extends da{beforeDraw(t,e){const{stage:n}=e;if(n==="visibility")return t;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=t,l=(u,c)=>{i.getRelatedEdgesData(c).forEach(d=>!s.has(J(d))&&s.set(J(d),d))};return a.forEach(l),o.forEach(l),t}}const uX={animation:{"combo-collapse":iA,"combo-expand":QB,"node-collapse":nA,"node-expand":ZB,"path-in":rA,"path-out":JB,fade:XB,translate:KB},behavior:{"brush-select":Jo,"click-select":bc,"collapse-expand":Pc,"create-edge":Nc,"drag-canvas":Cc,"drag-element-force":az,"drag-element":il,"fix-element-size":Ic,"focus-element":Dc,"hover-activate":Bc,"lasso-select":oz,"auto-adapt-label":pc,"optimize-viewport-transform":Fc,"scroll-canvas":zc,"zoom-canvas":jc},combo:{circle:i4,rect:a4},edge:{cubic:Va,line:VA,polyline:Tc,quadratic:nl,"cubic-horizontal":Mc,"cubic-radial":kc,"cubic-vertical":Oc},layout:{"antv-dagre":u8,"combo-combined":w9,"compact-box":iu.compactBox,"d3-force":U9,"force-atlas2":cW,circular:d8,concentric:wm,dagre:lh,dendrogram:iu.dendrogram,fishbone:uh,force:bP,fruchterman:fW,grid:vW,indented:iu.indented,mds:xP,mindmap:iu.mindmap,radial:_W,random:NW,snake:ch},node:{circle:el,diamond:o5,ellipse:Ec,hexagon:d5,html:Sc,image:FA,rect:n4,star:r4,donut:xc,triangle:_c},palette:{spectral:YW,tableau:HW,oranges:XW,greens:KW,blues:ZW},theme:{dark:OH,light:AH},plugin:{"bubble-sets":fh,"edge-bundling":vh,"edge-filter-lens":ph,"grid-line":bh,background:hh,contextmenu:gh,fisheye:yh,fullscreen:mh,history:wh,hull:xh,legend:Th,minimap:Ah,snapline:Ph,timebar:Nh,toolbar:Ch,tooltip:Rh,watermark:Lh},transform:{"arrange-draw-order":PH,"collapse-expand-combo":NH,"collapse-expand-node":CH,"get-edge-actual-ends":eX,"map-node-size":Bh,"place-radial-labels":Fh,"process-parallel-edges":zh,"update-related-edges":lX},shape:{circle:Ti,ellipse:Ho,group:on,html:Xo,image:d1,line:Da,path:rr,polygon:Ga,polyline:gc,rect:xn,text:Wa,label:la,badge:Ls}};function cX(){Object.entries(uX).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{AC(r,e,n)})})}cX();const Mo=class Mo extends nl{onCreate(){this.shapeMap.key.animate([{lineDashOffset:Mo.lineDashGap*2},{lineDashOffset:0}],{duration:500,iterations:1/0,delay:0})}};he(Mo,"tyoe","ant-quadratic"),he(Mo,"lineDashGap",5);let Ca=Mo;AC(Ts.EDGE,Ca.tyoe,Ca,!0);const mX=JC({__name:"TrackGraph",props:{nodes:{},queryResult:{},showUnitResults:{},filterUnitResults:{}},setup(r){const t=r,e=QC(),n=g=>t.nodes[g],i=Us(()=>vR(t.queryResult.unitResults.asJsReadonlyArrayView().flatMap(g=>g.context.toArray()),g=>g.id)),a=Us(()=>KC(t.nodes,i.value)),s=g=>({id:g.id.toString(),children:a.value.getChildren(g).map(s)}),o=Us(()=>tX(s(a.value.topNode))),l=g=>a.value.getChildren(g).length>0,u=Us(()=>{const g={},y={},m=P=>{const N=`#${P.source.id}-${P.target.id}`,C=g[N]||0;g[N]=C+1;const L=N+(C>0?`-${C}`:"");return y[L]=P,{id:L,source:String(P.source.id),target:String(P.target.id)}},E=t.showUnitResults.map(P=>({result:P,pathList:P.getNodeConnectPath(iR).asJsReadonlyArrayView().concat()})).map(({result:P,pathList:N})=>{const C=N.map(L=>m(L));return{result:P,edgeGroup:C}}),_=E.flatMap(P=>P.edgeGroup),k=P=>y[P.id].formatConnectOffset,T=P=>E.findIndex(N=>N.edgeGroup.some(C=>C.id===P.id));return{groupList:E,edgeList:_,getLabel:k,getColor:P=>{const N=t.showUnitResults.indexOf(E[T(P)].result);return hb[N%hb.length]},getGroupIndex:T}}),c=g=>{var y;return((y=g.id)==null?void 0:y[0])==="#"},h=(g,y,m,w)=>Math.sqrt(Math.pow(Math.abs(g-m),2)+Math.pow(Math.abs(y-w),2)),d=(g,y)=>{var E,_,k,T;const m=g.getNodeData(y.source),w=g.getNodeData(y.target);return h(((E=m.style)==null?void 0:E.x)||0,((_=m.style)==null?void 0:_.y)||0,((k=w.style)==null?void 0:k.x)||0,((T=w.style)==null?void 0:T.y)||0)},f=/\d+/,v=tR();eR(()=>{v.value&&v.value.destroy()}),db(e,async()=>{if(!e.value)return;const g=new Dh({container:e.value,data:o.value,autoFit:"view",padding:[24,48],animation:!1,node:{type(y){const m=n(y.id);return l(m)?"triangle":"rect"},style(y){const m=n(y.id),w=t.queryResult.target.id===m.id,E=a.value.isPlaceholder(m),_=ZC(m);return{size:l(m)?4:1,direction:l(m)?"down":void 0,fill:l(m)?"#767C82":"#E3E3E3",pointerEvents:"none",labelPlacement:"right",labelText:a.value.getLabel(m),labelOffsetX:2,labelFontWeight:_&&!E?"bold":void 0,labelOpacity:E?.5:void 0,labelPointerEvents:"none",labelStroke:w?"#0FF":void 0}}},edge:{type(y){return c(y)?Ca.tyoe:"polyline"},style(y){if(c(y)){const m=d(g,y),w=u.value.getLabel(y),E=w.match(f);return{curveOffset:30*(Number(y.source)>Number(y.target)?1:-1),stroke:u.value.getColor(y)||"#FF7FFF",zIndex:1+u.value.getGroupIndex(y),pointerEvents:"none",endArrow:!0,endArrowOpacity:.5,endArrowPointerEvents:"none",labelText:w,labelFill:"#F00",labelFontSize:E&&m<50?8:12,labelBackground:!0,labelBackgroundStroke:"#FF00FF",labelPadding:E?[0,1,-2,0]:[0,0,-1,0],labelBackgroundLineWidth:1,labelBackgroundRadius:2,labelBackgroundPointerEvents:"none",labelOffsetX:m<50?-5:0,labelPointerEvents:"none",lineDash:[Ca.lineDashGap,Ca.lineDashGap]}}return{router:{type:"orth"},stroke:"#E3E3E3",pointerEvents:"none"}}},layout:{type:"indented",direction:"LR",indent:20,getHeight:()=>0},behaviors:["drag-canvas","zoom-canvas"]});await g.render(),v.value=g});const p=Us(()=>{const g=t.filterUnitResults;return g!=null&&g.length?u.value.groupList.filter(y=>g.includes(y.result)).flatMap(y=>y.edgeGroup):[]});return db([v,p],async([g,y],[m,w])=>{if(g){if(y!==w){const E=w.filter(k=>!y.some(T=>T.id===k.id)),_=y.filter(k=>!w.some(T=>T.id===k.id));if(!E.length&&!_.length)return;g.removeEdgeData(E.map(k=>k.id)),await g.draw(),g.addEdgeData(_)}else g.addEdgeData(y);await g.draw()}}),(g,y)=>(rR(),nR("div",{class:"TrackGraph",ref_key:"el",ref:e},null,512))}});export{mX as default};
134
- //# sourceMappingURL=TrackGraph-lKQE5cUJ.js.map